/** * Increments the count by 1 */ public void increment() { this.increment(1); }
/** * Increments the count by 1 */ public void increment() { this.increment(1); }
/** * Adds a characteristic to the set merging it into the appropriate existing * characteristic if applicable * * @param characteristic * Characteristics */ public void add(CharacteristicWritable characteristic) { if (this.characteristics.containsKey(characteristic.getNode())) { this.characteristics.get(characteristic.getNode()).increment(characteristic.getCount().get()); } else { this.characteristics.put(characteristic.getNode(), characteristic); } }
@Override protected void reduce(NodeWritable key, Iterable<T> values, Context context) throws IOException, InterruptedException { Map<NodeWritable, CharacteristicWritable> characteristics = new TreeMap<NodeWritable, CharacteristicWritable>(); // Firstly need to find individual characteristics Iterator<T> iter = values.iterator(); while (iter.hasNext()) { T tuple = iter.next(); NodeWritable predicate = this.getPredicate(tuple); if (characteristics.containsKey(predicate)) { characteristics.get(predicate).increment(); } else { characteristics.put(predicate, new CharacteristicWritable(predicate.get())); } } // Then we need to produce all the possible characteristic sets based on // this information List<CharacteristicWritable> cs = new ArrayList<CharacteristicWritable>(characteristics.values()); if (cs.size() == 0) return; for (int i = 1; i <= cs.size(); i++) { this.outputSets(cs, i, context); } }
/** * Adds a characteristic to the set merging it into the appropriate existing * characteristic if applicable * * @param characteristic * Characteristics */ public void add(CharacteristicWritable characteristic) { if (this.characteristics.containsKey(characteristic.getNode())) { this.characteristics.get(characteristic.getNode()).increment(characteristic.getCount().get()); } else { this.characteristics.put(characteristic.getNode(), characteristic); } }