package com.hammurapi.reasoning.impl;

import java.util.List;

import com.hammurapi.config.bootstrap.ConfigurationException;

public abstract class ReasoningTransitionBase<F> implements com.hammurapi.flow.runtime.Transition<KnowledgeBase<F>,InferenceToken<F>> {

	private int ruleIndex = -1;
	protected Object rule;
	protected KnowledgeBase<F> knowledgeBase;
	
	public void setRuleIndex(int ruleIndex) {
		this.ruleIndex = ruleIndex;
	}

	public void setRules(List<?> rules) throws ConfigurationException {
		if (ruleIndex!=-1) {
			this.rule = rules.get(ruleIndex);
		}
	}

	public void setKnowledgeBase(KnowledgeBase<F> knowledgeBase) {
		this.knowledgeBase = knowledgeBase;		
	}
	
	@Override
	public void beforeConnect() throws ConfigurationException {
		// NOP		
	}
	
	@Override
	public void afterConnect() throws ConfigurationException {
		// NOP, override as needed.
	}
	
}
