2013-07-03 02:52:38 +00:00
|
|
|
/* Copyright (c) 2008-2013, Avian Contributors
|
2008-02-19 18:06:52 +00:00
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software
|
|
|
|
for any purpose with or without fee is hereby granted, provided
|
|
|
|
that the above copyright notice and this permission notice appear
|
|
|
|
in all copies.
|
|
|
|
|
|
|
|
There is NO WARRANTY for this software. See license.txt for
|
|
|
|
details. */
|
|
|
|
|
2007-07-20 03:18:25 +00:00
|
|
|
package java.lang;
|
|
|
|
|
2007-10-29 00:51:08 +00:00
|
|
|
public final class Short extends Number implements Comparable<Short> {
|
2013-02-22 18:55:01 +00:00
|
|
|
public static final Class TYPE = avian.Classes.forCanonicalName("S");
|
2007-09-26 15:46:38 +00:00
|
|
|
public static final short MAX_VALUE = 32767;
|
2007-07-27 02:39:53 +00:00
|
|
|
|
2007-07-20 03:18:25 +00:00
|
|
|
private final short value;
|
|
|
|
|
|
|
|
public Short(short value) {
|
|
|
|
this.value = value;
|
|
|
|
}
|
|
|
|
|
2007-08-13 00:50:25 +00:00
|
|
|
public static Short valueOf(short value) {
|
|
|
|
return new Short(value);
|
|
|
|
}
|
|
|
|
|
2007-10-29 00:51:08 +00:00
|
|
|
public int compareTo(Short o) {
|
|
|
|
return value - o.value;
|
|
|
|
}
|
|
|
|
|
2007-07-29 23:32:23 +00:00
|
|
|
public boolean equals(Object o) {
|
|
|
|
return o instanceof Short && ((Short) o).value == value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
return toString(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static String toString(short v, int radix) {
|
|
|
|
return Long.toString(v, radix);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static String toString(short v) {
|
|
|
|
return toString(v, 10);
|
|
|
|
}
|
|
|
|
|
2007-07-21 17:50:26 +00:00
|
|
|
public byte byteValue() {
|
|
|
|
return (byte) value;
|
|
|
|
}
|
|
|
|
|
2007-07-20 03:18:25 +00:00
|
|
|
public short shortValue() {
|
|
|
|
return value;
|
|
|
|
}
|
2007-07-21 17:50:26 +00:00
|
|
|
|
|
|
|
public int intValue() {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public long longValue() {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public float floatValue() {
|
|
|
|
return (float) value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public double doubleValue() {
|
|
|
|
return (double) value;
|
|
|
|
}
|
2007-07-20 03:18:25 +00:00
|
|
|
}
|