Latest bnd code
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1350613 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Instructions.java b/bundleplugin/src/main/java/aQute/lib/osgi/Instructions.java
index e74150c..679c374 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Instructions.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Instructions.java
@@ -4,25 +4,24 @@
import aQute.libg.header.*;
-public class Instructions implements Map<Instruction, Attrs> {
- private LinkedHashMap<Instruction, Attrs> map;
- static Map<Instruction, Attrs> EMPTY = Collections.emptyMap();
+public class Instructions implements Map<Instruction,Attrs> {
+ private LinkedHashMap<Instruction,Attrs> map;
+ static Map<Instruction,Attrs> EMPTY = Collections.emptyMap();
public Instructions(Instructions other) {
if (other.map != null && !other.map.isEmpty()) {
- map = new LinkedHashMap<Instruction, Attrs>(other.map);
+ map = new LinkedHashMap<Instruction,Attrs>(other.map);
}
}
public Instructions(Collection<String> other) {
- if ( other != null)
- for ( String s : other ) {
- put( new Instruction(s), null);
+ if (other != null)
+ for (String s : other) {
+ put(new Instruction(s), null);
}
}
- public Instructions() {
- }
+ public Instructions() {}
public Instructions(Parameters contained) {
append(contained);
@@ -43,7 +42,8 @@
return map.containsKey(name);
}
- @Deprecated public boolean containsKey(Object name) {
+ @Deprecated
+ public boolean containsKey(Object name) {
assert name instanceof Instruction;
if (map == null)
return false;
@@ -58,7 +58,8 @@
return map.containsValue(value);
}
- @Deprecated public boolean containsValue(Object value) {
+ @Deprecated
+ public boolean containsValue(Object value) {
assert value instanceof Attrs;
if (map == null)
return false;
@@ -66,14 +67,15 @@
return map.containsValue((Attrs) value);
}
- public Set<java.util.Map.Entry<Instruction, Attrs>> entrySet() {
+ public Set<java.util.Map.Entry<Instruction,Attrs>> entrySet() {
if (map == null)
return EMPTY.entrySet();
return map.entrySet();
}
- @Deprecated public Attrs get(Object key) {
+ @Deprecated
+ public Attrs get(Object key) {
assert key instanceof Instruction;
if (map == null)
return null;
@@ -101,21 +103,22 @@
public Attrs put(Instruction key, Attrs value) {
if (map == null)
- map = new LinkedHashMap<Instruction, Attrs>();
+ map = new LinkedHashMap<Instruction,Attrs>();
return map.put(key, value);
}
- public void putAll(Map<? extends Instruction, ? extends Attrs> map) {
+ public void putAll(Map< ? extends Instruction, ? extends Attrs> map) {
if (this.map == null)
if (map.isEmpty())
return;
else
- this.map = new LinkedHashMap<Instruction, Attrs>();
+ this.map = new LinkedHashMap<Instruction,Attrs>();
this.map.putAll(map);
}
- @Deprecated public Attrs remove(Object var0) {
+ @Deprecated
+ public Attrs remove(Object var0) {
assert var0 instanceof Instruction;
if (map == null)
return null;
@@ -147,19 +150,20 @@
}
public void append(Parameters other) {
- for (Map.Entry<String, Attrs> e : other.entrySet()) {
- put( new Instruction(e.getKey()), e.getValue());
+ for (Map.Entry<String,Attrs> e : other.entrySet()) {
+ put(new Instruction(e.getKey()), e.getValue());
}
}
+
public <T> Collection<T> select(Collection<T> set, boolean emptyIsAll) {
- return select(set,null, emptyIsAll);
+ return select(set, null, emptyIsAll);
}
-
+
public <T> Collection<T> select(Collection<T> set, Set<Instruction> unused, boolean emptyIsAll) {
List<T> input = new ArrayList<T>(set);
- if ( emptyIsAll && isEmpty())
+ if (emptyIsAll && isEmpty())
return input;
-
+
List<T> result = new ArrayList<T>();
for (Instruction instruction : keySet()) {
@@ -174,13 +178,12 @@
used = true;
}
}
- if ( !used && unused != null)
+ if (!used && unused != null)
unused.add(instruction);
}
return result;
}
-
public <T> Collection<T> reject(Collection<T> set) {
List<T> input = new ArrayList<T>(set);
List<T> result = new ArrayList<T>();
@@ -195,22 +198,22 @@
o.remove();
} else
result.add(oo);
-
+
}
}
return result;
}
public boolean matches(String value) {
- if ( size() == 0)
+ if (size() == 0)
return true;
-
- for ( Instruction i : keySet()) {
- if ( i.matches(value)) {
- if ( i.isNegated())
- return false; // we deny this one explicitly
+
+ for (Instruction i : keySet()) {
+ if (i.matches(value)) {
+ if (i.isNegated())
+ return false; // we deny this one explicitly
else
- return true; // we allow it explicitly
+ return true; // we allow it explicitly
}
}
return false;