de.dfki.mycbr.core.casebase
Class FloatRange

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

public final class FloatRange
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 FloatAttribute object or creates a new one. SpecialAttributes are also handled for each SpecialAttribute used in the current project

Author:
myCBR Team

Constructor Summary
FloatRange(Project prj, FloatDesc floatDesc)
          Initializes internal data structures according to maximal number of integer attributes (given by FloatDesc.getMax() - FloatDesc.getMin()).
 
Method Summary
 boolean containsFloat(java.lang.Float value)
          Returns true, if there is a FloatAttribute contained in this range which has the specified value.
 Attribute getAttribute(java.lang.Object obj)
          Gets the attribute associated with the specified Object obj.
 FloatDesc getDesc()
          Gets the float description for attributes maintained by this range.
 FloatAttribute getDoubleValue(double dValue)
          Returns the FloatAttribute associated with the given double.
 java.util.Collection<FloatAttribute> getFloats()
          Gets all values contained in this range.
 FloatAttribute getFloatValue(float value)
          Returns the FloatAttribute associated with the given float.
 SimpleAttribute getValue(float 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

FloatRange

public FloatRange(Project prj,
                  FloatDesc floatDesc)
Initializes internal data structures according to maximal number of integer attributes (given by FloatDesc.getMax() - FloatDesc.getMin()).

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

getDesc

public FloatDesc getDesc()
Gets the float description for attributes maintained by this range.

Returns:
the description of values contained in this range

containsFloat

public boolean containsFloat(java.lang.Float value)
Returns true, if there is a FloatAttribute contained in this range which has the specified value.

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

getFloatValue

public FloatAttribute getFloatValue(float value)
Returns the FloatAttribute associated with the given float. Creates a new FloatAttribute if there is no FloatAttribute for the given float yet.

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

getDoubleValue

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

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

getFloats

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

Returns:
Collection of FloatAttribute 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 Float, Double or String. Returns result of getFloatValue(float) if obj is of type Float, 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 Float or SpecialAttribute
Returns:
SimpleAttribute that corresponds to obj, null if there is no such SimpleAttribute

getValue

public SimpleAttribute getValue(float value)
Returns an attribute representing the given number. Calls getFloatValue(float).

Parameters:
value - the value of the float attribute to be returned
Returns:
the float 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