Examples of Match


Examples of org.eclipse.search.ui.text.Match

    private void addMatches(final List<ModuleLineFunctionArityRef> chunk) {
        final List<Match> l = Lists.newArrayListWithCapacity(chunk.size());
        final List<ErlangSearchElement> resultAdded = Lists
                .newArrayListWithCapacity(chunk.size());
        for (final ModuleLineFunctionArityRef ref : chunk) {
            final Match m = SearchUtil.createMatch(ref, pathToModuleMap);
            l.add(m);
            resultAdded.add((ErlangSearchElement) m.getElement());
        }
        fSearchResult = (ErlangSearchResult) getSearchResult();
        final List<ErlangSearchElement> result = fSearchResult.getResult();
        result.addAll(resultAdded);
        fSearchResult.setResult(result);
View Full Code Here

Examples of org.eclipse.search.ui.text.Match

 
  public static Match createMatch(final ModuleLineFunctionArityRef ref, final Map<String, IErlModule> pathToModuleMap) {
    final ErlangSearchElement ese = SearchUtil.createSearchElementFromRef(ref, pathToModuleMap);
    int _offset = ref.getOffset();
    int _length = ref.getLength();
    return new Match(ese, _offset, _length);
  }
View Full Code Here

Examples of org.exist.dom.Match

     * @param predicate
     *            the predicate based on which the full-text matches are filtered: If the predicate returns true the
     *            match stays, if not the match is removed.
     */
    public static void filterMatches(final NodeProxy node, final F<Match, Boolean> predicate) {
        Match m = node.getMatches();
        node.setMatches(null);
        while (m != null) {
            if (predicate.f(m).booleanValue())
                node.addMatch(m);
            m = m.getNextMatch();
        }
    }
View Full Code Here

Examples of org.ggp.base.util.match.Match

  @Override
  public void observe(Event genericEvent) {
    if (!(genericEvent instanceof ServerMatchUpdatedEvent)) return;
    ServerMatchUpdatedEvent event = (ServerMatchUpdatedEvent)genericEvent;
    Match match = event.getMatch();

    DefaultTableModel model = (DefaultTableModel) queueTable.getModel();
    for (int i = 0; i < model.getRowCount(); i++) {
      String rowMatchId = model.getValueAt(i, 0).toString();
      if (rowMatchId.equals(match.getMatchId())) {
        String status = "active";
        if (match.isAborted()) status = "aborted";
        if (match.isCompleted()) status = "done";
        model.setValueAt(status, i, 3);
        if (match.isCompleted()) {
          model.setValueAt(getLinebreakString(match.getGoalValues()), i, 5);
        }
        List<Integer> errorCounts = new ArrayList<Integer>();
        List<String> errorCountStrings = new ArrayList<String>();
        for (int j = 0; j < match.getPlayerNamesFromHost().size(); j++) {
          errorCounts.add(0);
        }
        for (List<String> errors : match.getErrorHistory()) {
          for (int j = 0; j < errors.size(); j++) {
            if (!errors.get(j).isEmpty()) {
              errorCounts.set(j, errorCounts.get(j) + 1);
            }
          }
        }
        for (int errorCount : errorCounts) {
          if (errorCount > 0) {
            errorCountStrings.add("<font color=red>" + errorCount + "</font>");
          } else {
            errorCountStrings.add("0");
          }
        }
        model.setValueAt(getLinebreakString(errorCountStrings), i, 6);
        model.setValueAt(match.getStateHistory().size()-1, i, 7);

        if (event.getExternalPublicationKey() != null) {
          matchIdToURL.put(match.getMatchId(), "http://www.ggp.org/view/all/matches/" + event.getExternalPublicationKey() + "/");
        }
        if (event.getExternalFilename() != null) {
          matchIdToFilename.put(match.getMatchId(), event.getExternalFilename());
        }

        return;
      }
    }

    // Couldn't find the match in the existing list -- add it.
    model.addRow(new Object[]{match.getMatchId(),match.getGame().getKey(),match.getStartClock() + "," + match.getPlayClock(),"starting",getLinebreakString(match.getPlayerNamesFromHost()),"","",0});
    queueTable.setRowHeight(model.getRowCount()-1, match.getPlayerNamesFromHost().size()*20);
  }
 
View Full Code Here

Examples of org.jitterbit.ui.util.find.SearchTarget.Match

        return target != null;
    }

    public void findNext() {
        TextSearchParameters params = model.getSearchParameters();
        Match match = target.nextMatch(params);
        handleNewMatch(match, params);
    }
View Full Code Here

Examples of org.joox.Match

        StreamSource xsl = new StreamSource(isXSL);
        TransformerFactory factory = TransformerFactory.newInstance();
        Transformer transformer = factory.newTransformer(xsl);

        Match manual = $(isXML);
        for (Match section : manual.find("section").each()) {
            Match sections = section.add(section.parents("section")).reverse();

            String path = StringUtils.join(sections.ids(), "/");
            String relativePath = StringUtils.join(Collections.nCopies(sections.size(), ".."), "/") + "/";
            File dir = new File(path);
            dir.mkdirs();

            System.out.println("Transforming section " + path);
            FileOutputStream out = new FileOutputStream(new File(dir, "index.php"));
View Full Code Here

Examples of org.jwall.audit.Match

  static Logger log = LoggerFactory.getLogger(FilterCompiler.class);

  public Condition createCondition(FilterExpression e) throws SyntaxException {
    if (e instanceof Match) {
      Match m = (Match) e;
      return AbstractCondition.createCondition(m.getOp(),
          m.getVariable(), m.getValue());
    }

    throw new FilterException(
        "Don't know how to compile condition from expression " + e
            + "!");
View Full Code Here

Examples of org.kie.api.runtime.rule.Match

        AgendaGroup[] agendaGroups = session.getAgenda().getAgendaGroups();
        assertEquals(1, agendaGroups.length);
        assertEquals("MAIN", agendaGroups[0].getName());
        assertEquals(1, agendaGroups[0].getActivations().length);

        Match activation = agendaGroups[0].getActivations()[0];
        assertEquals("ActivationCreator", activation.getRule().getName());
        Entry[] parameters = session.getActivationParameters(
            ((org.drools.core.spi.Activation) activation).getActivationNumber());
        assertEquals(1, parameters.length);
        assertEquals("o", parameters[0].getKey());
        assertEquals("String1", parameters[0].getValue());
View Full Code Here

Examples of org.kie.api.runtime.rule.Match

        verify( ael,
                times( 7 ) ).afterMatchFired(captor.capture());

        List<AfterMatchFiredEvent> values = captor.getAllValues();
        // first rule
        Match act = values.get( 0 ).getMatch();
        assertThat( act.getRule().getName(),
                    is( "launch" ) );

        if ( phreak == RuleEngineOption.PHREAK ) {
            // first rule
            act = values.get( 1 ).getMatch();
            assertThat( act.getRule().getName(),
                        is( "ba" ) );
            assertThat( ((Number) act.getDeclarationValue( "$a" )).intValue(),
                        is( 2 ) );
            assertThat( ((Number) act.getDeclarationValue( "$b" )).intValue(),
                        is( 1 ) );

            // second rule
            act = values.get( 2 ).getMatch();
            assertThat( act.getRule().getName(),
                        is( "ba" ) );
            assertThat( ((Number) act.getDeclarationValue( "$a" )).intValue(),
                        is( 3 ) );
            assertThat( ((Number) act.getDeclarationValue( "$b" )).intValue(),
                        is( 1 ) );

            // third rule
            act = values.get( 3 ).getMatch();
            assertThat( act.getRule().getName(),
                        is( "ba" ) );
            assertThat( ((Number) act.getDeclarationValue( "$a" )).intValue(),
                        is( 3 ) );
            assertThat( ((Number) act.getDeclarationValue( "$b" )).intValue(),
                        is( 2 ) );

            // fourth rule
            act = values.get( 4 ).getMatch();
            assertThat( act.getRule().getName(),
                        is( "ab" ) );
            assertThat( ((Number) act.getDeclarationValue( "$a" )).intValue(),
                        is( 2 ) );
            assertThat( ((Number) act.getDeclarationValue( "$b" )).intValue(),
                        is( 1 ) );

            // fifth rule
            act = values.get( 5 ).getMatch();
            assertThat( act.getRule().getName(),
                        is( "ab" ) );
            assertThat( ((Number) act.getDeclarationValue( "$a" )).intValue(),
                        is( 3 ) );
            assertThat( ((Number) act.getDeclarationValue( "$b" )).intValue(),
                        is( 1 ) );

            // sixth rule
            act = values.get( 6 ).getMatch();
            assertThat( act.getRule().getName(),
                        is( "ab" ) );
            assertThat( ((Number) act.getDeclarationValue( "$a" )).intValue(),
                        is( 3 ) );
            assertThat( ((Number) act.getDeclarationValue( "$b" )).intValue(),
                        is( 2 ) );
        } else {
            // second rule
            act = values.get( 1 ).getMatch();
            assertThat( act.getRule().getName(),
                        is( "ba" ) );
            assertThat( ((Number) act.getDeclarationValue( "$a" )).intValue(),
                        is( 3 ) );
            assertThat( ((Number) act.getDeclarationValue( "$b" )).intValue(),
                        is( 2 ) );

            // third rule
            act = values.get( 2 ).getMatch();
            assertThat( act.getRule().getName(),
                        is( "ab" ) );
            assertThat( ((Number) act.getDeclarationValue( "$a" )).intValue(),
                        is( 3 ) );
            assertThat( ((Number) act.getDeclarationValue( "$b" )).intValue(),
                        is( 2 ) );

            // fourth rule
            act = values.get( 3 ).getMatch();
            assertThat( act.getRule().getName(),
                        is( "ba" ) );
            assertThat( ((Number) act.getDeclarationValue( "$a" )).intValue(),
                        is( 3 ) );
            assertThat( ((Number) act.getDeclarationValue( "$b" )).intValue(),
                        is( 1 ) );

            // fifth rule
            act = values.get( 4 ).getMatch();
            assertThat( act.getRule().getName(),
                        is( "ab" ) );
            assertThat( ((Number) act.getDeclarationValue( "$a" )).intValue(),
                        is( 3 ) );
            assertThat( ((Number) act.getDeclarationValue( "$b" )).intValue(),
                        is( 1 ) );

            // sixth rule
            act = values.get( 5 ).getMatch();
            assertThat( act.getRule().getName(),
                        is( "ba" ) );
            assertThat( ((Number) act.getDeclarationValue( "$a" )).intValue(),
                        is( 2 ) );
            assertThat( ((Number) act.getDeclarationValue( "$b" )).intValue(),
                        is( 1 ) );

            // seventh rule
            act = values.get( 6 ).getMatch();
            assertThat( act.getRule().getName(),
                        is( "ab" ) );
            assertThat( ((Number) act.getDeclarationValue( "$a" )).intValue(),
                        is( 2 ) );
            assertThat( ((Number) act.getDeclarationValue( "$b" )).intValue(),
                        is( 1 ) );
        }


    }
View Full Code Here

Examples of org.kie.api.runtime.rule.Match

        ksession.fireAllRules();

        ArgumentCaptor<AfterMatchFiredEvent> cap = ArgumentCaptor.forClass( AfterMatchFiredEvent.class );
        Mockito.verify( ael ).afterMatchFired(cap.capture());

        Match activation = cap.getValue().getMatch();
        assertThat( ((Number) activation.getDeclarationValue( "$sum" )).intValue(),
                    is( 18 ) );
        assertThat( ((Number) activation.getDeclarationValue( "$min" )).intValue(),
                    is( 3 ) );
        assertThat( ((Number) activation.getDeclarationValue( "$avg" )).intValue(),
                    is( 6 ) );

        Mockito.reset( ael );
        // ---------------- 2nd scenario
        final int index = 1;
        cheese[index].setPrice( 9 );
        ksession.update( cheeseHandles[index],
                         cheese[index] );
        ksession.fireAllRules();

        Mockito.verify( ael ).afterMatchFired(cap.capture());

        activation = cap.getValue().getMatch();
        assertThat( ((Number) activation.getDeclarationValue( "$sum" )).intValue(),
                    is( 24 ) );
        assertThat( ((Number) activation.getDeclarationValue( "$min" )).intValue(),
                    is( 5 ) );
        assertThat( ((Number) activation.getDeclarationValue( "$avg" )).intValue(),
                    is( 8 ) );

        Mockito.reset( ael );
        // ---------------- 3rd scenario
        bob.setLikes( "brie" );
        ksession.update( bobHandle,
                         bob );
        ksession.fireAllRules();

        Mockito.verify( ael ).afterMatchFired(cap.capture());

        activation = cap.getValue().getMatch();
        assertThat( ((Number) activation.getDeclarationValue( "$sum" )).intValue(),
                    is( 32 ) );
        assertThat( ((Number) activation.getDeclarationValue( "$min" )).intValue(),
                    is( 15 ) );
        assertThat( ((Number) activation.getDeclarationValue( "$avg" )).intValue(),
                    is( 16 ) );

        Mockito.reset( ael );
        // ---------------- 4th scenario
        ksession.retract( cheeseHandles[3] );
        ksession.fireAllRules();

        Mockito.verify( ael ).afterMatchFired(cap.capture());

        activation = cap.getValue().getMatch();
        assertThat( ((Number) activation.getDeclarationValue( "$sum" )).intValue(),
                    is( 17 ) );
        assertThat( ((Number) activation.getDeclarationValue( "$min" )).intValue(),
                    is( 17 ) );
        assertThat( ((Number) activation.getDeclarationValue( "$avg" )).intValue(),
                    is( 17 ) );
    }
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.