All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class crw.circuit.BatterySymbol

java.lang.Object
   |
   +----crw.circuit.BatterySymbol

public class BatterySymbol
extends Object
implements VisualElement
Prepares a battery which aligned horizontally or vertically. A horizontal battery could have its positive side on the right or on the left. A vertical battery could have its positive side up or down.

Version:
1.0 2-15-1998.
Author:
C.R.Wie

Constructor Index

 o BatterySymbol()
Creates a battery symbol, horizontal and right-side plus.
 o BatterySymbol(int)
Creates a horizontally aligned battery symbol, plus on right.
 o BatterySymbol(Point)
Creates a horizontal, plus on right, scale 2, battery with the plus pole on the specified position.
 o BatterySymbol(String, String)
Bettery symbol with specified alignment (vertical or horizontal), and specified plus pole side.

Method Index

 o draw(Graphics)
Draws the battery symbol in the Graphics context specified.
 o erase(Graphics)
Erases the battery symbol, if drawn.
 o erase(Graphics, Color)
 o getHiY()
Returns the High-side y-coordinate of this battery.
 o getLeftX()
Returns the Left-side x-coordinate of this battery.
 o getLocation()
Returns the coordinate of the plus pole.
 o getLowY()
Returns the Low-side y-coor of this battery.
 o getMinus()
Returns the minus pole coordinate.
 o getRightX()
Returns the RHS x-coordinate of this battery.
 o getScale()
Returns the current scale.
 o reverse()
Reverses the Polarity of this battery.
 o setAlign(String, String)
Sets the alignment of this battery symbol.
 o setLocation(int, int)
Sets a new location for the plus pole.
 o setScale(int)
Sets a new scale.

Constructors

 o BatterySymbol
 public BatterySymbol()
Creates a battery symbol, horizontal and right-side plus. Default scale is 2, MEDIUM.

 o BatterySymbol
 public BatterySymbol(int scale)
Creates a horizontally aligned battery symbol, plus on right.

Parameters:
scale - the new scale.
 o BatterySymbol
 public BatterySymbol(Point plusPosition)
Creates a horizontal, plus on right, scale 2, battery with the plus pole on the specified position.

Parameters:
plusPosition - the coordinate of the plus pole in the Graphics context.
 o BatterySymbol
 public BatterySymbol(String align,
                      String plusSide)
Bettery symbol with specified alignment (vertical or horizontal), and specified plus pole side.

Parameters:
align - "vertical" or "horizontal"
plusSide - up/down or right/left.

Methods

 o setLocation
 public void setLocation(int x,
                         int y)
Sets a new location for the plus pole.

Parameters:
x - the x-coordinate of plus pole.
y - the y-coordinate of plus pole.
 o draw
 public void draw(Graphics g)
Draws the battery symbol in the Graphics context specified.

Parameters:
g - the Graphics context.
 o erase
 public void erase(Graphics g)
Erases the battery symbol, if drawn. Draws a symbol, if not already drawn.

Parameters:
g - the Graphics context.
 o erase
 public void erase(Graphics g,
                   Color xorMode)
 o setAlign
 public void setAlign(String vertOrHori,
                      String plusSide)
Sets the alignment of this battery symbol.

Parameters:
vertOrHori - "vertical" or "horizontal"
plusSide - "up"/"down" or "right"/"left"
 o getScale
 public int getScale()
Returns the current scale.

Returns:
the current scale.
 o setScale
 public void setScale(int s)
Sets a new scale.

Parameters:
s - the new scale.
 o getLocation
 public Point getLocation()
Returns the coordinate of the plus pole.

Returns:
the plus pole position.
 o getMinus
 public Point getMinus()
Returns the minus pole coordinate.

Returns:
the minus pole position.
 o reverse
 public void reverse()
Reverses the Polarity of this battery. Equivalently, interchanges the positions of Plus Pole and Minus Pole.

 o getLeftX
 public int getLeftX()
Returns the Left-side x-coordinate of this battery.

Returns:
the x-coor of LHS wire contact.
 o getRightX
 public int getRightX()
Returns the RHS x-coordinate of this battery.

Returns:
the x-coor of RHS wire contact.
 o getHiY
 public int getHiY()
Returns the High-side y-coordinate of this battery.

Returns:
the y-coor of High-side wire contact.
 o getLowY
 public int getLowY()
Returns the Low-side y-coor of this battery.

Returns:
the y-coor of Low-side wire contact.

All Packages  Class Hierarchy  This Package  Previous  Next  Index