tl.lin.data.array
Class ArrayListOfLongsWritable

java.lang.Object
  extended by tl.lin.data.array.ArrayListOfLongs
      extended by tl.lin.data.array.ArrayListOfLongsWritable
All Implemented Interfaces:
Cloneable, Comparable<ArrayListOfLongsWritable>, Iterable<Long>, RandomAccess, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<ArrayListOfLongsWritable>

public class ArrayListOfLongsWritable
extends ArrayListOfLongs
implements org.apache.hadoop.io.WritableComparable<ArrayListOfLongsWritable>

Writable extension of the ArrayListOfLongs class. This class provides an efficient data structure to store a list of longs for MapReduce jobs.


Field Summary
 
Fields inherited from class tl.lin.data.array.ArrayListOfLongs
array, size
 
Constructor Summary
ArrayListOfLongsWritable()
          Constructs an ArrayListOfLongsWritable object.
ArrayListOfLongsWritable(ArrayListOfLongsWritable other)
          Constructs a deep copy of the ArrayListOfLongsWritable object given as parameter.
ArrayListOfLongsWritable(int initialCapacity)
          Constructs an empty list with the specified initial capacity.
ArrayListOfLongsWritable(int first, int last)
          Constructs a list populated with shorts in range [first, last).
ArrayListOfLongsWritable(long[] arr)
          Constructs a list from an array.
 
Method Summary
 int compareTo(ArrayListOfLongsWritable obj)
          Elementwise comparison.
static ArrayListOfLongsWritable fromArrayListOfLongs(ArrayListOfLongs a)
          Creates a Writable version of this list.
 void readFields(DataInput in)
          Deserializes this object.
 String toString()
           
 void write(DataOutput out)
          Serializes this object.
 
Methods inherited from class tl.lin.data.array.ArrayListOfLongs
add, add, addUnique, clear, clone, contains, ensureCapacity, equals, get, getArray, indexOf, intersection, isEmpty, iterator, lastIndexOf, merge, remove, set, setSize, shiftLastNToTop, size, sort, subList, toString, trimToSize
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArrayListOfLongsWritable

public ArrayListOfLongsWritable()
Constructs an ArrayListOfLongsWritable object.


ArrayListOfLongsWritable

public ArrayListOfLongsWritable(int initialCapacity)
Constructs an empty list with the specified initial capacity.

Parameters:
initialCapacity - the initial capacity of the list

ArrayListOfLongsWritable

public ArrayListOfLongsWritable(int first,
                                int last)
Constructs a list populated with shorts in range [first, last).

Parameters:
first - the smallest short in the range (inclusive)
last - the largest short in the range (exclusive)

ArrayListOfLongsWritable

public ArrayListOfLongsWritable(ArrayListOfLongsWritable other)
Constructs a deep copy of the ArrayListOfLongsWritable object given as parameter.

Parameters:
other - object to be copied

ArrayListOfLongsWritable

public ArrayListOfLongsWritable(long[] arr)
Constructs a list from an array. Defensively makes a copy of the array.

Parameters:
arr - source array
Method Detail

readFields

public void readFields(DataInput in)
                throws IOException
Deserializes this object.

Specified by:
readFields in interface org.apache.hadoop.io.Writable
Parameters:
in - source for raw byte representation
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Serializes this object.

Specified by:
write in interface org.apache.hadoop.io.Writable
Parameters:
out - where to write the raw byte representation
Throws:
IOException

toString

public String toString()
Overrides:
toString in class ArrayListOfLongs

fromArrayListOfLongs

public static ArrayListOfLongsWritable fromArrayListOfLongs(ArrayListOfLongs a)
Creates a Writable version of this list.


compareTo

public int compareTo(ArrayListOfLongsWritable obj)
Elementwise comparison. Shorter always comes before if it is a sublist of longer. No preference if both are empty.

Specified by:
compareTo in interface Comparable<ArrayListOfLongsWritable>
Parameters:
obj - other object this is compared against


Copyright © 2013. All Rights Reserved.