de.dfki.mycbr.core.casebase
Class IntervalRange

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

public final class IntervalRange
extends Range

Holds IntervalAttributes for a given IntervalDesc. Each time an interval is used in a case the IntervalRange returns a reference to the corresponding IntervalAttribute object or creates a new one. SpecialAttribute are also handled for each SpecialValue used in the current project

Author:
myCBR Team

Constructor Summary
IntervalRange(Project prj, IntervalDesc d)
          Initializes internal data structures.
 
Method Summary
 Attribute getAttribute(java.lang.Object obj)
          Gets the attribute associated with the specified Object obj.
 IntervalAttribute getIntervalValue(Pair<java.lang.Number,java.lang.Number> interval)
          Returns the IntervalAttribute associated with the given interval.
 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

IntervalRange

public IntervalRange(Project prj,
                     IntervalDesc d)
Initializes internal data structures.

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

getIntervalValue

public IntervalAttribute getIntervalValue(Pair<java.lang.Number,java.lang.Number> interval)
Returns the IntervalAttribute associated with the given interval. Creates a new IntervalAttribute if there is no IntervalAttribute for the given interval yet.

Parameters:
interval - the value for which the corresponding IntervalAttribute should be returned
Returns:
the IntervalAttribute specified by interval

getAttribute

public Attribute getAttribute(java.lang.Object obj)
Gets the attribute associated with the specified Object obj. obj is expected to be of type Interval or String. Returns result of getIntervalValue(Pair) if obj is of type Interval, result of Project.getSpecialAttribute(String) if obj is of type SpecialAttribute, else returns null.

Specified by:
getAttribute in class Range
Parameters:
obj - representing Interval or SpecialAttribute
Returns:
SimpleAttribute that corresponds to obj, null if there is no such SimpleAttribute

update

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

parseValue

public Attribute parseValue(java.lang.String string)
Parameters:
string - the string which should be used for parsing
Returns:
the attribute which corresponds to the given string