All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface aid.cbr.tools.core.memory.casebase.CaseBase

public interface CaseBase
Defines the operations on the set of cases that are accessed and updated in a CBR application.

In a CBR application, a case base is the set of cases that can be used by the reasoner. In CBR*Tools, a case base is responsible of storing cases and it assigns a unique identifier to access the cases. In addition, case bases can be simple or compound (Composite design pattern) i.e. made of sub-case bases in order to improve their management. This interface is the root of a hierarchy of classes that intends to manage different implementations of case bases: local/remote, simple/coumpound, persistent/transient case bases.

Version:
$Revision$, $Date$
Author:
M. Jaczynski

Method Index

 o addCase(CbrCase)
Adds or moves a case to this case base.
 o addCaseBaseListener(CaseBaseListener)
Adds a case base listener.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a property change listener.
 o addSubCaseBase(CaseBase)
Adds a sub case base.
 o addSubCaseBase(int, CaseBase)
Adds a sub case base at a given position in the list of sub-case bases.
 o addVetoableChangeListener(VetoableChangeListener)
Adds a property change listener with veto.
 o cases()
Returns an unmodifable map object containing all the cases.
 o clear()
Clears the case base.
 o close()
Closes the case base.
 o commitCase(CbrCase)
Commits the changes in a case object.
 o deleteCase(Object)
Deletes a case from this case base.
 o getCase(Object)
Returns the case object given its id.
 o getMetadata()
Returns the metadata of this case base.
 o getName()
Returns the local name of this case base.
 o isCaseCompatible(CbrCase)
Indiquates if a case can be added in this case base.
 o isOpened()
Indicates if the case base is opened.
 o isReadOnly()
Indicates if the case base is opened in read only mode.
 o open()
Opens the case base in the default mode (readonly or read/write depending on the case base).
 o open(boolean)
Opens the case base in the given mode (readonly or read/write).
 o removeAllSubCaseBases()
remove all sub-case bases.
 o removeCaseBaseListener(CaseBaseListener)
Removes a case base listener Nothing is done if the listener does not exist.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a property change listener.
 o removeSubCaseBase(CaseBase)
Removes a case base from the list of sub-case bases.
 o removeSubCaseBase(int)
Removes a case base at a given position the the list of sub-case bases.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes a property change listener with veto.
 o setMetadata(CaseBaseMetadata)
Sets the metadata of this case base.
 o setName(String)
Sets the local name of the case base.
 o subCaseBases()
Returns the list of sub-case bases.

Methods

 o open
 public abstract void open(boolean readOnly) throws CaseBaseAccessException
Opens the case base in the given mode (readonly or read/write).

Preconditions:

 this.isOpen()==false
 

Postrelations:

 this.isOpen()==true
 this.isReadonly()==readOnly
 "opened" PropertyChangeEvent fired
 

Parameters:
readOnly - the opening mode
Throws: CaseBaseAccessException
the case base cannot be opened in the requested mode or the case bas is already opened.
 o open
 public abstract void open() throws CaseBaseAccessException
Opens the case base in the default mode (readonly or read/write depending on the case base).

Preconditions:

 this.isOpen()==false
 

Postrelations:

 this.isOpen()==true
 "opened" PropertyChangeEvent fired
 

Throws: CaseBaseAccessException
the case base cannot be opened.
 o isReadOnly
 public abstract boolean isReadOnly()
Indicates if the case base is opened in read only mode.

Preconditions:

 this.isOpen()==true
 

Returns:
true if the case base is opended in read only mode
false otherwise
 o isOpened
 public abstract boolean isOpened()
Indicates if the case base is opened.

Returns:
true if the case base is opended
false otherwise
Throws: CaseBaseAccessException
the opening mode is note accessible.
 o close
 public abstract void close() throws CaseBaseAccessException
Closes the case base. Nothing is done if the case base is already closed.

Postrelations:

 this.isOpen()==false
 "opened" PropertyChangeEvent fired  on change
 

Throws: CaseBaseAccessException
the case base cannot be closed.
 o addCase
 public abstract Object addCase(CbrCase newCase) throws CaseBaseAccessException
Adds or moves a case to this case base. If the case is already in another case base, the case is moved to this one.

