public abstract class Porte2Entrees extends Porte { Composant in1,in2; Boolean s; void setIN1(Composant comp){in1= comp;} void setIN2(Composant comp){in2= comp;} public String description(){ String s1 ="non connecté"; String s2 ="non connecté"; if(in1!=null){s1=in1.getId();} if(in2!=null){s2=in2.getId();} return getId() +" ||in1: " + s1 +" ||in2: "+ s2; } public abstract boolean eval()throws NonConnecteException; public void probe(SondesTable tableSondes){ if(in1 instanceof Interrupteur){ tableSondes.getSonde((Interrupteur)in1,in1,in1.getId()); } if(in2 instanceof Interrupteur){ tableSondes.getSonde((Interrupteur)in2,in2,in2.getId()); } } public void unprobe(SondesTable tableSondes){ if(in1 instanceof LazySonde){ tableSondes.getInterrupteur((LazySonde)in1); } if(in2 instanceof LazySonde){ tableSondes.getInterrupteur((LazySonde)in2); } } /*public boolean getEtat() throws NonConnecteException { if ((this.in1 == null) || (this.in2 == null)) { throw new NonConnecteException(); } else if(s==null) { s=this.eval(); return s; } else{ return s;} }*/ public boolean getEtat() throws NonConnecteException { if ((this.in1 == null) || (this.in2 == null)) { throw new NonConnecteException(); } else { return this.eval(); } }