public class TestEventMgr
extends java.lang.Object
TestEventListener
Modifier and Type | Class and Description |
---|---|
static class |
TestEventMgr.TestListener
This class keeps the test event listener object and its filter list
|
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.CopyOnWriteArrayList<TestEventMgr.TestListener> |
listeners |
Constructor and Description |
---|
TestEventMgr()
Default constructor
|
TestEventMgr(java.lang.String owner)
This constructor allows the caller to identify who created the object; this is only a debugging aid
and does not otherwise impact the behavior.
|
Modifier and Type | Method and Description |
---|---|
static int[] |
addFilter(int[] efilter,
int eventId)
add an event id to an existing filter. if it's already there, leave it alone
|
void |
addListener(TestEventListener cl,
int[] filter)
This method adds a listener to the collection of listeners.
|
void |
addListener(TestEventListener cl,
int[] filter,
boolean quietToo)
This method adds a listener to the collection of listeners.
|
static java.util.List<java.lang.String> |
filterToStringList(int[] events) |
int |
getListenersCount() |
java.lang.String |
getOwner()
This identifies the creator of this event queue.
|
boolean |
isEventFiltered(int evId)
Method to test a certain event ID and figure out if it's filtered
|
static boolean |
isEventFiltered(int eventId,
int[] filter)
Method to test a certain event and figure out if it's filtered
|
static boolean |
isEventFiltered(TestEvent ev,
int[] filter)
Method to test a certain event and figure out if it's filtered
|
protected static boolean |
isInArray(int id,
int[] ar) |
static int[] |
mergeFilterInfoExisting(int[] efilter,
int[] nfilter)
Use this method when you are trying to merge a new filter (as nfilter) into an existing filter (efilter).
|
void |
pushEvent(TestEvent ev)
Method called by the event source to publish an event to all its listeners
|
void |
pushEvent(TestEvent ev,
boolean quiet) |
void |
removeListener(TestEventListener cl)
Takes a listener out of the collection
|
void |
updateListenerFilter(TestEventListener cl,
int[] nfilter)
Takes a listener out of the collection
|
protected final java.util.concurrent.CopyOnWriteArrayList<TestEventMgr.TestListener> listeners
public TestEventMgr()
public TestEventMgr(java.lang.String owner)
owner
- public java.lang.String getOwner()
public void addListener(TestEventListener cl, int[] filter)
cl
- - object that supports the interface to get eventsfilter
- - the array of Event IDs that you DON'T WANT sent to you
quite useful to reduce chatter on the linecontains all the Event IDs so you know
what you do/don't want to filter.
public void addListener(TestEventListener cl, int[] filter, boolean quietToo)
cl
- - object that supports the interface to get eventsfilter
- - the array of Event IDs that you DON'T WANT sent to you
quite useful to reduce chatter on the linequietToo
- - do you want even events considered quiet (suppressed by the test author)
Note that if you want to make sure you get all the events that could possibly
be sent, send TestEvent.noFilter as the filter. If you want to get most,
but not the painfully bandwidth-hungary ones, send null or TestEvent.defaultFilter.
contains all the Event IDs so you know
what you do/don't want to filter.
public int getListenersCount()
public void removeListener(TestEventListener cl)
cl
- - the listener to removepublic void updateListenerFilter(TestEventListener cl, int[] nfilter)
cl
- - the listener to removenfilter
- - the new filterpublic void pushEvent(TestEvent ev)
ev
- the event to pushpublic void pushEvent(TestEvent ev, boolean quiet)
public static boolean isEventFiltered(int eventId, int[] filter)
filter
- - the filter we'll compare the event againstpublic static boolean isEventFiltered(TestEvent ev, int[] filter)
ev
- - the event we want to know is filteredfilter
- - the filter we'll compare the event againstpublic boolean isEventFiltered(int evId)
evId
- - the event ID we want to know is filteredpublic static int[] mergeFilterInfoExisting(int[] efilter, int[] nfilter)
efilter
- - the existing filter to updatenfilter
- - new filter to applypublic static java.util.List<java.lang.String> filterToStringList(int[] events)
public static int[] addFilter(int[] efilter, int eventId)
efilter
- existing filter to updateeventId
- new event to filter outprotected static boolean isInArray(int id, int[] ar)
Copyright © 1998-2014 CA, Inc. All Rights Reserved.