edu.indiana.iucbrf.casebase
Class FlatCaseBase

java.lang.Object
  extended by edu.indiana.iucbrf.casebase.AbstractCaseBase
      extended by edu.indiana.iucbrf.casebase.AbstractKeyableCaseBase
          extended by edu.indiana.iucbrf.casebase.FlatCaseBase
All Implemented Interfaces:
CaseBase, KeyableCaseBase, SwingRepresentableWithDomain, SwingRepresentable, java.io.Serializable

public class FlatCaseBase
extends AbstractKeyableCaseBase
implements java.io.Serializable, SwingRepresentableWithDomain

A list of cases, without any hierarchical ordering.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.indiana.iucbrf.casebase.AbstractKeyableCaseBase
markerList
 
Fields inherited from class edu.indiana.iucbrf.casebase.AbstractCaseBase
caseClass, debugMode, DEFAULT_INITIAL_CAPACITY, domain, listeners, prototype
 
Fields inherited from interface edu.indiana.util.swing.SwingRepresentable
TITLE_FONT
 
Constructor Summary
FlatCaseBase()
          Construct a FlatCaseBase.
FlatCaseBase(CaseGenerator caseGenerator, int numToGenerate)
          Construct a FlatCaseBase that will be initialized with initialCapacity cases, generated by caseGenerator.
FlatCaseBase(java.lang.Class caseClass)
          Construct a FlatCaseBase that will contain cases of the given case class.
FlatCaseBase(java.lang.Class caseClass, int initialCapacity)
           
FlatCaseBase(int initialCapacity)
          Creates new empty FlatCaseBase.
 
Method Summary
 void addCaseWithKey(Case acase)
          Add a case with the key already in acase.getCaseKey().
 void ensureCapacity(int minCapacity)
          This implementation does nothing.
 Case getCase(long key)
          Get the case with the given key.
 int getCaseCount()
          Gets the number of cases in this CaseBase
 java.util.HashMap getCases()
           
protected  void initializeCB(int initialCapacity)
          Perform any necessary initialization of the case base.
 java.util.Iterator iterator()
          Create an iterator on the case base.
 boolean removeCase(long key)
          Remove the case with the given key.
protected  boolean removeCaseImpl(Case c)
          Completes the task of removing a case, begun by removeCase().
 java.lang.String toString()
          Convert this case base into a String representation.
 javax.swing.JComponent toSwing(Domain domain)
           
 javax.swing.JComponent toSwing(int detailLevel)
          Detail level may be ignored by implementations.
 
Methods inherited from class edu.indiana.iucbrf.casebase.AbstractKeyableCaseBase
addCaseImpl, getMarkerKeys, getNextCaseKey
 
Methods inherited from class edu.indiana.iucbrf.casebase.AbstractCaseBase
addCase, addCaseBaseListener, addCases, addCases, addCases, buildCaseJList, checkCaseType, classMemberIterator, clearAllEstimates, close, fireCaseAdded, fireCaseClassChanged, fireCaseRemoved, fireCaseReplaced, fireCasesCleared, getCaseClass, getCasesMatching, getDomain, getPrototype, isEmpty, removeCase, removeCaseBaseListener, setBaseFileName, setCaseClass, setDebugMode, setDomain, toVerboseString
 
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
addCase, addCaseBaseListener, addCases, addCases, addCases, clearAllEstimates, close, getCaseClass, getCasesMatching, getDomain, isEmpty, removeCase, removeCaseBaseListener, setBaseFileName, setCaseClass, setDomain, toVerboseString
 

Constructor Detail

FlatCaseBase

public FlatCaseBase()
Construct a FlatCaseBase.


FlatCaseBase

public FlatCaseBase(java.lang.Class caseClass)
Construct a FlatCaseBase that will contain cases of the given case class.


FlatCaseBase

public FlatCaseBase(int initialCapacity)
Creates new empty FlatCaseBase. Use this contructor if a size estimate of the case base is available.

Parameters:
initialCapacity - The initial capacity of the FlatCaseBase

FlatCaseBase

public FlatCaseBase(java.lang.Class caseClass,
                    int initialCapacity)

FlatCaseBase

public FlatCaseBase(CaseGenerator caseGenerator,
                    int numToGenerate)
Construct a FlatCaseBase that will be initialized with initialCapacity cases, generated by caseGenerator.

Method Detail

getCases

public java.util.HashMap getCases()

initializeCB

protected void initializeCB(int initialCapacity)
Perform any necessary initialization of the case base.

Specified by:
initializeCB in class AbstractCaseBase

ensureCapacity

public void ensureCapacity(int minCapacity)
This implementation does nothing. Ordinarily, it would make sure that the CaseBase can hold at least minCapacity before it must be grown, and would be used for efficiency before adding a large number of additional cases. But there are no such actions possible for this type of case base.

Specified by:
ensureCapacity in interface CaseBase
Specified by:
ensureCapacity in class AbstractCaseBase

getCaseCount

public int getCaseCount()
Gets the number of cases in this CaseBase

Specified by:
getCaseCount in interface CaseBase

toString

public java.lang.String toString()
Convert this case base into a String representation.

Specified by:
toString in interface CaseBase
Overrides:
toString in class AbstractCaseBase

iterator

public java.util.Iterator iterator()
Create an iterator on the case base.

Specified by:
iterator in interface CaseBase
Specified by:
iterator in class AbstractCaseBase

removeCaseImpl

protected boolean removeCaseImpl(Case c)
Completes the task of removing a case, begun by removeCase().

Overrides:
removeCaseImpl in class AbstractKeyableCaseBase

addCaseWithKey

public void addCaseWithKey(Case acase)
Description copied from interface: KeyableCaseBase
Add a case with the key already in acase.getCaseKey(). If this method is used, then it is the programmer's responsibility to make sure that the provided keys are unique

Specified by:
addCaseWithKey in interface KeyableCaseBase

getCase

public Case getCase(long key)
Get the case with the given key.

Specified by:
getCase in interface KeyableCaseBase
Parameters:
key - The key of the case to be retrieved.
Returns:
The retrieved case, or null if none with that key was found.

removeCase

public boolean removeCase(long key)
Remove the case with the given key.

Specified by:
removeCase in interface KeyableCaseBase
Parameters:
key - The key of the case to be removed.
Returns:
true if case was found and removed, false otherwise.

toSwing

public javax.swing.JComponent toSwing(Domain domain)
Specified by:
toSwing in interface SwingRepresentableWithDomain
Overrides:
toSwing in class AbstractCaseBase

toSwing

public javax.swing.JComponent toSwing(int detailLevel)
Description copied from interface: SwingRepresentable
Detail level may be ignored by implementations. If used, the standard is for detailLevel 0 to be least detail, with higher values growing more detailed. 0 is least detail, higher numbers are more

Specified by:
toSwing in interface SwingRepresentable
Overrides:
toSwing in class AbstractCaseBase