Commit 2da3d75d authored by Allan MILHOMME's avatar Allan MILHOMME

gne.

parent 3560dc42
......@@ -115,10 +115,4 @@ public class AndInfo extends HigherInfo
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
return new AndInfo(this.info1.accessArray(index, null), this.info2.accessArray(index, null));
}
@Override
public HigherInfo replaceAndRemoveOther(Value[] toReplace, OperationList[] replacement)
{
return new AndInfo(this.info1.replaceAndRemoveOther(toReplace, replacement),this.info2.replaceAndRemoveOther(toReplace, replacement));
}
}
......@@ -126,10 +126,4 @@ public class ArrayInfo extends HigherInfo
{
return new ArrayInfo(this.index, this.info.removeInfo(inf));
}
@Override
public HigherInfo replaceAndRemoveOther(Value[] toReplace, OperationList[] replacement)
{
return new ArrayInfo(index,this.info.replaceAndRemoveOther(toReplace, replacement));
}
}
\ No newline at end of file
......@@ -106,10 +106,4 @@ public class FieldInfo extends HigherInfo
}
return this;
}
@Override
public HigherInfo replaceAndRemoveOther(Value[] toReplace, OperationList[] replacement)
{
return new FieldInfo(var,this.info.replaceAndRemoveOther(toReplace, replacement));
}
}
......@@ -42,6 +42,4 @@ public abstract class HigherInfo {
return NoInfo.instance;
}
public abstract HigherInfo replaceAndRemoveOther(Value[] toReplace, OperationList[] replacement);
}
\ No newline at end of file
......@@ -134,10 +134,4 @@ public class IfInfo extends HigherInfo
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
return new IfInfo(this.condition, this.then.accessArray(index, null), this.els.accessArray(index, null));
}
@Override
public HigherInfo replaceAndRemoveOther(Value[] toReplace, OperationList[] replacement)
{
return new IfInfo(this.condition, this.then.replaceAndRemoveOther(toReplace, replacement),this.els.replaceAndRemoveOther(toReplace, replacement));
}
}
......@@ -37,10 +37,12 @@ public class MethodUse implements Operation
public HigherInfo apply(HigherInfo onInfo, OperationList on, HigherInfo refInfos) {
if (dec != null) {
return this.dec.apply().replaceAndRemoveOther(
this.dec.args.originalValues,
this.args
);
HigherInfo info = NoInfo.instance;
for (int i=0;i<this.dec.args.getVariableList().length;i++)
info = new AndInfo(info, this.args[i].getInfos(refInfos, false).setValue(this.dec.args.originalValues[i]));
return this.dec.apply(info);
}
if (this.args.length == 0)
......@@ -51,8 +53,14 @@ public class MethodUse implements Operation
@Override
public AndInfo knowing(HigherInfo resultInfo, OperationList resultList, OperationList callerList, HigherInfo refInfos) {
if (dec != null)
return (AndInfo)dec.knowing(resultInfo);
if (dec != null) {
HigherInfo info = NoInfo.instance;
for (int i=0;i<this.dec.args.getVariableList().length;i++)
info = new AndInfo(info, this.args[i].getInfos(refInfos, false).setValue(this.dec.args.originalValues[i]));
return this.dec.knowing(resultInfo, info);
}
if (this.args.length == 0)
return new AndInfo(
......
......@@ -89,10 +89,4 @@ public class NoInfo extends HigherInfo {
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
return this;
}
@Override
public HigherInfo replaceAndRemoveOther(Value[] toReplace, OperationList[] replacement)
{
return this;
}
}
......@@ -115,10 +115,4 @@ public class OrInfo extends HigherInfo
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
return new OrInfo(this.info1.accessArray(index, null), this.info2.accessArray(index, null));
}
@Override
public HigherInfo replaceAndRemoveOther(Value[] toReplace, OperationList[] replacement)
{
return new OrInfo(this.info1.replaceAndRemoveOther(toReplace, replacement),this.info2.replaceAndRemoveOther(toReplace, replacement));
}
}
......@@ -134,10 +134,4 @@ public class ValueInfo extends HigherInfo
public HigherInfo accessArray(OperationList index, HigherInfo refInfos) {
return NoInfo.instance;
}
@Override
public HigherInfo replaceAndRemoveOther(Value[] toReplace, OperationList[] replacement)
{
return new ValueInfo(value, this.info.replaceAndRemoveOther(toReplace, replacement));
}
}
......@@ -131,10 +131,4 @@ public class BooleanValueInfo extends Info
public boolean use(VariableValue value) {
return false;
}
@Override
public Info replaceAndRemoveOther(Value[] toReplace, OperationList[] replacement)
{
return this;
}
}
......@@ -53,17 +53,6 @@ public class Calcul
return new Calcul(this.calc1.mul(other.calc2), this.calc2.mul(other.calc1)).normalize();
}
public Calcul replaceAndRemoveOther(Value[] toReplace, OperationList[] replacement)
{
Ligne l1 = this.calc1.replaceAndRemoveOther(toReplace, replacement);
Ligne l2 = this.calc1.replaceAndRemoveOther(toReplace, replacement);
if (l1 == null || l2 == null)
return null;
return new Calcul(l1, l2);
}
public Calcul not()
{
return new Calcul(this.calc1.not(), this.calc2).normalize();
......@@ -155,25 +144,6 @@ class Ligne
return this.add(c.not());
}
public Calcul replaceAndRemoveOther(Value[] toReplace, OperationList[] replacement)
{
for (Element e : this.elements)
{
Element ee = new Element(e.multiplicateur);
for (VariableValue v : e.var)
{
for (Value vv : toReplace)
if (vv == v)
{
}
else
return null;
}
}
}
public Ligne mul(Ligne c) {
LinkedList<Element> newList = new LinkedList<>();
for (Element e : this.elements)
......
......@@ -26,5 +26,4 @@ public abstract class Info {
public abstract HigherInfo inverse();
public abstract boolean use(VariableValue value);
public abstract Info replaceAndRemoveOther(Value[] toReplace, OperationList[] replacement);
}
......@@ -305,17 +305,4 @@ public class IntRangeInfo extends Info
return this.min.getValues().stream().anyMatch(v -> v.possessedBy.equals(value.possessedBy)) ||
this.max.getValues().stream().anyMatch(v -> v.possessedBy.equals(value.possessedBy));
}
@Override
public Info replaceAndRemoveOther(Value[] toReplace, OperationList[] replacement)
{
Calcul min2 = this.min.replaceAndRemoveOther(toReplace, replacement);
Calcul max2 = this.max.replaceAndRemoveOther(toReplace, replacement);
if (min2 == null || max2 == null)
return null;
return new IntRangeInfo(min2, max2);
}
}
......@@ -361,23 +361,23 @@ public class MethodDeclaration extends Token
return this.namingSpace.getFirstUpperNamingSpace(ClassNamingSpace.class).getClassDeclaration();
}
public HigherInfo apply()
public HigherInfo apply(HigherInfo refInfos)
{
HigherInfo info = NoInfo.instance;
for (ReturnStatement st : this.getTokensIn(ReturnStatement.class))
info = new AndInfo(info, st.resultInfo);
info = new AndInfo(info, st.exp.toOperationList().getInfos(refInfos, false));
return info;
}
public HigherInfo knowing(HigherInfo resultInfo)
public AndInfo knowing(HigherInfo resultInfo, HigherInfo refInfos)
{
HigherInfo info = NoInfo.instance;
for (ReturnStatement st : this.getTokensIn(ReturnStatement.class))
info = new AndInfo(info, st.exp.toOperationList().knowing(resultInfo, st.refInfos));
info = new AndInfo(info, st.exp.toOperationList().knowing(resultInfo, refInfos));
return info;
return (AndInfo)info;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment