On 20 kvě, 16:12, Leigh McRae <[email protected]> wrote:
> On 5/19/2010 11:49 PM, Xavier Ducrohet wrote:

> First the OP didn't talk about using a preprocessor for xml.  I would
> agree that that would be odd and there are better tools for that.  Still
> a preprocessor could be used to conditionally include a resource by id.  
> How about I give you some concrete examples and you can help me see the
> light?
>
> ----------------------------------------
> Example 1
> ----------------------------------------
> //#if BETA
>      if ( hasBetaExpired() )
>          System.exit( 0 )
> //#endif
> ----------------------------------------
> Example 2
> ----------------------------------------
> public final class Assert
> {
>         public static final void RIP( final String msg )
>         {
> //#if BETA
>                 sendReport( msg );
> //#endif
>                 System.exit( 0 );
>         }}
>
> ----------------------------------------
> Example 3
> ----------------------------------------
> public class Debug
> {
>         void Println( String msg )
>         {
> //#if !RELEASE          
>                 Log.d( TAG, msg );
> //#endif                
>         }}
>
> ----------------------------------------
> Example 4
> ----------------------------------------
> //#if PLATFORM_BLACKBERRY              
> //@     omega = (float)MathUtilities.acos( cosom );
> //#else              
>         omega = (float)java.lang.Math.acos( cosom );
> //#endif              
> ----------------------------------------
> Example 5
> ----------------------------------------
> public static final float VecToHeading( float x, float y )
> {
> //#if PLATFORM_BLACKBERRY
> //@     float    fAngle = ((float)Fixed32.atand2( (int)(x * 65536.0f), 
> (int)(y * 65536.0f) )) / 65536.0f;
> //#else
>         float    fAngle = ((float)Math.atan2( x, y )) * 
> 57.295779513082320876798154814105f;
> //#endif
>         if ( fAngle<  0.0f )
>                 return fAngle + 360.0f;
>
>          return fAngle;
>
> }

Leigh,

have you ever heard about design patterns? Eg. strategy IMHO can solve
all your requests.

Tom

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to