forked from JavaTX/JavaCompilerCore
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 boolean isInSmArg(Type smArgT, Type t);
|
||||||
|
|
||||||
public Set<Type> smaller(String typeName);
|
|
||||||
|
|
||||||
public Type getType(String typeName);
|
public Type getType(String typeName);
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ public class FiniteClosure implements IFiniteClosure {
|
|||||||
|
|
||||||
// Add edges to build the transitive closure
|
// Add edges to build the transitive closure
|
||||||
parentNode.getPredecessors().stream().forEach(x -> x.AddDescendant(childNode));
|
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());
|
return smaller(type.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private Set<Type> smaller(String typeName) {
|
||||||
public Set<Type> smaller(String typeName) {
|
|
||||||
if(!inheritanceGraph.containsKey(typeName))
|
if(!inheritanceGraph.containsKey(typeName))
|
||||||
return new HashSet<>();
|
return new HashSet<>();
|
||||||
|
|
||||||
@ -70,20 +70,34 @@ public class FiniteClosure implements IFiniteClosure {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<Type> greater(Type type) {
|
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 new HashSet<>();
|
||||||
|
|
||||||
return inheritanceGraph.get(type.getName()).getContentOfPredecessors();
|
return inheritanceGraph.get(typeName).getContentOfPredecessors();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Type> grArg(Type type) {
|
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
|
@Override
|
||||||
public Set<Type> smArg(Type type) {
|
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
|
@Override
|
||||||
|
@ -49,4 +49,9 @@ public class Node<T> {
|
|||||||
public Set<T> getContentOfPredecessors() {
|
public Set<T> getContentOfPredecessors() {
|
||||||
return predecessors.stream().map(x -> x.getContent()).collect(Collectors.toSet());
|
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;
|
package de.dhbwstuttgart.typinference.unify.model;
|
||||||
|
|
||||||
public class PlaceholderType extends Type{
|
public class PlaceholderType extends Type{
|
||||||
|
|
||||||
|
public PlaceholderType(String name) {
|
||||||
|
typeName = name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,10 @@ public abstract class Type {
|
|||||||
protected String typeName = "";
|
protected String typeName = "";
|
||||||
protected TypeParams typeParams;
|
protected TypeParams typeParams;
|
||||||
|
|
||||||
|
public Type() {
|
||||||
|
typeParams = new TypeParams();
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return typeName;
|
return typeName;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user