package ec.app.semanticGP.func.classification;

/**
 * @author Tomasz Pawlak
 */

import ec.gp.semantic.BooleanSemantics;
import ec.gp.semantic.ISemantics;
import ec.gp.semantic.func.BinaryNode;
import library.semantics.BitSet;

/**
 * @author Tomasz Pawlak
 */
public final class Neq extends BinaryNode<Boolean> {

	@Override
	protected ISemantics execute(ISemantics... arguments) {
		byte[] p0 = (byte[]) arguments[0].getValue();
		byte[] p1 = (byte[]) arguments[1].getValue();
		BitSet semantics = new BitSet(arguments[0].size());

		for (int i = 0; i < p0.length; ++i) {
			semantics.set(i, p0[i] != p1[i]);
		}

		return new BooleanSemantics(semantics);
	}

	@Override
	public Boolean[] invert(Boolean output, int missingArgIdx, Boolean... restOfArguments) {
		throw new UnsupportedOperationException("not implemented");
	}

	@Override
	public boolean isSymmetric() {
		return true;
	}

	@Override
	public String toString() {
		return "!=";
	}
}