daikon
Class VarComparability

Object
  extended by 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.


Field Summary
static Logger debug
          Debug tracer.
static int IMPLICIT
           
static int NONE
           
 
Constructor Summary
VarComparability()
           
 
Method Summary
abstract  boolean alwaysComparable()
          Returns true if this is comparable to everything else.
static boolean comparable(VarComparability type1, 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(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
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static final Logger debug
Debug tracer.


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 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.

makeAlias

public static VarComparability makeAlias(VarInfo vi)

makeAlias

public abstract VarComparability makeAlias()

elementType

public abstract VarComparability elementType()

indexType

public abstract VarComparability indexType(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()
Returns true if this is comparable to everything else.


comparable

public static boolean comparable(VarInfo v1,
                                 VarInfo v2)
Returns whether two variables are comparable.


comparable

public static boolean comparable(VarComparability type1,
                                 VarComparability type2)
Returns whether two comparabilities are comparable.


equality_set_ok

public boolean equality_set_ok(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