Ejemplo n.º 1
0
 /**
  * Find the next signal along our route and setup subscription for status changes on that signal.
  */
 public void getAndGetNotifiedFromNextSignal() {
   if (_nextSignal != null) {
     log.debug(
         _trainName
             + " getAndGetNotifiedFromNextSignal removing property listener for signal "
             + _nextSignal.getDisplayName());
     _nextSignal.removePropertyChangeListener(this);
     _nextSignal = null;
   }
   for (int i = _idxCurrentOrder + 1; i <= _orders.size() - 1; i++) {
     BlockOrder bo = getBlockOrderAt(i);
     if (bo == null) {
       log.debug(
           _trainName
               + " getAndGetNotifiedFromNextSignal could not find a BlockOrder for index "
               + i);
     } else if (bo.getEntryName().equals("")) {
       log.debug(
           _trainName
               + " getAndGetNotifiedFromNextSignal could not find an entry to Block for index "
               + i);
     } else {
       log.debug(
           _trainName
               + " getAndGetNotifiedFromNextSignal examines block "
               + bo.getBlock().getDisplayName()
               + " with entryname = "
               + bo.getEntryName());
       _nextSignal = bo.getSignal();
       if (_nextSignal != null) {
         log.debug(
             _trainName
                 + " getAndGetNotifiedFromNextSignal found a new signal to listen to: "
                 + _nextSignal.getDisplayName());
         break;
       }
     }
   }
   if (_nextSignal != null) {
     _nextSignal.addPropertyChangeListener(this);
   }
 }