1 |
/* Permissions.java -- a collection of permission collections |
/* Permissions.java -- a collection of permission collections |
2 |
Copyright (C) 1998, 2001, 2002, 2004 Free Software Foundation, Inc. |
Copyright (C) 1998, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
53 |
* collection type which stores its permissions in a hash table will be |
* collection type which stores its permissions in a hash table will be |
54 |
* used. |
* used. |
55 |
* |
* |
56 |
* @author Aaron M. Renn <arenn@urbanophile.com> |
* @author Aaron M. Renn (arenn@urbanophile.com) |
57 |
* @author Eric Blake <ebb9@email.byu.edu> |
* @author Eric Blake (ebb9@email.byu.edu) |
58 |
* @since 1.1 |
* @since 1.1 |
59 |
*/ |
*/ |
60 |
public final class Permissions extends PermissionCollection |
public final class Permissions extends PermissionCollection |
193 |
* Implements the permission collection for all permissions without one of |
* Implements the permission collection for all permissions without one of |
194 |
* their own, and obeys serialization of JDK. |
* their own, and obeys serialization of JDK. |
195 |
* |
* |
196 |
* @author Eric Blake <ebb9@email.byu.edu> |
* @author Eric Blake (ebb9@email.byu.edu) |
197 |
*/ |
*/ |
198 |
private static final class PermissionsHash extends PermissionCollection |
private static final class PermissionsHash extends PermissionCollection |
199 |
{ |
{ |
227 |
* @param perm the permission to check |
* @param perm the permission to check |
228 |
* @return true if it is implied |
* @return true if it is implied |
229 |
*/ |
*/ |
230 |
|
// FIXME: Should this method be synchronized? |
231 |
public boolean implies(Permission perm) |
public boolean implies(Permission perm) |
232 |
{ |
{ |
233 |
return perms.get(perm) != null; |
Enumeration elements = elements(); |
234 |
|
|
235 |
|
while (elements.hasMoreElements()) |
236 |
|
{ |
237 |
|
Permission p = (Permission)elements.nextElement(); |
238 |
|
if (p.implies(perm)) |
239 |
|
return true; |
240 |
|
} |
241 |
|
return false; |
242 |
} |
} |
243 |
|
|
244 |
/** |
/** |