result.dart 1.24 KB
Newer Older
1
// Copyright 2016 The Chromium Authors. All rights reserved.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'solver.dart';

/// Return values used by methods on the cassowary [Solver].
class Result {
  const Result._(this.message, { bool isError: true }) : error = isError;

  /// The human-readable string associated with this result.
  ///
  /// This message is typically brief and intended for developers to help debug
  /// erroneous expressions.
  final String message;

  /// Whether this [Result] represents an error (true) or not (false).
  final bool error;

  static const Result success =
      const Result._('Success', isError: false);

  static const Result duplicateConstraint =
      const Result._('Duplicate constraint');

  static const Result unsatisfiableConstraint =
      const Result._('Unsatisfiable constraint');

  static const Result unknownConstraint =
      const Result._('Unknown constraint');

  static const Result duplicateEditVariable =
      const Result._('Duplicate edit variable');

  static const Result badRequiredStrength =
      const Result._('Bad required strength');

  static const Result unknownEditVariable =
      const Result._('Unknown edit variable');
}