public static bool IsCircleEquation(
            this Equation eq, 
            out CircleSymbol cs, bool allowEval = false)
        {
            Debug.Assert(eq != null);
            Debug.Assert(eq.Rhs != null);
            cs = null;
            Circle circle;
            bool matched = SatisfySpecialForm(eq, out circle);
            if (matched)
            {
                cs = new CircleSymbol(circle);
                circle.Label = eq.EqLabel;
                #region TODO Trace
                /*                if (eq.Traces.Count == 1)
                {
                    var strategy = "Generate a line by manipulating algebraic equation.";
                    var newTrace = new Tuple<object, object>(strategy, eq.Traces[0].Item2);
                    ls.Traces.Add(newTrace);
                    //ls.ImportTrace(eq);
                }
                TraceInstructionalDesign.LineSlopeIntercepToGraph(ls);*/
                #endregion
                return true;
            }

            object obj;
            bool? result = eq.Eval(out obj, true, true); // without transitive equational rule.
            if (result != null) return false;

            var gEq = obj as Equation;
            if (gEq == null) return false;
            matched = SatisfyGeneralForm(gEq, out circle);
            if (matched)
            {
                cs = new CircleSymbol(circle);
                circle.Label = eq.EqLabel;
                #region TODO Trace
                /*                if (eq.Traces.Count == 1)
                {
                    var strategy = "Generate a line by manipulating algebraic equation.";
                    var newTrace = new Tuple<object, object>(strategy, eq.Traces[0].Item2);
                    ls.Traces.Add(newTrace);
                    //ls.ImportTrace(eq);
                }
                TraceInstructionalDesign.LineSlopeIntercepToGraph(ls);*/
                #endregion
                return true;
            }


            return false;
        }
        public static bool IsCircleEquation(
            this Equation eq,
            out CircleSymbol cs, bool allowEval = false)
        {
            Debug.Assert(eq != null);
            Debug.Assert(eq.Rhs != null);
            cs = null;
            Circle circle;
            bool   matched = SatisfySpecialForm(eq, out circle);

            if (matched)
            {
                cs           = new CircleSymbol(circle);
                circle.Label = eq.EqLabel;
                #region TODO Trace

                /*                if (eq.Traces.Count == 1)
                 * {
                 *  var strategy = "Generate a line by manipulating algebraic equation.";
                 *  var newTrace = new Tuple<object, object>(strategy, eq.Traces[0].Item2);
                 *  ls.Traces.Add(newTrace);
                 *  //ls.ImportTrace(eq);
                 * }
                 * TraceInstructionalDesign.LineSlopeIntercepToGraph(ls);*/
                #endregion
                return(true);
            }

            object obj;
            bool?  result = eq.Eval(out obj, true, true); // without transitive equational rule.
            if (result != null)
            {
                return(false);
            }

            var gEq = obj as Equation;
            if (gEq == null)
            {
                return(false);
            }
            matched = SatisfyGeneralForm(gEq, out circle);
            if (matched)
            {
                cs           = new CircleSymbol(circle);
                circle.Label = eq.EqLabel;
                #region TODO Trace

                /*                if (eq.Traces.Count == 1)
                 * {
                 *  var strategy = "Generate a line by manipulating algebraic equation.";
                 *  var newTrace = new Tuple<object, object>(strategy, eq.Traces[0].Item2);
                 *  ls.Traces.Add(newTrace);
                 *  //ls.ImportTrace(eq);
                 * }
                 * TraceInstructionalDesign.LineSlopeIntercepToGraph(ls);*/
                #endregion
                return(true);
            }


            return(false);
        }
Esempio n. 3
0
 public static Expr ToExpr(this CircleSymbol cs)
 {
     return(Text.Convert(cs.ToString()));
 }