tl.lin.data.array
Class ArrayListOfFloatsWritable

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

public class ArrayListOfFloatsWritable
extends ArrayListOfFloats
implements org.apache.hadoop.io.WritableComparable<ArrayListOfFloatsWritable>

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


Field Summary
 
Fields inherited from class tl.lin.data.array.ArrayListOfFloats
array, size
 
Constructor Summary
ArrayListOfFloatsWritable()
          Constructs an ArrayListOfFloatsWritable object.
ArrayListOfFloatsWritable(ArrayListOfFloatsWritable other)
          Constructs a deep copy of the ArrayListOfFloatsWritable object given as parameter.
ArrayListOfFloatsWritable(float[] arr)
          Constructs a list from an array.
ArrayListOfFloatsWritable(int initialCapacity)
          Constructs an empty list with the specified initial capacity.
 
Method Summary
 int compareTo(ArrayListOfFloatsWritable obj)
          Elementwise comparison.
static ArrayListOfFloatsWritable fromArrayListOfFloats(ArrayListOfFloats 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.ArrayListOfFloats
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

ArrayListOfFloatsWritable

public ArrayListOfFloatsWritable()
Constructs an ArrayListOfFloatsWritable object.


ArrayListOfFloatsWritable

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

Parameters:
initialCapacity - the initial capacity of the list

ArrayListOfFloatsWritable

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

Parameters:
other - object to be copied

ArrayListOfFloatsWritable

public ArrayListOfFloatsWritable(float[] 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 ArrayListOfFloats

fromArrayListOfFloats

public static ArrayListOfFloatsWritable fromArrayListOfFloats(ArrayListOfFloats a)
Creates a Writable version of this list.


compareTo

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


Copyright © 2013. All Rights Reserved.