de.dfki.mycbr.core.casebase
Class DateRange

java.lang.Object
  extended by de.dfki.mycbr.core.casebase.Range
      extended by de.dfki.mycbr.core.casebase.DateRange
All Implemented Interfaces:
java.util.Observer

public final class DateRange
extends Range

Holds DateAttributes for a given DateDescr. Each time a date is used in a case the DateRange returns a reference to the corresponding DateAttribute object or creates a new one. SpecialAttributes are also handled for each SpecialAttribute used in the current project

Author:
myCBR Team

Constructor Summary
DateRange(Project p, DateDesc d)
          Initializes internal data structures.
 
Method Summary
 Attribute getAttribute(java.lang.Object obj)
          Gets the attribute associated with the specified Object obj.
 DateAttribute getDateValue(java.util.Date date)
          Returns the DateAttribute associated with the given date.
 Attribute parseValue(java.lang.String string)
           
 void update(java.util.Observable ob, java.lang.Object o)
           
 
Methods inherited from class de.dfki.mycbr.core.casebase.Range
getProject, setProject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateRange

public DateRange(Project p,
                 DateDesc d)
Initializes internal data structures.

Parameters:
p - the project this range belongs to
d - the date description for attributes maintained by this range
Method Detail

getDateValue

public DateAttribute getDateValue(java.util.Date date)
Returns the DateAttribute associated with the given date. Creates a new DateAttribute if there is no DateAttribute for the given date yet.

Parameters:
date - the value for which the corresponding DateAttribute should be returned
Returns:
the DateAttribute specified by date

getAttribute

public Attribute getAttribute(java.lang.Object obj)
                       throws java.text.ParseException
Gets the attribute associated with the specified Object obj. obj is expected to be of type Date or String. Returns result of getDateValue(Date) if obj is of type Date, result of Project.getSpecialAttribute(String) if obj is of type SpecialAttribute, else returns null. Is needed for MultipleRange.

Specified by:
getAttribute in class Range
Parameters:
obj - representing Date or SpecialAttribute
Returns:
SimpleAttribute that corresponds to obj, null if there is no such SimpleAttribute
Throws:
java.text.ParseException - if obj does not fit the description

parseValue

public Attribute parseValue(java.lang.String string)
                     throws java.text.ParseException
Parameters:
string - the string to be parsed
Returns:
the attribute associated with string
Throws:
java.text.ParseException - if string does not fit description

update

public void update(java.util.Observable ob,
                   java.lang.Object o)