NVelocity.Runtime.Parser.Node.ASTGTNode.Evaluate C# (CSharp) Method

Evaluate() public method

public Evaluate ( IInternalContextAdapter context ) : bool
context IInternalContextAdapter
return bool
        public override bool Evaluate(IInternalContextAdapter context)
        {
            // get the two args
            Object left = GetChild(0).Value(context);
            Object right = GetChild(1).Value(context);

            // if either is null, lets log and bail
            if (left == null || right == null)
            {
                runtimeServices.Error(
                    string.Format(
                        "{0} side ({1}) of '>' operation has null value. Operation not possible. {2} [line {3}, column {4}]",
                        (left == null ? "Left" : "Right"), GetChild((left == null ? 0 : 1)).Literal, context.CurrentTemplateName, Line,
                        Column));
                return false;
            }

            try
            {
                return ObjectComparer.CompareObjects(left, right) == ObjectComparer.Greater;
            }
            catch(ArgumentException argumentException)
            {
                runtimeServices.Error(argumentException.Message);

                return false;
            }
        }