1 23 24 28 29 34 35 package com.sun.enterprise.admin.util; 36 37 import java.util.Iterator ; 38 import java.util.Set ; 39 import java.util.HashSet ; 40 import com.sun.enterprise.admin.util.TokenValue; 41 42 46 47 public class TokenValueSet implements Cloneable { 48 49 50 private final Set values; 51 52 public TokenValueSet() { 53 values = new HashSet (); 54 } 55 56 public TokenValueSet(Set values) { 57 this.values = new HashSet (); 61 this.values.addAll(values); 62 } 63 64 public void add(TokenValue tokenValue) { 65 boolean added = this.values.add(tokenValue); 66 } 67 68 public void remove(TokenValue tokenValue) { 69 this.values.remove(tokenValue); 70 } 71 72 public void clear() { 73 this.values.clear(); 74 } 75 76 public Iterator iterator() { 77 return ( this.values.iterator() ); 78 } 79 80 public boolean isEmpty() { 81 return ( this.values.isEmpty() ); 82 } 83 84 public Object [] toArray() { 85 return ( this.values.toArray() ); 86 } 87 88 public int size() { 89 return ( this.values.size() ); 90 } 91 92 public Object clone() throws CloneNotSupportedException { 93 return ( super.clone() ); 94 } 95 96 public String toString() { 97 StringBuffer buf = new StringBuffer (); 98 Iterator iter = this.iterator(); 99 while(iter.hasNext()) { 100 TokenValue tv = (TokenValue) iter.next(); 101 buf.append(tv.toString()); 102 buf.append(System.getProperty("line.separator")); 103 } 104 return ( buf.toString() ); 105 } 106 } 107 | Popular Tags |