Package daikon

Class VarComparability

  • Direct Known Subclasses:
    VarComparabilityImplicit, VarComparabilityNone

    public abstract class VarComparability
    extends Object
    Represents the comparability of variables, including methods to determine if two VarComparabilities are comparable. VarComparability types have two formats: implicit and none.

    A VarComparabilityImplicit is an arbitrary string, and comparisons succeed exactly if the two VarComparabilitys are identical.

    VarComparabilityNone means no comparability information was provided.

    • Method Detail

      • parse

        public static VarComparability parse​(int format,
                                             String rep,
                                             ProglangType vartype)
        Create a VarComparability representing the given arguments with respect to a variable.
        Parameters:
        format - the type of comparability, either NONE or IMPLICIT
        rep - a regular expression indicating how to match. The form is "(a)[b][c]..." where each variable is string (or number) that is a UID for a basic type. a is the type of the element, b is the type of the first index, c the type of the second, etc. Index variables only apply if this is an array.
        vartype - the declared type of the variable
      • makeComparabilitySameIndices

        public static VarComparability makeComparabilitySameIndices​(String elemTypeName,
                                                                    VarComparability old)
        Create a VarComparability based on comparabilities of indices.
        Parameters:
        elemTypeName - the new type of the elements of return value
        old - the varcomparability that this is derived from; has the same indices as this
        Returns:
        a new comparability that is an array with the same dimensionality and indices as given, but with a different element type
      • alwaysComparable

        public abstract boolean alwaysComparable​(@GuardSatisfied VarComparability this)
        Returns true if this is comparable to everything else.
      • comparable

        @Pure
        public static boolean comparable​(VarInfo v1,
                                         VarInfo v2)
        Returns whether two variables are comparable.
      • equality_set_ok

        public boolean equality_set_ok​(@GuardSatisfied VarComparability this,
                                       @GuardSatisfied VarComparability other)
        In general, if two items are comparable, they can be placed in the same equality set. This is not always true for some comparabilities (because they are not always transitive). They can override this method to provide the correct results.