de.dfki.mycbr.core.model
Class DoubleDesc

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.DoubleDesc
All Implemented Interfaces:
IExplainable, java.util.Observer

public class DoubleDesc
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
DoubleDesc(Concept owner, java.lang.String name, double min, double max)
          Initializes this with the given name.
 
Method Summary
 AdvancedDoubleFct addAdvancedDoubleFct(java.lang.String name, boolean active)
          Creates a new AdvancedNumberFct for the given description.
 DoubleFct addDoubleFct(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.
 double getMax()
          Gets the maximal Number that can be used as value for this description
 double getMin()
          Gets the minimal Number that can be used as value for this description
 SimpleAttribute getNumberAttribute(double value)
          Returns NumberAttribute object representing the specified value.
 DoubleRange getRange()
          Gets the range maintaining the number attributes of this description
 void setMax(double max)
          Sets the max value which may appear as Number specified for this description to max.
 void setMin(double 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

DoubleDesc

public DoubleDesc(Concept owner,
                  java.lang.String name,
                  double min,
                  double 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(double value)
Returns NumberAttribute object representing the specified value.

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

setMin

public void setMin(double 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 double 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(double 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 double getMax()
Gets the maximal Number that can be used as value for this description

Returns:
maximal value for attributes of this description

getRange

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

Returns:
the number range of this description

addDoubleFct

public DoubleFct addDoubleFct(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

addAdvancedDoubleFct

public AdvancedDoubleFct addAdvancedDoubleFct(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