예제 #1
0
파일: Knowledge2.java 프로젝트: ps7z/tetrad
  private String checkSpec(String spec) {
    java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("[A-Za-z0-9:-_,\\-\\.*]+");
    Matcher matcher = pattern.matcher(spec);

    if (!matcher.matches()) {
      throw new IllegalArgumentException(
          spec
              + ": Pattern names can consist of alphabetic "
              + "characters plus :, _, -, and .. A wildcard '*' may be included to match a "
              + "string of such characters.");
    }

    spec = spec.replace(".", "\\.");

    return spec;
  }
예제 #2
0
파일: Knowledge2.java 프로젝트: ps7z/tetrad
  private Set<MyNode> getExtent(String spec) {
    Set<String> split = split(spec);
    Set<MyNode> matches = new HashSet<>();

    for (String _spec : split) {
      _spec = _spec.replace("*", ".*");

      java.util.regex.Pattern pattern = java.util.regex.Pattern.compile(_spec);

      for (MyNode var : myNodes) {
        Matcher matcher = pattern.matcher(var.getName());
        if (matcher.matches()) {
          matches.add(var);
        }
      }
    }

    return matches;
  }
예제 #3
0
파일: Knowledge2.java 프로젝트: ps7z/tetrad
 private boolean checkVarName(String name) {
   java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("[A-Za-z0-9:_\\-\\.]+");
   Matcher matcher = pattern.matcher(name);
   return matcher.matches();
 }