Class TimestampSet

    • Field Detail

      • AP_TIMESTAMP_DOWNSTREAM_IAF_MIN

        public static final int AP_TIMESTAMP_DOWNSTREAM_IAF_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_IAF_TRANSPORT_ENTRY

        public static final int AP_TIMESTAMP_DOWNSTREAM_IAF_TRANSPORT_ENTRY
        Optionally implemented by a transport, represents the time a message from the external system is received by the transport.
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_IAF_TRANSPORT_EXIT

        public static final int AP_TIMESTAMP_DOWNSTREAM_IAF_TRANSPORT_EXIT
        Optionally implemented by a transport, represents the time a message leaves the transport.
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_IAF_DECODER_ENTRY

        public static final int AP_TIMESTAMP_DOWNSTREAM_IAF_DECODER_ENTRY
        Optionally implemented by a codec, represents the time a message from the transport enters the codec.
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_IAF_DECODER_EXIT

        public static final int AP_TIMESTAMP_DOWNSTREAM_IAF_DECODER_EXIT
        Optionally implemented by a codec, represents the time a normalised event leaves the codec (for the semantic mapper).
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_IAF_MAPPER_ENTRY

        public static final int AP_TIMESTAMP_DOWNSTREAM_IAF_MAPPER_ENTRY
        Represents the time a normalised event enters the semantic mapper before being sent to the Correlator.
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_IAF_MAPPER_EXIT

        public static final int AP_TIMESTAMP_DOWNSTREAM_IAF_MAPPER_EXIT
        Represents the time a normalised event leaves the semantic mapper before being sent to the Correlator.
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_IAF_APAMA_ENTRY

        public static final int AP_TIMESTAMP_DOWNSTREAM_IAF_APAMA_ENTRY
        Not currently implemented, do not use.
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_IAF_APAMA_EXIT

        public static final int AP_TIMESTAMP_DOWNSTREAM_IAF_APAMA_EXIT
        Not currently implemented, do not use.
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_IAF_MAX

        public static final int AP_TIMESTAMP_DOWNSTREAM_IAF_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_SENDER_MIN

        public static final int AP_TIMESTAMP_DOWNSTREAM_SENDER_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_SENDER_MAX

        public static final int AP_TIMESTAMP_DOWNSTREAM_SENDER_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_MIN

        public static final int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_INPUT_MIN

        public static final int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_INPUT_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_INPUT_MAX

        public static final int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_INPUT_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_SERVICE_MONITOR_MIN

        public static final int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_SERVICE_MONITOR_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_SERVICE_MONITOR_MAX

        public static final int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_SERVICE_MONITOR_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_RESERVED1_MIN

        public static final int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_RESERVED1_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_RESERVED1_MAX

        public static final int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_RESERVED1_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_RESERVED2_MIN

        public static final int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_RESERVED2_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_RESERVED2_MAX

        public static final int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_RESERVED2_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_APPLICATION_MIN

        public static final int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_APPLICATION_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_APPLICATION_MAX

        public static final int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_APPLICATION_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_OUTPUT_MIN

        public static final int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_OUTPUT_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_OUTPUT_MAX

        public static final int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_OUTPUT_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_MAX

        public static final int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_MERGER_MIN

        public static final int AP_TIMESTAMP_DOWNSTREAM_MERGER_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_MERGE_MAX

        public static final int AP_TIMESTAMP_DOWNSTREAM_MERGE_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_CLIENT_MIN

        public static final int AP_TIMESTAMP_DOWNSTREAM_CLIENT_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_DOWNSTREAM_CLIENT_MAX

        public static final int AP_TIMESTAMP_DOWNSTREAM_CLIENT_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_CLIENT_MIN

        public static final int AP_TIMESTAMP_UPSTREAM_CLIENT_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_CLIENT_MAX

        public static final int AP_TIMESTAMP_UPSTREAM_CLIENT_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_SENDER_MIN

        public static final int AP_TIMESTAMP_UPSTREAM_SENDER_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_SENDER_MAX

        public static final int AP_TIMESTAMP_UPSTREAM_SENDER_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_CORRELATOR_MIN

        public static final int AP_TIMESTAMP_UPSTREAM_CORRELATOR_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_CORRELATOR_INPUT_MIN

        public static final int AP_TIMESTAMP_UPSTREAM_CORRELATOR_INPUT_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_CORRELATOR_INPUT_MAX

        public static final int AP_TIMESTAMP_UPSTREAM_CORRELATOR_INPUT_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_CORRELATOR_APPLICATION_MIN

        public static final int AP_TIMESTAMP_UPSTREAM_CORRELATOR_APPLICATION_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_CORRELATOR_APPLICATION_MAX

        public static final int AP_TIMESTAMP_UPSTREAM_CORRELATOR_APPLICATION_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_CORRELATOR_RESERVED2_MIN

        public static final int AP_TIMESTAMP_UPSTREAM_CORRELATOR_RESERVED2_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_CORRELATOR_RESERVED2_MAX

        public static final int AP_TIMESTAMP_UPSTREAM_CORRELATOR_RESERVED2_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_CORRELATOR_RESERVED1_MIN

        public static final int AP_TIMESTAMP_UPSTREAM_CORRELATOR_RESERVED1_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_CORRELATOR_RESERVED1_MAX

        public static final int AP_TIMESTAMP_UPSTREAM_CORRELATOR_RESERVED1_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_CORRELATOR_SERVICE_MONITOR_MIN

        public static final int AP_TIMESTAMP_UPSTREAM_CORRELATOR_SERVICE_MONITOR_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_CORRELATOR_SERVICE_MONITOR_MAX

        public static final int AP_TIMESTAMP_UPSTREAM_CORRELATOR_SERVICE_MONITOR_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_CORRELATOR_OUTPUT_MIN

        public static final int AP_TIMESTAMP_UPSTREAM_CORRELATOR_OUTPUT_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_CORRELATOR_OUTPUT_MAX

        public static final int AP_TIMESTAMP_UPSTREAM_CORRELATOR_OUTPUT_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_CORRELATOR_MAX

        public static final int AP_TIMESTAMP_UPSTREAM_CORRELATOR_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_MERGER_MIN

        public static final int AP_TIMESTAMP_UPSTREAM_MERGER_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_MERGER_MAX

        public static final int AP_TIMESTAMP_UPSTREAM_MERGER_MAX
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_IAF_MIN

        public static final int AP_TIMESTAMP_UPSTREAM_IAF_MIN
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_IAF_APAMA_ENTRY

        public static final int AP_TIMESTAMP_UPSTREAM_IAF_APAMA_ENTRY
        Not currently implemented, do not use.
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_IAF_APAMA_EXIT

        public static final int AP_TIMESTAMP_UPSTREAM_IAF_APAMA_EXIT
        Not currently implemented, do not use.
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_IAF_MAPPER_ENTRY

        public static final int AP_TIMESTAMP_UPSTREAM_IAF_MAPPER_ENTRY
        Represents the time an Apama event from the Correlator enters the semantic mapper.
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_IAF_MAPPER_EXIT

        public static final int AP_TIMESTAMP_UPSTREAM_IAF_MAPPER_EXIT
        Represents the time an Apama event from the Correlator leaves the semantic mapper.
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_IAF_ENCODER_ENTRY

        public static final int AP_TIMESTAMP_UPSTREAM_IAF_ENCODER_ENTRY
        Optionally implemented by a codec, represents the time a normalised event from the semantic mapper enters the codec.
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_IAF_ENCODER_EXIT

        public static final int AP_TIMESTAMP_UPSTREAM_IAF_ENCODER_EXIT
        Optionally implemented by a codec, represents the time a normalised event leaves the codec.
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_IAF_TRANSPORT_ENTRY

        public static final int AP_TIMESTAMP_UPSTREAM_IAF_TRANSPORT_ENTRY
        Optionally implemented by a transport, represents the time a message from the codec enters the transport.
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_IAF_TRANSPORT_EXIT

        public static final int AP_TIMESTAMP_UPSTREAM_IAF_TRANSPORT_EXIT
        Optionally implemented by a transport, represents the time a message leaves the transport and is to sent to the external system.
        See Also:
        Constant Field Values
      • AP_TIMESTAMP_UPSTREAM_IAF_MAX

        public static final int AP_TIMESTAMP_UPSTREAM_IAF_MAX
        See Also:
        Constant Field Values
    • Constructor Detail

      • TimestampSet

        public TimestampSet()
        Constructs a new TimestampSet, initially empty.
      • TimestampSet

        public TimestampSet​(java.util.Map<java.lang.Integer,​java.lang.Double> m)
        Constructs a new TimestampSet, with the same name/time pairs as the specified Map or TimestampSet.
    • Method Detail

      • size

        public int size()
        Get the number of elements (name-time pairs) currently stored by the event.
        Specified by:
        size in interface java.util.Map<java.lang.Integer,​java.lang.Double>
        Returns:
        The number of elements in the event
      • addNow

        public void addNow​(java.lang.Integer index)
                    throws TimestampSetException
        Add a new index-time pair to the event. The pair will have the current (relative) time. If a timestamp with the same index already exists, it will NOT be overwritten.

        Parameters:
        index - The name of the new element
        Throws:
        TimestampSetException - Thrown if index=null
      • addTime

        public void addTime​(java.lang.Integer index,
                            java.lang.Double theTime)
                     throws TimestampSetException
        Add a new index-time pair to the timestamp. The given index and time will be copied into the timestamp. If a timestamp with the same index already exists, it will NOT be overwritten.
        Parameters:
        index - The index of the new element
        theTime - The time of the new element
        Throws:
        TimestampSetException - Thrown if index=null
      • replace

        @Deprecated
        public java.lang.Double replace​(java.lang.Integer index,
                                        java.lang.Double newTime)
                                 throws TimestampSetException
        Deprecated.
        This method has been deprecated to avoid confusion with Map.replace; please update code to use put(Integer, Double) instead.
        Identical to put(Integer, Double).

        This method does not have the same semantics as the new Map.replace method introduced in Java 1.8, and has therefore been deprecated to avoid confusion.

        Specified by:
        replace in interface java.util.Map<java.lang.Integer,​java.lang.Double>
        Throws:
        TimestampSetException
      • replaceWithNow

        @Deprecated
        public void replaceWithNow​(java.lang.Integer index)
                            throws TimestampSetException
        Deprecated.
        This method has been deprecated to avoid confusion with Map.replace; please update code to use putNow(Integer) instead.
        Identical to putNow(Integer).

        This method does not have the same semantics as the new Map.replace method introduced in Java 1.8, and has therefore been deprecated to avoid confusion.

        Throws:
        TimestampSetException
      • putNow

        public void putNow​(java.lang.Integer index)
                    throws TimestampSetException
        Set the time of a specified timestamp in the timestamp set to current time, regardless of whether a timestamp with the given index already exists.
        Parameters:
        index - The name of the element to be updated
        Throws:
        TimestampSetException - Thrown if index=null
      • findTime

        public java.lang.Double findTime​(java.lang.Integer index)
        Search for a named element in the timestamp set and return its time.
        Parameters:
        index - The element name to search for
        Returns:
        The time associated with the given name, or null if no matching element could be found. Note that this function cannot distinguish between an element with a missing time and an element that does not exist - null will be returned in either case.
      • findTimeAndRemove

        public java.lang.Double findTimeAndRemove​(java.lang.Integer index)
        Search for a named element in the timestamp set and return its time. If found, the element will also be removed from the event.
        Parameters:
        index - The element name to search for
        Returns:
        The time associated with the given name, or null if no matching element could be found. If the element was found, it will be deleted from the event. Note that this function cannot distinguish between an element with a missing time and an element that does not exist - null will be returned in either case.
      • toString

        public java.lang.String toString()
        Return a printable string representation of the timestamp set.
        Overrides:
        toString in class java.lang.Object
        Returns:
        Printable string representation of the timestamp set. The time returned may differ between implementations, and is not the same as the time returned by the C implementation of this class.
      • iterator

        public java.util.Iterator<java.util.Map.Entry<java.lang.Integer,​java.lang.Double>> iterator()
        Returns a standard Java Iterator over the contents of the TimestampSet using Map.Entry objects. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation, or through the setTime operation on a map entry returned by the iterator) the results of the iteration are undefined.

        Instead of calling this method directly, it may be easier to use the following construction: for (Map.Entry element: TimestampSet) { ... }

        Specified by:
        iterator in interface java.lang.Iterable<java.util.Map.Entry<java.lang.Integer,​java.lang.Double>>
        Returns:
        An iterator over the contents of the TimestampSet.
      • put

        public java.lang.Double put​(java.lang.Integer index,
                                    java.lang.Double time)
                             throws TimestampSetException
        Adds or replaces the specified (index,time) pair in the underlying map
        Specified by:
        put in interface java.util.Map<java.lang.Integer,​java.lang.Double>
        Parameters:
        index - Any string
        time - Any string or null
        Returns:
        Previous time associated with index (which could be null), or null if the index did not exist
        Throws:
        TimestampSetException - If index=null
        See Also:
        Map.put(Object, Object)
      • entrySet

        public java.util.Set<java.util.Map.Entry<java.lang.Integer,​java.lang.Double>> entrySet()
        Specified by:
        entrySet in interface java.util.Map<java.lang.Integer,​java.lang.Double>
        Returns:
        A set view of the (index,time) pairs making up the TimestampSet.
        See Also:
        Map.entrySet()
      • keySet

        public java.util.Set<java.lang.Integer> keySet()
        Specified by:
        keySet in interface java.util.Map<java.lang.Integer,​java.lang.Double>
        Returns:
        A set view of the indices of the TimestampSet.
        See Also:
        Map.keySet()
      • clear

        public void clear()
        Removes all mappings from this map.
        Specified by:
        clear in interface java.util.Map<java.lang.Integer,​java.lang.Double>
        See Also:
        Map.clear()
      • containsKey

        public boolean containsKey​(java.lang.Object index)
        Returns true if this map contains the specified key
        Specified by:
        containsKey in interface java.util.Map<java.lang.Integer,​java.lang.Double>
        Parameters:
        index - The key whose presence in this map is to be tested
        Returns:
        true if this map contains the key
        See Also:
        Map.containsKey(Object)
      • containsValue

        public boolean containsValue​(java.lang.Object time)
        Returns true if this map maps one or more names to the specified time.
        Specified by:
        containsValue in interface java.util.Map<java.lang.Integer,​java.lang.Double>
        Parameters:
        time - time whose presence in this map is to be tested.
        Returns:
        true if this map maps one or more names to the specified time.
        See Also:
        Map.containsValue(Object)
      • get

        public java.lang.Double get​(java.lang.Object index)
        Returns the time to which the specified name is mapped, or null if the map contains no mapping for this index. A return time of null does not necessarily indicate that the map contains no mapping for the index; it is also possible that the map explicitly maps the index to null. The containsIndex method may be used to distinguish these two cases.
        Specified by:
        get in interface java.util.Map<java.lang.Integer,​java.lang.Double>
        Parameters:
        index - the index whose associated time is to be returned.
        Returns:
        the time to which this map maps the specified index, or null if the map contains no mapping for this index.
        See Also:
        Map.put(Object, Object), Map.get(Object)
      • isEmpty

        public boolean isEmpty()
        Returns true if this map contains no index-time mappings.
        Specified by:
        isEmpty in interface java.util.Map<java.lang.Integer,​java.lang.Double>
        Returns:
        true if this map contains no index-time mappings.
        See Also:
        Map.isEmpty()
      • putAll

        public void putAll​(java.util.Map<? extends java.lang.Integer,​? extends java.lang.Double> m)
        Copies all of the mappings from the specified map to this map These mappings will replace any mappings that this map had for any of the indices currently in the specified map.
        Specified by:
        putAll in interface java.util.Map<java.lang.Integer,​java.lang.Double>
        Parameters:
        m - mappings to be stored in this map.
        Throws:
        java.lang.NullPointerException - if the specified map is null.
        See Also:
        Map.putAll(Map)
      • remove

        public java.lang.Double remove​(java.lang.Object index)
        Removes the mapping for this index from this map if present.
        Specified by:
        remove in interface java.util.Map<java.lang.Integer,​java.lang.Double>
        Parameters:
        index - index whose mapping is to be removed from the map.
        Returns:
        previous time associated with specified index, or null if there was no mapping for index. A null return can also indicate that the map previously associated null with the specified index.
        See Also:
        Map.remove(Object)
      • values

        public java.util.Collection<java.lang.Double> values()
        Returns a collection view of the times contained in this map.
        Specified by:
        values in interface java.util.Map<java.lang.Integer,​java.lang.Double>
        Returns:
        a collection view of the times contained in this map.
        See Also:
        Map.values()
      • getMicroTime

        public static double getMicroTime()
        Get the current microsecond-accurate relative timestamp.
        Returns:
        The current timestamp