jcreek.representation
Interface PartitionData

All Known Implementing Classes:
LocalPartitionData

public interface PartitionData

The PartitionData interface is an interface for storing data about partitions. An implementation of the KnowledgeModel interface will also typically have a custom implementation of this interface. The contract of this interface specifices that: - Each ParitionData object can be encapsulated by multiple Partition objects. - The contract does NOT state that the data is stored locally in the PartitionData object, and this can not be assumed. This means that the PartitionData object can be an interface to a standard SQL database or a concurrently accessed knowledge model server. - The data represented by an PartitionData object must be possible to access concurrently. If an implementation of PartitionData allows multiple instances of PartitionData to exist at once, the access must allow concurrent, thread-safe even access to the data across the PartitionData instances. - All manipulations of this object is done either from a KnowledgeModel or Partition object (or a subclass of these). PartitionData classes should be viewed as internal classes to the Partition, Entity, Relation and KnowledgeModel classes.

Version:
1.0
Author:
Frode Sørmo

Method Summary
 void addEntity(Entity entity)
          Adds an entity to this partition.
 void addRelation(Relation relation)
          Adds a relation to this partition.
 long getCreationTime()
          Returns the time of creation for this partition in the same format as System.getCurrentTimeMillis();
 Entity[] getEntities()
          Returns all the entitys in this partition.
 java.util.Iterator getEntityIterator()
          Returns an iterator for all the entities in this partition.
 java.lang.Object getID()
          Returns a unique ID for the entity this EntityData represents.
 java.lang.String getName()
          Returns the name of this partition.
 java.util.Iterator getRelationIterator()
          Returns an iterator for all the relations in this partition.
 Relation[] getRelations()
          Returns all the relations in this partition.
 boolean hasEntity(Entity entity)
          Returns true if the given entity is a part of this partition.
 boolean hasRelation(Relation relation)
          Returns true if the given relation is a part of this partition.
 void remove()
          Permanently deletes the parition.
 boolean removeEntity(Entity entity)
          Removes an entity to the list of entity from this partition.
 boolean removeRelation(Relation relation)
          Removes a relation to the list of relation from this entity.
 void setCreationTime(long time)
          Sets the creation time.
 void setName(java.lang.String name)
          Sets the name of this partition.
 

Method Detail

setName

public void setName(java.lang.String name)
Sets the name of this partition.

Parameters:
name - The new name

getName

public java.lang.String getName()
Returns the name of this partition.


getID

public java.lang.Object getID()
Returns a unique ID for the entity this EntityData represents.


getCreationTime

public long getCreationTime()
Returns the time of creation for this partition in the same format as System.getCurrentTimeMillis();


setCreationTime

public void setCreationTime(long time)
Sets the creation time. This is normally not necessary as the creation time is automatically set when the entity is created, but in some odd cases (like the importModel method in KnowledgeModel), it can be required.

Parameters:
time - The time in the format of System.getCurrentTimeMillis() this parition was created.

addRelation

public void addRelation(Relation relation)
Adds a relation to this partition.

Parameters:
relation - The relation to add.

removeRelation

public boolean removeRelation(Relation relation)
Removes a relation to the list of relation from this entity. Returns false if the relation do not exist in the partition.

Parameters:
relation - The relation to remove.

getRelations

public Relation[] getRelations()
Returns all the relations in this partition.


getRelationIterator

public java.util.Iterator getRelationIterator()
Returns an iterator for all the relations in this partition.


hasRelation

public boolean hasRelation(Relation relation)
Returns true if the given relation is a part of this partition.

Parameters:
relation -

addEntity

public void addEntity(Entity entity)
Adds an entity to this partition.

Parameters:
entity - The entity to add.

removeEntity

public boolean removeEntity(Entity entity)
Removes an entity to the list of entity from this partition. Returns false if the entity do not exist in the partition.

Parameters:
entity - The entity to remove.

getEntities

public Entity[] getEntities()
Returns all the entitys in this partition.


getEntityIterator

public java.util.Iterator getEntityIterator()
Returns an iterator for all the entities in this partition.


hasEntity

public boolean hasEntity(Entity entity)
Returns true if the given entity is a part of this partition.

Parameters:
entity -

remove

public void remove()
Permanently deletes the parition.



Created at IDI, NTNU by the Artificial Intelligence and Learning group