diff --git a/il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/plugin/preferences/revision/WidgetPreferences.java b/il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/plugin/preferences/revision/WidgetPreferences.java index 4a8609b9cf..85d9b6d2cf 100644 --- a/il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/plugin/preferences/revision/WidgetPreferences.java +++ b/il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/plugin/preferences/revision/WidgetPreferences.java @@ -51,8 +51,7 @@ public static void storeDefaultEntries() { store().setToDefault(PreferencesResources.WIDGET_OPERATION_CONFIGURATION); } @SuppressWarnings("unchecked") public static List readEntries() { - final String forString = store().getString(PreferencesResources.WIDGET_OPERATION_CONFIGURATION); - final byte[] theOutBarr = Base64.getDecoder().decode(forString); + final byte[] theOutBarr = Base64.getDecoder().decode(store().getString(PreferencesResources.WIDGET_OPERATION_CONFIGURATION)); final ByteArrayInputStream in = new ByteArrayInputStream(theOutBarr); List $ = null; try { diff --git a/il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/cmdline/BatchSpartanizer.java b/il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/cmdline/BatchSpartanizer.java index 0b6de636b6..653ee5d922 100644 --- a/il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/cmdline/BatchSpartanizer.java +++ b/il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/cmdline/BatchSpartanizer.java @@ -125,8 +125,8 @@ boolean collect(final AbstractTypeDeclaration in) { final int length = in.getLength(), tokens = metrics.tokens(in + ""), nodes = countOf.nodes(in), body = metrics.bodySize(in), tide = clean(in + "").length(), essence = Essence.of(in + "").length(); final String out = interactiveSpartanizer.fixedPoint(in + ""); - final int length2 = out.length(), tokens2 = metrics.tokens(out), tide2 = clean(out + "").length(), essence2 = Essence.of(out + "").length(), - wordCount = system.wc(Essence.of(out + "")); + final int length2 = out.length(), tokens2 = metrics.tokens(out), tide2 = clean(out).length(), essence2 = Essence.of(out).length(), + wordCount = system.wc(Essence.of(out)); final ASTNode from = makeAST.COMPILATION_UNIT.from(out); final int nodes2 = countOf.nodes(from), body2 = metrics.bodySize(from); System.err.println(++classesDone + " " + extract.category(in) + " " + extract.name(in)); diff --git a/il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/java/namespace/Namespace.java b/il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/java/namespace/Namespace.java index 0e0399651a..d9f37e9e35 100644 --- a/il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/java/namespace/Namespace.java +++ b/il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/java/namespace/Namespace.java @@ -334,7 +334,7 @@ Namespace spawn(final String childName) { return addChild(new Namespace(this, childName)); } @Override public String toString() { - return name + "" + flat; + return name + flat; } static boolean init(final Namespace n, final Iterable children) { children.forEach(n::fillScope); diff --git a/il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/plugin/widget/SpartanWidgetHandler.java b/il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/plugin/widget/SpartanWidgetHandler.java index 12866c1a22..e5244a4e5d 100644 --- a/il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/plugin/widget/SpartanWidgetHandler.java +++ b/il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/plugin/widget/SpartanWidgetHandler.java @@ -58,7 +58,7 @@ public static void launchWidget(final Function startLocation) { final Button closeButton = new Button(shell, SWT.PUSH | SWT.WRAP); closeButton.setText("close"); expandControl(closeButton, MINIMAL_BUTTON_SIZE); - closeButton.setLocation(R / 2 + r, 2 * R - closeButton.getSize().y / 2 + r); + closeButton.setLocation(r + R / 2, r + (2 * R - closeButton.getSize().y / 2)); closeButton.addListener(SWT.Selection, __ -> { shell.close(); active.set(false); @@ -79,7 +79,7 @@ public static void launchWidget(final Function startLocation) { setControl(canvas, setSolid, setTransparent); setMovable(display, canvas, shell); final Region region = new Region(); - region.add(circle(R, R + r, R + r)); + region.add(circle(R, r + R, r + R)); region.add(closeButton.getBounds()); final Rectangle size = region.getBounds(); shell.setSize(size.width, size.height); @@ -129,11 +129,11 @@ private static boolean setUpR() { R = widgetSize; circles = new Point[] { // new Point(2 * r, 2 * R)// - , new Point(r, R + r)// + , new Point(r, r + R)// , new Point(2 * r, 2 * r)// - , new Point(R + r, r)// + , new Point(r + R, r)// , new Point(2 * R, 2 * r)// - , new Point(2 * R + r, R + r)// + , new Point(r + 2 * R, r + R)// , new Point(2 * R, 2 * R)// }; return true; @@ -188,9 +188,9 @@ static int[] circle(@SuppressWarnings("hiding") final int r, final int offsetX, final int[] $ = new int[8 * r + 4]; for (int i = 0; i <= 2 * r; ++i) { final int x = i - r, y = (int) Math.sqrt(r * r - x * x); - $[2 * i] = offsetX + x; - $[2 * i + 1] = offsetY + y; - $[8 * r - 2 * i - 2] = offsetX + x; + $[2 * i] = x + offsetX; + $[2 * i + 1] = y + offsetY; + $[8 * r - 2 * i - 2] = x + offsetX; $[8 * r - 2 * i - 1] = offsetY - y; } return $; @@ -209,7 +209,7 @@ static Canvas createImage(final Shell s) { ¢.gc.drawImage(i, 0, 0); $.setSize(w, h); }); - $.setLocation(R / 2 + r, R / 2 + r); + $.setLocation(r + R / 2, r + R / 2); $.pack(); return $; } diff --git a/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/AtomicConversionsTest.java b/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/AtomicConversionsTest.java index 7ac49d582f..bb996f217c 100644 --- a/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/AtomicConversionsTest.java +++ b/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/AtomicConversionsTest.java @@ -57,12 +57,12 @@ public final class AtomicConversionsTest { assert !atomic.isDouble(1L); assert atomic.isLong(1L); assert atomic.isFloat(2F); - assert atomic.isFloat(2F + f); + assert atomic.isFloat(f + 2F); assert atomic.isFloat(1L + 2F); } @Test public void mod() { assert atomic.isLong(l / i); - assert atomic.isLong(l + i); + assert atomic.isLong(i + l); assert atomic.isLong(l % i); assert atomic.isLong(i % l); } diff --git a/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixtureCatchBlock.java b/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixtureCatchBlock.java index 9d1efe4a98..22b59226cf 100644 --- a/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixtureCatchBlock.java +++ b/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixtureCatchBlock.java @@ -52,7 +52,7 @@ public class FixtureCatchBlock extends MetaFixture { } finally { @foreign("$") final int a = hashCode() * hashCode(); @knows("a") final int z = a * a + hashCode(); - f(a * z + z + hashCode()); + f(z + a * z + hashCode()); } return 3; } @@ -72,11 +72,11 @@ void simple() { @knows({ "a2", "x" }) @foreign("r") final int a2 = hashCode() * hashCode(); f(a2 * x.hashCode()); @knows({ "a2", "x" }) final int r = hashCode(); - f(r * a2 * a2 + r); + f(r + r * a2 * a2); } finally { @foreign("r") final int a = hashCode() * hashCode(); @knows("a") final int r = hashCode(); - f(a * a * r + r); + f(r + a * a * r); } } } diff --git a/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixturePlainFor.java b/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixturePlainFor.java index 0de5411eb8..012e1fb1c8 100644 --- a/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixturePlainFor.java +++ b/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixturePlainFor.java @@ -11,7 +11,7 @@ int f(final int[] a) { for (@knows({ "f/1", "$", "i" }) int i = 0; i < a.length; ++i) for (@knows({ "f/1", "$", "i", "j" }) int j = 0; j < a.length; ++j) { @knows({ "f/1", "$", "i", "j", "f" }) final int f = hashCode(); - $ += f * i * j + f; + $ += f + f * i * j; } return $; } diff --git a/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixtureTryResources.java b/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixtureTryResources.java index 2476dcef96..2343160053 100644 --- a/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixtureTryResources.java +++ b/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixtureTryResources.java @@ -27,6 +27,6 @@ public class FixtureTryResources extends MetaFixture { } @foreign("$") final int x = hashCode() >>> 3; @knows("$") final int $ = 100 * hashCode() >>> 3; - return f() == x ? x + $ : 2 * hashCode(); + return f() == x ? $ + x : 2 * hashCode(); } } diff --git a/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/KnowsTest.java b/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/KnowsTest.java index bfbe03c5ff..c6f74a7beb 100644 --- a/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/KnowsTest.java +++ b/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/KnowsTest.java @@ -32,12 +32,12 @@ public static Double g(final double y) { public static int g(final int x, final int y) { @knows({ "x", "y", "$" }) final int $ = x * y; @knows({ "x", "y", "z", "$" }) final int z = $ * (x + y); - return x * z + y + $; + return $ + y + x * z; } public static int h(final int x, final int y) { @knows({ "x", "y", "$" }) final int $ = x * y; @knows({ "x", "y", "z", "$" }) final int z = $ * (x + y); - return x * z + y + $; + return $ + y + x * z; } final String repository; diff --git a/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/NamespaceTest.java b/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/NamespaceTest.java index 8a9a75f886..8113e86345 100644 --- a/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/NamespaceTest.java +++ b/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/NamespaceTest.java @@ -16,7 +16,7 @@ class NamespaceFixture { l = $ * k; @knows("k") int s = l + k * k * l; s *= s + 2; - f(k + s * hashCode() + l + $ * s); + f(k + l + $ * s + s * hashCode()); } int f(final int a) { diff --git a/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/definitionTest.java b/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/definitionTest.java index 59552acf92..1e0f9ea0a9 100644 --- a/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/definitionTest.java +++ b/il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/definitionTest.java @@ -457,7 +457,7 @@ class ZZZ___Fixture_ModelClass { return ¢ + ""; }; for (@ScopeSize(1) @foreach final char ¢ : (this + "").toCharArray()) - return sum(super.hashCode(), hashCode() * $.hashCode() + ¢); + return sum(super.hashCode(), ¢ + hashCode() * $.hashCode()); return sum(super.hashCode(), hashCode() * $.hashCode()) + something.hashCode(); } @ScopeSize(4) @method int sum(@ScopeSize(1) @parameter final int a, @ScopeSize(1) @parameter final int b) { @@ -469,7 +469,7 @@ class ZZZ___Fixture_ModelClass { @local final int c0 = localVariableInTryBlock - localVariableNewClass; --localVariableNewClass; localVariableNewClass ^= localVariableInTryBlock; - @ScopeSize(5) @knows({ "localVariableNewClass", "raisin" }) @local int raisin = localVariableInTryBlock + localVariableNewClass; + @ScopeSize(5) @knows({ "localVariableNewClass", "raisin" }) @local int raisin = localVariableNewClass + localVariableInTryBlock; @ScopeSize(3) @local int c8; ++localVariableNewClass; c8 = ++raisin; @@ -490,17 +490,16 @@ class ZZZ___Fixture_ModelClass { } for (@knows("carrot") final int carrot : toString().toCharArray()) { @knows("carrot") final int cherry = 2 * carrot * (carrot - 21) + 2; - q(carrot * cherry + cherry); + q(cherry + carrot * cherry); } - for (@ScopeSize(6) @for¢ int melon = 0, ¢ = 0 + melon; ¢ < 10 * melon; melon *= 2, --melon, ¢ = melon) { + for (@ScopeSize(6) @for¢ int melon = 0, ¢ = melon; ¢ < 10 * melon; melon *= 2, --melon, ¢ = melon) { @knows({ "melon", "¢" }) final int variableInPlainFor = 2 * melon + hashCode(); q(melon * hashCode() + variableInPlainFor * variableInPlainFor); ¢ += melon; q(melon * hashCode() + variableInPlainFor * variableInPlainFor); } - for (@ScopeSize(8) @for¢ int pear, j = 0, variableInPlainFor = 12, ¢ = 0 + j; ¢ < 10 * j; j *= 2, --j, ¢ = j) { - @knows({ "variableInPlainFor", "pear", "j", "anotherVariableInAnotherPlainFor" }) int anotherVariableInAnotherPlainFor = 2 * hashCode() + j - + variableInPlainFor; + for (@ScopeSize(8) @for¢ int pear, j = 0, variableInPlainFor = 12, ¢ = j; ¢ < 10 * j; j *= 2, --j, ¢ = j) { + @knows({ "variableInPlainFor", "pear", "j", "anotherVariableInAnotherPlainFor" }) int anotherVariableInAnotherPlainFor = j + variableInPlainFor + 2 * hashCode(); pear = hashCode() * anotherVariableInAnotherPlainFor; anotherVariableInAnotherPlainFor >>>= pear; ¢ += j + anotherVariableInAnotherPlainFor;