docs: public void simplify() throws ParseException {
      if (!simplified) {
        simplified = true;
        boolean optionalParts = true;
        List<MtasCQLParserBasicSentencePartCondition> newPartList;
        MtasCQLParserBasicSentencePartCondition lastPart = null;
        newPartList = new ArrayList<MtasCQLParserBasicSentencePartCondition>();
        // try and merge equal basicSentencePart (word/group) conditions
        for (MtasCQLParserBasicSentencePartCondition part : partList) {
          if ((lastPart == null) || !lastPart.equals(part)) {
            lastPart = part;
            newPartList.add(part);
            if (!part.isOptional()) {
              optionalParts = false;
            }
          } else {
            int newMinimumOccurence;
            int newMaximumOccurence;
            if (!lastPart.isOptional() && !part.isOptional()) {
              newMinimumOccurence = lastPart.getMinimumOccurence()
                  + part.getMinimumOccurence();
              newMaximumOccurence = lastPart.getMaximumOccurence()
                  + part.getMaximumOccurence();
              lastPart.setOccurence(newMinimumOccurence, newMaximumOccurence);
            } else if (!lastPart.isOptional() && part.isOptional()) {
              if (part.getMinimumOccurence() == 1) {
                newMinimumOccurence = lastPart.getMinimumOccurence()
                    + part.getMinimumOccurence() - 1;
                newMaximumOccurence = lastPart.getMaximumOccurence()
                    + part.getMaximumOccurence();
                lastPart.setOccurence(newMinimumOccurence, newMaximumOccurence);
              } else {
                lastPart = part;
                newPartList.add(part);
                if (!part.isOptional()) {
                  optionalParts = false;
                }
              }
            } else if (lastPart.isOptional() && !part.isOptional()) {
              if (lastPart.getMinimumOccurence() == 1) {
                newMinimumOccurence = lastPart.getMinimumOccurence()
                    + part.getMinimumOccurence() - 1;
                newMaximumOccurence = lastPart.getMaximumOccurence()
                    + part.getMaximumOccurence();
                lastPart.setOccurence(newMinimumOccurence, newMaximumOccurence);
                lastPart.setOptional(false);
                optionalParts = false;
              } else {
                lastPart = part;
                newPartList.add(part);
                optionalParts = false;
              }
            } else {
              if ((lastPart.getMinimumOccurence() == 1)
                  && (part.getMinimumOccurence() == 1)) {
                newMinimumOccurence = 1;
                newMaximumOccurence = lastPart.getMaximumOccurence()
                    + part.getMaximumOccurence();
                lastPart.setOccurence(newMinimumOccurence, newMaximumOccurence);
                lastPart.setOptional(true);
              } else {
                lastPart = part;
                newPartList.add(part);
              }
            }
          }
        }
        partList = newPartList;
        if (optionalParts) {
          optional = true;
        }
      }
    }