diff options
author | Tom Tromey <tromey@cygnus.com> | 2000-11-18 02:29:13 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2000-11-18 02:29:13 +0000 |
commit | 9839499072cebd19a8c5cc2a3734adf60b06b21b (patch) | |
tree | 172790643762236160d84d128d568d37d0b773ac /libjava/java/util | |
parent | c5f651bf3ff1ec27c25ebdcd14d55bc125c020a4 (diff) | |
download | gcc-9839499072cebd19a8c5cc2a3734adf60b06b21b.zip gcc-9839499072cebd19a8c5cc2a3734adf60b06b21b.tar.gz gcc-9839499072cebd19a8c5cc2a3734adf60b06b21b.tar.bz2 |
natString.cc: Include Locale.h.
* java/lang/natString.cc: Include Locale.h.
(toUpperCase): Added `locale' argument. Handle locale
sensitivity.
(toLowerCase): Added `locale' argument. Handle locale
sensitivity.
(ESSET, CAPITAL_S, SMALL_I, CAPITAL_I_WITH_DOT, SMALL_DOTLESS_I,
CAPITAL_I): New defines.
* java/lang/String.java (CASE_INSENSITIVE_ORDER): Now public and
final.
Import Locale.
(toUpperCase, toLowerCase): New methods. Variants which accept
locale now native.
* java/lang/ExceptionInInitializerError.java (printStackTrace):
New methods.
* java/util/PropertyPermission.java: Re-merged from Classpath.
* java/text/RuleBasedCollator.java (getCollationElementIterator):
New method.
* java/text/StringCharacterIterator.java: Reindented.
(setText): New method.
From-SVN: r37539
Diffstat (limited to 'libjava/java/util')
-rw-r--r-- | libjava/java/util/PropertyPermission.java | 133 |
1 files changed, 73 insertions, 60 deletions
diff --git a/libjava/java/util/PropertyPermission.java b/libjava/java/util/PropertyPermission.java index 8d004c0..57f5f08c9 100644 --- a/libjava/java/util/PropertyPermission.java +++ b/libjava/java/util/PropertyPermission.java @@ -1,5 +1,5 @@ /* java.util.PropertyPermission - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -7,7 +7,7 @@ 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 @@ -68,13 +68,13 @@ public final class PropertyPermission extends BasicPermission private static final long serialVersionUID = 885438825399942851L; - private static final int READ = 1; + private static final int READ = 1; private static final int WRITE = 2; private transient int actions; - private static String actionStrings[] = - { - "", "read", "write", "read,write" + private static final String actionStrings[] = + { + "", "read", "write", "read,write" }; /** @@ -109,7 +109,7 @@ public final class PropertyPermission extends BasicPermission else if ("write".equals(anAction)) this.actions |= WRITE; else - throw new IllegalArgumentException("illegal action "+anAction); + throw new IllegalArgumentException("illegal action " + anAction); } } @@ -127,7 +127,7 @@ public final class PropertyPermission extends BasicPermission { if (!(p instanceof PropertyPermission)) return false; - + // We have to check the actions. PropertyPermission pp = (PropertyPermission) p; if ((pp.actions & ~actions) != 0) @@ -151,10 +151,24 @@ public final class PropertyPermission extends BasicPermission } /** + * Check to see whether this object is the same as another + * PropertyPermission object. + * + * @param obj The other object + */ + public boolean equals (Object obj) + { + if (! (obj instanceof PropertyPermission)) + return false; + PropertyPermission p = (PropertyPermission) obj; + return actions == p.actions && super.equals (p); + } + + /** * Reads an object from the stream. This converts the external to the * internal representation. */ - private void readObject(ObjectInputStream s) + private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { ObjectInputStream.GetField fields = s.readFields(); @@ -165,8 +179,7 @@ public final class PropertyPermission extends BasicPermission * Writes an object to the stream. This converts the internal to the * external representation. */ - private void writeObject(ObjectOutputStream s) - throws IOException + private void writeObject(ObjectOutputStream s) throws IOException { ObjectOutputStream.PutField fields = s.putFields(); fields.put("actions", getActions()); @@ -178,61 +191,61 @@ public final class PropertyPermission extends BasicPermission * PropertyPermission objects. * @return a new empty PermissionCollection. */ - public PermissionCollection newPermissionCollection() + public PermissionCollection newPermissionCollection() { - return new PermissionCollection() + return new PermissionCollection() + { + Hashtable permissions = new Hashtable(); + int allActions = 0; + + public void add(Permission permission) { - Hashtable permissions = new Hashtable(); - int allActions = 0; - - public void add(Permission permission) - { - if (isReadOnly()) - throw new IllegalStateException("readonly"); - - // also check that permission is of correct type. - PropertyPermission pp = (PropertyPermission) permission; - String name = pp.getName(); - if (name.equals("*")) - allActions |= pp.actions; - permissions.put(name, pp); - } - - public boolean implies(Permission permission) - { - if (!(permission instanceof PropertyPermission)) - return false; + if (isReadOnly()) + throw new IllegalStateException("readonly"); + + // also check that permission is of correct type. + PropertyPermission pp = (PropertyPermission) permission; + String name = pp.getName(); + if (name.equals("*")) + allActions |= pp.actions; + permissions.put(name, pp); + } - PropertyPermission toImply = (PropertyPermission) permission; - if ((toImply.actions & ~allActions) == 0) - return true; + public boolean implies(Permission permission) + { + if (!(permission instanceof PropertyPermission)) + return false; - String name = toImply.getName(); - if (name.equals("*")) - return false; + PropertyPermission toImply = (PropertyPermission) permission; + if ((toImply.actions & ~allActions) == 0) + return true; - int prefixLength = name.length(); - if (name.endsWith("*")) - prefixLength -= 2; - - while (true) { - PropertyPermission forName = - (PropertyPermission) permissions.get(name); - if (forName != null - && (toImply.actions & ~forName.actions) == 0) - return true; - - prefixLength = name.lastIndexOf('.', prefixLength); - if (prefixLength < 0) - return false; - name = name.substring(0, prefixLength + 1) + '*'; - } - } - - public Enumeration elements() + String name = toImply.getName(); + if (name.equals("*")) + return false; + + int prefixLength = name.length(); + if (name.endsWith("*")) + prefixLength -= 2; + + while (true) { - return permissions.elements(); + PropertyPermission forName = + (PropertyPermission) permissions.get(name); + if (forName != null && (toImply.actions & ~forName.actions) == 0) + return true; + + prefixLength = name.lastIndexOf('.', prefixLength); + if (prefixLength < 0) + return false; + name = name.substring(0, prefixLength + 1) + '*'; } - }; + } + + public Enumeration elements() + { + return permissions.elements(); + } + }; } } |