status
Class AStatusAlgoCmd<R,S extends AStatus,P>

java.lang.Object
  extended by status.AStatusAlgoCmd<R,S,P>
Type Parameters:
R - The return type of the algorithm.
S - The concrete type of the status host.
P - The type of the input vararg parameters
All Implemented Interfaces:
IExtVisitorCmd<R,java.lang.Class<? extends AStatus>,P,AStatus>, java.io.Serializable

public abstract class AStatusAlgoCmd<R,S extends AStatus,P>
extends java.lang.Object
implements IExtVisitorCmd<R,java.lang.Class<? extends AStatus>,P,AStatus>

Convenience class to simplify the code and to tighten the type checking on status processing code.

Author:
Stephen Wong (c) 2010
See Also:
Serialized Form

Field Summary
private static long serialVersionUID
           
 
Constructor Summary
AStatusAlgoCmd()
           
 
Method Summary
<T extends IExtVisitorHost<java.lang.Class<? extends AStatus>,? super AStatus>>
R
apply(java.lang.Class<? extends AStatus> index, T host, P... params)
          The actual method called by the host visitor when the associated case is invoked.
abstract  R apply(S host, P... params)
          Abstract method that actually performs the processing of the case.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

AStatusAlgoCmd

public AStatusAlgoCmd()
Method Detail

apply

public final <T extends IExtVisitorHost<java.lang.Class<? extends AStatus>,? super AStatus>> R apply(java.lang.Class<? extends AStatus> index,
                                                                                                     T host,
                                                                                                     P... params)
The actual method called by the host visitor when the associated case is invoked. This method simply forwards the call to the abstract apply method, performing an unchecked cast of the host to the required DataPacket type.

Specified by:
apply in interface IExtVisitorCmd<R,java.lang.Class<? extends AStatus>,P,AStatus>
Type Parameters:
T - The type of the host the is expected to call this method. T is restricted to be a subclass of IExtVisitorHost<I, ? super H>
Parameters:
index - The String object used to identify the host
host - The host calling the visitor
params - Vararg input parameters to be used for processing the host
Returns:
The result of this case.

apply

public abstract R apply(S host,
                        P... params)
Abstract method that actually performs the processing of the case. Here, the host is strongly typed to be the AStatus sub-type appropriate for the case.

Parameters:
host - The AStatus subclass host calling the visitor
params - Vararg input parameter to be used for processing the host
Returns:
The result of this case.