@Test public void testIncrement() { TargetIdGenerator gen = new TargetIdGenerator(0, 0); assertEquals(0, gen.nextId()); assertEquals(2, gen.nextId()); assertEquals(4, gen.nextId()); assertEquals(6, gen.nextId()); gen = new TargetIdGenerator(0, 46); assertEquals(46, gen.nextId()); assertEquals(48, gen.nextId()); assertEquals(50, gen.nextId()); assertEquals(52, gen.nextId()); assertEquals(54, gen.nextId()); gen = new TargetIdGenerator(1, 1); assertEquals(1, gen.nextId()); assertEquals(3, gen.nextId()); assertEquals(5, gen.nextId()); gen = new TargetIdGenerator(1, 45); assertEquals(45, gen.nextId()); assertEquals(47, gen.nextId()); assertEquals(49, gen.nextId()); assertEquals(51, gen.nextId()); assertEquals(53, gen.nextId()); }
public int nextId() { int nextId = this.nextId; this.nextId += 1 << RESERVED_BITS; return nextId; }
TargetIdGenerator { public int nextId() { int nextId = this.nextId; this.nextId += 1 << RESERVED_BITS; return nextId; } }
TargetIdGenerator { public int nextId() { int nextId = this.nextId; this.nextId += 1 << RESERVED_BITS; return nextId; } TargetIdGenerator(int generatorId, int seed); }
TargetIdGenerator { public int nextId() { int nextId = this.nextId; this.nextId += 1 << RESERVED_BITS; return nextId; } TargetIdGenerator(int generatorId, int seed); static TargetIdGenerator forTargetCache(int after); static TargetIdGenerator forSyncEngine(); int nextId(); }
TargetIdGenerator { public int nextId() { int nextId = this.nextId; this.nextId += 1 << RESERVED_BITS; return nextId; } TargetIdGenerator(int generatorId, int seed); static TargetIdGenerator forTargetCache(int after); static TargetIdGenerator forSyncEngine(); int nextId();  }