|
@@ -40,7 +40,7 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
|
|
|
private double scaleX;
|
|
|
private double scaleY;
|
|
|
//private float[] arrayOfFloats = null;
|
|
|
- private boolean[] arrayOfBooleans = null;
|
|
|
+ //private boolean[] arrayOfBooleans = null;
|
|
|
private double width = -1;
|
|
|
private double height = -1;
|
|
|
private boolean isElement = false;
|
|
@@ -177,7 +177,7 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
|
|
|
*/
|
|
|
|
|
|
} else if (isSwitch) {
|
|
|
- if (arrayOfBooleans != null) {
|
|
|
+ if (/*arrayOfBooleans*/current != null) {//Technically this test should be unnecessary
|
|
|
// array fillen
|
|
|
fillArrayofBooleans();
|
|
|
|
|
@@ -221,16 +221,16 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
|
|
|
|
|
|
// Iteration Value
|
|
|
g2.setColor(Color.BLUE);
|
|
|
- textWidth = g.getFontMetrics().stringWidth("" + arrayOfBooleans[effectiveX]) + 2;
|
|
|
+ textWidth = g.getFontMetrics().stringWidth("" + ((HolonSwitch)current).getActiveAt(model.getCurIteration())/*arrayOfBooleans[effectiveX]*/) + 2;
|
|
|
if (textWidth
|
|
|
+ (effectiveX) * (this.getWidth() - (border * 2)) / (/*model.getIterations()*/100 - 1) + 2
|
|
|
+ border <= this.getWidth()) {
|
|
|
- g2.drawString("" + arrayOfBooleans[effectiveX],
|
|
|
+ g2.drawString("" + ((HolonSwitch)current).getActiveAt(model.getCurIteration()),
|
|
|
(effectiveX) * (this.getWidth() - (border * 2)) / (/*model.getIterations()*/100 - 1)
|
|
|
+ 2 + border,
|
|
|
this.getHeight() - 10);
|
|
|
} else {
|
|
|
- g2.drawString("" + arrayOfBooleans[effectiveX],
|
|
|
+ g2.drawString("" + ((HolonSwitch)current).getActiveAt(model.getCurIteration()),
|
|
|
(effectiveX) * (this.getWidth() - (border * 2)) / (/*model.getIterations()*/100 - 1)
|
|
|
+ border - textWidth,
|
|
|
this.getHeight() - 10);
|
|
@@ -560,7 +560,6 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
|
|
|
pointList = null;
|
|
|
tempElements = null;
|
|
|
current = null;
|
|
|
- arrayOfBooleans = null;
|
|
|
isSwitch = false;
|
|
|
isElement = false;
|
|
|
repaint();
|
|
@@ -629,7 +628,7 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
|
|
|
*/
|
|
|
public void repaintWithNewSwitch(HolonSwitch s) {
|
|
|
current=s;
|
|
|
- arrayOfBooleans = s.getValueArray();
|
|
|
+ //arrayOfBooleans = s.getValueArray();
|
|
|
pointList = s.getGraphPoints();
|
|
|
isSwitch = true;
|
|
|
isElement = false;
|
|
@@ -675,14 +674,13 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
|
|
|
* Fills the Arrays with booleans.
|
|
|
*/
|
|
|
public void fillArrayofBooleans() {
|
|
|
- for (int i = 0; i < arrayOfBooleans.length; i++) {
|
|
|
- int t = (int) getYValueAt((int) (i * width / (model.getIterations() - 1)));
|
|
|
+ for (int i = 0; i < STANDARD_GRAPH_ACCURACY; i++) {
|
|
|
+ int t = (int) getYValueAt((int) (i * width / (STANDARD_GRAPH_ACCURACY - 1)));
|
|
|
if (t <= height / 2) {
|
|
|
- arrayOfBooleans[i] = true;
|
|
|
+ ((HolonSwitch)current).setActiveAt(i, true);
|
|
|
} else {
|
|
|
- arrayOfBooleans[i] = false;
|
|
|
+ ((HolonSwitch)current).setActiveAt(i, false);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|