Tabnine Logo
DaciukMihovAutomatonBuilder$State
Code IndexAdd Tabnine to your IDE (free)

How to use
DaciukMihovAutomatonBuilder$State
in
org.apache.lucene.util.automaton

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

origin: org.apache.lucene/lucene-core

/**
 * Create a new outgoing transition labeled <code>label</code> and return
 * the newly created target state for this transition.
 */
State newState(int label) {
 assert Arrays.binarySearch(labels, label) < 0 : "State already has transition labeled: "
   + label;
 
 labels = ArrayUtil.growExact(labels, labels.length + 1);
 states = ArrayUtil.growExact(states, states.length + 1);
 labels[labels.length - 1] = label;
 return states[states.length - 1] = new State();
}

origin: org.apache.lucene/lucene-core

/**
 * Add another character sequence to this automaton. The sequence must be
 * lexicographically larger or equal compared to any previous sequences added
 * to this automaton (the input must be sorted).
 */
public void add(CharsRef current) {
 if (current.length > MAX_TERM_LENGTH) {
  throw new IllegalArgumentException("This builder doesn't allow terms that are larger than 1,000 characters, got " + current);
 }
 assert stateRegistry != null : "Automaton already built.";
 assert previous == null
   || comparator.compare(previous, current) <= 0 : "Input must be in sorted UTF-8 order: "
   + previous + " >= " + current;
 assert setPrevious(current);
 // Descend in the automaton (find matching prefix).
 int pos = 0, max = current.length();
 State next, state = root;
 while (pos < max && (next = state.lastChild(Character.codePointAt(current, pos))) != null) {
  state = next;
  // todo, optimize me
  pos += Character.charCount(Character.codePointAt(current, pos));
 }
 
 if (state.hasChildren()) replaceOrRegister(state);
 
 addSuffix(state, current, pos);
}

origin: org.apache.lucene/lucene-core

 /**
  * Add a suffix of <code>current</code> starting at <code>fromIndex</code>
  * (inclusive) to state <code>state</code>.
  */
 private void addSuffix(State state, CharSequence current, int fromIndex) {
  final int len = current.length();
  while (fromIndex < len) {
   int cp = Character.codePointAt(current, fromIndex);
   state = state.newState(cp);
   fromIndex += Character.charCount(cp);
  }
  state.is_final = true;
 }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/**
 * Add another character sequence to this automaton. The sequence must be
 * lexicographically larger or equal compared to any previous sequences added
 * to this automaton (the input must be sorted).
 */
public void add(CharsRef current) {
 if (current.length > MAX_TERM_LENGTH) {
  throw new IllegalArgumentException("This builder doesn't allow terms that are larger than 1,000 characters, got " + current);
 }
 assert stateRegistry != null : "Automaton already built.";
 assert previous == null
   || comparator.compare(previous, current) <= 0 : "Input must be in sorted UTF-8 order: "
   + previous + " >= " + current;
 assert setPrevious(current);
 // Descend in the automaton (find matching prefix).
 int pos = 0, max = current.length();
 State next, state = root;
 while (pos < max && (next = state.lastChild(Character.codePointAt(current, pos))) != null) {
  state = next;
  // todo, optimize me
  pos += Character.charCount(Character.codePointAt(current, pos));
 }
 
 if (state.hasChildren()) replaceOrRegister(state);
 
 addSuffix(state, current, pos);
}

origin: harbby/presto-connectors

/**
 * Add another character sequence to this automaton. The sequence must be
 * lexicographically larger or equal compared to any previous sequences added
 * to this automaton (the input must be sorted).
 */
