jcreek.representation
Class LocalEntityData

java.lang.Object
  extended byjcreek.representation.LocalEntityData
All Implemented Interfaces:
EntityData, java.io.Serializable

public class LocalEntityData
extends java.lang.Object
implements EntityData, java.io.Serializable

Implementation of EntityData that will store data locally in memory or by serialization.

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

Method Summary
 void addConstraint(Constraint constraint)
          Adds a constraint to the entity
 void addRelation(Relation relation)
          Adds a relation to the list of relations from this entity.
 void addRelationInstance(Relation relation)
          Registers a relation as beeing an instance of this entity (which then represents a relation type).
 long getCreationTime()
          Returns the time of creation for this entity in the same format as System.getCurrentMillis();
 java.lang.String getDescription()
          Returns the description of this entity.
 java.io.Serializable getEntityObject()
          Returns the current (if any) data object encapsulated by this entity.
 java.lang.Object getID()
          Returns a unique ID for the entity this EntityData represents.
 Constraint[] getLocalConstraints()
          Returns all the relations from this entity.
 Relation[] getLocalRelations()
          Returns all the relations from this entity.
 Relation[] getLocalRelations(Entity[] relationTypes)
          Returns the local relations from the entity represented by this object, where the type of each relation must be in the array of relation types supplied to this method.
 java.lang.String getName()
          Gives the name of this entity.
 Relation[] getRelationInstances()
          Returns the Relation objects that are of the relation type represented by this entity.
 void remove()
          Permanently deletes the entity.
 void removeConstraint(Constraint c)
          Removes a constraint from the entity
 void removeRelation(Relation relation)
          Removes a relation to the list of relation from this entity.
 void removeRelationInstance(Relation relation)
          Removes a relation as beeing an instance of this entity (which then represents a relation type).
 void setCreationTime(long time)
          Sets the creation time.
 void setDescription(java.lang.String description)
          Sets the description of this entity.
 void setEntityObject(java.io.Serializable object)
          Sets data object encapsulated by this entity.
 void setName(java.lang.String name)
          Sets the name of this entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getID

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

Specified by:
getID in interface EntityData

setName

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

Specified by:
setName in interface EntityData
Parameters:
name - The new name of the entity.

getName

public java.lang.String getName()
Gives the name of this entity.

Specified by:
getName in interface EntityData

setDescription

public void setDescription(java.lang.String description)
Sets the description of this entity.

Specified by:
setDescription in interface EntityData
Parameters:
description - The description String.

getDescription

public java.lang.String getDescription()
Returns the description of this entity.

Specified by:
getDescription in interface EntityData

getRelationInstances

public Relation[] getRelationInstances()
Returns the Relation objects that are of the relation type represented by this entity. Only entities that represent relation types are expected to have such instances.

Specified by:
getRelationInstances in interface EntityData

addRelationInstance

public void addRelationInstance(Relation relation)
Registers a relation as beeing an instance of this entity (which then represents a relation type).

Specified by:
addRelationInstance in interface EntityData

removeRelationInstance

public void removeRelationInstance(Relation relation)
Removes a relation as beeing an instance of this entity (which then represents a relation type).

Specified by:
removeRelationInstance in interface EntityData
Parameters:
relation - The relation to remove.

addRelation

public void addRelation(Relation relation)
Adds a relation to the list of relations from this entity.

Specified by:
addRelation in interface EntityData
Parameters:
relation - The relation to add.

removeRelation

public void removeRelation(Relation relation)
Removes a relation to the list of relation from this entity.

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

getCreationTime

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

Specified by:
getCreationTime in interface EntityData

setCreationTime

public void setCreationTime(long time)
Sets the creation time.

Specified by:
setCreationTime in interface EntityData
Parameters:
time - The time in the format of System.getCurrentMillis() this entity was created.

getLocalRelations

public Relation[] getLocalRelations(Entity[] relationTypes)
Returns the local relations from the entity represented by this object, where the type of each relation must be in the array of relation types supplied to this method.

Specified by:
getLocalRelations in interface EntityData
Parameters:
relationTypes - An array of the relation types of relations to return.

getLocalRelations

public Relation[] getLocalRelations()
Returns all the relations from this entity.

Specified by:
getLocalRelations in interface EntityData

getEntityObject

public java.io.Serializable getEntityObject()
Returns the current (if any) data object encapsulated by this entity.

Specified by:
getEntityObject in interface EntityData

setEntityObject

public void setEntityObject(java.io.Serializable object)
Sets data object encapsulated by this entity.

Specified by:
setEntityObject in interface EntityData
Parameters:
object - Any Java object that implements the Serializable interface.

remove

public void remove()
Permanently deletes the entity.

Specified by:
remove in interface EntityData

addConstraint

public void addConstraint(Constraint constraint)
Adds a constraint to the entity

Specified by:
addConstraint in interface EntityData
Parameters:
constraint - the constraint to be added

getLocalConstraints

public Constraint[] getLocalConstraints()
Returns all the relations from this entity.

Specified by:
getLocalConstraints in interface EntityData

removeConstraint

public void removeConstraint(Constraint c)
Removes a constraint from the entity

Specified by:
removeConstraint in interface EntityData


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