idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
124,200
static double getValue ( Moment moment , TimeScale scale ) { long elapsedTime = moment . getElapsedTime ( scale ) + jdOffset ( scale ) ; int nano = moment . getNanosecond ( scale ) ; double secs = elapsedTime + nano / ( MRD * 1.0 ) ; return secs / DAY_IN_SECONDS ; }
obtains the JD - value for given moment and scale
124,201
static DayPeriod of ( Locale locale , String calendarType ) { String lang = locale . getLanguage ( ) ; if ( lang . equals ( "nn" ) ) { locale = new Locale ( "nb" ) ; } Map < String , String > resourceMap = loadTextForms ( locale , calendarType ) ; SortedMap < PlainTime , String > codeMap = Collections . emptySortedMap ...
package - private because used in deserialization
124,202
double getHighestElevationOfSun ( PlainDate date ) { Moment noon = date . get ( this . transitAtNoon ( ) ) ; double jde = JulianDay . getValue ( noon , TimeScale . TT ) ; double decInRad = Math . toRadians ( this . getCalculator ( ) . getFeature ( jde , DECLINATION ) ) ; double latInRad = Math . toRadians ( this . lati...
used in test classes too
124,203
HistoricEra getPreferredEra ( HistoricDate hd , PlainDate date ) { if ( ( this . era == null ) || date . isBefore ( this . start ) || date . isAfter ( this . end ) ) { return ( ( hd . compareTo ( AD1 ) < 0 ) ? HistoricEra . BC : HistoricEra . AD ) ; } else if ( ( this . era == HistoricEra . HISPANIC ) && ( hd . compare...
determines the preferred era for a given historic date
124,204
void dump ( int size , Appendable buffer ) throws IOException { for ( int i = 0 ; i < size ; i ++ ) { ZonalTransition transition = this . transitions [ i ] ; TransitionModel . dump ( transition , buffer ) ; } }
Called by CompositeTransitionModel
124,205
private static int search ( long posixTime , ZonalTransition [ ] transitions ) { int low = 0 ; int high = transitions . length - 1 ; while ( low <= high ) { int middle = ( low + high ) / 2 ; if ( transitions [ middle ] . getPosixTime ( ) <= posixTime ) { low = middle + 1 ; } else { high = middle - 1 ; } } return low ; ...
returns index of first transition after posixTime
124,206
private static int searchLocal ( long localSecs , ZonalTransition [ ] transitions ) { int low = 0 ; int high = transitions . length - 1 ; while ( low <= high ) { int middle = ( low + high ) / 2 ; ZonalTransition zt = transitions [ middle ] ; int offset = Math . max ( zt . getTotalOffset ( ) , zt . getPreviousOffset ( )...
returns index of first transition after local date and time
124,207
< V > ElementRule < T , V > getRule ( ChronoElement < V > element ) { return this . getChronology ( ) . getRule ( element ) ; }
Determines the associated element rule .
124,208
int getValue ( ) { if ( this . matches ( Selector . NORTHERN_COURT ) ) { return ( this . index - NORTHERN_NENGOS . length + NENGO_OEI . index - Nengo . SHOWA . index + 1 ) ; } return ( this . index - Nengo . SHOWA . index + 1 ) ; }
verwendet in JapaneseCalendar
124,209
static long transform ( int relgregyear , int dayOfYear ) { if ( relgregyear >= 1873 ) { return PlainDate . of ( relgregyear , dayOfYear ) . getDaysSinceEpochUTC ( ) ; } else { return START_OF_YEAR [ relgregyear - 701 ] + dayOfYear - 1 ; } }
also used in serialization
124,210
int getPrefixedDigitArea ( ) { if ( this . multi == null ) { return 0 ; } int digits = 0 ; for ( int i = 0 , n = this . multi . length ( ) ; i < n && Character . isDigit ( this . multi . charAt ( i ) ) ; i ++ ) { digits ++ ; } return digits ; }
count of leading digits
124,211
static int subSequenceEquals ( CharSequence test , int offset , CharSequence expected , boolean caseInsensitive , boolean rtl ) { int j = 0 ; int max = test . length ( ) ; int len = expected . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = '\u0000' ; char exp = expected . charAt ( i ) ; if ( isBidi ( exp ) ...
also used by LocalizedGMTProcessor
124,212
ChronoFormatter < T > with ( Map < ChronoElement < ? > , Object > outerDefaults , AttributeSet outerAttrs ) { AttributeSet merged = AttributeSet . merge ( outerAttrs , this . globalAttributes ) ; return new ChronoFormatter < > ( new ChronoFormatter < > ( this , outerDefaults ) , merged , merged . get ( HistoricAttribut...
used by CustomizedProcessor
124,213
static boolean hasUnixChronology ( Chronology < ? > chronology ) { Chronology < ? > c = chronology ; do { if ( UnixTime . class . isAssignableFrom ( c . getChronoType ( ) ) ) { return true ; } } while ( ( c = c . preparser ( ) ) != null ) ; return false ; }
also called in PatternType
124,214
private static double sinAlt ( double mjd0 , double hour , double longitudeRad , double cosLatitude , double sinLatitude , double geodeticAngle , double refraction , double deltaT ) { double mjd = mjd0 + hour / 24.0 ; double jct = toJulianCenturies ( mjd + ( deltaT / 86400 ) ) ; double [ ] data = MoonPosition . calcula...
sinus of moon altitude above or below horizon
124,215
public static String removeZones ( String pattern ) { boolean literal = false ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 , n = pattern . length ( ) ; i < n ; i ++ ) { char c = pattern . charAt ( i ) ; if ( c == '\'' ) { if ( i + 1 < n && pattern . charAt ( i + 1 ) == '\'' ) { sb . append ( c ) ; i ++ ...
Strips off any timezone symbols in clock time patterns .
124,216
static void printNanos ( StringBuilder sb , int nano ) { sb . append ( PlainTime . ISO_DECIMAL_SEPARATOR ) ; String num = Integer . toString ( nano ) ; int len ; if ( ( nano % MIO ) == 0 ) { len = 3 ; } else if ( ( nano % KILO ) == 0 ) { len = 6 ; } else { len = 9 ; } for ( int i = num . length ( ) ; i < 9 ; i ++ ) { s...
also called by ZonalDateTime
124,217
static AttributeSet merge ( AttributeSet outer , AttributeSet inner ) { Map < String , Object > internalsNew = new HashMap < > ( ) ; internalsNew . putAll ( inner . internals ) ; internalsNew . putAll ( outer . internals ) ; Attributes attributesNew = new Attributes . Builder ( ) . setAll ( inner . attributes ) . setAl...
used to create merged global attributes for a new formatter
124,218
void reset ( ) { if ( this . keys == null ) { this . len = Integer . MIN_VALUE ; this . mask = Integer . MIN_VALUE ; this . threshold = Integer . MIN_VALUE ; this . count = Integer . MIN_VALUE ; for ( int i = 0 ; i < 3 ; i ++ ) { this . ints [ i ] = Integer . MIN_VALUE ; } this . map = null ; } else { this . keys = new...
called in context of erraneous or - block
124,219
static int parsePeriod ( String period , char symbol ) throws ParseException { if ( period . isEmpty ( ) ) { throw new ParseException ( "Empty period." , 0 ) ; } boolean negative = false ; int index = 0 ; int len = period . length ( ) ; if ( period . charAt ( 0 ) == '-' ) { index ++ ; negative = true ; } if ( ( index <...
called by subclasses
124,220
static void writeTransitions ( ZonalTransition [ ] transitions , int size , DataOutput out ) throws IOException { int n = Math . min ( size , transitions . length ) ; out . writeInt ( n ) ; if ( n > 0 ) { int stdOffset = transitions [ 0 ] . getPreviousOffset ( ) ; writeOffset ( out , stdOffset ) ; for ( int i = 0 ; i <...
called by ArrayTransitionModel
124,221
protected TextAccessor accessor ( AttributeQuery attributes , OutputContext outputContext , boolean leap ) { Locale lang = attributes . get ( Attributes . LANGUAGE , Locale . ROOT ) ; TextWidth textWidth = attributes . get ( Attributes . TEXT_WIDTH , TextWidth . WIDE ) ; CalendarText cnames = CalendarText . getInstance...
Might be overridden in special cases .
124,222
static HijriAdjustment from ( String variant ) { int index = variant . indexOf ( ':' ) ; if ( index == - 1 ) { return new HijriAdjustment ( variant , 0 ) ; } else { try { int adjustment = Integer . parseInt ( variant . substring ( index + 1 ) ) ; return new HijriAdjustment ( variant . substring ( 0 , index ) , adjustme...
also called by Hijri calendar systems
124,223
private int unFilledSpacesInHeaderGroup ( int header ) { if ( mNumColumns == 0 ) { return 0 ; } int remainder = mDelegate . getCountForHeader ( header ) % mNumColumns ; return remainder == 0 ? 0 : mNumColumns - remainder ; }
Counts the number of items that would be need to fill out the last row in the group of items with the given header .
124,224
public View getHeaderAt ( int position ) { if ( position == MATCHED_STICKIED_HEADER ) { return mStickiedHeader ; } try { return ( View ) getChildAt ( position ) . getTag ( ) ; } catch ( Exception e ) { } return null ; }
Gets the header at an item position . However the position must be that of a HeaderFiller .
124,225
@ TargetApi ( Build . VERSION_CODES . HONEYCOMB ) public void setActivateOnItemClick ( boolean activateOnItemClick ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . HONEYCOMB ) { mGridView . setChoiceMode ( activateOnItemClick ? ListView . CHOICE_MODE_SINGLE : ListView . CHOICE_MODE_NONE ) ; } }
Turns on activate - on - click mode . When this mode is on list items will be given the activated state when touched .
124,226
@ TargetApi ( Build . VERSION_CODES . ICE_CREAM_SANDWICH ) void addScrapView ( View scrap , int position , int viewType ) { Scrap item = new Scrap ( scrap , true ) ; if ( viewTypeCount == 1 ) { currentScraps . put ( position , item ) ; } else { scraps [ viewType ] . put ( position , item ) ; } if ( Build . VERSION . SD...
Put a view into the ScrapViews list . These views are unordered .
124,227
private void setDrawWithLayer ( View v , boolean drawWithLayer ) { if ( isHardwareAccelerated ( ) ) { if ( v . getLayerType ( ) != LAYER_TYPE_HARDWARE && drawWithLayer ) { v . setLayerType ( LAYER_TYPE_HARDWARE , null ) ; } else if ( v . getLayerType ( ) != LAYER_TYPE_NONE && ! drawWithLayer ) { v . setLayerType ( LAYE...
Enable a hardware layer for the view .
124,228
public static Parser < Void > many ( CharPredicate predicate ) { return Patterns . isChar ( predicate ) . many ( ) . toScanner ( predicate + "*" ) ; }
A scanner that scans greedily for 0 or more characters that satisfies the given CharPredicate .
124,229
public static Parser < Void > many1 ( CharPredicate predicate ) { return Patterns . many1 ( predicate ) . toScanner ( predicate + "+" ) ; }
A scanner that scans greedily for 1 or more characters that satisfies the given CharPredicate .
124,230
public static Parser < Void > many1 ( Pattern pattern , String name ) { return pattern . many1 ( ) . toScanner ( name ) ; }
A scanner that scans greedily for 1 or more occurrences of the given pattern .
124,231
public static Parser < Void > stringCaseInsensitive ( String str ) { return Patterns . stringCaseInsensitive ( str ) . toScanner ( str ) ; }
A scanner that matches the input against the specified string case insensitively .
124,232
public static void checkState ( boolean condition , String message , Object ... args ) throws IllegalStateException { if ( ! condition ) { throw new IllegalStateException ( String . format ( message , args ) ) ; } }
Checks a certain state .
124,233
static Parser < Expression > simpleNewExpression ( Parser < Expression > arg , Parser < DefBody > body ) { return Parsers . sequence ( term ( "new" ) . next ( TypeLiteralParser . ELEMENT_TYPE_LITERAL ) , argumentList ( arg ) , body . optional ( ) , ( type , args , defBody ) -> new NewExpression ( null , type , args , d...
new a class instance
124,234
public OperatorTable < T > prefix ( Parser < ? extends Function < ? super T , ? extends T > > parser , int precedence ) { ops . add ( new Operator ( parser , precedence , Associativity . PREFIX ) ) ; return this ; }
Adds a prefix unary operator .
124,235
public OperatorTable < T > postfix ( Parser < ? extends Function < ? super T , ? extends T > > parser , int precedence ) { ops . add ( new Operator ( parser , precedence , Associativity . POSTFIX ) ) ; return this ; }
Adds a postfix unary operator .
124,236
public OperatorTable < T > infixl ( Parser < ? extends BiFunction < ? super T , ? super T , ? extends T > > parser , int precedence ) { ops . add ( new Operator ( parser , precedence , Associativity . LASSOC ) ) ; return this ; }
Adds an infix left - associative binary operator .
124,237
public OperatorTable < T > infixr ( Parser < ? extends BiFunction < ? super T , ? super T , ? extends T > > parser , int precedence ) { ops . add ( new Operator ( parser , precedence , Associativity . RASSOC ) ) ; return this ; }
Adds an infix right - associative binary operator .
124,238
public OperatorTable < T > infixn ( Parser < ? extends BiFunction < ? super T , ? super T , ? extends T > > parser , int precedence ) { ops . add ( new Operator ( parser , precedence , Associativity . NASSOC ) ) ; return this ; }
Adds an infix non - associative binary operator .
124,239
public static long cleartextSize ( long ciphertextSize , Cryptor cryptor ) { checkArgument ( ciphertextSize >= 0 , "expected ciphertextSize to be positive, but was %s" , ciphertextSize ) ; long cleartextChunkSize = cryptor . fileContentCryptor ( ) . cleartextChunkSize ( ) ; long ciphertextChunkSize = cryptor . fileCont...
Calculates the size of the cleartext resulting from the given ciphertext decrypted with the given cryptor .
124,240
public static long ciphertextSize ( long cleartextSize , Cryptor cryptor ) { checkArgument ( cleartextSize >= 0 , "expected cleartextSize to be positive, but was %s" , cleartextSize ) ; long cleartextChunkSize = cryptor . fileContentCryptor ( ) . cleartextChunkSize ( ) ; long ciphertextChunkSize = cryptor . fileContent...
Calculates the size of the ciphertext resulting from the given cleartext encrypted with the given cryptor .
124,241
public static int copy ( ByteBuffer source , ByteBuffer destination ) { final int numBytes = Math . min ( source . remaining ( ) , destination . remaining ( ) ) ; final ByteBuffer tmp = source . asReadOnlyBuffer ( ) ; tmp . limit ( tmp . position ( ) + numBytes ) ; destination . put ( tmp ) ; source . position ( tmp . ...
Copies as many bytes as possible from the given source to the destination buffer . The position of both buffers will be incremented by as many bytes as have been copied .
124,242
public static KeyFile parse ( byte [ ] serialized ) { try ( InputStream in = new ByteArrayInputStream ( serialized ) ; Reader reader = new InputStreamReader ( in , UTF_8 ) ; JsonReader jsonReader = GSON . newJsonReader ( reader ) ) { JsonObject jsonObj = new JsonParser ( ) . parse ( jsonReader ) . getAsJsonObject ( ) ;...
Parses a json keyfile .
124,243
public < T extends KeyFile > T as ( Class < T > clazz ) { T result = GSON . fromJson ( jsonObj , clazz ) ; ( ( KeyFile ) result ) . jsonObj = jsonObj ; return result ; }
Creates a new version - specific KeyFile instance from this instance .
124,244
public static < T > void register ( Class < T > pluginClass , T pluginImpl ) throws IllegalStateException { INSTANCE . registerInternal ( pluginClass , pluginImpl ) ; }
Registers an implementation as a global override of any injected or default implementations .
124,245
private static Object getPluginImplementationViaProperty ( Class < ? > pluginClass ) { String className = pluginClass . getCanonicalName ( ) ; if ( className == null ) { throw new IllegalArgumentException ( "Class " + pluginClass + " does not have a canonical name!" ) ; } String implementingClass = System . getProperty...
Returns an implementation of the given class using the system properties as a registry .
124,246
public static < T > Function < T , Boolean > forPredicate ( Predicate < T > predicate ) { return predicate :: test ; }
Creates a function that returns the same boolean output as the given predicate for all inputs .
124,247
public final Optional < L > asOptionalLeft ( ) { return fold ( Optional :: of , val -> Optional . < L > empty ( ) ) ; }
Returns the left side as an Optional .
124,248
public final Optional < R > asOptionalRight ( ) { return fold ( val -> Optional . < R > empty ( ) , Optional :: of ) ; }
Returns the right side as an Optional .
124,249
public final < T > T fold ( Function < ? super L , ? extends T > left , Function < ? super R , ? extends T > right ) { if ( isLeft ( ) ) { return left . apply ( getLeft ( ) ) ; } else { return right . apply ( getRight ( ) ) ; } }
Applies either the left or the right function as appropriate .
124,250
public final void accept ( Consumer < ? super L > left , Consumer < ? super R > right ) { if ( isLeft ( ) ) { left . accept ( getLeft ( ) ) ; } else { right . accept ( getRight ( ) ) ; } }
Accepts either the left or the right consumer as appropriate .
124,251
public final void acceptBoth ( Consumer < ? super L > left , Consumer < ? super R > right , L defaultLeft , R defaultRight ) { left . accept ( isLeft ( ) ? getLeft ( ) : defaultLeft ) ; right . accept ( isRight ( ) ? getRight ( ) : defaultRight ) ; }
Accepts both the left and right consumers using the default values to set the empty side .
124,252
public static < L , R > Either < L , R > create ( L l , R r ) { if ( l == null && r != null ) { return createRight ( r ) ; } else if ( l != null && r == null ) { return createLeft ( l ) ; } else { if ( l == null ) { throw new IllegalArgumentException ( "Both arguments were null." ) ; } else { throw new IllegalArgumentE...
Creates a left or right depending on which element is non - null . Precisely one element should be non - null .
124,253
public static < L , R > Either < L , R > createLeft ( L l ) { return new Left < > ( l ) ; }
Creates an instance of Left .
124,254
public static < L , R > Either < L , R > createRight ( R r ) { return new Right < > ( r ) ; }
Creates an instance of Right .
124,255
public TreeComparison < E , A > decorateErrorsWith ( Function < ? super E , String > expectedToString , Function < ? super A , String > actualToString ) { this . expectedToString = expectedToString ; this . actualToString = actualToString ; return this ; }
Decorates errors thrown by any assertions with the given functions .
124,256
private AssertionError createComparisonFailure ( String className , String expected , String actual ) throws Exception { Class < ? > clazz = Class . forName ( className ) ; Constructor < ? > constructor = clazz . getConstructor ( String . class , String . class , String . class ) ; return ( AssertionError ) constructor...
Attempts to create an instance of junit s ComparisonFailure exception using reflection .
124,257
public < T > SameType < T > mapToSame ( Function < ? super E , ? extends T > mapExpected , Function < ? super A , ? extends T > mapActual ) { return new SameTypeImp < > ( this , mapExpected , mapActual ) ; }
Maps both sides of the comparison to the same type for easier comparison and assertions .
124,258
public void sortChildrenByContent ( Comparator < ? super T > comparator ) { Comparator < TreeNode < T > > byContent = Comparator . comparing ( TreeNode :: getContent , comparator ) ; sortChildrenByNode ( byContent ) ; }
Recursively sorts all children using the given comparator of their content .
124,259
public void sortChildrenByNode ( Comparator < TreeNode < T > > comparator ) { Collections . sort ( children , comparator ) ; for ( TreeNode < T > child : children ) { child . sortChildrenByNode ( comparator ) ; } }
Recursively sorts all children using the given comparator of TreeNode .
124,260
public static < T > TreeNode < T > copy ( TreeDef < T > treeDef , T root ) { return copy ( treeDef , root , Function . identity ( ) ) ; }
Creates a hierarchy of TreeNodes that copies the structure and content of the given tree .
124,261
public TreeNode < T > findByContent ( T content ) { Optional < TreeNode < T > > opt = TreeStream . breadthFirst ( treeDef ( ) , this ) . filter ( node -> node . getContent ( ) . equals ( content ) ) . findFirst ( ) ; if ( opt . isPresent ( ) ) { return opt . get ( ) ; } else { throw new IllegalArgumentException ( this ...
Searches breadth - first for the TreeNode with the given content .
124,262
public static < T > boolean isDescendantOf ( TreeDef . Parented < T > treeDef , T child , T parent ) { T candidateParent = treeDef . parentOf ( child ) ; while ( candidateParent != null ) { if ( candidateParent . equals ( parent ) ) { return true ; } else { candidateParent = treeDef . parentOf ( candidateParent ) ; } }...
Returns true iff child is a descendant of parent .
124,263
public static < T > boolean isDescendantOfOrEqualTo ( TreeDef . Parented < T > treeDef , T child , T parent ) { if ( child . equals ( parent ) ) { return true ; } else { return isDescendantOf ( treeDef , child , parent ) ; } }
Returns true iff child is a descendant of parent or if child is equal to parent .
124,264
public static < T > T root ( TreeDef . Parented < T > treeDef , T node ) { T lastParent ; T parent = node ; do { lastParent = parent ; parent = treeDef . parentOf ( lastParent ) ; } while ( parent != null ) ; return lastParent ; }
Returns the root of the given tree .
124,265
private static < T > Optional < T > lowestCommonAncestor ( TreeDef . Parented < T > treeDef , T nodeA , T nodeB ) { class TreeSearcher { private T tip ; private final Set < T > visited ; public TreeSearcher ( T start ) { this . tip = start ; this . visited = new HashSet < > ( ) ; } public boolean hasMore ( ) { return t...
Returns the common parent of the two given elements .
124,266
public static < T > String path ( TreeDef . Parented < T > treeDef , T node , Function < ? super T , String > toString , String delimiter ) { List < T > toRoot = toRoot ( treeDef , node ) ; ListIterator < T > iterator = toRoot . listIterator ( toRoot . size ( ) ) ; StringBuilder builder = new StringBuilder ( ) ; while ...
Returns the path of the given node .
124,267
public Runnable wrap ( Throwing . Runnable runnable ) { return ( ) -> { try { runnable . run ( ) ; } catch ( Throwable e ) { handler . accept ( e ) ; } } ; }
Returns a Runnable whose exceptions are handled by this Errors .
124,268
public < T > Consumer < T > wrap ( Throwing . Consumer < T > consumer ) { return val -> { try { consumer . accept ( val ) ; } catch ( Throwable e ) { handler . accept ( e ) ; } } ; }
Returns a Consumer whose exceptions are handled by this Errors .
124,269
public static RuntimeException asRuntime ( Throwable e ) { if ( e instanceof RuntimeException ) { return ( RuntimeException ) e ; } else { return new WrappedAsRuntimeException ( e ) ; } }
Casts or wraps the given exception to be a RuntimeException .
124,270
private static Object tryCall ( String methodName , Throwing . Supplier < Object > supplier ) { try { return supplier . get ( ) ; } catch ( Throwable error ) { return new CallException ( methodName , error ) ; } }
Executes the given function return any exceptions it might throw as wrapped values .
124,271
private static < K , V > Map . Entry < K , V > createEntry ( K key , V value ) { return new Map . Entry < K , V > ( ) { public K getKey ( ) { return key ; } public V getValue ( ) { return value ; } public V setValue ( V value ) { throw new UnsupportedOperationException ( ) ; } } ; }
Creates an immutable Map . Entry .
124,272
public static void dump ( String message , Throwable exception ) { printEmphasized ( StringPrinter . buildString ( printer -> { printer . println ( message ) ; exception . printStackTrace ( printer . toPrintWriter ( ) ) ; } ) ) ; }
Dumps the given message and exception stack to the system error console
124,273
public static PrintStream wrapAndDumpWhenContains ( PrintStream source , String trigger ) { StringPrinter wrapped = new StringPrinter ( StringPrinter . stringsToLines ( perLine -> { source . println ( perLine ) ; if ( perLine . contains ( trigger ) ) { dump ( "Triggered by " + trigger ) ; } } ) ) ; return wrapped . toP...
Returns a PrintStream which will redirect all of its output to the source PrintStream . If the trigger string is passed through the wrapped PrintStream then it will dump the stack trace of the call that printed the trigger .
124,274
public static List < StackTraceElement > captureStackBelow ( Class < ? > ... clazzes ) { List < Class < ? > > toIgnore = new ArrayList < > ( clazzes . length + 1 ) ; toIgnore . addAll ( Arrays . asList ( clazzes ) ) ; toIgnore . add ( StackDumper . class ) ; Predicate < StackTraceElement > isSkipped = element -> toIgno...
Captures all of the current stack which is below the given classes .
124,275
private static void printEmphasized ( String toPrint ) { pristineSysErr . println ( "+----------\\" ) ; for ( String line : toPrint . split ( "\n" ) ) { pristineSysErr . println ( "| " + line ) ; } pristineSysErr . println ( "+----------/" ) ; }
Prints the given string to the the given printer wrapped in hierarchy - friendly braces . Useful for emphasizing a specific event from a sea of logging statements .
124,276
public static String buildString ( Consumer < StringPrinter > printer ) { StringBuilder builder = new StringBuilder ( ) ; printer . accept ( new StringPrinter ( builder :: append ) ) ; return builder . toString ( ) ; }
Easy way to create a String using a StringPrinter .
124,277
public static String buildStringFromLines ( String ... lines ) { int numChars = lines . length ; for ( String line : lines ) { numChars += line . length ( ) ; } StringBuilder builder = new StringBuilder ( numChars ) ; for ( String line : lines ) { builder . append ( line ) ; builder . append ( '\n' ) ; } return builder...
Easy way to create a String from a bunch of lines .
124,278
public PrintStream toPrintStream ( Charset charset ) { return Errors . rethrow ( ) . get ( ( ) -> { return new PrintStream ( toOutputStream ( charset ) , true , charset . name ( ) ) ; } ) ; }
Creates a PrintStream of the given charset which passes its content to this StringPrinter .
124,279
public Writer toWriter ( ) { return new Writer ( ) { public Writer append ( char c ) { consumer . accept ( new String ( new char [ ] { c } ) ) ; return this ; } public Writer append ( CharSequence csq ) { if ( csq instanceof String ) { consumer . accept ( ( String ) csq ) ; } else { consumer . accept ( toStringSafely (...
Creates a Writer which passes its content to this StringPrinter .
124,280
public static double getDouble ( final String key ) { return Double . longBitsToDouble ( getPreferences ( ) . getLong ( key , Double . doubleToLongBits ( 0.0d ) ) ) ; }
Returns the double that has been saved as a long raw bits value in the long preferences . Returns 0 if the preference does not exist .
124,281
public static String getString ( final String key , final String defValue ) { return getPreferences ( ) . getString ( key , defValue ) ; }
Retrieves a stored String value .
124,282
public static void putLong ( final String key , final long value ) { final Editor editor = getPreferences ( ) . edit ( ) ; editor . putLong ( key , value ) ; editor . apply ( ) ; }
Stores a long value .
124,283
public static void putDouble ( final String key , final double value ) { final Editor editor = getPreferences ( ) . edit ( ) ; editor . putLong ( key , Double . doubleToRawLongBits ( value ) ) ; editor . apply ( ) ; }
Stores a double value as a long raw bits value .
124,284
public static void remove ( final String key ) { SharedPreferences prefs = getPreferences ( ) ; final Editor editor = prefs . edit ( ) ; if ( prefs . contains ( key + LENGTH ) ) { int stringSetLength = prefs . getInt ( key + LENGTH , - 1 ) ; if ( stringSetLength >= 0 ) { editor . remove ( key + LENGTH ) ; for ( int i =...
Removes a preference value .
124,285
public static Editor clear ( ) { final Editor editor = getPreferences ( ) . edit ( ) . clear ( ) ; editor . apply ( ) ; return editor ; }
Removed all the stored keys and values .
124,286
protected String fetchMarkdownTagletDescriptionFile ( String resourceName ) { final URL url = this . getClass ( ) . getResource ( resourceName ) ; if ( url != null ) { try { return FileUtils . readFileToString ( new File ( url . toURI ( ) ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } return "" ; }
Fetch the markdown taglet description from a resource within your classpath .
124,287
public void render ( Tag tag , StringBuilder target , MarkdownDoclet doclet ) { Counter counter ; if ( tag . holder ( ) instanceof MemberDoc ) { counter = getCounter ( ( ( MemberDoc ) tag . holder ( ) ) . containingClass ( ) ) ; } else { counter = getCounter ( tag . holder ( ) ) ; } target . append ( "<div class=\"todo...
Render the tag .
124,288
public void appendOption ( String ... option ) { options = Arrays . copyOf ( options , options . length + 1 ) ; options [ options . length - 1 ] = option ; }
Append an option to the doclet options .
124,289
protected void processOverview ( ) { if ( options . getOverviewFile ( ) != null ) { try { rootDoc . setRawCommentText ( Files . toString ( options . getOverviewFile ( ) , options . getEncoding ( ) ) ) ; defaultProcess ( rootDoc , false ) ; } catch ( IOException e ) { printError ( "Error loading overview from " + option...
Process the overview file if specified .
124,290
protected void processClass ( ClassDoc doc ) { defaultProcess ( doc , true ) ; for ( MemberDoc member : doc . fields ( ) ) { processMember ( member ) ; } for ( MemberDoc member : doc . constructors ( ) ) { processMember ( member ) ; } for ( MemberDoc member : doc . methods ( ) ) { processMember ( member ) ; } if ( doc ...
Process the class documentation .
124,291
protected void processPackage ( PackageDoc doc ) { try { Field foundDoc = doc . getClass ( ) . getDeclaredField ( "foundDoc" ) ; foundDoc . setAccessible ( true ) ; foundDoc . set ( doc , false ) ; } catch ( Exception e ) { printWarning ( doc . position ( ) , "Cannot suppress warning about multiple package sources: " +...
Process the package documentation .
124,292
protected void defaultProcess ( Doc doc , boolean fixLeadingSpaces ) { try { StringBuilder buf = new StringBuilder ( ) ; buf . append ( getOptions ( ) . toHtml ( doc . commentText ( ) , fixLeadingSpaces ) ) ; buf . append ( '\n' ) ; for ( Tag tag : doc . tags ( ) ) { processTag ( tag , buf ) ; buf . append ( '\n' ) ; }...
Default processing of any documentation node .
124,293
@ SuppressWarnings ( "unchecked" ) protected void processTag ( Tag tag , StringBuilder target ) { TagRenderer < Tag > renderer = ( TagRenderer < Tag > ) tagRenderers . get ( tag . kind ( ) ) ; if ( renderer == null ) { renderer = TagRenderer . VERBATIM ; } renderer . render ( tag , target , this ) ; }
Process a tag .
124,294
public static void main ( String [ ] args ) throws Exception { args = Arrays . copyOf ( args , args . length + 2 ) ; args [ args . length - 2 ] = "-doclet" ; args [ args . length - 1 ] = MarkdownDoclet . class . getName ( ) ; Main . main ( args ) ; }
Just a main method for debugging .
124,295
public String [ ] [ ] load ( String [ ] [ ] options , DocErrorReporter errorReporter ) { LinkedList < String [ ] > optionsList = new LinkedList < > ( Arrays . asList ( options ) ) ; Iterator < String [ ] > optionsIter = optionsList . iterator ( ) ; while ( optionsIter . hasNext ( ) ) { String [ ] opt = optionsIter . ne...
Loads the options from the command line .
124,296
public JavadocQuirks getJavadocVersion ( ) { if ( javadocVersion == null ) { String javaVersion = System . getProperty ( "java.version" ) ; if ( javaVersion != null && javaVersion . compareTo ( "1.8" ) >= 0 ) { return JavadocQuirks . V8 ; } else { return JavadocQuirks . V7 ; } } return javadocVersion ; }
Gets the Javadoc version .
124,297
public void visit ( VerbatimNode node ) { if ( options . isHighlightEnabled ( ) && ! options . isAutoHighlightEnabled ( ) && node . getType ( ) . isEmpty ( ) ) { VerbatimNode noHighlightNode = new VerbatimNode ( node . getText ( ) , "no-highlight" ) ; noHighlightNode . setStartIndex ( node . getStartIndex ( ) ) ; noHig...
Overrides the default implementation to set the language to no - highlight no language is specified . If highlighting is disabled or auto - highlighting is enabled this method just calls the default implementation .
124,298
private static String createTagletPattern ( String tagNames ) { final StringBuilder regex = new StringBuilder ( ) ; final int size = STR_TAGS_REGEX_LIST . size ( ) ; for ( int regexIdx = 0 ; regexIdx < size ; regexIdx ++ ) { final String tagRegex = STR_TAGS_REGEX_LIST . get ( regexIdx ) ; final String argsRex = STR_ARG...
Creates the taglet pattern from tagNames .
124,299
public static ServiceContext createServiceContext ( ServletRequest request ) { if ( ! ( request instanceof HttpServletRequest ) ) { throw new IllegalArgumentException ( "Expected HttpServletRequest" ) ; } return createServiceContext ( ( HttpServletRequest ) request ) ; }
Convenience method it requires that the request is a HttpServletRequest .