summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-05-25 08:43:10 +0000
committerPaul Buetow <paul@buetow.org>2008-05-25 08:43:10 +0000
commit1a7bb4cc9ab0ae182fa7283462f44758ec24c6ce (patch)
tree7e865f187214f9e35a6c29be2ebe272d6bbb4cd5
parenta206697fbafb48a26706e58daf8542401d617fef (diff)
JavaDoc.
-rw-r--r--sources/core/VSMessage.java1
-rw-r--r--sources/core/VSTask.java76
-rw-r--r--sources/core/VSTaskManager.java25
3 files changed, 48 insertions, 54 deletions
diff --git a/sources/core/VSMessage.java b/sources/core/VSMessage.java
index a16d35b..2be91bf 100644
--- a/sources/core/VSMessage.java
+++ b/sources/core/VSMessage.java
@@ -8,7 +8,6 @@ import core.time.*;
import events.*;
import prefs.VSPrefs;
-// TODO: Auto-generated Javadoc
/**
* This class represents a message which is send from one process to another process in the simulation.
*/
diff --git a/sources/core/VSTask.java b/sources/core/VSTask.java
index 43d9cb5..8e6bd34 100644
--- a/sources/core/VSTask.java
+++ b/sources/core/VSTask.java
@@ -10,16 +10,18 @@ import events.internal.*;
import prefs.VSPrefs;
import protocols.VSProtocol;
-// TODO: Auto-generated Javadoc
/**
- * The Class VSTask.
+ * The Class VSTask. An object of this class represents a task to do or done.
+ * All tasks are managed by the task manager. There are local and global timed tasks.
+ * Local timed tasks are being fullfilled if the process' local time is reached.
+ * Global timed tasks are being fullfilled if the simulation's time is reached.
*/
public class VSTask implements Comparable {
- /** The Constant LOCAL. */
+ /** The Constant LOCAL. Used for the constructor if it's a local timed task. */
public final static boolean LOCAL = true;
- /** The Constant GLOBAL. */
+ /** The Constant GLOBAL. Used for the constructor if it's a global timed task. */
public final static boolean GLOBAL = false;
/** The task time. */
@@ -34,25 +36,25 @@ public class VSTask implements Comparable {
/** The prefs. */
private VSPrefs prefs;
- /** The is programmed. */
+ /** The task is programmed. The task will be still in the task manager after reset. */
private boolean isProgrammed;
- /** The is global timed. */
+ /** The task is global timed. If set to true, its local timed. */
private boolean isGlobalTimed;
- /** The task counter. */
+ /** The task counter. Needed for the unique task numbers. */
private static int taskCounter;
- /** The task num. */
+ /** The task number. */
private int taskNum;
/**
- * Instantiates a new vS task.
+ * Instantiates a new task.
*
* @param taskTime the task time
* @param process the process
* @param event the event
- * @param isLocal the is local
+ * @param isLocal the taks is local timed
*/
public VSTask(long taskTime, VSProcess process, VSEvent event, boolean isLocal) {
this.process = process;
@@ -75,45 +77,45 @@ public class VSTask implements Comparable {
/**
* Checks if is programmed.
*
- * @param isProgrammed the is programmed
+ * @param isProgrammed the task is programmed
*/
public void isProgrammed(boolean isProgrammed) {
this.isProgrammed = isProgrammed;
}
/**
- * Checks if is programmed.
+ * Checks if the task is programmed.
*
- * @return true, if is programmed
+ * @return true, if the task is programmed
*/
public boolean isProgrammed() {
return isProgrammed;
}
/**
- * Checks if is message receive event.
+ * Checks if the task is a message receive event.
*
- * @return true, if is message receive event
+ * @return true, if it is a message receive event
*/
public boolean isMessageReceiveEvent() {
return event instanceof MessageReceiveEvent;
}
/**
- * Checks if is process recover event.
+ * Checks if the task is a process recover event.
*
- * @return true, if is process recover event
+ * @return true, if it is a process recover event
*/
public boolean isProcessRecoverEvent() {
return event instanceof ProcessRecoverEvent;
}
/**
- * Checks if is protocol.
+ * Checks if the task belongs to the specified protocol object.
*
- * @param protocol the protocol
+ * @param protocol the protocol object to check against.
*
- * @return true, if is protocol
+ * @return true, if it's a task using the protocol object.
*/
public boolean isProtocol(VSProtocol protocol) {
if (event instanceof VSProtocol)
@@ -123,9 +125,9 @@ public class VSTask implements Comparable {
}
/**
- * Time over.
+ * Time over. The task's time is over.
*
- * @return true, if successful
+ * @return true, if it's over
*/
public boolean timeOver() {
if (isGlobalTimed)
@@ -135,37 +137,31 @@ public class VSTask implements Comparable {
}
/**
- * Equals.
+ * Checks if the task equals to another task.
*
- * @param task the task
+ * @param task the task to compare to
*
- * @return true, if successful
+ * @return true, if equal
*/
public boolean equals(VSTask task) {
return taskNum == task.getTaskNum();
- /*
- return event.equals(task.getEvent())
- && taskTime == task.getTaskTime()
- && isGlobalTimed == task.isGlobalTimed()
- && isProgrammed == task.isProgrammed;
- */
}
/**
- * Checks if is process.
+ * Checks if the event belongs to the specified process.
*
- * @param process the process
+ * @param process the process to check against
*
- * @return true, if is process
+ * @return true, if the event is using the process
*/
public boolean isProcess(VSProcess process) {
return this.process.equals(process);
}
/**
- * Checks if is global timed.
+ * Checks if the task is global timed.
*
- * @return true, if is global timed
+ * @return true, if the taks is global timed
*/
public boolean isGlobalTimed() {
return isGlobalTimed;
@@ -174,14 +170,14 @@ public class VSTask implements Comparable {
/**
* Gets the process.
*
- * @return the process
+ * @return the process of the event
*/
public VSProcess getProcess() {
return process;
}
/**
- * Run.
+ * Runs the task.
*/
public void run() {
if (event.getProcess() == null)
@@ -208,9 +204,9 @@ public class VSTask implements Comparable {
}
/**
- * Logg.
+ * Logg a message.
*
- * @param message the message
+ * @param message the message to logg
*/
private void logg(String message) {
process.logg(message);
diff --git a/sources/core/VSTaskManager.java b/sources/core/VSTaskManager.java
index 272922f..2bc11db 100644
--- a/sources/core/VSTaskManager.java
+++ b/sources/core/VSTaskManager.java
@@ -9,7 +9,6 @@ import java.util.*;
import prefs.*;
import utils.*;
-// TODO: Auto-generated Javadoc
/**
* The Class VSTaskManager.
*/
@@ -173,7 +172,7 @@ public class VSTaskManager {
}
/**
- * Reset.
+ * Resets the task manager.
*/
public synchronized void reset() {
PriorityQueue<VSTask> tmp = tasks;
@@ -201,9 +200,9 @@ public class VSTaskManager {
}
/**
- * Insert.
+ * Inserts a task. Only for internal usage. Use the add methods instead.
*
- * @param task the task
+ * @param task the task to insert
*/
private void insert(VSTask task) {
if (task.timeOver())
@@ -217,19 +216,19 @@ public class VSTaskManager {
}
/**
- * Adds the task.
+ * Adds a task.
*
- * @param task the task
+ * @param task the task to add
*/
public void addTask(VSTask task) {
addTask(task, VSTaskManager.ONLY_ONCE);
}
/**
- * Adds the task.
+ * Adds a task.
*
- * @param task the task
- * @param isProgrammed the is programmed
+ * @param task the task to add
+ * @param isProgrammed the task is programmed
*/
public synchronized void addTask(VSTask task, boolean isProgrammed) {
task.isProgrammed(isProgrammed);
@@ -237,9 +236,9 @@ public class VSTaskManager {
}
/**
- * Removes the task.
+ * Removes a task.
*
- * @param task the task
+ * @param task the task to remove
*
* @return true, if successful
*/
@@ -257,9 +256,9 @@ public class VSTaskManager {
}
/**
- * Removes the tasks of.
+ * Removes the tasks of the specified process.
*
- * @param process the process
+ * @param process the process to remove the tasks of
*/
public synchronized void removeTasksOf(VSProcess process) {
ArrayList<VSTask> removeThose = new ArrayList<VSTask>();