idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
9,100 | public static < T > Function < T , Void > function ( Consumer < T > adaptee ) { dbc . precondition ( adaptee != null , "cannot adapt a null consumer" ) ; return first -> { adaptee . accept ( first ) ; return null ; } ; } | Adapts an consumer to a function . |
9,101 | public static < T1 , T2 > BiFunction < T1 , T2 , Void > function ( BiConsumer < T1 , T2 > adaptee ) { dbc . precondition ( adaptee != null , "cannot adapt a null consumer" ) ; return ( first , second ) -> { adaptee . accept ( first , second ) ; return null ; } ; } | Adapts a binary consumer to a binary function . |
9,102 | public static < T1 , T2 , T3 > TriFunction < T1 , T2 , T3 , Void > function ( TriConsumer < T1 , T2 , T3 > adaptee ) { dbc . precondition ( adaptee != null , "cannot adapt a null consumer" ) ; return ( first , second , third ) -> { adaptee . accept ( first , second , third ) ; return null ; } ; } | Adapts a ternary consumer to a ternary function . |
9,103 | public static < T > Function < T , Boolean > function ( Predicate < T > adaptee ) { dbc . precondition ( adaptee != null , "cannot adapt a null predicate" ) ; return adaptee :: test ; } | Adapts a predicate to a function . |
9,104 | public static < T1 , T2 > BiFunction < T1 , T2 , Boolean > function ( BiPredicate < T1 , T2 > adaptee ) { dbc . precondition ( adaptee != null , "cannot adapt a null predicate" ) ; return adaptee :: test ; } | Adapts a binary predicate to a binary function . |
9,105 | public static < T1 , T2 , T3 > TriFunction < T1 , T2 , T3 , Boolean > function ( TriPredicate < T1 , T2 , T3 > adaptee ) { dbc . precondition ( adaptee != null , "cannot adapt a null predicate" ) ; return adaptee :: test ; } | Adapts a ternary predicate to a ternary function . |
9,106 | public static < T > Runnable runnable ( Supplier < T > supplier ) { dbc . precondition ( supplier != null , "cannot adapt a null supplier" ) ; return supplier :: get ; } | Adapts a supplier to a runnable . |
9,107 | public static < T , R > Consumer < T > consumer ( Function < T , R > function ) { dbc . precondition ( function != null , "cannot adapt a null function" ) ; return function :: apply ; } | Adapts a function to an consumer . |
9,108 | public static < T1 , T2 , R > BiConsumer < T1 , T2 > consumer ( BiFunction < T1 , T2 , R > function ) { dbc . precondition ( function != null , "cannot adapt a null function" ) ; return function :: apply ; } | Adapts a binary function to a binary consumer . |
9,109 | public static < T1 , T2 , T3 , R > TriConsumer < T1 , T2 , T3 > consumer ( TriFunction < T1 , T2 , T3 , R > function ) { dbc . precondition ( function != null , "cannot adapt a null function" ) ; return function :: apply ; } | Adapts a ternary function to a ternary consumer . |
9,110 | public static BooleanSupplier proposition ( Supplier < Boolean > supplier ) { dbc . precondition ( supplier != null , "cannot adapt a null supplier" ) ; return supplier :: get ; } | Adapts a supplier to a proposition . |
9,111 | public static < T > Predicate < T > predicate ( Function < T , Boolean > function ) { dbc . precondition ( function != null , "cannot adapt a null function" ) ; return function :: apply ; } | Adapts a function to a predicate . |
9,112 | public static < T1 , T2 > BiPredicate < T1 , T2 > predicate ( BiFunction < T1 , T2 , Boolean > function ) { dbc . precondition ( function != null , "cannot adapt a null function" ) ; return function :: apply ; } | Adapts a binary function to a binary predicate |
9,113 | public static < T1 , T2 , T3 > TriPredicate < T1 , T2 , T3 > predicate ( TriFunction < T1 , T2 , T3 , Boolean > function ) { dbc . precondition ( function != null , "cannot adapt a null function" ) ; return function :: apply ; } | Adapts a ternary function to a ternary predicate . |
9,114 | public static String [ ] getFieldDescription ( ) { if ( FIELDS == null ) { ArrayList < String > fields = new ArrayList < String > ( ) ; for ( Field field : KiekerTraceEntry . class . getDeclaredFields ( ) ) { if ( ! Modifier . isStatic ( field . getModifiers ( ) ) ) { fields . add ( field . getName ( ) ) ; } } FIELDS = fields . toArray ( new String [ fields . size ( ) ] ) ; } return FIELDS ; } | Returns a description for the Super CSV parser how to map a column of the csv to this type . |
9,115 | public static CellProcessor [ ] getCellProcessors ( ) { return new CellProcessor [ ] { new ParseInt ( ) { public Object execute ( Object value , CsvContext context ) { String content = value . toString ( ) ; String [ ] split = content . split ( "\\$" ) ; return super . execute ( split [ 1 ] , context ) ; } } , new ParseLong ( ) , null , null , new ParseLong ( ) , new ParseLong ( ) , new ParseLong ( ) , null , new ParseInt ( ) , new ParseInt ( ) } ; } | Provide this array to parse the columns of the csv into the right type using the Super CSV framework . |
9,116 | void configureEndpoints ( Reflections reflections ) { api = new HashMap < > ( ) ; log . info ( "Scanning for endpoint classes.." ) ; Set < Class < ? > > endpoints = reflections . getTypesAnnotatedWith ( Api . class ) ; log . info ( "Found {} endpoint classes." , endpoints . size ( ) ) ; log . info ( "Examining endpoint class methods:" ) ; for ( Class < ? > endpointClass : endpoints ) { Route route = getEndpoint ( endpointClass ) ; route . endpointClass = endpointClass ; for ( Method method : endpointClass . getMethods ( ) ) { if ( method . getDeclaringClass ( ) == Object . class ) { continue ; } if ( Modifier . isPublic ( method . getModifiers ( ) ) ) { annotation : for ( Annotation annotation : method . getAnnotations ( ) ) { HttpMethod httpMethod = HttpMethod . method ( annotation ) ; if ( httpMethod != null ) { log . info ( "Http method: {}" , httpMethod ) ; RequestHandler requestHandler = new RequestHandler ( ) ; requestHandler . handlerMethod = method ; log . info ( "Java method: {}" , method . getName ( ) ) ; for ( Class < ? > parameterType : method . getParameterTypes ( ) ) { if ( ! HttpServletRequest . class . isAssignableFrom ( parameterType ) && ! HttpServletResponse . class . isAssignableFrom ( parameterType ) ) { if ( requestHandler . requestMessageType != null ) { log . error ( "Too many parameters on {} method {}. " + "Message type already set to {} but also found a {} parameter." , httpMethod , method . getName ( ) , requestHandler . requestMessageType . getSimpleName ( ) , parameterType . getSimpleName ( ) ) ; break annotation ; } requestHandler . requestMessageType = parameterType ; log . info ( "request Json: {}" , requestHandler . requestMessageType . getSimpleName ( ) ) ; } } if ( method . getReturnType ( ) != void . class ) { requestHandler . responseMessageType = method . getReturnType ( ) ; log . info ( "Response Json: {}" , requestHandler . responseMessageType . getSimpleName ( ) ) ; } route . requestHandlers . put ( httpMethod , requestHandler ) ; } } } } } } | Searches for and configures all your lovely endpoints . |
9,117 | void configureNotFound ( Reflections reflections ) { log . info ( "Checking for a not-found endpoint.." ) ; NotFound notFound = getEndpoint ( NotFound . class , "not-found" , reflections ) ; if ( notFound == null ) notFound = new DefaultNotFound ( ) ; printEndpoint ( notFound , "not-found" ) ; this . notFound = notFound ; } | Searches for and configures the not found endpoint . |
9,118 | void configureServerError ( Reflections reflections ) { log . info ( "Checking for an error endpoint.." ) ; ServerError serverError = getEndpoint ( ServerError . class , "error" , reflections ) ; if ( serverError == null ) serverError = new DefaultServerError ( ) ; printEndpoint ( serverError , "error" ) ; this . serverError = serverError ; } | Searches for and configures the not error endpoint . |
9,119 | private static < E > E getEndpoint ( Class < E > type , String name , Reflections reflections ) { E result = null ; Set < Class < ? extends E > > foundClasses = reflections . getSubTypesOf ( type ) ; Set < Class < ? extends E > > endpointClasses = new HashSet < > ( ) ; for ( Class < ? extends E > clazz : foundClasses ) { if ( ! Modifier . isAbstract ( clazz . getModifiers ( ) ) ) { endpointClasses . add ( clazz ) ; } } Iterator < Class < ? extends E > > iterator = endpointClasses . iterator ( ) ; while ( iterator . hasNext ( ) ) { Class < ? extends E > next = iterator . next ( ) ; if ( StringUtils . startsWithIgnoreCase ( next . getName ( ) , "com.github.davidcarboni.restolino.routes." ) ) { iterator . remove ( ) ; } } if ( endpointClasses . size ( ) != 0 ) { if ( endpointClasses . size ( ) > 1 ) { log . info ( "Warning: found multiple candidates for {} endpoint: {}" , name , endpointClasses ) ; } try { result = endpointClasses . iterator ( ) . next ( ) . newInstance ( ) ; } catch ( Exception e ) { log . info ( "Error: cannot instantiate {} endpoint class {}" , name , endpointClasses . iterator ( ) . next ( ) ) ; e . printStackTrace ( ) ; } } return result ; } | Locates a single endpoint class . |
9,120 | public String mapRequestPath ( HttpServletRequest request ) { String endpointName = Path . newInstance ( request ) . firstSegment ( ) ; return StringUtils . lowerCase ( endpointName ) ; } | Determines the route name for the path of the given request . |
9,121 | public E apply ( Iterator < E > consumable ) { dbc . precondition ( consumable != null , "consuming a null iterator" ) ; dbc . precondition ( consumable . hasNext ( ) , "no element to consume" ) ; return consumable . next ( ) ; } | Consumes the first element from the passed iterator . |
9,122 | public static void start ( Path root , WatchService watcher ) { Scanner . watcher = watcher ; Scanner . root = root ; log . info ( "Monitoring changes under {}" , root ) ; Thread t = new Thread ( new Scanner ( ) , "Directory scanner" ) ; t . setDaemon ( true ) ; t . start ( ) ; } | Starts the scanning thread . |
9,123 | public E apply ( Iterator < E > consumable ) { dbc . precondition ( consumable != null , "consuming a null iterator" ) ; dbc . precondition ( consumable . hasNext ( ) , "no element to consume" ) ; E value = consumable . next ( ) ; while ( consumable . hasNext ( ) ) { value = consumable . next ( ) ; } return value ; } | Consumes the iterator and yields the last element contained in it . |
9,124 | public R apply ( T former , U latter ) { return function . apply ( latter , former ) ; } | Performs on the nested function swapping former and latter formal parameters . |
9,125 | public static String serialise ( Object object ) { Gson gson = getBuilder ( ) . create ( ) ; return gson . toJson ( object ) ; } | Serialises the given object to Json . |
9,126 | public static < O > O deserialise ( String json , Class < O > type ) { Gson gson = getBuilder ( ) . create ( ) ; return gson . fromJson ( json , type ) ; } | Deserialises the given json String . |
9,127 | public boolean foundPomXml ( final File directory , final int depth ) { LOG . debug ( "Directory: {}" , directory ) ; if ( depth == - 1 || directory == null || ! directory . isDirectory ( ) ) { return false ; } else { File [ ] pomFiles = directory . listFiles ( new FileFilter ( ) { public boolean accept ( final File pathname ) { return "pom.xml" . equals ( pathname . getName ( ) ) ; } } ) ; if ( pomFiles . length == 1 ) { pathToPomXml = pomFiles [ 0 ] ; return true ; } else { return foundPomXml ( directory . getParentFile ( ) , depth - 1 ) ; } } } | Tries to find the pom recursively by going up in the directory tree . |
9,128 | public void link ( NGScope scope , JQElement element , JSON attrs ) { IsWidget widget = scope . get ( getName ( ) ) ; String id = "gwt-widget-" + counter ++ ; element . attr ( "id" , id ) ; RootPanel . get ( id ) . add ( widget ) ; } | Replaces the element body with the GWT widget passed via gwt - widget attribute . GWT widget must implement IsWidget interface . |
9,129 | public Pair < Optional < E1 > , Optional < E2 > > next ( ) { return Pair . of ( former . next ( ) , latter . next ( ) ) ; } | iterating over the longest iterator gives a Pair of Optional . nothing indefinitely no matter how many times you try you can t shoot the dog |
9,130 | public void createXMLData ( final String classname ) { data = new Kopemedata ( ) ; data . setTestcases ( new Testcases ( ) ) ; final Testcases tc = data . getTestcases ( ) ; tc . setClazz ( classname ) ; storeData ( ) ; } | Initializes XML - Data . |
9,131 | public static void parseFieldsMap ( final Reader inputReader , final Map < String , String > defaultsMap , final Map < String , Optional < JsonPointer > > pathsMap ) throws IOException , CSVStreamException { CSVStream . parse ( inputReader , h -> { } , ( h , l ) -> { defaultsMap . put ( l . get ( h . indexOf ( FIELD ) ) , l . get ( h . indexOf ( DEFAULT ) ) ) ; String relativePath = l . get ( h . indexOf ( RELATIVE_PATH ) ) . trim ( ) ; pathsMap . put ( l . get ( h . indexOf ( FIELD ) ) , relativePath . isEmpty ( ) ? Optional . empty ( ) : Optional . of ( JsonPointer . compile ( relativePath ) ) ) ; return l ; } , l -> { } , null , CSVStream . DEFAULT_HEADER_COUNT ) ; } | Parse field definitions from the input reader into the defaults map and the paths map . |
9,132 | public static TriFunction < JsonNode , List < String > , List < String > , List < String > > getSummaryFunctionWithStartTime ( final JDefaultDict < String , AtomicInteger > emptyCounts , final JDefaultDict < String , AtomicInteger > nonEmptyCounts , final JDefaultDict < String , AtomicBoolean > possibleIntegerFields , final JDefaultDict < String , AtomicBoolean > possibleDoubleFields , final JDefaultDict < String , JDefaultDict < String , AtomicInteger > > valueCounts , final AtomicInteger rowCount , final long startTime ) { return ( node , header , line ) -> { int nextLineNumber = rowCount . incrementAndGet ( ) ; if ( nextLineNumber % 10000 == 0 ) { double secondsSinceStart = ( System . currentTimeMillis ( ) - startTime ) / 1000.0d ; System . out . printf ( "%d\tSeconds since start: %f\tRecords per second: %f%n" , nextLineNumber , secondsSinceStart , nextLineNumber / secondsSinceStart ) ; } for ( int i = 0 ; i < header . size ( ) ; i ++ ) { if ( line . get ( i ) . trim ( ) . isEmpty ( ) ) { emptyCounts . get ( header . get ( i ) ) . incrementAndGet ( ) ; } else { nonEmptyCounts . get ( header . get ( i ) ) . incrementAndGet ( ) ; valueCounts . get ( header . get ( i ) ) . get ( line . get ( i ) ) . incrementAndGet ( ) ; try { Integer . parseInt ( line . get ( i ) ) ; } catch ( NumberFormatException nfe ) { possibleIntegerFields . get ( header . get ( i ) ) . set ( false ) ; } try { Double . parseDouble ( line . get ( i ) ) ; } catch ( NumberFormatException nfe ) { possibleDoubleFields . get ( header . get ( i ) ) . set ( false ) ; } } } return line ; } ; } | Returns a function that can be used as a summary function using the given start time for timing analysis . |
9,133 | public Map < String , Object > toMap ( ) { Map < String , Object > map = new HashMap < > ( ) ; map . put ( "chatDienst" , getChatDienst ( ) ) ; map . put ( "dienstName" , getDienstName ( ) ) ; map . put ( "account" , getAccount ( ) ) ; return map ; } | Liefert die einzelnen Attribute eines ChatAccounts als Map . |
9,134 | public AnalysisResults < SolutionType > merge ( AnalysisResults < SolutionType > otherResults ) { otherResults . results . keySet ( ) . forEach ( problemID -> { otherResults . results . get ( problemID ) . keySet ( ) . forEach ( searchID -> { List < SearchRunResults < SolutionType > > runs = otherResults . results . get ( problemID ) . get ( searchID ) ; runs . forEach ( run -> { SearchRunResults < SolutionType > runCopy = new SearchRunResults < > ( run ) ; registerSearchRun ( problemID , searchID , runCopy ) ; } ) ; } ) ; } ) ; return this ; } | Merge the given results into this results object . A copy of the newly added search runs is made . |
9,135 | public void registerSearchRun ( String problemID , String searchID , SearchRunResults < SolutionType > run ) { if ( ! results . containsKey ( problemID ) ) { results . put ( problemID , new HashMap < > ( ) ) ; } if ( ! results . get ( problemID ) . containsKey ( searchID ) ) { results . get ( problemID ) . put ( searchID , new ArrayList < > ( ) ) ; } results . get ( problemID ) . get ( searchID ) . add ( run ) ; } | Register results of a search run specifying the IDs of the problem being solved and the applied search . If no runs have been registered before for this combination of problem and search new entries are created . Else this run is appended to the existing runs . |
9,136 | public int getNumSearches ( String problemID ) { if ( ! results . containsKey ( problemID ) ) { throw new UnknownIDException ( "Unknown problem ID " + problemID + "." ) ; } return results . get ( problemID ) . size ( ) ; } | Get the number of different searches that have been applied to solve the problem with the given ID . |
9,137 | public int getNumRuns ( String problemID , String searchID ) { if ( ! results . containsKey ( problemID ) ) { throw new UnknownIDException ( "Unknown problem ID " + problemID + "." ) ; } if ( ! results . get ( problemID ) . containsKey ( searchID ) ) { throw new UnknownIDException ( "Unknown search ID " + searchID + " for problem " + problemID + "." ) ; } return results . get ( problemID ) . get ( searchID ) . size ( ) ; } | Get the number of performed runs of the given search when solving the given problem . |
9,138 | public SearchRunResults < SolutionType > getRun ( String problemID , String searchID , int i ) { if ( ! results . containsKey ( problemID ) ) { throw new UnknownIDException ( "Unknown problem ID " + problemID + "." ) ; } if ( ! results . get ( problemID ) . containsKey ( searchID ) ) { throw new UnknownIDException ( "Unknown search ID " + searchID + " for problem " + problemID + "." ) ; } return results . get ( problemID ) . get ( searchID ) . get ( i ) ; } | Get the results of the i - th performed run of the given search when solving the given problem . |
9,139 | public void addToContainer ( Element container , Element element ) throws DocumentException , VectorPrintException { if ( container instanceof TextElementArray ) { if ( element instanceof Image ) { ( ( TextElementArray ) container ) . add ( new Chunk ( ( Image ) element , 0 , 0 , true ) ) ; } else { ( ( TextElementArray ) container ) . add ( element ) ; } } else if ( container instanceof PdfPTable ) { if ( element instanceof PdfPCell ) { ( ( PdfPTable ) container ) . addCell ( ( PdfPCell ) element ) ; } else if ( element instanceof Phrase ) { ( ( PdfPTable ) container ) . addCell ( ( Phrase ) element ) ; } else if ( element instanceof PdfPTable ) { ( ( PdfPTable ) container ) . addCell ( ( PdfPTable ) element ) ; } else if ( element instanceof Image ) { ( ( PdfPTable ) container ) . addCell ( ( Image ) element ) ; } else { throw new VectorPrintException ( String . format ( "don't know how to add %s to %s" , ( element == null ) ? "null" : element . getClass ( ) . getName ( ) , ( container == null ) ? "null" : container . getClass ( ) . getName ( ) ) ) ; } } else if ( container instanceof PdfPCell ) { if ( element instanceof PdfPTable ) { throw new VectorPrintException ( String . format ( "use %s.%s if you want to nest tables" , CONTAINER_ELEMENT . class . getName ( ) , CONTAINER_ELEMENT . NESTED_TABLE ) ) ; } ( ( PdfPCell ) container ) . addElement ( element ) ; } else if ( container instanceof ColumnText ) { ( ( ColumnText ) container ) . addElement ( element ) ; } else { throw new VectorPrintException ( String . format ( "don't know how to add %s to %s" , ( element == null ) ? "null" : element . getClass ( ) . getName ( ) , ( container == null ) ? "null" : container . getClass ( ) . getName ( ) ) ) ; } } | attempts to add an element to a container |
9,140 | public static BooleanSupplier spy ( BooleanSupplier proposition , Box < Boolean > result ) { return new CapturingProposition ( proposition , result ) ; } | Proxies a proposition spying for result . |
9,141 | public static < R > Supplier < R > spy ( Supplier < R > supplier , Box < R > result ) { return new CapturingSupplier < R > ( supplier , result ) ; } | Proxies a supplier spying for result . |
9,142 | public static < T , R > Function < T , R > spy ( Function < T , R > function , Box < R > result , Box < T > param ) { return new CapturingFunction < > ( function , result , param ) ; } | Proxies a function spying for result and parameter . |
9,143 | public static < T1 , T2 , R > BiFunction < T1 , T2 , R > spy ( BiFunction < T1 , T2 , R > function , Box < R > result , Box < T1 > param1 , Box < T2 > param2 ) { return new BinaryCapturingFunction < > ( function , result , param1 , param2 ) ; } | Proxies a binary function spying for result and parameters . |
9,144 | public static < T1 , T2 , T3 , R > TriFunction < T1 , T2 , T3 , R > spy ( TriFunction < T1 , T2 , T3 , R > function , Box < R > result , Box < T1 > param1 , Box < T2 > param2 , Box < T3 > param3 ) { return new TernaryCapturingFunction < T1 , T2 , T3 , R > ( function , result , param1 , param2 , param3 ) ; } | Proxies a ternary function spying for result and parameters . |
9,145 | public static < T > Predicate < T > spy ( Predicate < T > predicate , Box < Boolean > result , Box < T > param ) { return new CapturingPredicate < T > ( predicate , result , param ) ; } | Proxies a predicate spying for result and parameter . |
9,146 | public static < T1 , T2 > BiPredicate < T1 , T2 > spy ( BiPredicate < T1 , T2 > predicate , Box < Boolean > result , Box < T1 > param1 , Box < T2 > param2 ) { return new BinaryCapturingPredicate < T1 , T2 > ( predicate , result , param1 , param2 ) ; } | Proxies a binary predicate spying for result and parameters . |
9,147 | public static < T1 , T2 , T3 > TriPredicate < T1 , T2 , T3 > spy ( TriPredicate < T1 , T2 , T3 > predicate , Box < Boolean > result , Box < T1 > param1 , Box < T2 > param2 , Box < T3 > param3 ) { return new TernaryCapturingPredicate < T1 , T2 , T3 > ( predicate , result , param1 , param2 , param3 ) ; } | Proxies a ternary predicate spying for result and parameters . |
9,148 | public static < T > Consumer < T > spy ( Consumer < T > consumer , Box < T > param ) { return new CapturingConsumer < T > ( consumer , param ) ; } | Proxies an consumer spying for parameter . |
9,149 | public static < T1 , T2 > BiConsumer < T1 , T2 > spy ( BiConsumer < T1 , T2 > consumer , Box < T1 > param1 , Box < T2 > param2 ) { return new BinaryCapturingConsumer < T1 , T2 > ( consumer , param1 , param2 ) ; } | Proxies a binary consumer spying for parameters . |
9,150 | public static < T1 , T2 , T3 > TriConsumer < T1 , T2 , T3 > spy ( TriConsumer < T1 , T2 , T3 > consumer , Box < T1 > param1 , Box < T2 > param2 , Box < T3 > param3 ) { return new TernaryCapturingConsumer < T1 , T2 , T3 > ( consumer , param1 , param2 , param3 ) ; } | Proxies a ternary consumer spying for parameters . |
9,151 | public static < T1 , T2 , T3 , R > TriFunction < T1 , T2 , T3 , R > spyRes ( TriFunction < T1 , T2 , T3 , R > function , Box < R > result ) { return spy ( function , result , Box . < T1 > empty ( ) , Box . < T2 > empty ( ) , Box . < T3 > empty ( ) ) ; } | Proxies a ternary function spying for result . |
9,152 | public static < T1 , T2 , T3 , R > TriFunction < T1 , T2 , T3 , R > spy1st ( TriFunction < T1 , T2 , T3 , R > function , Box < T1 > param1 ) { return spy ( function , Box . < R > empty ( ) , param1 , Box . < T2 > empty ( ) , Box . < T3 > empty ( ) ) ; } | Proxies a ternary function spying for first parameter . |
9,153 | public static < T1 , T2 , T3 , R > TriFunction < T1 , T2 , T3 , R > spy2nd ( TriFunction < T1 , T2 , T3 , R > function , Box < T2 > param2 ) { return spy ( function , Box . < R > empty ( ) , Box . < T1 > empty ( ) , param2 , Box . < T3 > empty ( ) ) ; } | Proxies a ternary function spying for second parameter |
9,154 | public static < T1 , T2 , T3 , R > TriFunction < T1 , T2 , T3 , R > spy3rd ( TriFunction < T1 , T2 , T3 , R > function , Box < T3 > param3 ) { return spy ( function , Box . < R > empty ( ) , Box . < T1 > empty ( ) , Box . < T2 > empty ( ) , param3 ) ; } | Proxies a ternary function spying for third parameter . |
9,155 | public static < T1 , T2 , R > BiFunction < T1 , T2 , R > spyRes ( BiFunction < T1 , T2 , R > function , Box < R > result ) { return spy ( function , result , Box . < T1 > empty ( ) , Box . < T2 > empty ( ) ) ; } | Proxies a binary function spying for result . |
9,156 | public static < T1 , T2 , R > BiFunction < T1 , T2 , R > spy1st ( BiFunction < T1 , T2 , R > function , Box < T1 > param1 ) { return spy ( function , Box . < R > empty ( ) , param1 , Box . < T2 > empty ( ) ) ; } | Proxies a binary function spying for first parameter . |
9,157 | public static < T1 , T2 , R > BiFunction < T1 , T2 , R > spy2nd ( BiFunction < T1 , T2 , R > function , Box < T2 > param2 ) { return spy ( function , Box . < R > empty ( ) , Box . < T1 > empty ( ) , param2 ) ; } | Proxies a binary function spying for second parameter . |
9,158 | public static < R , T > Function < T , R > spyRes ( Function < T , R > function , Box < R > result ) { return spy ( function , result , Box . < T > empty ( ) ) ; } | Proxies a function spying for result . |
9,159 | public static < R , T > Function < T , R > spy1st ( Function < T , R > function , Box < T > param ) { return spy ( function , Box . < R > empty ( ) , param ) ; } | Proxies a function spying for parameter . |
9,160 | public static < T1 , T2 , T3 > TriConsumer < T1 , T2 , T3 > spy1st ( TriConsumer < T1 , T2 , T3 > consumer , Box < T1 > param1 ) { return spy ( consumer , param1 , Box . < T2 > empty ( ) , Box . < T3 > empty ( ) ) ; } | Proxies a ternary consumer spying for first parameter . |
9,161 | public static < T1 , T2 , T3 > TriConsumer < T1 , T2 , T3 > spy2nd ( TriConsumer < T1 , T2 , T3 > consumer , Box < T2 > param2 ) { return spy ( consumer , Box . < T1 > empty ( ) , param2 , Box . < T3 > empty ( ) ) ; } | Proxies a ternary consumer spying for second parameter . |
9,162 | public static < T1 , T2 , T3 > TriConsumer < T1 , T2 , T3 > spy3rd ( TriConsumer < T1 , T2 , T3 > consumer , Box < T3 > param3 ) { return spy ( consumer , Box . < T1 > empty ( ) , Box . < T2 > empty ( ) , param3 ) ; } | Proxies a ternary consumer spying for third parameter . |
9,163 | public static < T1 , T2 > BiConsumer < T1 , T2 > spy2nd ( BiConsumer < T1 , T2 > consumer , Box < T2 > param2 ) { return spy ( consumer , Box . < T1 > empty ( ) , param2 ) ; } | Proxies a binary consumer spying for second parameter . |
9,164 | public static < T1 , T2 , T3 > TriPredicate < T1 , T2 , T3 > spyRes ( TriPredicate < T1 , T2 , T3 > predicate , Box < Boolean > result ) { return spy ( predicate , result , Box . < T1 > empty ( ) , Box . < T2 > empty ( ) , Box . < T3 > empty ( ) ) ; } | Proxies a ternary predicate spying for result . |
9,165 | public static < T1 , T2 , T3 > TriPredicate < T1 , T2 , T3 > spy1st ( TriPredicate < T1 , T2 , T3 > predicate , Box < T1 > param1 ) { return spy ( predicate , Box . < Boolean > empty ( ) , param1 , Box . < T2 > empty ( ) , Box . < T3 > empty ( ) ) ; } | Proxies a ternary predicate spying for first parameter . |
9,166 | public static < T1 , T2 , T3 > TriPredicate < T1 , T2 , T3 > spy2nd ( TriPredicate < T1 , T2 , T3 > predicate , Box < T2 > param2 ) { return spy ( predicate , Box . < Boolean > empty ( ) , Box . < T1 > empty ( ) , param2 , Box . < T3 > empty ( ) ) ; } | Proxies a ternary predicate spying for second parameter . |
9,167 | public static < T1 , T2 , T3 > TriPredicate < T1 , T2 , T3 > spy3rd ( TriPredicate < T1 , T2 , T3 > predicate , Box < T3 > param3 ) { return spy ( predicate , Box . < Boolean > empty ( ) , Box . < T1 > empty ( ) , Box . < T2 > empty ( ) , param3 ) ; } | Proxies a ternary predicate spying for third parameter . |
9,168 | public static < T1 , T2 > BiPredicate < T1 , T2 > spyRes ( BiPredicate < T1 , T2 > predicate , Box < Boolean > result ) { return spy ( predicate , result , Box . < T1 > empty ( ) , Box . < T2 > empty ( ) ) ; } | Proxies a binary predicate spying for result . |
9,169 | public static < T1 , T2 > BiPredicate < T1 , T2 > spy1st ( BiPredicate < T1 , T2 > predicate , Box < T1 > param1 ) { return spy ( predicate , Box . < Boolean > empty ( ) , param1 , Box . < T2 > empty ( ) ) ; } | Proxies a binary predicate spying for first parameter |
9,170 | public static < T1 , T2 > BiPredicate < T1 , T2 > spy2nd ( BiPredicate < T1 , T2 > predicate , Box < T2 > param2 ) { return spy ( predicate , Box . < Boolean > empty ( ) , Box . < T1 > empty ( ) , param2 ) ; } | Proxies a binary predicate spying for second parameter . |
9,171 | public static < T > Predicate < T > spyRes ( Predicate < T > predicate , Box < Boolean > result ) { return spy ( predicate , result , Box . < T > empty ( ) ) ; } | Proxies a predicate spying for result . |
9,172 | public static < T > Predicate < T > spy1st ( Predicate < T > predicate , Box < T > param ) { return spy ( predicate , Box . < Boolean > empty ( ) , param ) ; } | Proxies a predicate spying for parameter . |
9,173 | public static < T > Consumer < T > monitor ( Consumer < T > consumer , AtomicLong calls ) { return new MonitoringConsumer < T > ( consumer , calls ) ; } | Monitors calls to an consumer . |
9,174 | public static < T , R > Function < T , R > monitor ( Function < T , R > function , AtomicLong calls ) { return new MonitoringFunction < > ( function , calls ) ; } | Monitors calls to a function . |
9,175 | public static < T > Predicate < T > monitor ( Predicate < T > predicate , AtomicLong calls ) { return new MonitoringPredicate < T > ( predicate , calls ) ; } | Monitors calls to a predicate . |
9,176 | public static < R > Supplier < R > monitor ( Supplier < R > supplier , AtomicLong calls ) { return new MonitoringSupplier < > ( supplier , calls ) ; } | Monitors calls to a supplier . |
9,177 | public static < T1 , T2 > BiConsumer < T1 , T2 > monitor ( BiConsumer < T1 , T2 > consumer , AtomicLong calls ) { return new BinaryMonitoringConsumer < T1 , T2 > ( consumer , calls ) ; } | Monitors calls to a binary consumer . |
9,178 | public static < T1 , T2 , R > BiFunction < T1 , T2 , R > monitor ( BiFunction < T1 , T2 , R > function , AtomicLong calls ) { return new BinaryMonitoringFunction < > ( function , calls ) ; } | Monitors calls to a binary function . |
9,179 | public static < T1 , T2 > BiPredicate < T1 , T2 > monitor ( BiPredicate < T1 , T2 > predicate , AtomicLong calls ) { return new BinaryMonitoringPredicate < T1 , T2 > ( predicate , calls ) ; } | Monitors calls to a binary predicate |
9,180 | public static < T1 , T2 , T3 > TriConsumer < T1 , T2 , T3 > monitor ( TriConsumer < T1 , T2 , T3 > consumer , AtomicLong calls ) { return new TernaryMonitoringConsumer < T1 , T2 , T3 > ( consumer , calls ) ; } | Monitors calls to a ternary consumer . |
9,181 | public static < T1 , T2 , T3 , R > TriFunction < T1 , T2 , T3 , R > monitor ( TriFunction < T1 , T2 , T3 , R > function , AtomicLong calls ) { return new TernaryMonitoringFunction < T1 , T2 , T3 , R > ( function , calls ) ; } | Monitors calls to a ternary function . |
9,182 | public static < T1 , T2 , T3 > TriPredicate < T1 , T2 , T3 > monitor ( TriPredicate < T1 , T2 , T3 > predicate , AtomicLong calls ) { return new TernaryMonitoringPredicate < T1 , T2 , T3 > ( predicate , calls ) ; } | Monitors calls to a ternary predicate . |
9,183 | protected final void addDataCollector ( final Class collectorName ) { if ( ! DataCollector . class . isAssignableFrom ( collectorName ) ) { throw new RuntimeException ( "Class must be subclass of DataCollector!" ) ; } collectors . add ( collectorName ) ; } | Adds a DataCollector to the given list . |
9,184 | public final Map < String , DataCollector > getDataCollectors ( ) { final Map < String , DataCollector > collectorsRet = new HashMap < > ( ) ; for ( final Class < DataCollector > c : collectors ) { DataCollector dc ; try { dc = c . newInstance ( ) ; collectorsRet . put ( dc . getName ( ) , dc ) ; } catch ( final InstantiationException e ) { e . printStackTrace ( ) ; } catch ( final IllegalAccessException e ) { e . printStackTrace ( ) ; } } return collectorsRet ; } | Returns new DataCollectors which are saved in the current DataCollectorList . Every time this method is called there are new DataCollectors instanciated . |
9,185 | public void accept ( E value ) { for ( Consumer < E > consumer : consumers ) { consumer . accept ( value ) ; } } | performs every composed consumer |
9,186 | public Promise < String > getGreeting ( ) { Promise < String > p = q . all ( getSalutation ( ) , getName ( ) ) . then ( new Continue < String , JSArray < ? > > ( ) { public String call ( JSArray < ? > value ) { return value . get ( 0 ) + ", " + value . get ( 1 ) + "!" ; } } ) ; return p ; } | Given the promises of name and salutation returns a promise of greeting . |
9,187 | public Promise < String > getSalutation ( ) { final Deferred < String > d = q . defer ( ) ; Timer timer = new Timer ( ) { public void run ( ) { d . progress ( new TimerProgress ( "Loaded salutation" , this ) ) ; d . resolve ( "Hello" ) ; } } ; d . progress ( new TimerProgress ( "Loading salutation..." , timer ) ) ; timer . schedule ( 1000 ) ; return d . promise ( ) ; } | Returns a promise of salutation by simulating an asynchronous call with a time - out . |
9,188 | public Range < T > rightHalfOpen ( T lower , Optional < T > upper ) { return new DenseRange < T > ( sequencer , comparator , Endpoint . Include , lower , upper , Endpoint . Exclude ) ; } | returns [ lower upper ) |
9,189 | public Range < T > leftHalfOpen ( T lower , T upper ) { return new DenseRange < T > ( sequencer , comparator , Endpoint . Exclude , lower , Optional . of ( upper ) , Endpoint . Include ) ; } | returns ( lower upper ] |
9,190 | public static Boolean [ ] box ( boolean [ ] array ) { dbc . precondition ( array != null , "cannot box a null boolean array" ) ; final Boolean [ ] result = new Boolean [ array . length ] ; for ( int i = 0 ; i != result . length ; ++ i ) { result [ i ] = array [ i ] ; } return result ; } | Converts an array of booleans to an array of Booleans . |
9,191 | public static float round ( float f , int decimalPlace ) { return BigDecimal . valueOf ( ( double ) f ) . setScale ( decimalPlace , BigDecimal . ROUND_HALF_UP ) . floatValue ( ) ; } | Round to certain number of decimals |
9,192 | public static < E extends BaseStyler > List < E > getStylers ( Collection < ? extends BaseStyler > stylers , Class < E > clazz ) throws VectorPrintException { List < E > st = new ArrayList < > ( 1 ) ; for ( BaseStyler s : stylers ) { if ( clazz . isAssignableFrom ( s . getClass ( ) ) ) { st . add ( ( E ) s ) ; } } return st ; } | get stylers with a certain baseclass from a collection of stylers . |
9,193 | public static void delayedStyle ( Chunk c , String tag , Collection < ? extends Advanced > stylers , EventHelper eventHelper , Image img ) { eventHelper . addDelayedStyler ( tag , stylers , c , img ) ; c . setGenericTag ( tag ) ; } | register advanced stylers with the EventHelper to do the styling later |
9,194 | public Domainname getLevelDomain ( int level ) { String [ ] parts = this . getCode ( ) . split ( "\\." ) ; int firstPart = parts . length - level ; if ( ( firstPart < 0 ) || ( level < 1 ) ) { throw new LocalizedIllegalArgumentException ( level , "level" , Range . between ( 1 , parts . length ) ) ; } StringBuilder name = new StringBuilder ( parts [ firstPart ] ) ; for ( int i = firstPart + 1 ; i < parts . length ; i ++ ) { name . append ( '.' ) ; name . append ( parts [ i ] ) ; } return new Domainname ( name . toString ( ) ) ; } | Waehrend die Top - Level - Domain die oberste Ebende wie de ist ist die 2nd - Level - Domain von www . jfachwert . de die Domain jfachwert . de und die 3rd - Level - Domain ist in diesem Beispiel die komplette Domain . |
9,195 | public List < Move < ? super SolutionType > > getAllMoves ( SolutionType solution ) { return neighs . stream ( ) . flatMap ( neigh -> neigh . getAllMoves ( solution ) . stream ( ) ) . collect ( Collectors . toList ( ) ) ; } | Creates and returns the union of all moves generated by each of the contained neighbourhoods . The returned list may be empty if none of the contained neighbourhoods can generate any move . |
9,196 | public AbstractNumber multiply ( Bruch operand ) { BigInteger z = getZaehler ( ) . multiply ( operand . getZaehler ( ) ) ; BigInteger n = getNenner ( ) . multiply ( operand . getNenner ( ) ) ; return Bruch . of ( z , n ) . kuerzen ( ) ; } | Multiplikation zweier Brueche . |
9,197 | public AbstractNumber add ( Bruch operand ) { BigInteger n = getNenner ( ) . multiply ( operand . getNenner ( ) ) ; BigInteger z1 = getZaehler ( ) . multiply ( operand . getNenner ( ) ) ; BigInteger z2 = operand . getZaehler ( ) . multiply ( getNenner ( ) ) ; return Bruch . of ( z1 . add ( z2 ) , n ) . kuerzen ( ) ; } | Addition zweier Brueche . |
9,198 | public int compareTo ( Bruch other ) { BigInteger thisZaehlerErweitert = this . zaehler . multiply ( other . nenner ) ; BigInteger otherZaehlerErweitert = other . zaehler . multiply ( this . nenner ) ; return thisZaehlerErweitert . compareTo ( otherZaehlerErweitert ) ; } | Vergleicht den anderen Bruch mit dem aktuellen Bruch . |
9,199 | protected final PdfContentByte getPreparedCanvas ( float opacity ) { needRestore = false ; PdfContentByte canvas = ( tableForeground != null ) ? tableForeground : ( isBg ( ) ) ? getWriter ( ) . getDirectContentUnder ( ) : getWriter ( ) . getDirectContent ( ) ; String layerName = getLayerName ( ) ; BLENDMODE blend = getBlend ( ) ; if ( getWriter ( ) . getPDFXConformance ( ) == PdfWriter . PDFX1A2001 ) { if ( ! PdfGState . BM_NORMAL . equals ( blend . getBlend ( ) ) && ! PdfGState . BM_COMPATIBLE . equals ( blend . getBlend ( ) ) ) { throw new VectorPrintRuntimeException ( "blend not supported in PDF/X-1a: " + blend ) ; } if ( layerName != null ) { throw new VectorPrintRuntimeException ( "layers not supported in PDF/X-1a: " + layerName ) ; } if ( opacity < 1 ) { throw new VectorPrintRuntimeException ( "opacity not supported in PDF/X-1a: " + opacity ) ; } } if ( layerName != null ) { layerManager . startLayerInGroup ( layerName , canvas ) ; } if ( opacity <= 1 ) { canvas . saveState ( ) ; needRestore = true ; PdfGState pgs = new PdfGState ( ) ; pgs . setFillOpacity ( opacity ) ; pgs . setStrokeOpacity ( opacity ) ; canvas . setGState ( pgs ) ; } if ( ! BLENDMODE . NORMAL . equals ( blend ) ) { if ( ! needRestore ) { canvas . saveState ( ) ; needRestore = true ; } PdfGState pgs = new PdfGState ( ) ; pgs . setBlendMode ( blend . getBlend ( ) ) ; canvas . setGState ( pgs ) ; } if ( getTransform ( ) != null && ! ( this instanceof Image ) ) { canvas . transform ( new AffineTransform ( getTransform ( ) ) ) ; } return canvas ; } | get a canvas for drawing prepared according to settings |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.