You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Jon Scott Stevens <jo...@latchkey.com> on 2002/01/11 20:12:57 UTC
Re: cvs commit:
jakarta-velocity-tools/struts/src/java/org/apache/velocity/tools/struts
MathTool.java
on 1/11/02 3:08 AM, "sidler@apache.org" <si...@apache.org> 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
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs
commit:jakarta-velocity-tools/struts/src/java/org/apache/velocity/tools/strutsMathTool.java
Posted by Gabriel Sidler <si...@teamup.ch>.
Jon Scott Stevens wrote:
>
> on 1/11/02 1:26 PM, "Jon Scott Stevens" <jo...@latchkey.com> wrote:
>
> > on 1/11/02 1:09 PM, "Gabriel Sidler" <si...@teamup.ch> wrote:
> >
> >> 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
> >
> > Thanks for making me ask 3 times now.
> >
> > -jon
>
> I should also add that you are welcome to propose that we change the current
> conventions to whatever you want...especially since you have developer
> status now.
The conventions are fine. No need to change. I fixed MathTool.java
Gabe
--
Gabriel Sidler
Software Engineer, Eivycom GmbH, Zurich, Switzerland
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs
commit:jakarta-velocity-tools/struts/src/java/org/apache/velocity/tools/str
utsMathTool.java
Posted by Jon Scott Stevens <jo...@latchkey.com>.
on 1/11/02 1:26 PM, "Jon Scott Stevens" <jo...@latchkey.com> wrote:
> on 1/11/02 1:09 PM, "Gabriel Sidler" <si...@teamup.ch> wrote:
>
>> 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
>
> Thanks for making me ask 3 times now.
>
> -jon
I should also add that you are welcome to propose that we change the current
conventions to whatever you want...especially since you have developer
status now.
However, you are not allowed to make up and use your own conventions without
getting agreement from the committers on this project first.
In case you forgot, the documented conventions are here:
<http://jakarta.apache.org/velocity/code-standards.html>
Having said all of that, you will have a really hard time getting me to
agree to change the coding conventions to be the way that you suggest. Not
even the JLS (Java Language Spec) has anything close to your idea of
conventions. I suspect that the reason is that those conventions cannot be
automated. In other words, you can't run a style fixer on the current
version of MathTool and have it come out the way that you wrote it because
it would be very difficult to give it enough information to tell it that
certain code should be put into one line.
Lastly, you also broke the other rule of having 80 columns. For example...
public static final double pow (double base, double power) { return
java.lang.Math.pow(base, power); }
<http://java.sun.com/docs/codeconv/html/CodeConventions.doc3.html#313>
thanks,
-jon
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs
commit:jakarta-velocity-tools/struts/src/java/org/apache/velocity/tools/str
utsMathTool.java
Posted by Jon Scott Stevens <jo...@latchkey.com>.
on 1/11/02 1:09 PM, "Gabriel Sidler" <si...@teamup.ch> wrote:
> 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
Thanks for making me ask 3 times now.
-jon
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re:
cvscommit:jakarta-velocity-tools/struts/src/java/org/apache/velocity/tools/strutsMathTool.java
Posted by Gabriel Sidler <si...@teamup.ch>.
"Geir Magnusson Jr." wrote:
>
> On 1/11/02 4:09 PM, "Gabriel Sidler" <si...@teamup.ch> wrote:
> >
> > 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.
>
> It should conform.
One detail I noticed when scanning the convention again. It says:
"Below is a list of coding conventions that are specific to Turbine..."
Uff, that saved me... :-)
Gabe
--
Gabriel Sidler
Software Engineer, Eivycom GmbH, Zurich, Switzerland
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs
commit:jakarta-velocity-tools/struts/src/java/org/apache/velocity/tools/str
utsMathTool.java
Posted by "Geir Magnusson Jr." <ge...@earthlink.net>.
On 1/11/02 4:09 PM, "Gabriel Sidler" <si...@teamup.ch> wrote:
>
> 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.
It should conform.
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." - Benjamin Franklin
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs
commit:jakarta-velocity-tools/struts/src/java/org/apache/velocity/tools/strutsMathTool.java
Posted by Gabriel Sidler <si...@teamup.ch>.
Jon Scott Stevens wrote:
>
> on 1/11/02 3:08 AM, "sidler@apache.org" <si...@apache.org> 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: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
Gabriel Sidler
Software Engineer, Eivycom GmbH, Zurich, Switzerland
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>