int (String countString) { if (countString.equals(ONCE)) { return 1; } if (countString.equals(UNLIMITED)) { return -1; } if (countString.equals(UNTIL_FAILURE)) { return -2; } if (countString.equals(UNTIL_SUCCESS)) { return -3; } final String prefix = "@" + N; if (countString.startsWith(prefix)) { try { return Integer.parseInt(countString.substring(prefix.length())); } catch (NumberFormatException ignore) {} } return 0; }