public boolean mayMoveTo ( final int placeId , ResultListener < PlaceConfig > rl ) { final boolean [ ] vetoed = new boolean [ 1 ] ; _observers . apply ( new ObserverOp < LocationObserver > ( ) { public boolean apply ( LocationObserver obs ) { vetoed [ 0 ] = ( vetoed [ 0 ] || ! obs . locationMayChange ( placeId ) ) ; return true ; } } ) ; // if we're actually going somewhere, let the controller know that we might be leaving mayLeavePlace ( ) ; // if we have a result listener, let it know if we failed or keep it for later if we're // still going if ( rl != null ) { if ( vetoed [ 0 ] ) { rl . requestFailed ( new MoveVetoedException ( ) ) ; } else { _moveListener = rl ; } } // and return the result return ! vetoed [ 0 ] ; }
This can be called by cooperating directors that need to coopt the moving process to extend it in some way or other . In such situations they should call this method before moving to a new location to check to be sure that all of the registered location observers are amenable to a location change .