idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
9,000
public static void mergeWorkerContext ( TracyThreadContext workerTracyThreadContext ) { TracyThreadContext ctx = threadContext . get ( ) ; if ( isValidContext ( ctx ) ) { ctx . mergeChildContext ( workerTracyThreadContext ) ; } }
When called from the requester thread will merge worker TracyThreadContext into the requester TracyThreadContext
58
20
9,001
public static void frameErrorWithoutPopping ( String error ) { TracyThreadContext ctx = threadContext . get ( ) ; if ( isValidContext ( ctx ) ) { ctx . annotateFrameError ( error ) ; } }
In case where an error occurs but the user does not want to raise an exception and the user takes responsibility of ensuring Tracy . after is guaranteed to be called then frameErrorWithoutPoping can be called to simply create an error annotation
50
46
9,002
public static < E > List < E > search ( Iterator < E > iterator , Predicate < E > predicate ) { final Function < Iterator < E > , ArrayList < E > > consumer = new ConsumeIntoCollection <> ( new ArrayListFactory < E > ( ) ) ; final FilteringIterator < E > filtered = new FilteringIterator < E > ( iterator , predicate ) ; return consumer . apply ( filtered ) ; }
Searches the iterator consuming it yielding every value matching the predicate .
94
14
9,003
public static < C extends Collection < E > , E > C search ( Iterator < E > iterator , C collection , Predicate < E > predicate ) { final Function < Iterator < E > , C > consumer = new ConsumeIntoCollection <> ( new ConstantSupplier < C > ( collection ) ) ; final FilteringIterator < E > filtered = new FilteringIterator < E > ( iterator , predicate ) ; return consumer . apply ( filtered ) ; }
Searches the iterator consuming it adding every value matching the predicate to the passed collection .
98
18
9,004
public static < C extends Collection < E > , E > C search ( Iterable < E > iterable , C collection , Predicate < E > predicate ) { dbc . precondition ( iterable != null , "cannot search a null iterable" ) ; final Function < Iterator < E > , C > consumer = new ConsumeIntoCollection <> ( new ConstantSupplier < C > ( collection ) ) ; final FilteringIterator < E > filtered = new FilteringIterator < E > ( iterable . iterator ( ) , predicate ) ; return consumer . apply ( filtered ) ; }
Searches the iterable adding every value matching the predicate to the passed collection .
127
17
9,005
public static < C extends Collection < E > , E > C search ( E [ ] array , Supplier < C > supplier , Predicate < E > predicate ) { final Function < Iterator < E > , C > consumer = new ConsumeIntoCollection <> ( supplier ) ; final FilteringIterator < E > filtered = new FilteringIterator < E > ( new ArrayIterator < E > ( array ) , predicate ) ; return consumer . apply ( filtered ) ; }
Searches the array adding every value matching the predicate to the collection yielded by the passed supplier .
99
20
9,006
public static < E > List < E > find ( Iterator < E > iterator , Predicate < E > predicate ) { final Function < Iterator < E > , ArrayList < E > > consumer = new ConsumeIntoCollection <> ( new ArrayListFactory < E > ( ) ) ; final FilteringIterator < E > filtered = new FilteringIterator < E > ( iterator , predicate ) ; final ArrayList < E > found = consumer . apply ( filtered ) ; dbc . precondition ( ! found . isEmpty ( ) , "no element matched" ) ; return found ; }
Searches the iterator consuming it yielding every value matching the predicate . An IllegalStateException is thrown if no element matches .
126
25
9,007
public void measureBefore ( ) { if ( ! CTRLINST . isMonitoringEnabled ( ) ) { return ; } hostname = VMNAME ; sessionId = SESSIONREGISTRY . recallThreadLocalSessionId ( ) ; traceId = CFREGISTRY . recallThreadLocalTraceId ( ) ; // entry point if ( traceId == - 1 ) { entrypoint = true ; traceId = CFREGISTRY . getAndStoreUniqueThreadLocalTraceId ( ) ; CFREGISTRY . storeThreadLocalEOI ( 0 ) ; CFREGISTRY . storeThreadLocalESS ( 1 ) ; // next operation is ess + 1 eoi = 0 ; ess = 0 ; } else { entrypoint = false ; eoi = CFREGISTRY . incrementAndRecallThreadLocalEOI ( ) ; // ess > 1 ess = CFREGISTRY . recallAndIncrementThreadLocalESS ( ) ; // ess >= 0 if ( ( eoi == - 1 ) || ( ess == - 1 ) ) { LOG . error ( "eoi and/or ess have invalid values:" + " eoi == " + eoi + " ess == " + ess ) ; CTRLINST . terminateMonitoring ( ) ; } } tin = TIME . getTime ( ) ; }
Will be called to register the time when the method has started .
270
13
9,008
@ Override public void apply ( PermutationSolution solution ) { int start = from ; int stop = to ; int n = solution . size ( ) ; // reverse subsequence by performing a series of swaps // (works cyclically when start > stop) int reversedLength ; if ( start < stop ) { reversedLength = stop - start + 1 ; } else { reversedLength = n - ( start - stop - 1 ) ; } int numSwaps = reversedLength / 2 ; for ( int k = 0 ; k < numSwaps ; k ++ ) { solution . swap ( start , stop ) ; start = ( start + 1 ) % n ; stop = ( stop - 1 + n ) % n ; } }
Reverse the subsequence by performing a series of swaps in the given permutation solution .
150
19
9,009
public static < T > T access ( T [ ] array , int n ) { int max = array . length - 1 ; if ( ( n < 0 ) || ( n > max ) ) { throw new InvalidValueException ( n , "n" , Range . between ( 0 , max ) ) ; } return array [ n ] ; }
Liefert das n - te Element des uebergebenen Arrays zurueck falls ein korrekter Index uebergaben wird
71
37
9,010
public static void precondition ( boolean assertion , String format , Object ... params ) { if ( ! assertion ) { throw new IllegalArgumentException ( String . format ( format , params ) ) ; } }
Enforces a state precondition throwing an IllegalArgumentException if the assertion fails .
43
18
9,011
public static void state ( boolean assertion , String format , Object ... params ) { if ( ! assertion ) { throw new IllegalStateException ( String . format ( format , params ) ) ; } }
Enforces a state precondition throwing an IllegalStateException if the assertion fails .
40
17
9,012
@ SuppressWarnings ( "unchecked" ) @ Override public < T extends MonetaryAmount > MonetaryAmountFactory < T > getAmountFactory ( Class < T > amountType ) { if ( Geldbetrag . class . equals ( amountType ) ) { return ( MonetaryAmountFactory < T > ) new GeldbetragFactory ( ) ; } MonetaryAmountFactoryProviderSpi < T > f = MonetaryAmountFactoryProviderSpi . class . cast ( factories . get ( amountType ) ) ; if ( Objects . nonNull ( f ) ) { return f . createMonetaryAmountFactory ( ) ; } throw new MonetaryException ( "no MonetaryAmountFactory found for " + amountType ) ; }
save cast since members are managed by this instance
148
9
9,013
private DebugStyler debugStylers ( String ... names ) throws VectorPrintException { if ( settings . getBooleanProperty ( false , DEBUG ) ) { DebugStyler dst = new DebugStyler ( ) ; StylerFactoryHelper . initStylingObject ( dst , writer , document , null , layerManager , settings ) ; try { ParamAnnotationProcessorImpl . PAP . initParameters ( dst ) ; } catch ( NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException ex ) { throw new VectorPrintException ( ex ) ; } for ( String n : names ) { dst . getStyleSetup ( ) . add ( n ) ; styleSetup . put ( n , SettingsBindingService . getInstance ( ) . getFactory ( ) . getBindingHelper ( ) . serializeValue ( settings . getStringProperties ( null , n ) ) ) ; } return dst ; } return null ; }
return a debug styler that will be appended to the stylers for providing debugging info in reports
196
20
9,014
public static < K , V > MapAdapter < K , V > mapAdapter ( final Map < K , V > map ) { return key -> Optional . ofNullable ( map . get ( key ) ) ; }
Produces a MapAdapter for the given Map .
45
10
9,015
public static < T > Optional < T > firstInList ( List < T > list ) { return list . isEmpty ( ) ? Optional . empty ( ) : Optional . ofNullable ( list . get ( 0 ) ) ; }
Adapter to create an Optional out of the first element of a List . If the list is empty we get an empty optional . Also if the first element is null return an empty optional .
49
37
9,016
public static < K , V > Optional < V > getOpt ( Map < K , V > map , K key ) { return Optional . ofNullable ( map . get ( key ) ) ; }
Get an item from a map wrapping it in an Optional
42
11
9,017
@ Override public GeldbetragFactory setNumber ( Number number ) { this . number = number ; this . context = getMonetaryContextOf ( number ) ; return this ; }
Setzt die Nummer fuer den Geldbetrag .
39
14
9,018
@ Override public final void onOpenDocument ( PdfWriter writer , Document document ) { super . onOpenDocument ( writer , document ) ; template = writer . getDirectContent ( ) . createTemplate ( document . getPageSize ( ) . getWidth ( ) , document . getPageSize ( ) . getHeight ( ) ) ; if ( ! getSettings ( ) . containsKey ( PAGEFOOTERSTYLEKEY ) ) { getSettings ( ) . put ( PAGEFOOTERSTYLEKEY , PAGEFOOTERSTYLE ) ; } if ( ! getSettings ( ) . containsKey ( PAGEFOOTERTABLEKEY ) ) { float tot = ItextHelper . ptsToMm ( document . getPageSize ( ) . getWidth ( ) - document . leftMargin ( ) - document . rightMargin ( ) ) ; getSettings ( ) . put ( PAGEFOOTERTABLEKEY , new StringBuilder ( "Table(columns=3,widths=" ) . append ( Math . round ( tot * getSettings ( ) . getFloatProperty ( 0.85f , "footerleftwidthpercentage" ) ) ) . append ( ' ' ) . append ( Math . round ( tot * getSettings ( ) . getFloatProperty ( 0.14f , "footermiddlewidthpercentage" ) ) ) . append ( ' ' ) . append ( Math . round ( tot * getSettings ( ) . getFloatProperty ( 0.01f , "footerrightwidthpercentage" ) ) ) . append ( ' ' ) . toString ( ) ) ; } }
prepares template for printing header and footer
339
9
9,019
protected void printFailureHeader ( PdfTemplate template , float x , float y ) { Font f = DebugHelper . debugFontLink ( template , getSettings ( ) ) ; Chunk c = new Chunk ( getSettings ( ) . getProperty ( "failures in report, see end of report" , "failureheader" ) , f ) ; ColumnText . showTextAligned ( template , Element . ALIGN_LEFT , new Phrase ( c ) , x , y , 0 ) ; }
when failure information is appended to the report a header on each page will be printed refering to this information .
107
23
9,020
protected void renderFooter ( PdfWriter writer , Document document ) throws DocumentException , VectorPrintException , InstantiationException , IllegalAccessException { if ( ! debugHereAfter && ! failuresHereAfter ) { PdfPTable footerTable = elementProducer . createElement ( null , PdfPTable . class , getStylers ( PAGEFOOTERTABLEKEY ) ) ; footerTable . addCell ( createFooterCell ( ValueHelper . createDate ( new Date ( ) ) ) ) ; String pageText = writer . getPageNumber ( ) + getSettings ( ) . getProperty ( " of " , UPTO ) ; PdfPCell c = createFooterCell ( pageText ) ; c . setHorizontalAlignment ( Element . ALIGN_RIGHT ) ; footerTable . addCell ( c ) ; footerTable . addCell ( createFooterCell ( new Chunk ( ) ) ) ; footerTable . writeSelectedRows ( 0 , - 1 , document . getPageSize ( ) . getLeft ( ) + document . leftMargin ( ) , document . getPageSize ( ) . getBottom ( document . bottomMargin ( ) ) , writer . getDirectContentUnder ( ) ) ; footerBottom = document . bottom ( ) - footerTable . getTotalHeight ( ) ; } }
prints a footer table with a line at the top a date and page numbering second cell will be right aligned
284
22
9,021
protected Image getTemplateImage ( PdfTemplate template ) throws BadElementException { if ( templateImage == null ) { templateImage = Image . getInstance ( template ) ; templateImage . setAbsolutePosition ( 0 , 0 ) ; } return templateImage ; }
this image will be used for painting the total number of pages and for a failure header when failures are printed inside the report .
54
25
9,022
public static Collection < BaseStyler > findForCssName ( String cssName , boolean required ) throws ClassNotFoundException , IOException , InstantiationException , IllegalAccessException , NoSuchMethodException , InvocationTargetException { Collection < BaseStyler > stylers = new ArrayList <> ( 1 ) ; for ( Class < ? > c : ClassHelper . fromPackage ( Font . class . getPackage ( ) ) ) { if ( ! Modifier . isAbstract ( c . getModifiers ( ) ) && BaseStyler . class . isAssignableFrom ( c ) ) { BaseStyler bs = ( BaseStyler ) c . newInstance ( ) ; if ( bs . findForCssProperty ( cssName ) != null && ! bs . findForCssProperty ( cssName ) . isEmpty ( ) ) { stylers . add ( bs ) ; if ( LOGGER . isLoggable ( Level . FINE ) ) { LOGGER . fine ( String . format ( "found %s supporting css property %s" , cssName , bs . getClass ( ) . getName ( ) ) ) ; } } } } if ( stylers . isEmpty ( ) ) { if ( required ) { throw new IllegalArgumentException ( String . format ( "no styler supports css property %s" , cssName ) ) ; } else { LOGGER . warning ( String . format ( "no styler supports css property %s" , cssName ) ) ; } } return stylers ; }
find BaseStylers that implements a css property .
335
11
9,023
public static Waehrung of ( Currency currency ) { String key = currency . getCurrencyCode ( ) ; return CACHE . computeIfAbsent ( key , t -> new Waehrung ( currency ) ) ; }
Gibt die entsprechende Currency als Waehrung zurueck . Da die Anzahl der Waehrungen ueberschaubar ist werden sie in einem dauerhaften Cache vorgehalten .
49
59
9,024
public static Waehrung of ( CurrencyUnit currencyUnit ) { if ( currencyUnit instanceof Waehrung ) { return ( Waehrung ) currencyUnit ; } else { return of ( currencyUnit . getCurrencyCode ( ) ) ; } }
Gibt die entsprechende Currency als Waehrung zurueck .
55
22
9,025
public static String validate ( String code ) { try { toCurrency ( code ) ; } catch ( IllegalArgumentException ex ) { throw new InvalidValueException ( code , "currency" ) ; } return code ; }
Validiert den uebergebenen Waehrungscode .
46
17
9,026
public static String getSymbol ( CurrencyUnit cu ) { try { return Waehrung . of ( cu ) . getSymbol ( ) ; } catch ( IllegalArgumentException ex ) { LOG . log ( Level . WARNING , "Cannot get symbol for '" + cu + "':" , ex ) ; return cu . getCurrencyCode ( ) ; } }
Lieft das Waehrungssymbol der uebergebenen Waehrungseinheit .
79
25
9,027
public static synchronized boolean compareMetricsCacheValuesByKey ( String deployment , String key , ArrayList < Object > valuesToCompare ) { boolean isEqual = true ; ArrayList < Object > cacheValues ; cacheValues = getMetricsCache ( deployment ) . get ( key ) ; for ( Object valueComp : valuesToCompare ) { for ( Object value : cacheValues ) { if ( value . toString ( ) . compareTo ( valueComp . toString ( ) ) == 0 ) { isEqual = true ; break ; } isEqual = false ; } } return isEqual ; }
Dummy comparison for test cases .
126
7
9,028
public static < T , R > R widen ( T value ) { return new Vary < T , R > ( ) . apply ( value ) ; }
Performs a downcast on a value .
32
9
9,029
public static < T extends R , R > R narrow ( T value ) { return new Vary < T , R > ( ) . apply ( value ) ; }
Performs an upcast on a value .
34
9
9,030
public static < T , R > R vary ( T value ) { return new Vary < T , R > ( ) . apply ( value ) ; }
Performs a reinterpret cast on a value .
32
10
9,031
public static String validate ( String code ) { String plz = normalize ( code ) ; if ( hasLandeskennung ( plz ) ) { validateNumberOf ( plz ) ; } else { plz = LengthValidator . validate ( plz , 3 , 10 ) ; } return plz ; }
Eine Postleitahl muss zwischen 3 und 10 Ziffern lang sein . Eventuell kann noch die Laenderkennung vorangestellt werden . Dies wird hier ueberprueft .
67
57
9,032
public Locale getLand ( ) { String kennung = this . getLandeskennung ( ) ; switch ( kennung ) { case "D" : return new Locale ( "de" , "DE" ) ; case "A" : return new Locale ( "de" , "AT" ) ; case "CH" : return new Locale ( "de" , "CH" ) ; default : throw new UnsupportedOperationException ( "unbekannte Landeskennung '" + kennung + "'" ) ; } }
Liefert das Land die der Landeskennung entspricht .
121
18
9,033
public List < File > getFiles ( File dir , FileFilter filter ) { // System.out.println("Standardoutput: " + standardoutput); List < File > files = new LinkedList < File > ( ) ; for ( File f : dir . listFiles ( ) ) { if ( f . isFile ( ) ) { if ( filter . accept ( f ) ) files . add ( f ) ; } else { files . addAll ( getFiles ( f , filter ) ) ; } } return files ; }
Returns a list with all files in the given Directory matching the given Filter
109
14
9,034
public void execute ( ) throws MojoExecutionException { getLog ( ) . info ( "Start, BS: " + System . getProperty ( "os.name" ) ) ; if ( System . getProperty ( "os.name" ) . contains ( "indows" ) ) { CPPATHSEPERATOR = ";" ; PATHSEPERATOR = "\\" ; } else { CPPATHSEPERATOR = ":" ; PATHSEPERATOR = "/" ; } System . out . println ( "Execute: " + standardoutput ) ; tests = 0 ; failure = 0 ; error = 0 ; if ( standardoutput != null ) { File output = new File ( standardoutput ) ; try { bw = new BufferedWriter ( new FileWriter ( output ) ) ; } catch ( IOException e1 ) { // TODO Automatisch generierter Erfassungsblock e1 . printStackTrace ( ) ; } } else { File output = new File ( "stdout.txt" ) ; try { bw = new BufferedWriter ( new FileWriter ( output ) ) ; } catch ( IOException e1 ) { // TODO Automatisch generierter Erfassungsblock e1 . printStackTrace ( ) ; } } File dir = new File ( "src/test/java/" ) ; FileFilter fileFilter = new RegexFileFilter ( "[A-z/]*.java$" ) ; project = project . getExecutionProject ( ) ; runTestFile ( dir , fileFilter ) ; getLog ( ) . info ( "Tests: " + tests + " Fehlschläge: " ailure + " Fehler: " + error ) ; }
Main - method that is executed when the tests are executed
370
11
9,035
public void addEvaluation ( Objective obj , Evaluation eval , double weight ) { evaluations . put ( obj , eval ) ; // update weighted sum weightedSum += weight * eval . getValue ( ) ; }
Add an evaluation produced by an objective specifying its weight .
43
11
9,036
private void loadData ( ) throws JAXBException { if ( file . exists ( ) ) { final JAXBContext jc = JAXBContext . newInstance ( Kopemedata . class ) ; final Unmarshaller unmarshaller = jc . createUnmarshaller ( ) ; data = ( Kopemedata ) unmarshaller . unmarshal ( file ) ; LOG . trace ( "Daten geladen, Daten: " + data ) ; } else { LOG . info ( "Datei {} existiert nicht" , file . getAbsolutePath ( ) ) ; data = new Kopemedata ( ) ; data . setTestcases ( new Testcases ( ) ) ; final Testcases tc = data . getTestcases ( ) ; LOG . trace ( "TC: " + tc ) ; tc . setClazz ( file . getName ( ) ) ; } }
Loads the data .
197
5
9,037
public Map < String , Map < Date , Long > > getData ( final String collectorName ) { final Map < String , Map < Date , Long > > map = new HashMap <> ( ) ; final Testcases testcases = data . getTestcases ( ) ; for ( final TestcaseType tct : testcases . getTestcase ( ) ) { final Map < Date , Long > measures = new HashMap <> ( ) ; final List < Datacollector > collectorMap = tct . getDatacollector ( ) ; Datacollector collector = null ; for ( final Datacollector dc : collectorMap ) { if ( dc . getName ( ) . equals ( collectorName ) ) { collector = dc ; } } if ( collector == null ) { LOG . error ( "Achtung: Datenkollektor " + collectorName + " nicht vorhanden" ) ; } else { for ( final Result s : collector . getResult ( ) ) { measures . put ( new Date ( s . getDate ( ) ) , ( long ) s . getValue ( ) ) ; } map . put ( tct . getName ( ) , measures ) ; } } return map ; }
Returns a mapping from all testcases to their results for a certain collectorName .
265
16
9,038
public Set < String > getCollectors ( ) { final Set < String > collectors = new HashSet < String > ( ) ; final Testcases testcases = data . getTestcases ( ) ; for ( final TestcaseType tct : testcases . getTestcase ( ) ) { for ( final Datacollector collector : tct . getDatacollector ( ) ) { collectors . add ( collector . getName ( ) ) ; } } return collectors ; }
Returns all datacollectors that are used in the resultfile .
101
15
9,039
public static < T > T max ( T lhs , T rhs , Comparator < T > comparator ) { return BinaryOperator . maxBy ( comparator ) . apply ( lhs , rhs ) ; }
Evaluates max of two elements .
47
8
9,040
public static < T extends Comparable < T > > T max ( T lhs , T rhs ) { return BinaryOperator . maxBy ( new ComparableComparator < T > ( ) ) . apply ( lhs , rhs ) ; }
Evaluates max of two comparable elements .
53
9
9,041
public static < T > T min ( T lhs , T rhs , Comparator < T > comparator ) { return BinaryOperator . minBy ( comparator ) . apply ( lhs , rhs ) ; }
Evaluates min of two elements .
47
8
9,042
public static < T extends Comparable < T > > T min ( T lhs , T rhs ) { return BinaryOperator . minBy ( new ComparableComparator < T > ( ) ) . apply ( lhs , rhs ) ; }
Evaluates min of two comparable elements .
53
9
9,043
public static < T > Pair < T , T > ordered ( T lhs , T rhs , Comparator < T > comparator ) { return new MakeOrder < T > ( comparator ) . apply ( lhs , rhs ) ; }
Returns the two elements ordered in a pair .
52
9
9,044
public static < T extends Comparable < T > > Pair < T , T > ordered ( T lhs , T rhs ) { return new MakeOrder < T > ( new ComparableComparator < T > ( ) ) . apply ( lhs , rhs ) ; }
Returns the two comparable elements ordered in a pair .
58
10
9,045
public void swap ( int i , int j ) { try { // swap items Collections . swap ( order , i , j ) ; } catch ( IndexOutOfBoundsException ex ) { throw new SolutionModificationException ( "Error while modifying permutation solution: swapped positions should be positive " + "and smaller than the number of items in the permutation." , this ) ; } }
Swap the items at position i and j in the permutation . Both positions should be positive and smaller than the number of items in the permutation .
80
31
9,046
public static void validate ( BigInteger nummer , Ort ort ) { if ( nummer . compareTo ( BigInteger . ONE ) < 0 ) { throw new InvalidValueException ( nummer , "number" ) ; } validate ( ort ) ; }
Validiert das uebergebene Postfach auf moegliche Fehler .
54
23
9,047
public final boolean execute ( ) throws Exception { boolean finished = false ; mainThread . start ( ) ; mainThread . setUncaughtExceptionHandler ( new UncaughtExceptionHandler ( ) { @ Override public void uncaughtException ( final Thread arg0 , final Throwable arg1 ) { LOG . error ( "Uncaught exception in {}: {}" , arg0 . getName ( ) , arg1 . getClass ( ) ) ; testError = arg1 ; } } ) ; LOG . debug ( "Warte: " + timeout ) ; mainThread . join ( timeout ) ; if ( mainThread . isAlive ( ) ) { mainThread . setFinished ( true ) ; LOG . error ( "Test " + type + " " + mainThread . getName ( ) + " timed out!" ) ; for ( int i = 0 ; i < 5 ; i ++ ) { mainThread . interrupt ( ) ; // asure, that the test does not catch the interrupt state itself Thread . sleep ( 5 ) ; } } else { finished = true ; } mainThread . join ( 1000 ) ; // TODO If this time is shortened, test if ( mainThread . isAlive ( ) ) { LOG . error ( "Test timed out and was not able to save his data after 10 seconds - is killed hard now." ) ; mainThread . stop ( ) ; } if ( testError != null ) { LOG . trace ( "Test error != null" ) ; if ( testError instanceof Exception ) { throw ( Exception ) testError ; } else if ( testError instanceof Error ) { throw ( Error ) testError ; } else { LOG . error ( "Unexpected behaviour" ) ; testError . printStackTrace ( ) ; } } return finished ; }
Executes the TimeBoundedExecution .
373
9
9,048
public static Geldbetrag parse ( CharSequence text , MonetaryAmountFormat formatter ) { return from ( formatter . parse ( text ) ) ; }
Erzeugt einen Geldbetrag anhand des uebergebenen Textes und mittels des uebergebenen Formatters .
33
35
9,049
public static String validate ( String zahl ) { try { return Geldbetrag . valueOf ( zahl ) . toString ( ) ; } catch ( IllegalArgumentException ex ) { throw new InvalidValueException ( zahl , "money_amount" , ex ) ; } }
Validiert die uebergebene Zahl ob sie sich als Geldbetrag eignet .
60
27
9,050
public static BigDecimal validate ( BigDecimal zahl , CurrencyUnit currency ) { if ( zahl . scale ( ) == 0 ) { return zahl . setScale ( currency . getDefaultFractionDigits ( ) , RoundingMode . HALF_UP ) ; } return zahl ; }
Validiert die uebergebene Zahl .
64
13
9,051
@ Override public < R > R query ( MonetaryQuery < R > query ) { Objects . requireNonNull ( query ) ; try { return query . queryFrom ( this ) ; } catch ( MonetaryException ex ) { throw ex ; } catch ( RuntimeException ex ) { throw new LocalizedMonetaryException ( "query failed" , query , ex ) ; } }
Fraegt einen Wert an .
77
9
9,052
public String toLongString ( ) { NumberFormat formatter = DecimalFormat . getInstance ( ) ; formatter . setMinimumFractionDigits ( context . getMaxScale ( ) ) ; formatter . setMinimumFractionDigits ( context . getMaxScale ( ) ) ; return formatter . format ( betrag ) + " " + currency ; }
Hier wird der Geldbetrag mit voller Genauigkeit ausgegeben .
76
23
9,053
public static < T2 , T1 , R > Function < T1 , R > compose ( Function < T2 , R > f , Function < T1 , T2 > g ) { dbc . precondition ( f != null , "cannot compose a null function" ) ; dbc . precondition ( g != null , "cannot compose a null function" ) ; return f . compose ( g ) ; }
Composes a function with another function .
91
8
9,054
public static < T1 , T2 , T3 , R > BiFunction < T1 , T2 , R > compose ( Function < T3 , R > unary , BiFunction < T1 , T2 , T3 > binary ) { dbc . precondition ( unary != null , "cannot compose a null unary function" ) ; dbc . precondition ( binary != null , "cannot compose a null binary function" ) ; return binary . andThen ( unary ) ; }
Composes a function with a binary function .
109
9
9,055
public static < T1 , T2 , T3 , T4 , R > TriFunction < T1 , T2 , T3 , R > compose ( Function < T4 , R > unary , TriFunction < T1 , T2 , T3 , T4 > ternary ) { dbc . precondition ( unary != null , "cannot compose a null unary function" ) ; dbc . precondition ( ternary != null , "cannot compose a null ternary function" ) ; return ternary . andThen ( unary ) ; }
Composes a function with a ternary function .
126
11
9,056
public static < T > UnaryOperator < T > compose ( Iterator < Function < T , T > > endodelegates ) { return new UnaryOperatorsComposer < T > ( ) . apply ( endodelegates ) ; }
Composes an iterator of endofunctions .
52
9
9,057
public static < T1 , T2 > BiPredicate < T1 , T2 > or ( BiPredicate < T1 , T2 > first , BiPredicate < T1 , T2 > second , BiPredicate < T1 , T2 > third ) { dbc . precondition ( first != null , "first predicate is null" ) ; dbc . precondition ( second != null , "second predicate is null" ) ; dbc . precondition ( third != null , "third predicate is null" ) ; return Logic . Binary . or ( Iterations . iterable ( first , second , third ) ) ; }
Creates a composite OR predicate from the given predicates .
137
12
9,058
@ SuppressWarnings ( "unchecked" ) // marshall from apache commons cli private void parse ( ) throws ParseException { _argValues = new HashMap < Argument , String > ( ) ; _varargValues = new ArrayList < String > ( ) ; List < String > argList = _commandLine . getArgList ( ) ; int required = 0 ; boolean hasOptional = false ; boolean hasVarargs = false ; for ( Argument argument : _arguments . getArguments ( ) ) { if ( argument . isRequired ( ) ) { required ++ ; } else { hasOptional = true ; } if ( argument . isVararg ( ) ) { hasVarargs = true ; } } int allowed = hasOptional ? required + 1 : required ; if ( argList . size ( ) < required ) { throw new ParseException ( "Not enough arguments provided. " + required + " required, but only " + argList . size ( ) + " provided." ) ; } if ( ! hasVarargs ) { if ( argList . size ( ) > allowed ) { throw new ParseException ( "Too many arguments provided. Only " + allowed + " allowed, but " + argList . size ( ) + " provided." ) ; } } int index = 0 ; boolean finalArgEncountered = false ; for ( Argument argument : _arguments . getArguments ( ) ) { if ( finalArgEncountered ) throw new IllegalStateException ( "Illegal arguments defined. No additional arguments may be defined after first optional or vararg argument." ) ; if ( argument . isRequired ( ) && ! argument . isVararg ( ) ) { // the normal case if ( index <= argList . size ( ) ) { _argValues . put ( argument , argList . get ( index ) ) ; } else { throw new IllegalStateException ( "not enough arguments" ) ; // should not happen given above size check } } else { // it's the last argument, either it's optional or a vararg finalArgEncountered = true ; if ( argument . isVararg ( ) ) { _varargValues = argList . subList ( Math . min ( index , argList . size ( ) ) , argList . size ( ) ) ; if ( argument . isRequired ( ) && _varargValues . size ( ) < 1 ) { throw new IllegalStateException ( "not enough arguments" ) ; // should not happen given above size check } } else { // if it's a optional if ( index < argList . size ( ) ) { _argValues . put ( argument , argList . get ( index ) ) ; } } } index ++ ; } }
Parses and verifies the command line options .
571
11
9,059
public String normalize ( String value ) { if ( ! value . matches ( "[\\d,.]+([eE]\\d+)?" ) ) { throw new InvalidValueException ( value , NUMBER ) ; } Locale locale = guessLocale ( value ) ; DecimalFormat df = ( DecimalFormat ) DecimalFormat . getInstance ( locale ) ; df . setParseBigDecimal ( true ) ; try { return df . parse ( value ) . toString ( ) ; } catch ( ParseException ex ) { throw new InvalidValueException ( value , NUMBER , ex ) ; } }
Normalisiert einen String sodass er zur Generierung einer Zahl herangezogen werden kann .
129
28
9,060
@ Override public boolean isValid ( String wert ) { if ( StringUtils . length ( wert ) < 1 ) { return false ; } else { return getPruefziffer ( wert ) . equals ( berechnePruefziffer ( wert . substring ( 0 , wert . length ( ) - 1 ) ) ) ; } }
Liefert true zurueck wenn der uebergebene Wert gueltig ist .
81
25
9,061
public boolean isBruch ( ) { String s = toString ( ) ; if ( s . contains ( "/" ) ) { try { Bruch . of ( s ) ; return true ; } catch ( IllegalArgumentException ex ) { LOG . fine ( s + " is not a fraction: " + ex ) ; return false ; } } else { return false ; } }
Liefert true zurueck wenn die Zahl als Bruch angegeben ist .
80
24
9,062
public PackedDecimal movePointLeft ( int n ) { BigDecimal result = toBigDecimal ( ) . movePointLeft ( n ) ; return PackedDecimal . valueOf ( result ) ; }
Verschiebt den Dezimalpunkt um n Stellen nach links .
45
17
9,063
public PackedDecimal movePointRight ( int n ) { BigDecimal result = toBigDecimal ( ) . movePointRight ( n ) ; return PackedDecimal . valueOf ( result ) ; }
Verschiebt den Dezimalpunkt um n Stellen nach rechts .
45
19
9,064
public PackedDecimal setScale ( int n , RoundingMode mode ) { BigDecimal result = toBigDecimal ( ) . setScale ( n , mode ) ; return PackedDecimal . valueOf ( result ) ; }
Setzt die Anzahl der Nachkommastellen .
50
15
9,065
public static < T > Runnable curry ( Consumer < T > consumer , T value ) { dbc . precondition ( consumer != null , "cannot bind parameter of a null consumer" ) ; return ( ) -> consumer . accept ( value ) ; }
Partial application of the first parameter to an consumer .
55
11
9,066
public static < T1 , T2 > Consumer < T2 > curry ( BiConsumer < T1 , T2 > consumer , T1 first ) { dbc . precondition ( consumer != null , "cannot bind parameter of a null consumer" ) ; return second -> consumer . accept ( first , second ) ; }
Partial application of the first parameter to a binary consumer .
68
12
9,067
public static < T > BooleanSupplier curry ( Predicate < T > predicate , T value ) { dbc . precondition ( predicate != null , "cannot bind parameter of a null predicate" ) ; return ( ) -> predicate . test ( value ) ; }
Partial application of the parameter to a predicate .
56
10
9,068
public static < T1 , T2 , T3 > BiPredicate < T2 , T3 > curry ( TriPredicate < T1 , T2 , T3 > predicate , T1 first ) { dbc . precondition ( predicate != null , "cannot bind parameter of a null predicate" ) ; return ( second , third ) -> predicate . test ( first , second , third ) ; }
Partial application of the first parameter to a ternary predicate .
86
14
9,069
public static < T , R > Supplier < R > curry ( Function < T , R > function , T value ) { dbc . precondition ( function != null , "cannot bind parameter of a null function" ) ; return ( ) -> function . apply ( value ) ; }
Partial application of the parameter to a function .
61
10
9,070
public static < T1 , T2 , R > Function < T2 , R > curry ( BiFunction < T1 , T2 , R > function , T1 first ) { dbc . precondition ( function != null , "cannot bind parameter of a null function" ) ; return second -> function . apply ( first , second ) ; }
Partial application of the first parameter to a binary function .
74
12
9,071
public static < T1 , T2 , T3 , R > BiFunction < T2 , T3 , R > curry ( TriFunction < T1 , T2 , T3 , R > function , T1 first ) { dbc . precondition ( function != null , "cannot bind parameter of a null function" ) ; return ( second , third ) -> function . apply ( first , second , third ) ; }
Partial application of the first parameter to a ternary function .
90
14
9,072
public static < T > Predicate < T > ignore ( BooleanSupplier proposition , Class < T > ignored ) { dbc . precondition ( proposition != null , "cannot ignore parameter of a null proposition" ) ; return t -> proposition . getAsBoolean ( ) ; }
Adapts a proposition to a predicate by ignoring the passed parameter .
60
13
9,073
public static < T1 , T2 > BiPredicate < T1 , T2 > ignore2nd ( Predicate < T1 > predicate , Class < T2 > ignored ) { dbc . precondition ( predicate != null , "cannot ignore parameter of a null predicate" ) ; return ( first , second ) -> predicate . test ( first ) ; }
Adapts a predicate to a binary predicate by ignoring second parameter .
77
13
9,074
public static < T1 , T2 , T3 > TriPredicate < T1 , T2 , T3 > ignore2nd ( BiPredicate < T1 , T3 > predicate , Class < T2 > ignored ) { dbc . precondition ( predicate != null , "cannot ignore parameter of a null predicate" ) ; return ( first , second , third ) -> predicate . test ( first , third ) ; }
Adapts a binary predicate to a ternary predicate by ignoring second parameter .
91
16
9,075
public static < T > Consumer < T > ignore ( Runnable runnable , Class < T > ignored ) { dbc . precondition ( runnable != null , "cannot ignore parameter of a null runnable" ) ; return first -> runnable . run ( ) ; }
Adapts a runnable to an consumer by ignoring the parameter .
64
14
9,076
public static < T1 , T2 > BiConsumer < T1 , T2 > ignore1st ( Consumer < T2 > consumer , Class < T1 > ignored ) { dbc . precondition ( consumer != null , "cannot ignore parameter of a null consumer" ) ; return ( first , second ) -> consumer . accept ( second ) ; }
Adapts an consumer to a binary consumer by ignoring the first parameter .
75
14
9,077
public static < T1 , T2 , T3 > TriConsumer < T1 , T2 , T3 > ignore3rd ( BiConsumer < T1 , T2 > consumer , Class < T3 > ignored ) { dbc . precondition ( consumer != null , "cannot ignore parameter of a null consumer" ) ; return ( first , second , third ) -> consumer . accept ( first , second ) ; }
Adapts a binary consumer to a ternary consumer by ignoring the third parameter .
89
17
9,078
public static < T , R > Function < T , R > ignore ( Supplier < R > supplier , Class < T > ignored ) { dbc . precondition ( supplier != null , "cannot ignore parameter of a null supplier" ) ; return first -> supplier . get ( ) ; }
Adapts a supplier to a function by ignoring the passed parameter .
62
13
9,079
public static < T1 , T2 , R > BiFunction < T1 , T2 , R > ignore1st ( Function < T2 , R > function , Class < T1 > ignored ) { dbc . precondition ( function != null , "cannot ignore parameter of a null function" ) ; return ( first , second ) -> function . apply ( second ) ; }
Adapts a function to a binary function by ignoring the first parameter .
81
14
9,080
public static < T1 , T2 , T3 , R > TriFunction < T1 , T2 , T3 , R > ignore1st ( BiFunction < T2 , T3 , R > function , Class < T1 > ignored ) { dbc . precondition ( function != null , "cannot ignore parameter of a null function" ) ; return ( first , second , third ) -> function . apply ( second , third ) ; }
Adapts a binary function to a ternary function by ignoring the first parameter .
95
17
9,081
public static < T > Supplier < Optional < T > > supplier ( Iterator < T > adaptee ) { return new IteratingSupplier < T > ( adaptee ) ; }
Adapts an iterator to a supplier .
39
8
9,082
public static Supplier < Void > supplier ( Runnable adaptee ) { dbc . precondition ( adaptee != null , "cannot adapt a null runnable" ) ; return ( ) -> { adaptee . run ( ) ; return null ; } ; }
Adapts a runnable to a supplier .
58
10
9,083
public static Supplier < Boolean > supplier ( BooleanSupplier adaptee ) { dbc . precondition ( adaptee != null , "cannot adapt a null boolean supplier" ) ; return ( ) -> adaptee . getAsBoolean ( ) ; }
Adapts a proposition to a supplier .
54
8
9,084
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 .
61
8
9,085
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 .
81
10
9,086
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 .
94
14
9,087
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 .
51
8
9,088
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 .
65
10
9,089
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 .
74
14
9,090
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 .
47
10
9,091
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 .
49
8
9,092
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 .
63
10
9,093
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 .
72
14
9,094
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 .
42
8
9,095
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 .
48
8
9,096
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
62
9
9,097
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 .
71
14
9,098
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 .
119
21
9,099
public static CellProcessor [ ] getCellProcessors ( ) { return new CellProcessor [ ] { new ParseInt ( ) { @ Override 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 .
136
22