Package edu.umd.cloud9.io.array

Examples of edu.umd.cloud9.io.array.ArrayListOfIntsWritable


    super();
    terms = new ArrayListOfIntsWritable();
  }

  public MinhashSignature(ArrayListOfIntsWritable b){
    terms = new ArrayListOfIntsWritable(b);
  }
View Full Code Here


    this(other.terms);
  }
 
  public MinhashSignature(int numTerms){      //need this constructor for general purposes.
    super();
    terms = new ArrayListOfIntsWritable(numTerms);
  }
View Full Code Here


  @Override
  public int hammingDistance(Signature signature, int threshold){
    MinhashSignature s2 = (MinhashSignature) signature;
    ArrayListOfIntsWritable l1 = this.terms;
    ArrayListOfIntsWritable l2 = s2.terms;

    int count=0;
    for(int i=0;i<l1.size();i++){

      int i1 = l1.get(i), i2=l2.get(i);
      if(i1!=i2){
        count++;
        if(count>threshold){
          return count;
        }
View Full Code Here

   *   last index to be included in sub-list
   * @return
   *   return a new ArrayListOfIntsWritable object, containing the ints of this object from <code>start</code> to <code>end</code>
   */
  public ArrayListOfIntsWritable sub(ArrayListOfIntsWritable lst, int start, int end) {
    ArrayListOfIntsWritable sublst = new ArrayListOfIntsWritable(end-start+1);
    for(int i=start;i<=end;i++){
      sublst.add(lst.get(i));
    }
    return sublst;
  }
View Full Code Here

  public ArrayListOfIntsWritable nextPermutation() {
    if(combEnd==NUM_BLOCKS){
      throw new RuntimeException("Too many calls! All permutations done!");
    }
    System.err.println(combStart+","+combEnd);
    ArrayListOfIntsWritable perm = new ArrayListOfIntsWritable();
    addAll(perm, blocks[combStart].getArray());
    addAll(perm, blocks[combEnd].getArray());
    //    if(combStart==(BLOCK_SIZE-1) ||combEnd==(BLOCK_SIZE-1)){
    //      keyLen = 25;
    //    }else{
    //      keyLen = 26;
    //    }
    ArrayList<Integer> rest = new ArrayList<Integer>();
    for(int i=0;i<NUM_BLOCKS;i++){
      if(i!=combStart && i!=combEnd){
        rest.add(i);
      }
    }
    Collections.shuffle(rest);

    for(int nextBlock : rest){
      addAll(perm, blocks[nextBlock].getArray());
    }
    if(perm.size()!=length){
      throw new RuntimeException("Number of elements not correct!");
    }
    if(combEnd==(NUM_BLOCKS-1)){
      combStart++;
      combEnd = combStart+1;
View Full Code Here

  /**
   * Constructs a target with an empty source list.
   */
  public AnchorTextTarget() {
    sources = new ArrayListOfIntsWritable();
  }
View Full Code Here

 
  public static void writeToFile(Permutation p, int numPerms, FileSystem fs, JobConf job, String fileName) throws IOException{
    SequenceFile.Writer writer = SequenceFile.createWriter(fs, job, new Path(fileName), IntWritable.class, ArrayListOfIntsWritable.class);

    for(int j=0;j<numPerms;j++){
      ArrayListOfIntsWritable perm = p.nextPermutation();
      writer.append(new IntWritable(j), perm);
      //            sLogger.debug(j +":"+perm);
    }
    writer.close();
  }
View Full Code Here

    public void map(LongWritable key, Text value,
        OutputCollector<IntWritable, HITSNode> output, Reporter reporter)
        throws IOException {

      ArrayListOfIntsWritable links = new ArrayListOfIntsWritable();
      String line = ((Text) value).toString();
      StringTokenizer itr = new StringTokenizer(line);
      if (itr.hasMoreTokens()) {
        int curr = Integer.parseInt(itr.nextToken());
        if (stopList.contains(curr)) {
          return;
        }
        links.add(curr);
        valOut.setInlinks(links);
        valOut.setARank((float) 0.0);
        valOut.setType(HITSNode.TYPE_AUTH_COMPLETE);
      }
      while (itr.hasMoreTokens()) {
View Full Code Here

      String[] arr = t.toString().trim().split("\\s+");

      nid.set(Integer.parseInt(arr[0]));
      if (arr.length == 1) {
        node.setNodeId(Integer.parseInt(arr[0]));
        node.setAdjacencyList(new ArrayListOfIntsWritable());

      } else {
        node.setNodeId(Integer.parseInt(arr[0]));

        int[] neighbors = new int[arr.length - 1];
        for (int i = 1; i < arr.length; i++) {
          neighbors[i - 1] = Integer.parseInt(arr[i]);
        }

        node.setAdjacencyList(new ArrayListOfIntsWritable(neighbors));
      }

      context.getCounter("graph", "numNodes").increment(1);
      context.getCounter("graph", "numEdges").increment(arr.length - 1);
View Full Code Here

        OutputCollector<IntWritable, HITSNode> output, Reporter reporter)
        throws IOException {

      mOutput = output;

      ArrayListOfIntsWritable links = new ArrayListOfIntsWritable();
      String line = ((Text) value).toString();
      //System.out.println(line);
      StringTokenizer itr = new StringTokenizer(line);
      if (itr.hasMoreTokens()) {
        int curr = Integer.parseInt(itr.nextToken());
        if (!(stopList.contains(curr))) {
          links.add(curr);
        } else {
          return;
        }
        // add to HMap here
      }
      while (itr.hasMoreTokens()) {
        int curr = Integer.parseInt(itr.nextToken());
        //System.out.println("-->" + curr + " " + links.toString());
        if (!(stopList.contains(curr))) {
          if (adjLists.containsKey(curr)) {
            //FIXME?
            ArrayListOfIntsWritable list = new ArrayListOfIntsWritable(adjLists.get(curr));
            list.trimToSize();
            links.trimToSize();
            list.addUnique(links.getArray());
            adjLists.remove(curr);
            adjLists.put(curr, list);
          } else {
            links.trimToSize();
            adjLists.put(curr, links);
View Full Code Here

TOP

Related Classes of edu.umd.cloud9.io.array.ArrayListOfIntsWritable

Copyright © 2018 www.massapicom. 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.