Commit a1f4e5ed by Tom Tromey Committed by Tom Tromey

SimpleDateFormat.java: Re-merged with Classpath.

	* java/text/SimpleDateFormat.java: Re-merged with Classpath.
	* gnu/gcj/text/LocaleData.java, gnu/gcj/text/LocaleData_en.java,
	gnu/gcj/text/LocaleData_en_US.java: Removed.
	* java/text/DateFormatSymbols.java (clone): Use Classpath
	implementation.
	(equals): Simplified.
	(DateFormatSymbols): Look in gnu.java.locale for information.
	(DateFormatSymbols(DateFormatSymbols)): Removed.
	(safeGetResource): Removed.
	(DateFormatSymbols): Throws MissingResourceException.
	(ampmsDefault, erasDefault, localPatternCharsDefault,
	monthsDefault, shortMonthsDefault, shortWeekdaysDefault,
	weekdaysDefault, zoneStringsDefault): Removed.
	* java/text/Collator.java (getAvailableLocales): Use modified
	Classpath implementation.
	(getInstance): Look in gnu.java.locale for information.
	(clone): Rewrote.
	* java/text/MessageFormat.java: Reindented.
	(clone): Rewrote.
	* java/text/FieldPosition.java: Merged with Classpath.
	* java/text/ParsePosition.java: Merged with Classpath.
	* java/text/Format.java: Merged with Classpath.
	* java/text/StringCharacterIterator.java
	(StringCharacterIterator(StringCharacterIterator,int,int)): New
	constructor from Classpath.
	* java/text/Annotation.java,
	java/text/AttributedCharacterIterator.java,
	java/text/AttributedString.java,
	java/text/AttributedStringIterator.java: New from Classpath.
	* java/text/CharacterIterator.java: Copied from Classpath.
	* java/text/ChoiceFormat.java: Reindented.
	(clone): Removed.
	* gnu/java/text/BaseBreakIterator.java,
	gnu/java/text/CharacterBreakIterator.java,
	gnu/java/text/LineBreakIterator.java,
	gnu/java/text/LocaleData_en.java,
	gnu/java/text/LocaleData_en_US.java,
	gnu/java/text/SentenceBreakIterator.java,
	gnu/java/text/WordBreakIterator.java: Renamed from gnu/gcj/text/*.
	* gnu/gcj/text/BaseBreakIterator.java (last): Advance past final
	character.
	* java/text/BreakIterator.java (getAvailableLocales): Use
	Classpath implementation.
	(getInstance): Look in gnu.java.locale for information.
	(getCharacterInstance, getLineInstance, getSentenceInstance,
	getWordInstance): Look in gnu.java.text for implementations.
	* java/text/DecimalFormatSymbols.java: Reindented
	(clone): Use Classpath implementation.
	(DecimalFormatSymbols(DecimalFormatSymbols)): Removed.
	(DecimalFormatSymbols(Locale)): Look in gnu.java.locale for
	information.
	* java/text/DateFormat.java: Merged with Classpath.
	(getAvailableLocales): Use Classpath implementation.
	(format(Object,StringBuffer,FieldPosition)): Minor cleanup.
	(computeInstance): Look in gnu.java.locale for information.
	* java/text/NumberFormat.java: Reindented.
	(computeInstance): Look in gnu.java.locale for information.
	(getAvailableLocales): Use implementation from Classpath.
	(setMaximumIntegerDigits): Likewise.
	(setMinimumIntegerDigits): Likewise.
	(setMaximumFractionDigits): Likewise.
	(clone): Removed.
	* java/text/DecimalFormat.java: Reindented.
	* gnu/java/locale/LocaleInformation_en.java: Copied from Classpath.
	* gnu/java/locale/LocaleInformation_en_US.java: Copied from Classpath.
	* Makefile.in: Rebuilt.
	* Makefile.am (ordinary_java_source_files): Added all new files.
	(ordinary_java_source_files): Renamed or removed gnu/gcj/text/*.
	* java/security/spec/AlgorithmParameterSpec.java,
	java/security/spec/KeySpec.java: Re-merged with Classpath.

From-SVN: r45390
parent 45932d27
2001-09-04 Tom Tromey <tromey@redhat.com> 2001-09-04 Tom Tromey <tromey@redhat.com>
* java/text/SimpleDateFormat.java: Re-merged with Classpath.
* gnu/gcj/text/LocaleData.java, gnu/gcj/text/LocaleData_en.java,
gnu/gcj/text/LocaleData_en_US.java: Removed.
* java/text/DateFormatSymbols.java (clone): Use Classpath
implementation.
(equals): Simplified.
(DateFormatSymbols): Look in gnu.java.locale for information.
(DateFormatSymbols(DateFormatSymbols)): Removed.
(safeGetResource): Removed.
(DateFormatSymbols): Throws MissingResourceException.
(ampmsDefault, erasDefault, localPatternCharsDefault,
monthsDefault, shortMonthsDefault, shortWeekdaysDefault,
weekdaysDefault, zoneStringsDefault): Removed.
* java/text/Collator.java (getAvailableLocales): Use modified
Classpath implementation.
(getInstance): Look in gnu.java.locale for information.
(clone): Rewrote.
* java/text/MessageFormat.java: Reindented.
(clone): Rewrote.
* java/text/FieldPosition.java: Merged with Classpath.
* java/text/ParsePosition.java: Merged with Classpath.
* java/text/Format.java: Merged with Classpath.
* java/text/StringCharacterIterator.java
(StringCharacterIterator(StringCharacterIterator,int,int)): New
constructor from Classpath.
* java/text/Annotation.java,
java/text/AttributedCharacterIterator.java,
java/text/AttributedString.java,
java/text/AttributedStringIterator.java: New from Classpath.
* java/text/CharacterIterator.java: Copied from Classpath.
* java/text/ChoiceFormat.java: Reindented.
(clone): Removed.
* gnu/java/text/BaseBreakIterator.java,
gnu/java/text/CharacterBreakIterator.java,
gnu/java/text/LineBreakIterator.java,
gnu/java/text/LocaleData_en.java,
gnu/java/text/LocaleData_en_US.java,
gnu/java/text/SentenceBreakIterator.java,
gnu/java/text/WordBreakIterator.java: Renamed from gnu/gcj/text/*.
* gnu/gcj/text/BaseBreakIterator.java (last): Advance past final
character.
* java/text/BreakIterator.java (getAvailableLocales): Use
Classpath implementation.
(getInstance): Look in gnu.java.locale for information.
(getCharacterInstance, getLineInstance, getSentenceInstance,
getWordInstance): Look in gnu.java.text for implementations.
* java/text/DecimalFormatSymbols.java: Reindented
(clone): Use Classpath implementation.
(DecimalFormatSymbols(DecimalFormatSymbols)): Removed.
(DecimalFormatSymbols(Locale)): Look in gnu.java.locale for
information.
* java/text/DateFormat.java: Merged with Classpath.
(getAvailableLocales): Use Classpath implementation.
(format(Object,StringBuffer,FieldPosition)): Minor cleanup.
(computeInstance): Look in gnu.java.locale for information.
* java/text/NumberFormat.java: Reindented.
(computeInstance): Look in gnu.java.locale for information.
(getAvailableLocales): Use implementation from Classpath.
(setMaximumIntegerDigits): Likewise.
(setMinimumIntegerDigits): Likewise.
(setMaximumFractionDigits): Likewise.
(clone): Removed.
* java/text/DecimalFormat.java: Reindented.
* gnu/java/locale/LocaleInformation_en.java: Copied from Classpath.
* gnu/java/locale/LocaleInformation_en_US.java: Copied from Classpath.
* Makefile.in: Rebuilt.
* Makefile.am (ordinary_java_source_files): Added all new files.
(ordinary_java_source_files): Renamed or removed gnu/gcj/text/*.
* java/security/spec/AlgorithmParameterSpec.java,
java/security/spec/KeySpec.java: Re-merged with Classpath.
Fix for PR libgcj/4213: Fix for PR libgcj/4213:
* Makefile.am (ordinary_java_source_files): Added new file. * Makefile.am (ordinary_java_source_files): Added new file.
* gnu/gcj/text/LocaleData.java: New file. * gnu/gcj/text/LocaleData.java: New file.
......
...@@ -1123,14 +1123,6 @@ gnu/gcj/protocol/jar/Handler.java \ ...@@ -1123,14 +1123,6 @@ gnu/gcj/protocol/jar/Handler.java \
gnu/gcj/runtime/FileDeleter.java \ gnu/gcj/runtime/FileDeleter.java \
gnu/gcj/runtime/FirstThread.java \ gnu/gcj/runtime/FirstThread.java \
gnu/gcj/runtime/VMClassLoader.java \ gnu/gcj/runtime/VMClassLoader.java \
gnu/gcj/text/BaseBreakIterator.java \
gnu/gcj/text/CharacterBreakIterator.java \
gnu/gcj/text/LineBreakIterator.java \
gnu/gcj/text/LocaleData.java \
gnu/gcj/text/LocaleData_en.java \
gnu/gcj/text/LocaleData_en_US.java \
gnu/gcj/text/SentenceBreakIterator.java \
gnu/gcj/text/WordBreakIterator.java \
gnu/java/io/ClassLoaderObjectInputStream.java \ gnu/java/io/ClassLoaderObjectInputStream.java \
gnu/java/io/NullOutputStream.java \ gnu/java/io/NullOutputStream.java \
gnu/java/io/ObjectIdentityWrapper.java \ gnu/java/io/ObjectIdentityWrapper.java \
...@@ -1141,10 +1133,20 @@ gnu/java/locale/Calendar.java \ ...@@ -1141,10 +1133,20 @@ gnu/java/locale/Calendar.java \
gnu/java/locale/Calendar_de.java \ gnu/java/locale/Calendar_de.java \
gnu/java/locale/Calendar_en.java \ gnu/java/locale/Calendar_en.java \
gnu/java/locale/Calendar_nl.java \ gnu/java/locale/Calendar_nl.java \
gnu/java/locale/LocaleInformation.java \
gnu/java/locale/LocaleInformation_de.java \
gnu/java/locale/LocaleInformation_en.java \
gnu/java/locale/LocaleInformation_en_US.java \
gnu/java/locale/LocaleInformation_nl.java \
gnu/java/security/provider/DefaultPolicy.java \ gnu/java/security/provider/DefaultPolicy.java \
gnu/java/security/provider/Gnu.java \ gnu/java/security/provider/Gnu.java \
gnu/java/security/provider/SHA.java \ gnu/java/security/provider/SHA.java \
gnu/java/security/provider/SHA1PRNG.java \ gnu/java/security/provider/SHA1PRNG.java \
gnu/java/text/BaseBreakIterator.java \
gnu/java/text/CharacterBreakIterator.java \
gnu/java/text/LineBreakIterator.java \
gnu/java/text/SentenceBreakIterator.java \
gnu/java/text/WordBreakIterator.java \
gnu/java/util/DoubleEnumeration.java \ gnu/java/util/DoubleEnumeration.java \
java/lang/ref/PhantomReference.java \ java/lang/ref/PhantomReference.java \
java/lang/ref/Reference.java \ java/lang/ref/Reference.java \
...@@ -1333,6 +1335,10 @@ java/sql/Struct.java \ ...@@ -1333,6 +1335,10 @@ java/sql/Struct.java \
java/sql/Time.java \ java/sql/Time.java \
java/sql/Timestamp.java \ java/sql/Timestamp.java \
java/sql/Types.java \ java/sql/Types.java \
java/text/Annotation.java \
java/text/AttributedCharacterIterator.java \
java/text/AttributedString.java \
java/text/AttributedStringIterator.java \
java/text/BreakIterator.java \ java/text/BreakIterator.java \
java/text/CharacterIterator.java \ java/text/CharacterIterator.java \
java/text/ChoiceFormat.java \ java/text/ChoiceFormat.java \
......
...@@ -873,14 +873,6 @@ gnu/gcj/protocol/jar/Handler.java \ ...@@ -873,14 +873,6 @@ gnu/gcj/protocol/jar/Handler.java \
gnu/gcj/runtime/FileDeleter.java \ gnu/gcj/runtime/FileDeleter.java \
gnu/gcj/runtime/FirstThread.java \ gnu/gcj/runtime/FirstThread.java \
gnu/gcj/runtime/VMClassLoader.java \ gnu/gcj/runtime/VMClassLoader.java \
gnu/gcj/text/BaseBreakIterator.java \
gnu/gcj/text/CharacterBreakIterator.java \
gnu/gcj/text/LineBreakIterator.java \
gnu/gcj/text/LocaleData.java \
gnu/gcj/text/LocaleData_en.java \
gnu/gcj/text/LocaleData_en_US.java \
gnu/gcj/text/SentenceBreakIterator.java \
gnu/gcj/text/WordBreakIterator.java \
gnu/java/io/ClassLoaderObjectInputStream.java \ gnu/java/io/ClassLoaderObjectInputStream.java \
gnu/java/io/NullOutputStream.java \ gnu/java/io/NullOutputStream.java \
gnu/java/io/ObjectIdentityWrapper.java \ gnu/java/io/ObjectIdentityWrapper.java \
...@@ -891,10 +883,20 @@ gnu/java/locale/Calendar.java \ ...@@ -891,10 +883,20 @@ gnu/java/locale/Calendar.java \
gnu/java/locale/Calendar_de.java \ gnu/java/locale/Calendar_de.java \
gnu/java/locale/Calendar_en.java \ gnu/java/locale/Calendar_en.java \
gnu/java/locale/Calendar_nl.java \ gnu/java/locale/Calendar_nl.java \
gnu/java/locale/LocaleInformation.java \
gnu/java/locale/LocaleInformation_de.java \
gnu/java/locale/LocaleInformation_en.java \
gnu/java/locale/LocaleInformation_en_US.java \
gnu/java/locale/LocaleInformation_nl.java \
gnu/java/security/provider/DefaultPolicy.java \ gnu/java/security/provider/DefaultPolicy.java \
gnu/java/security/provider/Gnu.java \ gnu/java/security/provider/Gnu.java \
gnu/java/security/provider/SHA.java \ gnu/java/security/provider/SHA.java \
gnu/java/security/provider/SHA1PRNG.java \ gnu/java/security/provider/SHA1PRNG.java \
gnu/java/text/BaseBreakIterator.java \
gnu/java/text/CharacterBreakIterator.java \
gnu/java/text/LineBreakIterator.java \
gnu/java/text/SentenceBreakIterator.java \
gnu/java/text/WordBreakIterator.java \
gnu/java/util/DoubleEnumeration.java \ gnu/java/util/DoubleEnumeration.java \
java/lang/ref/PhantomReference.java \ java/lang/ref/PhantomReference.java \
java/lang/ref/Reference.java \ java/lang/ref/Reference.java \
...@@ -1083,6 +1085,10 @@ java/sql/Struct.java \ ...@@ -1083,6 +1085,10 @@ java/sql/Struct.java \
java/sql/Time.java \ java/sql/Time.java \
java/sql/Timestamp.java \ java/sql/Timestamp.java \
java/sql/Types.java \ java/sql/Types.java \
java/text/Annotation.java \
java/text/AttributedCharacterIterator.java \
java/text/AttributedString.java \
java/text/AttributedStringIterator.java \
java/text/BreakIterator.java \ java/text/BreakIterator.java \
java/text/CharacterIterator.java \ java/text/CharacterIterator.java \
java/text/ChoiceFormat.java \ java/text/ChoiceFormat.java \
...@@ -1491,14 +1497,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -1491,14 +1497,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/gcj/protocol/jar/Handler.P \ .deps/gnu/gcj/protocol/jar/Handler.P \
.deps/gnu/gcj/runtime/FileDeleter.P .deps/gnu/gcj/runtime/FirstThread.P \ .deps/gnu/gcj/runtime/FileDeleter.P .deps/gnu/gcj/runtime/FirstThread.P \
.deps/gnu/gcj/runtime/VMClassLoader.P \ .deps/gnu/gcj/runtime/VMClassLoader.P \
.deps/gnu/gcj/runtime/natFirstThread.P \ .deps/gnu/gcj/runtime/natFirstThread.P .deps/gnu/gcj/xlib/Clip.P \
.deps/gnu/gcj/text/BaseBreakIterator.P \
.deps/gnu/gcj/text/CharacterBreakIterator.P \
.deps/gnu/gcj/text/LineBreakIterator.P .deps/gnu/gcj/text/LocaleData.P \
.deps/gnu/gcj/text/LocaleData_en.P \
.deps/gnu/gcj/text/LocaleData_en_US.P \
.deps/gnu/gcj/text/SentenceBreakIterator.P \
.deps/gnu/gcj/text/WordBreakIterator.P .deps/gnu/gcj/xlib/Clip.P \
.deps/gnu/gcj/xlib/Colormap.P .deps/gnu/gcj/xlib/Display.P \ .deps/gnu/gcj/xlib/Colormap.P .deps/gnu/gcj/xlib/Display.P \
.deps/gnu/gcj/xlib/Drawable.P .deps/gnu/gcj/xlib/Font.P \ .deps/gnu/gcj/xlib/Drawable.P .deps/gnu/gcj/xlib/Font.P \
.deps/gnu/gcj/xlib/GC.P .deps/gnu/gcj/xlib/Pixmap.P \ .deps/gnu/gcj/xlib/GC.P .deps/gnu/gcj/xlib/Pixmap.P \
...@@ -1543,6 +1542,11 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -1543,6 +1542,11 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/java/lang/reflect/TypeSignature.P \ .deps/gnu/java/lang/reflect/TypeSignature.P \
.deps/gnu/java/locale/Calendar.P .deps/gnu/java/locale/Calendar_de.P \ .deps/gnu/java/locale/Calendar.P .deps/gnu/java/locale/Calendar_de.P \
.deps/gnu/java/locale/Calendar_en.P .deps/gnu/java/locale/Calendar_nl.P \ .deps/gnu/java/locale/Calendar_en.P .deps/gnu/java/locale/Calendar_nl.P \
.deps/gnu/java/locale/LocaleInformation.P \
.deps/gnu/java/locale/LocaleInformation_de.P \
.deps/gnu/java/locale/LocaleInformation_en.P \
.deps/gnu/java/locale/LocaleInformation_en_US.P \
.deps/gnu/java/locale/LocaleInformation_nl.P \
.deps/gnu/java/rmi/dgc/DGCImpl.P .deps/gnu/java/rmi/dgc/DGCImpl_Skel.P \ .deps/gnu/java/rmi/dgc/DGCImpl.P .deps/gnu/java/rmi/dgc/DGCImpl_Skel.P \
.deps/gnu/java/rmi/dgc/DGCImpl_Stub.P \ .deps/gnu/java/rmi/dgc/DGCImpl_Stub.P \
.deps/gnu/java/rmi/registry/RegistryImpl.P \ .deps/gnu/java/rmi/registry/RegistryImpl.P \
...@@ -1565,6 +1569,11 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -1565,6 +1569,11 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/java/security/provider/Gnu.P \ .deps/gnu/java/security/provider/Gnu.P \
.deps/gnu/java/security/provider/SHA.P \ .deps/gnu/java/security/provider/SHA.P \
.deps/gnu/java/security/provider/SHA1PRNG.P \ .deps/gnu/java/security/provider/SHA1PRNG.P \
.deps/gnu/java/text/BaseBreakIterator.P \
.deps/gnu/java/text/CharacterBreakIterator.P \
.deps/gnu/java/text/LineBreakIterator.P \
.deps/gnu/java/text/SentenceBreakIterator.P \
.deps/gnu/java/text/WordBreakIterator.P \
.deps/gnu/java/util/DoubleEnumeration.P .deps/interpret.P \ .deps/gnu/java/util/DoubleEnumeration.P .deps/interpret.P \
.deps/java/applet/Applet.P .deps/java/applet/AppletContext.P \ .deps/java/applet/Applet.P .deps/java/applet/AppletContext.P \
.deps/java/applet/AppletStub.P .deps/java/applet/AudioClip.P \ .deps/java/applet/AppletStub.P .deps/java/applet/AudioClip.P \
...@@ -2024,6 +2033,10 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -2024,6 +2033,10 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/sql/SQLOutput.P .deps/java/sql/SQLWarning.P \ .deps/java/sql/SQLOutput.P .deps/java/sql/SQLWarning.P \
.deps/java/sql/Statement.P .deps/java/sql/Struct.P \ .deps/java/sql/Statement.P .deps/java/sql/Struct.P \
.deps/java/sql/Time.P .deps/java/sql/Timestamp.P .deps/java/sql/Types.P \ .deps/java/sql/Time.P .deps/java/sql/Timestamp.P .deps/java/sql/Types.P \
.deps/java/text/Annotation.P \
.deps/java/text/AttributedCharacterIterator.P \
.deps/java/text/AttributedString.P \
.deps/java/text/AttributedStringIterator.P \
.deps/java/text/BreakIterator.P .deps/java/text/CharacterIterator.P \ .deps/java/text/BreakIterator.P .deps/java/text/CharacterIterator.P \
.deps/java/text/ChoiceFormat.P \ .deps/java/text/ChoiceFormat.P \
.deps/java/text/CollationElementIterator.P \ .deps/java/text/CollationElementIterator.P \
......
// Generic locale data for java.text.
/* Copyright (C) 2001 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.text;
import java.util.ListResourceBundle;
public class LocaleData extends ListResourceBundle
{
private static final Object[][] contents =
{
};
protected Object[][] getContents ()
{
return contents;
}
}
// Generic English locale data for java.text.
/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.text;
import java.util.ListResourceBundle;
/**
* @author Tom Tromey <tromey@cygnus.com>
* @date March 4, 1999
*/
public final class LocaleData_en extends ListResourceBundle
{
// These are for DateFormatSymbols.
static final String[] ampmsDefault = {"AM", "PM" };
static final String[] erasDefault = {"BC", "AD" };
static final String localPatternCharsDefault = "GyMdkHmsSEDFwWahKz";
static final String[] monthsDefault = {
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December", ""
};
static final String[] shortMonthsDefault = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""
};
static final String[] shortWeekdaysDefault = {
"", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
static final String[] weekdaysDefault = {
"", "Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday"
};
private static final Object[][] contents =
{
// These are for DecimalFormatSymbols.
{ "decimalSeparator", "." },
{ "digit", "#" },
{ "exponential", "E" },
{ "groupingSeparator", "," },
{ "infinity", "\u221e" },
{ "minusSign", "-" },
{ "monetarySeparator", "." },
{ "NaN", "\ufffd" },
{ "patternSeparator", ";" },
{ "percent", "%" },
{ "perMill", "\u2030" },
{ "zeroDigit", "0" },
// These are for NumberFormat.
{ "numberFormat", "#,##0.###" },
{ "percentFormat", "#,##0%" },
// These are for DateFormatSymbols.
{ "ampm", ampmsDefault },
{ "eras", erasDefault },
{ "datePatternChars", localPatternCharsDefault },
{ "months", monthsDefault },
{ "shortMonths", shortMonthsDefault },
{ "shortWeekdays", shortWeekdaysDefault },
{ "weekdays", weekdaysDefault },
// These are for DateFormat.
{ "shortDateFormat", "M/d/yy" }, // Java's Y2K bug.
{ "mediumDateFormat", "d-MMM-yy" },
{ "longDateFormat", "MMMM d, yyyy" },
{ "fullDateFormat", "EEEE MMMM d, yyyy G" },
{ "shortTimeFormat", "h:mm a" },
{ "mediumTimeFormat", "h:mm:ss a" },
{ "longTimeFormat", "h:mm:ss a z" },
{ "fullTimeFormat", "h:mm:ss;S 'o''clock' a z" },
// For RuleBasedCollator.
// FIXME: this is nowhere near complete.
// In particular we must mark accents as ignorable,
// and probably other things as well.
{ "collatorRule", "< 0 < 1 < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < a,A < b,B < c,C < d,D < e,E < f,F < g,G < h,H < i,I < j,J < k,K < l,L < m,M < n,N < o,O < p,P < q,Q < r,R < s,S < t,T < u,U < v,V < w,W < x,X < y,Y < z,Z" }
};
protected Object[][] getContents ()
{
return contents;
}
}
/* LocaleInformation_de.java -- German locale data /* LocaleInformation_de.java -- German locale data
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999, 2001 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -47,7 +47,7 @@ public class LocaleInformation_de extends ListResourceBundle ...@@ -47,7 +47,7 @@ public class LocaleInformation_de extends ListResourceBundle
* proper format. * proper format.
*/ */
private static final String collation_rules = private static final String collation_rules =
"-<0,1<2<3<4<5<6<7<8<9<A,a<b,B<c,C<d,D<e,E<f,F<g,G<h,H<i,I<j,J<j,K" + "<0<1<2<3<4<5<6<7<8<9<A,a<b,B<c,C<d,D<e,E<f,F<g,G<h,H<i,I<j,J<k,K" +
"<l,L<m,M<n,N<o,O<p,P<q,Q<r,R<s,S<t,T<u,U<v,V<w,W<x,X<y,Y,z<Z" + "<l,L<m,M<n,N<o,O<p,P<q,Q<r,R<s,S<t,T<u,U<v,V<w,W<x,X<y,Y,z<Z" +
"&ae,\u00e4&Ae,\u00c4&oe,\u00f6&Oe,\u00d6&ue,\u00fc&Ue,\u00dc&ss,\u00df"; "&ae,\u00e4&Ae,\u00c4&oe,\u00f6&Oe,\u00d6&ue,\u00fc&Ue,\u00dc&ss,\u00df";
......
// US English locale data for java.text. /* LocaleInformation_en.java -- US English locale data
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
/* Copyright (C) 1999 Free Software Foundation This file is part of GNU Classpath.
This file is part of libgcj. 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.
This software is copyrighted work licensed under the terms of the You should have received a copy of the GNU General Public License
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for along with GNU Classpath; see the file COPYING. If not, write to the
details. */ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
package gnu.gcj.text; As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package gnu.java.locale;
import java.util.ListResourceBundle; import java.util.ListResourceBundle;
import java.util.Calendar;
import java.util.Date;
/** /**
* @author Tom Tromey <tromey@cygnus.com> * This class contains locale data for English in the US.
* @date March 4, 1999
*/ */
public class LocaleInformation_en_US extends ListResourceBundle
public final class LocaleData_en_US extends ListResourceBundle
{ {
// These are for DateFormatSymbols. // These are for DateFormatSymbols.
static String[][] zoneStringsDefault = { private static final String[][] zoneStrings =
{
{ "GMT", "Greenwich Mean Time", "GMT", { "GMT", "Greenwich Mean Time", "GMT",
/**/ "Greenwich Mean Time", "GMT", "GMT" }, /**/ "Greenwich Mean Time", "GMT", "GMT" },
{ "PST", "Pacific Standard Time", "PST", { "PST", "Pacific Standard Time", "PST",
...@@ -51,31 +69,44 @@ public final class LocaleData_en_US extends ListResourceBundle ...@@ -51,31 +69,44 @@ public final class LocaleData_en_US extends ListResourceBundle
/**/ "Alaska Daylight Time", "AKDT", "Anchorage" } /**/ "Alaska Daylight Time", "AKDT", "Anchorage" }
}; };
/**
* This is the object array used to hold the keys and values
* for this bundle
*/
private static final Object[][] contents = private static final Object[][] contents =
{ {
// These are for DecimalFormatSymbols. // For SimpleDateFormat/DateFormatSymbols
{ "currency", "$" }, { "zoneStrings", zoneStrings },
{ "intlCurrencySymbol", "$" }, // FIXME?
// These are for NumberFormat.
{ "currencyFormat", "$#,##0.00;($#,##0.00)" },
// These are for DateFormatSymbols.
{ "zoneStrings", zoneStringsDefault },
// These are for DateFormat.
{ "shortDateFormat", "M/d/yy" }, // Java's Y2K bug. { "shortDateFormat", "M/d/yy" }, // Java's Y2K bug.
{ "mediumDateFormat", "d-MMM-yy" }, { "mediumDateFormat", "d-MMM-yy" },
{ "longDateFormat", "MMMM d, yyyy" }, { "longDateFormat", "MMMM d, yyyy" },
{ "defaultDateFormat", "d-MMMM-yy" },
{ "fullDateFormat", "EEEE MMMM d, yyyy G" }, { "fullDateFormat", "EEEE MMMM d, yyyy G" },
{ "shortTimeFormat", "h:mm a" }, { "shortTimeFormat", "h:mm a" },
{ "mediumTimeFormat", "h:mm:ss a" }, { "mediumTimeFormat", "h:mm:ss a" },
{ "longTimeFormat", "h:mm:ss a z" }, { "longTimeFormat", "h:mm:ss a z" },
{ "fullTimeFormat", "h:mm:ss;S 'o''clock' a z" } { "fullTimeFormat", "h:mm:ss;S 'o''clock' a z" },
{ "defaultTimeFormat", "h:mm:ss a" },
// For DecimalFormat/DecimalFormatSymbols
{ "currencySymbol", "$" },
{ "intlCurrencySymbol", "US$" },
// For NumberFormat.
{ "currencyFormat", "$#,##0.00;($#,##0.00)" }
}; };
protected Object[][] getContents () /*************************************************************************/
{
return contents; /**
} * This method returns the object array of key, value pairs containing
* the data for this bundle.
*
* @return The key, value information.
*/
public Object[][] getContents ()
{
return contents;
}
} }
/* LocaleInformation_nl.java -- Dutch locale data /* LocaleInformation_nl.java -- Dutch locale data
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999, 2001 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -50,39 +50,9 @@ public class LocaleInformation_nl extends ListResourceBundle ...@@ -50,39 +50,9 @@ public class LocaleInformation_nl extends ListResourceBundle
* This is the same rule as used in the English locale. * This is the same rule as used in the English locale.
*/ */
private static final String collation_rules = private static final String collation_rules =
"-<0,1<2<3<4<5<6<7<8<9A,a<b,B<c,C<d,D<e,E<f,F<g,G<h,H<i,I<j,J<j,K" + "<0<1<2<3<4<5<6<7<8<9<A,a<b,B<c,C<d,D<e,E<f,F<g,G<h,H<i,I<j,J<k,K" +
"<l,L<m,M<n,N<o,O<p,P<q,Q<r,R<s,S<t,T<u,U<v,V<w,W<x,X<y,Y,z<Z"; "<l,L<m,M<n,N<o,O<p,P<q,Q<r,R<s,S<t,T<u,U<v,V<w,W<x,X<y,Y,z<Z";
/*
* For the followings lists, strings that are subsets of other break strings
* must be listed first. For example, if "\r" and "\r\n" are sequences,
* the "\r" must be first or it will never be used.
*/
/**
* This is the list of word separator characters used by
* java.text.BreakIterator
* <p>
* This is the same list as used in the English local
*/
private static final String[] word_breaks = { " ", "\t", "\r\n", "\n" };
/**
* This is the list of sentence break sequences used by
* java.text.BreakIterator
* <p>
* This is the same list as used in the English local
*/
private static final String[] sentence_breaks = { ". " };
/**
* This is the list of potential line break locations.
* <p>
* This is the same list as used in the English local
*/
private static final String[] line_breaks = { "\t", "-", "\r\n",
"\n", ". ", ". ", ".", "? ", "? ", "?", "! ", "! ", "!", ", ", " " };
/** /**
* This is the list of months, fully spelled out * This is the list of months, fully spelled out
*/ */
...@@ -281,10 +251,6 @@ private static final Object[][] contents = ...@@ -281,10 +251,6 @@ private static final Object[][] contents =
{ {
// For RuleBasedCollator // For RuleBasedCollator
{ "collation_rules", collation_rules }, { "collation_rules", collation_rules },
// For BreakIterator
{ "word_breaks", word_breaks },
{ "sentence_breaks", sentence_breaks },
{ "line_breaks", line_breaks },
// For SimpleDateFormat/DateFormatSymbols // For SimpleDateFormat/DateFormatSymbols
{ "months", months }, { "months", months },
{ "shortMonths", shortMonths }, { "shortMonths", shortMonths },
......
// Base class for default BreakIterators. /* BaseBreakIterator.java -- Base class for default BreakIterators
Copyright (C) 1999, 2001 Free Software Foundation, Inc.
/* Copyright (C) 1999 Free Software Foundation This file is part of GNU Classpath.
This file is part of libgcj. 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.
This software is copyrighted work licensed under the terms of the You should have received a copy of the GNU General Public License
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for along with GNU Classpath; see the file COPYING. If not, write to the
details. */ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
package gnu.gcj.text; As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package gnu.java.text;
import java.text.BreakIterator; import java.text.BreakIterator;
import java.text.CharacterIterator; import java.text.CharacterIterator;
...@@ -48,6 +65,8 @@ public abstract class BaseBreakIterator extends BreakIterator ...@@ -48,6 +65,8 @@ public abstract class BaseBreakIterator extends BreakIterator
public int last () public int last ()
{ {
iter.last(); iter.last();
// Go past the last character.
iter.next();
return iter.getEndIndex(); return iter.getEndIndex();
} }
......
// Default character BreakIterator. /* CharacterBreakIterator.java - Default character BreakIterator.
Copyright (C) 1999, 2001 Free Software Foundation, Inc.
/* Copyright (C) 1999 Free Software Foundation
This file is part of GNU Classpath.
This file is part of libgcj.
GNU Classpath is free software; you can redistribute it and/or modify
This software is copyrighted work licensed under the terms of the it under the terms of the GNU General Public License as published by
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for the Free Software Foundation; either version 2, or (at your option)
details. */ any later version.
package gnu.gcj.text; 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., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package gnu.java.text;
import java.text.BreakIterator; import java.text.BreakIterator;
import java.text.CharacterIterator; import java.text.CharacterIterator;
......
// Default word BreakIterator. /* LineBreakIterator.java - Default word BreakIterator.
Copyright (C) 1999, 2001 Free Software Foundation, Inc.
/* Copyright (C) 1999 Free Software Foundation
This file is part of GNU Classpath.
This file is part of libgcj.
GNU Classpath is free software; you can redistribute it and/or modify
This software is copyrighted work licensed under the terms of the it under the terms of the GNU General Public License as published by
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for the Free Software Foundation; either version 2, or (at your option)
details. */ any later version.
package gnu.gcj.text; 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., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package gnu.java.text;
import java.text.BreakIterator; import java.text.BreakIterator;
import java.text.CharacterIterator; import java.text.CharacterIterator;
......
// Default sentence BreakIterator. /* SentenceBreakIterator.java - Default sentence BreakIterator.
Copyright (C) 1999, 2001 Free Software Foundation, Inc.
/* Copyright (C) 1999 Free Software Foundation
This file is part of GNU Classpath.
This file is part of libgcj.
GNU Classpath is free software; you can redistribute it and/or modify
This software is copyrighted work licensed under the terms of the it under the terms of the GNU General Public License as published by
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for the Free Software Foundation; either version 2, or (at your option)
details. */ any later version.
package gnu.gcj.text; 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., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package gnu.java.text;
import java.text.BreakIterator; import java.text.BreakIterator;
import java.text.CharacterIterator; import java.text.CharacterIterator;
......
// Default word BreakIterator. /* WordBreakIterator.java - Default word BreakIterator.
Copyright (C) 1999, 2001 Free Software Foundation, Inc.
/* Copyright (C) 1999 Free Software Foundation
This file is part of GNU Classpath.
This file is part of libgcj.
GNU Classpath is free software; you can redistribute it and/or modify
This software is copyrighted work licensed under the terms of the it under the terms of the GNU General Public License as published by
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for the Free Software Foundation; either version 2, or (at your option)
details. */ any later version.
package gnu.gcj.text; 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., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package gnu.java.text;
import java.text.BreakIterator; import java.text.BreakIterator;
import java.text.CharacterIterator; import java.text.CharacterIterator;
......
/* Annotation.java -- Wrapper for a text attribute object
Copyright (C) 1998, 1999 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., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.text;
/**
* This class is used as a wrapper for a text attribute object. Annotation
* objects are associated with a specific range of text. Changing either
* the text range or the underlying text invalidates the object.
*
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class Annotation
{
/*
* Instance Variables
*/
/**
* This is the attribute object being wrappered
*/
private Object attrib;
/*************************************************************************/
/**
* Constructors
*/
/**
* This method initializes a new instance of <code>Annotation</code> to
* wrapper the specified text attribute object.
*
* @param attrib The text attribute <code>Object</code> to wrapper.
*/
public
Annotation(Object attrib)
{
this.attrib = attrib;
}
/*************************************************************************/
/*
* Instance Variables
*/
/**
* This method returns the text attribute object this <code>Annotation</code>
* instance is wrappering.
*
* @return The text attribute object for this <code>Annotation</code>.
*/
public Object
getValue()
{
return(attrib);
}
/*************************************************************************/
/**
* This method returns a <code>String</code> representation of this
* object.
*
* @return This object as a <code>String</code>.
*/
public String
toString()
{
return(getClass().getName() + "[value=" + attrib.toString() + "]");
}
} // class Annotation
/* AttributedCharacterIterator.java -- Iterate over attributes
Copyright (C) 1998, 1999 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., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.text;
import java.io.Serializable;
import java.io.InvalidObjectException;
import java.util.Set;
import java.util.Map;
/**
* This interface extends the <code>CharacterIterator</code> interface
* in order to support iteration over character attributes as well as
* over the characters themselves.
* <p>
* In addition to attributes of specific characters, this interface
* supports the concept of the "attribute run", which is an attribute
* that is defined for a particular value across an entire range of
* characters or which is undefined over a range of characters.
*
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public interface AttributedCharacterIterator extends CharacterIterator
{
/*
* Inner Classes
*/
/**
* This class defines attribute keys that are used as text attributes.
*/
public static class Attribute implements Serializable
{
/*************************************************************************/
/*
* Static Variables
*/
/**
* This is the attribute for the language of the text. The value of
* attributes of this key type are instances of <code>Locale</code>.
*/
public static final Attribute LANGUAGE = new Attribute("LANGUAGE");
/**
* This is the attribute for the reading form of text. This is used
* for storing pronunciation along with the written text for languages
* which need it. The value of attributes of this key type are
* instances of <code>Annotation</code> which wrappers a <code>String</code>.
*/
public static final Attribute READING = new Attribute("READING");
/**
* This is the attribute for input method segments. The value of attributes
* of this key type are instances of <code>Annotation</code> which wrapper
* a <code>String</code>.
*/
public static final Attribute INPUT_METHOD_SEGMENT =
new Attribute("INPUT_METHOD_SEGMENT");
/*************************************************************************/
/*
* Instance Variables
*/
/**
* This is the name of the attribute key
* @serial
*/
private String name;
/*************************************************************************/
/*
* Constructors
*/
/**
* This method initializes a new instance of this class with the specified
* name.
*
* @param name The name of this attribute key.
*/
protected
Attribute(String name)
{
this.name = name;
}
/*************************************************************************/
/*
* Instance Methods
*/
/**
* This method returns the name of this attribute.
*
* @return The attribute name
*/
protected String
getName()
{
return(name);
}
/*************************************************************************/
/**
* This method resolves an instance of <code>AttributedCharacterIterator.Attribute</code>
* that is being deserialized to one of the three pre-defined attribute
* constants. It does this by comparing the names of the attributes. The
* constant that the deserialized object resolves to is returned.
*
* @return The resolved contant value
*
* @exception InvalidObjectException If the object being deserialized cannot be resolved.
*/
protected Object
readResolve() throws InvalidObjectException
{
if (this.equals(READING))
return(READING);
if (this.equals(LANGUAGE))
return(LANGUAGE);
if (this.equals(INPUT_METHOD_SEGMENT))
return(INPUT_METHOD_SEGMENT);
throw new InvalidObjectException("Can't resolve Attribute: " + getName());
}
/*************************************************************************/
/**
* This method tests this object for equality against the specified object.
* The two objects will be considered equal if and only if:
* <ul>
* <li>The specified object is not <code>null</code>.
* <li>The specified object is an instance of <code>AttributedCharacterIterator.Attribute</code>.
* <li>The specified object has the same attribute name as this object.
* </ul>
*
* @param The <code>Object</code> to test for equality against this object.
*
* @return <code>true</code> if the specified object is equal to this one, <code>false</code> otherwise.
*/
public final boolean
equals(Object obj)
{
if (obj == this)
return(true);
else
return(false);
}
/*************************************************************************/
/**
* This method returns a hash value for this object.
*
* @return A hash value for this object.
*/
public final int
hashCode()
{
return(super.hashCode());
}
/*************************************************************************/
/**
* This method returns a <code>String</code> representation of this object.
*
* @return A <code>String</code> representation of this object.
*/
public String
toString()
{
return(getClass().getName() + "(" + getName() + ")");
}
} // Inner class Attribute
/*************************************************************************/
/*
* Instance Methods
*/
/**
* This method returns a list of all keys that are defined for the
* text range. This can be an empty list if no attributes are defined.
*
* @return A list of keys
*/
public abstract Set
getAllAttributeKeys();
/*************************************************************************/
/**
* This method returns a <code>Map</code> of the attributed defined for
* the current character.
*
* @return A <code>Map</code> of the attributes for the current character.
*/
public abstract Map
getAttributes();
/*************************************************************************/
/**
* This method returns the value of the specified attribute for the
* current character. If the attribute is not defined for the current
* character, <code>null</code> is returned.
*
* @param attrib The attribute to retrieve the value of.
*
* @return The value of the specified attribute
*/
public abstract Object
getAttribute(AttributedCharacterIterator.Attribute attrib);
/*************************************************************************/
/**
* This method returns the index of the first character in the run that
* contains all attributes defined for the current character.
*
* @return The start index of the run
*/
public abstract int
getRunStart();
/*************************************************************************/
/**
* This method returns the index of the first character in the run that
* contains all attributes in the specified <code>Set</code> defined for
* the current character.
*
* @param attribs The <code>Set</code> of attributes.
*
* @return The start index of the run.
*/
public abstract int
getRunStart(Set attribs);
/*************************************************************************/
/**
* This method returns the index of the first character in the run that
* contains the specified attribute defined for the current character.
*
* @param attrib The attribute.
*
* @return The start index of the run.
*/
public abstract int
getRunStart(AttributedCharacterIterator.Attribute attrib);
/*************************************************************************/
/**
* This method returns the index of the character after the end of the run
* that contains all attributed defined for the current character.
*
* @return The end index of the run.
*/
public abstract int
getRunLimit();
/*************************************************************************/
/**
* This method returns the index of the character after the end of the run
* that contains all attributes in the specified <code>Set</code> defined
* for the current character.
*
* @param attribs The <code>Set</code> of attributes.
*
* @return The end index of the run.
*/
public abstract int
getRunLimit(Set attribs);
/*************************************************************************/
/**
* This methods returns the index of the character after the end of the run
* that contains the specified attribute defined for the current character.
*
* @param attrib The attribute.
*
* @return The end index of the run.
*/
public abstract int
getRunLimit(AttributedCharacterIterator.Attribute attrib);
} // interface AttributedCharacterIterator
/* AttributedStringIterator.java -- Class to iterate over AttributedString
Copyright (C) 1998, 1999 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., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.text;
import java.util.Set;
import java.util.HashSet;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
/**
* This class implements the AttributedCharacterIterator interface. It
* is used by AttributedString.getIterator().
*
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
class AttributedStringIterator implements AttributedCharacterIterator
{
/*************************************************************************/
/**
* Instance Variables
*/
/**
* The character iterator containing the text
*/
private CharacterIterator ci;
/**
* The list of attributes and ranges
*/
private AttributedString.AttributeRange[] attribs;
/**
* The list of attributes that the user is interested in. We may,
* at our option, not return any other attributes.
*/
private AttributedCharacterIterator.Attribute[] restricts;
/*************************************************************************/
/*
* Constructors
*/
AttributedStringIterator(StringCharacterIterator sci,
AttributedString.AttributeRange[] attribs,
int begin_index, int end_index,
AttributedCharacterIterator.Attribute[] restricts)
{
this.ci = new StringCharacterIterator(sci, begin_index, end_index);
this.attribs = attribs;
this.restricts = restricts;
}
/*************************************************************************/
/*
* Instance Methods
*/
// First we have a bunch of stupid redirects. If StringCharacterIterator
// weren't final, I just would have extended that for this class. Alas, no.
public Object
clone()
{
return(ci.clone());
}
public char
current()
{
return(ci.current());
}
public char
next()
{
return(ci.next());
}
public char
previous()
{
return(ci.previous());
}
public char
first()
{
return(ci.first());
}
public char
last()
{
return(ci.last());
}
public int
getIndex()
{
return(ci.getIndex());
}
public char
setIndex(int index)
{
return(ci.setIndex(index));
}
public int
getBeginIndex()
{
return(ci.getBeginIndex());
}
public int
getEndIndex()
{
return(ci.getEndIndex());
}
/*
* Here is where the AttributedCharacterIterator methods start.
*/
/*************************************************************************/
/**
* Returns a list of all the attribute keys that are defined anywhere
* on this string.
*/
public Set
getAllAttributeKeys()
{
HashSet s = new HashSet();
if (attribs == null)
return(s);
for (int i = 0; i < attribs.length; i++)
{
Set key_set = attribs[i].attribs.keySet();
Iterator iter = key_set.iterator();
while (iter.hasNext())
{
s.add(iter.next());
}
}
return(s);
}
/*************************************************************************/
/**
* Various methods that determine how far the run extends for various
* attribute combinations.
*/
public int
getRunLimit()
{
return(getRunLimit(getAttributes().keySet()));
}
public int
getRunLimit(AttributedCharacterIterator.Attribute attrib)
{
HashSet s = new HashSet();
s.add(attrib);
return(getRunLimit(s));
}
public synchronized int
getRunLimit(Set attribute_set)
{
int orig_index = ci.getIndex();
int run_limit;
do
{
run_limit = ci.getIndex();
Map attribute_map = getAttributes();
boolean found = false;
Iterator iter = attribute_set.iterator();
while(iter.hasNext())
if (!attribute_map.containsKey(iter.next()))
{
found = true;
break;
}
if (found)
break;
}
while (ci.next() != CharacterIterator.DONE);
boolean hit_end = (ci.previous() == CharacterIterator.DONE);
ci.setIndex(orig_index);
if (run_limit == orig_index)
return(-1); // No characters match the given attributes
// else if (!hit_end)
// --run_limit;
return(run_limit);
}
/*************************************************************************/
/**
* Various methods that determine where the run begins for various
* attribute combinations.
*/
public int
getRunStart()
{
return(getRunStart(getAttributes().keySet()));
}
public int
getRunStart(AttributedCharacterIterator.Attribute attrib)
{
HashSet s = new HashSet();
s.add(attrib);
return(getRunStart(s));
}
public int
getRunStart(Set attribute_set)
{
int orig_index = ci.getIndex();
int run_start;
do
{
run_start = ci.getIndex();
Map attribute_map = getAttributes();
Iterator iter = attribute_set.iterator();
while(iter.hasNext())
if (!attribute_map.containsKey(iter.next()))
break;
if (iter.hasNext())
break;
}
while (ci.previous() != CharacterIterator.DONE);
boolean hit_beginning = (ci.previous() == CharacterIterator.DONE);
ci.setIndex(orig_index);
if (run_start == orig_index)
return(-1); // No characters match the given attributes
else if (!hit_beginning)
++run_start;
return(run_start);
}
/*************************************************************************/
public Object
getAttribute(AttributedCharacterIterator.Attribute attrib)
{
if (attribs == null)
return(null);
for (int i = 0; i < attribs.length; i++)
{
Set key_set = attribs[i].attribs.keySet();
Iterator iter = key_set.iterator();
while (iter.hasNext())
{
Object obj = iter.next();
// Check for attribute match and range match
if (obj.equals(attrib))
if ((ci.getIndex() >= attribs[i].begin_index) &&
(ci.getIndex() <= attribs[i].end_index))
return(attribs[i].attribs.get(obj));
}
}
return(null);
}
/*************************************************************************/
/**
* Return a list of all the attributes and values defined for this
* character
*/
public Map
getAttributes()
{
HashMap m = new HashMap();
if (attribs == null)
return(m);
for (int i = 0; i < attribs.length; i++)
{
if ((ci.getIndex() >= attribs[i].begin_index) &&
(ci.getIndex() <= attribs[i].end_index))
m.putAll(attribs[i].attribs);
}
return(m);
}
} // class AttributedStringIterator
// CharacterIterator.java - Protocol for iterating over Unicode characters. /* CharacterIterator.java -- Iterate over a character range
Copyright (C) 1998, 2001 Free Software Foundation, Inc.
/* Copyright (C) 1999 Free Software Foundation This file is part of GNU Classpath.
This file is part of libgcj. 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., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.text; package java.text;
/** /**
* @author Tom Tromey <tromey@cygnus.com> * This interface defines a mechanism for iterating over a range of
* @date February 22, 1999 * characters. For a given range of text, a beginning and ending index,
*/ * as well as a current index are defined. These values can be queried
/* Written using "Java Class Libraries", 2nd edition, plus online * by the methods in this interface. Additionally, various methods allow
* API docs for JDK 1.2 beta from http://www.javasoft.com. * the index to be set.
* Status: Believed complete and correct to 1.1. *
*/ * @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public interface CharacterIterator extends Cloneable public interface CharacterIterator extends Cloneable
{ {
public abstract Object clone ();
/*************************************************************************/
/*
* Static Variables
*/
/**
* This is a special constant value that is returned when the beginning or
* end of the character range has been reached.
*/
public static final char DONE = '\uFFFF';
/*************************************************************************/
/*
* Instance Methods
*/
/**
* This method returns the character at the current index position
*
* @return The character at the current index position.
*/
public abstract char current (); public abstract char current ();
/*************************************************************************/
/**
* This method increments the current index and then returns the character
* at the new index value. If the index is already at <code>getEndIndex() - 1</code>,
* it will not be incremented.
*
* @return The character at the position of the incremented index value, or <code>DONE</code> if the index has reached getEndIndex() - 1
*/
public abstract char next ();
/*************************************************************************/
/**
* This method decrements the current index and then returns the character
* at the new index value. If the index value is already at the beginning
* index, it will not be decremented.
*
* @return The character at the position of the decremented index value, or <code>DONE</code> if index was already equal to the beginning index value.
*/
public abstract char previous ();
/*************************************************************************/
/**
* This method sets the index value to the beginning of the range and returns
* the character there.
*
* @return The character at the beginning of the range, or <code>DONE</code> if the range is empty.
*/
public abstract char first (); public abstract char first ();
/*************************************************************************/
/**
* This method sets the index value to <code>getEndIndex() - 1</code> and
* returns the character there. If the range is empty, then the index value
* will be set equal to the beginning index.
*
* @return The character at the end of the range, or <code>DONE</code> if the range is empty.
*/
public abstract char last ();
/*************************************************************************/
/**
* This method returns the current value of the index.
*
* @return The current index value
*/
public abstract int getIndex ();
/*************************************************************************/
/**
* This method sets the value of the index to the specified value, then
* returns the character at that position.
*
* @param index The new index value.
*
* @return The character at the new index value or <code>DONE</code> if the index value is equal to <code>getEndIndex</code>.
*/
public abstract char setIndex (int index) throws IllegalArgumentException;
/*************************************************************************/
/**
* This method returns the character position of the first character in the
* range.
*
* @return The index of the first character in the range.
*/
public abstract int getBeginIndex (); public abstract int getBeginIndex ();
/*************************************************************************/
/**
* This method returns the character position of the end of the text range.
* This will actually be the index of the first character following the
* end of the range. In the event the text range is empty, this will be
* equal to the first character in the range.
*
* @return The index of the end of the range.
*/
public abstract int getEndIndex (); public abstract int getEndIndex ();
public abstract int getIndex ();
public abstract char last ();
public abstract char next ();
public abstract char previous ();
public abstract char setIndex (int idx);
public static final char DONE = '\uffff'; /*************************************************************************/
/**
* This method creates a copy of this <code>CharacterIterator</code>.
*
* @return A copy of this <code>CharacterIterator</code>.
*/
public abstract Object clone ();
} }
/* Copyright (C) 1998, 1999 Free Software Foundation /* FieldPosition.java -- Keeps track of field positions while formatting
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
This file is part of libgcj. 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., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.text; package java.text;
/** /**
* This class is used by the java.text formatting classes to track
* field positions. A field position is defined by an identifier value
* and begin and end index positions. The formatting classes in java.text
* typically define constant values for the field identifiers.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Per Bothner <bothner@cygnus.com> * @author Per Bothner <bothner@cygnus.com>
* @date October 25, 1998.
*/
/* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct.
* Includes JDK 1.2 methods.
*/ */
public class FieldPosition public class FieldPosition
{ {
int field; /**
int beginIndex; * This is the field identifier value.
int endIndex; */
private int field_id;
/**
* This is the beginning index of the field.
*/
private int begin;
/**
* This is the ending index of the field.
*/
private int end;
public FieldPosition (int field) /**
* This method initializes a new instance of <code>FieldPosition</code> to
* have the specified field id.
*
* @param field_id The field identifier value.
*/
public FieldPosition (int field_id)
{ {
this.field = field; this.field_id = field_id;
} }
/**
* This method returns the field identifier value for this object.
*
* @return The field identifier.
*/
public int getField () public int getField ()
{ {
return field; return field_id;
} }
/**
* This method returns the beginning index for this field.
*
* @return The beginning index.
*/
public int getBeginIndex () public int getBeginIndex ()
{ {
return beginIndex; return begin;
} }
public int getEndIndex () /**
* This method sets the beginning index of this field to the specified value.
*
* @param begin The new beginning index.
*/
public void setBeginIndex (int begin)
{ {
return endIndex; this.begin = begin;
} }
public void setBeginIndex (int index) /**
* This method returns the ending index for the field.
*
* @return The ending index.
*/
public int getEndIndex ()
{ {
beginIndex = index; return end;
} }
public void setEndIndex (int index) /**
* This method sets the ending index of this field to the specified value.
*
* @param end The new ending index.
*/
public void setEndIndex (int end)
{ {
endIndex = index; this.end = end;
} }
/**
* This method tests this object for equality against the specified object.
* The objects will be considered equal if and only if:
* <p>
* <ul>
* <li>The specified object is not <code>null</code>.
* <li>The specified object is an instance of <code>FieldPosition</code>.
* <li>The specified object has the same field identifier and beginning
* and ending index as this object.
* </ul>
*
* @param obj The object to test for equality to this object.
*
* @return <code>true</code> if the specified object is equal to
* this object, <code>false</code> otherwise.
*/
public boolean equals (Object obj) public boolean equals (Object obj)
{ {
if (! (obj instanceof FieldPosition)) if (! (obj instanceof FieldPosition))
return false; return false;
FieldPosition other = (FieldPosition) obj;
return (field == other.field FieldPosition fp = (FieldPosition) obj;
&& beginIndex == other.beginIndex && endIndex == other.endIndex); return (field_id == fp.field_id
&& begin == fp.begin
&& end == fp.end);
}
/**
* This method returns a <code>String</code> representation of this
* object.
*
* @return A <code>String</code> representation of this object.
*/
public String toString ()
{
return (getClass ().getName () + "[field=" + getField () + ",beginIndex="
+ getBeginIndex () + ",endIndex=" + getEndIndex () + "]");
} }
} }
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation /* Format.java -- Abstract superclass for formatting/parsing strings.
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of libgcj. 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., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.text; package java.text;
import java.io.Serializable;
/** /**
* This class is the abstract superclass of classes that format and parse
* data to/from <code>Strings</code>. It is guaranteed that any
* <code>String</code> produced by a concrete subclass of <code>Format</code>
* will be parseable by that same subclass.
* <p>
* In addition to implementing the abstract methods in this class, subclasses
* should provide static factory methods of the form
* <code>getInstance()</code> and <code>getInstance(Locale)</code> if the
* subclass loads different formatting/parsing schemes based on locale.
* These subclasses should also implement a static method called
* <code>getAvailableLocales()</code> which returns an array of
* available locales in the current runtime environment.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Per Bothner <bothner@cygnus.com> * @author Per Bothner <bothner@cygnus.com>
* @date October 25, 1998.
*/
/* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct.
*/ */
public abstract class Format implements Serializable, Cloneable
public abstract class Format implements java.io.Serializable, Cloneable
{ {
/**
* This method initializes a new instance of <code>Format</code>.
* It performs no actions, but acts as a default constructor for
* subclasses.
*/
public Format () public Format ()
{ {
} }
public abstract StringBuffer format (Object obj, /**
StringBuffer sbuf, FieldPosition pos); * This method formats an <code>Object</code> into a <code>String</code>.
*
public final String format (Object obj) * @param obj The <code>Object</code> to format.
*
* @return The formatted <code>String</code>.
*
* @exception IllegalArgumentException If the <code>Object</code>
* cannot be formatted.
*/
public final String format(Object obj) throws IllegalArgumentException
{ {
StringBuffer sbuf = new StringBuffer(); StringBuffer sb = new StringBuffer ();
format(obj, sbuf, new FieldPosition(0)); format (obj, sb, new FieldPosition (0));
return sbuf.toString(); return sb.toString ();
} }
public abstract Object parseObject (String source, ParsePosition pos); /**
* This method formats an <code>Object</code> into a <code>String</code> and
* appends the <code>String</code> to a <code>StringBuffer</code>.
*
* @param obj The <code>Object</code> to format.
* @param sb The <code>StringBuffer</code> to append to.
* @param pos The desired <code>FieldPosition</code>, which is also
* updated by this call.
*
* @return The updated <code>StringBuffer</code>.
*
* @exception IllegalArgumentException If the <code>Object</code>
* cannot be formatted.
*/
public abstract StringBuffer format (Object obj, StringBuffer sb,
FieldPosition pos)
throws IllegalArgumentException;
public Object parseObject (String source) throws ParseException /**
* This method parses a <code>String</code> and converts the parsed
* contents into an <code>Object</code>.
*
* @param str The <code>String to parse.
*
* @return The resulting <code>Object</code>.
*
* @exception ParseException If the <code>String</code> cannot be parsed.
*/
public Object parseObject (String str) throws ParseException
{ {
ParsePosition pos = new ParsePosition(0); ParsePosition pos = new ParsePosition(0);
Object result = parseObject (source, pos); Object result = parseObject (str, pos);
if (result == null) if (result == null)
{ {
int index = pos.getErrorIndex(); int index = pos.getErrorIndex();
...@@ -49,8 +116,33 @@ public abstract class Format implements java.io.Serializable, Cloneable ...@@ -49,8 +116,33 @@ public abstract class Format implements java.io.Serializable, Cloneable
return result; return result;
} }
/**
* This method parses a <code>String</code> and converts the parsed
* contents into an <code>Object</code>.
*
* @param str The <code>String</code> to parse.
* @param pos The starting parse index on input, the ending parse
* index on output.
*
* @return The parsed <code>Object</code>, or <code>null</code> in
* case of error.
*/
public abstract Object parseObject (String str, ParsePosition pos);
/**
* Creates a copy of this object.
*
* @return The copied <code>Object</code>.
*/
public Object clone () public Object clone ()
{ {
return super.clone (); try
{
return super.clone ();
}
catch (CloneNotSupportedException e)
{
return null;
}
} }
} }
// MessageFormat.java - Localized message formatting. /* MessageFormat.java - Localized message formatting.
Copyright (C) 1999, 2001 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., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
/* Copyright (C) 1999, 2001 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.text; package java.text;
......
/* Copyright (C) 1998, 1999 Free Software Foundation /* ParsePosition.java -- Keep track of position while parsing.
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
This file is part of libgcj. 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., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.text; package java.text;
/** /**
* This class is used to keep track of the current position during parsing
* operations.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Per Bothner <bothner@cygnus.com> * @author Per Bothner <bothner@cygnus.com>
* @date October 25, 1998.
*/ */
/* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct.
* Includes JDK 1.2 methods.
*/
public class ParsePosition public class ParsePosition
{ {
int index; /**
int errorIndex; * This is the index of the current parse position.
*/
private int index;
/**
* This is the index of the position where an error occurred during parsing.
*/
private int error_index;
/**
* This method initializes a new instance of <code>ParsePosition</code> to
* have the specified initial index value.
*
* @param index The initial parsing index.
*/
public ParsePosition (int index) public ParsePosition (int index)
{ {
this.index = index; this.index = index;
errorIndex = -1; error_index = -1;
} }
/**
* This method returns the current parsing index.
*
* @return The current parsing index
*/
public int getIndex () public int getIndex ()
{ {
return index; return index;
} }
/**
* This method sets the current parsing index to the specified value.
*
* @param index The new parsing index.
*/
public void setIndex (int index) public void setIndex (int index)
{ {
this.index = index; this.index = index;
} }
/**
* This method returns the error index value. This value defaults to -1
* unless explicitly set to another value.
*
* @return The error index.
*/
public int getErrorIndex () public int getErrorIndex ()
{ {
return errorIndex; return error_index;
} }
public void setErrorIndex (int ei) /**
* This method sets the error index to the specified value.
*
* @param error_index The new error index
*/
public void setErrorIndex (int error_index)
{ {
errorIndex = ei; this.error_index = error_index;
} }
/**
* This method tests the specified object for equality with this
* object. The two objects will be considered equal if and only if
* all of the following conditions are met.
* <p>
* <ul>
* <li>The specified object is not <code>null</code>.
* <li>The specified object is an instance of <code>ParsePosition</code>.
* <li>The specified object has the same index and error index as
* this object.
* </ul>
*
* @param obj The <code>Object</code> to test for equality against
* this object.
*
* @return <code>true</code> if the specified object is equal to
* this object, <code>false</code> otherwise.
*/
public boolean equals (Object obj) public boolean equals (Object obj)
{ {
if (obj != null || ! (obj instanceof ParsePosition)) if (! (obj instanceof ParsePosition))
return false; return false;
ParsePosition other = (ParsePosition) obj; ParsePosition other = (ParsePosition) obj;
return index == other.index && errorIndex == other.errorIndex; return index == other.index && error_index == other.error_index;
}
/**
* This method returns a <code>String</code> representation of this
* object.
*
* @return A <code>String</code> that represents this object.
*/
public String toString ()
{
return (getClass ().getName () + "[index=" + getIndex ()
+ ",errorIndex=" + getErrorIndex () + "]");
} }
} }
...@@ -207,6 +207,7 @@ public class SimpleDateFormat extends DateFormat ...@@ -207,6 +207,7 @@ public class SimpleDateFormat extends DateFormat
{ {
super(); super();
calendar = new GregorianCalendar(); calendar = new GregorianCalendar();
computeCenturyStart ();
tokens = new Vector(); tokens = new Vector();
this.formatData = formatData; this.formatData = formatData;
compileFormat(pattern); compileFormat(pattern);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment