All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jadex.bpmn.model.MContextVariable Maven / Gradle / Ivy

The newest version!
package jadex.bpmn.model;

import jadex.bridge.modelinfo.Argument;
import jadex.bridge.modelinfo.UnparsedExpression;

import java.util.HashMap;
import java.util.Map;

public class MContextVariable extends Argument
{
	/** Initial values for configurations */
	protected Map configinitialvalues;
	
	/**
	 *  Create a new argument.
	 */
	public MContextVariable()
	{
	}
	
	/**
	 *  Create a new argument.
	 */
	public MContextVariable(String name, String description, String classname, String defaultvalue)
	{
		super(name, description, classname, defaultvalue);
	}
	
	/**
	 *  Removes the value for a specific configuration.
	 *  
	 *  @param config The configuration.
	 *  @return The expression.
	 */
	public UnparsedExpression removeValue(String config)
	{
		return configinitialvalues != null? configinitialvalues.remove(config) : null;
	}
	
	/**
	 *  Get the value for a specific configuration.
	 *  
	 *  @param config The configuration.
	 *  @return The expression.
	 */
	public UnparsedExpression getValue(String config)
	{
		return configinitialvalues != null? configinitialvalues.get(config) != null? configinitialvalues.get(config) : this : this;
	}
	
	/**
	 *  Get the value for a specific configuration only.
	 *  
	 *  @param config The configuration.
	 *  @return The expression.
	 */
	public UnparsedExpression getConfigValue(String config)
	{
		return configinitialvalues != null? configinitialvalues.get(config) : null;
	}
	
	/**
	 *  Set the value for a specific configuration.
	 *  
	 *  @param config The configuration.
	 *  @return The expression.
	 */
	public void setValue(String config, UnparsedExpression value)
	{
		if (configinitialvalues == null)
		{
			configinitialvalues = new HashMap();
		}
		configinitialvalues.put(config, value);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy