On 3/27/07, Will Glass-Husain <[EMAIL PROTECTED]> wrote:
Does this mean a decimal number is supported in an integer range?

yeah, it just takes the intValue().  i was a little surprised at this
at first, until i realized it basically makes it so that template
authors needn't care about the number's type.  numbers just work.  i
like that. :)

WILL

On 3/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Author: dlr
> Date: Tue Mar 27 16:07:08 2007
> New Revision: 523108
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=523108
> Log:
> * src/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java
>   (value): Support use of any sub-class of java.lang.Number as an end
>    of the integer values used to compose a range.
>
> Modified:
>     
velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java
>
> Modified: 
velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java
> URL: 
http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java?view=diff&rev=523108&r1=523107&r2=523108
> ==============================================================================
> --- 
velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java
 (original)
> +++ 
velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java
 Tue Mar 27 16:07:08 2007
> @@ -97,13 +97,13 @@
>           *  if not an Integer, not much we can do either
>           */
>
> -        if ( !( left instanceof Integer )  || !( right instanceof Integer ))
> +        if ( !( left instanceof Number )  || !( right instanceof Number ))
>          {
> -            log.error((!(left instanceof Integer) ? "Left" : "Right")
> +            log.error((!(left instanceof Number) ? "Left" : "Right")
>                             + " side of range operator is not a valid type. "
> -                           + "Currently only integers (1,2,3...) and Integer type 
is supported. "
> +                           + "Currently only integers (1,2,3...) and the 
Numbertype is supported. "
>                             + context.getCurrentTemplateName() + " [line " + 
getLine()
> -                           + ", column " + getColumn() + "]");
> +                           + ", column " + getColumn() + ']');
>
>              return null;
>          }
> @@ -113,8 +113,8 @@
>           *  get the two integer values of the ends of the range
>           */
>
> -        int l = ( (Integer) left ).intValue() ;
> -        int r = (  (Integer) right ).intValue();
> +        int l = ((Number) left).intValue() ;
> +        int r = ((Number) right).intValue();
>
>          /*
>           *  find out how many there are
>
>
>


--
Forio Business Simulations

Will Glass-Husain
[EMAIL PROTECTED]
www.forio.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to