private com.relteq.sirius.jaxb.Phase restorePhase(Phases db_ph) throws TorqueException { com.relteq.sirius.jaxb.Phase phase = factory.createPhase(); phase.setNema(BigInteger.valueOf(db_ph.getNema())); phase.setProtected(db_ph.getIsProtected()); phase.setPermissive(db_ph.getPermissive()); phase.setLag(db_ph.getLag()); phase.setRecall(db_ph.getRecall()); phase.setMinGreenTime(db_ph.getMinGreenTime()); phase.setYellowTime(db_ph.getYellowTime()); phase.setRedClearTime(db_ph.getRedClearTime()); @SuppressWarnings("unchecked") List<PhaseLinks> db_phl_l = db_ph.getPhaseLinkss(); com.relteq.sirius.jaxb.LinkReferences linkrefs = factory.createLinkReferences(); for (PhaseLinks db_phl : db_phl_l) linkrefs.getLinkReference().add(restorePhaseLink(db_phl)); phase.setLinkReferences(linkrefs); return phase; }
protected final void populateFromJaxb( Scenario myScenario, com.relteq.sirius.jaxb.Phase jaxbPhase) { int numlinks = jaxbPhase.getLinks().getLinkReference().size(); this.targetlinks = new Link[numlinks]; for (int i = 0; i < numlinks; i++) { com.relteq.sirius.jaxb.LinkReference linkref = jaxbPhase.getLinks().getLinkReference().get(i); targetlinks[i] = myScenario.getLinkWithId(linkref.getId()); } if (jaxbPhase.getNema() != null) myNEMA = Signal.String2NEMA(jaxbPhase.getNema().toString()); else myNEMA = Signal.NEMA.NULL; if (jaxbPhase.getMinGreenTime() != null) this.mingreen = jaxbPhase.getMinGreenTime().floatValue(); else this.mingreen = Defaults.mingreen; if (jaxbPhase.getRedClearTime() != null) this.redcleartime = jaxbPhase.getRedClearTime().floatValue(); else this.redcleartime = Defaults.redcleartime; if (jaxbPhase.getYellowTime() != null) this.yellowtime = jaxbPhase.getYellowTime().floatValue(); else this.yellowtime = Defaults.yellowtime; this.lag = jaxbPhase.isLag(); this.permissive = jaxbPhase.isPermissive(); this.protectd = jaxbPhase.isProtected(); this.recall = jaxbPhase.isRecall(); // actual yellow and red clear times this.actualyellowtime = yellowtime; this.actualredcleartime = redcleartime; // dual ring structure: opposingPhase, isthrough, myRingGroup switch (myNEMA) { case _1: opposingPhase = mySignal.getPhaseForNEMA(NEMA._2); isthrough = false; myRingGroup = 0; break; case _2: opposingPhase = mySignal.getPhaseForNEMA(NEMA._1); isthrough = true; myRingGroup = 0; break; case _3: opposingPhase = mySignal.getPhaseForNEMA(NEMA._4); isthrough = false; myRingGroup = 1; break; case _4: opposingPhase = mySignal.getPhaseForNEMA(NEMA._3); isthrough = true; myRingGroup = 1; break; case _5: opposingPhase = mySignal.getPhaseForNEMA(NEMA._6); isthrough = false; myRingGroup = 0; break; case _6: opposingPhase = mySignal.getPhaseForNEMA(NEMA._5); isthrough = true; myRingGroup = 0; break; case _7: opposingPhase = mySignal.getPhaseForNEMA(NEMA._8); isthrough = false; myRingGroup = 1; break; case _8: opposingPhase = mySignal.getPhaseForNEMA(NEMA._7); isthrough = true; myRingGroup = 1; break; } }