com.ajc.esim.core
Class Data

java.lang.Object
  extended by com.ajc.esim.core.Data
All Implemented Interfaces:
java.io.Serializable

public class Data
extends java.lang.Object
implements java.io.Serializable

Stores all information for the program, written to file for program persistance.

See Also:
Serialized Form

Field Summary
 java.awt.Color backgroundColor
           
 int chargeScale
           
 boolean fieldLinesOn
           
 double gradMax
           
 double gradMin
           
 java.awt.Color gridColor
           
 boolean gridOn
           
 java.awt.Color infoBack
           
 int MainWinHeight
           
 int mainWinWidth
           
 java.awt.Color negColor
           
 int peRes
           
 int pLines
           
 java.awt.Color posColor
           
 java.awt.Color potentialColor
           
 boolean potentialLinesOn
           
 long potOffset
           
 long potspacing
           
static Prefix[] prefixes
          Array of Prefixes used for a feature still in devlopment.
 int prefixIndex
           
 double siFactor
           
 java.awt.Color text
           
 java.awt.Color tickColor
           
 boolean ticksOn
           
 int tickSpacing
           
 double totalPositiveCharge
           
 
Constructor Summary
Data()
          Creates new Data object.
 
Method Summary
 void addCharge(Charge c)
          Adds a charge to the Charges ArrayList
 void flushCharges()
          Clears all charges from the Charges ArrayList and then calls the System garbage collector
 Charge getCharge(int index)
          Gets the charge from the Charges array list at the given index.
 Charge[] getChargeArray()
           
 int getChargeIndex(Charge c)
          Gets the index of Charge c.
 int getChargeLength()
          Returns the length of the Charges ArrayList
 java.util.ArrayList<Charge> getCharges()
           
 int getNumLines()
          Gets the Charge density
 int getPeRes()
          Gets the potential line resolution
 Prefix getPrefix(int POT)
          Gets the prefix corrsponding to the specificed power of ten Currently returns only the 4th prefix (0)
 int getPrefixIndex()
          Gets the index of the current Prefix
 double getScale()
          Gets the Scale of the current prefix
 java.awt.Color negate(java.awt.Color in)
          Inverts the inverted color.
 void rebuildAllShapes()
          Calls reBuildShape on all charges.
 void removeCharge(Charge c)
          Removes a charge from the Charges ArrayList
 void removeCharge(int index)
          Removes a charge from the Charges ArrayList based on the index number
 void resetAll()
          Resets program variables to original values
 void setNumLines(int numLines)
          Sets the Charge Density
 void setPeRes(int peRes)
          Sets the Potential Resolution
 void setPrefix(int x)
          Sets the current prefix index.
 void setupColors()
          Sets all colors to defaults.
 void setupPrefixArray()
          initalizes the prefix array
 void updateScales()
          Updates the potential offset and spacing, field line color scale and field line distrobution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prefixes

public static Prefix[] prefixes
Array of Prefixes used for a feature still in devlopment.

See Also:
setupPrefixArray(), Prefix

backgroundColor

public java.awt.Color backgroundColor

gridColor

public java.awt.Color gridColor

infoBack

public java.awt.Color infoBack

negColor

public java.awt.Color negColor

posColor

public java.awt.Color posColor

potentialColor

public java.awt.Color potentialColor

text

public java.awt.Color text

tickColor

public java.awt.Color tickColor

fieldLinesOn

public boolean fieldLinesOn

gridOn

public boolean gridOn

potentialLinesOn

public boolean potentialLinesOn

ticksOn

public boolean ticksOn

siFactor

public double siFactor

totalPositiveCharge

public double totalPositiveCharge

MainWinHeight

public int MainWinHeight

chargeScale

public int chargeScale

mainWinWidth

public int mainWinWidth

pLines

public int pLines

peRes

public int peRes

prefixIndex

public int prefixIndex

tickSpacing

public int tickSpacing

gradMax

public double gradMax

gradMin

public double gradMin

potOffset

public long potOffset

potspacing

public long potspacing
Constructor Detail

Data

public Data()
Creates new Data object.

Method Detail

addCharge

public void addCharge(Charge c)
Adds a charge to the Charges ArrayList

Parameters:
c - Charge to add to list
See Also:
Charges

flushCharges

public void flushCharges()
Clears all charges from the Charges ArrayList and then calls the System garbage collector

See Also:
Charges

getCharge

public Charge getCharge(int index)
Gets the charge from the Charges array list at the given index.

Parameters:
index - Charges ArrayList item to return
Returns:
Charge
See Also:
Charge, Charges

getChargeIndex

public int getChargeIndex(Charge c)
Gets the index of Charge c.

Parameters:
c - Charge to find the index of
Returns:
Index of the given Charge in the Charges ArrayList
See Also:
Charges

getChargeLength

public int getChargeLength()
Returns the length of the Charges ArrayList

Returns:
Number of Charges in the Charges ArrayList
See Also:
Charges

getCharges

public java.util.ArrayList<Charge> getCharges()

getNumLines

public int getNumLines()
Gets the Charge density

Returns:
Charge density (double)
See Also:
numLines

getPeRes

public int getPeRes()
Gets the potential line resolution

Returns:
Potential resolution (integer)
See Also:
peRes

getPrefix

public Prefix getPrefix(int POT)
Gets the prefix corrsponding to the specificed power of ten Currently returns only the 4th prefix (0)

Parameters:
POT - Power Of Ten
Returns:
Prefix
See Also:
Prefix

getPrefixIndex

public int getPrefixIndex()
Gets the index of the current Prefix

Returns:
Index of current Prefix
See Also:
prefixes

getScale

public double getScale()
Gets the Scale of the current prefix

Returns:
Scaler of current prefix.
See Also:
Prefix.mult()

negate

public java.awt.Color negate(java.awt.Color in)
Inverts the inverted color.

Parameters:
in - Inital color
Returns:
Inverse of inital color

rebuildAllShapes

public void rebuildAllShapes()
Calls reBuildShape on all charges.

See Also:
Charge.reBuildShape()

removeCharge

public void removeCharge(Charge c)
Removes a charge from the Charges ArrayList

Parameters:
c - Charge to be removed
See Also:
Charges

removeCharge

public void removeCharge(int index)
Removes a charge from the Charges ArrayList based on the index number

Parameters:
index - Index of charge to be removed
See Also:
Charges

resetAll

public void resetAll()
Resets program variables to original values

See Also:
setupColors(), updateScales()

setNumLines

public void setNumLines(int numLines)
Sets the Charge Density

Parameters:
numLines - New charge density
See Also:
numLines

setPeRes

public void setPeRes(int peRes)
Sets the Potential Resolution

Parameters:
peRes - New potential resolution
See Also:
peRes

setPrefix

public void setPrefix(int x)
Sets the current prefix index.

Parameters:
x - new prefix index; must be between 8 and 0 inclusive.

setupColors

public void setupColors()
Sets all colors to defaults.


setupPrefixArray

public void setupPrefixArray()
initalizes the prefix array

See Also:
Prefix

updateScales

public void updateScales()
Updates the potential offset and spacing, field line color scale and field line distrobution.


getChargeArray

public Charge[] getChargeArray()