|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecteu.xtreemos.xosd.resmng.data.ConditionTreeCondition
public class ConditionTreeCondition
A class that implements the comparison of the end values that represent a resource against the conditions passed as the parameter. An instance of ConditionTreeCondition is a leaf node of the condition tree.
Field Summary | |
---|---|
protected int |
attribute
Identifies which attribute the node refers to. |
protected int |
conditionType
The type of condition. |
static int |
EXACT
This value represents a condition type where the value in the resource descriptor must be equal to the value of the node: x == E. |
static int |
GREATERANDEQUALTO
This value represents a condition type where the value in the resource descriptor must be greater than or equal to the value of the node: x >= U. |
static int |
GREATERTHAN
This value represents a condition type where the value in the resource descriptor must be greater than the value of the node: x > U. |
protected boolean |
hasBeenEvaluated
True if a call to evaluateNode() has been performed, and
false otherwise. |
(package private) static org.apache.log4j.Logger |
logger
|
static int |
LOWERANDEQUALTO
This value represents a condition type where the value in the resource descriptor must be lower than or equal to the value of the node: x <= U. |
static int |
LOWERTHAN
This value represents a condition type where the value in the resource descriptor must be lower than the value of the node: x < U. |
static int |
NODECPUARCHITECTURENAME
This value represents the node attribute which refers to the CPU architecture name (instruction set). |
protected INodeEvaluation |
nodeEvaluationFunction
The class implementing an evaluation function for scoring the resource against the resource query. |
static int |
NODEINDIVIDUALCPUCOUNT
This value represents the node attribute which refers to the number of physical CPUs in the host. |
static int |
NODEINDIVIDUALCPUSPEED
This value represents the node attribute which refers to the individual CPU speed. |
static int |
NODEINDIVIDUALPHYSICALRAM
This value represents the node attribute refers to the individual physical RAM. |
static int |
NODEOSSYSTEMNAME
This value represents the node attribute which refers to the OS system name. |
protected java.lang.Object |
referenceValue
The value we compare the resource against. |
Constructor Summary | |
---|---|
ConditionTreeCondition(double reference,
int attribute,
int conditionType)
|
|
ConditionTreeCondition(java.lang.String reference,
int attribute)
Instantiate a condition tree lead node that represents the comparison of a case insensitive equality to the string provided as the reference value of the node. |
Method Summary | |
---|---|
protected boolean |
evalExact(java.lang.Object value)
|
protected boolean |
evalGreaterThan(java.lang.Double value,
boolean excl)
|
protected boolean |
evalLowerThan(java.lang.Double value,
boolean excl)
|
boolean |
evaluateNode(ResourceDescriptorRecord resource)
Check the compliance of the input resource with the node of the condition subtree originating from this node. |
double |
evaluateScore(ResourceDescriptorRecord resource)
Check the compliance of the input resource with the node of the condition subtree originating from this node, and evaluate the score of the resource. |
double |
evaluateScore(ResourceDescriptorRecord resource,
java.util.Hashtable<java.lang.Integer,java.lang.Double> attributeWeight)
Check the compliance of the input resource with the node of the condition subtree originating from this node, and evaluate the score of the resource. |
int |
getAttribute()
|
int |
getConditionType()
|
protected java.lang.Object |
getMatchingResourceValue(ResourceDescriptorRecord resource)
Returns the value of the resource attribute that corresponds the condition tree node's attribute. |
INodeEvaluation |
getNodeEvaluationFunction()
|
java.lang.Object |
getReferenceValue()
|
boolean |
getSubtreeScorekeeper(ResourceDescriptorRecord resource,
java.util.Hashtable<java.lang.Integer,AttributeScorekeeper> scorekeepers)
The method builds a hash table of AttributeScorekeeper instances for each of the attribute that takes part in the subtree of the condition tree that starts at the provided node. |
void |
setNodeEvaluationFunction(INodeEvaluation nodeEvaluationFunction)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static org.apache.log4j.Logger logger
public static final int EXACT
public static final int LOWERTHAN
public static final int GREATERTHAN
public static final int LOWERANDEQUALTO
public static final int GREATERANDEQUALTO
public static final int NODEOSSYSTEMNAME
public static final int NODECPUARCHITECTURENAME
public static final int NODEINDIVIDUALCPUSPEED
public static final int NODEINDIVIDUALCPUCOUNT
public static final int NODEINDIVIDUALPHYSICALRAM
protected int conditionType
protected java.lang.Object referenceValue
protected int attribute
protected boolean hasBeenEvaluated
evaluateNode()
has been performed, and
false otherwise.
protected INodeEvaluation nodeEvaluationFunction
Constructor Detail |
---|
public ConditionTreeCondition(java.lang.String reference, int attribute)
reference
- The value to test the resources against.attribute
- Identifies which attribute the node refers to. Use the
NODE* static members.public ConditionTreeCondition(double reference, int attribute, int conditionType)
Method Detail |
---|
protected boolean evalExact(java.lang.Object value)
protected boolean evalLowerThan(java.lang.Double value, boolean excl)
protected boolean evalGreaterThan(java.lang.Double value, boolean excl)
public boolean evaluateNode(ResourceDescriptorRecord resource) throws java.lang.IllegalArgumentException
IConditionTreeNode
evaluateNode
in interface IConditionTreeNode
resource
- The resource to check the compliance of.
java.lang.IllegalArgumentException
public double evaluateScore(ResourceDescriptorRecord resource) throws java.lang.IllegalArgumentException
evaluateScore
in interface IConditionTreeNode
resource
- The resource to check the compliance of.
java.lang.IllegalArgumentException
public double evaluateScore(ResourceDescriptorRecord resource, java.util.Hashtable<java.lang.Integer,java.lang.Double> attributeWeight) throws java.lang.IllegalArgumentException
IConditionTreeNode
evaluateScore
in interface IConditionTreeNode
resource
- The resource to check the compliance of.attributeWeight
- A hash table of pairs (attribute identifier,
the weight)
java.lang.IllegalArgumentException
public boolean getSubtreeScorekeeper(ResourceDescriptorRecord resource, java.util.Hashtable<java.lang.Integer,AttributeScorekeeper> scorekeepers)
getSubtreeScorekeeper
in interface IConditionTreeNode
resource
- The resource record to get the scores of.scorekeepers
- The hash table that receives the attribute's scores.
The contents of the hash table will change during the call execution.
The method encounters a single attribute, and thus it updates a single
entry in the hash table. If the
attribute fits the condition of the node, the evaluated attribute's score
will be added to the hashtable, otherwise a negative score will be noted
if the attribute does not have any entry in the hash table before the
call of the method.
protected java.lang.Object getMatchingResourceValue(ResourceDescriptorRecord resource)
resource
- The descriptor record to retrieve the matching value
from.
public INodeEvaluation getNodeEvaluationFunction()
public void setNodeEvaluationFunction(INodeEvaluation nodeEvaluationFunction)
public int getConditionType()
public java.lang.Object getReferenceValue()
public int getAttribute()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |