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

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

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

Operations.minus介绍

[英]Returns a (deterministic) automaton that accepts the intersection of the language of a1 and the complement of the language of a2. As a side-effect, the automata may be determinized, if not already deterministic.

Complexity: quadratic in number of states if a2 already deterministic and exponential in number of a2's states otherwise.
[中]返回一个(确定性)自动机,该自动机接受a1语言与a2语言补码的交集。作为一种副作用,自动机可能是确定的,如果还没有确定的话。
复杂性:如果a2已经确定,则状态数为二次,否则状态数为指数。

代码示例

代码示例来源: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.elasticsearch/elasticsearch

  1. private Automaton toAutomaton() {
  2. Automaton a = null;
  3. if (include != null) {
  4. a = include.toAutomaton();
  5. } else if (includeValues != null) {
  6. a = Automata.makeStringUnion(includeValues);
  7. } else {
  8. a = Automata.makeAnyString();
  9. }
  10. if (exclude != null) {
  11. a = Operations.minus(a, exclude.toAutomaton(), Operations.DEFAULT_MAX_DETERMINIZED_STATES);
  12. } else if (excludeValues != null) {
  13. a = Operations.minus(a, Automata.makeStringUnion(excludeValues), Operations.DEFAULT_MAX_DETERMINIZED_STATES);
  14. }
  15. return a;
  16. }

代码示例来源:origin: apache/servicemix-bundles

  1. private Automaton toAutomaton() {
  2. Automaton a = null;
  3. if (include != null) {
  4. a = include.toAutomaton();
  5. } else if (includeValues != null) {
  6. a = Automata.makeStringUnion(includeValues);
  7. } else {
  8. a = Automata.makeAnyString();
  9. }
  10. if (exclude != null) {
  11. a = Operations.minus(a, exclude.toAutomaton(), Operations.DEFAULT_MAX_DETERMINIZED_STATES);
  12. } else if (excludeValues != null) {
  13. a = Operations.minus(a, Automata.makeStringUnion(excludeValues), Operations.DEFAULT_MAX_DETERMINIZED_STATES);
  14. }
  15. return a;
  16. }

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

  1. private Automaton toAutomaton() {
  2. Automaton a = null;
  3. if (include != null) {
  4. a = include.toAutomaton();
  5. } else if (includeValues != null) {
  6. a = Automata.makeStringUnion(includeValues);
  7. } else {
  8. a = Automata.makeAnyString();
  9. }
  10. if (exclude != null) {
  11. a = Operations.minus(a, exclude.toAutomaton(), Operations.DEFAULT_MAX_DETERMINIZED_STATES);
  12. } else if (excludeValues != null) {
  13. a = Operations.minus(a, Automata.makeStringUnion(excludeValues), Operations.DEFAULT_MAX_DETERMINIZED_STATES);
  14. }
  15. return a;
  16. }

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

  1. private Automaton toAutomaton() {
  2. Automaton a = null;
  3. if (include != null) {
  4. a = include.toAutomaton();
  5. } else if (includeValues != null) {
  6. a = Automata.makeStringUnion(includeValues);
  7. } else {
  8. a = Automata.makeAnyString();
  9. }
  10. if (exclude != null) {
  11. a = Operations.minus(a, exclude.toAutomaton(), Operations.DEFAULT_MAX_DETERMINIZED_STATES);
  12. } else if (excludeValues != null) {
  13. a = Operations.minus(a, Automata.makeStringUnion(excludeValues), Operations.DEFAULT_MAX_DETERMINIZED_STATES);
  14. }
  15. return a;
  16. }

代码示例来源:origin: org.codelibs/elasticsearch-querybuilders

  1. private Automaton toAutomaton() {
  2. Automaton a = null;
  3. if (include != null) {
  4. a = include.toAutomaton();
  5. } else if (includeValues != null) {
  6. a = Automata.makeStringUnion(includeValues);
  7. } else {
  8. a = Automata.makeAnyString();
  9. }
  10. if (exclude != null) {
  11. a = Operations.minus(a, exclude.toAutomaton(), Operations.DEFAULT_MAX_DETERMINIZED_STATES);
  12. } else if (excludeValues != null) {
  13. a = Operations.minus(a, Automata.makeStringUnion(excludeValues), Operations.DEFAULT_MAX_DETERMINIZED_STATES);
  14. }
  15. return a;
  16. }

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

  1. private Automaton toAutomaton() {
  2. Automaton a = null;
  3. if (include != null) {
  4. a = include.toAutomaton();
  5. } else if (includeValues != null) {
  6. a = Automata.makeStringUnion(includeValues);
  7. } else {
  8. a = Automata.makeAnyString();
  9. }
  10. if (exclude != null) {
  11. a = Operations.minus(a, exclude.toAutomaton(), Operations.DEFAULT_MAX_DETERMINIZED_STATES);
  12. } else if (excludeValues != null) {
  13. a = Operations.minus(a, Automata.makeStringUnion(excludeValues), Operations.DEFAULT_MAX_DETERMINIZED_STATES);
  14. }
  15. return a;
  16. }

相关文章