jopt.js.api.util
Class TransitionTimeTable

java.lang.Object
  extended byjopt.js.api.util.TransitionTimeTable

public class TransitionTimeTable
extends java.lang.Object

TransitionTimeTable is a singleton class to keep track of the amount of time it takes to transition between two different locations, a source and destination.

Author:
jboerkoel

Method Summary
 void add(int sourceRefNum, int destRefNum, int transitTime)
          Adds an entry to the table given source and destination numbers
 void addByOp(int sourceOpId, int destOpId, int transitTime)
          Adds an entry to the table given the between two operations
 int get(int sourceRefNum, int destRefNum)
          Returns the entry for the amount of time it takes to transition from the source to the destination
 int getByOp(int sourceOpId, int destOpId)
          Returns the entry for the amount of time it takes to transition from the source to the destination give their respective operation ids
 int getDestNumByOp(int opID)
          Returns the destination number for a given operation Id
static TransitionTimeTable getInstance()
          Gets an instance of the TransitionTimeTable.
 int getSourceNumByOp(int opID)
          Returns the source number for a given operation Id
 void registerOperationID(int operationID, int sourceRefNum, int destRefNum)
          Registers an operation ID with a specific source and destination reference number.
 java.lang.String toString()
          Creates a String object that represents the useful information in this class
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static TransitionTimeTable getInstance()
Gets an instance of the TransitionTimeTable. This enforces that there can only be one transition time table at a time.


registerOperationID

public void registerOperationID(int operationID,
                                int sourceRefNum,
                                int destRefNum)
Registers an operation ID with a specific source and destination reference number. This allows multiple different operations to be considered as the same source or destination reference number.

Parameters:
operationID - the id of the operation, and

getSourceNumByOp

public int getSourceNumByOp(int opID)
Returns the source number for a given operation Id

Parameters:
opID - operation id
Returns:
int representing the coresponding source num

getDestNumByOp

public int getDestNumByOp(int opID)
Returns the destination number for a given operation Id

Parameters:
opID - operation id
Returns:
int representing the coresponding destination num

addByOp

public void addByOp(int sourceOpId,
                    int destOpId,
                    int transitTime)
Adds an entry to the table given the between two operations

Parameters:
sourceOpId - id of the source operation
destOpId - id of the destination operation
transitTime - the amount of time that it takes to transition between the given source and destination

add

public void add(int sourceRefNum,
                int destRefNum,
                int transitTime)
Adds an entry to the table given source and destination numbers

Parameters:
sourceRefNum - number of the source
destRefNum - number of the destination
transitTime - the amount of time that it takes to transition between the given source and destination

get

public int get(int sourceRefNum,
               int destRefNum)
Returns the entry for the amount of time it takes to transition from the source to the destination

Parameters:
sourceRefNum - number of the source
destRefNum - number of the destination
Returns:
int representing the time it takes to transtion from the source to the destination

getByOp

public int getByOp(int sourceOpId,
                   int destOpId)
Returns the entry for the amount of time it takes to transition from the source to the destination give their respective operation ids

Parameters:
sourceOpId - id of the source operation
destOpId - id of the destination operation
Returns:
int representing the time it takes to transtion from the source to the destination

toString

public java.lang.String toString()
Creates a String object that represents the useful information in this class

Returns:
String object that represents the useful information in this class