Code Review
/
nonrtric.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Fix bug in A1 clients"
[nonrtric.git]
/
policy-agent
/
src
/
main
/
java
/
org
/
oransc
/
policyagent
/
repository
/
PolicyTypes.java
diff --git
a/policy-agent/src/main/java/org/oransc/policyagent/repository/PolicyTypes.java
b/policy-agent/src/main/java/org/oransc/policyagent/repository/PolicyTypes.java
index
f686ee4
..
2897a50
100644
(file)
--- a/
policy-agent/src/main/java/org/oransc/policyagent/repository/PolicyTypes.java
+++ b/
policy-agent/src/main/java/org/oransc/policyagent/repository/PolicyTypes.java
@@
-20,16
+20,15
@@
package org.oransc.policyagent.repository;
package org.oransc.policyagent.repository;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.HashMap;
import java.util.Map;
+import java.util.Vector;
import org.oransc.policyagent.exceptions.ServiceException;
public class PolicyTypes {
import org.oransc.policyagent.exceptions.ServiceException;
public class PolicyTypes {
- private Map<String, PolicyType> types = new HashMap<String, PolicyType>();
-
- public PolicyTypes() {
- }
+ private Map<String, PolicyType> types = new HashMap<>();
public synchronized PolicyType getType(String name) throws ServiceException {
PolicyType t = types.get(name);
public synchronized PolicyType getType(String name) throws ServiceException {
PolicyType t = types.get(name);
@@
-39,15
+38,27
@@
public class PolicyTypes {
return t;
}
return t;
}
+ public synchronized PolicyType get(String name) {
+ return types.get(name);
+ }
+
public synchronized void put(PolicyType type) {
types.put(type.name(), type);
}
public synchronized void put(PolicyType type) {
types.put(type.name(), type);
}
- public
boolean contains(PolicyType
policyType) {
- return types.containsKey(policyType
.name()
);
+ public
synchronized boolean contains(String
policyType) {
+ return types.containsKey(policyType);
}
}
- public int size() {
+ public synchronized Collection<PolicyType> getAll() {
+ return new Vector<>(types.values());
+ }
+
+ public synchronized int size() {
return types.size();
}
return types.size();
}
+
+ public synchronized void clear() {
+ this.types.clear();
+ }
}
}