/**
 * 
 */
package com.hammurapi.reasoning.impl;

import com.hammurapi.flow.runtime.Invocable;
import com.hammurapi.flow.runtime.Invoker;

class Output<F> implements Invoker<KnowledgeBase<F>, InferenceToken<F>>, Comparable<Output<F>> {

	Invocable<KnowledgeBase<F>,InferenceToken<F>> invocable;
	private Integer priority;
	PinEntry<F> pinEntry;
	
	public Output(PinEntry<F> pinEntry, Integer priority) {
		if (priority==null) {
			throw new NullPointerException("Priority is not set");
		}
		this.priority = priority;
		this.pinEntry = pinEntry;
	}

	@Override
	public void setInvocable(Invocable<KnowledgeBase<F>, InferenceToken<F>> invocable) throws IllegalStateException {
		this.invocable = invocable;			
	}

	@Override
	public int compareTo(Output<F> o) {
		return o.priority - priority;
	}
	
}