backtype.storm.tuple
Class TupleImpl

java.lang.Object
  extended by AFn
      extended by backtype.storm.utils.IndifferentAccessMap
          extended by backtype.storm.tuple.TupleImpl
All Implemented Interfaces:
Tuple, java.util.Map

public class TupleImpl
extends IndifferentAccessMap
implements Tuple


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class backtype.storm.utils.IndifferentAccessMap
_map
 
Constructor Summary
TupleImpl(GeneralTopologyContext context, java.util.List<java.lang.Object> values, int taskId, java.lang.String streamId)
           
TupleImpl(GeneralTopologyContext context, java.util.List<java.lang.Object> values, int taskId, java.lang.String streamId, MessageId id)
           
 
Method Summary
 boolean contains(java.lang.String field)
          Returns true if this tuple contains the specified name of the field.
 int count()
           
 boolean equals(java.lang.Object other)
           
 int fieldIndex(java.lang.String field)
          Returns the position of the specified field in this tuple.
 long getAckVal()
           
 byte[] getBinary(int i)
          Returns the byte array at position i in the tuple.
 byte[] getBinaryByField(java.lang.String field)
           
 java.lang.Boolean getBoolean(int i)
          Returns the Boolean at position i in the tuple.
 java.lang.Boolean getBooleanByField(java.lang.String field)
           
 java.lang.Byte getByte(int i)
          Returns the Byte at position i in the tuple.
 java.lang.Byte getByteByField(java.lang.String field)
           
 java.lang.Double getDouble(int i)
          Returns the Double at position i in the tuple.
 java.lang.Double getDoubleByField(java.lang.String field)
           
 Fields getFields()
          Gets the names of the fields in this tuple.
 java.lang.Float getFloat(int i)
          Returns the Float at position i in the tuple.
 java.lang.Float getFloatByField(java.lang.String field)
           
 java.lang.Integer getInteger(int i)
          Returns the Integer at position i in the tuple.
 java.lang.Integer getIntegerByField(java.lang.String field)
           
 java.lang.Long getLong(int i)
          Returns the Long at position i in the tuple.
 java.lang.Long getLongByField(java.lang.String field)
           
 IPersistentMap getMap()
           
 MessageId getMessageId()
          Gets the message id that associated with this tuple.
 java.lang.Long getSampleStartTime()
           
 java.lang.Short getShort(int i)
          Returns the Short at position i in the tuple.
 java.lang.Short getShortByField(java.lang.String field)
           
 java.lang.String getSourceComponent()
          Gets the id of the component that created this tuple.
 GlobalStreamId getSourceGlobalStreamid()
          Returns the global stream id (component + stream) of this tuple.
 java.lang.String getSourceStreamId()
          Gets the id of the stream that this tuple was emitted to.
 int getSourceTask()
          Gets the id of the task that created this tuple.
 java.lang.String getString(int i)
          Returns the String at position i in the tuple.
 java.lang.String getStringByField(java.lang.String field)
           
 java.lang.Object getValue(int i)
          Gets the field at position i in the tuple.
 java.lang.Object getValueByField(java.lang.String field)
           
 java.util.List<java.lang.Object> getValues()
          Gets all the values in this tuple.
 int hashCode()
           
 IPersistentMap meta()
           
 java.lang.Object nth(int i)
           
 java.lang.Object nth(int i, java.lang.Object notfound)
           
 java.util.List<java.lang.Object> select(Fields selector)
          Returns a subset of the tuple based on the fields selector.
 ISeq seq()
           
 void setSampleStartTime(long ms)
           
 int size()
          Returns the number of fields in this tuple.
 java.lang.String toString()
           
 void updateAckVal(long val)
           
 java.lang.Object valAt(java.lang.Object o)
           
 
Methods inherited from class backtype.storm.utils.IndifferentAccessMap
assoc, assocEx, clear, cons, containsKey, containsValue, empty, entryAt, entrySet, equiv, get, invoke, invoke, isEmpty, iterator, keySet, put, putAll, remove, setMap, valAt, values, without
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TupleImpl

public TupleImpl(GeneralTopologyContext context,
                 java.util.List<java.lang.Object> values,
                 int taskId,
                 java.lang.String streamId,
                 MessageId id)

TupleImpl

public TupleImpl(GeneralTopologyContext context,
                 java.util.List<java.lang.Object> values,
                 int taskId,
                 java.lang.String streamId)
Method Detail

setSampleStartTime

public void setSampleStartTime(long ms)

getSampleStartTime

public java.lang.Long getSampleStartTime()

updateAckVal

public void updateAckVal(long val)

getAckVal

public long getAckVal()

size

public int size()
Description copied from interface: Tuple
Returns the number of fields in this tuple.

Specified by:
size in interface Tuple
Specified by:
size in interface java.util.Map
Overrides:
size in class IndifferentAccessMap

fieldIndex

public int fieldIndex(java.lang.String field)
Description copied from interface: Tuple
Returns the position of the specified field in this tuple.

Specified by:
fieldIndex in interface Tuple

contains

public boolean contains(java.lang.String field)
Description copied from interface: Tuple
Returns true if this tuple contains the specified name of the field.

Specified by:
contains in interface Tuple

getValue

public java.lang.Object getValue(int i)
Description copied from interface: Tuple
Gets the field at position i in the tuple. Returns object since tuples are dynamically typed.

Specified by:
getValue in interface Tuple

