Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: samples/total/client/IndexedValue.dart

Issue 10635015: Delete proxy and total samples, which have bit-rotted. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/total/client/IdGenerator.dart ('k') | samples/total/client/InnerMenuView.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Utility class used for sorting spreadsheet columns
6 class IndexedValue {
7 // Sort numbers, followed by non-blank strings, followed by blanks
8 static final int NUMBER = 0;
9 static final int STRING = 1;
10 static final int BLANK = 2;
11
12 int _class;
13 double _dValue;
14 int _index;
15 String _sValue;
16
17 int get index() => _index;
18
19 IndexedValue.blank(this._index) {
20 _class = BLANK;
21 }
22
23 IndexedValue.number(this._index, this._dValue) {
24 _class = NUMBER;
25 }
26
27 IndexedValue.string(this._index, this._sValue) {
28 _class = (_sValue == null || _sValue.length == 0) ? BLANK : STRING;
29 }
30
31 int compareTo(IndexedValue other) {
32 if (_class < other._class) {
33 return -1;
34 } else if (_class > other._class) {
35 return 1;
36 }
37
38 if (_class == NUMBER) {
39 return _dValue < other._dValue ? -1 : (_dValue > other._dValue ? 1 : 0);
40 } else if (_class == STRING) {
41 return StringUtils.compare(_sValue, other._sValue);
42 }
43 // All blanks are equal
44 return 0;
45 }
46 }
OLDNEW
« no previous file with comments | « samples/total/client/IdGenerator.dart ('k') | samples/total/client/InnerMenuView.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698