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
-
_metadata
-
-
_subCaseBases
-
-
CompoundCaseBase(String, List)
- Creates a new local compound case base.
-
addCase(CbrCase)
- Adds or moves a case to a case base.
-
addSubCaseBase(CaseBase)
-
-
addSubCaseBase(int, CaseBase)
-
-
caseAdded(CaseBaseEvent)
-
-
caseBaseCleared(CaseBaseEvent)
-
-
caseCommitted(CaseBaseEvent)
-
-
caseRemoved(CaseBaseEvent)
-
-
cases()
- Returns an unmodifable map object containing all the cases.
-
clear()
- Clears the case base by clearing all the sub-case bases that are opened in read/write
-
close()
- Closes the case base and all its sub-case bases.
-
commitCase(CbrCase)
-
-
deleteCase(Object)
- Deletes a case from a case base by propagating this operation on each sub-case base opened in read/write.
-
getCase(Object)
- Returns the case object given its id.
-
getMetadata()
-
-
isCaseCompatible(CbrCase)
- Indiquates if a case can be added in this case base.
-
open()
- Opens the case base and all its sub-case bases in the default mode.
-
open(boolean)
- Opens the case base and all its sub-case bases in the given mode (readonly or read/write).
-
removeAllSubCaseBases()
-
-
removeSubCaseBase(CaseBase)
-
-
removeSubCaseBase(int)
-
-
setMetadata(CaseBaseMetadata)
-
-
subCaseBaseAdded(CaseBaseEvent)
-
-
subCaseBaseRemoved(CaseBaseEvent)
-
-
subCaseBases()
-
_metadata
protected CaseBaseMetadata _metadata
_subCaseBases
protected List _subCaseBases
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
addSubCaseBase
public void addSubCaseBase(CaseBase cb) throws CaseBaseAccessException
- Overrides:
- addSubCaseBase in class AbstractCaseBase
addSubCaseBase
public void addSubCaseBase(int position,
CaseBase cb) throws CaseBaseAccessException
- Overrides:
- addSubCaseBase in class AbstractCaseBase
removeSubCaseBase
public void removeSubCaseBase(CaseBase cb) throws CaseBaseAccessException
- Overrides:
- removeSubCaseBase in class AbstractCaseBase
removeSubCaseBase
public void removeSubCaseBase(int position) throws CaseBaseAccessException
- Overrides:
- removeSubCaseBase in class AbstractCaseBase
removeAllSubCaseBases
public void removeAllSubCaseBases() throws CaseBaseAccessException
- Overrides:
- removeAllSubCaseBases in class AbstractCaseBase
subCaseBases
public List subCaseBases() throws CaseBaseAccessException
- Overrides:
- subCaseBases in class AbstractCaseBase
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
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
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
caseAdded
public void caseAdded(CaseBaseEvent evt)
caseRemoved
public void caseRemoved(CaseBaseEvent evt)
caseCommitted
public void caseCommitted(CaseBaseEvent evt)
caseBaseCleared
public void caseBaseCleared(CaseBaseEvent evt)
subCaseBaseAdded
public void subCaseBaseAdded(CaseBaseEvent evt)
subCaseBaseRemoved
public void subCaseBaseRemoved(CaseBaseEvent evt)
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
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
commitCase
public void commitCase(CbrCase aCase) throws CaseBaseAccessException
- Overrides:
- commitCase in class AbstractCaseBase
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
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
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
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
getMetadata
public CaseBaseMetadata getMetadata() throws CaseBaseAccessException
- Overrides:
- getMetadata in class AbstractCaseBase
setMetadata
public void setMetadata(CaseBaseMetadata md) throws CaseBaseAccessException
- Overrides:
- setMetadata in class AbstractCaseBase
All Packages Class Hierarchy This Package Previous Next Index