Examples of PairOfInts


Examples of edu.umd.cloud9.io.pair.PairOfInts

  }

  public void readFields(DataInput in) throws IOException{
    int size = in.readInt();
    for(int i=0; i<size; i++){
      PairOfInts elt = new PairOfInts();
      elt.readFields(in);
      lst.add(elt);
    }
  }
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfInts

    return lst.equals(p);
  }
 
  public void addPair(int i1, int i2){
    lst.add(new PairOfInts(i1, i2));
  }
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfInts

    public void reduce(IntWritable key, Iterator<PairOfInts> values,
        OutputCollector<IntWritable, PairOfInts> output, Reporter reporter)
    throws IOException {
      list.clear();
      while(values.hasNext()){
        PairOfInts p = values.next();
        list.add(new PairOfInts(p.getLeftElement(),p.getRightElement()));
        reporter.incrCounter(mapoutput.count, 1);
      }
      int cntr = 0;
      while(!list.isEmpty() && cntr<numResults){
        output.collect(key, list.pollFirst());
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfInts

      int rightKey = key.getRightElement();    //german docno

      sLogger.debug(rightKey);
      if(samplesMap==null || samplesMap.containsKey(rightKey)){
        if(maxDist==-1 || value.get()<=maxDist){
          output.collect(new IntWritable(rightKey), new PairOfInts(value.get(),leftKey));
         
          //symmetric implementation. change when not desired.
//          output.collect(new IntWritable(leftKey), new PairOfInts(value.get(),rightKey));
        }
      }
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfInts

    public void reduce(IntWritable key, Iterator<PairOfInts> values,
        OutputCollector<IntWritable, PairOfInts> output, Reporter reporter)
    throws IOException {
      list.clear();
      while(values.hasNext()){
        PairOfInts p = values.next();
        list.add(new PairOfInts(p.getLeftElement(),p.getRightElement()));
        reporter.incrCounter(mapoutput.count, 1);
      }
      int cntr = 0;
      while(!list.isEmpty() && cntr<numResults){
        output.collect(key, list.pollFirst());
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfInts

      }

      // Emit postings.
      for (PairOfObjectInt<String> e : COUNTS) {
        WORD.set(e.getLeftElement());
        context.write(WORD, new PairOfInts((int) docno.get(), e.getRightElement()));
      }
    }
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfInts

    startTime = System.currentTimeMillis();

    List<PairOfInts> listPairOfInts1 = new ArrayList<PairOfInts>();
    for (int i = 0; i < SAMPLES; i++) {
      listPairOfInts1.add(new PairOfInts(r.nextInt(1000), r.nextInt(1000)));
    }

    duration = (System.currentTimeMillis() - startTime) / 1000.0;
    System.out.println("Generated PairOfInts in " + duration + " seconds");
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfInts

    FileSystem fs = FileSystem.get(conf);
    SequenceFile.Writer writer = SequenceFile.createWriter(fs, conf, new Path(
        "random-pairs.seq"), PairOfInts.class, IntWritable.class);

    IntWritable n = new IntWritable();
    PairOfInts pair = new PairOfInts();

    for (int i = 0; i < 1000000; i++) {
      n.set(i);
      pair.set(r.nextInt(1000), r.nextInt(1000));
      writer.append(pair, n);
    }

    writer.close();
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfInts

public class PairOfIntsTest {

  @Test
  public void testBasic() throws IOException {
    PairOfInts pair = new PairOfInts(1, 2);

    assertEquals(1, pair.getLeftElement());
    assertEquals(2, pair.getRightElement());
  }
View Full Code Here

Examples of edu.umd.cloud9.io.pair.PairOfInts

    assertEquals(2, pair.getRightElement());
  }

  @Test
  public void testSerialize() throws IOException {
    PairOfInts origPair = new PairOfInts(1, 2);

    ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
    DataOutputStream dataOut = new DataOutputStream(bytesOut);

    origPair.write(dataOut);

    PairOfInts pair = new PairOfInts();

    pair.readFields(new DataInputStream(new ByteArrayInputStream(bytesOut.toByteArray())));

    assertEquals(1, pair.getLeftElement());
    assertEquals(2, pair.getRightElement());
  }
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.