Skip to content

Commit

Permalink
Cleaning at the code level (format) (#2299)
Browse files Browse the repository at this point in the history
Co-authored-by: wil <wil@debian>
  • Loading branch information
JNightRider and wil authored Jul 28, 2024
1 parent 3ab3647 commit cb20019
Show file tree
Hide file tree
Showing 75 changed files with 510 additions and 238 deletions.
35 changes: 33 additions & 2 deletions jme3-core/src/main/java/com/jme3/anim/util/AnimMigrationUtils.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
/*
* Copyright (c) 2009-2024 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jme3.anim.util;

import com.jme3.anim.*;
Expand All @@ -10,8 +41,8 @@

public class AnimMigrationUtils {

final private static AnimControlVisitor animControlVisitor = new AnimControlVisitor();
final private static SkeletonControlVisitor skeletonControlVisitor = new SkeletonControlVisitor();
private static final AnimControlVisitor animControlVisitor = new AnimControlVisitor();
private static final SkeletonControlVisitor skeletonControlVisitor = new SkeletonControlVisitor();

/**
* A private constructor to inhibit instantiation of this class.
Expand Down
31 changes: 31 additions & 0 deletions jme3-core/src/main/java/com/jme3/anim/util/HasLocalTransform.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
/*
* Copyright (c) 2009-2024 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jme3.anim.util;

import com.jme3.export.Savable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
/*
* Copyright (c) 2009-2024 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jme3.anim.util;

import com.jme3.anim.Joint;
Expand Down
31 changes: 31 additions & 0 deletions jme3-core/src/main/java/com/jme3/anim/util/Primitives.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
/*
* Copyright (c) 2009-2024 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jme3.anim.util;

import java.util.Collections;
Expand Down
31 changes: 31 additions & 0 deletions jme3-core/src/main/java/com/jme3/anim/util/Weighted.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
/*
* Copyright (c) 2009-2024 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jme3.anim.util;

import com.jme3.anim.tween.action.Action;
Expand Down
52 changes: 26 additions & 26 deletions jme3-core/src/main/java/com/jme3/app/state/CompositeAppState.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,41 +63,41 @@ public class CompositeAppState extends BaseAppState {
private AppStateManager stateManager;
private boolean attached;

public CompositeAppState( AppState... states ) {
for( AppState a : states ) {
public CompositeAppState(AppState... states) {
for (AppState a : states) {
this.states.add(new AppStateEntry(a, false));
}
}

private int indexOf( AppState state ) {
for( int i = 0; i < states.size(); i++ ) {
private int indexOf(AppState state) {
for (int i = 0; i < states.size(); i++) {
AppStateEntry e = states.get(i);
if( e.state == state ) {
if (e.state == state) {
return i;
}
}
return -1;
}

private AppStateEntry entry( AppState state ) {
for( AppStateEntry e : states.getArray() ) {
if( e.state == state ) {
private AppStateEntry entry(AppState state) {
for (AppStateEntry e : states.getArray()) {
if (e.state == state) {
return e;
}
}
return null;
}

protected <T extends AppState> T addChild( T state ) {
protected <T extends AppState> T addChild(T state) {
return addChild(state, false);
}

protected <T extends AppState> T addChild( T state, boolean overrideEnable ) {
if( indexOf(state) >= 0 ) {
protected <T extends AppState> T addChild(T state, boolean overrideEnable) {
if (indexOf(state) >= 0) {
return state;
}
states.add(new AppStateEntry(state, overrideEnable));
if( attached ) {
if (attached) {
stateManager.attach(state);
}
return state;
Expand Down Expand Up @@ -130,30 +130,30 @@ protected void clearChildren() {
}

@Override
public void stateAttached( AppStateManager stateManager ) {
public void stateAttached(AppStateManager stateManager) {
this.stateManager = stateManager;
for( AppStateEntry e : states.getArray() ) {
for (AppStateEntry e : states.getArray()) {
stateManager.attach(e.state);
}
this.attached = true;
}

@Override
public void stateDetached( AppStateManager stateManager ) {
public void stateDetached(AppStateManager stateManager) {
// Reverse order
for( int i = states.size() - 1; i >= 0; i-- ) {
for (int i = states.size() - 1; i >= 0; i--) {
stateManager.detach(states.get(i).state);
}
this.attached = false;
this.stateManager = null;
}

protected void setChildrenEnabled( boolean b ) {
if( childrenEnabled == b ) {
protected void setChildrenEnabled(boolean b) {
if(childrenEnabled == b) {
return;
}
childrenEnabled = b;
for( AppStateEntry e : states.getArray() ) {
for (AppStateEntry e : states.getArray()) {
e.setEnabled(b);
}
}
Expand All @@ -170,12 +170,12 @@ protected void setChildrenEnabled( boolean b ) {
* too. Override is about remembering the child's state before that
* happened and restoring it when the 'family' is enabled again as a whole.
*/
public void setOverrideEnabled( AppState state, boolean override ) {
public void setOverrideEnabled(AppState state, boolean override) {
AppStateEntry e = entry(state);
if( e == null ) {
if (e == null) {
throw new IllegalArgumentException("State not managed:" + state);
}
if( override ) {
if (override) {
e.override = true;
} else {
e.override = false;
Expand Down Expand Up @@ -206,16 +206,16 @@ private class AppStateEntry {
boolean enabled;
boolean override;

public AppStateEntry( AppState state, boolean overrideEnable ) {
public AppStateEntry(AppState state, boolean overrideEnable) {
this.state = state;
this.override = overrideEnable;
this.enabled = state.isEnabled();
}

public void setEnabled( boolean b ) {
public void setEnabled(boolean b) {

if( override ) {
if( b ) {
if (override) {
if (b) {
// Set it to whatever its enabled state
// was before going disabled last time.
state.setEnabled(enabled);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ public class WeakRefCloneAssetCache implements AssetCache {
* Maps cloned key to AssetRef which has a weak ref to the original
* key and a strong ref to the original asset.
*/
private final ConcurrentHashMap<AssetKey, AssetRef> smartCache
= new ConcurrentHashMap<>();
private final ConcurrentHashMap<AssetKey, AssetRef> smartCache = new ConcurrentHashMap<>();

/**
* Stored in the ReferenceQueue to find out when originalKey is collected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class ALAudioRenderer implements AudioRenderer, Runnable {
// which is exactly 1 second of audio.
private static final int BUFFER_SIZE = 35280;
private static final int STREAMING_BUFFER_COUNT = 5;
private final static int MAX_NUM_CHANNELS = 64;
private static final int MAX_NUM_CHANNELS = 64;
private IntBuffer ib = BufferUtils.createIntBuffer(1);
private final FloatBuffer fb = BufferUtils.createVector3Buffer(2);
private final ByteBuffer nativeBuf = BufferUtils.createByteBuffer(BUFFER_SIZE);
Expand Down
2 changes: 1 addition & 1 deletion jme3-core/src/main/java/com/jme3/cinematic/Cinematic.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public class Cinematic extends AbstractCinematicEvent implements AppState {
private Node scene;
protected TimeLine timeLine = new TimeLine();
private int lastFetchedKeyFrame = -1;
final private List<CinematicEvent> cinematicEvents = new ArrayList<>();
private final List<CinematicEvent> cinematicEvents = new ArrayList<>();
private Map<String, CameraNode> cameras = new HashMap<>();
private CameraNode currentCam;
private boolean initialized = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
*/
public class AnimEvent extends AbstractCinematicEvent {

final public static Logger logger
public static final Logger logger
= Logger.getLogger(AnimEvent.class.getName());

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@ public IBLGLEnvBaker(RenderManager rm, AssetManager am, Format format, Format de
brtf.getImage().setColorSpace(ColorSpace.Linear);
}

@Override
public TextureCubeMap getSpecularIBL() {
return specular;
}

@Override
public TextureCubeMap getIrradiance() {
return irradiance;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
*/
public class SavableClassUtil {

private final static HashMap<String, String> CLASS_REMAPPINGS = new HashMap<>();
private static final HashMap<String, String> CLASS_REMAPPINGS = new HashMap<>();

private static void addRemapping(String oldClass, Class<? extends Savable> newClass) {
CLASS_REMAPPINGS.put(oldClass, newClass.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class BitmapCharacterSet implements Savable {
private int renderedSize;
private int width;
private int height;
final private IntMap<IntMap<BitmapCharacter>> characters;
private final IntMap<IntMap<BitmapCharacter>> characters;
private int pageSize;

@Override
Expand Down
2 changes: 1 addition & 1 deletion jme3-core/src/main/java/com/jme3/font/ColorTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
class ColorTags {
private static final Pattern colorPattern = Pattern.compile("\\\\#([0-9a-fA-F]{8})#|\\\\#([0-9a-fA-F]{6})#|" +
"\\\\#([0-9a-fA-F]{4})#|\\\\#([0-9a-fA-F]{3})#");
final private LinkedList<Range> colors = new LinkedList<>();
private final LinkedList<Range> colors = new LinkedList<>();
private String text;
private String original;
private float baseAlpha = -1;
Expand Down
Loading

0 comments on commit cb20019

Please sign in to comment.