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

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

本文整理了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

  1. /**
  2. * Returns a (deterministic) automaton that accepts the intersection of the
  3. * language of <code>a1</code> and the complement of the language of
  4. * <code>a2</code>. As a side-effect, the automata may be determinized, if not
  5. * already deterministic.
  6. * <p>
  7. * Complexity: quadratic in number of states if a2 already deterministic and
  8. * exponential in number of a2's states otherwise.
  9. */
  10. static public Automaton minus(Automaton a1, Automaton a2, int maxDeterminizedStates) {
  11. if (Operations.isEmpty(a1) || a1 == a2) {
  12. return Automata.makeEmpty();
  13. }
  14. if (Operations.isEmpty(a2)) {
  15. return a1;
  16. }
  17. return intersection(a1, complement(a2, maxDeterminizedStates));
  18. }

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

  1. /** {@inheritDoc} */
  2. @Override
  3. public TermsEnum getTermsEnumForSuggestions(final Terms terms) {
  4. if (terms == null) {
  5. return TermsEnum.EMPTY;
  6. }
  7. BytesRef prefix = getPrefix();
  8. if (prefix != null) {
  9. Automaton prefixAutomaton = PrefixQuery.toAutomaton(prefix);
  10. Automaton finalAutomaton;
  11. if (suggestPosition == SuggestPosition.LOWER) {
  12. Automaton binaryInt = Automata.makeBinaryInterval(
  13. getLowerTerm(), includesLower(), getUpperTerm(), includesUpper());
  14. finalAutomaton = Operations.intersection(binaryInt, prefixAutomaton);
  15. } else {
  16. Automaton binaryInt = Automata.makeBinaryInterval(null, true, getLowerTerm(), !includesLower());
  17. finalAutomaton = Operations.minus(prefixAutomaton, binaryInt, Integer.MIN_VALUE);
  18. }
  19. CompiledAutomaton compiledAutomaton = new CompiledAutomaton(finalAutomaton);
  20. try {
  21. return compiledAutomaton.getTermsEnum(terms);
  22. } catch (IOException e) {
  23. logger.log(Level.WARNING, "Could not compile automaton for range suggestions", e);
  24. }
  25. }
  26. return TermsEnum.EMPTY;
  27. }

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

  1. break;
  2. case REGEXP_INTERSECTION:
  3. a = Operations.intersection(
  4. exp1.toAutomatonInternal(
  5. automata, automaton_provider, maxDeterminizedStates),

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

  1. /**
  2. * Returns a (deterministic) automaton that accepts the intersection of the
  3. * language of <code>a1</code> and the complement of the language of
  4. * <code>a2</code>. As a side-effect, the automata may be determinized, if not
  5. * already deterministic.
  6. * <p>
  7. * Complexity: quadratic in number of states if a2 already deterministic and
  8. * exponential in number of a2's states otherwise.
  9. */
  10. static public Automaton minus(Automaton a1, Automaton a2, int maxDeterminizedStates) {
  11. if (Operations.isEmpty(a1) || a1 == a2) {
  12. return Automata.makeEmpty();
  13. }
  14. if (Operations.isEmpty(a2)) {
  15. return a1;
  16. }
  17. return intersection(a1, complement(a2, maxDeterminizedStates));
  18. }

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

  1. /**
  2. * Returns a (deterministic) automaton that accepts the intersection of the
  3. * language of <code>a1</code> and the complement of the language of
  4. * <code>a2</code>. As a side-effect, the automata may be determinized, if not
  5. * already deterministic.
  6. * <p>
  7. * Complexity: quadratic in number of states if a2 already deterministic and
  8. * exponential in number of a2's states otherwise.
  9. */
  10. static public Automaton minus(Automaton a1, Automaton a2, int maxDeterminizedStates) {
  11. if (Operations.isEmpty(a1) || a1 == a2) {
  12. return Automata.makeEmpty();
  13. }
  14. if (Operations.isEmpty(a2)) {
  15. return a1;
  16. }
  17. return intersection(a1, complement(a2, maxDeterminizedStates));
  18. }

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

  1. /**
  2. * Returns a (deterministic) automaton that accepts the intersection of the
  3. * language of <code>a1</code> and the complement of the language of
  4. * <code>a2</code>. As a side-effect, the automata may be determinized, if not
  5. * already deterministic.
  6. * <p>
  7. * Complexity: quadratic in number of states if a2 already deterministic and
  8. * exponential in number of a2's states otherwise.
  9. */
  10. static public Automaton minus(Automaton a1, Automaton a2, int maxDeterminizedStates) {
  11. if (Operations.isEmpty(a1) || a1 == a2) {
  12. return Automata.makeEmpty();
  13. }
  14. if (Operations.isEmpty(a2)) {
  15. return a1;
  16. }
  17. return intersection(a1, complement(a2, maxDeterminizedStates));
  18. }

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

  1. break;
  2. case REGEXP_INTERSECTION:
  3. a = Operations.intersection(
  4. exp1.toAutomatonInternal(
  5. automata, automaton_provider, maxDeterminizedStates),

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

  1. break;
  2. case REGEXP_INTERSECTION:
  3. a = Operations.intersection(
  4. exp1.toAutomatonInternal(
  5. automata, automaton_provider, maxDeterminizedStates),

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

  1. break;
  2. case REGEXP_INTERSECTION:
  3. a = Operations.intersection(
  4. exp1.toAutomatonInternal(
  5. automata, automaton_provider, maxDeterminizedStates),

相关文章