signature from getLeftHandedType from type to string

This commit is contained in:
Florian Steurer 2016-04-10 14:52:07 +02:00
parent 23e0be2572
commit 64247b689b
3 changed files with 11 additions and 11 deletions

View File

@ -104,7 +104,7 @@ public class RuleSet implements IRuleSet{
if(x.getTypeParams().empty() || extY.getTypeParams().size() != x.getTypeParams().size()) if(x.getTypeParams().empty() || extY.getTypeParams().size() != x.getTypeParams().size())
return Optional.empty(); return Optional.empty();
UnifyType xFromFc = finiteClosure.getLeftHandedType(sTypeX).orElse(null); UnifyType xFromFc = finiteClosure.getLeftHandedType(sTypeX.getName()).orElse(null);
if(xFromFc == null || !xFromFc.getTypeParams().arePlaceholders()) if(xFromFc == null || !xFromFc.getTypeParams().arePlaceholders())
return Optional.empty(); return Optional.empty();
@ -156,7 +156,7 @@ public class RuleSet implements IRuleSet{
if(x.getTypeParams().empty() || supY.getTypeParams().size() != x.getTypeParams().size()) if(x.getTypeParams().empty() || supY.getTypeParams().size() != x.getTypeParams().size())
return Optional.empty(); return Optional.empty();
UnifyType xFromFc = finiteClosure.getLeftHandedType(sTypeX).orElse(null); UnifyType xFromFc = finiteClosure.getLeftHandedType(sTypeX.getName()).orElse(null);
if(xFromFc == null || !xFromFc.getTypeParams().arePlaceholders()) if(xFromFc == null || !xFromFc.getTypeParams().arePlaceholders())
return Optional.empty(); return Optional.empty();
@ -234,7 +234,7 @@ public class RuleSet implements IRuleSet{
if(lhsSType.getTypeParams().empty() || lhsSType.getTypeParams().size() != rhsSType.getTypeParams().size()) if(lhsSType.getTypeParams().empty() || lhsSType.getTypeParams().size() != rhsSType.getTypeParams().size())
return Optional.empty(); return Optional.empty();
UnifyType cFromFc = finiteClosure.getLeftHandedType(c).orElse(null); UnifyType cFromFc = finiteClosure.getLeftHandedType(c.getName()).orElse(null);
if(cFromFc == null || !cFromFc.getTypeParams().arePlaceholders()) if(cFromFc == null || !cFromFc.getTypeParams().arePlaceholders())
return Optional.empty(); return Optional.empty();
@ -383,7 +383,7 @@ public class RuleSet implements IRuleSet{
return Optional.empty(); return Optional.empty();
Optional<UnifyType> opt = finiteClosure.getLeftHandedType(typeD); Optional<UnifyType> opt = finiteClosure.getLeftHandedType(typeD.getName());
if(!opt.isPresent()) if(!opt.isPresent())
return Optional.empty(); return Optional.empty();
@ -427,9 +427,9 @@ public class RuleSet implements IRuleSet{
UnifyType typeDgen; UnifyType typeDgen;
if(typeD instanceof ReferenceType) if(typeD instanceof ReferenceType)
typeDgen = finiteClosure.getLeftHandedType(typeD).orElse(null); typeDgen = finiteClosure.getLeftHandedType(typeD.getName()).orElse(null);
else { else {
Optional<UnifyType> opt = finiteClosure.getLeftHandedType(((ExtendsType) typeD).getExtendedType()); Optional<UnifyType> opt = finiteClosure.getLeftHandedType(((ExtendsType) typeD).getExtendedType().getName());
typeDgen = opt.isPresent() ? new ExtendsType(opt.get()) : null; typeDgen = opt.isPresent() ? new ExtendsType(opt.get()) : null;
} }
@ -472,7 +472,7 @@ public class RuleSet implements IRuleSet{
return Optional.empty(); return Optional.empty();
Optional<UnifyType> opt = finiteClosure.getLeftHandedType(((SuperType) typeSupD).getSuperedType()); Optional<UnifyType> opt = finiteClosure.getLeftHandedType(((SuperType) typeSupD).getSuperedType().getName());
if(!opt.isPresent()) if(!opt.isPresent())
return Optional.empty(); return Optional.empty();

View File

@ -53,7 +53,7 @@ public interface IFiniteClosure {
public Set<UnifyType> grArg(FunNType type); public Set<UnifyType> grArg(FunNType type);
public Set<UnifyType> smArg(FunNType type); public Set<UnifyType> smArg(FunNType type);
public Optional<UnifyType> getLeftHandedType(UnifyType t); public Optional<UnifyType> getLeftHandedType(String typeName);
public Set<UnifyType> getAncestors(UnifyType t); public Set<UnifyType> getAncestors(UnifyType t);
public Set<UnifyType> getChildren(UnifyType t); public Set<UnifyType> getChildren(UnifyType t);
public Set<UnifyType> getAllTypesByName(String typeName); public Set<UnifyType> getAllTypesByName(String typeName);

View File

@ -395,12 +395,12 @@ public class FiniteClosure implements IFiniteClosure {
} }
@Override @Override
public Optional<UnifyType> getLeftHandedType(UnifyType t) { public Optional<UnifyType> getLeftHandedType(String typeName) {
if(!strInheritanceGraph.containsKey(t.getName())) if(!strInheritanceGraph.containsKey(typeName))
return Optional.empty(); return Optional.empty();
for(UnifyPair pair : pairs) for(UnifyPair pair : pairs)
if(pair.getLhsType().getName().equals(t.getName())) if(pair.getLhsType().getName().equals(typeName))
return Optional.of(pair.getLhsType()); return Optional.of(pair.getLhsType());
return Optional.empty(); return Optional.empty();