Exemplo n.º 1
0
        private static LMD_Object getElementAtStartOfAString(String input)
        {
            if (input == null || input.Length == 0)
            {
                return(new LMD_Plaintext(""));
            }

            LMD_Object lmdObj = null;

            // this is guaranteed to be a valid start of an element. The else part will take care of the escaped $
            if (input[0] == '$')
            {
                lmdObj = readMathtext(input);
            }
            // 7 is minimal length of a valid eval command - notice the parentheses!
            // simplest eval is eval(x) -> length is 7
            else if (input.Length >= 7 && input.Substring(0, 4).ToLower() == "eval")
            {
                lmdObj = readCommandtextEval(input);
            }
            // 13 is minimal length of a valid plot command - notice the parentheses and parameters
            // simplest plot is plot(x,0,5,5) -> length is 13
            else if (input.Length >= 13 && input.Substring(0, 4).ToLower() == "plot")
            {
                lmdObj = readCommandtextPlot(input);
            }

            // if no condition was satisfied, lmdObj shall be null so plaintext object will be created
            return((lmdObj == null) ? readPlaintext(input) : lmdObj);
        }
Exemplo n.º 2
0
        private void createObjects(String input)
        {
            if (input.Length == 0)
            {
                Content.Add(new LMD_Plaintext(""));
                return;
            }

            while (input.Length != 0)
            {
                LMD_Object foundElement = getElementAtStartOfAString(input);
                Content.Add(foundElement);
                input = input.Substring(foundElement.Text.Length);
            }
        }
Exemplo n.º 3
0
        public Boolean isEqualTo(LMD_Object cmpObj)
        {
            LMD_Commandtext cmpCt = cmpObj as LMD_Commandtext;

            return(cmpCt != null && Text == cmpCt.Text);
        }
Exemplo n.º 4
0
        public bool isEqualTo(LMD_Object cmpObj)
        {
            LMD_Plaintext cmpPt = cmpObj as LMD_Plaintext;

            return(cmpPt != null && Text == cmpPt.Text);
        }
Exemplo n.º 5
0
        public bool isEqualTo(LMD_Object cmpObj)
        {
            LMD_Mathtext cmpMt = cmpObj as LMD_Mathtext;

            return(cmpMt != null && Text == cmpMt.Text);
        }