Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(570)

Unified Diff: pkg/kernel/testcases/input/DeltaBlue.dart

Issue 2747113004: Run dartfmt on kernel package (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/kernel/testcases/closures/type_variables.dart ('k') | pkg/kernel/testcases/input/argument.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/testcases/input/DeltaBlue.dart
diff --git a/pkg/kernel/testcases/input/DeltaBlue.dart b/pkg/kernel/testcases/input/DeltaBlue.dart
index cb606f89c34f259f930d1bf1d8412997aa901bc8..1b58f52f5e18b55881b197b0d7aa89e6fe51285c 100644
--- a/pkg/kernel/testcases/input/DeltaBlue.dart
+++ b/pkg/kernel/testcases/input/DeltaBlue.dart
@@ -46,7 +46,6 @@ class DeltaBlue {
}
}
-
/**
* Strengths are used to measure the relative importance of constraints.
* New strengths may be inserted in the strength hierarchy without
@@ -54,15 +53,19 @@ class DeltaBlue {
* this class, so == can be used for value comparison.
*/
class Strength {
-
final int value;
final String name;
const Strength(this.value, this.name);
- Strength nextWeaker() =>
- const <Strength>[STRONG_PREFERRED, PREFERRED, STRONG_DEFAULT, NORMAL,
- WEAK_DEFAULT, WEAKEST][value];
+ Strength nextWeaker() => const <Strength>[
+ STRONG_PREFERRED,
+ PREFERRED,
+ STRONG_DEFAULT,
+ NORMAL,
+ WEAK_DEFAULT,
+ WEAKEST
+ ][value];
static bool stronger(Strength s1, Strength s2) {
return s1.value < s2.value;
@@ -81,19 +84,16 @@ class Strength {
}
}
-
// Compile time computed constants.
-const REQUIRED = const Strength(0, "required");
+const REQUIRED = const Strength(0, "required");
const STRONG_PREFERRED = const Strength(1, "strongPreferred");
-const PREFERRED = const Strength(2, "preferred");
-const STRONG_DEFAULT = const Strength(3, "strongDefault");
-const NORMAL = const Strength(4, "normal");
-const WEAK_DEFAULT = const Strength(5, "weakDefault");
-const WEAKEST = const Strength(6, "weakest");
-
+const PREFERRED = const Strength(2, "preferred");
+const STRONG_DEFAULT = const Strength(3, "strongDefault");
+const NORMAL = const Strength(4, "normal");
+const WEAK_DEFAULT = const Strength(5, "weakDefault");
+const WEAKEST = const Strength(6, "weakest");
abstract class Constraint {
-
final Strength strength;
const Constraint(this.strength);
@@ -157,7 +157,6 @@ abstract class Constraint {
* Abstract superclass for constraints having a single possible output variable.
*/
abstract class UnaryConstraint extends Constraint {
-
final Variable myOutput;
bool satisfied = false;
@@ -173,8 +172,8 @@ abstract class UnaryConstraint extends Constraint {
/// Decides if this constraint can be satisfied and records that decision.
void chooseMethod(int mark) {
- satisfied = (myOutput.mark != mark)
- && Strength.stronger(strength, myOutput.walkStrength);
+ satisfied = (myOutput.mark != mark) &&
+ Strength.stronger(strength, myOutput.walkStrength);
}
/// Returns true if this constraint is satisfied in the current solution.
@@ -211,7 +210,6 @@ abstract class UnaryConstraint extends Constraint {
}
}
-
/**
* Variables that should, with some level of preference, stay the same.
* Planners may exploit the fact that instances, if satisfied, will not
@@ -219,7 +217,6 @@ abstract class UnaryConstraint extends Constraint {
* optimization".
*/
class StayConstraint extends UnaryConstraint {
-
StayConstraint(Variable v, Strength str) : super(v, str);
void execute() {
@@ -227,13 +224,11 @@ class StayConstraint extends UnaryConstraint {
}
}
-
/**
* A unary input constraint used to mark a variable that the client
* wishes to change.
*/
class EditConstraint extends UnaryConstraint {
-
EditConstraint(Variable v, Strength str) : super(v, str);
/// Edits indicate that a variable is to be changed by imperative code.
@@ -244,19 +239,16 @@ class EditConstraint extends UnaryConstraint {
}
}
-
// Directions.
const int NONE = 1;
const int FORWARD = 2;
const int BACKWARD = 0;
-
/**
* Abstract superclass for constraints having two possible output
* variables.
*/
abstract class BinaryConstraint extends Constraint {
-
Variable v1;
Variable v2;
int direction = NONE;
@@ -272,21 +264,23 @@ abstract class BinaryConstraint extends Constraint {
*/
void chooseMethod(int mark) {
if (v1.mark == mark) {
- direction = (v2.mark != mark &&
- Strength.stronger(strength, v2.walkStrength))
- ? FORWARD : NONE;
+ direction =
+ (v2.mark != mark && Strength.stronger(strength, v2.walkStrength))
+ ? FORWARD
+ : NONE;
}
if (v2.mark == mark) {
- direction = (v1.mark != mark &&
- Strength.stronger(strength, v1.walkStrength))
- ? BACKWARD : NONE;
+ direction =
+ (v1.mark != mark && Strength.stronger(strength, v1.walkStrength))
+ ? BACKWARD
+ : NONE;
}
if (Strength.weaker(v1.walkStrength, v2.walkStrength)) {
- direction = Strength.stronger(strength, v1.walkStrength)
- ? BACKWARD : NONE;
+ direction =
+ Strength.stronger(strength, v1.walkStrength) ? BACKWARD : NONE;
} else {
- direction = Strength.stronger(strength, v2.walkStrength)
- ? FORWARD : BACKWARD;
+ direction =
+ Strength.stronger(strength, v2.walkStrength) ? FORWARD : BACKWARD;
}
}
@@ -340,7 +334,6 @@ abstract class BinaryConstraint extends Constraint {
}
}
-
/**
* Relates two variables by the linear scaling relationship: "v2 =
* (v1 * scale) + offset". Either v1 or v2 may be changed to maintain
@@ -349,13 +342,12 @@ abstract class BinaryConstraint extends Constraint {
*/
class ScaleConstraint extends BinaryConstraint {
-
final Variable scale;
final Variable offset;
- ScaleConstraint(Variable src, this.scale, this.offset,
- Variable dest, Strength strength)
- : super(src, dest, strength);
+ ScaleConstraint(
+ Variable src, this.scale, this.offset, Variable dest, Strength strength)
+ : super(src, dest, strength);
/// Adds this constraint to the constraint graph.
void addToGraph() {
@@ -395,17 +387,14 @@ class ScaleConstraint extends BinaryConstraint {
out.stay = ihn.stay && scale.stay && offset.stay;
if (out.stay) execute();
}
-
}
-
/**
* Constrains two variables to have the same value.
*/
class EqualityConstraint extends BinaryConstraint {
-
EqualityConstraint(Variable v1, Variable v2, Strength strength)
- : super(v1, v2, strength);
+ : super(v1, v2, strength);
/// Enforce this constraint. Assume that it is satisfied.
void execute() {
@@ -413,7 +402,6 @@ class EqualityConstraint extends BinaryConstraint {
}
}
-
/**
* A constrained variable. In addition to its value, it maintain the
* structure of the constraint graph, the current dataflow graph, and
@@ -421,7 +409,6 @@ class EqualityConstraint extends BinaryConstraint {
* constraint solver.
**/
class Variable {
-
List<Constraint> constraints = <Constraint>[];
Constraint determinedBy;
int mark = 0;
@@ -447,9 +434,7 @@ class Variable {
}
}
-
class Planner {
-
int currentMark = 0;
/**
@@ -468,7 +453,7 @@ class Planner {
*/
void incrementalAdd(Constraint c) {
int mark = newMark();
- for(Constraint overridden = c.satisfy(mark);
+ for (Constraint overridden = c.satisfy(mark);
overridden != null;
overridden = overridden.satisfy(mark));
}
@@ -615,7 +600,6 @@ class Planner {
}
}
-
/**
* A Plan is an ordered list of constraints to be executed in sequence
* to resatisfy all currently satisfiable constraints in the face of
@@ -637,7 +621,6 @@ class Plan {
}
}
-
/**
* This is the standard DeltaBlue benchmark. A long chain of equality
* constraints is constructed with a stay constraint on one end. An
« no previous file with comments | « pkg/kernel/testcases/closures/type_variables.dart ('k') | pkg/kernel/testcases/input/argument.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698