edu.umd.cloud9.io.array
Class ArrayOfFloatsWritable

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

public class ArrayOfFloatsWritable
extends Object
implements Writable

An array of floats that implements Writable class.

Author:
Ferhan Ture

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

Constructor Detail

ArrayOfFloatsWritable

public ArrayOfFloatsWritable()
Constructor with no arguments.


ArrayOfFloatsWritable

public ArrayOfFloatsWritable(float[] array)
Constructor take in a one-dimensional array.

Parameters:
array - input float array

ArrayOfFloatsWritable

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

Parameters:
size - number of floats 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 float[] getClone()
Get a deep copy of the array.

Returns:
a clone of the array

getArray

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

Returns:
a pointer to the array

setArray

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

Parameters:
array -

get

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

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

set

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

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

size

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

Returns:
size of array

toString

public String toString()
Overrides:
toString in class Object