Package daikon
Class VarInfoAux
- Object
-
- VarInfoAux
-
- All Implemented Interfaces:
Serializable
,Cloneable
public final class VarInfoAux extends Object implements Cloneable, Serializable
Represents additional information about a VarInfo that front ends tell Daikon. For example, whether order matters in a collection. This is immutable and interned.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Logger
debug
General debug tracer.static String
FALSE
static String
HAS_DUPLICATES
Whether repeated elements can exist in this collection.static String
HAS_NULL
Whether null has a special meaning for this variable or its members.static String
HAS_ORDER
Whether order matters.static String
HAS_SIZE
Whether taking the size of this matters.static String
IS_NON_NULL
Whether this variable is known to be non-null, such as "this" in a Java program.static String
IS_PARAM
Whether this variable is a parameter to a method, or derived from a parameter to a method.static String
IS_STRUCT
Whether this variable is an inline structure.static String
MAXIMUM_LENGTH
Indicates the maximum size of the vector, if there's any.static String
MAXIMUM_VALUE
Indicates the maximum value of the scalar variable or the vector elements, if there's any.static String
MINIMUM_LENGTH
Indicates the minimum size of the vector, if there's any.static String
MINIMUM_VALUE
Indicates the minimum value of the scalar variable or the vector elements, if there's any.static String
NO_PACKAGE_NAME
SeePACKAGE_NAME
.static String
NULL_TERMINATING
Whether the elements in this collection are all the meaningful elements, or whether there is a null at the end of this collection that ends the collection.static String
PACKAGE_NAME
Java-specific.static String
TRUE
static String
VALID_VALUES
Indicates the valid values (using string representation) for the elements of the vector, if there's any.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description VarInfoAux
clone()
Creates and returns a copy of this.boolean
equals(@GuardSatisfied @Nullable Object o)
boolean
equals_for_instantiation(@GuardSatisfied VarInfoAux o)
boolean
equalsVarInfoAux(@GuardSatisfied VarInfoAux o)
static @Interned VarInfoAux
getDefault()
Create a new VarInfoAux with default options.boolean
getFlag(@KeyFor("this.map") String key)
int
getInt(@KeyFor("this.map") String key)
Returns the integer value associated with a key, assuming it is defined.String[]
getList(@KeyFor("this.map") String key)
Returns the string array associated with a key, assuming it is defined.String
getValue(@KeyFor("this.map") String key)
Returns the value for the given key, which must be present in the map.@Nullable String
getValueOrNull(String key)
Returns the value for the given key, or null if it is not present.boolean
hasDuplicates()
SeeHAS_DUPLICATES
.int
hashCode()
boolean
hasNull()
SeeHAS_NULL
.boolean
hasOrder()
SeeHAS_ORDER
.boolean
hasSize()
SeeHAS_SIZE
.boolean
hasValue(String key)
Returntrue
if the value for the given key is defined, andfalse
otherwise.boolean
isNonNull()
SeeIS_NON_NULL
.boolean
isParam()
SeeIS_PARAM
.boolean
isStruct()
SeeIS_STRUCT
.boolean
nullTerminating()
SeeNULL_TERMINATING
.boolean
packageName()
SeePACKAGE_NAME
.static @Interned VarInfoAux
parse(String inString)
Return an interned VarInfoAux that represents a given string.VarInfoAux
setInt(String key, int value)
Converts the integervalue
to a String before invokingsetValue(String, String)
.@Interned VarInfoAux
setValue(String key, String value)
Return a new VarInfoAux with the desired value set.String
toString()
-
-
-
Field Detail
-
TRUE
public static final String TRUE
- See Also:
- Constant Field Values
-
FALSE
public static final String FALSE
- See Also:
- Constant Field Values
-
NULL_TERMINATING
public static final String NULL_TERMINATING
Whether the elements in this collection are all the meaningful elements, or whether there is a null at the end of this collection that ends the collection.- See Also:
- Constant Field Values
-
IS_PARAM
public static final String IS_PARAM
Whether this variable is a parameter to a method, or derived from a parameter to a method. By default, if p is a parameter, then some EXIT invariants related to p aren't printed. However, this does not affect the computation of invariants.Frontends are responsible for setting if p is a parameter and if p.a is a parameter. In Java, p.a is not a parameter, whereas in IOA, it is.
- See Also:
- Constant Field Values
-
HAS_DUPLICATES
public static final String HAS_DUPLICATES
Whether repeated elements can exist in this collection.- See Also:
- Constant Field Values
-
HAS_ORDER
public static final String HAS_ORDER
Whether order matters.- See Also:
- Constant Field Values
-
HAS_SIZE
public static final String HAS_SIZE
Whether taking the size of this matters.- See Also:
- Constant Field Values
-
HAS_NULL
public static final String HAS_NULL
Whether null has a special meaning for this variable or its members.- See Also:
- Constant Field Values
-
MINIMUM_LENGTH
public static final String MINIMUM_LENGTH
Indicates the minimum size of the vector, if there's any.- See Also:
- Constant Field Values
-
MAXIMUM_LENGTH
public static final String MAXIMUM_LENGTH
Indicates the maximum size of the vector, if there's any.- See Also:
- Constant Field Values
-
MINIMUM_VALUE
public static final String MINIMUM_VALUE
Indicates the minimum value of the scalar variable or the vector elements, if there's any.- See Also:
- Constant Field Values
-
MAXIMUM_VALUE
public static final String MAXIMUM_VALUE
Indicates the maximum value of the scalar variable or the vector elements, if there's any.- See Also:
- Constant Field Values
-
VALID_VALUES
public static final String VALID_VALUES
Indicates the valid values (using string representation) for the elements of the vector, if there's any. Values are enclosed in square brackets, and each element is quoted separately, e.g.: ["a" "b"]. Parsing will be done upon call of the getList() method.- See Also:
getList(String)
, Constant Field Values
-
IS_STRUCT
public static final String IS_STRUCT
Whether this variable is an inline structure. By default, a variable is a reference to a structure (class). If it is an inlined structure (or array), it doesn't make sense to look for invariants over its hashcode. Front ends include references to inlined structures as variables because some tools that follow daikon need other information about the variable.- See Also:
- Constant Field Values
-
IS_NON_NULL
public static final String IS_NON_NULL
Whether this variable is known to be non-null, such as "this" in a Java program.- See Also:
- Constant Field Values
-
PACKAGE_NAME
public static final String PACKAGE_NAME
Java-specific. The package name of the class that declares this variable, if the variable is a field. If it's not a field of some class, the value of this key is "no_package_name_string".- See Also:
- Constant Field Values
-
NO_PACKAGE_NAME
public static final String NO_PACKAGE_NAME
SeePACKAGE_NAME
.- See Also:
- Constant Field Values
-
-
Method Detail
-
parse
public static @Interned VarInfoAux parse(String inString) throws IOException
Return an interned VarInfoAux that represents a given string. Elements are separated by commas, in the form:x = a, "a key" = "a value"
Parse allow for quoted elements. White space to the left and right of keys and values do not matter, but inbetween does.
- Throws:
IOException
-
getDefault
public static @Interned VarInfoAux getDefault()
Create a new VarInfoAux with default options.- Returns:
- a new VarInfoAux with default options
-
clone
@SideEffectFree public VarInfoAux clone(@GuardSatisfied VarInfoAux this) throws CloneNotSupportedException
Creates and returns a copy of this.- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
hashCode
@Pure public int hashCode(@GuardSatisfied VarInfoAux this)
-
equals
@EnsuresNonNullIf(result=true, expression="#1") @Pure public boolean equals(@GuardSatisfied VarInfoAux this, @GuardSatisfied @Nullable Object o)
-
equalsVarInfoAux
@Pure public boolean equalsVarInfoAux(@GuardSatisfied VarInfoAux this, @GuardSatisfied VarInfoAux o)
-
equals_for_instantiation
@Pure public boolean equals_for_instantiation(@GuardSatisfied VarInfoAux this, @GuardSatisfied VarInfoAux o)
-
getInt
@Pure public int getInt(@KeyFor("this.map") String key)
Returns the integer value associated with a key, assuming it is defined. It is recommended to check that it is defined first withhasValue(String)
.- Throws:
RuntimeException
- if the key is not definedNumberFormatException
- if the value of the key cannot be parsed as an integer- See Also:
hasValue(String)
-
getList
public String[] getList(@KeyFor("this.map") String key)
Returns the string array associated with a key, assuming it is defined. It is recommended to check that it is defined first withhasValue(String)
.- Throws:
RuntimeException
- if the key is not defined- See Also:
hasValue(String)
-
getValue
public String getValue(@GuardSatisfied VarInfoAux this, @KeyFor("this.map") String key)
Returns the value for the given key, which must be present in the map.
-
getValueOrNull
public @Nullable String getValueOrNull(@GuardSatisfied VarInfoAux this, String key)
Returns the value for the given key, or null if it is not present.
-
hasValue
@Pure @EnsuresKeyForIf(result=true, expression="#1", map="map") public boolean hasValue(String key)
Returntrue
if the value for the given key is defined, andfalse
otherwise.
-
setValue
public @Interned VarInfoAux setValue(String key, String value)
Return a new VarInfoAux with the desired value set. Does not modify this.
-
setInt
public VarInfoAux setInt(String key, int value)
Converts the integervalue
to a String before invokingsetValue(String, String)
.
-
nullTerminating
@Pure public boolean nullTerminating()
SeeNULL_TERMINATING
.- See Also:
NULL_TERMINATING
-
packageName
@Pure public boolean packageName()
SeePACKAGE_NAME
.- See Also:
PACKAGE_NAME
-
hasDuplicates
@Pure public boolean hasDuplicates()
SeeHAS_DUPLICATES
.- See Also:
HAS_DUPLICATES
-
isNonNull
@Pure public boolean isNonNull()
SeeIS_NON_NULL
.- See Also:
IS_NON_NULL
-
-