Preconditions:

 this.isOpen()==true
 this.isReadonly()==false
 this.isCaseCompatible(newcase)==true 
 newCase!=null
 this.cases.containsValue(newCase)==false
 

Postrelations:

 newCase.getCaseId()!=null
 newCase.getCaseId()==this.addCase(newCase)
 newCase.getCaseBase()==this
 CaseBaseEvent fired (caseAdded)
 

Parameters:
newCase - the case to be added
Returns:
the assigned id by the case base
Throws: CaseBaseAccessException
the case cannot be added.
 o getCase
 public abstract CbrCase getCase(Object caseId) throws CaseBaseAccessException
Returns the case object given its id.

Preconditions:

 this.isOpen()==true 
 caseId !=null
 

Parameters:
caseId - the id of a case
Returns:
the case object or null if not found
Throws: CaseBaseAccessException
the case cannot be accessed.
 o cases
 public abstract Map cases() throws CaseBaseAccessException
Returns an unmodifable map object containing all the cases.

Preconditions:

 this.isOpen()==true 
 

Returns:
the cases {(key/object)}
Throws: CaseBaseAccessException
the map cannot be returned
 o isCaseCompatible
 public abstract boolean isCaseCompatible(CbrCase newCase) throws CaseBaseAccessException
Indiquates if a case can be added in this case base. This function is used as a Template Method pattern to add a case by classification in the hierarchy of case bases.

Preconditions:

 this.isOpen()==true 
 newCase !=null
 

Parameters:
newCase - the case object
Returns:
true if the case can be added i.e. is compatible
false otherwise
Throws: CaseBaseAccessException
this information cannot be accessed
 o commitCase
 public abstract void commitCase(CbrCase aCase) throws CaseBaseAccessException
Commits the changes in a case object.

Preconditions:

 this.isOpen()==true
 this.isReadonly()==false
 aCase !=null
 this.cases().containsValue(aCase)
 

Postrelations:

 CaseBaseEvent fired (caseCommitted)
 

Parameters:
aCase - the case to be committed in the case base.
Throws: CaseBaseAccessException
the case base cannot be updated.
 o deleteCase
 public abstract void deleteCase(Object id) throws CaseBaseAccessException
Deletes a case from this case base. If a copy of the case have not been done before calling this operation all data associated to the case is lost and the case is no more accesible in the case base. Nothing is done if the cas is not in this case base.

Preconditions:

 this.isOpen()==true 
 this.isReadOnly()==false
 

Postrelations:

 this.cases().containsKey(id)==false
 CaseBaseEvent fired (caseRemoved)
 

Parameters:
id - the id an existing case in that case base
Throws: CaseBaseAccessException
the case cannot be deleted
 o clear
 public abstract void clear() throws CaseBaseAccessException
Clears the case base.

Preconditions:

 this.isOpen()==true 
 this.isReadOnly()==false
 

PostRelations:

 this.cases.isEmpty()==true
 CaseBaseEvent fired (caseBaseCleared)
 

Throws: CaseBaseAccessException
the case base cannot be cleared
 o getName
 public abstract String getName()
Returns the local name of this case base.

Returns:
the name
 o setName
 public abstract void setName(String name)
Sets the local name of the case base.

PostRelations:

 this.getName()=name
 "name" PropertyChangeEvent with veto fired
 

Parameters:
name - the name [not null]
 o getMetadata
 public abstract CaseBaseMetadata getMetadata() throws CaseBaseAccessException
Returns the metadata of this case base.

Preconditions:

 this.isOpen()==true 
 

Returns:
the metadata
Throws: CaseBaseAccessException
the metadata cannot be returned
 o setMetadata
 public abstract void setMetadata(CaseBaseMetadata md) throws CaseBaseAccessException
Sets the metadata of this case base.

Preconditions:

 this.isOpen()==true 
 this.isReadOnly()==false 
 md !=null
 

Postrelations:

 "metadata" PropertyChangeEvent fired
 

Parameters:
md - the metadata
Throws: CaseBaseAccessException
the metadata cannot be affected
 o addSubCaseBase
 public abstract void addSubCaseBase(CaseBase cb) throws CaseBaseAccessException
Adds a sub case base. Nothing is done if the sub-case base is already in the list of sub-case bases.

