Package daikon
Class VarComparability
- Object
-
- 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.
-
-
Constructor Summary
Constructors Constructor Description VarComparability()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
alwaysComparable()
Returns true if this is comparable to everything else.static boolean
comparable(@GuardSatisfied VarComparability type1, @GuardSatisfied VarComparability type2)
Returns whether two comparabilities are comparable.static boolean
comparable(VarInfo v1, VarInfo v2)
Returns whether two variables are comparable.abstract VarComparability
elementType()
boolean
equality_set_ok(@GuardSatisfied VarComparability other)
In general, if two items are comparable, they can be placed in the same equality set.abstract VarComparability
indexType(int dim)
abstract VarComparability
makeAlias()
static VarComparability
makeAlias(VarInfo vi)
static VarComparability
makeComparabilitySameIndices(String elemTypeName, VarComparability old)
Create a VarComparability based on comparabilities of indices.static VarComparability
parse(int format, String rep, ProglangType vartype)
Create a VarComparability representing the given arguments with respect to a variable.abstract VarComparability
string_length_type()
Return the comparability for the length of this string*
-
-
-
Field Detail
-
NONE
public static final int NONE
- See Also:
- Constant Field Values
-
IMPLICIT
public static final int IMPLICIT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
VarComparability
public VarComparability()
-
-
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 IMPLICITrep
- 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 valueold
- 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
-
makeAlias
public static VarComparability makeAlias(VarInfo vi)
-
makeAlias
public abstract VarComparability makeAlias()
-
elementType
public abstract VarComparability elementType(@GuardSatisfied VarComparability this)
-
indexType
public abstract VarComparability indexType(@GuardSatisfied VarComparability this, int dim)
-
string_length_type
public abstract VarComparability string_length_type()
Return the comparability for the length of this string*
-
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.
-
comparable
@Pure public static boolean comparable(@GuardSatisfied VarComparability type1, @GuardSatisfied VarComparability type2)
Returns whether two comparabilities 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.
-
-