tl.lin.data.array
Class ArrayListOfDoublesWritable

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

public class ArrayListOfDoublesWritable
extends ArrayListOfDoubles
implements org.apache.hadoop.io.WritableComparable<ArrayListOfDoublesWritable>

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


Field Summary
 
Fields inherited from class tl.lin.data.array.ArrayListOfDoubles
array, size
 
Constructor Summary
ArrayListOfDoublesWritable()
          Constructs an ArrayListOfDoublesWritable object.
ArrayListOfDoublesWritable(ArrayListOfDoublesWritable other)
          Constructs a deep copy of the ArrayListOfDoublesWritable object given as parameter.
ArrayListOfDoublesWritable(double[] arr)
          Constructs a list from an array.
ArrayListOfDoublesWritable(int initialCapacity)
          Constructs an empty list with the specified initial capacity.
 
Method Summary
 int compareTo(ArrayListOfDoublesWritable obj)
          Elementwise comparison.
static ArrayListOfDoublesWritable fromArrayListOfDoubles(ArrayListOfDoubles arr)
          Creates an instance of this object from ArrayListOfDoubles.
 void readFields(DataInput in)
          Deserializes this object.
 String toString()
           
 void write(DataOutput out)
          Serializes this object.
 
Methods inherited from class tl.lin.data.array.ArrayListOfDoubles
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

ArrayListOfDoublesWritable

public ArrayListOfDoublesWritable()
Constructs an ArrayListOfDoublesWritable object.


ArrayListOfDoublesWritable

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

Parameters:
initialCapacity - the initial capacity of the list

ArrayListOfDoublesWritable

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

Parameters:
other - object to be copied

ArrayListOfDoublesWritable

public ArrayListOfDoublesWritable(double[] 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 ArrayListOfDoubles

fromArrayListOfDoubles

public static ArrayListOfDoublesWritable fromArrayListOfDoubles(ArrayListOfDoubles arr)
Creates an instance of this object from ArrayListOfDoubles. Note that backing array is cloned.

Parameters:
arr - source ArrayListOfDoubles

compareTo

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


Copyright © 2013. All Rights Reserved.