|
||||||||||
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.Operand gov.nasa.arc.brahms.vm.data.VMOperand
public class VMOperand
A VMOperand is an Operand with extensions for use in the virtual machine. An operand represents a terminal element in an expression and specifies either an object, object and attribute, value, or represents a nested expression. An object can be one of a Concept, Current, Variable referencing a Concept, or a Parameter referencing a Concept or Variable. A value can be an Integer, Double, Boolean, String, Symbol, a Variable referencing a value or a Parameter referencing a value.
Operand
,
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 | |
---|---|
VMOperand()
Constructor, creates a new empty operand. |
|
VMOperand(java.lang.Boolean b)
Constructor, creates a new operand referencing the specified value |
|
VMOperand(java.lang.Byte bt)
Constructor, creates a new operand referencing the specified value |
|
VMOperand(java.lang.Character c)
Constructor, creates a new operand referencing the specified value |
|
VMOperand(Concept concept)
Constructor, creates a new operand for the specified concept. |
|
VMOperand(Concept concept,
Attribute attribute)
Constructor, creates a new operand for the specified concept and attribute |
|
VMOperand(Current current)
Constructor, creates a new operand for the current indicator. |
|
VMOperand(Current current,
Attribute attribute)
Constructor, creates a new operand for the current indicator and attribute. |
|
VMOperand(java.lang.Double d)
Constructor, creates a new operand referencing the specified value |
|
VMOperand(java.lang.Float f)
Constructor, creates a new operand referencing the specified value |
|
VMOperand(java.lang.Integer i)
Constructor, creates a new operand referencing the specified value |
|
VMOperand(java.lang.Long l)
Constructor, creates a new operand referencing the specified value |
|
VMOperand(java.lang.Object value)
Constructor, creates a new operand referencing the specified value |
|
VMOperand(java.lang.Object object,
Attribute property)
Constructor, creates a new operand referencing the specified Java object and property. |
|
VMOperand(Parameter parm)
Constructor, creates a new operand for the specified parameter. |
|
VMOperand(Parameter parm,
Attribute attribute)
Constructor, creates a new operand for the specified parameter and attribute. |
|
VMOperand(java.lang.Short st)
Constructor, creates a new operand referencing the specified value |
|
VMOperand(java.lang.String s)
Constructor, creates a new operand referencing the specified value |
|
VMOperand(java.lang.String s,
boolean symbol)
Constructor, creates a new operand referencing the specified value |
|
VMOperand(Variable var)
Constructor, creates a new operand for the specified variable. |
|
VMOperand(Variable var,
Attribute attribute)
Constructor, creates a new operand for the specified variable and attribute. |
|
VMOperand(VMExpression expr)
Constructor, creates a new operand representing a nested expression |
Method Summary | |
---|---|
void |
assign(java.util.List<java.lang.Object> values,
VMActiveInstanceCtx agent,
VMFrameCtx frame,
Type collectType)
Assigns a list of values to the element resulting from evaluating the left-hand side expression. |
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 operand to the reasoning state network to build up a reasoning state network that maintains a state of what statements matched with the operand. |
java.lang.Object |
coerceValue(java.lang.Object value,
Type brahmsType)
Attempts to coerce a value to a form that can be assigned to a variable of a given Brahms type. |
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 operand as part of a precondition determining whether or not the operand has a successfull match with a statement. |
java.lang.String |
getConditionElementID(gov.nasa.arc.brahms.vm.engine.rsn.IRSNFrameNode frame)
Returns the condition element id for this operand for the specified frame node. |
java.util.LinkedList |
resolveAsLhs(VMActiveInstanceCtx agent,
VMFrameCtx frame,
int strategy)
Resolves this operand considering it to be part of an expression located on the left hand side in a comparison. |
java.util.LinkedList |
resolveAsRhs(VMActiveInstanceCtx agent,
VMFrameCtx frame,
int strategy)
Resolves this operand considering it to be part of an expression located on the right hand side in a comparison. |
java.util.LinkedList |
resolveCollectionIndex(VMActiveInstanceCtx agent,
VMFrameCtx frame)
Resolves the collection index of this operand, this method resolves the index value specified in this operand. |
java.util.LinkedList |
resolveObject(VMActiveInstanceCtx agent,
VMFrameCtx frame)
Resolves the object for this operand to one or more concepts provided this operand represents an object. |
java.util.LinkedList |
resolveValue(VMActiveInstanceCtx agent,
VMFrameCtx frame)
Resolves the value of this operand, this method only resolves the object to the appropriate set of concepts or returns the value represented by this operand. |
Methods inherited from class gov.nasa.arc.brahms.common.data.Operand |
---|
getAttribute, getCollectionIndex, getCollectionIndexType, getExpression, getObject, getObjectType, getOperandType, getParameters, getValue, getValueType, getValueTypeIndicator, getVariables, isAnonymous, isUnknown, setAttribute, setCollectionIndex, setCollectionIndex, setCollectionIndex, setCollectionIndex, setExpression, setID, setObject, setObject, setObject, setObject, setObjectType, setOperandType, setUnknown, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueType, 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.IAssignmentLhs |
---|
export |
Constructor Detail |
---|
public VMOperand()
public VMOperand(Concept concept)
concept
- the Concept this operand referencespublic VMOperand(Current current)
current
- the Current objectpublic VMOperand(Variable var)
var
- the Variable this operand referencespublic VMOperand(Parameter parm)
parm
- the Parameter this operand referencespublic VMOperand(Concept concept, Attribute attribute)
concept
- the Concept this operand referencesattribute
- the Attribute of the Concept referenced by the operandpublic VMOperand(Current current, Attribute attribute)
current
- the Current objectattribute
- the Attribute of the Current concept referenced by the operandpublic VMOperand(Variable var, Attribute attribute)
var
- the Variable this operand referencesattribute
- the Attribute of the concept referenced by the variable as referenced
by the operandpublic VMOperand(Parameter parm, Attribute attribute)
parm
- the Parameter this operand referencesattribute
- the Attribute of the concept referenced by the parameter as referenced
by the operandpublic VMOperand(java.lang.Integer i)
i
- the Integer value referenced by the operandpublic VMOperand(java.lang.Character c)
c
- the Character value referenced by the operandpublic VMOperand(java.lang.Byte bt)
bt
- the Byte value referenced by the operandpublic VMOperand(java.lang.Short st)
st
- the Short value referenced by the operandpublic VMOperand(java.lang.Long l)
l
- the Long value referenced by the operandpublic VMOperand(java.lang.Float f)
f
- the Float value referenced by the operandpublic VMOperand(java.lang.Double d)
d
- the Double value referenced by the operandpublic VMOperand(java.lang.Boolean b)
b
- the Boolean value referenced by the operandpublic VMOperand(java.lang.String s)
s
- the String value referenced by the operandpublic VMOperand(java.lang.String s, boolean symbol)
s
- the String or Symbol value referenced by the operandsymbol
- true if s is a symbol, false if s is a stringpublic VMOperand(java.lang.Object value)
value
- the Java object referenced by the operandpublic VMOperand(java.lang.Object object, Attribute property)
object
- the Java object referenced by the operandproperty
- an Attribute representing a property of the Java objectpublic VMOperand(VMExpression expr)
expr
- the nested ExpressionMethod 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 operandframe
- the frame in which this operand is used, used to resolve variables. The frame
is also used to resolve current. Current is replaced with the agent performing
the frame. The agent passed can be another agent then the current agent (in case
of transfers from another agent).strategy
- 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 operand when
considering this as part of a left hand side expression in a comparison.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 resolveObject(VMActiveInstanceCtx agent, VMFrameCtx frame) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
agent
- the agent from which the belief set is to be used to resolve this operandframe
- the frame in which this operand is used, used to resolve variables. The frame
is also used to resolve current. Current is replaced with the agent performing
the frame. The agent passed can be another agent then the current agent (in case
of transfers from another agent).
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if the operand does not reference an object
VMError
- if an invalid element is encountered in the operand when
considering this as part of a left hand side expression in a comparison.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 operandframe
- the frame in which this operand is used, used to resolve variables. The frame
is also used to resolve current. Current is replaced with the agent performing
the frame. The agent passed can be another agent then the current agent (in case
of transfers from another agent).strategy
- 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 operand when
considering this as part of a left hand side expression in a comparison.resolveAsLhs(gov.nasa.arc.brahms.vm.rt.VMActiveInstanceCtx, gov.nasa.arc.brahms.vm.rt.VMFrameCtx, int)
,
IVMComparison.FACTS
,
IVMComparison.BELIEFS
public java.util.LinkedList resolveValue(VMActiveInstanceCtx agent, VMFrameCtx frame) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
agent
- the agent from which the belief set is to be used to resolve this operandframe
- the frame in which this operand is used, used to resolve variables. The frame
is also used to resolve current. Current is replaced with the agent performing
the frame. The agent passed can be another agent then the current agent (in case
of transfers from another agent).
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 operand when
considering this as part of a left hand side expression in a comparison.public java.util.LinkedList resolveCollectionIndex(VMActiveInstanceCtx agent, VMFrameCtx frame) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
agent
- the agent from which the belief set is to be used to resolve this operandframe
- the frame in which this operand is used, used to resolve variables.
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if the method was unable to get access to dynamic or static model elementspublic 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
condition element 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 operand'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 operand
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if an internal error occurspublic void assign(java.util.List<java.lang.Object> values, VMActiveInstanceCtx agent, VMFrameCtx frame, Type collectType) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
assign
in interface IVMAssignmentLhs
values
- the list of values to be assignedagent
- the VMActiveInstanceCtx for the agent performing the assignment operationframe
- the VMFrameCtx for the frame that is being executedcollectType
- the collection element type if the values should be assigned as a collection to the left-hand side, else null
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if an error occurs during the assignmentpublic java.lang.Object coerceValue(java.lang.Object value, Type brahmsType) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
value
- the value to be coercedbrahmsType
- the Brahms type to which the value should be coerced
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if an error occurs during the attempted coercionpublic final java.lang.String getConditionElementID(gov.nasa.arc.brahms.vm.engine.rsn.IRSNFrameNode frame)
frame
- the IRSNFrameNode for which the condition element is requested
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |