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
-
a2scalar
- The object preforming multiplication by 2 initialized with one input joint.
-
activeJoint
- Stores the active joint (the joint the mouse pointer is over)
-
average
- The object preforming the average computation initialized with 2 input joints.
-
def
-
-
inputs
- A copy of the 2 input joints.
-
tempJoints
- Used for storing a backup of the locations of one of the ScalarMultiplier1 members
-
Adder(Rectangle)
-
-
copyCoordinates(Coordinate[], Coordinate[])
- Copies an array of coordinates
The method does not prefrom any length checking.
-
forceInputJoints(Coordinate[])
-
-
getActiveJoint()
-
-
getActiveStr(int)
-
-
getInputJoints()
-
-
getOutputJoints()
-
-
getParameters()
- Not implemented.
-
mouseDragged(MouseEvent)
-
-
mouseMoved(MouseEvent)
-
-
redraw(Graphics)
- Draws an Adder Linkage.
-
setActiveJoint(int)
-
-
setInputJoints(Coordinate[])
-
-
setParameters(double[])
- Not implemented.
average
ScalarMultiplier1 average
- The object preforming the average computation initialized with 2 input joints.
- See Also:
- ScalarMultiplier1
a2scalar
ScalarMultiplier1 a2scalar
- The object preforming multiplication by 2 initialized with one input joint.
tempJoints
Coordinate tempJoints[]
- Used for storing a backup of the locations of one of the ScalarMultiplier1 members
inputs
Coordinate inputs[]
- A copy of the 2 input joints.
This is a redondence field since The ScalarMultiplier1 class defines this field too.
activeJoint
int activeJoint
- Stores the active joint (the joint the mouse pointer is over)
def
static final String def
Adder
public Adder(Rectangle d)
- Parameters:
- d - the rectangle to draw the Adder in. The 2 ScalarMultipliers are initialized with d
- See Also:
- ScalarMultiplier1
forceInputJoints
public Coordinate[] forceInputJoints(Coordinate inputs[])
- See Also:
- forceInputJoints
setInputJoints
public Coordinate[] setInputJoints(Coordinate inputJoints[]) throws MachineException
- Throws: MachineException
- .
- See Also:
- setInputJoints
getOutputJoints
public Coordinate[] getOutputJoints()
- See Also:
- getOutputJoints
getInputJoints
public Coordinate[] getInputJoints()
- See Also:
- getInputJoints
getParameters
public double[] getParameters()
- Not implemented. The Adder stores no parameters.
setParameters
public void setParameters(double parameters[])
- Not implemented. The Adder stores no parameters.
redraw
public void redraw(Graphics g)
- Draws an Adder Linkage.
- Parameters:
- g - the graphic context to draw to.
mouseMoved
public int mouseMoved(MouseEvent m)
- See Also:
- mouseMoved
mouseDragged
public void mouseDragged(MouseEvent m) throws MachineException
- Throws: MachineException
- .
- See Also:
- mouseDragged
getActiveStr
public String getActiveStr(int activeJoint)
- See Also:
- getActiveStr
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.
getActiveJoint
public int getActiveJoint()
- See Also:
- getActiveJoint
setActiveJoint
public void setActiveJoint(int activeJoint)
- See Also:
- setActiveJoint
All Packages Class Hierarchy This Package Previous Next Index