From 64247b689b268fedd0de202adc49ab9ba5ace030 Mon Sep 17 00:00:00 2001 From: Florian Steurer Date: Sun, 10 Apr 2016 14:52:07 +0200 Subject: [PATCH] signature from getLeftHandedType from type to string --- .../dhbwstuttgart/typeinference/unify/RuleSet.java | 14 +++++++------- .../unify/interfaces/IFiniteClosure.java | 2 +- .../typeinference/unify/model/FiniteClosure.java | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/de/dhbwstuttgart/typeinference/unify/RuleSet.java b/src/de/dhbwstuttgart/typeinference/unify/RuleSet.java index e18e6156..0765b9b7 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/RuleSet.java +++ b/src/de/dhbwstuttgart/typeinference/unify/RuleSet.java @@ -104,7 +104,7 @@ public class RuleSet implements IRuleSet{ if(x.getTypeParams().empty() || extY.getTypeParams().size() != x.getTypeParams().size()) return Optional.empty(); - UnifyType xFromFc = finiteClosure.getLeftHandedType(sTypeX).orElse(null); + UnifyType xFromFc = finiteClosure.getLeftHandedType(sTypeX.getName()).orElse(null); if(xFromFc == null || !xFromFc.getTypeParams().arePlaceholders()) return Optional.empty(); @@ -156,7 +156,7 @@ public class RuleSet implements IRuleSet{ if(x.getTypeParams().empty() || supY.getTypeParams().size() != x.getTypeParams().size()) return Optional.empty(); - UnifyType xFromFc = finiteClosure.getLeftHandedType(sTypeX).orElse(null); + UnifyType xFromFc = finiteClosure.getLeftHandedType(sTypeX.getName()).orElse(null); if(xFromFc == null || !xFromFc.getTypeParams().arePlaceholders()) return Optional.empty(); @@ -234,7 +234,7 @@ public class RuleSet implements IRuleSet{ if(lhsSType.getTypeParams().empty() || lhsSType.getTypeParams().size() != rhsSType.getTypeParams().size()) return Optional.empty(); - UnifyType cFromFc = finiteClosure.getLeftHandedType(c).orElse(null); + UnifyType cFromFc = finiteClosure.getLeftHandedType(c.getName()).orElse(null); if(cFromFc == null || !cFromFc.getTypeParams().arePlaceholders()) return Optional.empty(); @@ -383,7 +383,7 @@ public class RuleSet implements IRuleSet{ return Optional.empty(); - Optional opt = finiteClosure.getLeftHandedType(typeD); + Optional opt = finiteClosure.getLeftHandedType(typeD.getName()); if(!opt.isPresent()) return Optional.empty(); @@ -427,9 +427,9 @@ public class RuleSet implements IRuleSet{ UnifyType typeDgen; if(typeD instanceof ReferenceType) - typeDgen = finiteClosure.getLeftHandedType(typeD).orElse(null); + typeDgen = finiteClosure.getLeftHandedType(typeD.getName()).orElse(null); else { - Optional opt = finiteClosure.getLeftHandedType(((ExtendsType) typeD).getExtendedType()); + Optional opt = finiteClosure.getLeftHandedType(((ExtendsType) typeD).getExtendedType().getName()); typeDgen = opt.isPresent() ? new ExtendsType(opt.get()) : null; } @@ -472,7 +472,7 @@ public class RuleSet implements IRuleSet{ return Optional.empty(); - Optional opt = finiteClosure.getLeftHandedType(((SuperType) typeSupD).getSuperedType()); + Optional opt = finiteClosure.getLeftHandedType(((SuperType) typeSupD).getSuperedType().getName()); if(!opt.isPresent()) return Optional.empty(); diff --git a/src/de/dhbwstuttgart/typeinference/unify/interfaces/IFiniteClosure.java b/src/de/dhbwstuttgart/typeinference/unify/interfaces/IFiniteClosure.java index bd15999a..cb95ac41 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/interfaces/IFiniteClosure.java +++ b/src/de/dhbwstuttgart/typeinference/unify/interfaces/IFiniteClosure.java @@ -53,7 +53,7 @@ public interface IFiniteClosure { public Set grArg(FunNType type); public Set smArg(FunNType type); - public Optional getLeftHandedType(UnifyType t); + public Optional getLeftHandedType(String typeName); public Set getAncestors(UnifyType t); public Set getChildren(UnifyType t); public Set getAllTypesByName(String typeName); diff --git a/src/de/dhbwstuttgart/typeinference/unify/model/FiniteClosure.java b/src/de/dhbwstuttgart/typeinference/unify/model/FiniteClosure.java index 5575dcf6..0ef5d2a3 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/model/FiniteClosure.java +++ b/src/de/dhbwstuttgart/typeinference/unify/model/FiniteClosure.java @@ -395,12 +395,12 @@ public class FiniteClosure implements IFiniteClosure { } @Override - public Optional getLeftHandedType(UnifyType t) { - if(!strInheritanceGraph.containsKey(t.getName())) + public Optional getLeftHandedType(String typeName) { + if(!strInheritanceGraph.containsKey(typeName)) return Optional.empty(); for(UnifyPair pair : pairs) - if(pair.getLhsType().getName().equals(t.getName())) + if(pair.getLhsType().getName().equals(typeName)) return Optional.of(pair.getLhsType()); return Optional.empty();