class GermanHelper {

  private GermanHelper() {
  }

  public static boolean hasReadingOfType(AnalyzedTokenReadings tokenReadings, GermanToken.POSType type) {
    if (tokenReadings == null) {
      return false;
    }
    for (AnalyzedToken token : tokenReadings) {
      if (token.getPOSTag() != null &&
          (token.getPOSTag().equals(JLanguageTool.SENTENCE_END_TAGNAME) ||
           token.getPOSTag().equals(JLanguageTool.PARAGRAPH_END_TAGNAME))) {
        return false;
      }
      AnalyzedGermanToken germanToken = new AnalyzedGermanToken(token);
      if (germanToken.getType() == type) {
        return true;
      }
    }
    return false;
  }

  /**
   * @since 2.4
   */
  public static String getNounCase(String posTag) {
    // input e.g. SUB:AKK:SIN:NEU
    return getIndexOrEmptyString(posTag, 1);
  }

  /**
   * @since 2.4
   */
  public static String getNounNumber(String posTag) {
    return getIndexOrEmptyString(posTag, 2);
  }

  /**
   * @since 2.4
   */
  public static String getNounGender(String posTag) {
    return getIndexOrEmptyString(posTag, 3);
  }

  /**
   * @since 2.4
   */
  public static String getDeterminerDefiniteness(String posTag) {
    // input e.g. ART:DEF:DAT:SIN:FEM
    return getIndexOrEmptyString(posTag, 1);
  }

  /**
   * @return GRU, KOM, or SUP
   * @since 5.4
   */
  public static String getComparison(String posTag) {
    // input e.g. ADJ:AKK:PLU:MAS:KOM:SOL
    String cmp = getIndexOrEmptyString(posTag, 4);
    if (!cmp.equals("GRU") && !cmp.equals("KOM") && !cmp.equals("SUP")) {
      // for cases like "PA2:PRD:GRU:VER"
      cmp = getIndexOrEmptyString(posTag, 2);
    }
    return cmp;
  }

  /**
   * @since 2.4
   */
  public static String getDeterminerCase(String posTag) {
    return getIndexOrEmptyString(posTag, 2);
  }

  /**
   * @since 2.4
   */
  public static String getDeterminerNumber(String posTag) {
    return getIndexOrEmptyString(posTag, 3);
  }

  /**
   * @since 2.4
   */
  public static String getDeterminerGender(String posTag) {
    return getIndexOrEmptyString(posTag, 4);
  }

  private static String getIndexOrEmptyString(String posTag, int idx) {<FILL_FUNCTION_BODY>}

}

    if (posTag == null) {
      return "";
    }
    String[] array = posTag.split(":");
    if (array.length > idx) {
      return array[idx];
    } else {
      return "";
    }
  
<no_super_class>