variable.dart 553 Bytes
Newer Older
Chinmay Garde's avatar
Chinmay Garde committed
1 2 3 4 5 6
// 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;

7
class Variable {
8
  double value;
9 10
  String name;

11 12
  Param _owner;

13
  final int _tick;
14 15 16
  static int _total = 0;

  Variable(this.value) : _tick = _total++;
Chinmay Garde's avatar
Chinmay Garde committed
17

18 19 20 21 22
  bool _applyUpdate(double updated) {
    bool res = updated != value;
    value = updated;
    return res;
  }
23

Hixie's avatar
Hixie committed
24
  String get debugName => _elvis(name, 'variable$_tick');
25

26
  String toString() => debugName;
Chinmay Garde's avatar
Chinmay Garde committed
27
}