|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ajc.esim.core.Charge
public abstract class Charge
Defines a basic charge, stores location, shape and charge.
sci.core.PointCharge
,
sci.core.LineCharge
,
Serialized FormNested Class Summary | |
---|---|
static class |
Charge.ChargeType
ChargeType of Charge. |
Field Summary | |
---|---|
boolean |
isSel
true if this is selected in the MainWindow window |
protected java.awt.Shape |
myShape
Shape for drawing, used by paint, must be initialized by implementing sub-classes |
Constructor Summary | |
---|---|
Charge()
Default Constructor |
|
Charge(double x,
double y,
double c)
Location and Charge constructor |
Method Summary | |
---|---|
boolean |
checkClick(java.awt.event.MouseEvent e)
Checks to see if this was clicked on. |
int |
compareTo(java.lang.Object obj)
Compares this to another charge by comparing charge values |
void |
drawOutline(java.awt.Graphics g)
Draws the shape. |
double |
getCharge()
Returns the charge of this Charge object. |
java.lang.String |
getChargeText()
Gets the charge in text form. |
double |
getHeight()
Gets the height of the charge, default is 1/2 of getSize(), can be overridden |
double |
getLength()
Gets the length of the charge, default is 1/2 of getSize(), can be overridden |
int |
getPaintX()
Gets the X Location as used for painting |
int |
getPaintY()
Gets the Y Location as used for painting |
double |
getSize()
Size of charge for painting, currently set at 16. |
Charge.ChargeType |
getType()
|
double |
getX()
|
double |
getY()
|
abstract boolean |
isInside(double x,
double y)
Needs to be overridden by implementing classes |
abstract void |
paint(java.awt.Graphics g)
Paint method, to be overridden by implementing classes |
abstract void |
reBuildShape()
Builder for shape object, to be overridden by implementing classes |
void |
setCharge(double charge)
|
protected void |
setType(Charge.ChargeType type)
|
void |
setX(double X)
|
void |
setY(double Y)
|
java.lang.String |
toStringShort()
A shorter version of toString(); |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public boolean isSel
protected java.awt.Shape myShape
Constructor Detail |
---|
public Charge()
public Charge(double x, double y, double c)
x
- X Location (in pixels)y
- Y Location (in pixels)c
- charger (in columbs)Method Detail |
---|
public boolean checkClick(java.awt.event.MouseEvent e)
e
- MouseEvent, passed from Launcher.win
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
obj
- Object, must be type Charge
public void drawOutline(java.awt.Graphics g)
g
- Graphics for painting.public double getCharge()
public java.lang.String getChargeText()
public double getHeight()
getSize()
public double getLength()
getSize()
public int getPaintX()
public int getPaintY()
public double getSize()
public Charge.ChargeType getType()
public double getX()
public double getY()
public abstract boolean isInside(double x, double y)
x
- X location of point to checky
- Y location of point to check
public abstract void paint(java.awt.Graphics g)
g
- Graphics object for paintingpublic abstract void reBuildShape()
myShape
public void setCharge(double charge)
charge
- sets charge valuepublic void setX(double X)
X
- sets the x location value
min val of -1600,
max val of 1600public void setY(double Y)
Y
- sets the y location value and rebuilds the shape
min val of -1600,
max val of 1600public java.lang.String toStringShort()
protected void setType(Charge.ChargeType type)
type
- The type to set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |