cascading.tuple
Class Tuples

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

public class Tuples
extends Object

Class Tuples is a helper class providing common methods to manipulate Tuple and TupleEntry instances.

See Also:
Tuple, TupleEntry

Constructor Summary
Tuples()
           
 
Method Summary
static Object[] asArray(Tuple tuple, Class[] types)
          Deprecated. 
static Object[] asArray(Tuple tuple, Class[] types, Object[] destination)
          Deprecated. 
static Object[] asArray(Tuple tuple, CoercibleType[] coercions, Class[] types, Object[] destination)
           
static
<T> T[]
asArray(Tuple tuple, T[] destination)
          Method asArray copies the elements of the given Tuple instance to the given Object array.
static Collection asCollection(Tuple tuple)
           
static Tuple asModifiable(Tuple tuple)
          Method asModifiable marks the given Tuple instance as modifiable.
static Tuple asUnmodifiable(Tuple tuple)
          Method asUnmodifiable marks the given Tuple instance as unmodifiable.
static Object coerce(Object value, Class type)
          Deprecated. 
static Tuple coerce(Tuple tuple, Class[] types)
          Deprecated. 
static Tuple coerce(Tuple tuple, Class[] types, Tuple destination)
          Deprecated. 
static Object coerce(Tuple tuple, int pos, Class type)
          Deprecated. 
static Tuple create(List<Object> arrayList)
           
static Tuple extract(TupleEntry tupleEntry, Fields selector)
          Method extract creates a new Tuple from the given selector, but sets the values in the current tuple to null.
static Tuple extractTuple(TupleEntry tupleEntry, Fields selector)
          Method extractTuple returns a new Tuple based on the given selector.
static int frequency(TupleEntry tupleEntry, Object value)
          Method frequency behaves the same as Collections.frequency(java.util.Collection, Object).
static int frequency(Tuple tuple, Object value)
          Method frequency behaves the same as Collections.frequency(java.util.Collection, Object).
static Tuple nulledCopy(Fields declarator, Tuple tuple, Fields selector)
           
static Tuple nulledCopy(TupleEntry tupleEntry, Fields selector)
           
static Tuple setOnEmpty(TupleEntry baseEntry, TupleEntry valuesEntry)
           
static Tuple setUnmodifiable(Tuple tuple, boolean isUnmodifiable)
           
static boolean toBoolean(Object value)
          Deprecated. 
static Boolean toBooleanObject(Object value)
          Deprecated. 
static double toDouble(Object value)
          Deprecated. 
static Double toDoubleObject(Object value)
          Deprecated. 
static float toFloat(Object value)
          Deprecated. 
static Float toFloatObject(Object value)
          Deprecated. 
static int toInteger(Object value)
          Deprecated. 
static Integer toIntegerObject(Object value)
          Deprecated. 
static long toLong(Object value)
          Deprecated. 
static Long toLongObject(Object value)
          Deprecated. 
static short toShort(Object value)
          Deprecated. 
static Short toShortObject(Object value)
          Deprecated. 
static String toString(Object value)
          Deprecated. 
static Tuple tuple(Object a)
          A utility function for use with Janino expressions to get around its lack of support for varargs.
static Tuple tuple(Object a, Object b)
          A utility function for use with Janino expressions to get around its lack of support for varargs.
static Tuple tuple(Object a, Object b, Object c)
          A utility function for use with Janino expressions to get around its lack of support for varargs.
static Tuple tuple(Object a, Object b, Object c, Object d)
          A utility function for use with Janino expressions to get around its lack of support for varargs.
static Tuple tuple(Object a, Object b, Object c, Object d, Object e)
          A utility function for use with Janino expressions to get around its lack of support for varargs.
static Tuple tuple(Object a, Object b, Object c, Object d, Object e, Object f)
          A utility function for use with Janino expressions to get around its lack of support for varargs.
static Tuple tuple(Object a, Object b, Object c, Object d, Object e, Object f, Object g)
          A utility function for use with Janino expressions to get around its lack of support for varargs.
static Tuple tuple(Object a, Object b, Object c, Object d, Object e, Object f, Object g, Object h)
          A utility function for use with Janino expressions to get around its lack of support for varargs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tuples

