public static StringBuilder getFree() {
   synchronized (free) {
     if (free.size() == 0) {
       return new StringBuilder(1024 * 1024);
     } else {
       return (StringBuilder) free.pop();
     }
   }
 }
示例#2
0
  public static boolean pushTabOrEnterKey() {
    if (currentTabBlock != null) {
      if (parameterIdx == currentTabBlock.parameterBeginOffsetIdx.length - 1) {
        // 最后一个参数
        final TabBlock popBlock = (TabBlock) tabBlockStack.pop();
        if (popBlock != null) {
          currentTabBlock = popBlock;
          parameterIdx = currentTabBlock.lastParameterIdxBeforeStack;
          currentTabBlock.parameterEndOffsetIdx[parameterIdx] += inputShiftOffset;
          inputShiftOffset = 0;
          pushTabOrEnterKey();
          return true;
        }
        calculateIdx(); // 重新更新currFocusHighlightEndIdx标位
        clearHighlight();

        // 跳到方法尾
        currentTabBlock = null;
        scriptPanel.setCaretPosition(currFocusHighlightEndIdx + 1); // +1=)
        return true;
      } else {
        parameterIdx++;
        focusParameter();
        return true;
      }
    }
    return false;
  }
示例#3
0
  public static void clearAll() {
    clearHighlight();

    if (currentTabBlock != null) {
      tabBlockStack.removeAllElements();
      currentTabBlock = null;
    }
  }
  public static void cycle(final StringBuilder sb) {
    if (sb == null) {
      return;
    }

    sb.setLength(0);

    synchronized (free) {
      free.push(sb);
    }
  }
示例#5
0
  public static void setCurrentTabBlock(
      final int startIdx, final char[] methods, final int parameterNum) {
    final TabBlock newBlock = new TabBlock(startIdx, methods, parameterNum);
    if (currentTabBlock != null) {
      currentTabBlock.lastParameterIdxBeforeStack = parameterIdx;
      tabBlockStack.push(currentTabBlock);
    }

    currentTabBlock = newBlock;
    parameterIdx = 0;
    inputShiftOffset = 0;

    focusParameter();
  }