jET
1.0alpha5


org.jet.tracks
Class TrackFactory

java.lang.Object
  |
  +--org.jet.tracks.TrackFactory

public class TrackFactory
extends java.lang.Object

Tracks factory can build tracks and switches with specified properties.


Field Summary
static int HANDLER_LEFT
          Handler at left.
static int HANDLER_RIGHT
          Handler at right.
static int HANDLER_SIDE
          Handler at side track of the switch.
 
Method Summary
 Track createArc(double len, double rad)
          Creates new arc track.
 Track createStraight(double len)
          Creates straight track.
 Switch createSwitch(int handler, double len1, double rad1, double len2, double rad2)
          Creates switch.
static TrackFactory getInstance()
          Gets instance of the track factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HANDLER_LEFT

public static final int HANDLER_LEFT
Handler at left. In switches it is a common point of switch's tracks.

See Also:
Constant Field Values

HANDLER_RIGHT

public static final int HANDLER_RIGHT
Handler at right. In switches it is the end point of straight track.

See Also:
Constant Field Values

HANDLER_SIDE

public static final int HANDLER_SIDE
Handler at side track of the switch.

See Also:
Constant Field Values
Method Detail

getInstance

public static TrackFactory getInstance()
Gets instance of the track factory.


createStraight

public Track createStraight(double len)
Creates straight track. No matter which handler was selected.

It fills in only geometry fields of the track. Programmer must fill in rest attributes on his own.

Parameters:
len - Length of this track.

createArc

public Track createArc(double len,
                       double rad)
Creates new arc track.

Parameters:
len - Length of the track.
rad - Radius of the track. Positive means right arc. Negative means left arc.

createSwitch

public Switch createSwitch(int handler,
                           double len1,
                           double rad1,
                           double len2,
                           double rad2)
Creates switch.

Parameters:
handler - Handler. One of the predefined values.
len1 - Length of the straight track.
rad1 - Radius of the straight track. When it equals 0, it means that track is straight. Positive values mean right arc of the main track of this switch. Negative - left arc.
len2 - Length of the side track of the switch.
rad2 - Radius of the side track of the switch. When it is positive track is right arc and also it means that switch is right. Negative means left arc and left switch.
Returns:
Switch with handler in point (0, 0, 0).
See Also:
HANDLER_LEFT, HANDLER_RIGHT, HANDLER_SIDE

jET
1.0alpha5