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

x33g5p2x  于2022-01-17 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(93)

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

Automata.between介绍

[英]Constructs sub-automaton corresponding to decimal numbers of value between x.substring(n) and y.substring(n) and of length x.substring(n).length() (which must be equal to y.substring(n).length()).
[中]构造子自动机,对应于x.substring(n)和y.substring(n)之间的十进制数值以及长度x.substring(n)。长度()(必须等于y.substring(n)。长度()。

代码示例

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

between(builder, x, y, 0, initials, digits <= 0);

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

/**
 * Constructs sub-automaton corresponding to decimal numbers of value between
 * x.substring(n) and y.substring(n) and of length x.substring(n).length()
 * (which must be equal to y.substring(n).length()).
 */
private static int between(Automaton.Builder builder,
  String x, String y, int n,
  Collection<Integer> initials, boolean zeros) {
 int s = builder.createState();
 if (x.length() == n) {
  builder.setAccept(s, true);
 } else {
  if (zeros) {
   initials.add(s);
  }
  char cx = x.charAt(n);
  char cy = y.charAt(n);
  if (cx == cy) {
   builder.addTransition(s, between(builder, x, y, n + 1, initials, zeros && cx == '0'), cx);
  } else { // cx<cy
   builder.addTransition(s, atLeast(builder, x, n + 1, initials, zeros && cx == '0'), cx);
   builder.addTransition(s, atMost(builder, y, n + 1), cy);
   if (cx + 1 < cy) {
    builder.addTransition(s, anyOfRightLength(builder, x, n+1), (char) (cx + 1), (char) (cy - 1));
   }
  }
 }
 return s;
}

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

between(builder, x, y, 0, initials, digits <= 0);

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

between(builder, x, y, 0, initials, digits <= 0);

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

between(builder, x, y, 0, initials, digits <= 0);

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

/**
 * Constructs sub-automaton corresponding to decimal numbers of value between
 * x.substring(n) and y.substring(n) and of length x.substring(n).length()
 * (which must be equal to y.substring(n).length()).
 */
private static int between(Automaton.Builder builder,
  String x, String y, int n,
  Collection<Integer> initials, boolean zeros) {
 int s = builder.createState();
 if (x.length() == n) {
  builder.setAccept(s, true);
 } else {
  if (zeros) {
   initials.add(s);
  }
  char cx = x.charAt(n);
  char cy = y.charAt(n);
  if (cx == cy) {
   builder.addTransition(s, between(builder, x, y, n + 1, initials, zeros && cx == '0'), cx);
  } else { // cx<cy
   builder.addTransition(s, atLeast(builder, x, n + 1, initials, zeros && cx == '0'), cx);
   builder.addTransition(s, atMost(builder, y, n + 1), cy);
   if (cx + 1 < cy) {
    builder.addTransition(s, anyOfRightLength(builder, x, n+1), (char) (cx + 1), (char) (cy - 1));
   }
  }
 }
 return s;
}

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

/**
 * Constructs sub-automaton corresponding to decimal numbers of value between
 * x.substring(n) and y.substring(n) and of length x.substring(n).length()
 * (which must be equal to y.substring(n).length()).
 */
private static int between(Automaton.Builder builder,
  String x, String y, int n,
  Collection<Integer> initials, boolean zeros) {
 int s = builder.createState();
 if (x.length() == n) {
  builder.setAccept(s, true);
 } else {
  if (zeros) {
   initials.add(s);
  }
  char cx = x.charAt(n);
  char cy = y.charAt(n);
  if (cx == cy) {
   builder.addTransition(s, between(builder, x, y, n + 1, initials, zeros && cx == '0'), cx);
  } else { // cx<cy
   builder.addTransition(s, atLeast(builder, x, n + 1, initials, zeros && cx == '0'), cx);
   builder.addTransition(s, atMost(builder, y, n + 1), cy);
   if (cx + 1 < cy) {
    builder.addTransition(s, anyOfRightLength(builder, x, n+1), (char) (cx + 1), (char) (cy - 1));
   }
  }
 }
 return s;
}

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

/**
 * Constructs sub-automaton corresponding to decimal numbers of value between
 * x.substring(n) and y.substring(n) and of length x.substring(n).length()
 * (which must be equal to y.substring(n).length()).
 */
private static int between(Automaton.Builder builder,
  String x, String y, int n,
  Collection<Integer> initials, boolean zeros) {
 int s = builder.createState();
 if (x.length() == n) {
  builder.setAccept(s, true);
 } else {
  if (zeros) {
   initials.add(s);
  }
  char cx = x.charAt(n);
  char cy = y.charAt(n);
  if (cx == cy) {
   builder.addTransition(s, between(builder, x, y, n + 1, initials, zeros && cx == '0'), cx);
  } else { // cx<cy
   builder.addTransition(s, atLeast(builder, x, n + 1, initials, zeros && cx == '0'), cx);
   builder.addTransition(s, atMost(builder, y, n + 1), cy);
   if (cx + 1 < cy) {
    builder.addTransition(s, anyOfRightLength(builder, x, n+1), (char) (cx + 1), (char) (cy - 1));
   }
  }
 }
 return s;
}

相关文章