public Tuples()
Method Detail

tuple

public static Tuple tuple(Object a)
A utility function for use with Janino expressions to get around its lack of support for varargs.

Parameters:
a - of type Object
Returns:
a new Tuple

tuple

public static Tuple tuple(Object a,
                          Object b)
A utility function for use with Janino expressions to get around its lack of support for varargs.

Parameters:
a - of type Object
b - of type Object
Returns:
a new Tuple

tuple

public static Tuple tuple(Object a,
                          Object b,
                          Object c)
A utility function for use with Janino expressions to get around its lack of support for varargs.

Parameters:
a - of type Object
b - of type Object
c - of type Object
Returns:
a new Tuple

tuple

public static Tuple tuple(Object a,
                          Object b,
                          Object c,
                          Object d)
A utility function for use with Janino expressions to get around its lack of support for varargs.

Parameters:
a - of type Object
b - of type Object
c - of type Object
d - of type Object
Returns:
a new Tuple

tuple

public static Tuple tuple(Object a,
                          Object b,
                          Object c,
                          Object d,
                          Object e)
A utility function for use with Janino expressions to get around its lack of support for varargs.

Parameters:
a - of type Object
b - of type Object
c - of type Object
d - of type Object
e - of type Object
Returns:
a new Tuple

tuple

public static Tuple tuple(Object a,
                          Object b,
                          Object c,
                          Object d,
                          Object e,
                          Object f)
A utility function for use with Janino expressions to get around its lack of support for varargs.

Parameters:
a - of type Object
b - of type Object
c - of type Object
d - of type Object
e - of type Object
f - of type Object
Returns:
a new Tuple

tuple

public static Tuple tuple(Object a,
                          Object b,
                          Object c,
                          Object d,
                          Object e,
                          Object f,
                          Object g)
A utility function for use with Janino expressions to get around its lack of support for varargs.

Parameters:
a - of type Object
b - of type Object
c - of type Object
d - of type Object
e - of type Object
f - of type Object
g - of type Object
Returns:
a new Tuple

tuple

public static Tuple tuple(Object a,
                          Object b,
                          Object c,
                          Object d,
                          Object e,
                          Object f,
                          Object g,
                          Object h)
A utility function for use with Janino expressions to get around its lack of support for varargs.

Parameters:
a - of type Object
b - of type Object
c - of type Object
d - of type Object
e - of type Object
f - of type Object
g - of type Object
h - of type Object
Returns:
a new Tuple

asArray

public static <T> T[] asArray(Tuple tuple,
                              T[] destination)
Method asArray copies the elements of the given Tuple instance to the given Object array.

Parameters:
tuple - of type Tuple
destination - of type Object[]
Returns:
Object[]

asArray

@Deprecated
public static Object[] asArray(Tuple tuple,
                                          Class[] types)
Deprecated. 

Method asArray convert the given Tuple instance into an Object[]. The given Class[] array denotes the types each tuple element value should be coerced into.

Coercion types are Object, String, Integer, Long, Float, Double, Short, and Boolean.

If all Tuple element values are null, they will remain null for String and Object, but become zero for the numeric types.

The string value 'true' can be converted to the boolean true.

Parameters:
tuple - of type Tuple
types - of type Class[]
Returns:
Object[]

asArray

@Deprecated
public static Object[] asArray(Tuple tuple,
                                          Class[] types,
                                          Object[] destination)
Deprecated. 

Method asArray convert the given Tuple instance into an Object[]. The given Class[] array denotes the types each tuple element value should be coerced into.

Parameters:
tuple - of type Tuple
types - of type Class[]
destination - of type Object[]
Returns:
Object[]

asArray

public static Object[] asArray(Tuple tuple,
                               CoercibleType[] coercions,
                               Class[] types,
                               Object[] destination)

asCollection

public static Collection asCollection(Tuple tuple)

frequency

public static int frequency(Tuple tuple,
                            Object value)
Method frequency behaves the same as Collections.frequency(java.util.Collection, Object).

This method is a convenient way to test for all null values in a tuple.

Parameters:
tuple - of type Tuple
value - of type Object
Returns:
an int

frequency

public static int frequency(TupleEntry tupleEntry,
                            Object value)
Method frequency behaves the same as Collections.frequency(java.util.Collection, Object).

This method is a convenient way to test for all null values in a tuple.

Parameters:
tupleEntry - of type TupleEntry
value - of type Object
Returns:
an int

coerce

@Deprecated
public static Object coerce(Tuple tuple,
                                       int pos,
                                       Class type)
Deprecated. 

Method coerce returns the value in the tuple at the given position to the requested type.

If the given type is a primitive (long), and the tuple value is null, 0 is returned.

If the type is an Object (Long), and the tuple value is null, null is returned.

Parameters:
tuple - of type Tuple
pos - of type int
type - of type Class
Returns:
returns the value coerced

coerce

@Deprecated
public static Object coerce(Object value,
                                       Class type)
Deprecated. 


toString

@Deprecated
public static final String toString(Object value)
Deprecated. 


toInteger

@Deprecated
public static final int toInteger(Object value)
Deprecated. 


toLong

@Deprecated
public static final long toLong(Object value)
Deprecated. 


toDouble

@Deprecated
public static final double toDouble(Object value)
Deprecated. 


toFloat

@Deprecated
public static final float toFloat(Object value)
Deprecated. 


toShort

@Deprecated
public static final short toShort(Object value)
Deprecated. 


toBoolean

@Deprecated
public static final boolean toBoolean(Object value)
Deprecated. 


toIntegerObject

@Deprecated
public static final Integer toIntegerObject(Object value)
Deprecated. 


toLongObject

@Deprecated
public static final Long toLongObject(Object value)
Deprecated. 


toDoubleObject

@Deprecated
public static final Double toDoubleObject(Object value)
Deprecated. 


toFloatObject

@Deprecated
public static final Float toFloatObject(Object value)
Deprecated. 


toShortObject

@Deprecated
public static final Short toShortObject(Object value)
Deprecated. 


toBooleanObject

@Deprecated
public static final Boolean toBooleanObject(Object value)
Deprecated. 


coerce

@Deprecated
public static Tuple coerce(Tuple tuple,
                                      Class[] types)
Deprecated. 

Method coerce forces each element value in the given Tuple to the corresponding primitive type.

Parameters:
tuple - of type Tuple
types - of type Class[]
Returns:
Tuple

coerce

@Deprecated
public static Tuple coerce(Tuple tuple,
                                      Class[] types,
                                      Tuple destination)
Deprecated. 

Method coerce forces each element value in the given Tuple to the corresponding primitive type.

This method expects the destination Tuple was created with the same size at the types array.

Parameters:
tuple - of type Tuple
types - of type Class[]
destination - of type Tuple
Returns:
Tuple

extractTuple

public static Tuple extractTuple(TupleEntry tupleEntry,
                                 Fields selector)
Method extractTuple returns a new Tuple based on the given selector. But sets the values of the given TupleEntry to null.

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

extract

public static Tuple extract(TupleEntry tupleEntry,
                            Fields selector)
Method extract creates a new Tuple from the given selector, but sets the values in the current tuple to null.

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

nulledCopy

public static Tuple nulledCopy(TupleEntry tupleEntry,
                               Fields selector)

nulledCopy

public static Tuple nulledCopy(Fields declarator,
                               Tuple tuple,
                               Fields selector)

setOnEmpty

public static Tuple setOnEmpty(TupleEntry baseEntry,
                               TupleEntry valuesEntry)

asUnmodifiable

public static Tuple asUnmodifiable(Tuple tuple)
Method asUnmodifiable marks the given Tuple instance as unmodifiable.

Parameters:
tuple - of type Tuple
Returns:
Tuple

asModifiable

public static Tuple asModifiable(Tuple tuple)
Method asModifiable marks the given Tuple instance as modifiable.

Parameters:
tuple - of type Tuple
Returns:
Tuple

setUnmodifiable

public static Tuple setUnmodifiable(Tuple tuple,
                                    boolean isUnmodifiable)

create

public static Tuple create(List<Object> arrayList)


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