cbr.framework
Class Case

java.lang.Object
  extended by cbr.framework.Case
All Implemented Interfaces:
Comparable<Case>

public class Case
extends Object
implements Comparable<Case>

A case consists of indexed and non-indexed features, a solution and the last similarity value that was computed for this case.


Constructor Summary
Case()
          Create an empty case.
Case(Map<String,Feature> allFeatures)
          Create a case with features contained in a Map.
 
Method Summary
 void addFeature(Feature f)
          Add a feature to the case.
 int compareTo(Case other)
          Override the compareTo() method so that Cases can be sorted according to descending similarity.
 double getOutcomeValue()
          Retrieve the outcome value for this case.
 double getSimilarity()
          Get the last similarity value that was derived.
 Solution getSolution()
          Retrieve the solution for this case.
 void setOutcomeValue(double value)
          Set the Outcome value for this case.
 void setSolution(Solution solution)
          Set the Solution for this case.
 String toString()
          Iterate over the features, solution and current similarity and display each of their values.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Case

public Case()
Create an empty case.


Case

public Case(Map<String,Feature> allFeatures)
Create a case with features contained in a Map.

Parameters:
allFeatures - a Map which holds Features with a name key.
Method Detail

addFeature

public void addFeature(Feature f)
Add a feature to the case.

Parameters:
f - the additional Feature.

setSolution

public void setSolution(Solution solution)
Set the Solution for this case.

Parameters:
solution - the solution

getSolution

public Solution getSolution()
Retrieve the solution for this case.

Returns:
the solution

setOutcomeValue

public void setOutcomeValue(double value)
Set the Outcome value for this case.

Parameters:
value - the outcome value

getOutcomeValue

public double getOutcomeValue()
Retrieve the outcome value for this case.

Returns:
the outcome as a double

toString

public String toString()
Iterate over the features, solution and current similarity and display each of their values.

Overrides:
toString in class Object
Returns:
a description String

getSimilarity

public double getSimilarity()
Get the last similarity value that was derived.

Returns:
the latest similarity value

compareTo

public int compareTo(Case other)
Override the compareTo() method so that Cases can be sorted according to descending similarity.

Specified by:
compareTo in interface Comparable<Case>
Parameters:
other - the Case to compare with.
Returns:
an int which represents the cases order in the sort.