You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Nicolas Melendez <nm...@getsense.com.ar> on 2009/08/18 16:58:55 UTC
Why FLAGS and bits operators are used in wicket Component Class?
Hi everybody, does anybody know why wicket uses FLAGS and bits
operator in Component Class.
for example:
in Component.java
line 650 :private int flags = FLAG_VISIBLE | FLAG_ESCAPE_MODEL_STRINGS
| FLAG_VERSIONED | FLAG_ENABLED |
FLAG_IS_RENDER_ALLOWED | FLAG_VISIBILITY_ALLOWED;
line 3456 : protected final boolean getFlag(final int flag)
{
return (flags & flag) != 0;
}
for those who don't know what & operator do: return 1, if the two
operators are 1, otherwise return 0
Are the because optimization?
i have no experience doing frameworks, can someone with experience tell me why?
Thank You!
NM
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Why FLAGS and bits operators are used in wicket Component Class?
Posted by Igor Vaynberg <ig...@gmail.com>.
yes, it is an optimization to save space.
-igor
On Tue, Aug 18, 2009 at 7:58 AM, Nicolas
Melendez<nm...@getsense.com.ar> wrote:
> Hi everybody, does anybody know why wicket uses FLAGS and bits
> operator in Component Class.
> for example:
> in Component.java
>
> line 650 :private int flags = FLAG_VISIBLE | FLAG_ESCAPE_MODEL_STRINGS
> | FLAG_VERSIONED | FLAG_ENABLED |
> FLAG_IS_RENDER_ALLOWED | FLAG_VISIBILITY_ALLOWED;
>
>
> line 3456 : protected final boolean getFlag(final int flag)
> {
> return (flags & flag) != 0;
> }
>
> for those who don't know what & operator do: return 1, if the two
> operators are 1, otherwise return 0
>
> Are the because optimization?
> i have no experience doing frameworks, can someone with experience tell me why?
> Thank You!
> NM
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org