Some code formatting.

This commit is contained in:
MobiusDev
2016-03-19 08:47:52 +00:00
parent 9a9a5dd414
commit 345b88ad95
106 changed files with 308 additions and 308 deletions

View File

@@ -22,5 +22,5 @@ package com.l2jmobius.commons.mmocore;
*/
public interface IClientFactory<T extends MMOClient<?>>
{
public T create(final MMOConnection<T> con);
public T create(MMOConnection<T> con);
}

View File

@@ -26,7 +26,7 @@ public abstract class MMOClient<T extends MMOConnection<?>>
{
private final T _con;
public MMOClient(final T con)
public MMOClient(T con)
{
_con = con;
}
@@ -36,9 +36,9 @@ public abstract class MMOClient<T extends MMOConnection<?>>
return _con;
}
public abstract boolean decrypt(final ByteBuffer buf, final int size);
public abstract boolean decrypt(ByteBuffer buf, int size);
public abstract boolean encrypt(final ByteBuffer buf, final int size);
public abstract boolean encrypt(ByteBuffer buf, int size);
protected abstract void onDisconnection();

View File

@@ -58,7 +58,7 @@ public class MMOConnection<T extends MMOClient<?>>
private T _client;
public MMOConnection(final SelectorThread<T> selectorThread, final Socket socket, final SelectionKey key, boolean tcpNoDelay)
public MMOConnection(SelectorThread<T> selectorThread, Socket socket, SelectionKey key, boolean tcpNoDelay)
{
_selectorThread = selectorThread;
_socket = socket;
@@ -80,7 +80,7 @@ public class MMOConnection<T extends MMOClient<?>>
}
}
final void setClient(final T client)
final void setClient(T client)
{
_client = client;
}
@@ -90,7 +90,7 @@ public class MMOConnection<T extends MMOClient<?>>
return _client;
}
public final void sendPacket(final SendablePacket<T> sp)
public final void sendPacket(SendablePacket<T> sp)
{
sp._client = _client;
@@ -137,17 +137,17 @@ public class MMOConnection<T extends MMOClient<?>>
_socket.close();
}
final int read(final ByteBuffer buf) throws IOException
final int read(ByteBuffer buf) throws IOException
{
return _readableByteChannel.read(buf);
}
final int write(final ByteBuffer buf) throws IOException
final int write(ByteBuffer buf) throws IOException
{
return _writableByteChannel.write(buf);
}
final void createWriteBuffer(final ByteBuffer buf)
final void createWriteBuffer(ByteBuffer buf)
{
if (_primaryWriteBuffer == null)
{
@@ -186,7 +186,7 @@ public class MMOConnection<T extends MMOClient<?>>
return _primaryWriteBuffer != null;
}
final void movePendingWriteBufferTo(final ByteBuffer dest)
final void movePendingWriteBufferTo(ByteBuffer dest)
{
_primaryWriteBuffer.flip();
dest.put(_primaryWriteBuffer);
@@ -195,7 +195,7 @@ public class MMOConnection<T extends MMOClient<?>>
_secondaryWriteBuffer = null;
}
final void setReadBuffer(final ByteBuffer buf)
final void setReadBuffer(ByteBuffer buf)
{
_readBuffer = buf;
}
@@ -220,7 +220,7 @@ public class MMOConnection<T extends MMOClient<?>>
*/
@SuppressWarnings("unchecked")
public final void close(final SendablePacket<T> sp)
public final void close(SendablePacket<T> sp)
{
close(new SendablePacket[]
{
@@ -228,7 +228,7 @@ public class MMOConnection<T extends MMOClient<?>>
});
}
public final void close(final SendablePacket<T>[] closeList)
public final void close(SendablePacket<T>[] closeList)
{
if (_pendingClose)
{

View File

@@ -33,7 +33,7 @@ public final class NioNetStackList<E>
clear();
}
public final void addLast(final E elem)
public final void addLast(E elem)
{
final NioNetStackNode newEndNode = _buf.removeFirst();
_end._value = elem;
@@ -78,7 +78,7 @@ public final class NioNetStackList<E>
_start._next = _end;
}
final void addLast(final NioNetStackNode node)
final void addLast(NioNetStackNode node)
{
node._next = null;
node._value = null;

View File

@@ -29,7 +29,7 @@ public final class NioNetStringBuffer
private int _len;
public NioNetStringBuffer(final int size)
public NioNetStringBuffer(int size)
{
_buf = new char[size];
_size = size;
@@ -41,7 +41,7 @@ public final class NioNetStringBuffer
_len = 0;
}
public final void append(final char c)
public final void append(char c)
{
if (_len < _size)
{

View File

@@ -40,7 +40,7 @@ public abstract class ReceivablePacket<T extends MMOClient<?>>extends AbstractPa
* Reads as many bytes as the length of the array.
* @param dst : the byte array which will be filled with the data.
*/
protected final void readB(final byte[] dst)
protected final void readB(byte[] dst)
{
_buf.get(dst);
}
@@ -52,7 +52,7 @@ public abstract class ReceivablePacket<T extends MMOClient<?>>extends AbstractPa
* @param offset : starts to fill the byte array from the given offset.
* @param len : the given length of bytes to be read.
*/
protected final void readB(final byte[] dst, final int offset, final int len)
protected final void readB(byte[] dst, int offset, int len)
{
_buf.get(dst, offset, len);
}

View File

@@ -67,7 +67,7 @@ public final class SelectorThread<T extends MMOClient<?>>extends Thread
private boolean _shutdown;
public SelectorThread(final SelectorConfig sc, final IMMOExecutor<T> executor, final IPacketHandler<T> packetHandler, final IClientFactory<T> clientFactory, final IAcceptFilter acceptFilter) throws IOException
public SelectorThread(SelectorConfig sc, IMMOExecutor<T> executor, IPacketHandler<T> packetHandler, IClientFactory<T> clientFactory, IAcceptFilter acceptFilter) throws IOException
{
super.setName("SelectorThread-" + super.getId());
@@ -234,7 +234,7 @@ public final class SelectorThread<T extends MMOClient<?>>extends Thread
closeSelectorThread();
}
private final void finishConnection(final SelectionKey key, final MMOConnection<T> con)
private final void finishConnection(SelectionKey key, MMOConnection<T> con)
{
try
{
@@ -254,7 +254,7 @@ public final class SelectorThread<T extends MMOClient<?>>extends Thread
}
}
private final void acceptConnection(final SelectionKey key, MMOConnection<T> con)
private final void acceptConnection(SelectionKey key, MMOConnection<T> con)
{
final ServerSocketChannel ssc = (ServerSocketChannel) key.channel();
SocketChannel sc;
@@ -283,7 +283,7 @@ public final class SelectorThread<T extends MMOClient<?>>extends Thread
}
}
private final void readPacket(final SelectionKey key, final MMOConnection<T> con)
private final void readPacket(SelectionKey key, MMOConnection<T> con)
{
if (!con.isClosed())
{
@@ -363,7 +363,7 @@ public final class SelectorThread<T extends MMOClient<?>>extends Thread
}
}
private final boolean tryReadPacket(final SelectionKey key, final T client, final ByteBuffer buf, final MMOConnection<T> con)
private final boolean tryReadPacket(SelectionKey key, T client, ByteBuffer buf, MMOConnection<T> con)
{
switch (buf.remaining())
{
@@ -445,13 +445,13 @@ public final class SelectorThread<T extends MMOClient<?>>extends Thread
}
}
private final void allocateReadBuffer(final MMOConnection<T> con)
private final void allocateReadBuffer(MMOConnection<T> con)
{
con.setReadBuffer(getPooledBuffer().put(READ_BUFFER));
READ_BUFFER.clear();
}
private final void parseClientPacket(final int pos, final ByteBuffer buf, final int dataSize, final T client)
private final void parseClientPacket(int pos, ByteBuffer buf, int dataSize, T client)
{
final boolean ret = client.decrypt(buf, dataSize);
@@ -480,7 +480,7 @@ public final class SelectorThread<T extends MMOClient<?>>extends Thread
}
}
private final void writeClosePacket(final MMOConnection<T> con)
private final void writeClosePacket(MMOConnection<T> con)
{
SendablePacket<T> sp;
synchronized (con.getSendQueue())
@@ -510,7 +510,7 @@ public final class SelectorThread<T extends MMOClient<?>>extends Thread
}
}
protected final void writePacket(final SelectionKey key, final MMOConnection<T> con)
protected final void writePacket(SelectionKey key, MMOConnection<T> con)
{
if (!prepareWriteBuffer(con))
{
@@ -561,7 +561,7 @@ public final class SelectorThread<T extends MMOClient<?>>extends Thread
}
}
private final boolean prepareWriteBuffer(final MMOConnection<T> con)
private final boolean prepareWriteBuffer(MMOConnection<T> con)
{
boolean hasPending = false;
DIRECT_WRITE_BUFFER.clear();
@@ -619,7 +619,7 @@ public final class SelectorThread<T extends MMOClient<?>>extends Thread
return hasPending;
}
private final void putPacketIntoWriteBuffer(final T client, final SendablePacket<T> sp)
private final void putPacketIntoWriteBuffer(T client, SendablePacket<T> sp)
{
WRITE_BUFFER.clear();
@@ -651,7 +651,7 @@ public final class SelectorThread<T extends MMOClient<?>>extends Thread
WRITE_BUFFER.position(dataPos + dataSize);
}
final void closeConnection(final MMOConnection<T> con)
final void closeConnection(MMOConnection<T> con)
{
synchronized (_pendingClose)
{
@@ -659,7 +659,7 @@ public final class SelectorThread<T extends MMOClient<?>>extends Thread
}
}
private final void closeConnectionImpl(final SelectionKey key, final MMOConnection<T> con)
private final void closeConnectionImpl(SelectionKey key, MMOConnection<T> con)
{
try
{

View File

@@ -22,17 +22,17 @@ package com.l2jmobius.commons.mmocore;
*/
public abstract class SendablePacket<T extends MMOClient<?>>extends AbstractPacket<T>
{
protected final void putInt(final int value)
protected final void putInt(int value)
{
_buf.putInt(value);
}
protected final void putDouble(final double value)
protected final void putDouble(double value)
{
_buf.putDouble(value);
}
protected final void putFloat(final float value)
protected final void putFloat(float value)
{
_buf.putFloat(value);
}
@@ -42,7 +42,7 @@ public abstract class SendablePacket<T extends MMOClient<?>>extends AbstractPack
* 8bit integer (00)
* @param data
*/
protected final void writeC(final boolean data)
protected final void writeC(boolean data)
{
_buf.put((byte) (data ? 0x01 : 0x00));
}
@@ -52,7 +52,7 @@ public abstract class SendablePacket<T extends MMOClient<?>>extends AbstractPack
* 8bit integer (00)
* @param data
*/
protected final void writeC(final int data)
protected final void writeC(int data)
{
_buf.put((byte) data);
}
@@ -62,7 +62,7 @@ public abstract class SendablePacket<T extends MMOClient<?>>extends AbstractPack
* 64bit double precision float (00 00 00 00 00 00 00 00)
* @param value
*/
protected final void writeF(final double value)
protected final void writeF(double value)
{
_buf.putDouble(value);
}
@@ -72,7 +72,7 @@ public abstract class SendablePacket<T extends MMOClient<?>>extends AbstractPack
* 16bit integer (00 00)
* @param value
*/
protected final void writeH(final int value)
protected final void writeH(int value)
{
_buf.putShort((short) value);
}
@@ -82,7 +82,7 @@ public abstract class SendablePacket<T extends MMOClient<?>>extends AbstractPack
* 32bit integer (00 00 00 00)
* @param value
*/
protected final void writeD(final int value)
protected final void writeD(int value)
{
_buf.putInt(value);
}
@@ -92,7 +92,7 @@ public abstract class SendablePacket<T extends MMOClient<?>>extends AbstractPack
* 32bit integer (00 00 00 00)
* @param value
*/
protected final void writeD(final boolean value)
protected final void writeD(boolean value)
{
_buf.putInt(value ? 0x01 : 0x00);
}
@@ -102,7 +102,7 @@ public abstract class SendablePacket<T extends MMOClient<?>>extends AbstractPack
* 64bit integer (00 00 00 00 00 00 00 00)
* @param value
*/
protected final void writeQ(final long value)
protected final void writeQ(long value)
{
_buf.putLong(value);
}
@@ -112,7 +112,7 @@ public abstract class SendablePacket<T extends MMOClient<?>>extends AbstractPack
* 8bit integer array (00 ...)
* @param data
*/
protected final void writeB(final byte[] data)
protected final void writeB(byte[] data)
{
_buf.put(data);
}
@@ -121,7 +121,7 @@ public abstract class SendablePacket<T extends MMOClient<?>>extends AbstractPack
* Write <B>String</B> to the buffer.
* @param text
*/
protected final void writeS(final String text)
protected final void writeS(String text)
{
if (text != null)
{