Skip to content

Commit

Permalink
Merge pull request #286 from DevFactory/release/useless-parenthesis-s…
Browse files Browse the repository at this point in the history
…hould-be-removed-fix-1

Code quality fix - Useless parentheses around expressions should be removed to prevent any misunderstanding.
  • Loading branch information
nicolasgramlich committed Sep 20, 2016
2 parents f4e0661 + 0739b30 commit 4fc3823
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/org/anddev/andengine/audio/sound/Sound.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void release() {

@Override
public void setLooping(final boolean pLooping) {
this.setLoopCount((pLooping) ? -1 : 0);
this.setLoopCount(pLooping ? -1 : 0);
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/org/anddev/andengine/collision/BaseCollisionChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public class BaseCollisionChecker {
// ===========================================================

public static boolean checkAxisAlignedRectangleCollision(final float pLeftA, final float pTopA, final float pRightA, final float pBottomA, final float pLeftB, final float pTopB, final float pRightB, final float pBottomB) {
return (pLeftA < pRightB &&
return pLeftA < pRightB &&
pLeftB < pRightA &&
pTopA < pBottomB &&
pTopB < pBottomA);
pTopB < pBottomA;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void setLifeTime(final float pMinLifeTime, final float pMaxLifeTime) {

@Override
public void onInitializeParticle(final Particle pParticle) {
pParticle.setDeathTime((RANDOM.nextFloat() * (this.mMaxLifeTime - this.mMinLifeTime) + this.mMinLifeTime));
pParticle.setDeathTime(RANDOM.nextFloat() * (this.mMaxLifeTime - this.mMinLifeTime) + this.mMinLifeTime);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/org/anddev/andengine/entity/scene/menu/MenuScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void setMenuAnimator(final IMenuAnimator pMenuAnimator) {

@Override
public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final ITouchArea pTouchArea, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
final IMenuItem menuItem = ((IMenuItem)pTouchArea);
final IMenuItem menuItem = (IMenuItem)pTouchArea;

switch(pSceneTouchEvent.getAction()) {
case MotionEvent.ACTION_DOWN:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ public abstract class PVRTexture extends Texture {
// Constants
// ===========================================================

public static final int FLAG_MIPMAP = (1<<8); // has mip map levels
public static final int FLAG_TWIDDLE = (1<<9); // is twiddled
public static final int FLAG_BUMPMAP = (1<<10); // has normals encoded for a bump map
public static final int FLAG_TILING = (1<<11); // is bordered for tiled pvr
public static final int FLAG_CUBEMAP = (1<<12); // is a cubemap/skybox
public static final int FLAG_FALSEMIPCOL = (1<<13); // are there false colored MIP levels
public static final int FLAG_VOLUME = (1<<14); // is this a volume texture
public static final int FLAG_ALPHA = (1<<15); // v2.1 is there transparency info in the texture
public static final int FLAG_VERTICALFLIP = (1<<16); // v2.1 is the texture vertically flipped
public static final int FLAG_MIPMAP = 1<<; // has mip map levels
public static final int FLAG_TWIDDLE = 1<<9; // is twiddled
public static final int FLAG_BUMPMAP = 1<<10; // has normals encoded for a bump map
public static final int FLAG_TILING = 1<<11; // is bordered for tiled pvr
public static final int FLAG_CUBEMAP = 1<<12; // is a cubemap/skybox
public static final int FLAG_FALSEMIPCOL = 1<<13; // are there false colored MIP levels
public static final int FLAG_VOLUME = 1<<14; // is this a volume texture
public static final int FLAG_ALPHA = 1<<15; // v2.1 is there transparency info in the texture
public static final int FLAG_VERTICALFLIP = 1<<16; // v2.1 is the texture vertically flipped

// ===========================================================
// Fields
Expand Down
2 changes: 1 addition & 1 deletion src/org/anddev/andengine/opengl/util/FastFloatBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class FastFloatBuffer {
* Constructs a new direct native-ordered buffer
*/
public FastFloatBuffer(final int pCapacity) {
this.mByteBuffer = ByteBuffer.allocateDirect((pCapacity * BYTES_PER_FLOAT)).order(ByteOrder.nativeOrder());
this.mByteBuffer = ByteBuffer.allocateDirect(pCapacity * BYTES_PER_FLOAT).order(ByteOrder.nativeOrder());
this.mFloatBuffer = this.mByteBuffer.asFloatBuffer();
this.mIntBuffer = this.mByteBuffer.asIntBuffer();
}
Expand Down
28 changes: 14 additions & 14 deletions src/org/anddev/andengine/opengl/util/GLHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class GLHelper {
public static final int BYTES_PER_FLOAT = 4;
public static final int BYTES_PER_PIXEL_RGBA = 4;

private static final boolean IS_LITTLE_ENDIAN = (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN);
private static final boolean IS_LITTLE_ENDIAN = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN;

private static final int[] HARDWARETEXTUREID_CONTAINER = new int[1];
private static final int[] HARDWAREBUFFERID_CONTAINER = new int[1];
Expand Down Expand Up @@ -470,9 +470,9 @@ private static byte[] convertARGB_8888toRGB_565(final int[] pPixelsARGB_8888) {
for(int i = pPixelsARGB_8888.length - 1, j = pixelsRGB_565.length - 1; i >= 0; i--) {
final int pixel = pPixelsARGB_8888[i];

final int red = ((pixel >> 16) & 0xFF);
final int green = ((pixel >> 8) & 0xFF);
final int blue = ((pixel) & 0xFF);
final int red = (pixel >> 16) & 0xFF;
final int green = (pixel >> 8) & 0xFF;
final int blue = (pixel) & 0xFF;

/* Byte1: [R1 R2 R3 R4 R5 G1 G2 G3]
* Byte2: [G4 G5 G6 B1 B2 B3 B4 B5] */
Expand All @@ -484,9 +484,9 @@ private static byte[] convertARGB_8888toRGB_565(final int[] pPixelsARGB_8888) {
for(int i = pPixelsARGB_8888.length - 1, j = pixelsRGB_565.length - 1; i >= 0; i--) {
final int pixel = pPixelsARGB_8888[i];

final int red = ((pixel >> 16) & 0xFF);
final int green = ((pixel >> 8) & 0xFF);
final int blue = ((pixel) & 0xFF);
final int red = (pixel >> 16) & 0xFF;
final int green = (pixel >> 8) & 0xFF;
final int blue = (pixel) & 0xFF;

/* Byte2: [G4 G5 G6 B1 B2 B3 B4 B5]
* Byte1: [R1 R2 R3 R4 R5 G1 G2 G3]*/
Expand All @@ -504,9 +504,9 @@ private static byte[] convertARGB_8888toARGB_4444(final int[] pPixelsARGB_8888)
for(int i = pPixelsARGB_8888.length - 1, j = pixelsARGB_4444.length - 1; i >= 0; i--) {
final int pixel = pPixelsARGB_8888[i];

final int alpha = ((pixel >> 28) & 0x0F);
final int red = ((pixel >> 16) & 0xF0);
final int green = ((pixel >> 8) & 0xF0);
final int alpha = (pixel >> 28) & 0x0F;
final int red = (pixel >> 16) & 0xF0;
final int green = (pixel >> 8) & 0xF0;
final int blue = ((pixel) & 0x0F);

/* Byte1: [A1 A2 A3 A4 R1 R2 R3 R4]
Expand All @@ -519,10 +519,10 @@ private static byte[] convertARGB_8888toARGB_4444(final int[] pPixelsARGB_8888)
for(int i = pPixelsARGB_8888.length - 1, j = pixelsARGB_4444.length - 1; i >= 0; i--) {
final int pixel = pPixelsARGB_8888[i];

final int alpha = ((pixel >> 28) & 0x0F);
final int red = ((pixel >> 16) & 0xF0);
final int green = ((pixel >> 8) & 0xF0);
final int blue = ((pixel) & 0x0F);
final int alpha = (pixel >> 28) & 0x0F;
final int red = (pixel >> 16) & 0xF0;
final int green = (pixel >> 8) & 0xF0;
final int blue = (pixel) & 0x0F;

/* Byte2: [G1 G2 G3 G4 G2 G2 G3 G4]
* Byte1: [A1 A2 A3 A4 R1 R2 R3 R4] */
Expand Down
2 changes: 1 addition & 1 deletion src/org/anddev/andengine/util/MathUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static final int random(final int pMin, final int pMax) {
}

public static final boolean isPowerOfTwo(final int n) {
return ((n != 0) && (n & (n - 1)) == 0);
return (n != 0) && (n & (n - 1)) == 0;
}

public static final int nextPowerOfTwo(final float f) {
Expand Down
2 changes: 1 addition & 1 deletion src/org/anddev/andengine/util/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static String[] split(final String pString, final char pCharacter, final
final int partCount = StringUtils.countOccurrences(pString, pCharacter) + 1;

final boolean reuseable = pReuse != null && pReuse.length == partCount;
final String[] out = (reuseable) ? pReuse : new String[partCount];
final String[] out = reuseable ? pReuse : new String[partCount];

if(partCount == 0) {
out[0] = pString;
Expand Down

0 comments on commit 4fc3823

Please sign in to comment.