PowerLawDegreeEdgeIterator extends ReadOnlyIntIterator implements WithEdgeMetadataIntIterator, ReusableNodeIntIterator { public PowerLawDegreeEdgeIterator(AbstractPowerLawDegreeEdgePool powerLawDegreeEdgePool) { this.powerLawDegreeEdgePool = powerLawDegreeEdgePool; int numPools = powerLawDegreeEdgePool.getNumPools(); this.regularDegreeEdgeIterators = new RegularDegreeEdgeIterator[numPools]; for (int i = 0; i < numPools; i++) { regularDegreeEdgeIterators[i] = new RegularDegreeEdgeIterator(powerLawDegreeEdgePool.getRegularDegreeEdgePool(i)); } } PowerLawDegreeEdgeIterator(AbstractPowerLawDegreeEdgePool powerLawDegreeEdgePool); @Override PowerLawDegreeEdgeIterator resetForNode(int inputNode); @Override int nextInt(); @Override long currentMetadata(); @Override int skip(int i); @Override boolean hasNext(); @Override Integer next();  }
@Test public void testPowerLawDegreeEdgeIterator() throws Exception { int maxNumNodes = 4; int maxDegree = 6; PowerLawDegreeEdgePool powerLawDegreeEdgePool = new PowerLawDegreeEdgePool(maxNumNodes, maxDegree, 2.0, new NullStatsReceiver()); addEdgesToPool(powerLawDegreeEdgePool); PowerLawDegreeEdgeIterator powerLawDegreeEdgeIterator = new PowerLawDegreeEdgeIterator(powerLawDegreeEdgePool); powerLawDegreeEdgeIterator.resetForNode(1); assertEquals(new IntArrayList(new int[]{11, 12, 13, 14, 15, 16, 17}), new IntArrayList(powerLawDegreeEdgeIterator)); powerLawDegreeEdgeIterator.resetForNode(2); assertEquals(new IntArrayList(new int[]{21, 22, 23}), new IntArrayList(powerLawDegreeEdgeIterator)); powerLawDegreeEdgeIterator.resetForNode(3); assertEquals(new IntArrayList(new int[]{31}), new IntArrayList(powerLawDegreeEdgeIterator)); powerLawDegreeEdgeIterator.resetForNode(4); assertEquals(new IntArrayList(new int[]{41, 42, 43}), new IntArrayList(powerLawDegreeEdgeIterator)); powerLawDegreeEdgeIterator.resetForNode(5); assertEquals(new IntArrayList(new int[]{51}), new IntArrayList(powerLawDegreeEdgeIterator)); }