|
@@ -1,107 +1,107 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.eventbus.client.nonpublic; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.eventbus.client.rpc.*; |
5 |
|
- |
|
6 |
|
- |
import java.io.*; |
7 |
|
- |
|
8 |
|
- |
public class ChannelServicePackage implements Serializable { |
9 |
|
- |
private String[] mAddPeerInterests; |
10 |
|
- |
private String[] mRemovePeerInterests; |
11 |
|
- |
private ChannelEventPackage[] mEvents; |
12 |
|
- |
private String[] mAckPeerInterests; |
13 |
|
- |
|
14 |
|
- |
/** |
15 |
|
- |
* @deprecated GWT ONLY |
16 |
|
- |
*/ |
17 |
|
- |
public ChannelServicePackage() { |
18 |
|
- |
} |
19 |
|
- |
|
20 |
|
- |
public ChannelServicePackage( String[] pAddPeerInterests, String[] pRemovePeerInterests, |
21 |
|
- |
ChannelEventPackage[] pEvents, String[] pAckPeerInterests ) { |
22 |
|
- |
mAddPeerInterests = pAddPeerInterests; |
23 |
|
- |
mRemovePeerInterests = pRemovePeerInterests; |
24 |
|
- |
mEvents = pEvents; |
25 |
|
- |
mAckPeerInterests = pAckPeerInterests; |
26 |
|
- |
} |
27 |
|
- |
|
28 |
|
- |
public boolean isEmpty() { |
29 |
|
- |
return !isNotEmpty(); |
30 |
|
- |
} |
31 |
|
- |
|
32 |
|
- |
public boolean isNotEmpty() { |
33 |
|
- |
return anyAddPeerInterests() || anyRemovePeerInterests() || anyEvents() || anyAckPeerInterests(); |
34 |
|
- |
} |
35 |
|
- |
|
36 |
|
- |
public boolean anyAddPeerInterests() { |
37 |
|
- |
return (mAddPeerInterests != null) && (mAddPeerInterests.length != 0); |
38 |
|
- |
} |
39 |
|
- |
|
40 |
|
- |
public String[] getAddPeerInterests() { |
41 |
|
- |
return mAddPeerInterests; |
42 |
|
- |
} |
43 |
|
- |
|
44 |
|
- |
public boolean anyRemovePeerInterests() { |
45 |
|
- |
return (mRemovePeerInterests != null) && (mRemovePeerInterests.length != 0); |
46 |
|
- |
} |
47 |
|
- |
|
48 |
|
- |
public String[] getRemovePeerInterests() { |
49 |
|
- |
return mRemovePeerInterests; |
50 |
|
- |
} |
51 |
|
- |
|
52 |
|
- |
public boolean anyEvents() { |
53 |
|
- |
return (mEvents != null) && (mEvents.length != 0); |
54 |
|
- |
} |
55 |
|
- |
|
56 |
|
- |
public ChannelEventPackage[] getEvents() { |
57 |
|
- |
return mEvents; |
58 |
|
- |
} |
59 |
|
- |
|
60 |
|
- |
public boolean anyAckPeerInterests() { |
61 |
|
- |
return (mAckPeerInterests != null) && (mAckPeerInterests.length != 0); |
62 |
|
- |
} |
63 |
|
- |
|
64 |
|
- |
public String[] getAckPeerInterests() { |
65 |
|
- |
return mAckPeerInterests; |
66 |
|
- |
} |
67 |
|
- |
|
68 |
|
- |
public String toString() { |
69 |
|
- |
return toString( new StringBuilder( "ChannelServicePackage" ) ).toString(); |
70 |
|
- |
} |
71 |
|
- |
|
72 |
|
- |
public StringBuilder toString( StringBuilder pSB ) { |
73 |
|
- |
boolean any = false; |
74 |
|
- |
if ( anyAddPeerInterests() ) { |
75 |
|
- |
any = true; |
76 |
|
- |
pSB.append( "\n AddPeerInterests:" ); |
77 |
|
- |
for ( int i = 0; i < mAddPeerInterests.length; i++ ) { |
78 |
|
- |
pSB.append( "\n " ).append( mAddPeerInterests[i] ); |
79 |
|
- |
} |
80 |
|
- |
} |
81 |
|
- |
if ( anyRemovePeerInterests() ) { |
82 |
|
- |
any = true; |
83 |
|
- |
pSB.append( "\n RemovePeerInterests:" ); |
84 |
|
- |
for ( int i = 0; i < mRemovePeerInterests.length; i++ ) { |
85 |
|
- |
pSB.append( "\n " ).append( mRemovePeerInterests[i] ); |
86 |
|
- |
} |
87 |
|
- |
} |
88 |
|
- |
if ( anyEvents() ) { |
89 |
|
- |
any = true; |
90 |
|
- |
pSB.append( "\n Events:" ); |
91 |
|
- |
for ( int i = 0; i < mEvents.length; i++ ) { |
92 |
|
- |
pSB.append( "\n " ).append( mEvents[i] ); |
93 |
|
- |
} |
94 |
|
- |
} |
95 |
|
- |
if ( anyAckPeerInterests() ) { |
96 |
|
- |
any = true; |
97 |
|
- |
pSB.append( "\n AckPeerInterests:" ); |
98 |
|
- |
for ( int i = 0; i < mAckPeerInterests.length; i++ ) { |
99 |
|
- |
pSB.append( "\n " ).append( mAckPeerInterests[i] ); |
100 |
|
- |
} |
101 |
|
- |
} |
102 |
|
- |
if ( !any ) { |
103 |
|
- |
pSB.append( " Empty!" ); |
104 |
|
- |
} |
105 |
|
- |
return pSB; |
106 |
|
- |
} |
107 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.eventbus.client.nonpublic; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.eventbus.client.rpc.*; |
|
5 |
+ |
|
|
6 |
+ |
import java.io.*; |
|
7 |
+ |
|
|
8 |
+ |
public class ChannelServicePackage implements Serializable { |
|
9 |
+ |
private String[] mAddPeerInterests; |
|
10 |
+ |
private String[] mRemovePeerInterests; |
|
11 |
+ |
private ChannelEventPackage[] mEvents; |
|
12 |
+ |
private String[] mAckPeerInterests; |
|
13 |
+ |
|
|
14 |
+ |
/** |
|
15 |
+ |
* @deprecated GWT ONLY |
|
16 |
+ |
*/ |
|
17 |
+ |
public ChannelServicePackage() { |
|
18 |
+ |
} |
|
19 |
+ |
|
|
20 |
+ |
public ChannelServicePackage( String[] pAddPeerInterests, String[] pRemovePeerInterests, |
|
21 |
+ |
ChannelEventPackage[] pEvents, String[] pAckPeerInterests ) { |
|
22 |
+ |
mAddPeerInterests = pAddPeerInterests; |
|
23 |
+ |
mRemovePeerInterests = pRemovePeerInterests; |
|
24 |
+ |
mEvents = pEvents; |
|
25 |
+ |
mAckPeerInterests = pAckPeerInterests; |
|
26 |
+ |
} |
|
27 |
+ |
|
|
28 |
+ |
public boolean isEmpty() { |
|
29 |
+ |
return !isNotEmpty(); |
|
30 |
+ |
} |
|
31 |
+ |
|
|
32 |
+ |
public boolean isNotEmpty() { |
|
33 |
+ |
return anyAddPeerInterests() || anyRemovePeerInterests() || anyEvents() || anyAckPeerInterests(); |
|
34 |
+ |
} |
|
35 |
+ |
|
|
36 |
+ |
public boolean anyAddPeerInterests() { |
|
37 |
+ |
return (mAddPeerInterests != null) && (mAddPeerInterests.length != 0); |
|
38 |
+ |
} |
|
39 |
+ |
|
|
40 |
+ |
public String[] getAddPeerInterests() { |
|
41 |
+ |
return mAddPeerInterests; |
|
42 |
+ |
} |
|
43 |
+ |
|
|
44 |
+ |
public boolean anyRemovePeerInterests() { |
|
45 |
+ |
return (mRemovePeerInterests != null) && (mRemovePeerInterests.length != 0); |
|
46 |
+ |
} |
|
47 |
+ |
|
|
48 |
+ |
public String[] getRemovePeerInterests() { |
|
49 |
+ |
return mRemovePeerInterests; |
|
50 |
+ |
} |
|
51 |
+ |
|
|
52 |
+ |
public boolean anyEvents() { |
|
53 |
+ |
return (mEvents != null) && (mEvents.length != 0); |
|
54 |
+ |
} |
|
55 |
+ |
|
|
56 |
+ |
public ChannelEventPackage[] getEvents() { |
|
57 |
+ |
return mEvents; |
|
58 |
+ |
} |
|
59 |
+ |
|
|
60 |
+ |
public boolean anyAckPeerInterests() { |
|
61 |
+ |
return (mAckPeerInterests != null) && (mAckPeerInterests.length != 0); |
|
62 |
+ |
} |
|
63 |
+ |
|
|
64 |
+ |
public String[] getAckPeerInterests() { |
|
65 |
+ |
return mAckPeerInterests; |
|
66 |
+ |
} |
|
67 |
+ |
|
|
68 |
+ |
public String toString() { |
|
69 |
+ |
return toString( new StringBuilder( "ChannelServicePackage" ) ).toString(); |
|
70 |
+ |
} |
|
71 |
+ |
|
|
72 |
+ |
public StringBuilder toString( StringBuilder pSB ) { |
|
73 |
+ |
boolean any = false; |
|
74 |
+ |
if ( anyAddPeerInterests() ) { |
|
75 |
+ |
any = true; |
|
76 |
+ |
pSB.append( "\n AddPeerInterests:" ); |
|
77 |
+ |
for ( int i = 0; i < mAddPeerInterests.length; i++ ) { |
|
78 |
+ |
pSB.append( "\n " ).append( mAddPeerInterests[i] ); |
|
79 |
+ |
} |
|
80 |
+ |
} |
|
81 |
+ |
if ( anyRemovePeerInterests() ) { |
|
82 |
+ |
any = true; |
|
83 |
+ |
pSB.append( "\n RemovePeerInterests:" ); |
|
84 |
+ |
for ( int i = 0; i < mRemovePeerInterests.length; i++ ) { |
|
85 |
+ |
pSB.append( "\n " ).append( mRemovePeerInterests[i] ); |
|
86 |
+ |
} |
|
87 |
+ |
} |
|
88 |
+ |
if ( anyEvents() ) { |
|
89 |
+ |
any = true; |
|
90 |
+ |
pSB.append( "\n Events:" ); |
|
91 |
+ |
for ( int i = 0; i < mEvents.length; i++ ) { |
|
92 |
+ |
pSB.append( "\n " ).append( mEvents[i] ); |
|
93 |
+ |
} |
|
94 |
+ |
} |
|
95 |
+ |
if ( anyAckPeerInterests() ) { |
|
96 |
+ |
any = true; |
|
97 |
+ |
pSB.append( "\n AckPeerInterests:" ); |
|
98 |
+ |
for ( int i = 0; i < mAckPeerInterests.length; i++ ) { |
|
99 |
+ |
pSB.append( "\n " ).append( mAckPeerInterests[i] ); |
|
100 |
+ |
} |
|
101 |
+ |
} |
|
102 |
+ |
if ( !any ) { |
|
103 |
+ |
pSB.append( " Empty!" ); |
|
104 |
+ |
} |
|
105 |
+ |
return pSB; |
|
106 |
+ |
} |
|
107 |
+ |
} |