de.dfki.mycbr.core.casebase
Class SpecialRange

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

public final class SpecialRange
extends SymbolRange

Range that holds all possible special values of the given project.

Author:
myCBR Team

Constructor Summary
SpecialRange(Project prj, SymbolDesc desc, java.util.Collection<java.lang.String> allowedValues)
           
 
Method Summary
 SymbolAttribute addSymbolValue(java.lang.String value)
           
 int compare(SpecialAttribute att1, SpecialAttribute att2)
          Compares the given attributes according to a linear order.
 Attribute getAttribute(java.lang.Object obj)
          Gets the attribute associated with the specified Object obj.
 java.lang.Integer getIndexOf(SpecialAttribute att)
          Returns the index of the given attribute.
 
Methods inherited from class de.dfki.mycbr.core.casebase.SymbolRange
getHighestIndex, getIndexes, getIndexOf, getSymbols, getSymbolValue, initIndexes, removeAttribute, renameSymbol, setHighestIndex, setIndexes, update
 
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

SpecialRange

public SpecialRange(Project prj,
                    SymbolDesc desc,
                    java.util.Collection<java.lang.String> allowedValues)
Parameters:
prj - the project this range belongs to
desc - the description this range belongs to
allowedValues - the allowed values for this range
Method Detail

compare

public int compare(SpecialAttribute att1,
                   SpecialAttribute att2)
Compares the given attributes according to a linear order. This linear order is used for indexing symbol attributes. By default, the first attribute specified in the given symbol description is the smallest element in the linear order.

Parameters:
att1 - the first attribute to be compared with the second
att2 - the second attribute
Returns:
-2 if one of the attributes does not occur in this range, -1 if the first attribute is smaller than the second, 0 if they are equal, 1 else

getIndexOf

public java.lang.Integer getIndexOf(SpecialAttribute att)
Returns the index of the given attribute. Returns null, If the attribute is not maintained by this range.

Parameters:
att - the attribute whose index should be returned
Returns:
index of the given att, null if this attribute is unknown

addSymbolValue

public final SymbolAttribute addSymbolValue(java.lang.String value)
Overrides:
addSymbolValue in class SymbolRange
Parameters:
value - the value of the new symbol attribute
Returns:
the new symbol attribute with value value

getAttribute

public final Attribute getAttribute(java.lang.Object obj)
Gets the attribute associated with the specified Object obj. obj is expected to be of type String. Returns result of SymbolRange.getSymbolValue(String) if obj is of type String, else returns null. Is needed for MultipleRange.

Overrides:
getAttribute in class SymbolRange
Parameters:
obj - representing String or SpecialValue
Returns:
SimpleAttribute that corresponds to obj, null if there is no such SimpleAttribute