jcreek.representation
Class LocalPartitionData

java.lang.Object
  extended byjcreek.representation.LocalPartitionData
All Implemented Interfaces:
PartitionData, java.io.Serializable

public class LocalPartitionData
extends java.lang.Object
implements PartitionData, java.io.Serializable

Implements the PartitionData interface by storing the partition information locally, in memory. Companion class to LocalKnowledgeModel.

Version:
1.0
Author:
Frode Sørmo
See Also:
Serialized Form

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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setName

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

Specified by:
setName in interface PartitionData
Parameters:
name - The new name

getName

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

Specified by:
getName in interface PartitionData

getID

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

Specified by:
getID in interface PartitionData

getCreationTime

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

Specified by:
getCreationTime in interface PartitionData

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.

Specified by:
setCreationTime in interface PartitionData
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.

Specified by:
addRelation in interface PartitionData
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.

Specified by:
removeRelation in interface PartitionData
Parameters:
relation - The relation to remove.

getRelations

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

Specified by:
getRelations in interface PartitionData

getRelationIterator

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

Specified by:
getRelationIterator in interface PartitionData

hasRelation

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

Specified by:
hasRelation in interface PartitionData
Parameters:
relation -

addEntity

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

Specified by:
addEntity in interface PartitionData
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.

Specified by:
removeEntity in interface PartitionData
Parameters:
entity - The entity to remove.

getEntities

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

Specified by:
getEntities in interface PartitionData

getEntityIterator

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

Specified by:
getEntityIterator in interface PartitionData

hasEntity

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

Specified by:
hasEntity in interface PartitionData
Parameters:
entity -

remove

public void remove()
Permanently deletes the parition.

Specified by:
remove in interface PartitionData


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