Example #1
0
 private Game createGameFromInput(String input) {
   String gameListRegex = RelayUtils.createGameListRegex();
   Pattern pattern = Pattern.compile(gameListRegex);
   Matcher matcher = pattern.matcher(input);
   if (matcher.find()) {
     int id = Integer.parseInt(matcher.group(1).trim());
     String playerOne = matcher.group(2).trim();
     String playerTwo = matcher.group(3).trim();
     String result = matcher.group(4).trim();
     String ecocode = matcher.group(5).trim();
     return new Game(id, playerOne, playerTwo, result, ecocode);
   }
   return null;
 }