package ec.gp.semantic.geometry;

import library.semantics.*;
import ec.gp.semantic.*;

public class UnbiasedBooleanMidpointProvider implements IMidpointProvider<Boolean> {

	@Override
	public DesiredSemanticsBase<Boolean> getMidpoint(ISemantics semantics1, ISemantics semantics2) {
		BitSet s1 = (BitSet) semantics1.getValue();
		BitSet s2 = (BitSet) semantics2.getValue();

		BooleanDesiredSemantics ds = new BooleanDesiredSemantics(s1.length());
		for (int i = 0; i < s1.length(); ++i) {
			if (s1.get(i) == s2.get(i)) {
				ds.addValues(i, s1.get(i));
			} else {
				//ds.markDontCare(i);
				assert ds.getValuesFor(i).size() == 0; // == don't care
				//ds.markInconsistent(i);
			}
		}
		
		return ds;
	}

}
