コード例 #1
0
ファイル: SignalPhase.java プロジェクト: elenadorogush/sirius
  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;
    }
  }