com.ajc.esim.core
Class PointCharge

java.lang.Object
  extended by com.ajc.esim.core.Charge
      extended by com.ajc.esim.core.PointCharge
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public class PointCharge
extends Charge

Defines an point charge. A point charge represents a point in space (no size) that has a given electrical charge. This class holds location and charge information, it also can paint itself.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.ajc.esim.core.Charge
Charge.ChargeType
 
Field Summary
 
Fields inherited from class com.ajc.esim.core.Charge
isSel, myShape
 
Constructor Summary
PointCharge(double charg, double X, double Y)
          Constructor, double precision
PointCharge(double charg, int X, int Y)
          Constructor, integer percision
 
Method Summary
 boolean isInside(double x, double y)
          Checks to seen if a point is inside of the charge as it is drawn on the screen
 void paint(java.awt.Graphics g)
          Draws this on screen with Graphics g (cast to a Graphics 2D object internally).
 void reBuildShape()
          Creates Shape myShape(Defined in Charge).
 java.lang.String toString()
           
 
Methods inherited from class com.ajc.esim.core.Charge
checkClick, compareTo, drawOutline, getCharge, getChargeText, getHeight, getLength, getPaintX, getPaintY, getSize, getType, getX, getY, setCharge, setType, setX, setY, toStringShort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PointCharge

public PointCharge(double charg,
                   double X,
                   double Y)
Constructor, double precision

Parameters:
charg - charge in Coulombs
X - Horiz. Location of charge
Y - Vert. Location of charge

PointCharge

public PointCharge(double charg,
                   int X,
                   int Y)
Constructor, integer percision

Parameters:
charg - charge in Coulombs
X - Horiz. Location of charge
Y - Vert. Location of charge
Method Detail

isInside

public boolean isInside(double x,
                        double y)
Checks to seen if a point is inside of the charge as it is drawn on the screen

Specified by:
isInside in class Charge
Parameters:
x - X Location of point to check.
y - Y Location of point to check.
Returns:
boolean True if point (x,y) is covered by this when it is painted, otherwise false.

paint

public void paint(java.awt.Graphics g)
Draws this on screen with Graphics g (cast to a Graphics 2D object internally). Sets color based on charge sign. Draws this.myShape.

Specified by:
paint in class Charge
Parameters:
g - Graphics object used to paint.
See Also:
Charge.myShape

reBuildShape

public void reBuildShape()
Creates Shape myShape(Defined in Charge). The shape is defined as a Shape in Charge, it is set as a PointChargeShape in this method.

Specified by:
reBuildShape in class Charge
See Also:
sci.gui.PointChargeShape, Charge.myShape

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
String representing the data stored in this charge