de.dfki.mycbr.core.model
Class DateDesc

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

public class DateDesc
extends SimpleAttDesc

Description for date attributes. Restricts the values that can be used as attributes of this description by minValue and maxValue and holds a format which is used for these values

Author:
myCBR Team

Constructor Summary
DateDesc(Concept owner, java.lang.String name, java.util.Date minDate, java.util.Date maxDate, java.text.SimpleDateFormat format)
          Initializes this with the given name, minimal/ maximal value and format.
 
Method Summary
 DateFct addDateFct(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.
 DateAttribute getDateAttribute(java.util.Date value)
          Returns DateAttribute object representing the specified value.
 java.text.SimpleDateFormat getFormat()
          Gets the values' format
 java.util.Date getMaxDate()
          Gets the maximal date which can be used as value for this description.
 java.util.Date getMinDate()
          Returns the minimal date which can be used as value for this description.
 void setFormat(java.text.SimpleDateFormat format)
          Sets the values' format
 void setMaxDate(java.util.Date maxDate)
          Sets the maximal date which can be used as value for this description.
 void setMinDate(java.util.Date minDate)
          Sets the minimal date which can be used as value for this description.
 
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

DateDesc

public DateDesc(Concept owner,
                java.lang.String name,
                java.util.Date minDate,
                java.util.Date maxDate,
                java.text.SimpleDateFormat format)
         throws java.lang.Exception
Initializes this with the given name, minimal/ maximal value and format. The name should be unique within the attributes of the c description containing this description. Creates a new range for this description.

Parameters:
name - the name to be used for this description.
Throws:
java.lang.Exception
Method Detail

getDateAttribute

public DateAttribute getDateAttribute(java.util.Date value)
Returns DateAttribute object representing the specified value.

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

setMinDate

public void setMinDate(java.util.Date minDate)
Sets the minimal date which can be used as value for this description. Does nothing if minDate is already the minimal date or if it is not before maxDate

Parameters:
minDate - the minDate to set

getMinDate

public java.util.Date getMinDate()
Returns the minimal date which can be used as value for this description.

Returns:
the minDate

setMaxDate

public void setMaxDate(java.util.Date maxDate)
Sets the maximal date which can be used as value for this description. Does nothing if maxDate is already the maximal date or if it is not before maxDate.

Parameters:
maxDate - the maxDate to set

getMaxDate

public java.util.Date getMaxDate()
Gets the maximal date which can be used as value for this description.

Returns:
the maxDate

getFormat

public java.text.SimpleDateFormat getFormat()
Gets the values' format

Returns:
the format

setFormat

public void setFormat(java.text.SimpleDateFormat format)
Sets the values' format

Parameters:
format - the new format

addDateFct

public DateFct addDateFct(java.lang.String name,
                          boolean active)
Creates a new SymbolFct for the given description.

Parameters:
name - the description for which a new function should be created
Returns:
the Similarity.getFunction 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 attribute 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