gov.sandia.cognition.framework
Interface CogxelState

All Superinterfaces:
Cloneable, CloneableSerializable, Iterable<Cogxel>, Serializable
All Known Implementing Classes:
CogxelStateLite

public interface CogxelState
extends Iterable<Cogxel>, CloneableSerializable

Keeps a collection of Cogxels and some accessor methods.

Since:
1.0
Author:
Justin Basilico, Kevin R. Dixon

Method Summary
 void addCogxel(Cogxel cogxel)
          Adds a Cogxel to the state, overriding the existing Cogxel, if it exists.
 CogxelState clone()
          Clones this Cogxel state, returning a deep copy of the Cogxels.
 Cogxel getCogxel(SemanticIdentifier identifier)
          Gets a Cogxel from the state, if it has been previously added.
 double getCogxelActivation(SemanticIdentifier identifier)
          Gets the activation level of a Cogxel in the CogxelState.
 Collection<Cogxel> getCogxels()
          Gets the Cogxels that have been previously added to this CogxelState.
 int getNumCogxels()
          Gets the number of existing Cogxels in this CogxelState.
 Cogxel getOrCreateCogxel(SemanticIdentifier identifier, CogxelFactory factory)
          Attempts to get an existing Cogxel for a given SemanticIdentifier.
 boolean hasCogxel(SemanticIdentifier identifier)
          Returns true if there is an existing Cogxel for the given identifier and false otherwise.
 boolean removeCogxel(Cogxel cogxel)
          Removes a Cogxel from the CogxelState, if it exists.
 boolean removeCogxel(SemanticIdentifier identifier)
          Removes a Cogxel from the state, if it exists.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

addCogxel

void addCogxel(Cogxel cogxel)
Adds a Cogxel to the state, overriding the existing Cogxel, if it exists.

Parameters:
cogxel - The Cogxel to add.
Throws:
IllegalArgumentException - If an invalid Cogxel is given.

hasCogxel

boolean hasCogxel(SemanticIdentifier identifier)
Returns true if there is an existing Cogxel for the given identifier and false otherwise.

Parameters:
identifier - The identifier to look for the Cogxel.
Returns:
True if there is a Cogxel for the given identifier.

getCogxel

Cogxel getCogxel(SemanticIdentifier identifier)
Gets a Cogxel from the state, if it has been previously added.

Parameters:
identifier - The SemanticIdentifier for the Cogxel.
Returns:
If the SemanticIdentifier exists in the CogxelState, then return the corresponding Cogxel. Otherwise, return null.
Throws:
IllegalArgumentException - If an invalid identifier is given.

getOrCreateCogxel

Cogxel getOrCreateCogxel(SemanticIdentifier identifier,
                         CogxelFactory factory)
Attempts to get an existing Cogxel for a given SemanticIdentifier. If no such Cogxel exists, it uses the given CogxelFactory to create the Cogxel and adds it to the CogxelState. In either case, as long as a valid SemanticIdentifier is given, it will return a Cogxel.

Parameters:
identifier - The identifier to get or create a Cogxel for.
factory - The factory to use to create the Cogxel is one does not already exist for the identifier.
Returns:
A Cogxel for the given identifier.
Throws:
IllegalArgumentException - If an invalid identifier is given.
NullPointerException - If an invalid factory is given.

removeCogxel

boolean removeCogxel(SemanticIdentifier identifier)
Removes a Cogxel from the state, if it exists.

Parameters:
identifier - The SemanticIdentifier of the Cogxel to remove.
Returns:
True if the Cogxel was sucessfully removed, false otherwise.
Throws:
IllegalArgumentException - If an invalid identifier is given.

removeCogxel

boolean removeCogxel(Cogxel cogxel)
Removes a Cogxel from the CogxelState, if it exists.

Parameters:
cogxel - The Cogxel to remove.
Returns:
True if the Cogxel was sucessfully removed, false otherwise.
Throws:
IllegalArgumentException - If an invalid Cogxel is given.

getCogxelActivation

double getCogxelActivation(SemanticIdentifier identifier)
Gets the activation level of a Cogxel in the CogxelState. If the associated Cogxel is null then 0.0 is returned, otherwise the getActivation method is called on the underlying Cogxel.

Parameters:
identifier - The SemanticIdentifier for the Cogxel to get the activation level of.
Returns:
The activation level of the underlying Cogxel, or 0.0 if the Cogxel doesn't exist in the CogxelState.
Throws:
IllegalArgumentException - If an invalid identifier is given.

getCogxels

Collection<Cogxel> getCogxels()
Gets the Cogxels that have been previously added to this CogxelState.

Returns:
The previously added Cogxels.

getNumCogxels

int getNumCogxels()
Gets the number of existing Cogxels in this CogxelState.

Returns:
The number of existing Cogxels in this CogxelState.

clone

CogxelState clone()
Clones this Cogxel state, returning a deep copy of the Cogxels.

Specified by:
clone in interface CloneableSerializable
Returns:
A copy of this CogxelState.