edu.umd.cloud9.io.array
Class ArrayListOfDoublesWritable

java.lang.Object
  extended by edu.umd.cloud9.util.array.ArrayListOfDoubles
      extended by edu.umd.cloud9.io.array.ArrayListOfDoublesWritable
All Implemented Interfaces:
Cloneable, Comparable, Iterable<Double>, RandomAccess, Writable, WritableComparable

public class ArrayListOfDoublesWritable
extends ArrayListOfDoubles
implements WritableComparable

Writable extension of the ArrayListOfDoubles class.

Author:
Jimmy Lin

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(Object 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 edu.umd.cloud9.util.array.ArrayListOfDoubles
add, add, clear, clone, contains, ensureCapacity, get, getArray, indexOf, isEmpty, iterator, lastIndexOf, remove, set, setSize, size, sort, toString, trimToSize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArrayListOfDoublesWritable

public ArrayListOfDoublesWritable()
Constructs an ArrayListOfDoublesWritable object.


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

ArrayListOfDoublesWritable

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

Parameters:
initialCapacity - the initial capacity of the list
Method Detail

compareTo

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

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

readFields

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

Specified by:
readFields in interface Writable
Parameters:
in - source for raw byte representation
Throws:
IOException

toString

public String toString()
Overrides:
toString in class ArrayListOfDoubles

write

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

Specified by:
write in interface Writable
Parameters:
out - where to write the raw byte representation
Throws:
IOException