added funN

This commit is contained in:
Florian Steurer 2016-03-23 09:45:36 +01:00
parent 14e00913e8
commit 88726ccb70
3 changed files with 51 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import java.util.Optional;
import java.util.Set;
import de.dhbwstuttgart.typeinference.unify.model.ExtendsType;
import de.dhbwstuttgart.typeinference.unify.model.FunNType;
import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType;
import de.dhbwstuttgart.typeinference.unify.model.SimpleType;
import de.dhbwstuttgart.typeinference.unify.model.SuperType;
@ -49,6 +50,9 @@ public interface IFiniteClosure {
public Set<Type> grArg(PlaceholderType type);
public Set<Type> smArg(PlaceholderType type);
public Set<Type> grArg(FunNType type);
public Set<Type> smArg(FunNType type);
public Optional<Type> getGenericType(String typeName);
public Set<Type> getAllTypesByName(String typeName);
}

View File

@ -8,6 +8,7 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
import de.dhbwstuttgart.typeinference.unify.interfaces.IUnify;
import de.dhbwstuttgart.typeinference.unify.model.MPair.PairOperator;
@ -193,6 +194,11 @@ public class FiniteClosure implements IFiniteClosure {
return result;
}
@Override
public Set<Type> grArg(FunNType type) {
throw new NotImplementedException();
}
@Override
public Set<Type> grArg(ExtendsType type) {
if(!inheritanceGraph.containsKey(type.getExtendedType()))
@ -249,7 +255,13 @@ public class FiniteClosure implements IFiniteClosure {
return result;
}
@Override
public Set<Type> smArg(FunNType type) {
throw new NotImplementedException();
}
@Override
public Set<Type> smArg(ExtendsType type) {
if(!inheritanceGraph.containsKey(type.getExtendedType()))
return new HashSet<Type>();

View File

@ -0,0 +1,34 @@
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.Set;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
public class FunNType extends Type {
public FunNType(TypeParams p) {
super("FuN", p);
}
@Override
public Type setTypeParams(TypeParams newTp) {
return new FunNType(newTp);
}
@Override
Set<Type> smArg(IFiniteClosure fc) {
return fc.smArg(this);
}
@Override
Set<Type> grArg(IFiniteClosure fc) {
return fc.grArg(this);
}
@Override
Type apply(Unifier unif) {
// TODO Auto-generated method stub
return null;
}
}