class PatternRuleId {

  private final String id;
  private final String subId;

  /**
   * @param id the rule id
   */
  public PatternRuleId(String id) {
    Validate.notEmpty(id, "id must be set");
    this.id = id;
    this.subId = null;
  }

  /**
   * @param id the rule id
   * @param subId the sub id of a rulegroup, starting at {@code 1}
   */
  public PatternRuleId(String id, String subId) {
    Validate.notEmpty(id, "id must be set");
    Validate.notEmpty(subId, "subId must be set, if specified");
    this.id = id;
    this.subId = subId;
  }

  public String getId() {
    return id;
  }

  /**
   * @return a sub id or {@code null} if no sub id has been set
   */
  @Nullable
  public String getSubId() {
    return subId;
  }

  @Override
  public String toString() {<FILL_FUNCTION_BODY>}

}

    if (subId != null) {
      return id + "[" + subId + "]";
    } else {
      return id;
    }
  
<no_super_class>