public static Separator valueOf(Token token) { for (Separator separator : values()) { if (separator.getTokenValue().equals(token.getTokenValue())) { return separator; } } return null; }
public static Separator valueOf(String str) { for (Separator separator : values()) { if (separator.getTokenValue().equals(str)) { return separator; } } return null; }
static { VALUES[0] = SEMICOLON; VALUES[1] = COMMA; VALUES[2] = PERIOD; VALUES[3] = LEFT_PARENTHESIS_DELIMITER; VALUES[4] = RIGHT_PARENTHESIS_DELIMITER; VALUES[5] = LEFT_BRACE_DELIMITER; VALUES[6] = RIGHT_BRACE_DELIMITER; VALUES[7] = LEFT_BRACKET_DELIMITER; VALUES[8] = RIGHT_BRACKET_DELIMITER; LEFT_BRACE_DELIMITER.setOpposite(RIGHT_BRACE_DELIMITER); LEFT_BRACKET_DELIMITER.setOpposite(RIGHT_BRACKET_DELIMITER); LEFT_PARENTHESIS_DELIMITER.setOpposite(RIGHT_PARENTHESIS_DELIMITER); }