|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gov.nasa.arc.brahms.vm.rt.StatementSet
public class StatementSet
A Statement set manages a set of statements allowing for assertion and retraction of statements. On assertion of a statement the statement checks makes sure that single valued statements remain single valued by retracting the old value before replacing it with the new value. The statement set also allows for quick access to statements based on a specified concept and attribute and optionally a specific relational operator.
IStatementSet
Field Summary |
---|
Fields inherited from interface gov.nasa.arc.brahms.vm.rt.IStatementSet |
---|
ASSERTED, EXISTED, NOT_FOUND, RETRACTED |
Constructor Summary | |
---|---|
StatementSet(gov.nasa.arc.brahms.vm.worldstate.IWorldState owner)
Constructor, creates a new StatementSet |
|
StatementSet(VMActiveInstanceCtx owner)
Constructor, creates a new StatementSet |
Method Summary | |
---|---|
byte |
assertStatement(VMStatementCtx s,
long time)
Asserts the specified statement in the statement set. |
void |
clear()
Clears the statement set, removing all the statements from the statement set. |
boolean |
containsStatement(Statement statement)
Checks if a statement with the same contents as the specified contents exists in the statement set. |
VMStatementCtx |
getAssertedStatement()
Returns the asserted statement that resulted from the last assert. |
java.util.ListIterator |
getRetractedStatements()
Returns the retracted statement that resulted from the last action (assert or retraction). |
VMStatementCtx |
getStatement(Concept lhsConcept,
Relation relation,
java.lang.Object rhsConcept,
int truthValue)
Find the statement using the specified parameters and return the statement if found, null if the statement was not found. |
VMStatementCtx |
getStatement(java.lang.Object lhsObject,
Attribute lhsAttribute,
int lhsCollectionIndex,
int relation)
Find the statement using the specified parameters and return the statement if found, null if the statement was not found. |
VMStatementCtx |
getStatement(java.lang.Object lhsObject,
Attribute lhsAttribute,
int lhsCollectionIndex,
int relation,
java.lang.Object value)
Find the statement using the specified parameters and return the statement if found, null if the statement was not found. |
VMStatementCtx |
getStatement(java.lang.Object lhsObject,
Attribute lhsAttribute,
int relation,
java.lang.Object value)
Find the statement using the specified parameters and return the statement if found, null if the statement was not found. |
VMStatementCtx |
getStatement(java.lang.Object lhsObject,
Attribute lhsAttribute,
java.lang.String lhsCollectionIndex,
int relation)
Find the statement using the specified parameters and return the statement if found, null if the statement was not found. |
VMStatementCtx |
getStatement(java.lang.Object lhsObject,
Attribute lhsAttribute,
java.lang.String lhsCollectionIndex,
int relation,
java.lang.Object value)
Find the statement using the specified parameters and return the statement if found, null if the statement was not found. |
VMStatementCtx |
getStatementForIndex(java.lang.Object lhsObject,
Attribute lhsAttribute,
int lhsCollectionIndex)
Find the statement using the specified parameters and return the statement if found, null if the statement was not found. |
VMStatementCtx |
getStatementForIndex(java.lang.Object lhsObject,
Attribute lhsAttribute,
java.lang.String lhsCollectionIndex)
Find the statement using the specified parameters and return the statement if found, null if the statement was not found. |
java.util.ListIterator |
getStatements()
Returns a list of all the statements in the statement set. |
java.util.ListIterator |
getStatements(Attribute attribute)
Returns a list of all the statements that have the specified attribute regardless of their left and right hand side values. |
java.util.ListIterator |
getStatements(Concept lhsConcept,
Relation relation)
Returns a list of all the statements that have the specified left hand side concept and relation regardless of their right hand side concept. |
java.util.ListIterator |
getStatements(Concept lhsConcept,
Relation relation,
int truthvalue)
Returns a list of all the statements that have the specified left hand side concept, relation and truth value regardless of their right hand side concept. |
java.util.ListIterator |
getStatements(Concept lhsConcept,
Relation relation,
java.lang.Object rhsConcept,
int truthvalue)
Returns a list of all the statements that have the specified left hand side concept, relation, right hand side concept, and truth value. |
java.util.ListIterator |
getStatements(java.lang.Object object)
Returns a list of all the statements that have the specified concept in either their left or right hand side. |
java.util.ListIterator |
getStatements(java.lang.Object lhsObject,
Attribute lhsAttribute)
Returns a list of all the statements that have the specified concept and attribute on their left hand side regardless of their relational operator or value. |
java.util.ListIterator |
getStatements(java.lang.Object lhsObject,
Attribute lhsAttribute,
int relation)
Returns a list of all the statements that have the specified concept and attribute on their left hand side and that use the specified relational operator. |
java.util.ListIterator |
getStatements(java.lang.Object lhsObject,
Attribute lhsAttribute,
int lhsCollectionIndex,
int relation)
Find and return the statements using the specified parameters. |
java.util.ListIterator |
getStatements(java.lang.Object lhsObject,
Attribute lhsAttribute,
int lhsCollectionIndex,
int relation,
java.lang.Object value)
Find and return the statements using the specified parameters. |
java.util.ListIterator |
getStatements(java.lang.Object lhsObject,
Attribute lhsAttribute,
int relation,
java.lang.Object value)
Find the statement(s) using the specified parameters and return the statement(s) if found. |
java.util.ListIterator |
getStatements(java.lang.Object lhsObject,
Attribute lhsAttribute,
java.lang.String lhsCollectionIndex,
int relation)
Find and return the statements using the specified parameters. |
java.util.ListIterator |
getStatements(java.lang.Object lhsObject,
Attribute lhsAttribute,
java.lang.String lhsCollectionIndex,
int relation,
java.lang.Object value)
Find and return the statements using the specified parameters. |
java.util.ListIterator |
getStatements(Relation relation)
Returns a list of all the statements that have the specified relation regardless of their left and right hand side concept. |
java.util.ListIterator |
getStatements(Relation relation,
java.lang.Object rhsConcept,
int truthvalue)
Returns a list of all the statements that have the specified relation and right hand side concept, and truth value regardless of their left hand side concept. |
java.util.ListIterator |
getStatementsForIndex(java.lang.Object lhsObject,
Attribute lhsAttribute,
int lhsCollectionIndex)
Find and return the statements using the specified parameters. |
java.util.ListIterator |
getStatementsForIndex(java.lang.Object lhsObject,
Attribute lhsAttribute,
java.lang.String lhsCollectionIndex)
Find and return the statements using the specified parameters. |
boolean |
hasAssertedStatement()
Indicates whether the last action performed on the statement set was an assertion. |
boolean |
hasRetractedStatement()
Indicates whether the last action performed on the statement set was a retraction. |
byte |
retractStatement(VMStatementCtx s,
long time)
Retracts the specified statement from the statement set. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StatementSet(gov.nasa.arc.brahms.vm.worldstate.IWorldState owner)
owner
- the IWorldState for which the statement set
is maintainedpublic StatementSet(VMActiveInstanceCtx owner)
owner
- the VMActiveInstanceCtx for which the statement set
is maintainedMethod Detail |
---|
public byte assertStatement(VMStatementCtx s, long time) throws VMException
Note:If a statement already exists it does not necessarily mean it is the exact same object that is passed to the assert method. The assertion analyzes the contents of the statement and on first assertion uses that object. If a second object has the same contents it is not added to the set. So be aware not to count on identical objects.
assertStatement
in interface IStatementSet
s
- the Statement to be asserted to the statement settime
- the time at which the assertion is performed
VMException
- if an internal error occursIStatementSet.ASSERTED
,
IStatementSet.EXISTED
,
IStatementSet.RETRACTED
,
IStatementSet.getRetractedStatements()
,
IStatementSet.hasRetractedStatement()
public byte retractStatement(VMStatementCtx s, long time) throws VMException
Note:The specified statement is merely analyzed for its contents in order to retract a statement. It does not necessarily mean that this actual object is searched for and removed. It could be another statement object representing the same statement.
retractStatement
in interface IStatementSet
s
- the statement to be retractedtime
- the time at which the retraction is performed
VMException
- if an internal error occursIStatementSet.RETRACTED
,
IStatementSet.NOT_FOUND
public boolean hasAssertedStatement()
hasAssertedStatement
in interface IStatementSet
public VMStatementCtx getAssertedStatement()
getAssertedStatement
in interface IStatementSet
public boolean hasRetractedStatement()
hasRetractedStatement
in interface IStatementSet
public java.util.ListIterator getRetractedStatements()
getRetractedStatements
in interface IStatementSet
public java.util.ListIterator getStatements()
getStatements
in interface IStatementSet
public java.util.ListIterator getStatements(Attribute attribute)
getStatements
in interface IStatementSet
attribute
- the Attribute in the requested statement(s)
public java.util.ListIterator getStatements(java.lang.Object object)
getStatements
in interface IStatementSet
concept
- the Concept in the requested statement(s)
public java.util.ListIterator getStatements(java.lang.Object lhsObject, Attribute lhsAttribute, int lhsCollectionIndex, int relation, java.lang.Object value)
getStatements
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statementlhsAttribute
- the left hand side Attribute in the requested statementlhsCollectionIndex
- the integer index/key if the attribute's type is a collectionrelation
- the relational operator in the requested statementvalue
- the right hand side value to match
IConstants.EQ
,
IConstants.NE
,
IConstants.GT
,
IConstants.GE
,
IConstants.LT
,
IConstants.LE
public java.util.ListIterator getStatements(java.lang.Object lhsObject, Attribute lhsAttribute, java.lang.String lhsCollectionIndex, int relation, java.lang.Object value)
getStatements
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statementlhsAttribute
- the left hand side Attribute in the requested statementlhsCollectionIndex
- the String index/key if the attribute's type is a collectionrelation
- the relational operator in the requested statementvalue
- the right hand side value to match
IConstants.EQ
,
IConstants.NE
,
IConstants.GT
,
IConstants.GE
,
IConstants.LT
,
IConstants.LE
public java.util.ListIterator getStatements(java.lang.Object lhsObject, Attribute lhsAttribute, int relation, java.lang.Object value)
getStatements
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statementlhsAttribute
- the left hand side Attribute in the requested statementrelation
- the relational operator in the requested statementvalue
- the right hand side value to match
IConstants.EQ
,
IConstants.NE
,
IConstants.GT
,
IConstants.GE
,
IConstants.LT
,
IConstants.LE
public java.util.ListIterator getStatements(java.lang.Object lhsObject, Attribute lhsAttribute, int lhsCollectionIndex, int relation)
getStatements
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statementlhsAttribute
- the left hand side Attribute in the requested statementlhsCollectionIndex
- the integer index/key if the attribute's type is a collectionrelation
- the relational operator in the requested statement
IConstants.EQ
,
IConstants.NE
,
IConstants.GT
,
IConstants.GE
,
IConstants.LT
,
IConstants.LE
public java.util.ListIterator getStatements(java.lang.Object lhsObject, Attribute lhsAttribute, java.lang.String lhsCollectionIndex, int relation)
getStatements
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statementlhsAttribute
- the left hand side Attribute in the requested statementlhsCollectionIndex
- the String index/key if the attribute's type is a collectionrelation
- the relational operator in the requested statement
IConstants.EQ
,
IConstants.NE
,
IConstants.GT
,
IConstants.GE
,
IConstants.LT
,
IConstants.LE
public java.util.ListIterator getStatementsForIndex(java.lang.Object lhsObject, Attribute lhsAttribute, int lhsCollectionIndex)
getStatementsForIndex
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statementlhsAttribute
- the left hand side Attribute in the requested statementlhsCollectionIndex
- the integer index/key if the attribute's type is a collection
IConstants.EQ
,
IConstants.NE
,
IConstants.GT
,
IConstants.GE
,
IConstants.LT
,
IConstants.LE
public java.util.ListIterator getStatementsForIndex(java.lang.Object lhsObject, Attribute lhsAttribute, java.lang.String lhsCollectionIndex)
getStatementsForIndex
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statementlhsAttribute
- the left hand side Attribute in the requested statementlhsCollectionIndex
- the String index/key if the attribute's type is a collection
IConstants.EQ
,
IConstants.NE
,
IConstants.GT
,
IConstants.GE
,
IConstants.LT
,
IConstants.LE
public VMStatementCtx getStatement(java.lang.Object lhsObject, Attribute lhsAttribute, int lhsCollectionIndex, int relation, java.lang.Object value)
getStatement
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statementlhsAttribute
- the left hand side Attribute in the requested statementlhsCollectionIndex
- the integer index/key if the attribute's type is a collectionrelation
- the relational operator in the requested statementvalue
- the right hand side value to match
IConstants.EQ
,
IConstants.NE
,
IConstants.GT
,
IConstants.GE
,
IConstants.LT
,
IConstants.LE
public VMStatementCtx getStatement(java.lang.Object lhsObject, Attribute lhsAttribute, java.lang.String lhsCollectionIndex, int relation, java.lang.Object value)
getStatement
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statementlhsAttribute
- the left hand side Attribute in the requested statementlhsCollectionIndex
- the String index/key if the attribute's type is a collectionrelation
- the relational operator in the requested statementvalue
- the right hand side value to match
IConstants.EQ
,
IConstants.NE
,
IConstants.GT
,
IConstants.GE
,
IConstants.LT
,
IConstants.LE
public VMStatementCtx getStatement(java.lang.Object lhsObject, Attribute lhsAttribute, int relation, java.lang.Object value)
getStatement
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statementlhsAttribute
- the left hand side Attribute in the requested statementrelation
- the relational operator in the requested statementvalue
- the right hand side value to match
IConstants.EQ
,
IConstants.NE
,
IConstants.GT
,
IConstants.GE
,
IConstants.LT
,
IConstants.LE
public VMStatementCtx getStatement(java.lang.Object lhsObject, Attribute lhsAttribute, int lhsCollectionIndex, int relation)
getStatement
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statementlhsAttribute
- the left hand side Attribute in the requested statementlhsCollectionIndex
- the integer index/key if the attribute's type is a collectionrelation
- the relational operator in the requested statement
IConstants.EQ
,
IConstants.NE
,
IConstants.GT
,
IConstants.GE
,
IConstants.LT
,
IConstants.LE
public VMStatementCtx getStatement(java.lang.Object lhsObject, Attribute lhsAttribute, java.lang.String lhsCollectionIndex, int relation)
getStatement
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statementlhsAttribute
- the left hand side Attribute in the requested statementlhsCollectionIndex
- the String index/key if the attribute's type is a collectionrelation
- the relational operator in the requested statement
IConstants.EQ
,
IConstants.NE
,
IConstants.GT
,
IConstants.GE
,
IConstants.LT
,
IConstants.LE
public VMStatementCtx getStatementForIndex(java.lang.Object lhsObject, Attribute lhsAttribute, int lhsCollectionIndex)
getStatementForIndex
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statementlhsAttribute
- the left hand side Attribute in the requested statementlhsCollectionIndex
- the integer index/key if the attribute's type is a collection
IConstants.EQ
,
IConstants.NE
,
IConstants.GT
,
IConstants.GE
,
IConstants.LT
,
IConstants.LE
public VMStatementCtx getStatementForIndex(java.lang.Object lhsObject, Attribute lhsAttribute, java.lang.String lhsCollectionIndex)
getStatementForIndex
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statementlhsAttribute
- the left hand side Attribute in the requested statementlhsCollectionIndex
- the String index/key if the attribute's type is a collection
IConstants.EQ
,
IConstants.NE
,
IConstants.GT
,
IConstants.GE
,
IConstants.LT
,
IConstants.LE
public VMStatementCtx getStatement(Concept lhsConcept, Relation relation, java.lang.Object rhsConcept, int truthValue)
getStatement
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statementrelation
- the Relation in the requested statementrhsConcept
- the right hand side Concept in the requested statement or the value unknowntruthValue
- the truth value in the requested statement (TRUE, FALSE, UNKNOWN)
IConstants.TRUE
,
IConstants.FALSE
,
IConstants.UNKNOWN
,
IConstants.unknown
public java.util.ListIterator getStatements(java.lang.Object lhsObject, Attribute lhsAttribute)
getStatements
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statement(s)lhsAttribute
- the left hand side Attribute in the requested statement(s)
public java.util.ListIterator getStatements(java.lang.Object lhsObject, Attribute lhsAttribute, int relation)
getStatements
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statement(s)lhsAttribute
- the left hand side Attribute in the requested statement(s)relation
- the relational operator in the requested statement(s)
IConstants.EQ
,
IConstants.NE
,
IConstants.GT
,
IConstants.GE
,
IConstants.LT
,
IConstants.LE
public java.util.ListIterator getStatements(Relation relation)
getStatements
in interface IStatementSet
relation
- the Relation in the requested statement(s)
public java.util.ListIterator getStatements(Concept lhsConcept, Relation relation)
getStatements
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statement(s)relation
- the Relation in the requested statement(s)
public java.util.ListIterator getStatements(Concept lhsConcept, Relation relation, int truthvalue)
getStatements
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statement(s)relation
- the Relation in the requested statement(s)truthvalue
- the truth value in the requested statement(s) (TRUE< FALSE, UNKNOWN)
IConstants.TRUE
,
IConstants.FALSE
,
IConstants.UNKNOWN
public java.util.ListIterator getStatements(Relation relation, java.lang.Object rhsConcept, int truthvalue)
getStatements
in interface IStatementSet
relation
- the Relation in the requested statement(s)rhsConcept
- the right hand side Concept in the requested statement(s) or the value unknowntruthvalue
- the truth value in the requested statement(s) (TRUE, FALSE, UNKNOWN)
IConstants.TRUE
,
IConstants.FALSE
,
IConstants.UNKNOWN
,
IConstants.unknown
public java.util.ListIterator getStatements(Concept lhsConcept, Relation relation, java.lang.Object rhsConcept, int truthvalue)
getStatements
in interface IStatementSet
lhsConcept
- the left hand side Concept in the requested statement(s)relation
- the Relation in the requested statement(s)rhsConcept
- the right hand side Concept in the requested statement(s) or the value unknowntruthvalue
- the truth value in the requested statement(s) (TRUE, FALSE, UNKNOWN)
IConstants.TRUE
,
IConstants.FALSE
,
IConstants.UNKNOWN
public boolean containsStatement(Statement statement)
Note that this method does not check whether the statement set contains the same statement reference as specified for this method, it only compares the contents of the statement to the statements in this statement set.
containsStatement
in interface IStatementSet
statement
- the statement to be checked
public void clear()
clear
in interface IStatementSet
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |