de.dfki.mycbr.core.model
Class FloatDesc

java.lang.Object
  extended by java.util.Observable
      extended by de.dfki.mycbr.core.model.AttributeDesc
          extended by de.dfki.mycbr.core.model.SimpleAttDesc
              extended by de.dfki.mycbr.core.model.FloatDesc
All Implemented Interfaces:
IExplainable, java.util.Observer

public class FloatDesc
extends SimpleAttDesc

Description for Number attributes. Restricts the values that can be used as attributes of this description by minValue and maxValue

Author:
myCBR Team

Constructor Summary
FloatDesc(Concept owner, java.lang.String name, float min, float max)
          Initializes this with the given name.
 
Method Summary
 AdvancedFloatFct addAdvancedFloatFct(java.lang.String name, boolean active)
          Creates a new AdvancedNumberFct for the given description.
 FloatFct addFloatFct(java.lang.String name, boolean active)
          Creates a new NumberFct for the given description.
 boolean canOverride(AttributeDesc desc)
          Checks whether this attribute description can override the given attribute description
 boolean fits(Attribute att)
          Checks whether the given attribute fits this.
 boolean fitsSingle(Attribute att)
          Checks whether a single attribute fits the constraints for this.
 float getMax()
          Gets the maximal Number that can be used as value for this description
 float getMin()
          Gets the minimal Number that can be used as value for this description
 SimpleAttribute getNumberAttribute(float value)
          Returns NumberAttribute object representing the specified value.
 FloatRange getRange()
          Gets the range maintaining the number attributes of this description
 void setMax(float max)
          Sets the max value which may appear as Number specified for this description to max.
 void setMin(float min)
          Sets the minimal value which may appear as Number specified for this description to min.
 
Methods inherited from class de.dfki.mycbr.core.model.SimpleAttDesc
addFct, deleteAllFcts, deleteSimFct, getFct, getSimFcts, renameFct
 
Methods inherited from class de.dfki.mycbr.core.model.AttributeDesc
delete, getAttribute, getExpType, getName, getOwner, isMultiple, setMultiple, setName, setOwner, toString, update
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FloatDesc

public FloatDesc(Concept owner,
                 java.lang.String name,
                 float min,
                 float max)
          throws java.lang.Exception
Initializes this with the given name. The name should be unique within the attributes of the c description containing this description. Creates a new range for this description.

Throws:
java.lang.Exception
Method Detail

getNumberAttribute

public SimpleAttribute getNumberAttribute(float value)
Returns NumberAttribute object representing the specified value.

Parameters:
value - the Number representing the value that should be returned
Returns:
value representing the specified float.

setMin

public void setMin(float min)
Sets the minimal value which may appear as Number specified for this description to min. Does nothing if min >= max.

Parameters:
min - minimal value appearing as Number for this description

getMin

public float getMin()
Gets the minimal Number that can be used as value for this description

Returns:
minimal value for attributes of this description

setMax

public void setMax(float max)
Sets the max value which may appear as Number specified for this description to max. Does nothing if max <=min

Parameters:
max - max value appearing as Number for this description

getMax

public float getMax()
Gets the maximal Number that can be used as value for this description

Returns:
maximal value for attributes of this description

getRange

public FloatRange getRange()
Gets the range maintaining the number attributes of this description

Returns:
the number range of this description

addFloatFct

public FloatFct addFloatFct(java.lang.String name,
                            boolean active)
Creates a new NumberFct for the given description.

Parameters:
name - the description for which a new function should be created
Returns:
the new NumberFct for description desc

addAdvancedFloatFct

public AdvancedFloatFct addAdvancedFloatFct(java.lang.String name,
                                            boolean active)
Creates a new AdvancedNumberFct for the given description.

Parameters:
name - the description for which a new function should be created
Returns:
the new AdvancedNumberFct for description desc

canOverride

public boolean canOverride(AttributeDesc desc)
Description copied from class: AttributeDesc
Checks whether this attribute description can override the given attribute description

Specified by:
canOverride in class SimpleAttDesc

fits

public boolean fits(Attribute att)
Description copied from class: AttributeDesc
Checks whether the given attribute fits this. Be aware that if this is multiple then single values will not fit. For checking whether single values fit this description without taking multiple values into account call AttributeDesc.fitsSingle(Attribute)

Overrides:
fits in class AttributeDesc
Parameters:
att -
Returns:
true, if the given att fits this

fitsSingle

public boolean fitsSingle(Attribute att)
Description copied from class: AttributeDesc
Checks whether a single attribute fits the constraints for this. Returns true, if att is a valid SpecialAttribute or if att can be used as a single value of a multiple attribute. If this is not multiple calls AttributeDesc.fits(Attribute)

Overrides:
fitsSingle in class AttributeDesc
Parameters:
att - the attribute which should be checked
Returns:
true, when att can be used as value of this or in multiple attribute