|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjcreek.representation.SubModel
jcreek.representation.Partition
A Partition is a submodel of a KnowledgeModel. Unlike the SubModel class, the Partition is a persistent part of the model, and can be looked up, retrieved and accessed through a KnowledgeModel instance. In addition, it to limit the scope of model inference and browsing to a partition so that e.g. an Entity object will only return relations from this entity that are in the "current partition", and inheritance will only work on relations and entities present in this partition. To do this, see the setCurrentPartition() method in the Entity and Relation classes. It is also possible to register ModelChangeListener instances to a partition. This will allow the listener to only get events when a change occurs in the partition, i.e. an entity or relation is the partition is changed or a change is done to the partition itself. Each Partition also have an inference cache associated with it. When possible, it is wise to use this cache instead of the one from the KnowledgeModel class as a Partition's inference cache is only flushed when a change occurs in the Partition while the KnowledgeModel inference cache is flushed whenever any change occurs.
Constructor Summary | |
Partition(KnowledgeModel model,
java.lang.String name)
Creates a new Partition with the given name in the given KnowledgeModel. |
Method Summary | |
void |
add(Entity entity)
Adds an entity to the partition. |
void |
add(Entity[] ents)
Adds a set of entitites to the partition. |
void |
add(Relation r)
Adds a relation to the partition. |
void |
add(Relation[] rels)
Adds an array of relations to the partition. |
boolean |
contains(Entity ent)
Returns true if the submodel contains the entity. |
boolean |
contains(Relation rel)
Returns true if the submodel contains the relation. |
boolean |
equals(java.lang.Object ob)
Two entities are considered equal if they represent the same PartitionData object. |
long |
getCreationTime()
Returns the time of creation of this partition, in the the format as System.currentTimeMillis(); |
Entity[] |
getEntities()
Returns an array of all the entities in the submodel. |
java.lang.Object |
getID()
Returns the unique ID of this partition. |
KnowledgeModel |
getKnowledgeModel()
Returns the knowledgemodel this partition belongs to. |
java.lang.String |
getName()
Returns the name of this Partition. |
protected PartitionData |
getPartitionData()
Returns the PartitionData object in case a subclass needs to manipulate it directly. |
Relation[] |
getRelations()
Returns an array of all the relations in the submodel. |
int |
hashCode()
Overrides the hashCode() method to match the class' new equals() method. |
void |
remove()
Removes the partition from the KnowledgeModel. |
boolean |
remove(Entity ent)
Removes an entity from the submodel. |
boolean |
remove(Relation r)
Removes a relation from the partition. |
void |
setName(java.lang.String name)
Sets the name of the Partition. |
java.lang.String |
toString()
|
Methods inherited from class jcreek.representation.SubModel |
add, addExpanded, addExpanded, clear, contains, joinWith, remove, size, toSet, union |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Partition(KnowledgeModel model, java.lang.String name) throws NameAlreadyExistException
model
- The KnowledgeModel to make a new Partition in.name
- The name of the new Parition.Method Detail |
public void setName(java.lang.String name) throws NameAlreadyExistException
name
- The new name of the Partition.
NameAlreadyExistException
public java.lang.String getName()
public void add(Entity entity)
add
in class SubModel
entity
- The entity to add.public void add(Entity[] ents)
add
in class SubModel
ents
- The arrays of entities to add.public void add(Relation r)
add
in class SubModel
r
- The relation to add.public void add(Relation[] rels)
add
in class SubModel
rels
- The array of relations to add.public boolean remove(Relation r)
remove
in class SubModel
public boolean remove(Entity ent)
remove
in class SubModel
public boolean contains(Entity ent)
contains
in class SubModel
public boolean contains(Relation rel)
contains
in class SubModel
public Entity[] getEntities()
getEntities
in class SubModel
public Relation[] getRelations()
getRelations
in class SubModel
public void remove()
protected PartitionData getPartitionData()
public java.lang.Object getID()
public KnowledgeModel getKnowledgeModel()
public long getCreationTime()
public boolean equals(java.lang.Object ob)
public java.lang.String toString()
toString
in class SubModel
public int hashCode()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |