Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: Java  |  size: 0.66 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public boolean isFoundStack(Record record){
  2.                
  3.                 IRecordStack tempStackOne=new RecordStack();
  4.                 IRecordStack tempStackTwo=new RecordStack();
  5.                 tempStackOne=this.stackOne;
  6.                 tempStackTwo=this.stackTwo;
  7.                 boolean found=true;
  8.                
  9.                 while (!this.stackOne.isEmpty() && !this.stackOne.top().equals(record)){
  10.                         tempStackOne.push(this.stackOne.pop());
  11.                         found=false;
  12.                 }
  13.                
  14.                 this.stackOne=tempStackOne;            
  15.                 if (found){
  16.                         return found;
  17.                 }
  18.                
  19.                
  20.                 found=true;
  21.                
  22.                 while (!tempStackTwo.isEmpty() && !tempStackTwo.top().equals(record)){
  23.                         tempStackTwo.push(this.stackOne.pop());
  24.                         found=false;
  25.                 }
  26.                
  27.                 this.stackTwo=tempStackTwo;
  28.                 return found;
  29.         }