Commit 8574e442 authored by pq's avatar pq

@override annotation cleanup.

Added missing @override annotations (as per the `annotate_overrides` lint rule).
parent 9ce6bff5
...@@ -5,12 +5,15 @@ ...@@ -5,12 +5,15 @@
part of cassowary; part of cassowary;
class ConstantMember extends _EquationMember { class ConstantMember extends _EquationMember {
@override
final double value; final double value;
@override
bool get isConstant => true; bool get isConstant => true;
ConstantMember(this.value); ConstantMember(this.value);
@override
Expression asExpression() => new Expression([], this.value); Expression asExpression() => new Expression([], this.value);
} }
......
...@@ -15,6 +15,7 @@ class Constraint { ...@@ -15,6 +15,7 @@ class Constraint {
Constraint operator |(double p) => this..priority = p; Constraint operator |(double p) => this..priority = p;
@override
String toString() { String toString() {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.write(expression.toString()); buffer.write(expression.toString());
......
...@@ -25,6 +25,7 @@ abstract class _EquationMember { ...@@ -25,6 +25,7 @@ abstract class _EquationMember {
Expression operator /(_EquationMember m) => asExpression() / m; Expression operator /(_EquationMember m) => asExpression() / m;
@override
int get hashCode => int get hashCode =>
throw "An equation member is not comparable and cannot be added to collections"; throw "An equation member is not comparable and cannot be added to collections";
} }
...@@ -9,8 +9,10 @@ class Expression extends _EquationMember { ...@@ -9,8 +9,10 @@ class Expression extends _EquationMember {
final double constant; final double constant;
@override
bool get isConstant => terms.length == 0; bool get isConstant => terms.length == 0;
@override
double get value => terms.fold(constant, (value, term) => value + term.value); double get value => terms.fold(constant, (value, term) => value + term.value);
Expression(this.terms, this.constant); Expression(this.terms, this.constant);
...@@ -18,6 +20,7 @@ class Expression extends _EquationMember { ...@@ -18,6 +20,7 @@ class Expression extends _EquationMember {
: this.terms = new List<Term>.from(expr.terms), : this.terms = new List<Term>.from(expr.terms),
this.constant = expr.constant; this.constant = expr.constant;
@override
Expression asExpression() => this; Expression asExpression() => this;
Constraint _createConstraint( Constraint _createConstraint(
...@@ -51,15 +54,19 @@ class Expression extends _EquationMember { ...@@ -51,15 +54,19 @@ class Expression extends _EquationMember {
return null; return null;
} }
@override
Constraint operator >=(_EquationMember value) => Constraint operator >=(_EquationMember value) =>
_createConstraint(value, Relation.greaterThanOrEqualTo); _createConstraint(value, Relation.greaterThanOrEqualTo);
@override
Constraint operator <=(_EquationMember value) => Constraint operator <=(_EquationMember value) =>
_createConstraint(value, Relation.lessThanOrEqualTo); _createConstraint(value, Relation.lessThanOrEqualTo);
@override
Constraint equals(_EquationMember value) => Constraint equals(_EquationMember value) =>
_createConstraint(value, Relation.equalTo); _createConstraint(value, Relation.equalTo);
@override
Expression operator +(_EquationMember m) { Expression operator +(_EquationMember m) {
if (m is ConstantMember) { if (m is ConstantMember) {
return new Expression(new List.from(terms), constant + m.value); return new Expression(new List.from(terms), constant + m.value);
...@@ -83,6 +90,7 @@ class Expression extends _EquationMember { ...@@ -83,6 +90,7 @@ class Expression extends _EquationMember {
return null; return null;
} }
@override
Expression operator -(_EquationMember m) { Expression operator -(_EquationMember m) {
if (m is ConstantMember) { if (m is ConstantMember) {
return new Expression(new List.from(terms), constant - m.value); return new Expression(new List.from(terms), constant - m.value);
......
...@@ -23,5 +23,6 @@ class Variable { ...@@ -23,5 +23,6 @@ class Variable {
String get debugName => _elvis(name, 'variable$_tick'); String get debugName => _elvis(name, 'variable$_tick');
@override
String toString() => debugName; String toString() => debugName;
} }
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