Skip to content
Snippets Groups Projects
Commit 9e717b15 authored by Ludovic Apvrille's avatar Ludovic Apvrille
Browse files

Bug on invariants partially resolved

parent 1fae7e49
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
...@@ -285,8 +285,8 @@ public class IntMatrix { ...@@ -285,8 +285,8 @@ public class IntMatrix {
} }
// noMultiplier indicates whether names of lines may contain the "*" sign, or not.
public void Farkas() { public void Farkas(boolean noMultiplier) {
int sizeColumBeforeConcat = sizeColumn; int sizeColumBeforeConcat = sizeColumn;
IntMatrix idMat = new IntMatrix(sizeRow, sizeRow); IntMatrix idMat = new IntMatrix(sizeRow, sizeRow);
idMat.makeID(); idMat.makeID();
...@@ -297,6 +297,7 @@ public class IntMatrix { ...@@ -297,6 +297,7 @@ public class IntMatrix {
int l, i; int l, i;
String s0, s1; String s0, s1;
String nameOfNewLine; String nameOfNewLine;
int cpt;
for(int j=0; j<sizeColumBeforeConcat; j++) { for(int j=0; j<sizeColumBeforeConcat; j++) {
// Loop on lines to add line combinations // Loop on lines to add line combinations
...@@ -314,14 +315,28 @@ public class IntMatrix { ...@@ -314,14 +315,28 @@ public class IntMatrix {
if (Math.abs(lined2[j]) == 1) { if (Math.abs(lined2[j]) == 1) {
s0 = nameOfRows[i] + " + "; s0 = nameOfRows[i] + " + ";
} else { } else {
s0 = "" + Math.abs(lined2[j]) + "*(" + nameOfRows[i] + ") + "; if (noMultiplier) {
s0 = nameOfRows[i] + " + ";
for(cpt=Math.abs(lined2[j]); cpt>1; cpt--) {
s0 += nameOfRows[i] + " + " ;
}
} else {
s0 = "" + Math.abs(lined2[j]) + "*(" + nameOfRows[i] + ") + ";
}
} }
if (Math.abs(lined2[j]) == 1) { if (Math.abs(lined1[j]) == 1) {
s1 = nameOfRows[k]; s1 = nameOfRows[k];
} else { } else {
s1 = "" + Math.abs(lined1[j]) + "*(" + nameOfRows[k] + ")"; if (noMultiplier) {
} s1 = nameOfRows[k];
for(cpt=Math.abs(lined1[j]); cpt>1; cpt--) {
s1 += " +" + nameOfRows[k];
}
} else {
s1 = "" + Math.abs(lined1[j]) + "*(" + nameOfRows[k] + ") + ";
}
}
nameOfNewLine = s0 + s1; nameOfNewLine = s0 + s1;
gcd = MyMath.gcd(lined); gcd = MyMath.gcd(lined);
...@@ -343,7 +358,7 @@ public class IntMatrix { ...@@ -343,7 +358,7 @@ public class IntMatrix {
for(i=0;i<sizeRow; i++) { for(i=0;i<sizeRow; i++) {
if (matrice[i][j] != 0) { if (matrice[i][j] != 0) {
removeLine(i); removeLine(i);
System.out.println("matafterremove " + i + "=\n" + toString() + "\n\n"); //System.out.println("matafterremove " + i + "=\n" + toString() + "\n\n");
i--; i--;
} }
} }
......
...@@ -73,12 +73,16 @@ public class Invariant implements GenericTree { ...@@ -73,12 +73,16 @@ public class Invariant implements GenericTree {
} }
public void addComponent(TGComponent _tgc) { public void addComponent(TGComponent _tgc) {
if (_tgc == null) {
TraceManager.addDev("NULL Component added to invariant -> IGNORING");
return;
}
components.add(_tgc); components.add(_tgc);
} }
public String toString() { public String toString() {
return name; return "(" + value + ") " + name;
} }
public int getChildCount() { public int getChildCount() {
......
...@@ -186,7 +186,7 @@ public class AvatarCDBlock extends TGCScalableWithInternalComponent implements S ...@@ -186,7 +186,7 @@ public class AvatarCDBlock extends TGCScalableWithInternalComponent implements S
Color avat = ColorManager.AVATAR_BLOCK; Color avat = ColorManager.AVATAR_BLOCK;
int h; int h;
h = 2* (currentFontSize + (int)(textY1 * tdp.getZoom())) + 2; h = 2* (currentFontSize + (int)(textY1 * tdp.getZoom())) + 2;
g.setColor(new Color(avat.getRed(), avat.getGreen(), avat.getBlue() + (getMyDepth() * 10))); g.setColor(new Color(avat.getRed(), avat.getGreen(), Math.min(255, avat.getBlue() + (getMyDepth() * 10))));
g.fill3DRect(x+1, y+1, width-1, Math.min(h, height)-1, true); g.fill3DRect(x+1, y+1, width-1, Math.min(h, height)-1, true);
g.setColor(c); g.setColor(c);
...@@ -219,7 +219,7 @@ public class AvatarCDBlock extends TGCScalableWithInternalComponent implements S ...@@ -219,7 +219,7 @@ public class AvatarCDBlock extends TGCScalableWithInternalComponent implements S
h = h +2; h = h +2;
if (h < height) { if (h < height) {
//g.drawLine(x, y+h, x+width, y+h); //g.drawLine(x, y+h, x+width, y+h);
g.setColor(new Color(avat.getRed(), avat.getGreen(), avat.getBlue() + (getMyDepth() * 10))); g.setColor(new Color(avat.getRed(), avat.getGreen(), Math.min(255, avat.getBlue() + (getMyDepth() * 10))));
g.fill3DRect(x+1, y+h, width-1, height-1-h, true); g.fill3DRect(x+1, y+h, width-1, height-1-h, true);
g.setColor(c); g.setColor(c);
} }
......
src/ui/images/starting_logo.gif

62.3 KiB | W: | H:

src/ui/images/starting_logo.gif

65.1 KiB | W: | H:

src/ui/images/starting_logo.gif
src/ui/images/starting_logo.gif
src/ui/images/starting_logo.gif
src/ui/images/starting_logo.gif
  • 2-up
  • Swipe
  • Onion skin
...@@ -76,7 +76,7 @@ public class InvariantDataTree implements GenericTree { ...@@ -76,7 +76,7 @@ public class InvariantDataTree implements GenericTree {
public Object getChild(int index) { public Object getChild(int index) {
LinkedList<Invariant> invs = mgui.getInvariants(); LinkedList<Invariant> invs = mgui.getInvariants();
if (invs.size() == 0) { if (invs.size() == 0) {
return "Not yet performed"; return "No invariant";
} }
return mgui.getInvariants().get(index); return mgui.getInvariants().get(index);
} }
......
...@@ -253,8 +253,8 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act ...@@ -253,8 +253,8 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act
testGo(); testGo();
jta.append("Computing invariants\n"); jta.append("Computing invariants\n");
im.Farkas(); im.Farkas(true);
jtainvariants.append("Invariants:\n" + im.namesOfRowToString() + "\n\n"); //jtainvariants.append("All invariants:\n" + im.namesOfRowToString() + "\n\n");
mgui.gtm.clearInvariants(); mgui.gtm.clearInvariants();
...@@ -274,6 +274,8 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act ...@@ -274,6 +274,8 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act
AvatarBlock prevBlock; AvatarBlock prevBlock;
int ignored = 0; int ignored = 0;
jtainvariants.append("Computed invariants:\n-----------------\n");
for(int i=0; i<im.getNbOfLines(); i++) { for(int i=0; i<im.getNbOfLines(); i++) {
name = im.getNameOfLine(i); name = im.getNameOfLine(i);
prevBlock = null; prevBlock = null;
...@@ -287,7 +289,7 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act ...@@ -287,7 +289,7 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act
state = 0; state = 0;
for(int j=0; j<elts.length; j++) { for(int j=0; j<elts.length; j++) {
tmp = elts[j].trim(); tmp = elts[j].trim();
TraceManager.addDev("#" + j + "=" + elts[j]); //TraceManager.addDev("#" + j + "=" + elts[j]);
tmp = Conversion.replaceAllString(tmp, "__", "&"); tmp = Conversion.replaceAllString(tmp, "__", "&");
tmps = tmp.split("&"); tmps = tmp.split("&");
if (tmps.length > 2) { if (tmps.length > 2) {
...@@ -303,14 +305,14 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act ...@@ -303,14 +305,14 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act
try { try {
myid = Integer.decode(tmps[2]).intValue(); myid = Integer.decode(tmps[2]).intValue();
o = ab.getStateMachine().getReferenceObjectFromID(myid); o = ab.getStateMachine().getReferenceObjectFromID(myid);
TraceManager.addDev("Adding component to inv block=" + ab.getName() + " id=" + myid + " object=" + o); //TraceManager.addDev("Adding component to inv block=" + ab.getName() + " id=" + myid + " object=" + o);
inv.addComponent((TGComponent)o); inv.addComponent((TGComponent)o);
TraceManager.addDev("Component added:" + o); //TraceManager.addDev("Component added:" + o);
if (o instanceof AvatarSMDStartState) { if (o instanceof AvatarSMDStartState) {
valToken ++; valToken ++;
} }
} catch (Exception e) { } catch (Exception e) {
TraceManager.addDev("Exception invariants:" + e.getMessage()); TraceManager.addDev("Exception invariants:" + e.getMessage() + "tmps[2]=" + tmps[2] + "inv=" + name);
} }
} }
} }
...@@ -318,8 +320,10 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act ...@@ -318,8 +320,10 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act
if (!(ignoreInvariants.isSelected() && sameBlock)) { if (!(ignoreInvariants.isSelected() && sameBlock)) {
mgui.gtm.addInvariant(inv); mgui.gtm.addInvariant(inv);
jtainvariants.append(inv + "\n");
} else { } else {
TraceManager.addDev("Invariant ignored " + inv); //TraceManager.addDev("Invariant ignored " + inv);
jtainvariants.append("Ignored invariant: " + inv + "\n");
ignored ++; ignored ++;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment