All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class primitives.machines.StraightLineMachine

java.lang.Object
   |
   +----primitives.machines.StraightLineMachine

public class StraightLineMachine
extends Object
implements MachineListener
A class defining a Peacullier Linkage used by StraightLineDemo


Variable Index

 o alpha
 o bigCenter
 o centralJoint
 o d
 o dcentralJoint
 o demo
 o doutputJoint
 o dradialJoints
 o leader
 o leaderJoint
 o line
 o outputJoint
 o p
 o r
 o radialJoints
 o reachedEnd
 o smallCenter
 o temp
 o tempPoints
 o x
 o y

Constructor Index

 o StraightLineMachine(Dimension, boolean)

Method Index

 o drawLine(Graphics, Point, Point)
 o finalize()
Sets object fields to null.
 o moveMachine(double)
preforms a motion of the machine
 o redraw(Graphics)
Redraws the machine.
 o restorePoints()
restores to the last valid state of the machine in case the current state is not valid.
 o savePoints()
preform backup of last valid state incase next step is not legal.
 o switchLeader()
switches between 2 supporting joints.

Variables

 o bigCenter
 public ExtPoint bigCenter
 o smallCenter
 public ExtPoint smallCenter
 o radialJoints
 public ExtPoint radialJoints[]
 o dradialJoints
 private Coordinate dradialJoints[]
 o outputJoint
 public ExtPoint outputJoint
 o doutputJoint
 private Coordinate doutputJoint
 o centralJoint
 public ExtPoint centralJoint
 o dcentralJoint
 private Coordinate dcentralJoint
 o y
 public double y
 o x
 public double x
 o r
 public int r
 o alpha
 public double alpha
 o line
 public int line
 o leader
 public Coordinate leader
 o d
 private Dimension d
 o demo
 private boolean demo
 o leaderJoint
 public int leaderJoint
 o tempPoints
 private Coordinate tempPoints[]
 o temp
 private Coordinate temp
 o reachedEnd
 static final String reachedEnd
 o p
 static final String p

Constructors

 o StraightLineMachine
 public StraightLineMachine(Dimension d,
                            boolean demo)
Parameters:
d - the size of the rectangle in which to draw the machine.
demo - if false draws circles and straight line of various joints.

Methods

 o finalize
 public void finalize() throws Throwable
Sets object fields to null.

Throws: Throwable
.
Overrides:
finalize in class Object
 o savePoints
 private void savePoints()
preform backup of last valid state incase next step is not legal.

 o restorePoints
 private void restorePoints()
restores to the last valid state of the machine in case the current state is not valid.

 o switchLeader
 public double switchLeader()
switches between 2 supporting joints. this is done in order to keep a well behaved motion without changing the moveMachine method to be based on the current state of the machine.

Returns:
the current angle of the straight motion joint
 o moveMachine
 public void moveMachine(double alpha) throws MachineException
preforms a motion of the machine

Parameters:
alpha - the angle to move the leader joint to.
Throws: MachineException
if the move is not valid.
 o drawLine
 private void drawLine(Graphics g,
                       Point p1,
                       Point p2)
 o redraw
 public void redraw(Graphics g)
Redraws the machine. If demo is set to true, blue circles and black line of motion of the various joint are also drawn.

Parameters:
g - the graphic context to draw to.

All Packages  Class Hierarchy  This Package  Previous  Next  Index