Browse Source

1877: Fix style issues on jme3-core/com.jme3.app package (#2054)

* 1877: Fix style issues on jme3-core/com.jme3.app package

One remaining issue regarding local var distance from declaration to
use.

* Made changes as per PR comments
Andy Gibson 2 years ago
parent
commit
b1a0109a1d

+ 10 - 3
jme3-core/src/main/java/com/jme3/app/AppTask.java

@@ -31,7 +31,12 @@
  */
  */
 package com.jme3.app;
 package com.jme3.app;
 
 
-import java.util.concurrent.*;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.logging.Level;
 import java.util.logging.Level;
@@ -52,7 +57,8 @@ public class AppTask<V> implements Future<V> {
 
 
     private V result;
     private V result;
     private ExecutionException exception;
     private ExecutionException exception;
-    private boolean cancelled, finished;
+    private boolean cancelled;
+    private boolean finished;
     private final ReentrantLock stateLock = new ReentrantLock();
     private final ReentrantLock stateLock = new ReentrantLock();
     private final Condition finishedCondition = stateLock.newCondition();
     private final Condition finishedCondition = stateLock.newCondition();
 
 
@@ -100,7 +106,8 @@ public class AppTask<V> implements Future<V> {
     }
     }
 
 
     @Override
     @Override
-    public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
+    public V get(long timeout, TimeUnit unit)
+        throws InterruptedException, ExecutionException, TimeoutException {
         stateLock.lock();
         stateLock.lock();
         try {
         try {
             if (!isDone()) {
             if (!isDone()) {

+ 3 - 1
jme3-core/src/main/java/com/jme3/app/Application.java

@@ -41,7 +41,9 @@ import com.jme3.renderer.Camera;
 import com.jme3.renderer.RenderManager;
 import com.jme3.renderer.RenderManager;
 import com.jme3.renderer.Renderer;
 import com.jme3.renderer.Renderer;
 import com.jme3.renderer.ViewPort;
 import com.jme3.renderer.ViewPort;
-import com.jme3.system.*;
+import com.jme3.system.AppSettings;
+import com.jme3.system.JmeContext;
+import com.jme3.system.Timer;
 import java.util.concurrent.Callable;
 import java.util.concurrent.Callable;
 import java.util.concurrent.Future;
 import java.util.concurrent.Future;
 
 

+ 5 - 1
jme3-core/src/main/java/com/jme3/app/BasicProfiler.java

@@ -32,7 +32,11 @@
 
 
 package com.jme3.app;
 package com.jme3.app;
 
 
-import com.jme3.profile.*;
+
+import com.jme3.profile.AppProfiler;
+import com.jme3.profile.AppStep;
+import com.jme3.profile.SpStep;
+import com.jme3.profile.VpStep;
 import com.jme3.renderer.ViewPort;
 import com.jme3.renderer.ViewPort;
 import com.jme3.renderer.queue.RenderQueue.Bucket;
 import com.jme3.renderer.queue.RenderQueue.Bucket;
 import com.jme3.scene.Mesh;
 import com.jme3.scene.Mesh;

+ 41 - 42
jme3-core/src/main/java/com/jme3/app/BasicProfilerState.java

@@ -122,53 +122,52 @@ public class BasicProfilerState extends BaseAppState {
         float frameTime = 1000f / 60;
         float frameTime = 1000f / 60;
         mesh.setBuffer(Type.Position, 3, new float[] {
         mesh.setBuffer(Type.Position, 3, new float[] {
 
 
-                    // first quad
-                    0, 0, 0,
-                    size, 0, 0,
-                    size, frameTime, 0,
-                    0, frameTime, 0,
-
-                    // second quad
-                    0, frameTime, 0,
-                    size, frameTime, 0,
-                    size, frameTime * 2, 0,
-                    0, frameTime * 2, 0,
-
-                    // A lower dark border just to frame the
-                    // 'update' stats against bright backgrounds
-                    0, -2, 0,
-                    size, -2, 0,
-                    size, 0, 0,
-                    0, 0, 0
-                });
+                // first quad
+                0, 0, 0,
+                size, 0, 0,
+                size, frameTime, 0,
+                0, frameTime, 0,
+                // second quad
+                0, frameTime, 0,
+                size, frameTime, 0,
+                size, frameTime * 2, 0,
+                0, frameTime * 2, 0,
+
+                // A lower dark border just to frame the
+                // 'update' stats against bright backgrounds
+                0, -2, 0,
+                size, -2, 0,
+                size, 0, 0,
+                0, 0, 0
+        });
 
 
         mesh.setBuffer(Type.Color, 4, new float[] {
         mesh.setBuffer(Type.Color, 4, new float[] {
                     // first quad, within normal frame limits
                     // first quad, within normal frame limits
-                    0, 1, 0, 0.25f,
-                    0, 1, 0, 0.25f,
-                    0, 0.25f, 0, 0.25f,
-                    0, 0.25f, 0, 0.25f,
-
-                    // Second quad, dropped frames
-                    0.25f, 0, 0, 0.25f,
-                    0.25f, 0, 0, 0.25f,
-                    1, 0, 0, 0.25f,
-                    1, 0, 0, 0.25f,
-
-                    0, 0, 0, 0.5f,
-                    0, 0, 0, 0.5f,
-                    0, 0, 0, 0.5f,
-                    0, 0, 0, 0.5f
-                });
+                0, 1, 0, 0.25f,
+                0, 1, 0, 0.25f,
+                0, 0.25f, 0, 0.25f,
+                0, 0.25f, 0, 0.25f,
+
+                // Second quad, dropped frames
+                0.25f, 0, 0, 0.25f,
+                0.25f, 0, 0, 0.25f,
+                1, 0, 0, 0.25f,
+                1, 0, 0, 0.25f,
+
+                0, 0, 0, 0.5f,
+                0, 0, 0, 0.5f,
+                0, 0, 0, 0.5f,
+                0, 0, 0, 0.5f
+        });
 
 
         mesh.setBuffer(Type.Index, 3, new short[] {
         mesh.setBuffer(Type.Index, 3, new short[] {
-                    0, 1, 2,
-                    0, 2, 3,
-                    4, 5, 6,
-                    4, 6, 7,
-                    8, 9, 10,
-                    8, 10, 11
-                });
+                0, 1, 2,
+                0, 2, 3,
+                4, 5, 6,
+                4, 6, 7,
+                8, 9, 10,
+                8, 10, 11
+        });
     }
     }
 
 
     @Override
     @Override

+ 4 - 2
jme3-core/src/main/java/com/jme3/app/ChaseCameraAppState.java

@@ -82,7 +82,8 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
     protected Vector3f leftVector = new Vector3f();
     protected Vector3f leftVector = new Vector3f();
     protected Trigger[] zoomOutTrigger = {new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true)};
     protected Trigger[] zoomOutTrigger = {new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true)};
     protected Trigger[] zoomInTrigger = {new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false)};
     protected Trigger[] zoomInTrigger = {new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false)};
-    protected Trigger[] toggleRotateTrigger = {new MouseButtonTrigger(MouseInput.BUTTON_LEFT), new MouseButtonTrigger(MouseInput.BUTTON_RIGHT)};
+    protected Trigger[] toggleRotateTrigger = {new MouseButtonTrigger(MouseInput.BUTTON_LEFT),
+            new MouseButtonTrigger(MouseInput.BUTTON_RIGHT)};
 
 
 //
 //
 //    protected boolean rotating = false;
 //    protected boolean rotating = false;
@@ -209,7 +210,8 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
     @Override
     @Override
     public void update(float tpf) {
     public void update(float tpf) {
         if (spatial == null) {
         if (spatial == null) {
-            throw new IllegalArgumentException("The spatial to follow is null, please use the setTarget method");
+            throw new IllegalArgumentException(
+                    "The spatial to follow is null, please use the setTarget method");
         }
         }
         target.setLocalTranslation(spatial.getWorldTranslation());
         target.setLocalTranslation(spatial.getWorldTranslation());
         camNode.lookAt(target.getWorldTranslation(), upVector);
         camNode.lookAt(target.getWorldTranslation(), upVector);

+ 7 - 4
jme3-core/src/main/java/com/jme3/app/DebugKeysAppState.java

@@ -55,7 +55,7 @@ public class DebugKeysAppState extends AbstractAppState {
     public static final String INPUT_MAPPING_MEMORY = "SIMPLEAPP_Memory";
     public static final String INPUT_MAPPING_MEMORY = "SIMPLEAPP_Memory";
     
     
     private Application app;
     private Application app;
-    final private DebugKeyListener keyListener = new DebugKeyListener();
+    private final DebugKeyListener keyListener = new DebugKeyListener();
     private InputManager inputManager;
     private InputManager inputManager;
 
 
     public DebugKeysAppState() {
     public DebugKeysAppState() {
@@ -83,10 +83,12 @@ public class DebugKeysAppState extends AbstractAppState {
     public void cleanup() {
     public void cleanup() {
         super.cleanup();
         super.cleanup();
 
 
-        if (inputManager.hasMapping(INPUT_MAPPING_CAMERA_POS))
+        if (inputManager.hasMapping(INPUT_MAPPING_CAMERA_POS)) {
             inputManager.deleteMapping(INPUT_MAPPING_CAMERA_POS);
             inputManager.deleteMapping(INPUT_MAPPING_CAMERA_POS);
-        if (inputManager.hasMapping(INPUT_MAPPING_MEMORY))
+        }
+        if (inputManager.hasMapping(INPUT_MAPPING_MEMORY)) {
             inputManager.deleteMapping(INPUT_MAPPING_MEMORY);
             inputManager.deleteMapping(INPUT_MAPPING_MEMORY);
+        }
         
         
         inputManager.removeListener(keyListener);
         inputManager.removeListener(keyListener);
     }
     }
@@ -111,7 +113,8 @@ public class DebugKeysAppState extends AbstractAppState {
                     System.out.println("Camera Direction: " + cam.getDirection());
                     System.out.println("Camera Direction: " + cam.getDirection());
                     System.out.println("cam.setLocation(new Vector3f("
                     System.out.println("cam.setLocation(new Vector3f("
                             + loc.x + "f, " + loc.y + "f, " + loc.z + "f));");
                             + loc.x + "f, " + loc.y + "f, " + loc.z + "f));");
-                    System.out.println("cam.setRotation(new Quaternion(" + rot.getX() + "f, " +rot.getY()+ "f, " + rot.getZ() + "f, " + rot.getW() + "f));");
+                    System.out.println("cam.setRotation(new Quaternion(" + rot.getX() + "f, " + rot.getY()
+                            + "f, " + rot.getZ() + "f, " + rot.getW() + "f));");
                   
                   
                 }
                 }
             } else if (name.equals(INPUT_MAPPING_MEMORY)) {
             } else if (name.equals(INPUT_MAPPING_MEMORY)) {

+ 13 - 10
jme3-core/src/main/java/com/jme3/app/DetailedProfiler.java

@@ -43,7 +43,7 @@ import java.util.*;
  */
  */
 public class DetailedProfiler implements AppProfiler {
 public class DetailedProfiler implements AppProfiler {
 
 
-    private final static int MAX_FRAMES = 100;
+    private static final int MAX_FRAMES = 100;
     private Map<String, StatLine> data;
     private Map<String, StatLine> data;
     private Map<String, StatLine> pool;
     private Map<String, StatLine> pool;
     private long startFrame;
     private long startFrame;
@@ -59,10 +59,10 @@ public class DetailedProfiler implements AppProfiler {
     private String curSpPath = null;
     private String curSpPath = null;
     private VpStep lastVpStep = null;
     private VpStep lastVpStep = null;
 
 
-    final private StringBuilder path = new StringBuilder(256);
-    final private StringBuilder vpPath = new StringBuilder(256);
+    private final StringBuilder path = new StringBuilder(256);
+    private final StringBuilder vpPath = new StringBuilder(256);
 
 
-    final private Deque<Integer> idsPool = new ArrayDeque<>(100);
+    private final Deque<Integer> idsPool = new ArrayDeque<>(100);
 
 
     StatLine frameTime;
     StatLine frameTime;
 
 
@@ -152,14 +152,17 @@ public class DetailedProfiler implements AppProfiler {
 
 
         if (data != null) {
         if (data != null) {
             vpPath.setLength(0);
             vpPath.setLength(0);
-            vpPath.append(vp.getName()).append("/").append((bucket == null ? step.name() : bucket.name() + " Bucket"));
+            vpPath.append(vp.getName()).append("/")
+                    .append((bucket == null ? step.name() : bucket.name() + " Bucket"));
             path.setLength(0);
             path.setLength(0);
             if ((lastVpStep == VpStep.PostQueue || lastVpStep == VpStep.PostFrame) && bucket != null) {
             if ((lastVpStep == VpStep.PostQueue || lastVpStep == VpStep.PostFrame) && bucket != null) {
-                path.append(curAppPath).append("/").append(curVpPath).append(curSpPath).append("/").append(vpPath);
+                path.append(curAppPath).append("/").append(curVpPath).append(curSpPath).append("/")
+                    .append(vpPath);
                 curVpPath = vpPath.toString();
                 curVpPath = vpPath.toString();
             } else {
             } else {
                 if (bucket != null) {
                 if (bucket != null) {
-                    path.append(curAppPath).append("/").append(curVpPath).append("/").append(bucket.name() + " Bucket");
+                    path.append(curAppPath).append("/").append(curVpPath).append("/")
+                        .append(bucket.name() + " Bucket");
                 } else {
                 } else {
                     path.append(curAppPath).append("/").append(vpPath);
                     path.append(curAppPath).append("/").append(vpPath);
                     curVpPath = vpPath.toString();
                     curVpPath = vpPath.toString();
@@ -185,7 +188,7 @@ public class DetailedProfiler implements AppProfiler {
 
 
     public Map<String, StatLine> getStats() {
     public Map<String, StatLine> getStats() {
         if (data != null) {
         if (data != null) {
-            return data;//new LinkedHashMap<>(data);
+            return data; //new LinkedHashMap<>(data);
         }
         }
         return null;
         return null;
     }
     }
@@ -256,8 +259,8 @@ public class DetailedProfiler implements AppProfiler {
     }
     }
 
 
     public static class StatLine {
     public static class StatLine {
-        final private long[] cpuTimes = new long[MAX_FRAMES];
-        final private long[] gpuTimes = new long[MAX_FRAMES];
+        private final long[] cpuTimes = new long[MAX_FRAMES];
+        private final long[] gpuTimes = new long[MAX_FRAMES];
         private int startCursor = 0;
         private int startCursor = 0;
         private int cpuCursor = 0;
         private int cpuCursor = 0;
         private int gpuCursor = 0;
         private int gpuCursor = 0;

+ 33 - 20
jme3-core/src/main/java/com/jme3/app/DetailedProfilerState.java

@@ -60,13 +60,13 @@ public class DetailedProfilerState extends BaseAppState {
     private static final String TOGGLE_KEY = "Toggle_Detailed_Profiler";
     private static final String TOGGLE_KEY = "Toggle_Detailed_Profiler";
     private static final String CLICK_KEY = "Click_Detailed_Profiler";
     private static final String CLICK_KEY = "Click_Detailed_Profiler";
     private static final String INSIGNIFICANT = "Hide insignificant stat";
     private static final String INSIGNIFICANT = "Hide insignificant stat";
-    final private DetailedProfiler prof = new DetailedProfiler();
+    private final DetailedProfiler prof = new DetailedProfiler();
 
 
     private float time = 0;
     private float time = 0;
     private BitmapFont font;
     private BitmapFont font;
     private BitmapFont bigFont;
     private BitmapFont bigFont;
-    final private Node ui = new Node("Stats ui");
-    final private Map<String, StatLineView> lines = new HashMap<>();
+    private final Node ui = new Node("Stats ui");
+    private final Map<String, StatLineView> lines = new HashMap<>();
     private double totalTimeCpu;
     private double totalTimeCpu;
     private double totalTimeGpu;
     private double totalTimeGpu;
     private int maxLevel = 0;
     private int maxLevel = 0;
@@ -83,14 +83,14 @@ public class DetailedProfilerState extends BaseAppState {
 
 
     private StatLineView rootLine;
     private StatLineView rootLine;
     private int height = 0;
     private int height = 0;
-    final private DecimalFormat df = new DecimalFormat("##0.00", new DecimalFormatSymbols(Locale.US));
+    private final DecimalFormat df = new DecimalFormat("##0.00", new DecimalFormatSymbols(Locale.US));
 
 
-    final private ColorRGBA dimmedWhite = ColorRGBA.White.mult(0.7f);
-    final private ColorRGBA dimmedGreen = ColorRGBA.Green.mult(0.7f);
-    final private ColorRGBA dimmedOrange = ColorRGBA.Orange.mult(0.7f);
-    final private ColorRGBA dimmedRed = ColorRGBA.Red.mult(0.7f);
+    private final ColorRGBA dimmedWhite = ColorRGBA.White.mult(0.7f);
+    private final ColorRGBA dimmedGreen = ColorRGBA.Green.mult(0.7f);
+    private final ColorRGBA dimmedOrange = ColorRGBA.Orange.mult(0.7f);
+    private final ColorRGBA dimmedRed = ColorRGBA.Red.mult(0.7f);
 
 
-    final private ProfilerInputListener inputListener = new ProfilerInputListener();
+    private final ProfilerInputListener inputListener = new ProfilerInputListener();
 
 
     public DetailedProfilerState() {
     public DetailedProfilerState() {
 
 
@@ -101,7 +101,8 @@ public class DetailedProfilerState extends BaseAppState {
         Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
         Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
         mat.setColor("Color", new ColorRGBA(0, 0, 0, 0.5f));
         mat.setColor("Color", new ColorRGBA(0, 0, 0, 0.5f));
         mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
         mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
-        Geometry darkenStats = new Geometry("StatsDarken", new Quad(PANEL_WIDTH, app.getCamera().getHeight()));
+        Geometry darkenStats = new Geometry("StatsDarken", new Quad(PANEL_WIDTH,
+                app.getCamera().getHeight()));
         darkenStats.setMaterial(mat);
         darkenStats.setMaterial(mat);
         darkenStats.setLocalTranslation(0, -app.getCamera().getHeight(), -1);
         darkenStats.setLocalTranslation(0, -app.getCamera().getHeight(), -1);
 
 
@@ -116,17 +117,20 @@ public class DetailedProfilerState extends BaseAppState {
         BitmapText frameLabel = new BitmapText(bigFont);
         BitmapText frameLabel = new BitmapText(bigFont);
         frameLabel.setText("Total Frame Time: ");
         frameLabel.setText("Total Frame Time: ");
         ui.attachChild(frameLabel);
         ui.attachChild(frameLabel);
-        frameLabel.setLocalTranslation(new Vector3f(PANEL_WIDTH / 2 - bigFont.getLineWidth(frameLabel.getText()), -PADDING, 0));
+        frameLabel.setLocalTranslation(
+                new Vector3f(PANEL_WIDTH / 2 - bigFont.getLineWidth(frameLabel.getText()), -PADDING, 0));
 
 
         BitmapText cpuLabel = new BitmapText(bigFont);
         BitmapText cpuLabel = new BitmapText(bigFont);
         cpuLabel.setText("CPU");
         cpuLabel.setText("CPU");
         ui.attachChild(cpuLabel);
         ui.attachChild(cpuLabel);
-        cpuLabel.setLocalTranslation(PANEL_WIDTH / 4 - bigFont.getLineWidth(cpuLabel.getText()) / 2, -PADDING - 30, 0);
+        cpuLabel.setLocalTranslation(PANEL_WIDTH / 4 - bigFont.getLineWidth(cpuLabel.getText()) / 2,
+                -PADDING - 30, 0);
 
 
         BitmapText gpuLabel = new BitmapText(bigFont);
         BitmapText gpuLabel = new BitmapText(bigFont);
         gpuLabel.setText("GPU");
         gpuLabel.setText("GPU");
         ui.attachChild(gpuLabel);
         ui.attachChild(gpuLabel);
-        gpuLabel.setLocalTranslation(3 * PANEL_WIDTH / 4 - bigFont.getLineWidth(gpuLabel.getText()) / 2, -PADDING - 30, 0);
+        gpuLabel.setLocalTranslation(3 * PANEL_WIDTH / 4 - bigFont.getLineWidth(gpuLabel.getText()) / 2,
+                -PADDING - 30, 0);
 
 
         frameTimeValue = new BitmapText(bigFont);
         frameTimeValue = new BitmapText(bigFont);
         frameCpuTimeValue = new BitmapText(bigFont);
         frameCpuTimeValue = new BitmapText(bigFont);
@@ -221,16 +225,22 @@ public class DetailedProfilerState extends BaseAppState {
         setColor(frameTimeValue, prof.getAverageFrameTime(), totalTimeCpu, false, false);
         setColor(frameTimeValue, prof.getAverageFrameTime(), totalTimeCpu, false, false);
 
 
         frameCpuTimeValue.setText(df.format(getMsFromNs(totalTimeCpu)) + "ms");
         frameCpuTimeValue.setText(df.format(getMsFromNs(totalTimeCpu)) + "ms");
-        frameCpuTimeValue.setLocalTranslation(new Vector3f(PANEL_WIDTH / 4 - bigFont.getLineWidth(frameCpuTimeValue.getText()) / 2, -PADDING - 50, 0));
+        frameCpuTimeValue.setLocalTranslation(
+                new Vector3f(PANEL_WIDTH / 4 - bigFont.getLineWidth(frameCpuTimeValue.getText()) / 2,
+                -PADDING - 50, 0));
         setColor(frameCpuTimeValue, totalTimeCpu, totalTimeCpu, false, false);
         setColor(frameCpuTimeValue, totalTimeCpu, totalTimeCpu, false, false);
 
 
         frameGpuTimeValue.setText(df.format(getMsFromNs(totalTimeGpu)) + "ms");
         frameGpuTimeValue.setText(df.format(getMsFromNs(totalTimeGpu)) + "ms");
-        frameGpuTimeValue.setLocalTranslation(new Vector3f(3 * PANEL_WIDTH / 4 - bigFont.getLineWidth(frameGpuTimeValue.getText()) / 2, -PADDING - 50, 0));
+        frameGpuTimeValue.setLocalTranslation(
+                new Vector3f(3 * PANEL_WIDTH / 4 - bigFont.getLineWidth(frameGpuTimeValue.getText()) / 2,
+                -PADDING - 50, 0));
         setColor(frameGpuTimeValue, totalTimeGpu, totalTimeGpu, false, false);
         setColor(frameGpuTimeValue, totalTimeGpu, totalTimeGpu, false, false);
 
 
-        selectedField.setText("Selected: " + df.format(getMsFromNs(selectedValueCpu)) + "ms / " + df.format(getMsFromNs(selectedValueGpu)) + "ms");
+        selectedField.setText("Selected: " + df.format(getMsFromNs(selectedValueCpu)) + "ms / "
+                + df.format(getMsFromNs(selectedValueGpu)) + "ms");
 
 
-        selectedField.setLocalTranslation(3 * PANEL_WIDTH / 4 - font.getLineWidth(selectedField.getText()) / 2, -PADDING - 75, 0);
+        selectedField.setLocalTranslation(
+                3 * PANEL_WIDTH / 4 - font.getLineWidth(selectedField.getText()) / 2, -PADDING - 75, 0);
     }
     }
 
 
     private StatLineView getStatLineView(String path) {
     private StatLineView getStatLineView(String path) {
@@ -285,7 +295,8 @@ public class DetailedProfilerState extends BaseAppState {
         ui.removeFromParent();
         ui.removeFromParent();
     }
     }
 
 
-    public boolean setColor(BitmapText t, double value, double totalTime, boolean isParent, boolean expended) {
+    public boolean setColor(BitmapText t, double value, double totalTime, boolean isParent,
+            boolean expended) {
 
 
         boolean dimmed = isParent && expended;
         boolean dimmed = isParent && expended;
         boolean insignificant = false;
         boolean insignificant = false;
@@ -413,7 +424,8 @@ public class DetailedProfilerState extends BaseAppState {
             int y = -(height * LINE_HEIGHT + HEADER_HEIGHT);
             int y = -(height * LINE_HEIGHT + HEADER_HEIGHT);
 
 
             label.setLocalTranslation(PADDING + indent * PADDING, y, 0);
             label.setLocalTranslation(PADDING + indent * PADDING, y, 0);
-            float gpuPos = PANEL_WIDTH - font.getLineWidth(gpuText.getText()) - PADDING * (maxLevel - indent + 1);
+            float gpuPos = PANEL_WIDTH - font.getLineWidth(gpuText.getText())
+                    - PADDING * (maxLevel - indent + 1);
             cpuText.setLocalTranslation(gpuPos - font.getLineWidth(cpuText.getText()), y, 0);
             cpuText.setLocalTranslation(gpuPos - font.getLineWidth(cpuText.getText()), y, 0);
             gpuText.setLocalTranslation(gpuPos, y, 0);
             gpuText.setLocalTranslation(gpuPos, y, 0);
 
 
@@ -466,7 +478,8 @@ public class DetailedProfilerState extends BaseAppState {
 
 
         @Override
         @Override
         public String toString() {
         public String toString() {
-            return label.getText() + " - " + df.format(getMsFromNs(cpuValue)) + "ms / " + df.format(getMsFromNs(gpuValue)) + "ms";
+            return label.getText() + " - " + df.format(getMsFromNs(cpuValue)) + "ms / "
+                    + df.format(getMsFromNs(gpuValue)) + "ms";
         }
         }
     }
     }
 
 

+ 43 - 18
jme3-core/src/main/java/com/jme3/app/LegacyApplication.java

@@ -37,7 +37,11 @@ import com.jme3.asset.AssetManager;
 import com.jme3.audio.AudioContext;
 import com.jme3.audio.AudioContext;
 import com.jme3.audio.AudioRenderer;
 import com.jme3.audio.AudioRenderer;
 import com.jme3.audio.Listener;
 import com.jme3.audio.Listener;
-import com.jme3.input.*;
+import com.jme3.input.InputManager;
+import com.jme3.input.JoyInput;
+import com.jme3.input.KeyInput;
+import com.jme3.input.MouseInput;
+import com.jme3.input.TouchInput;
 import com.jme3.math.Vector3f;
 import com.jme3.math.Vector3f;
 import com.jme3.profile.AppProfiler;
 import com.jme3.profile.AppProfiler;
 import com.jme3.profile.AppStep;
 import com.jme3.profile.AppStep;
@@ -45,8 +49,13 @@ import com.jme3.renderer.Camera;
 import com.jme3.renderer.RenderManager;
 import com.jme3.renderer.RenderManager;
 import com.jme3.renderer.Renderer;
 import com.jme3.renderer.Renderer;
 import com.jme3.renderer.ViewPort;
 import com.jme3.renderer.ViewPort;
-import com.jme3.system.*;
+import com.jme3.system.AppSettings;
+import com.jme3.system.JmeContext;
 import com.jme3.system.JmeContext.Type;
 import com.jme3.system.JmeContext.Type;
+import com.jme3.system.JmeSystem;
+import com.jme3.system.NanoTimer;
+import com.jme3.system.SystemListener;
+import com.jme3.system.Timer;
 import java.net.MalformedURLException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URL;
 import java.util.concurrent.Callable;
 import java.util.concurrent.Callable;
@@ -188,9 +197,10 @@ public class LegacyApplication implements Application, SystemListener {
 
 
     @Deprecated
     @Deprecated
     public void setAssetManager(AssetManager assetManager) {
     public void setAssetManager(AssetManager assetManager) {
-        if (this.assetManager != null)
+        if (this.assetManager != null) {
             throw new IllegalStateException("Can only set asset manager"
             throw new IllegalStateException("Can only set asset manager"
                     + " before initialization.");
                     + " before initialization.");
+        }
 
 
         this.assetManager = assetManager;
         this.assetManager = assetManager;
     }
     }
@@ -204,11 +214,13 @@ public class LegacyApplication implements Application, SystemListener {
                 try {
                 try {
                     assetCfgUrl = new URL(assetCfg);
                     assetCfgUrl = new URL(assetCfg);
                 } catch (MalformedURLException ex) {
                 } catch (MalformedURLException ex) {
+                    //do nothing, we check assetCfgUrl
                 }
                 }
                 if (assetCfgUrl == null) {
                 if (assetCfgUrl == null) {
                     assetCfgUrl = LegacyApplication.class.getClassLoader().getResource(assetCfg);
                     assetCfgUrl = LegacyApplication.class.getClassLoader().getResource(assetCfg);
                     if (assetCfgUrl == null) {
                     if (assetCfgUrl == null) {
-                        logger.log(Level.SEVERE, "Unable to access AssetConfigURL in asset config:{0}", assetCfg);
+                        logger.log(Level.SEVERE, "Unable to access AssetConfigURL in asset config:{0}", 
+                                assetCfg);
                         return;
                         return;
                     }
                     }
                 }
                 }
@@ -332,21 +344,25 @@ public class LegacyApplication implements Application, SystemListener {
      */
      */
     private void initInput() {
     private void initInput() {
         mouseInput = context.getMouseInput();
         mouseInput = context.getMouseInput();
-        if (mouseInput != null)
+        if (mouseInput != null) {
             mouseInput.initialize();
             mouseInput.initialize();
+        }
 
 
         keyInput = context.getKeyInput();
         keyInput = context.getKeyInput();
-        if (keyInput != null)
+        if (keyInput != null) {
             keyInput.initialize();
             keyInput.initialize();
+        }
 
 
         touchInput = context.getTouchInput();
         touchInput = context.getTouchInput();
-        if (touchInput != null)
+        if (touchInput != null) {
             touchInput.initialize();
             touchInput.initialize();
+        }
 
 
         if (settings.useJoysticks()) {
         if (settings.useJoysticks()) {
             joyInput = context.getJoyInput();
             joyInput = context.getJoyInput();
-            if (joyInput != null)
+            if (joyInput != null) {
                 joyInput.initialize();
                 joyInput.initialize();
+            }
         }
         }
 
 
         inputManager = new InputManager(mouseInput, keyInput, joyInput, touchInput);
         inputManager = new InputManager(mouseInput, keyInput, joyInput, touchInput);
@@ -580,7 +596,7 @@ public class LegacyApplication implements Application, SystemListener {
 
 
 
 
     @Override
     @Override
-    public void rescale(float x, float y){
+    public void rescale(float x, float y) {
         if (renderManager != null) {
         if (renderManager != null) {
             renderManager.notifyRescale(x, y);
             renderManager.notifyRescale(x, y);
         }
         }
@@ -770,24 +786,28 @@ public class LegacyApplication implements Application, SystemListener {
         // Make sure the audio renderer is available to callables
         // Make sure the audio renderer is available to callables
         AudioContext.setAudioRenderer(audioRenderer);
         AudioContext.setAudioRenderer(audioRenderer);
 
 
-        if (prof != null)
+        if (prof != null) {
             prof.appStep(AppStep.QueuedTasks);
             prof.appStep(AppStep.QueuedTasks);
+        }
         runQueuedTasks();
         runQueuedTasks();
 
 
-        if (speed == 0 || paused)
+        if (speed == 0 || paused) {
             return;
             return;
+        }
 
 
         timer.update();
         timer.update();
 
 
         if (inputEnabled) {
         if (inputEnabled) {
-            if (prof != null)
+            if (prof != null) {
                 prof.appStep(AppStep.ProcessInput);
                 prof.appStep(AppStep.ProcessInput);
+            }
             inputManager.update(timer.getTimePerFrame());
             inputManager.update(timer.getTimePerFrame());
         }
         }
 
 
         if (audioRenderer != null) {
         if (audioRenderer != null) {
-            if (prof != null)
+            if (prof != null) {
                 prof.appStep(AppStep.ProcessAudio);
                 prof.appStep(AppStep.ProcessAudio);
+            }
             audioRenderer.update(timer.getTimePerFrame());
             audioRenderer.update(timer.getTimePerFrame());
         }
         }
 
 
@@ -795,17 +815,21 @@ public class LegacyApplication implements Application, SystemListener {
     }
     }
 
 
     protected void destroyInput() {
     protected void destroyInput() {
-        if (mouseInput != null)
+        if (mouseInput != null) {
             mouseInput.destroy();
             mouseInput.destroy();
+        }
 
 
-        if (keyInput != null)
+        if (keyInput != null) {
             keyInput.destroy();
             keyInput.destroy();
+        }
 
 
-        if (joyInput != null)
+        if (joyInput != null) {
             joyInput.destroy();
             joyInput.destroy();
+        }
 
 
-        if (touchInput != null)
+        if (touchInput != null) {
             touchInput.destroy();
             touchInput.destroy();
+        }
 
 
         inputManager = null;
         inputManager = null;
     }
     }
@@ -819,8 +843,9 @@ public class LegacyApplication implements Application, SystemListener {
         stateManager.cleanup();
         stateManager.cleanup();
 
 
         destroyInput();
         destroyInput();
-        if (audioRenderer != null)
+        if (audioRenderer != null) {
             audioRenderer.cleanup();
             audioRenderer.cleanup();
+        }
 
 
         timer.reset();
         timer.reset();
     }
     }

+ 13 - 7
jme3-core/src/main/java/com/jme3/app/SimpleApplication.java

@@ -76,7 +76,7 @@ public abstract class SimpleApplication extends LegacyApplication {
     protected BitmapFont guiFont;
     protected BitmapFont guiFont;
     protected FlyByCamera flyCam;
     protected FlyByCamera flyCam;
     protected boolean showSettings = true;
     protected boolean showSettings = true;
-    final private AppActionListener actionListener = new AppActionListener();
+    private final AppActionListener actionListener = new AppActionListener();
 
 
     private class AppActionListener implements ActionListener {
     private class AppActionListener implements ActionListener {
 
 
@@ -242,8 +242,9 @@ public abstract class SimpleApplication extends LegacyApplication {
 
 
     @Override
     @Override
     public void update() {
     public void update() {
-        if (prof != null)
+        if (prof != null) {
             prof.appStep(AppStep.BeginFrame);
             prof.appStep(AppStep.BeginFrame);
+        }
 
 
         super.update(); // makes sure to execute AppTasks
         super.update(); // makes sure to execute AppTasks
         if (speed == 0 || paused) {
         if (speed == 0 || paused) {
@@ -253,15 +254,17 @@ public abstract class SimpleApplication extends LegacyApplication {
         float tpf = timer.getTimePerFrame() * speed;
         float tpf = timer.getTimePerFrame() * speed;
 
 
         // update states
         // update states
-        if (prof != null)
+        if (prof != null) {
             prof.appStep(AppStep.StateManagerUpdate);
             prof.appStep(AppStep.StateManagerUpdate);
+        }
         stateManager.update(tpf);
         stateManager.update(tpf);
 
 
         // simple update and root node
         // simple update and root node
         simpleUpdate(tpf);
         simpleUpdate(tpf);
 
 
-        if (prof != null)
+        if (prof != null) {
             prof.appStep(AppStep.SpatialUpdate);
             prof.appStep(AppStep.SpatialUpdate);
+        }
         rootNode.updateLogicalState(tpf);
         rootNode.updateLogicalState(tpf);
         guiNode.updateLogicalState(tpf);
         guiNode.updateLogicalState(tpf);
 
 
@@ -269,18 +272,21 @@ public abstract class SimpleApplication extends LegacyApplication {
         guiNode.updateGeometricState();
         guiNode.updateGeometricState();
 
 
         // render states
         // render states
-        if (prof != null)
+        if (prof != null) {
             prof.appStep(AppStep.StateManagerRender);
             prof.appStep(AppStep.StateManagerRender);
+        }
         stateManager.render(renderManager);
         stateManager.render(renderManager);
 
 
-        if (prof != null)
+        if (prof != null) {
             prof.appStep(AppStep.RenderFrame);
             prof.appStep(AppStep.RenderFrame);
+        }
         renderManager.render(tpf, context.isRenderable());
         renderManager.render(tpf, context.isRenderable());
         simpleRender(renderManager);
         simpleRender(renderManager);
         stateManager.postRender();
         stateManager.postRender();
 
 
-        if (prof != null)
+        if (prof != null) {
             prof.appStep(AppStep.EndFrame);
             prof.appStep(AppStep.EndFrame);
+        }
     }
     }
 
 
     public void setDisplayFps(boolean show) {
     public void setDisplayFps(boolean show) {

+ 6 - 5
jme3-core/src/main/java/com/jme3/app/StatsView.java

@@ -60,11 +60,11 @@ import com.jme3.util.clone.JmeCloneable;
  * </pre>
  * </pre>
  */
  */
 public class StatsView extends Node implements Control, JmeCloneable {
 public class StatsView extends Node implements Control, JmeCloneable {
-    final private BitmapText statText;
-    final private Statistics statistics;
+    private final BitmapText statText;
+    private final Statistics statistics;
 
 
-    final private String[] statLabels;
-    final private int[] statData;
+    private final String[] statLabels;
+    private final int[] statData;
 
 
     private boolean enabled = true;
     private boolean enabled = true;
 
 
@@ -96,8 +96,9 @@ public class StatsView extends Node implements Control, JmeCloneable {
 
 
     @Override
     @Override
     public void update(float tpf) {
     public void update(float tpf) {
-        if (!isEnabled())
+        if (!isEnabled()) {
             return;
             return;
+        }
 
 
         statistics.getData(statData);
         statistics.getData(statData);
         stringBuilder.setLength(0);
         stringBuilder.setLength(0);