public void restoreState(int index,PdfCanvas cb){
  int pops;
  if (index < 0)   pops=Math.min(-index,savedStates.size());
 else   pops=Math.max(savedStates.size() - index,0);
  if (pops == 0)   return;
  MetaState state=null;
  while (pops-- != 0) {
    cb.restoreState();
    state=savedStates.pop();
  }
  setMetaState(state);
}

public void restoreState ( int index , PdfCanvas cb ) { int pops ; if ( index < 0 ) pops = Math . min ( - index , savedStates . size ( ) ) ; else pops = Math . max ( savedStates . size ( ) - index , 0 ) ; if ( pops == 0 ) return ; MetaState state = null ; while ( pops -- != 0 ) { cb . restoreState ( ) ; state = savedStates . pop ( ) ; } setMetaState ( state ) ; }
restores the state to the next state on the saved states stack .
