Пример #1
0
 /// <summary>
 /// Instancia um novo objecto do tipo <see cref="MathematicsInterpreter"/>.
 /// </summary>
 public MathematicsInterpreter()
 {
     this.currentResult    = new MathematicsInterpreterResult();
     this.mediator         = new MathematicsInterpreterMediator();
     this.expressionReader = this.PrepareExpressionReader();
     this.InitStates();
     this.Reset();
 }
Пример #2
0
        /// <summary>
        /// Instancia um novo objecto do tipo <see cref="NameMathematicsObject"/>.
        /// </summary>
        /// <param name="name">O nome.</param>
        /// <param name="mediator">O mediador.</param>
        /// <exception cref="ExpressionInterpreterException">Se o nome for nulo ou vazio.</exception>
        public NameMathematicsObject(string name, MathematicsInterpreterMediator mediator)
            : base(EMathematicsType.NAME, false)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ExpressionInterpreterException("Empty names aren't allowed.");
            }

            this.name     = name;
            this.mediator = mediator;
        }
Пример #3
0
 /// <summary>
 /// Instancia um novo objecto do tipo<see cref="AssignMathematicsObject"/>.
 /// </summary>
 /// <param name="leftObject">O objecto a ser atribuído.</param>
 /// <param name="rightObject">O objecto a atribuir.</param>
 /// <param name="mediator">O mediador.</param>
 /// <exception cref="ExpressionInterpreterException">
 /// Se o objecto atribuído for nulo.
 /// </exception>
 public AssignMathematicsObject(
     AMathematicsObject leftObject,
     AMathematicsObject rightObject,
     MathematicsInterpreterMediator mediator)
     : base(EMathematicsType.ASSIGN)
 {
     if (leftObject == null)
     {
         throw new ExpressionInterpreterException("Left object must be non null within an assignement.");
     }
     else
     {
         this.leftObject  = leftObject;
         this.rightObject = rightObject;
         this.mediator    = mediator;
     }
 }
Пример #4
0
 /// <summary>
 /// Instancia um novo objecto do tipo <see cref="MathematicsObjectParser"/>.
 /// </summary>
 /// <param name="mediator">O mediador.</param>
 public MathematicsObjectParser(MathematicsInterpreterMediator mediator)
 {
     this.mediator = mediator;
 }