code: public Occurrence calcOccurrence(AgBuffer copyBuffer, List<Attribute> stack) {
          Alternative ab;
          int i;
          int j;
          int max;
          List<Occurrence> seq;
          List<Occurrence> alt;
          Attribute next;
          Occurrence occ;
  
          alt = new ArrayList<Occurrence>();
          for (i = 0; i < alternatives.size(); i++) {
              ab = alternatives.get(i);
              max = ab.getArgCount();
              seq = new ArrayList<Occurrence>();
              for (j = 0; j < max; j++) {
                  next = ab.getArgAttribute(j);
                  if (stack.indexOf(next) == -1) {
                      seq.add(copyBuffer.calcOccurrence(stack, next));
                  } else {
                      seq.add(null);
                  }
              }
              occ = Occurrence.sequence(seq);
              alt.add(occ);
          }
          return Occurrence.alternate(alt);
      }
docs: --