edu.indiana.iucbrf.casebase
Interface CaseBase

All Superinterfaces:
SwingRepresentable, SwingRepresentableWithDomain
All Known Subinterfaces:
KeyableCaseBase
All Known Implementing Classes:
AbstractCaseBase, AbstractKeyableCaseBase, CachedRDBCaseBase, FileCaseBase, FlatCaseBase, PartitionedCaseBase, RDBCaseBase

public interface CaseBase
extends SwingRepresentableWithDomain

A CaseBase contains cases.


Field Summary
 
Fields inherited from interface edu.indiana.util.swing.SwingRepresentable
TITLE_FONT
 
Method Summary
 long addCase(Case acase)
          Add a single case to the case base.
 void addCaseBaseListener(CaseBaseListener cll)
          Add a CaseBaseListener to listen for CaseBaseEvents.
 void addCases(CaseBase cases)
          Add a case base containing cases to this case base, using addCase().
 void addCases(CaseGenerator caseGenerator, int numToAdd)
          Generate numToAdd cases with the given caseGenerator.
 void addCases(java.util.Collection cases)
          Add a Collection of cases to the case base, using addCase().
 void clearAllEstimates()
          Remove all estimated features from the cases in the case base.
 void close()
          Perform any maintenance needed during finalization of this CaseBase, such closing of open files.
 void ensureCapacity(int minimumCapacity)
           
 java.lang.Class getCaseClass()
          Get the class of cases used in this case base.
 int getCaseCount()
          Gets the number of cases in this case base
 FlatCaseBase getCasesMatching(java.lang.Class case_class)
          Get the cases in this case base that are of a given class.
 Domain getDomain()
           
 boolean isEmpty()
          Returns true if this case base is empty, false otherwise.
 java.util.Iterator iterator()
          Create an iterator on the case base.
 boolean removeCase(Case c)
          Remove a single case from the case base.
 void removeCaseBaseListener(CaseBaseListener cll)
          Remove a previously added CaseBaseListener.
 void setBaseFileName(java.lang.String baseFilename)
          Set the base filename that will be used for saving this case base.
 void setCaseClass(java.lang.Class case_class)
          Set the class of cases used in this case base.
 void setDomain(Domain domain)
          Set the transient domain attribute for this case base.
 java.lang.String toString()
          Convert this case base to a string representation.
 java.lang.String toVerboseString()
          Can be overridden to provide more details than toString().
 
Methods inherited from interface edu.indiana.iucbrf.util.SwingRepresentableWithDomain
toSwing
 
Methods inherited from interface edu.indiana.util.swing.SwingRepresentable
toSwing
 

Method Detail

addCase

long addCase(Case acase)
Add a single case to the case base.

Parameters:
acase - The case to add.
Returns:
-1 (a meaningless value), unless the non-abstract class in use extends KeyableCaseBase.

iterator

java.util.Iterator iterator()
                            throws java.lang.UnsupportedOperationException
Create an iterator on the case base.

Throws:
java.lang.UnsupportedOperationException

ensureCapacity

void ensureCapacity(int minimumCapacity)

toString

java.lang.String toString()
Convert this case base to a string representation. Warning: naturally, the String representation will be quite large if there are many cases and/or the cases themselves have a large String representation.

Overrides:
toString in class java.lang.Object

toVerboseString

java.lang.String toVerboseString()
                                 throws java.lang.UnsupportedOperationException
Can be overridden to provide more details than toString().

Throws:
java.lang.UnsupportedOperationException

addCases

void addCases(java.util.Collection cases)
Add a Collection of cases to the case base, using addCase().

Parameters:
cases - The Collection of cases to add.

addCases

void addCases(CaseBase cases)
Add a case base containing cases to this case base, using addCase().

Parameters:
cases - The CaseBase of cases to add.

addCases

void addCases(CaseGenerator caseGenerator,
              int numToAdd)
Generate numToAdd cases with the given caseGenerator.


getCaseClass

java.lang.Class getCaseClass()
Get the class of cases used in this case base. All cases must be of this class (or a subclass).


setCaseClass

void setCaseClass(java.lang.Class case_class)
Set the class of cases used in this case base. All cases must be of this class (or a subclass).


getCasesMatching

FlatCaseBase getCasesMatching(java.lang.Class case_class)
Get the cases in this case base that are of a given class.

Returns:
A FlatCaseBase containing the desired cases.

removeCase

boolean removeCase(Case c)
Remove a single case from the case base. Note that acase must be the same object (same memory location) as the actual case in the case base. Note that this method will likely cause a ConcurrentModificationException if it is called while iterating through the case base with an Iterator. If the goal is to remove the case just obtained through a call to Iterator.next(), then use Iterator.remove() instead.

Parameters:
acase - The case to remove.
Returns:
True if the case was found and removed, false otherwise.

getCaseCount

int getCaseCount()
Gets the number of cases in this case base


isEmpty

boolean isEmpty()
Returns true if this case base is empty, false otherwise.


close

void close()
Perform any maintenance needed during finalization of this CaseBase, such closing of open files.


addCaseBaseListener

void addCaseBaseListener(CaseBaseListener cll)
Add a CaseBaseListener to listen for CaseBaseEvents.


removeCaseBaseListener

void removeCaseBaseListener(CaseBaseListener cll)
Remove a previously added CaseBaseListener.


setBaseFileName

void setBaseFileName(java.lang.String baseFilename)
Set the base filename that will be used for saving this case base.


setDomain

void setDomain(Domain domain)
Set the transient domain attribute for this case base. This is called upon deserialization of a CBRSystem.


getDomain

Domain getDomain()

clearAllEstimates

void clearAllEstimates()
Remove all estimated features from the cases in the case base.