Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

arch.task
Class JXTask  view JXTask download JXTask.java

java.lang.Object
  extended byarch.task.JXTask
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
JunkTask, LinuxTask, MothTask

public abstract class JXTask
extends java.lang.Object
implements java.io.Serializable

JXTask represents a task that the requester wants a specific module to do on its behalf. A task here is defined as a service that is provided by a module through JUNK. It defines the main (minimum) information of what service is requested by the client. It is the parent class of all custom user defined requests. All service request to JUNK must therefore be a subclass of it or in other words this class was designed for inheritance. The contract both explicitly and implicitly defined for all of its subclasses MUST be adhered to strictly, in order to assure JD4X system compliance. Note that its subclass MUST be of an immutable type, else arbitrarily errors might occur while making a request with any given task in a multi-threaded environment.

Since:
JD4X 1.0
Version:
0.1, 15/05/2002

Field Summary
private  java.lang.Object description
          Defines the task description represented by the id.
private  int hValue
          Cached hash value
private  int taskID
          Defines the requested service of the client.
 
Constructor Summary
protected JXTask()
          Only a subclass is allowed to create an instance of it.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare two tasks for equality.
 java.lang.Object getTaskDescription()
          Get the module specific, task description object associated with its task id.
 int getTaskID()
          Get the task ID that represent this task or service.
 int hashCode()
          The hash value is computed using the method proposed by Joshua Bloch in Effective Java.
protected  void setTaskDescription(java.lang.Object obj)
          Set the new module specific, task description object.
protected  void setTaskID(int newID)
          Set the new task or service ID.
 java.lang.String toString()
          A string representation of this task.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

taskID

private int taskID
Defines the requested service of the client.


description

private java.lang.Object description
Defines the task description represented by the id.


hValue

private int hValue
Cached hash value

Constructor Detail

JXTask

protected JXTask()
Only a subclass is allowed to create an instance of it. This class is designed for inheritance and no direct instantiation is allowed. It also initializes the task to an invalid state. This constructor is provided for future serialization of subclasses.

Method Detail

equals

public boolean equals(java.lang.Object obj)
Compare two tasks for equality. Two tasks are considered equal if their description objects and task id are equal. This method merely calls the description object's equals method and assumes that the description object has its own way of determining equality as well as comparing their task id for equality.


getTaskDescription

public final java.lang.Object getTaskDescription()
Get the module specific, task description object associated with its task id.


getTaskID

public final int getTaskID()
Get the task ID that represent this task or service.


hashCode

public int hashCode()
The hash value is computed using the method proposed by Joshua Bloch in Effective Java. Because it is unlikely that anyone will attempt to extendsively use the hash function due to the nature of tasks this simple function should be sufficient for most use.


setTaskID

protected final void setTaskID(int newID)
Set the new task or service ID.


setTaskDescription

protected final void setTaskDescription(java.lang.Object obj)
Set the new module specific, task description object.


toString

public java.lang.String toString()
A string representation of this task. This method merely provides information on the task id and the description's toString method assuming that the description has a correct string representation of the desired task to be done. The exact details of the representation are unspecified and subject to change, but the following maybe regarded as typical: Task: 2, create new Process. It can be interpreted as task id = 2, description = create new Process.