idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
8,300
public static void postTaskSuccess ( final TaskCompletionListener completionListener ) { new Handler ( Looper . getMainLooper ( ) ) . post ( new Runnable ( ) { public void run ( ) { if ( null != completionListener ) { completionListener . onSuccess ( ) ; } } } ) ; }
A helper function to post success to a TaskCompletionListener on the UI thread
8,301
public static void postTaskError ( final TaskCompletionListener completionListener , final String errorMessage ) { new Handler ( Looper . getMainLooper ( ) ) . post ( new Runnable ( ) { public void run ( ) { if ( null != completionListener ) { completionListener . onError ( errorMessage ) ; } } } ) ; }
A helper function to post an error message to a TaskCompletionListener on the UI thread
8,302
public static String makeGUID ( ) { String uuid = "" ; String chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" ; int rnd = 0 ; int r ; for ( int i = 0 ; i < GUID_STRING_LENGTH ; i += 1 ) { if ( i == 8 || i == 13 || i == 18 || i == 23 ) { uuid = uuid + "-" ; } else if ( i == 14 ) { uuid = uuid + ...
Create a globally unique identifier for naming instances
8,303
public void unregisterPushServices ( TaskCompletionListener completionListener ) { RespokeClient activeInstance = null ; for ( RespokeClient eachInstance : instances ) { if ( eachInstance . isConnected ( ) ) { activeInstance = eachInstance ; break ; } } if ( null != activeInstance ) { activeInstance . unregisterFromPus...
Unregister this device from the Respoke push notification service and stop any future notifications until it is re - registered
8,304
public void clientConnected ( RespokeClient client ) { if ( null != pushToken ) { registerPushServices ( ) ; } if ( ! factoryStaticInitialized ) { PeerConnectionFactory . initializeAndroidGlobals ( context , true , true , true , VideoRendererGui . getEGLContext ( ) ) ; factoryStaticInitialized = true ; } }
Notify the shared SDK instance that the specified client has connected . This is for internal use only and should never be called by your client application .
8,305
private void registerPushServices ( ) { RespokeClient activeInstance = null ; for ( RespokeClient eachInstance : instances ) { if ( eachInstance . isConnected ( ) ) { activeInstance = eachInstance ; } } if ( null != activeInstance ) { activeInstance . registerPushServicesWithToken ( pushToken ) ; } }
Attempt to register push services for this device
8,306
public static JiraRestClient connect ( URL jiraUrl , String username , String password ) throws IOException { return new AsynchronousJiraRestClientFactory ( ) . createWithBasicHttpAuthentication ( URI . create ( jiraUrl . toExternalForm ( ) ) , username , password ) ; }
Connects to the JIRA server .
8,307
public < T extends Serializable > T get ( Object key , T defaultValue ) { throw new UnsupportedOperationException ( "DeltaMap must only be read in bulk." ) ; }
- If we clear this map the type changes to REPLACE and all elements are cleared
8,308
public void update ( ) { final long time = System . currentTimeMillis ( ) ; elapsedTime += time - lastUpdateTime ; lastUpdateTime = time ; frameCount ++ ; if ( elapsedTime >= 1000 ) { tps = frameCount ; frameCount = 0 ; elapsedTime = 0 ; } }
Updates the TPS .
8,309
public InternalContext createSubContext ( VariantIndexer [ ] indexers , InternalContext localContext , int varSize ) { Object [ ] [ ] myParentScopes = this . parentScopes ; Object [ ] [ ] scopes ; if ( myParentScopes == null ) { scopes = new Object [ ] [ ] { this . vars } ; } else { scopes = new Object [ myParentScopes...
Create a sub context .
8,310
public Object resetReturnLoop ( ) { Object result = this . loopType == LoopInfo . RETURN ? this . returned : VOID ; resetLoop ( ) ; return result ; }
Unmark loops at the end of functions .
8,311
public < T > Object getBeanProperty ( final T bean , final Object property ) { if ( bean != null ) { @ SuppressWarnings ( "unchecked" ) GetResolver < T > resolver = this . getters . unsafeGet ( bean . getClass ( ) ) ; if ( resolver != null ) { return resolver . get ( bean , property ) ; } } return this . resolverManage...
Get a bean s property .
8,312
public < T > void setBeanProperty ( final T bean , final Object property , final Object value ) { if ( bean != null ) { @ SuppressWarnings ( "unchecked" ) SetResolver < T > resolver = this . setters . unsafeGet ( bean . getClass ( ) ) ; if ( resolver != null ) { resolver . set ( bean , property , value ) ; return ; } }...
Set a bean s property .
8,313
public void execute ( CinchContext cinchContext , SparkConf sparkConf ) { JavaSparkContext sparkContext = new JavaSparkContext ( sparkConf ) ; execute ( sparkContext , cinchContext ) ; }
Execute cinch job with context .
8,314
private void put ( String section , String key , String value , boolean append ) { if ( key == null ) { return ; } if ( section == null ) { put ( key , value , append ) ; return ; } put ( key . isEmpty ( ) ? section : section + '.' + key , value , append ) ; }
Adds accumulated value to key and current section .
8,315
public void forEachConst ( BiConsumer < String , Object > action ) { Objects . requireNonNull ( action ) ; this . constVars . forEach ( action ) ; }
Performs the given action for each const vars until all have been processed or the action throws an exception .
8,316
public void forEachGlobal ( BiConsumer < String , Object > action ) { Objects . requireNonNull ( action ) ; this . globalVars . forEach ( action ) ; }
Performs the given action for each global vars until all have been processed or the action throws an exception .
8,317
private void sendMessage ( org . isoblue . isobus . Message message ) { if ( mChatService . getState ( ) != BluetoothService . STATE_CONNECTED ) { Toast . makeText ( this , R . string . not_connected , Toast . LENGTH_SHORT ) . show ( ) ; return ; } mChatService . write ( message ) ; mOutStringBuffer . setLength ( 0 ) ;...
Sends a message .
8,318
static void setHost ( String scheme , String host , int port ) { BASE_URL = scheme + "://" + host + ":" + port + "/" + VERSION + "/" ; }
Override the server location .
8,319
public String performPostRequest ( String requestString , String data ) throws IOException { HttpPost request = new HttpPost ( getBaseUrl ( ) + requestString ) ; String json = null ; CloseableHttpClient httpClient = HttpClients . createDefault ( ) ; if ( proxies . size ( ) > 0 ) { Proxy myProxy = proxies . get ( 0 ) ; ...
Perform the request with the given URL and JSON data .
8,320
protected String performGetRequest ( String requestString ) throws IOException { HttpGet request = new HttpGet ( getBaseUrl ( ) + requestString ) ; if ( USER != null && ! USER . isEmpty ( ) ) { request . setHeader ( "Authorization" , USER + ":" + TOKEN ) ; } String json = null ; CloseableHttpClient httpClient = HttpCli...
Perform a get request
8,321
public String concat ( final String parent , final String name ) { return parent != null ? FileNameUtil . concat ( FileNameUtil . getPath ( parent ) , name ) : name ; }
get child template name by parent template name and relative name .
8,322
protected String getRealPath ( final String name ) { return this . root != null ? this . root . concat ( name ) : name . substring ( 1 ) ; }
get real path from name .
8,323
public String normalize ( String name ) { if ( name == null ) { return null ; } if ( name . isEmpty ( ) ) { return "/" ; } if ( name . charAt ( 0 ) != '/' && name . charAt ( 0 ) != '\\' ) { name = "/" . concat ( name ) ; } name = FileNameUtil . normalize ( name ) ; if ( name == null ) { return null ; } if ( ! this . ap...
normalize a template s name .
8,324
public final int get ( int i ) { if ( fullWidth ) { return array . get ( i ) ; } return unPack ( array . get ( getIndex ( i ) ) , getSubIndex ( i ) ) ; }
Gets an element from the array at a given index
8,325
public int [ ] getPacked ( ) { int length = this . array . length ( ) ; int [ ] packed = new int [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { packed [ i ] = this . array . get ( i ) ; } return packed ; }
Gets a packed version of this array . Tearing may occur if the array is updated during this method call .
8,326
@ SuppressWarnings ( "unchecked" ) public < T > T get ( final Class < T > type ) { T bean = ( T ) components . get ( type ) ; if ( bean != null ) { return bean ; } return ( T ) get ( type . getName ( ) ) ; }
Get component or bean by type .
8,327
public Object get ( final String name ) { Object bean = this . beans . get ( name ) ; if ( bean != null ) { return bean ; } return resolveBeanIfAbsent ( name ) ; }
Get bean by name .
8,328
private synchronized void setState ( int state ) { mState = state ; mHandler . obtainMessage ( ISOBlueDemo . MESSAGE_STATE_CHANGE , state , - 1 ) . sendToTarget ( ) ; }
Set the current state of the chat connection
8,329
public synchronized void connect ( BluetoothDevice device , boolean past ) throws IOException , InterruptedException { if ( mState == STATE_CONNECTING ) { if ( mConnectThread != null ) { mConnectThread . cancel ( ) ; mConnectThread = null ; } } if ( mEngConnectedThread != null ) { mEngConnectedThread . cancel ( ) ; mEn...
Start the ConnectThread to initiate a connection to a remote device .
8,330
public void write ( org . isoblue . isobus . Message out ) { ConnectedThread r ; synchronized ( this ) { if ( mState != STATE_CONNECTED ) return ; r = mEngConnectedThread ; } r . write ( out ) ; }
Write to the ConnectedThread in an unsynchronized manner
8,331
private void connectionFailed ( ) { Message msg = mHandler . obtainMessage ( ISOBlueDemo . MESSAGE_TOAST ) ; Bundle bundle = new Bundle ( ) ; bundle . putString ( ISOBlueDemo . TOAST , "Unable to connect device" ) ; msg . setData ( bundle ) ; mHandler . sendMessage ( msg ) ; BluetoothService . this . start ( ) ; }
Indicate that the connection attempt failed and notify the UI Activity .
8,332
public void onCreate ( Bundle savedInstanceState ) { setContentView ( R . layout . about ) ; TextView tv = ( TextView ) findViewById ( R . id . legal_text ) ; tv . setText ( readRawTextFile ( R . raw . legal ) ) ; tv = ( TextView ) findViewById ( R . id . info_text ) ; tv . setText ( Html . fromHtml ( readRawTextFile (...
This is the standard Android on create method that gets called when the activity initialized .
8,333
public static < A , B > boolean equalsAny ( A object , B ... objects ) { for ( B o : objects ) { if ( bothNullOrEqual ( o , object ) ) { return true ; } } return false ; }
Checks if the object equals one of the other objects given
8,334
public static boolean bothNullOrEqual ( Object a , Object b ) { return ( a == null || b == null ) ? ( a == b ) : a . equals ( b ) ; }
Checks if object a and b are both null or are equal
8,335
protected void verifySadRequest ( SignatureActivationDataContext sadRequest , ProfileRequestContext < ? , ? > context ) throws ExternalAutenticationErrorCodeException { final AuthnRequest authnRequest = this . getAuthnRequest ( context ) ; if ( authnRequest == null ) { log . error ( "No AuthnRequest available [{}]" , t...
Verifies a received SAD request .
8,336
protected boolean isSignMessageURI ( String uri ) { LoaEnum loa = LoaEnum . parse ( uri ) ; return ( loa != null && loa . isSignatureMessageUri ( ) ) ; }
Predicate that tells if the supplied URI is a URI indicating sign message display .
8,337
public void connect ( String endpointID , String appID , boolean shouldReconnect , final Object initialPresence , Context context , final ConnectCompletionListener completionListener ) { if ( ( endpointID != null ) && ( appID != null ) && ( endpointID . length ( ) > 0 ) && ( appID . length ( ) > 0 ) ) { connectionInPro...
Connect to the Respoke infrastructure and authenticate in development mode using the specified endpoint ID and app ID . Attempt to obtain an authentication token automatically from the Respoke infrastructure .
8,338
public void connect ( String tokenID , final Object initialPresence , Context context , final ConnectCompletionListener completionListener ) { if ( ( tokenID != null ) && ( tokenID . length ( ) > 0 ) ) { connectionInProgress = true ; appContext = context ; APIDoOpen request = new APIDoOpen ( context , baseURL ) { publi...
Connect to the Respoke infrastructure and authenticate with the specified brokered auth token ID .
8,339
public void joinGroups ( final ArrayList < String > groupIDList , final JoinGroupCompletionListener completionListener ) { if ( isConnected ( ) ) { if ( ( groupIDList != null ) && ( groupIDList . size ( ) > 0 ) ) { String urlEndpoint = "/v1/groups" ; JSONArray groupList = new JSONArray ( groupIDList ) ; JSONObject data...
Join a list of Groups and begin keeping track of them .
8,340
public RespokeConnection getConnection ( String connectionID , String endpointID , boolean skipCreate ) { RespokeConnection connection = null ; if ( null != connectionID ) { RespokeEndpoint endpoint = getEndpoint ( endpointID , skipCreate ) ; if ( null != endpoint ) { for ( RespokeConnection eachConnection : endpoint ....
Find a Connection by id and return it . In most cases if we don t find it we will create it . This is useful in the case of dynamic endpoints where groups are not in use . Set skipCreate = true to return null if the Connection is not already known .
8,341
public RespokeCall joinConference ( RespokeCall . Listener callListener , Context context , String conferenceID ) { RespokeCall call = null ; if ( ( null != signalingChannel ) && ( signalingChannel . connected ) ) { call = new RespokeCall ( signalingChannel , conferenceID , "conference" ) ; call . setListener ( callLis...
Initiate a call to a conference .
8,342
public RespokeEndpoint getEndpoint ( String endpointIDToFind , boolean skipCreate ) { RespokeEndpoint endpoint = null ; if ( null != endpointIDToFind ) { for ( RespokeEndpoint eachEndpoint : knownEndpoints ) { if ( eachEndpoint . getEndpointID ( ) . equals ( endpointIDToFind ) ) { endpoint = eachEndpoint ; break ; } } ...
Find an endpoint by id and return it . In most cases if we don t find it we will create it . This is useful in the case of dynamic endpoints where groups are not in use . Set skipCreate = true to return null if the Endpoint is not already known .
8,343
public RespokeGroup getGroup ( String groupIDToFind ) { RespokeGroup group = null ; if ( null != groupIDToFind ) { group = groups . get ( groupIDToFind ) ; } return group ; }
Returns the group with the specified ID
8,344
public void getGroupHistories ( final List < String > groupIds , final Integer maxMessages , final GroupHistoriesCompletionListener completionListener ) { if ( ! isConnected ( ) ) { getGroupHistoriesError ( completionListener , "Can't complete request when not connected, " + "Please reconnect!" ) ; return ; } if ( ( ma...
Retrieve the history of messages that have been persisted for 1 or more groups . Only those messages that have been marked to be persisted when sent will show up in the history .
8,345
public void setConversationsRead ( final List < RespokeConversationReadStatus > updates , final Respoke . TaskCompletionListener completionListener ) { if ( ! isConnected ( ) ) { Respoke . postTaskError ( completionListener , "Can't complete request when not connected, " + "Please reconnect!" ) ; return ; } if ( ( upda...
Mark messages in a conversation as having been read up to the given timestamp
8,346
public void getGroupHistory ( final String groupId , final Integer maxMessages , final GroupHistoryCompletionListener completionListener ) { getGroupHistory ( groupId , maxMessages , null , completionListener ) ; }
Retrieve the history of messages that have been persisted for a specific group . Only those messages that have been marked to be persisted when sent will show up in the history . To retrieve messages further back in the history than right now use the other method signature that allows before to be specified .
8,347
public void getGroupHistory ( final String groupId , final Integer maxMessages , final Date before , final GroupHistoryCompletionListener completionListener ) { if ( ! isConnected ( ) ) { getGroupHistoryError ( completionListener , "Can't complete request when not connected, " + "Please reconnect!" ) ; return ; } if ( ...
Retrieve the history of messages that have been persisted for a specific group . Only those messages that have been marked to be persisted when sent will show up in the history .
8,348
public void setPresence ( Object newPresence , final Respoke . TaskCompletionListener completionListener ) { if ( isConnected ( ) ) { Object presenceToSet = newPresence ; if ( null == presenceToSet ) { presenceToSet = "available" ; } JSONObject typeData = new JSONObject ( ) ; JSONObject data = new JSONObject ( ) ; try ...
Set the presence on the client session
8,349
public void registerPushServicesWithToken ( final String token ) { String httpURI ; String httpMethod ; JSONObject data = new JSONObject ( ) ; try { data . put ( "token" , token ) ; data . put ( "service" , "google" ) ; SharedPreferences prefs = appContext . getSharedPreferences ( appContext . getPackageName ( ) , Cont...
Register the client to receive push notifications when the socket is not active
8,350
public void unregisterFromPushServices ( final Respoke . TaskCompletionListener completionListener ) { if ( isConnected ( ) ) { SharedPreferences prefs = appContext . getSharedPreferences ( appContext . getPackageName ( ) , Context . MODE_PRIVATE ) ; if ( null != prefs ) { String lastKnownPushTokenID = prefs . getStrin...
Unregister this client from the push service so that no more notifications will be received for this endpoint ID
8,351
private void postConnectError ( final ConnectCompletionListener completionListener , final String errorMessage ) { new Handler ( Looper . getMainLooper ( ) ) . post ( new Runnable ( ) { public void run ( ) { if ( null != completionListener ) { completionListener . onError ( errorMessage ) ; } } } ) ; }
A convenience method for posting errors to a ConnectCompletionListener
8,352
private void postJoinGroupMembersError ( final JoinGroupCompletionListener completionListener , final String errorMessage ) { new Handler ( Looper . getMainLooper ( ) ) . post ( new Runnable ( ) { public void run ( ) { if ( null != completionListener ) { completionListener . onError ( errorMessage ) ; } } } ) ; }
A convenience method for posting errors to a JoinGroupCompletionListener
8,353
private void performReconnect ( ) { if ( null != applicationID ) { reconnectCount ++ ; new java . util . Timer ( ) . schedule ( new java . util . TimerTask ( ) { public void run ( ) { actuallyReconnect ( ) ; } } , RECONNECT_INTERVAL * ( reconnectCount - 1 ) ) ; } }
Attempt to reconnect the client after a small delay
8,354
private void actuallyReconnect ( ) { if ( ( ( null == signalingChannel ) || ! signalingChannel . connected ) && reconnect ) { if ( connectionInProgress ) { performReconnect ( ) ; } else { Log . d ( TAG , "Trying to reconnect..." ) ; connect ( localEndpointID , applicationID , reconnect , presence , appContext , new Con...
Attempt to reconnect the client if it is not already trying in another thread
8,355
private RespokeGroupMessage buildGroupMessage ( JSONObject source ) throws JSONException { if ( source == null ) { throw new IllegalArgumentException ( "source cannot be null" ) ; } final JSONObject header = source . getJSONObject ( "header" ) ; final String endpointID = header . getString ( "from" ) ; final RespokeEnd...
Build a group message from a JSON object . The format of the JSON object would be the format that comes over the wire from Respoke when receiving a pubsub message . This same format is used when retrieving message history .
8,356
public void setListener ( Listener listener ) { if ( null != listener ) { listenerReference = new WeakReference < Listener > ( listener ) ; } else { listenerReference = null ; } }
Set a receiver for the Listener interface
8,357
public void accept ( Context context ) { if ( null != callReference ) { RespokeCall call = callReference . get ( ) ; if ( null != call ) { call . directConnectionDidAccept ( context ) ; } } }
Accept the direct connection and start the process of obtaining media .
8,358
public void sendMessage ( String message , final Respoke . TaskCompletionListener completionListener ) { if ( isActive ( ) ) { JSONObject jsonMessage = new JSONObject ( ) ; try { jsonMessage . put ( "message" , message ) ; byte [ ] rawMessage = jsonMessage . toString ( ) . getBytes ( Charset . forName ( "UTF-8" ) ) ; B...
Send a message to the remote client through the direct connection .
8,359
public void createDataChannel ( ) { if ( null != callReference ) { RespokeCall call = callReference . get ( ) ; if ( null != call ) { PeerConnection peerConnection = call . getPeerConnection ( ) ; dataChannel = peerConnection . createDataChannel ( "respokeDataChannel" , new DataChannel . Init ( ) ) ; dataChannel . regi...
Establish a new direct connection instance with the peer connection for the call . This is used internally to the SDK and should not be called directly by your client application .
8,360
public void peerConnectionDidOpenDataChannel ( DataChannel newDataChannel ) { if ( null != dataChannel ) { dataChannel . unregisterObserver ( ) ; } else { new Handler ( Looper . getMainLooper ( ) ) . post ( new Runnable ( ) { public void run ( ) { if ( null != listenerReference ) { Listener listener = listenerReference...
Notify the direct connection instance that the peer connection has opened the specified data channel
8,361
public void onStateChange ( ) { switch ( dataChannel . state ( ) ) { case CONNECTING : break ; case OPEN : { if ( null != callReference ) { RespokeCall call = callReference . get ( ) ; if ( null != call ) { call . directConnectionDidOpen ( this ) ; } } new Handler ( Looper . getMainLooper ( ) ) . post ( new Runnable ( ...
org . webrtc . DataChannel . Observer methods
8,362
public void set ( int [ ] initial ) { resizeLock . lock ( ) ; try { if ( initial . length != length ) { throw new IllegalArgumentException ( "Array length mismatch, expected " + length + ", got " + initial . length ) ; } int unique = AtomicShortIntArray . getUnique ( initial ) ; int allowedPalette = AtomicShortIntPalet...
Sets the array equal to the given array . The array should be the same length as this array
8,363
public void uncompressedSet ( int [ ] initial ) { resizeLock . lock ( ) ; try { if ( initial . length != length ) { throw new IllegalArgumentException ( "Array length mismatch, expected " + length + ", got " + initial . length ) ; } store . set ( new AtomicShortIntDirectBackingArray ( length , initial ) ) ; } finally {...
Sets the array equal to the given array without automatically compressing the data . The array should be the same length as this array
8,364
public void set ( int [ ] palette , int blockArrayWidth , int [ ] variableWidthBlockArray ) { resizeLock . lock ( ) ; try { if ( palette . length == 0 ) { store . set ( new AtomicShortIntDirectBackingArray ( length , variableWidthBlockArray ) ) ; } else if ( palette . length == 1 ) { store . set ( new AtomicShortIntUni...
Sets the array equal to the given palette based array . The main array should be the same length as this array
8,365
public void compress ( ) { resizeLock . lock ( ) ; try { AtomicShortIntBackingArray s = store . get ( ) ; if ( s instanceof AtomicShortIntUniformBackingArray ) { return ; } int unique = s . getUnique ( ) ; if ( AtomicShortIntPaletteBackingArray . roundUpWidth ( unique - 1 ) >= s . width ( ) ) { return ; } if ( unique >...
Attempts to compress the array
8,366
public void getMembers ( final GetGroupMembersCompletionListener completionListener ) { if ( isJoined ( ) ) { if ( ( null != groupID ) && ( groupID . length ( ) > 0 ) ) { String urlEndpoint = "/v1/channels/" + groupID + "/subscribers/" ; signalingChannel . sendRESTMessage ( "get" , urlEndpoint , null , new RespokeSigna...
Get an array containing the members of the group .
8,367
public void join ( final Respoke . TaskCompletionListener completionListener ) { if ( ! isConnected ( ) ) { Respoke . postTaskError ( completionListener , "Can't complete request when not connected. " + "Please reconnect!" ) ; return ; } if ( ( groupID == null ) || ( groupID . length ( ) == 0 ) ) { Respoke . postTaskEr...
Join this group
8,368
public void leave ( final Respoke . TaskCompletionListener completionListener ) { if ( isJoined ( ) ) { if ( ( null != groupID ) && ( groupID . length ( ) > 0 ) ) { String urlEndpoint = "/v1/groups" ; JSONArray groupList = new JSONArray ( ) ; groupList . put ( groupID ) ; JSONObject data = new JSONObject ( ) ; try { da...
Leave this group
8,369
public void sendMessage ( String message , boolean push , boolean persist , final Respoke . TaskCompletionListener completionListener ) { if ( isJoined ( ) ) { if ( ( null != groupID ) && ( groupID . length ( ) > 0 ) ) { RespokeClient client = clientReference . get ( ) ; if ( null != client ) { JSONObject data = new JS...
Send a message to the entire group .
8,370
public void connectionDidJoin ( final RespokeConnection connection ) { members . add ( connection ) ; new Handler ( Looper . getMainLooper ( ) ) . post ( new Runnable ( ) { public void run ( ) { Listener listener = listenerReference . get ( ) ; if ( null != listener ) { listener . onJoin ( connection , RespokeGroup . t...
Notify the group that a connection has joined . This is used internally to the SDK and should not be called directly by your client application .
8,371
public void connectionDidLeave ( final RespokeConnection connection ) { members . remove ( connection ) ; new Handler ( Looper . getMainLooper ( ) ) . post ( new Runnable ( ) { public void run ( ) { Listener listener = listenerReference . get ( ) ; if ( null != listener ) { listener . onLeave ( connection , RespokeGrou...
Notify the group that a connection has left . This is used internally to the SDK and should not be called directly by your client application .
8,372
private void postGetGroupMembersError ( final GetGroupMembersCompletionListener completionListener , final String errorMessage ) { new Handler ( Looper . getMainLooper ( ) ) . post ( new Runnable ( ) { public void run ( ) { if ( null != completionListener ) { completionListener . onError ( errorMessage ) ; } } } ) ; }
A convenience method for posting errors to a GetGroupMembersCompletionListener
8,373
public HttpEntity < byte [ ] > getMetadata ( HttpServletRequest request , @ RequestHeader ( name = "Accept" , required = false ) String acceptHeader ) { logger . debug ( "Request to download metadata from {}" , request . getRemoteAddr ( ) ) ; try { if ( this . metadataContainer . updateRequired ( true ) ) { logger . de...
Returns the metadata for the entity .
8,374
public void execute ( StreamingCinchContext cinchContext , SparkConf sparkConf ) { JavaStreamingContext streamingContext = new JavaStreamingContext ( sparkConf , new Duration ( durationInMillis ) ) ; defineJob ( streamingContext , cinchContext ) ; streamingContext . start ( ) ; streamingContext . awaitTermination ( ) ;...
Execute cinch job with context and spark conf .
8,375
public Context merge ( final Map < String , Object > vars ) { return merge ( Vars . of ( vars ) ) ; }
Merge this template and discard outputs .
8,376
public Context debug ( final Vars vars , final Out out , final BreakpointListener listener ) { try { return Parser . parse ( this , listener ) . execute ( this , out , vars ) ; } catch ( Exception e ) { throw completeException ( e ) ; } }
Debug this template .
8,377
protected void setAuthenticatingAuthority ( Assertion assertion , Assertion proxiedAssertion ) { if ( proxiedAssertion . getIssuer ( ) == null || proxiedAssertion . getIssuer ( ) . getValue ( ) == null ) { log . warn ( "No issuer element found in proxied assertion" ) ; return ; } if ( assertion . getAuthnStatements ( )...
Assigns the AuthenticatingAuthority element holding the issuer of the proxied assertion .
8,378
public void update ( Matrix4f projection , Matrix4f view ) { final float [ ] clip = projection . mul ( view ) . toArray ( true ) ; frustum [ 0 ] [ 0 ] = clip [ 3 ] - clip [ 0 ] ; frustum [ 0 ] [ 1 ] = clip [ 7 ] - clip [ 4 ] ; frustum [ 0 ] [ 2 ] = clip [ 11 ] - clip [ 8 ] ; frustum [ 0 ] [ 3 ] = clip [ 15 ] - clip [ 1...
Updates the frustum to match the view and projection matrix .
8,379
public float getNearPlane ( ) { if ( nearPlane == - 1 ) { final Vector3f nearPos = vertices [ 0 ] . add ( vertices [ 2 ] ) . add ( vertices [ 4 ] ) . add ( vertices [ 6 ] ) . div ( 4 ) ; nearPlane = nearPos . sub ( position ) . length ( ) ; } return nearPlane ; }
Returns the near plane distance of the frustum .
8,380
public float getFarPlane ( ) { if ( farPlane == - 1 ) { final Vector3f farPos = vertices [ 1 ] . add ( vertices [ 3 ] ) . add ( vertices [ 5 ] ) . add ( vertices [ 7 ] ) . div ( 4 ) ; farPlane = farPos . sub ( position ) . length ( ) ; } return farPlane ; }
Returns the far plane distance of the frustum .
8,381
private float distance ( int i , float x , float y , float z ) { return frustum [ i ] [ 0 ] * x + frustum [ i ] [ 1 ] * y + frustum [ i ] [ 2 ] * z + frustum [ i ] [ 3 ] ; }
Compute the distance between a point and the given plane .
8,382
protected Locale getLocale ( RequestContext context ) { return this . locale != null ? this . locale : context . getExternalContext ( ) . getLocale ( ) ; }
Returns the locale to use when resolving messages .
8,383
private static < A extends Annotation > A getParameterAnnotation ( Method method , int index , Class < A > annotationClass ) { for ( Annotation a : method . getParameterAnnotations ( ) [ index ] ) { if ( annotationClass . isInstance ( a ) ) { return annotationClass . cast ( a ) ; } } return null ; }
Find an annotation for a parameter on a method .
8,384
private static < A extends Annotation > A getAnnotation ( AnnotatedElement element , Class < A > annotationClass ) { return ( element != null ) ? element . getAnnotation ( annotationClass ) : null ; }
Null safe annotation checker
8,385
public byte [ ] serialize ( ) { try { ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; ObjectOutputStream oos = new ObjectOutputStream ( out ) ; oos . writeObject ( map ) ; return out . toByteArray ( ) ; } catch ( IOException ex ) { throw new IllegalStateException ( "Unable to compress SerializableMap" ) ; }...
This serializes only the data as opposed to the whole object .
8,386
@ SuppressWarnings ( "unchecked" ) public void deserialize ( byte [ ] serializedData , boolean wipe ) throws IOException { if ( wipe ) { map . clear ( ) ; } InputStream in = new ByteArrayInputStream ( serializedData ) ; ObjectInputStream ois = new ClassResolverObjectInputStream ( in ) ; try { for ( Map . Entry < String...
This deserializes only the data as opposed to the whole object .
8,387
public boolean becomePublisher ( ) { if ( publisherThreadID . get ( ) != - 1 ) { return false ; } publisherThreadID . set ( Thread . currentThread ( ) . getId ( ) ) ; return true ; }
Attempts to make the thread the publisher returning true if the attempt succeeded . This is only possible if there s no publisher .
8,388
public void unsubscribe ( ) { final long id = Thread . currentThread ( ) . getId ( ) ; queues . remove ( id ) ; if ( subscriberIdentifiers != null ) { for ( Iterator < Entry < Object , Long > > iterator = subscriberIdentifiers . entrySet ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { if ( id == iterator . next ( ) ....
Unsubscribes the thread from the queue .
8,389
public boolean addAll ( Collection < ? extends T > c , Object identifier ) { checkNotNullArgument ( c ) ; if ( isPublisherThread ( ) ) { boolean changed = false ; if ( identifier != null ) { final Long id = subscriberIdentifiers . get ( identifier ) ; checkNotNullIdentifier ( id ) ; changed = queues . get ( id ) . addA...
Adds a collection of objects to the queue targeting only the subscriber identified by the provided identifier object unless said object is null . The added objects will only be visible to the subscriber .
8,390
public final boolean isValid ( HttpServletRequest req , String token ) { String storedToken = getStoredToken ( req ) ; if ( storedToken == null ) return false ; return storedToken . equals ( token ) ; }
Tests given token against stored one .
8,391
protected void store ( HttpServletRequest req , HttpServletResponse resp , String token ) { HttpSession session = req . getSession ( ) ; session . setAttribute ( ATR_SESSION_TOKEN , token ) ; }
Associates a token with an user . Default implementation stores the token into user session .
8,392
protected String getStoredToken ( HttpServletRequest req ) { HttpSession session = req . getSession ( false ) ; if ( session == null ) return null ; return ( String ) session . getAttribute ( ATR_SESSION_TOKEN ) ; }
Returns the token previously associated with given request . Default implementation retrieves the token from user session .
8,393
public void spec ( String name , Runnable body ) { context . spec ( name , new GroovyClosure ( body ) ) ; }
Declares a child spec .
8,394
public QueryableIndex cache ( String dataSource , Iterable < InputRow > loader , IncrementalIndexSchema indexSchema ) throws IOException { IncrementalIndex < ? > incIndex = new OnheapIncrementalIndex ( indexSchema , true , Integer . MAX_VALUE ) ; for ( InputRow row : loader ) { incIndex . add ( row ) ; } String tmpDir ...
Builds and caches a QueryableIndex from an Iterable by building persisting and reloading an IncrementalIndex
8,395
public static boolean startsWithIgnoreCase ( String input , String prefix ) { if ( input == null || prefix == null || prefix . length ( ) > input . length ( ) ) { return false ; } else { final char [ ] inputCharArray = input . toCharArray ( ) ; final char [ ] prefixCharArray = prefix . toCharArray ( ) ; for ( int i = 0...
Tests if this string starts with the specified prefix ignoring case
8,396
public static < T extends Named > Collection < T > matchName ( Collection < T > values , String name ) { List < T > result = new ArrayList < > ( ) ; for ( T value : values ) { if ( value == null ) { continue ; } if ( startsWithIgnoreCase ( value . getName ( ) , name ) ) { result . add ( value ) ; } } return result ; }
Matches a named class using a name
8,397
public static String toNamedString ( Object object , Object ... components ) { StringBuilder b = new StringBuilder ( components . length * 5 + 2 ) ; if ( object != null ) { b . append ( object . getClass ( ) . getSimpleName ( ) ) . append ( ' ' ) ; } b . append ( '{' ) ; for ( int i = 0 ; i < components . length ; i ++...
Wraps all components in between brackets delimited by - signs appending the class name in front of it .
8,398
public String getAttributeID ( String name ) { Map < String , String > m = this . getMapping ( ) ; return m != null ? m . get ( name ) : null ; }
Returns the Shibboleth attribute ID that corresponds to the supplied SAML2 attribute name .
8,399
protected void initializeServices ( ProfileRequestContext < ? , ? > profileRequestContext ) throws ExternalAutenticationErrorCodeException { this . authnContextService . initializeContext ( profileRequestContext ) ; this . signSupportService . initializeContext ( profileRequestContext ) ; }
Initializes the services for the controller . Subclasses should override this method to initialize their own services .