You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by gschen <gs...@gmail.com> on 2012/11/30 06:42:07 UTC

something about mina statemachine

hi,

I recently read the source code about mina statemachine, and I confused
about one issue described below.
------------------------------------------------------------
mina-statemachine version: 2.0.6

org.apache.mina.statemachine.context.SingletonStateContextLookup
public StateContext lookup(Object[] eventArgs) {
return context;
}
-------------------------------------------------------------
when you invoke this method, you should supply an object array as the
method arguments, but in the method body, you do not use the eventArgs
anytime. Does this coding have some hidden meaning or other considerations?

My english is not good, I hope I have described clear the issue .

Thank you.

justin

Re: something about mina statemachine

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 11/30/12 6:42 AM, gschen a écrit :
> hi,
>
> I recently read the source code about mina statemachine, and I confused
> about one issue described below.
> ------------------------------------------------------------
> mina-statemachine version: 2.0.6
>
> org.apache.mina.statemachine.context.SingletonStateContextLookup
> public StateContext lookup(Object[] eventArgs) {
> return context;
> }
> -------------------------------------------------------------
> when you invoke this method, you should supply an object array as the
> method arguments, but in the method body, you do not use the eventArgs
> anytime. Does this coding have some hidden meaning or other considerations?
>
> My english is not good, I hope I have described clear the issue .

Don't worry too much. Most of us aren't english natives anyway :)

I think that this method does nothing with the array. It's just
necessary to pass such an array in order to comply with the
StateContextLookup interface :

public interface StateContextLookup {
    /**
     * Searches the arguments from an {@link Event} and returns a
     * {@link StateContext} if any of the arguments holds one. NOTE!
This method
     * must create a new {@link StateContext} if a compatible object is in
     * the arguments and the next time that same object is passed to this
     * method the same {@link StateContext} should be returned.
     */
    StateContext lookup(Object[] eventArgs);
}

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com