On 12/4/01 7:12 PM, "Will Hartung" <[EMAIL PROTECTED]> wrote:
> I'm adding (changing) Velocity so that it will support Comparable objects
> for >, >= , ==, <= , < rather than simply Integers and objects of the same
> class.
>
> Is this some great crime? Would this be of interest to Others?
A heineous crime that is of interest to others indeed... :)
>
> I'm going to do this anyway, and if anyone else would like it, they can
> e-mail me.
>
> I'm doing it because my internal scripting language has a runtime-typed
> value, and I want to be able to use the comparison operators as well as
> something like "contains()" on the values passed to Velocity.
>
> Currently if you do $var.contains("thing") and var is a string, Velocity
> seems to silently ignore the error and simply continues.
>
> My code replaces the runtime/parser/node/AST[EQ, GT, GE, LT, LE]Node.java
> and I added a Comparator class with static methods in util.
>
> Comparator can be extended for "special cases" if we like. Currently it
> casts the Object parameters to Comparable and does a left.compareTo(right).
>
> It'll throw a ClassCastException as appropriate, the Node classes catch the
> exception and log the error.
>
> And if no one is interested, I'm curious as to why it's a problem.
Check the archives first. There are long threads on this :)
>
> Thanx!
>
> Best Regards,
>
> Will Hartung
> ([EMAIL PROTECTED])
>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
--
Geir Magnusson Jr. [EMAIL PROTECTED]
System and Software Consulting
You're going to end up getting pissed at your software
anyway, so you might as well not pay for it. Try Open Source.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>