soot
Class ArrayType

java.lang.Object
  extended by soot.Type
      extended by soot.RefLikeType
          extended by soot.ArrayType
All Implemented Interfaces:
Serializable, Numberable, Switchable

public class ArrayType
extends RefLikeType

A class that models Java's array types. ArrayTypes are parametrized by a Type and and an integer representing the array's dimension count.. Two ArrayType are 'equal' if they are parametrized equally.

See Also:
Serialized Form

Field Summary
 Type baseType
          baseType can be any type except for an array type, null and void What is the base type of the array? That is, for an array of type A[][][], how do I find out what the A is? The accepted way of doing this has always been to look at the public field baseType in ArrayType, ever since the very beginning of Soot.
 int numDimensions
          dimension count for the array type
 
Fields inherited from class soot.Type
arrayType
 
Method Summary
 void apply(Switch sw)
          Method required for use of Switchable.
 boolean equals(Object t)
          Two ArrayType are 'equal' if they are parametrized identically.
 Type getArrayElementType()
          If I have a variable x of declared type t, what is a good declared type for the expression ((Object[]) x)[i]? The getArrayElementType() method in RefLikeType was introduced to answer this question for all classes implementing RefLikeType.
 Type getElementType()
          If I get an element of the array, what will be its type? That is, if I have an array a of type A[][][], what is the type of a[] (it's A[][])? The getElementType() method in ArrayType was introduced to answer this question.
 int hashCode()
           
 ArrayType makeArrayType()
           
 String toString()
          Returns a textual representation of this type.
 void toString(UnitPrinter up)
           
static ArrayType v(Type baseType, int numDimensions)
          Creates an ArrayType parametrized by a given Type and dimension count.
 
Methods inherited from class soot.Type
getArrayType, getNumber, merge, setArrayType, setNumber, toMachineType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

baseType

public final Type baseType
baseType can be any type except for an array type, null and void What is the base type of the array? That is, for an array of type A[][][], how do I find out what the A is? The accepted way of doing this has always been to look at the public field baseType in ArrayType, ever since the very beginning of Soot.


numDimensions

public final int numDimensions
dimension count for the array type

Method Detail

v

public static ArrayType v(Type baseType,
                          int numDimensions)
Creates an ArrayType parametrized by a given Type and dimension count.

Parameters:
baseType - a Type to parametrize the ArrayType
numDimensions - the dimension count to parametrize the ArrayType.
Returns:
an ArrayType parametrized accrodingly.

equals

public boolean equals(Object t)
Two ArrayType are 'equal' if they are parametrized identically. (ie have same Type and dimension count.

Overrides:
equals in class Object
Parameters:
t - object to test for equality
Returns:
true if t is an ArrayType and is parametrized identically to this.

toString

public void toString(UnitPrinter up)

toString

public String toString()
Description copied from class: Type
Returns a textual representation of this type.

Specified by:
toString in class Type

hashCode

public int hashCode()
Overrides:
hashCode in class Object

apply

public void apply(Switch sw)
Description copied from class: Type
Method required for use of Switchable.

Specified by:
apply in interface Switchable
Overrides:
apply in class Type

getArrayElementType

public Type getArrayElementType()
If I have a variable x of declared type t, what is a good declared type for the expression ((Object[]) x)[i]? The getArrayElementType() method in RefLikeType was introduced to answer this question for all classes implementing RefLikeType. If t is an array, then the answer is the same as getElementType(). But t could also be Object, Serializable, or Cloneable, which can all hold any array, so then the answer is Object.

Specified by:
getArrayElementType in class RefLikeType

getElementType

public Type getElementType()
If I get an element of the array, what will be its type? That is, if I have an array a of type A[][][], what is the type of a[] (it's A[][])? The getElementType() method in ArrayType was introduced to answer this question.


makeArrayType

public ArrayType makeArrayType()
Overrides:
makeArrayType in class Type