com.apama.util
Class TimestampSet

java.lang.Object
  extended by com.apama.util.TimestampSet
All Implemented Interfaces:
java.lang.Iterable<java.util.Map.Entry<java.lang.Integer,java.lang.Double>>, java.util.Map<java.lang.Integer,java.lang.Double>

public class TimestampSet
extends java.lang.Object
implements java.lang.Iterable<java.util.Map.Entry<java.lang.Integer,java.lang.Double>>, java.util.Map<java.lang.Integer,java.lang.Double>

Represents a set of high-accuracy timestamps, used for latency measurement.

The timestamp set is represented as a dictionary of integer-float pairs, where the integer index refers to the location at which the timestamp was added and the floating-point time gives the time at which an event was there.

The class provides methods for constructing, manipulating and querying the contents of the timestamp set.

Note that this class is NOT itself thread-safe.

This class defines a number of constants for representing different points in the journey of an event/message through the layers of the IAF, which can be enabled by setting the relevant recordUpstream/recordDownstream configuration setting. The most commonly used timestamps are:


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
static int AP_TIMESTAMP_DOWNSTREAM_CLIENT_MAX
           
static int AP_TIMESTAMP_DOWNSTREAM_CLIENT_MIN
           
static int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_APPLICATION_MAX
           
static int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_APPLICATION_MIN
           
static int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_INPUT_MAX
           
static int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_INPUT_MIN
           
static int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_MAX
           
static int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_MIN
           
static int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_OUTPUT_MAX
           
static int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_OUTPUT_MIN
           
static int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_RESERVED1_MAX
           
static int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_RESERVED1_MIN
           
static int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_RESERVED2_MAX
           
static int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_RESERVED2_MIN
           
static int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_SERVICE_MONITOR_MAX
           
static int AP_TIMESTAMP_DOWNSTREAM_CORRELATOR_SERVICE_MONITOR_MIN
           
static int AP_TIMESTAMP_DOWNSTREAM_IAF_APAMA_ENTRY
          Not currently implemented, do not use.
static int AP_TIMESTAMP_DOWNSTREAM_IAF_APAMA_EXIT
          Not currently implemented, do not use.
static int AP_TIMESTAMP_DOWNSTREAM_IAF_DECODER_ENTRY
          Optionally implemented by a codec, represents the time a message from the transport enters the codec.
static 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).
static int AP_TIMESTAMP_DOWNSTREAM_IAF_MAPPER_ENTRY
          Represents the time a normalised event enters the semantic mapper before being sent to the Correlator.
static int AP_TIMESTAMP_DOWNSTREAM_IAF_MAPPER_EXIT
          Represents the time a normalised event leaves the semantic mapper before being sent to the Correlator.
static int AP_TIMESTAMP_DOWNSTREAM_IAF_MAX
           
static int AP_TIMESTAMP_DOWNSTREAM_IAF_MIN
           
static 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.
static int AP_TIMESTAMP_DOWNSTREAM_IAF_TRANSPORT_EXIT
          Optionally implemented by a transport, represents the time a message leaves the transport.
static int AP_TIMESTAMP_DOWNSTREAM_MERGE_MAX
           
static int AP_TIMESTAMP_DOWNSTREAM_MERGER_MIN
           
static int AP_TIMESTAMP_DOWNSTREAM_SENDER_MAX
           
static int AP_TIMESTAMP_DOWNSTREAM_SENDER_MIN
           
static int AP_TIMESTAMP_UPSTREAM_CLIENT_MAX
           
static int AP_TIMESTAMP_UPSTREAM_CLIENT_MIN
           
static int AP_TIMESTAMP_UPSTREAM_CORRELATOR_APPLICATION_MAX
           
static int AP_TIMESTAMP_UPSTREAM_CORRELATOR_APPLICATION_MIN
           
static int AP_TIMESTAMP_UPSTREAM_CORRELATOR_INPUT_MAX
           
static int AP_TIMESTAMP_UPSTREAM_CORRELATOR_INPUT_MIN
           
static int AP_TIMESTAMP_UPSTREAM_CORRELATOR_MAX
           
static int AP_TIMESTAMP_UPSTREAM_CORRELATOR_MIN
           
static int AP_TIMESTAMP_UPSTREAM_CORRELATOR_OUTPUT_MAX
           
static int AP_TIMESTAMP_UPSTREAM_CORRELATOR_OUTPUT_MIN
           
static int AP_TIMESTAMP_UPSTREAM_CORRELATOR_RESERVED1_MAX
           
static int AP_TIMESTAMP_UPSTREAM_CORRELATOR_RESERVED1_MIN
           
