Esempio n. 1
0
  /**
   * Check if we have found our node
   *
   * @param v Node we are analyzing
   * @param n int size of graph
   * @return True if v is our searched node
   */
  public boolean checkStoppingCondition(GraphNode v, Integer n) {
    if (n == 6) {
      if (Integer.parseInt(v.getPopulation()) > 500000
          && 150 <= Float.parseFloat(v.getElevation())
          && Float.parseFloat(v.getElevation()) <= 200) {
        return true;
      }
    } else if (n == 100) {
      if (v.getCity().equals("SouthAva")
          && Integer.parseInt(v.getPopulation()) == 2042542
          && Float.parseFloat(v.getElevation()) <= 1074.0) {
        return true;
      }

    } else if (n == 1000) {
      if (v.getCity().equals("NewMarlene")
          && Integer.parseInt(v.getPopulation()) == 47182047
          && Float.parseFloat(v.getElevation()) >= 8.0) {
        return true;
      }

    } else if (n == 10000) {
      if (v.getCity().equals("Careyland")
          && Integer.parseInt(v.getPopulation()) <= 5086547
          && Float.parseFloat(v.getElevation()) >= 1645.0) {
        return true;
      }
    }
    return false;
  }