|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.indiana.iucbrf.casebase.AbstractCaseBase
public abstract class AbstractCaseBase
This abstract base component class contains the outline for the
implementation of a case base, as well as implementations of some common functions.
Field Summary | |
---|---|
protected java.lang.Class |
caseClass
|
protected boolean |
debugMode
|
static int |
DEFAULT_INITIAL_CAPACITY
|
protected Domain |
domain
|
protected java.util.ArrayList |
listeners
interested third parties |
protected Case |
prototype
|
Fields inherited from interface edu.indiana.util.swing.SwingRepresentable |
---|
TITLE_FONT |
Constructor Summary | |
---|---|
AbstractCaseBase()
Creates new CaseBase |
|
AbstractCaseBase(CaseGenerator caseGenerator,
int numToGenerate)
Construct a case base generated randomly according to a CaseGenerator. |
|
AbstractCaseBase(java.lang.Class caseClass,
int initialCapacity)
|
Method Summary | |
---|---|
long |
addCase(Case acase)
Add a case to the case base. |
void |
addCaseBaseListener(CaseBaseListener cll)
Add a CaseBaseListener to listen for CaseBaseEvents. |
protected abstract long |
addCaseImpl(Case caseToAdd)
Implement this method to add a case to the case base, assuming that class and event issues are already handled by addCase(). |
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(). |
protected CaseJList |
buildCaseJList()
|
protected void |
checkCaseType(Case c)
Makes sure that a case is of an appropriate class for this case base. |
java.util.Iterator |
classMemberIterator()
|
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. |
abstract void |
ensureCapacity(int minCapacity)
Prepare the case base to be able to hold at least minCapacity cases. |
protected void |
fireCaseAdded(Case addedCase)
Notify all CaseBaseListeners added to this CaseBase that a case has been added to this case base. |
protected void |
fireCaseClassChanged()
Notify all CaseBaseListeners added to this CaseBase that the case class associated with the case base had been changed. |
protected void |
fireCaseRemoved(Case removedCase)
Notify all CaseBaseListeners added to this CaseBase that a case has been removed. |
protected void |
fireCaseReplaced(Case oldCase,
Case newCase)
Notify all CaseBaseListeners added to this CaseBase that a case has been replaced. |
protected void |
fireCasesCleared()
Notify all CaseBaseListeners added to this CaseBase that all cases have been cleared from the CaseBase. |
java.lang.Class |
getCaseClass()
Get the class of cases used 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()
|
java.lang.Object |
getPrototype()
|
protected abstract void |
initializeCB(int initialCapacity)
|
boolean |
isEmpty()
Returns true if this case base is empty, false otherwise. |
abstract 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. |
protected abstract boolean |
removeCaseImpl(Case c)
|
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 |
setDebugMode(boolean debugMode)
|
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. |
javax.swing.JComponent |
toSwing(Domain domain)
|
javax.swing.JComponent |
toSwing(int detailLevel)
Detail level may be ignored by implementations. |
java.lang.String |
toVerboseString()
Can be overridden to provide more details than toString(). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface edu.indiana.iucbrf.casebase.CaseBase |
---|
getCaseCount |
Field Detail |
---|
public static final int DEFAULT_INITIAL_CAPACITY
protected java.lang.Class caseClass
protected java.util.ArrayList listeners
protected boolean debugMode
protected transient Domain domain
protected Case prototype
Constructor Detail |
---|
public AbstractCaseBase()
public AbstractCaseBase(java.lang.Class caseClass, int initialCapacity)
public AbstractCaseBase(CaseGenerator caseGenerator, int numToGenerate)
Method Detail |
---|
protected abstract void initializeCB(int initialCapacity)
public abstract void ensureCapacity(int minCapacity)
ensureCapacity
in interface CaseBase
public abstract java.util.Iterator iterator()
iterator
in interface CaseBase
public java.lang.String toString()
toString
in interface CaseBase
toString
in class java.lang.Object
public java.lang.String toVerboseString() throws java.lang.UnsupportedOperationException
toVerboseString
in interface CaseBase
java.lang.UnsupportedOperationException
public void addCases(java.util.Collection cases)
addCases
in interface CaseBase
cases
- The Collection of cases to add.public void addCases(CaseBase cases)
addCases
in interface CaseBase
cases
- The CaseBase of cases to add.public void addCases(CaseGenerator caseGenerator, int numToAdd)
CaseBase
addCases
in interface CaseBase
public java.lang.Class getCaseClass()
getCaseClass
in interface CaseBase
public FlatCaseBase getCasesMatching(java.lang.Class case_class)
getCasesMatching
in interface CaseBase
public void setCaseClass(java.lang.Class case_class)
setCaseClass
in interface CaseBase
protected void checkCaseType(Case c)
c
- The case in question.public void close()
close
in interface CaseBase
public long addCase(Case acase)
addCase
in interface CaseBase
acase
- The case to add.
protected abstract long addCaseImpl(Case caseToAdd)
protected abstract boolean removeCaseImpl(Case c)
public boolean removeCase(Case c)
removeCase
in interface CaseBase
acase
- The case to remove.
public javax.swing.JComponent toSwing(int detailLevel)
SwingRepresentable
toSwing
in interface SwingRepresentable
public javax.swing.JComponent toSwing(Domain domain)
toSwing
in interface SwingRepresentableWithDomain
protected CaseJList buildCaseJList()
public boolean isEmpty()
CaseBase
isEmpty
in interface CaseBase
public void addCaseBaseListener(CaseBaseListener cll)
addCaseBaseListener
in interface CaseBase
public void removeCaseBaseListener(CaseBaseListener cll)
removeCaseBaseListener
in interface CaseBase
protected void fireCaseReplaced(Case oldCase, Case newCase)
index
- The index of the case that was replaced.protected void fireCaseClassChanged()
protected void fireCasesCleared()
protected void fireCaseRemoved(Case removedCase)
index
- The index of the case that was removed.protected void fireCaseAdded(Case addedCase)
index
- The index of the case that was added.public void setBaseFileName(java.lang.String baseFilename)
setBaseFileName
in interface CaseBase
public void setDebugMode(boolean debugMode)
public void setDomain(Domain domain)
CaseBase
setDomain
in interface CaseBase
public Domain getDomain()
getDomain
in interface CaseBase
public void clearAllEstimates()
clearAllEstimates
in interface CaseBase
public java.lang.Object getPrototype()
public java.util.Iterator classMemberIterator()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |