idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
8,400 | protected void servicesProcessRequest ( ProfileRequestContext < ? , ? > profileRequestContext ) throws ExternalAutenticationErrorCodeException { this . authnContextService . processRequest ( profileRequestContext ) ; this . signSupportService . processRequest ( profileRequestContext ) ; } | Invokes request processing for all installed services . Subclasses should override this method to invoke their own services . |
8,401 | protected String getExternalAuthenticationKey ( HttpServletRequest httpRequest ) throws ExternalAuthenticationException { String key = ( String ) httpRequest . getSession ( ) . getAttribute ( EXTAUTHN_KEY_ATTRIBUTE_NAME ) ; if ( key == null ) { throw new ExternalAuthenticationException ( "No external authentication process is active" ) ; } return key ; } | Returns the Shibboleth external authentication key for the current session . |
8,402 | protected void success ( HttpServletRequest httpRequest , HttpServletResponse httpResponse , String principal , List < Attribute > attributes , String authnContextClassUri , DateTime authnInstant , Boolean cacheForSSO ) throws ExternalAuthenticationException , IOException { SubjectBuilder builder = this . getSubjectBuilder ( principal ) ; for ( Attribute a : attributes ) { builder . attribute ( a ) ; } builder . authnContextClassRef ( authnContextClassUri ) ; this . success ( httpRequest , httpResponse , builder . build ( ) , authnInstant , cacheForSSO ) ; } | Method that should be invoked to exit the external authentication process with a successful result . |
8,403 | protected void cancel ( HttpServletRequest httpRequest , HttpServletResponse httpResponse ) throws ExternalAuthenticationException , IOException { this . error ( httpRequest , httpResponse , ExtAuthnEventIds . CANCEL_AUTHN ) ; } | Method that should be invoked before exiting the external authentication process and indicate that the user cancelled the authentication . |
8,404 | protected void error ( HttpServletRequest httpRequest , HttpServletResponse httpResponse , Status errorStatus ) throws ExternalAuthenticationException , IOException { this . error ( httpRequest , httpResponse , new IdpErrorStatusException ( errorStatus ) ) ; } | Method that should be invoked to exit the external authentication process with an error where the SAML status to respond with is given . |
8,405 | protected String getBinding ( ProfileRequestContext < ? , ? > context ) { SAMLBindingContext samlBinding = this . samlBindingContextLookupStrategy . apply ( context ) ; return samlBinding != null ? samlBinding . getBindingUri ( ) : null ; } | Utility method that may be used to obtain the binding that was used to pass the AuthnRequest message . |
8,406 | protected String getRelayState ( ProfileRequestContext < ? , ? > context ) { SAMLBindingContext samlBinding = this . samlBindingContextLookupStrategy . apply ( context ) ; return samlBinding != null ? samlBinding . getRelayState ( ) : null ; } | Utility method that may be used to obtain the Relay State for the request . |
8,407 | public int convertTo ( StringToUniqueIntegerMap other , int localId ) { if ( other == null ) { throw new IllegalStateException ( "Other map is null" ) ; } String localKey = store . reverseGet ( localId ) ; if ( localKey == null ) { throw new IllegalArgumentException ( "Cannot convert an id that is not registered locally." ) ; } Integer foreignId = null ; if ( other == this ) { return localId ; } else if ( other == parent ) { foreignId = thisToParentMap . get ( localId ) ; } else if ( other . parent == this ) { foreignId = other . parentToThisMap . get ( localId ) ; } if ( foreignId != null ) { return foreignId ; } Integer integerForeignId = other . store . get ( localKey ) ; if ( integerForeignId == null ) { integerForeignId = other . register ( localKey ) ; } if ( other == parent ) { thisToParentMap . set ( localId , integerForeignId ) ; parentToThisMap . set ( integerForeignId , localId ) ; } else if ( other . parent == this ) { other . thisToParentMap . set ( integerForeignId , localId ) ; other . parentToThisMap . set ( localId , integerForeignId ) ; } return integerForeignId ; } | Converts an id local to this map to a foreign id local to another map . |
8,408 | public int register ( String key ) { Integer id = store . get ( key ) ; if ( id != null ) { return id ; } int localId = nextId . getAndIncrement ( ) ; while ( localId < maxId ) { if ( store . setIfAbsent ( key , localId ) ) { return localId ; } Integer storeId = store . get ( key ) ; if ( storeId != null ) { return storeId ; } localId = nextId . getAndIncrement ( ) ; } throw new IllegalStateException ( "StringMap id space exhausted" ) ; } | Registers a key with the map and returns the matching id . |
8,409 | public void executeJob ( ) { AbstractApplicationContext springContext = SpringContext . getContext ( springConfigurationClass ) ; CinchJob cinchJob = springContext . getBean ( CinchJob . class ) ; cinchJob . execute ( this ) ; } | Executes your job from the spring context . |
8,410 | public < T1 , R > Function < T1 , R > function ( Class < ? extends Function < T1 , R > > springBeanClass ) { return new SpringFunction < > ( springConfigurationClass , springBeanClass ) ; } | Create a new SpringFunction which implements Spark s Function interface . |
8,411 | public < T > VoidFunction < T > voidFunction ( Class < ? extends VoidFunction < T > > springBeanClass ) { return new SpringVoidFunction < > ( springConfigurationClass , springBeanClass ) ; } | Create a new SpringVoidFunction which implements Spark s VoidFunction interface . |
8,412 | public < T , R > FlatMapFunction < T , R > flatMapFunction ( Class < ? extends FlatMapFunction < T , R > > springBeanClass ) { return new SpringFlatMapFunction < > ( springConfigurationClass , springBeanClass ) ; } | Create a new SpringFlapMapFunction which implements Spark s FlatMapFunction interface . |
8,413 | public void sendMessage ( String message , boolean push , boolean ccSelf , final Respoke . TaskCompletionListener completionListener ) { if ( ( null != signalingChannel ) && ( signalingChannel . connected ) ) { try { JSONObject data = new JSONObject ( ) ; data . put ( "to" , endpointID ) ; data . put ( "message" , message ) ; data . put ( "push" , push ) ; data . put ( "ccSelf" , ccSelf ) ; signalingChannel . sendRESTMessage ( "post" , "/v1/messages" , data , new RespokeSignalingChannel . RESTListener ( ) { public void onSuccess ( Object response ) { Respoke . postTaskSuccess ( completionListener ) ; } public void onError ( final String errorMessage ) { Respoke . postTaskError ( completionListener , errorMessage ) ; } } ) ; } catch ( JSONException e ) { Respoke . postTaskError ( completionListener , "Error encoding message" ) ; } } else { Respoke . postTaskError ( completionListener , "Can't complete request when not connected. Please reconnect!" ) ; } } | Send a message to the endpoint through the infrastructure . |
8,414 | public RespokeCall startCall ( RespokeCall . Listener callListener , Context context , GLSurfaceView glView , boolean audioOnly ) { RespokeCall call = null ; if ( ( null != signalingChannel ) && ( signalingChannel . connected ) ) { call = new RespokeCall ( signalingChannel , this , false ) ; call . setListener ( callListener ) ; call . startCall ( context , glView , audioOnly ) ; } return call ; } | Create a new call with audio and optionally video . |
8,415 | public RespokeConnection getConnection ( String connectionID , boolean skipCreate ) { RespokeConnection connection = null ; for ( RespokeConnection eachConnection : connections ) { if ( eachConnection . connectionID . equals ( connectionID ) ) { connection = eachConnection ; break ; } } if ( ( null == connection ) && ! skipCreate ) { connection = new RespokeConnection ( connectionID , this ) ; connections . add ( connection ) ; } return connection ; } | Returns a connection with the specified ID and optionally creates one if it does not exist |
8,416 | public void didSendMessage ( final String message , final Date timestamp ) { new Handler ( Looper . getMainLooper ( ) ) . post ( new Runnable ( ) { public void run ( ) { if ( null != listenerReference ) { Listener listener = listenerReference . get ( ) ; if ( null != listener ) { listener . onMessage ( message , timestamp , RespokeEndpoint . this , true ) ; } } } } ) ; } | Process a sent message . This is used internally to the SDK and should not be called directly by your client application . |
8,417 | public void setDirectConnection ( RespokeDirectConnection newDirectConnection ) { if ( null != newDirectConnection ) { directConnectionReference = new WeakReference < RespokeDirectConnection > ( newDirectConnection ) ; } else { directConnectionReference = null ; } } | Associate a direct connection object with this endpoint . This method is used internally by the SDK should not be called by your client application . |
8,418 | public RespokeDirectConnection startDirectConnection ( ) { RespokeCall call = new RespokeCall ( signalingChannel , this , true ) ; call . startCall ( null , null , false ) ; return directConnection ( ) ; } | Create a new DirectConnection . This method creates a new Call as well attaching this DirectConnection to it for the purposes of creating a peer - to - peer link for sending data such as messages to the other endpoint . Information sent through a DirectConnection is not handled by the cloud infrastructure . |
8,419 | public final T check ( Object object , T defaultValue ) { try { return check ( object ) ; } catch ( ClassCastException e ) { return defaultValue ; } } | Checks and casts an object to the specified type . If casting fails a default value is returned . |
8,420 | public Server run ( ) throws Exception { if ( server == null ) { server = new Server ( port ) ; String basePath = "/druid" ; buildSwagger ( basePath ) ; HandlerList handlers = new HandlerList ( ) ; handlers . addHandler ( buildContext ( basePath ) ) ; server . setHandler ( handlers ) ; server . start ( ) ; } else { throw new IllegalStateException ( "Server already running" ) ; } return server ; } | Starts the Druid instance and returns the server it is running on |
8,421 | private static void buildSwagger ( String basePath ) { BeanConfig beanConfig = new BeanConfig ( ) ; beanConfig . setVersion ( "1.0.0" ) ; beanConfig . setResourcePackage ( QueryResource . class . getPackage ( ) . getName ( ) ) ; beanConfig . setBasePath ( basePath ) ; beanConfig . setDescription ( "Embedded Druid" ) ; beanConfig . setTitle ( "Embedded Druid" ) ; beanConfig . setScan ( true ) ; } | Builds the Swagger documentation |
8,422 | private static ContextHandler buildContext ( String basePath ) { ResourceConfig resourceConfig = new ResourceConfig ( ) ; resourceConfig . packages ( QueryResource . class . getPackage ( ) . getName ( ) , ApiListingResource . class . getPackage ( ) . getName ( ) ) ; ServletContainer servletContainer = new ServletContainer ( resourceConfig ) ; ServletHolder entityBrowser = new ServletHolder ( servletContainer ) ; ServletContextHandler entityBrowserContext = new ServletContextHandler ( ServletContextHandler . SESSIONS ) ; entityBrowserContext . setContextPath ( basePath ) ; entityBrowserContext . addServlet ( entityBrowser , "/*" ) ; FilterHolder corsFilter = new FilterHolder ( CrossOriginFilter . class ) ; corsFilter . setAsyncSupported ( true ) ; corsFilter . setInitParameter ( CrossOriginFilter . ALLOWED_ORIGINS_PARAM , "*" ) ; corsFilter . setInitParameter ( CrossOriginFilter . ALLOWED_HEADERS_PARAM , "*" ) ; corsFilter . setInitParameter ( CrossOriginFilter . ACCESS_CONTROL_ALLOW_ORIGIN_HEADER , "*" ) ; corsFilter . setInitParameter ( CrossOriginFilter . ALLOWED_METHODS_PARAM , "GET,POST,HEAD,DELETE,PUT,OPTIONS" ) ; entityBrowserContext . addFilter ( corsFilter , "/*" , EnumSet . allOf ( DispatcherType . class ) ) ; return entityBrowserContext ; } | Adds resources to the context to be run on the server |
8,423 | public void stop ( ) throws Exception { DruidIndices . getInstance ( ) . remove ( String . valueOf ( port ) ) ; server . stop ( ) ; } | Stops the server and removes the index |
8,424 | public String getPmPackageId ( ) { StringBuilder sb = new StringBuilder ( ) ; if ( pm != null ) sb . append ( pm ) ; sb . append ( ":" ) ; if ( group != null ) sb . append ( group ) ; sb . append ( ":" ) ; if ( name != null ) sb . append ( name ) ; sb . append ( ":" ) ; if ( version != null ) sb . append ( version ) ; sb . append ( ":" ) ; return sb . toString ( ) ; } | Get a reasonable unique ID for the package including the package manager name . |
8,425 | public String getPackageId ( ) { StringBuilder sb = new StringBuilder ( ) ; if ( group != null ) sb . append ( group ) ; sb . append ( ":" ) ; if ( name != null ) sb . append ( name ) ; sb . append ( ":" ) ; if ( version != null ) sb . append ( version ) ; sb . append ( ":" ) ; return sb . toString ( ) ; } | Get a reasonable unique ID for the package . |
8,426 | protected String toSignMessageURI ( String uri ) { LoaEnum loa = LoaEnum . parse ( uri ) ; if ( loa == null ) { return null ; } if ( loa . isSignatureMessageUri ( ) ) { return uri ; } for ( LoaEnum l : LoaEnum . values ( ) ) { if ( l . getBaseUri ( ) . equals ( loa . getBaseUri ( ) ) && l . isSignatureMessageUri ( ) && l . isNotified ( ) == loa . isNotified ( ) ) { return l . getUri ( ) ; } } return null ; } | Given a base URI the method returns its corresponding sigmessage URI . |
8,427 | protected String toBaseURI ( String uri ) { LoaEnum loa = LoaEnum . parse ( uri ) ; if ( loa != null && loa . isSignatureMessageUri ( ) ) { return LoaEnum . minusSigMessage ( loa ) . getUri ( ) ; } return uri ; } | Given an URI its base form is returned . This means that the URI minus any potential sigmessage extension . |
8,428 | public void register ( ) throws ManagementException { try { DynamicMBean dynamicMBean = new IntrospectedDynamicMBean ( mBean ) ; mBeanServer . registerMBean ( dynamicMBean , mBeanObjectName ) ; } catch ( Exception e ) { throw new ManagementException ( e ) ; } } | Register the MXBean . If the registration fails a WARN message is logged |
8,429 | public void sync ( ) { if ( nextTick < 0 ) { throw new IllegalStateException ( "Timer was not started" ) ; } if ( tps <= 0 ) { return ; } try { for ( long time1 = getTime ( ) , time2 ; nextTick - time1 > sleepDurations . average ( ) ; time1 = time2 ) { Thread . sleep ( 1 ) ; sleepDurations . add ( ( time2 = getTime ( ) ) - time1 ) ; } sleepDurations . dampen ( ) ; for ( long time1 = getTime ( ) , time2 ; nextTick - time1 > yieldDurations . average ( ) ; time1 = time2 ) { Thread . yield ( ) ; yieldDurations . add ( ( time2 = getTime ( ) ) - time1 ) ; } } catch ( InterruptedException ignored ) { } nextTick = Math . max ( nextTick + 1000000000 / tps , getTime ( ) ) ; } | An accurate sync method that will attempt to run at the tps . It should be called once every tick . |
8,430 | public final void setBase ( int bx , int by , int bz ) { this . bx = bx ; this . by = by ; this . bz = bz ; } | Sets the base of the hash to the given values |
8,431 | public static synchronized AbstractApplicationContext getContext ( Class < ? > springConfigurationClass ) { if ( ! CONTEXTS . containsKey ( springConfigurationClass ) ) { AbstractApplicationContext context = new AnnotationConfigApplicationContext ( springConfigurationClass ) ; context . registerShutdownHook ( ) ; CONTEXTS . put ( springConfigurationClass , context ) ; } return CONTEXTS . get ( springConfigurationClass ) ; } | Get application context for configuration class . |
8,432 | private int getId ( int value ) throws PaletteFullException { short id = idLookup . get ( value ) ; if ( ! idLookup . isEmptyValue ( id ) ) { return id ; } else { id = ( short ) paletteCounter . getAndIncrement ( ) ; if ( id >= paletteSize ) { throw new PaletteFullException ( ) ; } short oldId = idLookup . putIfAbsent ( value , id ) ; if ( ! idLookup . isEmptyValue ( oldId ) ) { id = oldId ; } palette . set ( id , value ) ; return id ; } } | Gets the id for the given value allocating an id if required |
8,433 | public static boolean sdpHasVideo ( JSONObject sdp ) { boolean hasVideo = false ; if ( null != sdp ) { try { String sdpString = sdp . getString ( "sdp" ) ; hasVideo = sdpString . contains ( "m=video" ) ; } catch ( JSONException e ) { Log . d ( TAG , "ERROR: Incoming call appears to have an invalid SDP" ) ; } } return hasVideo ; } | Determines if the specified SDP data contains definitions for a video stream |
8,434 | private void commonConstructor ( RespokeSignalingChannel channel ) { signalingChannel = channel ; iceServers = new ArrayList < PeerConnection . IceServer > ( ) ; queuedLocalCandidates = new ArrayList < IceCandidate > ( ) ; queuedRemoteCandidates = new ArrayList < IceCandidate > ( ) ; collectedLocalCandidates = new ArrayList < IceCandidate > ( ) ; sessionID = Respoke . makeGUID ( ) ; timestamp = new Date ( ) ; queuedRemoteCandidatesSemaphore = new Semaphore ( 1 ) ; localCandidatesSemaphore = new Semaphore ( 1 ) ; if ( null != signalingChannel ) { RespokeSignalingChannel . Listener signalingChannelListener = signalingChannel . GetListener ( ) ; if ( null != signalingChannelListener ) { signalingChannelListener . callCreated ( this ) ; } } } | Common constructor logic |
8,435 | public void startCall ( final Context context , GLSurfaceView glView , boolean isAudioOnly ) { caller = true ; audioOnly = isAudioOnly ; if ( directConnectionOnly ) { if ( null == directConnection ) { actuallyAddDirectConnection ( ) ; } directConnectionDidAccept ( context ) ; } else { attachVideoRenderer ( glView ) ; getTurnServerCredentials ( new Respoke . TaskCompletionListener ( ) { public void onSuccess ( ) { Log . d ( TAG , "Got TURN credentials" ) ; initializePeerConnection ( context ) ; addLocalStreams ( context ) ; createOffer ( ) ; } public void onError ( String errorMessage ) { postErrorToListener ( errorMessage ) ; } } ) ; } } | Start the outgoing call process . This method is used internally by the SDK and should never be called directly from your client application |
8,436 | public void attachVideoRenderer ( GLSurfaceView glView ) { if ( null != glView ) { VideoRendererGui . setView ( glView , new Runnable ( ) { public void run ( ) { Log . d ( TAG , "VideoRendererGui GL Context ready" ) ; } } ) ; remoteRender = VideoRendererGui . create ( 0 , 0 , 100 , 100 , VideoRendererGui . ScalingType . SCALE_ASPECT_FILL , false ) ; localRender = VideoRendererGui . create ( 70 , 5 , 25 , 25 , VideoRendererGui . ScalingType . SCALE_ASPECT_FILL , false ) ; } } | Attach the call s video renderers to the specified GLSurfaceView |
8,437 | public void answer ( final Context context , Listener newListener ) { if ( ! caller ) { listenerReference = new WeakReference < Listener > ( newListener ) ; getTurnServerCredentials ( new Respoke . TaskCompletionListener ( ) { public void onSuccess ( ) { initializePeerConnection ( context ) ; addLocalStreams ( context ) ; processRemoteSDP ( ) ; } public void onError ( String errorMessage ) { postErrorToListener ( errorMessage ) ; } } ) ; } } | Answer the call and start the process of obtaining media . This method is called automatically on the caller s side . This method must be called on the callee s side to indicate that the endpoint does wish to accept the call . |
8,438 | public void hangup ( boolean shouldSendHangupSignal ) { if ( ! isHangingUp ) { isHangingUp = true ; if ( shouldSendHangupSignal ) { try { JSONObject data = new JSONObject ( "{'signalType':'bye','version':'1.0'}" ) ; data . put ( "target" , directConnectionOnly ? "directConnection" : "call" ) ; data . put ( "sessionId" , sessionID ) ; data . put ( "signalId" , Respoke . makeGUID ( ) ) ; final WeakReference < Listener > hangupListener = listenerReference ; if ( null != signalingChannel ) { signalingChannel . sendSignal ( data , toEndpointId , toConnection , toType , true , new Respoke . TaskCompletionListener ( ) { public void onSuccess ( ) { if ( null != hangupListener ) { new Handler ( Looper . getMainLooper ( ) ) . post ( new Runnable ( ) { public void run ( ) { Listener listener = hangupListener . get ( ) ; if ( null != listener ) { listener . onHangup ( RespokeCall . this ) ; } } } ) ; } } public void onError ( String errorMessage ) { postErrorToListener ( errorMessage ) ; } } ) ; } } catch ( JSONException e ) { postErrorToListener ( "Error encoding signal to json" ) ; } } disconnect ( ) ; } } | Tear down the call and release resources |
8,439 | public void muteVideo ( boolean mute ) { if ( ! audioOnly && ( null != localStream ) && ( isActive ( ) ) ) { for ( MediaStreamTrack eachTrack : localStream . videoTracks ) { eachTrack . setEnabled ( ! mute ) ; } } } | Mute or unmute the local video |
8,440 | public boolean videoIsMuted ( ) { boolean isMuted = true ; if ( ! audioOnly && ( null != localStream ) ) { for ( MediaStreamTrack eachTrack : localStream . videoTracks ) { if ( eachTrack . enabled ( ) ) { isMuted = false ; } } } return isMuted ; } | Indicates if the local video stream is muted |
8,441 | public void muteAudio ( boolean mute ) { if ( ( null != localStream ) && isActive ( ) ) { for ( MediaStreamTrack eachTrack : localStream . audioTracks ) { eachTrack . setEnabled ( ! mute ) ; } } } | Mute or unmute the local audio |
8,442 | public boolean audioIsMuted ( ) { boolean isMuted = true ; if ( null != localStream ) { for ( MediaStreamTrack eachTrack : localStream . audioTracks ) { if ( eachTrack . enabled ( ) ) { isMuted = false ; } } } return isMuted ; } | Indicates if the local audio stream is muted |
8,443 | public void hangupReceived ( ) { if ( ! isHangingUp ) { isHangingUp = true ; if ( null != listenerReference ) { final Listener listener = listenerReference . get ( ) ; new Handler ( Looper . getMainLooper ( ) ) . post ( new Runnable ( ) { public void run ( ) { if ( null != listener ) { listener . onHangup ( RespokeCall . this ) ; } } } ) ; } disconnect ( ) ; } } | Process a hangup message received from the remote endpoint . This is used internally to the SDK and should not be called directly by your client application . |
8,444 | public void answerReceived ( JSONObject remoteSDP , String remoteConnection ) { if ( isActive ( ) ) { incomingSDP = remoteSDP ; toConnection = remoteConnection ; try { JSONObject signalData = new JSONObject ( "{'signalType':'connected','version':'1.0'}" ) ; signalData . put ( "target" , directConnectionOnly ? "directConnection" : "call" ) ; signalData . put ( "connectionId" , toConnection ) ; signalData . put ( "sessionId" , sessionID ) ; signalData . put ( "signalId" , Respoke . makeGUID ( ) ) ; if ( null != signalingChannel ) { signalingChannel . sendSignal ( signalData , toEndpointId , toConnection , toType , false , new Respoke . TaskCompletionListener ( ) { public void onSuccess ( ) { if ( isActive ( ) ) { processRemoteSDP ( ) ; if ( null != listenerReference ) { final Listener listener = listenerReference . get ( ) ; if ( null != listener ) { new Handler ( Looper . getMainLooper ( ) ) . post ( new Runnable ( ) { public void run ( ) { if ( isActive ( ) ) { listener . onConnected ( RespokeCall . this ) ; } } } ) ; } } } } public void onError ( final String errorMessage ) { postErrorToListener ( errorMessage ) ; } } ) ; } } catch ( JSONException e ) { postErrorToListener ( "Error encoding answer signal" ) ; } } } | Process an answer message received from the remote endpoint . This is used internally to the SDK and should not be called directly by your client application . |
8,445 | public void connectedReceived ( ) { if ( null != listenerReference ) { final Listener listener = listenerReference . get ( ) ; if ( null != listener ) { new Handler ( Looper . getMainLooper ( ) ) . post ( new Runnable ( ) { public void run ( ) { if ( isActive ( ) ) { listener . onConnected ( RespokeCall . this ) ; } } } ) ; } } } | Process a connected messsage received from the remote endpoint . This is used internally to the SDK and should not be called directly by your client application . |
8,446 | public void iceCandidatesReceived ( JSONArray candidates ) { if ( isActive ( ) ) { for ( int ii = 0 ; ii < candidates . length ( ) ; ii ++ ) { try { JSONObject eachCandidate = ( JSONObject ) candidates . get ( ii ) ; String mid = eachCandidate . getString ( "sdpMid" ) ; int sdpLineIndex = eachCandidate . getInt ( "sdpMLineIndex" ) ; String sdp = eachCandidate . getString ( "candidate" ) ; IceCandidate rtcCandidate = new IceCandidate ( mid , sdpLineIndex , sdp ) ; try { queuedRemoteCandidatesSemaphore . acquire ( ) ; if ( null != queuedRemoteCandidates ) { queuedRemoteCandidates . add ( rtcCandidate ) ; } else { peerConnection . addIceCandidate ( rtcCandidate ) ; } queuedRemoteCandidatesSemaphore . release ( ) ; } catch ( InterruptedException e ) { Log . d ( TAG , "Error with remote candidates semaphore" ) ; } } catch ( JSONException e ) { Log . d ( TAG , "Error processing remote ice candidate data" ) ; } } } } | Process ICE candidates suggested by the remote endpoint . This is used internally to the SDK and should not be called directly by your client application . |
8,447 | public static int add ( int key , int x , int y , int z ) { int offset = key ( x , y , z ) ; return ( key + offset ) & mask ; } | Adds the given offset to the packed key |
8,448 | public static CStorageException buildCStorageException ( CResponse response , String message , CPath path ) { switch ( response . getStatus ( ) ) { case 401 : return new CAuthenticationException ( message , response ) ; case 404 : message = "No file found at URL " + shortenUrl ( response . getUri ( ) ) + " (" + message + ")" ; return new CFileNotFoundException ( message , path ) ; default : return new CHttpException ( message , response ) ; } } | Some common code between providers . Handles the different status codes and generates a nice exception |
8,449 | public static String abbreviate ( String source , int maxLen ) { if ( source == null || source . length ( ) <= maxLen ) { return source ; } return source . substring ( 0 , maxLen ) + "..." ; } | Abbreviate a string if longer than maxLen . |
8,450 | public static void downloadDataToSink ( CResponse response , ByteSink byteSink ) { InputStream is = null ; ByteSinkStream bss = null ; boolean success = false ; try { long contentLength = response . getContentLength ( ) ; if ( contentLength >= 0 ) { byteSink . setExpectedLength ( contentLength ) ; } long current = 0 ; is = response . openStream ( ) ; bss = byteSink . openStream ( ) ; byte [ ] buffer = new byte [ 8 * 1024 ] ; int len ; while ( ( len = is . read ( buffer ) ) != - 1 ) { current += len ; bss . write ( buffer , 0 , len ) ; } if ( contentLength < 0 ) { byteSink . setExpectedLength ( current ) ; } bss . flush ( ) ; bss . close ( ) ; bss = null ; success = true ; } catch ( IOException ex ) { throw new CStorageException ( ex . getMessage ( ) , ex ) ; } finally { if ( bss != null && ! success ) { bss . abort ( ) ; } PcsUtils . closeQuietly ( is ) ; PcsUtils . closeQuietly ( bss ) ; } } | Server has answered OK with a file to download as stream . |
8,451 | public static String randomString ( char [ ] values , int len ) { Random rnd = new SecureRandom ( ) ; StringBuilder sb = new StringBuilder ( len ) ; for ( int i = 0 ; i < len ; i ++ ) { sb . append ( values [ rnd . nextInt ( values . length ) ] ) ; } return sb . toString ( ) ; } | Generate a random String |
8,452 | public final Span [ ] seqToSpans ( final String [ ] tokens ) { final Span [ ] annotatedText = this . sequenceLabeler . tag ( tokens ) ; final List < Span > probSpans = new ArrayList < Span > ( Arrays . asList ( annotatedText ) ) ; return probSpans . toArray ( new Span [ probSpans . size ( ) ] ) ; } | Get array of Spans from a list of tokens . |
8,453 | private Set < TableEntry > search ( final ProtoNetwork pn , String ... literals ) { Set < TableEntry > ret ; if ( noItems ( literals ) ) { return emptySet ( ) ; } ret = new HashSet < TableEntry > ( ) ; final ParameterTable paramTbl = pn . getParameterTable ( ) ; final TermTable termTbl = pn . getTermTable ( ) ; final List < String > terms = termTbl . getTermValues ( ) ; final NamespaceTable nsTbl = pn . getNamespaceTable ( ) ; final int [ ] [ ] indata = pn . getTermIndices ( ) ; final Set < String > literalSet = constrainedHashSet ( literals . length ) ; for ( final String s : literals ) { literalSet . add ( s ) ; } for ( int i = 0 ; i < indata . length ; i ++ ) { int tid = indata [ i ] [ TERM_INDEX ] ; String string = terms . get ( tid ) ; if ( ! literalSet . contains ( string ) ) { continue ; } int pid = indata [ i ] [ PARAM_INDEX ] ; final TableParameter tp = paramTbl . getTableParameter ( pid ) ; final String inval = tp . getValue ( ) ; int nid = indata [ i ] [ NAMESPACE_INDEX ] ; final TableNamespace tns = nsTbl . getTableNamespace ( nid ) ; String inrl = null ; if ( tns != null ) inrl = tns . getResourceLocation ( ) ; final TableEntry te = new TableEntry ( inval , inrl ) ; ret . add ( te ) ; } return ret ; } | Aggregate the set of all table entries for a proto - network that match at least one of the provided term literals . |
8,454 | private static boolean validParameter ( final Parameter p ) { if ( p . getNamespace ( ) == null ) { return false ; } if ( p . getValue ( ) == null ) { return false ; } return true ; } | Returns true if the parameter has a namespace and value false if not . |
8,455 | private static boolean validParameter ( final TableParameter tp ) { if ( tp . getNamespace ( ) == null ) { return false ; } if ( tp . getValue ( ) == null ) { return false ; } return true ; } | Returns true if the table parameter has a namespace and value false if not . |
8,456 | protected final List < String > getExtraneousArguments ( ) { if ( commandLine == null ) { return emptyList ( ) ; } String [ ] args = commandLine . getArgs ( ) ; if ( noItems ( args ) ) { return emptyList ( ) ; } return asList ( args ) ; } | Returns the extraneous command - line arguments . |
8,457 | protected final void printApplicationInfo ( final String applicationName ) { final StringBuilder bldr = new StringBuilder ( ) ; bldr . append ( "\n" ) ; bldr . append ( BELFrameworkVersion . VERSION_LABEL ) . append ( ": " ) . append ( applicationName ) . append ( "\n" ) ; bldr . append ( "Copyright (c) 2011-2012, Selventa. All Rights Reserved.\n" ) ; bldr . append ( "\n" ) ; reportable . output ( bldr . toString ( ) ) ; } | Prints out application information . |
8,458 | public void printUsage ( final OutputStream os ) { final StringBuilder bldr = new StringBuilder ( ) ; bldr . append ( "Usage: " ) ; bldr . append ( getUsage ( ) ) ; bldr . append ( "\n" ) ; bldr . append ( "Try '--help' for more information.\n" ) ; PrintWriter pw = new PrintWriter ( os ) ; pw . write ( bldr . toString ( ) ) ; pw . close ( ) ; } | Prints usage information to the provided output stream . |
8,459 | public static String normalize ( final String token ) { String normalizedToken = "" ; char currentCharacter ; int prevCharType = - 1 ; char charType = '~' ; boolean addedStar = false ; for ( int i = 0 ; i < token . length ( ) ; i ++ ) { currentCharacter = token . charAt ( i ) ; if ( currentCharacter >= 'A' && currentCharacter <= 'Z' ) { charType = 'X' ; } else if ( currentCharacter >= 'a' && currentCharacter <= 'z' ) { charType = 'x' ; } else if ( currentCharacter >= '0' && currentCharacter <= '9' ) { charType = 'd' ; } else { charType = currentCharacter ; } if ( charType == prevCharType ) { if ( ! addedStar ) { normalizedToken += "*" ; addedStar = true ; } } else { addedStar = false ; normalizedToken += charType ; } prevCharType = charType ; } return normalizedToken ; } | Normalize upper case lower case digits and duplicate characters . |
8,460 | public Element cloneSvgElement ( Element source ) { if ( source == null || source . getNodeName ( ) == null ) { return null ; } if ( "#text" . equals ( source . getNodeName ( ) ) ) { return Document . get ( ) . createTextNode ( source . getNodeValue ( ) ) . cast ( ) ; } Element clone = createElementNS ( Dom . NS_SVG , source . getNodeName ( ) , Dom . createUniqueId ( ) ) ; cloneAttributes ( source , clone ) ; for ( int i = 0 ; i < source . getChildCount ( ) ; i ++ ) { Element child = source . getChild ( i ) . cast ( ) ; clone . appendChild ( cloneSvgElement ( child ) ) ; } return clone ; } | Clone a single SVG element . |
8,461 | public Tag getTagByName ( String name ) { Tag t = this . tags . get ( name ) ; if ( null == t ) { t = new Tag ( name , this . workspace . getId ( ) , "" ) ; this . tags . put ( name , t ) ; } return t ; } | Gets an existing tag by name |
8,462 | public String getReport ( ) { return "Report\n - Created " + newComponents . size ( ) + " components\n - Updated " + this . updatedComponentCount + " components\n - Created " + newRefs . size ( ) + " references\n - Updated " + this . updatedRefCount + " references\n - Deleted " + this . deletedComponents + " components\n - Deleted " + this . deletedRefs + " references" ; } | Returns an update report with statistics of created updated and deleted references and components . |
8,463 | private static FunctionEnum function ( final String s ) { String [ ] args = ARGS_REGEX . split ( s ) ; return getFunctionEnum ( args [ 0 ] ) ; } | Returns the function enum for the provided string . |
8,464 | private static ReturnType returnType ( final String s ) { String [ ] args = ARGS_REGEX . split ( s ) ; return ReturnType . getReturnType ( args [ args . length - 1 ] ) ; } | Returns the return type for the provided string . |
8,465 | private static String countArgs ( final String s ) { String [ ] args = ARGS_REGEX . split ( s ) ; if ( "" . equals ( args [ 1 ] ) ) return "0" ; String [ ] argarray = args [ 1 ] . split ( "," ) ; for ( final String arg : argarray ) if ( arg . contains ( VARARGS_SUFFIX ) ) return "1 or more" ; return valueOf ( argarray . length ) ; } | Returns the number of arguments for the provided string . |
8,466 | public static Properties setTokenizeProperties ( final String lang , final String normalize , final String untokenizable , final String hardParagraph ) { final Properties annotateProperties = new Properties ( ) ; annotateProperties . setProperty ( "language" , lang ) ; annotateProperties . setProperty ( "normalize" , normalize ) ; annotateProperties . setProperty ( "untokenizable" , untokenizable ) ; annotateProperties . setProperty ( "hardParagraph" , hardParagraph ) ; return annotateProperties ; } | Creates the Properties object required to construct a Sentence Segmenter and a Tokenizer . |
8,467 | public static Properties setPOSLemmaProperties ( final String model , final String lemmatizerModel , final String language , final String multiwords , final String dictag , final String allMorphology ) { final Properties annotateProperties = new Properties ( ) ; annotateProperties . setProperty ( "model" , model ) ; annotateProperties . setProperty ( "lemmatizerModel" , lemmatizerModel ) ; annotateProperties . setProperty ( "language" , language ) ; annotateProperties . setProperty ( "multiwords" , multiwords ) ; annotateProperties . setProperty ( "dictag" , dictag ) ; annotateProperties . setProperty ( "allMorphology" , allMorphology ) ; return annotateProperties ; } | Generate Properties object for POS tagging and Lemmatizing . Language model and lemmatizerModel are compulsory . |
8,468 | public Properties setChunkingProperties ( final String model , final String language ) { final Properties annotateProperties = new Properties ( ) ; annotateProperties . setProperty ( "model" , model ) ; annotateProperties . setProperty ( "language" , language ) ; return annotateProperties ; } | Generate Properties object for chunking . Both parameters are compulsory . |
8,469 | public final ParserModel train ( final TrainingParameters params , final TrainingParameters taggerParams , final TrainingParameters chunkerParams ) { if ( getParserFactory ( ) == null ) { throw new IllegalStateException ( "The ParserFactory must be instantiated!!" ) ; } if ( getTaggerFactory ( ) == null ) { throw new IllegalStateException ( "The TaggerFactory must be instantiated!" ) ; } ParserModel trainedModel = null ; ParserEvaluator parserEvaluator = null ; try { trainedModel = ShiftReduceParser . train ( this . lang , this . trainSamples , this . rules , params , this . parserFactory , taggerParams , this . taggerFactory , chunkerParams , this . chunkerFactory ) ; final ShiftReduceParser parser = new ShiftReduceParser ( trainedModel ) ; parserEvaluator = new ParserEvaluator ( parser ) ; parserEvaluator . evaluate ( this . testSamples ) ; } catch ( final IOException e ) { System . err . println ( "IO error while loading training and test sets!" ) ; e . printStackTrace ( ) ; System . exit ( 1 ) ; } System . out . println ( "Final Result: \n" + parserEvaluator . getFMeasure ( ) ) ; return trainedModel ; } | Train a parser model from the Treebank data . |
8,470 | public final ParserModel train ( final TrainingParameters params , final InputStream taggerModel , final TrainingParameters chunkerParams ) { if ( getParserFactory ( ) == null ) { throw new IllegalStateException ( "The ParserFactory must be instantiated!!" ) ; } SequenceLabelerModel posModel = null ; try { posModel = new SequenceLabelerModel ( taggerModel ) ; } catch ( final IOException e1 ) { e1 . printStackTrace ( ) ; } ParserModel trainedModel = null ; ParserEvaluator parserEvaluator = null ; try { trainedModel = ShiftReduceParser . train ( this . lang , this . trainSamples , this . rules , params , this . parserFactory , posModel , chunkerParams , this . chunkerFactory ) ; final ShiftReduceParser parser = new ShiftReduceParser ( trainedModel ) ; parserEvaluator = new ParserEvaluator ( parser ) ; parserEvaluator . evaluate ( this . testSamples ) ; } catch ( final IOException e ) { System . err . println ( "IO error while loading training and test sets!" ) ; e . printStackTrace ( ) ; System . exit ( 1 ) ; } System . out . println ( "Final Result: \n" + parserEvaluator . getFMeasure ( ) ) ; return trainedModel ; } | Train a parser model providing an already trained POS tagger . |
8,471 | public final String getSequenceCodec ( ) { String seqCodec = null ; if ( "BIO" . equals ( this . sequenceCodec ) ) { seqCodec = BioCodec . class . getName ( ) ; } else if ( "BILOU" . equals ( this . sequenceCodec ) ) { seqCodec = BilouCodec . class . getName ( ) ; } return seqCodec ; } | Get the Sequence codec . |
8,472 | public static ExpectedCondition < WebElement > visibilityOfOneOfElementsLocatedBy ( final By locator ) { return new ExpectedCondition < WebElement > ( ) { public WebElement apply ( WebDriver driver ) { for ( WebElement element : driver . findElements ( locator ) ) { if ( element . isDisplayed ( ) ) { return element ; } } return null ; } public String toString ( ) { return "visibility of one of the elements located by " + locator ; } } ; } | An expectation for checking that at least one of the elements matching the locator is visible . |
8,473 | private String parseRegularExpression ( File annotationCacheCopy , long characterOffset ) throws IOException { BufferedReader reader = null ; try { reader = new BufferedReader ( new FileReader ( annotationCacheCopy ) ) ; reader . skip ( characterOffset ) ; return reader . readLine ( ) ; } finally { if ( reader != null ) { try { reader . close ( ) ; } catch ( Exception e ) { } } } } | Reads the first line after the annotation header as a regular expression for the annotation definition . |
8,474 | public static byte [ ] computeSha256 ( final byte [ ] data ) { try { return MessageDigest . getInstance ( ALGORITHM_SHA_256 ) . digest ( data ) ; } catch ( NoSuchAlgorithmException e ) { throw new IllegalStateException ( "unsupported algorithm for message digest: " , e ) ; } } | Calculate the message digest value with SHA 256 algorithm . |
8,475 | public Filter convert ( Criterion criterionDto , List < AttributeDescriptor > schema ) { FilterContext fc = new FilterContext ( ) ; fc . setSchema ( schema ) ; criterionDto . accept ( this , fc ) ; try { log . debug ( "Filter converted : " + ECQL . toCQL ( fc . getFilter ( ) ) ) ; } catch ( Exception e ) { } return fc . getFilter ( ) ; } | Convert a criterion to a filter . |
8,476 | public List < Parameter > getAllParameters ( ) { List < Parameter > ret = new ArrayList < Parameter > ( ) ; ret . addAll ( subject . getAllParameters ( ) ) ; if ( object != null ) { if ( object . getStatement ( ) != null ) ret . addAll ( object . getStatement ( ) . getAllParameters ( ) ) ; else ret . addAll ( object . getTerm ( ) . getAllParameters ( ) ) ; } return ret ; } | Returns a list of all parameters contained by this statement and object . |
8,477 | public List < Term > getAllTerms ( ) { List < Term > ret = new ArrayList < Term > ( ) ; ret . add ( subject ) ; List < Term > subjectTerms = subject . getTerms ( ) ; if ( subjectTerms != null ) { ret . addAll ( subjectTerms ) ; for ( final Term term : subjectTerms ) { ret . addAll ( term . getAllTerms ( ) ) ; } } if ( object != null ) { ret . addAll ( object . getAllTerms ( ) ) ; } return ret ; } | Returns a list of all terms contained by this statement s subject and object . |
8,478 | private double calculateBufferFromPixelTolerance ( ) { Coordinate c1 = mapPresenter . getViewPort ( ) . getTransformationService ( ) . transform ( new Coordinate ( 0 , 0 ) , RenderSpace . SCREEN , RenderSpace . WORLD ) ; Coordinate c2 = mapPresenter . getViewPort ( ) . getTransformationService ( ) . transform ( new Coordinate ( pixelBuffer , 0 ) , RenderSpace . SCREEN , RenderSpace . WORLD ) ; return c1 . distance ( c2 ) ; } | Calculate a buffer in which the listener may include the features from the map . |
8,479 | private boolean isDownPosition ( HumanInputEvent < ? > event ) { if ( clickedPosition != null ) { Coordinate location = getLocation ( event , RenderSpace . SCREEN ) ; if ( MathService . distance ( clickedPosition , location ) < clickDelta ) { return true ; } } return false ; } | Is the event at the same location as the down event? |
8,480 | public byte [ ] read ( long record ) throws IOException { long pos = record * recordSize + recordSize ; if ( pos >= size ) { final String fmt = "bad seek to position: %d (size is %d)" ; final String msg = format ( fmt , pos , size ) ; throw new InvalidArgument ( msg ) ; } raf . seek ( pos ) ; byte [ ] ret = new byte [ recordSize ] ; int read = raf . read ( ret ) ; if ( read != recordSize ) { final String fmt = "read %d bytes, but expected %d" ; final String msg = format ( fmt , read , recordSize ) ; throw new InvalidArgument ( msg ) ; } return ret ; } | Reads a record from this record file . |
8,481 | public void read ( long record , byte [ ] bytes ) throws IOException { if ( bytes . length != recordSize ) { final String fmt = "invalid buffer length of %d bytes, expected %d" ; final String msg = format ( fmt , bytes . length , recordSize ) ; throw new InvalidArgument ( msg ) ; } long pos = record * recordSize + recordSize ; if ( pos >= size ) { final String fmt = "bad seek to position: %d (size is %d)" ; final String msg = format ( fmt , pos , size ) ; throw new InvalidArgument ( msg ) ; } raf . seek ( pos ) ; int read = raf . read ( bytes ) ; if ( read != recordSize ) { final String fmt = "read %d bytes, but expected %d" ; final String msg = format ( fmt , read , recordSize ) ; throw new InvalidArgument ( msg ) ; } } | Reads a record from this record file into the provided byte buffer . |
8,482 | public byte [ ] read ( long record , int column ) throws IOException { long pos = record * recordSize + recordSize ; int i = 0 ; for ( ; i < column ; i ++ ) { pos += columns [ i ] . size ; } if ( pos >= size ) { final String fmt = "bad seek to position: %d (size is %d)" ; final String msg = format ( fmt , pos , size ) ; throw new InvalidArgument ( msg ) ; } Column < ? > c = columns [ i - 1 ] ; raf . seek ( pos ) ; byte [ ] ret = new byte [ c . size ] ; int read = raf . read ( ret ) ; if ( read != c . size ) { final String fmt = "read %d bytes, but expected %d" ; final String msg = format ( fmt , read , c . size ) ; throw new IOException ( msg ) ; } return ret ; } | Reads a record for a specific columns from this record file . |
8,483 | public void write ( long record , byte [ ] bytes ) throws IOException { if ( readonly ) { throw new UnsupportedOperationException ( RO_MSG ) ; } if ( bytes . length != recordSize ) { final String fmt = "invalid write of %d bytes, expected %d" ; final String msg = format ( fmt , bytes . length , recordSize ) ; throw new InvalidArgument ( msg ) ; } long pos = record * recordSize + recordSize ; if ( pos >= size ) { final String fmt = "bad seek to position: %d (size is %d)" ; final String msg = format ( fmt , pos , size ) ; throw new InvalidArgument ( msg ) ; } raf . seek ( pos ) ; raf . write ( bytes ) ; } | Writes a record to this record file overwriting the previous contents . |
8,484 | public void write ( long record , int column , byte [ ] bytes ) throws IOException { if ( readonly ) { throw new UnsupportedOperationException ( RO_MSG ) ; } long pos = record * recordSize + recordSize ; int i = 0 ; for ( ; i < column ; i ++ ) { pos += columns [ i ] . size ; } if ( pos >= size ) { final String fmt = "bad seek to position: %d (size is %d)" ; final String msg = format ( fmt , pos , size ) ; throw new InvalidArgument ( msg ) ; } Column < ? > c = columns [ i ] ; if ( bytes . length != c . size ) { final String fmt = "invalid write of %d bytes, expected %d" ; final String msg = format ( fmt , bytes . length , c . size ) ; throw new InvalidArgument ( msg ) ; } raf . seek ( pos ) ; raf . write ( bytes ) ; } | Writes a record for a specific column to this record file overwriting the previous contents . |
8,485 | public void writeMetadata ( byte [ ] bytes ) throws IOException { if ( readonly ) { throw new UnsupportedOperationException ( RO_MSG ) ; } if ( bytes . length != recordSize ) { final String fmt = "invalid write of %d bytes, expected %d" ; final String msg = format ( fmt , bytes . length , recordSize ) ; throw new InvalidArgument ( msg ) ; } raf . seek ( 0 ) ; raf . write ( bytes ) ; } | Writes metadata to this record file overwriting existing metadata . |
8,486 | public static void exportKam ( final Kam kam , final KAMStore kAMStore , String outputPath ) throws KAMStoreException , FileNotFoundException { if ( nulls ( kam , kAMStore , outputPath ) ) { throw new InvalidArgument ( "argument(s) were null" ) ; } PrintWriter writer = new PrintWriter ( outputPath ) ; XGMMLUtility . writeStart ( kam . getKamInfo ( ) . getName ( ) , writer ) ; for ( KamNode kamNode : kam . getNodes ( ) ) { Node xNode = new Node ( ) ; xNode . id = kamNode . getId ( ) ; xNode . label = kamNode . getLabel ( ) ; xNode . function = kamNode . getFunctionType ( ) ; List < BelTerm > supportingTerms = kAMStore . getSupportingTerms ( kamNode ) ; XGMMLUtility . writeNode ( xNode , supportingTerms , writer ) ; } for ( KamEdge kamEdge : kam . getEdges ( ) ) { Edge xEdge = new Edge ( ) ; xEdge . id = kamEdge . getId ( ) ; xEdge . rel = kamEdge . getRelationshipType ( ) ; KamNode knsrc = kamEdge . getSourceNode ( ) ; KamNode kntgt = kamEdge . getTargetNode ( ) ; xEdge . source = knsrc . getId ( ) ; xEdge . target = kntgt . getId ( ) ; Node src = new Node ( ) ; src . function = knsrc . getFunctionType ( ) ; src . label = knsrc . getLabel ( ) ; Node tgt = new Node ( ) ; tgt . function = kntgt . getFunctionType ( ) ; tgt . label = kntgt . getLabel ( ) ; XGMMLUtility . writeEdge ( src , tgt , xEdge , writer ) ; } XGMMLUtility . writeEnd ( writer ) ; writer . close ( ) ; } | Export KAM to XGMML format using the KAM API . |
8,487 | private void add ( final List < String > arguments , final Collection < String > argumentsToAdd ) { if ( argumentsToAdd != null && argumentsToAdd . size ( ) > 0 ) { arguments . addAll ( argumentsToAdd ) ; } } | Adds a collection of arguments to a list of arguments by skipping null arguments . |
8,488 | private void add ( final List < String > arguments , final String argument ) { if ( argument != null && argument . trim ( ) . length ( ) > 0 ) { arguments . add ( argument ) ; } } | Adds an argumentto a list of arguments by skipping null or empty arguments . |
8,489 | private Collection < String > defaultArguments ( ) { final List < String > arguments = new ArrayList < String > ( ) ; arguments . add ( "--noConsole" ) ; arguments . add ( "--noDownloadFeedback" ) ; if ( ! argsSetManually ) { arguments . add ( "--noArgs" ) ; } String folder = System . getProperty ( "java.io.tmpdir" ) + "/paxexam_runner_" + System . getProperty ( "user.name" ) ; arguments . add ( "--workingDirectory=" + createWorkingDirectory ( folder ) . getAbsolutePath ( ) ) ; return arguments ; } | Returns a collection of default Pax Runner arguments . |
8,490 | public void supportsFeatures ( String baseUrl , WmsService . WmsVersion version , final String typeName , final Callback < WfsFeatureTypeDescriptionInfo , String > callback ) { wmsService . describeLayer ( baseUrl , typeName , version , new Callback < WmsDescribeLayerInfo , String > ( ) { public void onSuccess ( WmsDescribeLayerInfo describeLayerInfo ) { String wfsUrl = null ; for ( WmsLayerDescriptionInfo layerDescription : describeLayerInfo . getLayerDescriptions ( ) ) { if ( layerDescription . getWfs ( ) != null ) { wfsUrl = layerDescription . getWfs ( ) ; break ; } else if ( layerDescription . getOwsType ( ) == WmsLayerDescriptionInfo . WFS ) { wfsUrl = layerDescription . getOwsUrl ( ) ; break ; } } if ( wfsUrl != null ) { WfsServerExtension . getInstance ( ) . getWfsService ( ) . describeFeatureType ( WfsVersion . V1_0_0 , wfsUrl , typeName , callback ) ; } else { callback . onFailure ( "No WFS in layer description" ) ; } } public void onFailure ( String reason ) { callback . onFailure ( reason ) ; } } ) ; } | Find out if a certain WMS layer has support for features through WFS . If successful the WFS configuration will be returned . |
8,491 | public < T > void setHintValue ( Hint < T > hint , T value ) { if ( value == null ) { throw new IllegalArgumentException ( "Null value passed." ) ; } hintValues . put ( hint , value ) ; } | Apply a new value for a specific WMS hint . |
8,492 | private synchronized Swift getSwiftClient ( ) throws CStorageException { if ( swiftClient != null ) { return swiftClient ; } String url = ENDPOINT + "/account/credentials" ; RequestInvoker < CResponse > ri = getApiRequestInvoker ( new HttpGet ( url ) ) ; JSONObject info = retryStrategy . invokeRetry ( ri ) . asJSONObject ( ) ; swiftClient = new Swift ( info . getString ( "endpoint" ) , info . getString ( "token" ) , new NoRetryStrategy ( ) , true , httpExecutor ) ; swiftClient . useFirstContainer ( ) ; return swiftClient ; } | Return current swift client or create one if none exists yet . The internal swift client does NOT retry its requests . Retries are performed by this class . |
8,493 | public Bbox getBounds ( ) { double w = mapWidth * getResolution ( ) ; double h = mapHeight * getResolution ( ) ; double x = getPosition ( ) . getX ( ) - w / 2 ; double y = getPosition ( ) . getY ( ) - h / 2 ; return new Bbox ( x , y , w , h ) ; } | Given the information in this ViewPort object what is the currently visible area? This value is expressed in world coordinates . |
8,494 | public Parse cloneRoot ( final Parse node , final int parseIndex ) { final Parse c = ( Parse ) this . clone ( ) ; final Parse fc = c . parts . get ( parseIndex ) ; c . parts . set ( parseIndex , fc . clone ( node ) ) ; return c ; } | Clones the right frontier of this root parse up to and including the specified node . |
8,495 | public void addPreviousPunctuation ( final Parse punct ) { if ( this . prevPunctSet == null ) { this . prevPunctSet = new TreeSet < Parse > ( ) ; } this . prevPunctSet . add ( punct ) ; } | Designates that the specified punctuation should is prior to this parse . |
8,496 | public void addNextPunctuation ( final Parse punct ) { if ( this . nextPunctSet == null ) { this . nextPunctSet = new TreeSet < Parse > ( ) ; } this . nextPunctSet . add ( punct ) ; } | Designates that the specified punctuation follows this parse . |
8,497 | public void show ( ) { final StringBuffer sb = new StringBuffer ( this . text . length ( ) * 4 ) ; show ( sb ) ; System . out . println ( sb ) ; } | Displays this parse using Penn Treebank - style formatting . |
8,498 | public double getTagSequenceProb ( ) { if ( this . parts . size ( ) == 1 && this . parts . get ( 0 ) . type . equals ( ShiftReduceParser . TOK_NODE ) ) { return Math . log ( this . prob ) ; } else if ( this . parts . size ( ) == 0 ) { System . err . println ( "Parse.getTagSequenceProb: Wrong base case!" ) ; return 0.0 ; } else { double sum = 0.0 ; for ( final Parse parse : this . parts ) { sum += parse . getTagSequenceProb ( ) ; } return sum ; } } | Returns the probability associated with the pos - tag sequence assigned to this parse . |
8,499 | public void setChild ( final int index , final String label ) { final Parse newChild = ( Parse ) this . parts . get ( index ) . clone ( ) ; newChild . setLabel ( label ) ; this . parts . set ( index , newChild ) ; } | Replaces the child at the specified index with a new child with the specified label . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.