You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by temp temp <mi...@yahoo.com> on 2006/07/31 23:19:03 UTC

how to read

How to read the following code ?
  
  boolean vIsForm = vWorkTypeId.equals(IFormflowWorkTypeIds.FORM);  
        String vWorkForwardName = MessageFormat.format("work={0}", new Object[] {vWorkAlias});
          String vForwardName = (aActionMapping.findForward(vWorkForwardName) == null)
              ? (vIsForm) ? "form" : "task"
              : vWorkForwardName;
  Thanks
  Miro
  
 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: how to read

Posted by Chris Cheshire <ch...@gmail.com>.
Miro, which part are you confused with? I am assuming the third line
as it uses nested tertiary operators (the ? : bit).

It could be written otherwise as:
String vForwardName = "";
if (aActionMapping.findForward(vWorkForwardName) == null) {
  if (visForm) {
    vForwardName = "form";
  }
  else {
    vForwardName = "task";
}
else {
  vForwardName = vWorkForwardName;
}

The ? : operator is used to specify what value to assign a variable
based upon a boolean condition.

ie

variable = condition ? value if true : value if false

This can be nested as above - it's more succint than using if/else
logic, but a little more obscure.

HTH

Chris

On 7/31/06, temp temp <mi...@yahoo.com> wrote:
> How to read the following code ?
>
>   boolean vIsForm = vWorkTypeId.equals(IFormflowWorkTypeIds.FORM);
>         String vWorkForwardName = MessageFormat.format("work={0}", new Object[] {vWorkAlias});
>           String vForwardName = (aActionMapping.findForward(vWorkForwardName) == null)
>               ? (vIsForm) ? "form" : "task"
>               : vWorkForwardName;
>   Thanks
>   Miro
>
>  __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: how to read

Posted by Michael Jouravlev <jm...@gmail.com>.
On 7/31/06, temp temp <mi...@yahoo.com> wrote:
> How to read the following code ?
>
>   boolean vIsForm = vWorkTypeId.equals(IFormflowWorkTypeIds.FORM);
>         String vWorkForwardName = MessageFormat.format("work={0}", new Object[] {vWorkAlias});
>           String vForwardName = (aActionMapping.findForward(vWorkForwardName) == null)
>               ? (vIsForm) ? "form" : "task"
>               : vWorkForwardName;
>   Thanks
>   Miro

http://marc.theaimsgroup.com/?l=struts-user&m=114375163618830&w=2

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org