congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
org.apache.lucene.util.automaton
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.lucene.util.automaton

Best Java code snippets using org.apache.lucene.util.automaton (Showing top 20 results out of 315)

origin: org.apache.lucene/lucene-core

 /** Copies over all states from other. */
 public void copyStates(Automaton other) {
  int otherNumStates = other.getNumStates();
  for (int s = 0; s < otherNumStates; s++) {
   int newState = createState();
   setAccept(newState, other.isAccept(s));
  }
 }
}
origin: org.apache.lucene/lucene-core

private Automaton toAutomaton(Map<String,Automaton> automata,
  AutomatonProvider automaton_provider, int maxDeterminizedStates)
  throws IllegalArgumentException, TooComplexToDeterminizeException {
 try {
  return toAutomatonInternal(automata, automaton_provider,
   maxDeterminizedStates);
 } catch (TooComplexToDeterminizeException e) {
  throw new TooComplexToDeterminizeException(this, e);
 }
}
origin: org.apache.lucene/lucene-core

public void add(Transition t) {
 find(t.min).starts.add(t);
 find(1+t.max).ends.add(t);
}
origin: org.apache.lucene/lucene-core

static RegExp makeUnion(RegExp exp1, RegExp exp2) {
 RegExp r = new RegExp();
 r.kind = Kind.REGEXP_UNION;
 r.exp1 = exp1;
 r.exp2 = exp2;
 return r;
}

origin: org.apache.lucene/lucene-core

/**
 * Returns true if the given automaton accepts all strings for the specified min/max
 * range of the alphabet.  The automaton must be minimized.
 */
public static boolean isTotal(Automaton a, int minAlphabet, int maxAlphabet) {
 if (a.isAccept(0) && a.getNumTransitions(0) == 1) {
  Transition t = new Transition();
  a.getTransition(0, 0, t);
  return t.dest == 0
   && t.min == minAlphabet
   && t.max == maxAlphabet;
 }
 return false;
}

origin: org.apache.lucene/lucene-core

/**
 * Returns a new (deterministic) automaton that accepts only the empty string.
 */
public static Automaton makeEmptyString() {
 Automaton a = new Automaton();
 a.createState();
 a.setAccept(0, true);
 return a;
}

origin: org.apache.lucene/lucene-core

/**
 * Returns true if the language of this automaton is finite.  The
 * automaton must not have any dead states.
 */
public static boolean isFinite(Automaton a) {
 if (a.getNumStates() == 0) {
  return true;
 }
 return isFinite(new Transition(), a, 0, new BitSet(a.getNumStates()), new BitSet(a.getNumStates()), 0);
}

origin: org.apache.lucene/lucene-core

final RegExp parseInterExp() throws IllegalArgumentException {
 RegExp e = parseConcatExp();
 if (check(INTERSECTION) && match('&')) e = makeIntersection(e,
   parseInterExp());
 return e;
}

origin: org.apache.lucene/lucene-core

/** Appends the specified character to the specified state, returning a new state. */
public static int appendChar(Automaton a, int state, int c) {
 int newState = a.createState();
 a.addTransition(state, newState, c, c);
 return newState;
}
origin: org.apache.lucene/lucene-core

final RegExp parseUnionExp() throws IllegalArgumentException {
 RegExp e = parseInterExp();
 if (match('|')) e = makeUnion(e, parseUnionExp());
 return e;
}

origin: org.apache.lucene/lucene-core

@Override
public IntsRef next() {
 if (count >= limit) {
  // Abort on limit.
  return null;
 }
 IntsRef result = super.next();
 if (result != null) {
  count++;
 }
 return result;
}
origin: org.apache.lucene/lucene-core

public static Automaton toAutomaton(BytesRef lowerTerm, BytesRef upperTerm, boolean includeLower, boolean includeUpper) {
 if (lowerTerm == null) {
  // makeBinaryInterval is more picky than we are:
  includeLower = true;
 }
 if (upperTerm == null) {
  // makeBinaryInterval is more picky than we are:
  includeUpper = true;
 }
 return Automata.makeBinaryInterval(lowerTerm, includeLower, upperTerm, includeUpper);
}
origin: org.apache.lucene/lucene-core

/**
 * Create a new LevenshteinAutomata for some input String.
 * Optionally count transpositions as a primitive edit.
 */
public LevenshteinAutomata(String input, boolean withTranspositions) {
 this(codePoints(input), Character.MAX_CODE_POINT, withTranspositions);
}
origin: org.apache.lucene/lucene-core

/**
 * Return the most recent transitions's target state.
 */
State lastChild() {
 assert hasChildren() : "No outgoing transitions.";
 return states[states.length - 1];
}

origin: org.apache.lucene/lucene-core

static RegExp makeOptional(RegExp exp) {
 RegExp r = new RegExp();
 r.kind = Kind.REGEXP_OPTIONAL;
 r.exp1 = exp;
 return r;
}

origin: org.apache.lucene/lucene-core

/** Accept any single character starting from the specified state, returning the new state */
public static int appendAnyChar(Automaton a, int state) {
 int newState = a.createState();
 a.addTransition(state, newState, Character.MIN_CODE_POINT, Character.MAX_CODE_POINT);
 return newState;
}
origin: org.apache.lucene/lucene-core

static RegExp makeRepeat(RegExp exp, int min, int max) {
 RegExp r = new RegExp();
 r.kind = Kind.REGEXP_REPEAT_MINMAX;
 r.exp1 = exp;
 r.min = min;
 r.max = max;
 return r;
}

origin: org.apache.lucene/lucene-core

static RegExp makeChar(int c) {
 RegExp r = new RegExp();
 r.kind = Kind.REGEXP_CHAR;
 r.c = c;
 return r;
}

origin: org.apache.lucene/lucene-core

static RegExp makeAnyChar() {
 RegExp r = new RegExp();
 r.kind = Kind.REGEXP_ANYCHAR;
 return r;
}

origin: org.apache.lucene/lucene-core

static RegExp makeAutomaton(String s) {
 RegExp r = new RegExp();
 r.kind = Kind.REGEXP_AUTOMATON;
 r.s = s;
 return r;
}

org.apache.lucene.util.automaton

Most used classes

  • RegExp
    Regular Expression extension to Automaton. Regular expressions are built from the following abstract
  • CompiledAutomaton
    Immutable class holding compiled details for a given Automaton. The Automaton is deterministic, must
  • Automaton
    Represents an automaton and all its states and transitions. States are integers and must be created
  • Operations
    Automata operations.
  • Automata
    Construction of basic automata.
  • ByteRunAutomaton,
  • LevenshteinAutomata,
  • Transition,
  • FiniteStringsIterator,
  • UTF32ToUTF8,
  • RunAutomaton,
  • Automaton$Builder,
  • LimitedFiniteStringsIterator,
  • MinimizationOperations,
  • Automaton$1,
  • Automaton$2,
  • Automaton$Builder$1,
  • AutomatonProvider,
  • BasicAutomata
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now