All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class aid.cbr.tools.core.memory.casebase.CompoundCaseBase

java.lang.Object
   |
   +----aid.cbr.tools.core.memory.casebase.AbstractCaseBase
           |
           +----aid.cbr.tools.core.memory.casebase.CompoundCaseBase

public abstract class CompoundCaseBase
extends AbstractCaseBase
implements CaseBaseListener, CaseBase
Implements basic operation for local and coumpound case bases. This classe facilitate the implementation of local and counpound case bases. It must be used by specialization.

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

Variable Index

 o _metadata
 o _subCaseBases

Constructor Index

 o CompoundCaseBase(String, List)
Creates a new local compound case base.

Method Index

 o addCase(CbrCase)
Adds or moves a case to a case base.
 o addSubCaseBase(CaseBase)
 o addSubCaseBase(int, CaseBase)
 o caseAdded(CaseBaseEvent)
 o caseBaseCleared(CaseBaseEvent)
 o caseCommitted(CaseBaseEvent)
 o caseRemoved(CaseBaseEvent)
 o cases()
Returns an unmodifable map object containing all the cases.
 o clear()
Clears the case base by clearing all the sub-case bases that are opened in read/write
 o close()
Closes the case base and all its sub-case bases.
 o commitCase(CbrCase)
 o deleteCase(Object)
Deletes a case from a case base by propagating this operation on each sub-case base opened in read/write.
 o getCase(Object)
Returns the case object given its id.
 o getMetadata()
 o isCaseCompatible(CbrCase)
Indiquates if a case can be added in this case base.
 o open()
Opens the case base and all its sub-case bases in the default mode.
 o open(boolean)
Opens the case base and all its sub-case bases in the given mode (readonly or read/write).
 o removeAllSubCaseBases()
 o removeSubCaseBase(CaseBase)
 o removeSubCaseBase(int)
 o setMetadata(CaseBaseMetadata)
 o subCaseBaseAdded(CaseBaseEvent)
 o subCaseBaseRemoved(CaseBaseEvent)
 o subCaseBases()

Variables

 o _metadata
 protected CaseBaseMetadata _metadata
 o _subCaseBases
 protected List _subCaseBases

Constructors

 o CompoundCaseBase
 public CompoundCaseBase(String name,
                         List subCaseBases)
Creates a new local compound case base.

Parameters:
name - the local name of this case base
subCaseBases - the initial list of sub case bases

Methods

 o addSubCaseBase
 public void addSubCaseBase(CaseBase cb) throws CaseBaseAccessException
Overrides:
addSubCaseBase in class AbstractCaseBase
 o addSubCaseBase
 public void addSubCaseBase(int position,
                            CaseBase cb) throws CaseBaseAccessException
Overrides:
addSubCaseBase in class AbstractCaseBase
 o removeSubCaseBase
 public void removeSubCaseBase(CaseBase cb) throws CaseBaseAccessException
Overrides:
removeSubCaseBase in class AbstractCaseBase
 o removeSubCaseBase
 public void removeSubCaseBase(int position) throws CaseBaseAccessException
Overrides:
removeSubCaseBase in class AbstractCaseBase
 o removeAllSubCaseBases
 public void removeAllSubCaseBases() throws CaseBaseAccessException
Overrides:
removeAllSubCaseBases in class AbstractCaseBase
 o subCaseBases
 public List subCaseBases() throws CaseBaseAccessException
Overrides:
subCaseBases in class AbstractCaseBase
 o open
 public void open(boolean readOnly) throws CaseBaseAccessException
Opens the case base and all its sub-case bases in the given mode (readonly or read/write). if the requested mode is read/write, it tries to open each case base in read/write. If that fails, it then opens in read only. At least one sub case base must be onpened in read/write mode to open this case base in read/write mode.

Parameters:
readOnly - the opening mode
Throws: CaseBaseAccessException
the case base cannot be opened in the requested mode.
Overrides:
open in class AbstractCaseBase
 o open
 public void open() throws CaseBaseAccessException
Opens the case base and all its sub-case bases in the default mode.

Throws: CaseBaseAccessException
the case base cannot be opened.
Overrides:
open in class AbstractCaseBase
 o close
 public void close() throws CaseBaseAccessException
Closes the case base and all its sub-case bases.

Throws: CaseBaseAccessException
the case base cannot be closed.
Overrides:
close in class AbstractCaseBase
 o caseAdded
 public void caseAdded(CaseBaseEvent evt)
 o caseRemoved
 public void caseRemoved(CaseBaseEvent evt)
 o caseCommitted
 public void caseCommitted(CaseBaseEvent evt)
 o caseBaseCleared
 public void caseBaseCleared(CaseBaseEvent evt)
 o subCaseBaseAdded
 public void subCaseBaseAdded(CaseBaseEvent evt)
 o subCaseBaseRemoved
 public void subCaseBaseRemoved(CaseBaseEvent evt)
 o addCase
 public Object addCase(CbrCase newCase) throws CaseBaseAccessException
Adds or moves a case to a case base. Tries to add the case in the first sub case base that is open in read/write indiquating that the case is compatible. It is a classification process using the isCaseCompatible() method

Parameters:
newCase - the case to be added
Returns:
the assigned id by the case base
Throws: CaseBaseAccessException
the case cannot be added.
Overrides:
addCase in class AbstractCaseBase
 o getCase
 public CbrCase getCase(Object caseId) throws CaseBaseAccessException
Returns the case object given its id. This query is propagated to the sub case bases.

Parameters:
caseId - the id of a case
Returns:
the case object or null if not found
Throws: CaseBaseAccessException
the case cannot be accessed.
Overrides:
getCase in class AbstractCaseBase
 o commitCase
 public void commitCase(CbrCase aCase) throws CaseBaseAccessException
Overrides:
commitCase in class AbstractCaseBase
 o cases
 public Map cases() throws CaseBaseAccessException
Returns an unmodifable map object containing all the cases. Make the unions of cases from the sub case bases

Returns:
the cases {(key/object)}
Throws: CaseBaseAccessException
the map cannot be returned
Overrides:
cases in class AbstractCaseBase
 o isCaseCompatible
 public boolean isCaseCompatible(CbrCase newCase) throws CaseBaseAccessException
Indiquates if a case can be added in this case base. returns true if one the sub case bases returns true to this query.

Returns:
true if the case can be added i.e. is compatible
false otherwise
Throws: CaseBaseAccessException
this information cannot be accessed
Overrides:
isCaseCompatible in class AbstractCaseBase
 o deleteCase
 public void deleteCase(Object id) throws CaseBaseAccessException
Deletes a case from a case base by propagating this operation on each sub-case base opened in read/write.

Parameters:
id - the id an existing case in that case base
Throws: CaseBaseAccessException
the case cannot be deleted
Overrides:
deleteCase in class AbstractCaseBase
 o clear
 public void clear() throws CaseBaseAccessException
Clears the case base by clearing all the sub-case bases that are opened in read/write

Throws: CaseBaseAccessException
the case base cannot be cleared
Overrides:
clear in class AbstractCaseBase
 o getMetadata
 public CaseBaseMetadata getMetadata() throws CaseBaseAccessException
Overrides:
getMetadata in class AbstractCaseBase
 o setMetadata
 public void setMetadata(CaseBaseMetadata md) throws CaseBaseAccessException
Overrides:
setMetadata in class AbstractCaseBase

All Packages  Class Hierarchy  This Package  Previous  Next  Index