Examples of ObserverNotification


Examples of de.hpi.eworld.observer.ObserverNotification

        this.logger.info("SUMO net file was successfully generated by netconvert.");
      } else {
        this.logger.error("SUMO net file WASN'T successfully generated by netconvert.");

        this.setChanged();
        this.notifyObservers(new ObserverNotification(NotificationType.netFileFailed));
        this.clearChanged();
      }
      return result;
    } else {
      this.logger.error("Either filename or path not defined.");
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

        this.logger.info("SUMO routes file was successfully generated by duarouter.");
      } else {
        this.logger.info("SUMO routes file WASN'T successfully generated by duarouter.");

        this.setChanged();
        this.notifyObservers(new ObserverNotification(NotificationType.rouFileFailed));
        this.clearChanged();
      }
      return result;
    } else {
      this.logger.error("Either filename or path not defined.");
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

   * @author Jonas Truemper
   */
  public void run() {
    if (executeAllExportSteps()) {
      this.setChanged();
      this.notifyObservers(new ObserverNotification(NotificationType.exportSuccessful));
      this.clearChanged();
    }
  }
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

    if (convert()) {
      logger.info("Emit convertSuccessful");
      logger.info("Number of observers: " + this.countObservers());
      this.setChanged();
      this.notifyObservers(new ObserverNotification(NotificationType.convertSuccessful));
    } else {
      logger.info("Emit convertFailed");
      this.setChanged();
      this.notifyObservers(new ObserverNotification(NotificationType.convertFailed, getLastError()));
      return false;
    }

    // check if the user has pressed cancel
    if (checkForAbortAndSendSignal())
      return false;

    this.setChanged();
    if (this.doNetconvert) {
      if (generateNetFile(netconvertDest, netconvertArguments))
        this.notifyObservers(new ObserverNotification(NotificationType.netFileSuccessful));
      else {
        this.notifyObservers(new ObserverNotification(NotificationType.netFileFailed, getLastError()));
        return false;
      }
    }

    // check if the user has pressed cancel
    if (checkForAbortAndSendSignal())
      return false;

    this.setChanged();
    if (this.doDuarouter) {
      if (generateRouFile(duarouterDest, duarouterArguments))
        this.notifyObservers(new ObserverNotification(NotificationType.rouFileSuccessful));
      else {
        this.notifyObservers(new ObserverNotification(NotificationType.rouFileFailed, getLastError()));
        return false;
      }
    }
    if (this.doEwdRouFile) {
      generateRouFileFromEwd();
    }

    // check if the user has pressed cancel
    if (checkForAbortAndSendSignal())
      return false;

    this.setChanged();
    if (this.doTlsfile) {
      if (generateTlsFile())
        this.notifyObservers(new ObserverNotification(NotificationType.tlsFileSuccessful));
      else {
        this.notifyObservers(new ObserverNotification(NotificationType.tlsFileFailed, getLastError()));
        return false;
      }
    }

    // check if the user has pressed cancel
    if (checkForAbortAndSendSignal())
      return false;

    // check if local SUMO version is 0.10.0 or greater, because
    // then creation of edge/lane dumps requires different
    // commands and an additional file
    int[] minVersion = { 0, 10, 0 };
    boolean addFileCreated = false;
    this.setChanged();
    if (sumoVersionGreaterOrEqual(minVersion)) {
      if (generateAddFile(statisticsIntervals)) {
        this.notifyObservers(new ObserverNotification(NotificationType.addFileSuccessful));
        addFileCreated = true;
      } else {
        this.notifyObservers(new ObserverNotification(NotificationType.addFileFailed, getLastError()));
        return false;
      }
    }

    // check if the user has pressed cancel
    if (checkForAbortAndSendSignal())
      return false;

    this.setChanged();
    if (generateCfgFile(this.doTlsfile, this.doNetconvert, this.doDuarouter, addFileCreated))
      this.notifyObservers(new ObserverNotification(NotificationType.cfgFileSuccessful));
    else {
      this.notifyObservers(new ObserverNotification(NotificationType.cfgFileFailed, getLastError()));
      return false;
    }
    return true;
  }
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

   * @return true if aborted, false otherwise.
   */
  private boolean checkForAbortAndSendSignal() {
    if (abort) {
      this.setChanged();
      this.notifyObservers(new ObserverNotification(NotificationType.executionAbortedOnUserRequest));
      this.logger.info("Export canceled upon user request.");
    }
    return abort;
  }
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

    Assert.assertEquals( endTime , modelManager.getSimulationEndTime());
  }

  @Override
  public void update(Observable o, Object arg) {
    ObserverNotification notification = (ObserverNotification) arg;
   
    if(notification.getType() == NotificationType.elementRemoved){
      this.onElementRemoved((ModelElement)notification.getObj1());
    }
  }
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

  @Test
  public void testSumoImport() {
    ModelManager model = ModelManager.getInstance();
    model.clearModel();
    model.notifyObservers(new ObserverNotification(NotificationType.startBatchProcess));
    Sumo2ModelDOM s2m = new Sumo2ModelDOM("./resources/sumo_test/original/berlin_test.net.xml", model, false,
        false, "");
    s2m.run();
   
    model.notifyObservers(new ObserverNotification(NotificationType.endBatchProcess, true, false));

    Assert.assertEquals(1597, ModelManager.getInstance().getAllModelElements().size());
  }
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

        EWorldConstants.getDuaRouterFile(), "", true /* doTlsFile */, false, false,
        false, true, new Integer[]{10000}, false);
    ew2s.run();

    model.clearModel();
    model.notifyObservers(new ObserverNotification(NotificationType.startBatchProcess));
    Sumo2ModelDOM s2m = new Sumo2ModelDOM("./resources/sumo_test/original/berlin_test.net.xml", model, true,
        false, "");
    s2m.run();
    model.notifyObservers(new ObserverNotification(NotificationType.endBatchProcess, true, false));

    int edges2 = 0;
    int nodes2 = 0;
    int ways2 = 0;
    int tls2 = 0;
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

  }

  public void setPhase(final TrafficLightPhase phase) {
    this.phase = phase;
    setChanged();
    notifyObservers(new ObserverNotification(NotificationType.elementChanged, this));
    clearChanged();
  }
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

  }

  public void setPosition(final Point2D position) {
    this.position = position;
    setChanged();
    notifyObservers(new ObserverNotification(NotificationType.elementChanged, this));
    clearChanged();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.