Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a712ed2

Browse files
committed
Fix for 4.2 Jmol ArrayList and Enum
overstepped on trying to optimize SearchAndExecuteMethod.
1 parent ec5cf1f commit a712ed2

File tree

10 files changed

+18
-16
lines changed

10 files changed

+18
-16
lines changed
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20240301123437
1+
20240316183332
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20240301123437
1+
20240316183332
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="src" path="src"/>
3+
<classpathentry kind="src" path="src_4.2"/>
44
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
55
<classpathentry kind="output" path="bin"/>
66
</classpath>
Binary file not shown.

sources/net.sf.j2s.java.core/site-resources_4.2/jsmol/js/j2sjmol.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
// https://github.com/BobHanson/java2script/raw/master/sources/net.sf.j2s.java.core/site-resources_4.2/jsmol/js/j2sjmol.js
77

8+
// BH 2024.03.18 messed up Enum and ArrayList
89
// BH 2024.03.03 fixes new Clazz.exceptionOf(e,"NullPointerException") not working
910

1011
LoadClazz = function() {
@@ -1526,7 +1527,7 @@ Clazz.instantialize = function(objThis, args) {
15261527
args = argsClone;
15271528
}
15281529

1529-
var c = objThis.construct;
1530+
var c = objThis.construct; // the actual constructor Xxx() {...}
15301531
if (c) {
15311532
if (!objThis.con$truct) { // no need to init fields
15321533
c.apply (objThis, args);
@@ -2115,11 +2116,13 @@ Clazz.cloneFinals = function(){
21152116
Clazz.defineEnumConstant = function(clazzEnum, enumName, enumOrdinal, initialParams, clazzEnumExt) {
21162117
var o = (clazzEnumExt ? new clazzEnumExt() : new clazzEnum());
21172118
// BH avoids unnecessary calls to SAEM
2118-
o.$name = enumName;
2119-
o.$ordinal = enumOrdinal;
2120-
//Clazz.superConstructor (o, clazzEnum, [enumName, enumOrdinal]);
2121-
if (initialParams && initialParams.length)
2122-
o.construct.apply (o, initialParams);
2119+
if (initialParams && initialParams.length) {
2120+
o.constructor.apply (o, initialParams);
2121+
// Clazz.superConstructor (o, clazzEnum, [enumName, enumOrdinal]);
2122+
// } else {
2123+
o.$name = enumName;
2124+
o.$ordinal = enumOrdinal;
2125+
// }
21232126
clazzEnum[enumName] = o;
21242127
clazzEnum.prototype[enumName] = o;
21252128
if (!clazzEnum["$ values"]) { // BH added

sources/net.sf.j2s.java.core/src/javajs/util/CU.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public static String toCSSString(GenericColor c) {
3434
}
3535

3636
private final static String[] colorNames = {
37+
"contrast", // fedcba
3738
"black", // 000000
3839
"pewhite", // ffffff
3940
"pecyan", // 00ffff
@@ -203,6 +204,7 @@ public static String toCSSString(GenericColor c) {
203204

204205
private final static int[] colorArgbs = {
205206
//#FFFFC3 hover
207+
0xFFfedcba, // CONTRAST (colix = 3)
206208
0xFF000000, // black
207209
// plus the PE chain colors
208210
0xFFffffff, // pewhite
@@ -460,7 +462,7 @@ public static int colorPtToFFRGB(T3 pt) {
460462
return colorTriadToFFRGB(pt.x, pt.y, pt.z);
461463
}
462464

463-
public static void toRGB3f(int c, double[] f) {
465+
public static void toRGB3(int c, double[] f) {
464466
f[0] = ((c >> 16) & 0xFF) / 255f; // red
465467
f[1] = ((c >> 8) & 0xFF) / 255f;
466468
f[2] = (c & 0xFF) / 255f;

sources/net.sf.j2s.java.core/src/javajs/util/M34d.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ protected void mul33(double x) {
350350
m22 *= x;
351351
}
352352

353-
protected void transpose33() {
353+
public void transpose33() {
354354
double tmp = m01;
355355
m01 = m10;
356356
m10 = tmp;

sources/net.sf.j2s.java.core/src_4.2/java/util/ArrayList.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,13 @@ public class ArrayList<E> extends AbstractList<E> implements List<E>, Cloneable,
4545
private transient E[] array;
4646

4747
/**
48-
* @j2sIgnore
49-
*
5048
* Constructs a new instance of ArrayList with zero capacity.
5149
*/
5250
public ArrayList() {
53-
this(0);
51+
setCapacity(0);
5452
}
5553

5654
/**
57-
* @j2sIgnore
5855
* Constructs a new instance of ArrayList with the specified capacity.
5956
*
6057
* @param capacity
@@ -690,7 +687,7 @@ public <T> T[] toArray(T[] contents) {
690687
/**
691688
* @j2sNative
692689
*
693-
* return this.array.slice(firstIndex, firstIndex + size);
690+
* return this.array.slice(this.firstIndex, this.firstIndex + size);
694691
*/
695692
{
696693
return null;

0 commit comments

Comments
 (0)