java.lang.Comparable?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

java.lang.Comparable?

mcbrides
I just grabbed the decimal package from Hursley. Compiling decdemo.nrx yeilds:

----------

NetRexx portable processor, version 1.144  [21 Oct 1998]
Copyright (c) IBM Corporation, 1998.  All rights reserved.
Translating 'decdemo.nrx' [Pass 0]
  2 classes imported from 'com.ibm.math'
  Loaded public class 'java.lang.Object'
Translating 'decdemo.nrx' [Pass 1]
Program decdemo.nrx [pass 2, over 18 clauses]
      Loaded public class 'netrexx.lang.Rexx'
      Loaded public abstract class 'java.lang.Number'
      Loaded public class 'com.ibm.math.BigDecimal'
      Loaded public final class 'java.lang.String'
      Loaded public final class 'java.lang.System'
      Loaded public abstract class 'java.io.OutputStream'
      Loaded public class 'java.io.FilterOutputStream'
      Loaded public class 'java.io.PrintStream'
Compiling: '-nowarn -classpath d:\java11\lib\classes.zip;d:\netrexx\lib\NetRexxC.zip;d:\java\decimal\decimal.jar;.;.. D:\java\decimal\decdemo.java'
D:\java\decimal\decdemo.java:16: Class java.lang.Comparable not found in void main(java.lang.String[]).
   s=d.toString();
               ^
1 error
Compilation of 'decdemo.nrx' failed [javac failed]
Translate time:  8.1s
    javac time:  2.2s
    Total time: 10.3s

JAVA.EXE full version "JDK 1.1.7A IBM build o117-19981120 (JIT enabled: javax)"

----------

Uh... where is java.lang.Comparable? Not in my jdk117.

Using the decimal1.jar of the decimal 0.94 package results in correct
operations. You guys using the jdk112 beta, I would assume java.lang.Comparable
to belong there?

--

/--------------------\
| Jerry McBride      |
| [hidden email] |
\--------------------/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: java.lang.Comparable?

Dr Tony Dahlman-2
It must be somehow "unapproved", but a clear hint is
provided:

>> decfaq.html wrote:
>The new class can be used with Java 1.1 if the java.lang.Comparable
>interface is available in the Java 1.1 environment
>   (for example, if it is copied from a Java 1.2 environment, or
>    re-created). The Comparable interface is simply:
   >
   >      package java.lang;
   >      public interface Comparable {
   >        public abstract int compareTo(Object anObject);
   >      }
   
So it sounds like one could: (a) download the 1.2 version from
Sun (though still in beta) and copy class Comparable from package
java.lang, or (b) cut and paste the above, compile this do-nothing
abstract class, and add the resulting Comparable.class to, for
example ;), the /java/lang/ directory of classes.zip.

Okay, I haven't done it yet.  Has someone here tried it?  Does option
(b) mean we can't sort BigDecimals?  Is that all there is to it?

- Tony Dahlman

Surgery, Surgeons and You <http://www.jps.net/adahlman/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: java.lang.Comparable?

mcbrides
>It must be somehow "unapproved", but a clear hint is provided:
>
>>> decfaq.html wrote:

Yup. There it is! I read as far as the installation instructions and stopped
there. Missed the WHOLE portion that mentions JDK1.2. My misstake.

>So it sounds like one could: (a) download the 1.2 version from
>Sun (though still in beta) and copy class Comparable from package
>java.lang, or (b) cut and paste the above, compile this do-nothing
>abstract class, and add the resulting Comparable.class to, for
>example ;), the /java/lang/ directory of classes.zip.
>

Yup. But I'll wait on an OS/2 port of 1.2, before I go though the
"hoops of fire"... <G>

>Okay, I haven't done it yet.  Has someone here tried it?  Does option
>(b) mean we can't sort BigDecimals?  Is that all there is to it?
>

I haven't, but the IBM version of BigDecimal is lightyears better than what is
provided in the SUN package. Thanks, BigBlue.

Hmmm... Since I have your attention. I'm begining an "OS2 INSTALLATION FAQ" on
my personal website at www.erols.com/mcbrides and if anyone has any obscure
methods of "getting things done", feel free to email me.

Thanks,


--

/--------------------\
| Jerry McBride      |
| [hidden email] |
\--------------------/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: java.lang.Comparable?

Dr Tony Dahlman-2
In reply to this post by mcbrides
Answering my own question ;)  And sorry, this has drifted a bit
off topic.

You can get the improved BigDecimal class working in JDK 1.1 very easily,
maybe 15 minutes, by:

1. Compile the java.lang.Comparable source code and put the resulting
Comparable.class in a subdirectory named ....java/lang.

2. Keep a backup of classes.zip from Java11/lib, then use a zip utility
to add java/lang/Comparable.class to classes.zip.  (First, stop any
running java programs, servlets, browsers. )  Just keep the java/lang
part of its path.

3. Put decimal.jar (the com.ibm.math.* files) explicitly in your
classpath, and you're done:
   SET CLASSPATH=%classpath%;f:\java11\lib\decimal.jar

(This is what to do with OS/2, which is at JDK 1.1.7 general availability
as of 25 Nov 98.)

As for performance, some code I had written does internationalized
floating point currency conversions, one class uses primitive double
and the other uses BigDecimal.  So now there are two BigDecimal
versions and the com.ibm.math.BigDecimal class is *definitely* way
faster:

1,000 iterations of some conversions to dollars and French francs:
   * Using double..............................1.596 sec
   * Using standard BigDecimal.................4.409 sec
   * Using com.ibm.math.BigDecimal.............2.930 sec

Since Locale and NumberFormat objects are being created with each loop,
not just BigDecimal objects, you can see that the math code has been
accelerated at least 5-fold by the proposed new BigDecimal class.

My currency conversion & formatting classes and docs are available at:
  http://www.jps.net/adahlman/programs/Programs.html#BigCurrencyDecimal

- Tony Dahlman

Surgery, Surgeons and You <http://www.jps.net/adahlman/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>