|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gov.nasa.arc.brahms.common.data.BrahmsObject gov.nasa.arc.brahms.common.data.Expression gov.nasa.arc.brahms.vm.data.VMExpression
public class VMExpression
The VMExpression is an Expression with extensions for use in the virtual machine. An Expression either represents an operand or a mathematical expression allowing for the mathematical operators +, -, *, /, and %. Expressions with a left and right hand side must have an operator and the evaluated expression must result in a numeric value.
Expression
,
Serialized FormField Summary |
---|
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 | |
---|---|
VMExpression()
Constructor, creates a new expression |
|
VMExpression(Operand lhs,
int operator,
Operand rhs)
Constructor, creates a new expression with the specified left hand side, operator and right hand side. |
|
VMExpression(VMOperand lhs)
Constructor, creates a new expression with only the specified left hand side. |
Method Summary | |
---|---|
void |
buildRSN(gov.nasa.arc.brahms.vm.engine.rsn.ReasoningStateNetwork rsn,
gov.nasa.arc.brahms.vm.engine.rsn.IRSNFrameNode frame,
gov.nasa.arc.brahms.vm.engine.rsn.RSNActivityRefNode actref,
int modifier)
Adds this expression to the reasoning state network to build up a reasoning state network that maintains a state of what statements matched with the expression. |
boolean |
evaluate(gov.nasa.arc.brahms.vm.engine.rsn.RSNFrameNode frame,
int modifier,
int relop,
gov.nasa.arc.brahms.vm.engine.rsn.RSNFrameNode.FrameEvaluationRecord evalRcd,
java.util.LinkedList values)
Evaluates the expression as part of a value comparison determining whether or not the expression has a successfull match with a statement. |
java.util.List<java.lang.Object> |
evaluate(VMActiveInstanceCtx agent,
VMFrameCtx frame)
Evaluates the expression to produce a list of values. |
java.util.LinkedList |
resolveAsLhs(VMActiveInstanceCtx agent,
VMFrameCtx frame,
int strategy)
Resolves this expression considering it a left hand side in a comparison. |
java.util.LinkedList |
resolveAsRhs(VMActiveInstanceCtx agent,
VMFrameCtx frame,
int strategy)
Resolves this expression considering it a right hand side in a comparison. |
Methods inherited from class gov.nasa.arc.brahms.common.data.Expression |
---|
getCollectType, getLhs, getOperator, getParameters, getRhs, getVariables, setCollectType, setID, setLhs, setOperator, setRhs, toString |
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, setLine, setLoaded, setResolved, setSerialNumber |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface gov.nasa.arc.brahms.common.data.IExpression |
---|
export |
Constructor Detail |
---|
public VMExpression()
public VMExpression(VMOperand lhs)
lhs
- the left hand side operandpublic VMExpression(Operand lhs, int operator, Operand rhs)
lhs
- the left hand side operandoperator
- the operator (+, -, *, /, %)rhs
- the right hand side operandVMOperand
,
IConstants.PLUS
,
IConstants.MINUS
,
IConstants.MULT
,
IConstants.DIV
,
IConstants.MOD
Method Detail |
---|
public java.util.LinkedList resolveAsLhs(VMActiveInstanceCtx agent, VMFrameCtx frame, int strategy) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Note:This method is only usable with consequences, detectables, and transfer definitions, not with preconditions. Left hand side of preconditions can contain expressions which are not handled by this method.
agent
- the agent from which the belief set is to be used to resolve this expressionframe
- the frame in which this expression is used, used to resolve variablesstrategy
- the strategy to use to resolve this operand as a left hand side.
NONE if an OA is not to be resolved, FACTS if facts are to be used to resolve
an OA, BELIEFS if beliefs are to be used to resolve an OA
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if the method was unable to get access to dynamic or static model elements
VMError
- if an invalid element is encountered in the expressions when
considering this as a left hand side.resolveAsRhs(gov.nasa.arc.brahms.vm.rt.VMActiveInstanceCtx, gov.nasa.arc.brahms.vm.rt.VMFrameCtx, int)
,
IVMComparison.NONE
,
IVMComparison.FACTS
,
IVMComparison.BELIEFS
public java.util.LinkedList resolveAsRhs(VMActiveInstanceCtx agent, VMFrameCtx frame, int strategy) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
agent
- the agent from which the belief set is to be used to resolve this expressionframe
- the frame in which this expression is used, used to resolve variablesstrategy
- the strategy to use to resolve this operand as a right hand side.
FACTS if facts are to be used to resolve an OA, BELIEFS if beliefs are to be used to resolve an OA
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if the method was unable to get access to dynamic or static model elements
VMError
- if an invalid element is encountered in the expressions when
considering this as a right hand side.resolveAsLhs(gov.nasa.arc.brahms.vm.rt.VMActiveInstanceCtx, gov.nasa.arc.brahms.vm.rt.VMFrameCtx, int)
,
IVMComparison.FACTS
,
IVMComparison.BELIEFS
public void buildRSN(gov.nasa.arc.brahms.vm.engine.rsn.ReasoningStateNetwork rsn, gov.nasa.arc.brahms.vm.engine.rsn.IRSNFrameNode frame, gov.nasa.arc.brahms.vm.engine.rsn.RSNActivityRefNode actref, int modifier) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
rsn
- the ReasoningStateNetwork to be builtframe
- the RSNFrameNode for the frame in which this
expression is used.actref
- the optional RSNActivityRefNode for the activity reference
referencing a composite activity in which the frame
and the precondition are specified.modifier
- the modifier of the (pre)condition
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if an error occurs in building up
the RSN with this expressionpublic boolean evaluate(gov.nasa.arc.brahms.vm.engine.rsn.RSNFrameNode frame, int modifier, int relop, gov.nasa.arc.brahms.vm.engine.rsn.RSNFrameNode.FrameEvaluationRecord evalRcd, java.util.LinkedList values) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
frame
- the RSNFrameNode for the frame in which the expression's precondition
is specifiedmodifier
- the modifier of the (pre)conditionrelop
- relational operator used to find OA matches, -1 if relop can
be ignored, otherwise one of Relation.EQ or Relation.NEevalRcd
- the record in which to store bindings for variables and statements
matching preconditionsvalues
- the list of values matching the expression, or a variable binding
if we're dealing with a post-assigned variable that has no values
assigned yet.
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if an internal error occurspublic java.util.List<java.lang.Object> evaluate(VMActiveInstanceCtx agent, VMFrameCtx frame) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
evaluate
in interface IVMExpression
agent
- the VMActiveInstanceCtx for the agent performing the expression evaluationframe
- the VMFrameCtx for the frame that is being executed -- contains variable contexts for variables used in the evaluation
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if an error occurs during the expression evaluation
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |