/*******************************************************************************
 * (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Apache License v2.0 which accompany this distribution.
 *
 * The Apache License is available at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 *******************************************************************************/
package io.cloudslang.lang.runtime.env;

import org.apache.commons.lang3.StringUtils;

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

/**
 * @author moradi
 * @since 06/11/2014
 */
public class ExecutionPath implements Serializable {

    public static final String PATH_SEPARATOR = "/";

    private Deque<Integer> parentPositions;
    private int position;

    public ExecutionPath() {
        parentPositions = new ArrayDeque<>();
    }

    public int forward() {
        return position++;
    }

    public int down() {
        parentPositions.push(position);
        position = 0;
        return position;
    }

    public int up() {
        position = parentPositions.pop();
        return position;
    }

    public int getDepth() {
        return parentPositions.size();
    }

    public String getCurrentPath() {
        return getCurrentPath(position);
    }

    public String getCurrentPathPeekForward() {
        return getCurrentPath(position + 1);
    }

    private String getCurrentPath(int position) {
        String parents = StringUtils.join(parentPositions.descendingIterator(), PATH_SEPARATOR);
        return StringUtils.isEmpty(parents) ? position + "" : parents + PATH_SEPARATOR + position;
    }

}

@@ -648,16 +648,74 @@
 Deque;%0A%0A
+import static org.apache.commons.lang3.StringUtils.join;%0A%0A
 /**%0A * @
@@ -1025,19 +1025,20 @@
  public 
-int
+void
  forward
@@ -1042,39 +1042,32 @@
 ard() %7B%0A        
-return 
 position++;%0A    
@@ -1080,19 +1080,20 @@
  public 
-int
+void
  down() 
@@ -1160,33 +1160,8 @@
  0;%0A
-        return position;%0A
     
@@ -1174,19 +1174,20 @@
  public 
-int
+void
  up() %7B%0A
@@ -1232,33 +1232,8 @@
 ();%0A
-        return position;%0A
     
@@ -1569,28 +1569,16 @@
 rents = 
-StringUtils.
 join(par

make path control methods void