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 {
Expression asExpression() => new Expression([], this.value);
}
ConstantMember CM(num value) {
ConstantMember cm(double value) {
return new ConstantMember(value);
}
......@@ -12,8 +12,8 @@ class Param extends _EquationMember {
variable._owner = this;
}
Param.withContext(ctx)
: variable = new Variable(0.0),
Param.withContext(ctx, [double value = 0.0])
: variable = new Variable(value),
context = ctx {
variable._owner = this;
}
......
......@@ -5,25 +5,25 @@
part of cassowary;
class Result {
final bool error;
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 unimplemented = const Result("Unimplemented", true);
static final Result success = const Result("Success", isError: false);
static final Result unimplemented = const Result("Unimplemented");
static final Result duplicateConstraint =
const Result("Duplicate Constraint", true);
const Result("Duplicate Constraint");
static final Result unsatisfiableConstraint =
const Result("Unsatisfiable Constraint", true);
const Result("Unsatisfiable Constraint");
static final Result unknownConstraint =
const Result("Unknown Constraint", true);
const Result("Unknown Constraint");
static final Result duplicateEditVariable =
const Result("Duplicate Edit Variable", true);
const Result("Duplicate Edit Variable");
static final Result badRequiredStrength =
const Result("Bad Required Strength", true);
const Result("Bad Required Strength");
static final Result unknownEditVariable =
const Result("Unknown Edit Variable", true);
const Result("Unknown Edit Variable");
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, }
class _Symbol {
final _SymbolType type;
int tick;
final int tick;
_Symbol(this.type, this.tick);
......
......@@ -5,12 +5,12 @@
part of cassowary;
class Variable {
double value = 0.0;
double value;
String name;
Param _owner;
int _tick;
final int _tick;
static int _total = 0;
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