FileDocCategorySizeDatePackage
UnaryOperatorExpression.javaAPI DocGlassfish v2 API4885Sat May 05 19:17:28 BST 2007org.apache.taglibs.standard.lang.jstl

UnaryOperatorExpression

public class UnaryOperatorExpression extends Expression

An expression representing one or more unary operators on a value

author
Nathan Abramson - Art Technology Group
author
Shawn Bayern
version
$Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: tcfujii $

Fields Summary
UnaryOperator
mOperator
List
mOperators
Expression
mExpression
Constructors Summary
public UnaryOperatorExpression(UnaryOperator pOperator, List pOperators, Expression pExpression)
Constructor

    mOperator = pOperator;
    mOperators = pOperators;
    mExpression = pExpression;
  
Methods Summary
public java.lang.Objectevaluate(java.lang.Object pContext, VariableResolver pResolver, java.util.Map functions, java.lang.String defaultPrefix, Logger pLogger)
Evaluates to the literal value

    Object value = mExpression.evaluate (pContext, pResolver, functions,
					 defaultPrefix, pLogger);
    if (mOperator != null) {
      value = mOperator.apply (value, pContext, pLogger);
    }
    else {
      for (int i = mOperators.size () - 1; i >= 0; i--) {
	UnaryOperator operator = (UnaryOperator) mOperators.get (i);
	value = operator.apply (value, pContext, pLogger);
      }
    }
    return value;
  
public ExpressiongetExpression()

 return mExpression; 
public java.lang.StringgetExpressionString()
Returns the expression in the expression language syntax

    StringBuffer buf = new StringBuffer ();
    buf.append ("(");
    if (mOperator != null) {
      buf.append (mOperator.getOperatorSymbol ());
      buf.append (" ");
    }
    else {
      for (int i = 0; i < mOperators.size (); i++) {
	UnaryOperator operator = (UnaryOperator) mOperators.get (i);
	buf.append (operator.getOperatorSymbol ());
	buf.append (" ");
      }
    }
    buf.append (mExpression.getExpressionString ());
    buf.append (")");
    return buf.toString ();
  
public UnaryOperatorgetOperator()

 return mOperator; 
public java.util.ListgetOperators()

 return mOperators; 
public voidsetExpression(Expression pExpression)

 mExpression = pExpression; 
public voidsetOperator(UnaryOperator pOperator)

 mOperator = pOperator; 
public voidsetOperators(java.util.List pOperators)

 mOperators = pOperators;