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
-
BatterySymbol()
- Creates a battery symbol, horizontal and right-side plus.
-
BatterySymbol(int)
- Creates a horizontally aligned battery symbol, plus on right.
-
BatterySymbol(Point)
- Creates a horizontal, plus on right, scale 2, battery with
the plus pole on the specified position.
-
BatterySymbol(String, String)
- Bettery symbol with specified alignment (vertical or horizontal),
and specified plus pole side.
-
draw(Graphics)
- Draws the battery symbol in the Graphics context specified.
-
erase(Graphics)
- Erases the battery symbol, if drawn.
-
erase(Graphics, Color)
-
-
getHiY()
- Returns the High-side y-coordinate of this battery.
-
getLeftX()
- Returns the Left-side x-coordinate of this battery.
-
getLocation()
- Returns the coordinate of the plus pole.
-
getLowY()
- Returns the Low-side y-coor of this battery.
-
getMinus()
- Returns the minus pole coordinate.
-
getRightX()
- Returns the RHS x-coordinate of this battery.
-
getScale()
- Returns the current scale.
-
reverse()
- Reverses the Polarity of this battery.
-
setAlign(String, String)
- Sets the alignment of this battery symbol.
-
setLocation(int, int)
- Sets a new location for the plus pole.
-
setScale(int)
- Sets a new scale.
BatterySymbol
public BatterySymbol()
- Creates a battery symbol, horizontal and right-side plus.
Default scale is 2, MEDIUM.
BatterySymbol
public BatterySymbol(int scale)
- Creates a horizontally aligned battery symbol, plus on right.
- Parameters:
- scale - the new scale.
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.
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.
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.
draw
public void draw(Graphics g)
- Draws the battery symbol in the Graphics context specified.
- Parameters:
- g - the Graphics context.
erase
public void erase(Graphics g)
- Erases the battery symbol, if drawn. Draws a symbol, if not already drawn.
- Parameters:
- g - the Graphics context.
erase
public void erase(Graphics g,
Color xorMode)
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"
getScale
public int getScale()
- Returns the current scale.
- Returns:
- the current scale.
setScale
public void setScale(int s)
- Sets a new scale.
- Parameters:
- s - the new scale.
getLocation
public Point getLocation()
- Returns the coordinate of the plus pole.
- Returns:
- the plus pole position.
getMinus
public Point getMinus()
- Returns the minus pole coordinate.
- Returns:
- the minus pole position.
reverse
public void reverse()
- Reverses the Polarity of this battery. Equivalently,
interchanges the positions of Plus Pole and Minus Pole.
getLeftX
public int getLeftX()
- Returns the Left-side x-coordinate of this battery.
- Returns:
- the x-coor of LHS wire contact.
getRightX
public int getRightX()
- Returns the RHS x-coordinate of this battery.
- Returns:
- the x-coor of RHS wire contact.
getHiY
public int getHiY()
- Returns the High-side y-coordinate of this battery.
- Returns:
- the y-coor of High-side wire contact.
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