fc smaller greater tests
This commit is contained in:
parent
b93f1dd376
commit
6b709f0198
@ -29,7 +29,5 @@ public interface IFiniteClosure {
|
||||
|
||||
public boolean isInSmArg(Type smArgT, Type t);
|
||||
|
||||
public Set<Type> smaller(String typeName);
|
||||
|
||||
public Type getType(String typeName);
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ public class FiniteClosure implements IFiniteClosure {
|
||||
|
||||
// Add edges to build the transitive closure
|
||||
parentNode.getPredecessors().stream().forEach(x -> x.AddDescendant(childNode));
|
||||
childNode.getDescendants().stream().forEach(x -> x.AddPredecessor(parentNode));
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,8 +49,7 @@ public class FiniteClosure implements IFiniteClosure {
|
||||
return smaller(type.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Type> smaller(String typeName) {
|
||||
private Set<Type> smaller(String typeName) {
|
||||
if(!inheritanceGraph.containsKey(typeName))
|
||||
return new HashSet<>();
|
||||
|
||||
@ -70,20 +70,34 @@ public class FiniteClosure implements IFiniteClosure {
|
||||
*/
|
||||
@Override
|
||||
public Set<Type> greater(Type type) {
|
||||
if(!inheritanceGraph.containsKey(type.getName()))
|
||||
return greater(type.typeName);
|
||||
}
|
||||
|
||||
private Set<Type> greater(String typeName) {
|
||||
if(!inheritanceGraph.containsKey(typeName))
|
||||
return new HashSet<>();
|
||||
|
||||
return inheritanceGraph.get(type.getName()).getContentOfPredecessors();
|
||||
return inheritanceGraph.get(typeName).getContentOfPredecessors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Type> grArg(Type type) {
|
||||
throw new NotImplementedException();
|
||||
return grArg(type.getName());
|
||||
}
|
||||
|
||||
private Set<Type> grArg(String typeName) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Type> smArg(Type type) {
|
||||
throw new NotImplementedException();
|
||||
return smArg(type.getName());
|
||||
}
|
||||
|
||||
private Set<Type> smArg(String typeName) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,4 +49,9 @@ public class Node<T> {
|
||||
public Set<T> getContentOfPredecessors() {
|
||||
return predecessors.stream().map(x -> x.getContent()).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Node(" + content.toString() + ")";
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package de.dhbwstuttgart.typinference.unify.model;
|
||||
|
||||
public class PlaceholderType extends Type{
|
||||
|
||||
|
||||
public PlaceholderType(String name) {
|
||||
typeName = name;
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,10 @@ public abstract class Type {
|
||||
protected String typeName = "";
|
||||
protected TypeParams typeParams;
|
||||
|
||||
public Type() {
|
||||
typeParams = new TypeParams();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return typeName;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user