public void add(CharsRef current) {
 assert stateRegistry != null : "Automaton already built.";
 assert previous == null
   || comparator.compare(previous, current) <= 0 : "Input must be in sorted UTF-8 order: "
   + previous + " >= " + current;
 assert setPrevious(current);
 // Descend in the automaton (find matching prefix).
 int pos = 0, max = current.length();
 State next, state = root;
 while (pos < max && (next = state.lastChild(Character.codePointAt(current, pos))) != null) {
  state = next;
  // todo, optimize me
  pos += Character.charCount(Character.codePointAt(current, pos));
 }
 
 if (state.hasChildren()) replaceOrRegister(state);
 
 addSuffix(state, current, pos);
}

origin: org.infinispan/infinispan-embedded-query

/**
 * Add another character sequence to this automaton. The sequence must be
 * lexicographically larger or equal compared to any previous sequences added
 * to this automaton (the input must be sorted).
 */
public void add(CharsRef current) {
 assert stateRegistry != null : "Automaton already built.";
 assert previous == null
   || comparator.compare(previous, current) <= 0 : "Input must be in sorted UTF-8 order: "
   + previous + " >= " + current;
 assert setPrevious(current);
 // Descend in the automaton (find matching prefix).
 int pos = 0, max = current.length();
 State next, state = root;
 while (pos < max && (next = state.lastChild(Character.codePointAt(current, pos))) != null) {
  state = next;
  // todo, optimize me
  pos += Character.charCount(Character.codePointAt(current, pos));
 }
 
 if (state.hasChildren()) replaceOrRegister(state);
 
 addSuffix(state, current, pos);
}

origin: org.infinispan/infinispan-embedded-query

/**
 * Two states are equal if:
 * <ul>
 * <li>they have an identical number of outgoing transitions, labeled with
 * the same labels</li>
 * <li>corresponding outgoing transitions lead to the same states (to states
 * with an identical right-language).
 * </ul>
 */
@Override
public boolean equals(Object obj) {
 final State other = (State) obj;
 return is_final == other.is_final
   && Arrays.equals(this.labels, other.labels)
   && referenceEquals(this.states, other.states);
}

origin: harbby/presto-connectors

/**
 * Two states are equal if:
 * <ul>
 * <li>they have an identical number of outgoing transitions, labeled with
 * the same labels</li>
 * <li>corresponding outgoing transitions lead to the same states (to states
 * with an identical right-language).
 * </ul>
 */
@Override
public boolean equals(Object obj) {
 final State other = (State) obj;
 return is_final == other.is_final
   && Arrays.equals(this.labels, other.labels)
   && referenceEquals(this.states, other.states);
}

origin: harbby/presto-connectors

 /**
  * Add a suffix of <code>current</code> starting at <code>fromIndex</code>
  * (inclusive) to state <code>state</code>.
  */
 private void addSuffix(State state, CharSequence current, int fromIndex) {
  final int len = current.length();
  while (fromIndex < len) {
   int cp = Character.codePointAt(current, fromIndex);
   state = state.newState(cp);
   fromIndex += Character.charCount(cp);
  }
  state.is_final = true;
 }
}
origin: harbby/presto-connectors

/**
 * Return the associated state if the most recent transition is labeled with
 * <code>label</code>.
 */
State lastChild(int label) {
 final int index = labels.length - 1;
 State s = null;
 if (index >= 0 && labels[index] == label) {
  s = states[index];
 }
 assert s == getState(label);
 return s;
}

origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/**
 * Two states are equal if:
 * <ul>
 * <li>they have an identical number of outgoing transitions, labeled with
 * the same labels</li>
 * <li>corresponding outgoing transitions lead to the same states (to states
 * with an identical right-language).
 * </ul>
 */
@Override
public boolean equals(Object obj) {
 final State other = (State) obj;
 return is_final == other.is_final
   && Arrays.equals(this.labels, other.labels)
   && referenceEquals(this.states, other.states);
}

