|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.indiana.iucbrf.casepackage.Case
public class Case
A case consists of a problem description and a solution.
Consequently, the Case component package is simply a wrapper for a
Problem object and a Solution object. Essentially all functionality
is deferred to these objects. This base component class is not
abstract and should fit the needs of many CBR systems without
modification.
Note: Any extension must implement Serializable, if case base file save and load functionality is desired.
Field Summary | |
---|---|
static long |
CASE_KEY_NOT_SET
|
protected long |
caseKey
|
protected java.util.HashSet |
inactiveContexts
The set of contexts in which this case is inactive, and should not be retrieved. |
protected Problem |
p
The object representing the problem that this case solves. |
protected double |
problemCountAtAddition
The number of problems the system had seen when this case was added. |
protected Solution |
s
The object representing the solution that this case solves. |
protected CaseSource |
source
The source of this case. |
protected int |
successfulUseCount
number of times this case has been used, and that use has lead to a "successful" solution |
protected int |
useCount
number of times this case has been used (sent for adaptation, perhaps along with other cases) |
Fields inherited from interface edu.indiana.util.swing.SwingRepresentable |
---|
TITLE_FONT |
Constructor Summary | |
---|---|
protected |
Case()
|
|
Case(Problem p,
Solution s)
Creates new Case This constructor can be used to create a new case when the problem and solution are already known. |
|
Case(Problem p,
Solution s,
CaseSource source,
int useCount,
int successfulUseCount,
double problemCountAtAddition,
java.util.HashSet inactiveContexts)
|
|
Case(Problem p,
Solution s,
double problemCount)
Creates new Case This constructor can be used to create a new case when the problem and solution are already known. |
|
Case(Problem p,
Solution s,
double problemCount,
CaseSource source)
Creates new Case This constructor can be used to create a new case when the problem and solution are already known. |
Method Summary | |
---|---|
void |
applyFeatureNoise(FeatureKey featureKey,
Distribution distribution)
Apply noise, according to the given distribution, to the given feature. |
void |
applySolutionNoise(Distribution distribution)
Apply noise, according to the given distribution, to the solution of this case. |
int |
compareTo(java.lang.Object otherCase)
Compare two cases, by comparing the problem. |
ProblemIndices |
constructIndices(Domain domain)
Constructs a ProblemIndices object using an IndicesIterator. |
boolean |
equals(java.lang.Object other)
Returns true if this case equals the given case; false otherwise. |
void |
fromXML(java.lang.String XMLString)
|
double |
getCaseAge(PerformanceMonitor monitor)
Returns the number of problem-solving episodes, since this case was added, that have been seen by the system monitored by the given monitor. |
long |
getCaseKey()
|
CaseSource |
getCaseSource()
Get the source of this case. |
java.util.HashSet |
getInactiveContexts()
Method getInactiveContexts |
Problem |
getProblem()
Get the Problem object for this case. |
double |
getProblemCountAtAddition()
|
Solution |
getSolution()
Get the Solution object for this case. |
int |
getSuccessfulUseCount()
For performance monitoring purposes, get the number of times this case has been used successfully. |
java.lang.String |
getTitle()
Get the title of this case. |
int |
getUseCount()
For performance monitoring purposes, get the number of times this case has been used. |
boolean |
hasCaseKey()
|
boolean |
hasSolution()
Report if this case has a solution. |
boolean |
isActive(Context context)
Determine if this case is active for the given context. |
void |
markCaseUsed()
For performance monitoring purposes, indicate that this case has been used - sent for adaptation, perhaps along with other cases. |
void |
markCaseUsedSuccessfully()
For performance monitoring purposes, indicate that this case has been used, and that use has lead to a "successful" solution. |
javax.swing.JComponent |
miscToSwing()
|
void |
resetCounts()
Reset the use, successful use, and problemCountAtAddition trackers for this case, to 0. |
void |
setActive(Context context)
Make this case active for the given context. |
void |
setCaseKey(long caseKey)
|
void |
setCaseSource(CaseSource source)
Set the source of this case. |
void |
setInactive(Context context)
Make this case inactive for the given context. |
void |
setInactiveContexts(java.util.HashSet inactiveContexts)
|
void |
setProblem(Problem newProblem)
Set the problem of this case. |
void |
setSolution(Solution newSolution)
Set the solution of this case. |
void |
setTitle(java.lang.String title)
Set the title of this case. |
java.lang.String |
toString()
Convert this case to a string representation. |
java.lang.String |
toString(Domain domain)
|
protected java.lang.String |
toString(java.lang.String title,
java.lang.String source,
java.lang.String problem,
java.lang.String solution)
|
javax.swing.JComponent |
toSwing(Domain domain)
|
javax.swing.JComponent |
toSwing(int detailLevel)
Detail level may be ignored by implementations. |
protected javax.swing.JComponent |
toSwing(javax.swing.JComponent problemAsSwing,
javax.swing.JComponent solutionAsSwing)
|
java.lang.String |
toXML(Domain domain)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final long CASE_KEY_NOT_SET
protected Problem p
protected Solution s
protected java.util.HashSet inactiveContexts
protected int useCount
protected int successfulUseCount
protected double problemCountAtAddition
protected CaseSource source
protected long caseKey
Constructor Detail |
---|
protected Case()
public Case(Problem p, Solution s)
p
- The Problem for this case.s
- The Solution to the problem.public Case(Problem p, Solution s, double problemCount)
p
- The Problem for this case.s
- The Solution to the problem.problemCount
- The number of problems the system had seen when this case was added.public Case(Problem p, Solution s, double problemCount, CaseSource source)
p
- The Problem for this case.s
- The Solution to the problem.public Case(Problem p, Solution s, CaseSource source, int useCount, int successfulUseCount, double problemCountAtAddition, java.util.HashSet inactiveContexts)
Method Detail |
---|
public void setCaseKey(long caseKey)
public long getCaseKey()
public boolean hasCaseKey()
public ProblemIndices constructIndices(Domain domain)
public java.lang.String getTitle()
public void setTitle(java.lang.String title)
public void setActive(Context context)
public void setInactive(Context context)
public boolean isActive(Context context)
public CaseSource getCaseSource()
public void setCaseSource(CaseSource source)
public void markCaseUsed()
public void markCaseUsedSuccessfully()
public int getUseCount()
public int getSuccessfulUseCount()
public double getCaseAge(PerformanceMonitor monitor)
monitor
- The performance monitor for this CBR system.
public void resetCounts()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(Domain domain)
protected java.lang.String toString(java.lang.String title, java.lang.String source, java.lang.String problem, java.lang.String solution)
public javax.swing.JComponent toSwing(int detailLevel)
SwingRepresentable
toSwing
in interface SwingRepresentable
public javax.swing.JComponent toSwing(Domain domain)
toSwing
in interface SwingRepresentableWithDomain
protected javax.swing.JComponent toSwing(javax.swing.JComponent problemAsSwing, javax.swing.JComponent solutionAsSwing)
public javax.swing.JComponent miscToSwing()
public java.lang.String toXML(Domain domain)
public void fromXML(java.lang.String XMLString)
public boolean hasSolution()
public Problem getProblem()
public void setProblem(Problem newProblem)
public Solution getSolution()
public void setSolution(Solution newSolution)
public int compareTo(java.lang.Object otherCase)
compareTo
in interface java.lang.Comparable
otherCase
- The other Case object, to compare to this.
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public void applyFeatureNoise(FeatureKey featureKey, Distribution distribution)
public void applySolutionNoise(Distribution distribution)
public double getProblemCountAtAddition()
public java.util.HashSet getInactiveContexts()
public void setInactiveContexts(java.util.HashSet inactiveContexts)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |