示例#1
0
        public CombinedTermInequality(string inequality)
        {
            inequality = inequality.TrimStart(' ', '\t');
            inequality = inequality.TrimEnd(' ', '\t');
            while (inequality.StartsWith("(") && inequality.EndsWith(")"))
            {
                inequality = inequality.Substring(1, inequality.Length - 2);
                inequality = inequality.TrimStart(' ', '\t');
                inequality = inequality.TrimEnd(' ', '\t');
            }
            string ineqBlank = MathParser.Term.BlankCharsBetweenBrackets(inequality);

            ineqBlank = ineqBlank.Replace("->", "$$");

            int indexOfOr = ineqBlank.IndexOf("||");

            if (indexOfOr >= 0)
            {
                type = Type.Or;
                eq1  = new CombinedTermInequality(inequality.Substring(0, indexOfOr));
                eq2  = new CombinedTermInequality(inequality.Substring(indexOfOr + 2));
            }
            else
            {
                int indexOfAnd = ineqBlank.IndexOf("&&");
                if (indexOfAnd >= 0)
                {
                    type = Type.And;
                    eq1  = new CombinedTermInequality(inequality.Substring(0, indexOfAnd));
                    eq2  = new CombinedTermInequality(inequality.Substring(indexOfAnd + 2));
                }
                else
                {
                    type = Type.Unary;
                    eq1  = new TermInequality(inequality);
                }
            }
        }
示例#2
0
 public TermInequalityTerm(Term parent, int indexInParent, TermInequality inequality)
     : base(parent, indexInParent)
 {
     this.inequality = inequality;
 }