Esempio n. 1
0
 private void playMakeTurn(RouteDirectionInfo next, RouteDirectionInfo nextNext) {
   CommandBuilder play = getNewCommandPlayerToPlay();
   if (play != null) {
     String tParam = getTurnType(next.getTurnType());
     boolean isplay = true;
     if (tParam != null) {
       play.turn(tParam);
     } else if (next.getTurnType().isRoundAbout()) {
       play.roundAbout(next.getTurnType().getTurnAngle(), next.getTurnType().getExitOut());
     } else if (next.getTurnType().getValue().equals(TurnType.TU)
         || next.getTurnType().getValue().equals(TurnType.TRU)) {
       play.makeUT();
       // do not say it
       //				} else if(next.getTurnType().getValue().equals(TurnType.C)){
       //					play.goAhead();
     } else {
       isplay = false;
     }
     // add turn after next
     if (nextNext != null) {
       String t2Param = getTurnType(nextNext.getTurnType());
       if (t2Param != null) {
         if (isplay) {
           play.then();
         }
         play.turn(t2Param, next.distance);
       } else if (nextNext.getTurnType().isRoundAbout()) {
         if (isplay) {
           play.then();
         }
         play.roundAbout(
             next.distance,
             nextNext.getTurnType().getTurnAngle(),
             nextNext.getTurnType().getExitOut());
       } else if (nextNext.getTurnType().getValue().equals(TurnType.TU)) {
         if (isplay) {
           play.then();
         }
         play.makeUT(next.distance);
       }
       isplay = true;
     }
     if (isplay) {
       play.play();
     }
   }
 }
Esempio n. 2
0
 private void playMakeTurnIn(
     RouteDirectionInfo next, int dist, RouteDirectionInfo pronounceNextNext) {
   CommandBuilder play = getNewCommandPlayerToPlay();
   if (play != null) {
     String tParam = getTurnType(next.getTurnType());
     boolean isPlay = true;
     if (tParam != null) {
       play.turn(tParam, dist);
     } else if (next.getTurnType().isRoundAbout()) {
       play.roundAbout(dist, next.getTurnType().getTurnAngle(), next.getTurnType().getExitOut());
     } else if (next.getTurnType().getValue().equals(TurnType.TU)
         || next.getTurnType().getValue().equals(TurnType.TRU)) {
       play.makeUT(dist);
     } else {
       isPlay = false;
     }
     // small preparation to next after next
     if (pronounceNextNext != null) {
       TurnType t = pronounceNextNext.getTurnType();
       isPlay = true;
       if (next.getTurnType().getValue().equals(TurnType.C) && !TurnType.C.equals(t.getValue())) {
         play.goAhead(dist);
       }
       if (TurnType.TL.equals(t.getValue())
           || TurnType.TSHL.equals(t.getValue())
           || TurnType.TSLL.equals(t.getValue())
           || TurnType.TU.equals(t.getValue())
           || TurnType.KL.equals(t.getValue())) {
         play.then().bearLeft();
       } else if (TurnType.TR.equals(t.getValue())
           || TurnType.TSHR.equals(t.getValue())
           || TurnType.TSLR.equals(t.getValue())
           || TurnType.KR.equals(t.getValue())) {
         play.then().bearRight();
       }
     }
     if (isPlay) {
       play.play();
     }
   }
 }