Number.hx 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. package java.lang;
  2. /*
  3. * Copyright (c) 1994, 2001, Oracle and/or its affiliates. All rights reserved.
  4. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5. *
  6. * This code is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 only, as
  8. * published by the Free Software Foundation. Oracle designates this
  9. * particular file as subject to the "Classpath" exception as provided
  10. * by Oracle in the LICENSE file that accompanied this code.
  11. *
  12. * This code is distributed in the hope that it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  15. * version 2 for more details (a copy is included in the LICENSE file that
  16. * accompanied this code).
  17. *
  18. * You should have received a copy of the GNU General Public License version
  19. * 2 along with this work; if not, write to the Free Software Foundation,
  20. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21. *
  22. * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  23. * or visit www.oracle.com if you need additional information or have any
  24. * questions.
  25. */
  26. /**
  27. * The abstract class <code>Number</code> is the superclass of classes
  28. * <code>BigDecimal</code>, <code>BigInteger</code>,
  29. * <code>Byte</code>, <code>Double</code>, <code>Float</code>,
  30. * <code>Integer</code>, <code>Long</code>, and <code>Short</code>.
  31. * <p>
  32. * Subclasses of <code>Number</code> must provide methods to convert
  33. * the represented numeric value to <code>byte</code>, <code>double</code>,
  34. * <code>float</code>, <code>int</code>, <code>long</code>, and
  35. * <code>short</code>.
  36. *
  37. * @author Lee Boynton
  38. * @author Arthur van Hoff
  39. * @see java.lang.Byte
  40. * @see java.lang.Double
  41. * @see java.lang.Float
  42. * @see java.lang.Integer
  43. * @see java.lang.Long
  44. * @see java.lang.Short
  45. * @since JDK1.0
  46. */
  47. @:require(java0) extern class Number implements java.io.Serializable
  48. {
  49. /**
  50. * Returns the value of the specified number as an <code>int</code>.
  51. * This may involve rounding or truncation.
  52. *
  53. * @return the numeric value represented by this object after conversion
  54. * to type <code>int</code>.
  55. */
  56. @:overload @:abstract public function intValue() : Int;
  57. /**
  58. * Returns the value of the specified number as a <code>long</code>.
  59. * This may involve rounding or truncation.
  60. *
  61. * @return the numeric value represented by this object after conversion
  62. * to type <code>long</code>.
  63. */
  64. @:overload @:abstract public function longValue() : haxe.Int64;
  65. /**
  66. * Returns the value of the specified number as a <code>float</code>.
  67. * This may involve rounding.
  68. *
  69. * @return the numeric value represented by this object after conversion
  70. * to type <code>float</code>.
  71. */
  72. @:overload @:abstract public function floatValue() : Single;
  73. /**
  74. * Returns the value of the specified number as a <code>double</code>.
  75. * This may involve rounding.
  76. *
  77. * @return the numeric value represented by this object after conversion
  78. * to type <code>double</code>.
  79. */
  80. @:overload @:abstract public function doubleValue() : Float;
  81. /**
  82. * Returns the value of the specified number as a <code>byte</code>.
  83. * This may involve rounding or truncation.
  84. *
  85. * @return the numeric value represented by this object after conversion
  86. * to type <code>byte</code>.
  87. * @since JDK1.1
  88. */
  89. @:require(java1) @:overload public function byteValue() : java.StdTypes.Int8;
  90. /**
  91. * Returns the value of the specified number as a <code>short</code>.
  92. * This may involve rounding or truncation.
  93. *
  94. * @return the numeric value represented by this object after conversion
  95. * to type <code>short</code>.
  96. * @since JDK1.1
  97. */
  98. @:require(java1) @:overload public function shortValue() : java.StdTypes.Int16;
  99. }