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

Side by Side Diff: lib/core/int.dart

Issue 10959067: Add documentation of double and int. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 years, 2 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Dart core library. 5 /**
6 * Representation of Dart integers containing integer specific
7 * operations and specialization of operations inherited from [num].
8 *
9 * Integers can be arbitrarily large in Dart.
10 *
11 * *Note however, that when compiling to JavaScript, integers are
12 * implemented as JavaScript numbers. When compiling to JavaScript,
13 * integers are therefore restricted to 53 significant bits because
14 * all JavaScript numbers are double-precision floating point
15 * values. The behavior of the operators and methods in the [int]
16 * class therefore sometimes differs between the Dart VM and Dart code
17 * compiled to JavaScript.*
18 */
19 abstract class int implements num {
20 /** The bit-wise and operator. */
21 int operator &(int other);
6 22
7 abstract class int implements num { 23 /** The bit-wise or operator. */
8 // Bit-operations.
9 int operator &(int other);
10 int operator |(int other); 24 int operator |(int other);
25
26 /** The bit-wise xor operator. */
11 int operator ^(int other); 27 int operator ^(int other);
28
29 /** The bit-wise negate operator. */
12 int operator ~(); 30 int operator ~();
31
32 /** The left shift operator. */
13 int operator <<(int shiftAmount); 33 int operator <<(int shiftAmount);
34
35 /** The right shift operator. */
14 int operator >>(int shiftAmount); 36 int operator >>(int shiftAmount);
15 37
16 // Testers. 38 /** Returns true if and only if this integer is even. */
17 bool isEven(); 39 bool isEven();
40
41 /** Returns true if and only if this integer is odd. */
18 bool isOdd(); 42 bool isOdd();
19 43
20 // Specializations of super-interface. 44 /** Negate operator. Negating an integer produces an integer. */
21 int operator -(); 45 int operator -();
46
47 /** Returns the absolute value of this integer. */
22 int abs(); 48 int abs();
49
50 /** For integers the round method is the identify function. */
23 int round(); 51 int round();
52
53 /** For integers the floor method is the identify function. */
24 int floor(); 54 int floor();
55
56 /** For integers the ceil method is the identify function. */
25 int ceil(); 57 int ceil();
58
59 /** For integers the truncate method is the identify function. */
26 int truncate(); 60 int truncate();
61
27 /** 62 /**
28 * Returns a representation of this [int] value. 63 * Returns a representation of this [int] value.
29 * 64 *
30 * It should always be the case that if 'i' is an [int] value, then 65 * It should always be the case that if [:i:] is an [int] value,
31 * [:i == int.parse(i.toString())]. 66 * then [:i == int.parse(i.toString()):].
32 */ 67 */
33 String toString(); 68 String toString();
34 69
35 /** 70 /**
36 * Parse [source] as an integer literal and return its value. 71 * Parse [source] as an integer literal and return its value.
37 * 72 *
38 * Accepts "0x" prefix for hexadecimal numbers, otherwise defaults 73 * Accepts "0x" prefix for hexadecimal numbers, otherwise defaults
39 * to base-10. 74 * to base-10.
75 *
40 * Throws a [FormatException] if [source] is not a valid integer literal. 76 * Throws a [FormatException] if [source] is not a valid integer literal.
41 */ 77 */
42 external static int parse(String source); 78 external static int parse(String source);
43 } 79 }
OLDNEW
« lib/core/double.dart ('K') | « lib/core/double.dart ('k') | lib/core/num.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698