hell + gui

This commit is contained in:
Lukian LEIZOUR 2024-03-26 21:59:12 +01:00
parent 4a63c7c01e
commit b05b7cd13c
9 changed files with 212 additions and 3 deletions

41
universe/Stack.java Normal file
View file

@ -0,0 +1,41 @@
// Antoine CRETUAL, Lukian LEIZOUR, 21/02/2024
package universe;
import java.util.Vector;
public class Stack <T> {
// Atributes
private Vector <T> array;
// Construcors
public Stack() {
array = new Vector<T>();
}
public Stack(Vector<T> array) {
array = array;
}
// Methods
public void push(T x) {
this.array.add(this.array.size(), x);
}
public T pop() {
T x = this.array.elementAt(this.array.size() - 1);
this.array.remove(this.array.size() - 1);
return x;
}
public int size() {
return this.array.size();
}
public Stack copy() {
return new Stack(new Vector<T>(this.array));
}
}