List of usage examples for com.google.common.primitives Chars checkedCast
public static char checkedCast(long value)
From source file:com.google.gerrit.server.util.RegexListSearcher.java
public RegexListSearcher(String re) { if (re.startsWith("^")) { re = re.substring(1);/* w w w. ja v a 2s. c o m*/ } if (re.endsWith("$") && !re.endsWith("\\$")) { re = re.substring(0, re.length() - 1); } Automaton automaton = new RegExp(re).toAutomaton(); prefixBegin = automaton.getCommonPrefix(); prefixLen = prefixBegin.length(); if (0 < prefixLen) { char max = Chars.checkedCast(prefixBegin.charAt(prefixLen - 1) + 1); prefixEnd = prefixBegin.substring(0, prefixLen - 1) + max; prefixOnly = re.equals(prefixBegin + ".*"); } else { prefixEnd = ""; prefixOnly = false; } pattern = prefixOnly ? null : new RunAutomaton(automaton); }