    001    package com.hammurapi.reasoning.impl;
    002
    003    import java.util.List;
    004
    005    import com.hammurapi.config.bootstrap.ConfigurationException;
    006
    007    public abstract class ReasoningTransitionBase<F> implements com.hammurapi.flow.runtime.Transition<KnowledgeBase<F>,InferenceToken<F>> {
    008
    009            private int ruleIndex = -1;
    010            protected Object rule;
    011            protected KnowledgeBase<F> knowledgeBase;
    012
    013            public void setRuleIndex(int ruleIndex) {
    014                    this.ruleIndex = ruleIndex;
    015            }
    016
    017            public void setRules(List<?> rules) throws ConfigurationException {
    018                    if (ruleIndex!=-1) {
    019                            this.rule = rules.get(ruleIndex);
    020                    }
    021            }
    022
    023            public void setKnowledgeBase(KnowledgeBase<F> knowledgeBase) {
    024                    this.knowledgeBase = knowledgeBase;
    025            }
    026
    027            @Override
    028            public void beforeConnect() throws ConfigurationException {
    029                    // NOP
    030            }
    031
    032            @Override
    033            public void afterConnect() throws ConfigurationException {
    034                    // NOP, override as needed.
    035            }
    036
    037    }