comments
This commit is contained in:
parent
6616d78dcb
commit
aa692c2f25
@ -10,6 +10,10 @@ import de.dhbwstuttgart.typeinference.unify.model.ReferenceType;
|
|||||||
import de.dhbwstuttgart.typeinference.unify.model.SuperType;
|
import de.dhbwstuttgart.typeinference.unify.model.SuperType;
|
||||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
|
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Florian Steurer
|
||||||
|
*/
|
||||||
public interface IFiniteClosure {
|
public interface IFiniteClosure {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,6 +5,10 @@ import java.util.Set;
|
|||||||
|
|
||||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
|
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the inference rules that are applied to the set Eq.
|
||||||
|
* @author Florian Steurer
|
||||||
|
*/
|
||||||
public interface IRuleSet {
|
public interface IRuleSet {
|
||||||
|
|
||||||
public Optional<UnifyPair> reduceUp(UnifyPair pair);
|
public Optional<UnifyPair> reduceUp(UnifyPair pair);
|
||||||
@ -17,7 +21,7 @@ public interface IRuleSet {
|
|||||||
public Optional<Set<UnifyPair>> reduce2(UnifyPair pair);
|
public Optional<Set<UnifyPair>> reduce2(UnifyPair pair);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Missing Rules
|
* Missing Reduce-Rules for Wildcards
|
||||||
*/
|
*/
|
||||||
public Optional<UnifyPair> reduceWildcardLow(UnifyPair pair);
|
public Optional<UnifyPair> reduceWildcardLow(UnifyPair pair);
|
||||||
public Optional<UnifyPair> reduceWildcardLowRight(UnifyPair pair);
|
public Optional<UnifyPair> reduceWildcardLowRight(UnifyPair pair);
|
||||||
@ -34,8 +38,22 @@ public interface IRuleSet {
|
|||||||
public Optional<Set<UnifyPair>> greaterFunN(UnifyPair pair);
|
public Optional<Set<UnifyPair>> greaterFunN(UnifyPair pair);
|
||||||
public Optional<Set<UnifyPair>> smallerFunN(UnifyPair pair);
|
public Optional<Set<UnifyPair>> smallerFunN(UnifyPair pair);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the erase1-Rule applies to the pair.
|
||||||
|
* @return True if the pair is erasable, false otherwise.
|
||||||
|
*/
|
||||||
public boolean erase1(UnifyPair pair);
|
public boolean erase1(UnifyPair pair);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the erase2-Rule applies to the pair.
|
||||||
|
* @return True if the pair is erasable, false otherwise.
|
||||||
|
*/
|
||||||
public boolean erase2(UnifyPair pair);
|
public boolean erase2(UnifyPair pair);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the erase3-Rule applies to the pair.
|
||||||
|
* @return True if the pair is erasable, false otherwise.
|
||||||
|
*/
|
||||||
public boolean erase3(UnifyPair pair);
|
public boolean erase3(UnifyPair pair);
|
||||||
|
|
||||||
public Optional<UnifyPair> swap(UnifyPair pair);
|
public Optional<UnifyPair> swap(UnifyPair pair);
|
||||||
@ -44,5 +62,10 @@ public interface IRuleSet {
|
|||||||
public Optional<UnifyPair> adaptExt(UnifyPair pair);
|
public Optional<UnifyPair> adaptExt(UnifyPair pair);
|
||||||
public Optional<UnifyPair> adaptSup(UnifyPair pair);
|
public Optional<UnifyPair> adaptSup(UnifyPair pair);
|
||||||
|
|
||||||
public Optional<Set<UnifyPair>> subst(Set<UnifyPair> pair);
|
/**
|
||||||
|
* Applies the subst-Rule to a set of pairs (usually Eq').
|
||||||
|
* @param pairs The set of pairs where the subst rule should apply.
|
||||||
|
* @return An optional of the modified set, if there were any substitutions. An empty optional if there were no substitutions.
|
||||||
|
*/
|
||||||
|
public Optional<Set<UnifyPair>> subst(Set<UnifyPair> pairs);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,14 @@ package de.dhbwstuttgart.typeinference.unify.interfaces;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains operations on sets.
|
||||||
|
* @author Florian Steurer
|
||||||
|
*/
|
||||||
public interface ISetOperations {
|
public interface ISetOperations {
|
||||||
|
/**
|
||||||
|
* Calculates the cartesian product of the sets.
|
||||||
|
* @return The cartesian product
|
||||||
|
*/
|
||||||
<B> Set<List<B>> cartesianProduct(List<? extends Set<? extends B>> sets);
|
<B> Set<List<B>> cartesianProduct(List<? extends Set<? extends B>> sets);
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,20 @@ import de.dhbwstuttgart.typeinference.unify.model.Unifier;
|
|||||||
*/
|
*/
|
||||||
public interface IUnify {
|
public interface IUnify {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the most general unifier sigma of the set {t1,...,tn} so that
|
||||||
|
* sigma(t1) = sigma(t2) = ... = sigma(tn).
|
||||||
|
* @param terms The set of terms to be unified
|
||||||
|
* @return An optional of the most general unifier if it exists or an empty optional if there is no unifier.
|
||||||
|
*/
|
||||||
public Optional<Unifier> unify(Set<UnifyType> terms);
|
public Optional<Unifier> unify(Set<UnifyType> terms);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the most general unifier sigma of the set {t1,...,tn} so that
|
||||||
|
* sigma(t1) = sigma(t2) = ... = sigma(tn).
|
||||||
|
* @param terms The set of terms to be unified
|
||||||
|
* @return An optional of the most general unifier if it exists or an empty optional if there is no unifier.
|
||||||
|
*/
|
||||||
default public Optional<Unifier> unify(UnifyType... terms) {
|
default public Optional<Unifier> unify(UnifyType... terms) {
|
||||||
return unify(Arrays.stream(terms).collect(Collectors.toSet()));
|
return unify(Arrays.stream(terms).collect(Collectors.toSet()));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user