@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; }
private boolean matches(byte[] bytes, int offset, int len) { int range = offset + len; Matcher matcher = pattern.matcher(bytes, offset, range); int ret = matcher.match(offset, range, Option.DEFAULT); return len == ret; }
@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; }
Matcher matcher = pattern.matcher(srcBytes, 0, srcRange); int cur = srcOffset; List<PairInt> searchResults = new LinkedList<PairInt>();
private boolean substr(byte[] srcBytes, int offset, int range, ImmutableBytesWritable outPtr) { Matcher matcher = pattern.matcher(srcBytes, 0, range); boolean ret = matcher.search(offset, range, Option.DEFAULT) >= 0; if (ret) { int len = matcher.getEnd() - matcher.getBegin(); outPtr.set(srcBytes, matcher.getBegin(), len); } else { outPtr.set(ByteUtil.EMPTY_BYTE_ARRAY); } return ret; }
new PArrayDataTypeEncoder(PVarchar.INSTANCE, sortOrder); int srcRange = srcOffset + srcLen; Matcher matcher = pattern.matcher(srcBytes, 0, srcRange); int cur = srcOffset; boolean append;
private boolean matches(byte[] bytes, int offset, int len) { int range = offset + len; Matcher matcher = pattern.matcher(bytes, offset, range); int ret = matcher.match(offset, range, Option.DEFAULT); return len == ret; }
@Override public boolean test(final CharSequence string) { return regex.matcher(string.toString().getBytes(StandardCharsets.UTF_8)) .search(0, string.length(), Option.NONE) > Matcher.FAILED; }
private boolean matches(byte[] bytes, int offset, int len) { int range = offset + len; Matcher matcher = pattern.matcher(bytes, offset, range); int ret = matcher.match(offset, range, Option.DEFAULT); return len == ret; }
public Region match(String str, int from) { byte[] strBytes = str.getBytes(); Matcher matcher = this.pattern.matcher(strBytes, 0, strBytes.length); if (matcher.search(from, strBytes.length, 0) >= 0) { return matcher.getEagerRegion(); } return null; }
@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; }
@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; }
private boolean substr(byte[] srcBytes, int offset, int range, ImmutableBytesWritable outPtr) { Matcher matcher = pattern.matcher(srcBytes, 0, range); boolean ret = matcher.search(offset, range, Option.DEFAULT) >= 0; if (ret) { int len = matcher.getEnd() - matcher.getBegin(); outPtr.set(srcBytes, matcher.getBegin(), len); } else { outPtr.set(ByteUtil.EMPTY_BYTE_ARRAY); } return ret; }
private boolean substr(byte[] srcBytes, int offset, int range, ImmutableBytesWritable outPtr) { Matcher matcher = pattern.matcher(srcBytes, 0, range); boolean ret = matcher.search(offset, range, Option.DEFAULT) >= 0; if (ret) { int len = matcher.getEnd() - matcher.getBegin(); outPtr.set(srcBytes, matcher.getBegin(), len); } else { outPtr.set(ByteUtil.EMPTY_BYTE_ARRAY); } return ret; }
@Override public MatcherStateImpl matcher(CharSequence s) { UEncoding enc = getEncoding(); if (s != lastInput) { lastInput = s; lastInputBytes = enc.toBytes(s); } int length = lastInputBytes.length - enc.minLength(); Matcher matcher = getPattern().matcher(lastInputBytes, 0, length); return new MatcherStateImpl(new EncodedString(enc, s), matcher, negativeLAGroups, namedGroups); }
private RubyMatchData subBangMatch(ThreadContext context, RubyRegexp regexp, RubyString repl) { Regex pattern = regexp.getPattern(); Regex prepared = regexp.preparePattern(this); int begin = value.getBegin(); int range = begin + value.getRealSize(); final Matcher matcher = prepared.matcher(value.getUnsafeBytes(), begin, range); if (RubyRegexp.matcherSearch(context, matcher, begin, range, Option.NONE) >= 0) { RubyMatchData match = RubyRegexp.createMatchData(context, this, matcher, pattern); match.regexp = regexp; return match; } return null; }
@Override public MatcherStateImpl matcher(String s) { UEncoding enc = getEncoding(); if (s != lastInput) { lastInput = s; lastInputBytes = enc.toBytes(s); } int length = lastInputBytes.length - enc.minLength(); Matcher matcher = getPattern().matcher(lastInputBytes, 0, length); return new MatcherStateImpl(new EncodedString(enc, s), matcher, negativeLAGroups, namedGroups); }
protected void handleFileEncodingComment(ByteList encodingLine) throws IOException { int realSize = encodingLine.getRealSize(); int begin = encodingLine.getBegin(); Matcher matcher = encodingRegexp.matcher(encodingLine.getUnsafeBytes(), begin, begin + realSize); int result = RubyRegexp.matcherSearch(parserSupport.getConfiguration().getRuntime(), matcher, begin, begin + realSize, Option.IGNORECASE); if (result < 0) return; int begs[] = matcher.getRegion().beg; int ends[] = matcher.getRegion().end; setEncoding(new ByteList(encodingLine.getUnsafeBytes(), begs[1], ends[1] - begs[1])); }
protected void handleFileEncodingComment(ByteList encodingLine) throws IOException { int realSize = encodingLine.getRealSize(); int begin = encodingLine.getBegin(); Matcher matcher = encodingRegexp.matcher(encodingLine.getUnsafeBytes(), begin, begin + realSize); int result = RubyRegexp.matcherSearch(parserSupport.getConfiguration().getRuntime(), matcher, begin, begin + realSize, Option.IGNORECASE); if (result < 0) return; int begs[] = matcher.getRegion().beg; int ends[] = matcher.getRegion().end; setEncoding(new ByteList(encodingLine.getUnsafeBytes(), begs[1], ends[1] - begs[1])); }
private IRubyObject subBangNoIter(ThreadContext context, Regex pattern, RubyString repl) { int tuFlags = repl.flags; int range = value.getBegin() + value.getRealSize(); Matcher matcher = pattern.matcher(value.getUnsafeBytes(), value.getBegin(), range); if (RubyRegexp.matcherSearch(context.runtime, matcher, value.getBegin(), range, Option.NONE) >= 0) { repl = RubyRegexp.regsub(repl, this, matcher, context.runtime.getKCode().getEncoding()); RubyMatchData match = RubyRegexp.createMatchData(context, this, matcher, pattern); context.setBackRef(match); return subBangCommon(context, pattern, matcher, repl, tuFlags); } else { return context.setBackRef(context.runtime.getNil()); } }