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

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

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

Operations.repeat介绍

[英]Returns an automaton that accepts the Kleene star (zero or more concatenated repetitions) of the language of the given automaton. Never modifies the input automaton language.

Complexity: linear in number of states.
[中]返回一个自动机,该自动机接受给定自动机语言的Kleene星形(零个或多个串联重复)。从不修改输入自动机语言。
复杂性:状态数呈线性。

代码示例

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

  1. /**
  2. * Returns an automaton that accepts <code>min</code> or more concatenated
  3. * repetitions of the language of the given automaton.
  4. * <p>
  5. * Complexity: linear in number of states and in <code>min</code>.
  6. */
  7. static public Automaton repeat(Automaton a, int count) {
  8. if (count == 0) {
  9. return repeat(a);
  10. }
  11. List<Automaton> as = new ArrayList<>();
  12. while (count-- > 0) {
  13. as.add(a);
  14. }
  15. as.add(repeat(a));
  16. return concatenate(as);
  17. }

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

  1. break;
  2. case REGEXP_REPEAT:
  3. a = Operations.repeat(exp1.toAutomatonInternal(
  4. automata, automaton_provider, maxDeterminizedStates));
  5. a = MinimizationOperations.minimize(a, maxDeterminizedStates);
  6. throw new TooComplexToDeterminizeException(a, minNumStates);
  7. a = Operations.repeat(a, min);
  8. a = MinimizationOperations.minimize(a, maxDeterminizedStates);
  9. break;
  10. throw new TooComplexToDeterminizeException(a, minMaxNumStates);
  11. a = Operations.repeat(a, min, max);
  12. break;
  13. case REGEXP_COMPLEMENT:

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

  1. /**
  2. * Returns an automaton that accepts <code>min</code> or more concatenated
  3. * repetitions of the language of the given automaton.
  4. * <p>
  5. * Complexity: linear in number of states and in <code>min</code>.
  6. */
  7. static public Automaton repeat(Automaton a, int count) {
  8. if (count == 0) {
  9. return repeat(a);
  10. }
  11. List<Automaton> as = new ArrayList<>();
  12. while (count-- > 0) {
  13. as.add(a);
  14. }
  15. as.add(repeat(a));
  16. return concatenate(as);
  17. }

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

  1. /**
  2. * Returns an automaton that accepts <code>min</code> or more concatenated
  3. * repetitions of the language of the given automaton.
  4. * <p>
  5. * Complexity: linear in number of states and in <code>min</code>.
  6. */
  7. static public Automaton repeat(Automaton a, int count) {
  8. if (count == 0) {
  9. return repeat(a);
  10. }
  11. List<Automaton> as = new ArrayList<>();
  12. while (count-- > 0) {
  13. as.add(a);
  14. }
  15. as.add(repeat(a));
  16. return concatenate(as);
  17. }

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

  1. /**
  2. * Returns an automaton that accepts <code>min</code> or more concatenated
  3. * repetitions of the language of the given automaton.
  4. * <p>
  5. * Complexity: linear in number of states and in <code>min</code>.
  6. */
  7. static public Automaton repeat(Automaton a, int count) {
  8. if (count == 0) {
  9. return repeat(a);
  10. }
  11. List<Automaton> as = new ArrayList<>();
  12. while (count-- > 0) {
  13. as.add(a);
  14. }
  15. as.add(repeat(a));
  16. return concatenate(as);
  17. }

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

  1. private static Automaton toContextAutomaton(final Map<IntsRef, ContextMetaData> contexts, final boolean matchAllContexts) {
  2. final Automaton matchAllAutomaton = Operations.repeat(Automata.makeAnyString());
  3. final Automaton sep = Automata.makeChar(ContextSuggestField.CONTEXT_SEPARATOR);
  4. if (matchAllContexts || contexts.size() == 0) {
  5. return Operations.concatenate(matchAllAutomaton, sep);
  6. } else {
  7. Automaton contextsAutomaton = null;
  8. for (Map.Entry<IntsRef, ContextMetaData> entry : contexts.entrySet()) {
  9. final ContextMetaData contextMetaData = entry.getValue();
  10. final IntsRef ref = entry.getKey();
  11. Automaton contextAutomaton = Automata.makeString(ref.ints, ref.offset, ref.length);
  12. if (contextMetaData.exact == false) {
  13. contextAutomaton = Operations.concatenate(contextAutomaton, matchAllAutomaton);
  14. }
  15. contextAutomaton = Operations.concatenate(contextAutomaton, sep);
  16. if (contextsAutomaton == null) {
  17. contextsAutomaton = contextAutomaton;
  18. } else {
  19. contextsAutomaton = Operations.union(contextsAutomaton, contextAutomaton);
  20. }
  21. }
  22. return contextsAutomaton;
  23. }
  24. }

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

  1. break;
  2. case REGEXP_REPEAT:
  3. a = Operations.repeat(exp1.toAutomatonInternal(
  4. automata, automaton_provider, maxDeterminizedStates));
  5. a = MinimizationOperations.minimize(a, maxDeterminizedStates);
  6. break;
  7. case REGEXP_REPEAT_MIN:
  8. a = Operations.repeat(
  9. exp1.toAutomatonInternal(automata, automaton_provider,
  10. maxDeterminizedStates),
  11. break;
  12. case REGEXP_REPEAT_MINMAX:
  13. a = Operations.repeat(
  14. exp1.toAutomatonInternal(automata, automaton_provider,
  15. maxDeterminizedStates),

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

  1. break;
  2. case REGEXP_REPEAT:
  3. a = Operations.repeat(exp1.toAutomatonInternal(
  4. automata, automaton_provider, maxDeterminizedStates));
  5. a = MinimizationOperations.minimize(a, maxDeterminizedStates);
  6. break;
  7. case REGEXP_REPEAT_MIN:
  8. a = Operations.repeat(
  9. exp1.toAutomatonInternal(automata, automaton_provider,
  10. maxDeterminizedStates),
  11. break;
  12. case REGEXP_REPEAT_MINMAX:
  13. a = Operations.repeat(
  14. exp1.toAutomatonInternal(automata, automaton_provider,
  15. maxDeterminizedStates),

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

  1. break;
  2. case REGEXP_REPEAT:
  3. a = Operations.repeat(exp1.toAutomatonInternal(
  4. automata, automaton_provider, maxDeterminizedStates));
  5. a = MinimizationOperations.minimize(a, maxDeterminizedStates);
  6. throw new TooComplexToDeterminizeException(a, minNumStates);
  7. a = Operations.repeat(a, min);
  8. a = MinimizationOperations.minimize(a, maxDeterminizedStates);
  9. break;
  10. throw new TooComplexToDeterminizeException(a, minMaxNumStates);
  11. a = Operations.repeat(a, min, max);
  12. break;
  13. case REGEXP_COMPLEMENT:

相关文章