Builds a {@link String term string} where {@link Parameter parameters}
are replaced with {@code #} characters.

@param t {@link Term}
@param b {@link StringBuilder}
347657
private static void replaceParameters(Term t, StringBuilder b) {
        FunctionEnum f = t.getFunctionEnum();
        String fx = f.getShortestForm();
        b.append(fx).append("(");
        if (hasItems(t.getFunctionArguments())) {
            for (BELObject bo : t.getFunctionArguments()) {
                if (Term.class.isAssignableFrom(bo.getClass())) {
                    Term inner = (Term) bo;
                    if (inner.getFunctionEnum() == PROTEIN_MODIFICATION ||
                        inner.getFunctionEnum() == SUBSTITUTION ||
                        inner.getFunctionEnum() == TRUNCATION) {
                        b.append(inner.toBELShortForm());
                    } else {
                        replaceParameters((Term) bo, b);
                    }
                } else {
                    b.append("#");
                }
                b.append(",");
            }
            b.deleteCharAt(b.length() - 1);
            b.append(")");
        }
    }
1372203
public void writeParamsToStub(VariableElement param, ParamType paramType, String paramName, MethodSpec.Builder methodBuilder) {
        methodBuilder.addStatement("$T " + paramName, param.asType());
    }
1103507
public static String readString(Reader is, String term) throws IOException {
        CharArrayWriter baos = new CharArrayWriter();

        int ch_int;
        char last = term.charAt(term.length() - 1);
        while ((ch_int = is.read()) >= 0) {
            final char ch = (char) ch_int;
            baos.write(ch);
            if (ch == last && baos.size() >= term.length()) {
                String tmp = baos.toString();
                if (tmp.substring(tmp.length() - term.length())
                       .equals(term)) {
                    return tmp.substring(0, tmp.length() - term.length());
                }
            }
        }

        return baos.toString();
    }
32189
private static void serializeString(StringBuilder builder, String str) {
    builder.append('"');
    int last = 0;
    int length = str.length();
    for (int i = 0; i < length; i++) {
      char c = str.charAt(i);
      String replacement;
      if (c < 128) {
        replacement = REPLACEMENT_CHARS[c];
        if (replacement == null) {
          continue;
        }
      } else if (c == '\u2028') {
        replacement = "\\u2028";
      } else if (c == '\u2029') {
        replacement = "\\u2029";
      } else {
        continue;
      }
      if (last < i) {
        builder.append(str, last, i);
      }
      builder.append(replacement);
      last = i + 1;
    }
    if (last < length) {
      builder.append(str, last, length);
    }
    builder.append('"');
  }
1112948
private List<ImmutableTerm> addToTermsList(String str) {
        ArrayList<ImmutableTerm> terms = new ArrayList<>();
        int i, j;
        String st;
        str = str.substring(1, str.length() - 1);
        while (str.contains("{")) {
            i = getIndexOfCurlyB(str);
            if (i > 0) {
                st = str.substring(0, i);
                st = st.replace("\\\\", "");
                terms.add(termFactory.getConstantLiteral(st));
                str = str.substring(str.indexOf("{", i), str.length());
            } else if (i == 0) {
                j = str.indexOf("}");
                terms.add(termFactory.getVariable(str.substring(1, j)));
                str = str.substring(j + 1, str.length());
            } else {
                break;
            }
        }
        if (!str.equals("")) {
            str = str.replace("\\\\", "");
            terms.add(termFactory.getConstantLiteral(str));
        }
        return terms;
    }
680647
public StringBuilder process(StringBuilder source) {
        CharSequence result = process((CharSequence) source);
        if (result instanceof StringBuilder) {
            return (StringBuilder) result;
        } else {
            return new StringBuilder(result);
        }
    }
389264
private void _buildParameter(
                    final Object value,
                    final StringBuilder stmt,
                    final List<Object> params
                    )
    {
        params.add( value );
        stmt.append( _PARAM_SIGN_ ).append( params.size() );
    }
1237030
public void set(byte b, Collection c) {
		if ((c != null) && (c.size() > 0)) {
			StringBuilder sb = new StringBuilder();
			Iterator it = c.iterator();
			while (it.hasNext()) {
				String s = (String) it.next();
				sb.append(s);
				if (it.hasNext())
					sb.append(lineSeparator);
			}
			set(b, sb.toString());
		} else
			remove(b);
	}
810592
private List<Term> analysisStr(String temp) {
        Graph gp = new Graph(temp);
        int startOffe = 0;

        if (this.ambiguityForest != null) {
            GetWord gw = new GetWord(this.ambiguityForest, gp.chars);
            String[] params = null;
            while ((gw.getFrontWords()) != null) {
                if (gw.offe > startOffe) {
                    analysis(gp, startOffe, gw.offe);
                }
                params = gw.getParams();
                startOffe = gw.offe;
                for (int i = 0; i < params.length; i += 2) {
                    gp.addTerm(new Term(params[i], startOffe, new TermNatures(new TermNature(params[i + 1], 1))));
                    startOffe += params[i].length();
                }
            }
        }
        if (startOffe < gp.chars.length) {
            analysis(gp, startOffe, gp.chars.length);
        }
        List<Term> result = this.getResult(gp);

        return result;
    }
1130648
private void genOptFormalTypeParameters(
      List<? extends TypeParameterElement> typeParameters, StringBuilder sb) {
    if (!typeParameters.isEmpty()) {
      sb.append('<');
      for (TypeParameterElement typeParam : typeParameters) {
        genFormalTypeParameter(typeParam, sb);
      }
      sb.append('>');
    }
  }
1348763
public static FormattedStringBuilder wrap(StringBuilder builder) {
        FormattedStringBuilder b = new FormattedStringBuilder();
        b._delegate = builder;
        return b;
    }
1319105
protected StringBuilder style(StringBuilder b, String line, Color color, Style style){
    if(color != Color.NONE || style != Style.NONE){
      b.append(color.ansiCode);
      b.append(style.ansiCode);
      b.append(line);
      b.append("\033[0m");
    } else {
      b.append(line);
    }
    return b;
  }
686813
@NonNull
  public static Term typeHint(@NonNull Term term, @NonNull DataType targetType) {
    return new TypeHintTerm(term, targetType);
  }
570788
@NonNull
  public static Term function(
      @Nullable CqlIdentifier keyspaceId,
      @NonNull CqlIdentifier functionId,
      @NonNull Iterable<Term> arguments) {
    return new FunctionTerm(keyspaceId, functionId, arguments);
  }
551843
StringBuilder subBuf(int start, int end) {
		if (start > end) {
			return null;
		}
		StringBuilder ret = new StringBuilder(end - start + 1);
		for (int i=start; i<=end; i++) {
			ret.append(buf[i]);
		}
		return ret;
	}
1170255
private String escapeText(StringBuilder sb, String text)
   {
      int length = text.length();
      char c;

      sb.setLength(0);

      for (int loop = 0; loop < length; loop++)
      {
         c = text.charAt(loop);

         switch (c)
         {
            case '<':
            {
               sb.append("&lt;");
               break;
            }

            case '>':
            {
               sb.append("&gt;");
               break;
            }

            case '&':
            {
               sb.append("&amp;");
               break;
            }

            default:
            {
               if (validXMLCharacter(c))
               {
                  if (c > 127)
                  {
                     sb.append("&#" + (int) c + ";");
                  }
                  else
                  {
                     sb.append(c);
                  }
               }

               break;
            }
         }
      }

      return (sb.toString());
   }
339247
public SpannableStringBuilder replace(final int start, final int end,
            CharSequence tb, int tbstart, int tbend) {
        checkRange("replace", start, end);

        int filtercount = mFilters.length;
        for (int i = 0; i < filtercount; i++) {
            CharSequence repl = mFilters[i].filter(tb, tbstart, tbend, this, start, end);

            if (repl != null) {
                tb = repl;
                tbstart = 0;
                tbend = repl.length();
            }
        }

        final int origLen = end - start;
        final int newLen = tbend - tbstart;

        if (origLen == 0 && newLen == 0 && !hasNonExclusiveExclusiveSpanAt(tb, tbstart)) {
            // This is a no-op iif there are no spans in tb that would be added (with a 0-length)
            // Early exit so that the text watchers do not get notified
            return this;
        }

        TextWatcher[] textWatchers = getSpans(start, start + origLen, TextWatcher.class);
        sendBeforeTextChanged(textWatchers, start, origLen, newLen);

        // Try to keep the cursor / selection at the same relative position during
        // a text replacement. If replaced or replacement text length is zero, this
        // is already taken care of.
        boolean adjustSelection = origLen != 0 && newLen != 0;
        int selectionStart = 0;
        int selectionEnd = 0;
        if (adjustSelection) {
            selectionStart = Selection.getSelectionStart(this);
            selectionEnd = Selection.getSelectionEnd(this);
        }

        change(start, end, tb, tbstart, tbend);

        if (adjustSelection) {
            if (selectionStart > start && selectionStart < end) {
                final int offset = (selectionStart - start) * newLen / origLen;
                selectionStart = start + offset;

                setSpan(false, Selection.SELECTION_START, selectionStart, selectionStart,
                        Spanned.SPAN_POINT_POINT);
            }
            if (selectionEnd > start && selectionEnd < end) {
                final int offset = (selectionEnd - start) * newLen / origLen;
                selectionEnd = start + offset;

                setSpan(false, Selection.SELECTION_END, selectionEnd, selectionEnd,
                        Spanned.SPAN_POINT_POINT);
            }
        }

        sendTextChanged(textWatchers, start, origLen, newLen);
        sendAfterTextChanged(textWatchers);

        // Span watchers need to be called after text watchers, which may update the layout
        sendToSpanWatchers(start, end, newLen - origLen);

        return this;
    }