Esempio n. 1
0
 private int calcOpt() {
   int size = 0;
   for (LookupPair lp : this) {
     size++; // dup
     int match = lp.getMatch();
     if (match >= -1 && match <= 5) {
       size++; // iconst_x
     } else {
       size += 2; // bipush or ldc
     }
     size += 3; // if_icmpne
     size++; // pop
     size += 3; // goto_n
   }
   return size + 3 + 1; // last goto_n and pop
 }
Esempio n. 2
0
 public boolean isContiguous() {
   Collections.sort(this);
   boolean first = true;
   int prev = 0;
   for (LookupPair lp : this) {
     if (first) {
       first = false;
       prev = lp.getMatch();
     } else {
       int next = lp.getMatch();
       if (next - prev != 1) {
         return false;
       }
       prev = next;
     }
   }
   return true;
 }