<commit_before>/*******************************************************************************
 * (c) Copyright 2016 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 com.google.common.base.Function;
import com.google.common.collect.Collections2;
import com.hp.oo.sdk.content.plugin.SerializableSessionObject;
import io.cloudslang.lang.entities.NavigationOptions;
import io.cloudslang.lang.entities.SystemProperty;
import io.cloudslang.lang.entities.bindings.prompt.Prompt;
import io.cloudslang.lang.entities.bindings.values.SensitiveValue;
import io.cloudslang.lang.entities.bindings.values.Value;
import io.cloudslang.score.api.StatefulSessionStack;
import org.apache.commons.lang3.Validate;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * User: stoneo
 * Date: 20/10/2014
 * Time: 10:28
 */
public class RunEnvironment implements Serializable {

    // Call arguments for the current step
    private Map<String, Value> callArguments;

    // Return values from the current step
    private ReturnValues returnValues;

    // The position of the next step
    private Long nextStepPosition;

    // Navigation options, e.g. ROI value for each navigation step
    private Map<String, List<NavigationOptions>> navigationOptions;

    // Stack holding the contexts of the parent scopes
    private ContextStack contextStack;

    // Stack of the parent flow's data (for the sub-flow use-case)
    private ParentFlowStack parentFlowStack;

    private ExecutionPath executionPath;

    private final Set<SystemProperty> systemProperties;

    // Map holding serializable data that is common for the entire run
    // This is data that should be shared between different actions with the ability to change the data
    private Map<String, SerializableSessionObject> serializableDataMap;

    private StatefulSessionStack statefulSessionStack;

    //prompt args for current step
    private Map<String, Prompt> promptArguments;

    //Map holding already prompted values
    private Map<String, Value> promptedValues;

    public RunEnvironment(Set<SystemProperty> systemProperties) {
        Validate.notNull(systemProperties, "system properties cannot be null");
        contextStack = new ContextStack();
        parentFlowStack = new ParentFlowStack();
        callArguments = new HashMap<>();
        executionPath = new ExecutionPath();
        serializableDataMap = new HashMap<>();
        statefulSessionStack = new StatefulSessionStack();
        this.systemProperties = systemProperties;
        promptArguments = new LinkedHashMap<>();
        promptedValues = new HashMap<>();
    }

    public RunEnvironment() {
        this(new HashSet<SystemProperty>());
    }

    public ContextStack getStack() {
        return contextStack;
    }

    public ParentFlowStack getParentFlowStack() {
        return parentFlowStack;
    }

    public void setParentFlowStack(ParentFlowStack parentFlowStack) {
        this.parentFlowStack = parentFlowStack;
    }

    public Map<String, Value> removeCallArguments() {
        Map<String, Value> callArgumentsValues = callArguments;
        callArguments = new HashMap<>();
        return callArgumentsValues;
    }

    public void putCallArguments(Map<String, Value> callArguments) {
        this.callArguments.putAll(callArguments);
    }
<commit_msg>- removed setter<commit_after>/*******************************************************************************
 * (c) Copyright 2016 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 com.google.common.base.Function;
import com.google.common.collect.Collections2;
import com.hp.oo.sdk.content.plugin.SerializableSessionObject;
import io.cloudslang.lang.entities.NavigationOptions;
import io.cloudslang.lang.entities.SystemProperty;
import io.cloudslang.lang.entities.bindings.prompt.Prompt;
import io.cloudslang.lang.entities.bindings.values.SensitiveValue;
import io.cloudslang.lang.entities.bindings.values.Value;
import io.cloudslang.score.api.StatefulSessionStack;
import org.apache.commons.lang3.Validate;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * User: stoneo
 * Date: 20/10/2014
 * Time: 10:28
 */
public class RunEnvironment implements Serializable {

    // Call arguments for the current step
    private Map<String, Value> callArguments;

    // Return values from the current step
    private ReturnValues returnValues;

    // The position of the next step
    private Long nextStepPosition;

    // Navigation options, e.g. ROI value for each navigation step
    private Map<String, List<NavigationOptions>> navigationOptions;

    // Stack holding the contexts of the parent scopes
    private ContextStack contextStack;

    // Stack of the parent flow's data (for the sub-flow use-case)
    private ParentFlowStack parentFlowStack;

    private ExecutionPath executionPath;

    private final Set<SystemProperty> systemProperties;

    // Map holding serializable data that is common for the entire run
    // This is data that should be shared between different actions with the ability to change the data
    private Map<String, SerializableSessionObject> serializableDataMap;

    private StatefulSessionStack statefulSessionStack;

    //prompt args for current step
    private Map<String, Prompt> promptArguments;

    //Map holding already prompted values
    private Map<String, Value> promptedValues;

    public RunEnvironment(Set<SystemProperty> systemProperties) {
        Validate.notNull(systemProperties, "system properties cannot be null");
        contextStack = new ContextStack();
        parentFlowStack = new ParentFlowStack();
        callArguments = new HashMap<>();
        executionPath = new ExecutionPath();
        serializableDataMap = new HashMap<>();
        statefulSessionStack = new StatefulSessionStack();
        this.systemProperties = systemProperties;
        promptArguments = new LinkedHashMap<>();
        promptedValues = new HashMap<>();
    }

    public RunEnvironment() {
        this(new HashSet<SystemProperty>());
    }

    public ContextStack getStack() {
        return contextStack;
    }

    public ParentFlowStack getParentFlowStack() {
        return parentFlowStack;
    }

    public Map<String, Value> removeCallArguments() {
        Map<String, Value> callArgumentsValues = callArguments;
        callArguments = new HashMap<>();
        return callArgumentsValues;
    }

    public void putCallArguments(Map<String, Value> callArguments) {
        this.callArguments.putAll(callArguments);
    }

{'fraction_non_alphanumeric': 0.12140240711669283, 'fraction_numerical': 0.0057561486132914706, 'mean_word_length': 3.9869536855838223, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1894606', 'n_tokens_mistral': 1967, 'n_tokens_neox': 1890, 'n_words': 576}