jsim.process
Class Transport

java.lang.Object
  extended by jsim.process.Transport

public class Transport
extends java.lang.Object

The Transport class implements the connecting links between the nodes. Any two nodes can be connected only by a Transport. The transport can be a straight line (determined by 2 points) or a quad curve (determined by 3 points).


Field Summary
protected static double DEFAULT_STEP_SIZE
          Default step size for entities moving on transport.
protected static double DEFAULT_STEP_TIME
          Default step time for entities moving on transport.
protected  QCurve edge
          The quad curve representing the transport edge.
protected  java.awt.geom.Point2D.Double end
          The last point of the edge.
protected  java.awt.geom.Point2D.Double start
          The first point of the edge.
protected  double stepSize
          The size of each step.
protected  double stepTime
          The time between steps.
protected  double totalTime
           
protected static java.util.logging.Logger trc
          Tracing messages.
 
Constructor Summary
Transport(double x1, double y1, double ctrlx, double ctrly, double x2, double y2, Variate timeDist)
          Construct a transport as a quad curve.
Transport(double x1, double y1, double x2, double y2, Variate timeDist)
          Construct a transport as a straight line (degenerate quad curve).
 
Method Summary
 void adjustSpeed(double stepTime, double stepSize)
          Adjust the speed of the transport by reseting the stepTime and/or stepSize.
 void join(SimObject entity)
          Place entity at start of transport.
 boolean move(SimObject entity)
          This method implements the logic for a SimObject stepping through the transport.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_STEP_TIME

protected static final double DEFAULT_STEP_TIME
Default step time for entities moving on transport.

See Also:
Constant Field Values

DEFAULT_STEP_SIZE

protected static final double DEFAULT_STEP_SIZE
Default step size for entities moving on transport.

See Also:
Constant Field Values

edge

protected final QCurve edge
The quad curve representing the transport edge.


start

protected final java.awt.geom.Point2D.Double start
The first point of the edge.


end

protected final java.awt.geom.Point2D.Double end
The last point of the edge.


trc

protected static java.util.logging.Logger trc
Tracing messages.


stepTime

protected double stepTime
The time between steps.


stepSize

protected double stepSize
The size of each step.


totalTime

protected double totalTime
Constructor Detail

Transport

public Transport(double x1,
                 double y1,
                 double x2,
                 double y2,
                 Variate timeDist)
Construct a transport as a straight line (degenerate quad curve).

Parameters:
x1 - x coordinate of start point
y1 - y coordinate of start point
x2 - x coordinate of end point
y2 - y coordinate of end point

Transport

public Transport(double x1,
                 double y1,
                 double ctrlx,
                 double ctrly,
                 double x2,
                 double y2,
                 Variate timeDist)
Construct a transport as a quad curve.

Parameters:
x1 - x coordinate of start point
y1 - y coordinate of start point
ctrlx - x coordinate of control point
ctrly - y coordinate of control point
x2 - x coordinate of end point
y2 - y coordinate of end point
Method Detail

join

public void join(SimObject entity)
Place entity at start of transport.

Parameters:
entity - SimObject/entity joining the transport

move

public boolean move(SimObject entity)
This method implements the logic for a SimObject stepping through the transport. It changes the position co-ordinates of the SimObject as required.

Parameters:
entity - SimObject/entity stepping through the transport
Returns:
boolean whether entity is still moving on transport

adjustSpeed

public void adjustSpeed(double stepTime,
                        double stepSize)
Adjust the speed of the transport by reseting the stepTime and/or stepSize.

Parameters:
stepTime - new step time (ignored if not positive)
stepSize - new step size (ignored if not positive)