org.joni.Regex.getOptions()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(105)

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

Regex.getOptions介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

@Override
public int getFlags() {
 return pattern.getOptions();
}

代码示例来源:origin: apache/hbase

@Override
public int compareTo(byte[] value, int offset, int length) {
 // Use subsequence match instead of full sequence match to adhere to the
 // principle of least surprise.
 Matcher m = pattern.matcher(value);
 return m.search(offset, length, pattern.getOptions()) < 0 ? 1 : 0;
}

代码示例来源:origin: apache/hbase

@Override
public byte[] toByteArray() {
 ComparatorProtos.RegexStringComparator.Builder builder =
   ComparatorProtos.RegexStringComparator.newBuilder();
  builder.setPattern(regex);
  builder.setPatternFlags(joniToPatternFlags(pattern.getOptions()));
  builder.setCharset(encoding.getCharsetName());
  builder.setEngine(EngineType.JONI.name());
  return builder.build().toByteArray();
}

代码示例来源:origin: org.apache.hbase/hbase-client

@Override
public int getFlags() {
 return pattern.getOptions();
}

代码示例来源:origin: org.apache.hbase/hbase-client

@Override
public int compareTo(byte[] value, int offset, int length) {
 // Use subsequence match instead of full sequence match to adhere to the
 // principle of least surprise.
 Matcher m = pattern.matcher(value);
 return m.search(offset, length, pattern.getOptions()) < 0 ? 1 : 0;
}

代码示例来源:origin: org.apache.hbase/hbase-client

@Override
public byte[] toByteArray() {
 ComparatorProtos.RegexStringComparator.Builder builder =
   ComparatorProtos.RegexStringComparator.newBuilder();
  builder.setPattern(regex);
  builder.setPatternFlags(joniToPatternFlags(pattern.getOptions()));
  builder.setCharset(encoding.getCharsetName());
  builder.setEngine(EngineType.JONI.name());
  return builder.build().toByteArray();
}

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

static RubyRegexp newRegexp(Ruby runtime, ByteList str, Regex pattern) {
  RubyRegexp regexp = new RubyRegexp(runtime);
  assert str != null;
  regexp.str = str;
  regexp.options = RegexpOptions.fromJoniOptions(pattern.getOptions());
  regexp.pattern = pattern;
  return regexp;
}

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

