Commit f17007f1 authored by Allan MILHOMME's avatar Allan MILHOMME

test

parent 15353732
......@@ -21,19 +21,19 @@ public class AndInfo extends HigherInfo
}
@Override
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, HigherInfo otherInfo, HigherInfo refInfos) {
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, HigherInfo otherInfo, SpaceInfos refInfos) {
return new AndInfo(this.info1.apply(thisExp, otherExp, opType, otherInfo, refInfos),
this.info2.apply(thisExp, otherExp, opType, otherInfo, refInfos));
}
@Override
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, ValueInfo otherInfo, HigherInfo refInfos) {
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, ValueInfo otherInfo, SpaceInfos refInfos) {
return new AndInfo(this.info1.apply(thisExp, otherExp, opType, otherInfo, refInfos),
this.info2.apply(thisExp, otherExp, opType, otherInfo, refInfos));
}
@Override
public HigherInfo knowing(OperationList caller, OperationList thisExp, OperationList otherExp, OperationEnum opType, HigherInfo refInfos) {
public HigherInfo knowing(OperationList caller, OperationList thisExp, OperationList otherExp, OperationEnum opType, SpaceInfos refInfos) {
return new AndInfo(
this.info1.knowing(caller, thisExp, otherExp, opType, refInfos),
this.info2.knowing(caller, thisExp, otherExp, opType, refInfos)
......@@ -41,12 +41,12 @@ public class AndInfo extends HigherInfo
}
@Override
public boolean isTrue(HigherInfo info) {
public boolean isTrue(SpaceInfos info) {
return this.info1.isTrue(info) || this.info2.isTrue(info);
}
@Override
public boolean isFalse(HigherInfo info) {
public boolean isFalse(SpaceInfos info) {
return this.info1.isFalse(info) || this.info2.isFalse(info);
}
......@@ -88,7 +88,7 @@ public class AndInfo extends HigherInfo
}
@Override
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
public HigherInfo accessArray(OperationList index, SpaceInfos refInfos) {
return new AndInfo(this.info1.accessArray(index, null), this.info2.accessArray(index, null));
}
}
......@@ -20,11 +20,11 @@ public class ArrayInfo extends HigherInfo
}
@Override
public HigherInfo accessArray(OperationList index, HigherInfo refInfos)
public HigherInfo accessArray(OperationList index, SpaceInfos refInfos)
{
OperationList opList = this.index.apply(new MethodUse(OperationEnum.INT_EQ, index));
if (opList.getInfos(refInfos, false).isTrue())
if (opList.getInfos(refInfos).isTrue(refInfos))
if (!(this.info instanceof ValueInfo))
return this.info;
return new ArrayInfo(this.index, this.info.accessArray(index, refInfos));
......@@ -32,21 +32,21 @@ public class ArrayInfo extends HigherInfo
@Override
public HigherInfo apply(OperationList refExp, OperationList argExp, OperationEnum opType, HigherInfo arg,
HigherInfo refInfos)
SpaceInfos refInfos)
{
return NoInfo.instance;
}
@Override
public HigherInfo apply(OperationList refExp, OperationList argExp, OperationEnum opType, ValueInfo arg,
HigherInfo refInfos)
SpaceInfos refInfos)
{
return NoInfo.instance;
}
@Override
public HigherInfo knowing(OperationList resultExp, OperationList refExp, OperationList argExp, OperationEnum opType,
HigherInfo refInfos)
SpaceInfos refInfos)
{
return NoInfo.instance;
}
......@@ -67,13 +67,13 @@ public class ArrayInfo extends HigherInfo
}
@Override
public boolean isTrue(HigherInfo refInfos)
public boolean isTrue(SpaceInfos refInfos)
{
return false;
}
@Override
public boolean isFalse(HigherInfo refInfos)
public boolean isFalse(SpaceInfos refInfos)
{
return false;
}
......
......@@ -34,7 +34,7 @@ public class ArrayOperation implements Operation
@Override
public HigherInfo apply(HigherInfo onInfo, OperationList on, HigherInfo refInfos)
public HigherInfo apply(HigherInfo onInfo, OperationList on, SpaceInfos refInfos)
{
System.out.println("Passe in : apply");
return null;
......@@ -42,7 +42,7 @@ public class ArrayOperation implements Operation
@Override
public AndInfo knowing(HigherInfo resultInfo, OperationList resultList, OperationList callerList,
HigherInfo refInfos)
SpaceInfos refInfos)
{
System.out.println("Passe in : knowing");
return null;
......
......@@ -11,13 +11,13 @@ public class FieldAccess implements Operation
}
@Override
public HigherInfo apply(HigherInfo onInfo, OperationList on, HigherInfo refInfos) {
public HigherInfo apply(HigherInfo onInfo, OperationList on, SpaceInfos refInfos) {
return onInfo.access(this.var);
}
@Override
public AndInfo knowing(HigherInfo resultInfo, OperationList resultList, OperationList callerList,
HigherInfo refInfos) {
SpaceInfos refInfos) {
return new AndInfo(resultInfo, NoInfo.instance);
}
......
......@@ -14,29 +14,29 @@ public class FieldInfo extends HigherInfo
@Override
public HigherInfo apply(OperationList refExp, OperationList argExp, OperationEnum opType, HigherInfo arg,
HigherInfo refInfos) {
SpaceInfos refInfos) {
return NoInfo.instance;
}
@Override
public HigherInfo apply(OperationList refExp, OperationList argExp, OperationEnum opType, ValueInfo arg,
HigherInfo refInfos) {
SpaceInfos refInfos) {
return NoInfo.instance;
}
@Override
public HigherInfo knowing(OperationList resultExp, OperationList refExp, OperationList argExp, OperationEnum opType,
HigherInfo refInfos) {
SpaceInfos refInfos) {
return NoInfo.instance;
}
@Override
public boolean isTrue(HigherInfo refInfos) {
public boolean isTrue(SpaceInfos refInfos) {
return false;
}
@Override
public boolean isFalse(HigherInfo refInfos) {
public boolean isFalse(SpaceInfos refInfos) {
return false;
}
......@@ -68,7 +68,7 @@ public class FieldInfo extends HigherInfo
}
@Override
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
public HigherInfo accessArray(OperationList index, SpaceInfos refInfos) {
return new FieldInfo(this.var, this.info.accessArray(index, null));
}
......
......@@ -7,16 +7,13 @@ import language.parser.tokens.Access;
public abstract class HigherInfo {
public abstract HigherInfo access(Variable v);
public abstract HigherInfo accessArray(OperationList index, HigherInfo refInfos);
public abstract HigherInfo apply(OperationList refExp, OperationList argExp, OperationEnum opType, HigherInfo arg, HigherInfo refInfos);
public abstract HigherInfo apply(OperationList refExp, OperationList argExp, OperationEnum opType, ValueInfo arg, HigherInfo refInfos);
public abstract HigherInfo knowing(OperationList resultExp, OperationList refExp, OperationList argExp, OperationEnum opType, HigherInfo refInfos);
public abstract HigherInfo accessArray(OperationList index, SpaceInfos refInfos);
public abstract HigherInfo apply(OperationList refExp, OperationList argExp, OperationEnum opType, HigherInfo arg, SpaceInfos refInfos);
public abstract HigherInfo apply(OperationList refExp, OperationList argExp, OperationEnum opType, ValueInfo arg, SpaceInfos refInfos);
public abstract HigherInfo knowing(OperationList resultExp, OperationList refExp, OperationList argExp, OperationEnum opType, SpaceInfos refInfos);
public final boolean isTrue() {return this.isTrue(this);}
public final boolean isFalse() {return this.isFalse(this);}
public abstract boolean isTrue(HigherInfo refInfos);
public abstract boolean isFalse(HigherInfo refInfos);
public abstract boolean isTrue(SpaceInfos refInfos);
public abstract boolean isFalse(SpaceInfos refInfos);
public abstract HigherInfo normalize();
public abstract HigherInfo inverse();
......
......@@ -23,9 +23,9 @@ public class IfInflow extends Inflow {
{
this.inflows[i] = new BasicInflow(this, parent.getAllInfos());
this.deduced[i] = this.conditions[i].knowing(true, parent.getAllInfos());
this.conditions[i].knowing(true, this.inflows[i].currentInfos);
for (int j=0;j < i - 1;j++)
this.deduced[i] = new AndInfo(this.deduced[i], this.conditions[i].knowing(false, parent.getAllInfos()));
this.conditions[j].knowing(false, this.inflows[i].currentInfos);
}
}
......@@ -56,22 +56,22 @@ public class IfInflow extends Inflow {
for (VariableValue v : changedValues)
{
IfInfo currentInfo = new IfInfo(this.conditions[0], this.inflows[0].getAllInfos().getInfosOn(v), NoInfo.instance);
HigherInfo firstInfo = currentInfo;
HigherInfo afterInfo = this.ifElse.ifs[0].canEscape() ? NoInfo.instance : this.conditions[0].knowing(false, this.getParentInflow().getAllInfos().getInfosOn(v));
for (int i=1;i<this.conditions.length - 1;i++)
IfInfo firstInfo = null, preInfo = null;
for (int i=0;i<this.conditions.length - 1;i++)
{
IfInfo info = new IfInfo(this.conditions[i], this.inflows[i].getAllInfos().getInfosOn(v), null);
currentInfo.els = info;
currentInfo = info;
IfInfo info = new IfInfo(this.conditions[i], this.inflows[i].getAllInfos().getInfosOn(v), NoInfo.instance);
if (i == 0)
firstInfo = preInfo = info;
preInfo.els = info;
preInfo = info;
if (this.ifElse.ifs[i].canEscape())
afterInfo = new AndInfo(afterInfo, this.conditions[i].knowing(false, this.getParentInflow().getAllInfos().getInfosOn(v)));
if (!this.ifElse.ifs[i].canEscape())
this.conditions[i].knowing(false, newInfos);
}
preInfo.els = this.inflows[this.conditions.length - 1].getAllInfos().getInfosOn(v);
currentInfo.els = this.inflows[this.conditions.length - 1].getAllInfos().getInfosOn(v);
afterInfo = new AndInfo(afterInfo, this.conditions[this.conditions.length - 1].knowing(false, this.getParentInflow().getAllInfos()));
newInfos.setInfo(v, firstInfo);
}
return newInfos;
......
......@@ -8,6 +8,8 @@ public class IfInfo extends HigherInfo
public final HigherInfo then;
public HigherInfo els;
public boolean beenTested = false;
public IfInfo(OperationList e, HigherInfo t, HigherInfo el) {
this.condition = e;
this.then = t;
......@@ -19,7 +21,7 @@ public class IfInfo extends HigherInfo
}
@Override
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, HigherInfo otherInfo, HigherInfo refInfos) {
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, HigherInfo otherInfo, SpaceInfos refInfos) {
return new IfInfo(
this.condition,
this.then.apply(thisExp, otherExp, opType, otherInfo, refInfos),
......@@ -27,7 +29,7 @@ public class IfInfo extends HigherInfo
}
@Override
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, ValueInfo otherInfo, HigherInfo refInfos) {
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, ValueInfo otherInfo, SpaceInfos refInfos) {
return new IfInfo(
this.condition,
this.then.apply(thisExp, otherExp, opType, otherInfo, refInfos),
......@@ -35,7 +37,7 @@ public class IfInfo extends HigherInfo
}
@Override
public HigherInfo knowing(OperationList caller, OperationList thisExp, OperationList otherExp, OperationEnum opType, HigherInfo refInfos)
public HigherInfo knowing(OperationList caller, OperationList thisExp, OperationList otherExp, OperationEnum opType, SpaceInfos refInfos)
{
return new IfInfo(this.condition,
this.then.knowing(caller, thisExp, otherExp, opType, refInfos),
......@@ -43,7 +45,7 @@ public class IfInfo extends HigherInfo
}
@Override
public boolean isTrue(HigherInfo refInfos)
public boolean isTrue(SpaceInfos refInfos)
{
if (this.test(refInfos))
return this.then.isTrue(refInfos);
......@@ -51,7 +53,7 @@ public class IfInfo extends HigherInfo
}
@Override
public boolean isFalse(HigherInfo refInfos)
public boolean isFalse(SpaceInfos refInfos)
{
if (this.test(refInfos))
return this.then.isFalse(refInfos);
......@@ -77,9 +79,15 @@ public class IfInfo extends HigherInfo
return new IfInfo(this.condition, this.then.inverse(), this.els.inverse());
}
public boolean test(HigherInfo refInfos)
public boolean test(SpaceInfos refInfos)
{
return this.condition.getInfos(refInfos.removeInfo(this), false).isTrue();
if (this.beenTested)
return false;
this.beenTested = true;
boolean i = this.condition.getInfos(refInfos).isTrue(refInfos);
this.beenTested = false;
return i;
}
@Override
......@@ -102,7 +110,7 @@ public class IfInfo extends HigherInfo
}
@Override
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
public HigherInfo accessArray(OperationList index, SpaceInfos refInfos) {
return new IfInfo(this.condition, this.then.accessArray(index, null), this.els.accessArray(index, null));
}
}
......@@ -34,27 +34,21 @@ public class MethodUse implements Operation
}
@Override
public HigherInfo apply(HigherInfo onInfo, OperationList on, HigherInfo refInfos) {
public HigherInfo apply(HigherInfo onInfo, OperationList on, SpaceInfos refInfos) {
if (dec != null)
return dec.getResultInfo();
if (this.args.length == 0)
return onInfo.apply(on, null, this.opType, null, refInfos);
return onInfo.apply(on, this.args[0], this.opType, this.args[0].getInfos(refInfos, false), refInfos);
return onInfo.apply(on, this.args[0], this.opType, this.args[0].getInfos(refInfos), refInfos);
}
@Override
public AndInfo knowing(HigherInfo resultInfo, OperationList resultList, OperationList callerList, HigherInfo refInfos) {
public HigherInfo knowing(HigherInfo resultInfo, OperationList resultList, OperationList callerList, SpaceInfos refInfos) {
if (this.args.length == 0)
return new AndInfo(
resultInfo.knowing(resultList, callerList, null, this.opType, refInfos),
NoInfo.instance
);
return new AndInfo(
resultInfo.knowing(resultList, callerList, this.args[0], this.opType, refInfos),
this.args[0].knowing(resultInfo.getInfosOn(this.args[0].getLastValue()), refInfos)
);
return resultInfo.knowing(resultList, callerList, null, this.opType, refInfos);
return resultInfo.knowing(resultList, callerList, this.args[0], this.opType, refInfos);
}
@Override
public String toString()
......
......@@ -10,27 +10,27 @@ public class NoInfo extends HigherInfo {
private NoInfo() {}
@Override
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, HigherInfo otherInfo, HigherInfo refInfos) {
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, HigherInfo otherInfo, SpaceInfos refInfos) {
return this;
}
@Override
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, ValueInfo otherInfo, HigherInfo refInfos) {
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, ValueInfo otherInfo, SpaceInfos refInfos) {
return this;
}
@Override
public HigherInfo knowing(OperationList caller, OperationList thisExp, OperationList otherExp, OperationEnum opType, HigherInfo refInfos) {
public HigherInfo knowing(OperationList caller, OperationList thisExp, OperationList otherExp, OperationEnum opType, SpaceInfos refInfos) {
return this;
}
@Override
public boolean isTrue(HigherInfo info) {
public boolean isTrue(SpaceInfos info) {
return false;
}
@Override
public boolean isFalse(HigherInfo info) {
public boolean isFalse(SpaceInfos info) {
return false;
}
......@@ -60,7 +60,7 @@ public class NoInfo extends HigherInfo {
}
@Override
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
public HigherInfo accessArray(OperationList index, SpaceInfos refInfos) {
return this;
}
......
package inflow;
public interface Operation {
public HigherInfo apply(HigherInfo onInfo, OperationList on, HigherInfo refInfos);
public AndInfo knowing(HigherInfo resultInfo, OperationList resultList, OperationList callerList, SpaceInfos refInfos);
public HigherInfo apply(HigherInfo onInfo, OperationList on, SpaceInfos refInfos);
public HigherInfo knowing(HigherInfo resultInfo, OperationList resultList, OperationList callerList, SpaceInfos refInfos);
}
......@@ -45,30 +45,17 @@ public class OperationList
return list;
}
public HigherInfo getInfos(HigherInfo refInfos)
{
return this.getInfos(refInfos, false);
}
public HigherInfo getInfos(HigherInfo refInfos, boolean accumulate)
public HigherInfo getInfos(SpaceInfos refInfos)
{
HigherInfo info = this.getFirstValueInfo(refInfos);
int i = 0;
for (Operation o : this.operationList)
{
HigherInfo temp = o.apply(info, this, refInfos);
if (accumulate)
info = new AndInfo(info, temp.setValue(this.selfValues[i++])).normalize();
else
info = temp;
}
info = o.apply(info, this, refInfos);
return info;
}
public HigherInfo getFirstValueInfo(HigherInfo refInfos)
public HigherInfo getFirstValueInfo(SpaceInfos refInfos)
{
if (this.baseValue instanceof VariableValue)
return ((VariableValue)this.baseValue).getInfos(refInfos);
......@@ -76,12 +63,12 @@ public class OperationList
return ((ConstantValue)this.baseValue).value;
}
public SpaceInfos knowing(boolean value, SpaceInfos refInfos)
public void knowing(boolean value, SpaceInfos refInfos)
{
return this.knowing(new ValueInfo(new BooleanValueInfo(value)), refInfos);
this.knowing(new ValueInfo(new BooleanValueInfo(value)), refInfos);
}
public SpaceInfos knowing(HigherInfo resultInfo, SpaceInfos refInfos)
public void knowing(HigherInfo resultInfo, SpaceInfos refInfos)
{
SpaceInfos totalDeduced = new SpaceInfos();
for(int i=this.operationList.size() - 1; ;i--)
......@@ -93,24 +80,7 @@ public class OperationList
}
Operation op = this.operationList.get(i);
AndInfo tempInfo = op.knowing(resultInfo, this.copy(i + 1), this.copy(i), refInfos);
resultInfo = tempInfo.info1.normalize();
if (op instanceof MethodUse && ((MethodUse)op).args.length == 1)
totalDeduced.merge(((MethodUse)op).args[0].knowing(tempInfo.info2.normalize(), refInfos));
}
}
public SpaceInfos knowing(HigherInfo resultInfo, SpaceInfos refInfos, int i)
{
if (i == -1)
{
if (this.baseValue instanceof VariableValue)
{
totalDeduced.addInfo((VariableValue)this.baseValue, new AndInfo(toAdd, resultInfo));
return new AndInfo(toAdd, resultInfo).setValue(this.baseValue).normalize();
}
return NoInfo.instance;
resultInfo = op.knowing(resultInfo, this.copy(i + 1), this.copy(i), refInfos);
}
}
......
......@@ -23,19 +23,19 @@ public class OrInfo extends HigherInfo
}
@Override
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, HigherInfo otherInfo, HigherInfo refInfos) {
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, HigherInfo otherInfo, SpaceInfos refInfos) {
return new OrInfo(this.info1.apply(thisExp, otherExp, opType, otherInfo, refInfos),
this.info2.apply(thisExp, otherExp, opType, otherInfo, refInfos));
}
@Override
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, ValueInfo otherInfo, HigherInfo refInfos) {
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, ValueInfo otherInfo, SpaceInfos refInfos) {
return new OrInfo(this.info1.apply(thisExp, otherExp, opType, otherInfo, refInfos),
this.info2.apply(thisExp, otherExp, opType, otherInfo, refInfos));
}
@Override
public HigherInfo knowing(OperationList caller, OperationList thisExp, OperationList otherExp, OperationEnum opType, HigherInfo refInfos) {
public HigherInfo knowing(OperationList caller, OperationList thisExp, OperationList otherExp, OperationEnum opType, SpaceInfos refInfos) {
return new OrInfo(
this.info1.knowing(caller, thisExp, otherExp, opType, refInfos),
this.info2.knowing(caller, thisExp, otherExp, opType, refInfos)
......@@ -43,12 +43,12 @@ public class OrInfo extends HigherInfo
}
@Override
public boolean isTrue(HigherInfo info) {
public boolean isTrue(SpaceInfos info) {
return this.info1.isTrue(info) && this.info2.isTrue(info);
}
@Override
public boolean isFalse(HigherInfo info) {
public boolean isFalse(SpaceInfos info) {
return this.info1.isFalse(info) && this.info2.isFalse(info);
}
......@@ -91,7 +91,7 @@ public class OrInfo extends HigherInfo
}
@Override
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
public HigherInfo accessArray(OperationList index, SpaceInfos refInfos) {
return new OrInfo(this.info1.accessArray(index, null), this.info2.accessArray(index, null));
}
}
......@@ -13,7 +13,7 @@ public class ValueInfo extends HigherInfo
}
@Override
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, HigherInfo arg, HigherInfo refInfos)
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, HigherInfo arg, SpaceInfos refInfos)
{
if (arg == null)
return this.info.apply(thisExp, otherExp, opType, null, refInfos);
......@@ -22,7 +22,7 @@ public class ValueInfo extends HigherInfo
}
@Override
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, ValueInfo arg, HigherInfo refInfos)
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, ValueInfo arg, SpaceInfos refInfos)
{
if (arg == null)
return this.info.apply(thisExp, otherExp, opType, null, refInfos);
......@@ -32,17 +32,17 @@ public class ValueInfo extends HigherInfo
@Override
public HigherInfo knowing(OperationList caller, OperationList thisExp, OperationList otherExp, OperationEnum opType, HigherInfo refInfos) {
public HigherInfo knowing(OperationList caller, OperationList thisExp, OperationList otherExp, OperationEnum opType, SpaceInfos refInfos) {
return this.info.knowing(caller, thisExp, otherExp, opType, refInfos);
}
@Override
public boolean isTrue(HigherInfo info) {
public boolean isTrue(SpaceInfos info) {
return this.info instanceof BooleanValueInfo && ((BooleanValueInfo)this.info).value;
}
@Override
public boolean isFalse(HigherInfo info) {
public boolean isFalse(SpaceInfos info) {
return this.info instanceof BooleanValueInfo && !((BooleanValueInfo)this.info).value;
}
......@@ -76,7 +76,7 @@ public class ValueInfo extends HigherInfo
}
@Override
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
public HigherInfo accessArray(OperationList index, SpaceInfos refInfos) {
return NoInfo.instance;
}
......
......@@ -17,7 +17,7 @@ public class VariableValue implements Value
return this.possessedBy.getName();
}
public HigherInfo getInfos(HigherInfo refInfos)
public HigherInfo getInfos(SpaceInfos refInfos)
{
return new AndInfo(refInfos.getInfosOn(this), HigherInfo.getSelfInfo(this, this.possessedBy.getType().getClassDeclaration().getFullAccess()));
}
......
......@@ -3,29 +3,30 @@ package info;
import inflow.HigherInfo;
import inflow.OperationEnum;
import inflow.OperationList;
import inflow.SpaceInfos;
import inflow.VariableValue;
public abstract class Info {
public boolean deduced = false;
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, Info otherInfo, HigherInfo refInfos)
public HigherInfo apply(OperationList thisExp, OperationList otherExp, OperationEnum opType, Info otherInfo, SpaceInfos refInfos)
{
if (opType.argAccesses.length == 0)
return this.apply0(thisExp, opType, refInfos);
return this.apply1(thisExp, otherExp, opType, otherInfo, refInfos);
}
public abstract HigherInfo apply0(OperationList refExp, OperationEnum opType, HigherInfo refInfos);
public abstract HigherInfo apply1(OperationList refExp, OperationList argExp, OperationEnum opType, Info otherInfo, HigherInfo refInfos);
public abstract HigherInfo apply0(OperationList refExp, OperationEnum opType, SpaceInfos refInfos);
public abstract HigherInfo apply1(OperationList refExp, OperationList argExp, OperationEnum opType, Info otherInfo, SpaceInfos refInfos);
public HigherInfo knowing(OperationList caller, OperationList thisExp, OperationList otherExp, OperationEnum opType, HigherInfo refInfos)
public HigherInfo knowing(OperationList caller, OperationList thisExp, OperationList otherExp, OperationEnum opType, SpaceInfos refInfos)
{
if (opType.argAccesses.length == 0)
return this.knowing0(caller, thisExp, opType, refInfos);
return this.knowing1(caller, thisExp, otherExp, opType, refInfos);
}
public abstract HigherInfo knowing0(OperationList resultExp, OperationList refExp, OperationEnum opType, HigherInfo refInfos);
public abstract HigherInfo knowing1(OperationList resultExp, OperationList refExp, OperationList argExp, OperationEnum opType, HigherInfo refInfos);
public abstract HigherInfo knowing0(OperationList resultExp, OperationList refExp, OperationEnum opType, SpaceInfos refInfos);
public abstract HigherInfo knowing1(OperationList resultExp, OperationList refExp, OperationList argExp, OperationEnum opType, SpaceInfos refInfos);
public abstract HigherInfo inverse();
public abstract boolean use(VariableValue value);
......
......@@ -10,6 +10,7 @@ import inflow.NoInfo;
import inflow.OperationEnum;
import inflow.OperationList;
import inflow.OrInfo;
import inflow.SpaceInfos;
import inflow.ValueInfo;
import inflow.VariableValue;
......@@ -26,7 +27,7 @@ public class IntRangeInfo extends Info
}
@Override
public HigherInfo apply0(OperationList thisExp, OperationEnum opType, HigherInfo refInfos) {
public HigherInfo apply0(OperationList thisExp, OperationEnum opType, SpaceInfos refInfos) {
if (opType == OperationEnum.INT_NOT)
return new ValueInfo(new IntRangeInfo(this.max.not(), this.min.not()));
else if (opType == OperationEnum.INT_UP_TO)
......@@ -41,7 +42,7 @@ public class IntRangeInfo extends Info
}
@Override
public HigherInfo apply1(OperationList thisExp, OperationList otherExp, OperationEnum opType, Info otherInfo, HigherInfo refInfos) {
public HigherInfo apply1(OperationList thisExp, OperationList otherExp, OperationEnum opType, Info otherInfo, SpaceInfos refInfos) {
IntRangeInfo range = (IntRangeInfo)otherInfo;
if (opType == OperationEnum.INT_ADD) // TODO Tenir compte des effets de bords
......@@ -54,8 +55,8 @@ public class IntRangeInfo extends Info
return this.div(thisExp, otherExp, range, refInfos);
else if (opType == OperationEnum.INT_EXPAND)
{
boolean pos = otherExp.applySup0().getInfos(refInfos, false).isTrue();
boolean neg = otherExp.applySup0().getInfos(refInfos, false).isFalse();