de.dfki.mycbr.core.model
Class IntegerDesc

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

public class IntegerDesc
extends SimpleAttDesc

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

Author:
myCBR Team

Constructor Summary
IntegerDesc(Concept owner, java.lang.String name, int min, int max)
          Initializes this with the given name.
 
Method Summary
 AdvancedIntegerFct addAdvancedIntegerFct(java.lang.String name, boolean active)
          Creates a new AdvancedNumberFct for the given description.
 IntegerFct addIntegerFct(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.
 SimpleAttribute getIntegerAttribute(java.lang.Integer value)
          Returns IntegerAttribute object representing the specified value.
 java.lang.Integer getMax()
          Gets the maximal Integer that can be used as value for this description
 java.lang.Integer getMin()
          Gets the minimal Integer that can be used as value for this description
 void setMax(int max)
          Sets the max value which may appear as Integer specified for this description to max.
 void setMin(int min)
          Sets the minimal value which may appear as Integer 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

IntegerDesc

public IntegerDesc(Concept owner,
                   java.lang.String name,
                   int min,
                   int 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

getIntegerAttribute

public SimpleAttribute getIntegerAttribute(java.lang.Integer value)
Returns IntegerAttribute object representing the specified value.

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

setMin

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

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

getMin

public java.lang.Integer getMin()
Gets the minimal Integer that can be used as value for this description

Returns:
minimal value for attributes of this description

setMax

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

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

getMax

public java.lang.Integer getMax()
Gets the maximal Integer that can be used as value for this description

Returns:
maximal value for attributes of this description

addIntegerFct

public IntegerFct addIntegerFct(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

addAdvancedIntegerFct

public AdvancedIntegerFct addAdvancedIntegerFct(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