int (int index) { MessagePattern.Part part = myPattern.getPart(index); if (part.getType() != MessagePattern.Part.Type.ARG_START) return 0; int limitPart = myPattern.getLimitPartIndex(index); int msgCount = 0; int nesting = -1; for (int i = index + 1; i < limitPart; i++) { part = myPattern.getPart(i); if (part.getType() == MessagePattern.Part.Type.MSG_START) { if (nesting == -1) { nesting = part.getValue(); } else if (nesting != part.getValue()) { continue; } msgCount++; } } return msgCount; }