origin: org.infinispan/infinispan-embedded-query

 /**
  * Add a suffix of <code>current</code> starting at <code>fromIndex</code>
  * (inclusive) to state <code>state</code>.
  */
 private void addSuffix(State state, CharSequence current, int fromIndex) {
  final int len = current.length();
  while (fromIndex < len) {
   int cp = Character.codePointAt(current, fromIndex);
   state = state.newState(cp);
   fromIndex += Character.charCount(cp);
  }
  state.is_final = true;
 }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

 /**
  * Add a suffix of <code>current</code> starting at <code>fromIndex</code>
  * (inclusive) to state <code>state</code>.
  */
 private void addSuffix(State state, CharSequence current, int fromIndex) {
  final int len = current.length();
  while (fromIndex < len) {
   int cp = Character.codePointAt(current, fromIndex);
   state = state.newState(cp);
   fromIndex += Character.charCount(cp);
  }
  state.is_final = true;
 }
}
origin: org.infinispan/infinispan-embedded-query

/**
 * Return the associated state if the most recent transition is labeled with
 * <code>label</code>.
 */
State lastChild(int label) {
 final int index = labels.length - 1;
 State s = null;
 if (index >= 0 && labels[index] == label) {
  s = states[index];
 }
 assert s == getState(label);
 return s;
}

origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/**
 * Return the associated state if the most recent transition is labeled with
 * <code>label</code>.
 */
State lastChild(int label) {
 final int index = labels.length - 1;
 State s = null;
 if (index >= 0 && labels[index] == label) {
  s = states[index];
 }
 assert s == getState(label);
 return s;
}

origin: harbby/presto-connectors

/**
 * Finalize the automaton and return the root state. No more strings can be
 * added to the builder after this call.
 * 
 * @return Root automaton state.
 */
public State complete() {
 if (this.stateRegistry == null) throw new IllegalStateException();
 
 if (root.hasChildren()) replaceOrRegister(root);
 
 stateRegistry = null;
 return root;
}

origin: harbby/presto-connectors

/**
 * Replace the last added outgoing transition's target state with the given
 * state.
 */
void replaceLastChild(State state) {
 assert hasChildren() : "No outgoing transitions.";
 states[states.length - 1] = state;
}

origin: harbby/presto-connectors

/**
 * Replace last child of <code>state</code> with an already registered state
 * or stateRegistry the last child state.
 */
private void replaceOrRegister(State state) {
 final State child = state.lastChild();
 
 if (child.hasChildren()) replaceOrRegister(child);
 
 final State registered = stateRegistry.get(child);
 if (registered != null) {
  state.replaceLastChild(registered);
 } else {
  stateRegistry.put(child, child);
 }
}
origin: org.infinispan/infinispan-embedded-query

/**
 * Replace the last added outgoing transition's target state with the given
 * state.
 */
void replaceLastChild(State state) {
 assert hasChildren() : "No outgoing transitions.";
 states[states.length - 1] = state;
}

origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/**
 * Finalize the automaton and return the root state. No more strings can be
 * added to the builder after this call.
 * 
 * @return Root automaton state.
 */
public State complete() {
 if (this.stateRegistry == null) throw new IllegalStateException();
 
 if (root.hasChildren()) replaceOrRegister(root);
 
 stateRegistry = null;
 return root;
}

org.apache.lucene.util.automatonDaciukMihovAutomatonBuilder$State

Javadoc

DFSA state with char labels on transitions.

Most used methods

  • <init>
  • getState
    Returns the target state of a transition leaving this state and labeled with label. If no such tran
  • hasChildren
    Return true if this state has any children (outgoing transitions).
  • lastChild
    Return the associated state if the most recent transition is labeled withlabel.
  • newState
    Create a new outgoing transition labeled label and return the newly created target state for this tr
  • referenceEquals
    Compare two lists of objects for reference-equality.
  • replaceLastChild
    Replace the last added outgoing transition's target state with the given state.

Popular in Java

  • Creating JSON documents from java classes using gson
  • getExternalFilesDir (Context)
  • getApplicationContext (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Runner (org.openjdk.jmh.runner)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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