gov.nasa.arc.brahms.common.data
Class ArrayCreation

java.lang.Object
  extended by gov.nasa.arc.brahms.common.data.BrahmsObject
      extended by gov.nasa.arc.brahms.common.data.ArrayCreation
All Implemented Interfaces:
IExpression, gov.nasa.arc.brahms.common.IConstants, java.io.Serializable
Direct Known Subclasses:
VMArrayCreation

public class ArrayCreation
extends BrahmsObject
implements IExpression

An ArrayCreation represents a Java array creation expression that specifies one or more dimension expressions that evaluate to the size of some number of the dimensions of the array, e.g. new Integer[3][]. A Java array creation expression that uses an array initializer is represented by an ArrayInitializer.

Version:
$Revision: 1.1 $ $Date: 2009/11/23 18:28:41 $ $Author: rnado $
Author:
Bob Nado
See Also:
Serialized Form

Field Summary
static org.apache.log4j.Logger LOGGER
          The logger used to log messages
 
Fields inherited from interface gov.nasa.arc.brahms.common.IConstants
ABORT, ACTIVECLASS, ACTIVECONCEPT, ACTIVEINSTANCE, AGENT, ANONYMOUS, ANYAGENT, AREA, AREADEF, ASSIGNED, ATTRIBUTE, BASEAREADEF, BASECLASS, BASECONCEPTUALCLASS, BASEGROUP, BASELIBRARY, BOOLEAN, BROADCAST, BUILDING, BYTE, CCLOCK, CDATE, CHAR, CITY, CLASS, CLOCK, COLLECTALL, COMMUNICATE, COMPLETE, COMPOSITE, COMPUTER, CONCEPT, CONCEPTUALCLASS, CONCEPTUALCONCEPT, CONCEPTUALOBJECT, CONTINUE, COPY, CREATEAGENT, CREATEAREA, CREATEOBJECT, current, CURRENT, DATAFRAME, DATE, DB, DETECTABLE, DIV, DOUBLE, EMAIL, EMPTY_STRING, END, ENDACTIVITY, ENTAGENT, EQ, EXCEPTION, EXPR, FACE2FACE, FACTFRAME, FALSE, FAX, FLOAT, FOREACH, FORONE, G2, GE, GEOGRAPHYCONCEPT, GESTURE, GET, GROUP, GT, IMPASSE, INT, INVALID, JAVA, JAVA_TYPE, KNOWN_MODIFIER, KNOWNVAL_MODIFIER, LE, LOCAL, LONG, LT, MAP, MINUS, MOD, MOVE, MULT, NE, NEW, NONE, NOT_MODIFIER, NOWORK, O, OA, OBJECT, ONTOLOGY, PAGER, PARAMETER, PATH, PHONE, PLUS, PRIMITIVE, PRIVATE, PROAGENT, PROTECTED, PRSAGENT, PUBLIC, PUT, RECEIVE, RELATION, sACTIVECLASS, sACTIVECONCEPT, sACTIVEINSTANCE, sAGENT, sARCHIVE, sAREA, sAREADEF, sBOOLEAN, sBYTE, sBYTECODEEXT, sCHAR, sCLASS, sCOMPUTER, sCONCEPT, sCONCEPTUALCLASS, sCONCEPTUALCONCEPT, sCONCEPTUALOBJECT, sCOPY, sCURRENT, sDETECTABLE, sDOUBLE, sEMAIL, sEND, SEND, sFACE2FACE, sFAX, sFILEEXT, sFLOAT, sGEOGRAPHYCONCEPT, sGROUP, SHORT, SIMAGENT, sINT, sJAVA_TYPE, sLONG, sMAP, sNEW, sNONE, sNOWORK, sOBJECT, SOURCECODE, sPAGER, sPARAMETER, sPATH, sPHONE, sPRIVATE, sPROJECTEXT, sPROTECTED, sPUBLIC, sSHORT, sSTART, sSTRING, sSYMBOL, START, STRING, sUNKNOWN, sVOID, SYMBOL, TRUE, UDT, UML, UNASSIGNED, UNDEFINED, unknown, UNKNOWN, UNKNOWN_MODIFIER, V, VARIABLE, VOID, WHENEVER, WORKFRAME, WORLD, XML
 
Constructor Summary
ArrayCreation()
          Constructor, creates a new ArrayCreation with no reference to the type of array, or the source file location
ArrayCreation(JavaType arrayType, java.lang.String file, int line)
          Creates a new ArrayCreation with a given array type
ArrayCreation(java.lang.String file, int line)
          Constructor, creates a new ArrayCreation with no reference the type of array
 
