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

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

public class ArrayInitializer
extends BrahmsObject
implements IExpression

An ArrayInitializer represents a Java array initializer expression that specifies zero or more expressions that evaluate to the elements of a newly created array, e.g. {1, 2 + 4, 8}. ArrayInitializers may be nested to create multi-dimensional arrays

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

Field Summary
static org.apache.log4j.Logger LOGGER
          The logger used to log messages for this class
 
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
ArrayInitializer()
          Constructor, creates a new empty ArrayInitializer with no specified type and no source file location
ArrayInitializer(JavaType arrayType, java.lang.String file, int line)
          Constructor, creates a new empty ArrayInitializer with a specified array type
ArrayInitializer(java.lang.String file, int line)
          Constructor, creates a new empty ArrayInitializer with no specified type
 
Method Summary
 boolean addInitializerExpression(IExpression exp)
          Adds the specified IExpression to the list of initializer expressions specified for this array initialization.
 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.util.List<IExpression> getInitializerExpressions()
          Returns a list of all the initializer expressions that will be evaluated to determine the elements of the array
 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 for this class

Constructor Detail

ArrayInitializer

public ArrayInitializer()
Constructor, creates a new empty ArrayInitializer with no specified type and no source file location


ArrayInitializer

public ArrayInitializer(java.lang.String file,
                        int line)
Constructor, creates a new empty ArrayInitializer with no specified type

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

ArrayInitializer

public ArrayInitializer(JavaType arrayType,
                        java.lang.String file,
                        int line)
Constructor, creates a new empty ArrayInitializer with a specified array type

Parameters:
arrayType - the JavaType for the type of the array to be created
file - the file in which the array initializer expression is specified
line - the line number in the file at which the array initializer 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

addInitializerExpression

public boolean addInitializerExpression(IExpression exp)
Adds the specified IExpression to the list of initializer expressions specified for this array initialization.

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

getInitializerExpressions

public java.util.List<IExpression> getInitializerExpressions()
Returns a list of all the initializer expressions that will be evaluated to determine the elements of the array

Returns:
List<IExpression> a list of initializer 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.