Class builder.Wire
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class builder.Wire

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----builder.Moveable
                                   |
                                   +----builder.Wire

public class Wire
extends Moveable
Wire that conect Icons of two Nodes.

Variable Index

 o ARROW_RATIO
 o ARROW_SIZE

Constructor Index

 o Wire(Node, Node)
Main Constructor.

Method Index

 o drawArrow(Graphics, Point, Point)
drawArrow Draws an Arrow at the center of the wire to indicate the direction of the data flow.
 o getInput()
getInput
 o getOutput()
getOutput
 o initialize()
initialize Initializes the Wire and returns true if initialization is complete.
 o normalize(double, Point, Point)
normalize Normalices the vector defined between the center (c) point and the p point to a value specified by the size argument.
 o paintWire(Graphics)
paintWire Draws the wire in the Map.
 o transmit()
transmit Transmits the Action of the Input Node to the Output Node(s).

Variables

 o ARROW_SIZE
  public final static int ARROW_SIZE
 o ARROW_RATIO
  public final static double ARROW_RATIO

Constructors

 o Wire
  public Wire(Node first,
              Node second)
Main Constructor.
Parameters:
map - the Map where this wire will be drawn.

Methods

 o initialize
  public boolean initialize()
initialize Initializes the Wire and returns true if initialization is complete.
Returns:
true.
 o transmit
  public boolean transmit()
transmit Transmits the Action of the Input Node to the Output Node(s).
Returns:
true if the Action is fullfilled by (all) of the Output Nodes.
 o getInput
  public Node getInput()
getInput
Returns:
the Input Node to this Wire.
 o getOutput
  public Node getOutput()
getOutput
Returns:
the Output Node(s) to this Wire.
 o paintWire
  public void paintWire(Graphics g)
paintWire Draws the wire in the Map.
Parameters:
g - the graphics context.
 o drawArrow
  public void drawArrow(Graphics g,
                        Point start,
                        Point end)
drawArrow Draws an Arrow at the center of the wire to indicate the direction of the data flow.
Parameters:
g - the graphics context.
start - the point where the data flows FROM.
end - the point where the data flows TO.
 o normalize
  public Point normalize(double size,
                         Point c,
                         Point p)
normalize Normalices the vector defined between the center (c) point and the p point to a value specified by the size argument.
Parameters:
size - length of the resulting line c-p.
c - the "center" point for the normalization.
p - the Point to be moved to a "normalized" location.
Returns:
the new p Point such that the line c-p(new) is in the same direction as the line c-p(old) but of length size.

All Packages  Class Hierarchy  This Package  Previous  Next  Index