ilog.rules.contrib.scorecard.xom
Class Scorecard

java.lang.Object
  extended by ilog.rules.contrib.scorecard.xom.Scorecard
All Implemented Interfaces:
java.io.Serializable

public class Scorecard
extends java.lang.Object
implements java.io.Serializable

Scorecard is a representation of the scorecard object model.

See Also:
Serialized Form

Constructor Summary
Scorecard()
           
 
Method Summary
 double formatNumber(double score, int precision)
          Rounds the score up or down to a specific precision level.
 java.util.List<IReason> getAllReasons()
          Returns all the reasons fired when this scorecard runs.
 java.util.Map<java.lang.String,IScorecardAttribute> getAttributes()
          Returns all the attributes contained in this scorecard.
 double getBaseScore()
          Returns the base score for this scorecard.
 double getFinalScore()
          Returns the final score.
 double getMaximumScore()
          Returns the maximum score for this scorecard.
 int getMaxReasonNum()
          Returns the maximum number of reasons to be returned.
 java.lang.String getName()
          Returns the display name for this scorecard.
 java.util.Map<java.lang.String,IReason> getOriginalReasons()
          Returns all reasons associated with this scorecard.
 java.util.List<IReason> getPotentialReasons()
          Returns the reasons fired but not contained in the result when getReasons() is called.
 java.lang.String getReasonDuplicationBy()
          Returns the reason duplication strategy.
 java.lang.String getReasonFilterBy()
          Returns the reason filtering strategy.
 java.lang.String getReasonOrderBy()
          Returns the reason ordering strategy.
 java.util.List<IReason> getReasons()
          Returns the reasons generated when this scorecard runs.
 IRejection getRejection()
          Returns the rejection instance associated with this scorecard.
 void print()
          Prints the execution result in the console.
 void reset()
          Resets this scorecard instance.
 void setAttributeExpectedScore(java.lang.String attrName, double expectedScore)
          Sets the expected score for a given attribute.
 void setAttributeMaxScore(java.lang.String attrName, double maxScore)
          Sets the maximum score for a given attribute.
 void setAttributeProperties(java.lang.String attrName, double maxScore, double expectedScore)
          Sets the properties for a given attribute.
 void setAttributeProperties(java.lang.String attrName, double weight, double maxScore, double expectedScore)
          Sets all properties for a given attribute.
 void setBaseScore(double baseScore)
          Sets the base score for this scorecard.
 void setComplexScorecard(ComplexScorecard complexScorecard)
          Adds this Scorecard instance to a complex scorecard.
 void setConditionalMeans(java.lang.String attrName, double conditionalMeans)
          Set the conditional means for the given attribute.
 void setMaximumScore(double maximumScore)
          Sets the maximum score for this scorecard.
 void setMaxReasonNum(int maxReasonNum)
          Sets the maximum number of reasons to be returned.
 void setName(java.lang.String name)
          Sets the name for this scorecard.
 void setReasonCode(java.lang.String attrName, double numTypeValue, java.lang.String reasonCode, java.lang.String description, int rank)
          Sets the reason properties for a given attribute.
 void setReasonCode(java.lang.String attrName, java.lang.String reasonCode, java.lang.String description, int rank)
          of Sets the reason properties for a given attribute.
 void setReasonDuplicationBy(java.lang.String reasonDuplicationBy)
          Sets the reason duplication strategy.
 void setReasonFilterBy(java.lang.String reasonFilterBy)
          Sets the reason filtering strategy.
 void setReasoningStrategy(java.lang.String strategyName)
          Sets the reasoning strategy.
 void setReasonOrderBy(java.lang.String reasonOrderBy)
          Sets the reason ordering strategy.
 void setRejection(java.lang.String rejectCode, java.lang.String description)
          Sets the rejection code and the description associated with this scorecard.
 void setScore(java.lang.String attrName, double score)
          Sets the score for a given attribute.
 void setScore(java.lang.String attrName, double score, double weight)
          Sets the score and weight for a given attribute.
 void setScoringStrategy(java.lang.String strategyName)
          Sets the scoring strategy.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Scorecard

