ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ernst de Haan <er...@jollem.com>
Subject Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs FixCRLF.java
Date Fri, 07 Jul 2000 12:50:24 GMT
Hi,

>        private int addcr;      // cr:  -1 => remove, 0 => asis, +1 => add
>        private int addtab;     // tab: -1 => remove, 0 => asis, +1 => add
>        private int ctrlz;      // eof: -1 => remove, 0 => asis, +1 => add
>   +    private int tablength = 8;  // length of tab in spaces

For failsafe/foolproof-ness, I suggest you check for `less than 0'
instead of checkign for `equals -1', and the opposite for 'equals +1'.
So it would become something like:

   private int addcr;      // cr:  <0 => remove, 0 => asis, >0 => add
   private int addtab;     // tab: <0 => remove, 0 => asis, >0 => add
   private int ctrlz;      // eof: <0 => remove, 0 => asis, >0 => add

In an initial version of the JDK 1.2 java.lang.Comparable interface, the
method `int compareTo(Object)' would return -1, 0 or +1 to indicate
less-than, equals, or greater than, but this has been changed to
negative, 0 and positive. This situation is slightly different, because
it is an interface to be implemented by `untrusted' people. But on the
other hand a lot of people lay their hands on the Ant source code, so
foolproof-ness is always a good thing :)

Note that this does not apply if more modes may be added in the future.


Ernst

Mime
View raw message