Package hivemall.utils.lang.mutable

Examples of hivemall.utils.lang.mutable.MutableInt


        IMapIterator<String, MutableInt> itor = map.entries();
        Assert.assertFalse(itor.hasNext());

        final int numEntries = 1000000;
        for(int i = 0; i < numEntries; i++) {
            map.put(Integer.toString(i), new MutableInt(i));
        }

        final MutableInt probe = new MutableInt();
        itor = map.entries();
        Assert.assertTrue(itor.hasNext());
        while(itor.hasNext()) {
            Assert.assertFalse(itor.next() == -1);
            String k = itor.getKey();
            itor.getValue(probe);
            Assert.assertEquals(Integer.valueOf(k).intValue(), probe.intValue());
        }
        Assert.assertEquals(-1, itor.next());
    }
View Full Code Here


                return true;
            }

            if(partial == null) {
                this.partial = new PartialResult();
                partial.map.put(term, new MutableInt(1));
            } else {
                final Map<Text, MutableInt> map = partial.map;
                MutableInt count = map.get(term);
                if(count == null) {
                    map.put(term, new MutableInt(1));
                } else {
                    int newcount = count.getValue() + 1;
                    count.setValue(newcount);
                }
            }
            partial.globalCount++;
            return true;
        }
View Full Code Here

            }
            final Map<Text, MutableInt> this_map = partial.map;
            final Map<Text, MutableInt> other_map = other.map;
            for(Map.Entry<Text, MutableInt> e : other_map.entrySet()) {
                Text term = e.getKey();
                MutableInt other_count = e.getValue();
                MutableInt this_count = this_map.get(term);
                if(this_count == null) {
                    this_map.put(term, other_count);
                } else {
                    int newcount = this_count.getValue() + other_count.getValue();
                    this_count.setValue(newcount);
                }
            }
            partial.globalCount += other.globalCount;
            return true;
        }
View Full Code Here

TOP

Related Classes of hivemall.utils.lang.mutable.MutableInt

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.