summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-12-04 16:36:31 +0000
committerpaltherr <paltherr@epfl.ch>2003-12-04 16:36:31 +0000
commit8796df13604ef131cadc4f3c781fd6d35a5fa213 (patch)
tree8e4f6a2880424d725e01cefeeb24ac49434e19ab /sources
parentdbbab2f7f8b7cd16155112068c4784809ddd73f7 (diff)
downloadscala-8796df13604ef131cadc4f3c781fd6d35a5fa213.tar.gz
scala-8796df13604ef131cadc4f3c781fd6d35a5fa213.tar.bz2
scala-8796df13604ef131cadc4f3c781fd6d35a5fa213.zip
- Flattened Byte, Short and Char
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/Byte.java109
-rw-r--r--sources/scala/Char.java136
-rw-r--r--sources/scala/Double.java4
-rw-r--r--sources/scala/Float.java4
-rw-r--r--sources/scala/Int.java6
-rw-r--r--sources/scala/Long.java6
-rw-r--r--sources/scala/Short.java108
7 files changed, 352 insertions, 21 deletions
diff --git a/sources/scala/Byte.java b/sources/scala/Byte.java
index 1a7e7a3190..13dc8bd036 100644
--- a/sources/scala/Byte.java
+++ b/sources/scala/Byte.java
@@ -6,10 +6,115 @@
** |/ **
\* */
-// $OldId: Byte.java,v 1.9 2002/04/15 16:21:39 paltherr Exp $
// $Id$
package scala;
-public abstract class Byte extends Short {
+public abstract class Byte extends AnyVal {
+
+ /** @meta method []scala.Short ; */
+ public short coerce() { return asShort (); }
+ /** @meta method []scala.Int ; */
+ public int coerce() { return asInt (); }
+ /** @meta method []scala.Long ; */
+ public long coerce() { return asLong (); }
+ /** @meta method []scala.Float ; */
+ public float coerce() { return asFloat (); }
+ /** @meta method []scala.Double; */
+ public double coerce() { return asDouble(); }
+
+ public abstract double asDouble();
+ public abstract float asFloat();
+ public abstract long asLong();
+ public abstract int asInt();
+ public abstract char asChar();
+ public abstract short asShort();
+ public abstract byte asByte();
+
+ public boolean equals(java.lang.Object other) {
+ return other instanceof Byte && $eq$eq(((Byte )other).asByte ());
+ }
+ public int hashCode() {
+ int bits = asByte ();
+ return bits;
+ }
+ public String toString() {
+ return String.valueOf(asByte ());
+ }
+
+ /** @meta method (scala.Any)scala.Boolean; */
+ public boolean $eq$eq (java.lang.Object other) { return equals(other); }
+ /** @meta method (scala.Any)scala.Boolean; */
+ public boolean $bang$eq(java.lang.Object other) { return !equals(other); }
+
+ /** @meta method []scala.Int ; */
+ public int $plus () { return +asInt () ; }
+ /** @meta method []scala.Int ; */
+ public int $minus () { return -asInt () ; }
+ /** @meta method []scala.Int ; */
+ public int $tilde () { return ~asInt () ; }
+
+ public String $plus (String that) { return asInt () + that; }
+
+ public double $plus (double that) { return asDouble() + that; }
+ public double $minus (double that) { return asDouble() - that; }
+ public double $times (double that) { return asDouble() * that; }
+ public double $div (double that) { return asDouble() / that; }
+ public double $percent (double that) { return asDouble() % that; }
+ public boolean $eq$eq (double that) { return asDouble() == that; }
+ public boolean $bang$eq (double that) { return asDouble() != that; }
+ public boolean $less (double that) { return asDouble() < that; }
+ public boolean $greater (double that) { return asDouble() > that; }
+ public boolean $less$eq (double that) { return asDouble() <= that; }
+ public boolean $greater$eq(double that) { return asDouble() >= that; }
+
+ public float $plus (float that) { return asFloat () + that; }
+ public float $minus (float that) { return asFloat () - that; }
+ public float $times (float that) { return asFloat () * that; }
+ public float $div (float that) { return asFloat () / that; }
+ public float $percent (float that) { return asFloat () % that; }
+ public boolean $eq$eq (float that) { return asFloat () == that; }
+ public boolean $bang$eq (float that) { return asFloat () != that; }
+ public boolean $less (float that) { return asFloat () < that; }
+ public boolean $greater (float that) { return asFloat () > that; }
+ public boolean $less$eq (float that) { return asFloat () <= that; }
+ public boolean $greater$eq(float that) { return asFloat () >= that; }
+
+ public int $less$less (int that) { return asInt () << that; }
+ public int $less$less (long that) { return asInt () << that; }
+ public int $greater$greater(int that) { return asInt () >> that; }
+ public int $greater$greater(long that) { return asInt () >> that; }
+ public int $greater$greater$greater(int that) { return asInt () >>>that; }
+ public int $greater$greater$greater(long that) { return asInt () >>>that; }
+
+ public long $amp (long that) { return asLong () & that; }
+ public long $bar (long that) { return asLong () | that; }
+ public long $up (long that) { return asLong () ^ that; }
+ public long $plus (long that) { return asLong () + that; }
+ public long $minus (long that) { return asLong () - that; }
+ public long $times (long that) { return asLong () * that; }
+ public long $div (long that) { return asLong () / that; }
+ public long $percent (long that) { return asLong () % that; }
+ public boolean $eq$eq (long that) { return asLong () == that; }
+ public boolean $bang$eq (long that) { return asLong () != that; }
+ public boolean $less (long that) { return asLong () < that; }
+ public boolean $greater (long that) { return asLong () > that; }
+ public boolean $less$eq (long that) { return asLong () <= that; }
+ public boolean $greater$eq(long that) { return asLong () >= that; }
+
+ public int $amp (int that) { return asInt () & that; }
+ public int $bar (int that) { return asInt () | that; }
+ public int $up (int that) { return asInt () ^ that; }
+ public int $plus (int that) { return asInt () + that; }
+ public int $minus (int that) { return asInt () - that; }
+ public int $times (int that) { return asInt () * that; }
+ public int $div (int that) { return asInt () / that; }
+ public int $percent (int that) { return asInt () % that; }
+ public boolean $eq$eq (int that) { return asInt () == that; }
+ public boolean $bang$eq (int that) { return asInt () != that; }
+ public boolean $less (int that) { return asInt () < that; }
+ public boolean $greater (int that) { return asInt () > that; }
+ public boolean $less$eq (int that) { return asInt () <= that; }
+ public boolean $greater$eq(int that) { return asInt () >= that; }
+
}
diff --git a/sources/scala/Char.java b/sources/scala/Char.java
index 74516ab3af..f28be85f8e 100644
--- a/sources/scala/Char.java
+++ b/sources/scala/Char.java
@@ -6,29 +6,135 @@
** |/ **
\* */
-// $OldId: Char.java,v 1.11 2002/05/15 15:03:38 roeckl Exp $
// $Id$
package scala;
+public abstract class Char extends AnyVal {
-public abstract class Char extends Int {
- public String toString() { return String.valueOf((char)asInt()); }
- /** @meta method scala.Boolean;
- */
- public boolean isDigit() { return Character.isDigit((char)asInt()); }
+ /** @meta method []scala.Int ; */
+ public int coerce() { return asInt (); }
+ /** @meta method []scala.Long ; */
+ public long coerce() { return asLong (); }
+ /** @meta method []scala.Float ; */
+ public float coerce() { return asFloat (); }
+ /** @meta method []scala.Double; */
+ public double coerce() { return asDouble(); }
- /** @meta method scala.Boolean;
- */
- public boolean isLetter() { return Character.isLetter((char)asInt()); }
+ public abstract double asDouble();
+ public abstract float asFloat();
+ public abstract long asLong();
+ public abstract int asInt();
+ public abstract char asChar();
+ public abstract short asShort();
+ public abstract byte asByte();
- /** @meta method scala.Boolean;
- */
- public boolean isLetterOrDigit() { return Character.isLetterOrDigit((char)asInt()); }
+ public boolean equals(java.lang.Object other) {
+ return other instanceof Char && $eq$eq(((Char )other).asChar ());
+ }
+ public int hashCode() {
+ int bits = asChar ();
+ return bits;
+ }
+ public String toString() {
+ return String.valueOf(asChar ());
+ }
+
+ /** @meta method (scala.Any)scala.Boolean; */
+ public boolean $eq$eq (java.lang.Object other) { return equals(other); }
+ /** @meta method (scala.Any)scala.Boolean; */
+ public boolean $bang$eq(java.lang.Object other) { return !equals(other); }
+
+ /** @meta method []scala.Int ; */
+ public int $plus () { return +asInt () ; }
+ /** @meta method []scala.Int ; */
+ public int $minus () { return -asInt () ; }
+ /** @meta method []scala.Int ; */
+ public int $tilde () { return ~asInt () ; }
+
+ public String $plus (String that) { return asInt () + that; }
+
+ public double $plus (double that) { return asDouble() + that; }
+ public double $minus (double that) { return asDouble() - that; }
+ public double $times (double that) { return asDouble() * that; }
+ public double $div (double that) { return asDouble() / that; }
+ public double $percent (double that) { return asDouble() % that; }
+ public boolean $eq$eq (double that) { return asDouble() == that; }
+ public boolean $bang$eq (double that) { return asDouble() != that; }
+ public boolean $less (double that) { return asDouble() < that; }
+ public boolean $greater (double that) { return asDouble() > that; }
+ public boolean $less$eq (double that) { return asDouble() <= that; }
+ public boolean $greater$eq(double that) { return asDouble() >= that; }
+
+ public float $plus (float that) { return asFloat () + that; }
+ public float $minus (float that) { return asFloat () - that; }
+ public float $times (float that) { return asFloat () * that; }
+ public float $div (float that) { return asFloat () / that; }
+ public float $percent (float that) { return asFloat () % that; }
+ public boolean $eq$eq (float that) { return asFloat () == that; }
+ public boolean $bang$eq (float that) { return asFloat () != that; }
+ public boolean $less (float that) { return asFloat () < that; }
+ public boolean $greater (float that) { return asFloat () > that; }
+ public boolean $less$eq (float that) { return asFloat () <= that; }
+ public boolean $greater$eq(float that) { return asFloat () >= that; }
+
+ public int $less$less (int that) { return asInt () << that; }
+ public int $less$less (long that) { return asInt () << that; }
+ public int $greater$greater(int that) { return asInt () >> that; }
+ public int $greater$greater(long that) { return asInt () >> that; }
+ public int $greater$greater$greater(int that) { return asInt () >>>that; }
+ public int $greater$greater$greater(long that) { return asInt () >>>that; }
+
+ public long $amp (long that) { return asLong () & that; }
+ public long $bar (long that) { return asLong () | that; }
+ public long $up (long that) { return asLong () ^ that; }
+ public long $plus (long that) { return asLong () + that; }
+ public long $minus (long that) { return asLong () - that; }
+ public long $times (long that) { return asLong () * that; }
+ public long $div (long that) { return asLong () / that; }
+ public long $percent (long that) { return asLong () % that; }
+ public boolean $eq$eq (long that) { return asLong () == that; }
+ public boolean $bang$eq (long that) { return asLong () != that; }
+ public boolean $less (long that) { return asLong () < that; }
+ public boolean $greater (long that) { return asLong () > that; }
+ public boolean $less$eq (long that) { return asLong () <= that; }
+ public boolean $greater$eq(long that) { return asLong () >= that; }
+
+ public int $amp (int that) { return asInt () & that; }
+ public int $bar (int that) { return asInt () | that; }
+ public int $up (int that) { return asInt () ^ that; }
+ public int $plus (int that) { return asInt () + that; }
+ public int $minus (int that) { return asInt () - that; }
+ public int $times (int that) { return asInt () * that; }
+ public int $div (int that) { return asInt () / that; }
+ public int $percent (int that) { return asInt () % that; }
+ public boolean $eq$eq (int that) { return asInt () == that; }
+ public boolean $bang$eq (int that) { return asInt () != that; }
+ public boolean $less (int that) { return asInt () < that; }
+ public boolean $greater (int that) { return asInt () > that; }
+ public boolean $less$eq (int that) { return asInt () <= that; }
+ public boolean $greater$eq(int that) { return asInt () >= that; }
+
+ /** @meta method scala.Boolean; */
+ public boolean isDigit() {
+ return Character.isDigit((char)asChar());
+ }
+
+ /** @meta method scala.Boolean; */
+ public boolean isLetter() {
+ return Character.isLetter((char)asChar());
+ }
+
+ /** @meta method scala.Boolean; */
+ public boolean isLetterOrDigit() {
+ return Character.isLetterOrDigit((char)asChar());
+ }
+
+ /** @meta method scala.Boolean; */
+ public boolean isWhitespace() {
+ return Character.isWhitespace((char)asChar());
+ }
- /** @meta method scala.Boolean;
- */
- public boolean isWhitespace() { return Character.isWhitespace((char)asInt()); }
}
diff --git a/sources/scala/Double.java b/sources/scala/Double.java
index 727dfabf40..3a990e4970 100644
--- a/sources/scala/Double.java
+++ b/sources/scala/Double.java
@@ -19,6 +19,10 @@ public abstract class Double extends AnyVal {
+
+
+
+
public abstract double asDouble();
public abstract float asFloat();
public abstract long asLong();
diff --git a/sources/scala/Float.java b/sources/scala/Float.java
index 1633755d25..fae1b06130 100644
--- a/sources/scala/Float.java
+++ b/sources/scala/Float.java
@@ -16,6 +16,10 @@ public abstract class Float extends AnyVal {
+
+
+
+
/** @meta method []scala.Double; */
public double coerce() { return asDouble(); }
diff --git a/sources/scala/Int.java b/sources/scala/Int.java
index 2ee3adaf2c..c77d818464 100644
--- a/sources/scala/Int.java
+++ b/sources/scala/Int.java
@@ -12,6 +12,10 @@ package scala;
public abstract class Int extends AnyVal {
+
+
+
+
/** @meta method []scala.Long ; */
public long coerce() { return asLong (); }
/** @meta method []scala.Float ; */
@@ -31,7 +35,7 @@ public abstract class Int extends AnyVal {
return other instanceof Int && $eq$eq(((Int )other).asInt ());
}
public int hashCode() {
- int bits = asInt ();
+ int bits = asInt ();
return bits;
}
public String toString() {
diff --git a/sources/scala/Long.java b/sources/scala/Long.java
index 8fb5518b56..a4ab6302a3 100644
--- a/sources/scala/Long.java
+++ b/sources/scala/Long.java
@@ -14,6 +14,10 @@ public abstract class Long extends AnyVal {
+
+
+
+
/** @meta method []scala.Float ; */
public float coerce() { return asFloat (); }
/** @meta method []scala.Double; */
@@ -31,7 +35,7 @@ public abstract class Long extends AnyVal {
return other instanceof Long && $eq$eq(((Long )other).asLong ());
}
public int hashCode() {
- long bits = asLong();
+ long bits = asLong ();
return (int)(bits ^ (bits >>> 32));
}
public String toString() {
diff --git a/sources/scala/Short.java b/sources/scala/Short.java
index 24d019eb77..4f69ddbaa5 100644
--- a/sources/scala/Short.java
+++ b/sources/scala/Short.java
@@ -6,11 +6,115 @@
** |/ **
\* */
-// $OldId: Short.java,v 1.9 2002/04/15 16:21:39 paltherr Exp $
// $Id$
package scala;
+public abstract class Short extends AnyVal {
+
+
+
+ /** @meta method []scala.Int ; */
+ public int coerce() { return asInt (); }
+ /** @meta method []scala.Long ; */
+ public long coerce() { return asLong (); }
+ /** @meta method []scala.Float ; */
+ public float coerce() { return asFloat (); }
+ /** @meta method []scala.Double; */
+ public double coerce() { return asDouble(); }
+
+ public abstract double asDouble();
+ public abstract float asFloat();
+ public abstract long asLong();
+ public abstract int asInt();
+ public abstract char asChar();
+ public abstract short asShort();
+ public abstract byte asByte();
+
+ public boolean equals(java.lang.Object other) {
+ return other instanceof Short && $eq$eq(((Short )other).asShort ());
+ }
+ public int hashCode() {
+ int bits = asShort ();
+ return bits;
+ }
+ public String toString() {
+ return String.valueOf(asShort ());
+ }
+
+ /** @meta method (scala.Any)scala.Boolean; */
+ public boolean $eq$eq (java.lang.Object other) { return equals(other); }
+ /** @meta method (scala.Any)scala.Boolean; */
+ public boolean $bang$eq(java.lang.Object other) { return !equals(other); }
+
+ /** @meta method []scala.Int ; */
+ public int $plus () { return +asInt () ; }
+ /** @meta method []scala.Int ; */
+ public int $minus () { return -asInt () ; }
+ /** @meta method []scala.Int ; */
+ public int $tilde () { return ~asInt () ; }
+
+ public String $plus (String that) { return asInt () + that; }
+
+ public double $plus (double that) { return asDouble() + that; }
+ public double $minus (double that) { return asDouble() - that; }
+ public double $times (double that) { return asDouble() * that; }
+ public double $div (double that) { return asDouble() / that; }
+ public double $percent (double that) { return asDouble() % that; }
+ public boolean $eq$eq (double that) { return asDouble() == that; }
+ public boolean $bang$eq (double that) { return asDouble() != that; }
+ public boolean $less (double that) { return asDouble() < that; }
+ public boolean $greater (double that) { return asDouble() > that; }
+ public boolean $less$eq (double that) { return asDouble() <= that; }
+ public boolean $greater$eq(double that) { return asDouble() >= that; }
+
+ public float $plus (float that) { return asFloat () + that; }
+ public float $minus (float that) { return asFloat () - that; }
+ public float $times (float that) { return asFloat () * that; }
+ public float $div (float that) { return asFloat () / that; }
+ public float $percent (float that) { return asFloat () % that; }
+ public boolean $eq$eq (float that) { return asFloat () == that; }
+ public boolean $bang$eq (float that) { return asFloat () != that; }
+ public boolean $less (float that) { return asFloat () < that; }
+ public boolean $greater (float that) { return asFloat () > that; }
+ public boolean $less$eq (float that) { return asFloat () <= that; }
+ public boolean $greater$eq(float that) { return asFloat () >= that; }
+
+ public int $less$less (int that) { return asInt () << that; }
+ public int $less$less (long that) { return asInt () << that; }
+ public int $greater$greater(int that) { return asInt () >> that; }
+ public int $greater$greater(long that) { return asInt () >> that; }
+ public int $greater$greater$greater(int that) { return asInt () >>>that; }
+ public int $greater$greater$greater(long that) { return asInt () >>>that; }
+
+ public long $amp (long that) { return asLong () & that; }
+ public long $bar (long that) { return asLong () | that; }
+ public long $up (long that) { return asLong () ^ that; }
+ public long $plus (long that) { return asLong () + that; }
+ public long $minus (long that) { return asLong () - that; }
+ public long $times (long that) { return asLong () * that; }
+ public long $div (long that) { return asLong () / that; }
+ public long $percent (long that) { return asLong () % that; }
+ public boolean $eq$eq (long that) { return asLong () == that; }
+ public boolean $bang$eq (long that) { return asLong () != that; }
+ public boolean $less (long that) { return asLong () < that; }
+ public boolean $greater (long that) { return asLong () > that; }
+ public boolean $less$eq (long that) { return asLong () <= that; }
+ public boolean $greater$eq(long that) { return asLong () >= that; }
+
+ public int $amp (int that) { return asInt () & that; }
+ public int $bar (int that) { return asInt () | that; }
+ public int $up (int that) { return asInt () ^ that; }
+ public int $plus (int that) { return asInt () + that; }
+ public int $minus (int that) { return asInt () - that; }
+ public int $times (int that) { return asInt () * that; }
+ public int $div (int that) { return asInt () / that; }
+ public int $percent (int that) { return asInt () % that; }
+ public boolean $eq$eq (int that) { return asInt () == that; }
+ public boolean $bang$eq (int that) { return asInt () != that; }
+ public boolean $less (int that) { return asInt () < that; }
+ public boolean $greater (int that) { return asInt () > that; }
+ public boolean $less$eq (int that) { return asInt () <= that; }
+ public boolean $greater$eq(int that) { return asInt () >= that; }
-public abstract class Short extends Int {
}