forked from Dipesh1009/Ludo-Algorithm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStackTest.java
More file actions
39 lines (32 loc) · 677 Bytes
/
StackTest.java
File metadata and controls
39 lines (32 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.util.Stack;
public class StackTest {
Stack<tokenTest> house = new Stack<tokenTest>();
nodeTest nodeGate = null;
StackTest() {}
StackTest (nodeTest node1) {
this.nodeGate = node1;
}
boolean overflow(){
if (house.size() < 4) {
return false;
}
return true;
}
void in (tokenTest T){
if (!(overflow())){
return;
}
house.push(T);
}
void out (){
if (house.empty()){
return;
}
house.pop();
}
tokenTest top () {
tokenTest T = new tokenTest();
T = house.peek();
return T;
}
}