static int AP_TIMESTAMP_UPSTREAM_CORRELATOR_RESERVED2_MAX
           
static int AP_TIMESTAMP_UPSTREAM_CORRELATOR_RESERVED2_MIN
           
static int AP_TIMESTAMP_UPSTREAM_CORRELATOR_SERVICE_MONITOR_MAX
           
static int AP_TIMESTAMP_UPSTREAM_CORRELATOR_SERVICE_MONITOR_MIN
           
static int AP_TIMESTAMP_UPSTREAM_IAF_APAMA_ENTRY
          Not currently implemented, do not use.
static int AP_TIMESTAMP_UPSTREAM_IAF_APAMA_EXIT
          Not currently implemented, do not use.
static 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.
static int AP_TIMESTAMP_UPSTREAM_IAF_ENCODER_EXIT
          Optionally implemented by a codec, represents the time a normalised event leaves the codec.
static int AP_TIMESTAMP_UPSTREAM_IAF_MAPPER_ENTRY
          Represents the time an Apama event from the Correlator enters the semantic mapper.
static int AP_TIMESTAMP_UPSTREAM_IAF_MAPPER_EXIT
          Represents the time an Apama event from the Correlator leaves the semantic mapper.
static int AP_TIMESTAMP_UPSTREAM_IAF_MAX
           
static int AP_TIMESTAMP_UPSTREAM_IAF_MIN
           
static int AP_TIMESTAMP_UPSTREAM_IAF_TRANSPORT_ENTRY
          Optionally implemented by a transport, represents the time a message from the codec enters the transport.
static 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.
static int AP_TIMESTAMP_UPSTREAM_MERGER_MAX
           
static int AP_TIMESTAMP_UPSTREAM_MERGER_MIN
           
static int AP_TIMESTAMP_UPSTREAM_SENDER_MAX
           
static int AP_TIMESTAMP_UPSTREAM_SENDER_MIN
           
 
Constructor Summary
TimestampSet()
          Constructs a new TimestampSet, initially empty.
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 Summary
 void addNow(java.lang.Integer index)
          Add a new index-time pair to the event.
 void addTime(java.lang.Integer index, java.lang.Double theTime)
          Add a new index-time pair to the timestamp.
 void clear()
          Removes all mappings from this map.
 boolean containsKey(java.lang.Object index)
          Returns true if this map contains the specified key
 boolean containsValue(java.lang.Object time)
          Returns true if this map maps one or more names to the specified time.
 java.util.Set<java.util.Map.Entry<java.lang.Integer,java.lang.Double>> entrySet()
           
 java.lang.Double findTime(java.lang.Integer index)
          Search for a named element in the timestamp set and return its time.
 java.lang.Double findTimeAndRemove(java.lang.Integer index)
          Search for a named element in the timestamp set and return its time.
 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.
static double getMicroTime()
          Get the current microsecond-accurate relative timestamp.
 boolean isEmpty()
          Returns true if this map contains no index-time mappings.
 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.
 java.util.Set<java.lang.Integer> keySet()
           
 java.lang.Double put(java.lang.Integer index, java.lang.Double time)
          Adds or replaces the specified (index,time) pair in the underlying map
 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.
 java.lang.Double remove(java.lang.Object index)
          Removes the mapping for this index from this map if present.
 void replace(java.lang.Integer index, java.lang.Double newTime)
          Change the time of a specified timestamp in the timestamp set.
 void replaceWithNow(java.lang.Integer index)
          Change the time of a specified timestamp in the timestamp set.
 int size()
          Get the number of elements (name-time pairs) currently stored by the event.
 java.lang.String toString()
          Return a printable string representation of the timestamp set.
 java.util.Collection<java.lang.Double> values()
          Returns a collection view of the times contained in this map.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

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

public void replace(java.lang.Integer index,
                    java.lang.Double newTime)
             throws TimestampSetException
Change the time of a specified timestamp in the timestamp set. If a timestamp with the given index already exists, its time will be replaced with a copy of the given time. Otherwise, a new element is created just as though addTime() had been called.

Parameters:
index - The name of the element to be updated
newTime - The new time for the named element
Throws:
TimestampSetException - Thrown if index=null

replaceWithNow

public void replaceWithNow(java.lang.Integer index)
                    throws TimestampSetException
Change the time of a specified timestamp in the timestamp set. If a timestamp with the given index already exists, its time will be replaced with the current (relative) time. Otherwise, a new element is created just as though addNow() had been called.

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


Submit a bug or feature
Copyright (c) 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors. Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG