home *** CD-ROM | disk | FTP | other *** search
- package netscape.security;
-
- import netscape.util.ClassInfo;
- import netscape.util.Codable;
- import netscape.util.CodingException;
- import netscape.util.Decoder;
- import netscape.util.Encoder;
- import netscape.util.Enumeration;
- import netscape.util.Hashtable;
-
- public class PrivilegeTable implements Cloneable, Codable {
- static final int VERSION = 1;
- private Hashtable itsTable = null;
- private static Hashtable theEmptyTable = new Hashtable();
- private boolean itsInited = false;
-
- public int size() {
- return this.itsTable != null ? this.itsTable.size() : 0;
- }
-
- public boolean isEmpty() {
- return this.itsTable == null ? true : this.itsTable.isEmpty();
- }
-
- public Enumeration keys() {
- return this.itsTable == null ? theEmptyTable.keys() : this.itsTable.keys();
- }
-
- public Enumeration elements() {
- return this.itsTable == null ? theEmptyTable.elements() : this.itsTable.elements();
- }
-
- public String toString() {
- StringBuffer var1 = new StringBuffer();
- if (this.itsTable == null) {
- return "Empty Table";
- } else {
- Hashtable var2 = this.itsTable;
- synchronized(var2){}
-
- try {
- Enumeration var4 = this.keys();
-
- while(var4.hasMoreElements()) {
- Object var5 = var4.nextElement();
- var1.append(var5.toString());
- var1.append(" ");
- var1.append(this.get(var5).toString());
- var1.append("\n");
- }
- } catch (Throwable var7) {
- throw var7;
- }
-
- return var1.toString();
- }
- }
-
- public Privilege get(Object var1) {
- if (this.itsTable == null) {
- return Privilege.findPrivilege(2, 1);
- } else {
- Privilege var2 = (Privilege)this.itsTable.get(var1);
- return var2 == null ? Privilege.findPrivilege(2, 1) : var2;
- }
- }
-
- public Privilege get(Target var1) {
- return this.get((Object)var1);
- }
-
- public synchronized Privilege put(Object var1, Privilege var2) {
- if (this.itsTable == null) {
- this.itsTable = new Hashtable();
- }
-
- return (Privilege)this.itsTable.put(var1, var2);
- }
-
- public synchronized Privilege put(Target var1, Privilege var2) {
- return this.put((Object)var1, var2);
- }
-
- public synchronized Privilege remove(Object var1) {
- return this.itsTable == null ? (Privilege)theEmptyTable.remove(var1) : (Privilege)this.itsTable.remove(var1);
- }
-
- public synchronized Privilege remove(Target var1) {
- return this.itsTable == null ? (Privilege)theEmptyTable.remove(var1) : (Privilege)this.itsTable.remove(var1);
- }
-
- public synchronized void clear() {
- if (this.itsTable != null) {
- this.itsTable.clear();
- }
-
- }
-
- public Object clone() {
- PrivilegeTable var1 = new PrivilegeTable();
- if (this.itsTable == null) {
- var1.itsTable = null;
- } else {
- var1.itsTable = (Hashtable)this.itsTable.clone();
- }
-
- return var1;
- }
-
- public void describeClassInfo(ClassInfo var1) {
- var1.addClass("PrivilegeTable", 1);
- var1.addField("Table", (byte)18);
- }
-
- public void encode(Encoder var1) throws CodingException {
- var1.encodeObject("Table", this.itsTable);
- }
-
- public void decode(Decoder var1) throws CodingException {
- if (!this.itsInited) {
- this.itsInited = true;
- this.itsTable = (Hashtable)var1.decodeObject("Table");
- }
- }
-
- public void finishDecoding() throws CodingException {
- }
- }
-