Examples of Matcher

  • net.fortytwo.twitlogic.syntax.Matcher
    two.net).
  • net.xeoh.plugins.diagnosis.local.util.conditions.matcher.Matcher
    @author Ralf Biedert
  • org.apache.cocoon.matching.Matcher
    @author Giacomo Pati @version CVS $Revision: 1.2.2.5 $ $Date: 2001/11/06 09:55:36 $
  • org.apache.fop.fonts.FontTriplet.Matcher
  • org.apache.ivy.plugins.matcher.Matcher
    An interface that defines a string matcher.
  • org.apache.mailet.Matcher
    This interface define the behaviour of the message "routing" inside the mailet container. The match(Mail) method returns a Collection of recipients that meet this class's criteria.

    An important feature of the mailet container is the ability to fork processing of messages. When a message first arrives at the server, it might have multiple recipients specified. As a message is passed to a matcher, the matcher might only "match" one of the listed recipients. It would then return only the matching recipient in the Collection. The mailet container should then duplicate the message splitting the recipient list across the two messages as per what the matcher returned.

    [THIS PARAGRAPH NOT YET IMPLEMENTED] The matcher can extend this forking to further separation by returning a Collection of Collection objects. This allows a matcher to fork multiple processes if there are multiple recipients that require separate processing. For example, we could write a ListservMatcher that handles multiple listservs. When someone cross-posts across multiple listservs that this matcher handles, it could put each listserv address (recipient) that it handles in a separate Collection object. By returning each of these Collections within a container Collection object, it could indicate to the mailet container how many forks to spawn.

    This interface defines methods to initialize a matcher, to match messages, and to remove a matcher from the server. These are known as life-cycle methods and are called in the following sequence:

    1. The matcher is constructed, then initialized with the init method.
    2. Any calls from clients to the match method are handled.
    3. The matcher is taken out of service, then destroyed with the destroy method, then garbage collected and finalized.
    In addition to the life-cycle methods, this interface provides the getMatcherConfig method, which the matcher can use to get any startup information, and the getMatcherInfo method, which allows the matcher to return basic information about itself, such as author, version, and copyright. @version 1.0.0, 24/04/1999 @author Federico Barbieri @author Serge Knystautas
  • org.apache.tika.sax.xpath.Matcher
    XPath element matcher. A matcher instance encapsulates a specific state in XPath evaluation.
  • org.gocha.text.regex.Matcher
    Результат совпадения шаблона @author gocha
  • org.gwt.mosaic.core.client.util.regex.Matcher
    @author georgopoulos.georgios(at)gmail.com
  • org.hamcrest.Matcher
    A matcher over acceptable values. A matcher is able to describe itself to give feedback when it fails.

    Matcher implementations should NOT directly implement this interface. Instead, extend the {@link BaseMatcher} abstract class,which will ensure that the Matcher API can grow to support new features and remain compatible with all Matcher implementations.

    For easy access to common Matcher implementations, use the static factory methods in {@link CoreMatchers}. @see CoreMatchers @see BaseMatcher

  • org.infinispan.objectfilter.Matcher
    @author anistor@redhat.com @since 7.0
  • org.jbehave.core.mock.Matcher
    Represents a matcher on a method argument. @author Dan North
  • org.jbpm.pvm.internal.type.Matcher
  • org.jbpm.pvm.type.Matcher
  • org.joni.Matcher
  • org.jregex.Matcher
    Matcher instance is an automaton that actually performs matching. It provides the following methods:
  • searching for a matching substrings : matcher.find() or matcher.findAll();
  • testing whether a text matches a whole pattern : matcher.matches();
  • testing whether the text matches the beginning of a pattern : matcher.matchesPrefix();
  • searching with custom options : matcher.find(int options)

    Obtaining results
    After the search succeded, i.e. if one of above methods returned true one may obtain an information on the match:

  • may check whether some group is captured : matcher.isCaptured(int);
  • may obtain start and end positions of the match and its length : matcher.start(int),matcher.end(int),matcher.length(int);
  • may obtain match contents as String : matcher.group(int).
    The same way can be obtained the match prefix and suffix information. The appropriate methods are grouped in MatchResult interface, which the Matcher class implements.
    Matcher objects are not thread-safe, so only one thread may use a matcher instance at a time. Note, that Pattern objects are thread-safe(the same instanse may be shared between multiple threads), and the typical tactics in multithreaded applications is to have one Pattern instance per expression(a singleton), and one Matcher object per thread.
  • org.kitesdk.morphline.shaded.com.google.code.regexp.Matcher
    An engine that performs match operations on a character sequence by interpreting a {@link Pattern}. This is a wrapper for {@link java.util.regex.Matcher}. @since 0.1.9
  • org.modeshape.jcr.sequencer.SequencerPathExpression.Matcher
  • org.netbeans.server.componentsmatch.Matcher
    @author Jindrich Sedek
  • org.openstreetmap.osmosis.tagtransform.Matcher
  • org.parboiled.matchers.Matcher
    A Matcher instance is responsible for "executing" a specific Rule instance, i.e. it implements the actual rule type specific matching logic. Since it extends the {@link GraphNode} interface it can have submatchers.
  • org.shiftone.jrat.util.regex.Matcher
    @author $Author: jeffdrost $ @version $Revision: 1.4 $

  • Examples of org.apache.tika.sax.xpath.Matcher

        // eg <meta:user-defined meta:name="Info1">Text1</meta:user-defined> becomes custom:Info1=Text1
        public static final String USER_DEFINED_METADATA_NAME_PREFIX = "custom:";

        private static ContentHandler getMeta(
                ContentHandler ch, Metadata md, String name, String element) {
            Matcher matcher = new CompositeMatcher(
                    META_XPATH.parse("//meta:" + element),
                    META_XPATH.parse("//meta:" + element + "//text()"));
            ContentHandler branch =
                new MatchingContentHandler(new MetadataHandler(md, name), matcher);
            return new TeeContentHandler(ch, branch);
    View Full Code Here

    Examples of org.gocha.text.regex.Matcher

                ex.printStackTrace();
            }
            if( sdocText==null )return;

            clearApplyStyleQueue();
            Matcher matched = pattern.match(sdocText, 0);

            if( matched.isMatched() )
            {
                for( Matcher m : matched.walk() )
                {
                    addMatched(m);
                }
            }
    View Full Code Here

    Examples of org.gwt.mosaic.core.client.util.regex.Matcher

          encodedSpecs.addAll(subTokenList);
        }
      }

      private Multiplier multiplier(String expression, int offset) {
        Matcher matcher = MULTIPLIER_PREFIX_PATTERN.matcher(expression);
        if (!matcher.find()) {
          return null;
        }
        if (matcher.start() > 0) {
          fail(offset + matcher.start(), "illegal multiplier position");
        }
        Matcher digitMatcher = DIGIT_PATTERN.matcher(expression);
        if (!digitMatcher.find()) {
          return null;
        }
        String digitStr = expression.substring(0, digitMatcher.end());
        int number = 0;
        try {
          number = Integer.parseInt(digitStr);
        } catch (NumberFormatException e) {
          fail(offset, e);
    View Full Code Here

    Examples of org.hamcrest.Matcher

       * @param index the index of the widget.
       * @return a {@link SWTBotButton} with the specified <code>label</code>.
       */
      @SuppressWarnings("unchecked")
      public SWTBotButton buttonWithLabel(String label, int index) {
        Matcher matcher = allOf(widgetOfType(Button.class), withLabel(label), withStyle(SWT.PUSH, "SWT.PUSH"));
        return new SWTBotButton((Button) widget(matcher, index), matcher);
      }
    View Full Code Here

    Examples of org.infinispan.objectfilter.Matcher

       }

       protected abstract Matcher createMatcher();

       protected boolean match(String queryString, Object obj) throws Exception {
          Matcher matcher = createMatcher();

          final int[] matchCount = new int[1];

          matcher.registerFilter(queryString, new FilterCallback() {
             @Override
             public void onFilterResult(Object instance, Object[] projection, Comparable[] sortProjection) {
                matchCount[0]++;
             }
          });

          matcher.match(obj);
          return matchCount[0] == 1;
       }
    View Full Code Here

    Examples of org.jbehave.core.mock.Matcher

            DefaultWindowWrapper wrapper = new DefaultWindowWrapper(AFrame.FRAME_NAME);
           
            try {
                AFrame frame = new AFrame();
               
                Matcher spaceKeyEvent = new Matcher() {
                    public boolean matches(Object arg) {
                        return ((KeyEvent)arg).getKeyCode() == KeyEvent.VK_SPACE ||
                            ((KeyEvent)arg).getKeyChar() == ' ';
                    }
                };
    View Full Code Here

    Examples of org.jbpm.pvm.internal.type.Matcher

        }
       
        String hibernateSessionFactoryName = XmlUtil.attribute(element, "hibernate-session-factory");
       
        // first we get the matcher
        Matcher matcher = null;
        if (element.hasAttribute("class")) {
          String className = element.getAttribute("class");
         
          // if type="serializable"
          if ("serializable".equals(className)) {
            matcher = new SerializableMatcher();
           
          // if type="persistable"
          } else if ("persistable".equals(className)) {
            if (element.hasAttribute("id-type")) {
              String idType = element.getAttribute("id-type");
              if ("long".equalsIgnoreCase(idType)) {
                matcher = new HibernateLongIdMatcher(hibernateSessionFactoryName);
              } else if ("string".equalsIgnoreCase(idType)) {
                matcher = new HibernateStringIdMatcher(hibernateSessionFactoryName);
              } else {
                parse.addProblem("id-type was not 'long' or 'string': "+idType, element);
              }
            } else {
              parse.addProblem("id-type is required in a persistable type", element);
            }

          // otherwise, we expect type="some.java.ClassName"
          } else {
            matcher = new ClassNameMatcher(className);
          }

        } else {
          // look for the matcher element
          Element matcherElement = XmlUtil.element(element, "matcher");
          Element matcherObjectElement = XmlUtil.element(matcherElement);
          if (matcherObjectElement!=null) {
            try {
              matcher = (Matcher) parser.parseElement(matcherObjectElement, parse);
            } catch (ClassCastException e) {
              parse.addProblem("matcher is not a "+Matcher.class.getName()+": "+(matcher!=null ? matcher.getClass().getName() : "null"), element);
            }
          } else {
            parse.addProblem("no matcher specified in "+XmlUtil.toString(element), element);
          }
        }
    View Full Code Here

    Examples of org.jbpm.pvm.type.Matcher

      protected TypeMapping parseTypeMapping(Element element, Parse parse, Parser parser) {
        TypeMapping typeMapping = new TypeMapping();
       
        // first we get the matcher
        Matcher matcher = null;
        if (element.hasAttribute("class")) {
          String className = element.getAttribute("class");
         
          // if type="serializable"
          if ("serializable".equals(className)) {
            matcher = new SerializableMatcher();
           
          // if type="persistable"
          } else if ("persistable".equals(className)) {
            if (element.hasAttribute("id-type")) {
              String idType = element.getAttribute("id-type");
              if ("long".equalsIgnoreCase(idType)) {
                matcher = new HibernateLongIdMatcher();
              } else if ("string".equalsIgnoreCase(idType)) {
                matcher = new HibernateStringIdMatcher();
              } else {
                parse.addProblem("id-type was not 'long' or 'string': "+idType);
              }
            } else {
              parse.addProblem("id-type is required in a persistable type");
            }

          // otherwise, we expect type="some.java.ClassName"
          } else {
            matcher = new ClassNameMatcher(className);
          }

        } else {
          // look for the matcher element
          Element matcherElement = XmlUtil.element(element, "matcher");
          Element matcherObjectElement = XmlUtil.element(matcherElement);
          if (matcherObjectElement!=null) {
            try {
              matcher = (Matcher) parser.parseElement(matcherObjectElement, parse);
            } catch (ClassCastException e) {
              parse.addProblem("matcher is not a "+Matcher.class.getName()+": "+(matcher!=null ? matcher.getClass().getName() : "null"));
            }
          } else {
            parse.addProblem("no matcher specified in "+XmlUtil.toString(element));
          }
        }
    View Full Code Here

    Examples of org.joni.Matcher

        }

        private IRubyObject subBangCommon(Regex regex, ThreadContext context, final boolean iter, RubyRegexp rubyRegex, Block block, RubyString repl, boolean tainted) {

            int range = value.begin + value.realSize;
            Matcher matcher = regex.matcher(value.bytes, value.begin, range);

            Frame frame = context.getPreviousFrame();
            if (matcher.search(value.begin, range, Option.NONE) >= 0) {
                if (iter) {
                    byte[] bytes = value.bytes;
                    int size = value.realSize;
                    RubyMatchData match = rubyRegex.updateBackRef(context, this, frame, matcher);
                    match.use();
                    if (regex.numberOfCaptures() == 0) {
                        repl = objAsString(context, block.yield(context, substr(matcher.getBegin(), matcher.getEnd() - matcher.getBegin())));
                    } else {
                        Region region = matcher.getRegion();
                        repl = objAsString(context, block.yield(context, substr(region.beg[0], region.end[0] - region.beg[0])));
                    }
                    modifyCheck(bytes, size);
                    frozenCheck();
                    frame.setBackRef(match);
                } else {
                    repl = rubyRegex.regsub(repl, this, matcher);
                    rubyRegex.updateBackRef(context, this, frame, matcher);
                }

                final int beg;
                final int plen;
                if (regex.numberOfCaptures() == 0) {
                    beg = matcher.getBegin();
                    plen = matcher.getEnd() - beg;
                } else {
                    Region region = matcher.getRegion();
                    beg = region.beg[0];
                    plen = region.end[0] - beg;
                }

                ByteList replValue = repl.value;
    View Full Code Here

    Examples of org.jregex.Matcher

                    @Override
                    public Object activate(IokeObject method, Object on, List<Object> args, Map<String, Object> keywords, IokeObject context, IokeObject message) throws ControlFlow {
                        IokeObject target = IokeObject.as(Interpreter.send(context.runtime.asText, context, args.get(0)), context);
                        String arg = Text.getText(target);
                        Matcher m = ((Regexp)IokeObject.data(on)).regexp.matcher(arg);

                        if(m.find()) {
                            IokeObject match = regexpMatch.allocateCopy(message, context);
                            match.singleMimicsWithoutCheck(regexpMatch);
                            match.setData(new RegexpMatch(IokeObject.as(on, context), m, target));
                            return match;
                        } else {
                            return context.runtime.nil;
                        }
                    }
                }));

            obj.aliasMethod("match", "=~", null, null);

            obj.registerMethod(runtime.newNativeMethod("Takes one argument that should be a text and returns a text that has all regexp meta characters quoted", new NativeMethod("quote") {
                    private final DefaultArgumentsDefinition ARGUMENTS = DefaultArgumentsDefinition
                        .builder()
                        .withRequiredPositional("text")
                        .getArguments();

                    @Override
                    public DefaultArgumentsDefinition getArguments() {
                        return ARGUMENTS;
                    }

                    @Override
                    public Object activate(IokeObject method, Object on, List<Object> args, Map<String, Object> keywords, IokeObject context, IokeObject message) throws ControlFlow {
                        return context.runtime.newText(Pattern.quote(Text.getText(Interpreter.send(context.runtime.asText, context, args.get(0)))));
                    }
                }));

            obj.registerMethod(runtime.newNativeMethod("Takes one or two text arguments that describes the regular expression to create. the first text is the pattern and the second is the flags.", new NativeMethod("from") {
                    private final DefaultArgumentsDefinition ARGUMENTS = DefaultArgumentsDefinition
                        .builder()
                        .withRequiredPositional("pattern")
                        .withOptionalPositional("flags", "")
                        .getArguments();

                    @Override
                    public DefaultArgumentsDefinition getArguments() {
                        return ARGUMENTS;
                    }

                    @Override
                    public Object activate(IokeObject method, Object on, List<Object> args, Map<String, Object> keywords, IokeObject context, IokeObject message) throws ControlFlow {
                        String pattern = Text.getText(Interpreter.send(context.runtime.asText, context, args.get(0)));
                        String flags = "";
                        if(args.size() > 1) {
                            flags = Text.getText(Interpreter.send(context.runtime.asText, context, args.get(1)));
                        }

                        return context.runtime.newRegexp(pattern, flags, context, message);
                    }
                }));

            obj.registerMethod(runtime.newNativeMethod("Takes one argument and tries to match that argument against the current pattern. Returns a list of all the texts that were matched.", new TypeCheckingNativeMethod("allMatches") {
                    private final TypeCheckingArgumentsDefinition ARGUMENTS = TypeCheckingArgumentsDefinition
                        .builder()
                        .receiverMustMimic(runtime.regexp)
                        .withRequiredPositional("other")
                        .getArguments();

                    @Override
                    public TypeCheckingArgumentsDefinition getArguments() {
                        return ARGUMENTS;
                    }

                    @Override
                    public Object activate(IokeObject method, Object on, List<Object> args, Map<String, Object> keywords, IokeObject context, IokeObject message) throws ControlFlow {
                        String arg = Text.getText(Interpreter.send(context.runtime.asText, context, args.get(0)));
                        Matcher m = ((Regexp)IokeObject.data(on)).regexp.matcher(arg);

                        List<Object> result = new ArrayList<Object>();
                        MatchIterator iter = m.findAll();
                        Runtime runtime = context.runtime;
                        while(iter.hasMore()) {
                            result.add(runtime.newText(iter.nextMatch().group(0)));
                        }
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. All rights reserved.
    All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.