ss: replace a for loop with a foreach operation
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Thu, 1 Dec 2016 18:24:40 +0000 (13:24 -0500)
committerMarc-André Laperle <marc-andre.laperle@ericsson.com>
Thu, 15 Dec 2016 14:54:37 +0000 (09:54 -0500)
And extract a constant

Change-Id: If4e65223ed4e9ce617eb9da3023db0294ede151e
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/86172
Reviewed-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Reviewed-by: Hudson CI
Tested-by: Marc-André Laperle <marc-andre.laperle@ericsson.com>
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/StateSystem.java

index 81b7feada9a820309077da1f1226ec4dc8395a9a..8c8550eb6e8e932b6d194c6db56e4fa8e03bf78a 100644 (file)
@@ -57,6 +57,7 @@ import com.google.common.collect.ImmutableSet;
  */
 public class StateSystem implements ITmfStateSystemBuilder {
 
+    private static final int MAX_STACK_DEPTH = 100000;
     private static final String PARENT = ".."; //$NON-NLS-1$
     private static final String WILDCARD = "*"; //$NON-NLS-1$
 
@@ -340,9 +341,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
             }
         } else {
             if (element.equals(WILDCARD)) {
-                for (@NonNull Integer subquark : getSubAttributes(quark, false)) {
-                    getQuarks(builder, subquark, remainder);
-                }
+                getSubAttributes(quark, false).forEach(subquark -> getQuarks(builder, subquark, remainder));
             } else if (element.equals(PARENT)){
                 getQuarks(builder, getParentAttributeQuark(quark), remainder);
             } else {
@@ -399,7 +398,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
             throw new StateValueTypeException(getSSID() + " Quark:" + attributeQuark + ", Type:" + previousSV.getType() + ", Expected:" + Type.INTEGER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         }
 
-        if (stackDepth >= 100000) {
+        if (stackDepth >= MAX_STACK_DEPTH) {
             /*
              * Limit stackDepth to 100000, to avoid having Attribute Trees grow
              * out of control due to buggy insertions
This page took 0.027464 seconds and 5 git commands to generate.