# HG changeset patch # User Paul Boddie # Date 1106441615 -3600 # Node ID 805aa0c63c2f953cffe075b371696f823905bd05 # Parent 446942e97f4354c74638a9e7d691b4cfc6a210e3 Changed the stylesheet and added licensing details. diff -r 446942e97f43 -r 805aa0c63c2f docs/index.html --- a/docs/index.html Sun Jan 23 01:53:35 2005 +0100 +++ b/docs/index.html Sun Jan 23 01:53:35 2005 +0100 @@ -29,76 +29,63 @@

You can run Java classes by finding one with a main method and executing it. Here's a comparison of a freshly prepared Java class being run in Python and in a Java virtual machine respectively:

- -

cd tests/

- -

javac Value.java

- -

runclass.py Value

- -

v.getValue() correct: 123
-v.getValue() correct: 456
-v.isPositive() correct: 1
-v.isPositive() correct: 0
-v.compare(-790) correct: -1
-v.compare(-788) correct: 1
-v.compare(-789) correct: 0
-v.getValue() == v2.getValue() correct: 0
-v2.add(-123) correct: 0
-v2.getValue() correct: 255

- -

java Value

- -

v.getValue() correct: 123
-v.getValue() correct: 456
-v.isPositive() correct: true
-v.isPositive() correct: false
-v.compare(-790) correct: -1
-v.compare(-788) correct: 1
-v.compare(-789) correct: 0
-v.getValue() == v2.getValue() correct: false
-v2.add(-123) correct: 0
-v2.getValue() correct: 255

+
cd tests/
+
javac Value.java
+
runclass.py Value
+
v.getValue() correct: 123
+v.getValue() correct: 456
+v.isPositive() correct: 1
+v.isPositive() correct: 0
+v.compare(-790) correct: -1
+v.compare(-788) correct: 1
+v.compare(-789) correct: 0
+v.getValue() == v2.getValue() correct: 0
+v2.add(-123) correct: 0
+v2.getValue() correct: 255
+
java Value
+
v.getValue() correct: 123
+v.getValue() correct: 456
+v.isPositive() correct: true
+v.isPositive() correct: false
+v.compare(-790) correct: -1
+v.compare(-788) correct: 1
+v.compare(-789) correct: 0
+v.getValue() == v2.getValue() correct: false
+v2.add(-123) correct: 0
+v2.getValue() correct: 255

The Slightly More Credible Example

It can be more interesting to get into Python's interactive mode and then start playing around with Java classes:

- -

Python 2.2.2 (#2, Jan 21 2005, 16:16:57)
-[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2
-Type "help", "copyright", "credits" or "license" for more information.

- -

import javaclass.classhook

- -

from __this__ import Value

- -

dir()

- -

['Value', '__builtins__', '__doc__', '__name__', -'javaclass']

- -

dir(Value)

- -

['__class__', '__delattr__', '__dict__', '__doc__', +

Python 2.2.2 (#2, Jan 21 2005, 16:16:57)
+[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2
+Type "help", "copyright", "credits" or "license" for more information.
+
import javaclass.classhook
+
from __this__ import Value
+
dir()
+
['Value', '__builtins__', '__doc__', '__name__',
+'javaclass']
+
dir(Value)
+
['__class__', '__delattr__', '__dict__', '__doc__',
 '__getattribute__', '__hash__', '__init__', '__init______I_', '__module__',
 '__new__', '__reduce__', '__repr__', '__setattr__', '__str__', '__weakref__',
 'add', 'add____I_', 'compare', 'compare____I_', 'getClass', 'getClass___',
 'getValue', 'getValue___', 'isPositive', 'isPositive___', 'main',
 'main___java__lang__String_array_', 'newValue', 'newValue___', 'setValue',
-'setValue____I_']

- -

v = Value(20050121)

- -

v.getValue()

+'setValue____I_']
+
v = Value(20050121)
+
v.getValue()
+
20050121
+
v.setValue(20050401)
+
v.getValue()
+
20050401
-

20050121

- -

v.setValue(20050401)

+

Copyright and Licence

-

v.getValue()

- -

20050401

+

The javaclass software is distributed under the terms of the GNU Lesser +General Public Licence (LGPL). See the file COPYING.txt in the +docs directory within the source code distribution.

Getting Started

diff -r 446942e97f43 -r 805aa0c63c2f docs/styles.css --- a/docs/styles.css Sun Jan 23 01:53:35 2005 +0100 +++ b/docs/styles.css Sun Jan 23 01:53:35 2005 +0100 @@ -1,77 +1,116 @@ -body { +.Selected { +background-color: silver; +color: black; +font-family: sans-serif; +} + +.Selected A:link { color: black; } +.Selected A:visited { color: black; } +.Selected A:active { color: black; } + +.Unselected { +background-color: gray; +color: black; +font-family: sans-serif; +} + +.Unselected A:link { color: black; } +.Unselected A:visited { color: black; } +.Unselected A:active { color: black; } + +.Main { vertical-align: top; } + +BODY { background-color: white; font-size: 12pt; } -h1 { +H1 { color: navy; font-family: sans-serif; font-size: 20pt; } -h2 { +H2 { color: navy; font-family: sans-serif; font-size: 18pt; } -h3 { +H3 { color: navy; font-family: sans-serif; font-size: 16pt; } -h4 { +H4 { color: navy; font-family: sans-serif; font-size: 15pt; } -h5 { +H5 { color: navy; font-family: sans-serif; font-size: 14pt; } -ul { +UL { list-style-type: disc; } -pre { -background-color: silver; +.MainHeading { color: black; +background-color: gray; +font-family: sans-serif; +font-size: 14pt; +font-weight: bold; +vertical-align: top; } -p.prompt { -font-family: fixed; +.SubHeading { +color: black; background-color: silver; -color: black; +font-family: sans-serif; +font-size: 14pt; +font-weight: bold; +vertical-align: top; } -p.prompt:before { -content: "$ "; +.CellHeading { +color: black; +background-color: silver; +font-family: sans-serif; +font-size: 12pt; +font-weight: bold; +vertical-align: top; } -p.result { -font-family: fixed; -background-color: white; -color: black; -margin-left: 1em; +.CellContent { +font-size: 12pt; +vertical-align: top; +} + +PRE.Python { +background-color: #e0e0e0; +width: 100%; +} + +.Submodule { +color: #ff0000 } -p.python-prompt { -font-family: fixed; -background-color: silver; -color: black; +PRE.Prompt { +background-color: #c0c0c0; +width: 100%; } -p.python-prompt:before { -content: ">>> "; +PRE.PromptRequest { +background-color: #b0d0b0; +width: 100%; } -p.python-result { -font-family: fixed; -background-color: white; -color: black; -margin-left: 2em; +PRE.PromptResponse { +background-color: #d0b0b0; +width: 100%; }