signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class DiscordApiBuilderDelegateImpl { /** * Compile pre - registered listeners into proper collections for DiscordApi creation . */
@ SuppressWarnings ( "unchecked" ) private void prepareListeners ( ) { } } | if ( preparedListeners != null && preparedUnspecifiedListeners != null ) { // Already created , skip
return ; } preparedListeners = new ConcurrentHashMap < > ( ) ; Stream < Class < ? extends GloballyAttachableListener > > eventTypes = Stream . concat ( listeners . keySet ( ) . stream ( ) , Stream . concat ( listenerSuppliers . keySet ( ) . stream ( ) , listenerFunctions . keySet ( ) . stream ( ) ) ) . distinct ( ) ; eventTypes . forEach ( type -> { ArrayList < Function < DiscordApi , GloballyAttachableListener > > typeListenerFunctions = new ArrayList < > ( ) ; listeners . getOrDefault ( type , Collections . emptyList ( ) ) . forEach ( listener -> typeListenerFunctions . add ( api -> listener ) ) ; listenerSuppliers . getOrDefault ( type , Collections . emptyList ( ) ) . forEach ( supplier -> typeListenerFunctions . add ( api -> supplier . get ( ) ) ) ; listenerFunctions . getOrDefault ( type , Collections . emptyList ( ) ) . forEach ( function -> typeListenerFunctions . add ( ( Function < DiscordApi , GloballyAttachableListener > ) function ) ) ; preparedListeners . put ( type , typeListenerFunctions ) ; } ) ; // Unspecified Listeners
preparedUnspecifiedListeners = new CopyOnWriteArrayList < > ( unspecifiedListenerFunctions ) ; unspecifiedListenerSuppliers . forEach ( supplier -> preparedUnspecifiedListeners . add ( ( api ) -> supplier . get ( ) ) ) ; unspecifiedListeners . forEach ( listener -> preparedUnspecifiedListeners . add ( ( api ) -> listener ) ) ; |
public class BinaryString { /** * < p > Splits the provided text into an array , separator string specified . < / p >
* < p > The separator is not included in the returned String array .
* Adjacent separators are treated as separators for empty tokens . < / p >
* < p > A { @ code null } separator splits on whitespace . < / p >
* < pre >
* " " . splitByWholeSeparatorPreserveAllTokens ( * ) = [ ]
* " ab de fg " . splitByWholeSeparatorPreserveAllTokens ( null ) = [ " ab " , " de " , " fg " ]
* " ab de fg " . splitByWholeSeparatorPreserveAllTokens ( null ) = [ " ab " , " " , " " , " de " , " fg " ]
* " ab : cd : ef " . splitByWholeSeparatorPreserveAllTokens ( " : " ) = [ " ab " , " cd " , " ef " ]
* " ab - ! - cd - ! - ef " . splitByWholeSeparatorPreserveAllTokens ( " - ! - " ) = [ " ab " , " cd " , " ef " ]
* < / pre >
* < p > Note : return BinaryStrings is reuse MemorySegments from this . < / p >
* @ param separator String containing the String to be used as a delimiter ,
* { @ code null } splits on whitespace
* @ return an array of parsed Strings , { @ code null } if null String was input
* @ since 2.4 */
public BinaryString [ ] splitByWholeSeparatorPreserveAllTokens ( BinaryString separator ) { } } | ensureMaterialized ( ) ; final int len = sizeInBytes ; if ( len == 0 ) { return EMPTY_STRING_ARRAY ; } if ( separator == null || EMPTY_UTF8 . equals ( separator ) ) { // Split on whitespace .
return splitByWholeSeparatorPreserveAllTokens ( fromString ( " " ) ) ; } separator . ensureMaterialized ( ) ; final int separatorLength = separator . sizeInBytes ; final ArrayList < BinaryString > substrings = new ArrayList < > ( ) ; int beg = 0 ; int end = 0 ; while ( end < len ) { end = SegmentsUtil . find ( segments , offset + beg , sizeInBytes - beg , separator . segments , separator . offset , separator . sizeInBytes ) - offset ; if ( end > - 1 ) { if ( end > beg ) { // The following is OK , because String . substring ( beg , end ) excludes
// the character at the position ' end ' .
substrings . add ( BinaryString . fromAddress ( segments , offset + beg , end - beg ) ) ; // Set the starting point for the next search .
// The following is equivalent to beg = end + ( separatorLength - 1 ) + 1,
// which is the right calculation :
beg = end + separatorLength ; } else { // We found a consecutive occurrence of the separator .
substrings . add ( EMPTY_UTF8 ) ; beg = end + separatorLength ; } } else { // String . substring ( beg ) goes from ' beg ' to the end of the String .
substrings . add ( BinaryString . fromAddress ( segments , offset + beg , sizeInBytes - beg ) ) ; end = len ; } } return substrings . toArray ( new BinaryString [ 0 ] ) ; |
public class XMLMessageTransport { /** * From this external message , figure out the message type .
* @ externalMessage The external message just received .
* @ return The message type for this kind of message ( transport specific ) . */
public String getMessageCode ( BaseMessage externalMessage ) { } } | if ( ! ( externalMessage . getExternalMessage ( ) instanceof XmlTrxMessageIn ) ) return null ; if ( ! ( externalMessage . getExternalMessage ( ) . getRawData ( ) instanceof String ) ) return null ; String strXML = ( String ) externalMessage . getExternalMessage ( ) . getRawData ( ) ; int beginIndex = 0 ; while ( beginIndex != - 1 ) { beginIndex = strXML . indexOf ( '<' , beginIndex ) ; if ( beginIndex == - 1 ) return null ; // No type found .
beginIndex ++ ; if ( strXML . charAt ( beginIndex ) == '?' ) continue ; // XML Directive
int iEnd = strXML . indexOf ( ' ' , beginIndex ) ; int iClose = strXML . indexOf ( '>' , beginIndex ) ; if ( ( iEnd != - 1 ) && ( iClose != - 1 ) ) iEnd = Math . min ( iEnd , iClose ) ; else if ( iEnd == - 1 ) iEnd = iClose ; if ( iEnd != - 1 ) { String code = strXML . substring ( beginIndex , iEnd ) ; if ( code . indexOf ( ':' ) != - 1 ) code = code . substring ( code . indexOf ( ':' ) + 1 ) ; // Remove namespace prefix
return code ; } break ; // Not found
} return null ; // No type found . |
public class OrderAwarePluginRegistry { /** * Creates a new { @ link OrderAwarePluginRegistry } with the given { @ link Plugin } s and the order of the { @ link Plugin } s
* reverted .
* @ param plugins must not be { @ literal null } .
* @ return
* @ deprecated since 2.0 , for removal in 2.1 . Prefer { @ link OrderAwarePluginRegistry # ofReverse ( List ) } */
@ Deprecated public static < S , T extends Plugin < S > > OrderAwarePluginRegistry < T , S > createReverse ( List < ? extends T > plugins ) { } } | return of ( plugins , DEFAULT_REVERSE_COMPARATOR ) ; |
public class ORBManager { /** * Shutdown the ORB */
public static void shutdown ( ) { } } | if ( orbStart != null ) { orbStart . shutdown ( ) ; } if ( orb != null ) { orb . shutdown ( true ) ; LOGGER . debug ( "ORB shutdown" ) ; } |
public class FileCLA { /** * { @ inheritDoc } */
@ Override protected void exportCommandLineData ( final StringBuilder out , final int occ ) { } } | uncompileQuoter ( out , getValue ( occ ) . getAbsolutePath ( ) ) ; |
public class SpotsDialog { private void initMessage ( ) { } } | if ( message != null && message . length ( ) > 0 ) { ( ( TextView ) findViewById ( R . id . dmax_spots_title ) ) . setText ( message ) ; } |
public class CommerceShipmentLocalServiceUtil { /** * Deletes the commerce shipment from the database . Also notifies the appropriate model listeners .
* @ param commerceShipment the commerce shipment
* @ return the commerce shipment that was removed */
public static com . liferay . commerce . model . CommerceShipment deleteCommerceShipment ( com . liferay . commerce . model . CommerceShipment commerceShipment ) { } } | return getService ( ) . deleteCommerceShipment ( commerceShipment ) ; |
public class URLUtil { /** * 通过一个字符串形式的URL地址创建URL对象
* @ param url URL
* @ param handler { @ link URLStreamHandler }
* @ return URL对象
* @ since 4.1.1 */
public static URL url ( String url , URLStreamHandler handler ) { } } | Assert . notNull ( url , "URL must not be null" ) ; // 兼容Spring的ClassPath路径
if ( url . startsWith ( CLASSPATH_URL_PREFIX ) ) { url = url . substring ( CLASSPATH_URL_PREFIX . length ( ) ) ; return ClassLoaderUtil . getClassLoader ( ) . getResource ( url ) ; } try { return new URL ( null , url , handler ) ; } catch ( MalformedURLException e ) { // 尝试文件路径
try { return new File ( url ) . toURI ( ) . toURL ( ) ; } catch ( MalformedURLException ex2 ) { throw new UtilException ( e ) ; } } |
public class UtilMath { /** * Wrap value ( keep value between min and max ) . Useful to keep an angle between 0 and 360 for example .
* @ param value The input value .
* @ param min The minimum value ( included ) .
* @ param max The maximum value ( excluded ) .
* @ return The wrapped value . */
public static double wrapDouble ( double value , double min , double max ) { } } | double newValue = value ; final double step = max - min ; if ( Double . compare ( newValue , max ) >= 0 ) { while ( Double . compare ( newValue , max ) >= 0 ) { newValue -= step ; } } else if ( newValue < min ) { while ( newValue < min ) { newValue += step ; } } return newValue ; |
public class SingleColumnValueFilterAdapter { /** * { @ inheritDoc } */
@ Override public FilterSupportStatus isFilterSupported ( FilterAdapterContext context , SingleColumnValueFilter filter ) { } } | return delegateAdapter . isFilterSupported ( context , new ValueFilter ( filter . getOperator ( ) , filter . getComparator ( ) ) ) ; |
public class DownloadTask { /** * Get the breakpoint info of this task .
* @ return { @ code null } Only if there isn ' t any info for this task yet , otherwise you can get
* the info for the task . */
@ Nullable public BreakpointInfo getInfo ( ) { } } | if ( info == null ) info = OkDownload . with ( ) . breakpointStore ( ) . get ( id ) ; return info ; |
public class RSTImpl { /** * Checks , if there exists an SRelation which targets a SToken . */
private boolean isSegment ( SNode currNode ) { } } | List < SRelation < SNode , SNode > > edges = currNode . getGraph ( ) . getOutRelations ( currNode . getId ( ) ) ; if ( edges != null && edges . size ( ) > 0 ) { for ( SRelation < SNode , SNode > edge : edges ) { if ( edge . getTarget ( ) instanceof SToken ) { return true ; } } } return false ; |
public class RxUtil { /** * Returns a { @ link Func1 } that returns an empty { @ link Observable } .
* @ return */
public static < T > Func1 < T , Observable < Object > > toEmpty ( ) { } } | return Functions . constant ( Observable . < Object > empty ( ) ) ; |
public class CsvWriter { /** * Add formatted CSV cells to a builder
* @ param builder the string builder
* @ param cells the cells to format as CSV cells in a row */
public static void addCells ( StringBuilder builder , String ... cells ) { } } | if ( builder == null || cells == null || cells . length == 0 ) return ; for ( String cell : cells ) { addCell ( builder , cell ) ; } |
public class ESigItem { /** * Adds an issue to the signature item .
* @ param severity Severity of the issue .
* @ param description Description of the issue .
* @ return The added issue . */
public ESigItemIssue addIssue ( ESigItemIssueSeverity severity , String description ) { } } | ESigItemIssue issue = new ESigItemIssue ( severity , description ) ; if ( issues == null ) { issues = new ArrayList < ESigItemIssue > ( ) ; sortIssues = false ; } else { int i = issues . indexOf ( issue ) ; if ( i >= 0 ) { return issues . get ( i ) ; } sortIssues = true ; } issues . add ( issue ) ; return issue ; |
public class RuleBasedBreakIterator { /** * Get the status ( tag ) values from the break rule ( s ) that determined the most
* recently returned break position . The values appear in the rule source
* within brackets , { 123 } , for example . The default status value for rules
* that do not explicitly provide one is zero .
* The status values used by the standard ICU break rules are defined
* as public constants in class RuleBasedBreakIterator .
* If the size of the output array is insufficient to hold the data ,
* the output will be truncated to the available length . No exception
* will be thrown .
* @ param fillInArray an array to be filled in with the status values .
* @ return The number of rule status values from rules that determined
* the most recent boundary returned by the break iterator .
* In the event that the array is too small , the return value
* is the total number of status values that were available ,
* not the reduced number that were actually returned .
* @ hide draft / provisional / internal are hidden on Android */
@ Override public int getRuleStatusVec ( int [ ] fillInArray ) { } } | makeRuleStatusValid ( ) ; int numStatusVals = fRData . fStatusTable [ fLastRuleStatusIndex ] ; if ( fillInArray != null ) { int numToCopy = Math . min ( numStatusVals , fillInArray . length ) ; for ( int i = 0 ; i < numToCopy ; i ++ ) { fillInArray [ i ] = fRData . fStatusTable [ fLastRuleStatusIndex + i + 1 ] ; } } return numStatusVals ; |
public class ApiOvhIp { /** * Generate a migration token
* REST : POST / ip / { ip } / migrationToken
* @ param customerId [ required ] destination customer ID
* @ param ip [ required ] */
public OvhIpMigrationToken ip_migrationToken_POST ( String ip , String customerId ) throws IOException { } } | String qPath = "/ip/{ip}/migrationToken" ; StringBuilder sb = path ( qPath , ip ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "customerId" , customerId ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhIpMigrationToken . class ) ; |
public class StreamTask { /** * Execute { @ link StreamOperator # close ( ) } of each operator in the chain of this
* { @ link StreamTask } . Closing happens from < b > head to tail < / b > operator in the chain ,
* contrary to { @ link StreamOperator # open ( ) } which happens < b > tail to head < / b >
* ( see { @ link # openAllOperators ( ) } . */
private void closeAllOperators ( ) throws Exception { } } | // We need to close them first to last , since upstream operators in the chain might emit
// elements in their close methods .
StreamOperator < ? > [ ] allOperators = operatorChain . getAllOperators ( ) ; for ( int i = allOperators . length - 1 ; i >= 0 ; i -- ) { StreamOperator < ? > operator = allOperators [ i ] ; if ( operator != null ) { operator . close ( ) ; } } |
public class NodeSlicerCommand { /** * Do it . */
public void sliceNode ( final List < Node > nodes , final WaveBase wave ) { } } | final Node node = nodes . get ( 0 ) ; final long start = System . currentTimeMillis ( ) ; if ( node != null ) { if ( node instanceof ImageView ) { this . imageProperty . set ( ( ( ImageView ) node ) . getImage ( ) ) ; } else { final WritableImage wi = node . snapshot ( new SnapshotParameters ( ) , null ) ; this . imageProperty . set ( wi ) ; } } final double width = getImage ( ) . getWidth ( ) ; final double height = getImage ( ) . getHeight ( ) ; // StackPane sp = StackPaneBuilder . create ( ) . build ( ) ;
// final List < Animation > fades = new ArrayList < > ( ) ;
for ( double x = 0 ; x < width ; x += getTileWidth ( ) ) { for ( double y = 0 ; y < height ; y += getTileHeight ( ) ) { // TODO OPTIMIZE
final ImageView iv = ImageViewBuilder . create ( ) . image ( getImage ( ) ) . clip ( RectangleBuilder . create ( ) . x ( x ) . y ( y ) . width ( getTileWidth ( ) ) . height ( getTileHeight ( ) ) . build ( ) ) . opacity ( 1.0 ) . scaleX ( 0.9 ) // TODO
. layoutX ( x ) . layoutY ( y ) . build ( ) ; this . slices . add ( iv ) ; } } final long sliced = System . currentTimeMillis ( ) - start ; System . out . println ( "Sliced in " + sliced + " ms" ) ; LOGGER . debug ( "Sliced in {} ms" , sliced ) ; |
public class Temporals { /** * Converts an amount from one unit to another .
* This works on the units in { @ code ChronoUnit } and { @ code IsoFields } .
* The { @ code DAYS } and { @ code WEEKS } units are handled as exact multiple of 24 hours .
* The { @ code ERAS } and { @ code FOREVER } units are not supported .
* @ param amount the input amount in terms of the { @ code fromUnit }
* @ param fromUnit the unit to convert from , not null
* @ param toUnit the unit to convert to , not null
* @ return the conversion array ,
* element 0 is the signed whole number ,
* element 1 is the signed remainder in terms of the input unit ,
* not null
* @ throws DateTimeException if the units cannot be converted
* @ throws UnsupportedTemporalTypeException if the units are not supported
* @ throws ArithmeticException if numeric overflow occurs */
public static long [ ] convertAmount ( long amount , TemporalUnit fromUnit , TemporalUnit toUnit ) { } } | Objects . requireNonNull ( fromUnit , "fromUnit" ) ; Objects . requireNonNull ( toUnit , "toUnit" ) ; validateUnit ( fromUnit ) ; validateUnit ( toUnit ) ; if ( fromUnit . equals ( toUnit ) ) { return new long [ ] { amount , 0 } ; } // precise - based
if ( isPrecise ( fromUnit ) && isPrecise ( toUnit ) ) { long fromNanos = fromUnit . getDuration ( ) . toNanos ( ) ; long toNanos = toUnit . getDuration ( ) . toNanos ( ) ; if ( fromNanos > toNanos ) { long multiple = fromNanos / toNanos ; return new long [ ] { Math . multiplyExact ( amount , multiple ) , 0 } ; } else { long multiple = toNanos / fromNanos ; return new long [ ] { amount / multiple , amount % multiple } ; } } // month - based
int fromMonthFactor = monthMonthFactor ( fromUnit , fromUnit , toUnit ) ; int toMonthFactor = monthMonthFactor ( toUnit , fromUnit , toUnit ) ; if ( fromMonthFactor > toMonthFactor ) { long multiple = fromMonthFactor / toMonthFactor ; return new long [ ] { Math . multiplyExact ( amount , multiple ) , 0 } ; } else { long multiple = toMonthFactor / fromMonthFactor ; return new long [ ] { amount / multiple , amount % multiple } ; } |
public class ServiceCall { /** * Issues fire - and - forget request .
* @ param request request message to send .
* @ return mono publisher completing normally or with error . */
public Mono < Void > oneWay ( ServiceMessage request ) { } } | return Mono . defer ( ( ) -> requestOne ( request , Void . class ) . then ( ) ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcDimensionalExponents ( ) { } } | if ( ifcDimensionalExponentsEClass == null ) { ifcDimensionalExponentsEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 153 ) ; } return ifcDimensionalExponentsEClass ; |
public class Contract { /** * Checks that an array is of a given length
* @ param array the array
* @ param length the desired length of the array
* @ param arrayName the name of the array
* @ throws IllegalArgumentException if the array is null or if the array ' s length is not as expected */
public static void atLength ( final Object [ ] array , final int length , final String arrayName ) { } } | notNull ( array , arrayName ) ; notNegative ( length , "length" ) ; if ( array . length != length ) { throw new IllegalArgumentException ( "expecting " + maskNullArgument ( arrayName ) + " to be of length " + length + "." ) ; } |
public class HttpMediaType { /** * Sets the ( main ) media type , for example { @ code " text " } .
* @ param type main / major media type */
public HttpMediaType setType ( String type ) { } } | Preconditions . checkArgument ( TYPE_REGEX . matcher ( type ) . matches ( ) , "Type contains reserved characters" ) ; this . type = type ; cachedBuildResult = null ; return this ; |
public class JmxCallbackExample { /** * Entry point to the JMX Callback Example .
* @ param args unused
* @ throws Exception whatever may happen in this crazy world */
@ SuppressWarnings ( "InfiniteLoopStatement" ) public static void main ( String [ ] args ) throws Exception { } } | SimonManager . callback ( ) . addCallback ( new JmxRegisterCallback ( "org.javasimon.examples.jmx.JmxCallbackExample" ) ) ; Counter counter = SimonManager . getCounter ( "org.javasimon.examples.jmx.counter" ) ; Stopwatch stopwatch = SimonManager . getStopwatch ( "org.javasimon.examples.jmx.stopwatch" ) ; // these created just to have more stuff in jconsole
SimonManager . getCounter ( "org.javasimon.different.counter" ) ; SimonManager . getStopwatch ( "org.javasimon.some.other.jmx.stopwatch1" ) ; SimonManager . getStopwatch ( "org.javasimon.some.other.jmx.stopwatch2" ) ; System . out . println ( "Now open jconsole and check it out...\nWatch org.javasimon.examples.jmx.stopwatch for changes." ) ; while ( true ) { counter . increase ( ) ; try ( Split ignored = stopwatch . start ( ) ) { ExampleUtils . waitRandomlySquared ( 40 ) ; } } |
public class ImageModerationsImpl { /** * Fuzzily match an image against one of your custom Image Lists . You can create and manage your custom image lists using & lt ; a href = " / docs / services / 578ff44d2703741568569ab9 / operations / 578ff7b12703741568569abe " & gt ; this & lt ; / a & gt ; API .
* Returns ID and tags of matching image . & lt ; br / & gt ;
* & lt ; br / & gt ;
* Note : Refresh Index must be run on the corresponding Image List before additions and removals are reflected in the response .
* @ param matchMethodOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the MatchResponse object */
public Observable < ServiceResponse < MatchResponse > > matchMethodWithServiceResponseAsync ( MatchMethodOptionalParameter matchMethodOptionalParameter ) { } } | if ( this . client . baseUrl ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.baseUrl() is required and cannot be null." ) ; } final String listId = matchMethodOptionalParameter != null ? matchMethodOptionalParameter . listId ( ) : null ; final Boolean cacheImage = matchMethodOptionalParameter != null ? matchMethodOptionalParameter . cacheImage ( ) : null ; return matchMethodWithServiceResponseAsync ( listId , cacheImage ) ; |
public class NearCachedClientCacheProxy { /** * Publishes value got from remote or deletes reserved record when remote value is { @ code null } .
* @ param key key to update in Near Cache
* @ param remoteValue fetched value from server
* @ param reservationId reservation ID for this key
* @ param deserialize deserialize returned value
* @ return last known value for the key */
private Object tryPublishReserved ( Object key , Object remoteValue , long reservationId , boolean deserialize ) { } } | assert remoteValue != NOT_CACHED ; // caching null value is not supported for ICache Near Cache
if ( remoteValue == null ) { // needed to delete reserved record
invalidateNearCache ( key ) ; return null ; } Object cachedValue = null ; if ( reservationId != NOT_RESERVED ) { cachedValue = nearCache . tryPublishReserved ( key , remoteValue , reservationId , deserialize ) ; } return cachedValue == null ? remoteValue : cachedValue ; |
public class SeaGlassIcon { /** * Returns the icon ' s height . This is a cover method for < code >
* getIconHeight ( null ) < / code > .
* @ param context the SynthContext describing the component / region , the
* style , and the state .
* @ return an int specifying the fixed height of the icon . */
@ Override public int getIconHeight ( SynthContext context ) { } } | if ( context == null ) { return height ; } JComponent c = context . getComponent ( ) ; if ( c instanceof JToolBar ) { JToolBar toolbar = ( JToolBar ) c ; if ( toolbar . getOrientation ( ) == JToolBar . HORIZONTAL ) { // we only do the - 1 hack for UIResource borders , assuming
// that the border is probably going to be our border
if ( toolbar . getBorder ( ) instanceof UIResource ) { return c . getHeight ( ) - 1 ; } else { return c . getHeight ( ) ; } } else { return scale ( context , width ) ; } } else { return scale ( context , height ) ; } |
public class Matrix { /** * Runs a { @ link ParametrizedFunction } for each element of the matrix , using these arguments :
* < ol >
* < li > X Coordinate in the matrix < / li >
* < li > Y Coordinate in the matrix < / li >
* < li > { @ code args } , at the end < / li >
* < / ol >
* @ param function The ParametrizedFunction to run for each element
* @ param args The arguments to add at the end of the function ' s params
* @ param < R > The return value for the function . Must be the same as the return value of { @ code function }
* @ return A list containing all the return values */
public < R > Matrix < R > runForEach ( ParametrizedFunction < MatrixElement < E > , R > function , Object ... args ) { } } | Matrix < R > ret ; try { ret = new Matrix < > ( this . columns . size ( ) , this . columns . get ( 0 ) . size ( ) ) ; } catch ( Exception ignored ) { ret = new Matrix < > ( ) ; } for ( int x = 0 ; x < this . columns . size ( ) ; x ++ ) { ArrayList < E > col = this . columns . get ( x ) ; for ( int y = 0 ; y < col . size ( ) ; y ++ ) { if ( col . get ( y ) == null ) continue ; R obj = function . apply ( this . getElement ( x , y ) , args ) ; ret . set ( obj , x , y ) ; } } return ret ; |
public class WebPage { /** * Compare WebPage first by priority ( in descending order - higher priority is first ) , then by shortName ( in ascending order ) .
* Priority and / or shortName can be null . WebPages with null priority are at the end .
* @ param o Other WebPage
* @ return - 1 , 0 , 1 */
public int compareTo ( WebPage o ) { } } | int result ; // first compare by priority
result = PRIORITY_COMPARATOR . compare ( this . getPriority ( ) , o . getPriority ( ) ) ; // next compare by shortName
if ( result == 0 ) { result = SHORT_NAME_COMPARATOR . compare ( this . getShortName ( ) , o . getShortName ( ) ) ; } return result ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIOBYoaOrentToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class BluetoothLeScannerImplJB { /** * This method goes through registered callbacks and sets the power rest and scan intervals
* to next lowest value . */
private void setPowerSaveSettings ( ) { } } | long minRest = Long . MAX_VALUE , minScan = Long . MAX_VALUE ; synchronized ( wrappers ) { for ( final ScanCallbackWrapper wrapper : wrappers . values ( ) ) { final ScanSettings settings = wrapper . scanSettings ; if ( settings . hasPowerSaveMode ( ) ) { if ( minRest > settings . getPowerSaveRest ( ) ) { minRest = settings . getPowerSaveRest ( ) ; } if ( minScan > settings . getPowerSaveScan ( ) ) { minScan = settings . getPowerSaveScan ( ) ; } } } } if ( minRest < Long . MAX_VALUE && minScan < Long . MAX_VALUE ) { powerSaveRestInterval = minRest ; powerSaveScanInterval = minScan ; if ( powerSaveHandler != null ) { powerSaveHandler . removeCallbacks ( powerSaveScanTask ) ; powerSaveHandler . removeCallbacks ( powerSaveSleepTask ) ; powerSaveHandler . postDelayed ( powerSaveSleepTask , powerSaveScanInterval ) ; } } else { powerSaveRestInterval = powerSaveScanInterval = 0 ; if ( powerSaveHandler != null ) { powerSaveHandler . removeCallbacks ( powerSaveScanTask ) ; powerSaveHandler . removeCallbacks ( powerSaveSleepTask ) ; } } |
public class DuplicationTaskProcessor { /** * Retrieve the content listing for a space
* @ param store the storage provider in which the space exists
* @ param spaceId space from which to retrieve listing
* @ return */
private Iterator < String > getSpaceListing ( final StorageProvider store , final String spaceId ) throws TaskExecutionFailedException { } } | try { return new Retrier ( ) . execute ( new Retriable ( ) { @ Override public Iterator < String > retry ( ) throws Exception { // The actual method being executed
return store . getSpaceContents ( spaceId , null ) ; } } ) ; } catch ( Exception e ) { String msg = "Error attempting to retrieve space listing: " + e . getMessage ( ) ; throw new DuplicationTaskExecutionFailedException ( buildFailureMessage ( msg ) , e ) ; } |
public class ThreadDumpper { /** * 打印全部的stack , 重新实现threadInfo的toString ( ) 函数 , 因为默认最多只打印8层的stack . 同时 , 不再打印lockedMonitors和lockedSynchronizers . */
private String dumpThreadInfo ( Thread thread , StackTraceElement [ ] stackTrace , StringBuilder sb ) { } } | sb . append ( '\"' ) . append ( thread . getName ( ) ) . append ( "\" Id=" ) . append ( thread . getId ( ) ) . append ( ' ' ) . append ( thread . getState ( ) ) ; sb . append ( '\n' ) ; int i = 0 ; for ( ; i < Math . min ( maxStackLevel , stackTrace . length ) ; i ++ ) { StackTraceElement ste = stackTrace [ i ] ; sb . append ( "\tat " ) . append ( ste ) . append ( '\n' ) ; } if ( i < stackTrace . length ) { sb . append ( "\t..." ) . append ( '\n' ) ; } sb . append ( '\n' ) ; return sb . toString ( ) ; |
public class HtmlPageUtil { /** * Creates a { @ link HtmlPage } from a given { @ link URL } that points to the HTML code for that page .
* @ param url { @ link URL } that points to the HTML code
* @ return { @ link HtmlPage } for this { @ link URL } */
public static HtmlPage toHtmlPage ( URL url ) { } } | try { return ( HtmlPage ) new WebClient ( ) . getPage ( url ) ; } catch ( IOException e ) { throw new RuntimeException ( "Error creating HtmlPage from URL." , e ) ; } |
public class YggdrasilAuthenticator { /** * Creates a < code > YggdrasilAuthenticator < / code > with a customized
* { @ link AuthenticationService } and initializes it with a token .
* @ param clientToken the client token
* @ param accessToken the access token
* @ param service the customized { @ link AuthenticationService }
* @ return a YggdrasilAuthenticator
* @ throws AuthenticationException If an exception occurs during the
* authentication */
public static YggdrasilAuthenticator token ( String clientToken , String accessToken , AuthenticationService service ) throws AuthenticationException { } } | Objects . requireNonNull ( clientToken ) ; Objects . requireNonNull ( accessToken ) ; Objects . requireNonNull ( service ) ; YggdrasilAuthenticator auth = new YggdrasilAuthenticator ( service ) ; auth . refreshWithToken ( clientToken , accessToken ) ; return auth ; |
public class DeleteSmsChannelRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteSmsChannelRequest deleteSmsChannelRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteSmsChannelRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteSmsChannelRequest . getApplicationId ( ) , APPLICATIONID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Stripe { /** * Blocking method to create a { @ link Token } for a { @ link BankAccount } . Do not call this on
* the UI thread or your app will crash .
* This method uses the default publishable key for this { @ link Stripe } instance .
* @ param bankAccount the { @ link Card } to use for this token
* @ return a { @ link Token } that can be used for this { @ link BankAccount }
* @ throws AuthenticationException failure to properly authenticate yourself ( check your key )
* @ throws InvalidRequestException your request has invalid parameters
* @ throws APIConnectionException failure to connect to Stripe ' s API
* @ throws CardException should not be thrown with this type of token , but is theoretically
* possible given the underlying methods called
* @ throws APIException any other type of problem ( for instance , a temporary issue with
* Stripe ' s servers */
public Token createBankAccountTokenSynchronous ( final BankAccount bankAccount ) throws AuthenticationException , InvalidRequestException , APIConnectionException , CardException , APIException { } } | return createBankAccountTokenSynchronous ( bankAccount , mDefaultPublishableKey ) ; |
public class CommerceRegionUtil { /** * Returns the first commerce region in the ordered set where commerceCountryId = & # 63 ; .
* @ param commerceCountryId the commerce country ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce region , or < code > null < / code > if a matching commerce region could not be found */
public static CommerceRegion fetchByCommerceCountryId_First ( long commerceCountryId , OrderByComparator < CommerceRegion > orderByComparator ) { } } | return getPersistence ( ) . fetchByCommerceCountryId_First ( commerceCountryId , orderByComparator ) ; |
public class DomainResource { /** * syntactic sugar */
public DomainResource addExtension ( Extension t ) { } } | if ( t == null ) return this ; if ( this . extension == null ) this . extension = new ArrayList < Extension > ( ) ; this . extension . add ( t ) ; return this ; |
public class ContextsClient { /** * Creates a context .
* < p > If the specified context already exists , overrides the context .
* < p > Sample code :
* < pre > < code >
* try ( ContextsClient contextsClient = ContextsClient . create ( ) ) {
* SessionName parent = SessionName . of ( " [ PROJECT ] " , " [ SESSION ] " ) ;
* Context context = Context . newBuilder ( ) . build ( ) ;
* Context response = contextsClient . createContext ( parent . toString ( ) , context ) ;
* < / code > < / pre >
* @ param parent Required . The session to create a context for . Format : ` projects / & lt ; Project
* ID & gt ; / agent / sessions / & lt ; Session ID & gt ; ` or ` projects / & lt ; Project
* ID & gt ; / agent / environments / & lt ; Environment ID & gt ; / users / & lt ; User ID & gt ; / sessions / & lt ; Session
* ID & gt ; ` . If ` Environment ID ` is not specified , we assume default ' draft ' environment . If
* ` User ID ` is not specified , we assume default ' - ' user .
* @ param context Required . The context to create .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final Context createContext ( String parent , Context context ) { } } | CreateContextRequest request = CreateContextRequest . newBuilder ( ) . setParent ( parent ) . setContext ( context ) . build ( ) ; return createContext ( request ) ; |
public class AbstractIdConfig { /** * Gets id .
* @ return the id */
public String getId ( ) { } } | if ( id == null ) { synchronized ( this ) { if ( id == null ) { id = "rpc-cfg-" + ID_GENERATOR . getAndIncrement ( ) ; } } } return id ; |
public class MetaClassImpl { /** * Retrieves the value of an attribute ( field ) . This method is to support the Groovy runtime and not for general client API usage .
* @ param sender The class of the object that requested the attribute
* @ param object The instance the attribute is to be retrieved from
* @ param attribute The name of the attribute
* @ param useSuper Whether to look - up on the super class or not
* @ param fromInsideClass Whether the call was invoked from the inside or the outside of the class .
* @ return The attribute value */
public Object getAttribute ( Class sender , Object object , String attribute , boolean useSuper , boolean fromInsideClass ) { } } | checkInitalised ( ) ; boolean isStatic = theClass != Class . class && object instanceof Class ; if ( isStatic && object != theClass ) { MetaClass mc = registry . getMetaClass ( ( Class ) object ) ; return mc . getAttribute ( sender , object , attribute , useSuper ) ; } MetaProperty mp = getMetaProperty ( sender , attribute , useSuper , isStatic ) ; if ( mp != null ) { if ( mp instanceof MetaBeanProperty ) { MetaBeanProperty mbp = ( MetaBeanProperty ) mp ; mp = mbp . getField ( ) ; } try { // delegate the get operation to the metaproperty
if ( mp != null ) return mp . getProperty ( object ) ; } catch ( Exception e ) { throw new GroovyRuntimeException ( "Cannot read field: " + attribute , e ) ; } } throw new MissingFieldException ( attribute , theClass ) ; |
public class SimpleAntlrFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EObject create ( EClass eClass ) { } } | switch ( eClass . getClassifierID ( ) ) { case SimpleAntlrPackage . ANTLR_GRAMMAR : return createAntlrGrammar ( ) ; case SimpleAntlrPackage . OPTIONS : return createOptions ( ) ; case SimpleAntlrPackage . OPTION_VALUE : return createOptionValue ( ) ; case SimpleAntlrPackage . RULE : return createRule ( ) ; case SimpleAntlrPackage . PARAMETER : return createParameter ( ) ; case SimpleAntlrPackage . RULE_ELEMENT : return createRuleElement ( ) ; case SimpleAntlrPackage . EXPRESSION : return createExpression ( ) ; case SimpleAntlrPackage . REFERENCE_OR_LITERAL : return createReferenceOrLiteral ( ) ; case SimpleAntlrPackage . PREDICATED : return createPredicated ( ) ; case SimpleAntlrPackage . RULE_OPTIONS : return createRuleOptions ( ) ; case SimpleAntlrPackage . RULE_CALL : return createRuleCall ( ) ; case SimpleAntlrPackage . KEYWORD : return createKeyword ( ) ; case SimpleAntlrPackage . WILDCARD : return createWildcard ( ) ; case SimpleAntlrPackage . ALTERNATIVES : return createAlternatives ( ) ; case SimpleAntlrPackage . GROUP : return createGroup ( ) ; case SimpleAntlrPackage . ELEMENT_WITH_CARDINALITY : return createElementWithCardinality ( ) ; case SimpleAntlrPackage . NEGATED_ELEMENT : return createNegatedElement ( ) ; case SimpleAntlrPackage . UNTIL_ELEMENT : return createUntilElement ( ) ; case SimpleAntlrPackage . OR_EXPRESSION : return createOrExpression ( ) ; case SimpleAntlrPackage . AND_EXPRESSION : return createAndExpression ( ) ; case SimpleAntlrPackage . NOT_EXPRESSION : return createNotExpression ( ) ; case SimpleAntlrPackage . SKIP : return createSkip ( ) ; default : throw new IllegalArgumentException ( "The class '" + eClass . getName ( ) + "' is not a valid classifier" ) ; } |
public class ToArrayList { /** * Returns a method that can be used with { @ link solid . stream . Stream # collect ( Func1 ) }
* to convert a stream into a { @ link List } .
* Use this method instead of { @ link # toArrayList ( ) } for better performance on
* streams that can have more than 12 items .
* @ param < T > a type of { @ link List } items .
* @ param initialCapacity initial capacity of the list .
* @ return a method that converts an iterable into { @ link List } . */
public static < T > Func1 < Iterable < T > , ArrayList < T > > toArrayList ( final int initialCapacity ) { } } | return new Func1 < Iterable < T > , ArrayList < T > > ( ) { @ Override public ArrayList < T > call ( Iterable < T > iterable ) { ArrayList < T > list = new ArrayList < > ( initialCapacity ) ; for ( T value : iterable ) list . add ( value ) ; return list ; } } ; |
public class MeteorAuthCommands { /** * Logs in using username / password
* @ param username username / email
* @ param password password */
public void login ( String username , String password ) { } } | Object [ ] methodArgs = new Object [ 1 ] ; if ( username != null && username . indexOf ( '@' ) > 1 ) { EmailAuth emailpass = new EmailAuth ( username , password ) ; methodArgs [ 0 ] = emailpass ; } else { UsernameAuth userpass = new UsernameAuth ( username , password ) ; methodArgs [ 0 ] = userpass ; } getDDP ( ) . call ( "login" , methodArgs , new DDPListener ( ) { @ Override public void onResult ( Map < String , Object > jsonFields ) { handleLoginResult ( jsonFields ) ; } } ) ; |
public class RegisteredResources { /** * Distribute forget flow to given resource .
* Used internally when resource indicates a heuristic condition .
* May result in retries if resource cannot be contacted .
* @ param resource - the resource to issue forget to
* @ param index - the index of this resource in the arrays
* @ return boolean to indicate whether retries are necessary */
protected boolean forgetResource ( JTAResource resource ) { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "forgetResource" , resource ) ; boolean result = false ; // indicates whether retry necessary
boolean auditing = false ; try { boolean informResource = true ; auditing = _transaction . auditSendForget ( resource ) ; if ( xaFlowCallbackEnabled ) { informResource = XAFlowCallbackControl . beforeXAFlow ( XAFlowCallback . FORGET , XAFlowCallback . FORGET_NORMAL ) ; } if ( informResource ) { resource . forget ( ) ; } // Set the state of the Resource to completed after a successful forget .
resource . setResourceStatus ( StatefulResource . COMPLETED ) ; if ( auditing ) _transaction . auditForgetResponse ( XAResource . XA_OK , resource ) ; if ( xaFlowCallbackEnabled ) { XAFlowCallbackControl . afterXAFlow ( XAFlowCallback . FORGET , XAFlowCallback . AFTER_SUCCESS ) ; } } catch ( XAException xae ) { _errorCode = xae . errorCode ; // Save locally for FFDC
FFDCFilter . processException ( xae , "com.ibm.tx.jta.impl.RegisteredResources.forgetResource" , "2859" , this ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "XAException: error code " + XAReturnCodeHelper . convertXACode ( _errorCode ) , xae ) ; if ( auditing ) _transaction . auditForgetResponse ( _errorCode , resource ) ; if ( xaFlowCallbackEnabled ) { XAFlowCallbackControl . afterXAFlow ( XAFlowCallback . FORGET , XAFlowCallback . AFTER_FAIL ) ; } if ( _errorCode == XAException . XAER_RMERR ) { // An internal error has occured within
// the resource manager and it was unable
// to forget the transaction .
// Retry the forget flow .
result = true ; addToFailedResources ( resource ) ; } else if ( _errorCode == XAException . XAER_RMFAIL ) { // The resource manager is unavailable .
// Set the resource ' s state to failed so that
// we will attempt to reconnect to the resource
// manager upon retrying .
resource . setState ( JTAResource . FAILED ) ; // Retry the forget flow .
result = true ; addToFailedResources ( resource ) ; } else if ( _errorCode == XAException . XAER_NOTA ) { // The resource manager had no knowledge
// of this transaction . Perform some cleanup
// and return normally .
resource . setResourceStatus ( StatefulResource . COMPLETED ) ; resource . destroy ( ) ; } else // XAER _ INVAL , XAER _ PROTO
{ if ( ! auditing ) Tr . error ( tc , "WTRN0054_XA_FORGET_ERROR" , new Object [ ] { XAReturnCodeHelper . convertXACode ( _errorCode ) , xae } ) ; resource . setResourceStatus ( StatefulResource . COMPLETED ) ; // An internal logic error has occured .
_systemException = xae ; } } catch ( Throwable t ) { // treat like RMERR
FFDCFilter . processException ( t , "com.ibm.tx.jta.impl.RegisteredResources.forgetResource" , "2935" , this ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "RuntimeException" , t ) ; if ( xaFlowCallbackEnabled ) { XAFlowCallbackControl . afterXAFlow ( XAFlowCallback . FORGET , XAFlowCallback . AFTER_FAIL ) ; } // An internal error has occured within
// the resource manager and it was unable
// to forget the transaction .
// Retry the forget flow .
result = true ; addToFailedResources ( resource ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "forgetResource" , result ) ; return result ; |
public class Call { /** * Performs a delete http call and writes the call and response information
* to the output file
* @ param endpoint - the endpoint of the service under test
* @ param params - the parameters to be passed to the endpoint for the service
* call
* @ param file - an input file to be provided with the call
* @ return Response : the response provided from the http call */
public Response delete ( String endpoint , Request params , File file ) { } } | return call ( Method . DELETE , endpoint , params , file ) ; |
public class PumpStreamHandler { /** * Override this to customize how the background task is created .
* @ param task the task to be run in the background
* @ return the runnable of the wrapped task */
protected Runnable wrapTask ( Runnable task ) { } } | // Preserve the MDC context of the caller thread .
Map contextMap = MDC . getCopyOfContextMap ( ) ; if ( contextMap != null ) { return new MDCRunnableAdapter ( task , contextMap ) ; } return task ; |
public class JsonArraySerializer { /** * Method that can be called to ask implementation to serialize
* values of type this serializer handles .
* @ param value Value to serialize ; can < b > not < / b > be null .
* @ param gen Generator used to output resulting Json content
* @ param serializers Provider that can be used to get serializers for */
@ Override public void serialize ( JsonArray value , JsonGenerator gen , SerializerProvider serializers ) throws IOException , JsonProcessingException { } } | gen . writeObject ( value . getList ( ) ) ; |
public class SftpSubsystemChannel { /** * Recurse through a hierarchy of directories creating them as necessary .
* @ param path
* @ throws SftpStatusException
* , SshException */
public void recurseMakeDirectory ( String path ) throws SftpStatusException , SshException { } } | SftpFile file ; if ( path . trim ( ) . length ( ) > 0 ) { try { file = openDirectory ( path ) ; file . close ( ) ; } catch ( SshException ioe ) { int idx = 0 ; do { idx = path . indexOf ( '/' , idx ) ; String tmp = ( idx > - 1 ? path . substring ( 0 , idx + 1 ) : path ) ; try { file = openDirectory ( tmp ) ; file . close ( ) ; } catch ( SshException ioe7 ) { makeDirectory ( tmp ) ; } } while ( idx > - 1 ) ; } } |
public class AbstractHPELConfigService { /** * { @ inheritDoc } */
@ SuppressWarnings ( "unchecked" ) @ Override public void updated ( Dictionary < String , ? > properties ) throws ConfigurationException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) Tr . event ( tc , "HPEL properties updated for pid " + pid + ", properties=" + properties ) ; if ( properties == null ) return ; Map < String , Object > newMap = null ; if ( properties instanceof Map < ? , ? > ) { newMap = ( Map < String , Object > ) properties ; } else { newMap = new HashMap < String , Object > ( ) ; Enumeration < String > keys = properties . keys ( ) ; while ( keys . hasMoreElements ( ) ) { String key = keys . nextElement ( ) ; newMap . put ( key , properties . get ( key ) ) ; } } forwardUpdated ( newMap ) ; |
public class ResourceReaderImpl { /** * / * ( non - Javadoc )
* @ see net . crowmagnumb . util . ResourceReader # getStringList ( java . lang . String , java . util . List ) */
@ Override public List < String > getStringList ( final String key , final List < String > defaultValue ) { } } | return getStringList ( key , DEFAULT_LIST_DELIMITER , defaultValue ) ; |
public class HamtPMap { /** * Returns an empty map . */
@ SuppressWarnings ( "unchecked" ) // Empty immutable collection is safe to cast .
public static < K , V > HamtPMap < K , V > empty ( ) { } } | return ( HamtPMap < K , V > ) EMPTY ; |
public class WaitPageInterceptor { /** * Create a wait context to execute event in background .
* @ param executionContext execution context
* @ param annotation wait page annotation
* @ return redirect redirect user so that wait page appears
* @ throws IOException could not create background request */
private Resolution createContextAndRedirect ( ExecutionContext executionContext , WaitPage annotation ) throws IOException { } } | // Create context used to call the event in background .
Context context = this . createContext ( executionContext ) ; context . actionBean = executionContext . getActionBean ( ) ; context . eventHandler = executionContext . getHandler ( ) ; context . annotation = annotation ; context . resolution = new ForwardResolution ( annotation . path ( ) ) ; context . bindingFlashScope = FlashScope . getCurrent ( context . actionBean . getContext ( ) . getRequest ( ) , false ) ; int id = context . hashCode ( ) ; // Id of context .
String ids = Integer . toHexString ( id ) ; // Create background request to execute event .
HttpServletRequest request = executionContext . getActionBeanContext ( ) . getRequest ( ) ; UrlBuilder urlBuilder = new UrlBuilder ( executionContext . getActionBeanContext ( ) . getLocale ( ) , THREAD_URL , false ) ; // Add parameters from the original request in case there were some parameters that weren ' t bound but are used
@ SuppressWarnings ( { "cast" , "unchecked" } ) Set < Map . Entry < String , String [ ] > > paramSet = ( Set < Map . Entry < String , String [ ] > > ) request . getParameterMap ( ) . entrySet ( ) ; for ( Map . Entry < String , String [ ] > param : paramSet ) for ( String value : param . getValue ( ) ) urlBuilder . addParameter ( param . getKey ( ) , value ) ; urlBuilder . addParameter ( ID_PARAMETER , ids ) ; if ( context . bindingFlashScope != null ) { urlBuilder . addParameter ( StripesConstants . URL_KEY_FLASH_SCOPE_ID , String . valueOf ( context . bindingFlashScope . key ( ) ) ) ; } urlBuilder . addParameter ( StripesConstants . URL_KEY_SOURCE_PAGE , CryptoUtil . encrypt ( executionContext . getActionBeanContext ( ) . getSourcePage ( ) ) ) ; context . url = new URL ( request . getScheme ( ) , request . getServerName ( ) , request . getServerPort ( ) , request . getContextPath ( ) + urlBuilder . toString ( ) ) ; context . cookies = request . getHeader ( "Cookie" ) ; // Save context .
contexts . put ( id , context ) ; // Execute background request .
context . thread = new Thread ( context ) ; context . thread . start ( ) ; // Redirect user to wait page .
return new RedirectResolution ( StripesFilter . getConfiguration ( ) . getActionResolver ( ) . getUrlBinding ( context . actionBean . getClass ( ) ) ) { @ Override public RedirectResolution addParameter ( String key , Object ... value ) { // Leave flash scope to background request .
if ( ! StripesConstants . URL_KEY_FLASH_SCOPE_ID . equals ( key ) ) { return super . addParameter ( key , value ) ; } return this ; } } . addParameter ( ID_PARAMETER , ids ) ; |
public class AzureAffinityGroupSupport { /** * Modifies details of the specified affinity group
* @ param affinityGroupId the ID of the affinity group to be modified
* @ param options the options containing the modified data
* @ return the newly modified Dasein AffinityGroup object
* @ throws org . dasein . cloud . InternalException an error occurred within the Dasein Cloud implementation modifying the affinity group
* @ throws org . dasein . cloud . CloudException an error occurred within the service provider modifying the affinity group */
@ Override public AffinityGroup modify ( @ Nonnull String affinityGroupId , @ Nonnull AffinityGroupCreateOptions options ) throws InternalException , CloudException { } } | if ( affinityGroupId == null || affinityGroupId . isEmpty ( ) ) throw new InternalException ( "Cannot modify an affinity group: affinityGroupId cannot be null or empty" ) ; if ( options == null || options . getDescription ( ) == null ) throw new InternalException ( "Cannot create AffinityGroup. Create options or affinity group description cannot be null." ) ; UpdateAffinityGroupModel updateAffinityGroupModel = new UpdateAffinityGroupModel ( ) ; updateAffinityGroupModel . setDescription ( options . getDescription ( ) ) ; AzureMethod method = new AzureMethod ( this . provider ) ; try { method . put ( String . format ( RESOURCE_AFFINITYGROUP , affinityGroupId ) , updateAffinityGroupModel ) ; } catch ( JAXBException e ) { logger . error ( e . getMessage ( ) ) ; throw new InternalException ( e ) ; } return get ( affinityGroupId ) ; |
public class VisualizeStereoDisparity { /** * Active and deactivates different GUI configurations */
private void changeGuiActive ( final boolean error , final boolean reverse ) { } } | SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { control . setActiveGui ( error , reverse ) ; } } ) ; |
public class VerifyMappingsTask { /** * Returns the Class object of the class specified in the OJB . properties
* file for the " PersistentFieldClass " property .
* @ return Class The Class object of the " PersistentFieldClass " class
* specified in the OJB . properties file . */
public Class getPersistentFieldClass ( ) { } } | if ( m_persistenceClass == null ) { Properties properties = new Properties ( ) ; try { this . logWarning ( "Loading properties file: " + getPropertiesFile ( ) ) ; properties . load ( new FileInputStream ( getPropertiesFile ( ) ) ) ; } catch ( IOException e ) { this . logWarning ( "Could not load properties file '" + getPropertiesFile ( ) + "'. Using PersistentFieldDefaultImpl." ) ; e . printStackTrace ( ) ; } try { String className = properties . getProperty ( "PersistentFieldClass" ) ; m_persistenceClass = loadClass ( className ) ; } catch ( ClassNotFoundException e ) { e . printStackTrace ( ) ; m_persistenceClass = PersistentFieldPrivilegedImpl . class ; } logWarning ( "PersistentFieldClass: " + m_persistenceClass . toString ( ) ) ; } return m_persistenceClass ; |
public class XPathParser { /** * Retrieve the previous token from the command and
* store it in m _ token string . */
private final void prevToken ( ) { } } | if ( m_queueMark > 0 ) { m_queueMark -- ; m_token = ( String ) m_ops . m_tokenQueue . elementAt ( m_queueMark ) ; m_tokenChar = m_token . charAt ( 0 ) ; } else { m_token = null ; m_tokenChar = 0 ; } |
public class BinConverter { /** * converts a binhex string back into a byte array ( invalid codes will be skipped )
* @ param sBinHex binhex string
* @ param data the target array
* @ param nSrcPos from which character in the string the conversion should begin , remember that
* ( nSrcPos modulo 2 ) should equals 0 normally
* @ param nDstPos to store the bytes from which position in the array
* @ param nNumOfBytes number of bytes to extract
* @ return number of extracted bytes */
public static int binHexToBytes ( String sBinHex , byte [ ] data , int nSrcPos , int nDstPos , int nNumOfBytes ) { } } | // check for correct ranges
int nStrLen = sBinHex . length ( ) ; int nAvailBytes = ( nStrLen - nSrcPos ) >> 1 ; if ( nAvailBytes < nNumOfBytes ) nNumOfBytes = nAvailBytes ; int nOutputCapacity = data . length - nDstPos ; if ( nNumOfBytes > nOutputCapacity ) nNumOfBytes = nOutputCapacity ; // convert now
int nResult = 0 ; for ( int nI = 0 ; nI < nNumOfBytes ; nI ++ ) { byte bActByte = 0 ; boolean blConvertOK = true ; for ( int nJ = 0 ; nJ < 2 ; nJ ++ ) { bActByte <<= 4 ; char cActChar = sBinHex . charAt ( nSrcPos ++ ) ; if ( ( cActChar >= 'a' ) && ( cActChar <= 'f' ) ) bActByte |= ( byte ) ( cActChar - 'a' ) + 10 ; else if ( ( cActChar >= '0' ) && ( cActChar <= '9' ) ) bActByte |= ( byte ) ( cActChar - '0' ) ; else blConvertOK = false ; } if ( blConvertOK ) { data [ nDstPos ++ ] = bActByte ; nResult ++ ; } } return nResult ; |
public class CompactCalendarController { /** * it returns 0-6 where 0 is Sunday instead of 1 */
int getDayOfWeek ( Calendar calendar ) { } } | int dayOfWeek = calendar . get ( Calendar . DAY_OF_WEEK ) - firstDayOfWeekToDraw ; dayOfWeek = dayOfWeek < 0 ? 7 + dayOfWeek : dayOfWeek ; return dayOfWeek ; |
public class JavaSrcTextBuffer { /** * Formatted print .
* @ param text format string
* @ param args arguments for formatted string
* @ return this instance
* @ see String # format ( String , Object . . . ) */
public JavaSrcTextBuffer printf ( final String text , final Object ... args ) { } } | this . buffer . append ( String . format ( text , args ) ) ; return this ; |
public class CmsSolrDocument { /** * Adds the given document dependency to this document . < p >
* @ param cms the current CmsObject
* @ param resDeps the dependency */
public void addDocumentDependency ( CmsObject cms , CmsDocumentDependency resDeps ) { } } | if ( resDeps != null ) { m_doc . addField ( CmsSearchField . FIELD_DEPENDENCY_TYPE , resDeps . getType ( ) ) ; if ( ( resDeps . getMainDocument ( ) != null ) && ( resDeps . getType ( ) != null ) ) { m_doc . addField ( CmsSearchField . FIELD_PREFIX_DEPENDENCY + resDeps . getType ( ) . toString ( ) , resDeps . getMainDocument ( ) . toDependencyString ( cms ) ) ; } for ( CmsDocumentDependency dep : resDeps . getVariants ( ) ) { m_doc . addField ( CmsSearchField . FIELD_PREFIX_DEPENDENCY + dep . getType ( ) . toString ( ) , dep . toDependencyString ( cms ) ) ; } for ( CmsDocumentDependency dep : resDeps . getAttachments ( ) ) { m_doc . addField ( CmsSearchField . FIELD_PREFIX_DEPENDENCY + dep . getType ( ) . toString ( ) , dep . toDependencyString ( cms ) ) ; } } |
public class LocationApi { /** * Build call for getCharactersCharacterIdShip
* @ param characterId
* An EVE character ID ( required )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param ifNoneMatch
* ETag from a previous request . A 304 will be returned if this
* matches the current ETag ( optional )
* @ param token
* Access token to use if unable to set a header ( optional )
* @ param callback
* Callback for upload / download progress
* @ return Call to execute
* @ throws ApiException
* If fail to serialize the request body object */
public com . squareup . okhttp . Call getCharactersCharacterIdShipCall ( Integer characterId , String datasource , String ifNoneMatch , String token , final ApiCallback callback ) throws ApiException { } } | Object localVarPostBody = new Object ( ) ; // create path and map variables
String localVarPath = "/v1/characters/{character_id}/ship/" . replaceAll ( "\\{" + "character_id" + "\\}" , apiClient . escapeString ( characterId . toString ( ) ) ) ; List < Pair > localVarQueryParams = new ArrayList < Pair > ( ) ; List < Pair > localVarCollectionQueryParams = new ArrayList < Pair > ( ) ; if ( datasource != null ) { localVarQueryParams . addAll ( apiClient . parameterToPair ( "datasource" , datasource ) ) ; } if ( token != null ) { localVarQueryParams . addAll ( apiClient . parameterToPair ( "token" , token ) ) ; } Map < String , String > localVarHeaderParams = new HashMap < String , String > ( ) ; if ( ifNoneMatch != null ) { localVarHeaderParams . put ( "If-None-Match" , apiClient . parameterToString ( ifNoneMatch ) ) ; } Map < String , Object > localVarFormParams = new HashMap < String , Object > ( ) ; final String [ ] localVarAccepts = { "application/json" } ; final String localVarAccept = apiClient . selectHeaderAccept ( localVarAccepts ) ; if ( localVarAccept != null ) { localVarHeaderParams . put ( "Accept" , localVarAccept ) ; } final String [ ] localVarContentTypes = { } ; final String localVarContentType = apiClient . selectHeaderContentType ( localVarContentTypes ) ; localVarHeaderParams . put ( "Content-Type" , localVarContentType ) ; String [ ] localVarAuthNames = new String [ ] { "evesso" } ; return apiClient . buildCall ( localVarPath , "GET" , localVarQueryParams , localVarCollectionQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAuthNames , callback ) ; |
public class Handler { /** * pop command from stack and put it to one of collections */
@ Override public void endElement ( String namespaceURI , String localeName , String tagName ) throws SAXException { } } | Command cmd = stack . pop ( ) ; // cmd . setTabCount ( tabCount ) ;
// find if command works in context
if ( ! stack . isEmpty ( ) ) { Command ctx = stack . peek ( ) ; ctx . addChild ( cmd ) ; } // upper level commands
if ( stack . size ( ) == 1 && cmd . isExecutable ( ) ) { commands . add ( cmd ) ; } // store reference to command
if ( cmd . hasAttr ( "id" ) ) { // $ NON - NLS - 1 $
references . put ( cmd . getAttr ( "id" ) , cmd ) ; // $ NON - NLS - 1 $
} try { cmd . exec ( references ) ; } catch ( Exception e ) { SAXException e2 = new SAXException ( e . getMessage ( ) ) ; e2 . initCause ( e ) ; throw e2 ; } if ( -- tabCount < 0 ) { tabCount = 0 ; } Command . prn ( tabCount , tabCount + ">...<" + tagName + "> end" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $ |
public class JQMPage { /** * Sets the header element , overriding an existing header if any . */
public void setHeader ( HasJqmHeader header ) { } } | removeHeader ( ) ; this . header = header ; if ( this . header == null ) return ; addLogical ( header . getHeaderStage ( ) ) ; if ( panel == null ) { getElement ( ) . insertBefore ( header . getJqmHeader ( ) . getElement ( ) , getElement ( ) . getFirstChild ( ) ) ; } else { getElement ( ) . insertAfter ( header . getJqmHeader ( ) . getElement ( ) , panel . getElement ( ) ) ; } |
public class ImmutableTable { /** * Returns a new builder . The generated builder is equivalent to the builder
* created by the { @ link Builder # ImmutableTable . Builder ( ) } constructor . */
public static < R , C , V > Builder < R , C , V > builder ( ) { } } | return new Builder < R , C , V > ( ) ; |
public class UrlCopy { /** * Returns input stream based on the source url */
protected GlobusInputStream getInputStream ( ) throws Exception { } } | GlobusInputStream in = null ; String fromP = srcUrl . getProtocol ( ) ; String fromFile = srcUrl . getPath ( ) ; if ( fromP . equalsIgnoreCase ( "file" ) ) { fromFile = URLDecoder . decode ( fromFile ) ; in = new GlobusFileInputStream ( fromFile ) ; } else if ( fromP . equalsIgnoreCase ( "ftp" ) ) { fromFile = URLDecoder . decode ( fromFile ) ; in = new FTPInputStream ( srcUrl . getHost ( ) , srcUrl . getPort ( ) , srcUrl . getUser ( ) , srcUrl . getPwd ( ) , fromFile ) ; } else if ( fromP . equalsIgnoreCase ( "gsiftp" ) || fromP . equalsIgnoreCase ( "gridftp" ) ) { Authorization auth = getSourceAuthorization ( ) ; if ( auth == null ) { auth = HostAuthorization . getInstance ( ) ; } fromFile = URLDecoder . decode ( fromFile ) ; in = new GridFTPInputStream ( getSourceCredentials ( ) , auth , srcUrl . getHost ( ) , srcUrl . getPort ( ) , fromFile , getDCAU ( ) ) ; } else if ( fromP . equalsIgnoreCase ( "https" ) ) { Authorization auth = getSourceAuthorization ( ) ; if ( auth == null ) { auth = SelfAuthorization . getInstance ( ) ; } in = new GassInputStream ( getSourceCredentials ( ) , auth , srcUrl . getHost ( ) , srcUrl . getPort ( ) , fromFile ) ; } else if ( fromP . equalsIgnoreCase ( "http" ) ) { in = new HTTPInputStream ( srcUrl . getHost ( ) , srcUrl . getPort ( ) , fromFile ) ; } else { throw new Exception ( "Source protocol: " + fromP + " not supported!" ) ; } return in ; |
public class MarshallUtil { /** * Unmarshall arrays .
* @ param in { @ link ObjectInput } to read .
* @ param builder { @ link ArrayBuilder } to build the array .
* @ param < E > Array type .
* @ return The populated array .
* @ throws IOException If any of the usual Input / Output related exceptions occur .
* @ throws ClassNotFoundException If the class of a serialized object cannot be found .
* @ see # marshallArray ( Object [ ] , ObjectOutput ) . */
public static < E > E [ ] unmarshallArray ( ObjectInput in , ArrayBuilder < E > builder ) throws IOException , ClassNotFoundException { } } | final int size = unmarshallSize ( in ) ; if ( size == NULL_VALUE ) { return null ; } final E [ ] array = Objects . requireNonNull ( builder , "ArrayBuilder must be non-null" ) . build ( size ) ; for ( int i = 0 ; i < size ; ++ i ) { // noinspection unchecked
array [ i ] = ( E ) in . readObject ( ) ; } return array ; |
public class FileUtilsV2_2 { /** * Moves a file .
* When the destination file is on another file system , do a " copy and delete " .
* @ param srcFile the file to be moved
* @ param destFile the destination file
* @ throws NullPointerException if source or destination is < code > null < / code >
* @ throws FileExistsException if the destination file exists
* @ throws IOException if source or destination is invalid
* @ throws IOException if an IO error occurs moving the file
* @ since 1.4 */
public static void moveFile ( File srcFile , File destFile ) throws IOException { } } | if ( srcFile == null ) { throw new NullPointerException ( "Source must not be null" ) ; } if ( destFile == null ) { throw new NullPointerException ( "Destination must not be null" ) ; } if ( ! srcFile . exists ( ) ) { throw new FileNotFoundException ( "Source '" + srcFile + "' does not exist" ) ; } if ( srcFile . isDirectory ( ) ) { throw new IOException ( "Source '" + srcFile + "' is a directory" ) ; } if ( destFile . exists ( ) ) { throw new FileExistsException ( "Destination '" + destFile + "' already exists" ) ; } if ( destFile . isDirectory ( ) ) { throw new IOException ( "Destination '" + destFile + "' is a directory" ) ; } boolean rename = srcFile . renameTo ( destFile ) ; if ( ! rename ) { copyFile ( srcFile , destFile ) ; if ( ! srcFile . delete ( ) ) { FileUtils . deleteQuietly ( destFile ) ; throw new IOException ( "Failed to delete original file '" + srcFile + "' after copy to '" + destFile + "'" ) ; } } |
public class AbstractClusterBuilder { /** * Calculates the initial clusters randomly , this could be replaced with a better algorithm
* @ param values
* @ param numClusters
* @ return */
protected Cluster [ ] calculateInitialClusters ( List < ? extends Clusterable > values , int numClusters ) { } } | Cluster [ ] clusters = new Cluster [ numClusters ] ; // choose centers and create the initial clusters
Random random = new Random ( 1 ) ; Set < Integer > clusterCenters = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < numClusters ; i ++ ) { int index = random . nextInt ( values . size ( ) ) ; while ( clusterCenters . contains ( index ) ) { index = random . nextInt ( values . size ( ) ) ; } clusterCenters . add ( index ) ; clusters [ i ] = new Cluster ( values . get ( index ) . getLocation ( ) , i ) ; } return clusters ; |
public class JobFlowInstancesConfig { /** * A list of additional Amazon EC2 security group IDs for the core and task nodes .
* @ return A list of additional Amazon EC2 security group IDs for the core and task nodes . */
public java . util . List < String > getAdditionalSlaveSecurityGroups ( ) { } } | if ( additionalSlaveSecurityGroups == null ) { additionalSlaveSecurityGroups = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return additionalSlaveSecurityGroups ; |
public class URLRewriterService { /** * Print out information about the chain of URLRewriters in this request .
* @ param request the current HttpServletRequest .
* @ param output a PrintStream to output chain of URLRewriters in this request .
* If < code > null < / null > , < code > System . err < / code > is used . */
public static void dumpURLRewriters ( ServletRequest request , PrintStream output ) { } } | ArrayList /* < URLRewriter > */
rewriters = getRewriters ( request ) ; if ( output == null ) output = System . err ; output . println ( "*** List of URLRewriter objects: " + rewriters ) ; if ( rewriters != null ) { int count = 0 ; for ( Iterator i = rewriters . iterator ( ) ; i . hasNext ( ) ; ) { URLRewriter rewriter = ( URLRewriter ) i . next ( ) ; output . println ( " " + count ++ + ". " + rewriter . getClass ( ) . getName ( ) ) ; output . println ( " allows other rewriters: " + rewriter . allowOtherRewriters ( ) ) ; output . println ( " rewriter: " + rewriter ) ; } } else { output . println ( " No URLRewriter objects are registered with this request." ) ; } |
public class AbstractReadableInstantFieldProperty { /** * Compare this field to the same field on another partial instant .
* The comparison is based on the value of the same field type , irrespective
* of any difference in chronology . Thus , if this property represents the
* hourOfDay field , then the hourOfDay field of the other partial will be queried
* whether in the same chronology or not .
* @ param partial the partial to compare to
* @ return negative value if this is less , 0 if equal , or positive value if greater
* @ throws IllegalArgumentException if the partial is null
* @ throws IllegalArgumentException if the partial doesn ' t support this field */
public int compareTo ( ReadablePartial partial ) { } } | if ( partial == null ) { throw new IllegalArgumentException ( "The partial must not be null" ) ; } int thisValue = get ( ) ; int otherValue = partial . get ( getFieldType ( ) ) ; if ( thisValue < otherValue ) { return - 1 ; } else if ( thisValue > otherValue ) { return 1 ; } else { return 0 ; } |
public class ST_AsGeoJSON { /** * Coordinates of a MultiPolygon are an array of Polygon coordinate arrays .
* Syntax :
* { " type " : " MultiPolygon " , " coordinates " : [ [ [ [ 102.0 , 2.0 ] , [ 103.0 , 2.0 ] ,
* [ 103.0 , 3.0 ] , [ 102.0 , 3.0 ] , [ 102.0 , 2.0 ] ] ] , [ [ [ 100.0 , 0.0 ] , [ 101.0 , 0.0 ] ,
* [ 101.0 , 1.0 ] , [ 100.0 , 1.0 ] , [ 100.0 , 0.0 ] ] , [ [ 100.2 , 0.2 ] , [ 100.8 , 0.2 ] ,
* [ 100.8 , 0.8 ] , [ 100.2 , 0.8 ] , [ 100.2 , 0.2 ] ] ] ] }
* @ param multiPolygon
* @ param sb */
public static void toGeojsonMultiPolygon ( MultiPolygon multiPolygon , StringBuilder sb ) { } } | sb . append ( "{\"type\":\"MultiPolygon\",\"coordinates\":[" ) ; for ( int i = 0 ; i < multiPolygon . getNumGeometries ( ) ; i ++ ) { Polygon p = ( Polygon ) multiPolygon . getGeometryN ( i ) ; sb . append ( "[" ) ; // Process exterior ring
toGeojsonCoordinates ( p . getExteriorRing ( ) . getCoordinates ( ) , sb ) ; // Process interior rings
for ( int j = 0 ; j < p . getNumInteriorRing ( ) ; j ++ ) { sb . append ( "," ) ; toGeojsonCoordinates ( p . getInteriorRingN ( j ) . getCoordinates ( ) , sb ) ; } sb . append ( "]" ) ; if ( i < multiPolygon . getNumGeometries ( ) - 1 ) { sb . append ( "," ) ; } } sb . append ( "]}" ) ; |
public class VodClient { /** * Transcode the media again . Only status is FAILED or PUBLISHED media can use .
* @ param mediaId The unique ID for each media resource
* @ return */
public ReTranscodeResponse reTranscode ( String mediaId ) { } } | ReTranscodeRequest request = new ReTranscodeRequest ( ) . withMediaId ( mediaId ) ; return reTranscode ( request ) ; |
public class BNFHeadersImpl { /** * Utility method for parsing a header value out of the input buffer .
* @ param buff
* @ return boolean ( false if need more data , true otherwise )
* @ throws MalformedMessageException */
private boolean parseHeaderValueExtract ( WsByteBuffer buff ) throws MalformedMessageException { } } | // 295178 - don ' t log sensitive information
// log value contents based on the header key ( if known )
int log = LOG_FULL ; HeaderKeys key = this . currentElem . getKey ( ) ; if ( null != key && ! key . shouldLogValue ( ) ) { // this header key wants to block the entire thing
log = LOG_NONE ; } TokenCodes tcRC = parseCRLFTokenExtract ( buff , log ) ; if ( ! tcRC . equals ( TokenCodes . TOKEN_RC_MOREDATA ) ) { setHeaderValue ( ) ; this . parsedToken = null ; this . currentElem = null ; this . stateOfParsing = PARSING_CRLF ; return true ; } // otherwise we need more data in order to read the value
return false ; |
public class RMIImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . RMI__INCRMENT : setINCRMENT ( INCRMENT_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class CmsSiteManagerImpl { /** * Returns < code > true < / code > if the given site matcher matches the current site . < p >
* @ param cms the current OpenCms user context
* @ param matcher the site matcher to match the site with
* @ return < code > true < / code > if the matcher matches the current site */
public boolean isMatchingCurrentSite ( CmsObject cms , CmsSiteMatcher matcher ) { } } | return m_siteMatcherSites . get ( matcher ) == getCurrentSite ( cms ) ; |
public class PromisesArray { /** * Create PromisesArray from collection
* @ param collection Source collection
* @ param < T > type of array
* @ return array */
@ SuppressWarnings ( "unchecked" ) public static < T > PromisesArray < T > of ( Collection < T > collection ) { } } | final ArrayList < Promise < T > > res = new ArrayList < > ( ) ; for ( T t : collection ) { res . add ( Promise . success ( t ) ) ; } final Promise [ ] promises = res . toArray ( new Promise [ res . size ( ) ] ) ; return new PromisesArray < > ( ( PromiseFunc < Promise < T > [ ] > ) executor -> { executor . result ( promises ) ; } ) ; |
public class IndexBuilder { /** * Sort the index map . Traverse the index map for all it ' s elements and
* sort each element which is a list . */
protected void sortIndexMap ( ) { } } | for ( List < Doc > docs : indexmap . values ( ) ) { Collections . sort ( docs , configuration . utils . makeComparatorForIndexUse ( ) ) ; } |
public class BindTypeContext { /** * Gets the bind mapper name .
* @ param context the context
* @ param typeName the type name
* @ return the bind mapper name */
public String getBindMapperName ( BindTypeContext context , TypeName typeName ) { } } | Converter < String , String > format = CaseFormat . UPPER_CAMEL . converterTo ( CaseFormat . LOWER_CAMEL ) ; TypeName bindMapperName = TypeUtility . mergeTypeNameWithSuffix ( typeName , BindTypeBuilder . SUFFIX ) ; String simpleName = format . convert ( TypeUtility . simpleName ( bindMapperName ) ) ; if ( ! alreadyGeneratedMethods . contains ( simpleName ) ) { alreadyGeneratedMethods . add ( simpleName ) ; if ( bindMapperName . equals ( beanTypeName ) ) { context . builder . addField ( FieldSpec . builder ( bindMapperName , simpleName , modifiers ) . addJavadoc ( "$T" , bindMapperName ) . initializer ( "this" ) . build ( ) ) ; } else { context . builder . addField ( FieldSpec . builder ( bindMapperName , simpleName , modifiers ) . addJavadoc ( "$T" , bindMapperName ) . initializer ( "$T.mapperFor($T.class)" , BinderUtils . class , typeName ) . build ( ) ) ; } } return simpleName ; |
public class U { /** * Documented , # object */
public static < K , V > List < Tuple < K , V > > object ( final List < K > keys , final List < V > values ) { } } | return map ( keys , new Function < K , Tuple < K , V > > ( ) { private int index ; @ Override public Tuple < K , V > apply ( K key ) { return Tuple . create ( key , values . get ( index ++ ) ) ; } } ) ; |
public class CommonOps_DDF5 { /** * < p > Performs an element by element multiplication operation : < br >
* < br >
* c < sub > ij < / sub > = a < sub > ij < / sub > * b < sub > ij < / sub > < br >
* @ param a The left matrix in the multiplication operation . Not modified .
* @ param b The right matrix in the multiplication operation . Not modified .
* @ param c Where the results of the operation are stored . Modified . */
public static void elementMult ( DMatrix5x5 a , DMatrix5x5 b , DMatrix5x5 c ) { } } | c . a11 = a . a11 * b . a11 ; c . a12 = a . a12 * b . a12 ; c . a13 = a . a13 * b . a13 ; c . a14 = a . a14 * b . a14 ; c . a15 = a . a15 * b . a15 ; c . a21 = a . a21 * b . a21 ; c . a22 = a . a22 * b . a22 ; c . a23 = a . a23 * b . a23 ; c . a24 = a . a24 * b . a24 ; c . a25 = a . a25 * b . a25 ; c . a31 = a . a31 * b . a31 ; c . a32 = a . a32 * b . a32 ; c . a33 = a . a33 * b . a33 ; c . a34 = a . a34 * b . a34 ; c . a35 = a . a35 * b . a35 ; c . a41 = a . a41 * b . a41 ; c . a42 = a . a42 * b . a42 ; c . a43 = a . a43 * b . a43 ; c . a44 = a . a44 * b . a44 ; c . a45 = a . a45 * b . a45 ; c . a51 = a . a51 * b . a51 ; c . a52 = a . a52 * b . a52 ; c . a53 = a . a53 * b . a53 ; c . a54 = a . a54 * b . a54 ; c . a55 = a . a55 * b . a55 ; |
public class MessageItem { /** * Sets both the cached version of the reliability and the
* reliability in the underlying message .
* Called by the AbstractInputHandler to update the message
* reliability to that of the destination .
* @ param reliability */
public void setReliability ( Reliability reliability ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setReliability" , reliability ) ; JsMessage localMsg = getJSMessage ( true ) ; msgReliability = reliability ; localMsg . setReliability ( msgReliability ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setReliability" ) ; |
public class ListStatistics { /** * Defect 510343.1 */
public final void incrementAvailable ( int sizeInBytes ) throws SevereMessageStoreException { } } | boolean doCallback = false ; synchronized ( this ) { _countAvailable ++ ; doCallback = _incrementTotal ( sizeInBytes ) ; } if ( doCallback ) { _owningStreamLink . eventWatermarkBreached ( ) ; } |
public class Distill { /** * Convert the dot notation entity bean packages to slash notation .
* @ param packages entity bean packages */
static DetectQueryBean convert ( Collection < String > packages ) { } } | String [ ] asArray = packages . toArray ( new String [ packages . size ( ) ] ) ; for ( int i = 0 ; i < asArray . length ; i ++ ) { asArray [ i ] = convert ( asArray [ i ] ) ; } return new DetectQueryBean ( asArray ) ; |
public class ClassUtils { /** * Loads the Class object for the specified , fully qualified class name using the provided ClassLoader and the option
* to initialize the class ( calling any static initializers ) once loaded .
* @ param < T > { @ link Class } type of T .
* @ param fullyQualifiedClassName a String indicating the fully qualified class name of the Class to load .
* @ param initialize a boolean value indicating whether to initialize the class after loading .
* @ param classLoader the ClassLoader used to load the class .
* @ return a Class object for the specified , fully - qualified class name .
* @ throws TypeNotFoundException if the Class identified by the fully qualified class name could not be found .
* @ see java . lang . Class # forName ( String , boolean , ClassLoader ) */
@ SuppressWarnings ( "unchecked" ) public static < T > Class < T > loadClass ( String fullyQualifiedClassName , boolean initialize , ClassLoader classLoader ) { } } | try { return ( Class < T > ) Class . forName ( fullyQualifiedClassName , initialize , classLoader ) ; } catch ( ClassNotFoundException | NoClassDefFoundError cause ) { throw new TypeNotFoundException ( String . format ( "Class [%s] was not found" , fullyQualifiedClassName ) , cause ) ; } |
public class RuntimeSchema { /** * Generates a schema from the given class with the exclusion of certain fields . */
public static < T > RuntimeSchema < T > createFrom ( Class < T > typeClass , String [ ] exclusions , IdStrategy strategy ) { } } | HashSet < String > set = new HashSet < String > ( ) ; for ( String exclusion : exclusions ) set . add ( exclusion ) ; return createFrom ( typeClass , set , strategy ) ; |
public class DescribeAssociationExecutionTargetsRequest { /** * Filters for the request . You can specify the following filters and values .
* Status ( EQUAL )
* ResourceId ( EQUAL )
* ResourceType ( EQUAL )
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setFilters ( java . util . Collection ) } or { @ link # withFilters ( java . util . Collection ) } if you want to override
* the existing values .
* @ param filters
* Filters for the request . You can specify the following filters and values . < / p >
* Status ( EQUAL )
* ResourceId ( EQUAL )
* ResourceType ( EQUAL )
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeAssociationExecutionTargetsRequest withFilters ( AssociationExecutionTargetsFilter ... filters ) { } } | if ( this . filters == null ) { setFilters ( new com . amazonaws . internal . SdkInternalList < AssociationExecutionTargetsFilter > ( filters . length ) ) ; } for ( AssociationExecutionTargetsFilter ele : filters ) { this . filters . add ( ele ) ; } return this ; |
public class AbstractResult { /** * Computes the minimum .
* @ param meter the meter of the mean
* @ return the minimum result value . */
public final double min ( final AbstractMeter meter ) { } } | checkIfMeterExists ( meter ) ; final AbstractUnivariateStatistic min = new Min ( ) ; final CollectionDoubleCollection doubleColl = new CollectionDoubleCollection ( this . meterResults . get ( meter ) ) ; return min . evaluate ( doubleColl . toArray ( ) , 0 , doubleColl . toArray ( ) . length ) ; |
public class OpValidation { /** * Returns a list of classes that are not gradient checkable .
* An operation may not be gradient checkable due to , for example :
* ( a ) Having no real - valued arguments < br >
* ( b ) Having random output ( dropout , for example ) < br >
* Note that hawving non - real - valued output is OK - we still want to test these , as they
* should pass back zero gradients ! */
private static Set < Class > excludedFromGradientCheckCoverage ( ) { } } | List list = Arrays . asList ( // Exclude misc
DynamicCustomOp . class , EqualsWithEps . class , ConfusionMatrix . class , Eye . class , OneHot . class , BinaryMinimalRelativeError . class , BinaryMinimalRelativeError . class , Histogram . class , InvertPermutation . class , // Uses integer indices
ConfusionMatrix . class , // Integer indices
Linspace . class , // No input array
// Exclude boolean operations :
Any . class , All . class , // Exclude index accumulations ( index out , not real - valued )
FirstIndex . class , IAMax . class , IAMin . class , IMax . class , IMin . class , LastIndex . class , // Exclude Random ops
RandomStandardNormal . class , DistributionUniform . class , AlphaDropOut . class , BernoulliDistribution . class , BinomialDistribution . class , BinomialDistributionEx . class , Choice . class , DropOut . class , DropOutInverted . class , GaussianDistribution . class , LogNormalDistribution . class , ProbablisticMerge . class , Range . class , TruncatedNormalDistribution . class , UniformDistribution . class , // Other ops we don ' t intend to be differentiable ( only used as part of backprop , etc ) .
// But we still want a forward / check for these
Col2Im . class , NormalizeMoments . class , // In principle differentiable . In practice : doesn ' t make any sense to do so !
CumProdBp . class , CumSumBp . class , DotBp . class , MaxBp . class , MeanBp . class , MinBp . class , Norm1Bp . class , Norm2Bp . class , NormMaxBp . class , ProdBp . class , StandardDeviationBp . class , SumBp . class , VarianceBp . class ) ; return new HashSet < > ( list ) ; |
public class FileTransferNegotiator { /** * Returns a new , unique , stream ID to identify a file transfer .
* @ return Returns a new , unique , stream ID to identify a file transfer . */
public static String getNextStreamID ( ) { } } | StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( STREAM_INIT_PREFIX ) ; buffer . append ( randomGenerator . nextInt ( Integer . MAX_VALUE ) + randomGenerator . nextInt ( Integer . MAX_VALUE ) ) ; return buffer . toString ( ) ; |
public class KnowledgeBasesClient { /** * Deletes the specified knowledge base .
* < p > Sample code :
* < pre > < code >
* try ( KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient . create ( ) ) {
* KnowledgeBaseName name = KnowledgeBaseName . of ( " [ PROJECT ] " , " [ KNOWLEDGE _ BASE ] " ) ;
* knowledgeBasesClient . deleteKnowledgeBase ( name ) ;
* < / code > < / pre >
* @ param name Required . The name of the knowledge base to delete . Format : ` projects / & lt ; Project
* ID & gt ; / knowledgeBases / & lt ; Knowledge Base ID & gt ; ` .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final void deleteKnowledgeBase ( KnowledgeBaseName name ) { } } | DeleteKnowledgeBaseRequest request = DeleteKnowledgeBaseRequest . newBuilder ( ) . setName ( name == null ? null : name . toString ( ) ) . build ( ) ; deleteKnowledgeBase ( request ) ; |
public class ClassSpecRegistry { /** * SQL */
private static String getColumnName ( ColumnAnn ann , Field field ) { } } | String name = ann . name ; if ( isEmpty ( name ) ) { name = field . getName ( ) ; if ( isEntity ( field . getType ( ) ) && ! name . endsWith ( ID_AFFIX ) ) { name += ID_AFFIX ; } } return name ; |
public class JsiiClient { /** * Creates a remote jsii object .
* @ param fqn The fully - qualified - name of the class .
* @ param initializerArgs Constructor arguments .
* @ return A jsii object reference . */
public JsiiObjectRef createObject ( final String fqn , final List < Object > initializerArgs ) { } } | return createObject ( fqn , initializerArgs , Collections . emptyList ( ) ) ; |
public class LinkedBlockingQueue { /** * Removes a node from head of queue .
* @ return the node */
private E dequeue ( ) { } } | // assert takeLock . isHeldByCurrentThread ( ) ;
// assert head . item = = null ;
Node < E > h = head ; Node < E > first = h . next ; h . next = sentinel ( ) ; // help GC
head = first ; E x = first . item ; first . item = null ; return x ; |
public class DeploymentsInner { /** * Deploys resources to a resource group .
* You can provide the template and parameters directly in the request or link to JSON files .
* @ param resourceGroupName The name of the resource group to deploy the resources to . The name is case insensitive . The resource group must already exist .
* @ param deploymentName The name of the deployment .
* @ param properties The deployment properties .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < DeploymentExtendedInner > beginCreateOrUpdateAsync ( String resourceGroupName , String deploymentName , DeploymentProperties properties , final ServiceCallback < DeploymentExtendedInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( beginCreateOrUpdateWithServiceResponseAsync ( resourceGroupName , deploymentName , properties ) , serviceCallback ) ; |
public class QueryParserBase { /** * Get the mapped field name using meta information derived from the given domain type .
* @ param field
* @ param domainType
* @ return
* @ since 4.0 */
protected String getMappedFieldName ( Field field , @ Nullable Class < ? > domainType ) { } } | return getMappedFieldName ( field . getName ( ) , domainType ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.