libs.message.*: add missing javadocs
authorEddie <dev@fun2be.me>
Sat, 6 Jun 2015 09:55:24 +0000 (10:55 +0100)
committerEddie <dev@fun2be.me>
Sat, 6 Jun 2015 09:55:24 +0000 (10:55 +0100)
src/uk/ac/ntu/n0521366/wsyd/libs/message/MessageAbstract.java
src/uk/ac/ntu/n0521366/wsyd/libs/message/MessageLogRecord.java
src/uk/ac/ntu/n0521366/wsyd/libs/message/MessageMember.java
src/uk/ac/ntu/n0521366/wsyd/libs/message/MessageNetworkStream.java
src/uk/ac/ntu/n0521366/wsyd/libs/message/MessagePresence.java

index 54e5b2c..0bb1b04 100644 (file)
@@ -24,7 +24,6 @@
 package uk.ac.ntu.n0521366.wsyd.libs.message;
 
 import java.io.Serializable;
-import java.net.InetAddress;
 
 /**
  * Base class of all Message types.
index 74cc642..38cdf75 100644 (file)
@@ -32,6 +32,9 @@ import java.util.logging.LogRecord;
  * @author Eddie Berrisford-Lynch <dev@fun2be.me>
  */
 public class MessageLogRecord extends MessageAbstract {
+    /**
+     * Message type.
+     */
     private static final String _type = "LogRecord";
 
     /**
index c04648c..dff5018 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * The MIT License
  *
- * Copyright 2015 TJ <hacker@iam.tj>.
+ * Copyright 2015 Eddie Berrisford-Lynch <dev@fun2be.me>.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -28,36 +28,79 @@ import uk.ac.ntu.n0521366.wsyd.libs.WSYD_Member;
 /**
  * A specialised message containing a WSYD_Member.
  * 
- * @author TJ <hacker@iam.tj>
+ * @author Eddie Berrisford-Lynch <dev@fun2be.me>
  */
 public class MessageMember extends MessageAbstract {
 
+    /**
+     * Registration states.
+     */
     public static enum STATE {UNREGISTERED, REGISTERED};
+
+    /**
+     * Message type.
+     */
     private static final String _type = "WSYD_Member";
     
+    /**
+     * Member record.
+     */
     private WSYD_Member _member;
+
+    /**
+     * Registration state.
+     */
     private STATE _registered;
+
+    /**
+     * Optional registration status message (used by server as error hint)
+     */
     private String _status;
     
+    /** 
+     *  The Message Class type.
+     * 
+     * @return Message type
+     */
     public static String getType() {
         return _type;
     }
 
+    /**
+     * The purpose of this class of message.
+     * 
+     * @return "WSYD_Member"
+     */
     @Override
     public String getMessageType() {
         return _type;
     }
     
+    /**
+     * Create with a member record and current status.
+     * @param member the member
+     * @param registered true if registered
+     * @param status optional status hint (set by server when errors occur)
+     */
     public MessageMember(WSYD_Member member, STATE registered, String status) {
+        super();
         _member = member;
         _registered = registered;
         _status = status;
     }
     
+    /**
+     * Create with a member record.
+     *
+     * @param member the member
+     */
     public MessageMember(WSYD_Member member) {
         this(member, STATE.UNREGISTERED, null);
     }
     
+    /**
+     * Default constructor.
+     */
     public MessageMember() {
         this(null, STATE.UNREGISTERED, null);
     }
@@ -65,7 +108,7 @@ public class MessageMember extends MessageAbstract {
     /**
      * Get the Member contained in this message.
      * 
-     * @return 
+     * @return the member record
      */
     public WSYD_Member getMember() {
         return _member;
@@ -74,7 +117,7 @@ public class MessageMember extends MessageAbstract {
     /**
      * Current registration state of the member record contained in this message.
      * 
-     * @return
+     * @return the registration status
      */
     public STATE getRegistered() {
         return _registered;
@@ -92,7 +135,7 @@ public class MessageMember extends MessageAbstract {
     /**
      * Get registration status message.
      * 
-     * @return 
+     * @return an optional message describing the registration status (usually an error hint)
      */
     public String getStatus() {
         return _status;
index ff5f5ba..776d58e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * The MIT License
  *
- * Copyright 2015 eddie.
+ * Copyright 2015 Eddie Berrisford-Lynch <dev@fun2be.me>.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -27,22 +27,42 @@ import uk.ac.ntu.n0521366.wsyd.libs.net.NetworkStream;
 /**
  * Pass a NetworkStream reference in a message.
  * 
- * @author eddie
+ * @author Eddie Berrisford-Lynch <dev@fun2be.me>
  */
 public class MessageNetworkStream extends MessageAbstract {
+    /**
+     * Message type.
+     */
     public static final String _type = "NetworkStream";
     
+    /**
+     * the stream reference.
+     */
     public final NetworkStream _stream;
     
+    /** 
+     *  The Message Class type.
+     * 
+     * @return Message type
+     */
     public static String getType() {
         return _type;
     }
 
+    /**
+     * The purpose of this class of message.
+     * 
+     * @return "NetworkStream"
+     */
     @Override
     public String getMessageType() {
         return _type;
     }
 
+    /**
+     * Create with a stream reference.
+     * @param stream the stream
+     */
     public MessageNetworkStream(NetworkStream stream) {
         super();
         _stream = stream;
index 0f2cb37..e449441 100644 (file)
@@ -26,28 +26,20 @@ package uk.ac.ntu.n0521366.wsyd.libs.message;
 import uk.ac.ntu.n0521366.wsyd.libs.net.WSYD_SocketAddress;
 
 /**
- *
+ * Announcement over multicast neighbour discovery.
+ * 
  * @author Eddie Berrisford-Lynch <dev@fun2be.me>
  */
 public class MessagePresence extends MessageAbstract {
-    private static final String _type = "Presence";
-    
     /**
-     * Return the class type without needing an instance object.
-     * 
-     * Workaround for Java not permitting 'abstract static' qualifiers which would
-     * allow static methods in abstract base classes to be overridden in sub-classes.
-     * 
-     * @return class type
+     * Message type.
      */
-    public static String getType() {
-        return _type;
-    }
+    private static final String _type = "Presence";
     
     /**
      * The title of the service advertising itself.
      * 
-     * E.g. "ServerSocial", "ServerChat", "ServerLog","UserSocial", 'UserChat",  "Notify"
+     * E.g. "ServerSocial", "ServerChat", "ServerLog", "UserChat"
      */
     public String serviceName;
     
@@ -58,8 +50,18 @@ public class MessagePresence extends MessageAbstract {
      */
     public WSYD_SocketAddress socketAddress;
 
+    /** 
+     *  The Message Class type.
+     * 
+     * @return Message type
+     */
+    public static String getType() {
+        return _type;
+    }
+    
     /**
-     * The message type
+     * The purpose of this class of message.
+     * 
      * @return "Presence"
      */
     @Override
@@ -67,6 +69,11 @@ public class MessagePresence extends MessageAbstract {
         return _type;
     }
 
+    /**
+     * Construct a message that can be sent over the network.
+     * @param service Name of the service being announced
+     * @param socketAddress IP address and port of the service
+     */
     public MessagePresence(String service, WSYD_SocketAddress socketAddress) {
         super();
         this.serviceName = service;