Class InferredValue.InferredPair<T extends InferredValue<T>>

    • Constructor Detail

      • InferredPair

        public InferredPair​(T domain,
                            T inferred,
                            T state)
        Builds the pair.
        Parameters:
        domain - a singleton instance to be used during semantic operations to retrieve top and bottom values
        inferred - the inferred value
        state - the execution state
    • Method Detail

      • getInferred

        public T getInferred()
        Yields the instance of InferredValue representing the inferred value.
        Returns:
        the inferred value
      • getState

        public T getState()
        Yields the instance of InferredValue representing the execution state.
        Returns:
        the execution state
      • top

        public InferredValue.InferredPair<T> top()
        Description copied from interface: Lattice
        Yields the top element of this lattice. The returned element should be unique across different calls to this method, since Lattice.isTop() uses reference equality by default. If the value returned by this method is not a singleton, override Lattice.isTop() accordingly to provide a coherent test.
        Specified by:
        top in interface Lattice<T extends InferredValue<T>>
        Returns:
        the top element
      • isTop

        public boolean isTop()
        Description copied from interface: Lattice
        Yields true if and only if this object represents the top of the lattice. The default implementation of this method uses reference equality between this and the value returned by Lattice.top(), thus assuming that the top element is a singleton. If this is not the case, override this method accordingly to provide a coherent test.
        Specified by:
        isTop in interface Lattice<T extends InferredValue<T>>
        Returns:
        true if this is the top of the lattice
      • bottom

        public InferredValue.InferredPair<T> bottom()
        Description copied from interface: Lattice
        Yields the bottom element of this lattice. The returned element should be unique across different calls to this method, since Lattice.isBottom() uses reference equality by default. If the value returned by this method is not a singleton, override Lattice.isBottom() accordingly to provide a coherent test.
        Specified by:
        bottom in interface Lattice<T extends InferredValue<T>>
        Returns:
        the bottom element
      • isBottom

        public boolean isBottom()
        Description copied from interface: Lattice
        Yields true if and only if this object represents the bottom of the lattice. The default implementation of this method uses reference equality between this and the value returned by Lattice.bottom(), thus assuming that the bottom element is a singleton. If this is not the case, override this method accordingly to provide a coherent test.
        Specified by:
        isBottom in interface Lattice<T extends InferredValue<T>>
        Returns:
        true if this is the bottom of the lattice
      • lubAux

        public InferredValue.InferredPair<T> lubAux​(InferredValue.InferredPair<T> other)
                                             throws SemanticException
        Description copied from interface: BaseLattice
        Performs the least upper bound operation between this lattice element and the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:
        • other is not null
        • other is neither top nor bottom
        • this is neither top nor bottom
        • this and other are not the same object (according both to == and to Object.equals(Object))
        Specified by:
        lubAux in interface BaseLattice<T extends InferredValue<T>>
        Parameters:
        other - the other lattice element
        Returns:
        the least upper bound between this and other
        Throws:
        SemanticException - if an error occurs during the computation
      • glbAux

        public InferredValue.InferredPair<T> glbAux​(InferredValue.InferredPair<T> other)
                                             throws SemanticException
        Description copied from interface: BaseLattice
        Performs the greatest lower bound operation between this lattice element and the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:
        • other is not null
        • other is neither top nor bottom
        • this is neither top nor bottom
        • this and other are not the same object (according both to == and to Object.equals(Object))
        Specified by:
        glbAux in interface BaseLattice<T extends InferredValue<T>>
        Parameters:
        other - the other lattice element
        Returns:
        the greatest lower bound between this and other
        Throws:
        SemanticException - if an error occurs during the computation
      • wideningAux

        public InferredValue.InferredPair<T> wideningAux​(InferredValue.InferredPair<T> other)
                                                  throws SemanticException
        Description copied from interface: BaseLattice
        Performs the widening operation between this lattice element and the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:
        • other is not null
        • other is neither top nor bottom
        • this is neither top nor bottom
        • this and other are not the same object (according both to == and to Object.equals(Object))
        The default implementation of this method delegates to BaseLattice.lubAux(BaseLattice), and is thus safe for finite lattices and ACC ones.
        Specified by:
        wideningAux in interface BaseLattice<T extends InferredValue<T>>
        Parameters:
        other - the other lattice element
        Returns:
        the widening between this and other
        Throws:
        SemanticException - if an error occurs during the computation
      • narrowingAux

        public InferredValue.InferredPair<T> narrowingAux​(InferredValue.InferredPair<T> other)
                                                   throws SemanticException
        Description copied from interface: BaseLattice
        Performs the narrowing operation between this lattice element and the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:
        • other is not null
        • other is neither top nor bottom
        • this is neither top nor bottom
        • this and other are not the same object (according both to == and to Object.equals(Object))
        The default implementation of this method delegates to BaseLattice.glbAux(BaseLattice), and is thus safe for finite lattices and DCC ones.
        Specified by:
        narrowingAux in interface BaseLattice<T extends InferredValue<T>>
        Parameters:
        other - the other lattice element
        Returns:
        the narrowing between this and other
        Throws:
        SemanticException - if an error occurs during the computation
      • lessOrEqualAux

        public boolean lessOrEqualAux​(InferredValue.InferredPair<T> other)
                               throws SemanticException
        Description copied from interface: BaseLattice
        Yields true if and only if this lattice element is in relation with (usually represented through ≤) the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:
        • other is not null
        • other is neither top nor bottom
        • this is neither top nor bottom
        • this and other are not the same object (according both to == and to Object.equals(Object))
        Specified by:
        lessOrEqualAux in interface BaseLattice<T extends InferredValue<T>>
        Parameters:
        other - the other lattice element
        Returns:
        true if and only if that condition holds
        Throws:
        SemanticException - if an error occurs during the computation
      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface BaseLattice<T extends InferredValue<T>>
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Specified by:
        toString in interface BaseLattice<T extends InferredValue<T>>
        Overrides:
        toString in class java.lang.Object