Jon Scott Stevens wrote:
> 
> on 1/11/02 3:08 AM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> 
> > +    public static final int pow (int base, int power) { return
> > (int)java.lang.Math.pow(base, power); }
> > +    public static final long pow (long base, long power) { return
> > (long)java.lang.Math.pow(base, power); }
> > +    public static final float pow (float base, float power) { return
> > (float)java.lang.Math.pow(base, power); }
> > +    public static final double pow (double base, double power) { return
> > java.lang.Math.pow(base, power); }
> > +
> 
> I thought you were going to fix the code formatting?
> 
> -jon

Jon,
MathTool has many very short and similar methods. I felt that in this very
special case the file is easier to maintain if the methods are formatted 
in the compact way shown below.
I know it's against the convention, but I believe conventions have to be 
applied with some commen sense. This is a very special case that warranted
an exception in my view. In general, I do support the conventions.

I don't want to waste time and bandwidth on this issues. If one single person
on this list feels that the standard bracket convention should also be applied 
in this specific case I am going to change the file and make it conform.

Gabe





public class MathTool implements ContextTool 
{
    // -------------------------------------------- Properties ----------------
    
    // a singleton
    private static final MathTool _instance = new MathTool();
    
    // -------------------------------------------- Public Utility Methods ----

    /** the value of PI, as defined by <code>java.lang.Math.PI</code> */
    public static final double PI = java.lang.Math.PI;
    public static final double pi() { return java.lang.Math.PI; }
    
    /**
     * @return the smaller of the specified number
     */
    public static final int min (int a, int b)          { return (a<b)?a:b; }
    public static final long min (long a, long b)       { return (a<b)?a:b; }
    public static final float min (float a, float b)    { return (a<b)?a:b; }
    public static final double min (double a, double b) { return (a<b)?a:b; }
    
    /**
     * @return the larger of the specified number
     */
    public static final int max (int a, int b)          { return (a>b)?a:b; }
    public static final long max (long a, long b)       { return (a>b)?a:b; }
    public static final float max (float a, float b)    { return (a>b)?a:b; }
    public static final double max (double a, double b) { return (a>b)?a:b; }
    
    /**
     * Creates a pseudo-random Integer between <code>start</code>
     * and <code>end</code>, inclusive
     */
    public static final int random (int start, int end)
    {
        return start+((int) (1000000.0*java.lang.Math.random()) % end);
    }
    
    /**
     * @return <code>base</code> raised to the specified <code>power</code>
     */
    public static final int pow (int base, int power) { return 
(int)java.lang.Math.pow(base, power); }
    public static final long pow (long base, long power) { return 
(long)java.lang.Math.pow(base, power); }
    public static final float pow (float base, float power) { return 
(float)java.lang.Math.pow(base, power); }
    public static final double pow (double base, double power) { return 
java.lang.Math.pow(base, power); }

    /**
     * @return the absolute value of the specified number
     */
    public static final int abs (int a)       { return java.lang.Math.abs (a); }
    public static final long abs (long a)     { return java.lang.Math.abs (a); }
    public static final float abs (float a)   { return java.lang.Math.abs (a); }
    public static final double abs (double a) { return java.lang.Math.abs (a); }
    
    /**
     * @return <code>a</code> modulo <code>b</code>
     */
    public static final int mod (int a, int b) { return a%b; }

    
    // -------------------------------------------- Constructors -------------
    
    /** default contsructor.  Does nothing */
    public MathTool () 
    {
    }

    // -------------------------------------------- ContextTool Methods -------

    /**
     * Tool initialization method.  The MathTool doesn't interact with the 
     * context, so the <code>context</code> parameter is ignored.
     */
    public Object init( ViewContext context)
    {
        return MathTool._instance;
    }

    /**
     * Perform necessary cleanup work
     */
    public void destroy(Object o) 
    {
    }

}




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

--
Gabriel Sidler
Software Engineer, Eivycom GmbH, Zurich, Switzerland

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

Reply via email to