Exemple #1
0
  /**
   * Sets the values in the given positions to the values from the given Tuple.
   *
   * @param pos of type int[]
   * @param tuple of type Tuple
   */
  void set(int[] pos, Tuple tuple) {
    verifyModifiable();

    if (pos.length != tuple.size())
      throw new TupleException(
          "given tuple not same size as position array, tuple: " + tuple.print());

    int count = 0;
    for (int i : pos) elements.set(i, tuple.elements.get(count++));
  }
  private String generateKey(Tuple t) {
    System.out.println(t.field(0));

    /* SPECIAL CASES */
    if (t.field(0).equals("task")) return new String("task");

    if (t.field(0).equals("node")) return new String("node");

    if (t.field(0).equals("neighbourhood")) return new String("neighbourhood");

    if (t.field(0).equals("panel")) return new String("panel");

    if (t.field(0).equals("panel_")) return new String("panel_");

    if (t.field(0).equals("intermediate")) return new String("intermediate");

    if (t.field(0).equals("eta_inter")) return new String("eta_inter");

    if (t.field(0).equals("u_inter")) return new String("u_inter");

    if (t.field(0).equals("qtask")) return new String("qtask");

    if (t.field(0).equals("qresult")) return new String("qresult");

    if (t.field(0).equals("qsort")) return new String("qsort");

    if (t.field(0).equals("laplace")) return new String("laplace");

    if ((t.field(0) instanceof String) && (((String) t.field(0)).contains("mb")))
      return new String("mandelbrot");

    StringBuffer buf = new StringBuffer();
    int it = (t.size() > 2) ? 3 : 1;

    for (int i = 0; i < it; i++) {
      buf.append(t.field(i).toString());
    }

    return new String(buf);
  }