Class BoundSet


  • public class BoundSet
    extends java.lang.Object
    • Field Detail

      • JAVA_LANG_RUNTIME_EXCEPTION

        private static java.lang.String JAVA_LANG_RUNTIME_EXCEPTION
      • EMPTY

        private static final BoundSet EMPTY
      • bounds

        private java.util.List<Bound> bounds
    • Constructor Detail

      • BoundSet

        public BoundSet()
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isTrue

        public boolean isTrue()
        It is sometimes convenient to refer to an empty bound set with the symbol true; this is merely out of convenience, and the two are interchangeable.
      • empty

        public static BoundSet empty()
      • isEmpty

        public boolean isEmpty()
      • incorporate

        public BoundSet incorporate​(BoundSet otherBounds,
                                    TypeSolver typeSolver)
        Maintains a set of inference variable bounds, ensuring that these are consistent as new bounds are added. Because the bounds on one variable can sometimes impact the possible choices for another variable, this process propagates bounds between such interdependent variables.
      • containsFalse

        public boolean containsFalse()
      • allInferenceVariables

        private java.util.Set<InferenceVariable> allInferenceVariables()
      • buildAllSubsetsOfSize

        private <T> java.util.List<java.util.Set<T>> buildAllSubsetsOfSize​(java.util.Set<T> allElements,
                                                                           int desiredSize)
      • allButOne

        private <T> java.util.Set<T> allButOne​(java.util.Set<T> elements,
                                               T element)
      • smallestSetWithProperty

        private java.util.Optional<java.util.Set<InferenceVariable>> smallestSetWithProperty​(java.util.Set<InferenceVariable> uninstantiatedVariables,
                                                                                             java.util.List<BoundSet.VariableDependency> dependencies)
        there exists no non-empty proper subset of { α1, ..., αn } with this property.
      • hasProperty

        private boolean hasProperty​(java.util.Set<InferenceVariable> alphas,
                                    java.util.List<BoundSet.VariableDependency> dependencies)
        if αi depends on the resolution of a variable β, then either β has an instantiation or there is some j such that β = αj
        Returns:
      • performResolution

        public java.util.Optional<InstantiationSet> performResolution​(java.util.List<InferenceVariable> variablesToResolve,
                                                                      TypeSolver typeSolver)
        Examines the bounds on an inference variable and determines an instantiation that is compatible with those bounds. It also decides the order in which interdependent inference variables are to be resolved.
      • thereAreProperSubsets

        private boolean thereAreProperSubsets​(java.util.Set<InferenceVariable> aSet,
                                              java.util.Set<java.util.Set<InferenceVariable>> allPossibleSets)
      • isTheFirstAProperSubsetOfTheSecond

        private boolean isTheFirstAProperSubsetOfTheSecond​(java.util.Set<InferenceVariable> subset,
                                                           java.util.Set<InferenceVariable> originalSet)
      • properUpperBoundsAreAtMostExceptionThrowableAndObject

        private boolean properUpperBoundsAreAtMostExceptionThrowableAndObject​(InferenceVariable inferenceVariable)
      • appearInLeftPartOfCapture

        private boolean appearInLeftPartOfCapture​(InferenceVariable inferenceVariable)
      • getProperUpperBoundsFor

        public java.util.List<Bound> getProperUpperBoundsFor​(InferenceVariable inferenceVariable)