Examples of match()


Examples of org.jostraca.util.RegExp.match()

        RegExp markRegExp = RegExp.make( includeBlockMark, RegExp.ModeSet.DotMatchesNewline );

        // include the file block
        String  includeFileContent  = FileUtil.readFile( pIncludeBase + File.separatorChar + includeBlockFile );       
        String  includeBlockContent = markRegExp.match( includeFileContent );

        // very important - prevent data loss
        if( Standard.EMPTY.equals( includeBlockContent ) ) {
          throw new TemplateException( TemplateException.CODE_includeblock_find,
                                       new ValueSet( ValueCode.FILE, includeBlockFile, ValueCode.VALUE, includeBlockMark ) );

Examples of org.jostraca.util.RegExpMatch.match()

      RegExpMatch[] allincludes      = iIncludeRegExp.matchAll( source );
      numIncludes = allincludes.length;

      for( int includeI = 0; includeI < numIncludes; includeI++ ) {
        includeMatch = allincludes[ includeI ];
        includeText  = includeMatch.match();

        includeFile = includeMatch.matchFirstSub();
        includeFile = ( null == includeFile ? Standard.EMPTY : includeFile );
        includeFile    
          = ( includeFile.startsWith( Standard.QUOTE ) && includeFile.endsWith( Standard.QUOTE ) )

Examples of org.knowhowlab.osgi.monitoradmin.util.StatusVariablePathFilter.match()

            ServiceReference[] monitorableReferences = common.getMonitorableReferences(filter.getMonitorableIdFilter());
            for (ServiceReference monitorableReference : monitorableReferences) {
                String pid = (String) monitorableReference.getProperty(Constants.SERVICE_PID);
                String[] statusVariableNames = common.getStatusVariableNames(pid);
                for (String statusVariableName : statusVariableNames) {
                    if (filter.match(pid, statusVariableName)) {
                        checkPermissions(new StatusVariablePath(pid, statusVariableName), monitorableReference,
                                MonitorPermission.PUBLISH, MonitorPermission.SWITCHEVENTS);
                        paths.add(String.format(MonitorAdminCommon.PATH_PATERN, pid, statusVariableName));
                    }
                }

Examples of org.languagetool.rules.MultipleWhitespaceRule.match()

public class MultipleWhitespaceRuleTest extends TestCase {

  public void testRule() throws IOException {
    final MultipleWhitespaceRule rule = new MultipleWhitespaceRule(TestTools.getEnglishMessages(), new Polish());
    final JLanguageTool langTool = new JLanguageTool(new Polish());
    assertEquals(0, rule.match(langTool.getAnalyzedSentence("To jest test.")).length);
    assertEquals(1, rule.match(langTool.getAnalyzedSentence("To jest   test.")).length);
  }

}

Examples of org.languagetool.rules.Rule.match()

      for (Rule rule : rules) {
        final List<String> tokens = getSuggestionTokens(rule, lang);
        tokenCount += tokens.size();
        for (String token : tokens) {
          final AnalyzedSentence sentence = languageTool.getAnalyzedSentence(token);
          final RuleMatch[] matches = spellcheckRule.match(sentence);
          if (matches.length > 0) {
            suggestionTokens.add(token);
          } else {
            //System.out.println("No error matches for " + lang + ": " + token);
            noErrorCount++;

Examples of org.languagetool.rules.UppercaseSentenceStartRule.match()

  public void testUkrainian() throws IOException {
    final Ukrainian ukrainian = new Ukrainian();
    final UppercaseSentenceStartRule rule = new UppercaseSentenceStartRule(TestTools.getEnglishMessages(), ukrainian);
    final JLanguageTool lt = new JLanguageTool(ukrainian);

    assertEquals(0, rule.match(lt.getAnalyzedSentence("Автор написав це речення з великої літери.")).length);

    final RuleMatch[] matches = rule.match(lt.getAnalyzedSentence("автор написав це речення з маленької літери."));
    assertEquals(1, matches.length);
    assertEquals(1, matches[0].getSuggestedReplacements().size());
    assertEquals("Автор", matches[0].getSuggestedReplacements().get(0));

Examples of org.languagetool.rules.WhitespaceRule.match()

public class WhitespaceRuleTest extends TestCase {

    public void testRule() throws IOException {
      final WhitespaceRule rule = new WhitespaceRule(TestTools.getEnglishMessages(), new Polish());
      final JLanguageTool langTool = new JLanguageTool(new Polish());
      assertEquals(0, rule.match(langTool.getAnalyzedSentence("To jest test.")).length);
      assertEquals(1, rule.match(langTool.getAnalyzedSentence("To jest   test.")).length);
    }

}

Examples of org.languagetool.rules.WordRepeatRule.match()

    final German german = new German();
    final WordRepeatRule rule = new GermanWordRepeatRule(TestTools.getEnglishMessages(), german);
    RuleMatch[] matches;
    final JLanguageTool langTool = new JLanguageTool(german);
    // correct sentences:
    matches = rule.match(langTool.getAnalyzedSentence("Das sind die Sätze, die die testen sollen."));
    assertEquals(0, matches.length);
    matches = rule.match(langTool.getAnalyzedSentence("Sätze, die die testen."));
    assertEquals(0, matches.length);
    matches = rule.match(langTool.getAnalyzedSentence("Das Haus, auf das das Mädchen zeigt."));
    assertEquals(0, matches.length);

Examples of org.languagetool.rules.km.KhmerSpaceBeforeRule.match()

    public void testSpaceBeforeRule() throws IOException {
        final Khmer language = new Khmer();
        KhmerSpaceBeforeRule rule = new KhmerSpaceBeforeRule(TestTools.getEnglishMessages(), language);
        JLanguageTool langTool = new JLanguageTool(language);
        // correct sentences:
        assertEquals(0, rule.match(langTool.getAnalyzedSentence("គាត់​បាន​ទៅ ដើម្បី​ទិញ​ម្ហូប។")).length);
        assertEquals(0, rule.match(langTool.getAnalyzedSentence("ខ្ញុំ និង​គាត់។")).length);
        assertEquals(0, rule.match(langTool.getAnalyzedSentence("គាត់​ចង់​បាន ពីព្រោះ​គាត់​អត់​មាន។")).length);

        // incorrect sentences:
        assertEquals(1, rule.match(langTool.getAnalyzedSentence("គាត់​បាន​ទៅ​ដើម្បី​ទិញ​ម្ហូប។")).length);

Examples of org.languagetool.rules.spelling.hunspell.HunspellRule.match()

  public void testRuleWithGerman() throws Exception {
    final GermanyGerman language = new GermanyGerman();
    final HunspellRule rule = new GermanSpellerRule(TestTools.getMessages("German"), language);
    final JLanguageTool langTool = new JLanguageTool(language);
    commonGermanAsserts(rule, langTool);
    assertEquals(0, rule.match(langTool.getAnalyzedSentence("Der äußere Übeltäter.")).length)// umlauts
    assertEquals(1, rule.match(langTool.getAnalyzedSentence("Der äussere Übeltäter.")).length);
  }

  // note: copied from HunspellRuleTest
  @Test
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.