Subversion Repository Public Repository

litesoft

Diff Revisions 949 vs 950 for /trunk/Java/GWT/OldClient/src/org/litesoft/GWT/eventbus/client/nonpublic/PeerInterestManager.java

Diff revisions: vs.
  @@ -1,42 +1,42 @@
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.*;
5 - import org.litesoft.GWT.eventbus.client.rpc.*;
6 -
7 - import java.util.*;
8 -
9 - public class PeerInterestManager {
10 - private Set mPeerInterests = new HashSet();
11 - private String mEBform;
12 -
13 - public PeerInterestManager( String pEBform ) {
14 - mEBform = pEBform;
15 - }
16 -
17 - public synchronized boolean isPeerInterested( EventPackage pPackage ) {
18 - return (pPackage instanceof AlwaysSendToPeer) || //
19 - ((pPackage instanceof ChannelEventPackage) &&
20 - mPeerInterests.contains( pPackage.getTargetName() ));
21 - }
22 -
23 - public synchronized void add( Set pPeerInterests ) {
24 - if ( !pPeerInterests.isEmpty() ) {
25 - mPeerInterests.addAll( pPeerInterests );
26 - }
27 - }
28 -
29 - public synchronized void remove( Set pPeerInterests ) {
30 - if ( !pPeerInterests.isEmpty() ) {
31 - mPeerInterests.removeAll( pPeerInterests );
32 - }
33 - }
34 -
35 - public synchronized void clear() {
36 - mPeerInterests.clear();
37 - }
38 -
39 - public String toString() {
40 - return mEBform;
41 - }
42 - }
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.*;
5 + import org.litesoft.GWT.eventbus.client.rpc.*;
6 +
7 + import java.util.*;
8 +
9 + public class PeerInterestManager {
10 + private Set mPeerInterests = new HashSet();
11 + private String mEBform;
12 +
13 + public PeerInterestManager( String pEBform ) {
14 + mEBform = pEBform;
15 + }
16 +
17 + public synchronized boolean isPeerInterested( EventPackage pPackage ) {
18 + return (pPackage instanceof AlwaysSendToPeer) || //
19 + ((pPackage instanceof ChannelEventPackage) &&
20 + mPeerInterests.contains( pPackage.getTargetName() ));
21 + }
22 +
23 + public synchronized void add( Set pPeerInterests ) {
24 + if ( !pPeerInterests.isEmpty() ) {
25 + mPeerInterests.addAll( pPeerInterests );
26 + }
27 + }
28 +
29 + public synchronized void remove( Set pPeerInterests ) {
30 + if ( !pPeerInterests.isEmpty() ) {
31 + mPeerInterests.removeAll( pPeerInterests );
32 + }
33 + }
34 +
35 + public synchronized void clear() {
36 + mPeerInterests.clear();
37 + }
38 +
39 + public String toString() {
40 + return mEBform;
41 + }
42 + }