Code style changes.

This commit is contained in:
MobiusDev
2016-04-26 19:21:19 +00:00
parent 6a13705766
commit fc070c9238
768 changed files with 3338 additions and 4252 deletions

View File

@@ -207,7 +207,7 @@ public class HexUtils
else
{
numLines = (len / _HEX_ED_BPL) + 1;
textData = new char[(lineLength * numLines) - (_HEX_ED_BPL - (lenBplMod)) - _NEW_LINE_CHARS.length];
textData = new char[(lineLength * numLines) - (_HEX_ED_BPL - lenBplMod) - _NEW_LINE_CHARS.length];
}
// performance penalty, only doing space filling in the loop is faster
@@ -238,7 +238,7 @@ public class HexUtils
}
else if (dataLen < _HEX_ED_BPL)
{
Arrays.fill(textData, (lineHexDataStart + (dataLen * _HEX_ED_CPB)), lineHexDataStart + (dataLen * _HEX_ED_CPB) + ((_HEX_ED_BPL - dataLen) * _HEX_ED_CPB) + 1, ' ');
Arrays.fill(textData, lineHexDataStart + (dataLen * _HEX_ED_CPB), lineHexDataStart + (dataLen * _HEX_ED_CPB) + ((_HEX_ED_BPL - dataLen) * _HEX_ED_CPB) + 1, ' ');
}
else
{

View File

@@ -76,29 +76,26 @@ public class IPSubnet
}
}
}
else
// check for embedded v4 in v6 addr (not done !)
else if (_isIPv4)
{
// check for embedded v4 in v6 addr (not done !)
if (_isIPv4)
// my V4 vs V6
for (int i = 0; i < _addr.length; i++)
{
// my V4 vs V6
for (int i = 0; i < _addr.length; i++)
if ((addr[i + 12] & _mask[i]) != _addr[i])
{
if ((addr[i + 12] & _mask[i]) != _addr[i])
{
return false;
}
return false;
}
}
else
}
else
{
// my V6 vs V4
for (int i = 0; i < _addr.length; i++)
{
// my V6 vs V4
for (int i = 0; i < _addr.length; i++)
if ((addr[i] & _mask[i + 12]) != _addr[i + 12])
{
if ((addr[i] & _mask[i + 12]) != _addr[i + 12])
{
return false;
}
return false;
}
}
}
@@ -112,7 +109,7 @@ public class IPSubnet
int size = 0;
for (byte element : _mask)
{
size += Integer.bitCount((element & 0xFF));
size += Integer.bitCount(element & 0xFF);
}
try
@@ -136,15 +133,10 @@ public class IPSubnet
{
return applyMask(((IPSubnet) o).getAddress());
}
if (o instanceof InetAddress)
{
return applyMask(((InetAddress) o).getAddress());
}
return false;
return (o instanceof InetAddress) && applyMask(((InetAddress) o).getAddress());
}
private static final byte[] getMask(int n, int maxLength) throws UnknownHostException
private static byte[] getMask(int n, int maxLength) throws UnknownHostException
{
if ((n > (maxLength << 3)) || (n < 0))
{

View File

@@ -48,7 +48,7 @@ public class IPv4Filter implements IAcceptFilter, Runnable
* @param ip
* @return
*/
private static final int hash(byte[] ip)
private static int hash(byte[] ip)
{
return (ip[0] & 0xFF) | ((ip[1] << 8) & 0xFF00) | ((ip[2] << 16) & 0xFF0000) | ((ip[3] << 24) & 0xFF000000);
}

View File

@@ -339,7 +339,7 @@ public final class PrimeFinder
* @param desiredCapacity the capacity desired by the user.
* @return the capacity which should be used for a hashtable.
*/
public static final int nextPrime(int desiredCapacity)
public static int nextPrime(int desiredCapacity)
{
int i = Arrays.binarySearch(PRIME_CAPACITIES, desiredCapacity);
if (i < 0)

View File

@@ -303,7 +303,7 @@ public final class Rnd
protected static volatile long SEED_UNIQUIFIER = 8682522807148012L;
public static final Random directRandom()
public static Random directRandom()
{
return rnd.directRandom();
}
@@ -313,7 +313,7 @@ public final class Rnd
* @return A random double number from 0 to 1
* @see com.l2jmobius.util.Rnd#nextDouble()
*/
public static final double get()
public static double get()
{
return rnd.nextDouble();
}
@@ -323,7 +323,7 @@ public final class Rnd
* @param n The superior limit (exclusive)
* @return A random integer number from 0 to n-1
*/
public static final int get(int n)
public static int get(int n)
{
return rnd.get(n);
}
@@ -334,7 +334,7 @@ public final class Rnd
* @param max The maximum value
* @return A random integer number from min to max
*/
public static final int get(int min, int max)
public static int get(int min, int max)
{
return rnd.get(min, max);
}
@@ -345,12 +345,12 @@ public final class Rnd
* @param max The maximum value
* @return A random long number from min to max
*/
public static final long get(long min, long max)
public static long get(long min, long max)
{
return rnd.get(min, max);
}
public static final RandomContainer newInstance(RandomType type)
public static RandomContainer newInstance(RandomType type)
{
switch (type)
{
@@ -380,7 +380,7 @@ public final class Rnd
* @return A random boolean state (true or false)
* @see java.util.Random#nextBoolean()
*/
public static final boolean nextBoolean()
public static boolean nextBoolean()
{
return rnd.nextBoolean();
}
@@ -390,7 +390,7 @@ public final class Rnd
* @param array The array to be filled with random byte numbers
* @see java.util.Random#nextBytes(byte[] bytes)
*/
public static final void nextBytes(byte[] array)
public static void nextBytes(byte[] array)
{
rnd.nextBytes(array);
}
@@ -400,7 +400,7 @@ public final class Rnd
* @return A random double number from 0 to 1
* @see java.util.Random#nextDouble()
*/
public static final double nextDouble()
public static double nextDouble()
{
return rnd.nextDouble();
}
@@ -410,7 +410,7 @@ public final class Rnd
* @return A random integer number from 0 to 1
* @see java.util.Random#nextFloat()
*/
public static final float nextFloat()
public static float nextFloat()
{
return rnd.nextFloat();
}
@@ -420,7 +420,7 @@ public final class Rnd
* @return A random gaussian double number from 0 to 1
* @see java.util.Random#nextGaussian()
*/
public static final double nextGaussian()
public static double nextGaussian()
{
return rnd.nextGaussian();
}
@@ -430,7 +430,7 @@ public final class Rnd
* @return A random integer number from Integer.MIN_VALUE to Integer.MAX_VALUE
* @see java.util.Random#nextInt()
*/
public static final int nextInt()
public static int nextInt()
{
return rnd.nextInt();
}
@@ -440,7 +440,7 @@ public final class Rnd
* @return
* @see com.l2jmobius.util.Rnd#get(int n)
*/
public static final int nextInt(int n)
public static int nextInt(int n)
{
return get(n);
}
@@ -450,7 +450,7 @@ public final class Rnd
* @return A random integer number from Long.MIN_VALUE to Long.MAX_VALUE
* @see java.util.Random#nextLong()
*/
public static final long nextLong()
public static long nextLong()
{
return rnd.nextLong();
}

View File

@@ -1118,7 +1118,7 @@ public final class BlowfishEngine
private int func(int x)
{
return (((S0[(x >>> 24)] + S1[(x >>> 16) & 0xff]) ^ S2[(x >>> 8) & 0xff]) + S3[x & 0xff]);
return ((S0[(x >>> 24)] + S1[(x >>> 16) & 0xff]) ^ S2[(x >>> 8) & 0xff]) + S3[x & 0xff];
}
/**
@@ -1436,7 +1436,7 @@ public final class BlowfishEngine
*/
private int bytesTo32bits(byte[] src, int srcIndex)
{
return ((src[srcIndex + 3] & 0xff) << 24) | ((src[srcIndex + 2] & 0xff) << 16) | ((src[srcIndex + 1] & 0xff) << 8) | ((src[srcIndex] & 0xff));
return ((src[srcIndex + 3] & 0xff) << 24) | ((src[srcIndex + 2] & 0xff) << 16) | ((src[srcIndex + 1] & 0xff) << 8) | (src[srcIndex] & 0xff);
}
/**

View File

@@ -162,7 +162,7 @@ public final class NewCrypt
while (pos < stop)
{
edx = (raw[pos] & 0xFF);
edx = raw[pos] & 0xFF;
edx |= (raw[pos + 1] & 0xFF) << 8;
edx |= (raw[pos + 2] & 0xFF) << 16;
edx |= (raw[pos + 3] & 0xFF) << 24;

View File

@@ -38,17 +38,17 @@ import com.l2jmobius.util.file.filter.XMLFilter;
*/
public interface IXmlReader
{
static final Logger LOGGER = Logger.getLogger(IXmlReader.class.getName());
static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
Logger LOGGER = Logger.getLogger(IXmlReader.class.getName());
String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
/** The default file filter, ".xml" files only. */
static final XMLFilter XML_FILTER = new XMLFilter();
XMLFilter XML_FILTER = new XMLFilter();
/**
* This method can be used to load/reload the data.<br>
* It's highly recommended to clear the data storage, either the list or map.
*/
public void load();
void load();
/**
* Wrapper for {@link #parseFile(File)} method.