Not.java 729 Bytes
/**
 *
 * @author Bernard.Carre@polytech-lille.fr
 */

public class Not extends Porte {

    protected Composant in;

    public void setIn(Composant comp) {
	in = comp;
    }
    public void probe(SondesTable tableSondes){
	if(in instanceof Interrupteur){
	    setIn(tableSondes.getSonde((Interrupteur)in,in,in.getId()));
	}
    }
    public String description(){
	return getId() + " ||in: "+ in.getId();
    }


    public boolean getEtat() throws NonConnecteException {

	if (in == null) {

	    throw new NonConnecteException();

	} else {

	    return !in.getEtat();

	}
    }
    public void unprobe(SondesTable tableSondes){
	if(in instanceof LazySonde){
	    setIn(tableSondes.getInterrupteur((LazySonde)in));
	}
    }
}