Class Dependencies
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalculate and add transitive dependencies.Returns the set of dependencies for all variables invariables.Returns the set of dependencies ofalpha, always includingalphaitself, because JLS 18.4 says that an inference variable depends on the resolution of itself.voidAddvalueas a dependency ofkey.voidputOrAddAll(Variable key, Collection<? extends Variable> values) Addvaluesas dependencies ofkey.
-
Constructor Details
-
Dependencies
public Dependencies()Creates Dependencies.
-
-
Method Details
-
putOrAdd
Addvalueas a dependency ofkey.- Parameters:
key- a key to addvalue- a value to add
-
putOrAddAll
Addvaluesas dependencies ofkey.- Parameters:
key- a key to addvalues- values to add
-
calculateTransitiveDependencies
public void calculateTransitiveDependencies()Calculate and add transitive dependencies.JLS 18.4 "An inference variable alpha depends on the resolution of an inference variable beta if there exists an inference variable gamma such that alpha depends on the resolution of gamma and gamma depends on the resolution of beta."
-
get
Returns the set of dependencies ofalpha, always includingalphaitself, because JLS 18.4 says that an inference variable depends on the resolution of itself.If no dependency of
alphahas been added to this object, the result is{alpha}. That case arises only for a variable that is absent from the bound set that created this object, becauseBoundSet.getDependenciesrecords every variable of the bound set as a dependency of itself. For such a variable,{alpha}is a lower bound on its true dependencies: any dependency arising from its bounds is unknown to this object, so a caller may treatalphaas resolvable earlier or more independently than JLS 18.4 permits. Computing more than{alpha}here is not possible, because the transitive closure thatBoundSet.getDependenciescomputes needs the whole bound set.Resolution.getSmallestDependencySetandConstraintSet.getClosedSubsetboth query variables that the bound set does not necessarily contain, and letting such a variable depend on only itself lets inference proceed rather than crashing.The result is a new, mutable set; the caller may modify it.
- Parameters:
alpha- a variable- Returns:
- the set of dependencies of
alpha
-
get
Returns the set of dependencies for all variables invariables. Every variable invariablesis in the result; a variable to which no dependency has been added contributes only itself. Seeget(Variable).The result is a new, mutable set; the caller may modify it.
- Parameters:
variables- list of variables- Returns:
- the set of dependencies for all variables in
variables
-