diff --git a/src/de/dhbwstuttgart/typeinference/unify/interfaces/IFiniteClosure.java b/src/de/dhbwstuttgart/typeinference/unify/interfaces/IFiniteClosure.java index cb95ac41..dcb6c4d1 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/interfaces/IFiniteClosure.java +++ b/src/de/dhbwstuttgart/typeinference/unify/interfaces/IFiniteClosure.java @@ -10,6 +10,10 @@ import de.dhbwstuttgart.typeinference.unify.model.ReferenceType; import de.dhbwstuttgart.typeinference.unify.model.SuperType; import de.dhbwstuttgart.typeinference.unify.model.UnifyType; +/** + * + * @author Florian Steurer + */ public interface IFiniteClosure { /** diff --git a/src/de/dhbwstuttgart/typeinference/unify/interfaces/IRuleSet.java b/src/de/dhbwstuttgart/typeinference/unify/interfaces/IRuleSet.java index 11c98481..26ea0dce 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/interfaces/IRuleSet.java +++ b/src/de/dhbwstuttgart/typeinference/unify/interfaces/IRuleSet.java @@ -5,6 +5,10 @@ import java.util.Set; 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 Optional reduceUp(UnifyPair pair); @@ -17,7 +21,7 @@ public interface IRuleSet { public Optional> reduce2(UnifyPair pair); /* - * Missing Rules + * Missing Reduce-Rules for Wildcards */ public Optional reduceWildcardLow(UnifyPair pair); public Optional reduceWildcardLowRight(UnifyPair pair); @@ -34,8 +38,22 @@ public interface IRuleSet { public Optional> greaterFunN(UnifyPair pair); public Optional> 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); + + /** + * Checks whether the erase2-Rule applies to the pair. + * @return True if the pair is erasable, false otherwise. + */ 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 Optional swap(UnifyPair pair); @@ -44,5 +62,10 @@ public interface IRuleSet { public Optional adaptExt(UnifyPair pair); public Optional adaptSup(UnifyPair pair); - public Optional> subst(Set 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> subst(Set pairs); } diff --git a/src/de/dhbwstuttgart/typeinference/unify/interfaces/ISetOperations.java b/src/de/dhbwstuttgart/typeinference/unify/interfaces/ISetOperations.java index caed79e4..4a98aaba 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/interfaces/ISetOperations.java +++ b/src/de/dhbwstuttgart/typeinference/unify/interfaces/ISetOperations.java @@ -3,6 +3,14 @@ package de.dhbwstuttgart.typeinference.unify.interfaces; import java.util.List; import java.util.Set; +/** + * Contains operations on sets. + * @author Florian Steurer + */ public interface ISetOperations { + /** + * Calculates the cartesian product of the sets. + * @return The cartesian product + */ Set> cartesianProduct(List> sets); } diff --git a/src/de/dhbwstuttgart/typeinference/unify/interfaces/IUnify.java b/src/de/dhbwstuttgart/typeinference/unify/interfaces/IUnify.java index ef8775b1..524608f5 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/interfaces/IUnify.java +++ b/src/de/dhbwstuttgart/typeinference/unify/interfaces/IUnify.java @@ -14,8 +14,20 @@ import de.dhbwstuttgart.typeinference.unify.model.Unifier; */ 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 unify(Set 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 unify(UnifyType... terms) { return unify(Arrays.stream(terms).collect(Collectors.toSet())); }