Example usage for java.util.regex Matcher useTransparentBounds

List of usage examples for java.util.regex Matcher useTransparentBounds

Introduction

In this page you can find the example usage for java.util.regex Matcher useTransparentBounds.

Prototype

public Matcher useTransparentBounds(boolean b) 

Source Link

Document

Sets the transparency of region bounds for this matcher.

Usage

From source file:com.github.rwitzel.streamflyer.regex.AbstractRegexModifierTest.java

protected OnStreamMatcher createMatcher(String regex, int flags) {
    Matcher matcher = Pattern.compile(regex, flags).matcher("");
    matcher.useTransparentBounds(true);
    matcher.useAnchoringBounds(false);//  w  w  w .j  a  v a 2s  .  co m
    return new OnStreamStandardMatcher(matcher);
}

From source file:com.github.rwitzel.streamflyer.experimental.range.RangeFilterModifierTest.java

private RegexModifier createRegexModifier(String regex) {

    Matcher matcher = Pattern.compile(regex, 0).matcher("");
    matcher.useTransparentBounds(true);
    matcher.useAnchoringBounds(false);/*from   ww w.java 2  s . c o m*/
    OnStreamMatcher onStreamMatcher = new OnStreamStandardMatcher(matcher);
    return new RegexModifier(onStreamMatcher, new MatchProcessor() {

        @Override
        public MatchProcessorResult process(StringBuilder characterBuffer, int firstModifiableCharacterInBuffer,
                MatchResult matchResult) {
            throw new UnsupportedOperationException("this match processor must be replaced with another one");
        }
    }, 12, 345);
}

From source file:com.googlecode.streamflyer.regex.OnStreamMatcherPerformanceTest.java

private OnStreamMatcher createMatcher(Class<? extends OnStreamMatcher> onStreamMatcherClass, String regex) {

    if (onStreamMatcherClass.isAssignableFrom(OnStreamJava6Matcher.class)) {
        Matcher matcher = Pattern.compile(regex).matcher("");
        matcher.useTransparentBounds(true);
        matcher.useAnchoringBounds(false);
        return new OnStreamJava6Matcher(matcher);

    } else if (onStreamMatcherClass.isAssignableFrom(OnStreamStandardMatcher.class)) {
        Matcher matcher = Pattern.compile(regex).matcher("");
        matcher.useTransparentBounds(true);
        return new OnStreamStandardMatcher(matcher);
    } else if (onStreamMatcherClass.isAssignableFrom(OnStreamExtendedMatcher.class)) {
        com.googlecode.streamflyer.regex.fast.Matcher matcher = com.googlecode.streamflyer.regex.fast.Pattern
                .compile(regex).matcher("");
        matcher.useTransparentBounds(true);
        return new OnStreamExtendedMatcher(matcher);
    } else {/* w  w  w .  j a va2 s .  co m*/
        throw new IllegalArgumentException(
                String.format("class %s is not supported or of wrong type", onStreamMatcherClass));
    }
}