eu.xtreemos.xosd.resmng.data
Class AttributeScorekeeper

java.lang.Object
  extended by eu.xtreemos.xosd.resmng.data.AttributeScorekeeper

public class AttributeScorekeeper
extends java.lang.Object

An auxiliary structure for storing the score of the attribute in a related record. The class contains a sum of positive scores and the count of the occurrences that contributed to the score.

Author:
matej.artac@xlab.si

Field Summary
protected  int attribute
          The identifier that tells which attribute the score is for.
protected  int contributionCount
          The number of nodes that contributed to the scoreAccum.
protected  double scoreAccum
          The sum of all relevant scores computed
 
Constructor Summary
AttributeScorekeeper(int attribute, double scoreAccum)
          Intialise the first occurrence of the attribute's score.
AttributeScorekeeper(int attribute, double scoreAccum, int contributionCount)
          Initialise the class by passing all of the class's field values.
 
Method Summary
 void addScore(double scoreToAdd)
           
 void addScore(double scoreToAdd, int countToAdd)
           
 int getAttribute()
           
 int getContributionCount()
           
 double getScoreAccum()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attribute

protected int attribute
The identifier that tells which attribute the score is for.


scoreAccum

protected double scoreAccum
The sum of all relevant scores computed


contributionCount

protected int contributionCount
The number of nodes that contributed to the scoreAccum.

Constructor Detail

AttributeScorekeeper

public AttributeScorekeeper(int attribute,
                            double scoreAccum)
Intialise the first occurrence of the attribute's score.

Parameters:
attribute -
scoreAccum -

AttributeScorekeeper

public AttributeScorekeeper(int attribute,
                            double scoreAccum,
                            int contributionCount)
Initialise the class by passing all of the class's field values.

Parameters:
attribute - Identifies the attribute.
scoreAccum - A sum of scores accumulated so far. Use a negative value to denote the attribute took part in the query evaluation, but did not fit the subexpression.
contributionCount - The number of times the attribute has been evaluated. The value has to be 0 if scoreAccum is negative.
Method Detail

getAttribute

public int getAttribute()

getContributionCount

public int getContributionCount()

getScoreAccum

public double getScoreAccum()

addScore

public void addScore(double scoreToAdd)

addScore

public void addScore(double scoreToAdd,
                     int countToAdd)