From f206eb6eb1aabd7f285ab858e19d55112d4fad1c Mon Sep 17 00:00:00 2001 From: Konloch Date: Fri, 15 Dec 2023 04:48:37 -0700 Subject: [PATCH] Better Java Docs --- src/main/java/com/konloch/vortex/Client.java | 17 ----------------- src/main/java/com/konloch/vortex/IO.java | 2 -- src/main/java/com/konloch/vortex/Server.java | 18 ------------------ .../vortex/interfaces/ClientRunnable.java | 4 ++++ .../konloch/vortex/interfaces/IsAllowed.java | 5 +++++ 5 files changed, 9 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/konloch/vortex/Client.java b/src/main/java/com/konloch/vortex/Client.java index 8804904..d405edf 100644 --- a/src/main/java/com/konloch/vortex/Client.java +++ b/src/main/java/com/konloch/vortex/Client.java @@ -28,7 +28,6 @@ public class Client /** * Construct a new socket client - * * @param server the socket server this client will be bound to * @param socket the socket channel this client is using for communication * @param uid the unique user identifier this socket client is assigned @@ -44,7 +43,6 @@ public Client(Server server, SocketChannel socket, long uid) /** * Write to a byte array the output buffer - * * @param bytes any byte array */ public void write(byte[] bytes) @@ -63,7 +61,6 @@ public void write(byte[] bytes) /** * Returns the output buffer write progress - * * @return the output buffer write progress */ public int getOutputBufferProgress() @@ -73,7 +70,6 @@ public int getOutputBufferProgress() /** * Adds to the output buffer progress and then returns the current value - * * @param add the amount of progress to increase by * @return the output buffer write progress */ @@ -111,7 +107,6 @@ protected void resetLastNetworkActivityWrite() /** * Returns the unique user id for this specific connection - * * @return the unique user id for this specific connection */ public long getUID() @@ -130,7 +125,6 @@ public String getRemoteAddress() /** * Returns the last read network activity for this socket - * * @return a long representing the timestamp of the last time the socket read */ public long getLastNetworkActivityRead() @@ -140,7 +134,6 @@ public long getLastNetworkActivityRead() /** * Returns the last write network activity for this socket - * * @return a long representing the timestamp of the last time the socket writes */ public long getLastNetworkActivityWrite() @@ -150,7 +143,6 @@ public long getLastNetworkActivityWrite() /** * Returns true if the socket client is in the read state - * * @return true if the socket client is in the read state */ public boolean isInputRead() @@ -160,7 +152,6 @@ public boolean isInputRead() /** * Set the read state for the socket client - * * @param inputRead set true to enable the read state for the socket client */ public void setInputRead(boolean inputRead) @@ -170,7 +161,6 @@ public void setInputRead(boolean inputRead) /** * Returns true if the socket client is in the write state - * * @return true if the socket client is in the write state */ public boolean isOutputWrite() @@ -180,7 +170,6 @@ public boolean isOutputWrite() /** * Set the write state for the socket client - * * @param outputWrite set true to enable the write state for the socket client */ public void setOutputWrite(boolean outputWrite) @@ -208,7 +197,6 @@ public void setState(int state) /** * Returns the input buffer - * * @return the ByteArrayOutputStream representing the input buffer */ public ByteArrayOutputStream getInputBuffer() @@ -218,7 +206,6 @@ public ByteArrayOutputStream getInputBuffer() /** * Returns the output buffer - * * @return the ByteArrayOutputStream representing the output buffer */ public ByteArrayOutputStream getOutputBuffer() @@ -237,7 +224,6 @@ public byte[] getOutputBufferCache() /** * Set the output buffer cache - * * @param outputBufferCache any byte array as the buffer cache */ public void setOutputBufferCache(byte[] outputBufferCache) @@ -248,7 +234,6 @@ public void setOutputBufferCache(byte[] outputBufferCache) /** * Returns the bound NIO socket channel - * * @return the bound NIO socket channel */ public SocketChannel getSocket() @@ -258,7 +243,6 @@ public SocketChannel getSocket() /** * Returns the socket server this client is bound to - * * @return the socket server this client is bound to */ public Server getServer() @@ -268,7 +252,6 @@ public Server getServer() /** * Resolve the remote address - * * @return the remote address, or an empty string if that failed */ private String resolveRemoteAddress() diff --git a/src/main/java/com/konloch/vortex/IO.java b/src/main/java/com/konloch/vortex/IO.java index ab2088e..bdcc927 100644 --- a/src/main/java/com/konloch/vortex/IO.java +++ b/src/main/java/com/konloch/vortex/IO.java @@ -15,7 +15,6 @@ class IO implements Runnable /** * Construct a new SocketServerIO - * * @param server the SocketServer this IO Handler is bound to */ public IO(Server server) @@ -184,7 +183,6 @@ public void run() /** * Return the socket client list containing the connected clients - * * @return the Socket Client list containing the connected clients */ public List getClients() diff --git a/src/main/java/com/konloch/vortex/Server.java b/src/main/java/com/konloch/vortex/Server.java index c5ff5c4..ffda27b 100644 --- a/src/main/java/com/konloch/vortex/Server.java +++ b/src/main/java/com/konloch/vortex/Server.java @@ -31,7 +31,6 @@ public class Server extends Thread /** * Construct a new Socket Server - * * @param port any port between 0-65,535 * @param requestHandler the request handler * @throws IOException thrown if any IO issues are encountered. @@ -43,7 +42,6 @@ public Server(int port, ClientRunnable requestHandler) throws IOException /** * Construct a new Socket Server - * * @param port any port between 0-65,535 * @param threadPool the amount of threads that will be started * @param networkConnectionFilter the pre-requst filter @@ -58,7 +56,6 @@ public Server(int port, int threadPool, IsAllowed networkConnectionFilter, /** * Construct a new Socket Server - * * @param hostname the hostname the socket will bind to * @param port any port between 0-65,535 * @param threadPool the amount of threads that will be started @@ -79,7 +76,6 @@ public Server(String hostname, int port, int threadPool, IsAllowed networkConnec /** * Bind to the socket port - * * @return this instance for method chaining * @throws IOException thrown if any IO issues are encountered. */ @@ -154,7 +150,6 @@ public void run() /** * Attempts to accept an incoming socket connection, if there is not one in the queue it will return false. - * * @return true if a connection has been accepted * @throws IOException thrown if any IO issues are encountered. */ @@ -203,7 +198,6 @@ public boolean acceptConnection() throws IOException /** * Returns the port the socket server is bound to - * * @return the port the socket server is bound to */ public int getPort() @@ -213,7 +207,6 @@ public int getPort() /** * Returns true if the socket server is still running - * * @return true if the socket server is still running */ public boolean isRunning() @@ -223,7 +216,6 @@ public boolean isRunning() /** * Stops the socket server - * * @return this instance for method chaining */ public Server stopSocketServer() @@ -234,7 +226,6 @@ public Server stopSocketServer() /** * Returns true if the socket server has been stopped - * * @return true if the socket server has been stopped */ public boolean hasStopped() @@ -244,7 +235,6 @@ public boolean hasStopped() /** * Returns the request handler - * * @return the request handler */ public ClientRunnable getRequestHandler() @@ -254,7 +244,6 @@ public ClientRunnable getRequestHandler() /** * Set the request handler - * * @param requestHandler any request handler * @return this instance for method chaining */ @@ -266,7 +255,6 @@ public Server setRequestHandler(ClientRunnable requestHandler) /** * Returns the onDisconnect handler - * * @return the onDisconnect handler */ public ClientRunnable getOnDisconnect() @@ -276,7 +264,6 @@ public ClientRunnable getOnDisconnect() /** * Set the onDisconnect handler - * * @param onDisconnect any onDisconnet handler * @return this instance for method chaining */ @@ -288,7 +275,6 @@ public Server setOnDisconnect(ClientRunnable onDisconnect) /** * Returns the network connection filter - * * @return the network connection filter */ public IsAllowed getNetworkConnectionFilter() @@ -328,7 +314,6 @@ public int getTimeout() /** * Set the timeout value for network activity - * * @param timeout any integer representing the milliseconds for timeout from network activity * @return this instance for method chaining */ @@ -340,7 +325,6 @@ public Server setTimeout(int timeout) /** * Return the default size of the byte buffers - * * @return default size of the byte buffers */ public int getIOAmount() @@ -350,7 +334,6 @@ public int getIOAmount() /** * Set the default size of the byte buffers - * * @param ioAmount any integer as the default size of the byte buffers * @return this instance for method chaining */ @@ -363,7 +346,6 @@ public Server setIOAmount(int ioAmount) /** * Alert that this is a library - * * @param args program launch arguments */ public static void main(String[] args) diff --git a/src/main/java/com/konloch/vortex/interfaces/ClientRunnable.java b/src/main/java/com/konloch/vortex/interfaces/ClientRunnable.java index 9fc7ee7..ec919a1 100644 --- a/src/main/java/com/konloch/vortex/interfaces/ClientRunnable.java +++ b/src/main/java/com/konloch/vortex/interfaces/ClientRunnable.java @@ -8,5 +8,9 @@ */ public interface ClientRunnable { + /** + * Runnable function + * @param client the client reference + */ void run(Client client); } diff --git a/src/main/java/com/konloch/vortex/interfaces/IsAllowed.java b/src/main/java/com/konloch/vortex/interfaces/IsAllowed.java index 38fdc51..d4b8800 100644 --- a/src/main/java/com/konloch/vortex/interfaces/IsAllowed.java +++ b/src/main/java/com/konloch/vortex/interfaces/IsAllowed.java @@ -8,5 +8,10 @@ */ public interface IsAllowed { + /** + * Used for filtering + * @param client the client reference + * @return true if allowed, false if not + */ boolean allowed(Client client); }