public static Automaton toAutomaton(Term wildcardquery) {List<Automaton> automata = new ArrayList<>();String wildcardText = wildcardquery.text();for (int i = 0; i < wildcardText.length();) {final int c = wildcardText.codePointAt(i);int length = Character.charCount(c);switch(c) {case WILDCARD_STRING:automata.add(Automata.makeAnyString());break;case WILDCARD_CHAR:automata.add(Automata.makeAnyChar());break;case WILDCARD_ESCAPE:if (i + length < wildcardText.length()) {final int nextChar = wildcardText.codePointAt(i + length);length += Character.charCount(nextChar);automata.add(Automata.makeChar(nextChar));break;} default:automata.add(Automata.makeChar(c));}i += length;}return Operations.concatenate(automata);}

public static Automaton ToAutomaton(Term wildcardquery){IList<Automaton> automata = new List<Automaton>();string wildcardText = wildcardquery.Text();for (int i = 0; i < wildcardText.Length; ){int c = Character.CodePointAt(wildcardText, i);int length = Character.CharCount(c);switch (c){case WILDCARD_STRING:automata.Add(BasicAutomata.MakeAnyString());break;case WILDCARD_CHAR:automata.Add(BasicAutomata.MakeAnyChar());break;case WILDCARD_ESCAPE:if (i + length < wildcardText.Length){int nextChar = Character.CodePointAt(wildcardText, i + length);length += Character.CharCount(nextChar);automata.Add(BasicAutomata.MakeChar(nextChar));break;} goto default;default:automata.Add(BasicAutomata.MakeChar(c));break;}i += length;}return BasicOperations.Concatenate(automata);}
