jastrachan | 28 Apr 09:22 2004
Picon

Re: bit manipulation in groovy

On 28 Apr 2004, at 07:17, Matt Quail wrote:
> I decided to have a first-look at Groovy trying to knock up a script I 
> needed.
>
> But I can't work out how to do AND, OR and XOR bit manipulation. This 
> program fails with various lexer/parser exceptions:
>
> Byte a = 3
> Integer b = 2
> c = a & b; println "${a} & ${b} = ${c}"
> c = a | b; println "${a} | ${b} = ${c}"
> c = a ^ b; println "${a} ^ ${b} = ${c}"
>
> I assume this is just "we haven't got to those operators yet"?

Yes we've not added these tokens to the parser just yet. You can access 
the APIs available on the number classes though...

c = a.and(b)
c = a.or(b)

We've not added xor yet though :(

James
-------
http://radio.weblogs.com/0112098/

Gmane