Beispiel #1
0
        public override PointDataSourceBase TryBuild(object data)
        {
            string expression = data as string;

            if (expression != null)
            {
                try
                {
                    Parser parser = new Parser("x");
                    var    expr   = parser.Parse(expression).ToExpression <Func <double, double> >();
                    Func <double, double> func = expr.Compile();

                    DoubleLambdaDataSource ds = new DoubleLambdaDataSource(func);
                    return(ds);
                }
                catch (ParserException exc1)
                {
                    try
                    {
                        Parser parser = new Parser("x", "t");
                        var    expr   = parser.Parse(expression).ToExpression <Func <double, double, double> >();
                        Func <double, double, double> func = expr.Compile();

                        AnimatedDoubleLambdaDataSource ds = new AnimatedDoubleLambdaDataSource(func);
                        return(ds);
                    }
                    catch (ParserException exc2)
                    {
                    }
                }
            }

            return(null);
        }
		public override PointDataSourceBase TryBuild(object data)
		{
			string expression = data as string;
			if (expression != null)
			{
				try
				{
					Parser parser = new Parser("x");
					var expr = parser.Parse(expression).ToExpression<Func<double, double>>();
					Func<double, double> func = expr.Compile();

					DoubleLambdaDataSource ds = new DoubleLambdaDataSource(func);
					return ds;
				}
				catch (ParserException exc1)
				{
					try
					{
						Parser parser = new Parser("x", "t");
						var expr = parser.Parse(expression).ToExpression<Func<double, double, double>>();
						Func<double, double, double> func = expr.Compile();

						AnimatedDoubleLambdaDataSource ds = new AnimatedDoubleLambdaDataSource(func);
						return ds;
					}
					catch (ParserException exc2)
					{

					}
				}
			}

			return null;
		}
		public override PointDataSourceBase TryBuild(object data)
		{
			Func<double, double> func = data as Func<double, double>;
			if (func != null)
			{
				DoubleLambdaDataSource ds = new DoubleLambdaDataSource(func);
				return ds;
			}

			return null;
		}
Beispiel #4
0
        public override PointDataSourceBase TryBuild(object data)
        {
            Func <double, double> func = data as Func <double, double>;

            if (func != null)
            {
                DoubleLambdaDataSource ds = new DoubleLambdaDataSource(func);
                return(ds);
            }

            return(null);
        }