// Porte OU Exclusif, herite de Composant
public class Xor extends Composant {

	static int n = 1;
	
	public Xor(int n_in, int n_out){
		super(n_in, n_out);
		charName 	  = "^";
		composantName = "Xor";
		Name		  = "Xor_"+(n++);
	}
	
	protected void doWork() {
		boolean state = false;
		for(Pin pin : pin_in){
			if(!pin.isOn()) continue;
			if(state){
				state = false;
				break;
			}
			state = true;
		}
		
		for(Pin pin : pin_out)
			pin.setState(state);
	}

}
