edu.umd.cloud9.io.array
Class ArrayOfDoublesWritable

java.lang.Object
  extended by edu.umd.cloud9.io.array.ArrayOfDoublesWritable
All Implemented Interfaces:
Writable

public class ArrayOfDoublesWritable
extends Object
implements Writable

An array of doubles that implements Writable class.

Author:
Ke Zhai

Constructor Summary
ArrayOfDoublesWritable()
          Constructor with no arguments.
ArrayOfDoublesWritable(double[] array)
          Constructor take in a one-dimensional array.
ArrayOfDoublesWritable(int size)
          Constructor that takes the size of the array as an argument.
 
Method Summary
 double get(int i)
          Returns the double value at position i.
 double[] getArray()
          Get a shallow copy of the array.
 double[] getClone()
          Get a deep copy of the array.
 void readFields(DataInput in)
           
 void set(int i, double f)
          Sets the double at position i to f.
 void setArray(double[] array)
          Set the array.
 int size()
          Returns the size of the double array.
 String toString()
           
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArrayOfDoublesWritable

public ArrayOfDoublesWritable()
Constructor with no arguments.


ArrayOfDoublesWritable

public ArrayOfDoublesWritable(double[] array)
Constructor take in a one-dimensional array.

Parameters:
array - input double array

ArrayOfDoublesWritable

public ArrayOfDoublesWritable(int size)
Constructor that takes the size of the array as an argument.

Parameters:
size - number of doubles in array
Method Detail

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface Writable
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface Writable
Throws:
IOException

getClone

public double[] getClone()
Get a deep copy of the array.

Returns:
a clone of the array

getArray

public double[] getArray()
Get a shallow copy of the array.

Returns:
a pointer to the array

setArray

public void setArray(double[] array)
Set the array.

Parameters:
array -

get

public double get(int i)
Returns the double value at position i.

Parameters:
i - index of double to be returned
Returns:
double value at position i

set

public void set(int i,
                double f)
Sets the double at position i to f.

Parameters:
i - position in array
f - double value to be set

size

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

Returns:
size of array

toString

public String toString()
Overrides:
toString in class Object