/**
   * Gets the offset of next lig/kern instruction in a program based on counting only those
   * intervene instructions which will be converted to final lig/kern program.
   *
   * @param pos the position of current lig/kern instruction in ligAuxTable.
   * @return Returns the skip amount of the next instruction in the final version of lig/kern
   *     program.
   */
  private int getSkip(final int pos) {

    TfmLigKernCommand lkc = ligkerncommand[pos];
    if (lkc.meansStop()) {
      return -1;
    }
    int p = pos;
    int skip = 0;
    int next = lkc.nextIndex(pos);
    while (++p < next) {
      if (ligkerncommand[pos].getActivity() != TfmLigKernCommand.PASSTHROUGH) {
        skip++;
      }
    }
    return skip;
  }
  /**
   * Marks the lig/kern instructions which are really a part of some lig/kern program (active),
   * counts the final number of lig/kern instructions, creates the blank final lig/kern table and
   * checks for errors. Uses <code>activity</code> field of LigKern for marking the activity. It
   * supposes that the first instructions of programs are already marked active. TFtoPL[70]
   */
  private void promoteActivity() {

    int ligKernLength = 0;
    for (int i = 0; i < ligkerncommand.length; i++) {
      TfmLigKernCommand lkc = ligkerncommand[i];
      if (lkc.getActivity() == TfmLigKernCommand.ACCESSIBLE) {
        if (!lkc.meansStop()) {
          int next = lkc.nextIndex(i);
          if (next < ligkerncommand.length) {
            ligkerncommand[next].setActivity(TfmLigKernCommand.ACCESSIBLE);
          } else {
            lkc.makeStop();
          }
        }
      }
      if (lkc.getActivity() != TfmLigKernCommand.PASSTHROUGH) {
        ligKernLength++;
      }
    }
    ligKernTable = new TfmLigKern[ligKernLength];
  }