Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 81a9175

Browse filesBrowse files
committed
spartanize project part2
1 parent 424cc6d commit 81a9175
Copy full SHA for 81a9175

File tree

Expand file treeCollapse file tree

11 files changed

+29
-31
lines changed
Filter options
Expand file treeCollapse file tree

11 files changed

+29
-31
lines changed

‎il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/plugin/preferences/revision/WidgetPreferences.java

Copy file name to clipboardExpand all lines: il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/plugin/preferences/revision/WidgetPreferences.java
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ public static void storeDefaultEntries() {
5151
store().setToDefault(PreferencesResources.WIDGET_OPERATION_CONFIGURATION);
5252
}
5353
@SuppressWarnings("unchecked") public static List<WidgetOperationEntry> readEntries() {
54-
final String forString = store().getString(PreferencesResources.WIDGET_OPERATION_CONFIGURATION);
55-
final byte[] theOutBarr = Base64.getDecoder().decode(forString);
54+
final byte[] theOutBarr = Base64.getDecoder().decode(store().getString(PreferencesResources.WIDGET_OPERATION_CONFIGURATION));
5655
final ByteArrayInputStream in = new ByteArrayInputStream(theOutBarr);
5756
List<WidgetOperationEntry> $ = null;
5857
try {

‎il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/cmdline/BatchSpartanizer.java

Copy file name to clipboardExpand all lines: il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/cmdline/BatchSpartanizer.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ boolean collect(final AbstractTypeDeclaration in) {
125125
final int length = in.getLength(), tokens = metrics.tokens(in + ""), nodes = countOf.nodes(in), body = metrics.bodySize(in),
126126
tide = clean(in + "").length(), essence = Essence.of(in + "").length();
127127
final String out = interactiveSpartanizer.fixedPoint(in + "");
128-
final int length2 = out.length(), tokens2 = metrics.tokens(out), tide2 = clean(out + "").length(), essence2 = Essence.of(out + "").length(),
129-
wordCount = system.wc(Essence.of(out + ""));
128+
final int length2 = out.length(), tokens2 = metrics.tokens(out), tide2 = clean(out).length(), essence2 = Essence.of(out).length(),
129+
wordCount = system.wc(Essence.of(out));
130130
final ASTNode from = makeAST.COMPILATION_UNIT.from(out);
131131
final int nodes2 = countOf.nodes(from), body2 = metrics.bodySize(from);
132132
System.err.println(++classesDone + " " + extract.category(in) + " " + extract.name(in));

‎il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/java/namespace/Namespace.java

Copy file name to clipboardExpand all lines: il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/java/namespace/Namespace.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ Namespace spawn(final String childName) {
334334
return addChild(new Namespace(this, childName));
335335
}
336336
@Override public String toString() {
337-
return name + "" + flat;
337+
return name + flat;
338338
}
339339
static boolean init(final Namespace n, final Iterable<? extends ASTNode> children) {
340340
children.forEach(n::fillScope);

‎il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/plugin/widget/SpartanWidgetHandler.java

Copy file name to clipboardExpand all lines: il.org.spartan.spartanizer-plugin/src/main/java/il/org/spartan/spartanizer/plugin/widget/SpartanWidgetHandler.java
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static void launchWidget(final Function<Point, Point> startLocation) {
5858
final Button closeButton = new Button(shell, SWT.PUSH | SWT.WRAP);
5959
closeButton.setText("close");
6060
expandControl(closeButton, MINIMAL_BUTTON_SIZE);
61-
closeButton.setLocation(R / 2 + r, 2 * R - closeButton.getSize().y / 2 + r);
61+
closeButton.setLocation(r + R / 2, r + (2 * R - closeButton.getSize().y / 2));
6262
closeButton.addListener(SWT.Selection, __ -> {
6363
shell.close();
6464
active.set(false);
@@ -79,7 +79,7 @@ public static void launchWidget(final Function<Point, Point> startLocation) {
7979
setControl(canvas, setSolid, setTransparent);
8080
setMovable(display, canvas, shell);
8181
final Region region = new Region();
82-
region.add(circle(R, R + r, R + r));
82+
region.add(circle(R, r + R, r + R));
8383
region.add(closeButton.getBounds());
8484
final Rectangle size = region.getBounds();
8585
shell.setSize(size.width, size.height);
@@ -129,11 +129,11 @@ private static boolean setUpR() {
129129
R = widgetSize;
130130
circles = new Point[] { //
131131
new Point(2 * r, 2 * R)//
132-
, new Point(r, R + r)//
132+
, new Point(r, r + R)//
133133
, new Point(2 * r, 2 * r)//
134-
, new Point(R + r, r)//
134+
, new Point(r + R, r)//
135135
, new Point(2 * R, 2 * r)//
136-
, new Point(2 * R + r, R + r)//
136+
, new Point(r + 2 * R, r + R)//
137137
, new Point(2 * R, 2 * R)//
138138
};
139139
return true;
@@ -188,9 +188,9 @@ static int[] circle(@SuppressWarnings("hiding") final int r, final int offsetX,
188188
final int[] $ = new int[8 * r + 4];
189189
for (int i = 0; i <= 2 * r; ++i) {
190190
final int x = i - r, y = (int) Math.sqrt(r * r - x * x);
191-
$[2 * i] = offsetX + x;
192-
$[2 * i + 1] = offsetY + y;
193-
$[8 * r - 2 * i - 2] = offsetX + x;
191+
$[2 * i] = x + offsetX;
192+
$[2 * i + 1] = y + offsetY;
193+
$[8 * r - 2 * i - 2] = x + offsetX;
194194
$[8 * r - 2 * i - 1] = offsetY - y;
195195
}
196196
return $;
@@ -209,7 +209,7 @@ static Canvas createImage(final Shell s) {
209209
¢.gc.drawImage(i, 0, 0);
210210
$.setSize(w, h);
211211
});
212-
$.setLocation(R / 2 + r, R / 2 + r);
212+
$.setLocation(r + R / 2, r + R / 2);
213213
$.pack();
214214
return $;
215215
}

‎il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/AtomicConversionsTest.java

Copy file name to clipboardExpand all lines: il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/AtomicConversionsTest.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ public final class AtomicConversionsTest {
5757
assert !atomic.isDouble(1L);
5858
assert atomic.isLong(1L);
5959
assert atomic.isFloat(2F);
60-
assert atomic.isFloat(2F + f);
60+
assert atomic.isFloat(f + 2F);
6161
assert atomic.isFloat(1L + 2F);
6262
}
6363
@Test public void mod() {
6464
assert atomic.isLong(l / i);
65-
assert atomic.isLong(l + i);
65+
assert atomic.isLong(i + l);
6666
assert atomic.isLong(l % i);
6767
assert atomic.isLong(i % l);
6868
}

‎il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixtureCatchBlock.java

Copy file name to clipboardExpand all lines: il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixtureCatchBlock.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class FixtureCatchBlock extends MetaFixture {
5252
} finally {
5353
@foreign("$") final int a = hashCode() * hashCode();
5454
@knows("a") final int z = a * a + hashCode();
55-
f(a * z + z + hashCode());
55+
f(z + a * z + hashCode());
5656
}
5757
return 3;
5858
}
@@ -72,11 +72,11 @@ void simple() {
7272
@knows({ "a2", "x" }) @foreign("r") final int a2 = hashCode() * hashCode();
7373
f(a2 * x.hashCode());
7474
@knows({ "a2", "x" }) final int r = hashCode();
75-
f(r * a2 * a2 + r);
75+
f(r + r * a2 * a2);
7676
} finally {
7777
@foreign("r") final int a = hashCode() * hashCode();
7878
@knows("a") final int r = hashCode();
79-
f(a * a * r + r);
79+
f(r + a * a * r);
8080
}
8181
}
8282
}

‎il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixturePlainFor.java

Copy file name to clipboardExpand all lines: il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixturePlainFor.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ int f(final int[] a) {
1111
for (@knows({ "f/1", "$", "i" }) int i = 0; i < a.length; ++i)
1212
for (@knows({ "f/1", "$", "i", "j" }) int j = 0; j < a.length; ++j) {
1313
@knows({ "f/1", "$", "i", "j", "f" }) final int f = hashCode();
14-
$ += f * i * j + f;
14+
$ += f + f * i * j;
1515
}
1616
return $;
1717
}

‎il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixtureTryResources.java

Copy file name to clipboardExpand all lines: il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/FixtureTryResources.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ public class FixtureTryResources extends MetaFixture {
2727
}
2828
@foreign("$") final int x = hashCode() >>> 3;
2929
@knows("$") final int $ = 100 * hashCode() >>> 3;
30-
return f() == x ? x + $ : 2 * hashCode();
30+
return f() == x ? $ + x : 2 * hashCode();
3131
}
3232
}

‎il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/KnowsTest.java

Copy file name to clipboardExpand all lines: il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/KnowsTest.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ public static Double g(final double y) {
3232
public static int g(final int x, final int y) {
3333
@knows({ "x", "y", "$" }) final int $ = x * y;
3434
@knows({ "x", "y", "z", "$" }) final int z = $ * (x + y);
35-
return x * z + y + $;
35+
return $ + y + x * z;
3636
}
3737
public static int h(final int x, final int y) {
3838
@knows({ "x", "y", "$" }) final int $ = x * y;
3939
@knows({ "x", "y", "z", "$" }) final int z = $ * (x + y);
40-
return x * z + y + $;
40+
return $ + y + x * z;
4141
}
4242

4343
final String repository;

‎il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/NamespaceTest.java

Copy file name to clipboardExpand all lines: il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/NamespaceTest.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class NamespaceFixture {
1616
l = $ * k;
1717
@knows("k") int s = l + k * k * l;
1818
s *= s + 2;
19-
f(k + s * hashCode() + l + $ * s);
19+
f(k + l + $ * s + s * hashCode());
2020
}
2121

2222
int f(final int a) {

‎il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/definitionTest.java

Copy file name to clipboardExpand all lines: il.org.spartan.spartanizer-plugin/src/test/java/il/org/spartan/spartanizer/java/namespace/definitionTest.java
+6-7Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ class ZZZ___Fixture_ModelClass {
457457
return ¢ + "";
458458
};
459459
for (@ScopeSize(1) @foreach final char ¢ : (this + "").toCharArray())
460-
return sum(super.hashCode(), hashCode() * $.hashCode() + ¢);
460+
return sum(super.hashCode(), ¢ + hashCode() * $.hashCode());
461461
return sum(super.hashCode(), hashCode() * $.hashCode()) + something.hashCode();
462462
}
463463
@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 {
469469
@local final int c0 = localVariableInTryBlock - localVariableNewClass;
470470
--localVariableNewClass;
471471
localVariableNewClass ^= localVariableInTryBlock;
472-
@ScopeSize(5) @knows({ "localVariableNewClass", "raisin" }) @local int raisin = localVariableInTryBlock + localVariableNewClass;
472+
@ScopeSize(5) @knows({ "localVariableNewClass", "raisin" }) @local int raisin = localVariableNewClass + localVariableInTryBlock;
473473
@ScopeSize(3) @local int c8;
474474
++localVariableNewClass;
475475
c8 = ++raisin;
@@ -490,17 +490,16 @@ class ZZZ___Fixture_ModelClass {
490490
}
491491
for (@knows("carrot") final int carrot : toString().toCharArray()) {
492492
@knows("carrot") final int cherry = 2 * carrot * (carrot - 21) + 2;
493-
q(carrot * cherry + cherry);
493+
q(cherry + carrot * cherry);
494494
}
495-
for (@ScopeSize(6) @for¢ int melon = 0, ¢ = 0 + melon; ¢ < 10 * melon; melon *= 2, --melon, ¢ = melon) {
495+
for (@ScopeSize(6) @for¢ int melon = 0, ¢ = melon; ¢ < 10 * melon; melon *= 2, --melon, ¢ = melon) {
496496
@knows({ "melon", "¢" }) final int variableInPlainFor = 2 * melon + hashCode();
497497
q(melon * hashCode() + variableInPlainFor * variableInPlainFor);
498498
¢ += melon;
499499
q(melon * hashCode() + variableInPlainFor * variableInPlainFor);
500500
}
501-
for (@ScopeSize(8) @for¢ int pear, j = 0, variableInPlainFor = 12, ¢ = 0 + j; ¢ < 10 * j; j *= 2, --j, ¢ = j) {
502-
@knows({ "variableInPlainFor", "pear", "j", "anotherVariableInAnotherPlainFor" }) int anotherVariableInAnotherPlainFor = 2 * hashCode() + j
503-
+ variableInPlainFor;
501+
for (@ScopeSize(8) @for¢ int pear, j = 0, variableInPlainFor = 12, ¢ = j; ¢ < 10 * j; j *= 2, --j, ¢ = j) {
502+
@knows({ "variableInPlainFor", "pear", "j", "anotherVariableInAnotherPlainFor" }) int anotherVariableInAnotherPlainFor = j + variableInPlainFor + 2 * hashCode();
504503
pear = hashCode() * anotherVariableInAnotherPlainFor;
505504
anotherVariableInAnotherPlainFor >>>= pear;
506505
¢ += j + anotherVariableInAnotherPlainFor;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.