summaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/main/java
diff options
context:
space:
mode:
authorrama-huawei <rama.subba.reddy.s@huawei.com>2017-09-20 18:33:38 +0530
committerRama SubbaReddy <rama.subba.reddy.s@huawei.com>2017-09-21 12:37:11 +0000
commitc85be0b2c683678dbc94637c93be506216f915e1 (patch)
tree8cafacbdc8695b5ef20e119fd339860fe64f49d3 /POLICY-SDK-APP/src/main/java
parentd87fa780642ccad71006af55e21c7dcaee5c8385 (diff)
Used isEmpty to check collection is empty or not
Issue-ID: POLICY-239 Change-Id: I5c6a43ac0f66e02b4f2f6644f0936a846708e2a5 Signed-off-by: rama-huawei <rama.subba.reddy.s@huawei.com>
Diffstat (limited to 'POLICY-SDK-APP/src/main/java')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java27
1 files changed, 14 insertions, 13 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java
index a0f1ba86d..7c60ecfdf 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java
@@ -202,7 +202,7 @@ class HtmlProcessor extends SimpleCallback {
combiningAlgo2human.put("only-one-applicable", "to honour the result of the first successfully evaluated $placeholder$ in order");
}
- private Map<String, AttributeIdentifiers> attributeIdentifiersMap = new HashMap<String, AttributeIdentifiers>();
+ private Map<String, AttributeIdentifiers> attributeIdentifiersMap = new HashMap<>();
private final StringWriter stringWriter = new StringWriter();
private final PrintWriter htmlOut = new PrintWriter(stringWriter);
@@ -357,7 +357,7 @@ class HtmlProcessor extends SimpleCallback {
else
policySet(policySet, "li");
- if (policySet.getPolicySetOrPolicyOrPolicySetIdReference().size() > 0)
+ if (!policySet.getPolicySetOrPolicyOrPolicySetIdReference().isEmpty())
htmlOut.println("<ol>");
return super.onPreVisitPolicySet(parent, policySet);
@@ -377,7 +377,7 @@ class HtmlProcessor extends SimpleCallback {
LOGGER.trace("PolicySet: " + policySet.getPolicySetId() +
" Description: " + policySet.getDescription());
- if (policySet.getPolicySetOrPolicyOrPolicySetIdReference().size() > 0)
+ if (!policySet.getPolicySetOrPolicyOrPolicySetIdReference().isEmpty())
htmlOut.println("</ol>");
htmlOut.println("<p></p>");
@@ -421,7 +421,7 @@ class HtmlProcessor extends SimpleCallback {
}
if (policySet.getPolicySetOrPolicyOrPolicySetIdReference() != null &&
- policySet.getPolicySetOrPolicyOrPolicySetIdReference().size() > 0) {
+ !policySet.getPolicySetOrPolicyOrPolicySetIdReference().isEmpty()) {
String algoDesc = combiningAlgo2human.get(combiningAlgorithm);
if (algoDesc != null) {
algoDesc = algoDesc.replace("$placeholder$", "policy") + " (" + "<i>" + combiningAlgorithm + "</i>)";
@@ -449,7 +449,7 @@ class HtmlProcessor extends SimpleCallback {
policy(policy);
- if (policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().size() > 0)
+ if (!policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().isEmpty())
htmlOut.println("<ol type=\"i\">");
return super.onPreVisitPolicy(parent, policy);
@@ -464,7 +464,7 @@ class HtmlProcessor extends SimpleCallback {
LOGGER.trace("PolicySet: " + policy.getPolicyId() +
"Parent PolicySet: " + parent.getPolicySetId() + " Version: " + parent.getVersion());
- if (policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().size() > 0)
+ if (!policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().isEmpty())
htmlOut.println("</ol>");
htmlOut.println("<p></p>");
@@ -506,7 +506,7 @@ class HtmlProcessor extends SimpleCallback {
}
if (policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition() != null &&
- policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().size() > 0) {
+ !policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().isEmpty()) {
String algoDesc = combiningAlgo2human.get(combiningAlgorithm);
if (algoDesc != null) {
algoDesc = algoDesc.replace("$placeholder$", "rule") + " (<i>" + combiningAlgorithm + "</i>)";
@@ -710,7 +710,7 @@ class HtmlProcessor extends SimpleCallback {
//
StdAttribute attribute = null;
AttributeValueType value = match.getAttributeValue();
- String attributeDataType = null;
+ String attributeDataType;
if (match.getAttributeDesignator() != null && value != null) {
AttributeDesignatorType designator = match.getAttributeDesignator();
attribute = new StdAttribute(new IdentifierImpl(designator.getCategory()),
@@ -822,11 +822,12 @@ class HtmlProcessor extends SimpleCallback {
}
private String removePrimitives(String in) {
- in = in.replace("string-", "");
- in = in.replace("integer-", "");
- in = in.replace("double-", "");
- in = in.replace("boolean-", "");
- return in;
+ String newIn = in;
+ newIn = newIn.replace("string-", "");
+ newIn = newIn.replace("integer-", "");
+ newIn = newIn.replace("double-", "");
+ newIn = newIn.replace("boolean-", "");
+ return newIn;
}
private String stringifyCondition(ConditionType condition) {