getString

public java.lang.String getString(int i)
Description copied from interface: Tuple
Returns the String at position i in the tuple. If that field is not a String, you will get a runtime error.

Specified by:
getString in interface Tuple

getInteger

public java.lang.Integer getInteger(int i)
Description copied from interface: Tuple
Returns the Integer at position i in the tuple. If that field is not an Integer, you will get a runtime error.

Specified by:
getInteger in interface Tuple

getLong

public java.lang.Long getLong(int i)
Description copied from interface: Tuple
Returns the Long at position i in the tuple. If that field is not a Long, you will get a runtime error.

Specified by:
getLong in interface Tuple

getBoolean

public java.lang.Boolean getBoolean(int i)
Description copied from interface: Tuple
Returns the Boolean at position i in the tuple. If that field is not a Boolean, you will get a runtime error.

Specified by:
getBoolean in interface Tuple

getShort

public java.lang.Short getShort(int i)
Description copied from interface: Tuple
Returns the Short at position i in the tuple. If that field is not a Short, you will get a runtime error.

Specified by:
getShort in interface Tuple

getByte

public java.lang.Byte getByte(int i)
Description copied from interface: Tuple
Returns the Byte at position i in the tuple. If that field is not a Byte, you will get a runtime error.

Specified by:
getByte in interface Tuple

getDouble

public java.lang.Double getDouble(int i)
Description copied from interface: Tuple
Returns the Double at position i in the tuple. If that field is not a Double, you will get a runtime error.

Specified by:
getDouble in interface Tuple

getFloat

public java.lang.Float getFloat(int i)
Description copied from interface: Tuple
Returns the Float at position i in the tuple. If that field is not a Float, you will get a runtime error.

Specified by:
getFloat in interface Tuple

getBinary

public byte[] getBinary(int i)
Description copied from interface: Tuple
Returns the byte array at position i in the tuple. If that field is not a byte array, you will get a runtime error.

Specified by:
getBinary in interface Tuple

getValueByField

public java.lang.Object getValueByField(java.lang.String field)
Specified by:
getValueByField in interface Tuple

getStringByField

public java.lang.String getStringByField(java.lang.String field)
Specified by:
getStringByField in interface Tuple

getIntegerByField

public java.lang.Integer getIntegerByField(java.lang.String field)
Specified by:
getIntegerByField in interface Tuple

getLongByField

public java.lang.Long getLongByField(java.lang.String field)
Specified by:
getLongByField in interface Tuple

getBooleanByField

public java.lang.Boolean getBooleanByField(java.lang.String field)
Specified by:
getBooleanByField in interface Tuple

getShortByField

public java.lang.Short getShortByField(java.lang.String field)
Specified by:
getShortByField in interface Tuple

getByteByField

public java.lang.Byte getByteByField(java.lang.String field)
Specified by:
getByteByField in interface Tuple

getDoubleByField

public java.lang.Double getDoubleByField(java.lang.String field)
Specified by:
getDoubleByField in interface Tuple

getFloatByField

public java.lang.Float getFloatByField(java.lang.String field)
Specified by:
getFloatByField in interface Tuple

getBinaryByField

public byte[] getBinaryByField(java.lang.String field)
Specified by:
getBinaryByField in interface Tuple

getValues

public java.util.List<java.lang.Object> getValues()
Description copied from interface: Tuple
Gets all the values in this tuple.

Specified by:
getValues in interface Tuple

getFields

public Fields getFields()
Description copied from interface: Tuple
Gets the names of the fields in this tuple.

Specified by:
getFields in interface Tuple

select

public java.util.List<java.lang.Object> select(Fields selector)
Description copied from interface: Tuple
Returns a subset of the tuple based on the fields selector.

Specified by:
select in interface Tuple

getSourceGlobalStreamid

public GlobalStreamId getSourceGlobalStreamid()
Description copied from interface: Tuple
Returns the global stream id (component + stream) of this tuple.

Specified by:
getSourceGlobalStreamid in interface Tuple

getSourceComponent

public java.lang.String getSourceComponent()
Description copied from interface: Tuple
Gets the id of the component that created this tuple.

Specified by:
getSourceComponent in interface Tuple

getSourceTask

public int getSourceTask()
Description copied from interface: Tuple
Gets the id of the task that created this tuple.

Specified by:
getSourceTask in interface Tuple

getSourceStreamId

public java.lang.String getSourceStreamId()
Description copied from interface: Tuple
Gets the id of the stream that this tuple was emitted to.

Specified by:
getSourceStreamId in interface Tuple

getMessageId

public MessageId getMessageId()
Description copied from interface: Tuple
Gets the message id that associated with this tuple.

Specified by:
getMessageId in interface Tuple

toString

public java.lang.String toString()

equals

public boolean equals(java.lang.Object other)
Specified by:
equals in interface java.util.Map

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Map

valAt

public java.lang.Object valAt(java.lang.Object o)
Overrides:
valAt in class IndifferentAccessMap

seq

public ISeq seq()
Overrides:
seq in class IndifferentAccessMap

nth

public java.lang.Object nth(int i)

nth

public java.lang.Object nth(int i,
                            java.lang.Object notfound)

count

public int count()
Overrides:
count in class IndifferentAccessMap

meta

public IPersistentMap meta()

getMap

public IPersistentMap getMap()
Overrides:
getMap in class IndifferentAccessMap