input
Class ExternalMovementReader

java.lang.Object
  extended by input.ExternalMovementReader

public class ExternalMovementReader
extends java.lang.Object

Reader for ExternalMovement movement model's time-location tuples.

First line of the file should be the offset header. Syntax of the header should be:
minTime maxTime minX maxX minY maxY minZ maxZ
Last two values (Z-axis) are ignored at the moment but can be present in the file.

Following lines' syntax should be:
time id xPos yPos
where time is the time when a node with id should be at location (xPos, yPos).

All lines must be sorted by time. Sampling interval (time difference between two time instances) must be same for the whole file.


Field Summary
static java.lang.String COMMENT_PREFIX
           
 
Constructor Summary
ExternalMovementReader(java.lang.String inFilePath)
          Constructor.
 
Method Summary
 double getLastTimeStamp()
          Returns the time stamp where the last moves read with readNextMovements() belong to.
 double getMaxTime()
          Returns offset maxTime
 double getMaxX()
          Returns offset maxX
 double getMaxY()
          Returns offset maxY
 double getMinTime()
          Returns offset minTime
 double getMinX()
          Returns offset minX
 double getMinY()
          Returns offset minY
 java.util.List<Tuple<java.lang.String,Coord>> readNextMovements()
          Reads all new id-coordinate tuples that belong to the same time instance
 void setNormalize(boolean normalize)
          Sets normalizing of read values on/off.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMENT_PREFIX

public static final java.lang.String COMMENT_PREFIX
See Also:
Constant Field Values
Constructor Detail

ExternalMovementReader

public ExternalMovementReader(java.lang.String inFilePath)
Constructor. Creates a new reader that reads the data from a file.

Parameters:
inFilePath - Path to the file where the data is read
Throws:
SettingsError - if the file wasn't found
Method Detail

setNormalize

public void setNormalize(boolean normalize)
Sets normalizing of read values on/off. If on, values returned by readNextMovements() are decremented by minimum values of the offsets. Default is on (normalize).

Parameters:
normalize - If true, normalizing is on (false -> off).

readNextMovements

public java.util.List<Tuple<java.lang.String,Coord>> readNextMovements()
Reads all new id-coordinate tuples that belong to the same time instance

Returns:
A list of tuples or empty list if there were no more moves
Throws:
SettingError - if an invalid line was read

getLastTimeStamp

public double getLastTimeStamp()
Returns the time stamp where the last moves read with readNextMovements() belong to.

Returns:
The time stamp

getMaxTime

public double getMaxTime()
Returns offset maxTime

Returns:
the maxTime

getMaxX

public double getMaxX()
Returns offset maxX

Returns:
the maxX

getMaxY

public double getMaxY()
Returns offset maxY

Returns:
the maxY

getMinTime

public double getMinTime()
Returns offset minTime

Returns:
the minTime

getMinX

public double getMinX()
Returns offset minX

Returns:
the minX

getMinY

public double getMinY()
Returns offset minY

Returns:
the minY