idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
143,500
private static int findNext ( boolean reverse , int pos ) { boolean backwards = IS_BACKWARDS_CHECKBOX . isSelected ( ) ; backwards = backwards ? ! reverse : reverse ; String pattern = ( String ) FIND_FIELD . getSelectedItem ( ) ; if ( pattern != null && pattern . length ( ) > 0 ) { try { Document doc = textComponent . ...
Find and select the next searchable matching text .
143,501
protected static void invalidateSwitchPoints ( ) { if ( LOG_ENABLED ) { LOG . info ( "invalidating switch point" ) ; } SwitchPoint old = switchPoint ; switchPoint = new SwitchPoint ( ) ; synchronized ( IndyInterface . class ) { SwitchPoint . invalidateAll ( new SwitchPoint [ ] { old } ) ; } }
Callback for constant meta class update change
143,502
public static CallSite bootstrapCurrent ( Lookup caller , String name , MethodType type ) { return realBootstrap ( caller , name , CALL_TYPES . METHOD . ordinal ( ) , type , false , true , false ) ; }
bootstrap method for method calls with this as receiver
143,503
private static CallSite realBootstrap ( Lookup caller , String name , int callID , MethodType type , boolean safe , boolean thisCall , boolean spreadCall ) { MutableCallSite mc = new MutableCallSite ( type ) ; MethodHandle mh = makeFallBack ( mc , caller . lookupClass ( ) , name , callID , type , safe , thisCall , spre...
backing bootstrap method with all parameters
143,504
public void addCell ( TableLayoutCell cell ) { GridBagConstraints constraints = cell . getConstraints ( ) ; constraints . insets = new Insets ( cellpadding , cellpadding , cellpadding , cellpadding ) ; add ( cell . getComponent ( ) , constraints ) ; }
Adds a new cell to the current grid
143,505
public void addClass ( ClassNode node ) { node = node . redirect ( ) ; String name = node . getName ( ) ; ClassNode stored = classes . get ( name ) ; if ( stored != null && stored != node ) { SourceUnit nodeSource = node . getModule ( ) . getContext ( ) ; SourceUnit storedSource = stored . getModule ( ) . getContext ( ...
Adds a class to the unit .
143,506
private String getSlashyPath ( final String path ) { String changedPath = path ; if ( File . separatorChar != '/' ) changedPath = changedPath . replace ( File . separatorChar , '/' ) ; return changedPath ; }
This solution is based on an absolute path
143,507
public static void write ( Path self , String text , String charset ) throws IOException { Writer writer = null ; try { writer = new OutputStreamWriter ( Files . newOutputStream ( self , CREATE , APPEND ) , Charset . forName ( charset ) ) ; writer . write ( text ) ; writer . flush ( ) ; Writer temp = writer ; writer = ...
Write the text to the Path using the specified encoding .
143,508
public static void append ( Path self , Object text ) throws IOException { Writer writer = null ; try { writer = new OutputStreamWriter ( Files . newOutputStream ( self , CREATE , APPEND ) , Charset . defaultCharset ( ) ) ; InvokerHelper . write ( writer , text ) ; writer . flush ( ) ; Writer temp = writer ; writer = n...
Append the text at the end of the Path .
143,509
public static int count ( CharSequence self , CharSequence text ) { int answer = 0 ; for ( int idx = 0 ; true ; idx ++ ) { idx = self . toString ( ) . indexOf ( text . toString ( ) , idx ) ; if ( idx < answer ) break ; ++ answer ; } return answer ; }
Count the number of occurrences of a sub CharSequence .
143,510
public static < T extends CharSequence > T eachMatch ( T self , CharSequence regex , @ ClosureParams ( value = FromString . class , options = { "List<String>" , "String[]" } ) Closure closure ) { eachMatch ( self . toString ( ) , regex . toString ( ) , closure ) ; return self ; }
Process each regex group matched substring of the given CharSequence . If the closure parameter takes one argument an array with all match groups is passed to it . If the closure takes as many arguments as there are match groups then each parameter will be one match group .
143,511
public static String eachMatch ( String self , String regex , @ ClosureParams ( value = FromString . class , options = { "List<String>" , "String[]" } ) Closure closure ) { return eachMatch ( self , Pattern . compile ( regex ) , closure ) ; }
Process each regex group matched substring of the given string . If the closure parameter takes one argument an array with all match groups is passed to it . If the closure takes as many arguments as there are match groups then each parameter will be one match group .
143,512
public static String expandLine ( CharSequence self , int tabStop ) { String s = self . toString ( ) ; int index ; while ( ( index = s . indexOf ( '\t' ) ) != - 1 ) { StringBuilder builder = new StringBuilder ( s ) ; int count = tabStop - index % tabStop ; builder . deleteCharAt ( index ) ; for ( int i = 0 ; i < count ...
Expands all tabs into spaces . Assumes the CharSequence represents a single line of text .
143,513
public static String find ( CharSequence self , CharSequence regex , @ ClosureParams ( value = SimpleType . class , options = "java.lang.String[]" ) Closure closure ) { return find ( self . toString ( ) , Pattern . compile ( regex . toString ( ) ) , closure ) ; }
Returns the result of calling a closure with the first occurrence of a regular expression found within a CharSequence . If the regex doesn t match the closure will not be called and find will return null .
143,514
public static String getAt ( CharSequence self , Collection indices ) { StringBuilder answer = new StringBuilder ( ) ; for ( Object value : indices ) { if ( value instanceof Range ) { answer . append ( getAt ( self , ( Range ) value ) ) ; } else if ( value instanceof Collection ) { answer . append ( getAt ( self , ( Co...
Select a List of characters from a CharSequence using a Collection to identify the indices to be selected .
143,515
public static CharSequence getAt ( CharSequence text , int index ) { index = normaliseIndex ( index , text . length ( ) ) ; return text . subSequence ( index , index + 1 ) ; }
Support the subscript operator for CharSequence .
143,516
public static String getAt ( GString text , int index ) { return ( String ) getAt ( text . toString ( ) , index ) ; }
Support the subscript operator for GString .
143,517
public static CharSequence getAt ( CharSequence text , IntRange range ) { return getAt ( text , ( Range ) range ) ; }
Support the range subscript operator for CharSequence with IntRange
143,518
public static CharSequence getAt ( CharSequence text , Range range ) { RangeInfo info = subListBorders ( text . length ( ) , range ) ; CharSequence sequence = text . subSequence ( info . from , info . to ) ; return info . reverse ? reverse ( sequence ) : sequence ; }
Support the range subscript operator for CharSequence
143,519
public static String getAt ( GString text , Range range ) { return getAt ( text . toString ( ) , range ) ; }
Support the range subscript operator for GString
143,520
public static List getAt ( Matcher self , Collection indices ) { List result = new ArrayList ( ) ; for ( Object value : indices ) { if ( value instanceof Range ) { result . addAll ( getAt ( self , ( Range ) value ) ) ; } else { int idx = DefaultTypeTransformation . intUnbox ( value ) ; result . add ( getAt ( self , idx...
Select a List of values from a Matcher using a Collection to identify the indices to be selected .
143,521
public static String getAt ( String text , int index ) { index = normaliseIndex ( index , text . length ( ) ) ; return text . substring ( index , index + 1 ) ; }
Support the subscript operator for String .
143,522
public static String getAt ( String text , IntRange range ) { return getAt ( text , ( Range ) range ) ; }
Support the range subscript operator for String with IntRange
143,523
public static String getAt ( String text , Range range ) { RangeInfo info = subListBorders ( text . length ( ) , range ) ; String answer = text . substring ( info . from , info . to ) ; if ( info . reverse ) { answer = reverse ( answer ) ; } return answer ; }
Support the range subscript operator for String
143,524
public static int getCount ( Matcher matcher ) { int counter = 0 ; matcher . reset ( ) ; while ( matcher . find ( ) ) { counter ++ ; } return counter ; }
Find the number of Strings matched to the given Matcher .
143,525
public static boolean isAllWhitespace ( CharSequence self ) { String s = self . toString ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( ! Character . isWhitespace ( s . charAt ( i ) ) ) return false ; } return true ; }
True if a CharSequence only contains whitespace characters .
143,526
public static boolean isBigDecimal ( CharSequence self ) { try { new BigDecimal ( self . toString ( ) . trim ( ) ) ; return true ; } catch ( NumberFormatException nfe ) { return false ; } }
Determine if a CharSequence can be parsed as a BigDecimal .
143,527
public static boolean isBigInteger ( CharSequence self ) { try { new BigInteger ( self . toString ( ) . trim ( ) ) ; return true ; } catch ( NumberFormatException nfe ) { return false ; } }
Determine if a CharSequence can be parsed as a BigInteger .
143,528
public static boolean isDouble ( CharSequence self ) { try { Double . valueOf ( self . toString ( ) . trim ( ) ) ; return true ; } catch ( NumberFormatException nfe ) { return false ; } }
Determine if a CharSequence can be parsed as a Double .
143,529
public static boolean isFloat ( CharSequence self ) { try { Float . valueOf ( self . toString ( ) . trim ( ) ) ; return true ; } catch ( NumberFormatException nfe ) { return false ; } }
Determine if a CharSequence can be parsed as a Float .
143,530
public static boolean isInteger ( CharSequence self ) { try { Integer . valueOf ( self . toString ( ) . trim ( ) ) ; return true ; } catch ( NumberFormatException nfe ) { return false ; } }
Determine if a CharSequence can be parsed as an Integer .
143,531
public static boolean isLong ( CharSequence self ) { try { Long . valueOf ( self . toString ( ) . trim ( ) ) ; return true ; } catch ( NumberFormatException nfe ) { return false ; } }
Determine if a CharSequence can be parsed as a Long .
143,532
public static StringBuffer leftShift ( String self , Object value ) { return new StringBuffer ( self ) . append ( value ) ; }
Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a String .
143,533
public static StringBuilder leftShift ( StringBuilder self , Object value ) { self . append ( value ) ; return self ; }
Overloads the left shift operator to provide syntactic sugar for appending to a StringBuilder .
143,534
public static String minus ( CharSequence self , Object target ) { String s = self . toString ( ) ; String text = DefaultGroovyMethods . toString ( target ) ; int index = s . indexOf ( text ) ; if ( index == - 1 ) return s ; int end = index + text . length ( ) ; if ( s . length ( ) > end ) { return s . substring ( 0 , ...
Remove a part of a CharSequence by replacing the first occurrence of target within self with and returns the result .
143,535
public static String minus ( CharSequence self , Pattern pattern ) { return pattern . matcher ( self ) . replaceFirst ( "" ) ; }
Remove a part of a CharSequence . This replaces the first occurrence of the pattern within self with and returns the result .
143,536
public static String multiply ( CharSequence self , Number factor ) { String s = self . toString ( ) ; int size = factor . intValue ( ) ; if ( size == 0 ) return "" ; else if ( size < 0 ) { throw new IllegalArgumentException ( "multiply() should be called with a number of 0 or greater not: " + size ) ; } StringBuilder ...
Repeat a CharSequence a certain number of times .
143,537
public static String next ( CharSequence self ) { StringBuilder buffer = new StringBuilder ( self ) ; if ( buffer . length ( ) == 0 ) { buffer . append ( Character . MIN_VALUE ) ; } else { char last = buffer . charAt ( buffer . length ( ) - 1 ) ; if ( last == Character . MAX_VALUE ) { buffer . append ( Character . MIN_...
This method is called by the ++ operator for the class CharSequence . It increments the last character in the given CharSequence . If the last character in the CharSequence is Character . MAX_VALUE a Character . MIN_VALUE will be appended . The empty CharSequence is incremented to a string consisting of the character C...
143,538
public static String normalize ( final CharSequence self ) { final String s = self . toString ( ) ; int nx = s . indexOf ( '\r' ) ; if ( nx < 0 ) { return s ; } final int len = s . length ( ) ; final StringBuilder sb = new StringBuilder ( len ) ; int i = 0 ; do { sb . append ( s , i , nx ) ; sb . append ( '\n' ) ; if (...
Return a String with linefeeds and carriage returns normalized to linefeeds .
143,539
public static String plus ( CharSequence left , Object value ) { return left + DefaultGroovyMethods . toString ( value ) ; }
Appends the String representation of the given operand to this CharSequence .
143,540
public static String plus ( Number value , String right ) { return DefaultGroovyMethods . toString ( value ) + right ; }
Appends a String to the string representation of this number .
143,541
public static List < String > readLines ( CharSequence self ) throws IOException { return IOGroovyMethods . readLines ( new StringReader ( self . toString ( ) ) ) ; }
Return the lines of a CharSequence as a List of String .
143,542
public static String replaceAll ( final CharSequence self , final CharSequence regex , final CharSequence replacement ) { return self . toString ( ) . replaceAll ( regex . toString ( ) , replacement . toString ( ) ) ; }
Replaces each substring of this CharSequence that matches the given regular expression with the given replacement .
143,543
public static String replaceFirst ( final CharSequence self , final CharSequence regex , final CharSequence replacement ) { return self . toString ( ) . replaceFirst ( regex . toString ( ) , replacement . toString ( ) ) ; }
Replaces the first substring of this CharSequence that matches the given regular expression with the given replacement .
143,544
public static void setIndex ( Matcher matcher , int idx ) { int count = getCount ( matcher ) ; if ( idx < - count || idx >= count ) { throw new IndexOutOfBoundsException ( "index is out of range " + ( - count ) + ".." + ( count - 1 ) + " (index = " + idx + ")" ) ; } if ( idx == 0 ) { matcher . reset ( ) ; } else if ( i...
Set the position of the given Matcher to the given index .
143,545
public static < T > T splitEachLine ( CharSequence self , CharSequence regex , @ ClosureParams ( value = FromString . class , options = "List<String>" ) Closure < T > closure ) throws IOException { return splitEachLine ( self , Pattern . compile ( regex . toString ( ) ) , closure ) ; }
Iterates through the given CharSequence line by line splitting each line using the given regex delimiter . The list of tokens for each line is then passed to the given closure .
143,546
public static < T > T splitEachLine ( CharSequence self , Pattern pattern , @ ClosureParams ( value = FromString . class , options = "List<String>" ) Closure < T > closure ) throws IOException { final List < String > list = readLines ( self ) ; T result = null ; for ( String line : list ) { List vals = Arrays . asList ...
Iterates through the given CharSequence line by line splitting each line using the given separator Pattern . The list of tokens for each line is then passed to the given closure .
143,547
public static String takeWhile ( GString self , @ ClosureParams ( value = SimpleType . class , options = "char" ) Closure condition ) { return ( String ) takeWhile ( self . toString ( ) , condition ) ; }
A GString variant of the equivalent GString method .
143,548
public static List < String > toList ( CharSequence self ) { String s = self . toString ( ) ; int size = s . length ( ) ; List < String > answer = new ArrayList < String > ( size ) ; for ( int i = 0 ; i < size ; i ++ ) { answer . add ( s . substring ( i , i + 1 ) ) ; } return answer ; }
Converts the given CharSequence into a List of Strings of one character .
143,549
public static String unexpand ( CharSequence self , int tabStop ) { String s = self . toString ( ) ; if ( s . length ( ) == 0 ) return s ; try { StringBuilder builder = new StringBuilder ( ) ; for ( String line : readLines ( ( CharSequence ) s ) ) { builder . append ( unexpandLine ( line , tabStop ) ) ; builder . appen...
Replaces sequences of whitespaces with tabs .
143,550
public static String unexpandLine ( CharSequence self , int tabStop ) { StringBuilder builder = new StringBuilder ( self . toString ( ) ) ; int index = 0 ; while ( index + tabStop < builder . length ( ) ) { String piece = builder . substring ( index , index + tabStop ) ; int count = 0 ; while ( ( count < tabStop ) && (...
Replaces sequences of whitespaces with tabs within a line .
143,551
public boolean hasPossibleMethod ( String name , Expression arguments ) { int count = 0 ; if ( arguments instanceof TupleExpression ) { TupleExpression tuple = ( TupleExpression ) arguments ; count = tuple . getExpressions ( ) . size ( ) ; } ClassNode node = this ; do { for ( MethodNode method : getMethods ( name ) ) {...
Returns true if the given method has a possibly matching instance method with the given name and arguments .
143,552
private void checkOrMarkPrivateAccess ( Expression source , FieldNode fn ) { if ( fn != null && Modifier . isPrivate ( fn . getModifiers ( ) ) && ( fn . getDeclaringClass ( ) != typeCheckingContext . getEnclosingClassNode ( ) || typeCheckingContext . getEnclosingClosure ( ) != null ) && fn . getDeclaringClass ( ) . get...
Given a field node checks if we are calling a private field from an inner class .
143,553
private void checkOrMarkPrivateAccess ( Expression source , MethodNode mn ) { if ( mn == null ) { return ; } ClassNode declaringClass = mn . getDeclaringClass ( ) ; ClassNode enclosingClassNode = typeCheckingContext . getEnclosingClassNode ( ) ; if ( declaringClass != enclosingClassNode || typeCheckingContext . getEncl...
Given a method node checks if we are calling a private method from an inner class .
143,554
private boolean ensureValidSetter ( final Expression expression , final Expression leftExpression , final Expression rightExpression , final SetterInfo setterInfo ) { VariableExpression ve = new VariableExpression ( "%" , setterInfo . receiverType ) ; MethodCallExpression call = new MethodCallExpression ( ve , setterIn...
Given a binary expression corresponding to an assignment will check that the type of the RHS matches one of the possible setters and if not throw a type checking error .
143,555
private void addArrayMethods ( List < MethodNode > methods , ClassNode receiver , String name , ClassNode [ ] args ) { if ( args . length != 1 ) return ; if ( ! receiver . isArray ( ) ) return ; if ( ! isIntCategory ( getUnwrapper ( args [ 0 ] ) ) ) return ; if ( "getAt" . equals ( name ) ) { MethodNode node = new Meth...
add various getAt and setAt methods for primitive arrays
143,556
private ClassNode getGenericsResolvedTypeOfFieldOrProperty ( AnnotatedNode an , ClassNode type ) { if ( ! type . isUsingGenerics ( ) ) return type ; Map < String , GenericsType > connections = new HashMap ( ) ; extractGenericsConnections ( connections , typeCheckingContext . getEnclosingClassNode ( ) , an . getDeclarin...
resolves a Field or Property node generics by using the current class and the declaring class to extract the right meaning of the generics symbols
143,557
public static byte [ ] decodeBase64 ( String value ) { int byteShift = 4 ; int tmp = 0 ; boolean done = false ; final StringBuilder buffer = new StringBuilder ( ) ; for ( int i = 0 ; i != value . length ( ) ; i ++ ) { final char c = value . charAt ( i ) ; final int sixBit = ( c < 123 ) ? EncodingGroovyMethodsSupport . ...
Decode the String from Base64 into a byte array .
143,558
protected void runStatements ( Reader reader , PrintStream out ) throws IOException { log . debug ( "runStatements()" ) ; StringBuilder txt = new StringBuilder ( ) ; String line = "" ; BufferedReader in = new BufferedReader ( reader ) ; while ( ( line = in . readLine ( ) ) != null ) { line = getProject ( ) . replacePro...
Read in lines and execute them .
143,559
public static String toJson ( Date date ) { if ( date == null ) { return NULL_VALUE ; } CharBuf buffer = CharBuf . create ( 26 ) ; writeDate ( date , buffer ) ; return buffer . toString ( ) ; }
Format a date that is parseable from JavaScript according to ISO - 8601 .
143,560
public static String toJson ( Calendar cal ) { if ( cal == null ) { return NULL_VALUE ; } CharBuf buffer = CharBuf . create ( 26 ) ; writeDate ( cal . getTime ( ) , buffer ) ; return buffer . toString ( ) ; }
Format a calendar instance that is parseable from JavaScript according to ISO - 8601 .
143,561
private static void writeNumber ( Class < ? > numberClass , Number value , CharBuf buffer ) { if ( numberClass == Integer . class ) { buffer . addInt ( ( Integer ) value ) ; } else if ( numberClass == Long . class ) { buffer . addLong ( ( Long ) value ) ; } else if ( numberClass == BigInteger . class ) { buffer . addBi...
Serializes Number value and writes it into specified buffer .
143,562
private static void writeCharSequence ( CharSequence seq , CharBuf buffer ) { if ( seq . length ( ) > 0 ) { buffer . addJsonEscapedString ( seq . toString ( ) ) ; } else { buffer . addChars ( EMPTY_STRING_CHARS ) ; } }
Serializes any char sequence and writes it into specified buffer .
143,563
public static Enum castToEnum ( Object object , Class < ? extends Enum > type ) { if ( object == null ) return null ; if ( type . isInstance ( object ) ) return ( Enum ) object ; if ( object instanceof String || object instanceof GString ) { return Enum . valueOf ( type , object . toString ( ) ) ; } throw new GroovyCas...
this class requires that the supplied enum is not fitting a Collection case for casting
143,564
public void setTargetBytecode ( String version ) { if ( CompilerConfiguration . PRE_JDK5 . equals ( version ) || CompilerConfiguration . POST_JDK5 . equals ( version ) ) { this . targetBytecode = version ; } }
Sets the bytecode compatibility mode
143,565
public List depthFirst ( ) { List answer = new NodeList ( ) ; answer . add ( this ) ; answer . addAll ( depthFirstRest ( ) ) ; return answer ; }
Provides a collection of all the nodes in the tree using a depth first traversal .
143,566
public static String getGetterName ( String propertyName , Class type ) { String prefix = type == boolean . class || type == Boolean . class ? "is" : "get" ; return prefix + MetaClassHelper . capitalize ( propertyName ) ; }
Gets the name for the getter for this property
143,567
public static ProxyMetaClass getInstance ( Class theClass ) throws IntrospectionException { MetaClassRegistry metaRegistry = GroovySystem . getMetaClassRegistry ( ) ; MetaClass meta = metaRegistry . getMetaClass ( theClass ) ; return new ProxyMetaClass ( metaRegistry , theClass , meta ) ; }
convenience factory method for the most usual case .
143,568
private Expression correctClassClassChain ( PropertyExpression pe ) { LinkedList < Expression > stack = new LinkedList < Expression > ( ) ; ClassExpression found = null ; for ( Expression it = pe ; it != null ; it = ( ( PropertyExpression ) it ) . getObjectExpression ( ) ) { if ( it instanceof ClassExpression ) { found...
and class as property
143,569
public static void closeWithWarning ( Closeable c ) { if ( c != null ) { try { c . close ( ) ; } catch ( IOException e ) { LOG . warning ( "Caught exception during close(): " + e ) ; } } }
Close the Closeable . Logging a warning if any problems occur .
143,570
public V get ( K key ) { ManagedReference < V > ref = internalMap . get ( key ) ; if ( ref != null ) return ref . get ( ) ; return null ; }
Returns the value stored for the given key at the point of call .
143,571
public void put ( final K key , V value ) { ManagedReference < V > ref = new ManagedReference < V > ( bundle , value ) { public void finalizeReference ( ) { super . finalizeReference ( ) ; internalMap . remove ( key , get ( ) ) ; } } ; internalMap . put ( key , ref ) ; }
Sets a new value for a given key . an older value is overwritten .
143,572
public String getSample ( int line , int column , Janitor janitor ) { String sample = null ; String text = source . getLine ( line , janitor ) ; if ( text != null ) { if ( column > 0 ) { String marker = Utilities . repeatString ( " " , column - 1 ) + "^" ; if ( column > 40 ) { int start = column - 30 - 1 ; int end = ( ...
Returns a sampling of the source at the specified line and column of null if it is unavailable .
143,573
public static void withInstance ( String url , Closure c ) throws SQLException { Sql sql = null ; try { sql = newInstance ( url ) ; c . call ( sql ) ; } finally { if ( sql != null ) sql . close ( ) ; } }
Invokes a closure passing it a new Sql instance created from the given JDBC connection URL . The created connection will be closed if required .
143,574
public synchronized void withTransaction ( Closure closure ) throws SQLException { boolean savedCacheConnection = cacheConnection ; cacheConnection = true ; Connection connection = null ; boolean savedAutoCommit = true ; try { connection = createConnection ( ) ; savedAutoCommit = connection . getAutoCommit ( ) ; connec...
Performs the closure within a transaction using a cached connection . If the closure takes a single argument it will be called with the connection otherwise it will be called with no arguments .
143,575
public static Object invoke ( Object object , String methodName , Object [ ] parameters ) { try { Class [ ] classTypes = new Class [ parameters . length ] ; for ( int i = 0 ; i < classTypes . length ; i ++ ) { classTypes [ i ] = parameters [ i ] . getClass ( ) ; } Method method = object . getClass ( ) . getMethod ( met...
Invoke a method through reflection . Falls through to using the Invoker to call the method in case the reflection call fails ..
143,576
public static String [ ] tokenizeUnquoted ( String s ) { List tokens = new LinkedList ( ) ; int first = 0 ; while ( first < s . length ( ) ) { first = skipWhitespace ( s , first ) ; int last = scanToken ( s , first ) ; if ( first < last ) { tokens . add ( s . substring ( first , last ) ) ; } first = last ; } return ( S...
This method tokenizes a string by space characters but ignores spaces in quoted parts that are parts in or . The method does allows the usage of in and in . The space character between tokens is not returned .
143,577
@ SuppressWarnings ( "unchecked" ) private void addPrivateFieldsAccessors ( ClassNode node ) { Set < ASTNode > accessedFields = ( Set < ASTNode > ) node . getNodeMetaData ( StaticTypesMarker . PV_FIELDS_ACCESS ) ; if ( accessedFields == null ) return ; Map < String , MethodNode > privateConstantAccessors = ( Map < Stri...
Adds special accessors for private constants so that inner classes can retrieve them .
143,578
public static boolean isPostJDK5 ( String bytecodeVersion ) { return JDK5 . equals ( bytecodeVersion ) || JDK6 . equals ( bytecodeVersion ) || JDK7 . equals ( bytecodeVersion ) || JDK8 . equals ( bytecodeVersion ) ; }
Checks if the specified bytecode version string represents a JDK 1 . 5 + compatible bytecode version .
143,579
public void setTargetDirectory ( String directory ) { if ( directory != null && directory . length ( ) > 0 ) { this . targetDirectory = new File ( directory ) ; } else { this . targetDirectory = null ; } }
Sets the target directory .
143,580
protected synchronized Class loadClass ( final String name , boolean resolve ) throws ClassNotFoundException { Class c = this . findLoadedClass ( name ) ; if ( c != null ) return c ; c = ( Class ) customClasses . get ( name ) ; if ( c != null ) return c ; try { c = oldFindClass ( name ) ; } catch ( ClassNotFoundExcepti...
loads a class using the name of the class
143,581
public NodeList getAt ( String name ) { NodeList answer = new NodeList ( ) ; for ( Object child : this ) { if ( child instanceof Node ) { Node childNode = ( Node ) child ; Object temp = childNode . get ( name ) ; if ( temp instanceof Collection ) { answer . addAll ( ( Collection ) temp ) ; } else { answer . add ( temp ...
Provides lookup of elements by non - namespaced name .
143,582
public String text ( ) { String previousText = null ; StringBuilder buffer = null ; for ( Object child : this ) { String text = null ; if ( child instanceof String ) { text = ( String ) child ; } else if ( child instanceof Node ) { text = ( ( Node ) child ) . text ( ) ; } if ( text != null ) { if ( previousText == null...
Returns the text value of all of the elements in the collection .
143,583
private boolean isAllNumeric ( TokenStream stream ) { List < Token > tokens = ( ( NattyTokenSource ) stream . getTokenSource ( ) ) . getTokens ( ) ; for ( Token token : tokens ) { try { Integer . parseInt ( token . getText ( ) ) ; } catch ( NumberFormatException e ) { return false ; } } return true ; }
Determines if a token stream contains only numeric tokens
143,584
private List < TokenStream > collectTokenStreams ( TokenStream stream ) { List < Token > currentGroup = null ; List < List < Token > > groups = new ArrayList < List < Token > > ( ) ; Token currentToken ; int currentTokenType ; StringBuilder tokenString = new StringBuilder ( ) ; while ( ( currentToken = stream . getToke...
Scans the given token global token stream for a list of sub - token streams representing those portions of the global stream that may contain date time information
143,585
private void addGroup ( List < Token > group , List < List < Token > > groups ) { if ( group . isEmpty ( ) ) return ; while ( ! group . isEmpty ( ) && IGNORED_TRAILING_TOKENS . contains ( group . get ( group . size ( ) - 1 ) . getType ( ) ) ) { group . remove ( group . size ( ) - 1 ) ; } if ( ! group . isEmpty ( ) ) { ...
Cleans up the given group and adds it to the list of groups if still valid
143,586
public void seekToDayOfWeek ( String direction , String seekType , String seekAmount , String dayOfWeek ) { int dayOfWeekInt = Integer . parseInt ( dayOfWeek ) ; int seekAmountInt = Integer . parseInt ( seekAmount ) ; assert ( direction . equals ( DIR_LEFT ) || direction . equals ( DIR_RIGHT ) ) ; assert ( seekType . e...
seeks to a specified day of the week in the past or future .
143,587
public void seekToDayOfMonth ( String dayOfMonth ) { int dayOfMonthInt = Integer . parseInt ( dayOfMonth ) ; assert ( dayOfMonthInt >= 1 && dayOfMonthInt <= 31 ) ; markDateInvocation ( ) ; dayOfMonthInt = Math . min ( dayOfMonthInt , _calendar . getActualMaximum ( Calendar . DAY_OF_MONTH ) ) ; _calendar . set ( Calenda...
Seeks to the given day within the current month
143,588
public void seekToDayOfYear ( String dayOfYear ) { int dayOfYearInt = Integer . parseInt ( dayOfYear ) ; assert ( dayOfYearInt >= 1 && dayOfYearInt <= 366 ) ; markDateInvocation ( ) ; dayOfYearInt = Math . min ( dayOfYearInt , _calendar . getActualMaximum ( Calendar . DAY_OF_YEAR ) ) ; _calendar . set ( Calendar . DAY_...
Seeks to the given day within the current year
143,589
public void seekToMonth ( String direction , String seekAmount , String month ) { int seekAmountInt = Integer . parseInt ( seekAmount ) ; int monthInt = Integer . parseInt ( month ) ; assert ( direction . equals ( DIR_LEFT ) || direction . equals ( DIR_RIGHT ) ) ; assert ( monthInt >= 1 && monthInt <= 12 ) ; markDateIn...
seeks to a particular month
143,590
public void setExplicitTime ( String hours , String minutes , String seconds , String amPm , String zoneString ) { int hoursInt = Integer . parseInt ( hours ) ; int minutesInt = minutes != null ? Integer . parseInt ( minutes ) : 0 ; assert ( amPm == null || amPm . equals ( AM ) || amPm . equals ( PM ) ) ; assert ( hour...
Sets the the time of day
143,591
public void seekToHoliday ( String holidayString , String direction , String seekAmount ) { Holiday holiday = Holiday . valueOf ( holidayString ) ; assert ( holiday != null ) ; seekToIcsEvent ( HOLIDAY_ICS_FILE , holiday . getSummary ( ) , direction , seekAmount ) ; }
Seeks forward or backwards to a particular holiday based on the current date
143,592
public void seekToHolidayYear ( String holidayString , String yearString ) { Holiday holiday = Holiday . valueOf ( holidayString ) ; assert ( holiday != null ) ; seekToIcsEventYear ( HOLIDAY_ICS_FILE , yearString , holiday . getSummary ( ) ) ; }
Seeks to the given holiday within the given year
143,593
public void seekToSeason ( String seasonString , String direction , String seekAmount ) { Season season = Season . valueOf ( seasonString ) ; assert ( season != null ) ; seekToIcsEvent ( SEASON_ICS_FILE , season . getSummary ( ) , direction , seekAmount ) ; }
Seeks forward or backwards to a particular season based on the current date
143,594
public void seekToSeasonYear ( String seasonString , String yearString ) { Season season = Season . valueOf ( seasonString ) ; assert ( season != null ) ; seekToIcsEventYear ( SEASON_ICS_FILE , yearString , season . getSummary ( ) ) ; }
Seeks to the given season within the given year
143,595
private void resetCalendar ( ) { _calendar = getCalendar ( ) ; if ( _defaultTimeZone != null ) { _calendar . setTimeZone ( _defaultTimeZone ) ; } _currentYear = _calendar . get ( Calendar . YEAR ) ; }
Resets the calendar
143,596
private Date seasonalDateFromIcs ( String icsFileName , String eventSummary , int year ) { Map < Integer , Date > dates = getDatesFromIcs ( icsFileName , eventSummary , year , year ) ; return dates . get ( year - ( eventSummary . equals ( Holiday . NEW_YEARS_EVE . getSummary ( ) ) ? 1 : 0 ) ) ; }
Finds and returns the date for the given event summary and year within the given ics file or null if not present .
143,597
private void markDateInvocation ( ) { _updatePreviousDates = ! _dateGivenInGroup ; _dateGivenInGroup = true ; _dateGroup . setDateInferred ( false ) ; if ( _firstDateInvocationInGroup ) { if ( _timeGivenInGroup ) { int hours = _calendar . get ( Calendar . HOUR_OF_DAY ) ; int minutes = _calendar . get ( Calendar . MINUT...
ensures that the first invocation of a date seeking rule is captured
143,598
private Calendar cleanHistCalendar ( Calendar cal ) { cal . set ( Calendar . MILLISECOND , 0 ) ; cal . set ( Calendar . SECOND , 0 ) ; cal . set ( Calendar . MINUTE , 0 ) ; cal . set ( Calendar . HOUR , 0 ) ; return cal ; }
Put everything smaller than days at 0
143,599
public static Calendar parseDividendDate ( String date ) { if ( ! Utils . isParseable ( date ) ) { return null ; } date = date . trim ( ) ; SimpleDateFormat format = new SimpleDateFormat ( Utils . getDividendDateFormat ( date ) , Locale . US ) ; format . setTimeZone ( TimeZone . getTimeZone ( YahooFinance . TIMEZONE ) ...
Used to parse the dividend dates . Returns null if the date cannot be parsed .