private void increaseSize(int length) {
    length = Math.max(length + 1, 4 * p.length);
    Out.debug("increasing length to " + length); // $NON-NLS-1$

    int pn[] = new int[length];
    int qn[] = new int[length];

    System.arraycopy(p, 0, pn, 0, p.length);
    System.arraycopy(q, 0, qn, 0, q.length);

    p = pn;
    q = qn;
  }
示例#2
0
  /**
   * Stores a new macro and its definition.
   *
   * @param name the name of the new macro
   * @param definition the definition of the new macro
   * @return <code>true</code>, iff the macro name has not been stored before.
   */
  public boolean insert(String name, RegExp definition) {

    if (Options.DEBUG)
      Out.debug(
          "inserting macro "
              + name
              + " with definition :"
              + Out.NL
              + definition); //$NON-NLS-1$ //$NON-NLS-2$

    used.put(name, Boolean.FALSE);
    return macros.put(name, definition) == null;
  }