Examples of Tuple


Examples of eu.stratosphere.api.java.tuple.Tuple

    if (expected.length != found.length) {
      throw new IllegalArgumentException();
    }
   
    for (int i = 0; i < expected.length; i++) {
      Tuple v1 = (Tuple) expected[i];
      Tuple v2 = (Tuple) found[i];
     
      for (int k = 0; k < v1.getArity(); k++) {
        Object o1 = v1.getField(k);
        Object o2 = v2.getField(k);
        Assert.assertEquals(o1, o2);
      }
    }
  }
View Full Code Here

Examples of eu.stratosphere.test.recordJobs.util.Tuple

   *
   */
  @Override
  public void map(Record record, Collector<Record> out) throws Exception
  {
    Tuple inputTuple = record.getField(1, Tuple.class);
   
    /* Extract the year from the date element of the order relation: */
   
    /* pice = extendedprice * (1 - discount): */
    float price = Float.parseFloat(inputTuple.getStringValueAt(5)) * (1 - Float.parseFloat(inputTuple.getStringValueAt(6)));
    /* Project (orderkey | partkey, suppkey, linenumber, quantity, extendedprice, discount, tax, ...) to (partkey, suppkey, quantity): */
    inputTuple.project((0 << 0) | (1 << 1) | (1 << 2) | (0 << 3) | (1 << 4));
    inputTuple.addAttribute("" + price);
    record.setField(1, inputTuple);
    out.collect(record);
  }
View Full Code Here

Examples of game.slot.Tuple

  public void instantiateGameSheet(){
    for(int i = 0; i  < noOfPlayers; i++){
      ArrayList<AbstractScoreSlot> playerXStats = new ArrayList<AbstractScoreSlot>();

      //Add the upper section slots
      Tuple ones = new Tuple(1, "Ones", 5);
      playerXStats.add(ones);
      Tuple twos = new Tuple(2, "Twos", 10);
      playerXStats.add(twos);
      Tuple threes = new Tuple(3, "Threes", 15);
      playerXStats.add(threes);
      Tuple fours = new Tuple(4, "Fours", 20);
      playerXStats.add(fours);
      Tuple fives = new Tuple(5, "Fives", 25);
      playerXStats.add(fives);
      Tuple sixes = new Tuple(6, "Sixes", 30);
      playerXStats.add(sixes);
      Bonus bonus = new Bonus(ones, twos, threes, fours, fives, sixes, "Upper bonus", 50);
      playerXStats.add(bonus);

      //Add the intermediate summing slot
View Full Code Here

Examples of gololang.Tuple

    Method nested_tuples = moduleClass.getMethod("nested_tuples");
    Object result = nested_tuples.invoke(null);
    assertThat(result, instanceOf(Tuple.class));

    Tuple tuple = (Tuple) result;
    assertThat(tuple.size(), is(4));
    assertThat((Integer) tuple.get(0), is(1));
    assertThat((Integer) tuple.get(1), is(2));
    assertThat((Integer) tuple.get(2), is(3));
    assertThat(tuple.get(3), instanceOf(Tuple.class));

    Tuple nestedTuple = (Tuple) tuple.get(3);
    assertThat(nestedTuple.size(), is(2));
    assertThat((Integer) nestedTuple.get(0), is(10));
    assertThat((Integer) nestedTuple.get(1), is(20));

    Method empty_tuple = moduleClass.getMethod("empty_tuple");
    result = empty_tuple.invoke(null);
    assertThat(result, instanceOf(Tuple.class));
    tuple = (Tuple) result;
View Full Code Here

Examples of groovy.lang.Tuple

            while (matcher.find()) {
                newSql.append(sql.substring(txtIndex, matcher.start())).append('?');
                String indexStr = matcher.group(1);
                int index = (indexStr == null || indexStr.length() == 0) ? 0 : new Integer(indexStr) - 1;
                String prop = matcher.group(2);
                indexPropList.add(new Tuple(new Object[]{index, prop.length() == 0 ? "<this>" : prop}));
                txtIndex = matcher.end();
            }
            newSql.append(sql.substring(txtIndex)); // append ending SQL after last param.
            return newSql.toString();
        }
View Full Code Here

Examples of javax.persistence.Tuple

   
    @Test
    public void testEqualsCriteriaQueryTuple() throws Exception {
        List<Tuple> books = criteriaQueryBooksTuple("id==10");
        assertEquals(1, books.size());
        Tuple tuple = books.get(0);
        int tupleId = tuple.get("id", Integer.class);
        assertEquals(10, tupleId);
    }
View Full Code Here

Examples of jdbm.helper.Tuple

   }

   private Set<String> getChildrenNames0(Fqn name) throws IOException
   {
      TupleBrowser browser = tree.browse(name);
      Tuple t = new Tuple();

      if (browser.getNext(t))
      {
         if (!t.getValue().equals(NODE))
         {
            log.trace(" not a node");
            return null;
         }
      }
      else
      {
         log.trace(" no nodes");
         return null;
      }

      Set<String> set = new HashSet<String>();

      // Want only /a/b/c/X nodes
      int depth = name.size() + 1;
      while (browser.getNext(t))
      {
         Fqn fqn = (Fqn) t.getKey();
         int size = fqn.size();
         if (size < depth)
         {
            break;
         }
         if (size == depth && t.getValue().equals(NODE))
         {
            set.add((String) fqn.getLastElement());
         }
      }
View Full Code Here

Examples of jmathexpr.set.Tuple

    }

    @Override
    public TruthValue contains(Expression element) {
        if (element instanceof Tuple) {
            Tuple tuple = (Tuple) element;
           
            return TruthValue.valueOf(tuple.length() == 2 && tuple.at(1).equals(lhs) && tuple.at(2).equals(rhs));
        } else {
            return TruthValue.False;
        }
    }
View Full Code Here

Examples of kodkod.instance.Tuple

        return tmp.isEmpty();
    }

    /** Parse tuple. */
    private Tuple parseTuple(XMLNode tuple, int arity) throws Err {
        Tuple ans = null;
        try {
            for(XMLNode sub:tuple) if (sub.is("atom")) {
                Tuple x = factory.tuple(sub.getAttribute("label"));
                if (ans==null) ans=x; else ans=ans.product(x);
            }
            if (ans==null) throw new ErrorFatal("Expecting: <tuple> <atom label=\"..\"/> .. </tuple>");
            if (ans.arity()!=arity) throw new ErrorFatal("Expecting: tuple of arity "+arity+" but got tuple of arity "+ans.arity());
            return ans;
View Full Code Here

Examples of net.csdn.common.collect.Tuple

        if (_query == null) return;
        String[] queries = _query.split("&");
        for (String temp : queries) {
            if (temp.isEmpty() || !temp.contains("=")) continue;
            String[] key_pair = temp.split("=");
            query.add(new Tuple(key_pair[0], key_pair[1]));
        }
    }
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.