public override string GenerateContent(Namespace data) { Datum datum = data.Get(DataName); if (datum != null) { return datum.ToString(); } else { return ToString(); } }
public Datum Evaluate(Namespace data) { if (this.Count == 0) { return(new NumericDatum(1)); } Stack <Datum> stack = new Stack <Datum>(); foreach (Instruction instruction in this) { switch (instruction.OpCode) { case OpCode.Literal: stack.Push(instruction.Datum); break; case OpCode.Get: stack.Push(data.Get(instruction.DataName)); break; case OpCode.Minimum: DoMinimum(stack); break; case OpCode.Maximum: DoMaximum(stack); break; case OpCode.Add: DoAdd(stack); break; case OpCode.Subtract: DoSubtract(stack); break; case OpCode.Multiply: DoMultiply(stack); break; case OpCode.Divide: DoDivide(stack); break; case OpCode.Modulo: DoModulo(stack); break; case OpCode.Not: DoNot(stack); break; case OpCode.And: DoAnd(stack); break; case OpCode.Or: DoOr(stack); break; case OpCode.Equal: DoEqual(stack); break; case OpCode.NotEqual: DoNotEqual(stack); break; case OpCode.LessThan: DoLessThan(stack); break; case OpCode.LessThanOrEquals: DoLessThanOrEquals(stack); break; case OpCode.GreaterThan: DoGreaterThan(stack); break; case OpCode.GreaterThanOrEquals: DoGreaterThanOrEquals(stack); break; } } return(stack.Pop()); }
public override void TagWillBeReplaced(TagBase tag, Namespace data) { oldValue = data.Get(dataName); base.TagWillBeReplaced(tag, data); }