tl.lin.data.array
Class ArrayListOfShortsWritable

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

public class ArrayListOfShortsWritable
extends ArrayListOfShorts
implements org.apache.hadoop.io.WritableComparable<ArrayListOfShortsWritable>

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


Field Summary
 
Fields inherited from class tl.lin.data.array.ArrayListOfShorts
array, size
 
Constructor Summary
ArrayListOfShortsWritable()
          Constructs an ArrayListOfIntsWritable object.
ArrayListOfShortsWritable(ArrayListOfShortsWritable other)
          Constructs a deep copy of the ArrayListOfShortsWritable object given as parameter.
ArrayListOfShortsWritable(int initialCapacity)
          Constructs an empty list with the specified initial capacity.
ArrayListOfShortsWritable(short[] arr)
          Constructs a list from an array.
ArrayListOfShortsWritable(short first, short last)
          Constructs a list populated with shorts in range [first, last).
 
Method Summary
 int compareTo(ArrayListOfShortsWritable obj)
          Elementwise comparison.
static ArrayListOfShortsWritable fromArrayListOfShorts(ArrayListOfShorts 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.ArrayListOfShorts
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

ArrayListOfShortsWritable

public ArrayListOfShortsWritable()
Constructs an ArrayListOfIntsWritable object.


ArrayListOfShortsWritable

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

Parameters:
initialCapacity - the initial capacity of the list

ArrayListOfShortsWritable

public ArrayListOfShortsWritable(short first,
                                 short 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)

ArrayListOfShortsWritable

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

Parameters:
other - object to be copied

ArrayListOfShortsWritable

public ArrayListOfShortsWritable(short[] 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 ArrayListOfShorts

fromArrayListOfShorts

public static ArrayListOfShortsWritable fromArrayListOfShorts(ArrayListOfShorts a)
Creates a Writable version of this list.


compareTo

public int compareTo(ArrayListOfShortsWritable 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<ArrayListOfShortsWritable>
Parameters:
obj - other object this is compared against


Copyright © 2013. All Rights Reserved.