/** Adds all elements of the NamedIterator to this. */ public void add(NamedIterator it) { it.reset(); synchronized (this) { while (it.hasMore()) { data.addElement(it.next()); } } }
/** * 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(); }
/** Special constructor called from Class. */ NamedIterator(Vector v, Object type, int modifierMask) { // Using type 'Object' instead of 'java.lang.Class' for parameter type // is a workaround to avoid having to generate fully qualified class names // when applying BeatyJ to this code. (Otherwise, would confuse with class // 'Class' in this package.) this(); for (Enumeration e = v.elements(); e.hasMoreElements(); ) { Member m = (Member) e.nextElement(); int mod = m.getModifier(); if (((modifierMask & mod) != 0) && (m.getClass().isAssignableFrom((java.lang.Class) type))) { data.addElement(m); } } reset(); lockReadonly(); // read-only in this mode }
/** Creates a new instance of NamedIterator. */ public NamedIterator() { data = new Vector(); hash = new Hashtable(); reset(); }