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 pro...
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 . getSubjectBui...
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 locall...
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 sto...
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" , mess...
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 ( callLi...
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 ) && !...
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 , timest...
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 { thr...
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" ) ; ...
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 ServletContai...
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 ) ; ...
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 ( ) &&...
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 ( )...
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 ( ) ; CONTE...
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 ...
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 h...
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 Arra...
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 ) ; g...
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 ...
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 ...
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" ...
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...
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 ? "directCo...
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 ( "sdpM...
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...
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 ; ...
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 L...
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, Selv...
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 ...
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' && currentCh...
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 , ...
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...
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 ...
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" , n...
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 ) ; an...
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 I...
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 = n...
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 ; }...
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 ...
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 ...
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 . ...
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 ( ...
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 Coo...
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 [ ...
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 + reco...
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 ) ...
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...
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 = "b...
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 Inval...
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 . wr...
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" ) +...
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 ( WmsDes...
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 ) . asJSONObje...
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 ...
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 .