All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class primitives.machines.Adder

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

public class Adder
extends Object
implements FunctionalLinkage
An Adder Linkages is composed by two ScalarMultiplier Linkages; The first preforms the computation: output=(input1+input2)/2. The second preforms the computation: output=2*input The Adder does not inherit from Machine, instead it manipulates 2 ScalarMultiplier1 objects Which are its members.

See Also:
FunctionalLinkage, ScalarMultiplier1

Variable Index

 o a2scalar
The object preforming multiplication by 2 initialized with one input joint.
 o activeJoint
Stores the active joint (the joint the mouse pointer is over)
 o average
The object preforming the average computation initialized with 2 input joints.
 o def
 o inputs
A copy of the 2 input joints.
 o tempJoints
Used for storing a backup of the locations of one of the ScalarMultiplier1 members

Constructor Index

 o Adder(Rectangle)

Method Index

 o copyCoordinates(Coordinate[], Coordinate[])
Copies an array of coordinates The method does not prefrom any length checking.
 o forceInputJoints(Coordinate[])
 o getActiveJoint()
 o getActiveStr(int)
 o getInputJoints()
 o getOutputJoints()
 o getParameters()
Not implemented.
 o mouseDragged(MouseEvent)
 o mouseMoved(MouseEvent)
 o redraw(Graphics)
Draws an Adder Linkage.
 o setActiveJoint(int)
 o setInputJoints(Coordinate[])
 o setParameters(double[])
Not implemented.

Variables

 o average
 ScalarMultiplier1 average
The object preforming the average computation initialized with 2 input joints.

See Also:
ScalarMultiplier1
 o a2scalar
 ScalarMultiplier1 a2scalar
The object preforming multiplication by 2 initialized with one input joint.

 o tempJoints
 Coordinate tempJoints[]
Used for storing a backup of the locations of one of the ScalarMultiplier1 members

 o inputs
 Coordinate inputs[]
A copy of the 2 input joints. This is a redondence field since The ScalarMultiplier1 class defines this field too.

 o activeJoint
 int activeJoint
Stores the active joint (the joint the mouse pointer is over)

 o def
 static final String def

Constructors

 o Adder
 public Adder(Rectangle d)
Parameters:
d - the rectangle to draw the Adder in. The 2 ScalarMultipliers are initialized with d
See Also:
ScalarMultiplier1

Methods

 o forceInputJoints
 public Coordinate[] forceInputJoints(Coordinate inputs[])
See Also:
forceInputJoints
 o setInputJoints
 public Coordinate[] setInputJoints(Coordinate inputJoints[]) throws MachineException
Throws: MachineException
.
See Also:
setInputJoints
 o getOutputJoints
 public Coordinate[] getOutputJoints()
See Also:
getOutputJoints
 o getInputJoints
 public Coordinate[] getInputJoints()
See Also:
getInputJoints
 o getParameters
 public double[] getParameters()
Not implemented. The Adder stores no parameters.

 o setParameters
 public void setParameters(double parameters[])
Not implemented. The Adder stores no parameters.

 o redraw
 public void redraw(Graphics g)
Draws an Adder Linkage.

Parameters:
g - the graphic context to draw to.
 o mouseMoved
 public int mouseMoved(MouseEvent m)
See Also:
mouseMoved
 o mouseDragged
 public void mouseDragged(MouseEvent m) throws MachineException
Throws: MachineException
.
See Also:
mouseDragged
 o getActiveStr
 public String getActiveStr(int activeJoint)
See Also:
getActiveStr
 o copyCoordinates
 static void copyCoordinates(Coordinate src[],
                             Coordinate dst[])
Copies an array of coordinates The method does not prefrom any length checking.

Parameters:
src - the source array
dst - the destination array.
 o getActiveJoint
 public int getActiveJoint()
See Also:
getActiveJoint
 o setActiveJoint
 public void setActiveJoint(int activeJoint)
See Also:
setActiveJoint

All Packages  Class Hierarchy  This Package  Previous  Next  Index