|
@@ -3,16 +3,14 @@ |
3 |
3 |
|
|
4 |
4 |
|
import java.util.*; |
5 |
5 |
|
|
6 |
|
- |
public class EventSubscriptionCollector |
7 |
|
- |
{ |
|
6 |
+ |
public class EventSubscriptionCollector { |
8 |
7 |
|
/** |
9 |
8 |
|
* Add a handler to be triggered for the events of the given name. |
10 |
9 |
|
* |
11 |
10 |
|
* @param pEventName - nonNull |
12 |
11 |
|
* @param pListener - nonNull |
13 |
12 |
|
*/ |
14 |
|
- |
public final EventSubscriptionCollector subscribe( String pEventName, EventPackageListener pListener ) |
15 |
|
- |
{ |
|
13 |
+ |
public final EventSubscriptionCollector subscribe( String pEventName, EventPackageListener pListener ) { |
16 |
14 |
|
LLsubscribe( new EventSimpleSubscriptionStructure( pEventName, pListener ) ); |
17 |
15 |
|
return this; |
18 |
16 |
|
} |
|
@@ -22,10 +20,8 @@ |
22 |
20 |
|
* |
23 |
21 |
|
* @param pSubscriber - null ignored |
24 |
22 |
|
*/ |
25 |
|
- |
public final EventSubscriptionCollector subscribe( EventPackageSubscriber pSubscriber ) |
26 |
|
- |
{ |
27 |
|
- |
if ( pSubscriber != null ) |
28 |
|
- |
{ |
|
23 |
+ |
public final EventSubscriptionCollector subscribe( EventPackageSubscriber pSubscriber ) { |
|
24 |
+ |
if ( pSubscriber != null ) { |
29 |
25 |
|
LLsubscribe( new EventSubscriberStructure( pSubscriber ) ); |
30 |
26 |
|
} |
31 |
27 |
|
return this; |
|
@@ -36,10 +32,8 @@ |
36 |
32 |
|
* |
37 |
33 |
|
* @param pStructure - null ignored |
38 |
34 |
|
*/ |
39 |
|
- |
public final EventSubscriptionCollector subscribe( EventSubscriptionStructure pStructure ) |
40 |
|
- |
{ |
41 |
|
- |
if ( pStructure != null ) |
42 |
|
- |
{ |
|
35 |
+ |
public final EventSubscriptionCollector subscribe( EventSubscriptionStructure pStructure ) { |
|
36 |
+ |
if ( pStructure != null ) { |
43 |
37 |
|
LLsubscribe( pStructure ); |
44 |
38 |
|
} |
45 |
39 |
|
return this; |
|
@@ -51,12 +45,9 @@ |
51 |
45 |
|
* @param pStructures - null/ ignored |
52 |
46 |
|
*/ |
53 |
47 |
|
public final synchronized EventSubscriptionCollector subscribe( |
54 |
|
- |
EventSubscriptionStructure[] pStructures ) |
55 |
|
- |
{ |
56 |
|
- |
if ( pStructures != null ) |
57 |
|
- |
{ |
58 |
|
- |
for ( int i = 0; i < pStructures.length; i++ ) |
59 |
|
- |
{ |
|
48 |
+ |
EventSubscriptionStructure[] pStructures ) { |
|
49 |
+ |
if ( pStructures != null ) { |
|
50 |
+ |
for ( int i = 0; i < pStructures.length; i++ ) { |
60 |
51 |
|
subscribe( pStructures[i] ); |
61 |
52 |
|
} |
62 |
53 |
|
} |
|
@@ -66,15 +57,12 @@ |
66 |
57 |
|
/** |
67 |
58 |
|
* @return !null, and no nulls in array |
68 |
59 |
|
*/ |
69 |
|
- |
public final synchronized EventSubscriptionStructure[] getSubscriptions() |
70 |
|
- |
{ |
71 |
|
- |
if ( mSubscriptions.isEmpty() ) |
72 |
|
- |
{ |
|
60 |
+ |
public final synchronized EventSubscriptionStructure[] getSubscriptions() { |
|
61 |
+ |
if ( mSubscriptions.isEmpty() ) { |
73 |
62 |
|
return EventSubscriptionStructure.EMPTY_ARRAY; |
74 |
63 |
|
} |
75 |
64 |
|
EventSubscriptionStructure[] rv = new EventSubscriptionStructure[mSubscriptions.size()]; |
76 |
|
- |
for ( int i = 0; i < mSubscriptions.size(); i++ ) |
77 |
|
- |
{ |
|
65 |
+ |
for ( int i = 0; i < mSubscriptions.size(); i++ ) { |
78 |
66 |
|
rv[i] = mSubscriptions.get( i ); |
79 |
67 |
|
} |
80 |
68 |
|
return rv; |
|
@@ -82,8 +70,7 @@ |
82 |
70 |
|
|
83 |
71 |
|
private List<EventSubscriptionStructure> mSubscriptions = new ArrayList<EventSubscriptionStructure>(); |
84 |
72 |
|
|
85 |
|
- |
private synchronized void LLsubscribe( EventSubscriptionStructure pSubscription ) |
86 |
|
- |
{ |
|
73 |
+ |
private synchronized void LLsubscribe( EventSubscriptionStructure pSubscription ) { |
87 |
74 |
|
mSubscriptions.add( pSubscription ); |
88 |
75 |
|
} |
89 |
76 |
|
} |