daikon
Class ProglangType

Object
  extended by ProglangType
All Implemented Interfaces:
Serializable

public final class ProglangType
extends Object
implements Serializable

Represents the type of a variable, for its declared, dtrace file representation, and internal representations. ProgLangTypes are interned, so they can be == compared.

See Also:
Serialized Form

Field Summary
static ProglangType BOOLEAN
           
static ProglangType BOOLEAN_ARRAY
           
static ProglangType CHAR
           
static ProglangType CHAR_ARRAY
           
static ProglangType CHAR_ARRAY_ARRAY
           
static boolean dkconfig_convert_to_signed
          If true, treat 32 bit values whose high bit is on, as a negative number (rather than as a 32 bit unsigned).
static ProglangType DOUBLE
           
static ProglangType DOUBLE_ARRAY
           
static ProglangType HASHCODE
           
static ProglangType HASHCODE_ARRAY
           
static ProglangType INT
           
static ProglangType INT_ARRAY
           
static ProglangType INTEGER
           
static HashSet<String> list_implementors
           
static ProglangType LONG_OBJECT
           
static ProglangType LONG_PRIMITIVE
           
static ProglangType LONG_PRIMITIVE_ARRAY
           
static ProglangType OBJECT
           
static ProglangType STRING
           
static ProglangType STRING_ARRAY
           
 
Method Summary
 String base()
           
 boolean baseIsBoolean()
           
 boolean baseIsFloat()
           
 boolean baseIsHashcode()
           
 boolean baseIsIntegral()
           
 boolean baseIsObject()
           
 boolean baseIsPrimitive()
           
 boolean baseIsScalar()
           
 boolean baseIsString()
           
 boolean comparableOrSuperclassEitherWay(ProglangType other)
          Return true if these two types can be sensibly compared to one another, or if one can be cast to the other.
 boolean comparableOrSuperclassOf(ProglangType other)
          Return true if these two types can be sensibly compared to one another, and if non-integral, whether this could be a superclass of other.
 int dimensions()
           
 boolean elementIsFloat()
           
 boolean elementIsIntegral()
           
 boolean elementIsString()
           
 ProglangType elementType()
          Returns the type of elements of this.
 ProglangType fileTypeToRepType()
          Convert a file representation type to an internal representation type.
 String format()
           
 boolean is_function_pointer()
          Returns whether or not this declared type is a function pointer Only valid if the front end marks the function pointer with the name '*func'
 boolean isArray()
           
 boolean isFloat()
           
 boolean isHashcode()
           
 boolean isIndex()
           
 boolean isIntegral()
           
 boolean isObject()
           
 boolean isPointerFileRep()
          Does this type represent a pointer?
 boolean isPrimitive()
           
 boolean isScalar()
           
 boolean isString()
           
 Object parse_value_array_1d(String value)
           
 Object parse_value_array_2d(String value)
           
 Object parse_value_scalar(String value)
           
 Object parse_value(String value)
          Given a string representation of a value (of the type represented by this ProglangType), return the (canonicalized) interpretation of that value.
static ProglangType parse(String rep)
          This can't be a constructor because it returns a canonical representation (that can be compared with ==), not necessarily a new object.
 Object readResolve()
          For serialization; indicates which object to return instead of the one that was just read from the file.
static ProglangType rep_parse(String rep)
          Like parse, but does certain conversions for representation types, in order to return real file representation types even if the file contains something slightly different than the prescribed format.
 String toString()
           
static String toString(ProglangType[] types)
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

list_implementors

public static HashSet<String> list_implementors

dkconfig_convert_to_signed

public static boolean dkconfig_convert_to_signed
If true, treat 32 bit values whose high bit is on, as a negative number (rather than as a 32 bit unsigned).


INT

public static final ProglangType INT

LONG_PRIMITIVE

public static final ProglangType LONG_PRIMITIVE

DOUBLE

public static final ProglangType DOUBLE

CHAR

public static final ProglangType CHAR

STRING

public static final ProglangType STRING

INT_ARRAY

public static final ProglangType INT_ARRAY

LONG_PRIMITIVE_ARRAY

public static final ProglangType LONG_PRIMITIVE_ARRAY

DOUBLE_ARRAY

public static final ProglangType DOUBLE_ARRAY

