DateFormat.java (computeInstance): Separate time and date styles.
* java/text/DateFormat.java (computeInstance): Separate time and date styles. (getDateTimeInstance): Ditto. (getDateTimeInstance(int,int)): New method. * Makefile.in: Rebuilt. * Makefile.am (ordinary_java_source_files): Add new classes. * java/util/PropertyResourceBundle.java: New file. * gnu/gcj/util/EnumerationChain.java: New file. From-SVN: r26842
This commit is contained in:
parent
81a1c8c397
commit
e3884aeea7
6 changed files with 148 additions and 13 deletions
|
@ -1,3 +1,16 @@
|
|||
1999-05-9 Anthony Green <green@cygnus.com>
|
||||
|
||||
* java/text/DateFormat.java (computeInstance): Separate time
|
||||
and date styles.
|
||||
(getDateTimeInstance): Ditto.
|
||||
(getDateTimeInstance(int,int)): New method.
|
||||
|
||||
* Makefile.in: Rebuilt.
|
||||
* Makefile.am (ordinary_java_source_files): Add new classes.
|
||||
|
||||
* java/util/PropertyResourceBundle.java: New file.
|
||||
* gnu/gcj/util/EnumerationChain.java: New file.
|
||||
|
||||
1999-05-07 Tom Tromey <tromey@cygnus.com>
|
||||
|
||||
* acconfig.h (GCJVERSION): New undef.
|
||||
|
|
|
@ -422,6 +422,7 @@ gnu/gcj/protocol/file/Handler.java \
|
|||
gnu/gcj/protocol/http/Connection.java \
|
||||
gnu/gcj/protocol/http/Handler.java \
|
||||
gnu/gcj/RawData.java \
|
||||
gnu/gcj/util/EnumerationChain.java \
|
||||
java/io/BufferedInputStream.java \
|
||||
java/io/BufferedOutputStream.java \
|
||||
java/io/BufferedReader.java \
|
||||
|
@ -617,6 +618,7 @@ java/util/NoSuchElementException.java \
|
|||
java/util/Observable.java \
|
||||
java/util/Observer.java \
|
||||
java/util/Properties.java \
|
||||
java/util/PropertyResourceBundle.java \
|
||||
java/util/Random.java \
|
||||
java/util/ResourceBundle.java \
|
||||
java/util/SimpleTimeZone.java \
|
||||
|
|
|
@ -285,6 +285,7 @@ gnu/gcj/protocol/file/Handler.java \
|
|||
gnu/gcj/protocol/http/Connection.java \
|
||||
gnu/gcj/protocol/http/Handler.java \
|
||||
gnu/gcj/RawData.java \
|
||||
gnu/gcj/util/EnumerationChain.java \
|
||||
java/io/BufferedInputStream.java \
|
||||
java/io/BufferedOutputStream.java \
|
||||
java/io/BufferedReader.java \
|
||||
|
@ -480,6 +481,7 @@ java/util/NoSuchElementException.java \
|
|||
java/util/Observable.java \
|
||||
java/util/Observer.java \
|
||||
java/util/Properties.java \
|
||||
java/util/PropertyResourceBundle.java \
|
||||
java/util/Random.java \
|
||||
java/util/ResourceBundle.java \
|
||||
java/util/SimpleTimeZone.java \
|
||||
|
@ -671,6 +673,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
|
|||
.deps/gnu/gcj/text/LocaleData_en_US.P \
|
||||
.deps/gnu/gcj/text/SentenceBreakIterator.P \
|
||||
.deps/gnu/gcj/text/WordBreakIterator.P \
|
||||
.deps/gnu/gcj/util/EnumerationChain.P \
|
||||
.deps/java/io/BufferedInputStream.P \
|
||||
.deps/java/io/BufferedOutputStream.P .deps/java/io/BufferedReader.P \
|
||||
.deps/java/io/BufferedWriter.P .deps/java/io/ByteArrayInputStream.P \
|
||||
|
@ -809,12 +812,13 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
|
|||
.deps/java/util/MissingResourceException.P \
|
||||
.deps/java/util/NoSuchElementException.P .deps/java/util/Observable.P \
|
||||
.deps/java/util/Observer.P .deps/java/util/Properties.P \
|
||||
.deps/java/util/Random.P .deps/java/util/ResourceBundle.P \
|
||||
.deps/java/util/SimpleTimeZone.P .deps/java/util/Stack.P \
|
||||
.deps/java/util/StringTokenizer.P .deps/java/util/TimeZone.P \
|
||||
.deps/java/util/TooManyListenersException.P .deps/java/util/Vector.P \
|
||||
.deps/java/util/zip/Adler32.P .deps/java/util/zip/CRC32.P \
|
||||
.deps/java/util/zip/Checksum.P .deps/java/util/zip/Deflater.P \
|
||||
.deps/java/util/PropertyResourceBundle.P .deps/java/util/Random.P \
|
||||
.deps/java/util/ResourceBundle.P .deps/java/util/SimpleTimeZone.P \
|
||||
.deps/java/util/Stack.P .deps/java/util/StringTokenizer.P \
|
||||
.deps/java/util/TimeZone.P .deps/java/util/TooManyListenersException.P \
|
||||
.deps/java/util/Vector.P .deps/java/util/zip/Adler32.P \
|
||||
.deps/java/util/zip/CRC32.P .deps/java/util/zip/Checksum.P \
|
||||
.deps/java/util/zip/Deflater.P \
|
||||
.deps/java/util/zip/DeflaterOutputStream.P \
|
||||
.deps/java/util/zip/InflaterInputStream.P \
|
||||
.deps/java/util/zip/ZipConstants.P .deps/java/util/zip/ZipEntry.P \
|
||||
|
|
52
libjava/gnu/gcj/util/EnumerationChain.java
Normal file
52
libjava/gnu/gcj/util/EnumerationChain.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
/* Copyright (C) 1999 Cygnus Solutions
|
||||
|
||||
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.util;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
public class EnumerationChain implements Enumeration
|
||||
{
|
||||
private Enumeration first_;
|
||||
private Enumeration second_;
|
||||
|
||||
public EnumerationChain (Enumeration first, Enumeration second)
|
||||
{
|
||||
if (first == null
|
||||
|| second == null)
|
||||
throw new NullPointerException();
|
||||
|
||||
first_ = first;
|
||||
second_ = second;
|
||||
}
|
||||
|
||||
public synchronized boolean hasMoreElements()
|
||||
{
|
||||
if (first_ == null)
|
||||
return false;
|
||||
else
|
||||
return first_.hasMoreElements();
|
||||
}
|
||||
|
||||
public synchronized Object nextElement() throws NoSuchElementException
|
||||
{
|
||||
while (first_ != null)
|
||||
{
|
||||
if (! first_.hasMoreElements())
|
||||
{
|
||||
first_ = second_;
|
||||
second_ = null;
|
||||
}
|
||||
else
|
||||
return first_.nextElement();
|
||||
}
|
||||
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
}
|
|
@ -93,6 +93,15 @@ public abstract class DateFormat extends Format implements Cloneable
|
|||
private static final DateFormat computeInstance (int style, Locale loc,
|
||||
boolean use_date,
|
||||
boolean use_time)
|
||||
{
|
||||
return computeInstance (style, style, loc, use_date, use_time);
|
||||
}
|
||||
|
||||
private static final DateFormat computeInstance (int dateStyle,
|
||||
int timeStyle,
|
||||
Locale loc,
|
||||
boolean use_date,
|
||||
boolean use_time)
|
||||
{
|
||||
ResourceBundle res;
|
||||
try
|
||||
|
@ -108,7 +117,7 @@ public abstract class DateFormat extends Format implements Cloneable
|
|||
if (use_date)
|
||||
{
|
||||
String name, def;
|
||||
switch (style)
|
||||
switch (dateStyle)
|
||||
{
|
||||
case FULL:
|
||||
name = "fullDateFormat";
|
||||
|
@ -147,7 +156,7 @@ public abstract class DateFormat extends Format implements Cloneable
|
|||
pattern += " ";
|
||||
|
||||
String name, def;
|
||||
switch (style)
|
||||
switch (timeStyle)
|
||||
{
|
||||
case FULL:
|
||||
name = "fullTimeFormat";
|
||||
|
@ -201,23 +210,31 @@ public abstract class DateFormat extends Format implements Cloneable
|
|||
|
||||
public static final DateFormat getDateTimeInstance ()
|
||||
{
|
||||
return getDateTimeInstance (DEFAULT, Locale.getDefault());
|
||||
return getDateTimeInstance (DEFAULT, DEFAULT, Locale.getDefault());
|
||||
}
|
||||
|
||||
public static final DateFormat getDateTimeInstance (int style)
|
||||
{
|
||||
return getDateTimeInstance (style, Locale.getDefault());
|
||||
return getDateTimeInstance (style, style, Locale.getDefault());
|
||||
}
|
||||
|
||||
public static final DateFormat getDateTimeInstance (int style, Locale loc)
|
||||
public static final DateFormat getDateTimeInstance (int dateStyle,
|
||||
int timeStyle)
|
||||
{
|
||||
return computeInstance (style, loc, true, true);
|
||||
return getDateTimeInstance (dateStyle, timeStyle, Locale.getDefault());
|
||||
}
|
||||
|
||||
public static final DateFormat getDateTimeInstance (int dateStyle,
|
||||
int timeStyle,
|
||||
Locale loc)
|
||||
{
|
||||
return computeInstance (dateStyle, timeStyle, loc, true, true);
|
||||
}
|
||||
|
||||
public static final DateFormat getInstance ()
|
||||
{
|
||||
// JCL book says SHORT.
|
||||
return getDateTimeInstance (SHORT, Locale.getDefault());
|
||||
return getDateTimeInstance (SHORT, SHORT, Locale.getDefault());
|
||||
}
|
||||
|
||||
public NumberFormat getNumberFormat ()
|
||||
|
|
47
libjava/java/util/PropertyResourceBundle.java
Normal file
47
libjava/java/util/PropertyResourceBundle.java
Normal file
|
@ -0,0 +1,47 @@
|
|||
/* Copyright (C) 1999 Cygnus Solutions
|
||||
|
||||
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.util;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import gnu.gcj.util.EnumerationChain;
|
||||
|
||||
/**
|
||||
* @author Anthony Green <green@cygnus.com>
|
||||
* @date April 29, 1999.
|
||||
*/
|
||||
|
||||
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3,
|
||||
* and "The Java Language Specification", ISBN 0-201-63451-1. */
|
||||
|
||||
public class PropertyResourceBundle extends ResourceBundle
|
||||
{
|
||||
private Properties properties;
|
||||
|
||||
public PropertyResourceBundle (InputStream pstream) throws IOException
|
||||
{
|
||||
// Initialize and load our Properties.
|
||||
properties = new Properties();
|
||||
properties.load(pstream);
|
||||
}
|
||||
|
||||
public Enumeration getKeys()
|
||||
{
|
||||
if (parent == null)
|
||||
return properties.propertyNames();
|
||||
else
|
||||
return new EnumerationChain (properties.propertyNames(),
|
||||
parent.getKeys ());
|
||||
}
|
||||
|
||||
protected Object handleGetObject (String key)
|
||||
{
|
||||
return properties.getProperty(key);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue