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

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

public class ArrayAccess
extends BrahmsObject
implements IAssignmentLhs, IExpression

An ArrayAccess represents a Java array access expression that specifies one or more index expressions that evaluate to the indices to be used to access or set elements of the array, e.g. array[3][4]. An array access can be used on the left-hand side of an assignment or as a right-hand side expression. The reference to the array itself must be a Brahms variable or parameter.

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
ArrayAccess()
          Constructor, creates a new empty ArrayAccess
ArrayAccess(Operand arrayRef, java.lang.String file, int line)
          Constructor, creates a new ArrayAccess for an array access whose array is referenced by an Operand for a variable or parameter and that occurs in the given source file at the given line number.
ArrayAccess(java.lang.String file, int line)
          Constructor, creates a new empty ArrayAccess specified in the given file at the given line number.
 
Method Summary
 boolean addIndexExpression(IExpression exp)
          Adds the specified IExpression to the list of index expressions specified for this array access.
 Operand getArrayReference()
          Returns the Operand for the variable or parameter that will reference the array
 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> getIndexExpressions()
          Returns a list of all the index expressions specified for this array access.
 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 setArrayReference(Operand ref)
          Sets the Operand for the variable or parameter that will reference the array
 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.
 
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.IAssignmentLhs
export
 
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

ArrayAccess

public ArrayAccess()
Constructor, creates a new empty ArrayAccess


ArrayAccess

public ArrayAccess(java.lang.String file,
                   int line)
Constructor, creates a new empty ArrayAccess specified in the given file at the given line number.

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

ArrayAccess

public ArrayAccess(Operand arrayRef,
                   java.lang.String file,
                   int line)
Constructor, creates a new ArrayAccess for an array access whose array is referenced by an Operand for a variable or parameter and that occurs in the given source file at the given line number.

Parameters:
arrayRef - an Operand for a Brahms variable or parameter
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

setArrayReference

public void setArrayReference(Operand ref)
Sets the Operand for the variable or parameter that will reference the array

Parameters:
ref - the Operand referencing the array

getArrayReference

public Operand getArrayReference()
Returns the Operand for the variable or parameter that will reference the array

Returns:
Operand the variable or parameter referencing the array

addIndexExpression

public boolean addIndexExpression(IExpression exp)
Adds the specified IExpression to the list of index expressions specified for this array access. Each index expression should evaluate to an int giving the index to be used for the corresponding dimension of the array.

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

getIndexExpressions

public java.util.List<IExpression> getIndexExpressions()
Returns a list of all the index expressions specified for this array access.

Returns:
List<IExpression> a list of the index expressions
See Also:
IExpression

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.