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

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

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

/**
 * Returns an automaton that accepts <code>min</code> or more concatenated
 * repetitions of the language of the given automaton.
 * <p>
 * Complexity: linear in number of states and in <code>min</code>.
 */
static public Automaton repeat(Automaton a, int count) {
 if (count == 0) {
  return repeat(a);
 }
 List<Automaton> as = new ArrayList<>();
 while (count-- > 0) {
  as.add(a);
 }
 as.add(repeat(a));
 return concatenate(as);
}

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

break;
case REGEXP_REPEAT:
 a = Operations.repeat(exp1.toAutomatonInternal(
  automata, automaton_provider, maxDeterminizedStates));
 a = MinimizationOperations.minimize(a, maxDeterminizedStates);
  throw new TooComplexToDeterminizeException(a, minNumStates);
 a = Operations.repeat(a, min);
 a = MinimizationOperations.minimize(a, maxDeterminizedStates);
 break;
  throw new TooComplexToDeterminizeException(a, minMaxNumStates);
 a = Operations.repeat(a, min, max);
 break;
case REGEXP_COMPLEMENT:

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

/**
 * Returns an automaton that accepts <code>min</code> or more concatenated
 * repetitions of the language of the given automaton.
 * <p>
 * Complexity: linear in number of states and in <code>min</code>.
 */
static public Automaton repeat(Automaton a, int count) {
 if (count == 0) {
  return repeat(a);
 }
 List<Automaton> as = new ArrayList<>();
 while (count-- > 0) {
  as.add(a);
 }
 as.add(repeat(a));
 return concatenate(as);
}

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

/**
 * Returns an automaton that accepts <code>min</code> or more concatenated
 * repetitions of the language of the given automaton.
 * <p>
 * Complexity: linear in number of states and in <code>min</code>.
 */
static public Automaton repeat(Automaton a, int count) {
 if (count == 0) {
  return repeat(a);
 }
 List<Automaton> as = new ArrayList<>();
 while (count-- > 0) {
  as.add(a);
 }
 as.add(repeat(a));
 return concatenate(as);
}

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

/**
 * Returns an automaton that accepts <code>min</code> or more concatenated
 * repetitions of the language of the given automaton.
 * <p>
 * Complexity: linear in number of states and in <code>min</code>.
 */
static public Automaton repeat(Automaton a, int count) {
 if (count == 0) {
  return repeat(a);
 }
 List<Automaton> as = new ArrayList<>();
 while (count-- > 0) {
  as.add(a);
 }
 as.add(repeat(a));
 return concatenate(as);
}

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

private static Automaton toContextAutomaton(final Map<IntsRef, ContextMetaData> contexts, final boolean matchAllContexts) {
 final Automaton matchAllAutomaton = Operations.repeat(Automata.makeAnyString());
 final Automaton sep = Automata.makeChar(ContextSuggestField.CONTEXT_SEPARATOR);
 if (matchAllContexts || contexts.size() == 0) {
  return Operations.concatenate(matchAllAutomaton, sep);
 } else {
  Automaton contextsAutomaton = null;
  for (Map.Entry<IntsRef, ContextMetaData> entry : contexts.entrySet()) {
   final ContextMetaData contextMetaData = entry.getValue();
   final IntsRef ref = entry.getKey();
   Automaton contextAutomaton = Automata.makeString(ref.ints, ref.offset, ref.length);
   if (contextMetaData.exact == false) {
    contextAutomaton = Operations.concatenate(contextAutomaton, matchAllAutomaton);
   }
   contextAutomaton = Operations.concatenate(contextAutomaton, sep);
   if (contextsAutomaton == null) {
    contextsAutomaton = contextAutomaton;
   } else {
    contextsAutomaton = Operations.union(contextsAutomaton, contextAutomaton);
   }
  }
  return contextsAutomaton;
 }
}

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

break;
case REGEXP_REPEAT:
 a = Operations.repeat(exp1.toAutomatonInternal(
  automata, automaton_provider, maxDeterminizedStates));
 a = MinimizationOperations.minimize(a, maxDeterminizedStates);
 break;
case REGEXP_REPEAT_MIN:
 a = Operations.repeat(
  exp1.toAutomatonInternal(automata, automaton_provider,
   maxDeterminizedStates),
 break;
case REGEXP_REPEAT_MINMAX:
 a = Operations.repeat(
  exp1.toAutomatonInternal(automata, automaton_provider,
   maxDeterminizedStates),

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

break;
case REGEXP_REPEAT:
 a = Operations.repeat(exp1.toAutomatonInternal(
  automata, automaton_provider, maxDeterminizedStates));
 a = MinimizationOperations.minimize(a, maxDeterminizedStates);
 break;
case REGEXP_REPEAT_MIN:
 a = Operations.repeat(
  exp1.toAutomatonInternal(automata, automaton_provider,
   maxDeterminizedStates),
 break;
case REGEXP_REPEAT_MINMAX:
 a = Operations.repeat(
  exp1.toAutomatonInternal(automata, automaton_provider,
   maxDeterminizedStates),

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

break;
case REGEXP_REPEAT:
 a = Operations.repeat(exp1.toAutomatonInternal(
  automata, automaton_provider, maxDeterminizedStates));
 a = MinimizationOperations.minimize(a, maxDeterminizedStates);
  throw new TooComplexToDeterminizeException(a, minNumStates);
 a = Operations.repeat(a, min);
 a = MinimizationOperations.minimize(a, maxDeterminizedStates);
 break;
  throw new TooComplexToDeterminizeException(a, minMaxNumStates);
 a = Operations.repeat(a, min, max);
 break;
case REGEXP_COMPLEMENT:

相关文章