Skip to content

Commit

Permalink
Merge fdf08cc into c6e1ab4
Browse files Browse the repository at this point in the history
  • Loading branch information
lucian-cm committed Jul 2, 2020
2 parents c6e1ab4 + fdf08cc commit 0175640
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
package io.cloudslang.lang.runtime.env;

import java.io.Serializable;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Stack;

/**
Expand All @@ -19,24 +21,25 @@
*/
public class ContextStack implements Serializable {

private Stack<Context> stack = new Stack<>();
private Deque<Context> stack;

public ContextStack() {
stack = new ArrayDeque<>();
}

public void pushContext(Context newContext) {
stack.push(newContext);
}

public Context popContext() {
if (stack.empty()) {
if (stack.isEmpty()) {
return null;
} else {
return stack.pop();
}
return stack.pop();
}

public Context peekContext() {
if (stack.empty()) {
return null;
}
return stack.peek();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
package io.cloudslang.lang.runtime.env;

import java.io.Serializable;
import java.util.Stack;
import java.util.ArrayDeque;
import java.util.Deque;

/**
* User: stoneo
Expand All @@ -19,17 +20,22 @@
*/
public class ParentFlowStack implements Serializable {

private Stack<ParentFlowData> stack = new Stack<>();
private Deque<ParentFlowData> stack;

public ParentFlowStack() {
this.stack = new ArrayDeque<>();
}

public void pushParentFlowData(ParentFlowData newContext) {
stack.push(newContext);
}

public ParentFlowData popParentFlowData() {
if (stack.empty()) {
if (stack.isEmpty()) {
return null;
} else {
return stack.pop();
}
return stack.pop();
}

public boolean isEmpty() {
Expand Down

0 comments on commit 0175640

Please sign in to comment.