Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void map(LongWritable key, Text value, Context context)
- throws IOException, InterruptedException {
- String line = value.toString();
- String[] lineSplit = line.split(" ");
- if (Double.parseDouble(lineSplit[2]) < dcThreshold) {
- IntWritable one = new IntWritable(
- Integer.parseInt(lineSplit[0]));
- IntWritable two = new IntWritable(
- Integer.parseInt(lineSplit[1]));
- context.write(one, two);
- }
- }
- public void reduce(IntWritable key, IntWritable values, Context context)
- throws IOException, InterruptedException {
- int[] indexs = new int[2];
- indexs[0] = Integer.parseInt(key.toString());
- indexs[1] = Integer.parseInt(values.toString());
- for (int i = 0; i < indexs.length; i++) {
- densityCountMap.put(indexs[i],
- densityCountMap.get(indexs[i]) + 1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement