idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
29,300 | public boolean process ( Set < ? extends TypeElement > elements , RoundEnvironment environment ) { Messager messager = processingEnv . getMessager ( ) ; for ( TypeElement element : elements ) { Set < ? extends Element > elementsAnnotatedWith = environment . getElementsAnnotatedWith ( element ) ; for ( Element elementAn... | Generates metamodel Java source file of the specified Acid House entity class representations . |
29,301 | protected URLConnection openConnection ( URL url ) throws IOException { logger . trace ( "opening connection to resource '{}' (protocol: '{}')" , url . getPath ( ) , url . getProtocol ( ) ) ; URL resource = classloader . getResource ( url . getPath ( ) ) ; return resource . openConnection ( ) ; } | Opens a connection to the given resource if found in the classpath . |
29,302 | public static < T > Pair < T , IterableIterator < T > > takeOneFromTopN ( Iterator < T > iterator , int n ) { if ( ! iterator . hasNext ( ) || n < 1 ) { return new Pair < T , IterableIterator < T > > ( null , iterable ( iterator ) ) ; } List < T > firstN = new ArrayList < > ( n ) ; int i = 0 ; while ( i < n && iterator... | Takes one of the first n items of the iterator returning that item an a new Iterator which excludes that item . Remove operation is not supported on the first n items of the returned iterator . For the remaining items remove delegates to the original Iterator . |
29,303 | public static Prefer valueOf ( final String value ) { if ( nonNull ( value ) ) { final Map < String , String > data = new HashMap < > ( ) ; final Set < String > params = new HashSet < > ( ) ; stream ( value . split ( ";" ) ) . map ( String :: trim ) . map ( pref -> pref . split ( "=" , 2 ) ) . forEach ( x -> { if ( x .... | Create a Prefer header representation from a header string |
29,304 | public CredentialParams lookup ( String correlationId ) throws ApplicationException { if ( _credentials . size ( ) == 0 ) return null ; for ( CredentialParams credential : _credentials ) { if ( ! credential . useCredentialStore ( ) ) return credential ; } for ( CredentialParams credential : _credentials ) { if ( creden... | Looks up component credential parameters . If credentials are configured to be retrieved from Credential store it finds a ICredentialStore and lookups credentials there . |
29,305 | public static Response loadFromBase64XML ( Sso ssoService , String base64xml ) throws CertificateException , ParserConfigurationException , SAXException , IOException { return loadFromBase64XML ( ssoService . getSamlSettings ( ) . getIdpCertificate ( ) , base64xml ) ; } | Load the response with the provided base64 encoded XML string |
29,306 | public boolean isValid ( ) { NodeList nodes = xmlDoc . getElementsByTagNameNS ( XMLSignature . XMLNS , "Signature" ) ; if ( nodes == null || nodes . getLength ( ) == 0 ) { logger . debug ( "Can't find signature in document" ) ; return false ; } if ( setIdAttributeExists ( ) ) { tagIdAttributes ( xmlDoc ) ; } X509Certif... | Check if the XML response provided by the IDP is valid or not |
29,307 | private String surroundFields ( String csvData ) { StringBuilder surroundedCSV = null ; StringTokenizer currTokenizer = null ; surroundedCSV = new StringBuilder ( ) ; for ( String currLine : csvData . split ( BREAK ) ) { currTokenizer = new StringTokenizer ( currLine , SEP ) ; while ( currTokenizer . hasMoreTokens ( ) ... | Surround the given CSV data with quotations for every field . |
29,308 | private void writeFile ( File file , String csvData ) throws IOException { LOG . debug ( "Will try to write CSV data to file: " + file . getAbsolutePath ( ) ) ; FileUtils . writeStringToFile ( file , csvData , Charset . forName ( ENCODING ) , false ) ; LOG . debug ( "Finished writing CSV data to file: " + file . getAbs... | Write the given string to the file provided . |
29,309 | public void close ( ) throws Exception { BufferedWriter writer = null ; try { FileWriter fw = new FileWriter ( file . getAbsoluteFile ( ) ) ; writer = new BufferedWriter ( fw ) ; String header = layout . getFileHeader ( ) ; if ( header != null ) { writer . append ( header ) ; } String presentationHeader = layout . getP... | Close the trace and write the file |
29,310 | public Context createChild ( ) { Context c = new Context ( ) ; c . memoryHeap = memoryHeap ; c . parent = this ; this . children . add ( c ) ; return c ; } | Create child context |
29,311 | public void set ( String name , Object o ) { Map < String , Object > m = getMap ( name ) ; if ( m != null ) { memoryHeap . release ( m . get ( name ) ) ; m . put ( name , o ) ; memoryHeap . take ( m . get ( name ) ) ; } } | Find and set parameter from this context and upwards |
29,312 | public void remove ( String name ) { Map < String , Object > m = getMap ( name ) ; if ( m != null ) { memoryHeap . release ( m . get ( name ) ) ; m . remove ( name ) ; } } | Find and remove parameter from this context and upwards |
29,313 | public Map < String , Object > getMap ( String name ) { if ( variables . containsKey ( name ) ) return variables ; else if ( parent != null ) return parent . getMap ( name ) ; return null ; } | Find map containing parameter from this context and upwards |
29,314 | public Object convertUponGet ( final Object value ) { if ( value == null ) { return null ; } return _formatter . format ( ( Date ) value ) ; } | from Date to String |
29,315 | public Object convertUponSet ( final Object value ) { Date date = null ; if ( value != null ) { try { date = _formatter . parse ( ( String ) value ) ; } catch ( ParseException p_ex ) { throw new IllegalArgumentException ( p_ex . getMessage ( ) ) ; } } return date ; } | from String to Date |
29,316 | public void createTables ( ) { Validate . notNull ( connector , "connector must not be null" ) ; Validate . notNull ( tableOperations , "tableOperations must not be null" ) ; Value defaultFieldDelimiter = new Value ( "\t" . getBytes ( charset ) ) ; Value defaultFactDelimiter = new Value ( "|" . getBytes ( charset ) ) ;... | Create D4M tables . |
29,317 | private void executeCommand ( File newFile , List < String > processParams ) throws IOException { long startTime = System . currentTimeMillis ( ) ; if ( newFile . exists ( ) ) { LOG . debug ( "{} already exists. Trying to delete." , newFile ) ; newFile . delete ( ) ; } if ( ! newFile . getParentFile ( ) . exists ( ) ) ... | Executes a command . The actual command has already been configured and is passed via the processParams parameter . These will be passed to a |
29,318 | public static ToIntFunction < IntTuple > lexicographicalIndexer ( IntTuple size ) { Objects . requireNonNull ( size , "The size is null" ) ; IntTuple reversedProducts = IntTupleFunctions . exclusiveScan ( IntTuples . reversed ( size ) , 1 , ( a , b ) -> a * b , null ) ; IntTuple sizeProducts = IntTuples . reverse ( rev... | Creates a function that maps multidimensional indices to 1D indices . The function will create consecutive 1D indices for indices that are given in lexicographical order . |
29,319 | public static ToIntFunction < IntTuple > colexicographicalIndexer ( IntTuple size ) { Objects . requireNonNull ( size , "The size is null" ) ; IntTuple sizeProducts = IntTupleFunctions . exclusiveScan ( size , 1 , ( a , b ) -> a * b , null ) ; return indices -> IntTuples . dot ( indices , sizeProducts ) ; } | Creates a function that maps multidimensional indices to 1D indices . The function will create consecutive 1D indices for indices that are given in colexicographical order . |
29,320 | public Simulation create ( ) { if ( tickCount == null ) throw new IllegalStateException ( "tick count not set" ) ; return new SimulationImpl ( tickCount , phases , members , series , services ) ; } | Creates a simulation with the defined parameters . |
29,321 | private static Class < ? > findClass ( String name ) throws LauncherException { for ( ClassLoader clsLoader : new ClassLoader [ ] { Thread . currentThread ( ) . getContextClassLoader ( ) , CLASS . getClassLoader ( ) } ) try { return clsLoader . loadClass ( name ) ; } catch ( ClassNotFoundException ignored ) { logger . ... | Tries to find a class by name using the thread context class loader and this class s class loader . |
29,322 | public static Process getProcess ( String mainClass , String ... args ) throws LauncherException , IOException { return getProcessBuilder ( mainClass , args ) . start ( ) ; } | Get a process for a JVM . The class path for the JVM is computed based on the class loaders for the main class . |
29,323 | public String toJSON ( ) { StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( "{\n" ) ; buffer . append ( "\tfile: \'" ) . append ( file . getAbsolutePath ( ) ) . append ( "',\n" ) ; buffer . append ( "\tformat: \'" ) . append ( format ) . append ( "',\n" ) ; buffer . append ( "\taddressing: \'" ) . appen... | Returns a JSON representation of the object . |
29,324 | public static boolean isPublicAddress ( final InetAddress ia ) { return ! ia . isSiteLocalAddress ( ) && ! ia . isLinkLocalAddress ( ) && ! ia . isAnyLocalAddress ( ) && ! ia . isLoopbackAddress ( ) && ! ia . isMulticastAddress ( ) ; } | Returns whether or not the specified address represents an address on the public Internet . |
29,325 | public static Collection < InetAddress > getNetworkInterfaces ( ) throws SocketException { final Collection < InetAddress > addresses = new ArrayList < InetAddress > ( ) ; final Enumeration < NetworkInterface > e = NetworkInterface . getNetworkInterfaces ( ) ; while ( e . hasMoreElements ( ) ) { final NetworkInterface ... | Utility method for accessing public interfaces . |
29,326 | public AttributeType getTagAttribute ( ) { if ( tagAttributeType == null ) { synchronized ( this ) { if ( tagAttributeType == null ) { String attribute = Config . get ( typeName , name ( ) , "tag" ) . asString ( ) ; if ( StringUtils . isNullOrBlank ( attribute ) && ! AnnotationType . ROOT . equals ( getParent ( ) ) ) {... | Gets the attribute associated with the tag of this annotation . |
29,327 | public Annotation floor ( Annotation annotation , AnnotationType type ) { if ( annotation == null || type == null ) { return Fragments . detachedEmptyAnnotation ( ) ; } for ( Annotation a : Collect . asIterable ( new NodeIterator ( root , - 1 , annotation . start ( ) , type , false ) ) ) { if ( a . isInstance ( type ) ... | Floor annotation . |
29,328 | public Annotation ceiling ( Annotation annotation , AnnotationType type ) { if ( annotation == null || type == null ) { return Fragments . detachedEmptyAnnotation ( ) ; } for ( Annotation a : Collect . asIterable ( new NodeIterator ( root , annotation . end ( ) , Integer . MAX_VALUE , type , true ) ) ) { if ( a . isIns... | Ceiling annotation . |
29,329 | public static void clear ( ) { lock . writeLock ( ) . lock ( ) ; try { allStrings = new EfficientStringBiMap ( HASH_MODULO ) ; indexCounter . set ( 0 ) ; } finally { lock . writeLock ( ) . unlock ( ) ; } } | Clears the registry of existing Strings and resets the index to 0 . Use this to free up memory . |
29,330 | public static void setDefaultEnvironment ( String environment ) { System . setProperty ( "pelzer.environment" , environment ) ; Logging . getLogger ( EnvironmentManager . class ) ; PropertyManager . setDefaultEnvironment ( environment ) ; } | Overrides and resets the PropertyManager to a new environment . |
29,331 | public void handleNotification ( Notification notification , Object handback ) { try { method . invoke ( target , notification , handback ) ; } catch ( Exception e ) { LOG . error ( "Could not invoke MessageListener method " + method + " on " + target , e ) ; } } | Invokes the registered method on the target object . |
29,332 | public static < T > Function < T , Void > addTo ( final Collection < T > collection ) { return new Function < T , Void > ( ) { public Void apply ( T arg ) { collection . add ( arg ) ; return null ; } } ; } | Returns a function that adds its argument to the given collection . |
29,333 | public static < T , K > Function < T , Void > addTo ( final Map < K , T > map , final Function < ? super T , ? extends K > keyMaker ) { return new Function < T , Void > ( ) { public Void apply ( T arg ) { map . put ( keyMaker . apply ( arg ) , arg ) ; return null ; } } ; } | Returns a function that adds its argument to a map using a supplied function to determine the key . |
29,334 | protected static String parameterize ( String config , ConfigParams parameters ) throws IOException { if ( parameters == null ) { return config ; } Handlebars handlebars = new Handlebars ( ) ; Template template = handlebars . compileInline ( config ) ; return template . apply ( parameters ) ; } | Parameterized configuration template given as string with dynamic parameters . |
29,335 | @ SuppressWarnings ( "unchecked" ) public static DataProviderFactory create ( final Object ... args ) { final Class < ? extends DataProviderFactory > dataProviderClass = findDataProviderImpl ( ) ; final DataProviderFactory factory ; try { Constructor < ? extends DataProviderFactory > dataProviderConstructor = null ; fi... | Initialise the Data Provider Factory with the required data . |
29,336 | public void put ( DajlabModelInterface model ) { if ( model != null ) { String name = model . getClass ( ) . getName ( ) ; dajlab . put ( name , model ) ; } } | Add a model to the map . |
29,337 | public < T extends DajlabModelInterface > T get ( Class < T > clazz ) { T ret = null ; try { ret = ( T ) dajlab . get ( clazz . getName ( ) ) ; } catch ( ClassCastException e ) { e . printStackTrace ( ) ; } return ret ; } | Get a model from the map using the class . |
29,338 | public void registerFileDir ( Path dir , String fileType , ReloadableFile reloadableFile ) throws IOException { WatchKey key = dir . register ( watcher , ENTRY_MODIFY ) ; List < FileInfo > fileInfos = addOnMap . get ( key ) ; if ( fileInfos != null ) { fileInfos . add ( new FileInfo ( dir , fileType , reloadableFile ) ... | Use this method to register a file with the watcherService |
29,339 | private boolean isFileType ( WatchEvent event , String fileType ) { return event . context ( ) . toString ( ) . contains ( fileType ) ; } | Checks if an event belongs to the desired file type |
29,340 | public void run ( ) { while ( true ) { WatchKey key ; try { key = watcher . take ( ) ; } catch ( InterruptedException e ) { log . warn ( e ) ; continue ; } List < FileInfo > fileInfos = addOnMap . get ( key ) ; checkAndProcessFileInfo ( key , fileInfos ) ; boolean valid = key . reset ( ) ; if ( ! valid ) { addOnMap . r... | Main method of fileManager it constantly waits for new events and then processes them |
29,341 | public static < F , S > Failure < F , S > failure ( final F x ) { return new Failure < F , S > ( x ) ; } | Produce a new failure value . |
29,342 | public CommunicationServiceBuilder limit ( String socketName , Integer uplinkRate , Integer downlinkRate ) { checkUncreated ( ) ; this . uplink . put ( socketName , uplinkRate ) ; this . downlink . put ( socketName , downlinkRate ) ; return this ; } | Limits the given socket name to the given uplink and downlink byte rates . |
29,343 | public CommunicationServiceBuilder limit ( String socketName , Integer rate ) { return limit ( socketName , rate , rate ) ; } | Limits the given socket name to the given byte rates both uplink and downlink . |
29,344 | public CommunicationServiceBuilder delay ( String socketName , Long updelay , Long downdelay ) { checkUncreated ( ) ; this . updelay . put ( socketName , updelay ) ; this . downdelay . put ( socketName , downdelay ) ; return this ; } | Adds a delay to the given socket . |
29,345 | public CommunicationServiceBuilder delay ( String socketName , Long delay ) { return delay ( socketName , delay , delay ) ; } | Adds a delay to the given socket both uplink and downlink . |
29,346 | public FulltextMatch setProperties ( final Collection < String > properties ) { if ( properties == null || properties . size ( ) == 0 ) { clearProperties ( ) ; return this ; } synchronized ( properties ) { for ( String binding : properties ) { if ( binding == null ) { throw new IllegalArgumentException ( "null element"... | Sets the properties . First the previous elements are cleared and all of the specified properties are appended . The properties are appended in the array order . |
29,347 | public FulltextMatch addProperty ( final String property ) { if ( property == null ) { throw new IllegalArgumentException ( "no property specified" ) ; } _properties . add ( property ) ; return this ; } | Appends the specified property . |
29,348 | public FulltextMatch setPatterns ( final Collection < String > patterns ) { if ( patterns == null || patterns . size ( ) == 0 ) { clearPatterns ( ) ; return this ; } synchronized ( patterns ) { for ( String pattern : patterns ) { if ( pattern == null || pattern . length ( ) == 0 ) { throw new IllegalArgumentException (... | Sets the matching patterns . |
29,349 | public FulltextMatch addPattern ( final String pattern ) { if ( pattern == null || pattern . length ( ) == 0 ) { throw new IllegalArgumentException ( "no pattern specified" ) ; } _patterns . add ( pattern ) ; return this ; } | Appends the specified matching pattern . |
29,350 | public boolean isEmpty ( ) throws IOException { Closer closer = Closer . create ( ) ; try { Reader reader = closer . register ( openStream ( ) ) ; return reader . read ( ) == - 1 ; } catch ( Throwable e ) { throw closer . rethrow ( e ) ; } finally { closer . close ( ) ; } } | Returns whether the source has zero chars . The default implementation is to open a stream and check for EOF . |
29,351 | public void destroySession ( ) { if ( entryPoint != null ) { entryPoint . onSessionDestruction ( this , session ) ; } if ( accessManager != null ) { accessManager . destroyCurrentSession ( ) ; } session = null ; } | Destroys current session . |
29,352 | public void setAttribute ( Object key , Object value ) { if ( attributes == null ) { attributes = new HashMap ( 5 ) ; } attributes . put ( key , value ) ; } | Stores object during the lifespan of the request . Use with care . |
29,353 | public User login ( Credentials credentials ) throws AuthenticationException { User user = getSession ( true ) . login ( credentials ) ; entryPoint . onSessionUpdate ( this , session ) ; return user ; } | Tries to perform login on entry realm . Creates session if necessary . |
29,354 | public Session resolveSession ( String sessionToken , String userId ) { this . sessionToken = sessionToken ; this . userId = userId ; if ( accessManager != null ) { this . session = accessManager . getSessionByToken ( sessionToken ) ; } return session ; } | Tries to get a reference to the session identified by sessionToken |
29,355 | static SecurityBreachHandler createBreachHandler ( Main main , SystemMail systemMail , String toAddress ) throws IllegalAccessException { if ( ! exists ) { SecurityBreachHandler breachHandler = new SecurityBreachHandler ( main , systemMail , toAddress ) ; exists = true ; return breachHandler ; } throw new IllegalAccess... | Creates a SecurityBreachHandler . There can only be one single SecurityBreachHandler so calling this method twice will cause an illegal access exception . |
29,356 | public JmxTree filterTree ( JmxTree tree , String filter , boolean includeChildren ) { String nameFilter = filter . trim ( ) . toLowerCase ( ) ; Set < DomainNode > domainNodes = new TreeSet < DomainNode > ( ) ; for ( JmxTreeNode domain : tree . getRoot ( ) . getChildren ( ) ) { Set < ObjectNode > objectNodes = new Tree... | Returns a filtered tree from the supplied tree . |
29,357 | private Set < JmxTreeNode > getMatchingChildren ( String nameFilter , ObjectNode objectNode ) { AttributesNode attributesNode = null ; OperationsNode operationsNode = null ; NotificationsNode notificationsNode = null ; Set < JmxTreeNode > objectChildren = new TreeSet < JmxTreeNode > ( ) ; for ( JmxTreeNode child : obje... | Returns the matching child nodes of a ManagedObject . |
29,358 | private static void logHeader ( Status original ) { long id = original . getId ( ) ; String user = original . getUser ( ) . getScreenName ( ) ; String message = String . format ( MESSAGE_HEADER , id , user ) ; System . out . println ( message ) ; } | Prints a message header |
29,359 | private static void logOriginal ( Status original ) { String text = original . getText ( ) ; String message = String . format ( MESSAGE_ORIGINAL , text ) ; System . out . println ( message ) ; } | Prints an original tweet |
29,360 | private static void logResponse ( StatusUpdate response ) { String text = response . getStatus ( ) ; String message = String . format ( MESSAGE_RESPONSE , text ) ; System . out . println ( message ) ; } | Prints a response tweet |
29,361 | public JSONObject invokeJson ( ) throws InternalException , CloudException { ClientAndResponse clientAndResponse = null ; String content ; try { clientAndResponse = invokeInternal ( ) ; Header contentType = clientAndResponse . response . getFirstHeader ( "content-type" ) ; if ( ! "application/json" . equalsIgnoreCase (... | Invokes the method and returns the response body as a JSON object |
29,362 | public Map < String , String > invokeHeaders ( ) throws InternalException , CloudException { ClientAndResponse clientAndResponse = invokeInternal ( ) ; try { Map < String , String > headers = new HashMap < String , String > ( ) ; for ( Header header : clientAndResponse . response . getAllHeaders ( ) ) { headers . put (... | Invokes the method and returns the response headers |
29,363 | public void invoke ( ) throws InternalException , CloudException { final ClientAndResponse clientAndResponse = invokeInternal ( ) ; clientAndResponse . client . getConnectionManager ( ) . shutdown ( ) ; } | Invokes the method and returns nothing |
29,364 | public Object getRoot ( ) { Chain current = this ; while ( current . hasParent ( ) ) { current = current . getParent ( ) ; } return current . getValue ( ) ; } | Returns the root object of this chain . |
29,365 | public void notifyStart ( String projectName , String projectVersion , String category ) { try { if ( isStarted ( ) ) { JSONObject startNotification = new JSONObject ( ) . put ( "project" , new JSONObject ( ) . put ( "name" , projectName ) . put ( "version" , projectVersion ) ) . put ( "category" , category ) ; socket ... | Send a starting notification to Mini ROX |
29,366 | public void notifyEnd ( String projectName , String projectVersion , String category , long duration ) { try { if ( isStarted ( ) ) { JSONObject endNotification = new JSONObject ( ) . put ( "project" , new JSONObject ( ) . put ( "name" , projectName ) . put ( "version" , projectVersion ) ) . put ( "category" , category... | Send a ending notification to Mini ROX |
29,367 | public void send ( RoxPayload payload ) { try { if ( isStarted ( ) ) { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; new JsonSerializer ( ) . serializePayload ( new OutputStreamWriter ( baos ) , payload , false ) ; socket . emit ( "payload" , new String ( baos . toByteArray ( ) ) ) ; } else { LOGGER . wa... | Send a payload to the MINI ROX . This is a best effort and when the request failed there is no crash |
29,368 | public String [ ] getFilters ( ) { try { if ( isStarted ( ) ) { final MiniRoxFilterAcknowledger acknowledger = new MiniRoxFilterAcknowledger ( ) ; new Thread ( new Runnable ( ) { public void run ( ) { try { LOGGER . trace ( "Retrieve filters" ) ; socket . emit ( "filters:get" , acknowledger ) ; } catch ( Exception e ) ... | Try to get a filter list from MINI ROX |
29,369 | private Socket createConnectedSocket ( final String miniRoxUrl ) { try { final Socket initSocket = IO . socket ( miniRoxUrl ) ; final MiniRoxCallback callback = new MiniRoxCallback ( ) ; initSocket . on ( Socket . EVENT_CONNECT , callback ) ; initSocket . on ( Socket . EVENT_CONNECT_ERROR , callback ) ; initSocket . on... | Create a new connection to MiniROX |
29,370 | public static Map < String , Object > get ( CollectionId c , Map < String , Object > search ) throws NotFoundException , MoreThanOneFoundException { ensureOnlyOne ( c , search ) ; DBCollection coll = MongoDBConnectionHelper . getConnection ( c . getDatabase ( ) ) . getCollection ( c . getCollection ( ) ) ; Map < String... | Select exactly one record from collection |
29,371 | protected Violation createViolation ( HtmlElement htmlElement , Page page , String message ) { if ( htmlElement == null ) htmlElement = page . findHtmlTag ( ) ; return new Violation ( this , htmlElement , message ) ; } | Creates a new violation for that rule with the line number of the violating element in the given page and a message that describes the violation in detail . |
29,372 | String getWhereClause ( ) { final StringGrabber sgWhere = new StringGrabber ( ) ; List < Field > primaryKeyFieldList = getPrimaryKeyFieldList ( ) ; if ( primaryKeyFieldList . size ( ) > 0 ) { sgWhere . append ( "WHERE " ) ; for ( Field field : primaryKeyFieldList ) { DBColumn dbColumn = field . getAnnotation ( DBColumn... | generate where clause of current model class |
29,373 | public void attach ( ElementHandler < T > handler ) { NodeState < T > state = buildState ( ) ; context . addElementHandler ( state , handler ) ; } | Attach an ElementHandler to this selector or chain of selectors . The attached handler will receive notifications for every selected element . |
29,374 | public static < I , O > Iterable < O > map ( Iterable < I > it , Processor < I , O > processor ) { return new ProcessingIterable < I , O > ( it . iterator ( ) , processor ) ; } | Implement a map operation that applies a processor to each element in the wrapped iterator and iterates over the resulting output . |
29,375 | public static < I , S , O > Processor < I , O > compose ( final Processor < I , S > first , final Processor < S , O > last , final Processor < O , O > ... extraSteps ) { return new Processor < I , O > ( ) { public O process ( I input ) { O result = last . process ( first . process ( input ) ) ; for ( Processor < O , O ... | Compose two or more processors into one . |
29,376 | public static < T > Iterable < T > compose ( final Iterable < Iterable < T > > iterables ) { return toIterable ( new Iterator < T > ( ) { Iterator < Iterable < T > > it = iterables . iterator ( ) ; Iterator < T > current = null ; T next = null ; public boolean hasNext ( ) { if ( next != null ) { return true ; } else { ... | Given a number of iterables construct a iterable that iterates all of the iterables . |
29,377 | public static < I , O > Iterable < O > castingIterable ( Iterable < I > it , Class < O > clazz ) { return map ( it , new Processor < I , O > ( ) { @ SuppressWarnings ( "unchecked" ) public O process ( I input ) { return ( O ) input ; } } ) ; } | Allows you to iterate over objects and cast them to the appropriate type on the fly . |
29,378 | public static < T > T copy ( T orig ) { if ( orig == null ) return null ; try { ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; ObjectOutputStream oos = new ObjectOutputStream ( bos ) ; oos . writeObject ( orig ) ; oos . flush ( ) ; ByteArrayInputStream bin = new ByteArrayInputStream ( bos . toByteArray ( )... | Copy object deeply |
29,379 | public static boolean isNullOrEmpty ( Object obj ) { if ( obj == null ) return true ; if ( obj instanceof String ) { return ( ( ( String ) obj ) . isEmpty ( ) ) ; } if ( obj instanceof Map ) { return ( ( Map ) obj ) . isEmpty ( ) ; } if ( obj instanceof List ) { return ( ( List ) obj ) . isEmpty ( ) ; } if ( obj instan... | Returns true if object is null or empty |
29,380 | public static < T > T cast ( Object obj , String type ) { return ( T ) cast ( obj , resolveType ( type ) ) ; } | Resolves type and returns casted object |
29,381 | RuleReturnScope invoke ( Parser parser ) throws Exception { assert parser != null ; return ( RuleReturnScope ) method . invoke ( parser , arguments ) ; } | Invoke the selected parser method with its arguments |
29,382 | RuleReturnScope invoke ( TreeParser treeParser ) throws Exception { assert treeParser != null ; return ( RuleReturnScope ) method . invoke ( treeParser , arguments ) ; } | Invoke the selected tree parser method with its arguments |
29,383 | public ArchiveService createArchiveService ( final String endpointUrl ) { return new RestAdapter . Builder ( ) . setEndpoint ( endpointUrl ) . setErrorHandler ( errorHandler ) . setConverter ( new JacksonArchivedSequenceConverter ( jsonFactory ) ) . build ( ) . create ( ArchiveService . class ) ; } | Create and return a new archive service with the specified endpoint URL . |
29,384 | public VariationService createVariationService ( final String endpointUrl ) { return new RestAdapter . Builder ( ) . setEndpoint ( endpointUrl ) . setErrorHandler ( errorHandler ) . setConverter ( new JacksonVariationConverter ( jsonFactory ) ) . build ( ) . create ( VariationService . class ) ; } | Create and return a new variation service with the specified endpoint URL . |
29,385 | public SequenceService createSequenceService ( final String endpointUrl ) { return new RestAdapter . Builder ( ) . setEndpoint ( endpointUrl ) . setErrorHandler ( errorHandler ) . setConverter ( new JacksonSequenceConverter ( jsonFactory ) ) . build ( ) . create ( SequenceService . class ) ; } | Create and return a new sequence service with the specified endpoint URL . |
29,386 | public static String crypt ( String strpw , String strsalt ) { char [ ] pw = strpw . toCharArray ( ) ; char [ ] salt = strsalt . toCharArray ( ) ; byte [ ] pwb = new byte [ 66 ] ; char [ ] result = new char [ 13 ] ; byte [ ] new_etr = new byte [ etr . length ] ; int n = 0 ; int m = 0 ; while ( m < pw . length && n < 64... | Returns a String containing the encrypted passwd |
29,387 | public void setValue ( int value ) { if ( value < min || value > max ) { throw new IllegalArgumentException ( "The value " + value + " is out of the admitted range [" + min + ", " + max + "]." ) ; } if ( value != min && value != max ) { if ( timer == null ) { logger . trace ( "creating timer" ) ; timer = new Timer ( 50... | Sets the current progress arc value . |
29,388 | public static PrefixedProperties createCascadingPrefixProperties ( final List < PrefixConfig > configs ) { PrefixedProperties properties = null ; for ( final PrefixConfig config : configs ) { if ( properties == null ) { properties = new PrefixedProperties ( ( config == null ) ? new DynamicPrefixConfig ( ) : config ) ; ... | Creates the cascading prefix properties . |
29,389 | public static PrefixedProperties createCascadingPrefixProperties ( final String prefixString ) { return prefixString . indexOf ( PrefixConfig . PREFIXDELIMITER ) != - 1 ? createCascadingPrefixProperties ( prefixString . split ( "\\" + PrefixConfig . PREFIXDELIMITER ) ) : createCascadingPrefixProperties ( new String [ ]... | Creates the cascading prefix properties . This method parses the given prefixString and creates for each delimiter part a PrefixedProperties . |
29,390 | public static PrefixedProperties createCascadingPrefixProperties ( final String [ ] prefixes ) { PrefixedProperties properties = null ; for ( final String aPrefix : prefixes ) { if ( properties == null ) { properties = new PrefixedProperties ( aPrefix ) ; } else { properties = new PrefixedProperties ( properties , aPre... | Creates the cascading prefix properties by using the given Prefixes . |
29,391 | public boolean getBoolean ( final String key , final boolean def ) { final String value = getProperty ( key ) ; return value != null ? Boolean . valueOf ( value ) . booleanValue ( ) : def ; } | Gets the prefixed key and parse it to an boolean - value . |
29,392 | public double getDouble ( final String key ) { final String value = getProperty ( key ) ; if ( value == null ) { throw new NumberFormatException ( "Couldn't parse property to double." ) ; } return Double . parseDouble ( value ) ; } | Gets the prefixed key and parse it to an double - value . |
29,393 | public String getEffectivePrefix ( ) { lock . readLock ( ) . lock ( ) ; try { final boolean useLocalPrefixes = ! mixDefaultAndLocalPrefixes && hasLocalPrefixConfigurations ( ) ; return getPrefix ( new StringBuilder ( ) , useLocalPrefixes ) . toString ( ) ; } finally { lock . readLock ( ) . unlock ( ) ; } } | Gets the effective prefix . |
29,394 | public float getFloat ( final String key ) { final String value = getProperty ( key ) ; if ( value == null ) { throw new NumberFormatException ( "Couldn't parse property to float." ) ; } return Float . parseFloat ( value ) ; } | Gets the prefixed key and parse it to an float - value . |
29,395 | public int getInt ( final String key ) { final String value = getProperty ( key ) ; if ( value == null ) { throw new NumberFormatException ( "Couldn't parse property to int." ) ; } return Integer . parseInt ( value ) ; } | Gets the prefixed key and parse it to an int - value . |
29,396 | public long getLong ( final String key ) { final String value = getProperty ( key ) ; if ( value == null ) { throw new NumberFormatException ( "Couldn't parse property to long." ) ; } return Long . parseLong ( value ) ; } | Gets the prefixed key and parse it to an long - value . |
29,397 | public void setDefaultPrefix ( final String prefix ) { lock . writeLock ( ) . lock ( ) ; try { final String myPrefix = checkAndConvertPrefix ( prefix ) ; final List < String > prefixList = split ( myPrefix ) ; setDefaultPrefixes ( prefixList ) ; } finally { lock . writeLock ( ) . unlock ( ) ; } } | Sets the default prefix . |
29,398 | public void setLocalPrefix ( final String configuredPrefix ) { lock . writeLock ( ) . lock ( ) ; try { final String myPrefix = checkAndConvertPrefix ( configuredPrefix ) ; final List < String > prefixList = split ( myPrefix ) ; setPrefixes ( prefixList ) ; } finally { lock . writeLock ( ) . unlock ( ) ; } } | Sets the local Prefix . The local Prefix is Thread depended and will only affect the current thread . You can have a combination of default and local prefix . |
29,399 | public void setMixDefaultAndLocalPrefixSettings ( final boolean value ) { this . mixDefaultAndLocalPrefixes = value ; if ( properties instanceof PrefixedProperties ) { ( ( PrefixedProperties ) properties ) . setMixDefaultAndLocalPrefixSettings ( value ) ; } } | Setting to define if default prefixes should be mixed with local prefixes if local prefixes are not present . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.