Print() public method

public Print ( ) : string
return string
        protected FuncDrawOperation(Player player, Command cmd)
            : base(player)
        {
            string strFunc = cmd.Next();
            if (string.IsNullOrWhiteSpace(strFunc))
            {
                player.Message("&WEmpty function expression");
                return;
            }
            if (strFunc.Length < 3)
            {
                player.Message("&WExpression is too short (should be like z=f(x,y))");
                return;
            }

            strFunc = strFunc.ToLower();

            _vaxis = GetAxis(SimpleParser.PreparseAssignment(ref strFunc));

            _expression = SimpleParser.Parse(strFunc, GetVarArray(_vaxis));

            Player.Message("Expression parsed as "+_expression.Print());
            string scalingStr=cmd.Next();
            _scaler = new Scaler(scalingStr);
        }
Example #2
0
        protected FuncDrawOperation(Player player, Command cmd)
            : base(player)
        {
            string strFunc = cmd.Next();

            if (string.IsNullOrWhiteSpace(strFunc))
            {
                player.Message("&WEmpty function expression");
                return;
            }
            if (strFunc.Length < 3)
            {
                player.Message("&WExpression is too short (should be like z=f(x,y))");
                return;
            }

            strFunc = strFunc.ToLower();

            _vaxis = GetAxis(SimpleParser.PreparseAssignment(ref strFunc));

            _expression = SimpleParser.Parse(strFunc, GetVarArray(_vaxis));

            player.Message("Expression parsed as " + _expression.Print());
            string scalingStr = cmd.Next();

            _scaler = new Scaler(scalingStr);
        }
Example #3
0
        public InequalityDrawOperation(Player player, Command cmd)
            : base(player)
        {
            string strFunc = cmd.Next();

            if (string.IsNullOrWhiteSpace(strFunc))
            {
                throw new ArgumentException("empty inequality expression");
            }
            if (strFunc.Length < 3)
            {
                throw new ArgumentException("expression is too short (should be like f(x,y,z)>g(x,y,z))");
            }

            strFunc = strFunc.ToLower();

            _expression = SimpleParser.Parse(strFunc, new string[] { "x", "y", "z" });
            if (!_expression.IsInEquality())
            {
                throw new ArgumentException(
                          "the expression given is not an inequality (should be like f(x,y,z)>g(x,y,z))");
            }

            player.Message("Expression parsed as " + _expression.Print());
            string scalingStr = cmd.Next();

            _scaler = new Scaler(scalingStr);
        }
Example #4
0
        public EqualityDrawOperation(Player player, Command cmd)
            : base(player)
        {
            string strFunc = cmd.Next();

            if (string.IsNullOrWhiteSpace(strFunc))
            {
                player.Message("empty equality expression");
                return;
            }
            if (strFunc.Length < 3)
            {
                player.Message("expression is too short (should be like f(x,y,z)=g(x,y,z))");
                return;
            }

            strFunc = strFunc.ToLower();

            _expression = SimpleParser.ParseAsEquality(strFunc, new string[] { "x", "y", "z" });

            player.Message("Expression parsed as " + _expression.Print());
            string scalingStr = cmd.Next();

            _scaler = new Scaler(scalingStr);
        }
Example #5
0
        public static void SetParametrization(Player p, Command cmd)
        {
            string strFunc = cmd.Next();

            if (string.IsNullOrWhiteSpace(strFunc))
            {
                p.Message("Error: empty parametrization expression");
                return;
            }
            if (strFunc.Length < 3)
            {
                p.Message("Error: expression is too short (should be like x=f(t,u,v))");
                return;
            }

            strFunc = strFunc.ToLower();

            try
            {
                string coordVar = SimpleParser.PreparseAssignment(ref strFunc);
                CheckCoordVar(coordVar);

                Expression expression = SimpleParser.Parse(strFunc, new string[] { "t", "u", "v" });

                p.Message("Expression parsed as " + coordVar + "=" + expression.Print());

                GetPlayerParametrizationCoordsStorage(p)[VarNameToIdx(coordVar[0])] = expression;
            }
            catch (Exception e)
            {
                p.Message("Error: " + e.Message);
            }
        }
        public InequalityDrawOperation( Player player, Command cmd )
            : base(player)
        {
            string strFunc = cmd.Next();
            if ( string.IsNullOrWhiteSpace( strFunc ) )
                throw new ArgumentException( "empty inequality expression" );
            if ( strFunc.Length < 3 )
                throw new ArgumentException( "expression is too short (should be like f(x,y,z)>g(x,y,z))" );

            strFunc = strFunc.ToLower();

            _expression = SimpleParser.Parse( strFunc, new string[] { "x", "y", "z" } );
            if ( !_expression.IsInEquality() )
                throw new ArgumentException( "the expression given is not an inequality (should be like f(x,y,z)>g(x,y,z))" );

            player.Message( "Expression parsed as " + _expression.Print() );
            string scalingStr = cmd.Next();
            _scaler = new Scaler( scalingStr );
        }
        public EqualityDrawOperation( Player player, Command cmd )
            : base(player)
        {
            string strFunc = cmd.Next();
            if ( string.IsNullOrWhiteSpace( strFunc ) ) {
                player.Message( "empty equality expression" );
                return;
            }
            if ( strFunc.Length < 3 ) {
                player.Message( "expression is too short (should be like f(x,y,z)=g(x,y,z))" );
                return;
            }

            strFunc = strFunc.ToLower();

            _expression = SimpleParser.ParseAsEquality( strFunc, new string[] { "x", "y", "z" } );

            player.Message( "Expression parsed as " + _expression.Print() );
            string scalingStr = cmd.Next();
            _scaler = new Scaler( scalingStr );
        }