1 |
/* Subject.java -- a single entity in the system. |
/* Subject.java -- a single entity in the system. |
2 |
Copyright (C) 2004 Free Software Foundation, Inc. |
Copyright (C) 2004, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
385 |
// Constructors. |
// Constructors. |
386 |
// ----------------------------------------------------------------------- |
// ----------------------------------------------------------------------- |
387 |
|
|
388 |
SecureSet (final Subject subject, final int type, final Collection elements) |
SecureSet (final Subject subject, final int type, final Collection inElements) |
389 |
{ |
{ |
390 |
this (subject, type); |
this (subject, type); |
391 |
for (Iterator it = elements.iterator(); it.hasNext(); ) |
for (Iterator it = inElements.iterator(); it.hasNext(); ) |
392 |
{ |
{ |
393 |
Object o = it.next(); |
Object o = it.next(); |
394 |
if (type == PRINCIPALS && !(o instanceof Principal)) |
if (type == PRINCIPALS && !(o instanceof Principal)) |
395 |
{ |
{ |
396 |
throw new IllegalArgumentException(o+" is not a Principal"); |
throw new IllegalArgumentException(o+" is not a Principal"); |
397 |
} |
} |
398 |
if (!elements.contains (o)) |
if (!this.elements.contains (o)) |
399 |
{ |
{ |
400 |
elements.add (o); |
this.elements.add (o); |
401 |
} |
} |
402 |
} |
} |
403 |
} |
} |
511 |
|
|
512 |
public synchronized boolean contains (final Object element) |
public synchronized boolean contains (final Object element) |
513 |
{ |
{ |
514 |
return elements.remove (element); |
return elements.contains (element); |
515 |
} |
} |
516 |
|
|
517 |
public boolean removeAll (final Collection c) |
public boolean removeAll (final Collection c) |