org.apache.lucene.util.automaton.Operations.intersection()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中org.apache.lucene.util.automaton.Operations.intersection()方法的一些代码示例,展示了Operations.intersection()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Operations.intersection()方法的具体详情如下:
包路径:org.apache.lucene.util.automaton.Operations
类名称:Operations
方法名:intersection

Operations.intersection介绍

[英]Returns an automaton that accepts the intersection of the languages of the given automata. Never modifies the input automata languages.

Complexity: quadratic in number of states.
[中]返回接受给定自动机语言交集的自动机。从不修改输入自动机语言。
复杂性:状态数为二次。

代码示例

代码示例来源:origin: org.apache.lucene/lucene-core

/**
 * Returns a (deterministic) automaton that accepts the intersection of the
 * language of <code>a1</code> and the complement of the language of
 * <code>a2</code>. As a side-effect, the automata may be determinized, if not
 * already deterministic.
 * <p>
 * Complexity: quadratic in number of states if a2 already deterministic and
 *  exponential in number of a2's states otherwise.
 */
static public Automaton minus(Automaton a1, Automaton a2, int maxDeterminizedStates) {
 if (Operations.isEmpty(a1) || a1 == a2) {
  return Automata.makeEmpty();
 }
 if (Operations.isEmpty(a2)) {
  return a1;
 }
 return intersection(a1, complement(a2, maxDeterminizedStates));
}

代码示例来源:origin: oracle/opengrok

/** {@inheritDoc} */
@Override
public TermsEnum getTermsEnumForSuggestions(final Terms terms) {
  if (terms == null) {
    return TermsEnum.EMPTY;
  }
  BytesRef prefix = getPrefix();
  if (prefix != null) {
    Automaton prefixAutomaton = PrefixQuery.toAutomaton(prefix);
    Automaton finalAutomaton;
    if (suggestPosition == SuggestPosition.LOWER) {
      Automaton binaryInt = Automata.makeBinaryInterval(
          getLowerTerm(), includesLower(), getUpperTerm(), includesUpper());
      finalAutomaton = Operations.intersection(binaryInt, prefixAutomaton);
    } else {
      Automaton binaryInt = Automata.makeBinaryInterval(null, true, getLowerTerm(), !includesLower());
      finalAutomaton = Operations.minus(prefixAutomaton, binaryInt, Integer.MIN_VALUE);
    }
    CompiledAutomaton compiledAutomaton = new CompiledAutomaton(finalAutomaton);
    try {
      return compiledAutomaton.getTermsEnum(terms);
    } catch (IOException e) {
      logger.log(Level.WARNING, "Could not compile automaton for range suggestions", e);
    }
  }
  return TermsEnum.EMPTY;
}

代码示例来源:origin: org.apache.lucene/lucene-core

break;
case REGEXP_INTERSECTION:
 a = Operations.intersection(
   exp1.toAutomatonInternal(
    automata, automaton_provider, maxDeterminizedStates),

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/**
 * Returns a (deterministic) automaton that accepts the intersection of the
 * language of <code>a1</code> and the complement of the language of
 * <code>a2</code>. As a side-effect, the automata may be determinized, if not
 * already deterministic.
 * <p>
 * Complexity: quadratic in number of states if a2 already deterministic and
 *  exponential in number of a2's states otherwise.
 */
static public Automaton minus(Automaton a1, Automaton a2, int maxDeterminizedStates) {
 if (Operations.isEmpty(a1) || a1 == a2) {
  return Automata.makeEmpty();
 }
 if (Operations.isEmpty(a2)) {
  return a1;
 }
 return intersection(a1, complement(a2, maxDeterminizedStates));
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

/**
 * Returns a (deterministic) automaton that accepts the intersection of the
 * language of <code>a1</code> and the complement of the language of
 * <code>a2</code>. As a side-effect, the automata may be determinized, if not
 * already deterministic.
 * <p>
 * Complexity: quadratic in number of states if a2 already deterministic and
 *  exponential in number of a2's states otherwise.
 */
static public Automaton minus(Automaton a1, Automaton a2, int maxDeterminizedStates) {
 if (Operations.isEmpty(a1) || a1 == a2) {
  return Automata.makeEmpty();
 }
 if (Operations.isEmpty(a2)) {
  return a1;
 }
 return intersection(a1, complement(a2, maxDeterminizedStates));
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Returns a (deterministic) automaton that accepts the intersection of the
 * language of <code>a1</code> and the complement of the language of
 * <code>a2</code>. As a side-effect, the automata may be determinized, if not
 * already deterministic.
 * <p>
 * Complexity: quadratic in number of states if a2 already deterministic and
 *  exponential in number of a2's states otherwise.
 */
static public Automaton minus(Automaton a1, Automaton a2, int maxDeterminizedStates) {
 if (Operations.isEmpty(a1) || a1 == a2) {
  return Automata.makeEmpty();
 }
 if (Operations.isEmpty(a2)) {
  return a1;
 }
 return intersection(a1, complement(a2, maxDeterminizedStates));
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

break;
case REGEXP_INTERSECTION:
 a = Operations.intersection(
   exp1.toAutomatonInternal(
    automata, automaton_provider, maxDeterminizedStates),

代码示例来源:origin: harbby/presto-connectors

break;
case REGEXP_INTERSECTION:
 a = Operations.intersection(
   exp1.toAutomatonInternal(
    automata, automaton_provider, maxDeterminizedStates),

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

break;
case REGEXP_INTERSECTION:
 a = Operations.intersection(
   exp1.toAutomatonInternal(
    automata, automaton_provider, maxDeterminizedStates),

相关文章