symbol.dart 839 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
  @override
16
  String toString() {
Hixie's avatar
Hixie committed
17
    String typeString = 'unknown';
18 19
    switch (type) {
      case _SymbolType.invalid:
Hixie's avatar
Hixie committed
20
        typeString = 'i';
21 22
        break;
      case _SymbolType.external:
Hixie's avatar
Hixie committed
23
        typeString = 'v';
24 25
        break;
      case _SymbolType.slack:
Hixie's avatar
Hixie committed
26
        typeString = 's';
27 28
        break;
      case _SymbolType.error:
Hixie's avatar
Hixie committed
29
        typeString = 'e';
30 31
        break;
      case _SymbolType.dummy:
Hixie's avatar
Hixie committed
32
        typeString = 'd';
33 34
        break;
    }
Hixie's avatar
Hixie committed
35
    return '$typeString$tick';
36
  }
37
}