First Commit
This commit is contained in:
33
com/nemez/cmdmgr/util/BranchStack.java
Normal file
33
com/nemez/cmdmgr/util/BranchStack.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.nemez.cmdmgr.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.nemez.cmdmgr.component.ChainComponent;
|
||||
|
||||
public class BranchStack {
|
||||
|
||||
private ArrayList<ChainComponent> components;
|
||||
|
||||
public BranchStack() {
|
||||
components = new ArrayList<ChainComponent>();
|
||||
}
|
||||
|
||||
public void push(ChainComponent comp) {
|
||||
components.add(comp);
|
||||
}
|
||||
|
||||
public ChainComponent pop() {
|
||||
if (components.size() > 0) {
|
||||
ChainComponent toPop = components.remove(components.size() - 1);
|
||||
return toPop;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ChainComponent get() {
|
||||
if (components.size() > 0) {
|
||||
return components.get(components.size() - 1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user