@Override
public int compareTo(byte[] value, int offset, int length) {
 // Use subsequence match instead of full sequence match to adhere to the
 // principle of least surprise.
 Matcher m = pattern.matcher(value);
 return m.search(offset, length, pattern.getOptions()) < 0 ? 1 : 0;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

static Regex getRegexpFromCache(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options) {
  Map<ByteList, Regex> cache = patternCache.get();
  Regex regex = cache.get(bytes);
  if (regex != null && regex.getEncoding() == enc && regex.getOptions() == options.toJoniOptions()) return regex;
  regex = makeRegexp(runtime, bytes, options, enc);
  regex.setUserObject(bytes);
  cache.put(bytes, regex);
  return regex;
}

代码示例来源:origin: org.netbeans.api/org-jruby

public static void marshalTo(RubyRegexp regexp, MarshalStream output) throws java.io.IOException {
    output.registerLinkTarget(regexp);
    output.writeString(new String(regexp.str.bytes,regexp.str.begin,regexp.str.realSize));
    output.writeInt(regexp.pattern.getOptions() & EMBEDDABLE);
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private static Regex getPreprocessedRegexpFromCache(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options, ErrorMode mode) {
  Map<ByteList, Regex> cache = preprocessedPatternCache.get();
  Regex regex = cache.get(bytes);
  if (regex != null && regex.getEncoding() == enc && regex.getOptions() == options.toJoniOptions()) return regex;
  ByteList preprocessed = preprocess(runtime, bytes, enc, new Encoding[]{null}, ErrorMode.RAISE);
  regex = makeRegexp(runtime, preprocessed, options, enc);
  regex.setUserObject(preprocessed);
  cache.put(bytes, regex);
  return regex;
}

代码示例来源:origin: org.netbeans.api/org-jruby

/** rb_reg_inspect
 *
 */
@JRubyMethod(name = "inspect")
@Override
public IRubyObject inspect() {
  check();
  return getRuntime().newString(ByteList.create(rb_reg_desc(str.bytes, str.begin, str.realSize, pattern.getOptions()).toString()));
}

代码示例来源:origin: org.netbeans.api/org-jruby

@JRubyMethod(name = {"==", "eql?"}, required = 1)
@Override
public IRubyObject op_equal(ThreadContext context, IRubyObject other) {
  if(this == other) return context.getRuntime().getTrue();
  if(!(other instanceof RubyRegexp)) return context.getRuntime().getFalse();
  RubyRegexp otherRegex = (RubyRegexp)other;
  
  check();
  otherRegex.check();
  
  return context.getRuntime().newBoolean(str.equal(otherRegex.str) && 
      kcode == otherRegex.kcode && pattern.getOptions() == otherRegex.pattern.getOptions());
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public static void marshalTo(RubyRegexp regexp, MarshalStream output) throws java.io.IOException {
  output.registerLinkTarget(regexp);
  output.writeString(regexp.str);
  
  int options = regexp.pattern.getOptions() & EMBEDDABLE;
  if (regexp.getOptions().isFixed()) options |= ARG_ENCODING_FIXED;
  
  output.writeByte(options);
}

代码示例来源:origin: org.jruby/jruby-complete

public static Regex getRegexpFromCache(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options) {
  Regex regex = patternCache.get(bytes);
  if (regex != null && regex.getEncoding() == enc && regex.getOptions() == options.toJoniOptions()) return regex;
  regex = makeRegexp(runtime, bytes, options, enc);
  regex.setUserObject(bytes);
  patternCache.put(bytes, regex);
  return regex;
}

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

private static Regex getPreprocessedRegexpFromCache(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options, RegexpSupport.ErrorMode mode) {
  Regex regex = preprocessedPatternCache.get(bytes);
  if (regex != null && regex.getEncoding() == enc && regex.getOptions() == options.toJoniOptions()) return regex;
  ByteList preprocessed = RegexpSupport.preprocess(runtime, bytes, enc, new Encoding[]{null}, RegexpSupport.ErrorMode.RAISE);
  regex = makeRegexp(runtime, preprocessed, options, enc);
  regex.setUserObject(preprocessed);
  preprocessedPatternCache.put(bytes, regex);
  return regex;
}

代码示例来源:origin: org.jruby/jruby-complete

private static Regex getPreprocessedRegexpFromCache(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options, RegexpSupport.ErrorMode mode) {
  Regex regex = preprocessedPatternCache.get(bytes);
  if (regex != null && regex.getEncoding() == enc && regex.getOptions() == options.toJoniOptions()) return regex;
  ByteList preprocessed = RegexpSupport.preprocess(runtime, bytes, enc, new Encoding[]{null}, RegexpSupport.ErrorMode.RAISE);
  regex = makeRegexp(runtime, preprocessed, options, enc);
  regex.setUserObject(preprocessed);
  preprocessedPatternCache.put(bytes, regex);
  return regex;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-client

@Override
public byte[] toByteArray() {
 ComparatorProtos.RegexStringComparator.Builder builder =
   ComparatorProtos.RegexStringComparator.newBuilder();
  builder.setPattern(regex);
  builder.setPatternFlags(joniToPatternFlags(pattern.getOptions()));
  builder.setCharset(encoding.getCharsetName());
  builder.setEngine(EngineType.JONI.name());
  return builder.build().toByteArray();
}

代码示例来源:origin: org.jruby/jruby-complete

static Regex getQuotedRegexpFromCache(Ruby runtime, RubyString str, RegexpOptions options) {
  final ByteList bytes = str.getByteList();
  Regex regex = quotedPatternCache.get(bytes);
  Encoding enc = str.isAsciiOnly() ? USASCIIEncoding.INSTANCE : bytes.getEncoding();
  if (regex != null && regex.getEncoding() == enc && regex.getOptions() == options.toJoniOptions()) return regex;
  final ByteList quoted = quote(str);
  regex = makeRegexp(runtime, quoted, options, quoted.getEncoding());
  regex.setUserObject(quoted);
  quotedPatternCache.put(bytes, regex);
  return regex;
}

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

static Regex getQuotedRegexpFromCache(Ruby runtime, RubyString str, RegexpOptions options) {
  final ByteList bytes = str.getByteList();
  Regex regex = quotedPatternCache.get(bytes);
  Encoding enc = str.isAsciiOnly() ? USASCIIEncoding.INSTANCE : bytes.getEncoding();
  if (regex != null && regex.getEncoding() == enc && regex.getOptions() == options.toJoniOptions()) return regex;
  final ByteList quoted = quote(str);
  regex = makeRegexp(runtime, quoted, options, quoted.getEncoding());
  regex.setUserObject(quoted);
  quotedPatternCache.put(bytes, regex);
  return regex;
}

相关文章