Preconditions:

 this.isOpen()==true 
 this.isReadOnly()==false 
 cb !=null
 

Postrelations:

 this.subCaseBases().contains(cb)
 CaseBaseEvent fired (subCaseBaseAdded)
 

Parameters:
cb - the case base to be added
Throws: CaseBaseAccessException
the case base cannot be added
 o addSubCaseBase
 public abstract void addSubCaseBase(int position,
                                     CaseBase cb) throws CaseBaseAccessException
Adds a sub case base at a given position in the list of sub-case bases. Nothing is done if the case base is already a sub-case base.

Preconditions:

 this.isOpen()==true 
 this.isReadOnly()==false 
 cb!=null
 0<=position<this.subCaseBases().size()
 

Postrelations:

 this.subCaseBases().contains(cb)
 CaseBaseEvent fired (subCaseBaseAdded)
 

Parameters:
position - the position where the case base must added or inserted
cb - the case base to be added
Throws: CaseBaseAccessException
the case base cannot be added
 o removeSubCaseBase
 public abstract void removeSubCaseBase(CaseBase cb) throws CaseBaseAccessException
Removes a case base from the list of sub-case bases. Nothing is done if the case base is not an existing sub-case base.

Preconditions:

 this.isOpen()==true 
 this.isReadOnly()==false 
 cb!=null
 

Postrelations:

 !this.subCaseBases().contains(cb)
 CaseBaseEvent fired (subCaseBaseRemoved)
 

Parameters:
cb - the case base to be removed.
Throws: CaseBaseAccessException
the case base cannot be removed
 o removeSubCaseBase
 public abstract void removeSubCaseBase(int position) throws CaseBaseAccessException
Removes a case base at a given position the the list of sub-case bases.

Preconditions:

 this.isOpen()==true 
 this.isReadOnly()==false
 0<=position<this.subCaseBases().size()
 

Postrelations:

 !this.subCaseBases().contains(cb)
 CaseBaseEvent fired (subCaseBaseRemoved)
 

Parameters:
position - the position in the list of sub-case bases
Throws: CaseBaseAccessException
the case base cannot be removed
 o removeAllSubCaseBases
 public abstract void removeAllSubCaseBases() throws CaseBaseAccessException
remove all sub-case bases.

Preconditions:

 this.isOpen()==true 
 this.isReadOnly()==false 
 

Postrelations:

  this.subCaseBases().isEmpty()==true
 CaseBaseEvent fired (subCaseBaseRemoved) for each sub case base
 

Throws: CaseBaseAccessException
the case bases cannot be removed
 o subCaseBases
 public abstract List subCaseBases() throws CaseBaseAccessException
Returns the list of sub-case bases.

Preconditions:

 this.isOpen()==true 
 

Returns:
the sub-case bases
Throws: CaseBaseAccessException
the list of sub-case bases cannot be returned
 o addCaseBaseListener
 public abstract void addCaseBaseListener(CaseBaseListener l)
Adds a case base listener.

Parameters:
l - the listener to add [not null]
 o removeCaseBaseListener
 public abstract void removeCaseBaseListener(CaseBaseListener l)
Removes a case base listener Nothing is done if the listener does not exist.

Parameters:
l - the listener to remove [not null]
 o addPropertyChangeListener
 public abstract void addPropertyChangeListener(PropertyChangeListener l)
Adds a property change listener. The listener recieves events for "name", "metadata", "opened" changes.

Parameters:
l - the listener to add [not null]
 o removePropertyChangeListener
 public abstract void removePropertyChangeListener(PropertyChangeListener l)
Removes a property change listener. Nothing is done if the listener does not exist.

Parameters:
l - the listener to remove [not null]
 o addVetoableChangeListener
 public abstract void addVetoableChangeListener(VetoableChangeListener l)
Adds a property change listener with veto. The listener recieves events for "name" changes.

Parameters:
l - the listener to add [not null]
 o removeVetoableChangeListener
 public abstract void removeVetoableChangeListener(VetoableChangeListener l)
Removes a property change listener with veto. Nothing is done if the listener does not exist.

Parameters:
l - the listener to remove [not null]

All Packages  Class Hierarchy  This Package  Previous  Next  Index