cgl.imr.types
Class DoubleVectorData

java.lang.Object
  extended by cgl.imr.types.DoubleVectorData
All Implemented Interfaces:
TwisterConstants, TwisterSerializable, Value

public class DoubleVectorData
extends Object
implements Value

Represents a vector comprised of double values.


Nested Class Summary
 
Nested classes/interfaces inherited from interface cgl.imr.base.TwisterConstants
TwisterConstants.JobState
 
Field Summary
 
Fields inherited from interface cgl.imr.base.TwisterConstants
COMBINE_INPUT, COMBINE_TOPIC_BASE, DIR_LIST_REQ, DIR_LIST_RES, FAILED, FIXED_DATA_FILE, FIXED_DATA_MODEL, HEP_DATA_STRING, MAP_ITERATIONS_OVER, MAP_REDUCE_TOPIC_BASE, MAP_TASK, MAP_TASK_REQUEST, MAP_WORKER_STARTED, MAPPER_REQUEST, MONITOR_REQUEST, MONITOR_RESPONSE, MONITOR_SLEEP_TIME, NEW_JOB_REQUEST, NEW_JOB_RESPONSE, NUM_MAP_TASKS, NUM_REDUCE_TASKS, PARTITION_FILE_RESPONSE_TOPIC_BASE, PARTITION_FILE_SPLIT_PATTERN, PROPERTIES_FILE, REDUCE_INPUT, REDUCE_RESPONSE, REDUCE_TASK, REDUCE_TASK_REQUEST, REDUCE_TOPIC_BASE, REDUCE_WORKER_REQUEST, RESPONSE_TOPIC_BASE, SEND_RECV_MAX_SLEEP_TIME, SEND_RECV_SLEEP_TIME, SUCCESS, TASK_STATUS, WORKER_RESPONSE
 
Constructor Summary
DoubleVectorData()
           
DoubleVectorData(double[][] data, int numData, int vecLen)
           
 
Method Summary
 void fromBytes(byte[] bytes)
          Construct the object back from a previously serialized bytes.
 byte[] getBytes()
          Serialize the object and returns the bytes.
 double[][] getData()
           
 int getNumData()
           
 int getVecLen()
           
 boolean isDataLoaded()
           
 double[][] loadDataFromBinFile(String fileName)
          Loads data from a binary file.
 double[][] loadDataFromTextFile(String fileName)
          Loads data from a text file.
 void writeToBinFile(String fileName)
          Write the vector data into a binary file.
 void writeToTextFile(String fileName)
          Write the vector data into a text file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleVectorData

public DoubleVectorData()

DoubleVectorData

public DoubleVectorData(double[][] data,
                        int numData,
                        int vecLen)
Method Detail

fromBytes

public void fromBytes(byte[] bytes)
               throws SerializationException
Description copied from interface: TwisterSerializable
Construct the object back from a previously serialized bytes.

Specified by:
fromBytes in interface TwisterSerializable
Throws:
SerializationException

getBytes

public byte[] getBytes()
                throws SerializationException
Description copied from interface: TwisterSerializable
Serialize the object and returns the bytes.

Specified by:
getBytes in interface TwisterSerializable
Returns:
byte[] of serialized object.
Throws:
SerializationException

getData

public double[][] getData()

getNumData

public int getNumData()

getVecLen

public int getVecLen()

isDataLoaded

public boolean isDataLoaded()

loadDataFromBinFile

public double[][] loadDataFromBinFile(String fileName)
                               throws IOException
Loads data from a binary file. First two integer values gives the number of rows and the number of columns to read. The remaining double values contains the vector data.

Throws:
IOException

loadDataFromTextFile

public double[][] loadDataFromTextFile(String fileName)
                                throws IOException
Loads data from a text file. Sample input text file is shown below. First line indicates the number of lines. Second line gives the length of the vector. 5 2 1.2 2.3 5.6 3.3 1.0 2.5 3.0 6.5 5.5 6.3

Throws:
IOException

writeToBinFile

public void writeToBinFile(String fileName)
                    throws IOException
Write the vector data into a binary file.

Parameters:
fileName -
Throws:
IOException

writeToTextFile

public void writeToTextFile(String fileName)
                     throws IOException
Write the vector data into a text file. First two lines give numData and vecLen.

Parameters:
fileName - - Name of the file to write.
Throws:
IOException


For comments and suggestions please send e-mail to