idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
9,200 | public static < E , R > R reduce ( E [ ] array , BiFunction < R , E , R > function , R init ) { return new Reductor < > ( function , init ) . apply ( new ArrayIterator < E > ( array ) ) ; } | Reduces an array of elements using the passed function . |
9,201 | public static < E > boolean every ( Iterable < E > iterable , Predicate < E > predicate ) { dbc . precondition ( iterable != null , "cannot call every with a null iterable" ) ; return new Every < E > ( predicate ) . test ( iterable . iterator ( ) ) ; } | Yields true if EVERY predicate application on the given iterable yields true . |
9,202 | public static < E > boolean every ( Iterator < E > iterator , Predicate < E > predicate ) { return new Every < E > ( predicate ) . test ( iterator ) ; } | Yields true if EVERY predicate application on the given iterator yields true . |
9,203 | public static < E > boolean every ( E [ ] array , Predicate < E > predicate ) { return new Every < E > ( predicate ) . test ( new ArrayIterator < E > ( array ) ) ; } | Yields true if EVERY predicate application on the given array yields true . |
9,204 | public static < E > int counti ( Iterator < E > iterator ) { final long value = reduce ( iterator , new Count < E > ( ) , 0l ) ; dbc . state ( value <= Integer . MAX_VALUE , "iterator size overflows an integer" ) ; return ( int ) value ; } | Counts elements contained in the iterator . |
9,205 | public void updateBestSolution ( long time , double value , SolutionType newBestSolution ) { times . add ( time ) ; values . add ( value ) ; bestSolution = newBestSolution ; } | Update the best found solution . The update time and newly obtained value are added to the list of updates and the final best solution is overwritten . |
9,206 | public static < T , U , R > Function < Pair < T , U > , R > tupled ( BiFunction < T , U , R > function ) { dbc . precondition ( function != null , "cannot apply a pair to a null function" ) ; return pair -> function . apply ( pair . first ( ) , pair . second ( ) ) ; } | Adapts a binary function to a function accepting a pair . |
9,207 | public static < T , U > Predicate < Pair < T , U > > tupled ( BiPredicate < T , U > predicate ) { dbc . precondition ( predicate != null , "cannot apply a pair to a null predicate" ) ; return pair -> predicate . test ( pair . first ( ) , pair . second ( ) ) ; } | Adapts a binary predicate to a predicate accepting a pair . |
9,208 | public static < T , U > Consumer < Pair < T , U > > tupled ( BiConsumer < T , U > consumer ) { dbc . precondition ( consumer != null , "cannot apply a pair to a null consumer" ) ; return pair -> consumer . accept ( pair . first ( ) , pair . second ( ) ) ; } | Adapts a binary consumer to an consumer accepting a pair . |
9,209 | public static < T , U , V , R > Function < Triple < T , U , V > , R > tupled ( TriFunction < T , U , V , R > function ) { dbc . precondition ( function != null , "cannot apply a triple to a null function" ) ; return triple -> function . apply ( triple . first ( ) , triple . second ( ) , triple . third ( ) ) ; } | Adapts a ternary function to a function accepting a triple . |
9,210 | public static < T , U , V > Predicate < Triple < T , U , V > > tupled ( TriPredicate < T , U , V > predicate ) { dbc . precondition ( predicate != null , "cannot apply a triple to a null predicate" ) ; return triple -> predicate . test ( triple . first ( ) , triple . second ( ) , triple . third ( ) ) ; } | Adapts a ternary predicate to a predicate accepting a triple . |
9,211 | public static < T , U , V > Consumer < Triple < T , U , V > > tupled ( TriConsumer < T , U , V > consumer ) { dbc . precondition ( consumer != null , "cannot apply a triple to a null consumer" ) ; return triple -> consumer . accept ( triple . first ( ) , triple . second ( ) , triple . third ( ) ) ; } | Adapts a ternary consumer to an consumer accepting a triple . |
9,212 | public ConnectorDescriptor removeAllNamespaces ( ) { List < String > nameSpaceKeys = new ArrayList < String > ( ) ; java . util . Map < String , String > attributes = model . getAttributes ( ) ; for ( Entry < String , String > e : attributes . entrySet ( ) ) { final String name = e . getKey ( ) ; final String value = e . getValue ( ) ; if ( value != null && value . startsWith ( "http://" ) ) { nameSpaceKeys . add ( name ) ; } } for ( String name : nameSpaceKeys ) { model . removeAttribute ( name ) ; } return this ; } | Removes all existing namespaces . |
9,213 | private void around ( final CtMethod m , final String before , final String after , final List < VarDeclarationData > declarations ) throws CannotCompileException , NotFoundException { String signature = Modifier . toString ( m . getModifiers ( ) ) + " " + m . getReturnType ( ) . getName ( ) + " " + m . getLongName ( ) ; LOG . info ( "--- Instrumenting " + signature ) ; for ( VarDeclarationData declaration : declarations ) { m . addLocalVariable ( declaration . getName ( ) , pool . get ( declaration . getType ( ) ) ) ; } m . insertBefore ( before ) ; m . insertAfter ( after ) ; } | Method introducing code before and after a given javassist method . |
9,214 | public static < T > Iterable < T > oneTime ( Iterator < T > iterator ) { return new OneTimeIterable < T > ( iterator ) ; } | Creates an iterable usable only ONE TIME from an iterator . |
9,215 | public static < T > Iterator < T > iterator ( T first , T second ) { return ArrayIterator . of ( first , second ) ; } | Creates an iterator from the passed values . |
9,216 | public static < T > Iterable < T > iterable ( T first , T second ) { return ArrayIterable . of ( first , second ) ; } | Creates an iterable from the passed values . |
9,217 | public R apply ( T1 first , T2 second ) { interceptor . before ( first , second ) ; try { return inner . apply ( first , second ) ; } finally { interceptor . after ( first , second ) ; } } | Executes a function in the nested interceptor context . |
9,218 | public static String validate ( String blz ) { return VALIDATOR . validate ( PackedDecimal . of ( blz ) ) . toString ( ) ; } | Eine BLZ darf maximal 8 - stellig sein . |
9,219 | public WeightedIndexEvaluation evaluate ( SolutionType solution , DataType data ) { WeightedIndexEvaluation eval = new WeightedIndexEvaluation ( ) ; weights . keySet ( ) . forEach ( obj -> { Evaluation objEval = obj . evaluate ( solution , data ) ; double w = weights . get ( obj ) ; if ( obj . isMinimizing ( ) ) { w = - w ; } eval . addEvaluation ( obj , objEval , w ) ; } ) ; return eval ; } | Produces an evaluation object that reflects the weighted sum of evaluations of all underlying objectives . |
9,220 | public < ActualSolutionType extends SolutionType > WeightedIndexEvaluation evaluate ( Move < ? super ActualSolutionType > move , ActualSolutionType curSolution , Evaluation curEvaluation , DataType data ) { WeightedIndexEvaluation curEval = ( WeightedIndexEvaluation ) curEvaluation ; WeightedIndexEvaluation newEval = new WeightedIndexEvaluation ( ) ; weights . keySet ( ) . forEach ( obj -> { Evaluation objCurEval = curEval . getEvaluation ( obj ) ; Evaluation objNewEval = obj . evaluate ( move , curSolution , objCurEval , data ) ; double w = weights . get ( obj ) ; if ( obj . isMinimizing ( ) ) { w = - w ; } newEval . addEvaluation ( obj , objNewEval , w ) ; } ) ; return newEval ; } | Delta evaluation . Computes a delta evaluation for each contained objective and wraps the obtained modified evaluations in a new weighted index evaluation . |
9,221 | public void serialize ( Fachwert fachwert , JsonGenerator jgen , SerializerProvider provider ) throws IOException { serialize ( fachwert . toMap ( ) , jgen , provider ) ; } | Fuer die Serialisierung wird der uebergebenen Fachwert nach seinen einzelnen Elementen aufgeteilt und serialisiert . |
9,222 | void configurePort ( String port ) { if ( StringUtils . isNotBlank ( port ) ) { try { this . port = Integer . parseInt ( port ) ; log . info ( "Using port {}" , this . port ) ; } catch ( NumberFormatException e ) { log . info ( "Unable to parse server PORT variable ({}). Defaulting to port {}" , port , this . port ) ; } } } | Configures the server port by attempting to parse the given parameter but failing gracefully if that doesn t work out . |
9,223 | void configureClasses ( String path ) { findClassesInClasspath ( ) ; if ( StringUtils . isNotBlank ( path ) ) { configureClassesReloadable ( path ) ; } packagePrefix = getValue ( PACKAGE_PREFIX ) ; classesReloadable = classesUrl != null && classesInClasspath == null ; showClassesConfiguration ( ) ; } | Sets up configuration for reloading classes . |
9,224 | private void configureAuthentication ( String username , String password , String realm ) { if ( StringUtils . isNotBlank ( username ) ) { this . username = username ; this . password = password ; this . realm = StringUtils . defaultIfBlank ( realm , "restolino" ) ; authenticationEnabled = true ; } } | Sets up authentication . |
9,225 | void showFilesConfiguration ( ) { String message ; if ( filesUrl != null ) { String reload = filesReloadable ? "reloadable" : "non-reloadable" ; message = "Files will be served from: " + filesUrl + " (" + reload + ")" ; } else { message = "No static files will be served." ; } log . info ( "Files: {}" , message ) ; } | Prints out a message confirming the static file serving configuration . |
9,226 | void showClassesConfiguration ( ) { if ( classesInClasspath != null ) { log . warn ( "Dynamic class reloading is disabled because a classes URL is present in the classpath. P" + "lease launch without including your classes directory: {}" , classesInClasspath ) ; } String message ; if ( classesReloadable ) { if ( StringUtils . isNotBlank ( packagePrefix ) ) { message = "Classes will be reloaded from: " + classesUrl ; } else { message = "Classes will be reloaded from package " + packagePrefix + " at: " + classesUrl ; } } else { message = "Classes will not be dynamically reloaded." ; } log . info ( "Classes: {}" , message ) ; } | Prints out a message confirming the class reloading configuration . |
9,227 | static String getValue ( String key ) { String result = StringUtils . defaultIfBlank ( System . getProperty ( key ) , StringUtils . EMPTY ) ; result = StringUtils . defaultIfBlank ( result , System . getenv ( key ) ) ; return result ; } | Gets a configured value for the given key from either the system properties or an environment variable . |
9,228 | public boolean isValid ( T wert ) { int length = Objects . toString ( wert , "" ) . length ( ) ; return ( length >= min ) && ( length <= max ) ; } | Liefert true zurueck wenn der uebergebene Wert innerhalb der erlaubten Laenge liegt . |
9,229 | public Analysis < SolutionType > setNumRuns ( String searchID , int n ) { if ( ! searches . containsKey ( searchID ) ) { throw new UnknownIDException ( "No search with ID " + searchID + " has been added." ) ; } if ( n <= 0 ) { throw new IllegalArgumentException ( "Number of runs should be strictly positive." ) ; } searchNumRuns . put ( searchID , n ) ; return this ; } | Set the number of runs to be performed for the given search . This does not affect the number of runs of the other searches . Returns a reference to the analysis object on which this method was called so that methods can be chained . |
9,230 | public Analysis < SolutionType > setNumBurnIn ( String searchID , int n ) { if ( ! searches . containsKey ( searchID ) ) { throw new UnknownIDException ( "No search with ID " + searchID + " has been added." ) ; } if ( n <= 0 ) { throw new IllegalArgumentException ( "Number of burn-in runs should be strictly positive." ) ; } searchNumBurnIn . put ( searchID , n ) ; return this ; } | Set the number of additional burn - in runs to be performed for the given search . This does not affect the number of burn - in runs of the other searches . Returns a reference to the analysis object on which this method was called so that methods can be chained . |
9,231 | public Analysis < SolutionType > addProblem ( String ID , Problem < SolutionType > problem ) { if ( problem == null ) { throw new NullPointerException ( "Problem can not be null." ) ; } if ( problems . containsKey ( ID ) ) { throw new DuplicateIDException ( "Duplicate problem ID: " + ID + "." ) ; } problems . put ( ID , problem ) ; return this ; } | Add a problem to be analyzed . Returns a reference to the analysis object on which this method was called so that methods can be chained . |
9,232 | public Analysis < SolutionType > addSearch ( String ID , SearchFactory < SolutionType > searchFactory ) { if ( searchFactory == null ) { throw new NullPointerException ( "Search factory can not be null." ) ; } if ( searches . containsKey ( ID ) ) { throw new DuplicateIDException ( "Duplicate search ID: " + ID + "." ) ; } searches . put ( ID , searchFactory ) ; return this ; } | Add a search to be applied to solve the analyzed problems . Requires a search factory instead of a plain search as a new instance of the search will be created for every run and for every analyzed problem . Returns a reference to the analysis object on which this method was called so that methods can be chained . |
9,233 | public AnalysisResults < SolutionType > run ( ) { AnalysisResults < SolutionType > results = new AnalysisResults < > ( ) ; LOGGER . info ( ANALYSIS_MARKER , "Started analysis of {} problems {} using {} searches {}." , problems . size ( ) , problems . keySet ( ) , searches . size ( ) , searches . keySet ( ) ) ; problems . forEach ( ( problemID , problem ) -> { LOGGER . info ( ANALYSIS_MARKER , "Analyzing problem {}." , problemID ) ; searches . forEach ( ( searchID , searchFactory ) -> { int nBurnIn = getNumBurnIn ( searchID ) ; for ( int burnIn = 0 ; burnIn < nBurnIn ; burnIn ++ ) { LOGGER . info ( ANALYSIS_MARKER , "Burn-in of search {} applied to problem {} (burn-in run {}/{})." , searchID , problemID , burnIn + 1 , nBurnIn ) ; Search < SolutionType > search = searchFactory . create ( problem ) ; search . start ( ) ; search . dispose ( ) ; LOGGER . info ( ANALYSIS_MARKER , "Finished burn-in run {}/{} of search {} for problem {}." , burnIn + 1 , nBurnIn , searchID , problemID ) ; } int nRuns = getNumRuns ( searchID ) ; for ( int run = 0 ; run < nRuns ; run ++ ) { LOGGER . info ( ANALYSIS_MARKER , "Applying search {} to problem {} (run {}/{})." , searchID , problemID , run + 1 , nRuns ) ; Search < SolutionType > search = searchFactory . create ( problem ) ; AnalysisListener listener = new AnalysisListener ( ) ; search . addSearchListener ( listener ) ; search . start ( ) ; search . dispose ( ) ; results . registerSearchRun ( problemID , searchID , listener . getSearchRunResults ( ) ) ; LOGGER . info ( ANALYSIS_MARKER , "Finished run {}/{} of search {} for problem {}." , run + 1 , nRuns , searchID , problemID ) ; } } ) ; LOGGER . info ( ANALYSIS_MARKER , "Done analyzing problem {}." , problemID ) ; } ) ; LOGGER . info ( ANALYSIS_MARKER , "Analysis complete." ) ; return results ; } | Run the analysis . The returned results can be accessed directly or written to a JSON file to be loaded into R for analysis and visualization using the james - analysis R package . The analysis progress is logged at INFO level all log messages being tagged with a marker analysis . |
9,234 | public int run ( ) { try { if ( compile ) { compile ( ) ; } String separator = "/" ; String cpseperator = ":" ; if ( System . getProperty ( "os.name" ) . contains ( "indows" ) ) { separator = "\\" ; cpseperator = ";" ; } String s = fileName . replace ( separator , "." ) ; if ( ".java" . equals ( s . substring ( s . length ( ) - 5 ) ) ) { s = s . substring ( 0 , s . length ( ) - 5 ) ; } else { s = s . substring ( 0 , s . length ( ) - 6 ) ; } String localClasspath = classpath ; if ( compileFolder != null ) localClasspath = localClasspath + cpseperator + compileFolder ; String command = "java -cp " + localClasspath ; if ( libraryPath != null && libraryPath != "" ) command += "-Djava.library.path=" + libraryPath ; command = command + " de.kopeme.testrunner.PerformanceTestRunner " + s ; Process p = Runtime . getRuntime ( ) . exec ( command ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( p . getInputStream ( ) ) ) ; String line ; BufferedWriter bw = null ; if ( externalOutputFile != null && externalOutputFile != "" ) { File output = new File ( externalOutputFile ) ; try { bw = new BufferedWriter ( new FileWriter ( output ) ) ; } catch ( IOException e1 ) { e1 . printStackTrace ( ) ; } } while ( ( line = br . readLine ( ) ) != null ) { if ( bw == null ) { System . out . println ( line ) ; } else { bw . write ( line + "\n" ) ; } } br = new BufferedReader ( new InputStreamReader ( p . getErrorStream ( ) ) ) ; while ( ( line = br . readLine ( ) ) != null ) { if ( bw == null ) { System . out . println ( line ) ; } else { bw . write ( line + "\n" ) ; } } if ( bw != null ) bw . close ( ) ; int returnValue = p . waitFor ( ) ; return returnValue ; } catch ( IOException e ) { e . printStackTrace ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } return 1 ; } | Runs KoPeMe and returns 0 if everything works allright |
9,235 | public void link ( NGScope scope , JQElement element , JSON attrs ) { ImageResource resource = scope . get ( getName ( ) ) ; if ( resource == null ) { LOG . log ( Level . WARNING , "Mandatory attribute " + getName ( ) + " value is mssing" ) ; return ; } Image image = new Image ( resource ) ; Element target = image . asWidget ( ) . getElement ( ) ; String className = element . attr ( "class" ) ; target . addClassName ( className ) ; String style = element . attr ( "style" ) ; target . setAttribute ( "style" , style ) ; element . replaceWith ( target ) ; } | Replaces the element body with the ImageResource passed via gwt - image - resource attribute . |
9,236 | public Map < String , Object > toMap ( ) { Map < String , Object > map = new HashMap < > ( ) ; map . put ( "kontoinhaber" , getKontoinhaber ( ) ) ; map . put ( "iban" , getIban ( ) ) ; getBic ( ) . ifPresent ( b -> map . put ( "bic" , b ) ) ; return map ; } | Liefert die einzelnen Attribute einer Bankverbindung als Map . |
9,237 | public static String repeat ( char source , int times ) { dbc . precondition ( times > - 1 , "times must be non negative" ) ; final char [ ] array = new char [ times ] ; Arrays . fill ( array , source ) ; return new String ( array ) ; } | Creates a String by repeating the source char . |
9,238 | public static String repeat ( String source , int times ) { dbc . precondition ( source != null , "cannot repeat a null source" ) ; dbc . precondition ( times > - 1 , "times must be non negative" ) ; final int srcLen = source . length ( ) ; final long longLen = times * ( long ) srcLen ; final int len = ( int ) longLen ; dbc . precondition ( longLen == len , "resulting String would be too long" ) ; final char [ ] array = new char [ len ] ; for ( int i = 0 ; i != times ; ++ i ) { source . getChars ( 0 , srcLen , array , i * srcLen ) ; } return new String ( array ) ; } | Creates a String by repeating the source string . |
9,239 | public static Nummer of ( long code ) { if ( ( code >= 0 ) && ( code < CACHE . length ) ) { return CACHE [ ( int ) code ] ; } else { return new Nummer ( code ) ; } } | Die of - Methode liefert fuer kleine Nummer immer dasselbe Objekt zurueck . Vor allem wenn man nur kleinere Nummern hat lohnt sich der Aufruf dieser Methode . |
9,240 | public static String validate ( String nummer ) { try { return new BigInteger ( nummer ) . toString ( ) ; } catch ( NumberFormatException nfe ) { throw new InvalidValueException ( nummer , "number" ) ; } } | Ueberprueft ob der uebergebene String auch tatsaechlich eine Zahl ist . |
9,241 | public Optional < E > next ( ) { if ( iterator . hasNext ( ) ) { return Optional . of ( iterator . next ( ) ) ; } return Optional . empty ( ) ; } | calling next over the boundary of the contained iterator leads Optional . empty indefinitely no matter how many times you try you can t shoot the dog |
9,242 | public LocalDate ersterArbeitstag ( ) { LocalDate tag = ersterTag ( ) ; switch ( tag . getDayOfWeek ( ) ) { case SATURDAY : return tag . plusDays ( 2 ) ; case SUNDAY : return tag . plusDays ( 1 ) ; default : return tag ; } } | Diese Methode liefert den ersten Arbeitstag eines Monats . Allerdings werden dabei keine Feiertag beruecksichtigt sondern nur die Wochenende die auf einen ersten des Monats fallen werden berucksichtigt . |
9,243 | public LocalDate letzterArbeitstag ( ) { LocalDate tag = letzterTag ( ) ; switch ( tag . getDayOfWeek ( ) ) { case SATURDAY : return tag . minusDays ( 1 ) ; case SUNDAY : return tag . minusDays ( 2 ) ; default : return tag ; } } | Diese Methode liefert den letzten Arbeitstag eines Monats . Allerdings werden dabei keine Feiertag beruecksichtigt sondern nur die Wochenende die auf einen letzten des Monats fallen werden berucksichtigt . |
9,244 | public static < T > Consumer < T > pipeline ( Consumer < T > consumer ) { return new PipelinedConsumer < T > ( Iterations . iterable ( consumer ) ) ; } | Creates a pipeline from an consumer . |
9,245 | public static < T > Consumer < T > pipeline ( Consumer < T > former , Consumer < T > latter ) { return new PipelinedConsumer < T > ( Iterations . iterable ( former , latter ) ) ; } | Creates a pipeline from two actions . |
9,246 | public static < T > Consumer < T > pipeline ( Consumer < T > first , Consumer < T > second , Consumer < T > third ) { return new PipelinedConsumer < T > ( Iterations . iterable ( first , second , third ) ) ; } | Creates a pipeline from three actions . |
9,247 | public static < T > Consumer < T > pipeline ( Consumer < T > ... actions ) { return new PipelinedConsumer < T > ( Iterations . iterable ( actions ) ) ; } | Creates a pipeline from an array of actions . |
9,248 | public static < T1 , T2 > BiConsumer < T1 , T2 > pipeline ( BiConsumer < T1 , T2 > consumer ) { return new PipelinedBinaryConsumer < T1 , T2 > ( Iterations . iterable ( consumer ) ) ; } | Creates a pipeline from a binary consumer . |
9,249 | public static < T1 , T2 > BiConsumer < T1 , T2 > pipeline ( BiConsumer < T1 , T2 > former , BiConsumer < T1 , T2 > latter ) { return new PipelinedBinaryConsumer < T1 , T2 > ( Iterations . iterable ( former , latter ) ) ; } | Creates a pipeline from two binary actions . |
9,250 | public static < T1 , T2 > BiConsumer < T1 , T2 > pipeline ( BiConsumer < T1 , T2 > first , BiConsumer < T1 , T2 > second , BiConsumer < T1 , T2 > third ) { return new PipelinedBinaryConsumer < T1 , T2 > ( Iterations . iterable ( first , second , third ) ) ; } | Creates a pipeline from three binary actions . |
9,251 | public static < T1 , T2 > BiConsumer < T1 , T2 > pipeline ( BiConsumer < T1 , T2 > ... actions ) { return new PipelinedBinaryConsumer < T1 , T2 > ( Iterations . iterable ( actions ) ) ; } | Creates a pipeline from an array of binary actions . |
9,252 | public static < T1 , T2 , T3 > TriConsumer < T1 , T2 , T3 > pipeline ( TriConsumer < T1 , T2 , T3 > consumer ) { return new PipelinedTernaryConsumer < T1 , T2 , T3 > ( Iterations . iterable ( consumer ) ) ; } | Creates a pipeline from a ternary consumer . |
9,253 | public static < T1 , T2 , T3 > TriConsumer < T1 , T2 , T3 > pipeline ( TriConsumer < T1 , T2 , T3 > former , TriConsumer < T1 , T2 , T3 > latter ) { return new PipelinedTernaryConsumer < T1 , T2 , T3 > ( Iterations . iterable ( former , latter ) ) ; } | Creates a pipeline from two ternary actions . |
9,254 | public static < T1 , T2 , T3 > TriConsumer < T1 , T2 , T3 > pipeline ( TriConsumer < T1 , T2 , T3 > first , TriConsumer < T1 , T2 , T3 > second , TriConsumer < T1 , T2 , T3 > third ) { return new PipelinedTernaryConsumer < T1 , T2 , T3 > ( Iterations . iterable ( first , second , third ) ) ; } | Creates a pipeline from three ternary actions . |
9,255 | public static void initialize ( ) { if ( ! initialized ) { String libraryBaseName = "JCusparse-" + JCuda . getJCudaVersion ( ) ; String libraryName = LibUtils . createPlatformLibraryName ( libraryBaseName ) ; LibUtils . loadLibrary ( libraryName ) ; initialized = true ; } } | Initializes the native library . Note that this method does not have to be called explicitly since it will be called automatically when this class is loaded . |
9,256 | private static int checkResult ( int result ) { if ( exceptionsEnabled && result != cusparseStatus . CUSPARSE_STATUS_SUCCESS ) { throw new CudaException ( cusparseStatus . stringFor ( result ) ) ; } return result ; } | If the given result is not cusparseStatus . CUSPARSE_STATUS_SUCCESS and exceptions have been enabled this method will throw a CudaException with an error message that corresponds to the given result code . Otherwise the given result is simply returned . |
9,257 | public static int cusparseCsrmvEx_bufferSize ( cusparseHandle handle , int alg , int transA , int m , int n , int nnz , Pointer alpha , int alphatype , cusparseMatDescr descrA , Pointer csrValA , int csrValAtype , Pointer csrRowPtrA , Pointer csrColIndA , Pointer x , int xtype , Pointer beta , int betatype , Pointer y , int ytype , int executiontype , long [ ] bufferSizeInBytes ) { return checkResult ( cusparseCsrmvEx_bufferSizeNative ( handle , alg , transA , m , n , nnz , alpha , alphatype , descrA , csrValA , csrValAtype , csrRowPtrA , csrColIndA , x , xtype , beta , betatype , y , ytype , executiontype , bufferSizeInBytes ) ) ; } | Returns number of bytes |
9,258 | public T add ( T addend ) { if ( addend == null ) { throw new IllegalArgumentException ( "invalid (null) addend" ) ; } BigDecimal sum = this . value . add ( addend . value ) ; return newInstance ( sum , sum . scale ( ) ) ; } | Wraps BigDecimal s add method to accept and return T instances instead of BigDecimals so that users of the class don t have to typecast the return value . |
9,259 | public T subtract ( T subtrahend ) { if ( subtrahend == null ) { throw new IllegalArgumentException ( "invalid (null) subtrahend" ) ; } BigDecimal difference = this . value . subtract ( subtrahend . value ) ; return newInstance ( difference , difference . scale ( ) ) ; } | Wraps BigDecimal s subtract method to accept and return T instances instead of BigDecimals so that users of the class don t have to typecast the return value . |
9,260 | public T multiply ( T multiplier ) { if ( multiplier == null ) { throw new IllegalArgumentException ( "invalid (null) multiplier" ) ; } BigDecimal product = this . value . multiply ( multiplier . value ) ; return newInstance ( product , this . value . scale ( ) ) ; } | Wraps BigDecimal s multiply method to accept and return T instances instead of BigDecimals so that users of the class don t have to typecast the return value . |
9,261 | public T mod ( T modulus ) { if ( modulus == null ) { throw new IllegalArgumentException ( "invalid (null) modulus" ) ; } double difference = this . value . doubleValue ( ) % modulus . doubleValue ( ) ; return newInstance ( BigDecimal . valueOf ( difference ) , this . value . scale ( ) ) ; } | This method calculates the mod between to T values by first casting to doubles and then by performing the % operation on the two primitives . |
9,262 | public T divide ( T divisor ) { if ( divisor == null ) { throw new IllegalArgumentException ( "invalid (null) divisor" ) ; } BigDecimal quotient = this . value . divide ( divisor . value , ROUND_BEHAVIOR ) ; return newInstance ( quotient , this . value . scale ( ) ) ; } | Wraps BigDecimal s divide method to enforce the default rounding behavior |
9,263 | private static List < DAType > computeExtendedInterfaces ( List < DAInterface > interfaces ) { Optional < DAType > functionInterface = from ( interfaces ) . filter ( DAInterfacePredicates . isGuavaFunction ( ) ) . transform ( toDAType ( ) ) . filter ( notNull ( ) ) . first ( ) ; if ( functionInterface . isPresent ( ) ) { return Collections . singletonList ( functionInterface . get ( ) ) ; } return Collections . emptyList ( ) ; } | The only interface that can be extended by the Mapper interface is Guava s Function interface . |
9,264 | public static void start ( String path ) { classMonitor = new ClassReloader ( path ) ; Thread thread = new Thread ( classMonitor , ClassReloader . class . getSimpleName ( ) ) ; thread . setDaemon ( true ) ; thread . start ( ) ; } | Sets up and starts a monitor for the given path . |
9,265 | public static Integer toInteger ( String parameterValue ) { Integer result = null ; if ( isDigits ( parameterValue ) ) result = Integer . valueOf ( parameterValue ) ; return result ; } | Parses a parameter as an Integer . This is useful for working with query string parameters and path segments as numbers . |
9,266 | public static int toInt ( String parameterValue ) { int result = - 1 ; if ( isDigits ( parameterValue ) ) result = Integer . parseInt ( parameterValue ) ; return result ; } | Parses a parameter as an int . This is useful for working with query string parameters and path segments as numbers . |
9,267 | public static void validate ( Ort ort , String strasse , String hausnummer ) { if ( StringUtils . isBlank ( strasse ) ) { throw new InvalidValueException ( strasse , "street" ) ; } validate ( ort , strasse , hausnummer , VALIDATOR ) ; } | Validiert die uebergebene Adresse auf moegliche Fehler . |
9,268 | public String getStrasseKurz ( ) { if ( PATTERN_STRASSE . matcher ( strasse ) . matches ( ) ) { return strasse . substring ( 0 , StringUtils . lastIndexOfIgnoreCase ( strasse , "stra" ) + 3 ) + '.' ; } else { return strasse ; } } | Liefert die Strasse in einer abgekuerzten Schreibweise . |
9,269 | public Map < String , Object > toMap ( ) { Map < String , Object > map = new HashMap < > ( ) ; map . put ( "plz" , getPLZ ( ) ) ; map . put ( "ortsname" , getOrtsname ( ) ) ; map . put ( "strasse" , getStrasse ( ) ) ; map . put ( "hausnummer" , getHausnummer ( ) ) ; return map ; } | Liefert die einzelnen Attribute einer Adresse als Map . |
9,270 | public static Datamappingtype findDataMapping ( Object data , String id , Datamappingstype dataMappingConfig ) { if ( null != data ) { Class clazz = ( Class ) ( ( data instanceof Class ) ? data : data . getClass ( ) ) ; for ( Datamappingtype dt : dataMappingConfig . getDatamapping ( ) ) { if ( dt . isRegex ( ) && Pattern . compile ( dt . getClassname ( ) ) . matcher ( clazz . getName ( ) ) . find ( ) && idOK ( id , dt . getId ( ) ) ) { if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( String . format ( "Datamapping found: %s matches regex %s (requested id: %s)" , clazz . getName ( ) , dt . getClassname ( ) , id ) ) ; } return dt ; } else if ( clazz . getName ( ) . equals ( dt . getClassname ( ) ) && idOK ( id , dt . getId ( ) ) ) { if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( String . format ( "Datamapping found: %s matches %s (requested id: %s)" , clazz . getName ( ) , dt . getClassname ( ) , id ) ) ; } return dt ; } if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( String . format ( "%s does not match %s (regex: %s, requested id %s)" , dt . getClassname ( ) , clazz . getName ( ) , dt . isRegex ( ) , id ) ) ; } } } return null ; } | returns the first Datamapping found for an object or Class . A datamapping is valid for an object when either a regex is found in the classname of the object or the classname of the object equals the configured classname when an id is provided the id in the datamapping found must match this id when an id is not provided an id a datamapping with an id is not valid . |
9,271 | public static List < StartContainerConfig > getContainers ( Class clazz ) { if ( ! cacheSCC . containsKey ( clazz ) ) { cacheSCC . put ( clazz , new ArrayList < > ( 1 ) ) ; ContainerStart cs = ( ContainerStart ) clazz . getAnnotation ( ContainerStart . class ) ; if ( cs != null ) { cacheSCC . get ( clazz ) . add ( fromContainerStart ( cs ) ) ; } Containers c = ( Containers ) clazz . getAnnotation ( com . vectorprint . report . itext . annotations . Containers . class ) ; if ( c != null ) { for ( ContainerStart s : c . containers ( ) ) { cacheSCC . get ( clazz ) . add ( fromContainerStart ( s ) ) ; } } } return cacheSCC . get ( clazz ) ; } | Find a datamapping to start a container based on class annotation uses static cache . |
9,272 | public static List < ElementConfig > getElements ( Class clazz ) { if ( ! cacheEC . containsKey ( clazz ) ) { cacheEC . put ( clazz , new ArrayList < > ( 1 ) ) ; Element e = ( Element ) clazz . getAnnotation ( Element . class ) ; if ( e != null ) { cacheEC . get ( clazz ) . add ( fromAnnotation ( e ) ) ; } Elements es = ( Elements ) clazz . getAnnotation ( com . vectorprint . report . itext . annotations . Elements . class ) ; if ( es != null ) { for ( Element s : es . elements ( ) ) { cacheEC . get ( clazz ) . add ( fromAnnotation ( s ) ) ; } } } return cacheEC . get ( clazz ) ; } | Find a datamapping to create an element based on class annotation uses static cache . |
9,273 | public String getFormatted ( ) { String input = this . getUnformatted ( ) + " " ; StringBuilder buf = new StringBuilder ( ) ; for ( int i = 0 ; i < this . getUnformatted ( ) . length ( ) ; i += 4 ) { buf . append ( input , i , i + 4 ) ; buf . append ( ' ' ) ; } return buf . toString ( ) . trim ( ) ; } | Liefert die IBAN formattiert in der DIN - Form . Dies ist die uebliche Papierform in der die IBAN in 4er - Bloecke formattiert wird jeweils durch Leerzeichen getrennt . |
9,274 | @ SuppressWarnings ( { "squid:SwitchLastCaseIsDefaultCheck" , "squid:S1301" } ) public Locale getLand ( ) { String country = this . getUnformatted ( ) . substring ( 0 , 2 ) ; String language = country . toLowerCase ( ) ; switch ( country ) { case "AT" : case "CH" : language = "de" ; break ; } return new Locale ( language , country ) ; } | Liefert das Land zu dem die IBAN gehoert . |
9,275 | public Fachwert getFachwert ( Class < ? extends Fachwert > clazz , Object ... args ) { Class [ ] argTypes = toTypes ( args ) ; try { Constructor < ? extends Fachwert > ctor = clazz . getConstructor ( argTypes ) ; return ctor . newInstance ( args ) ; } catch ( ReflectiveOperationException ex ) { Throwable cause = ex . getCause ( ) ; if ( cause instanceof ValidationException ) { throw ( ValidationException ) cause ; } else if ( cause instanceof IllegalArgumentException ) { throw new LocalizedValidationException ( cause . getMessage ( ) , cause ) ; } else { throw new IllegalArgumentException ( "cannot create " + clazz + " with " + Arrays . toString ( args ) , ex ) ; } } } | Liefert einen Fachwert zur angegebenen Klasse . |
9,276 | public WordprocessingMLPackage loadPackage ( final InputStream docxTemplate ) throws LoadTemplateException { final WordprocessingMLPackage docxPkg ; try { docxPkg = WordprocessingMLPackage . load ( docxTemplate ) ; } catch ( final Docx4JException ex ) { throw new LoadTemplateException ( "Unable to load docx template from input stream" , ex ) ; } return docxPkg ; } | Load and return an in - memory representation of a docx . |
9,277 | public PdfFormField makeField ( ) throws IOException , DocumentException , VectorPrintException { switch ( getFieldtype ( ) ) { case TEXT : return ( ( TextField ) bf ) . getTextField ( ) ; case COMBO : return ( ( TextField ) bf ) . getComboField ( ) ; case LIST : return ( ( TextField ) bf ) . getListField ( ) ; case BUTTON : return ( ( PushbuttonField ) bf ) . getField ( ) ; case CHECKBOX : return ( ( RadioCheckField ) bf ) . getCheckField ( ) ; case RADIO : return ( ( RadioCheckField ) bf ) . getRadioField ( ) ; } throw new VectorPrintException ( String . format ( "cannot create pdfformfield from %s and %s" , ( bf != null ) ? bf . getClass ( ) : null , String . valueOf ( getFieldtype ( ) ) ) ) ; } | Create the PdfFormField that will be used to add a form field to the pdf . |
9,278 | public static < P extends Parameterizable > Set < P > getParameterizables ( Package javaPackage , Class < P > clazz ) throws IOException , FileNotFoundException , ClassNotFoundException , InstantiationException , IllegalAccessException , NoSuchMethodException , InvocationTargetException { Set < P > parameterizables = new HashSet < > ( 50 ) ; for ( Class < ? > c : ClassHelper . fromPackage ( javaPackage ) ) { if ( clazz . isAssignableFrom ( c ) && ! Modifier . isAbstract ( c . getModifiers ( ) ) ) { P p = ( P ) c . newInstance ( ) ; ParamAnnotationProcessor . PAP . initParameters ( p ) ; parameterizables . add ( p ) ; } } return parameterizables ; } | Use this generic method in for example a gui that supports building a styling file . |
9,279 | public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final ModuleSpecification moduleSpecification = deploymentUnit . getAttachment ( Attachments . MODULE_SPECIFICATION ) ; final ModuleLoader moduleLoader = Module . getBootModuleLoader ( ) ; if ( ! WeldDeploymentMarker . isPartOfWeldDeployment ( deploymentUnit ) ) { return ; } ModuleDependency dep = new ModuleDependency ( moduleLoader , ORG_JAM_METRICS , false , false , true , false ) ; dep . addImportFilter ( PathFilters . getMetaInfFilter ( ) , true ) ; dep . addExportFilter ( PathFilters . getMetaInfFilter ( ) , true ) ; moduleSpecification . addSystemDependency ( dep ) ; ModuleDependency dep2 = new ModuleDependency ( moduleLoader , ORG_JAM_METRICS_API , false , false , true , false ) ; dep2 . addImportFilter ( PathFilters . getMetaInfFilter ( ) , true ) ; dep2 . addExportFilter ( PathFilters . getMetaInfFilter ( ) , true ) ; moduleSpecification . addSystemDependency ( dep2 ) ; ModuleDependency dep3 = new ModuleDependency ( moduleLoader , ORG_JAM_METRICS_PROPERTIES , false , false , true , false ) ; dep3 . addImportFilter ( PathFilters . getMetaInfFilter ( ) , true ) ; dep3 . addExportFilter ( PathFilters . getMetaInfFilter ( ) , true ) ; moduleSpecification . addSystemDependency ( dep3 ) ; ModuleDependency dep4 = new ModuleDependency ( moduleLoader , ORG_JAM_METRICS_LIBRARY , false , false , true , false ) ; dep4 . addImportFilter ( PathFilters . getMetaInfFilter ( ) , true ) ; dep4 . addExportFilter ( PathFilters . getMetaInfFilter ( ) , true ) ; moduleSpecification . addSystemDependency ( dep4 ) ; ModuleDependency dep5 = new ModuleDependency ( moduleLoader , ORG_JAM_METRICS_LIBRARY2 , false , false , true , false ) ; dep5 . addImportFilter ( PathFilters . getMetaInfFilter ( ) , true ) ; dep5 . addExportFilter ( PathFilters . getMetaInfFilter ( ) , true ) ; moduleSpecification . addSystemDependency ( dep5 ) ; } | Add dependencies for modules required for metric deployments |
9,280 | public List < String > getDefaultProviderChain ( ) { List < String > list = new ArrayList < > ( getProviderNames ( ) ) ; return list ; } | Access a list of the currently registered default providers . The default providers are used when no provider names are passed by the caller . |
9,281 | public Set < CurrencyUnit > getCurrencies ( CurrencyQuery query ) { Set < CurrencyUnit > result = new HashSet < > ( ) ; for ( Locale locale : query . getCountries ( ) ) { try { result . add ( Waehrung . of ( Currency . getInstance ( locale ) ) ) ; } catch ( IllegalArgumentException ex ) { LOG . log ( Level . WARNING , "Cannot get currency for locale '" + locale + "':" , ex ) ; } } for ( String currencyCode : query . getCurrencyCodes ( ) ) { try { result . add ( Waehrung . of ( currencyCode ) ) ; } catch ( IllegalArgumentException ex ) { LOG . log ( Level . WARNING , "Cannot get currency '" + currencyCode + "':" , ex ) ; } } for ( CurrencyProviderSpi spi : Bootstrap . getServices ( CurrencyProviderSpi . class ) ) { result . addAll ( spi . getCurrencies ( query ) ) ; } return result ; } | Access all currencies matching the given query . |
9,282 | public static < E > List < E > all ( E [ ] array ) { final Function < Iterator < E > , ArrayList < E > > consumer = new ConsumeIntoCollection < > ( new ArrayListFactory < E > ( ) ) ; return consumer . apply ( new ArrayIterator < > ( array ) ) ; } | Yields all element of the array in a list . |
9,283 | public static < K , V > Map < K , V > dict ( Pair < K , V > ... array ) { final Function < Iterator < Pair < K , V > > , HashMap < K , V > > consumer = new ConsumeIntoMap < > ( new HashMapFactory < K , V > ( ) ) ; return consumer . apply ( new ArrayIterator < > ( array ) ) ; } | Yields all element of the array in a map . |
9,284 | public static < E > void pipe ( Iterator < E > iterator , OutputIterator < E > outputIterator ) { new ConsumeIntoOutputIterator < > ( outputIterator ) . apply ( iterator ) ; } | Consumes the input iterator to the output iterator . |
9,285 | public static < E > void pipe ( Iterable < E > iterable , OutputIterator < E > outputIterator ) { dbc . precondition ( iterable != null , "cannot call pipe with a null iterable" ) ; new ConsumeIntoOutputIterator < > ( outputIterator ) . apply ( iterable . iterator ( ) ) ; } | Consumes an iterable into the output iterator . |
9,286 | public static < E > void pipe ( E [ ] array , OutputIterator < E > outputIterator ) { new ConsumeIntoOutputIterator < > ( outputIterator ) . apply ( new ArrayIterator < > ( array ) ) ; } | Consumes the array into the output iterator . |
9,287 | public static < E > E first ( Iterator < E > iterator ) { return new FirstElement < E > ( ) . apply ( iterator ) ; } | Yields the first element of the iterator . |
9,288 | public static < E > E first ( Iterable < E > iterable ) { dbc . precondition ( iterable != null , "cannot call first with a null iterable" ) ; return new FirstElement < E > ( ) . apply ( iterable . iterator ( ) ) ; } | Yields the first element of the iterable . |
9,289 | public static < E > E first ( E [ ] array ) { return new FirstElement < E > ( ) . apply ( new ArrayIterator < > ( array ) ) ; } | Yields the first element of the array . |
9,290 | public < E extends Element > E createElementByStyler ( Collection < ? extends BaseStyler > stylers , Object data , Class < E > clazz ) throws VectorPrintException { E e = null ; return styleHelper . style ( e , data , stylers ) ; } | leaves object creation to the first styler in the list |
9,291 | public Phrase createPhrase ( Object data , Collection < ? extends BaseStyler > stylers ) throws VectorPrintException { return initTextElementArray ( styleHelper . style ( new Phrase ( Float . NaN ) , data , stylers ) , data , stylers ) ; } | Create a Phrase style it and add the data |
9,292 | public Paragraph createParagraph ( Object data , Collection < ? extends BaseStyler > stylers ) throws VectorPrintException { return initTextElementArray ( styleHelper . style ( new Paragraph ( Float . NaN ) , data , stylers ) , data , stylers ) ; } | Create a Paragraph style it and add the data |
9,293 | public Anchor createAnchor ( Object data , Collection < ? extends BaseStyler > stylers ) throws VectorPrintException { return initTextElementArray ( styleHelper . style ( new Anchor ( Float . NaN ) , data , stylers ) , data , stylers ) ; } | Create a Anchor style it and add the data |
9,294 | public ListItem createListItem ( Object data , Collection < ? extends BaseStyler > stylers ) throws VectorPrintException { return initTextElementArray ( styleHelper . style ( new ListItem ( Float . NaN ) , data , stylers ) , data , stylers ) ; } | Create a ListItem style it and add the data |
9,295 | public static BufferedImage makeImageTranslucent ( BufferedImage source , float opacity ) { if ( opacity == 1 ) { return source ; } BufferedImage translucent = new BufferedImage ( source . getWidth ( ) , source . getHeight ( ) , BufferedImage . TRANSLUCENT ) ; Graphics2D g = translucent . createGraphics ( ) ; g . setComposite ( AlphaComposite . getInstance ( AlphaComposite . SRC_OVER , opacity ) ) ; g . drawImage ( source , null , 0 , 0 ) ; g . dispose ( ) ; return translucent ; } | returns a transparent image when opacity < ; 1 |
9,296 | public Section getIndex ( String title , int nesting , List < ? extends BaseStyler > stylers ) throws VectorPrintException , InstantiationException , IllegalAccessException { if ( nesting < 1 ) { throw new VectorPrintException ( "chapter numbering starts with 1, wrong number: " + nesting ) ; } if ( sections . get ( nesting ) == null ) { sections . put ( nesting , new ArrayList < > ( 10 ) ) ; } Section current ; if ( nesting == 1 ) { List < Section > chapters = sections . get ( 1 ) ; current = new Chapter ( createElement ( title , Paragraph . class , stylers ) , chapters . size ( ) + 1 ) ; chapters . add ( current ) ; } else { List < Section > parents = sections . get ( nesting - 1 ) ; Section parent = parents . get ( parents . size ( ) - 1 ) ; current = parent . addSection ( createParagraph ( title , stylers ) ) ; sections . get ( nesting ) . add ( current ) ; } return styleHelper . style ( current , null , stylers ) ; } | create the Section style the title style the section and return the styled section . |
9,297 | public void visit ( Visitable visitable ) { StreamSupport . stream ( this . spliterator ( ) , false ) . forEach ( visitor -> visitor . visit ( visitable ) ) ; } | Visits the given Visitable object in order to carryout some function or investigation of the targeted object . |
9,298 | public static br_broker reboot ( nitro_service client , br_broker resource ) throws Exception { return ( ( br_broker [ ] ) resource . perform_operation ( client , "reboot" ) ) [ 0 ] ; } | Use this operation to reboot Unified Repeater Instance . |
9,299 | public static br_broker stop ( nitro_service client , br_broker resource ) throws Exception { return ( ( br_broker [ ] ) resource . perform_operation ( client , "stop" ) ) [ 0 ] ; } | Use this operation to stop Unified Repeater Instance . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.