eu.xtreemos.xosd.resmng.data
Interface IConditionTreeNode

All Known Implementing Classes:
ConditionTreeCondition, ConditionTreeOperator

public interface IConditionTreeNode

An interface to represent a node in a condition tree of the resource matcher. The condition tree represents a query for resources.

Version:
0.1
Author:
matej.artac@xlab.si

Method Summary
 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.
 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.
 

Method Detail

evaluateNode

boolean evaluateNode(ResourceDescriptorRecord resource)
                     throws java.lang.IllegalArgumentException
Check the compliance of the input resource with the node of the condition subtree originating from this node.

Parameters:
resource - The resource to check the compliance of.
Returns:
True if the resource fits the conditions of the condition subtree, and false otherwise.
Throws:
java.lang.IllegalArgumentException

evaluateScore

double evaluateScore(ResourceDescriptorRecord resource)
                     throws java.lang.IllegalArgumentException
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. Higher values of the score mean better compliance with the query. The attributes have uniform influence to the score.

Parameters:
resource - The resource to check the compliance of.
Returns:
The score of the resource. The higher the score, the better the resource fits the query. Returns -1 for resources that do not fit the conditions of the query.
Throws:
java.lang.IllegalArgumentException

evaluateScore

double evaluateScore(ResourceDescriptorRecord resource,
                     java.util.Hashtable<java.lang.Integer,java.lang.Double> attributeWeight)
                     throws java.lang.IllegalArgumentException
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. Higher values of the score mean better compliance with the query. The attributes have uniform influence to the score.

Parameters:
resource - The resource to check the compliance of.
attributeWeight - A hash table of pairs (attribute identifier, the weight)
Returns:
The score of the resource. The higher the score, the better the resource fits the query. Returns -1 for resources that do not fit the conditions of the query.
Throws:
java.lang.IllegalArgumentException

getSubtreeScorekeeper

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. The caller function should pass an already initialised Hashtable. The implementations of the method should ensure that at the end of its execution the hash table will contain the entries for all attributes ecountered in the subtree. If the condition subtree evaluates as false, then the attributes in the subtree that have no entries in the hash table before the call should appear in the hash table with negative scores and zero occurence counts.

Parameters:
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. If the subtree yields that the record complies with the respective subpart of the query, then the hash table should be updated with the scores computed at the leaf nodes. If it yields non-complience, then the attribute entries already in the hash table should be left intact, and those encountered in the subtree that do not appear in the hash table have to be tagged with negative scores and zero occurence counts.
Returns:
True if the resource fits the conditions of the condition subtree, and false otherwise.