edu.rice.cs.javalanglevels
Class ArrayData

java.lang.Object
  extended by edu.rice.cs.javalanglevels.Data
      extended by edu.rice.cs.javalanglevels.TypeData
          extended by edu.rice.cs.javalanglevels.SymbolData
              extended by edu.rice.cs.javalanglevels.ArrayData

public class ArrayData
extends SymbolData

Represents the data for an array class. There are two states of SymbolData. One is a continuation which is created when a type is referenced, but the corresponding class has not been read for its members. The other is a complete SymbolData containing all of the member data. This ArrayData stores the SymbolData of its element type inside of it.


Nested Class Summary
static class ArrayData.ArrayDataTest
          Test the methods in the enclosing class.
 
Nested classes/interfaces inherited from class edu.rice.cs.javalanglevels.SymbolData
SymbolData.SymbolDataTest
 
Nested classes/interfaces inherited from class edu.rice.cs.javalanglevels.Data
Data.DataTest
 
Field Summary
 
Fields inherited from class edu.rice.cs.javalanglevels.SymbolData
AMBIGUOUS_REFERENCE, BOOLEAN_TYPE, BYTE_TYPE, CHAR_TYPE, DOUBLE_TYPE, EXCEPTION, FLOAT_TYPE, INT_TYPE, LONG_TYPE, NOT_FOUND, NULL_TYPE, SHORT_TYPE, SUPER_CONSTRUCTOR, THIS_CONSTRUCTOR, VOID_TYPE
 
Fields inherited from class edu.rice.cs.javalanglevels.Data
_blockIterator, _blocks, _enclosingData, _innerClasses, _modifiersAndVisibility, _name, _outerData, _vars
 
Constructor Summary
ArrayData(SymbolData sd, LanguageLevelVisitor llv, SourceInfo si)
          Creates a new ArrayData corresponding to the elementType sd.
 
Method Summary
 boolean equals(Object obj)
          Returns true if the provided Object is equal to this symbol data.
 int getDimensions()
          Return the dimensions of this array (the level of nesting until a non-array element type is found).
 SymbolData getElementType()
           
 ModifiersAndVisibility getMav()
           
 Data getOuterData()
          Delegates to the outer data of your element type
 String getPackage()
           
 int hashCode()
          Provides a hashcode method that distinguishes between array datas based on name
 boolean isAssignableTo(SymbolData assignTo, JavaVersion version)
          Returns true only under the following conditions: if assignTo is a class, assignTo must be java.lang.Object.
 boolean isCastableTo(SymbolData castTo, JavaVersion version)
          Return true iff castTo is a class type and is Object castTo is an interface type that is Serializable or Clonable castTo is an array type then this and castTo must have element types that are either the same primitive type or (both reference types and this's element type must be castable to castTo's element type)
 void setMav(ModifiersAndVisibility mv)
          Sets the ModifiersAndVisibility of the element type to the specified value.
 void setOuterData(Data outerData)
          A Noop, because arrays shouldn't have outer data
 void setPackage(String s)
          Set the package of the element type to be the specified package:
 
Methods inherited from class edu.rice.cs.javalanglevels.SymbolData
addFinalVars, addInnerInterface, addInterface, addMethod, addMethod, addMethod, addVar, addVars, checkDifferentReturnTypes, checkDifferentReturnTypes, clearSuperClass, createUniqueMethodName, decrementConstructorCount, getAllSuperVars, getAnonymousInnerClassNum, getConstructorCount, getInnerClassOrInterfaceHelper, getInnerInterfaces, getInstanceData, getInterfaces, getMethod, getMethods, getSuperClass, getSymbolData, getTypeParameters, hasAutoGeneratedJunitImport, hasInterface, hasMethod, implementsRunnable, incrementConstructorCount, innerClassesAndInterfacesIterator, isContinuation, isInnerClassOf, isInstanceType, isInterface, isNonFloatOrBooleanType, isNonFloatOrBooleanTypeWithoutAutoboxing, isNumberType, isNumberTypeWithoutAutoboxing, isPrimitiveType, isSubClassOf, postdecrementAnonymousInnerClassNum, postdecrementLocalClassNum, preincrementAnonymousInnerClassNum, preincrementLocalClassNum, repeatedSignature, repeatedSignature, resolve, setAnonymousInnerClassNum, setHasAutoGeneratedJunitImport, setInstanceData, setInterface, setInterfaces, setIsContinuation, setMethods, setSuperClass, setTypeParameters, toString
 
Methods inherited from class edu.rice.cs.javalanglevels.Data
addBlock, addEnclosingData, addInnerClass, addModifier, createUniqueName, dollarSignsToDots, dotsToDollarSigns, getEnclosingClass, getEnclosingData, getInnerClasses, getInnerClassOrInterface, getName, getNextAnonymousInnerClass, getNextBlock, getVar, getVars, hasModifier, isAnonymousClass, isDoublyAnonymous, isOuterData, removeAllBlocks, resetBlockIterator, setEnclosingData, setInnerClasses
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArrayData

public ArrayData(SymbolData sd,
                 LanguageLevelVisitor llv,
                 SourceInfo si)
Creates a new ArrayData corresponding to the elementType sd.

Parameters:
sd - The SymbolData element type; may be a continuation
llv - The LanguageLevelVisitor who created this ArrayData.
si - The SourceInfo corresponding to this ArrayData.
Method Detail

getPackage

public String getPackage()
Overrides:
getPackage in class SymbolData
Returns:
the package of the element type

setPackage

public void setPackage(String s)
Set the package of the element type to be the specified package:

Overrides:
setPackage in class SymbolData
Parameters:
s - The package to use

getMav

public ModifiersAndVisibility getMav()
Overrides:
getMav in class Data
Returns:
the modifiersAndVisibility for this data.

setMav

public void setMav(ModifiersAndVisibility mv)
Sets the ModifiersAndVisibility of the element type to the specified value.

Overrides:
setMav in class Data
Parameters:
mv - The ModifiersAndVisibility to use.

getElementType

public SymbolData getElementType()
Returns:
the SymbolData element type corresponding to the elements of this array.

getOuterData

public Data getOuterData()
Delegates to the outer data of your element type

Overrides:
getOuterData in class Data
Returns:
the directly enclosing outer data.

setOuterData

public void setOuterData(Data outerData)
A Noop, because arrays shouldn't have outer data

Overrides:
setOuterData in class Data
Parameters:
outerData - The Data that encloses this data.

equals

public boolean equals(Object obj)
Description copied from class: SymbolData
Returns true if the provided Object is equal to this symbol data. SymbolDatas are equal if their fields are the same.

Overrides:
equals in class SymbolData

hashCode

public int hashCode()
Provides a hashcode method that distinguishes between array datas based on name

Overrides:
hashCode in class SymbolData

isAssignableTo

public boolean isAssignableTo(SymbolData assignTo,
                              JavaVersion version)
Returns true only under the following conditions: if assignTo is a class, assignTo must be java.lang.Object. if assignTo is an interferface, then it must be Serializable or Clonable. if assignTo is an array, then if this's element type is a primitive assignTo must have the same primitive element type and if this's element type is a reference type, this's reference type must be assignable to assignTo's element type.

Overrides:
isAssignableTo in class SymbolData

isCastableTo

public boolean isCastableTo(SymbolData castTo,
                            JavaVersion version)
Return true iff castTo is a class type and is Object castTo is an interface type that is Serializable or Clonable castTo is an array type then this and castTo must have element types that are either the same primitive type or (both reference types and this's element type must be castable to castTo's element type)

Overrides:
isCastableTo in class SymbolData
Parameters:
castTo - The TypeData we are trying to cast to. (castTo) this
Returns:
true If the cast is legal, false otherwise.

getDimensions

public int getDimensions()
Return the dimensions of this array (the level of nesting until a non-array element type is found).