idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
10,500 | public void createNewSecurityDomain ( String securityDomainName , LoginModuleRequest ... loginModules ) throws Exception { CoreJBossASClient coreClient = new CoreJBossASClient ( getModelControllerClient ( ) ) ; String serverVersion = coreClient . getAppServerVersion ( ) ; if ( serverVersion . startsWith ( "7.2" ) ) { c... | Creates a new security domain including one or more login modules . The security domain will be replaced if it exists . |
10,501 | public boolean securityDomainHasLoginModule ( String domainName , String moduleName ) throws Exception { Address addr = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_SECURITY , SECURITY_DOMAIN , domainName ) ; addr . add ( AUTHENTICATION , CLASSIC ) ; addr . add ( LOGIN_MODULE , moduleName ) ; ModelNode request = cr... | Check if a certain login module is present inside the passed security domain |
10,502 | private static < L > void populateMetricTypesForResourceType ( ResourceType . Builder < ? , L > resourceTypeBuilder , TypeSets . Builder < L > typeSetsBuilder ) { Map < Name , TypeSet < MetricType < L > > > metricTypeSets = typeSetsBuilder . getMetricTypeSets ( ) ; List < Name > metricSetNames = resourceTypeBuilder . g... | Given a resource type builder this will fill in its metric types . |
10,503 | public < N , S extends Session < L > > void discoverChildren ( Resource < L > parent , ResourceType < L > childType , Session < L > session , EndpointService < L , S > service , Consumer < Resource < L > > resourceConsumer ) { try { L parentLocation = parent != null ? parent . getLocation ( ) : null ; log . debugf ( "D... | Discovers children of the given type underneath the given parent . |
10,504 | public void doScrape ( ) throws Exception { MBeanServerConnection beanConn ; JMXConnector jmxc = null ; if ( jmxUrl . isEmpty ( ) ) { beanConn = ManagementFactory . getPlatformMBeanServer ( ) ; } else { Map < String , Object > environment = new HashMap < String , Object > ( ) ; if ( username != null && username . lengt... | Get a list of mbeans on host_port and scrape their values . |
10,505 | public boolean isCacheContainer ( String cacheContainerName ) throws Exception { Address addr = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_INFINISPAN ) ; String haystack = CACHE_CONTAINER ; return null != findNodeInList ( addr , haystack , cacheContainerName ) ; } | Checks to see if there is already a cache container with the given name . |
10,506 | public boolean isLocalCache ( String cacheContainerName , String localCacheName ) throws Exception { if ( ! isCacheContainer ( cacheContainerName ) ) { return false ; } Address addr = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_INFINISPAN , CACHE_CONTAINER , cacheContainerName ) ; String haystack = LOCAL_CACHE ; r... | Checks to see if there is already a local cache with the given name . |
10,507 | public boolean isJDBCDriver ( String jdbcDriverName ) throws Exception { Address addr = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_DATASOURCES ) ; String haystack = JDBC_DRIVER ; return null != findNodeInList ( addr , haystack , jdbcDriverName ) ; } | Checks to see if there is already a JDBC driver with the given name . |
10,508 | public boolean isDatasource ( String datasourceName ) throws Exception { Address addr = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_DATASOURCES ) ; String haystack = DATA_SOURCE ; return null != findNodeInList ( addr , haystack , datasourceName ) ; } | Checks to see if there is already a datasource with the given name . |
10,509 | public boolean isXADatasource ( String datasourceName ) throws Exception { Address addr = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_DATASOURCES ) ; String haystack = XA_DATA_SOURCE ; return null != findNodeInList ( addr , haystack , datasourceName ) ; } | Checks to see if there is already a XA datasource with the given name . |
10,510 | public ModelNode createNewDatasourceRequest ( String name , int blockingTimeoutWaitMillis , String connectionUrlExpression , String driverName , String exceptionSorterClassName , int idleTimeoutMinutes , boolean jta , int minPoolSize , int maxPoolSize , int preparedStatementCacheSize , String securityDomain , String st... | Returns a ModelNode that can be used to create a datasource . Callers are free to tweak the datasource request that is returned if they so choose before asking the client to execute the request . |
10,511 | public void add ( EndpointService < L , S > newEndpointService ) { if ( newEndpointService == null ) { throw new IllegalArgumentException ( "New endpoint service must not be null" ) ; } synchronized ( this . inventoryListeners ) { for ( InventoryListener listener : this . inventoryListeners ) { newEndpointService . add... | This will add a new endpoint service to the list . Once added the new service will immediately be started . |
10,512 | public void remove ( String name ) { EndpointService < L , S > service = endpointServices . remove ( name ) ; if ( service != null ) { service . stop ( ) ; log . infoRemovedEndpointService ( service . toString ( ) ) ; } } | This will stop the given endpoint service and remove it from the list of endpoint services . |
10,513 | public WebSocketCall createWebSocketCall ( String url , Map < String , String > headers ) { String base64Credentials = buildBase64Credentials ( ) ; Request . Builder requestBuilder = new Request . Builder ( ) . url ( url ) . addHeader ( "Authorization" , "Basic " + base64Credentials ) . addHeader ( "Accept" , "applicat... | Creates a websocket that connects to the given URL . |
10,514 | public void stopHawkularAgent ( ) { synchronized ( agentServiceStatus ) { if ( agentServiceStatus . get ( ) == ServiceStatus . STOPPED ) { log . infoStoppedAlready ( ) ; return ; } else if ( agentServiceStatus . get ( ) == ServiceStatus . STOPPING ) { while ( agentServiceStatus . get ( ) == ServiceStatus . STOPPING ) {... | Stops this service . If the service is already stopped this method is a no - op . |
10,515 | private void startStorageAdapter ( ) throws Exception { this . storageAdapter = new HawkularStorageAdapter ( ) ; this . storageAdapter . initialize ( feedId , configuration . getStorageAdapter ( ) , diagnostics , httpClientBuilder ) ; inventoryStorageProxy . setStorageAdapter ( storageAdapter ) ; this . diagnosticsRepo... | Creates and starts the storage adapter that will be used to store our inventory data and monitoring data . |
10,516 | public static < L > Builder < L > builder ( Resource < L > template ) { return new Builder < L > ( template ) ; } | Creates a builder with the given resource as a starting template . You can use this to clone a resource as well as build a resource that looks similar to the given template resource . |
10,517 | public AddResult < L > addResource ( Resource < L > newResource ) throws IllegalArgumentException { AddResult < L > result ; graphLockWrite . lock ( ) ; try { if ( newResource . getParent ( ) != null ) { Resource < L > parentInGraph = getResource ( newResource . getParent ( ) . getID ( ) ) ; if ( parentInGraph == null ... | Adds the given resource to the resource hierarchy replacing the resource if it already exist but has changed . |
10,518 | public Resource < L > getParent ( Resource < L > resource ) { graphLockRead . lock ( ) ; try { Set < Resource < L > > directParents = neighborIndex . predecessorsOf ( resource ) ; if ( directParents . isEmpty ( ) ) { return null ; } return directParents . iterator ( ) . next ( ) ; } finally { graphLockRead . unlock ( )... | Returns the direct parent of the given resource . This examines the internal hierarchical graph to determine parentage . |
10,519 | private void getAllDescendants ( Resource < L > parent , List < Resource < L > > descendants ) { for ( Resource < L > child : getChildren ( parent ) ) { if ( ! descendants . contains ( child ) ) { getAllDescendants ( child , descendants ) ; descendants . add ( child ) ; } } return ; } | make sure you call this with a graph lock - either read or write |
10,520 | private List < String > getDomainHostServers ( ModelControllerClient mcc , String hostName ) { return getChildrenNames ( PathAddress . EMPTY_ADDRESS . append ( "host" , hostName ) , "server" , mcc ) ; } | returns empty list if not in domain mode |
10,521 | public static void main ( String [ ] args ) { try { start ( args ) ; } catch ( Exception e ) { System . err . println ( "Hawkular Java Agent failed at startup" ) ; e . printStackTrace ( System . err ) ; return ; } synchronized ( JavaAgent . class ) { try { JavaAgent . class . wait ( ) ; } catch ( InterruptedException e... | an agent can be started in its own VM as the main class |
10,522 | public static void premain ( String args ) { if ( args == null ) { args = "config=config.yaml" ; } try { start ( args . split ( "," ) ) ; } catch ( Exception e ) { System . err . println ( "Hawkular Java Agent failed at startup" ) ; e . printStackTrace ( System . err ) ; } } | an agent can be started in a VM as a javaagent allowing it to be embedded with some other main app |
10,523 | public static void ensureEndsWithSlash ( StringBuilder str ) { if ( str . length ( ) == 0 || str . charAt ( str . length ( ) - 1 ) != '/' ) { str . append ( '/' ) ; } } | Given a string builder this ensures its last character is a forward - slash . |
10,524 | public static long copyStream ( InputStream input , OutputStream output , boolean closeStreams ) throws RuntimeException { long numBytesCopied = 0 ; int bufferSize = BUFFER_SIZE ; try { input = new BufferedInputStream ( input , bufferSize ) ; byte [ ] buffer = new byte [ bufferSize ] ; for ( int bytesRead = input . rea... | Copies one stream to another optionally closing the streams . |
10,525 | public static String base64Encode ( String plainTextString ) { String encoded = new String ( Base64 . getEncoder ( ) . encode ( plainTextString . getBytes ( ) ) ) ; return encoded ; } | Encodes a string using Base64 encoding . |
10,526 | public static String getContainerId ( ) { if ( containerId == null ) { containerId = System . getProperty ( HAWKULAR_AGENT_CONTAINER_ID ) ; if ( containerId != null ) { log . infof ( "Container ID was explicitly set to [%s]" , containerId ) ; } } if ( containerId == null ) { final String containerIdFilename = "/proc/se... | Tries to determine the container ID for the machine where this JVM is located . First check if the user explicitly set it . If not try determine it . |
10,527 | public void setDefaultTransactionTimeout ( int timeoutSecs ) throws Exception { final Address address = Address . root ( ) . add ( SUBSYSTEM , TRANSACTIONS ) ; final ModelNode req = createWriteAttributeRequest ( "default-timeout" , String . valueOf ( timeoutSecs ) , address ) ; final ModelNode response = execute ( req ... | Sets the default transaction timeout . |
10,528 | public static Address fromModelNode ( ModelNode node ) { Address address = Address . root ( ) ; if ( ! node . isDefined ( ) ) { return address ; } try { List < Property > addressList = node . asPropertyList ( ) ; for ( Property addressProperty : addressList ) { String resourceType = addressProperty . getName ( ) ; Stri... | Obtains the address from the given ModelNode which is assumed to be a property list that contains all the address parts and only the address parts . |
10,529 | public Address add ( String ... addressParts ) { if ( addressParts != null ) { if ( ( addressParts . length % 2 ) != 0 ) { throw new IllegalArgumentException ( "address is incomplete: " + Arrays . toString ( addressParts ) ) ; } if ( addressParts . length > 0 ) { for ( int i = 0 ; i < addressParts . length ; i += 2 ) {... | Appends the given address parts to this address . This lets you build up addresses in a step - wise fashion . |
10,530 | public Address add ( Address address ) { if ( address == null || address . isRoot ( ) ) { return this ; } if ( isRoot ( ) ) { this . addressNode = address . addressNode . clone ( ) ; } else { List < Property > parts = address . addressNode . asPropertyList ( ) ; for ( Property part : parts ) { this . addressNode . add ... | Appends the given address to this address . This lets you build up addresses in a step - wise fashion . |
10,531 | public String toAddressPathString ( ) { if ( isRoot ( ) ) { return "/" ; } StringBuilder str = new StringBuilder ( ) ; List < Property > parts = addressNode . asPropertyList ( ) ; for ( Property part : parts ) { String name = part . getName ( ) ; String value = part . getValue ( ) . asString ( ) ; str . append ( "/" ) ... | Returns the address as a flattened string that is compatible with the DMR CLI address paths . |
10,532 | public Double getPowerSourceMetric ( String powerSourceName , ID metricToCollect ) { Map < String , PowerSource > cache = getPowerSources ( ) ; PowerSource powerSource = cache . get ( powerSourceName ) ; if ( powerSource == null ) { return null ; } if ( PlatformMetricType . POWER_SOURCE_REMAINING_CAPACITY . getMetricTy... | Returns the given metric s value or null if there is no power source with the given name . |
10,533 | public Double getProcessorMetric ( String processorNumber , ID metricToCollect ) { CentralProcessor processor = getProcessor ( ) ; if ( processor == null ) { return null ; } int processorIndex ; try { processorIndex = Integer . parseInt ( processorNumber ) ; if ( processorIndex < 0 || processorIndex >= processor . getL... | Returns the given metric s value or null if there is no processor with the given number . |
10,534 | public Double getFileStoreMetric ( String fileStoreNameName , ID metricToCollect ) { Map < String , OSFileStore > cache = getFileStores ( ) ; OSFileStore fileStore = cache . get ( fileStoreNameName ) ; if ( fileStore == null ) { return null ; } if ( PlatformMetricType . FILE_STORE_TOTAL_SPACE . getMetricTypeId ( ) . eq... | Returns the given metric s value or null if there is no file store with the given name . |
10,535 | public Double getMemoryMetric ( ID metricToCollect ) { GlobalMemory mem = getMemory ( ) ; if ( PlatformMetricType . MEMORY_AVAILABLE . getMetricTypeId ( ) . equals ( metricToCollect ) ) { return Double . valueOf ( mem . getAvailable ( ) ) ; } else if ( PlatformMetricType . MEMORY_TOTAL . getMetricTypeId ( ) . equals ( ... | Returns the given memory metric s value . |
10,536 | public Double getOperatingSystemMetric ( ID metricId ) { if ( PlatformMetricType . OS_SYS_CPU_LOAD . getMetricTypeId ( ) . equals ( metricId ) ) { return Double . valueOf ( getProcessor ( ) . getSystemCpuLoad ( ) ) ; } else if ( PlatformMetricType . OS_SYS_LOAD_AVG . getMetricTypeId ( ) . equals ( metricId ) ) { return... | Returns the given OS metric s value . |
10,537 | public Double getMetric ( PlatformResourceType type , String name , ID metricToCollect ) { switch ( type ) { case OPERATING_SYSTEM : { return getOperatingSystemMetric ( metricToCollect ) ; } case MEMORY : { return getMemoryMetric ( metricToCollect ) ; } case FILE_STORE : { return getFileStoreMetric ( name , metricToCol... | Given a platform resource type a name and a metric name this will return that metric s value or null if there is no resource that can be identified by the name and type . |
10,538 | private static < L > Map < Name , TypeSet < ResourceType < L > > > buildTypeMapForConstructor ( Collection < ResourceType < L > > allTypes ) { TypeSetBuilder < ResourceType < L > > bldr = TypeSet . < ResourceType < L > > builder ( ) ; bldr . enabled ( true ) ; bldr . name ( new Name ( "all" ) ) ; for ( ResourceType < L... | for use by the above constructor |
10,539 | public Set < ResourceType < L > > getChildren ( ResourceType < L > resourceType ) { Set < ResourceType < L > > directChildren = index . successorsOf ( resourceType ) ; return Collections . unmodifiableSet ( directChildren ) ; } | Returns the direct child types of the given resource type . |
10,540 | public Set < ResourceType < L > > getParents ( ResourceType < L > resourceType ) { Set < ResourceType < L > > directParents = index . predecessorsOf ( resourceType ) ; return Collections . unmodifiableSet ( directParents ) ; } | Returns the direct parent types of the given resource type . |
10,541 | private void prepareGraph ( ) throws IllegalStateException { List < ResourceType < L > > disabledTypes = new ArrayList < > ( ) ; Map < Name , ResourceType < L > > allResourceTypes = new HashMap < > ( ) ; for ( TypeSet < ResourceType < L > > rTypeSet : typeSetMap . values ( ) ) { for ( ResourceType < L > rType : rTypeSe... | Prepares the graph . |
10,542 | public void sendAsync ( BasicMessageWithExtraData < ? extends BasicMessage > messageWithData ) { if ( ! isConnected ( ) ) { throw new IllegalStateException ( "WebSocket connection was closed. Cannot send any messages" ) ; } BasicMessage message = messageWithData . getBasicMessage ( ) ; configurationAuthentication ( mes... | Sends a message to the server asynchronously . This method returns immediately ; the message may not go out until some time in the future . |
10,543 | public void sendSync ( BasicMessageWithExtraData < ? extends BasicMessage > messageWithData ) throws Exception { if ( ! isConnected ( ) ) { throw new IllegalStateException ( "WebSocket connection was closed. Cannot send any messages" ) ; } BasicMessage message = messageWithData . getBasicMessage ( ) ; configurationAuth... | Sends a message to the server synchronously . This will return only when the message has been sent . |
10,544 | private void destroyPingExecutor ( ) { synchronized ( pingExecutor ) { if ( ! pingExecutor . isShutdown ( ) ) { try { log . debugf ( "Shutting down WebSocket ping executor" ) ; pingExecutor . shutdown ( ) ; if ( ! pingExecutor . awaitTermination ( 1 , TimeUnit . SECONDS ) ) { pingExecutor . shutdownNow ( ) ; } } catch ... | Call this when you know the feed comm processor object will never be used again and thus the ping executor will also never be used again . |
10,545 | public static ID generateResourceId ( String feedId , MonitoredEndpoint < ? extends AbstractEndpointConfiguration > endpoint , String idPart ) { ID id = new ID ( String . format ( "%s~%s~%s" , feedId , endpoint . getName ( ) , idPart ) ) ; return id ; } | Generates an ID for a resource . |
10,546 | public void addProperty ( String name , Object value ) { if ( value != null ) { properties . put ( name , value ) ; } else { removeProperty ( name ) ; } } | Adds an optional property to this object . If null any property with the given name will be removed . If the property already exists this new value will replace the old value . |
10,547 | public boolean isSocketBinding ( String socketBindingGroupName , String socketBindingName ) throws Exception { Address addr = Address . root ( ) . add ( SOCKET_BINDING_GROUP , socketBindingGroupName ) ; String haystack = SOCKET_BINDING ; return null != findNodeInList ( addr , haystack , socketBindingName ) ; } | Checks to see if there is already a socket binding in the given group . |
10,548 | public void addSocketBinding ( String socketBindingGroupName , String socketBindingName , int port ) throws Exception { addSocketBinding ( socketBindingGroupName , socketBindingName , null , port ) ; } | Adds a socket binding with the given name in the named socket binding group . If a socket binding with the given name already exists this method does nothing . |
10,549 | public void setSocketBindingPort ( String socketBindingGroupName , String socketBindingName , int port ) throws Exception { setSocketBindingPortExpression ( socketBindingGroupName , socketBindingName , null , port ) ; } | Sets the port number for the named socket binding found in the named socket binding group . |
10,550 | public void setStandardSocketBindingInterface ( String socketBindingName , String interfaceName ) throws Exception { setStandardSocketBindingInterfaceExpression ( socketBindingName , null , interfaceName ) ; } | Sets the interface name for the named standard socket binding . |
10,551 | public void setSocketBindingPort ( String socketBindingGroupName , String socketBindingName , String interfaceName ) throws Exception { setSocketBindingInterfaceExpression ( socketBindingGroupName , socketBindingName , null , interfaceName ) ; } | Sets the interface name for the named socket binding found in the named socket binding group . |
10,552 | private static String toCanonicalName ( String className ) { className = StringUtils . deleteWhitespace ( className ) ; Validate . notNull ( className , "className must not be null." ) ; if ( className . endsWith ( "[]" ) ) { final StringBuilder classNameBuffer = new StringBuilder ( ) ; while ( className . endsWith ( "... | Converts a class name to a JLS style class name . |
10,553 | public static String [ ] [ ] invert ( final String [ ] [ ] array ) { final String [ ] [ ] newarray = new String [ array . length ] [ 2 ] ; for ( int i = 0 ; i < array . length ; i ++ ) { newarray [ i ] [ 0 ] = array [ i ] [ 1 ] ; newarray [ i ] [ 1 ] = array [ i ] [ 0 ] ; } return newarray ; } | Used to invert an escape array into an unescape array |
10,554 | private Fraction addSub ( final Fraction fraction , final boolean isAdd ) { Validate . isTrue ( fraction != null , "The fraction must not be null" ) ; if ( numerator == 0 ) { return isAdd ? fraction : fraction . negate ( ) ; } if ( fraction . numerator == 0 ) { return this ; } final int d1 = greatestCommonDivisor ( den... | Implement add and subtract using algorithm described in Knuth 4 . 5 . 1 . |
10,555 | public ZonedDateTime intoZonedDateTimeOrUse ( ZoneId fallback ) { try { return intoZonedDateTime ( ) ; } catch ( RuntimeException ex ) { return intoLocalDateTime ( ) . atZone ( fallback ) ; } } | Converts to string & permissively parses as a date uses parsed time zone or falls back on input defaults day - > 1 month - > 1 hour - > 0 minute - > 0 second - > 0 nanoseconds - > 0 time - zone - > input |
10,556 | public final Morpheme createMorpheme ( final String word , final String tag ) { final Morpheme morpheme = new Morpheme ( ) ; morpheme . setValue ( word ) ; morpheme . setTag ( tag ) ; return morpheme ; } | Construct morpheme object with word and morphological tag . |
10,557 | public final void annotate ( final InputStream inputStream , final OutputStream outputStream ) throws IOException , JDOMException { final String model = this . parsedArguments . getString ( "model" ) ; final String lemmatizerModel = this . parsedArguments . getString ( "lemmatizerModel" ) ; final boolean allMorphology ... | Main entry point for annotation . Takes system . in as input and outputs annotated text via system . out . |
10,558 | private void loadAnnotateParameters ( ) { this . annotateParser . addArgument ( "-m" , "--model" ) . required ( true ) . help ( "It is required to provide a POS tagging model." ) ; this . annotateParser . addArgument ( "-lm" , "--lemmatizerModel" ) . required ( true ) . help ( "It is required to provide a lemmatizer mo... | Generate the annotation parameter of the CLI . |
10,559 | public final void train ( ) throws IOException { final String paramFile = this . parsedArguments . getString ( "params" ) ; final TrainingParameters params = InputOutputUtils . loadTrainingParameters ( paramFile ) ; String outModel = null ; if ( params . getSettings ( ) . get ( "OutputModel" ) == null || params . getSe... | Main entry point for training . |
10,560 | public final void eval ( ) throws IOException { final String component = this . parsedArguments . getString ( "component" ) ; final String testFile = this . parsedArguments . getString ( "testSet" ) ; final String model = this . parsedArguments . getString ( "model" ) ; Evaluate evaluator = null ; if ( component . equa... | Main entry point for evaluation . |
10,561 | private void loadEvalParameters ( ) { this . evalParser . addArgument ( "-c" , "--component" ) . required ( true ) . choices ( "pos" , "lemma" ) . help ( "Choose component for evaluation" ) ; this . evalParser . addArgument ( "-m" , "--model" ) . required ( true ) . help ( "Choose model" ) ; this . evalParser . addArgu... | Load the evaluation parameters of the CLI . |
10,562 | public final void crossValidate ( ) throws IOException { final String paramFile = this . parsedArguments . getString ( "params" ) ; final TrainingParameters params = InputOutputUtils . loadTrainingParameters ( paramFile ) ; final POSCrossValidator crossValidator = new POSCrossValidator ( params ) ; crossValidator . cro... | Main access to the cross validation . |
10,563 | private void loadServerParameters ( ) { serverParser . addArgument ( "-p" , "--port" ) . required ( true ) . help ( "Port to be assigned to the server.\n" ) ; serverParser . addArgument ( "-m" , "--model" ) . required ( true ) . help ( "It is required to provide a model to perform POS tagging." ) ; this . serverParser ... | Create the available parameters for POS tagging . |
10,564 | private Properties setAnnotateProperties ( final String model , final String lemmatizerModel , final String language , final String multiwords , final String dictag ) { final Properties annotateProperties = new Properties ( ) ; annotateProperties . setProperty ( "model" , model ) ; annotateProperties . setProperty ( "l... | Generate Properties objects for CLI usage . |
10,565 | public String [ ] getTokenArray ( ) { checkTokenized ( ) ; if ( this . tokens == null ) { return null ; } final String [ ] clone = new String [ this . tokens . length ] ; for ( int i = 0 ; i < this . tokens . length ; i ++ ) { clone [ i ] = this . tokens [ i ] ; } return clone ; } | Gets a copy of the full token list as an independent modifiable array . |
10,566 | public List < String > getTokenList ( ) { checkTokenized ( ) ; final List < String > list = new ArrayList < > ( tokens . length ) ; list . addAll ( Arrays . asList ( tokens ) ) ; return list ; } | Gets a copy of the full token list as an independent modifiable list . |
10,567 | public StrTokenizer reset ( final String input ) { reset ( ) ; if ( input != null ) { this . chars = input . toCharArray ( ) ; } else { this . chars = null ; } return this ; } | Reset this tokenizer giving it a new input string to parse . In this manner you can re - use a tokenizer with the same settings on multiple input lines . |
10,568 | private void checkTokenized ( ) { if ( tokens == null ) { if ( chars == null ) { final List < String > split = tokenize ( null , 0 , 0 ) ; tokens = split . toArray ( new String [ split . size ( ) ] ) ; } else { final List < String > split = tokenize ( chars , 0 , chars . length ) ; tokens = split . toArray ( new String... | Checks if tokenization has been done and if not then do it . |
10,569 | private void addToken ( final List < String > list , String tok ) { if ( StringUtils . isEmpty ( tok ) ) { if ( isIgnoreEmptyTokens ( ) ) { return ; } if ( isEmptyTokenAsNull ( ) ) { tok = null ; } } list . add ( tok ) ; } | Adds a token to a list paying attention to the parameters we ve set . |
10,570 | private int readNextToken ( final char [ ] srcChars , int start , final int len , final StrBuilder workArea , final List < String > tokenList ) { while ( start < len ) { final int removeLen = Math . max ( getIgnoredMatcher ( ) . isMatch ( srcChars , start , start , len ) , getTrimmerMatcher ( ) . isMatch ( srcChars , s... | Reads character by character through the String to get the next token . |
10,571 | private int readWithQuotes ( final char [ ] srcChars , final int start , final int len , final StrBuilder workArea , final List < String > tokenList , final int quoteStart , final int quoteLen ) { workArea . clear ( ) ; int pos = start ; boolean quoting = quoteLen > 0 ; int trimStart = 0 ; while ( pos < len ) { if ( qu... | Reads a possibly quoted string token . |
10,572 | Object cloneReset ( ) throws CloneNotSupportedException { final StrTokenizer cloned = new StrTokenizer ( ) ; if ( this . chars != null ) { cloned . chars = new char [ this . chars . length ] ; for ( int i = 0 ; i < this . chars . length ; i ++ ) { cloned . chars [ i ] = this . chars [ i ] ; } } if ( this . tokens == nu... | Creates a new instance of this Tokenizer . The new instance is reset so that it will be at the start of the token list . |
10,573 | private HashMap < List < String > , String > getLemmaTagsDict ( final String word ) { final List < WordData > wdList = this . dictLookup . lookup ( word ) ; final HashMap < List < String > , String > dictMap = new HashMap < List < String > , String > ( ) ; for ( final WordData wd : wdList ) { final List < String > word... | Get the lemma for a surface form word and a postag from a FSA morfologik generated dictionary . |
10,574 | private HashMap < List < String > , String > getDictMap ( final String word , final String postag ) { HashMap < List < String > , String > dictMap = new HashMap < List < String > , String > ( ) ; dictMap = this . getLemmaTagsDict ( word . toLowerCase ( ) ) ; return dictMap ; } | Generates the dictionary map . |
10,575 | public static String getStringFromTokens ( final String [ ] tokens ) { final StringBuilder sb = new StringBuilder ( ) ; for ( final String tok : tokens ) { sb . append ( tok ) . append ( " " ) ; } return sb . toString ( ) . trim ( ) ; } | Gets the String joined by a space of an array of tokens . |
10,576 | public static List < File > getFilesInDir ( final File inputPath ) { final List < File > fileList = new ArrayList < File > ( ) ; for ( final File aFile : Files . fileTreeTraverser ( ) . preOrderTraversal ( inputPath ) ) { if ( aFile . isFile ( ) ) { fileList . add ( aFile ) ; } } return fileList ; } | Recursively get every file in a directory and add them to a list . |
10,577 | private static int minimum ( int a , int b , int c ) { int minValue ; minValue = a ; if ( b < minValue ) { minValue = b ; } if ( c < minValue ) { minValue = c ; } return minValue ; } | Get mininum of three values . |
10,578 | private static String mapGermanTagSetToKaf ( final String postag ) { if ( postag . startsWith ( "ADV" ) ) { return "A" ; } else if ( postag . startsWith ( "KO" ) ) { return "C" ; } else if ( postag . equalsIgnoreCase ( "ART" ) ) { return "D" ; } else if ( postag . startsWith ( "ADJ" ) ) { return "G" ; } else if ( posta... | Mapping between CoNLL 2009 German tagset and KAF tagset . Based on the Stuttgart - Tuebingen tagset . |
10,579 | private static String mapEnglishTagSetToKaf ( final String postag ) { if ( postag . startsWith ( "RB" ) ) { return "A" ; } else if ( postag . equalsIgnoreCase ( "CC" ) ) { return "C" ; } else if ( postag . startsWith ( "D" ) || postag . equalsIgnoreCase ( "PDT" ) ) { return "D" ; } else if ( postag . startsWith ( "J" )... | Mapping between Penn Treebank tagset and KAF tagset . |
10,580 | private static String mapSpanishTagSetToKaf ( final String postag ) { if ( postag . equalsIgnoreCase ( "RG" ) || postag . equalsIgnoreCase ( "RN" ) ) { return "A" ; } else if ( postag . equalsIgnoreCase ( "CC" ) || postag . equalsIgnoreCase ( "CS" ) ) { return "C" ; } else if ( postag . startsWith ( "D" ) ) { return "D... | Mapping between EAGLES PAROLE tagset and NAF . |
10,581 | public synchronized void shutdown ( ) { if ( ! shutdown ) { if ( ownExecutor ) { getExecutorService ( ) . shutdownNow ( ) ; } if ( task != null ) { task . cancel ( false ) ; } shutdown = true ; } } | Initializes a shutdown . After that the object cannot be used any more . This method can be invoked an arbitrary number of times . All invocations after the first one do not have any effect . |
10,582 | public static Function < CharSequence , TemporalAccessor > orderedParseAttempter ( Function < CharSequence , TemporalAccessor > ... parsers ) { return date -> { RuntimeException first = null ; for ( Function < CharSequence , TemporalAccessor > parser : parsers ) { try { return parser . apply ( date ) ; } catch ( Runtim... | Returns an ordered functional blend of all input parsers . The attempter will try all functions until it succeeds . If none succeed will re - throw the first exception |
10,583 | public static Charset forName ( String charsetName ) { if ( charsetName == null ) { throw new IllegalArgumentException ( "Null charset name" ) ; } charsetName = charsetName . toUpperCase ( ) ; if ( EmulatedCharset . ISO_8859_1 . name ( ) . equals ( charsetName ) ) { return EmulatedCharset . ISO_8859_1 ; } else if ( Emu... | get charset for name . |
10,584 | public ReflectionToStringBuilder setExcludeFieldNames ( final String ... excludeFieldNamesParam ) { if ( excludeFieldNamesParam == null ) { this . excludeFieldNames = null ; } else { this . excludeFieldNames = toNoNullStringArray ( excludeFieldNamesParam ) ; Arrays . sort ( this . excludeFieldNames ) ; } return this ; ... | Sets the field names to exclude . |
10,585 | @ GwtIncompatible ( "incompatible method" ) private static long getFragment ( final Date date , final int fragment , final TimeUnit unit ) { validateDateNotNull ( date ) ; final Calendar calendar = Calendar . getInstance ( ) ; calendar . setTime ( date ) ; return getFragment ( calendar , fragment , unit ) ; } | Gets a Date fragment for any unit . |
10,586 | @ GwtIncompatible ( "incompatible method" ) private static long getFragment ( final Calendar calendar , final int fragment , final TimeUnit unit ) { if ( calendar == null ) { throw new IllegalArgumentException ( "The date must not be null" ) ; } long result = 0 ; final int offset = ( unit == TimeUnit . DAYS ) ? 0 : 1 ;... | Gets a Calendar fragment for any unit . |
10,587 | public static boolean truncatedEquals ( final Date date1 , final Date date2 , final int field ) { return truncatedCompareTo ( date1 , date2 , field ) == 0 ; } | Determines if two dates are equal up to no more than the specified most significant field . |
10,588 | public static int truncatedCompareTo ( final Calendar cal1 , final Calendar cal2 , final int field ) { final Calendar truncatedCal1 = truncate ( cal1 , field ) ; final Calendar truncatedCal2 = truncate ( cal2 , field ) ; return truncatedCal1 . compareTo ( truncatedCal2 ) ; } | Determines how two calendars compare up to no more than the specified most significant field . |
10,589 | public static int truncatedCompareTo ( final Date date1 , final Date date2 , final int field ) { final Date truncatedDate1 = truncate ( date1 , field ) ; final Date truncatedDate2 = truncate ( date2 , field ) ; return truncatedDate1 . compareTo ( truncatedDate2 ) ; } | Determines how two dates compare up to no more than the specified most significant field . |
10,590 | public static < L > void bindEventsToMethod ( final Object target , final String methodName , final Object eventSource , final Class < L > listenerType , final String ... eventTypes ) { final L listener = listenerType . cast ( Proxy . newProxyInstance ( target . getClass ( ) . getClassLoader ( ) , new Class [ ] { liste... | Binds an event listener to a specific method on a specific object . |
10,591 | public static < T > Builder < T > newSorter ( Serializer < T > serializer , Comparator < T > comparator ) { return new Builder < T > ( serializer , comparator ) ; } | Fluent API building a new instance of ExternalMergeSort<T . |
10,592 | public CloseableIterator < T > mergeSort ( Iterator < T > values ) throws IOException { ChunkSizeIterator < T > csi = new ChunkSizeIterator < T > ( values , config . chunkSize ) ; if ( csi . isMultipleChunks ( ) ) { List < File > sortedChunks = writeSortedChunks ( csi ) ; return mergeSortedChunks ( sortedChunks ) ; } e... | Performs an external merge on the values in the iterator . |
10,593 | public CloseableIterator < T > mergeSortedChunks ( List < File > sortedChunks ) throws IOException { return mergeSortedChunksNoPartialMerge ( partialMerge ( sortedChunks ) ) ; } | Returns an iterator over the sorted result . Takes a list of already sorted chunk files as input . Note that this method is normally used with one of the writeSortedChunks methods . |
10,594 | public List < File > writeSortedChunks ( Iterator < T > input ) throws IOException { List < File > result = new ArrayList < File > ( ) ; while ( input . hasNext ( ) ) { File chunkFile = writeSortedChunk ( input ) ; result . add ( chunkFile ) ; } if ( debugMerge ) { System . out . printf ( "Chunks %d (chunkSize=%d, maxO... | Read the data from the iterator then perform a sort and write individually sorted chunk files to disk . |
10,595 | public File writeSortedChunk ( Iterator < T > input ) throws IOException { List < T > chunk = readChunk ( input ) ; return writeInternalSortedChunk ( chunk ) ; } | Read the data from the iterator then perform a sort and write a single sorted chunk file to disk . Note that a maximum of elements equal to the chunk size will be read from the iterator so make sure that the iterator contains no more than that . If that is the case then you may want to use the writeSortedChunks method ... |
10,596 | public static String removeNotation ( String name ) { if ( name . matches ( "^m[A-Z]{1}" ) ) { return name . substring ( 1 , 2 ) . toLowerCase ( ) ; } else if ( name . matches ( "m[A-Z]{1}.*" ) ) { return name . substring ( 1 , 2 ) . toLowerCase ( ) + name . substring ( 2 ) ; } return name ; } | Get the name of the field removing hungarian notation |
10,597 | public static String removeNotationFromSetterAndSetPrefix ( String methodName ) { if ( methodName . matches ( "^set\\w+" ) ) { String withoutSetPrefix = methodName . substring ( 3 ) ; if ( Character . isLowerCase ( withoutSetPrefix . charAt ( 0 ) ) ) { return HungarianNotation . removeNotation ( withoutSetPrefix ) ; } ... | Removes the hungarian notation from setter method |
10,598 | public String apply ( final String word , final String postag ) { String lemma = null ; final List < String > keys = this . getDictKeys ( word , postag ) ; final String keyValue = this . dictMap . get ( keys ) ; if ( keyValue != null ) { lemma = keyValue ; } else { lemma = "O" ; } return lemma ; } | Lookup lemma in a dictionary . Outputs O if not found . |
10,599 | @ SuppressWarnings ( "boxing" ) public static void inclusiveBetween ( final double start , final double end , final double value ) { if ( value < start || value > end ) { throw new IllegalArgumentException ( StringUtils . simpleFormat ( DEFAULT_INCLUSIVE_BETWEEN_EX_MESSAGE , value , start , end ) ) ; } } | Validate that the specified primitive value falls between the two inclusive values specified ; otherwise throws an exception . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.