Latest bnd code
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1355520 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/libg/glob/Glob.java b/bundleplugin/src/main/java/aQute/libg/glob/Glob.java
index b48c147..6202524 100644
--- a/bundleplugin/src/main/java/aQute/libg/glob/Glob.java
+++ b/bundleplugin/src/main/java/aQute/libg/glob/Glob.java
@@ -1,5 +1,6 @@
package aQute.libg.glob;
+import java.util.*;
import java.util.regex.*;
public class Glob {
@@ -25,15 +26,6 @@
line = line.trim();
int strLen = line.length();
StringBuilder sb = new StringBuilder(strLen);
- // Remove beginning and ending * globs because they're useless
- if (line.startsWith("*")) {
- line = line.substring(1);
- strLen--;
- }
- if (line.endsWith("*")) {
- line = line.substring(0, strLen - 1);
- strLen--;
- }
boolean escaping = false;
int inCurlies = 0;
for (char currentChar : line.toCharArray()) {
@@ -106,4 +98,21 @@
}
return sb.toString();
}
+
+ public void select(List<?> objects) {
+ for ( Iterator<?> i =objects.iterator(); i.hasNext(); ) {
+ String s = i.next().toString();
+ if ( !matcher(s).matches())
+ i.remove();
+ }
+ }
+
+ public static Pattern toPattern(String s) {
+ try {
+ return Pattern.compile( convertGlobToRegEx(s));
+ } catch( Exception e) {
+ // ignore
+ }
+ return null;
+ }
}