de.dfki.mycbr.core.casebase
Class DoubleRange

java.lang.Object
  extended by de.dfki.mycbr.core.casebase.Range
      extended by de.dfki.mycbr.core.casebase.DoubleRange
All Implemented Interfaces:
java.util.Observer

public final class DoubleRange
extends Range

Holds FloatAttributes for a given FloatDescription. Each time a float is used in a case the FloatRange returns a reference to the corresponding DoubleAttribute object or creates a new one. SpecialAttributes are also handled for each SpecialAttribute used in the current project

Author:
myCBR Team

Constructor Summary
DoubleRange(Project prj, DoubleDesc doubleDesc)
          Initializes internal data structures according to maximal number of integer attributes (given by DoubleDesc.getMax() - DoubleDesc.getMin()).
 
Method Summary
 boolean containsDouble(java.lang.Double value)
          Returns true, if there is a DoubleAttribute contained in this range which has the specified value.
 Attribute getAttribute(java.lang.Object obj)
          Gets the attribute associated with the specified Object obj.
 DoubleDesc getDesc()
          Gets the double description for attributes maintained by this range.
 java.util.Collection<DoubleAttribute> getDoubles()
          Gets all values contained in this range.
 DoubleAttribute getDoubleValue(double value)
          Returns the DoubleAttribute associated with the given double.
 SimpleAttribute getValue(double value)
          Returns an attribute representing the given number.
 Attribute parseValue(java.lang.String string)
           
 void update(java.util.Observable ob, java.lang.Object o)
           
 
Methods inherited from class de.dfki.mycbr.core.casebase.Range
getProject, setProject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleRange

public DoubleRange(Project prj,
                   DoubleDesc doubleDesc)
Initializes internal data structures according to maximal number of integer attributes (given by DoubleDesc.getMax() - DoubleDesc.getMin()).

Parameters:
prj - the project this range belongs to
doubleDesc - the double description for attributes maintained by this range
Method Detail

getDesc

public DoubleDesc getDesc()
Gets the double description for attributes maintained by this range.

Returns:
the description of values contained in this range

containsDouble

public boolean containsDouble(java.lang.Double value)
Returns true, if there is a DoubleAttribute contained in this range which has the specified value.

Parameters:
value - the double to be checked
Returns:
true, if value is contained in this range, false otherwise

getDoubleValue

public DoubleAttribute getDoubleValue(double value)
Returns the DoubleAttribute associated with the given double. Creates a new DoubleAttribute if there is no DoubleAttribute for the given double yet.

Parameters:
value - the value for which the corresponding DoubleAttribute should be returned
Returns:
the DoubleAttribute specified by value

getDoubles

public java.util.Collection<DoubleAttribute> getDoubles()
Gets all values contained in this range.

Returns:
Collection of DoubleAttribute objects representing the values

getAttribute

public Attribute getAttribute(java.lang.Object obj)
Gets the attribute associated with the specified Object obj. obj is expected to be of type Double, Double or String. Returns result of getDoubleValue(double) if obj is of type Double, Double result of Project.getSpecialAttribute(String) if obj is of type SpecialAttribute, else returns null. Is needed for MultipleRange.

Specified by:
getAttribute in class Range
Parameters:
obj - representing Double or SpecialAttribute
Returns:
SimpleAttribute that corresponds to obj, null if there is no such SimpleAttribute

getValue

public SimpleAttribute getValue(double value)
Returns an attribute representing the given number. Calls getDoubleValue(double).

Parameters:
value - the value of the double attribute to be returned
Returns:
the double attribute corresponding to value

update

public void update(java.util.Observable ob,
                   java.lang.Object o)

parseValue

public Attribute parseValue(java.lang.String string)
Parameters:
string - the string which should be used for parsing
Returns:
the attribute which corresponds to the given string