public MathSignQueue subQueue(int start, int end) { MathSignQueue subQueue = new MathSignQueue(); subQueue.mAngularUnit = mAngularUnit; while (start < end) { subQueue.mMathSigns.add(this.mMathSigns.get(start++)); } return subQueue; }
// 从文本输入中解析出一个MathSignQueue public static MathSignQueue parse(String input) throws CalcException { MathSignQueue queue = new MathSignQueue(); if (input == null || input.length() == 0) { throw new CalcException("输入为空"); } queue.mTextInput = input; while (queue.mParseIndex < input.length()) { if (!queue.parseOneSign()) { throw new CalcException("不能解析的部分", queue.mParseIndex, queue.mTextInput.length()); } } return queue; }
public MathSignQueue append(MathSignQueue tail) { for (int i = 0; i < tail.size(); i++) { this.mMathSigns.add(tail.mMathSigns.get(i)); } return this; }