logo       

RE: Delagating variable lookup.: msg#00180

lang.groovy.user

Subject: RE: Delagating variable lookup.

That's called self-support :-)
Your idea to override Binding.getVariable() is certainly the best solution.

--
Guillaume Laforge
http://glaforge.free.fr/weblog


-----Message d'origine-----
De : Edward Povazan [mailto:epovazan-EynCeXvFgoheoWH0uzbU5w@xxxxxxxxxxxxxxxx]
Envoyé : mercredi 24 novembre 2004 18:39
À : user-i9PBDF1N6cxnkHa44VUL00B+6BGkLq7r@xxxxxxxxxxxxxxxx
Objet : Re: [groovy-user] Delagating variable lookup.


Nevermind, I hate when I answer my own question right after sending a
message :)
I overrode Binding.getVariable() to get what I need.
-Ed

----- Original Message -----
From: "Edward Povazan" <epovazan-EynCeXvFgoheoWH0uzbU5w@xxxxxxxxxxxxxxxx>
To: <groovy-user-81qHHgoATdGxIXFVlbCvtR2eb7JE58TQ@xxxxxxxxxxxxxxxx>
Sent: Tuesday, November 23, 2004 2:09 PM
Subject: [groovy-user] Delagating variable lookup.


> Hello,
>
> Since I program on the client side, I decided to use groovy on more than
the
> toys I have been using it with. So I want to create a little swing
> spreadsheet. I also want the formulas in cells to be groovy scripts.
> How would I do something like:
> sum(A1..A10)
> when A1 is not a variable but rather a name of a cell. Cells will be
stored
> in a sparse array backed by a map.
> With Jython I can create a custom dictionary and check if the variable
name
> looks like a cell name, and find the correct cell. It is a hack, but it is
> possible.
> Is there some sort of way to delegate variable lookup to my code in
Groovy?
> Otherwise I will need to do things like sum("A1..A10") and parse the range
> myself, which is not as nice.
>
> Thanks
> -Ed
>
>




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise