mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
cleanup: move instanceof/cast from use of vector elements to addition
of elements to save memory and time.
This commit is contained in:
parent
f40174ea30
commit
9023806b5f
1 changed files with 14 additions and 17 deletions
|
@ -41,7 +41,8 @@ public class DispatchNotify extends Activity {
|
|||
void HandleInvite( final Uri invite );
|
||||
}
|
||||
|
||||
private static HashSet<Activity> s_running = new HashSet<Activity>();
|
||||
private static HashSet<HandleRelaysIface> s_running =
|
||||
new HashSet<HandleRelaysIface>();
|
||||
private static HandleRelaysIface s_handler;
|
||||
|
||||
@Override
|
||||
|
@ -95,12 +96,16 @@ public class DispatchNotify extends Activity {
|
|||
|
||||
public static void SetRunning( Activity running )
|
||||
{
|
||||
s_running.add( running );
|
||||
if ( running instanceof HandleRelaysIface ) {
|
||||
s_running.add( (HandleRelaysIface)running );
|
||||
}
|
||||
}
|
||||
|
||||
public static void ClearRunning( Activity running )
|
||||
{
|
||||
s_running.remove( running );
|
||||
if ( running instanceof HandleRelaysIface ) {
|
||||
s_running.remove( (HandleRelaysIface)running );
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetRelayIDsHandler( HandleRelaysIface iface )
|
||||
|
@ -116,13 +121,9 @@ public class DispatchNotify extends Activity {
|
|||
s_handler.HandleInvite( data );
|
||||
handled = true;
|
||||
} else {
|
||||
for ( Activity activity : s_running ) {
|
||||
if ( activity instanceof DispatchNotify.HandleRelaysIface ) {
|
||||
DispatchNotify.HandleRelaysIface iface =
|
||||
(DispatchNotify.HandleRelaysIface)activity;
|
||||
iface.HandleInvite( data );
|
||||
handled = true;
|
||||
}
|
||||
for ( HandleRelaysIface iface : s_running ) {
|
||||
iface.HandleInvite( data );
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
return handled;
|
||||
|
@ -136,13 +137,9 @@ public class DispatchNotify extends Activity {
|
|||
s_handler.HandleRelaysIDs( relayIDs );
|
||||
handled = true;
|
||||
} else {
|
||||
for ( Activity activity : s_running ) {
|
||||
if ( activity instanceof DispatchNotify.HandleRelaysIface ) {
|
||||
DispatchNotify.HandleRelaysIface iface =
|
||||
(DispatchNotify.HandleRelaysIface)activity;
|
||||
iface.HandleRelaysIDs( relayIDs );
|
||||
handled = true;
|
||||
}
|
||||
for ( HandleRelaysIface iface : s_running ) {
|
||||
iface.HandleRelaysIDs( relayIDs );
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
return handled;
|
||||
|
|
Loading…
Add table
Reference in a new issue