aQute.libg.glob.Glob类的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中aQute.libg.glob.Glob类的一些代码示例,展示了Glob类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Glob类的具体详情如下:
包路径:aQute.libg.glob.Glob
类名称:Glob

Glob介绍

暂无

代码示例

代码示例来源:origin: biz.aQute/bndlib

public static Pattern toPattern(String s) {
    try {
      return Pattern.compile( convertGlobToRegEx(s));
    } catch( Exception e) {
      // ignore
    }
    return null;
  }
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public void getFiles(File root, List<File> result, boolean recursive, boolean usePath) {
  if (root == null || !root.isDirectory())
    return;
  for (File sub : root.listFiles()) {
    if (sub.isFile()) {
      String s = usePath ? sub.getAbsolutePath() : sub.getName();
      if (matcher(s).matches())
        result.add(sub);
    } else if (recursive && sub.isDirectory())
      getFiles(sub, result, recursive, usePath);
  }
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public DefaultURLConnectionHandler addMatcher(String glob) {
    matchers.add(new Glob(glob));
    return this;
  }
}

代码示例来源:origin: biz.aQute/bndlib

String ls(String args[], boolean relative) {
  if (args.length < 2)
    throw new IllegalArgumentException("the ${ls} macro must at least have a directory as parameter");
  File dir = IO.getFile(base, args[1]);
  if (!dir.isAbsolute())
    throw new IllegalArgumentException("the ${ls} macro directory parameter is not absolute: " + dir);
  if (!dir.exists())
    throw new IllegalArgumentException("the ${ls} macro directory parameter does not exist: " + dir);
  if (!dir.isDirectory())
    throw new IllegalArgumentException(
        "the ${ls} macro directory parameter points to a file instead of a directory: " + dir);
  List<File> files = new ArrayList<File>(new SortedList<File>(dir.listFiles()));
  for (int i = 2; i < args.length; i++) {
    Glob filters = new Glob(args[i]);
    filters.select(files);
  }
  ExtList<String> result = new ExtList<String>();
  for (File file : files)
    result.add(relative ? file.getName() : file.getAbsolutePath());
  return result.join(",");
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public static boolean in(Glob[] globs, String key) {
  for (Glob g : globs) {
    if (g.matcher(key)
      .matches())
      return true;
  }
  return false;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public static Pattern toPattern(String s) {
  return toPattern(s, 0);
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

@Override
public List<String> list(String pattern) throws Exception {
  init();
  Glob glob = pattern != null ? new Glob(pattern) : null;
  List<String> result = new LinkedList<>();
  for (String bsn : identityMap.getIdentities()) {
    if (glob == null || glob.matcher(bsn)
      .matches())
      result.add(bsn);
  }
  return result;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

/**
 * Get a list of files that match the glob expression
 * 
 * @param root the directory to get the files from
 * @param recursive to traverse the dirs recursive
 * @return file list
 */
public List<File> getFiles(File root, boolean recursive, boolean usePath) {
  List<File> result = new ArrayList<>();
  getFiles(root, result, recursive, usePath);
  return result;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

switch (currentChar) {
  case '*' :
    if ((state == State.SIMPLE || state == State.CURLIES) && !isEnd(previousChar)) {
      sb.append('.');
    break;
  case '?' :
    if ((state == State.SIMPLE || state == State.CURLIES) && !isStart(previousChar)
      && !isEnd(previousChar)) {
      sb.append('.');
    } else {
    if ((state == State.SIMPLE || state == State.CURLIES) && !isEnd(previousChar)) {
      sb.append('\\');
    if ((state == State.SIMPLE || state == State.CURLIES) && !isEnd(previousChar)) {
      state = State.CURLIES;
      sb.append("(?:");

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public void select(List<?> objects) {
  this.select((Collection<?>) objects);
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public void select(Collection<?> objects) {
  for (Iterator<?> i = objects.iterator(); i.hasNext();) {
    String s = i.next()
      .toString();
    if (!matches(s))
      i.remove();
  }
}

代码示例来源:origin: org.osgi/osgi.enroute.web.simple.provider

String ls(String args[], boolean relative) {
  if (args.length < 2)
    throw new IllegalArgumentException("the ${ls} macro must at least have a directory as parameter");
  File dir = IO.getFile(base, args[1]);
  if (!dir.isAbsolute())
    throw new IllegalArgumentException("the ${ls} macro directory parameter is not absolute: " + dir);
  if (!dir.exists())
    throw new IllegalArgumentException("the ${ls} macro directory parameter does not exist: " + dir);
  if (!dir.isDirectory())
    throw new IllegalArgumentException(
        "the ${ls} macro directory parameter points to a file instead of a directory: " + dir);
  List<File> files = new ArrayList<File>(new SortedList<File>(dir.listFiles()));
  for (int i = 2; i < args.length; i++) {
    Glob filters = new Glob(args[i]);
    filters.select(files);
  }
  ExtList<String> result = new ExtList<String>();
  for (File file : files)
    result.add(relative ? file.getName() : file.getAbsolutePath().replace(File.separatorChar, '/'));
  return result.join(",");
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public static boolean in(Collection<? extends Glob> globs, String key) {
  for (Glob g : globs) {
    if (g.matcher(key)
      .matches())
      return true;
  }
  return false;
}

代码示例来源:origin: biz.aQute.bnd/bndlib

public static Pattern toPattern(String s) {
  return toPattern(s,0);
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.repository

@Override
public List<String> list(String pattern) throws Exception {
  init();
  Glob glob = pattern != null ? new Glob(pattern) : null;
  List<String> result = new LinkedList<>();
  for (String bsn : identityMap.getIdentities()) {
    if (glob == null || glob.matcher(bsn)
      .matches())
      result.add(bsn);
  }
  return result;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

/**
 * Get a list of files that match the glob expression
 * 
 * @param root the directory to get the files from
 * @param recursive to traverse the dirs recursive
 * @return file list
 */
public List<File> getFiles(File root, boolean recursive, boolean usePath) {
  List<File> result = new ArrayList<>();
  getFiles(root, result, recursive, usePath);
  return result;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.resolve

switch (currentChar) {
  case '*' :
    if ((state == State.SIMPLE || state == State.CURLIES) && !isEnd(previousChar)) {
      sb.append('.');
    break;
  case '?' :
    if ((state == State.SIMPLE || state == State.CURLIES) && !isStart(previousChar)
      && !isEnd(previousChar)) {
      sb.append('.');
    } else {
    if ((state == State.SIMPLE || state == State.CURLIES) && !isEnd(previousChar)) {
      sb.append('\\');
    if ((state == State.SIMPLE || state == State.CURLIES) && !isEnd(previousChar)) {
      state = State.CURLIES;
      sb.append("(?:");

代码示例来源:origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.framework.extension

public void select(List<?> objects) {
  this.select((Collection<?>) objects);
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.resolve

public void select(Collection<?> objects) {
  for (Iterator<?> i = objects.iterator(); i.hasNext();) {
    String s = i.next()
      .toString();
    if (!matches(s))
      i.remove();
  }
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.resolve

public void getFiles(File root, List<File> result, boolean recursive, boolean usePath) {
  if (root == null || !root.isDirectory())
    return;
  for (File sub : root.listFiles()) {
    if (sub.isFile()) {
      String s = usePath ? sub.getAbsolutePath() : sub.getName();
      if (matcher(s).matches())
        result.add(sub);
    } else if (recursive && sub.isDirectory())
      getFiles(sub, result, recursive, usePath);
  }
}

相关文章