SMILA (incubation) API documentation

org.eclipse.smila.jobmanager.util
Class ValueExpression

java.lang.Object
  extended by org.eclipse.smila.jobmanager.util.ValueExpression

public final class ValueExpression
extends java.lang.Object

ValueXpression encapsulates a string with potential variable references.


Field Summary
static java.lang.String VARIABLE_REGEX
          variable pattern string.
 
Constructor Summary
ValueExpression(java.lang.String expression)
          Constructs a new VariableExpression.
 
Method Summary
 boolean equals(java.lang.Object arg0)
          
 ValueExpression evaluate(java.util.Map<java.lang.String,java.lang.String> context)
          Evaluates an expression with a given context.
 ValueExpression evaluateExpr(java.util.Map<java.lang.String,ValueExpression> context)
          Evaluates an expression with a given context.
 java.util.Map<java.lang.String,java.lang.String> extractValues(java.lang.String evaluatedExpression)
          try to extract variable values from a string that should be created from the expression.
 java.lang.String getExpression()
          Returns the expression as a String.
 java.util.Collection<java.lang.String> getVariables()
          Gets the recognizes variable names in the value.
 int hashCode()
          
 boolean referencesVariables()
          Checks if this valueExpression contains a references to a variable.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

VARIABLE_REGEX

public static final java.lang.String VARIABLE_REGEX
variable pattern string.

See Also:
Constant Field Values
Constructor Detail

ValueExpression

public ValueExpression(java.lang.String expression)
Constructs a new VariableExpression.

Parameters:
expression - The expression string.
Method Detail

evaluate

public ValueExpression evaluate(java.util.Map<java.lang.String,java.lang.String> context)
Evaluates an expression with a given context.

Parameters:
context - A map with known variables, will be used to resolve variables within the expression.
Returns:
An expression with each variable references exchanged by the corresponding values in the context.

evaluateExpr

public ValueExpression evaluateExpr(java.util.Map<java.lang.String,ValueExpression> context)
Evaluates an expression with a given context.

Parameters:
context - A map with known variables, will be used to resolve variables within the expression.
Returns:
An expression with each variable references exchanged by the corresponding values in the context.

extractValues

public java.util.Map<java.lang.String,java.lang.String> extractValues(java.lang.String evaluatedExpression)
try to extract variable values from a string that should be created from the expression. Throws IllegalArgumentException if no match could be found.

Parameters:
evaluatedExpression - value that is supposed to be created from the expression.
Returns:
variable values.

referencesVariables

public boolean referencesVariables()
Checks if this valueExpression contains a references to a variable.

Returns:
true if this valueExpression contains a references to a variable.

getVariables

public java.util.Collection<java.lang.String> getVariables()
Gets the recognizes variable names in the value.

Returns:
The recognized variables.

getExpression

public java.lang.String getExpression()
Returns the expression as a String.

Returns:
The expression as a String.

equals

public boolean equals(java.lang.Object arg0)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

SMILA (incubation) API documentation