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