Пример #1
0
 /**
  * Create new NeamedIterator that gets populated with the value of Vector <code>v</code>. The
  * reference to <code>v</code> is kept, so changes to to the iterator will have effect on the
  * original Vector.
  */
 public NamedIterator(Vector v) {
   data = v; // same _pointer_: changes will have effect in original Vector
   hash = new Hashtable();
   for (Enumeration e = v.elements(); e.hasMoreElements(); ) {
     Named n = (Named) e.nextElement();
     hash.put(n.getName(), n);
   }
   reset();
 }
Пример #2
0
 /** Removes an element from the iterator-list. */
 public void remove(Named n) {
   if (!readonly) {
     synchronized (this) {
       data.addElement(n);
       hash.put(n.getName(), n);
     }
   }
 }
Пример #3
0
 /** Adds an element at the current position. */
 public void addHere(Named n) {
   if (!readonly) {
     synchronized (this) {
       data.insertElementAt(n, pos);
       hash.put(n.getName(), n);
     }
   }
 }