Package java.util.regex

Examples of java.util.regex.Pattern$Category


        }
        String regexToCompareTo;
        if (right instanceof String) {
            regexToCompareTo = (String) right;
        } else if (right instanceof Pattern) {
            Pattern pattern = (Pattern) right;
            return pattern.matcher(stringToCompare);
        } else {
            regexToCompareTo = toString(right);
        }
        return Pattern.compile(regexToCompareTo).matcher(stringToCompare);
    }
View Full Code Here


     * @param left  string to compare
     * @param right regular expression to compare the string to
     */
    public static boolean matchRegex(Object left, Object right) {
        if (left == null || right == null) return false;
        Pattern pattern;
        if (right instanceof Pattern) {
            pattern = (Pattern) right;
        } else {
            pattern = Pattern.compile(toString(right));
        }
        String stringToCompare = toString(left);
        Matcher matcher = pattern.matcher(stringToCompare);
        RegexSupport.setLastMatcher(matcher);
        return matcher.matches();
    }
View Full Code Here

          throw new RuntimeException();
        } else {
          regex = patterns.get(patternName).getRegex();
        }
      }
      Pattern pattern = (regex == null) ? null : Pattern.compile(regex);

      EnumSet<AttributeValidator.Flag> flags =
          EnumSet.noneOf(AttributeValidator.Flag.class);
      if (flagNames != null) {
        for (String flagName : split(flagNames)) {
View Full Code Here

            ImageIcon statusIcon = null;

            // name based guess
            if (buddy.getUser().indexOf("@") == -1) {
                Pattern p = Pattern
                        .compile("^(aim|msn|yahoo|icq|gadu-gadu)[-_.].*");
                Matcher m = p.matcher(buddy.getUser());
                if (m.matches() && m.groupCount() >= 1) {
                    String type = m.group(1);
                    if (type != null) {
                        statusIcon = Standard
                                .getIcon("imagethemes/statusicons/"
View Full Code Here

      String name = getVariableName(attrMap, "name", false);
      List<JavaAnnotation> javaAnnotations
          = getJavaAnnotations(node, JavaAnnotation.Element.PARAM);
      Expression defaultValue = null;
      boolean hasDefaultFlag = false;
      Pattern regex = null;
      Expression constructor = null;
      boolean hasConstructorFlag = false;

      String content = attrMap.getOptional("content", null);
      Type defaultType = null;
View Full Code Here

  }
 
  public static class JavaSourceFileMethodParametersParser {

        public String[] parseJavaFileForParamNames(Method method,String content) {
            Pattern methodPattern = Pattern.compile("(?s)"+method.getName()+"\\s*\\("+getParamsPattern(method)+"\\)\\s*\\{");
          Matcher m = methodPattern.matcher(content);
          List paramNames = new ArrayList();
          while(m.find()) {
              for(int i = 1; i <= method.getParameterTypes().length; i++) {
                    paramNames.add(m.group(i));
                }
View Full Code Here

        }
       
        String javaSourceContent = removeSomeThings();
        String methodBody = getMethodBody(javaSourceContent);
       
        Pattern p = Pattern.compile(fieldMethodInvokeRegex);
        Matcher m = p.matcher(methodBody);
        while(m.find()) {
          String field = m.group(1);
          String methodName= m.group(2);
          addFieldMethodInvocation(field, methodName);
        }
View Full Code Here

  public void test_insertBefore() {
      assertEquals("1 2 3 \n 4 abc5 6",StringHelper.insertBefore("1 2 3 \n 4 5 6", "5", "abc"));
  }
 
  public void test_appendReplacement() {
    Pattern p = Pattern.compile("(\\d+)(\\w+)");
    Matcher m = p.matcher("jjj123www");
    m.find();
    StringBuffer sb = new StringBuffer();
    m.appendReplacement(sb, "|$2|");
    assertEquals("jjj|www|",sb.toString());
  }
View Full Code Here

            if (result == null)
                result = defaultCase(theEObject);
            return result;
        }
        case Bpmn2Package.CATEGORY: {
            Category category = (Category) theEObject;
            T result = caseCategory(category);
            if (result == null)
                result = caseRootElement(category);
            if (result == null)
                result = caseBaseElement(category);
View Full Code Here

            doc.appendChild(rootElement);
        }

      for (Object object : categories) {
      if (object instanceof Category){
        Category cat=(Category)object;
        Element categoryDef = doc.createElement("category-def");
        categoryDef.setAttribute("name", cat.getId());
        categoryDef.setAttribute("label", cat.getLabel());
        rootElement.appendChild(categoryDef);
        Element descriptionElement = doc.createElement("description");
        descriptionElement.setTextContent(cat.getDescription());
        categoryDef.appendChild(descriptionElement);
        ArrayList processedFeatures = cat.getProcessedFeatures(project, artifactFactory, remoteRepositories, localRepository, resolver);
        for (Object obj : processedFeatures) {
          FeatureArtifact feature=(FeatureArtifact)obj;
          if (!featureCategories.containsKey(feature.getArtifactId())){
            ArrayList list = new ArrayList();
            featureCategories.put(feature.getArtifactId(), list);
            list.add(feature);
          }
          ArrayList list = (ArrayList)featureCategories.get(feature.getArtifactId());
          list.add(cat.getId());
        }
      }
    }
     
      for (Object key : featureCategories.keySet()) {
View Full Code Here

TOP

Related Classes of java.util.regex.Pattern$Category

Copyright © 2018 www.massapicom. 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.