Commit d29a0b52 authored by Chinmay Garde's avatar Chinmay Garde

Address initial code review concerns

parent 99dc91eb
...@@ -14,6 +14,6 @@ class ConstantMember extends _EquationMember { ...@@ -14,6 +14,6 @@ class ConstantMember extends _EquationMember {
Expression asExpression() => new Expression([], this.value); Expression asExpression() => new Expression([], this.value);
} }
ConstantMember CM(num value) { ConstantMember cm(double value) {
return new ConstantMember(value); return new ConstantMember(value);
} }
...@@ -12,8 +12,8 @@ class Param extends _EquationMember { ...@@ -12,8 +12,8 @@ class Param extends _EquationMember {
variable._owner = this; variable._owner = this;
} }
Param.withContext(ctx) Param.withContext(ctx, [double value = 0.0])
: variable = new Variable(0.0), : variable = new Variable(value),
context = ctx { context = ctx {
variable._owner = this; variable._owner = this;
} }
......
...@@ -5,25 +5,25 @@ ...@@ -5,25 +5,25 @@
part of cassowary; part of cassowary;
class Result { class Result {
final bool error;
final String message; final String message;
final bool error;
const Result(this.message, this.error); const Result(this.message, { bool isError: true }) : error = isError;
static final Result success = const Result("Success", false); static final Result success = const Result("Success", isError: false);
static final Result unimplemented = const Result("Unimplemented", true); static final Result unimplemented = const Result("Unimplemented");
static final Result duplicateConstraint = static final Result duplicateConstraint =
const Result("Duplicate Constraint", true); const Result("Duplicate Constraint");
static final Result unsatisfiableConstraint = static final Result unsatisfiableConstraint =
const Result("Unsatisfiable Constraint", true); const Result("Unsatisfiable Constraint");
static final Result unknownConstraint = static final Result unknownConstraint =
const Result("Unknown Constraint", true); const Result("Unknown Constraint");
static final Result duplicateEditVariable = static final Result duplicateEditVariable =
const Result("Duplicate Edit Variable", true); const Result("Duplicate Edit Variable");
static final Result badRequiredStrength = static final Result badRequiredStrength =
const Result("Bad Required Strength", true); const Result("Bad Required Strength");
static final Result unknownEditVariable = static final Result unknownEditVariable =
const Result("Unknown Edit Variable", true); const Result("Unknown Edit Variable");
static final Result internalSolverError = static final Result internalSolverError =
const Result("Internal Solver Error", true); const Result("Internal Solver Error");
} }
...@@ -8,7 +8,7 @@ enum _SymbolType { invalid, external, slack, error, dummy, } ...@@ -8,7 +8,7 @@ enum _SymbolType { invalid, external, slack, error, dummy, }
class _Symbol { class _Symbol {
final _SymbolType type; final _SymbolType type;
int tick; final int tick;
_Symbol(this.type, this.tick); _Symbol(this.type, this.tick);
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
part of cassowary; part of cassowary;
class Variable { class Variable {
double value = 0.0; double value;
String name; String name;
Param _owner; Param _owner;
int _tick; final int _tick;
static int _total = 0; static int _total = 0;
Variable(this.value) : _tick = _total++; Variable(this.value) : _tick = _total++;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment