tl.lin.data.array
Class IntArrayWritable

java.lang.Object
  extended by tl.lin.data.array.IntArrayWritable
All Implemented Interfaces:
org.apache.hadoop.io.Writable

public class IntArrayWritable
extends Object
implements org.apache.hadoop.io.Writable


Constructor Summary
IntArrayWritable()
           
IntArrayWritable(int size)
          Constructor that creates an empty array of a particular size.
IntArrayWritable(int[] array)
          Constructor with array as input.
IntArrayWritable(int[] array, int length)
          Constructor with array as input and with a specific size.
 
Method Summary
 int get(int i)
          Returns the value at index i.
 int[] getArray()
          Returns a reference to the underlying array.
 int[] getClone()
          Returns a deep copy of the array.
 void readFields(DataInput in)
           
 void set(int i, int v)
          Sets the value at index i.
 void setArray(int[] array)
          Sets the underlying array.
 void setArray(int[] array, int length)
          Sets the underlying array and a specified length.
 int size()
          Returns the size of the float array.
 String toString()
           
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntArrayWritable

public IntArrayWritable()

IntArrayWritable

public IntArrayWritable(int[] array)
Constructor with array as input.

Parameters:
array - input array

IntArrayWritable

public IntArrayWritable(int[] array,
                        int length)
Constructor with array as input and with a specific size.

Parameters:
array - input array
length - length

IntArrayWritable

public IntArrayWritable(int size)
Constructor that creates an empty array of a particular size.

Parameters:
size - array size
Method Detail

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

getClone

public int[] getClone()
Returns a deep copy of the array. The length of the returned array will always be the value size(). That is, trailing unused space in the underlying array will be trimmed.


getArray

public int[] getArray()
Returns a reference to the underlying array. Note that the underlying array may have length longer than the value of size().


setArray

public void setArray(int[] array)
Sets the underlying array.


setArray

public void setArray(int[] array,
                     int length)
Sets the underlying array and a specified length.


get

public int get(int i)
Returns the value at index i. Note that no bounds checking is performed.

Parameters:
i - index position

set

public void set(int i,
                int v)
Sets the value at index i.

Parameters:
i - position in array
v - value

size

public int size()
Returns the size of the float array.


toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.