idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
28,600 | public static void setLogLevel ( String cls , String level ) { Logger l = null ; if ( Objects . isNullOrEmpty ( cls ) ) l = LogManager . getRootLogger ( ) ; else l = LogManager . getLogger ( cls ) ; if ( level . equalsIgnoreCase ( "TRACE" ) ) l . setLevel ( Level . TRACE ) ; else if ( level . equalsIgnoreCase ( "DEBUG"... | Set log level |
28,601 | public static synchronized LogStorage getLogStorage ( ) { if ( storage == null ) { String cls = Options . getStorage ( ) . getSystem ( "log.storageClass" , LogStorage . class . getName ( ) ) ; try { storage = ( LogStorage ) Class . forName ( cls ) . newInstance ( ) ; } catch ( Exception e ) { throw S1SystemError . wrap... | Get log storage |
28,602 | private void createRepositoryDirectoryStructure ( File rootDir ) { this . objs = new File ( rootDir , OBJECT_DIR ) ; if ( ! objs . exists ( ) ) { if ( ! objs . mkdirs ( ) ) { throw new RuntimeException ( "Could not create dir: " + objs . getAbsolutePath ( ) ) ; } } this . refs = new File ( rootDir , REFERENCE_DIR ) ; i... | Erzeugt die Verzeichnis - Struktur des Repositorys falls die Verzeichinsse noch nicht existieren . |
28,603 | public void renameNodesInTree ( String oldName , String newName ) { List < Node > nodes = getNodesFromTreeByName ( oldName ) ; Iterator i = nodes . iterator ( ) ; while ( i . hasNext ( ) ) { Node n = ( Node ) i . next ( ) ; n . setName ( newName ) ; } } | Renames all subnodes with a certain name |
28,604 | public void renameNodesWithAttributeValue ( String oldName , String newName , String attributeName , String attributeValue ) { List < Node > nodes = getNodesFromTreeByName ( oldName ) ; Iterator i = nodes . iterator ( ) ; while ( i . hasNext ( ) ) { Node n = ( Node ) i . next ( ) ; n . setName ( newName ) ; } } | Rename all nodes with a certain name and a certain attribute name - value pair |
28,605 | public void setValue ( String value ) { contents = new ArrayList ( ) ; contents . add ( value ) ; if ( value . trim ( ) . length ( ) > 0 ) { containsSingleString = true ; } } | Replaces the contents of this node with a single text |
28,606 | public void addValue ( String value ) { contents . add ( value ) ; if ( value . trim ( ) . length ( ) > 0 ) { if ( contents . size ( ) == 1 ) { containsSingleString = true ; } else { containsSingleString = false ; containsMarkupText = true ; } } } | Appends a piece of text to the contents of this node |
28,607 | public Node addNode ( Node subNode ) { if ( this instanceof Node ) { subNode . parentNode = ( Node ) this ; } contents . add ( subNode ) ; return subNode ; } | Adds a subnode to the contents |
28,608 | public static long putFromByteArray ( Cache cache , String resource , byte [ ] data ) throws CacheException { if ( cache == null ) { logger . error ( "cache reference must not be null" ) ; throw new CacheException ( "invalid cache" ) ; } ByteArrayInputStream input = null ; OutputStream output = null ; try { output = ca... | Stores the given array of bytes under the given resource name . |
28,609 | public static java . sql . Time getSqlTime ( java . util . Date date ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( date ) ; return new java . sql . Time ( cal . getTimeInMillis ( ) ) ; } | Get java . sql . Time from java . util . Date |
28,610 | public static java . sql . Timestamp getSqlTimeStamp ( java . util . Date date ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( date ) ; return new java . sql . Timestamp ( cal . getTimeInMillis ( ) ) ; } | Get java . sql . Timestamp from java . util . Date |
28,611 | public static String trimLeft ( final String value ) { final StringBuilder result = new StringBuilder ( assertNotNull ( value ) . length ( ) ) ; int index = 0 ; for ( ; index < value . length ( ) ; index ++ ) { final char chr = value . charAt ( index ) ; if ( ! ( Character . isWhitespace ( chr ) || Character . isISOCon... | Trim left white spaces in string . |
28,612 | @ SuppressWarnings ( "unchecked" ) public static < T extends Levenshtein > T of ( String baseTarget , String compareTarget ) { return ( T ) new LevenshteinEditDistance ( baseTarget ) . update ( compareTarget ) ; } | Returns a new Levenshtein edit distance instance with compare target string |
28,613 | public static < T extends Levenshtein > T weightedLevenshtein ( String baseTarget , CharacterSubstitution characterSubstitution ) { return weightedLevenshtein ( baseTarget , null , characterSubstitution ) ; } | Returns a new Weighted Levenshtein edit distance instance |
28,614 | @ SuppressWarnings ( "unchecked" ) public static < T extends Levenshtein > T weightedLevenshtein ( String baseTarget , String compareTarget , CharacterSubstitution characterSubstitution ) { return ( T ) new WeightedLevenshtein ( baseTarget , characterSubstitution ) . update ( compareTarget ) ; } | Returns a new Weighted Levenshtein edit distance instance with compare target string |
28,615 | @ SuppressWarnings ( "unchecked" ) public static < T extends Levenshtein > T damerau ( String baseTarget , String compareTarget ) { return ( T ) new Damerau ( baseTarget ) . update ( compareTarget ) ; } | Returns a new Damerau - Levenshtein distance instance with compare target string |
28,616 | @ SuppressWarnings ( "unchecked" ) public static < T extends Levenshtein > T jaroWinkler ( String baseTarget , String compareTarget ) { return ( T ) new JaroWinkler ( baseTarget ) . update ( compareTarget ) ; } | Returns a new Jaro - Winkler similarity instance with compare target string |
28,617 | @ SuppressWarnings ( "unchecked" ) public static < T extends Levenshtein > T longestCommonSubsequence ( String baseTarget , String compareTarget ) { return ( T ) new LongestCommonSubsequence ( baseTarget ) . update ( compareTarget ) ; } | Returns a new Longest Common Subsequence edit distance instance with compare target string |
28,618 | public static < T extends Levenshtein > T jaccard ( String baseTarget , String compareTarget ) { return jaccard ( baseTarget , compareTarget , null ) ; } | Returns a new Jaccard index instance with compare target string |
28,619 | @ SuppressWarnings ( "unchecked" ) public static < T extends Levenshtein > T jaccard ( String baseTarget , String compareTarget , Integer k ) { return ( T ) new Jaccard ( baseTarget , k ) . update ( compareTarget ) ; } | Returns a new Jaccard index instance with compare target string and k - shingling |
28,620 | public static < T extends Levenshtein > T sorensenDice ( String baseTarget , String compareTarget ) { return sorensenDice ( baseTarget , compareTarget , null ) ; } | Returns a new Sorensen - Dice coefficient instance with compare target string |
28,621 | @ SuppressWarnings ( "unchecked" ) public static < T extends Levenshtein > T sorensenDice ( String baseTarget , String compareTarget , Integer k ) { return ( T ) new SorensenDice ( baseTarget , k ) . update ( compareTarget ) ; } | Returns a new Sorensen - Dice coefficient instance with compare target string and k - shingling |
28,622 | public static < T extends Levenshtein > T cosine ( String baseTarget , String compareTarget ) { return cosine ( baseTarget , compareTarget , null ) ; } | Returns a new Cosine similarity instance with compare target string |
28,623 | @ SuppressWarnings ( "unchecked" ) public static < T extends Levenshtein > T cosine ( String baseTarget , String compareTarget , Integer k ) { return ( T ) new Cosine ( baseTarget , k ) . update ( compareTarget ) ; } | Returns a new Cosine similarity instance with compare target string and k - shingling |
28,624 | public synchronized void take ( long bytes ) throws ScriptLimitException { if ( limit > 0 ) { memory -= bytes ; if ( memory < 0 ) throw new ScriptLimitException ( ScriptLimitException . Limits . MEMORY , limit ) ; } } | Takes some bytes from heap |
28,625 | public void checkPermission ( Permission perm , AddOnModel addOnModel ) throws IzouPermissionException { try { rootPermission . checkPermission ( perm , addOnModel ) ; return ; } catch ( IzouPermissionException ignored ) { } standardCheck . stream ( ) . filter ( permissionModule -> permissionModule . canCheckPermission... | checks the permission |
28,626 | public List < ResourceModel > generateResources ( EventModel < ? > event ) { if ( ! event . getAllInformations ( ) . stream ( ) . anyMatch ( eventSubscribers :: containsKey ) ) return new LinkedList < > ( ) ; List < ResourceBuilderModel > resourceBuilders = event . getAllInformations ( ) . stream ( ) . map ( eventSubsc... | generates all the resources for an event |
28,627 | private List < ResourceModel > generateResources ( List < ResourceBuilderModel > resourceBuilders , EventModel event ) { Optional < EventModel > parameter = event != null ? Optional . of ( event ) : Optional . empty ( ) ; List < CompletableFuture < List < ResourceModel > > > futures = resourceBuilders . stream ( ) . ma... | generates the resources with a 1 sec . timeout for each ResourceBuilder |
28,628 | private void registerResourceIDsForResourceBuilder ( ResourceBuilderModel resourceBuilder ) { List < ? extends ResourceModel > resources = resourceBuilder . announceResources ( ) ; if ( resources == null ) return ; resources . stream ( ) . map ( this :: getRegisteredListForResource ) . forEach ( list -> list . add ( re... | registers all ResourceIDs for the ResourceBuilders |
28,629 | private List < ResourceBuilderModel > getRegisteredListForResource ( ResourceModel resource ) { if ( resourceIDs . containsKey ( resource . getResourceID ( ) ) ) { return resourceIDs . get ( resource . getResourceID ( ) ) ; } else { LinkedList < ResourceBuilderModel > tempList = new LinkedList < > ( ) ; resourceIDs . p... | returns the list with all the ResourceBuilders listening to the Resource |
28,630 | private void registerEventsForResourceBuilder ( ResourceBuilderModel resourceBuilder ) { List < ? extends EventModel < ? > > events = resourceBuilder . announceEvents ( ) ; if ( events == null ) return ; events . stream ( ) . filter ( event -> event . getAllInformations ( ) != null ) . flatMap ( event -> event . getAll... | Registers the events for the ResourceBuilder |
28,631 | private List < ResourceBuilderModel > getRegisteredListForEvent ( String event ) { if ( eventSubscribers . containsKey ( event ) ) { return eventSubscribers . get ( event ) ; } else { LinkedList < ResourceBuilderModel > tempList = new LinkedList < > ( ) ; eventSubscribers . put ( event , tempList ) ; return tempList ; ... | returns a list of all the ResourceBuilders listening to the Event - ID |
28,632 | private void unregisterResourceIDForResourceBuilder ( ResourceBuilderModel resourceBuilder ) { List < ? extends ResourceModel > resources = resourceBuilder . announceResources ( ) ; resources . stream ( ) . map ( resource -> resourceIDs . get ( resource . getResourceID ( ) ) ) . filter ( Objects :: nonNull ) . forEach ... | Unregisters all ResourceIDs for the ResourceBuilders |
28,633 | private void unregisterEventsForResourceBuilder ( ResourceBuilderModel resourceBuilder ) { resourceBuilder . announceEvents ( ) . stream ( ) . map ( eventSubscribers :: get ) . filter ( Objects :: nonNull ) . forEach ( list -> list . remove ( resourceBuilder ) ) ; } | unregisters the events for the ResourceBuilder |
28,634 | public Map < K , V > toMap ( ) { Map < K , V > result = new HashMap < K , V > ( ) ; result . put ( key , value ) ; return result ; } | Gets a mapped presentation of the pair . |
28,635 | public ArrayList < HashMap < String , String > > process ( ArrayList < HashMap < String , String > > soilsData ) { HashMap < String , String > previousSoil ; ArrayList < HashMap < String , String > > aggregatedSoilsData ; HashMap < String , String > aggregatedSoil ; boolean aggregate ; boolean enforceAggregation ; prev... | Process all the soil layers and return a new structure with aggregated data . |
28,636 | public ArrayList < HashMap < String , String > > normalizeSoilLayers ( ArrayList < HashMap < String , String > > soilsData ) { HashMap < String , String > referenceSoil ; ArrayList < HashMap < String , String > > newSoilsData ; referenceSoil = soilsData . get ( 0 ) ; newSoilsData = new ArrayList < HashMap < String , St... | Fill each layer with all parameters . In the json structure when a parameter value is missing we must take the value of the previous layer . |
28,637 | public static boolean isOfSubClassOf ( Object object , Class < ? > clazz ) { if ( object == null || clazz == null ) { return false ; } try { object . getClass ( ) . asSubclass ( clazz ) ; return true ; } catch ( ClassCastException e ) { return false ; } } | Returns whether the given object is an instance of a subclass of the given class that is if it can be cast to the given class . |
28,638 | public static boolean isOfSuperClassOf ( Object object , Class < ? > clazz ) { if ( object == null || clazz == null ) { return false ; } return object . getClass ( ) . isAssignableFrom ( clazz ) ; } | Returns whether the given object is an instance of a superclass of the given class that is if it can be cast to the given class . |
28,639 | public static int compareLexicographically ( IntTuple t0 , IntTuple t1 ) { Utils . checkForEqualSize ( t0 , t1 ) ; for ( int i = 0 ; i < t0 . getSize ( ) ; i ++ ) { if ( t0 . get ( i ) < t1 . get ( i ) ) { return - 1 ; } else if ( t0 . get ( i ) > t1 . get ( i ) ) { return 1 ; } } return 0 ; } | Compares two tuples lexicographically starting with the elements of the lowest index . |
28,640 | public static String urlEncode ( String input ) { if ( input == null ) { return "" ; } try { return URLEncoder . encode ( input , "UTF-8" ) ; } catch ( UnsupportedEncodingException uee ) { String result = StringSupport . replaceAll ( input , "&" , "%26" ) ; result = StringSupport . replaceAll ( result , "<" , "%3c" ) ;... | Encodes a String in format suitable for use in URL s |
28,641 | public static String htmlEncode ( String input ) { if ( input == null ) { return "" ; } StringBuffer retval = new StringBuffer ( input ) ; StringSupport . replaceAll ( retval , "&" , "&" ) ; StringSupport . replaceAll ( retval , "<" , "<" ) ; StringSupport . replaceAll ( retval , ">" , ">" ) ; StringSupport .... | Encodes a String in format suitable for use in HTML form input . Disables malicious input used for cross - scripting hacks . Converts null to empty string ; |
28,642 | final D6ModelClassFieldInfo getFieldInfo ( String columnName ) { final D6ModelClassFieldInfo fieldInfo = mColumnNameFieldInfoMap . get ( columnName ) ; return fieldInfo ; } | Returns Field info by columnName |
28,643 | final Set < String > getAllColumnNames ( ) { final Set < String > columnNameSet = mColumnNameFieldInfoMap . keySet ( ) ; return new LinkedHashSet < String > ( columnNameSet ) ; } | Returns Set of columName of model class |
28,644 | final Set < String > getPrimaryColumnNames ( ) { final List < DBColumn > primaryKeyColumnList = getPrimaryKeyColumnList ( ) ; final Set < String > primaryKeyColumnNameSet = new LinkedHashSet < String > ( ) ; for ( DBColumn col : primaryKeyColumnList ) { primaryKeyColumnNameSet . add ( col . columnName ( ) ) ; } return ... | Returns Set of primary key column name of model class |
28,645 | void setValue ( int parameterIndex , PreparedStatement preparedStatement , Class < ? > fieldType , Object fieldValue ) throws Exception { try { if ( fieldType == String . class ) { preparedStatement . setString ( parameterIndex , ( String ) fieldValue ) ; } else if ( fieldType == java . sql . Timestamp . class ) { prep... | Set value to preparedstatement with appropriate cast |
28,646 | final List < Field > getPrimaryKeyFieldList ( ) { final List < Field > fieldList = new ArrayList < Field > ( ) ; final Set < String > columnNameSet = getAllColumnNames ( ) ; for ( String columnName : columnNameSet ) { final D6ModelClassFieldInfo fieldInfo = getFieldInfo ( columnName ) ; final Field field = fieldInfo . ... | get primary key field of model class |
28,647 | final List < DBColumn > getPrimaryKeyColumnList ( ) { final List < DBColumn > primaryKeyColumnList = new ArrayList < DBColumn > ( ) ; final Set < String > columnNameSet = getAllColumnNames ( ) ; for ( String columnName : columnNameSet ) { final D6ModelClassFieldInfo fieldInfo = getFieldInfo ( columnName ) ; final Field... | Returns DBColumn list of primary key |
28,648 | public List < Dashboard > getDashboards ( ) { JAXBContext context ; try { context = JAXBContext . newInstance ( Dashboard . class . getPackage ( ) . getName ( ) ) ; } catch ( JAXBException e ) { throw new IllegalArgumentException ( "Could not create JAXBContext" , e ) ; } List < Dashboard > dashboards = new ArrayList <... | private Resource additionalSourceXml ; |
28,649 | public List < Entity > query ( Query query ) { return query ( query , FetchOptions . Builder . withOffset ( 0 ) ) ; } | Executes the specified query without an offset qualification . |
28,650 | public List < Entity > query ( Transaction transaction , Query query ) { return query ( transaction , query , FetchOptions . Builder . withOffset ( 0 ) ) ; } | Executes the specified query within the specified transaction without an offset qualification . |
28,651 | public List < Entity > query ( Query query , FetchOptions options ) { return datastore . prepare ( query ) . asList ( options ) ; } | Executes the specified query with the specified fetch options . |
28,652 | public static String readNullTerminatedString ( InputStream in ) throws IOException , EOFException { return readNullTerminatedString ( ( DataInput ) new DataInputStream ( in ) ) ; } | Reads a null - terminated string of bytes from the specified input stream . |
28,653 | public static String readNullTerminatedString ( DataInput in ) throws IOException , EOFException { StringBuilder s = new StringBuilder ( ) ; while ( true ) { int b = in . readByte ( ) ; if ( b == 0 ) { break ; } s . append ( ( char ) b ) ; } return s . toString ( ) ; } | Reads a null - terminated string of bytes from the specified input . |
28,654 | public Properties getProperties ( InjectionPoint injectionPoint ) { Properties properties = new Properties ( ) ; ConfigurationWrapper configuration = this . getConfigurationWrapper ( injectionPoint ) ; List < ISource > found = this . locate ( configuration ) ; List < ISource > copy = new ArrayList < ISource > ( found )... | Satisfies injection for java . util . Properties |
28,655 | static public boolean coinToss ( Probability probability ) { double p = probability . value ; double toss = RandomUtils . pickRandomProbability ( ) ; return p > toss ; } | This function returns the result of a coin toss that is weighted with the specified probability . A probability of zero will always return false and a probability of one will always return true . |
28,656 | protected void setup ( ) throws MojoExecutionException { if ( verbose ) { getLog ( ) . info ( "Rox configuration is generated" ) ; } if ( roxActive && roxConfig != null ) { if ( ! roxConfig . exists ( ) || ! roxConfig . isFile ( ) || ! roxConfig . getAbsolutePath ( ) . endsWith ( ".yml" ) ) { getLog ( ) . warn ( "The "... | Apply the internal setup for the plugin |
28,657 | protected void cleanup ( ) throws MojoExecutionException { if ( verbose ) { getLog ( ) . info ( "Clean the rox configuration files" ) ; } if ( roxActive ) { useCleanPlugin ( element ( "filesets" , element ( "fileset" , element ( "directory" , getWorkingDirectory ( ) . getAbsolutePath ( ) ) , element ( "followSymlinks" ... | Clean the ROX configuration files |
28,658 | public void put ( Object entity ) { if ( entity == null ) { throw new IllegalArgumentException ( "'entity' must not be [" + entity + "]" ) ; } if ( operation != null ) { throw new IllegalStateException ( "Log [" + operation + "] -> [" + Log . Operation . PUT + "] is not allowed: This operation must be first" ) ; } Key ... | Puts the specified entity instance into the Google App Engine Datastore newly . |
28,659 | public void update ( Object entity ) { if ( entity == null ) { throw new IllegalArgumentException ( "'entity' must not be [" + entity + "]" ) ; } if ( operation != Log . Operation . GET ) { throw new IllegalStateException ( "Log [" + operation + "] -> [" + Log . Operation . UPDATE + "] is not allowed: previous operatio... | Applies the specified entity s update to the Google App Engine Datastore . |
28,660 | public void delete ( Object entity ) { if ( entity == null ) { throw new IllegalArgumentException ( "'entity' must not be [" + entity + "]" ) ; } if ( operation != Log . Operation . GET ) { throw new IllegalStateException ( "Log [" + operation + "] -> [" + Log . Operation . DELETE + "] is not allowed: previous operatio... | Deletes the specified entity from the Google App Engine Datastore . |
28,661 | public void prepare ( ) { List < Log > logs = global . logs ( ) ; Object parent = null ; for ( int i = logs . size ( ) - 1 ; i >= 0 ; i -- ) { if ( logs . get ( i ) . operation ( ) != Log . Operation . GET ) { parent = logs . get ( i ) . entity ( ) ; break ; } } Lock lock = new Lock ( global . id ( ) , KeyFactory . cre... | Allocates lock for the managing entity . |
28,662 | @ SuppressWarnings ( "unchecked" ) public < T extends Operator > T geInstance ( Opcode opcode ) { Operator operator = this . operators . get ( opcode ) ; if ( operator == null ) { throw new TemplateException ( "Operator |%s| is not implemented." , opcode ) ; } return ( T ) operator ; } | Get operator instance for requested opcode . |
28,663 | private void setRecords ( byte [ ] [ ] data ) { if ( data == null || data . length == 0 ) { this . records = EMPTY_DATA ; return ; } this . records = new byte [ data . length ] [ ] ; for ( int i = 0 ; i < data . length ; i ++ ) { if ( data [ i ] != null ) { this . records [ i ] = data [ i ] ; } else { this . records [ ... | replaces null with EMPTY_DATA |
28,664 | public Bus < M > addDestination ( Destination < M > destination ) { if ( destination != null ) { logger . info ( "adding destination '{}' of class '{}'" , destination . getId ( ) , destination . getClass ( ) . getSimpleName ( ) ) ; destinations . add ( destination ) ; } return this ; } | Adds a destination to this message bus . |
28,665 | public boolean removeDestination ( String id ) { logger . trace ( "removing destination {}" , id ) ; for ( Destination < M > destination : destinations ) { if ( destination . getId ( ) . equals ( id ) ) { destinations . remove ( destination ) ; return true ; } } return false ; } | Removes the given object from the set of registered destinations . |
28,666 | public List < Tokenizer . Token > tokenize ( String sentence ) { Sequence seq = Sequence . create ( Chars . asList ( sentence . toCharArray ( ) ) . stream ( ) . map ( Object :: toString ) ) ; Labeling labels = model . label ( seq ) ; int n = sentence . length ( ) ; int [ ] [ ] spans = new int [ n + 1 ] [ 2 ] ; double [... | Tokenize list . |
28,667 | public static void setNoCache ( HttpServletRequest request , HttpServletResponse response ) { String protocol = request . getProtocol ( ) . trim ( ) ; { response . setHeader ( "Pragma" , "no-cache" ) ; } { response . setHeader ( "Cache-Control" , "no-cache, max-age=0, revalidate" ) ; } { } long now = System . currentTi... | Takes as many precautions as possible to prevent this page from being cached by the browser |
28,668 | public static String getRequestURLBaseWithoutProtocol ( HttpServletRequest req ) { return req . getServerName ( ) + ( req . getServerPort ( ) != 80 ? ":" + req . getServerPort ( ) : "" ) ; } | Gets a clean base url without the path from the current request . |
28,669 | public static void forward ( String url , ServletRequest req , ServletResponse res ) throws ServletException , IOException { RequestDispatcher dispatch = req . getRequestDispatcher ( url ) ; System . out . println ( new LogEntry ( "about to forward to " + url ) ) ; dispatch . forward ( req , res ) ; } | Dispatches http - request to url |
28,670 | public static void redirect ( String url , boolean copyParameters , ServletRequest req , ServletResponse res ) { if ( url == null ) { throw new IllegalArgumentException ( "URL cannot be null" ) ; } String redirectUrl = url ; char separator = '?' ; if ( redirectUrl . indexOf ( '?' ) != - 1 ) { separator = '&' ; } if ( c... | Redirects http - request to url |
28,671 | public static String getCookieValue ( ServletRequest request , String key ) { Cookie [ ] cookies = ( ( HttpServletRequest ) request ) . getCookies ( ) ; if ( cookies != null ) { for ( int i = 0 ; i < cookies . length ; i ++ ) { if ( cookies [ i ] . getName ( ) . equals ( key ) ) { return cookies [ i ] . getValue ( ) ; ... | Retrieves a value from a cookie |
28,672 | public static void writeClassPathResource ( HttpServletResponse response , String path , String contentType ) throws IOException { if ( path . startsWith ( "/" ) ) { path = path . substring ( 1 ) ; } InputStream input = ServletSupport . class . getClassLoader ( ) . getResourceAsStream ( path ) ; if ( input != null ) { ... | Obtains binary resource from classpath and writes it to http response . |
28,673 | public < T > T get ( String name , Closure < String , T > closure ) { T obj = null ; lock ( name ) ; try { obj = ( T ) cache . get ( name ) ; if ( obj != null ) { if ( ttl > 0 && ( created . get ( name ) + tu . toMillis ( ttl ) < System . currentTimeMillis ( ) ) ) { obj = null ; } } if ( obj != null ) { gets . put ( na... | Get record from cache |
28,674 | private Map < String , String > getCache ( String projectName , String projectVersion ) { if ( ! caches . containsKey ( getCacheKey ( projectName , projectVersion ) ) ) { caches . put ( getCacheKey ( projectName , projectVersion ) , loadOrCreateCache ( projectName , projectVersion ) ) ; } return caches . get ( getCache... | Retrieve the cache for a project in a version |
28,675 | @ SuppressWarnings ( "unchecked" ) private Map < String , String > loadOrCreateCache ( String projectName , String projectVersion ) { if ( projectName != null && projectVersion != null ) { File projectDir = new File ( getCacheDir ( ) , projectName ) ; if ( ! projectDir . exists ( ) ) { projectDir . mkdir ( ) ; } File v... | Try to load the cache from file if not available a new cache is created |
28,676 | private File getCacheDir ( ) { File cacheDir = new File ( configuration . getOptimizerCacheDir ( ) ) ; if ( ! cacheDir . exists ( ) ) { cacheDir . mkdir ( ) ; } File roxCacheDir = new File ( cacheDir , configuration . getServerConfiguration ( ) . getBaseUrlFootprint ( ) ) ; if ( ! roxCacheDir . exists ( ) ) { roxCacheD... | Get the cache directory . if not exist it is created and returned . |
28,677 | private void persistCaches ( ) { for ( Entry < CacheKey , Map < String , String > > cacheEntry : caches . entrySet ( ) ) { persistCache ( cacheEntry . getKey ( ) . projectName , cacheEntry . getKey ( ) . projectVersion , cacheEntry . getValue ( ) ) ; } } | Persist the cache that have been updated |
28,678 | private void persistCache ( String projectName , String projectVersion , Map < String , String > cache ) { File cacheFile = new File ( getCacheDir ( ) , projectName + "/" + projectVersion ) ; ObjectOutputStream oos = null ; try { oos = new ObjectOutputStream ( new FileOutputStream ( cacheFile ) ) ; oos . writeObject ( ... | Persist a specific cache |
28,679 | public static void initializeMessages ( List < DajlabControllerExtensionInterface < DajlabModelInterface > > controllers ) { ResourceBundle resourceD = ResourceBundle . getBundle ( MESSAGES_PATH + "dajlab" + MESSAGES_EXT ) ; getInstance ( ) . resources . put ( "dajlab" , resourceD ) ; if ( controllers != null ) { for (... | Initialize messages from the controllers . |
28,680 | public static String getString ( final String key ) { String ret = '!' + key + '!' ; if ( key != null ) { String [ ] els = key . split ( "\\." , 2 ) ; if ( els . length == 2 ) { String resourceName = els [ 0 ] ; ResourceBundle resource = getInstance ( ) . resources . get ( resourceName ) ; if ( resource != null ) { try... | Get message from the key . |
28,681 | public String getAccessId ( ) { String accessId = getAsNullableString ( "access_id" ) ; accessId = accessId != null ? accessId : getAsNullableString ( "client_id" ) ; return accessId ; } | Gets the application access id . The value can be stored in parameters access_id pr client_id |
28,682 | public String getAccessKey ( ) { String accessKey = getAsNullableString ( "access_key" ) ; accessKey = accessKey != null ? accessKey : getAsNullableString ( "client_key" ) ; return accessKey ; } | Gets the application secret key . The value can be stored in parameters access_key client_key or secret_key . |
28,683 | public static CredentialParams fromString ( String line ) { StringValueMap map = StringValueMap . fromString ( line ) ; return new CredentialParams ( map ) ; } | Creates a new CredentialParams object filled with key - value pairs serialized as a string . |
28,684 | public static List < CredentialParams > manyFromConfig ( ConfigParams config , boolean configAsDefault ) { List < CredentialParams > result = new ArrayList < CredentialParams > ( ) ; ConfigParams credentials = config . getSection ( "credentials" ) ; if ( credentials . size ( ) > 0 ) { List < String > sectionsNames = cr... | Retrieves all CredentialParams from configuration parameters from credentials section . If credential section is present instead than it returns a list with only one CredentialParams . |
28,685 | public static < T extends Comparable < T > > Aggregation < T > max ( Property < ? , T > property ) { return new Max < T > ( property ) ; } | Get the max aggregation implementation for the specified property . |
28,686 | public static < T extends Comparable < T > > Aggregation < T > min ( Property < ? , T > property ) { return new Min < T > ( property ) ; } | Get the min aggregation implementation for the specified property . |
28,687 | public static < T extends Number & Comparable < T > > Aggregation < T > sum ( Property < ? , T > property ) { return new Sum < T > ( property ) ; } | Get the sum aggregation implementation for the specified property . |
28,688 | protected boolean setConnector ( ) { if ( this . host == null ) { log . error ( "No host value set, cannot set up socket connector." ) ; return false ; } if ( this . port < 0 || this . port > 65535 ) { log . error ( "Port value is invalid {}." , Integer . valueOf ( this . port ) ) ; return false ; } if ( this . connect... | Configures the IO connector to establish a connection to the aggregator . |
28,689 | protected void handshakeMessageReceived ( IoSession session , HandshakeMessage handshakeMessage ) { log . debug ( "Received {}" , handshakeMessage ) ; this . receivedHandshake = handshakeMessage ; Boolean handshakeCheck = this . checkHandshake ( ) ; if ( handshakeCheck == null ) { return ; } if ( Boolean . TRUE . equal... | Verifies the received and notifies listeners if the connection is ready to send samples . If the handshake was invalid disconnects from the aggregator . |
28,690 | protected void finishConnection ( ) { this . connector . dispose ( ) ; this . connector = null ; for ( ConnectionListener listener : this . connectionListeners ) { listener . connectionEnded ( this ) ; } if ( this . executors != null ) { this . executors . destroy ( ) ; } } | Cleans - up any session - related constructs when this interface will no longer attempt connections to the aggregator . Notifies listener that the connection has ended permanently . |
28,691 | public boolean sendSample ( SampleMessage sampleMessage ) { if ( ! this . canSendSamples ) { log . warn ( "Cannot send samples." ) ; return false ; } if ( this . session . getScheduledWriteMessages ( ) > this . maxOutstandingSamples ) { log . warn ( "Buffer full, cannot send sample." ) ; return false ; } this . session... | Sends a sample to the aggregator . |
28,692 | public static String getHexdump ( final ByteBuffer in ) { int size = in . remaining ( ) ; if ( size == 0 ) { return "ByteBufferUtils::getHexdump buffer is empty" ; } final StringBuilder out = new StringBuilder ( ( in . remaining ( ) * 3 ) - 1 ) ; final int mark = in . position ( ) ; int byteValue = in . get ( ) & 0xFF ... | Utility method for dumping a buffer in hex . |
28,693 | public static boolean removeAll ( Iterable < ? > removeFrom , Collection < ? > elementsToRemove ) { return ( removeFrom instanceof Collection ) ? ( ( Collection < ? > ) removeFrom ) . removeAll ( checkNotNull ( elementsToRemove ) ) : Iterators . removeAll ( removeFrom . iterator ( ) , elementsToRemove ) ; } | Removes from an iterable every element that belongs to the provided collection . |
28,694 | public static boolean retainAll ( Iterable < ? > removeFrom , Collection < ? > elementsToRetain ) { return ( removeFrom instanceof Collection ) ? ( ( Collection < ? > ) removeFrom ) . retainAll ( checkNotNull ( elementsToRetain ) ) : Iterators . retainAll ( removeFrom . iterator ( ) , elementsToRetain ) ; } | Removes from an iterable every element that does not belong to the provided collection . |
28,695 | @ GwtIncompatible ( "Array.newInstance(Class, int)" ) public static < T > T [ ] toArray ( Iterable < ? extends T > iterable , Class < T > type ) { Collection < ? extends T > collection = toCollection ( iterable ) ; T [ ] array = ObjectArrays . newArray ( type , collection . size ( ) ) ; return collection . toArray ( ar... | Copies an iterable s elements into an array . |
28,696 | private Pattern compile ( final String tagIdentifiers , final boolean ignoreCase ) { try { String [ ] tags ; if ( tagIdentifiers . indexOf ( ',' ) == - 1 ) { tags = new String [ ] { tagIdentifiers } ; } else { tags = StringUtils . split ( tagIdentifiers , "," ) ; } List < String > regexps = new ArrayList < String > ( )... | Compiles a regular expression pattern to scan for tag identifiers . |
28,697 | public Collection < Task > scan ( final Reader reader ) throws IOException { try { if ( isInvalidPattern ) { throw new AbortException ( errorMessage . toString ( ) ) ; } LineIterator lineIterator = IOUtils . lineIterator ( reader ) ; List < Task > tasks = new ArrayList < Task > ( ) ; for ( int lineNumber = 1 ; lineIter... | Scans the specified input stream for open tasks . |
28,698 | private void init ( ) { Collection < String > paths = StringSupport . split ( classpath , ";:" , false ) ; for ( String location : paths ) { location = FileSupport . convertToUnixStylePath ( location ) ; if ( location . endsWith ( ".zip" ) || location . endsWith ( ".jar" ) ) { mapFilesInZip ( location ) ; } else { File... | Creates a map containing references of each resource to a jar or directory . |
28,699 | private void mapFilesInZip ( String fileName ) { File file = new File ( fileName ) ; fileCreationTimes . put ( file , new Long ( file . lastModified ( ) ) ) ; ZipFile zipfile ; try { zipfile = new ZipFile ( fileName ) ; } catch ( IOException ioe ) { throw new NoClassDefFoundError ( "class location '" + fileName + "' ca... | Creates a mapping to locate files in a zip file . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.