public Scorecard()
Method Detail

formatNumber

public double formatNumber(double score,
                           int precision)
Rounds the score up or down to a specific precision level.

Parameters:
score - The original score.
precision - The precision level.
Returns:
The formatted score.

getAttributes

public java.util.Map<java.lang.String,IScorecardAttribute> getAttributes()
Returns all the attributes contained in this scorecard.

Returns:
All the attributes contained in this scorecard. Use attribute name as the key to sort through the map returned.

getBaseScore

public double getBaseScore()
Returns the base score for this scorecard.

Returns:
The base score.

getFinalScore

public double getFinalScore()
Returns the final score. To validate the result for single scorecard, you must call getRejection() before returning the score using this method. The following code example shows how to validate the scorecard:
 IRejection rejection = scorecardInst.getRejection();
 if (null == rejection)
        return scorecardInst.getFinalScore();
 else
        throw new Exception("The scorecard " + scorecardInst.getName() + "is rejected because of " + rejection.getDescription());
 

Returns:
The final score.

getMaximumScore

public double getMaximumScore()
Returns the maximum score for this scorecard.

Returns:
The maximum score for this scorecard.

getMaxReasonNum

public int getMaxReasonNum()
Returns the maximum number of reasons to be returned.

Returns:
The maximum number of reasons to be returned.

getName

public java.lang.String getName()
Returns the display name for this scorecard.

Returns:
The display name.

getOriginalReasons

public java.util.Map<java.lang.String,IReason> getOriginalReasons()
Returns all reasons associated with this scorecard.

Returns:
All reasons associated with this scorecard.

getPotentialReasons

public java.util.List<IReason> getPotentialReasons()
Returns the reasons fired but not contained in the result when getReasons() is called.

Returns:
The potential reasons.
See Also:
getReasons()

getReasonDuplicationBy

public java.lang.String getReasonDuplicationBy()
Returns the reason duplication strategy.

Returns:
The reason duplication strategy.

getReasonFilterBy

public java.lang.String getReasonFilterBy()
Returns the reason filtering strategy.

Returns:
The reason filtering strategy.

getReasonOrderBy

public java.lang.String getReasonOrderBy()
Returns the reason ordering strategy.

Returns:
The reason ordering strategy.

getReasons

public java.util.List<IReason> getReasons()
Returns the reasons generated when this scorecard runs.

Returns:
The reasons generated when this scorecard runs. The value returned may not contain all the reasons fired. This depends on the reasoning strategy used.

getAllReasons

public java.util.List<IReason> getAllReasons()
Returns all the reasons fired when this scorecard runs.

Returns:
the reasons generated when this scorecard runs. This method will return all the reasons used.

getRejection

public IRejection getRejection()
Returns the rejection instance associated with this scorecard. If the value returned is not null, the scorecard MUST be rejected.
Use this method in conjunction with getFinalScore() to test if a score is valid.

Returns:
The rejection instance associated with this scorecard object.
See Also:
getFinalScore()

print

public void print()
Prints the execution result in the console.


reset

public void reset()
Resets this scorecard instance.


setAttributeMaxScore

public void setAttributeMaxScore(java.lang.String attrName,
                                 double maxScore)
Sets the maximum score for a given attribute.

Parameters:
attrName - The attribute name.
maxScore - The maximum score for attrName.

setAttributeExpectedScore

public void setAttributeExpectedScore(java.lang.String attrName,
                                      double expectedScore)
Sets the expected score for a given attribute. determine

Parameters:
attrName - The attribute name.
expectedScore - The expected score for attrName.

setAttributeProperties

public void setAttributeProperties(java.lang.String attrName,
                                   double maxScore,
                                   double expectedScore)
