|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
com.sas.collection.BaseCollection
public abstract class BaseCollection
Abstract base class for collections. This class provides some default implementation for some of the collections.
| Field Summary | |
|---|---|
protected com.sas.collection.ContentsChangedListenerList |
allContentsChangedListeners
allContentsChangedListeners is a list of listeners for the ContentsChangedEvent event. |
protected static java.lang.Object |
mappingObject
A replacement for null for internally used JDK collections (Hashtable)
which do not handle null. |
| Constructor Summary | |
|---|---|
BaseCollection()
|
|
| Method Summary | |
|---|---|
void |
addContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
Add a listener for the com.sas.collection.ContentsChangedEvent event. |
protected boolean |
anyContentsChangedListeners()
Test is there are any registered event listeners for a ContentsChangedEvent, or any registered listeners for a PropertyChangeEvent. |
void |
apply(com.sas.util.ApplyInterface action)
Applies an action to every item in the collection. |
java.lang.Object |
clone()
Clone the object. |
boolean |
contains(java.lang.Object element)
Test for the presence of an object in this collection. |
abstract int |
count()
Returns the number of items in this collection |
void |
disableEvents()
Ask this collection to suppress delivery of ContentsChangeEvents on subsequent changes to this collection. |
void |
enableEvents()
Undo a call. |
void |
enableEvents(com.sas.collection.ContentsChangedEvent event)
Undo a
call. |
protected void |
fireContentsChanged(com.sas.collection.ContentsChangedEvent event)
Send a ContentsChangedEvent event to all the ContentsChangedListener objects in the listener list. |
abstract java.util.Enumeration |
getItems()
Return an enumeration of all the elements in this collection |
protected static java.lang.Object |
map(java.lang.Object o)
Substitute the mappingObject for null object references. |
void |
removeContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
Remove a listener for the com.sas.collection.ContentsChangedEvent event. |
protected static java.lang.Object |
unmap(java.lang.Object o)
The inverse of the map(Object) call. |
| Methods inherited from interface com.sas.beans.PropertyChangeSource |
|---|
addPropertyChangeListener, removePropertyChangeListener |
| Field Detail |
|---|
protected static final java.lang.Object mappingObject
null for internally used JDK collections (Hashtable)
which do not handle null.
map(Object),
unmap(Object)protected transient com.sas.collection.ContentsChangedListenerList allContentsChangedListeners
ContentsChangedEvent event.
addContentsChangedListener(com.sas.collection.ContentsChangedListener),
removeContentsChangedListener(com.sas.collection.ContentsChangedListener),
anyContentsChangedListeners()| Constructor Detail |
|---|
public BaseCollection()
| Method Detail |
|---|
public abstract int count()
count in interface com.sas.util.Countablepublic abstract java.util.Enumeration getItems()
getItems in interface com.sas.util.EnumerablehasMoreElements()
returns false.Enumerable.getItems()public boolean contains(java.lang.Object element)
contains in interface StaticCollectionInterfaceelement - The item to search for
java.lang.ClassCastException - In some implementations,
the objects that are stored may be restricted to a particular
type (such as String).StaticCollectionInterface.contains(java.lang.Object)
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface StaticCollectionInterfaceclone in interface com.sas.PublicClonableclone in class Componentjava.lang.CloneNotSupportedException - if the clone fails.public void apply(com.sas.util.ApplyInterface action)
Subclasses may have a more efficient implementation.
apply in interface StaticCollectionInterfaceaction - An object performs some action on another object.
action.apply(item) is excecuted on successive items
in this collection until all items have been operated on, or until the method
returns ApplyInterface.ABORTprotected static java.lang.Object map(java.lang.Object o)
mappingObject for null object references.
Implementation classes which use other objects that do
not handle null references should use map(Object)
to change null references to a fixed non-null reference
(BaseCollection.mappingObject) before storing items
in the underlying object. For example, Dictionary uses a Hashtable which does
not allow null keys, so Dictionary runs all keys through map(key).
The mapped value can then be translated
back to null via the unmap(Object) method.
o - an object.
o == null, else ounmap(java.lang.Object),
mappingObjectprotected static java.lang.Object unmap(java.lang.Object o)
map(Object) call.
o - an object in a collection (possibly the mappingObject )
mappingObject, else the object omappingObject,
map(Object)public void addContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
addContentsChangedListener in interface com.sas.collection.ContentsChangedSourcelistener - an object which handles ContentsChangedEvent events.
The listener is not added a second time if it already exists
in the list of listeners for this event. If listener is null,
it is ignored.ContentsChangedSourcepublic void removeContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
removeContentsChangedListener in interface com.sas.collection.ContentsChangedSourcelistener - an object which handles ContentsChangedEvent eventsContentsChangedSourceprotected void fireContentsChanged(com.sas.collection.ContentsChangedEvent event)
adds or removes
are performed after the this method has started.
Also sends the event, which extends PropertyChangeEvent,
to all registered property change listeners.
event - the event to sendprotected boolean anyContentsChangedListeners()
disableEvents(),
enableEvents()public void disableEvents()
This call should always appear in a try { } block, with the matching enableEvents()
method in the finally { } block.
disableEvents in interface com.sas.util.EventGateInterfaceenableEvents(),
anyContentsChangedListeners()public void enableEvents()
disableEvents() call. This may or may not cause the
collection to start sending events again. If
there are no other pending suppress/allow gates on this
collection, this collection will send a single ContentsChangedEvent
and then subsequent changes to this collection will also
fire ContentsChangedEvents.
This call should always appear in a finally { } block;
the disableEvents() calls should be in the try { } block.
enableEvents in interface com.sas.util.EventGateInterfacedisableEvents(),
anyContentsChangedListeners()public void enableEvents(com.sas.collection.ContentsChangedEvent event)
disableEvents()
call. This may or may not cause the
collection to start sending events again. If
there are no other pending suppress/allow gates on this
collection, this collection will send the specified event
(unless it is null)
and then subsequent changes to this collection will also
fire ContentsChangedEvents.
This call should always appear in a finally block; the disableEvents calls should be in the try block.
event - an event to fire to the listeners
if there are other no pending enableEvents methods.
If null, do not fire any event. This is useful if
a concrete class wishes to fire a more specific
event.
|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||