mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Minor: Add result types for known failure cases
This commit is contained in:
parent
530700a8c1
commit
af67d08746
@ -14,3 +14,4 @@ part 'solver.dart';
|
||||
part 'symbol.dart';
|
||||
part 'row.dart';
|
||||
part 'utils.dart';
|
||||
part 'result.dart';
|
||||
|
||||
29
packages/cassowary/lib/result.dart
Normal file
29
packages/cassowary/lib/result.dart
Normal file
@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
part of cassowary;
|
||||
|
||||
class Result {
|
||||
final bool error;
|
||||
final String message;
|
||||
|
||||
const Result(this.message, this.error);
|
||||
|
||||
static final Result success = const Result("Success", false);
|
||||
static final Result unimplemented = const Result("Unimplemented", true);
|
||||
static final Result duplicateConstraint =
|
||||
const Result("Duplicate Constraint", true);
|
||||
static final Result unsatisfiableConstraint =
|
||||
const Result("Unsatisfiable Constraint", true);
|
||||
static final Result unknownConstraint =
|
||||
const Result("Unknown Constraint", true);
|
||||
static final Result duplicateEditVariable =
|
||||
const Result("Duplicate Edit Variable", true);
|
||||
static final Result badRequiredStrength =
|
||||
const Result("Bad Required Strength", true);
|
||||
static final Result unknownEditVariable =
|
||||
const Result("Unknown Edit Variable", true);
|
||||
static final Result internalSolverError =
|
||||
const Result("Internal Solver Error", true);
|
||||
}
|
||||
@ -13,32 +13,32 @@ class Solver {
|
||||
final Row _objective = new Row();
|
||||
final Row _artificial = new Row();
|
||||
|
||||
bool addConstraint(Constraint c) {
|
||||
return false;
|
||||
Result addConstraint(Constraint c) {
|
||||
return Result.unimplemented;
|
||||
}
|
||||
|
||||
bool removeContraint(Constraint c) {
|
||||
return false;
|
||||
Result removeContraint(Constraint c) {
|
||||
return Result.unimplemented;
|
||||
}
|
||||
|
||||
bool hasConstraint(Constraint c) {
|
||||
return false;
|
||||
Result hasConstraint(Constraint c) {
|
||||
return Result.unimplemented;
|
||||
}
|
||||
|
||||
bool addEditVariable(Variable v, double priority) {
|
||||
return false;
|
||||
Result addEditVariable(Variable v, double priority) {
|
||||
return Result.unimplemented;
|
||||
}
|
||||
|
||||
bool removeEditVariable(Variable v) {
|
||||
return false;
|
||||
Result removeEditVariable(Variable v) {
|
||||
return Result.unimplemented;
|
||||
}
|
||||
|
||||
bool hasEditVariable(Variable v) {
|
||||
return false;
|
||||
Result hasEditVariable(Variable v) {
|
||||
return Result.unimplemented;
|
||||
}
|
||||
|
||||
bool suggestVariable(Variable v, double value) {
|
||||
return false;
|
||||
Result suggestVariable(Variable v, double value) {
|
||||
return Result.unimplemented;
|
||||
}
|
||||
|
||||
void updateVariable() {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user