com.sas.util
Interface ApplyInterface
- All Known Implementing Classes:
- CompositeCommand, PrintContents, CompositeDynamicAttributeCommand, ChangeEnabledStateCommand, ChangeCursorCommand
- public interface ApplyInterface
An interface which allows the caller to
perform some action on an object.
ApplyInterface is normally used to apply some action to
all elements of a collection; see
StaticCollectionInterface.apply(com.sas.util.ApplyInterface).
For example, to print the contents of a collection, create an instance of
a PrintContents and apply it to a collection:
StaticCollectionInterface c = ...some collection...;
PrintContents printer = new PrintContents();
c.apply(printer);
ApplyInterface can be used to alter all items in a collection, or to
search collections for items matching specific conditions, etc.
Ths operation can be done without knowledge of how to access
individual items in the collection, or without having to obtain
an Enumeration, which requires extra
object allocations.
|
Field Summary |
static short |
ABORT
A return code from the apply(java.lang.Object) method
which indicates that the action should not continue for other objects.
|
static short |
CONTINUE
A return code from the apply(java.lang.Object) method
which indicates that the action should continue for other objects. |
|
Method Summary |
int |
apply(Object o)
Does something with/to an object |
CONTINUE
public static final short CONTINUE
- A return code from the
apply(java.lang.Object) method
which indicates that the action should continue for other objects.
ABORT
public static final short ABORT
- A return code from the
apply(java.lang.Object) method
which indicates that the action should not continue for other objects.
For example, if you implement an object to search a collection for
an item that matches some criteria, when the item is found, your
apply method can return ABORT
to indicate that the collection can abort the searh and not
apply your search object to the remaining items in the collection.
apply
public int apply(Object o)
- Does something with/to an object
- Parameters:
object - The object which should be used- Returns:
- one of
ABORT or CONTINUE.
The apply() method should
return ABORT if it
wishes to abort or short circuit an
iteration/application of the ApplyInterface to items
in a collection. Normally, this method would return CONTINUE
to indicate normal continuation of the iteration.
Copyright © 2005 SAS Institute Inc. All Rights Reserved.
javadoc generated Thu, 16 Feb 2006 02:30:11