mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-22 18:19:43 +08:00
bc6ccd3316
* java/beans/PropertyChangeEvent.java (serialVersionUID): Added. * java/beans/PropertyVetoException.java (serialVersionUID): Added. * java/io/File.java (writeObject): Added. (readObject): Added. (serialVersionUID): Added. * java/io/ObjectOutputStream.java (writeObject): Initialized fieldsAlreadyWritten before recursion rather than after. * java/io/ObjectStreamClass.java (serialVersionUID): Added. * java/io/OptionalDataException.java (serialVersionUID): Added. (OptionalDataException): Made package private. * java/io/SyncFailedException.java (SyncFailedException): Removed default constructor to match spec. * java/lang/Boolean.java (serialVersionUID): Added. * java/lang/Byte.java (serialVersionUID): Added. * java/lang/Character.java (serialVersionUID): Added. * java/lang/Double.java (serialVersionUID): Added. * java/lang/Float.java (serialVersionUID): Added. * java/lang/Integer.java (serialVersionUID): Added. * java/lang/Long.java (serialVersionUID): Added. * java/lang/Number.java (serialVersionUID): Added. * java/lang/Short.java (serialVersionUID): Added. * java/lang/String.java (serialVersionUID): Added. * java/lang/ThreadDeath.java (ThreadDeath): Removed constructor to match spec. * java/lang/reflect/InvocationTargetException.java (serialVersionUID): Added. * java/net/URL.java (handler): Made transient. (hashCode): Added field for serialization, per spec. and use cached value if available. (serialVersionUID): Added. (URL): Initialize hashCode. (set): Adjust hashCode. (readObject): New Method to initialize the protocol handler when deserializing. (writeObject): New method. * java/text/BreakIterator.java: Removed 'implements Serializable'. * java/text/Collator.java: Removed 'implements Serializable'. * java/util/GregorianCalendar.java (serialVersionUID): Added. * java/util/Properties.java (serialVersionUID): Added. * java/util/Random.java (serialVersionUID): Added. (seed): Made private. (nextNextGaussian): Made private. (haveNextNextGaussian): Made private. * java/util/Stack.java (serialVersionUID): Added. * java/util/TimeZone.java (serialVersionUID): Added. * java/util/Vector.java (serialVersionUID): Added. Serialization mods. From-SVN: r36272
135 lines
3.1 KiB
Java
135 lines
3.1 KiB
Java
// Collator.java - Locale-sensitive string comparison.
|
|
|
|
/* 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 java.text;
|
|
|
|
import java.util.Locale;
|
|
import java.util.MissingResourceException;
|
|
import java.util.ResourceBundle;
|
|
|
|
/**
|
|
* @author Tom Tromey <tromey@cygnus.com>
|
|
* @date March 18, 1999
|
|
*/
|
|
/* Written using "Java Class Libraries", 2nd edition, plus online
|
|
* API docs for JDK 1.2 from http://www.javasoft.com.
|
|
* Status: Mostly complete, but parts stubbed out. Look for FIXME.
|
|
*/
|
|
|
|
public abstract class Collator implements Cloneable
|
|
{
|
|
public static final int NO_DECOMPOSITION = 0;
|
|
public static final int CANONICAL_DECOMPOSITION = 1;
|
|
public static final int FULL_DECOMPOSITION = 2;
|
|
|
|
public static final int PRIMARY = 0;
|
|
public static final int SECONDARY = 1;
|
|
public static final int TERTIARY = 2;
|
|
public static final int IDENTICAL = 3;
|
|
|
|
protected Collator ()
|
|
{
|
|
strength = TERTIARY;
|
|
decmp = CANONICAL_DECOMPOSITION;
|
|
}
|
|
|
|
public abstract int compare (String source, String target);
|
|
|
|
public boolean equals (Object obj)
|
|
{
|
|
if (! (obj instanceof Collator))
|
|
return false;
|
|
Collator c = (Collator) obj;
|
|
return decmp == c.decmp && strength == c.strength;
|
|
}
|
|
|
|
public boolean equals (String source, String target)
|
|
{
|
|
return compare (source, target) == 0;
|
|
}
|
|
|
|
public Object clone ()
|
|
{
|
|
return super.clone ();
|
|
}
|
|
|
|
public static synchronized Locale[] getAvailableLocales ()
|
|
{
|
|
// FIXME.
|
|
return null;
|
|
}
|
|
|
|
public abstract CollationKey getCollationKey (String source);
|
|
|
|
public synchronized int getDecomposition ()
|
|
{
|
|
return decmp;
|
|
}
|
|
|
|
public static Collator getInstance ()
|
|
{
|
|
return getInstance (Locale.getDefault());
|
|
}
|
|
|
|
public static Collator getInstance (Locale loc)
|
|
{
|
|
ResourceBundle res;
|
|
String pattern;
|
|
try
|
|
{
|
|
res = ResourceBundle.getBundle("gnu.gcj.text.LocaleData", loc);
|
|
pattern = res.getString("collatorRule");
|
|
}
|
|
catch (MissingResourceException x)
|
|
{
|
|
return null;
|
|
}
|
|
try
|
|
{
|
|
return new RuleBasedCollator (pattern);
|
|
}
|
|
catch (ParseException x)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public synchronized int getStrength ()
|
|
{
|
|
return strength;
|
|
}
|
|
|
|
public abstract int hashCode ();
|
|
|
|
public synchronized void setDecomposition (int mode)
|
|
{
|
|
if (mode != NO_DECOMPOSITION
|
|
&& mode != CANONICAL_DECOMPOSITION
|
|
&& mode != FULL_DECOMPOSITION)
|
|
throw new IllegalArgumentException ();
|
|
decmp = mode;
|
|
}
|
|
|
|
public synchronized void setStrength (int strength)
|
|
{
|
|
if (strength != PRIMARY && strength != SECONDARY
|
|
&& strength != TERTIARY && strength != IDENTICAL)
|
|
throw new IllegalArgumentException ();
|
|
this.strength = strength;
|
|
}
|
|
|
|
// Decompose a single character and append results to the buffer.
|
|
protected native final void decomposeCharacter (char c, StringBuffer buf);
|
|
|
|
// These names are fixed by the serialization spec.
|
|
protected int decmp;
|
|
protected int strength;
|
|
}
|