Sets the properties for a given attribute.

Parameters:
attrName - The attribute name.
maxScore - The maximum score for attrName.
expectedScore - The expected score for attrName.

setAttributeProperties

public void setAttributeProperties(java.lang.String attrName,
                                   double weight,
                                   double maxScore,
                                   double expectedScore)
Sets all properties for a given attribute.

Parameters:
attrName - The attribute name.
weight - The weight for attrName.
maxScore - The maximum score for attrName.
expectedScore - The expected score for attrName.

setBaseScore

public void setBaseScore(double baseScore)
Sets the base score for this scorecard.

Parameters:
baseScore - The new base score.

setComplexScorecard

public void setComplexScorecard(ComplexScorecard complexScorecard)
Adds this Scorecard instance to a complex scorecard.

Parameters:
complexScorecard - The complex scorecard to add this Scorecard instance to.

setConditionalMeans

public void setConditionalMeans(java.lang.String attrName,
                                double conditionalMeans)
Set the conditional means for the given attribute.

Parameters:
attrName - The attribute name.
conditionalMeans - The conditional means for attrName.

setMaximumScore

public void setMaximumScore(double maximumScore)
Sets the maximum score for this scorecard.

Parameters:
maximumScore - The new maximum score.

setMaxReasonNum

public void setMaxReasonNum(int maxReasonNum)
Sets the maximum number of reasons to be returned.

Parameters:
maxReasonNum - The maximum number of reasons to be returned.

setName

public void setName(java.lang.String name)
Sets the name for this scorecard.

Parameters:
name - The new scorecard name.

setReasonCode

public void setReasonCode(java.lang.String attrName,
                          double numTypeValue,
                          java.lang.String reasonCode,
                          java.lang.String description,
                          int rank)
Sets the reason properties for a given attribute.

Parameters:
attrName - The attribute name.
numTypeValue - The attribute value for attrName.
reasonCode - The reason code for attrName.
description - The description for attrName.
rank - The rank for attrName.

setReasonCode

public void setReasonCode(java.lang.String attrName,
                          java.lang.String reasonCode,
                          java.lang.String description,
                          int rank)
of Sets the reason properties for a given attribute.

Parameters:
attrName - The attribute name.
reasonCode - The reason code for attrName.
description - The description for attrName.
rank - The rank for attrName.

setReasonDuplicationBy

public void setReasonDuplicationBy(java.lang.String reasonDuplicationBy)
Sets the reason duplication strategy.

Parameters:
reasonDuplicationBy - The new reason duplication strategy.

setReasonFilterBy

public void setReasonFilterBy(java.lang.String reasonFilterBy)
Sets the reason filtering strategy.

Parameters:
reasonFilterBy - The new reason filtering strategy.

setReasoningStrategy

public void setReasoningStrategy(java.lang.String strategyName)
Sets the reasoning strategy.

Parameters:
strategyName - The new strategy name

setReasonOrderBy

public void setReasonOrderBy(java.lang.String reasonOrderBy)
Sets the reason ordering strategy.

Parameters:
reasonOrderBy - The reason ordering strategy.

setRejection

public void setRejection(java.lang.String rejectCode,
                         java.lang.String description)
Sets the rejection code and the description associated with this scorecard.

Parameters:
rejectCode - The new rejection code.
description - The new description.

setScore

public void setScore(java.lang.String attrName,
                     double score)
Sets the score for a given attribute.

Parameters:
attrName - The attribute name.
score - The score associated with this attribute.

setScore

public void setScore(java.lang.String attrName,
                     double score,
                     double weight)
Sets the score and weight for a given attribute.

Parameters:
attrName - The attribute name.
score - The score for attrName.
weight - The weight for attrName.

setScoringStrategy

public void setScoringStrategy(java.lang.String strategyName)
Sets the scoring strategy.

Parameters:
strategyName - The new strategy name.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object