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

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

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

Regex.getOptions介绍

暂无

代码示例

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

  1. @Override
  2. public int getFlags() {
  3. return pattern.getOptions();
  4. }

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

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

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

  1. @Override
  2. public byte[] toByteArray() {
  3. ComparatorProtos.RegexStringComparator.Builder builder =
  4. ComparatorProtos.RegexStringComparator.newBuilder();
  5. builder.setPattern(regex);
  6. builder.setPatternFlags(joniToPatternFlags(pattern.getOptions()));
  7. builder.setCharset(encoding.getCharsetName());
  8. builder.setEngine(EngineType.JONI.name());
  9. return builder.build().toByteArray();
  10. }

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

  1. @Override
  2. public int getFlags() {
  3. return pattern.getOptions();
  4. }

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

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

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

  1. @Override
  2. public byte[] toByteArray() {
  3. ComparatorProtos.RegexStringComparator.Builder builder =
  4. ComparatorProtos.RegexStringComparator.newBuilder();
  5. builder.setPattern(regex);
  6. builder.setPatternFlags(joniToPatternFlags(pattern.getOptions()));
  7. builder.setCharset(encoding.getCharsetName());
  8. builder.setEngine(EngineType.JONI.name());
  9. return builder.build().toByteArray();
  10. }

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

  1. static RubyRegexp newRegexp(Ruby runtime, ByteList str, Regex pattern) {
  2. RubyRegexp regexp = new RubyRegexp(runtime);
  3. assert str != null;
  4. regexp.str = str;
  5. regexp.options = RegexpOptions.fromJoniOptions(pattern.getOptions());
  6. regexp.pattern = pattern;
  7. return regexp;
  8. }

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

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

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

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

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

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

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

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

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

  1. /** rb_reg_inspect
  2. *
  3. */
  4. @JRubyMethod(name = "inspect")
  5. @Override
  6. public IRubyObject inspect() {
  7. check();
  8. return getRuntime().newString(ByteList.create(rb_reg_desc(str.bytes, str.begin, str.realSize, pattern.getOptions()).toString()));
  9. }

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

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

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

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

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

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

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

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

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

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

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

  1. @Override
  2. public byte[] toByteArray() {
  3. ComparatorProtos.RegexStringComparator.Builder builder =
  4. ComparatorProtos.RegexStringComparator.newBuilder();
  5. builder.setPattern(regex);
  6. builder.setPatternFlags(joniToPatternFlags(pattern.getOptions()));
  7. builder.setCharset(encoding.getCharsetName());
  8. builder.setEngine(EngineType.JONI.name());
  9. return builder.build().toByteArray();
  10. }

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

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

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

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

相关文章