Exemplo n.º 1
0
  /**
   * Generate the AODV animation
   *
   * @param props The properties to use for the look & feel
   * @param primitives The preconfigured primitives from the wizard
   * @return The animation as a string in AnimalScript
   */
  public String generate(AnimationPropertiesContainer props, Hashtable<String, Object> primitives) {

    controller.drawStartPage();
    controller.hideStartPage();

    controller.drawGUIGraph();

    controller.drawInfoTable(aodvGraph.getAODVNodes());
    controller.drawStatisticTable(translator.translateMessage("statTableTitle"));
    controller.drawInfoBox(translator.translateMessage("infoBox"));

    AODVNode startNode;
    AODVNode destinationNode;

    // Reset the statistics
    Statistics.sharedInstance().reset();

    for (String[] startEndNodes : routeDiscoveries) {
      startNode = aodvGraph.getNode(startEndNodes[0]);
      destinationNode = aodvGraph.getNode(startEndNodes[1]);
      if (startNode != null && destinationNode != null) {
        controller.drawNodeInfo(startNode, destinationNode);
        startAodvRouting(startNode, destinationNode);
        controller.unhighlightAll();
      }
    }

    // Draws the end page with the complexity information of AODV
    controller.drawEndPage();

    return lang.toString();
  }
Exemplo n.º 2
0
  /**
   * Validates the properties and constructs thereby Objects for the later animation generation
   *
   * @param animationPropertieses
   * @param stringObjectHashtable
   * @return false if the properties are not valid
   * @throws IllegalArgumentException
   */
  @Override
  public boolean validateInput(
      AnimationPropertiesContainer animationPropertieses,
      Hashtable<String, Object> stringObjectHashtable)
      throws IllegalArgumentException {

    lang =
        new AnimalScript(
            "Ad-hoc Optimized Vector Routing", "Sascha Bleidner, Jan David Nose", 1200, 800);

    lang.setStepMode(true);

    routeDiscoveries = (String[][]) stringObjectHashtable.get("StartandEndnodes");

    Graph loadedGraph = (Graph) stringObjectHashtable.get("graph");
    controller = new GUIController(lang, loadedGraph, translator, animationPropertieses);

    aodvGraph = new AODVGraph(controller.getAnimalGraph(), controller);

    for (String[] startEndNodes : routeDiscoveries) {
      if (startEndNodes.length != 2) {
        showErrorMessage(translator.translateMessage("errorMessageWrongNumberNodes"));
        return false;
      } else {
        AODVNode startNode = aodvGraph.getNode(startEndNodes[0]);
        AODVNode destinationNode = aodvGraph.getNode(startEndNodes[1]);
        if (startNode == null || !aodvGraph.containsNode(startNode)) {
          showErrorMessage(translator.translateMessage("errorMessageStartNodeNotFound"));
          return false;
        } else {
          if (destinationNode == null || !aodvGraph.containsNode(destinationNode)) {
            showErrorMessage(translator.translateMessage("errorMessageDestinationNodeNotFound"));
            return false;
          }
        }
      }
    }
    return true;
  }
Exemplo n.º 3
0
 /** @return the description */
 public String getDescription() {
   return translator.translateMessage("algoDesc");
 }
Exemplo n.º 4
0
 /** @return the algorithm name */
 public String getAlgorithmName() {
   return translator.translateMessage("algoName");
 }
Exemplo n.º 5
0
 /**
  * Displays an error message on the screen as a JOptionPane
  *
  * @param message message to be displayed to help the user investigating on the error
  */
 private void showErrorMessage(String message) {
   JOptionPane.showMessageDialog(
       null, message, translator.translateMessage("errorMessageTitle"), JOptionPane.ERROR_MESSAGE);
 }