public void setState(int pin, boolean state) {
		if (pin >= 0 && pin <= this.pins) {
			this.states[pin] = state;
			if (!state) {
				if (this.connections[pin] != null) {
					this.connections[pin].delete();
					this.connections[pin] = null;
					this.circuit.getSimulation().addEvent(this.topnode[pin], 0);
					this.circuit.getSimulation().addEvent(this.bottomnode[pin], 0);
				}
			} else if (this.connections[pin] == null) {
				if (!NodeType.conflicts(this.topnode[pin].getType(), this.bottomnode[pin].getType())) {
					this.connections[pin] = new Potential(this.topnode[pin], this.bottomnode[pin]);
					this.circuit.getSimulation().addEvent(this.topnode[pin], 0);
				} else {
					this.setState(pin, false);
				}
			}
		}
	}