public void close() throws IOException { for (MapIV.Entry<ArrayListOfIntsWritable> e : adjLists.entrySet()) { keyOut.set(e.getKey()); valOut.setNodeId(e.getKey()); valOut.setHARank((float) 0.0); valOut.setType(HITSNode.TYPE_AUTH_COMPLETE); valOut.setAdjacencyList(e.getValue()); mOutput.collect(keyOut, valOut); } }
public void map( LongWritable key, Text value, OutputCollector<IntWritable, HITSNode> output, Reporter reporter) throws IOException { mOutput = output; 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))) { links.add(curr); } else { return; } // add to HMap here } while (itr.hasMoreTokens()) { int curr = Integer.parseInt(itr.nextToken()); if (!(stopList.contains(curr))) { if (adjLists.containsKey(curr)) { ArrayListOfIntsWritable list = adjLists.get(curr); list.trimToSize(); links.trimToSize(); list.addAll(links.getArray()); adjLists.put(curr, list); } else { links.trimToSize(); adjLists.put(curr, links); } } } }
public void configure(JobConf jc) { stopList = readStopList(jc); adjLists.clear(); }