⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stack.java

📁 WAP ide 代码
💻 JAVA
字号:
package wapide;

import java.lang.*;
import java.util.*;
/**
 *  A helper class that simulates a stack object.
 *  Copyright (c) 2003
 * @author  Mark Busman
 * @version 1.0
 *
 * For License and contact information see WAPIDE.java
 */
public class Stack extends Object {

  /**
   * The number of itmes on the stack.
   */
  private int StackCounter = -1;
  /**
   * The actual stack object.
   */
  private ArrayList theStack = new ArrayList();

  /** Creates new Stack */
  public Stack() {
  }

  /** Push an object onto the stack.
   *  @param Object o - Any class as long as it is cast to an Object.
   */
  public void Push(Object o) {

    StackCounter++;
    theStack.add(o);
  }

  /** Pop's an object off the top of the stack.
   *  @return Object o
   */
  public Object Pop() {
    Object remObj = new Object();
    if (StackCounter > -1) {
      remObj = theStack.remove(StackCounter);
      StackCounter--;
     }
     return remObj;
  }

  /** Checks to see if the stack is empty.
   *  @return boolean - If true the stack is empty.
   */
  public boolean StackNotEmpty() {
    if (StackCounter > -1)
      return true;
    else
      return false;
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -