コード例 #1
0
  public static Separator valueOf(Token token) {
    for (Separator separator : values()) {
      if (separator.getTokenValue().equals(token.getTokenValue())) {
        return separator;
      }
    }

    return null;
  }
コード例 #2
0
  public static Separator valueOf(String str) {
    for (Separator separator : values()) {
      if (separator.getTokenValue().equals(str)) {
        return separator;
      }
    }

    return null;
  }
コード例 #3
0
  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);
  }