java/ch/wlkl/processor/Gate.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ch.wlkl.processor;
import java.util.ArrayList;
/**
*
* @author walter
*/
public class Gate {
public final static Gate cFalse = new Gate(false);
public final static Gate cTrue = new Gate(true);
public final static Gate[] cArTrue = {cTrue};
boolean val;
ArrayList<Gate> out = new ArrayList();
public Gate() {
val = false;
}
public Gate(boolean v) {
val = v;
}
public void addOut(Gate c) {
out.add(c);
c.update();
}
public boolean get() {
return val;
}
public void set(boolean v) {
if (v == val)
return;
val = v;
propagate();
}
public void propagate() {
for (Gate out1 : out) {
out1.update();
}
}
void update() {
System.out.println("implement");
int i = 1 / 0;
}
}