* Note that the API changed slightly in the 3rd version: You must now invoke start() on the SwingWorker after creating
* it.
*/
@@ -62,6 +62,8 @@ public abstract class SwingWorker
/**
* Compute the value to be returned by the get method.
+ *
+ * @return The computed value.
*/
public abstract Object construct();
@@ -107,6 +109,8 @@ public abstract class SwingWorker
/**
* Get the value produced by the worker thread, or null if it hasn't been constructed yet.
+ *
+ * @return The value.
*/
protected synchronized Object getValue()
{
@@ -115,6 +119,8 @@ public abstract class SwingWorker
/**
* Set the value produced by worker thread
+ *
+ * @param x The object.
*/
private synchronized void setValue(Object x)
{
diff --git a/src/main/java/net/thauvin/erik/mobibot/TellMessage.java b/src/main/java/net/thauvin/erik/mobibot/TellMessage.java
index 030b825..ceb9de2 100644
--- a/src/main/java/net/thauvin/erik/mobibot/TellMessage.java
+++ b/src/main/java/net/thauvin/erik/mobibot/TellMessage.java
@@ -83,61 +83,121 @@ public class TellMessage implements Serializable
}
+ /**
+ * Returns the message id.
+ *
+ * @return The message id.
+ */
public String getId()
{
return this.id;
}
+ /**
+ * Returns the message text.
+ *
+ * @return The text of the message.
+ */
public String getMessage()
{
return message;
}
+ /**
+ * Returns the state of the queue flag.
+ *
+ * @return true if the message is queued.
+ */
public Date getQueued()
{
return queued;
}
+ /**
+ * Returns the state of the received flag.
+ *
+ * @return true if the message has been received.
+ */
public Date getReceived()
{
return received;
}
+ /**
+ * Returns the message's recipient.
+ *
+ * @return The recipient of the message.
+ */
public String getRecipient()
{
return recipient;
}
+ /**
+ * Returns the message's sender.
+ *
+ * @return The sender of the message.
+ */
public String getSender()
{
return sender;
}
+ /**
+ * Matches the message sender or recipient.
+ *
+ * @param nick The nickname to match with.
+ *
+ * @return true if the nickname matches.
+ */
public boolean isMatch(String nick)
{
return (sender.equalsIgnoreCase(nick) || recipient.equalsIgnoreCase(nick));
}
+ /**
+ * Match the message ID.
+ *
+ * @param id The ID to match with.
+ *
+ * @return true if the id matches.
+ */
public boolean isMatchId(String id)
{
return this.id.equals(id);
}
+ /**
+ * Returns the notification flag state.
+ *
+ * @return true if the sender has been notified.
+ */
public boolean isNotified()
{
return this.isNotified;
}
+ /**
+ * Returns the received flag state.
+ *
+ * @return true if the message was received.
+ */
public boolean isReceived()
{
return this.isReceived;
}
+ /**
+ * Sets the notified flag.
+ */
public void setIsNotified()
{
this.isNotified = true;
}
+ /**
+ * Sets the received flag.
+ */
public void setIsReceived()
{
this.received = Calendar.getInstance().getTime();
diff --git a/src/main/java/net/thauvin/erik/mobibot/TellMessagesMgr.java b/src/main/java/net/thauvin/erik/mobibot/TellMessagesMgr.java
index b0b9d43..bb261e5 100644
--- a/src/main/java/net/thauvin/erik/mobibot/TellMessagesMgr.java
+++ b/src/main/java/net/thauvin/erik/mobibot/TellMessagesMgr.java
@@ -80,6 +80,11 @@ public class TellMessagesMgr
try
{
+ if (logger.isDebugEnabled())
+ {
+ logger.debug("Loading the messages.");
+ }
+
return ((List) input.readObject());
}
finally
@@ -118,6 +123,10 @@ public class TellMessagesMgr
try
{
+ if (logger.isDebugEnabled())
+ {
+ logger.debug("Saving the messages.");
+ }
output.writeObject(messages);
}
finally
@@ -132,7 +141,10 @@ public class TellMessagesMgr
}
/**
- * Cleans the messages queue.
+ * Cleans the messages queue
+ *
+ * @param tellMessages The messages list.
+ * @param tellMaxDays The maximum number of days to keep messages for.
*/
public static void cleanTellMessages(List tellMessages, int tellMaxDays)
{
diff --git a/src/main/java/net/thauvin/erik/mobibot/Twitter.java b/src/main/java/net/thauvin/erik/mobibot/Twitter.java
index 23fd404..049a15f 100644
--- a/src/main/java/net/thauvin/erik/mobibot/Twitter.java
+++ b/src/main/java/net/thauvin/erik/mobibot/Twitter.java
@@ -39,7 +39,7 @@ import twitter4j.TwitterFactory;
import twitter4j.conf.ConfigurationBuilder;
/**
- * Inserts presence information into Twitter.
+ * Processes the {@link Commands#TWITTER_CMD} command.
*
* @author Erik C. Thauvin
* @created Sept 10, 2008
@@ -83,9 +83,9 @@ public class Twitter implements Runnable
private final String sender;
/**
- * Creates a new Twitter object.
+ * Creates a new {@link Twitter} instance.
*
- * @param bot The bot.
+ * @param bot The bot's instance.
* @param sender The nick of the person who sent the message.
* @param consumerKey The Twitter consumer key.
* @param consumerSecret The Twitter consumer secret.
@@ -105,6 +105,9 @@ public class Twitter implements Runnable
this.sender = sender;
}
+ /**
+ * Posts to twitter.
+ */
public final void run()
{
try
diff --git a/src/main/java/net/thauvin/erik/mobibot/TwitterOAuth.java b/src/main/java/net/thauvin/erik/mobibot/TwitterOAuth.java
index 1bcb5ba..3fa40a7 100644
--- a/src/main/java/net/thauvin/erik/mobibot/TwitterOAuth.java
+++ b/src/main/java/net/thauvin/erik/mobibot/TwitterOAuth.java
@@ -10,12 +10,13 @@ import java.io.InputStreamReader;
/**
* The TwitterOAuth class.
- *
+ *
* and follow the prompts/instructions.
*
* @author Erik C. Thauvin
diff --git a/src/main/java/net/thauvin/erik/mobibot/War.java b/src/main/java/net/thauvin/erik/mobibot/War.java
index 6430374..ec2ba9f 100644
--- a/src/main/java/net/thauvin/erik/mobibot/War.java
+++ b/src/main/java/net/thauvin/erik/mobibot/War.java
@@ -36,7 +36,7 @@ package net.thauvin.erik.mobibot;
import java.util.Random;
/**
- * The War class.
+ * Processes the {@link Commands#WAR_CMD} command.
*
* @author Erik C. Thauvin
* @created 2014-04-28
@@ -69,7 +69,7 @@ public class War
/**
* Plays war.
*
- * @param bot The bot.
+ * @param bot The bot's instance.
* @param sender The sender's nickname.
*/
public static void play(Mobibot bot, String sender)
diff --git a/src/main/java/net/thauvin/erik/mobibot/Weather.java b/src/main/java/net/thauvin/erik/mobibot/Weather.java
index af9eab7..105e770 100644
--- a/src/main/java/net/thauvin/erik/mobibot/Weather.java
+++ b/src/main/java/net/thauvin/erik/mobibot/Weather.java
@@ -42,7 +42,7 @@ import java.text.DecimalFormat;
import java.util.Date;
/**
- * Fetches the weather data from a specific station ID.
+ * Processes the {@link Commands#LOOKUP_CMD} command.
*
* @author Erik C. Thauvin
* @created Feb 7, 2004
@@ -81,9 +81,9 @@ public class Weather implements Runnable
private final boolean isPrivate;
/**
- * Creates a new Weather object.
+ * Creates a new {@link Weather} instance.
*
- * @param bot The bot.
+ * @param bot The bot's instance.
* @param sender The nick of the person who sent the message.
* @param station The station ID.
* @param isPrivate Set to true is the response should be send as a private message.
@@ -97,7 +97,7 @@ public class Weather implements Runnable
}
/**
- * Main processing method.
+ * Fetches the weather data from a specific station ID.
*/
public final void run()
{
diff --git a/src/main/java/net/thauvin/erik/mobibot/WorldTime.java b/src/main/java/net/thauvin/erik/mobibot/WorldTime.java
index e22514f..26eccfe 100644
--- a/src/main/java/net/thauvin/erik/mobibot/WorldTime.java
+++ b/src/main/java/net/thauvin/erik/mobibot/WorldTime.java
@@ -40,7 +40,7 @@ import java.util.TimeZone;
import java.util.TreeMap;
/**
- * Processes the {@link net.thauvin.erik.mobibot.Commands#TIME_CMD} command.
+ * The {@link Commands#TIME_CMD} command.
*
* @author Erik C. Thauvin
* @created 2014-04-27
@@ -65,7 +65,7 @@ public class WorldTime
new SimpleDateFormat("'The time is 'HH:mm' on 'EEEE, d MMMM yyyy' in '");
/**
- * Creates a new time object.
+ * Creates a new {@link WorldTime} instance.
*/
public WorldTime()
{
@@ -140,8 +140,9 @@ public class WorldTime
}
/**
- * Responds with the current time.
+ * Responds with the current time in the specified timezone/country.
*
+ * @param bot The bot instance.
* @param sender The nick of the person who sent the message.
* @param args The time command arguments.
* @param isPrivate Set to true is the response should be send as a private message.