com.sri.emo.controller
Class DecisionMatrix

java.lang.Object
  extended by com.sri.emo.controller.DecisionMatrix

public class DecisionMatrix
extends Object

Class that allows for execution of the decision matrix. It pre-parses the database objects so that when getDecision() is called, it is much faster.

Performance Note: Working with the Decision Matrix is not a simple task since very few things are constant. Picking a result from a decision matrix requires a lot of set manipulation or database reads. For performance, this implementation goes with high memory usage and few database reads. CPU-wise, it is an O(n^2) algorithm, so it may not scale over large models.

Memory optimization is possible, but has been not performed for construction speed's sake at this point in time.

Author:
Michael Rimov

Constructor Summary
DecisionMatrix(int wizardId)
          Constructor that takes a wizard id as an argument.
DecisionMatrix(String wizardId)
          Constructor that takes a wizard id as an argument.
 
Method Summary
 WizDecisionSet getDecision(Map decisionRow)
          Retrieves the decision.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecisionMatrix

public DecisionMatrix(String wizardId)
               throws DBException
Constructor that takes a wizard id as an argument. The constructor takes quite a bit of pre-processing work, executing a joined statement and parsing the results into the allItems map.

Parameters:
wizardId - the wizard id.
Throws:
DBException - upon database error.

DecisionMatrix

public DecisionMatrix(int wizardId)
               throws DBException
Constructor that takes a wizard id as an argument. The constructor takes quite a bit of pre-processing work, executing a joined statement and parsing the results into the allItems map.

Parameters:
wizardId - int the wizard id.
Throws:
DBException - upon database error.
Method Detail

getDecision

public WizDecisionSet getDecision(Map decisionRow)
                           throws DBException
Retrieves the decision. Retrieves a WizDecisionMatrix instance or null if no node matches the decision specified.

Parameters:
decisionRow - Map that has a key of the Wizard Step Id (as Integer), and the value as the picked key value from the picklist (or attribute). (Also as Integer)
Returns:
WizDecisionMatrix or null if there are no matches.
Throws:
DBException - upon database access error.


Copyright © 2004-2006 Codeguild, Inc.. All Rights Reserved.