Mind attaching this to the issue in patch format?  `cvs diff -u
file.java > patch`.  Thanks!

"apache-velocity-dev-subscriber" <[EMAIL PROTECTED]> writes:

> // The following quick fix may solve bug 14711. However it is not tested thoroughly 
>nor we are sure if it fits in well.
> 
>     private Twonk calcDistance( Object[] set, Class[] base )
>     {
>         if ( set.length != base.length)
>             return null;
>             
>         Twonk twonk = new Twonk( set.length );
> 
>         for (int i = 0; i < set.length; i++)
>         {
>             /* 
>              * can I get from here to there?
>              */
>              
>             Class setclass = set[i].getClass();
>             
>             Class tmpclass = base[i];
> 
>                       if (tmpclass.isPrimitive())
>                       {
>                               if (tmpclass.equals(Boolean.TYPE))
>                                       tmpclass = java.lang.Boolean.class;
>                               else if (tmpclass.equals(Byte.TYPE))
>                                       tmpclass = java.lang.Byte.class;
>                               else if (tmpclass.equals(Character.TYPE))
>                                       tmpclass = java.lang.Character.class;
>                               else if (tmpclass.equals(Double.TYPE))
>                                       tmpclass = java.lang.Double.class;
>                               else if (tmpclass.equals(Float.TYPE))
>                                       tmpclass = java.lang.Float.class;
>                               else if (tmpclass.equals(Integer.TYPE))
>                                       tmpclass = java.lang.Integer.class;
>                               else if (tmpclass.equals(Long.TYPE))
>                                       tmpclass = java.lang.Long.class;
>                               else if (tmpclass.equals(Short.TYPE))
>                                       tmpclass = java.lang.Short.class;
>                       }
> 
>             if ( !tmpclass.isAssignableFrom( set[i].getClass() ))
>                 return null;
>     
>             /*
>              * ok, I can.  How many steps?
>              */
>            
>             Class c = setclass;
>                       
>             while( c != null)
>             {      
>                 /*
>                  * is this a valid step?
>                  */
>                  
>                 if ( !tmpclass.isAssignableFrom( c ) )
>                 {      
>                     /*
>                      *  it stopped being assignable - therefore we are looking at
>                      *  an interface as our target, so move back one step
>                      *  from the distance as the stop wasn't valid
>                      */
>                     break;
>                 }
>                 
>                 if(  tmpclass.equals( c ) )
>                 {
>                     /*
>                      *  we are equal, so no need to move forward
>                      */
>                      
>                     break;
>                 }
> 
>                 c = c.getSuperclass();
>                 twonk.distance++;
>                 twonk.vec[i]++;
>             }
>          }
>                 
>         return twonk;
>     }
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 

-- 

Daniel Rall <[EMAIL PROTECTED]>

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

Reply via email to