|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<VariableType>
dk.brics.string.intermediate.VariableType
public enum VariableType
Describes the possible types of a variable. The types are named after their repsective Java-types, but are defined independently of Java. The three string-types we operate with are:
OBJECT / | \ \ / | \ \ / | \ \ / | \ \ / | \ \ / | \ \ STRING STRINGBUFFER ARRAY PRIMITIVE \ | / / \ | / / \ | / / \ | / / \ | / / NONE | NULLThe methods in the
Types
class are the preferred ways
to create a type from a Java type, since it is non-trivial to do so in a sound way. For example, a variable
of type Cloneable
might be an array, and the non-public type AbstractStringBuilder is in
fact the superclass of StringBuffer
and StringBuilder
, and not Object
like documented.
Note that mutable strings (STRINGBUFFER
) cannot be members of a string collection (ARRAY
).
This means that Java array types like StringBuffer[] cannot be modelled precisely.
Enum Constant Summary | |
---|---|
ARRAY
A mutable collection of immutable strings. |
|
NONE
An irrelevant type, or the value null. |
|
NULL
The value null (and not the string-value "null"). |
|
OBJECT
Any type we care about. |
|
PRIMITIVE
|
|
STRING
An immutable string object. |
|
STRINGBUFFER
A mutable string object. |
Method Summary | |
---|---|
boolean |
cannotBeAliasOf(VariableType other)
Returns whether a variable of this type can never be an alias of a variable of the other type. |
boolean |
cannotBeUsefulAliasOf(VariableType other)
Returns whether a variable of this type can never be a useful alias of a variable of the other type. |
VariableType |
greatestLowerBound(VariableType other)
Returns the most specific variable type that might be alias of both this type, and the specified type. |
VariableType |
leastUpperBound(VariableType other)
Returns the most specific variable type that might be alias of either this type, or the specified type, but not necessarily both. |
boolean |
mightBeAliasOf(VariableType other)
Returns whether a variable of this type might be an alias of a variable of the other type. |
boolean |
mightBeUsefulAliasOf(VariableType other)
Returns whether a variable of this type might be a useful alias of a variable of the other type. |
boolean |
mightBeUsefulMutable()
Returns true if this is STRINGBUFFER , ARRAY ,
or OBJECT . |
static VariableType |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static VariableType[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final VariableType ARRAY
String
,
but is definitely not String, StringBuffer, or StringBuilder.
public static final VariableType NONE
public static final VariableType NULL
public static final VariableType OBJECT
public static final VariableType PRIMITIVE
public static final VariableType STRING
String
, but definitely not StringBuffer,
StringBuilder or array.
public static final VariableType STRINGBUFFER
StringBuffer
or StringBuilder
,
but definitely not String or array.
Method Detail |
---|
public boolean cannotBeAliasOf(VariableType other)
other
- the other variable type
public boolean cannotBeUsefulAliasOf(VariableType other)
mightBeUsefulAliasOf(VariableType)
, and is
only here for convenience.
other
- the other variable type
public VariableType greatestLowerBound(VariableType other)
VariableType
's description to see how the greatest lower bound is defined.
other
- the other variable type
public VariableType leastUpperBound(VariableType other)
VariableType
's description to see how the least upper bound is defined.
other
- the other variable type
public boolean mightBeAliasOf(VariableType other)
other
- the other variable type
public boolean mightBeUsefulAliasOf(VariableType other)
other
- the other variable type
public boolean mightBeUsefulMutable()
STRINGBUFFER
, ARRAY
,
or OBJECT
.
public static VariableType valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic static VariableType[] values()
for (VariableType c : VariableType.values()) System.out.println(c);
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |