de.dfki.mycbr.core.model
Class IntervalDesc

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

public class IntervalDesc
extends SimpleAttDesc

The allow computation of similarity between intervals there must be a minimal and a maximal value that restrict the possible interval bounds.

Author:
myCBR Team

Constructor Summary
IntervalDesc(Concept owner, java.lang.String name, java.lang.Number minValue, java.lang.Number maxValue)
          initializes this with the given name.
 
Method Summary
 IntervalFct addIntervalFct(java.lang.String name, boolean active)
          Creates a new SymbolFct 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.
 IntervalAttribute getIntervalAttribute(java.lang.Number minValue, java.lang.Number maxValue)
          Returns IntervalAttribute object representing the specified interval.
 java.lang.Number getMax()
          Returns the maximal value which may appear in an interval specified for this description.
 java.lang.Number getMin()
          Returns the minimal value which may appear in an interval specified for this description.
 void setMax(java.lang.Number maxValue)
          Sets the maximal value which may appear in an interval specified for this description.
 void setMin(java.lang.Number minValue)
          Sets the minimal value which may appear in an interval 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

IntervalDesc

public IntervalDesc(Concept owner,
                    java.lang.String name,
                    java.lang.Number minValue,
                    java.lang.Number maxValue)
             throws java.lang.Exception
initializes this with the given name. The name should be unique within the attributes of the c description containing this interval description. Creates a new range for this description.

Parameters:
owner - the owner of this
name - the name to be used for this description.
minValue - number specifying the lower bound for attribute values for this
maxValue - number specifying the upper bound for attribute values for this
Throws:
java.lang.Exception - if min is not less than or equal to max
Method Detail

getIntervalAttribute

public final IntervalAttribute getIntervalAttribute(java.lang.Number minValue,
                                                    java.lang.Number maxValue)
Returns IntervalAttribute object representing the specified interval.

Parameters:
minValue - lower bound of the interval
maxValue - upper bound of the interval
Returns:
value representing the specified interval.

getMin

public final java.lang.Number getMin()
Returns the minimal value which may appear in an interval specified for this description.

Returns:
minimal value appearing in interval for this attribute

setMin

public final void setMin(java.lang.Number minValue)
Sets the minimal value which may appear in an interval specified for this description to min. Does nothing if min >= max

Parameters:
minValue - minimal value appearing in interval for this attribute

getMax

public final java.lang.Number getMax()
Returns the maximal value which may appear in an interval specified for this description.

Returns:
maximal value appearing in interval for this attribute

setMax

public final void setMax(java.lang.Number maxValue)
Sets the maximal value which may appear in an interval specified for this description. Does nothing if max <= min.

Parameters:
maxValue - maximal value appearing in interval for this attribute

addIntervalFct

public final IntervalFct addIntervalFct(java.lang.String name,
                                        boolean active)
Creates a new SymbolFct for the given description.

Parameters:
name - the name of the new function
active - if true, the new function is used in the active amalgamation of the owner of this
Returns:
the Similarity.getFunction for description desc

canOverride

public final 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
Parameters:
desc - the description which should be overridden by this
Returns:
true, if this can override the given description, false otherwise

fits

public final 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 - the attribute which should be checked for fitting this
Returns:
true, if it is has a valid interval value or a set of valid interval values (multiple attribute)

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