예제 #1
0
 public int nextIdx() {
   int res = currPair_;
   if (pool_.size() == 1) {
     currPair_ = -1;
     res = pool_.firstInt();
   } else if (pool_.size() == 0) {
     String mssg = "pool.size() == 0";
     LOG.error(this, mssg, "");
     throw new KinGroupError(mssg);
   } else if (currPair_ != -1) {
     currPair_ = -1;
   }
   //      else if (pool_.size() == 2) {
   //         res = random(pool_.firstInt(), pool_.lastInt());
   //      }
   else {
     Int2 pair = pairs_.removeFirstPair();
     res = random(pair.b, pair.a);
     currPair_ = pair.pair(res);
   }
   if (!pool_.removeInt(res)) {
     String mssg = "!pool_.removeInt(res)";
     LOG.error(this, mssg, "");
     throw new KinGroupError(mssg);
   }
   return res;
 }
예제 #2
0
 public boolean hasNext() {
   return (pool_.size() > 0);
 }