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

Skip to content

Hanson1 #221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified sources/net.sf.j2s.core/dist/swingjs/SwingJS-site.zip
Binary file not shown.
1 change: 1 addition & 0 deletions sources/net.sf.j2s.core/dist/swingjs/differences.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
java2script/SwingJS Notes
=========================

updated 3/11/2023 -- adds support for Java Regex Matcher.start/end(groupID) and .start/end(groupName)
updated 12/31/2020 -- full support for 64-bit long
updated 12/6/2020 -- note about restrictions on long, including BitSet and Scanner
updated 3/21/2020 -- adds note about HashMap, Hashtable, and HashSet iterator ordering
Expand Down
Binary file modified sources/net.sf.j2s.core/dist/swingjs/net.sf.j2s.core.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20230311212845
20230831104534
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.3.1/SwingJS-site.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
java2script/SwingJS Notes
=========================

updated 3/11/2023 -- adds support for Java Regex Matcher.start/end(groupID) and .start/end(groupName)
updated 12/31/2020 -- full support for 64-bit long
updated 12/6/2020 -- note about restrictions on long, including BitSet and Scanner
updated 3/21/2020 -- adds note about HashMap, Hashtable, and HashSet iterator ordering
Expand Down
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.3.1/net.sf.j2s.core.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/ver/3.3.1/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20230311212845
20230831104534
3 changes: 2 additions & 1 deletion sources/net.sf.j2s.core/src/net/sf/j2s/core/CorePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ public class CorePlugin extends Plugin {
* "net.sf.j2s.core.jar" not "net.sf.j2s.core.3.2.5"
*
*/
public static String VERSION = "3.3.1-v6";
public static String VERSION = "3.3.1-v7";

// if you change the x.x.x number, be sure to also indicate that in
// j2sApplet.js and also (Bob only) update.bat, update-clean.bat

// BH 2023.03.29 -- 3.3.1-v7 fixes outer static method call from within lambda expression.
// BH 2023.02.09 -- 3.3.1.v6 fixes j2s.excluded.paths needing /src/xxxx
// BH 2022.06.27 -- 3.3.1-v5 fixes missing method annotations
// BH 2022.01.17 -- 3.3.1-v4 fixes default interface methods referencing their own static fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@
// TODO: superclass inheritance for JAXB XmlAccessorType
// TODO: Transpiler bug allows static String name, but JavaScript function().name is read-only and will be "clazz"

//BH 2023.03.29 -- 3.3.1-v7 fixes outer static method call from within lambda expression.
//BH 2023.02.09 -- 3.3.1.v6 fixes j2s.excluded.paths needing /src/xxxx
//BH 2022.06.27 -- 3.3.1-v5 fixes missing method annotations
//BH 2022.01.17 -- 3.3.1-v4 fixes default interface methods referencing their own static fields
//BH 2021.01.14 -- 3.3.1-v3 fixes missing finals for nested () -> {...}
//BH 2021.01.03 -- 3.3.1-v2 adds @j2sAsync adds async for function - experimental
Expand Down Expand Up @@ -1578,11 +1581,16 @@ private boolean addMethodInvocation(SimpleName javaQualifier, List<?> arguments,
String privateVar = (isPrivateAndNotStatic ? getPrivateVar(declaringClass, false) : null);
boolean doLogMethodCalled = (!isPrivate && global_htMethodsCalled != null);
boolean needBname = (

!isStatic && lambdaArity < 0 && (expression == null
!isStatic
&& (lambdaArity < 0
&& (expression == null
? !areEqual(declaringClass, class_typeBinding)
&& !class_typeBinding.isAssignmentCompatible(declaringClass)
: expression instanceof ThisExpression && ((ThisExpression) expression).getQualifier() != null) || class_localType == LAMBDA_EXPRESSION);
: expression instanceof ThisExpression
&& ((ThisExpression) expression).getQualifier() != null)
|| class_localType == LAMBDA_EXPRESSION)
);

String bname = (needBname ? getThisRefOrSyntheticReference(javaQualifier, declaringClass, null) : null);
// add the qualifier
int pt = buffer.length();
Expand Down Expand Up @@ -4879,7 +4887,7 @@ private void addQualifiedNameForBinding(IVariableBinding varBinding, boolean isS
*
* For general fields, this will be "this.".
*
* For fields in outer classes, we need a synthetic references,
* For nonstatic fields in outer classes, we need a synthetic references,
* this.b$[className] that points to the outer object, which may be one or more
* levels higher than this one.
*
Expand Down
7 changes: 7 additions & 0 deletions sources/net.sf.j2s.java.core/_j2sheadlessclasslist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
java/lang/Class.js
java/lang/Runtime.js
java/lang/Shutdown.js
java/lang/Thread.js
java/lang/ThreadGroup.js
javajs/util/JSThread.js
swingjs/JSThreadGroup.js
53 changes: 53 additions & 0 deletions sources/net.sf.j2s.java.core/build-core-headless.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<project name="JSmol" default="toJs" basedir=".">

<property name="site.path" value="site/swingjs" />

<target name="toJs" id="toJs">


<property name="site.dir" value="site" />
<property name="j2s.dir" value="${site.dir}/swingjs/j2s" />
<!-- make core files -->

<echo>creating and compressing core files - warnings are OK; "does not exist" is trouble</echo>

<loadresource property="coreclasses">
<file file="_j2sheadlessclasslist.txt"/>
</loadresource>

<antcall target="call-core">
<param name="call-core.name" value="swingjsheadless" />
<param name="call-core.list" value="
${coreclasses}
" />
</antcall>


</target>


<target name="call-core" id="call-core">
<echo>......Creating core${call-core.name}.js</echo>
<concat destfile="${site.path}/js/core/tmp.js" fixlastline="yes">
<filelist dir="${site.path}/j2s" files="${call-core.list}" />
</concat>

<replace dir="${site.path}/js/core" includes="tmp.js" token="Clazz." value="Clazz_"/>
<replace dir="${site.path}/js/core" includes="tmp.js" token="Clazz__" value="Clazz._"/>
<echo>......Generating ${site.path}/j2s/core/core${call-core.name}.js</echo>
<concat destfile="${site.path}/j2s/core/core${call-core.name}.js"><filelist dir="${site.path}/js" files="
core/coretop2.js
core/tmp.js
core/corebottom2.js
" />
</concat>
<echo>......Generating ${site.path}/j2s/core/core${call-core.name}.z.js</echo>
<java jar="jars/closure_compiler.jar" fork="true" dir="${site.path}/j2s/core" failonerror="false">
<arg line="--js core${call-core.name}.js --js_output_file core${call-core.name}.z.js" />
</java>
<delete quiet="true" file="${site.path}/js/core/tmp.js" />
</target>



</project>
Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
1 change: 1 addition & 0 deletions sources/net.sf.j2s.java.core/dist/differences.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
java2script/SwingJS Notes
=========================

updated 3/11/2023 -- adds support for Java Regex Matcher.start/end(groupID) and .start/end(groupName)
updated 12/31/2020 -- full support for 64-bit long
updated 12/6/2020 -- note about restrictions on long, including BitSet and Scanner
updated 3/21/2020 -- adds note about HashMap, Hashtable, and HashSet iterator ordering
Expand Down
1 change: 1 addition & 0 deletions sources/net.sf.j2s.java.core/doc/Differences.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
java2script/SwingJS Notes
=========================

updated 3/11/2023 -- adds support for Java Regex Matcher.start/end(groupID) and .start/end(groupName)
updated 12/31/2020 -- full support for 64-bit long
updated 12/6/2020 -- note about restrictions on long, including BitSet and Scanner
updated 3/21/2020 -- adds note about HashMap, Hashtable, and HashSet iterator ordering
Expand Down
1 change: 1 addition & 0 deletions sources/net.sf.j2s.java.core/src/java/util/Hashtable.java
Original file line number Diff line number Diff line change
Expand Up @@ -1947,6 +1947,7 @@ public void remove() {
* key = p.value[0];
*/
Hashtable.this.remove(key);
expectedModCount++;
} else {

synchronized (Hashtable.this) {
Expand Down
4 changes: 4 additions & 0 deletions sources/net.sf.j2s.java.core/src/javajs/util/AU.java
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,10 @@ public static boolean isAFloat(Object x) {
return x instanceof Float[];
}

public static boolean isADouble(Object x) {
return x instanceof Double[];
}

public static boolean isAD(Object x) {
return x instanceof double[];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,11 @@ public String readLine() {
if (line == null)
return null;
if (isHeader) {
if (line.startsWith("#"))
if (line.startsWith("#")) {
fileHeader.append(line).appendC('\n');
else
} else if (line.length() > 0) {
isHeader = false;
}
}
return line;
} catch (Exception e) {
Expand Down
6 changes: 3 additions & 3 deletions sources/net.sf.j2s.java.core/src/javajs/util/Measure.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static T3[] computeHelicalAxis(P3 a, P3 b, Quat dq) {
V3 vda = new V3();
V3 vcb = V3.newV(n);
if (v_dot_n == 0)
v_dot_n = PT.FLOAT_MIN_SAFE; // allow for perpendicular axis to vab
v_dot_n = 2E-45f; // allow for perpendicular axis to vab
vcb.scale(v_dot_n);
vda.sub2(vcb, vab);
vda.scale(0.5f);
Expand All @@ -146,7 +146,7 @@ public static T3[] computeHelicalAxis(P3 a, P3 b, Quat dq) {
P3 pt_a_prime = P3.newP(a);
pt_a_prime.sub(r);
// already done this. ??
if (v_dot_n != PT.FLOAT_MIN_SAFE)
if (v_dot_n != 2E-45f)
n.scale(v_dot_n);
// must calculate directed angle:
P3 pt_b_prime = P3.newP(pt_a_prime);
Expand All @@ -156,7 +156,7 @@ public static T3[] computeHelicalAxis(P3 a, P3 b, Quat dq) {
theta = dq.getThetaDirectedV(n); // allow for r = 0
// anything else is an array
float residuesPerTurn = Math.abs(theta == 0 ? 0 : 360f / theta);
float pitch = Math.abs(v_dot_n == PT.FLOAT_MIN_SAFE ? 0 : n.length()
float pitch = Math.abs(v_dot_n == 2E-45f ? 0 : n.length()
* (theta == 0 ? 1 : 360f / theta));
return new T3[] { pt_a_prime, n, r, P3.new3(theta, pitch, residuesPerTurn), pt_b_prime };
}
Expand Down
19 changes: 9 additions & 10 deletions sources/net.sf.j2s.java.core/src/javajs/util/MeasureD.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ public static T3d[] computeHelicalAxis(P3d a, P3d b, Qd dq) {
// a'+---------a
// r

V3d vab = new V3d();
vab.sub2(b, a);
V3d vab = V3d.newVsub(b, a);
/*
* testing here to see if directing the normal makes any difference -- oddly
* enough, it does not. When n = -n and theta = -theta vab.n is reversed,
Expand All @@ -125,7 +124,7 @@ public static T3d[] computeHelicalAxis(P3d a, P3d b, Qd dq) {
double theta = dq.getTheta();
V3d n = dq.getNormal();
double v_dot_n = vab.dot(n);
if (Math.abs(v_dot_n) < 0.0001f)
if (Math.abs(v_dot_n) < 0.0001)
v_dot_n = 0;
V3d va_prime_d = new V3d();
va_prime_d.cross(vab, n);
Expand All @@ -134,10 +133,10 @@ public static T3d[] computeHelicalAxis(P3d a, P3d b, Qd dq) {
V3d vda = new V3d();
V3d vcb = V3d.newV(n);
if (v_dot_n == 0)
v_dot_n = PT.FLOAT_MIN_SAFE; // allow for perpendicular axis to vab
v_dot_n = 2E-45; // allow for perpendicular axis to vab
vcb.scale(v_dot_n);
vda.sub2(vcb, vab);
vda.scale(0.5f);
vda.scale(0.5d);
va_prime_d.scale(theta == 0 ? 0 : (vda.length() / Math.tan(theta
/ 2 / 180 * Math.PI)));
V3d r = V3d.newV(va_prime_d);
Expand All @@ -146,18 +145,18 @@ public static T3d[] computeHelicalAxis(P3d a, P3d b, Qd dq) {
P3d pt_a_prime = P3d.newP(a);
pt_a_prime.sub(r);
// already done this. ??
if (v_dot_n != PT.FLOAT_MIN_SAFE)
if (v_dot_n != 2E-45)
n.scale(v_dot_n);
// must calculate directed angle:
P3d pt_b_prime = P3d.newP(pt_a_prime);
pt_b_prime.add(n);
theta = computeTorsion(a, pt_a_prime, pt_b_prime, b, true);
if (Double.isNaN(theta) || r.length() < 0.0001f)
if (Double.isNaN(theta) || r.length() < 0.0001)
theta = dq.getThetaDirectedV(n); // allow for r = 0
// anything else is an array
double residuesPerTurn = Math.abs(theta == 0 ? 0 : 360f / theta);
double pitch = Math.abs(v_dot_n == PT.FLOAT_MIN_SAFE ? 0 : n.length()
* (theta == 0 ? 1 : 360f / theta));
double pitch = Math.abs(v_dot_n == 2E-45 ? 0 : n.length()
* (theta == 0 ? 1 : 360.0 / theta));
return new T3d[] { pt_a_prime, n, r, P3d.new3(theta, pitch, residuesPerTurn), pt_b_prime };
}

Expand Down Expand Up @@ -1005,7 +1004,7 @@ public static Lst<P3d> getLatticePoints(Lst<P3d> cpts, int h, int k, int l) {
}
}
for (int i = n; --i >= 0;)
cpts.removeItemAt(i);
cpts.removeItemAt(0);
return cpts;
}

Expand Down
Loading