Catrobat.IDE.Core.Formulas.FormulaInterpreter.Complete2 C# (CSharp) Method

Complete2() private method

See http://stackoverflow.com/questions/160118/static-and-instance-methods-with-the-same-name.
private Complete2 ( IList tokens, int index ) : Range
tokens IList
index int
return Catrobat.IDE.Core.CatrobatObjects.Range
        private Range Complete2(IList<IFormulaToken> tokens, int index)
        {
            tokens = SetOrigin(tokens).ToList();
            var token = tokens[index];

            if (token is FormulaNodeNumber || token is FormulaTokenDecimalSeparator) return GetOrigin(CompleteNumber(tokens, index));
            if (token is FormulaTokenParenthesis) return GetOrigin(CompleteBracket(tokens, index));
            if (token is IFormulaFunction) return GetOrigin(CompleteFunction(tokens, index) ?? token);
            if (token is IFormulaOperator) return GetOrigin(CompleteOperator(tokens, index));

            return GetOrigin(token);
        }

Usage Example

        public static Range Complete(IList<IFormulaToken> tokens, int index)
        {
            //var sw = new Stopwatch();
            //sw.Start();

            // validate input
            if (tokens == null || !(0 <= index && index < tokens.Count)) return Range.Empty(0);

            // complete token
            var instance = new FormulaInterpreter();
            var result = instance.Complete2(tokens, index);

            //sw.Stop();
            // Debug.WriteLine("Interpreter.CompleteToken needed " + sw.ElapsedMilliseconds + "ms");

            return result;
        }
All Usage Examples Of Catrobat.IDE.Core.Formulas.FormulaInterpreter::Complete2