org.apache.lens.server.api.priority
Class RangeConf<K extends Comparable<K>,V>

java.lang.Object
  extended by org.apache.lens.server.api.priority.RangeConf<K,V>
Type Parameters:
K - Key type. Integer in the grade range example
V - Value Type. String(or a Grade class) in the grade range example
Direct Known Subclasses:
CostToPriorityRangeConf

public abstract class RangeConf<K extends Comparable<K>,V>
extends Object

Class for storing range configurations. An Example would be grading system. The value F,30,D,40,C,60,B,80,A corresponds to a system where - inf < marks <= 30 : F 30 < marks <= 40 : D 40 < marks <= 60 : C 60 < marks <= 80 : B 80 < marks <= + Inf : A

rangeConfInstance.get(marks) would give you the grade depending on the range.

The utility is for easily storing range configs in config xml files.

Implementation is done by storing the least value(floor) and keeping a treemap on rest of values


Method Summary
 V get(K key)
          Get method.
 String toString()
          toString representation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

get

public V get(K key)
Get method.

Parameters:
key -
Returns:
the value depending on which range the key lies in

toString

public String toString()
toString representation

Overrides:
toString in class Object
Returns:
string representation


Copyright © 2014–2015 Apache Software Foundation. All rights reserved.