| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- package com.example.data_structure.domain;
- import java.util.ArrayList;
- public class Stack {
- public static final int MAX_SIZE =20;
- private int capacity; //栈的最大容量
- private int size; //栈现有的元素数
- private String elementType; //栈元素的类型,有char,String,int,double四种类型
- private ArrayList<Object> content;
- /**
- * 指定最大容量的构造方法
- * @param capacity
- * @param elementType
- * @param content
- */
- public Stack(int capacity,String elementType, ArrayList<Object> content) {
- this.capacity = capacity;
- this.elementType = elementType;
- this.content = content;
- }
- /**
- * 不指定最大容量的构造方法
- * @param elementType
- * @param content
- */
- public Stack( String elementType, ArrayList<Object> content) {
- this.elementType = elementType;
- this.content = content;
- }
- private boolean isFull(){
- return false;
- }
- private boolean isEmpty(){
- return true;
- }
- /**
- * push操作成功返回true,否则返回false
- * @return
- */
- public boolean push(){
- return false;
- }
- /**
- * pop()操作成功返回true,否则返回false
- * @return
- */
- public boolean pop(){
- return false;
- }
- public void makeEmpty(){
- }
- }
|