package com.hammurapi.extract;

import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;

/**
 * Base class for extractors.
 * @author Pavel Vlasov
 *
 * @param <T>
 * @param <V>
 * @param <C>
 */
public abstract class AbstractExtractor<T, V, C> extends ExtractorBase<T, V, C> {		

	private Set<Integer> parameterIndices;
	private boolean contextDependent;
	
	public AbstractExtractor(double initialCost, TimeUnit costUnit, boolean contextDependent, int... parameterIndices) {
		super(initialCost, costUnit);
		Set<Integer> pi = new TreeSet<Integer>();
		for (int idx:parameterIndices) {
			pi.add(idx);
		}
		this.parameterIndices=Collections.unmodifiableSet(pi);
		this.contextDependent=contextDependent;
	}

	@Override
	public Set<Integer> parameterIndices() {
		return parameterIndices;
	}

	@Override
	public boolean isContextDependent() {
		return contextDependent;
	}

}
