diff options
author | Mark Wielaard <mark@gcc.gnu.org> | 2006-03-10 21:46:48 +0000 |
---|---|---|
committer | Mark Wielaard <mark@gcc.gnu.org> | 2006-03-10 21:46:48 +0000 |
commit | 8aa540d2f783474d1d2e06f16744bf67b9c1facc (patch) | |
tree | ea38c56431c5d4528fb54254c3f8e50f517bede3 /libjava/java | |
parent | 27079765d00123f8e53d0e1ef7f9d46559266e6d (diff) | |
download | gcc-8aa540d2f783474d1d2e06f16744bf67b9c1facc.zip gcc-8aa540d2f783474d1d2e06f16744bf67b9c1facc.tar.gz gcc-8aa540d2f783474d1d2e06f16744bf67b9c1facc.tar.bz2 |
Imported GNU Classpath 0.90
Imported GNU Classpath 0.90
* scripts/makemake.tcl: Set gnu/java/awt/peer/swing to ignore.
* gnu/classpath/jdwp/VMFrame.java (SIZE): New constant.
* java/lang/VMCompiler.java: Use gnu.java.security.hash.MD5.
* java/lang/Math.java: New override file.
* java/lang/Character.java: Merged from Classpath.
(start, end): Now 'int's.
(canonicalName): New field.
(CANONICAL_NAME, NO_SPACES_NAME, CONSTANT_NAME): New constants.
(UnicodeBlock): Added argument.
(of): New overload.
(forName): New method.
Updated unicode blocks.
(sets): Updated.
* sources.am: Regenerated.
* Makefile.in: Likewise.
From-SVN: r111942
Diffstat (limited to 'libjava/java')
-rw-r--r-- | libjava/java/lang/Character.java | 1198 | ||||
-rw-r--r-- | libjava/java/lang/Math.java | 650 | ||||
-rw-r--r-- | libjava/java/lang/VMCompiler.java | 12 |
3 files changed, 1589 insertions, 271 deletions
diff --git a/libjava/java/lang/Character.java b/libjava/java/lang/Character.java index f56117f..dfa3f17 100644 --- a/libjava/java/lang/Character.java +++ b/libjava/java/lang/Character.java @@ -48,6 +48,8 @@ exception statement from your version. */ package java.lang; import java.io.Serializable; +import java.text.Collator; +import java.util.Locale; /** * Wrapper class for the primitive char data type. In addition, this class @@ -150,10 +152,18 @@ public final class Character implements Serializable, Comparable public static final class UnicodeBlock extends Subset { /** The start of the subset. */ - private final char start; + private final int start; /** The end of the subset. */ - private final char end; + private final int end; + + /** The canonical name of the block according to the Unicode standard. */ + private final String canonicalName; + + /** Constants for the <code>forName()</code> method */ + private static final int CANONICAL_NAME = 0; + private static final int NO_SPACES_NAME = 1; + private static final int CONSTANT_NAME = 2; /** * Constructor for strictly defined blocks. @@ -162,24 +172,43 @@ public final class Character implements Serializable, Comparable * @param end the end character of the range * @param name the block name */ - private UnicodeBlock(char start, char end, String name) + private UnicodeBlock(int start, int end, String name, + String canonicalName) { super(name); this.start = start; this.end = end; + this.canonicalName = canonicalName; } /** * Returns the Unicode character block which a character belongs to. + * <strong>Note</strong>: This method does not support the use of + * supplementary characters. For such support, <code>of(int)</code> + * should be used instead. * * @param ch the character to look up * @return the set it belongs to, or null if it is not in one */ public static UnicodeBlock of(char ch) { - // Special case, since SPECIALS contains two ranges. - if (ch == '\uFEFF') - return SPECIALS; + return of((int) ch); + } + + /** + * Returns the Unicode character block which a code point belongs to. + * + * @param codePoint the character to look up + * @return the set it belongs to, or null if it is not in one. + * @throws IllegalArgumentException if the specified code point is + * invalid. + * @since 1.5 + */ + public static UnicodeBlock of(int codePoint) + { + if (codePoint > MAX_CODE_POINT) + throw new IllegalArgumentException("The supplied integer value is " + + "too large to be a codepoint."); // Simple binary search for the correct block. int low = 0; int hi = sets.length - 1; @@ -187,9 +216,9 @@ public final class Character implements Serializable, Comparable { int mid = (low + hi) >> 1; UnicodeBlock b = sets[mid]; - if (ch < b.start) + if (codePoint < b.start) hi = mid - 1; - else if (ch > b.end) + else if (codePoint > b.end) low = mid + 1; else return b; @@ -198,703 +227,1300 @@ public final class Character implements Serializable, Comparable } /** + * <p> + * Returns the <code>UnicodeBlock</code> with the given name, as defined + * by the Unicode standard. The version of Unicode in use is defined by + * the <code>Character</code> class, and the names are given in the + * <code>Blocks-<version>.txt</code> file corresponding to that version. + * The name may be specified in one of three ways: + * </p> + * <ol> + * <li>The canonical, human-readable name used by the Unicode standard. + * This is the name with all spaces and hyphens retained. For example, + * `Basic Latin' retrieves the block, UnicodeBlock.BASIC_LATIN.</li> + * <li>The canonical name with all spaces removed e.g. `BasicLatin'.</li> + * <li>The name used for the constants specified by this class, which + * is the canonical name with all spaces and hyphens replaced with + * underscores e.g. `BASIC_LATIN'</li> + * </ol> + * <p> + * The names are compared case-insensitively using the case comparison + * associated with the U.S. English locale. The method recognises the + * previous names used for blocks as well as the current ones. At + * present, this simply means that the deprecated `SURROGATES_AREA' + * will be recognised by this method (the <code>of()</code> methods + * only return one of the three new surrogate blocks). + * </p> + * + * @param blockName the name of the block to look up. + * @return the specified block. + * @throws NullPointerException if the <code>blockName</code> is + * <code>null</code>. + * @throws IllegalArgumentException if the name does not match any Unicode + * block. + * @since 1.5 + */ + public static final UnicodeBlock forName(String blockName) + { + int type; + if (blockName.indexOf(' ') != -1) + type = CANONICAL_NAME; + else if (blockName.indexOf('_') != -1) + type = CONSTANT_NAME; + else + type = NO_SPACES_NAME; + Collator usCollator = Collator.getInstance(Locale.US); + usCollator.setStrength(Collator.PRIMARY); + /* Special case for deprecated blocks not in sets */ + switch (type) + { + case CANONICAL_NAME: + if (usCollator.compare(blockName, "Surrogates Area") == 0) + return SURROGATES_AREA; + break; + case NO_SPACES_NAME: + if (usCollator.compare(blockName, "SurrogatesArea") == 0) + return SURROGATES_AREA; + break; + case CONSTANT_NAME: + if (usCollator.compare(blockName, "SURROGATES_AREA") == 0) + return SURROGATES_AREA; + break; + } + /* Other cases */ + int setLength = sets.length; + switch (type) + { + case CANONICAL_NAME: + for (int i = 0; i < setLength; i++) + { + UnicodeBlock block = sets[i]; + if (usCollator.compare(blockName, block.canonicalName) == 0) + return block; + } + break; + case NO_SPACES_NAME: + for (int i = 0; i < setLength; i++) + { + UnicodeBlock block = sets[i]; + String nsName = block.canonicalName.replaceAll(" ",""); + if (usCollator.compare(blockName, nsName) == 0) + return block; + } + break; + case CONSTANT_NAME: + for (int i = 0; i < setLength; i++) + { + UnicodeBlock block = sets[i]; + if (usCollator.compare(blockName, block.toString()) == 0) + return block; + } + break; + } + throw new IllegalArgumentException("No Unicode block found for " + + blockName + "."); + } + + /** * Basic Latin. - * '\u0000' - '\u007F'. + * 0x0000 - 0x007F. */ public static final UnicodeBlock BASIC_LATIN - = new UnicodeBlock('\u0000', '\u007F', - "BASIC_LATIN"); + = new UnicodeBlock(0x0000, 0x007F, + "BASIC_LATIN", + "Basic Latin"); /** * Latin-1 Supplement. - * '\u0080' - '\u00FF'. + * 0x0080 - 0x00FF. */ public static final UnicodeBlock LATIN_1_SUPPLEMENT - = new UnicodeBlock('\u0080', '\u00FF', - "LATIN_1_SUPPLEMENT"); + = new UnicodeBlock(0x0080, 0x00FF, + "LATIN_1_SUPPLEMENT", + "Latin-1 Supplement"); /** * Latin Extended-A. - * '\u0100' - '\u017F'. + * 0x0100 - 0x017F. */ public static final UnicodeBlock LATIN_EXTENDED_A - = new UnicodeBlock('\u0100', '\u017F', - "LATIN_EXTENDED_A"); + = new UnicodeBlock(0x0100, 0x017F, + "LATIN_EXTENDED_A", + "Latin Extended-A"); /** * Latin Extended-B. - * '\u0180' - '\u024F'. + * 0x0180 - 0x024F. */ public static final UnicodeBlock LATIN_EXTENDED_B - = new UnicodeBlock('\u0180', '\u024F', - "LATIN_EXTENDED_B"); + = new UnicodeBlock(0x0180, 0x024F, + "LATIN_EXTENDED_B", + "Latin Extended-B"); /** * IPA Extensions. - * '\u0250' - '\u02AF'. + * 0x0250 - 0x02AF. */ public static final UnicodeBlock IPA_EXTENSIONS - = new UnicodeBlock('\u0250', '\u02AF', - "IPA_EXTENSIONS"); + = new UnicodeBlock(0x0250, 0x02AF, + "IPA_EXTENSIONS", + "IPA Extensions"); /** * Spacing Modifier Letters. - * '\u02B0' - '\u02FF'. + * 0x02B0 - 0x02FF. */ public static final UnicodeBlock SPACING_MODIFIER_LETTERS - = new UnicodeBlock('\u02B0', '\u02FF', - "SPACING_MODIFIER_LETTERS"); + = new UnicodeBlock(0x02B0, 0x02FF, + "SPACING_MODIFIER_LETTERS", + "Spacing Modifier Letters"); /** * Combining Diacritical Marks. - * '\u0300' - '\u036F'. + * 0x0300 - 0x036F. */ public static final UnicodeBlock COMBINING_DIACRITICAL_MARKS - = new UnicodeBlock('\u0300', '\u036F', - "COMBINING_DIACRITICAL_MARKS"); + = new UnicodeBlock(0x0300, 0x036F, + "COMBINING_DIACRITICAL_MARKS", + "Combining Diacritical Marks"); /** * Greek. - * '\u0370' - '\u03FF'. + * 0x0370 - 0x03FF. */ public static final UnicodeBlock GREEK - = new UnicodeBlock('\u0370', '\u03FF', - "GREEK"); + = new UnicodeBlock(0x0370, 0x03FF, + "GREEK", + "Greek"); /** * Cyrillic. - * '\u0400' - '\u04FF'. + * 0x0400 - 0x04FF. */ public static final UnicodeBlock CYRILLIC - = new UnicodeBlock('\u0400', '\u04FF', - "CYRILLIC"); + = new UnicodeBlock(0x0400, 0x04FF, + "CYRILLIC", + "Cyrillic"); + + /** + * Cyrillic Supplementary. + * 0x0500 - 0x052F. + * @since 1.5 + */ + public static final UnicodeBlock CYRILLIC_SUPPLEMENTARY + = new UnicodeBlock(0x0500, 0x052F, + "CYRILLIC_SUPPLEMENTARY", + "Cyrillic Supplementary"); /** * Armenian. - * '\u0530' - '\u058F'. + * 0x0530 - 0x058F. */ public static final UnicodeBlock ARMENIAN - = new UnicodeBlock('\u0530', '\u058F', - "ARMENIAN"); + = new UnicodeBlock(0x0530, 0x058F, + "ARMENIAN", + "Armenian"); /** * Hebrew. - * '\u0590' - '\u05FF'. + * 0x0590 - 0x05FF. */ public static final UnicodeBlock HEBREW - = new UnicodeBlock('\u0590', '\u05FF', - "HEBREW"); + = new UnicodeBlock(0x0590, 0x05FF, + "HEBREW", + "Hebrew"); /** * Arabic. - * '\u0600' - '\u06FF'. + * 0x0600 - 0x06FF. */ public static final UnicodeBlock ARABIC - = new UnicodeBlock('\u0600', '\u06FF', - "ARABIC"); + = new UnicodeBlock(0x0600, 0x06FF, + "ARABIC", + "Arabic"); /** * Syriac. - * '\u0700' - '\u074F'. + * 0x0700 - 0x074F. * @since 1.4 */ public static final UnicodeBlock SYRIAC - = new UnicodeBlock('\u0700', '\u074F', - "SYRIAC"); + = new UnicodeBlock(0x0700, 0x074F, + "SYRIAC", + "Syriac"); /** * Thaana. - * '\u0780' - '\u07BF'. + * 0x0780 - 0x07BF. * @since 1.4 */ public static final UnicodeBlock THAANA - = new UnicodeBlock('\u0780', '\u07BF', - "THAANA"); + = new UnicodeBlock(0x0780, 0x07BF, + "THAANA", + "Thaana"); /** * Devanagari. - * '\u0900' - '\u097F'. + * 0x0900 - 0x097F. */ public static final UnicodeBlock DEVANAGARI - = new UnicodeBlock('\u0900', '\u097F', - "DEVANAGARI"); + = new UnicodeBlock(0x0900, 0x097F, + "DEVANAGARI", + "Devanagari"); /** * Bengali. - * '\u0980' - '\u09FF'. + * 0x0980 - 0x09FF. */ public static final UnicodeBlock BENGALI - = new UnicodeBlock('\u0980', '\u09FF', - "BENGALI"); + = new UnicodeBlock(0x0980, 0x09FF, + "BENGALI", + "Bengali"); /** * Gurmukhi. - * '\u0A00' - '\u0A7F'. + * 0x0A00 - 0x0A7F. */ public static final UnicodeBlock GURMUKHI - = new UnicodeBlock('\u0A00', '\u0A7F', - "GURMUKHI"); + = new UnicodeBlock(0x0A00, 0x0A7F, + "GURMUKHI", + "Gurmukhi"); /** * Gujarati. - * '\u0A80' - '\u0AFF'. + * 0x0A80 - 0x0AFF. */ public static final UnicodeBlock GUJARATI - = new UnicodeBlock('\u0A80', '\u0AFF', - "GUJARATI"); + = new UnicodeBlock(0x0A80, 0x0AFF, + "GUJARATI", + "Gujarati"); /** * Oriya. - * '\u0B00' - '\u0B7F'. + * 0x0B00 - 0x0B7F. */ public static final UnicodeBlock ORIYA - = new UnicodeBlock('\u0B00', '\u0B7F', - "ORIYA"); + = new UnicodeBlock(0x0B00, 0x0B7F, + "ORIYA", + "Oriya"); /** * Tamil. - * '\u0B80' - '\u0BFF'. + * 0x0B80 - 0x0BFF. */ public static final UnicodeBlock TAMIL - = new UnicodeBlock('\u0B80', '\u0BFF', - "TAMIL"); + = new UnicodeBlock(0x0B80, 0x0BFF, + "TAMIL", + "Tamil"); /** * Telugu. - * '\u0C00' - '\u0C7F'. + * 0x0C00 - 0x0C7F. */ public static final UnicodeBlock TELUGU - = new UnicodeBlock('\u0C00', '\u0C7F', - "TELUGU"); + = new UnicodeBlock(0x0C00, 0x0C7F, + "TELUGU", + "Telugu"); /** * Kannada. - * '\u0C80' - '\u0CFF'. + * 0x0C80 - 0x0CFF. */ public static final UnicodeBlock KANNADA - = new UnicodeBlock('\u0C80', '\u0CFF', - "KANNADA"); + = new UnicodeBlock(0x0C80, 0x0CFF, + "KANNADA", + "Kannada"); /** * Malayalam. - * '\u0D00' - '\u0D7F'. + * 0x0D00 - 0x0D7F. */ public static final UnicodeBlock MALAYALAM - = new UnicodeBlock('\u0D00', '\u0D7F', - "MALAYALAM"); + = new UnicodeBlock(0x0D00, 0x0D7F, + "MALAYALAM", + "Malayalam"); /** * Sinhala. - * '\u0D80' - '\u0DFF'. + * 0x0D80 - 0x0DFF. * @since 1.4 */ public static final UnicodeBlock SINHALA - = new UnicodeBlock('\u0D80', '\u0DFF', - "SINHALA"); + = new UnicodeBlock(0x0D80, 0x0DFF, + "SINHALA", + "Sinhala"); /** * Thai. - * '\u0E00' - '\u0E7F'. + * 0x0E00 - 0x0E7F. */ public static final UnicodeBlock THAI - = new UnicodeBlock('\u0E00', '\u0E7F', - "THAI"); + = new UnicodeBlock(0x0E00, 0x0E7F, + "THAI", + "Thai"); /** * Lao. - * '\u0E80' - '\u0EFF'. + * 0x0E80 - 0x0EFF. */ public static final UnicodeBlock LAO - = new UnicodeBlock('\u0E80', '\u0EFF', - "LAO"); + = new UnicodeBlock(0x0E80, 0x0EFF, + "LAO", + "Lao"); /** * Tibetan. - * '\u0F00' - '\u0FFF'. + * 0x0F00 - 0x0FFF. */ public static final UnicodeBlock TIBETAN - = new UnicodeBlock('\u0F00', '\u0FFF', - "TIBETAN"); + = new UnicodeBlock(0x0F00, 0x0FFF, + "TIBETAN", + "Tibetan"); /** * Myanmar. - * '\u1000' - '\u109F'. + * 0x1000 - 0x109F. * @since 1.4 */ public static final UnicodeBlock MYANMAR - = new UnicodeBlock('\u1000', '\u109F', - "MYANMAR"); + = new UnicodeBlock(0x1000, 0x109F, + "MYANMAR", + "Myanmar"); /** * Georgian. - * '\u10A0' - '\u10FF'. + * 0x10A0 - 0x10FF. */ public static final UnicodeBlock GEORGIAN - = new UnicodeBlock('\u10A0', '\u10FF', - "GEORGIAN"); + = new UnicodeBlock(0x10A0, 0x10FF, + "GEORGIAN", + "Georgian"); /** * Hangul Jamo. - * '\u1100' - '\u11FF'. + * 0x1100 - 0x11FF. */ public static final UnicodeBlock HANGUL_JAMO - = new UnicodeBlock('\u1100', '\u11FF', - "HANGUL_JAMO"); + = new UnicodeBlock(0x1100, 0x11FF, + "HANGUL_JAMO", + "Hangul Jamo"); /** * Ethiopic. - * '\u1200' - '\u137F'. + * 0x1200 - 0x137F. * @since 1.4 */ public static final UnicodeBlock ETHIOPIC - = new UnicodeBlock('\u1200', '\u137F', - "ETHIOPIC"); + = new UnicodeBlock(0x1200, 0x137F, + "ETHIOPIC", + "Ethiopic"); /** * Cherokee. - * '\u13A0' - '\u13FF'. + * 0x13A0 - 0x13FF. * @since 1.4 */ public static final UnicodeBlock CHEROKEE - = new UnicodeBlock('\u13A0', '\u13FF', - "CHEROKEE"); + = new UnicodeBlock(0x13A0, 0x13FF, + "CHEROKEE", + "Cherokee"); /** * Unified Canadian Aboriginal Syllabics. - * '\u1400' - '\u167F'. + * 0x1400 - 0x167F. * @since 1.4 */ public static final UnicodeBlock UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS - = new UnicodeBlock('\u1400', '\u167F', - "UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS"); + = new UnicodeBlock(0x1400, 0x167F, + "UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS", + "Unified Canadian Aboriginal Syllabics"); /** * Ogham. - * '\u1680' - '\u169F'. + * 0x1680 - 0x169F. * @since 1.4 */ public static final UnicodeBlock OGHAM - = new UnicodeBlock('\u1680', '\u169F', - "OGHAM"); + = new UnicodeBlock(0x1680, 0x169F, + "OGHAM", + "Ogham"); /** * Runic. - * '\u16A0' - '\u16FF'. + * 0x16A0 - 0x16FF. * @since 1.4 */ public static final UnicodeBlock RUNIC - = new UnicodeBlock('\u16A0', '\u16FF', - "RUNIC"); + = new UnicodeBlock(0x16A0, 0x16FF, + "RUNIC", + "Runic"); + + /** + * Tagalog. + * 0x1700 - 0x171F. + * @since 1.5 + */ + public static final UnicodeBlock TAGALOG + = new UnicodeBlock(0x1700, 0x171F, + "TAGALOG", + "Tagalog"); + + /** + * Hanunoo. + * 0x1720 - 0x173F. + * @since 1.5 + */ + public static final UnicodeBlock HANUNOO + = new UnicodeBlock(0x1720, 0x173F, + "HANUNOO", + "Hanunoo"); + + /** + * Buhid. + * 0x1740 - 0x175F. + * @since 1.5 + */ + public static final UnicodeBlock BUHID + = new UnicodeBlock(0x1740, 0x175F, + "BUHID", + "Buhid"); + + /** + * Tagbanwa. + * 0x1760 - 0x177F. + * @since 1.5 + */ + public static final UnicodeBlock TAGBANWA + = new UnicodeBlock(0x1760, 0x177F, + "TAGBANWA", + "Tagbanwa"); /** * Khmer. - * '\u1780' - '\u17FF'. + * 0x1780 - 0x17FF. * @since 1.4 */ public static final UnicodeBlock KHMER - = new UnicodeBlock('\u1780', '\u17FF', - "KHMER"); + = new UnicodeBlock(0x1780, 0x17FF, + "KHMER", + "Khmer"); /** * Mongolian. - * '\u1800' - '\u18AF'. + * 0x1800 - 0x18AF. * @since 1.4 */ public static final UnicodeBlock MONGOLIAN - = new UnicodeBlock('\u1800', '\u18AF', - "MONGOLIAN"); + = new UnicodeBlock(0x1800, 0x18AF, + "MONGOLIAN", + "Mongolian"); + + /** + * Limbu. + * 0x1900 - 0x194F. + * @since 1.5 + */ + public static final UnicodeBlock LIMBU + = new UnicodeBlock(0x1900, 0x194F, + "LIMBU", + "Limbu"); + + /** + * Tai Le. + * 0x1950 - 0x197F. + * @since 1.5 + */ + public static final UnicodeBlock TAI_LE + = new UnicodeBlock(0x1950, 0x197F, + "TAI_LE", + "Tai Le"); + + /** + * Khmer Symbols. + * 0x19E0 - 0x19FF. + * @since 1.5 + */ + public static final UnicodeBlock KHMER_SYMBOLS + = new UnicodeBlock(0x19E0, 0x19FF, + "KHMER_SYMBOLS", + "Khmer Symbols"); + + /** + * Phonetic Extensions. + * 0x1D00 - 0x1D7F. + * @since 1.5 + */ + public static final UnicodeBlock PHONETIC_EXTENSIONS + = new UnicodeBlock(0x1D00, 0x1D7F, + "PHONETIC_EXTENSIONS", + "Phonetic Extensions"); /** * Latin Extended Additional. - * '\u1E00' - '\u1EFF'. + * 0x1E00 - 0x1EFF. */ public static final UnicodeBlock LATIN_EXTENDED_ADDITIONAL - = new UnicodeBlock('\u1E00', '\u1EFF', - "LATIN_EXTENDED_ADDITIONAL"); + = new UnicodeBlock(0x1E00, 0x1EFF, + "LATIN_EXTENDED_ADDITIONAL", + "Latin Extended Additional"); /** * Greek Extended. - * '\u1F00' - '\u1FFF'. + * 0x1F00 - 0x1FFF. */ public static final UnicodeBlock GREEK_EXTENDED - = new UnicodeBlock('\u1F00', '\u1FFF', - "GREEK_EXTENDED"); + = new UnicodeBlock(0x1F00, 0x1FFF, + "GREEK_EXTENDED", + "Greek Extended"); /** * General Punctuation. - * '\u2000' - '\u206F'. + * 0x2000 - 0x206F. */ public static final UnicodeBlock GENERAL_PUNCTUATION - = new UnicodeBlock('\u2000', '\u206F', - "GENERAL_PUNCTUATION"); + = new UnicodeBlock(0x2000, 0x206F, + "GENERAL_PUNCTUATION", + "General Punctuation"); /** * Superscripts and Subscripts. - * '\u2070' - '\u209F'. + * 0x2070 - 0x209F. */ public static final UnicodeBlock SUPERSCRIPTS_AND_SUBSCRIPTS - = new UnicodeBlock('\u2070', '\u209F', - "SUPERSCRIPTS_AND_SUBSCRIPTS"); + = new UnicodeBlock(0x2070, 0x209F, + "SUPERSCRIPTS_AND_SUBSCRIPTS", + "Superscripts and Subscripts"); /** * Currency Symbols. - * '\u20A0' - '\u20CF'. + * 0x20A0 - 0x20CF. */ public static final UnicodeBlock CURRENCY_SYMBOLS - = new UnicodeBlock('\u20A0', '\u20CF', - "CURRENCY_SYMBOLS"); + = new UnicodeBlock(0x20A0, 0x20CF, + "CURRENCY_SYMBOLS", + "Currency Symbols"); /** * Combining Marks for Symbols. - * '\u20D0' - '\u20FF'. + * 0x20D0 - 0x20FF. */ public static final UnicodeBlock COMBINING_MARKS_FOR_SYMBOLS - = new UnicodeBlock('\u20D0', '\u20FF', - "COMBINING_MARKS_FOR_SYMBOLS"); + = new UnicodeBlock(0x20D0, 0x20FF, + "COMBINING_MARKS_FOR_SYMBOLS", + "Combining Marks for Symbols"); /** * Letterlike Symbols. - * '\u2100' - '\u214F'. + * 0x2100 - 0x214F. */ public static final UnicodeBlock LETTERLIKE_SYMBOLS - = new UnicodeBlock('\u2100', '\u214F', - "LETTERLIKE_SYMBOLS"); + = new UnicodeBlock(0x2100, 0x214F, + "LETTERLIKE_SYMBOLS", + "Letterlike Symbols"); /** * Number Forms. - * '\u2150' - '\u218F'. + * 0x2150 - 0x218F. */ public static final UnicodeBlock NUMBER_FORMS - = new UnicodeBlock('\u2150', '\u218F', - "NUMBER_FORMS"); + = new UnicodeBlock(0x2150, 0x218F, + "NUMBER_FORMS", + "Number Forms"); /** * Arrows. - * '\u2190' - '\u21FF'. + * 0x2190 - 0x21FF. */ public static final UnicodeBlock ARROWS - = new UnicodeBlock('\u2190', '\u21FF', - "ARROWS"); + = new UnicodeBlock(0x2190, 0x21FF, + "ARROWS", + "Arrows"); /** * Mathematical Operators. - * '\u2200' - '\u22FF'. + * 0x2200 - 0x22FF. */ public static final UnicodeBlock MATHEMATICAL_OPERATORS - = new UnicodeBlock('\u2200', '\u22FF', - "MATHEMATICAL_OPERATORS"); + = new UnicodeBlock(0x2200, 0x22FF, + "MATHEMATICAL_OPERATORS", + "Mathematical Operators"); /** * Miscellaneous Technical. - * '\u2300' - '\u23FF'. + * 0x2300 - 0x23FF. */ public static final UnicodeBlock MISCELLANEOUS_TECHNICAL - = new UnicodeBlock('\u2300', '\u23FF', - "MISCELLANEOUS_TECHNICAL"); + = new UnicodeBlock(0x2300, 0x23FF, + "MISCELLANEOUS_TECHNICAL", + "Miscellaneous Technical"); /** * Control Pictures. - * '\u2400' - '\u243F'. + * 0x2400 - 0x243F. */ public static final UnicodeBlock CONTROL_PICTURES - = new UnicodeBlock('\u2400', '\u243F', - "CONTROL_PICTURES"); + = new UnicodeBlock(0x2400, 0x243F, + "CONTROL_PICTURES", + "Control Pictures"); /** * Optical Character Recognition. - * '\u2440' - '\u245F'. + * 0x2440 - 0x245F. */ public static final UnicodeBlock OPTICAL_CHARACTER_RECOGNITION - = new UnicodeBlock('\u2440', '\u245F', - "OPTICAL_CHARACTER_RECOGNITION"); + = new UnicodeBlock(0x2440, 0x245F, + "OPTICAL_CHARACTER_RECOGNITION", + "Optical Character Recognition"); /** * Enclosed Alphanumerics. - * '\u2460' - '\u24FF'. + * 0x2460 - 0x24FF. */ public static final UnicodeBlock ENCLOSED_ALPHANUMERICS - = new UnicodeBlock('\u2460', '\u24FF', - "ENCLOSED_ALPHANUMERICS"); + = new UnicodeBlock(0x2460, 0x24FF, + "ENCLOSED_ALPHANUMERICS", + "Enclosed Alphanumerics"); /** * Box Drawing. - * '\u2500' - '\u257F'. + * 0x2500 - 0x257F. */ public static final UnicodeBlock BOX_DRAWING - = new UnicodeBlock('\u2500', '\u257F', - "BOX_DRAWING"); + = new UnicodeBlock(0x2500, 0x257F, + "BOX_DRAWING", + "Box Drawing"); /** * Block Elements. - * '\u2580' - '\u259F'. + * 0x2580 - 0x259F. */ public static final UnicodeBlock BLOCK_ELEMENTS - = new UnicodeBlock('\u2580', '\u259F', - "BLOCK_ELEMENTS"); + = new UnicodeBlock(0x2580, 0x259F, + "BLOCK_ELEMENTS", + "Block Elements"); /** * Geometric Shapes. - * '\u25A0' - '\u25FF'. + * 0x25A0 - 0x25FF. */ public static final UnicodeBlock GEOMETRIC_SHAPES - = new UnicodeBlock('\u25A0', '\u25FF', - "GEOMETRIC_SHAPES"); + = new UnicodeBlock(0x25A0, 0x25FF, + "GEOMETRIC_SHAPES", + "Geometric Shapes"); /** * Miscellaneous Symbols. - * '\u2600' - '\u26FF'. + * 0x2600 - 0x26FF. */ public static final UnicodeBlock MISCELLANEOUS_SYMBOLS - = new UnicodeBlock('\u2600', '\u26FF', - "MISCELLANEOUS_SYMBOLS"); + = new UnicodeBlock(0x2600, 0x26FF, + "MISCELLANEOUS_SYMBOLS", + "Miscellaneous Symbols"); /** * Dingbats. - * '\u2700' - '\u27BF'. + * 0x2700 - 0x27BF. */ public static final UnicodeBlock DINGBATS - = new UnicodeBlock('\u2700', '\u27BF', - "DINGBATS"); + = new UnicodeBlock(0x2700, 0x27BF, + "DINGBATS", + "Dingbats"); + + /** + * Miscellaneous Mathematical Symbols-A. + * 0x27C0 - 0x27EF. + * @since 1.5 + */ + public static final UnicodeBlock MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A + = new UnicodeBlock(0x27C0, 0x27EF, + "MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A", + "Miscellaneous Mathematical Symbols-A"); + + /** + * Supplemental Arrows-A. + * 0x27F0 - 0x27FF. + * @since 1.5 + */ + public static final UnicodeBlock SUPPLEMENTAL_ARROWS_A + = new UnicodeBlock(0x27F0, 0x27FF, + "SUPPLEMENTAL_ARROWS_A", + "Supplemental Arrows-A"); /** * Braille Patterns. - * '\u2800' - '\u28FF'. + * 0x2800 - 0x28FF. * @since 1.4 */ public static final UnicodeBlock BRAILLE_PATTERNS - = new UnicodeBlock('\u2800', '\u28FF', - "BRAILLE_PATTERNS"); + = new UnicodeBlock(0x2800, 0x28FF, + "BRAILLE_PATTERNS", + "Braille Patterns"); + + /** + * Supplemental Arrows-B. + * 0x2900 - 0x297F. + * @since 1.5 + */ + public static final UnicodeBlock SUPPLEMENTAL_ARROWS_B + = new UnicodeBlock(0x2900, 0x297F, + "SUPPLEMENTAL_ARROWS_B", + "Supplemental Arrows-B"); + + /** + * Miscellaneous Mathematical Symbols-B. + * 0x2980 - 0x29FF. + * @since 1.5 + */ + public static final UnicodeBlock MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B + = new UnicodeBlock(0x2980, 0x29FF, + "MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B", + "Miscellaneous Mathematical Symbols-B"); + + /** + * Supplemental Mathematical Operators. + * 0x2A00 - 0x2AFF. + * @since 1.5 + */ + public static final UnicodeBlock SUPPLEMENTAL_MATHEMATICAL_OPERATORS + = new UnicodeBlock(0x2A00, 0x2AFF, + "SUPPLEMENTAL_MATHEMATICAL_OPERATORS", + "Supplemental Mathematical Operators"); + + /** + * Miscellaneous Symbols and Arrows. + * 0x2B00 - 0x2BFF. + * @since 1.5 + */ + public static final UnicodeBlock MISCELLANEOUS_SYMBOLS_AND_ARROWS + = new UnicodeBlock(0x2B00, 0x2BFF, + "MISCELLANEOUS_SYMBOLS_AND_ARROWS", + "Miscellaneous Symbols and Arrows"); /** * CJK Radicals Supplement. - * '\u2E80' - '\u2EFF'. + * 0x2E80 - 0x2EFF. * @since 1.4 */ public static final UnicodeBlock CJK_RADICALS_SUPPLEMENT - = new UnicodeBlock('\u2E80', '\u2EFF', - "CJK_RADICALS_SUPPLEMENT"); + = new UnicodeBlock(0x2E80, 0x2EFF, + "CJK_RADICALS_SUPPLEMENT", + "CJK Radicals Supplement"); /** * Kangxi Radicals. - * '\u2F00' - '\u2FDF'. + * 0x2F00 - 0x2FDF. * @since 1.4 */ public static final UnicodeBlock KANGXI_RADICALS - = new UnicodeBlock('\u2F00', '\u2FDF', - "KANGXI_RADICALS"); + = new UnicodeBlock(0x2F00, 0x2FDF, + "KANGXI_RADICALS", + "Kangxi Radicals"); /** * Ideographic Description Characters. - * '\u2FF0' - '\u2FFF'. + * 0x2FF0 - 0x2FFF. * @since 1.4 */ public static final UnicodeBlock IDEOGRAPHIC_DESCRIPTION_CHARACTERS - = new UnicodeBlock('\u2FF0', '\u2FFF', - "IDEOGRAPHIC_DESCRIPTION_CHARACTERS"); + = new UnicodeBlock(0x2FF0, 0x2FFF, + "IDEOGRAPHIC_DESCRIPTION_CHARACTERS", + "Ideographic Description Characters"); /** * CJK Symbols and Punctuation. - * '\u3000' - '\u303F'. + * 0x3000 - 0x303F. */ public static final UnicodeBlock CJK_SYMBOLS_AND_PUNCTUATION - = new UnicodeBlock('\u3000', '\u303F', - "CJK_SYMBOLS_AND_PUNCTUATION"); + = new UnicodeBlock(0x3000, 0x303F, + "CJK_SYMBOLS_AND_PUNCTUATION", + "CJK Symbols and Punctuation"); /** * Hiragana. - * '\u3040' - '\u309F'. + * 0x3040 - 0x309F. */ public static final UnicodeBlock HIRAGANA - = new UnicodeBlock('\u3040', '\u309F', - "HIRAGANA"); + = new UnicodeBlock(0x3040, 0x309F, + "HIRAGANA", + "Hiragana"); /** * Katakana. - * '\u30A0' - '\u30FF'. + * 0x30A0 - 0x30FF. */ public static final UnicodeBlock KATAKANA - = new UnicodeBlock('\u30A0', '\u30FF', - "KATAKANA"); + = new UnicodeBlock(0x30A0, 0x30FF, + "KATAKANA", + "Katakana"); /** * Bopomofo. - * '\u3100' - '\u312F'. + * 0x3100 - 0x312F. */ public static final UnicodeBlock BOPOMOFO - = new UnicodeBlock('\u3100', '\u312F', - "BOPOMOFO"); + = new UnicodeBlock(0x3100, 0x312F, + "BOPOMOFO", + "Bopomofo"); /** * Hangul Compatibility Jamo. - * '\u3130' - '\u318F'. + * 0x3130 - 0x318F. */ public static final UnicodeBlock HANGUL_COMPATIBILITY_JAMO - = new UnicodeBlock('\u3130', '\u318F', - "HANGUL_COMPATIBILITY_JAMO"); + = new UnicodeBlock(0x3130, 0x318F, + "HANGUL_COMPATIBILITY_JAMO", + "Hangul Compatibility Jamo"); /** * Kanbun. - * '\u3190' - '\u319F'. + * 0x3190 - 0x319F. */ public static final UnicodeBlock KANBUN - = new UnicodeBlock('\u3190', '\u319F', - "KANBUN"); + = new UnicodeBlock(0x3190, 0x319F, + "KANBUN", + "Kanbun"); /** * Bopomofo Extended. - * '\u31A0' - '\u31BF'. + * 0x31A0 - 0x31BF. * @since 1.4 */ public static final UnicodeBlock BOPOMOFO_EXTENDED - = new UnicodeBlock('\u31A0', '\u31BF', - "BOPOMOFO_EXTENDED"); + = new UnicodeBlock(0x31A0, 0x31BF, + "BOPOMOFO_EXTENDED", + "Bopomofo Extended"); + + /** + * Katakana Phonetic Extensions. + * 0x31F0 - 0x31FF. + * @since 1.5 + */ + public static final UnicodeBlock KATAKANA_PHONETIC_EXTENSIONS + = new UnicodeBlock(0x31F0, 0x31FF, + "KATAKANA_PHONETIC_EXTENSIONS", + "Katakana Phonetic Extensions"); /** * Enclosed CJK Letters and Months. - * '\u3200' - '\u32FF'. + * 0x3200 - 0x32FF. */ public static final UnicodeBlock ENCLOSED_CJK_LETTERS_AND_MONTHS - = new UnicodeBlock('\u3200', '\u32FF', - "ENCLOSED_CJK_LETTERS_AND_MONTHS"); + = new UnicodeBlock(0x3200, 0x32FF, + "ENCLOSED_CJK_LETTERS_AND_MONTHS", + "Enclosed CJK Letters and Months"); /** * CJK Compatibility. - * '\u3300' - '\u33FF'. + * 0x3300 - 0x33FF. */ public static final UnicodeBlock CJK_COMPATIBILITY - = new UnicodeBlock('\u3300', '\u33FF', - "CJK_COMPATIBILITY"); + = new UnicodeBlock(0x3300, 0x33FF, + "CJK_COMPATIBILITY", + "CJK Compatibility"); /** * CJK Unified Ideographs Extension A. - * '\u3400' - '\u4DB5'. + * 0x3400 - 0x4DBF. * @since 1.4 */ public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A - = new UnicodeBlock('\u3400', '\u4DB5', - "CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A"); + = new UnicodeBlock(0x3400, 0x4DBF, + "CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A", + "CJK Unified Ideographs Extension A"); + + /** + * Yijing Hexagram Symbols. + * 0x4DC0 - 0x4DFF. + * @since 1.5 + */ + public static final UnicodeBlock YIJING_HEXAGRAM_SYMBOLS + = new UnicodeBlock(0x4DC0, 0x4DFF, + "YIJING_HEXAGRAM_SYMBOLS", + "Yijing Hexagram Symbols"); /** * CJK Unified Ideographs. - * '\u4E00' - '\u9FFF'. + * 0x4E00 - 0x9FFF. */ public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS - = new UnicodeBlock('\u4E00', '\u9FFF', - "CJK_UNIFIED_IDEOGRAPHS"); + = new UnicodeBlock(0x4E00, 0x9FFF, + "CJK_UNIFIED_IDEOGRAPHS", + "CJK Unified Ideographs"); /** * Yi Syllables. - * '\uA000' - '\uA48F'. + * 0xA000 - 0xA48F. * @since 1.4 */ public static final UnicodeBlock YI_SYLLABLES - = new UnicodeBlock('\uA000', '\uA48F', - "YI_SYLLABLES"); + = new UnicodeBlock(0xA000, 0xA48F, + "YI_SYLLABLES", + "Yi Syllables"); /** * Yi Radicals. - * '\uA490' - '\uA4CF'. + * 0xA490 - 0xA4CF. * @since 1.4 */ public static final UnicodeBlock YI_RADICALS - = new UnicodeBlock('\uA490', '\uA4CF', - "YI_RADICALS"); + = new UnicodeBlock(0xA490, 0xA4CF, + "YI_RADICALS", + "Yi Radicals"); /** * Hangul Syllables. - * '\uAC00' - '\uD7A3'. + * 0xAC00 - 0xD7AF. */ public static final UnicodeBlock HANGUL_SYLLABLES - = new UnicodeBlock('\uAC00', '\uD7A3', - "HANGUL_SYLLABLES"); + = new UnicodeBlock(0xAC00, 0xD7AF, + "HANGUL_SYLLABLES", + "Hangul Syllables"); /** - * Surrogates Area. - * '\uD800' - '\uDFFF'. + * High Surrogates. + * 0xD800 - 0xDB7F. + * @since 1.5 */ - public static final UnicodeBlock SURROGATES_AREA - = new UnicodeBlock('\uD800', '\uDFFF', - "SURROGATES_AREA"); + public static final UnicodeBlock HIGH_SURROGATES + = new UnicodeBlock(0xD800, 0xDB7F, + "HIGH_SURROGATES", + "High Surrogates"); + + /** + * High Private Use Surrogates. + * 0xDB80 - 0xDBFF. + * @since 1.5 + */ + public static final UnicodeBlock HIGH_PRIVATE_USE_SURROGATES + = new UnicodeBlock(0xDB80, 0xDBFF, + "HIGH_PRIVATE_USE_SURROGATES", + "High Private Use Surrogates"); + + /** + * Low Surrogates. + * 0xDC00 - 0xDFFF. + * @since 1.5 + */ + public static final UnicodeBlock LOW_SURROGATES + = new UnicodeBlock(0xDC00, 0xDFFF, + "LOW_SURROGATES", + "Low Surrogates"); /** * Private Use Area. - * '\uE000' - '\uF8FF'. + * 0xE000 - 0xF8FF. */ public static final UnicodeBlock PRIVATE_USE_AREA - = new UnicodeBlock('\uE000', '\uF8FF', - "PRIVATE_USE_AREA"); + = new UnicodeBlock(0xE000, 0xF8FF, + "PRIVATE_USE_AREA", + "Private Use Area"); /** * CJK Compatibility Ideographs. - * '\uF900' - '\uFAFF'. + * 0xF900 - 0xFAFF. */ public static final UnicodeBlock CJK_COMPATIBILITY_IDEOGRAPHS - = new UnicodeBlock('\uF900', '\uFAFF', - "CJK_COMPATIBILITY_IDEOGRAPHS"); + = new UnicodeBlock(0xF900, 0xFAFF, + "CJK_COMPATIBILITY_IDEOGRAPHS", + "CJK Compatibility Ideographs"); /** * Alphabetic Presentation Forms. - * '\uFB00' - '\uFB4F'. + * 0xFB00 - 0xFB4F. */ public static final UnicodeBlock ALPHABETIC_PRESENTATION_FORMS - = new UnicodeBlock('\uFB00', '\uFB4F', - "ALPHABETIC_PRESENTATION_FORMS"); + = new UnicodeBlock(0xFB00, 0xFB4F, + "ALPHABETIC_PRESENTATION_FORMS", + "Alphabetic Presentation Forms"); /** * Arabic Presentation Forms-A. - * '\uFB50' - '\uFDFF'. + * 0xFB50 - 0xFDFF. */ public static final UnicodeBlock ARABIC_PRESENTATION_FORMS_A - = new UnicodeBlock('\uFB50', '\uFDFF', - "ARABIC_PRESENTATION_FORMS_A"); + = new UnicodeBlock(0xFB50, 0xFDFF, + "ARABIC_PRESENTATION_FORMS_A", + "Arabic Presentation Forms-A"); + + /** + * Variation Selectors. + * 0xFE00 - 0xFE0F. + * @since 1.5 + */ + public static final UnicodeBlock VARIATION_SELECTORS + = new UnicodeBlock(0xFE00, 0xFE0F, + "VARIATION_SELECTORS", + "Variation Selectors"); /** * Combining Half Marks. - * '\uFE20' - '\uFE2F'. + * 0xFE20 - 0xFE2F. */ public static final UnicodeBlock COMBINING_HALF_MARKS - = new UnicodeBlock('\uFE20', '\uFE2F', - "COMBINING_HALF_MARKS"); + = new UnicodeBlock(0xFE20, 0xFE2F, + "COMBINING_HALF_MARKS", + "Combining Half Marks"); /** * CJK Compatibility Forms. - * '\uFE30' - '\uFE4F'. + * 0xFE30 - 0xFE4F. */ public static final UnicodeBlock CJK_COMPATIBILITY_FORMS - = new UnicodeBlock('\uFE30', '\uFE4F', - "CJK_COMPATIBILITY_FORMS"); + = new UnicodeBlock(0xFE30, 0xFE4F, + "CJK_COMPATIBILITY_FORMS", + "CJK Compatibility Forms"); /** * Small Form Variants. - * '\uFE50' - '\uFE6F'. + * 0xFE50 - 0xFE6F. */ public static final UnicodeBlock SMALL_FORM_VARIANTS - = new UnicodeBlock('\uFE50', '\uFE6F', - "SMALL_FORM_VARIANTS"); + = new UnicodeBlock(0xFE50, 0xFE6F, + "SMALL_FORM_VARIANTS", + "Small Form Variants"); /** * Arabic Presentation Forms-B. - * '\uFE70' - '\uFEFE'. + * 0xFE70 - 0xFEFF. */ public static final UnicodeBlock ARABIC_PRESENTATION_FORMS_B - = new UnicodeBlock('\uFE70', '\uFEFE', - "ARABIC_PRESENTATION_FORMS_B"); + = new UnicodeBlock(0xFE70, 0xFEFF, + "ARABIC_PRESENTATION_FORMS_B", + "Arabic Presentation Forms-B"); /** * Halfwidth and Fullwidth Forms. - * '\uFF00' - '\uFFEF'. + * 0xFF00 - 0xFFEF. */ public static final UnicodeBlock HALFWIDTH_AND_FULLWIDTH_FORMS - = new UnicodeBlock('\uFF00', '\uFFEF', - "HALFWIDTH_AND_FULLWIDTH_FORMS"); + = new UnicodeBlock(0xFF00, 0xFFEF, + "HALFWIDTH_AND_FULLWIDTH_FORMS", + "Halfwidth and Fullwidth Forms"); /** * Specials. - * '\uFEFF', '\uFFF0' - '\uFFFD'. + * 0xFFF0 - 0xFFFF. */ public static final UnicodeBlock SPECIALS - = new UnicodeBlock('\uFFF0', '\uFFFD', - "SPECIALS"); + = new UnicodeBlock(0xFFF0, 0xFFFF, + "SPECIALS", + "Specials"); + + /** + * Linear B Syllabary. + * 0x10000 - 0x1007F. + * @since 1.5 + */ + public static final UnicodeBlock LINEAR_B_SYLLABARY + = new UnicodeBlock(0x10000, 0x1007F, + "LINEAR_B_SYLLABARY", + "Linear B Syllabary"); + + /** + * Linear B Ideograms. + * 0x10080 - 0x100FF. + * @since 1.5 + */ + public static final UnicodeBlock LINEAR_B_IDEOGRAMS + = new UnicodeBlock(0x10080, 0x100FF, + "LINEAR_B_IDEOGRAMS", + "Linear B Ideograms"); + + /** + * Aegean Numbers. + * 0x10100 - 0x1013F. + * @since 1.5 + */ + public static final UnicodeBlock AEGEAN_NUMBERS + = new UnicodeBlock(0x10100, 0x1013F, + "AEGEAN_NUMBERS", + "Aegean Numbers"); + + /** + * Old Italic. + * 0x10300 - 0x1032F. + * @since 1.5 + */ + public static final UnicodeBlock OLD_ITALIC + = new UnicodeBlock(0x10300, 0x1032F, + "OLD_ITALIC", + "Old Italic"); + + /** + * Gothic. + * 0x10330 - 0x1034F. + * @since 1.5 + */ + public static final UnicodeBlock GOTHIC + = new UnicodeBlock(0x10330, 0x1034F, + "GOTHIC", + "Gothic"); + + /** + * Ugaritic. + * 0x10380 - 0x1039F. + * @since 1.5 + */ + public static final UnicodeBlock UGARITIC + = new UnicodeBlock(0x10380, 0x1039F, + "UGARITIC", + "Ugaritic"); + + /** + * Deseret. + * 0x10400 - 0x1044F. + * @since 1.5 + */ + public static final UnicodeBlock DESERET + = new UnicodeBlock(0x10400, 0x1044F, + "DESERET", + "Deseret"); + + /** + * Shavian. + * 0x10450 - 0x1047F. + * @since 1.5 + */ + public static final UnicodeBlock SHAVIAN + = new UnicodeBlock(0x10450, 0x1047F, + "SHAVIAN", + "Shavian"); + + /** + * Osmanya. + * 0x10480 - 0x104AF. + * @since 1.5 + */ + public static final UnicodeBlock OSMANYA + = new UnicodeBlock(0x10480, 0x104AF, + "OSMANYA", + "Osmanya"); + + /** + * Cypriot Syllabary. + * 0x10800 - 0x1083F. + * @since 1.5 + */ + public static final UnicodeBlock CYPRIOT_SYLLABARY + = new UnicodeBlock(0x10800, 0x1083F, + "CYPRIOT_SYLLABARY", + "Cypriot Syllabary"); + + /** + * Byzantine Musical Symbols. + * 0x1D000 - 0x1D0FF. + * @since 1.5 + */ + public static final UnicodeBlock BYZANTINE_MUSICAL_SYMBOLS + = new UnicodeBlock(0x1D000, 0x1D0FF, + "BYZANTINE_MUSICAL_SYMBOLS", + "Byzantine Musical Symbols"); + + /** + * Musical Symbols. + * 0x1D100 - 0x1D1FF. + * @since 1.5 + */ + public static final UnicodeBlock MUSICAL_SYMBOLS + = new UnicodeBlock(0x1D100, 0x1D1FF, + "MUSICAL_SYMBOLS", + "Musical Symbols"); + + /** + * Tai Xuan Jing Symbols. + * 0x1D300 - 0x1D35F. + * @since 1.5 + */ + public static final UnicodeBlock TAI_XUAN_JING_SYMBOLS + = new UnicodeBlock(0x1D300, 0x1D35F, + "TAI_XUAN_JING_SYMBOLS", + "Tai Xuan Jing Symbols"); + + /** + * Mathematical Alphanumeric Symbols. + * 0x1D400 - 0x1D7FF. + * @since 1.5 + */ + public static final UnicodeBlock MATHEMATICAL_ALPHANUMERIC_SYMBOLS + = new UnicodeBlock(0x1D400, 0x1D7FF, + "MATHEMATICAL_ALPHANUMERIC_SYMBOLS", + "Mathematical Alphanumeric Symbols"); + + /** + * CJK Unified Ideographs Extension B. + * 0x20000 - 0x2A6DF. + * @since 1.5 + */ + public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B + = new UnicodeBlock(0x20000, 0x2A6DF, + "CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B", + "CJK Unified Ideographs Extension B"); + + /** + * CJK Compatibility Ideographs Supplement. + * 0x2F800 - 0x2FA1F. + * @since 1.5 + */ + public static final UnicodeBlock CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT + = new UnicodeBlock(0x2F800, 0x2FA1F, + "CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT", + "CJK Compatibility Ideographs Supplement"); + + /** + * Tags. + * 0xE0000 - 0xE007F. + * @since 1.5 + */ + public static final UnicodeBlock TAGS + = new UnicodeBlock(0xE0000, 0xE007F, + "TAGS", + "Tags"); + + /** + * Variation Selectors Supplement. + * 0xE0100 - 0xE01EF. + * @since 1.5 + */ + public static final UnicodeBlock VARIATION_SELECTORS_SUPPLEMENT + = new UnicodeBlock(0xE0100, 0xE01EF, + "VARIATION_SELECTORS_SUPPLEMENT", + "Variation Selectors Supplement"); + + /** + * Supplementary Private Use Area-A. + * 0xF0000 - 0xFFFFF. + * @since 1.5 + */ + public static final UnicodeBlock SUPPLEMENTARY_PRIVATE_USE_AREA_A + = new UnicodeBlock(0xF0000, 0xFFFFF, + "SUPPLEMENTARY_PRIVATE_USE_AREA_A", + "Supplementary Private Use Area-A"); + + /** + * Supplementary Private Use Area-B. + * 0x100000 - 0x10FFFF. + * @since 1.5 + */ + public static final UnicodeBlock SUPPLEMENTARY_PRIVATE_USE_AREA_B + = new UnicodeBlock(0x100000, 0x10FFFF, + "SUPPLEMENTARY_PRIVATE_USE_AREA_B", + "Supplementary Private Use Area-B"); + + /** + * Surrogates Area. + * 'D800' - 'DFFF'. + * @deprecated As of 1.5, the three areas, + * <a href="#HIGH_SURROGATES">HIGH_SURROGATES</a>, + * <a href="#HIGH_PRIVATE_USE_SURROGATES">HIGH_PRIVATE_USE_SURROGATES</a> + * and <a href="#LOW_SURROGATES">LOW_SURROGATES</a>, as defined + * by the Unicode standard, should be used in preference to + * this. These are also returned from calls to <code>of(int)</code> + * and <code>of(char)</code>. + */ + public static final UnicodeBlock SURROGATES_AREA + = new UnicodeBlock(0xD800, 0xDFFF, + "SURROGATES_AREA", + "Surrogates Area"); /** * The defined subsets. @@ -909,6 +1535,7 @@ public final class Character implements Serializable, Comparable COMBINING_DIACRITICAL_MARKS, GREEK, CYRILLIC, + CYRILLIC_SUPPLEMENTARY, ARMENIAN, HEBREW, ARABIC, @@ -935,8 +1562,16 @@ public final class Character implements Serializable, Comparable UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS, OGHAM, RUNIC, + TAGALOG, + HANUNOO, + BUHID, + TAGBANWA, KHMER, MONGOLIAN, + LIMBU, + TAI_LE, + KHMER_SYMBOLS, + PHONETIC_EXTENSIONS, LATIN_EXTENDED_ADDITIONAL, GREEK_EXTENDED, GENERAL_PUNCTUATION, @@ -956,7 +1591,13 @@ public final class Character implements Serializable, Comparable GEOMETRIC_SHAPES, MISCELLANEOUS_SYMBOLS, DINGBATS, + MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A, + SUPPLEMENTAL_ARROWS_A, BRAILLE_PATTERNS, + SUPPLEMENTAL_ARROWS_B, + MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B, + SUPPLEMENTAL_MATHEMATICAL_OPERATORS, + MISCELLANEOUS_SYMBOLS_AND_ARROWS, CJK_RADICALS_SUPPLEMENT, KANGXI_RADICALS, IDEOGRAPHIC_DESCRIPTION_CHARACTERS, @@ -967,24 +1608,49 @@ public final class Character implements Serializable, Comparable HANGUL_COMPATIBILITY_JAMO, KANBUN, BOPOMOFO_EXTENDED, + KATAKANA_PHONETIC_EXTENSIONS, ENCLOSED_CJK_LETTERS_AND_MONTHS, CJK_COMPATIBILITY, CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A, + YIJING_HEXAGRAM_SYMBOLS, CJK_UNIFIED_IDEOGRAPHS, YI_SYLLABLES, YI_RADICALS, HANGUL_SYLLABLES, - SURROGATES_AREA, + HIGH_SURROGATES, + HIGH_PRIVATE_USE_SURROGATES, + LOW_SURROGATES, PRIVATE_USE_AREA, CJK_COMPATIBILITY_IDEOGRAPHS, ALPHABETIC_PRESENTATION_FORMS, ARABIC_PRESENTATION_FORMS_A, + VARIATION_SELECTORS, COMBINING_HALF_MARKS, CJK_COMPATIBILITY_FORMS, SMALL_FORM_VARIANTS, ARABIC_PRESENTATION_FORMS_B, HALFWIDTH_AND_FULLWIDTH_FORMS, SPECIALS, + LINEAR_B_SYLLABARY, + LINEAR_B_IDEOGRAMS, + AEGEAN_NUMBERS, + OLD_ITALIC, + GOTHIC, + UGARITIC, + DESERET, + SHAVIAN, + OSMANYA, + CYPRIOT_SYLLABARY, + BYZANTINE_MUSICAL_SYMBOLS, + MUSICAL_SYMBOLS, + TAI_XUAN_JING_SYMBOLS, + MATHEMATICAL_ALPHANUMERIC_SYMBOLS, + CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B, + CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT, + TAGS, + VARIATION_SELECTORS_SUPPLEMENT, + SUPPLEMENTARY_PRIVATE_USE_AREA_A, + SUPPLEMENTARY_PRIVATE_USE_AREA_B, }; } // class UnicodeBlock diff --git a/libjava/java/lang/Math.java b/libjava/java/lang/Math.java new file mode 100644 index 0000000..08081e2 --- /dev/null +++ b/libjava/java/lang/Math.java @@ -0,0 +1,650 @@ +/* java.lang.Math -- common mathematical functions, native allowed + Copyright (C) 1998, 2001, 2002, 2003 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package java.lang; + +import gnu.classpath.Configuration; + +import java.util.Random; + +/** + * Helper class containing useful mathematical functions and constants. + * <P> + * + * Note that angles are specified in radians. Conversion functions are + * provided for your convenience. + * + * @author Paul Fisher + * @author John Keiser + * @author Eric Blake (ebb9@email.byu.edu) + * @since 1.0 + */ +public final class Math +{ + /** + * Math is non-instantiable + */ + private Math() + { + } + + static + { + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary("javalang"); + } + } + + /** + * A random number generator, initialized on first use. + */ + private static Random rand; + + /** + * The most accurate approximation to the mathematical constant <em>e</em>: + * <code>2.718281828459045</code>. Used in natural log and exp. + * + * @see #log(double) + * @see #exp(double) + */ + public static final double E = 2.718281828459045; + + /** + * The most accurate approximation to the mathematical constant <em>pi</em>: + * <code>3.141592653589793</code>. This is the ratio of a circle's diameter + * to its circumference. + */ + public static final double PI = 3.141592653589793; + + /** + * Take the absolute value of the argument. + * (Absolute value means make it positive.) + * <P> + * + * Note that the the largest negative value (Integer.MIN_VALUE) cannot + * be made positive. In this case, because of the rules of negation in + * a computer, MIN_VALUE is what will be returned. + * This is a <em>negative</em> value. You have been warned. + * + * @param i the number to take the absolute value of + * @return the absolute value + * @see Integer#MIN_VALUE + */ + public static int abs(int i) + { + return (i < 0) ? -i : i; + } + + /** + * Take the absolute value of the argument. + * (Absolute value means make it positive.) + * <P> + * + * Note that the the largest negative value (Long.MIN_VALUE) cannot + * be made positive. In this case, because of the rules of negation in + * a computer, MIN_VALUE is what will be returned. + * This is a <em>negative</em> value. You have been warned. + * + * @param l the number to take the absolute value of + * @return the absolute value + * @see Long#MIN_VALUE + */ + public static long abs(long l) + { + return (l < 0) ? -l : l; + } + + /** + * Take the absolute value of the argument. + * (Absolute value means make it positive.) + * <P> + * + * This is equivalent, but faster than, calling + * <code>Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))</code>. + * + * @param f the number to take the absolute value of + * @return the absolute value + */ + public static float abs(float f) + { + return (f <= 0) ? 0 - f : f; + } + + /** + * Take the absolute value of the argument. + * (Absolute value means make it positive.) + * + * This is equivalent, but faster than, calling + * <code>Double.longBitsToDouble(Double.doubleToLongBits(a) + * << 1) >>> 1);</code>. + * + * @param d the number to take the absolute value of + * @return the absolute value + */ + public static double abs(double d) + { + return (d <= 0) ? 0 - d : d; + } + + /** + * Return whichever argument is smaller. + * + * @param a the first number + * @param b a second number + * @return the smaller of the two numbers + */ + public static int min(int a, int b) + { + return (a < b) ? a : b; + } + + /** + * Return whichever argument is smaller. + * + * @param a the first number + * @param b a second number + * @return the smaller of the two numbers + */ + public static long min(long a, long b) + { + return (a < b) ? a : b; + } + + /** + * Return whichever argument is smaller. If either argument is NaN, the + * result is NaN, and when comparing 0 and -0, -0 is always smaller. + * + * @param a the first number + * @param b a second number + * @return the smaller of the two numbers + */ + public static float min(float a, float b) + { + // this check for NaN, from JLS 15.21.1, saves a method call + if (a != a) + return a; + // no need to check if b is NaN; < will work correctly + // recall that -0.0 == 0.0, but [+-]0.0 - [+-]0.0 behaves special + if (a == 0 && b == 0) + return -(-a - b); + return (a < b) ? a : b; + } + + /** + * Return whichever argument is smaller. If either argument is NaN, the + * result is NaN, and when comparing 0 and -0, -0 is always smaller. + * + * @param a the first number + * @param b a second number + * @return the smaller of the two numbers + */ + public static double min(double a, double b) + { + // this check for NaN, from JLS 15.21.1, saves a method call + if (a != a) + return a; + // no need to check if b is NaN; < will work correctly + // recall that -0.0 == 0.0, but [+-]0.0 - [+-]0.0 behaves special + if (a == 0 && b == 0) + return -(-a - b); + return (a < b) ? a : b; + } + + /** + * Return whichever argument is larger. + * + * @param a the first number + * @param b a second number + * @return the larger of the two numbers + */ + public static int max(int a, int b) + { + return (a > b) ? a : b; + } + + /** + * Return whichever argument is larger. + * + * @param a the first number + * @param b a second number + * @return the larger of the two numbers + */ + public static long max(long a, long b) + { + return (a > b) ? a : b; + } + + /** + * Return whichever argument is larger. If either argument is NaN, the + * result is NaN, and when comparing 0 and -0, 0 is always larger. + * + * @param a the first number + * @param b a second number + * @return the larger of the two numbers + */ + public static float max(float a, float b) + { + // this check for NaN, from JLS 15.21.1, saves a method call + if (a != a) + return a; + // no need to check if b is NaN; > will work correctly + // recall that -0.0 == 0.0, but [+-]0.0 - [+-]0.0 behaves special + if (a == 0 && b == 0) + return a - -b; + return (a > b) ? a : b; + } + + /** + * Return whichever argument is larger. If either argument is NaN, the + * result is NaN, and when comparing 0 and -0, 0 is always larger. + * + * @param a the first number + * @param b a second number + * @return the larger of the two numbers + */ + public static double max(double a, double b) + { + // this check for NaN, from JLS 15.21.1, saves a method call + if (a != a) + return a; + // no need to check if b is NaN; > will work correctly + // recall that -0.0 == 0.0, but [+-]0.0 - [+-]0.0 behaves special + if (a == 0 && b == 0) + return a - -b; + return (a > b) ? a : b; + } + + /** + * The trigonometric function <em>sin</em>. The sine of NaN or infinity is + * NaN, and the sine of 0 retains its sign. This is accurate within 1 ulp, + * and is semi-monotonic. + * + * @param a the angle (in radians) + * @return sin(a) + */ + public static native double sin(double a); + + /** + * The trigonometric function <em>cos</em>. The cosine of NaN or infinity is + * NaN. This is accurate within 1 ulp, and is semi-monotonic. + * + * @param a the angle (in radians) + * @return cos(a) + */ + public static native double cos(double a); + + /** + * The trigonometric function <em>tan</em>. The tangent of NaN or infinity + * is NaN, and the tangent of 0 retains its sign. This is accurate within 1 + * ulp, and is semi-monotonic. + * + * @param a the angle (in radians) + * @return tan(a) + */ + public static native double tan(double a); + + /** + * The trigonometric function <em>arcsin</em>. The range of angles returned + * is -pi/2 to pi/2 radians (-90 to 90 degrees). If the argument is NaN or + * its absolute value is beyond 1, the result is NaN; and the arcsine of + * 0 retains its sign. This is accurate within 1 ulp, and is semi-monotonic. + * + * @param a the sin to turn back into an angle + * @return arcsin(a) + */ + public static native double asin(double a); + + /** + * The trigonometric function <em>arccos</em>. The range of angles returned + * is 0 to pi radians (0 to 180 degrees). If the argument is NaN or + * its absolute value is beyond 1, the result is NaN. This is accurate + * within 1 ulp, and is semi-monotonic. + * + * @param a the cos to turn back into an angle + * @return arccos(a) + */ + public static native double acos(double a); + + /** + * The trigonometric function <em>arcsin</em>. The range of angles returned + * is -pi/2 to pi/2 radians (-90 to 90 degrees). If the argument is NaN, the + * result is NaN; and the arctangent of 0 retains its sign. This is accurate + * within 1 ulp, and is semi-monotonic. + * + * @param a the tan to turn back into an angle + * @return arcsin(a) + * @see #atan2(double, double) + */ + public static native double atan(double a); + + /** + * A special version of the trigonometric function <em>arctan</em>, for + * converting rectangular coordinates <em>(x, y)</em> to polar + * <em>(r, theta)</em>. This computes the arctangent of x/y in the range + * of -pi to pi radians (-180 to 180 degrees). Special cases:<ul> + * <li>If either argument is NaN, the result is NaN.</li> + * <li>If the first argument is positive zero and the second argument is + * positive, or the first argument is positive and finite and the second + * argument is positive infinity, then the result is positive zero.</li> + * <li>If the first argument is negative zero and the second argument is + * positive, or the first argument is negative and finite and the second + * argument is positive infinity, then the result is negative zero.</li> + * <li>If the first argument is positive zero and the second argument is + * negative, or the first argument is positive and finite and the second + * argument is negative infinity, then the result is the double value + * closest to pi.</li> + * <li>If the first argument is negative zero and the second argument is + * negative, or the first argument is negative and finite and the second + * argument is negative infinity, then the result is the double value + * closest to -pi.</li> + * <li>If the first argument is positive and the second argument is + * positive zero or negative zero, or the first argument is positive + * infinity and the second argument is finite, then the result is the + * double value closest to pi/2.</li> + * <li>If the first argument is negative and the second argument is + * positive zero or negative zero, or the first argument is negative + * infinity and the second argument is finite, then the result is the + * double value closest to -pi/2.</li> + * <li>If both arguments are positive infinity, then the result is the + * double value closest to pi/4.</li> + * <li>If the first argument is positive infinity and the second argument + * is negative infinity, then the result is the double value closest to + * 3*pi/4.</li> + * <li>If the first argument is negative infinity and the second argument + * is positive infinity, then the result is the double value closest to + * -pi/4.</li> + * <li>If both arguments are negative infinity, then the result is the + * double value closest to -3*pi/4.</li> + * + * </ul><p>This is accurate within 2 ulps, and is semi-monotonic. To get r, + * use sqrt(x*x+y*y). + * + * @param y the y position + * @param x the x position + * @return <em>theta</em> in the conversion of (x, y) to (r, theta) + * @see #atan(double) + */ + public static native double atan2(double y, double x); + + /** + * Take <em>e</em><sup>a</sup>. The opposite of <code>log()</code>. If the + * argument is NaN, the result is NaN; if the argument is positive infinity, + * the result is positive infinity; and if the argument is negative + * infinity, the result is positive zero. This is accurate within 1 ulp, + * and is semi-monotonic. + * + * @param a the number to raise to the power + * @return the number raised to the power of <em>e</em> + * @see #log(double) + * @see #pow(double, double) + */ + public static native double exp(double a); + + /** + * Take ln(a) (the natural log). The opposite of <code>exp()</code>. If the + * argument is NaN or negative, the result is NaN; if the argument is + * positive infinity, the result is positive infinity; and if the argument + * is either zero, the result is negative infinity. This is accurate within + * 1 ulp, and is semi-monotonic. + * + * <p>Note that the way to get log<sub>b</sub>(a) is to do this: + * <code>ln(a) / ln(b)</code>. + * + * @param a the number to take the natural log of + * @return the natural log of <code>a</code> + * @see #exp(double) + */ + public static native double log(double a); + + /** + * Take a square root. If the argument is NaN or negative, the result is + * NaN; if the argument is positive infinity, the result is positive + * infinity; and if the result is either zero, the result is the same. + * This is accurate within the limits of doubles. + * + * <p>For other roots, use pow(a, 1 / rootNumber). + * + * @param a the numeric argument + * @return the square root of the argument + * @see #pow(double, double) + */ + public static native double sqrt(double a); + + /** + * Raise a number to a power. Special cases:<ul> + * <li>If the second argument is positive or negative zero, then the result + * is 1.0.</li> + * <li>If the second argument is 1.0, then the result is the same as the + * first argument.</li> + * <li>If the second argument is NaN, then the result is NaN.</li> + * <li>If the first argument is NaN and the second argument is nonzero, + * then the result is NaN.</li> + * <li>If the absolute value of the first argument is greater than 1 and + * the second argument is positive infinity, or the absolute value of the + * first argument is less than 1 and the second argument is negative + * infinity, then the result is positive infinity.</li> + * <li>If the absolute value of the first argument is greater than 1 and + * the second argument is negative infinity, or the absolute value of the + * first argument is less than 1 and the second argument is positive + * infinity, then the result is positive zero.</li> + * <li>If the absolute value of the first argument equals 1 and the second + * argument is infinite, then the result is NaN.</li> + * <li>If the first argument is positive zero and the second argument is + * greater than zero, or the first argument is positive infinity and the + * second argument is less than zero, then the result is positive zero.</li> + * <li>If the first argument is positive zero and the second argument is + * less than zero, or the first argument is positive infinity and the + * second argument is greater than zero, then the result is positive + * infinity.</li> + * <li>If the first argument is negative zero and the second argument is + * greater than zero but not a finite odd integer, or the first argument is + * negative infinity and the second argument is less than zero but not a + * finite odd integer, then the result is positive zero.</li> + * <li>If the first argument is negative zero and the second argument is a + * positive finite odd integer, or the first argument is negative infinity + * and the second argument is a negative finite odd integer, then the result + * is negative zero.</li> + * <li>If the first argument is negative zero and the second argument is + * less than zero but not a finite odd integer, or the first argument is + * negative infinity and the second argument is greater than zero but not a + * finite odd integer, then the result is positive infinity.</li> + * <li>If the first argument is negative zero and the second argument is a + * negative finite odd integer, or the first argument is negative infinity + * and the second argument is a positive finite odd integer, then the result + * is negative infinity.</li> + * <li>If the first argument is less than zero and the second argument is a + * finite even integer, then the result is equal to the result of raising + * the absolute value of the first argument to the power of the second + * argument.</li> + * <li>If the first argument is less than zero and the second argument is a + * finite odd integer, then the result is equal to the negative of the + * result of raising the absolute value of the first argument to the power + * of the second argument.</li> + * <li>If the first argument is finite and less than zero and the second + * argument is finite and not an integer, then the result is NaN.</li> + * <li>If both arguments are integers, then the result is exactly equal to + * the mathematical result of raising the first argument to the power of + * the second argument if that result can in fact be represented exactly as + * a double value.</li> + * + * </ul><p>(In the foregoing descriptions, a floating-point value is + * considered to be an integer if and only if it is a fixed point of the + * method {@link #ceil(double)} or, equivalently, a fixed point of the + * method {@link #floor(double)}. A value is a fixed point of a one-argument + * method if and only if the result of applying the method to the value is + * equal to the value.) This is accurate within 1 ulp, and is semi-monotonic. + * + * @param a the number to raise + * @param b the power to raise it to + * @return a<sup>b</sup> + */ + public static native double pow(double a, double b); + + /** + * Get the IEEE 754 floating point remainder on two numbers. This is the + * value of <code>x - y * <em>n</em></code>, where <em>n</em> is the closest + * double to <code>x / y</code> (ties go to the even n); for a zero + * remainder, the sign is that of <code>x</code>. If either argument is NaN, + * the first argument is infinite, or the second argument is zero, the result + * is NaN; if x is finite but y is infinite, the result is x. This is + * accurate within the limits of doubles. + * + * @param x the dividend (the top half) + * @param y the divisor (the bottom half) + * @return the IEEE 754-defined floating point remainder of x/y + * @see #rint(double) + */ + public static native double IEEEremainder(double x, double y); + + /** + * Take the nearest integer that is that is greater than or equal to the + * argument. If the argument is NaN, infinite, or zero, the result is the + * same; if the argument is between -1 and 0, the result is negative zero. + * Note that <code>Math.ceil(x) == -Math.floor(-x)</code>. + * + * @param a the value to act upon + * @return the nearest integer >= <code>a</code> + */ + public static native double ceil(double a); + + /** + * Take the nearest integer that is that is less than or equal to the + * argument. If the argument is NaN, infinite, or zero, the result is the + * same. Note that <code>Math.ceil(x) == -Math.floor(-x)</code>. + * + * @param a the value to act upon + * @return the nearest integer <= <code>a</code> + */ + public static native double floor(double a); + + /** + * Take the nearest integer to the argument. If it is exactly between + * two integers, the even integer is taken. If the argument is NaN, + * infinite, or zero, the result is the same. + * + * @param a the value to act upon + * @return the nearest integer to <code>a</code> + */ + public static native double rint(double a); + + /** + * Take the nearest integer to the argument. This is equivalent to + * <code>(int) Math.floor(a + 0.5f)</code>. If the argument is NaN, the result + * is 0; otherwise if the argument is outside the range of int, the result + * will be Integer.MIN_VALUE or Integer.MAX_VALUE, as appropriate. + * + * @param a the argument to round + * @return the nearest integer to the argument + * @see Integer#MIN_VALUE + * @see Integer#MAX_VALUE + */ + public static int round(float a) + { + // this check for NaN, from JLS 15.21.1, saves a method call + if (a != a) + return 0; + return (int) floor(a + 0.5f); + } + + /** + * Take the nearest long to the argument. This is equivalent to + * <code>(long) Math.floor(a + 0.5)</code>. If the argument is NaN, the + * result is 0; otherwise if the argument is outside the range of long, the + * result will be Long.MIN_VALUE or Long.MAX_VALUE, as appropriate. + * + * @param a the argument to round + * @return the nearest long to the argument + * @see Long#MIN_VALUE + * @see Long#MAX_VALUE + */ + public static long round(double a) + { + // this check for NaN, from JLS 15.21.1, saves a method call + if (a != a) + return 0; + return (long) floor(a + 0.5d); + } + + /** + * Get a random number. This behaves like Random.nextDouble(), seeded by + * System.currentTimeMillis() when first called. In other words, the number + * is from a pseudorandom sequence, and lies in the range [+0.0, 1.0). + * This random sequence is only used by this method, and is threadsafe, + * although you may want your own random number generator if it is shared + * among threads. + * + * @return a random number + * @see Random#nextDouble() + * @see System#currentTimeMillis() + */ + public static synchronized double random() + { + if (rand == null) + rand = new Random(); + return rand.nextDouble(); + } + + /** + * Convert from degrees to radians. The formula for this is + * radians = degrees * (pi/180); however it is not always exact given the + * limitations of floating point numbers. + * + * @param degrees an angle in degrees + * @return the angle in radians + * @since 1.2 + */ + public static double toRadians(double degrees) + { + return (degrees * PI) / 180; + } + + /** + * Convert from radians to degrees. The formula for this is + * degrees = radians * (180/pi); however it is not always exact given the + * limitations of floating point numbers. + * + * @param rads an angle in radians + * @return the angle in degrees + * @since 1.2 + */ + public static double toDegrees(double rads) + { + return (rads * 180) / PI; + } +} diff --git a/libjava/java/lang/VMCompiler.java b/libjava/java/lang/VMCompiler.java index 4792011..e6405f0 100644 --- a/libjava/java/lang/VMCompiler.java +++ b/libjava/java/lang/VMCompiler.java @@ -1,5 +1,5 @@ /* VMClassLoader.java -- Reference implementation of compiler interface - Copyright (C) 2004, 2005 Free Software Foundation + Copyright (C) 2004, 2005, 2006 Free Software Foundation This file is part of GNU Classpath. @@ -50,6 +50,7 @@ import java.util.StringTokenizer; import java.util.Vector; import gnu.gcj.runtime.SharedLibHelper; import gnu.gcj.runtime.PersistentByteMap; +import gnu.java.security.hash.MD5; /** * This class is just a per-VM reflection of java.lang.Compiler. @@ -90,8 +91,8 @@ final class VMCompiler // interpreted bytecode -- before we're able to use this class to // load precompiled classes. - private static final MessageDigest md5Digest - = new gnu.java.security.provider.MD5(); + private static final MD5 md5Digest + = new gnu.java.security.hash.MD5(); static { @@ -193,8 +194,9 @@ final class VMCompiler try { - MessageDigest md = (MessageDigest) md5Digest.clone(); - digest = md.digest(data); + MD5 md = (MD5) md5Digest.clone(); + md.update(data); + digest = md.digest(); } catch (CloneNotSupportedException _) { |