CHAR_ARRAY

public static final ProglangType CHAR_ARRAY

STRING_ARRAY

public static final ProglangType STRING_ARRAY

CHAR_ARRAY_ARRAY

public static final ProglangType CHAR_ARRAY_ARRAY

INTEGER

public static final ProglangType INTEGER

LONG_OBJECT

public static final ProglangType LONG_OBJECT

OBJECT

public static final ProglangType OBJECT

BOOLEAN

public static final ProglangType BOOLEAN

HASHCODE

public static final ProglangType HASHCODE

BOOLEAN_ARRAY

public static final ProglangType BOOLEAN_ARRAY

HASHCODE_ARRAY

public static final ProglangType HASHCODE_ARRAY
Method Detail

base

public String base()

dimensions

public int dimensions()

isArray

public boolean isArray()

parse

public static ProglangType parse(String rep)
This can't be a constructor because it returns a canonical representation (that can be compared with ==), not necessarily a new object.

Parameters:
rep - the name of the type, optionally suffixed by (possibly multiple) "[]"

rep_parse

public static ProglangType rep_parse(String rep)
Like parse, but does certain conversions for representation types, in order to return real file representation types even if the file contains something slightly different than the prescribed format.


fileTypeToRepType

public ProglangType fileTypeToRepType()
Convert a file representation type to an internal representation type.


readResolve

public Object readResolve()
                   throws ObjectStreamException
For serialization; indicates which object to return instead of the one that was just read from the file. This obviates the need to write a readObject method that interns the interned fields (just "base").

Throws:
ObjectStreamException

elementType

public ProglangType elementType()
Returns the type of elements of this. They may themselves be arrays if this is multidimensional.


parse_value

public final Object parse_value(String value)
Given a string representation of a value (of the type represented by this ProglangType), return the (canonicalized) interpretation of that value.

If the type is an array and there are any nonsensical elements in the array, the entire array is considered to be nonsensical (indicated by returning null). This is not really correct, but it is a reasonable path to take for now. (jhp, Feb 12, 2005)


parse_value_scalar

public final Object parse_value_scalar(String value)

parse_value_array_1d

public final Object parse_value_array_1d(String value)

parse_value_array_2d

public final Object parse_value_array_2d(String value)

baseIsPrimitive

public boolean baseIsPrimitive()

isPrimitive

public boolean isPrimitive()

baseIsIntegral

public boolean baseIsIntegral()

isIntegral

public boolean isIntegral()

elementIsIntegral

public boolean elementIsIntegral()

elementIsFloat

public boolean elementIsFloat()

elementIsString

public boolean elementIsString()

isIndex

public boolean isIndex()

isScalar

public boolean isScalar()

baseIsScalar

public boolean baseIsScalar()

baseIsBoolean

public boolean baseIsBoolean()

baseIsFloat

public boolean baseIsFloat()

isFloat

public boolean isFloat()

isObject

public boolean isObject()

baseIsObject

public boolean baseIsObject()

baseIsString

public boolean baseIsString()

isString

public boolean isString()

baseIsHashcode

public boolean baseIsHashcode()

isHashcode

public boolean isHashcode()

isPointerFileRep

public boolean isPointerFileRep()
Does this type represent a pointer? Should only be applied to file_rep types.


comparableOrSuperclassEitherWay

public boolean comparableOrSuperclassEitherWay(ProglangType other)
Return true if these two types can be sensibly compared to one another, or if one can be cast to the other. For instance, int is castable to long, but boolean is not castable to float, and int is not castable to int[]. This is a reflexive relationship, but not a transitive one because it might not be true for two children of a superclass, even though it's true for the superclass.


comparableOrSuperclassOf

public boolean comparableOrSuperclassOf(ProglangType other)
Return true if these two types can be sensibly compared to one another, and if non-integral, whether this could be a superclass of other. A List is comparableOrSuperclassOf to a Vector, but not the other way around. This is a transitive method, but not reflexive.


format

public String format()

toString

public static String toString(ProglangType[] types)

toString

public String toString()
Overrides:
toString in class Object

is_function_pointer

public boolean is_function_pointer()
Returns whether or not this declared type is a function pointer Only valid if the front end marks the function pointer with the name '*func'