symbol.dart 827 Bytes
Newer Older
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
enum _SymbolType { invalid, external, slack, error, dummy, }
8

9
class _Symbol {
10
  final _SymbolType type;
11
  final int tick;
12

13
  _Symbol(this.type, this.tick);
14 15

  String toString() {
Hixie's avatar
Hixie committed
16
    String typeString = 'unknown';
17 18
    switch (type) {
      case _SymbolType.invalid:
Hixie's avatar
Hixie committed
19
        typeString = 'i';
20 21
        break;
      case _SymbolType.external:
Hixie's avatar
Hixie committed
22
        typeString = 'v';
23 24
        break;
      case _SymbolType.slack:
Hixie's avatar
Hixie committed
25
        typeString = 's';
26 27
        break;
      case _SymbolType.error:
Hixie's avatar
Hixie committed
28
        typeString = 'e';
29 30
        break;
      case _SymbolType.dummy:
Hixie's avatar
Hixie committed
31
        typeString = 'd';
32 33
        break;
    }
Hixie's avatar
Hixie committed
34
    return '$typeString$tick';
35
  }
36
}