1 11 package org.eclipse.ui.part; 12 13 import java.util.Stack ; 14 15 19 class DrillStack { 20 Stack fStack = null; 21 22 25 public DrillStack() { 26 reset(); 27 } 28 29 34 public DrillFrame add(DrillFrame oRecord) { 35 fStack.push(oRecord); 36 return oRecord; 37 } 38 39 45 public boolean canGoBack() { 46 return (fStack.size() > 0); 47 } 48 49 55 public boolean canGoHome() { 56 return (fStack.size() > 0); 57 } 58 59 62 public DrillFrame goBack() { 63 DrillFrame aFrame = (DrillFrame) fStack.pop(); 64 return aFrame; 65 } 66 67 70 public DrillFrame goHome() { 71 DrillFrame aFrame = (DrillFrame) fStack.elementAt(0); 72 reset(); 73 return aFrame; 74 } 75 76 79 public void reset() { 80 fStack = new Stack (); 81 } 82 83 88 public int size() { 89 return fStack.size(); 90 } 91 92 97 public DrillFrame top() { 98 return (DrillFrame) fStack.peek(); 99 } 100 } 101 | Popular Tags |