Beispiel #1
0
 public override string GenerateContent(Namespace data)
 {
     Datum datum = data.Get(DataName);
       if (datum != null) {
     return datum.ToString();
       } else {
     return ToString();
       }
 }
Beispiel #2
0
        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());
        }
Beispiel #3
0
 public override void TagWillBeReplaced(TagBase tag, Namespace data)
 {
     oldValue = data.Get(dataName);
     base.TagWillBeReplaced(tag, data);
 }