Пример #1
0
 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;
 }
Пример #2
0
 // 从文本输入中解析出一个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;
 }
Пример #3
0
 public MathSignQueue append(MathSignQueue tail) {
   for (int i = 0; i < tail.size(); i++) {
     this.mMathSigns.add(tail.mMathSigns.get(i));
   }
   return this;
 }