gov.nasa.arc.brahms.vm.rt
Class StatementSet

java.lang.Object
  extended by gov.nasa.arc.brahms.vm.rt.StatementSet
All Implemented Interfaces:
IStatementSet

public class StatementSet
extends java.lang.Object
implements IStatementSet

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.

Version:
$Revision: 1.8 $ $Date: 2009/11/24 00:01:56 $ $Author: rnado $
Author:
Ron van Hoof
See Also:
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

StatementSet

public StatementSet(gov.nasa.arc.brahms.vm.worldstate.IWorldState owner)
Constructor, creates a new StatementSet

Parameters:
owner - the IWorldState for which the statement set is maintained

StatementSet

public StatementSet(VMActiveInstanceCtx owner)
Constructor, creates a new StatementSet

Parameters:
owner - the VMActiveInstanceCtx for which the statement set is maintained
Method Detail

assertStatement

public byte assertStatement(VMStatementCtx s,
                            long time)
                     throws VMException
Asserts the specified statement in the statement set. If no rhs value exists for the statement it returns ASSERTED to indicate successful assertion. If a value for the statement exists and it is identical the statement is not asserted and the method returns EXISTED. If a value exists but it is different and the attribute or relation is single valued the statement with the old value is retracted followed by the assertion of the new statement. In this case the method returns RETRACTED. Using the method getRetractedStatement the retracted statement can be retrieved.

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.

Specified by:
assertStatement in interface IStatementSet
Parameters:
s - the Statement to be asserted to the statement set
time - the time at which the assertion is performed
Returns:
byte ASSERTED if successful assertion with no retraction of an old value, EXISTED if no assertion took place bc the value already exists for a single valued attribute/relation RETRACTED if successful assertion but with a retraction of a statement bc an existing value was to be overwritten
Throws:
VMException - if an internal error occurs
See Also:
IStatementSet.ASSERTED, IStatementSet.EXISTED, IStatementSet.RETRACTED, IStatementSet.getRetractedStatements(), IStatementSet.hasRetractedStatement()

retractStatement

public byte retractStatement(VMStatementCtx s,
                             long time)
                      throws VMException
Retracts the specified statement from the statement set. If the statement is successfully removed the method returns RETRACTED. If the specified statement could not be found the method returns NOT_FOUND.

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.

Specified by:
retractStatement in interface IStatementSet
Parameters:
s - the statement to be retracted
time - the time at which the retraction is performed
Returns:
byte RETRACTED if the statement is successfully retracted NOT_FOUND if the statement could not be found and was therefor not retracted
Throws:
VMException - if an internal error occurs
See Also:
IStatementSet.RETRACTED, IStatementSet.NOT_FOUND

hasAssertedStatement

public boolean hasAssertedStatement()
Indicates whether the last action performed on the statement set was an assertion. This method can be used instead of the ASSERTED/EXISTED/RETRACTED indicator that is returned on assertion of a statement. Using getAssertedStatement the last asserted statement can be retrieved.

Specified by:
hasAssertedStatement in interface IStatementSet
Returns:
true if the last assert caused an assertion (assertStatement returned ASSERTED or RETRACTED), false otherwise (assertStatement returned EXISTED or retractStatement was executed last).

getAssertedStatement

public VMStatementCtx getAssertedStatement()
Returns the asserted statement that resulted from the last assert. If no assert has taken place it returns null.

Specified by:
getAssertedStatement in interface IStatementSet
Returns:
VMStatementCtx the statement asserted as a result of the last action, null if no assertion took place last.

hasRetractedStatement

public boolean hasRetractedStatement()
Indicates whether the last action performed on the statement set was a retraction. This method can be used instead of the RETRACTED indicator that is returned on assertion of a statement. Using getRetractedStatement the last retracted statement can be retrieved.

Specified by:
hasRetractedStatement in interface IStatementSet
Returns:
true if the last action (assert or retract) caused a retraction, false otherwise

getRetractedStatements

public java.util.ListIterator getRetractedStatements()
Returns the retracted statement that resulted from the last action (assert or retraction). If no retract has taken place it returns null.

Specified by:
getRetractedStatements in interface IStatementSet
Returns:
VMStatementCtx the statement retracted as a result of the last action, null if no retraction took place.

getStatements

public java.util.ListIterator getStatements()
Returns a list of all the statements in the statement set.

Specified by:
getStatements in interface IStatementSet
Returns:
ListIterator a list of VMStatementCtx's

getStatements

public 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.

Specified by:
getStatements in interface IStatementSet
Parameters:
attribute - the Attribute in the requested statement(s)
Returns:
ListIterator a list of VMStatementCtx's

getStatements

public 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.

Specified by:
getStatements in interface IStatementSet
Parameters:
concept - the Concept in the requested statement(s)
Returns:
ListIterator a list of VMStatementCtx's

getStatements

public 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. Multiple statements can be found if the lhsConcept is of a class type. If the lhsConcept is of a class type then all statements of which the lhs concept matches the type of the specified lhsConcept will be returned provided the the other parameters match.

Specified by:
getStatements in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement
lhsAttribute - the left hand side Attribute in the requested statement
lhsCollectionIndex - the integer index/key if the attribute's type is a collection
relation - the relational operator in the requested statement
value - the right hand side value to match
Returns:
ListIterator the list of matching statements
See Also:
IConstants.EQ, IConstants.NE, IConstants.GT, IConstants.GE, IConstants.LT, IConstants.LE

getStatements

public 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. Multiple statements can be found if the lhsConcept is of a class type. If the lhsConcept is of a class type then all statements of which the lhs concept matches the type of the specified lhsConcept will be returned provided the the other parameters match.

Specified by:
getStatements in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement
lhsAttribute - the left hand side Attribute in the requested statement
lhsCollectionIndex - the String index/key if the attribute's type is a collection
relation - the relational operator in the requested statement
value - the right hand side value to match
Returns:
ListIterator the list of matching statements
See Also:
IConstants.EQ, IConstants.NE, IConstants.GT, IConstants.GE, IConstants.LT, IConstants.LE

getStatements

public 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. Multiple statements can be found if the lhsConcept is of a class type or if the attribute is of a collection type and the value matches for multiple indexes/keys. If the lhsConcept is of a class type then all statements of which the lhs concept matches the type of the specified lhsConcept will be returned provided the the other parameters match.

Specified by:
getStatements in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement
lhsAttribute - the left hand side Attribute in the requested statement
relation - the relational operator in the requested statement
value - the right hand side value to match
Returns:
ListIterator a list of VMStatementCtx's
See Also:
IConstants.EQ, IConstants.NE, IConstants.GT, IConstants.GE, IConstants.LT, IConstants.LE

getStatements

public java.util.ListIterator getStatements(java.lang.Object lhsObject,
                                            Attribute lhsAttribute,
                                            int lhsCollectionIndex,
                                            int relation)
Find and return the statements using the specified parameters. Multiple statements can be found if the lhsConcept is of a class type. If the lhsConcept is of a class type then all statements of which the lhs concept matches the type of the specified lhsConcept will be returned provided the the other parameters match.

Specified by:
getStatements in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement
lhsAttribute - the left hand side Attribute in the requested statement
lhsCollectionIndex - the integer index/key if the attribute's type is a collection
relation - the relational operator in the requested statement
Returns:
ListIterator a list of VMStatementCtx's
See Also:
IConstants.EQ, IConstants.NE, IConstants.GT, IConstants.GE, IConstants.LT, IConstants.LE

getStatements

public 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. Multiple statements can be found if the lhsConcept is of a class type. If the lhsConcept is of a class type then all statements of which the lhs concept matches the type of the specified lhsConcept will be returned provided the the other parameters match.

Specified by:
getStatements in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement
lhsAttribute - the left hand side Attribute in the requested statement
lhsCollectionIndex - the String index/key if the attribute's type is a collection
relation - the relational operator in the requested statement
Returns:
ListIterator a list of VMStatementCtx's
See Also:
IConstants.EQ, IConstants.NE, IConstants.GT, IConstants.GE, IConstants.LT, IConstants.LE

getStatementsForIndex

public java.util.ListIterator getStatementsForIndex(java.lang.Object lhsObject,
                                                    Attribute lhsAttribute,
                                                    int lhsCollectionIndex)
Find and return the statements using the specified parameters. Multiple statements can be found if the lhsConcept is of a class type. If the lhsConcept is of a class type then all statements of which the lhs concept matches the type of the specified lhsConcept will be returned provided the the other parameters match.

Specified by:
getStatementsForIndex in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement
lhsAttribute - the left hand side Attribute in the requested statement
lhsCollectionIndex - the integer index/key if the attribute's type is a collection
Returns:
ListIterator a list of VMStatementCtx's
See Also:
IConstants.EQ, IConstants.NE, IConstants.GT, IConstants.GE, IConstants.LT, IConstants.LE

getStatementsForIndex

public java.util.ListIterator getStatementsForIndex(java.lang.Object lhsObject,
                                                    Attribute lhsAttribute,
                                                    java.lang.String lhsCollectionIndex)
Find and return the statements using the specified parameters. Multiple statements can be found if the lhsConcept is of a class type. If the lhsConcept is of a class type then all statements of which the lhs concept matches the type of the specified lhsConcept will be returned provided the the other parameters match.

Specified by:
getStatementsForIndex in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement
lhsAttribute - the left hand side Attribute in the requested statement
lhsCollectionIndex - the String index/key if the attribute's type is a collection
Returns:
ListIterator a list of VMStatementCtx's
See Also:
IConstants.EQ, IConstants.NE, IConstants.GT, IConstants.GE, IConstants.LT, IConstants.LE

getStatement

public 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.

Specified by:
getStatement in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement
lhsAttribute - the left hand side Attribute in the requested statement
lhsCollectionIndex - the integer index/key if the attribute's type is a collection
relation - the relational operator in the requested statement
value - the right hand side value to match
Returns:
VMStatementCtx if the matching statement is found, null otherwise
See Also:
IConstants.EQ, IConstants.NE, IConstants.GT, IConstants.GE, IConstants.LT, IConstants.LE

getStatement

public 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.

Specified by:
getStatement in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement
lhsAttribute - the left hand side Attribute in the requested statement
lhsCollectionIndex - the String index/key if the attribute's type is a collection
relation - the relational operator in the requested statement
value - the right hand side value to match
Returns:
VMStatementCtx if the matching statement is found, null otherwise
See Also:
IConstants.EQ, IConstants.NE, IConstants.GT, IConstants.GE, IConstants.LT, IConstants.LE

getStatement

public 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.

Specified by:
getStatement in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement
lhsAttribute - the left hand side Attribute in the requested statement
relation - the relational operator in the requested statement
value - the right hand side value to match
Returns:
VMStatementCtx if the matching statement is found, null otherwise
See Also:
IConstants.EQ, IConstants.NE, IConstants.GT, IConstants.GE, IConstants.LT, IConstants.LE

getStatement

public 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.

Specified by:
getStatement in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement
lhsAttribute - the left hand side Attribute in the requested statement
lhsCollectionIndex - the integer index/key if the attribute's type is a collection
relation - the relational operator in the requested statement
Returns:
VMStatementCtx if the matching statement is found, null otherwise
See Also:
IConstants.EQ, IConstants.NE, IConstants.GT, IConstants.GE, IConstants.LT, IConstants.LE

getStatement

public 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.

Specified by:
getStatement in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement
lhsAttribute - the left hand side Attribute in the requested statement
lhsCollectionIndex - the String index/key if the attribute's type is a collection
relation - the relational operator in the requested statement
Returns:
VMStatementCtx if the matching statement is found, null otherwise
See Also:
IConstants.EQ, IConstants.NE, IConstants.GT, IConstants.GE, IConstants.LT, IConstants.LE

getStatementForIndex

public 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.

Specified by:
getStatementForIndex in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement
lhsAttribute - the left hand side Attribute in the requested statement
lhsCollectionIndex - the integer index/key if the attribute's type is a collection
Returns:
VMStatementCtx if the matching statement is found, null otherwise
See Also:
IConstants.EQ, IConstants.NE, IConstants.GT, IConstants.GE, IConstants.LT, IConstants.LE

getStatementForIndex

public 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.

Specified by:
getStatementForIndex in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement
lhsAttribute - the left hand side Attribute in the requested statement
lhsCollectionIndex - the String index/key if the attribute's type is a collection
Returns:
VMStatementCtx if the matching statement is found, null otherwise
See Also:
IConstants.EQ, IConstants.NE, IConstants.GT, IConstants.GE, IConstants.LT, IConstants.LE

getStatement

public 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.

Specified by:
getStatement in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement
relation - the Relation in the requested statement
rhsConcept - the right hand side Concept in the requested statement or the value unknown
truthValue - the truth value in the requested statement (TRUE, FALSE, UNKNOWN)
Returns:
VMStatementCtx if the matching statement is found, null otherwise
See Also:
IConstants.TRUE, IConstants.FALSE, IConstants.UNKNOWN, IConstants.unknown

getStatements

public 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. If the lhs concept is a class type concept the method will return all statements for the concepts instances that are instances of the specified lhs concept.

Specified by:
getStatements in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement(s)
lhsAttribute - the left hand side Attribute in the requested statement(s)
Returns:
ListIterator a list of VMStatementCtx's

getStatements

public 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. If the lhs concept is a class type concept the method will return all statements for the concepts instances that are instances of the specified lhs concept.

Specified by:
getStatements in interface IStatementSet
Parameters:
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)
Returns:
ListIterator a list of VMStatementCtx's
See Also:
IConstants.EQ, IConstants.NE, IConstants.GT, IConstants.GE, IConstants.LT, IConstants.LE

getStatements

public 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.

Specified by:
getStatements in interface IStatementSet
Parameters:
relation - the Relation in the requested statement(s)
Returns:
ListIterator a list of VMStatementCtx's

getStatements

public 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. If the lhs concept is a class type concept the method will return all statements for the concepts instances that are instances of the specified lhs concept.

Specified by:
getStatements in interface IStatementSet
Parameters:
lhsConcept - the left hand side Concept in the requested statement(s)
relation - the Relation in the requested statement(s)
Returns:
ListIterator a list of VMStatementCtx's

getStatements

public 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. If the lhs concept is a class type concept the method will return all statements for the concepts instances that are instances of the specified lhs concept.

Specified by:
getStatements in interface IStatementSet
Parameters:
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)
Returns:
ListIterator a list of VMStatementCtx's
See Also:
IConstants.TRUE, IConstants.FALSE, IConstants.UNKNOWN

getStatements

public 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. If the rhs concept is a class type concept the method will return all statements for the concepts instances that are instances of the specified rhs concept.

Specified by:
getStatements in interface IStatementSet
Parameters:
relation - the Relation in the requested statement(s)
rhsConcept - the right hand side Concept in the requested statement(s) or the value unknown
truthvalue - the truth value in the requested statement(s) (TRUE, FALSE, UNKNOWN)
Returns:
ListIterator a list of VMStatementCtx's
See Also:
IConstants.TRUE, IConstants.FALSE, IConstants.UNKNOWN, IConstants.unknown

getStatements

public 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. If either the lhs concept or the rhs concept is a class type concept the method will return all statements involving concepts that are instances of the specified lhs or rhs concept.

Specified by:
getStatements in interface IStatementSet
Parameters:
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 unknown
truthvalue - the truth value in the requested statement(s) (TRUE, FALSE, UNKNOWN)
Returns:
ListIterator a list of VMStatementCtx's
See Also:
IConstants.TRUE, IConstants.FALSE, IConstants.UNKNOWN

containsStatement

public boolean containsStatement(Statement statement)
Checks if a statement with the same contents as the specified contents exists in the statement set. If so true will be returned, if not false will be returned.

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.

Specified by:
containsStatement in interface IStatementSet
Parameters:
statement - the statement to be checked
Returns:
boolean true if the statement set contains a statement with the same contents, false otherwise

clear

public void clear()
Clears the statement set, removing all the statements from the statement set.

Specified by:
clear in interface IStatementSet


Copyright © 1997-2012 All Rights Reserved.