arom.kernel
Class AromEntity

java.lang.Object
  |
  +--arom.kernel.AromObject
        |
        +--arom.kernel.AromEntity
Direct Known Subclasses:
AromDomain, AromRecord, AromStructure, AromType, AromViewpoint

public abstract class AromEntity
extends arom.kernel.AromObject

The abstract class AromEntity is the root class of all the Java objects that represents AROM objects contained in an AROM knowledge base.

Version:
0.1, January 1998

Field Summary
protected  boolean alive
          The state of the entity : true if this entity is alive, false otherwise.
protected  Vector entityListeners
          The listeners of the entity.
protected  AromKb kb
          The kwnoledge-base the entity belongs to.
protected  String name
          The name of the entity.
protected static AromPredicate namePredicate
          The predicate used to check that the name of the entity is a correct AROM name.
 
Fields inherited from class arom.kernel.AromObject
bundle, doc, predicates
 
Constructor Summary
AromEntity()
           
 
Method Summary
 void addAromEntityListener(AromEntityListener listener)
          Adds an AromEntityListener to this AROM entity.
 void delete()
          Removes this entity from the knowledge base.
protected  void fireAromEntityEvent(AromEntityEvent event)
          Send notification to all the entity listeners.
 AromKb getKb()
          Returns the knowledge base the entity belongs to.
 String getName()
          Returns the name of the entity.
protected  void isAlive()
          Tests if this entity is a 'living' entity of the knowledge base.
 void removeAromEntityListener(AromEntityListener listener)
          Remove the AromEntityListener to the listener list of this entity.
 void setDocumentation(String doc)
          Sets the documentation of this entity.
 void setName(String name)
          Sets the name of the entity.
 String toString()
          Returns a string representation of this entity.
abstract  void write(Writer w)
          write écrit l'entité à l'aide du PrintWriter passé en paramètre.
 
Methods inherited from class arom.kernel.AromObject
check, check, getDocumentation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kb

protected AromKb kb
The kwnoledge-base the entity belongs to.

entityListeners

protected Vector entityListeners
The listeners of the entity. Listeners are notified of any modification of this entity (entity name or documentation change).

alive

protected boolean alive
The state of the entity : true if this entity is alive, false otherwise. An entity is dead since it have this entity have been suppressed from the knowledge base.

name

protected String name
The name of the entity.

namePredicate

protected static AromPredicate namePredicate
The predicate used to check that the name of the entity is a correct AROM name.
Constructor Detail

AromEntity

public AromEntity()
Method Detail

isAlive

protected void isAlive()
                throws AromNullPointerException
Tests if this entity is a 'living' entity of the knowledge base. A 'living' entity is an entity that have not been previouly deleted from the knowledge base.

An AromNullPointerException is throws if the entity is not alive.

This test must be performed at the very beginning of each method that modify the entity.

Throws:
if - the entity is not a 'living' entity

setDocumentation

public void setDocumentation(String doc)
Sets the documentation of this entity. The entity must be alive to allow modification of it's documentation.
Parameters:
doc - the new documentation.
Overrides:
setDocumentation in class arom.kernel.AromObject

getKb

public AromKb getKb()
Returns the knowledge base the entity belongs to.
Returns:
- the knowledge base the entity belongs to.

getName

public String getName()
Returns the name of the entity.
Returns:
- the name of the entity.

setName

public void setName(String name)
             throws AromIllegalIdentifierException,
                    AromAlreadyUsedIdentifierException
Sets the name of the entity.
Parameters:
structName - the new name of the entity.
Throws:
AromIllegalIdentifierException - if the new name is not a correct AROM name.

delete

public void delete()
Removes this entity from the knowledge base. Once deleted, an entity can't be used anymore. In consequence, any subsequent modification of this entity will throw an AromNullPointerException.

toString

public String toString()
Returns a string representation of this entity. This string is the name of the knowledge base the entity belongs to. It is recommended that all subclasses of AromEntity override this method.
Returns:
a string representation of this entity.
Overrides:
toString in class Object

write

public abstract void write(Writer w)
                    throws IOException
write écrit l'entité à l'aide du PrintWriter passé en paramètre. Ce PrintWriter est connecté à un canal de sortir (OutputStream) ou à un Writer. Cette méthode est utilisée pour enregistrer une base de connaissances, ou encore pour éditer une entité.
Parameters:
w - the stream the entity must be writed in.

addAromEntityListener

public void addAromEntityListener(AromEntityListener listener)
Adds an AromEntityListener to this AROM entity. Does nothing if the listener is already an AromEntityListener of this entity.
Parameters:
listener - the AromEntityListener to add to the entity listeners.

removeAromEntityListener

public void removeAromEntityListener(AromEntityListener listener)
Remove the AromEntityListener to the listener list of this entity. Does nothing if the AromEntityListener is not a listener of this entity.
Parameters:
listener - the AromEntityListener to remove to the entity listeners.

fireAromEntityEvent

protected void fireAromEntityEvent(AromEntityEvent event)
Send notification to all the entity listeners.
Parameters:
event - the AromEntityEvent describing changes of the entity.