Method Summary
 boolean addDimensionExpression(IExpression exp)
          Adds the specified IExpression to the list of dimension expressions specified for this array creation.
 Type getCollectType()
          Returns the Brahms type of the expression when it contains one or more collectall variables and the values of the expression should be accumulated in a list before assigning to a variable or passing the result to a Java method, constructor, or array initializer.
 java.lang.Class<?> getComponentClass()
          Returns the base component Java class for the array to be created, i.e.
 java.util.List<IExpression> getDimensionExpressions()
          Returns a list of all the dimension expressions specified for this array creation.
 JavaType getJavaType()
          Returns a JavaType representing the Java type of the array to be created
 void getParameters(java.util.LinkedList ll)
          Adds to a supplied list all the parameters used in the expression.
 void getVariables(java.util.LinkedList ll)
          Adds to a supplied list all the variables used in the expression.
 void setCollectType(Type type)
          Sets the Brahms type when this expression contains one or more collectall variables and the values of the expression should be accumulated in a list before assigning to a variable or passing the result to a Java method, constructor, or array initializer.
 void setJavaType(JavaType type)
          Sets the JavaType representing the Java type of the array to be created
 
Methods inherited from class gov.nasa.arc.brahms.common.data.BrahmsObject
delete, export, getFile, getID, getLine, getSerialNumber, isBCC, isDynamic, isLoaded, isResolved, setBCC, setDynamic, setFile, setID, setID, setLine, setLoaded, setResolved, setSerialNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nasa.arc.brahms.common.data.IExpression
export
 

Field Detail

LOGGER

public static final org.apache.log4j.Logger LOGGER
The logger used to log messages

Constructor Detail

ArrayCreation

public ArrayCreation()
Constructor, creates a new ArrayCreation with no reference to the type of array, or the source file location


ArrayCreation

public ArrayCreation(java.lang.String file,
                     int line)
Constructor, creates a new ArrayCreation with no reference the type of array

Parameters:
file - the file in which the array creation expression is specified
line - the line number in the file at which the array creation expression is specified

ArrayCreation

public ArrayCreation(JavaType arrayType,
                     java.lang.String file,
                     int line)
Creates a new ArrayCreation with a given array type

Parameters:
arrayType - the JavaType for the type of the array to be created
file - the file in which the array creation expression is specified
line - the line number in the file at which the array creation expression is specified
Method Detail

getJavaType

public JavaType getJavaType()
Returns a JavaType representing the Java type of the array to be created

Returns:
JavaType the type of the array

setJavaType

public void setJavaType(JavaType type)
Sets the JavaType representing the Java type of the array to be created

Parameters:
type - the JavaType for the type of array

getComponentClass

public java.lang.Class<?> getComponentClass()
Returns the base component Java class for the array to be created, i.e. the non-array type of the elements obtained from an array access that specifies an index for all of the dimensions

Returns:
Class<?> the base component Java class for the array

addDimensionExpression

public boolean addDimensionExpression(IExpression exp)
Adds the specified IExpression to the list of dimension expressions specified for this array creation. Each dimension expression should evaluate to an int giving the size of the corresponding dimension of the created array.

Parameters:
exp - the dimension IExpression to be added
Returns:
true if the expression is successfully added, false otherwise
See Also:
IExpression

getDimensionExpressions

public java.util.List<IExpression> getDimensionExpressions()
Returns a list of all the dimension expressions specified for this array creation.

Returns:
List<IExpression> a list of dimension expressions

setCollectType

public void setCollectType(Type type)
Sets the Brahms type when this expression contains one or more collectall variables and the values of the expression should be accumulated in a list before assigning to a variable or passing the result to a Java method, constructor, or array initializer.

Specified by:
setCollectType in interface IExpression
Parameters:
type - the Brahms type for the expression

getCollectType

public Type getCollectType()
Returns the Brahms type of the expression when it contains one or more collectall variables and the values of the expression should be accumulated in a list before assigning to a variable or passing the result to a Java method, constructor, or array initializer.

Specified by:
getCollectType in interface IExpression
Returns:
Type the Brahms type for the expression

getVariables

public void getVariables(java.util.LinkedList ll)
Adds to a supplied list all the variables used in the expression. Adds nothing to the list if the expression contains no variables

Specified by:
getVariables in interface IExpression
Parameters:
ll - the LinkedList to which to add the variables used in the expression.

getParameters

public void getParameters(java.util.LinkedList ll)
Adds to a supplied list all the parameters used in the expression. Adds nothing to the list if the expression contains no parameters

Specified by:
getParameters in interface IExpression
Parameters:
ll - the LinkedList to which to add the parameters used in the operand.


Copyright © 1997-2012 All Rights Reserved.