|
||||||||||
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.Comparison gov.nasa.arc.brahms.common.data.ValueComparison gov.nasa.arc.brahms.vm.data.VMValueComparison
public class VMValueComparison
A VMValueComparison is a ValueComparison with extensions for use in the virtual machine. A ValueComparison represents a comparison between two values in a relation that can be one of '=', '!=', '>', '>=', '<', '<='. The values being compared are part of expressions.
VMExpression
,
ValueComparison
,
Serialized FormField Summary |
---|
Fields inherited from interface gov.nasa.arc.brahms.vm.data.IVMComparison |
---|
BELIEFS, FACTS, NONE |
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 | |
---|---|
VMValueComparison()
Constructor, creates a new value comparison |
|
VMValueComparison(VMExpression lhs,
int relation,
VMExpression rhs)
Constructor, creates a new value comparison with the specified left hand side expression, relational operator and right hand side expression. |
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 comparison to the reasoning state network to build up a reasoning state network that maintains a state of what statements matched with the comparison. |
boolean |
evaluate(gov.nasa.arc.brahms.vm.engine.rsn.RSNFrameNode frame,
int modifier,
int truthvalue,
gov.nasa.arc.brahms.vm.engine.rsn.RSNFrameNode.FrameEvaluationRecord evalRcd)
Evaluates the comparison as part of a precondition determining whether or not the comparison has a successfull match with a statement. |
java.util.LinkedList |
getConcludingStatements(VMActiveInstanceCtx agent,
VMFrameCtx frame,
boolean updateJava)
Matches the comparison with the belief set of the specified agent and creates the statements that would result from the comparison after the match. |
java.util.LinkedList |
getDetectableFacts(VMActiveInstanceCtx agent,
VMFrameCtx frame)
Matches the comparison with the fact set of the world and returns the statements that match with the left hand side of the comparison after resolving the left hand side. |
java.util.LinkedList |
getTransferableCommunicativeActs(VMActiveInstanceCtx agent,
VMFrameCtx frame)
Resolves the CommunicativeAct specified for the transfer definition to the (list of) CommunicativeAct(s) to be transferred. |
java.util.LinkedList |
getTransferableStatements(VMActiveInstanceCtx agent,
VMFrameCtx frame,
int truthvalue)
Matches the comparison of a transfer definition with the belief set of the specified agent and returns the statements that match with the comparison after resolving the lhs and rhs. |
VMBeliefCtx |
hasTriggeringBelief(VMActiveInstanceCtx agent,
VMFrameCtx frame,
int truthvalue)
Checks whether the specified agent has a belief that can activate the trigger for which this comparison is the condition. |
boolean |
isDetectableFact(VMFactCtx fact,
VMActiveInstanceCtx agent,
VMFrameCtx frame)
Checks whether the specified fact can be detected by matching the fact against the left hand side of the comparison. |
boolean |
isTriggeringBelief(VMBeliefCtx belief,
VMActiveInstanceCtx agent,
VMFrameCtx frame,
int truthvalue)
Checks whether the specified belief can cause the activation of the trigger by matching the belief against the comparison. |
Methods inherited from class gov.nasa.arc.brahms.common.data.ValueComparison |
---|
getRelation, setRelation, toString |
Methods inherited from class gov.nasa.arc.brahms.common.data.Comparison |
---|
getLhs, getParameters, getRhs, getVariables, setLhs, setRhs |
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, wait, wait, wait |
Constructor Detail |
---|
public VMValueComparison()
public VMValueComparison(VMExpression lhs, int relation, VMExpression rhs)
lhs
- the left hand side Expressionrelation
- the relational operatorrhs
- the right hand side ExpressionVMExpression
,
IConstants.EQ
,
IConstants.NE
,
IConstants.GT
,
IConstants.GE
,
IConstants.LT
,
IConstants.LE
Method Detail |
---|
public java.util.LinkedList getConcludingStatements(VMActiveInstanceCtx agent, VMFrameCtx frame, boolean updateJava) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
The comparison serves as an assignment where the rhs is matched and resolved and new statements are created preserving the left hand side and assigning it the value(s) matched on the right hand side. On the left hand side only the object is resolved to concepts if instead of a concept, current, a variable or a parameter is specified.
Note:This method is only usable with consequences, not with detectables, transfer definitions and preconditions. Left hand side of preconditions can contain expressions which are not handled by this method. Transfer definitions and detectables require rhs matching and not assignment.
getConcludingStatements
in interface IVMComparison
agent
- the agent with whom's belief set we need to matchframe
- the frame containing variable contexts for variables used by the comparison.updateJava
- whether to update Java objects as a side effect of determining the concluded statements
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if an error occurs in retrieving information from the static or
dynamic modelpublic java.util.LinkedList getTransferableCommunicativeActs(VMActiveInstanceCtx agent, VMFrameCtx frame) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
getTransferableCommunicativeActs
in interface IVMComparison
agent
- the agent initiating the communicationframe
- the frame containing variable contexts for variables used by the comparison.
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if an error occurs in retrieving information from the static or
dynamic modelpublic java.util.LinkedList getTransferableStatements(VMActiveInstanceCtx agent, VMFrameCtx frame, int truthvalue) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
getTransferableStatements
in interface IVMComparison
agent
- the agent with whom's belief set we need to matchframe
- the frame containing variable contexts for variables used by the comparison.truthvalue
- the truth value of the comparison (TRUE, FALSE, UNKNOWN)
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if an error occurs in retrieving information from the static or
dynamic modelIConstants.TRUE
,
IConstants.FALSE
,
IConstants.UNKNOWN
public java.util.LinkedList getDetectableFacts(VMActiveInstanceCtx agent, VMFrameCtx frame) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Note:This method is only usable with detectables as it limits the matching to facts in the world and only matches against the left hand side.
getDetectableFacts
in interface IVMComparison
agent
- the agent that is checking for detectionframe
- the frame containing variable contexts for variables used by the comparison.
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if an error occurs in retrieving information from the static or
dynamic modelpublic boolean isDetectableFact(VMFactCtx fact, VMActiveInstanceCtx agent, VMFrameCtx frame) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
isDetectableFact
in interface IVMComparison
fact
- the fact that is checked for detectionagent
- the agent that is checking for detectionframe
- the frame containing variable contexts for variables used by the comparison.
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if an error occurs in retrieving information from the static or
dynamic modelpublic VMBeliefCtx hasTriggeringBelief(VMActiveInstanceCtx agent, VMFrameCtx frame, int truthvalue) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
hasTriggeringBelief
in interface IVMComparison
agent
- the agent that is checking the trigger and whom's belief set is
checked for a matching beliefframe
- the frame containing variable contexts for variables used by the comparison.truthvalue
- the specified truth value of the detectable condition (TRUE, FALSE, UNKNOWN)
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if an error occurs in retrieving information from the static or
dynamic modelIConstants.TRUE
,
IConstants.FALSE
,
IConstants.UNKNOWN
public boolean isTriggeringBelief(VMBeliefCtx belief, VMActiveInstanceCtx agent, VMFrameCtx frame, int truthvalue) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
isTriggeringBelief
in interface IVMComparison
belief
- the belief to be checked for activation of the triggeragent
- the agent that is checking the triggerframe
- the frame containing variable contexts for variables used by the comparison.truthvalue
- the specified truth value of the detectable condition (TRUE, FALSE, UNKNOWN)
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if an error occurs in retrieving information from the static or
dynamic modelIConstants.TRUE
,
IConstants.FALSE
,
IConstants.UNKNOWN
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
buildRSN
in interface IVMComparison
rsn
- the ReasoningStateNetwork to be builtframe
- the RSNFrameNode for the frame in which this
comparison 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 comparisonpublic boolean evaluate(gov.nasa.arc.brahms.vm.engine.rsn.RSNFrameNode frame, int modifier, int truthvalue, gov.nasa.arc.brahms.vm.engine.rsn.RSNFrameNode.FrameEvaluationRecord evalRcd) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
evaluate
in interface IVMComparison
frame
- the RSNFrameNode for the frame in which the comparison's precondition
is specifiedmodifier
- the modifier of the (pre)conditiontruthvalue
- the truth value of the (pre)condition (TRUE, FALSE, UNKNOWN)evalRcd
- the record in which to store bindings for variables and statements
matching preconditions
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if an internal error occursIConstants.TRUE
,
IConstants.FALSE
,
IConstants.UNKNOWN
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |