src/creator/AigerCircuit.java
public Pair<Boolean,ArrayList<Boolean>> compute(ArrayList<Boolean> einput, ArrayList<Boolean> cinput, ArrayList<Boolean> oldstate) 
			throws IllegalArgumentException {
		if (einput.size() != environmentIndexes.size())
			throw new IllegalArgumentException("Environment vector wrong dimension!");
		if (cinput.size() != controllerIndexes.size())
			throw new IllegalArgumentException("Controller vector wrong dimension!");		
		if (oldstate.size() != latchIndexes.size())
			throw new IllegalArgumentException("Old state vector wrong dimension!");
		
		for (int j=0; j<einput.size(); j++)
			inputs.get(environmentIndexes.get(j)).value = einput.get(j);
		for (int j=0; j<cinput.size(); j++)
			inputs.get(controllerIndexes.get(j)).value = cinput.get(j);
		for (int j=0; j<l; j++)
			latches.get(latchIndexes.get(j)).value = oldstate.get(j);
		
		for (int key : andgates.keySet())
			andgates.get(key).ready = false;
		
		AigerCircuit circuit = AigerCircuit.getInstance();
		
		Boolean result = false;
		if (o % 2 == 0) {
			if (circuit.inputs.containsKey(o))
				result = circuit.inputs.get(o).value;
			if (circuit.andgates.containsKey(o))
				result = circuit.andgates.get(o).getValue();
			if (circuit.latches.containsKey(o))
				result = circuit.latches.get(o).value;
		} else {
			if (o == 1) result = true;
			if (circuit.inputs.containsKey(o-1))
				result = !(circuit.inputs.get(o-1).value);
			if (circuit.andgates.containsKey(o-1))
				result = !(circuit.andgates.get(o-1).getValue());
			if (circuit.latches.containsKey(o-1))
				result = !(circuit.latches.get(o-1).value);
		}
		
		ArrayList<Boolean> newstate = new ArrayList<Boolean>(l);
		for (int j=0; j<l; j++)
			newstate.add(latches.get(latchIndexes.get(j)).getNewValue());
		
		return new Pair<Boolean,ArrayList<Boolean>>(result,newstate);
	}
/** Executes the circuit, updates the latches and obtains the output
	 * @param einput	Environment bits input
	 * @param cinput	Controller bits input
	 * @param oldstate	Previous latch bit values
	 * @return			Output bit and new latch bit values
	 * */
Executes the circuit, updates the latches and obtains the output
@param einput        Environment bits input
@param cinput        Controller bits input
@param oldstate      Previous latch bit values
@return                      Output bit and new latch bit values
Executes the circuit updates the latches and obtains the output @param einput Environment bits input @param cinput Controller bits input @param oldstate Previous latch bit values @return Output bit and new latch bit values
public Pair<Boolean,ArrayList<Boolean>> compute(ArrayList<Boolean> einput, ArrayList<Boolean> cinput, ArrayList<Boolean> oldstate) 
			throws IllegalArgumentException {
		if (einput.size() != environmentIndexes.size())
			throw new IllegalArgumentException("Environment vector wrong dimension!");
		if (cinput.size() != controllerIndexes.size())
			throw new IllegalArgumentException("Controller vector wrong dimension!");		
		if (oldstate.size() != latchIndexes.size())
			throw new IllegalArgumentException("Old state vector wrong dimension!");
		for (int j=0; j<einput.size(); j++)
			inputs.get(environmentIndexes.get(j)).value = einput.get(j);
		for (int j=0; j<cinput.size(); j++)
			inputs.get(controllerIndexes.get(j)).value = cinput.get(j);
		for (int j=0; j<l; j++)
			latches.get(latchIndexes.get(j)).value = oldstate.get(j);
		for (int key : andgates.keySet())
			andgates.get(key).ready = false;
		AigerCircuit circuit = AigerCircuit.getInstance();
		Boolean result = false;
		if (o % 2 == 0) {
			if (circuit.inputs.containsKey(o))
				result = circuit.inputs.get(o).value;
			if (circuit.andgates.containsKey(o))
				result = circuit.andgates.get(o).getValue();
			if (circuit.latches.containsKey(o))
				result = circuit.latches.get(o).value;
		} else {
			if (o == 1) result = true;
			if (circuit.inputs.containsKey(o-1))
				result = !(circuit.inputs.get(o-1).value);
			if (circuit.andgates.containsKey(o-1))
				result = !(circuit.andgates.get(o-1).getValue());
			if (circuit.latches.containsKey(o-1))
				result = !(circuit.latches.get(o-1).value);
		}
		ArrayList<Boolean> newstate = new ArrayList<Boolean>(l);
		for (int j=0; j<l; j++)
			newstate.add(latches.get(latchIndexes.get(j)).getNewValue());
		return new Pair<Boolean,ArrayList<Boolean>>(result,newstate);
	}
public Pair < Boolean , ArrayList < Boolean > > compute ( ArrayList < Boolean > einput , ArrayList < Boolean > cinput , ArrayList < Boolean > oldstate ) throws IllegalArgumentException { if ( einput . size ( ) != environmentIndexes . size ( ) ) throw new IllegalArgumentException ( "Environment vector wrong dimension!" ) ; if ( cinput . size ( ) != controllerIndexes . size ( ) ) throw new IllegalArgumentException ( "Controller vector wrong dimension!" ) ; if ( oldstate . size ( ) != latchIndexes . size ( ) ) throw new IllegalArgumentException ( "Old state vector wrong dimension!" ) ; for ( int j = 0 ; j < einput . size ( ) ; j ++ ) inputs . get ( environmentIndexes . get ( j ) ) . value = einput . get ( j ) ; for ( int j = 0 ; j < cinput . size ( ) ; j ++ ) inputs . get ( controllerIndexes . get ( j ) ) . value = cinput . get ( j ) ; for ( int j = 0 ; j < l ; j ++ ) latches . get ( latchIndexes . get ( j ) ) . value = oldstate . get ( j ) ; for ( int key : andgates . keySet ( ) ) andgates . get ( key ) . ready = false ; AigerCircuit circuit = AigerCircuit . getInstance ( ) ; Boolean result = false ; if ( o % 2 == 0 ) { if ( circuit . inputs . containsKey ( o ) ) result = circuit . inputs . get ( o ) . value ; if ( circuit . andgates . containsKey ( o ) ) result = circuit . andgates . get ( o ) . getValue ( ) ; if ( circuit . latches . containsKey ( o ) ) result = circuit . latches . get ( o ) . value ; } else { if ( o == 1 ) result = true ; if ( circuit . inputs . containsKey ( o - 1 ) ) result = ! ( circuit . inputs . get ( o - 1 ) . value ) ; if ( circuit . andgates . containsKey ( o - 1 ) ) result = ! ( circuit . andgates . get ( o - 1 ) . getValue ( ) ) ; if ( circuit . latches . containsKey ( o - 1 ) ) result = ! ( circuit . latches . get ( o - 1 ) . value ) ; } ArrayList < Boolean > newstate = new ArrayList < Boolean > ( l ) ; for ( int j = 0 ; j < l ; j ++ ) newstate . add ( latches . get ( latchIndexes . get ( j ) ) . getNewValue ( ) ) ; return new Pair < Boolean , ArrayList < Boolean > > ( result , newstate ) ; }
Executes the circuit, updates the latches and obtains the output
 @param einput        Environment bits input
 @param cinput        Controller bits input
 @param oldstate      Previous latch bit values
 @return                      Output bit and new latch bit values
Executes the circuit updates the latches and obtains the output @param einput Environment bits input @param cinput Controller bits input @param oldstate Previous latch bit values @return Output bit and new latch bit values