eu.xtreemos.xosd.resmng.data
Class NodeEvaluationLinearLimited

java.lang.Object
  extended by eu.xtreemos.xosd.resmng.data.NodeEvaluationLinearLimited
All Implemented Interfaces:
INodeEvaluation

public class NodeEvaluationLinearLimited
extends java.lang.Object
implements INodeEvaluation

The class evaluates the score as a linear function, limited with an upper and a lower bound. The linear function has a form of: y = k * attributeValue + n. The score has the value of lowerBound for y < lowerBound, upperBound for y > upperBound, and y otherwise.

Author:
matej.artac@xlab.si

Field Summary
protected  double k
          The slope of the linear function.
(package private) static org.apache.log4j.Logger logger
           
protected  double lowerBound
          The lowest possible value returned by the function.
protected  double n
          The offset in the y direction of the function.
protected  double upperBound
          The highest possible value returned by the function.
 
Constructor Summary
NodeEvaluationLinearLimited(double n, double k, double lowerBound, double upperBound)
          Initialise the evaluation function to be a linear function.
 
Method Summary
 double getScore(java.lang.Double attributeValue)
          Compute the score of the attribute value typed as Double.
 double getScore(java.lang.Object attributeValue)
          Compute the score of the attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.log4j.Logger logger

n

protected double n
The offset in the y direction of the function.


k

protected double k
The slope of the linear function.


lowerBound

protected double lowerBound
The lowest possible value returned by the function.


upperBound

protected double upperBound
The highest possible value returned by the function.

Constructor Detail

NodeEvaluationLinearLimited

public NodeEvaluationLinearLimited(double n,
                                   double k,
                                   double lowerBound,
                                   double upperBound)
Initialise the evaluation function to be a linear function.

Parameters:
n - The offset in the y direction of the function. This is the value of the function for attributeValue = 0;
k - The slope of the function.
lowerBound - The lowest possible value of the function.
upperBound - The highest possible value of the function.
Method Detail

getScore

public double getScore(java.lang.Double attributeValue)
Compute the score of the attribute value typed as Double.

Parameters:
attributeValue - The value of the attribute.
Returns:
The score of the attribute.

getScore

public double getScore(java.lang.Object attributeValue)
                throws java.security.InvalidParameterException
Compute the score of the attribute.

Specified by:
getScore in interface INodeEvaluation
Parameters:
attributeValue - The value of the attribute. Must be an instance of Double.
Returns:
The score of the attribute.
Throws:
java.security.InvalidParameterException