From 23384f413dbea79b38cbe6fd9696b65bca218eee Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Thu, 6 Feb 2020 15:27:51 +0100 Subject: [PATCH] modified: src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java modified: src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java variance von Pairs geloescht. --- .../typeinference/unify/TypeUnifyTask.java | 15 ++------------- .../typeinference/unify/model/UnifyPair.java | 18 ------------------ 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index 763faaf9..74c71706 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -308,8 +308,7 @@ public class TypeUnifyTask extends RecursiveTask>> { nOfUnify++; writeLog(nOfUnify.toString() + " Unifikation: " + eq.toString()); writeLog(nOfUnify.toString() + " Oderconstraints: " + oderConstraints.toString()); - //eq = eq.stream().map(x -> {x.setVariance((byte)-1); return x;}).collect(Collectors.toCollection(HashSet::new)); - + /* * Variancen auf alle Gleichungen vererben */ @@ -2033,7 +2032,6 @@ public class TypeUnifyTask extends RecursiveTask>> { protected Set> unifyCase1(UnifyPair pair, IFiniteClosure fc) { PlaceholderType a = (PlaceholderType)pair.getLhsType(); UnifyType thetaPrime = pair.getRhsType(); - byte variance = pair.getVariance(); Set> result = new HashSet<>(); @@ -2158,7 +2156,6 @@ public class TypeUnifyTask extends RecursiveTask>> { } resultPrime.addAll(substitutionSet); //writeLog("Substitution: " + substitutionSet.toString()); - resultPrime = resultPrime.stream().map(x -> { x.setVariance(variance); return x;}).collect(Collectors.toCollection(HashSet::new)); result.add(resultPrime); //writeLog("Result: " + resultPrime.toString()); //writeLog("MAX: " + oup.max(resultPrime.iterator()).toString()); @@ -2177,7 +2174,6 @@ public class TypeUnifyTask extends RecursiveTask>> { private Set> unifyCase2(UnifyPair pair, IFiniteClosure fc) { PlaceholderType a = (PlaceholderType) pair.getLhsType(); ExtendsType extThetaPrime = (ExtendsType) pair.getRhsType(); - byte variance = pair.getVariance(); Set> result = new HashSet<>(); UnifyType aPrime = PlaceholderType.freshPlaceholder(); @@ -2192,7 +2188,6 @@ public class TypeUnifyTask extends RecursiveTask>> { resultPrime = new HashSet<>(); resultPrime.add(new UnifyPair(a, extAPrime, PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); resultPrime.add(new UnifyPair(aPrime, thetaPrime, PairOperator.SMALLERDOT, pair.getSubstitution(), pair)); - resultPrime = resultPrime.stream().map(x -> { x.setVariance(variance); return x;}).collect(Collectors.toCollection(HashSet::new)); result.add(resultPrime); //writeLog("Result: " + resultPrime.toString()); return result; @@ -2205,7 +2200,6 @@ public class TypeUnifyTask extends RecursiveTask>> { PlaceholderType a = (PlaceholderType) pair.getLhsType(); a.reversVariance(); SuperType subThetaPrime = (SuperType) pair.getRhsType(); - byte variance = pair.getVariance(); Set> result = new HashSet<>(); UnifyType aPrime = PlaceholderType.freshPlaceholder(); @@ -2221,7 +2215,6 @@ public class TypeUnifyTask extends RecursiveTask>> { resultPrime = new HashSet<>(); resultPrime.add(new UnifyPair(a, supAPrime, PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); resultPrime.add(new UnifyPair(thetaPrime, aPrime, PairOperator.SMALLERDOT, pair.getSubstitution(), pair)); - resultPrime = resultPrime.stream().map(x -> { x.setVariance(variance); return x;}).collect(Collectors.toCollection(HashSet::new)); result.add(resultPrime); //writeLog(resultPrime.toString()); @@ -2234,7 +2227,6 @@ public class TypeUnifyTask extends RecursiveTask>> { private Set> unifyCase5(UnifyPair pair, IFiniteClosure fc) { UnifyType theta = pair.getLhsType(); PlaceholderType a = (PlaceholderType) pair.getRhsType(); - byte variance = pair.getVariance(); Set> result = new HashSet<>(); boolean allGen = theta.getTypeParams().size() > 0; @@ -2298,7 +2290,6 @@ public class TypeUnifyTask extends RecursiveTask>> { resultPrime.add(new UnifyPair(a, thetaS, PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); else resultPrime.add(new UnifyPair(a, thetaS.setTypeParams(new TypeParams(freshTphs)), PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); - resultPrime = resultPrime.stream().map(x -> { x.setVariance(variance); return x;}).collect(Collectors.toCollection(HashSet::new)); result.add(resultPrime); //writeLog("FBOUNDED2: " + pair.getfBounded()); //writeLog("resultPrime Theta < a: " + greater + pair + "THETA: " + theta + "FBOUNDED: " + pair.getfBounded() + " " + resultPrime.toString()); @@ -2313,8 +2304,7 @@ public class TypeUnifyTask extends RecursiveTask>> { private Set> unifyCase8(UnifyPair pair, IFiniteClosure fc) { UnifyType theta = pair.getLhsType(); PlaceholderType a = (PlaceholderType) pair.getRhsType(); - byte variance = pair.getVariance(); - Set> result = new HashSet<>(); + Set> result = new HashSet<>(); //for(UnifyType thetaS : fc.grArg(theta)) { Set resultPrime = new HashSet<>(); resultPrime.add(new UnifyPair(a, theta, PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); @@ -2334,7 +2324,6 @@ public class TypeUnifyTask extends RecursiveTask>> { resultPrime = new HashSet<>(); resultPrime.add(new UnifyPair(a, new SuperType(freshTph), PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); resultPrime.add(new UnifyPair(freshTph, theta, PairOperator.SMALLERDOT, pair.getSubstitution(), pair)); - resultPrime = resultPrime.stream().map(x -> { x.setVariance(variance); return x;}).collect(Collectors.toCollection(HashSet::new)); result.add(resultPrime); //writeLog(resultPrime.toString()); //} diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java index aafecf15..fbe3a099 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java @@ -28,15 +28,6 @@ public class UnifyPair { * The operator that determines the relation between the left and right hand side type. */ private PairOperator pairOp; - - /** wieder loesecn wird nicht mehr benoetigt PL 2018-03-31 - * variance shows the variance of the pair - * -1: contravariant - * 1 covariant - * 0 invariant - * PL 2018-03-21 - */ - private byte variance = 0; private boolean undefinedPair = false; @@ -83,7 +74,6 @@ public class UnifyPair { pairOp = op; substitution = uni; basePair = base; - this.variance = variance; // Caching hashcode @@ -125,14 +115,6 @@ public class UnifyPair { substitution.addAll(sup); } - public byte getVariance() { - return variance; - } - - public void setVariance(byte v) { - variance = v; - } - public void setUndefinedPair() { undefinedPair = true; }