cascading.tuple
Class TupleEntry

java.lang.Object
  extended by cascading.tuple.TupleEntry

public class TupleEntry
extends Object

Class TupleEntry allows a Tuple instance and its declarating Fields instance to be used as a single object.

Once a TupleEntry is created, its Fields cannot be changed, but the Tuple instance it holds can be replaced or modified. The managed Tuple should not have elements added or removed, as this will break the relationship with the associated Fields instance.

See Also:
Fields, Tuple

Constructor Summary
TupleEntry()
          Constructor TupleEntry creates a new TupleEntry instance.
TupleEntry(boolean isUnmodifiable)
          Constructor TupleEntry creates a new TupleEntry instance.
TupleEntry(Fields fields)
          Constructor TupleEntry creates a new TupleEntry instance.
TupleEntry(Fields fields, boolean isUnmodifiable)
          Constructor TupleEntry creates a new TupleEntry instance.
TupleEntry(Fields fields, Tuple tuple)
          Constructor TupleEntry creates a new TupleEntry instance.
TupleEntry(Tuple tuple)
          Constructor TupleEntry creates a new TupleEntry instance.
TupleEntry(TupleEntry tupleEntry)
          Constructor TupleEntry creates a new TupleEntry instance that is a safe copy of the given tupleEntry.
 
Method Summary
 TupleEntry appendNew(TupleEntry entry)
          Method appendNew appends the given TupleEntry instance to this instance.
 Comparable get(Comparable fieldName)
          Method get returns the value in the given field or position.
 Comparable get(int pos)
          Method get returns the value in the given position pos.
 boolean getBoolean(Comparable fieldName)
          Method getBoolean returns the element for the given field name or position as a boolean.
 double getDouble(Comparable fieldName)
          Method getDouble returns the element for the given field name or position as a double.
 Fields getFields()
          Method getFields returns the fields of this TupleEntry object.
 float getFloat(Comparable fieldName)
          Method getFloat returns the element for the given field name or position as a float.
 int getInteger(Comparable fieldName)
          Method getInteger returns the element for the given field name or position as an int.
 long getLong(Comparable fieldName)
          Method getLong returns the element for the given field name or position as a long.
 Object getObject(Comparable fieldName)
          Method get returns the value in the given field or position.
 short getShort(Comparable fieldName)
          Method getShort returns the element for the given field name or position as a short.
 String getString(Comparable fieldName)
          Method getString returns the element for the given field name or position as a String.
 Tuple getTuple()
          Method getTuple returns the tuple of this TupleEntry object.
 Tuple getTupleCopy()
          Method getTupleCopy returns a copy of the tuple of this TupleEntry object.
 boolean isUnmodifiable()
          Method isUnmodifiable returns true if this TupleEntry is unmodifiable.
static Tuple select(Fields selector, TupleEntry... entries)
          Method select will select a new Tuple instance from the given set of entries.
 TupleEntry selectEntry(Fields selector)
          Method selectEntry selects the fields specified in selector from this instance.
 int selectInteger(Fields selector)
          Method selectInteger selects the first field Tuple value in the specified selector.
 Tuple selectTuple(Fields selector)
          Method selectTuple selects the fields specified in selector from this instance.
 void set(Comparable fieldName, Object value)
          Method set sets the value in the given field or position.
 void set(TupleEntry tupleEntry)
          Method set sets the values from the given tupleEntry into this TupleEntry instance based on the given tupleEntry field names.
 void setTuple(Fields selector, Tuple tuple)
          Method setTuple sets the values specified by the selector to the values given by the given tuple.
 void setTuple(Tuple tuple)
          Method setTuple sets the tuple of this TupleEntry object.
 int size()
          Method size returns the number of values in this instance.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TupleEntry

public TupleEntry()
Constructor TupleEntry creates a new TupleEntry instance.


TupleEntry

@ConstructorProperties(value="isUnmodifiable")
public TupleEntry(boolean isUnmodifiable)
Constructor TupleEntry creates a new TupleEntry instance.

Parameters:
isUnmodifiable - of type boolean

TupleEntry

@ConstructorProperties(value="fields")
public TupleEntry(Fields fields)
Constructor TupleEntry creates a new TupleEntry instance.

Parameters:
fields - of type Fields

TupleEntry

@ConstructorProperties(value={"fields","isUnmodifiable"})
public TupleEntry(Fields fields,
                                             boolean isUnmodifiable)
Constructor TupleEntry creates a new TupleEntry instance.

Parameters:
fields - of type Fields
isUnmodifiable - of type boolean

TupleEntry

@ConstructorProperties(value={"fields","tuple"})
public TupleEntry(Fields fields,
                                             Tuple tuple)
Constructor TupleEntry creates a new TupleEntry instance.

Parameters:
fields - of type Fields
tuple - of type Tuple

TupleEntry

@ConstructorProperties(value="tupleEntry")
public TupleEntry(TupleEntry tupleEntry)
Constructor TupleEntry creates a new TupleEntry instance that is a safe copy of the given tupleEntry.

Parameters:
tupleEntry - of type TupleEntry

TupleEntry

@ConstructorProperties(value="tuple")
public TupleEntry(Tuple tuple)
Constructor TupleEntry creates a new TupleEntry instance.

Parameters:
tuple - of type Tuple
Method Detail

select

public static Tuple select(Fields selector,
                           TupleEntry... entries)
Method select will select a new Tuple instance from the given set of entries. Entries order is significant to the selector.

Parameters:
selector - of type Fields
entries - of type TupleEntry
Returns:
Tuple

isUnmodifiable

public boolean isUnmodifiable()
Method isUnmodifiable returns true if this TupleEntry is unmodifiable.

Returns:
boolean

getFields

public Fields getFields()
Method getFields returns the fields of this TupleEntry object.

Returns:
the fields (type Fields) of this TupleEntry object.

getTuple

public Tuple getTuple()
Method getTuple returns the tuple of this TupleEntry object.

Returns:
the tuple (type Tuple) of this TupleEntry object.

getTupleCopy

public Tuple getTupleCopy()
Method getTupleCopy returns a copy of the tuple of this TupleEntry object.

Returns:
a copy of the tuple (type Tuple) of this TupleEntry object.

setTuple

public void setTuple(Tuple tuple)
Method setTuple sets the tuple of this TupleEntry object.

Parameters:
tuple - the tuple of this TupleEntry object.

size

public int size()
Method size returns the number of values in this instance.

Returns:
int

get

public Comparable get(int pos)
Method get returns the value in the given position pos.

Parameters:
pos - position of the element to return.
Returns:
Comparable

get

public Comparable get(Comparable fieldName)
Method get returns the value in the given field or position.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
Comparable

getObject

public Object getObject(Comparable fieldName)
Method get returns the value in the given field or position.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
Comparable

set

public void set(Comparable fieldName,
                Object value)
Method set sets the value in the given field or position.

Parameters:
fieldName - field name or position to set
value - of type Comparable

getString

public String getString(Comparable fieldName)
Method getString returns the element for the given field name or position as a String.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
String

getFloat

public float getFloat(Comparable fieldName)
Method getFloat returns the element for the given field name or position as a float. Zero if null.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
float

getDouble

public double getDouble(Comparable fieldName)
Method getDouble returns the element for the given field name or position as a double. Zero if null.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
double

getInteger

public int getInteger(Comparable fieldName)
Method getInteger returns the element for the given field name or position as an int. Zero if null.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
int

getLong

public long getLong(Comparable fieldName)
Method getLong returns the element for the given field name or position as a long. Zero if null.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
long

getShort

public short getShort(Comparable fieldName)
Method getShort returns the element for the given field name or position as a short. Zero if null.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
short

getBoolean

public boolean getBoolean(Comparable fieldName)
Method getBoolean returns the element for the given field name or position as a boolean. If the value is (case ignored) the string 'true', a true value will be returned. false if null.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
boolean

selectEntry

public TupleEntry selectEntry(Fields selector)
Method selectEntry selects the fields specified in selector from this instance.

Parameters:
selector - Fields selector that selects the values to return
Returns:
TupleEntry

selectTuple

public Tuple selectTuple(Fields selector)
Method selectTuple selects the fields specified in selector from this instance.

Parameters:
selector - Fields selector that selects the values to return
Returns:
Tuple

selectInteger

public int selectInteger(Fields selector)
Method selectInteger selects the first field Tuple value in the specified selector.
All other fields in the selector are ignored.

Parameters:
selector -
Returns:
an int value

setTuple

public void setTuple(Fields selector,
                     Tuple tuple)
Method setTuple sets the values specified by the selector to the values given by the given tuple.

Parameters:
selector - of type Fields
tuple - of type Tuple

set

public void set(TupleEntry tupleEntry)
Method set sets the values from the given tupleEntry into this TupleEntry instance based on the given tupleEntry field names.

Parameters:
tupleEntry - of type TupleEntry

appendNew

public TupleEntry appendNew(TupleEntry entry)
Method appendNew appends the given TupleEntry instance to this instance.

Parameters:
entry - of type TupleEntry
Returns:
TupleEntry

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007-2010 Concurrent, Inc. All Rights Reserved.