signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class SessionFailRetryLoop { /** * Convenience utility : creates a " session fail " retry loop calling the given proc
* @ param client Zookeeper
* @ param mode how to handle session failures
* @ param proc procedure to call with retry
* @ param < T > return type
* @ return procedure result
* @ throws Exception any non - retriable errors */
public static < T > T callWithRetry ( CuratorZookeeperClient client , Mode mode , Callable < T > proc ) throws Exception { } } | T result = null ; SessionFailRetryLoop retryLoop = client . newSessionFailRetryLoop ( mode ) ; retryLoop . start ( ) ; try { while ( retryLoop . shouldContinue ( ) ) { try { result = proc . call ( ) ; } catch ( Exception e ) { ThreadUtils . checkInterrupted ( e ) ; retryLoop . takeException ( e ) ; } } } finally { retryLoop . close ( ) ; } return result ; |
public class RawPacket { /** * Append a byte array to the end of the packet . This may change the data
* buffer of this packet .
* @ param data byte array to append
* @ param len the number of bytes to append */
public void append ( byte [ ] data , int len ) { } } | if ( data == null || len <= 0 || len > data . length ) { throw new IllegalArgumentException ( "Invalid combination of parameters data and length to append()" ) ; } int oldLimit = buffer . limit ( ) ; // grow buffer if necessary
grow ( len ) ; // set positing to begin writing immediately after the last byte of the current buffer
buffer . position ( oldLimit ) ; // set the buffer limit to exactly the old size plus the new appendix length
buffer . limit ( oldLimit + len ) ; // append data
buffer . put ( data , 0 , len ) ; |
public class hqlParser { /** * hql . g : 199:1 : optionalFromTokenFromClause : optionalFromTokenFromClause2 path ( asAlias ) ? - > ^ ( FROM ^ ( RANGE path ( asAlias ) ? ) ) ; */
public final hqlParser . optionalFromTokenFromClause_return optionalFromTokenFromClause ( ) throws RecognitionException { } } | hqlParser . optionalFromTokenFromClause_return retval = new hqlParser . optionalFromTokenFromClause_return ( ) ; retval . start = input . LT ( 1 ) ; CommonTree root_0 = null ; ParserRuleReturnScope optionalFromTokenFromClause223 = null ; ParserRuleReturnScope path24 = null ; ParserRuleReturnScope asAlias25 = null ; RewriteRuleSubtreeStream stream_optionalFromTokenFromClause2 = new RewriteRuleSubtreeStream ( adaptor , "rule optionalFromTokenFromClause2" ) ; RewriteRuleSubtreeStream stream_path = new RewriteRuleSubtreeStream ( adaptor , "rule path" ) ; RewriteRuleSubtreeStream stream_asAlias = new RewriteRuleSubtreeStream ( adaptor , "rule asAlias" ) ; try { // hql . g : 200:2 : ( optionalFromTokenFromClause2 path ( asAlias ) ? - > ^ ( FROM ^ ( RANGE path ( asAlias ) ? ) ) )
// hql . g : 200:4 : optionalFromTokenFromClause2 path ( asAlias ) ?
{ pushFollow ( FOLLOW_optionalFromTokenFromClause2_in_optionalFromTokenFromClause752 ) ; optionalFromTokenFromClause223 = optionalFromTokenFromClause2 ( ) ; state . _fsp -- ; stream_optionalFromTokenFromClause2 . add ( optionalFromTokenFromClause223 . getTree ( ) ) ; pushFollow ( FOLLOW_path_in_optionalFromTokenFromClause754 ) ; path24 = path ( ) ; state . _fsp -- ; stream_path . add ( path24 . getTree ( ) ) ; // hql . g : 200:38 : ( asAlias ) ?
int alt6 = 2 ; int LA6_0 = input . LA ( 1 ) ; if ( ( LA6_0 == AS || LA6_0 == IDENT ) ) { alt6 = 1 ; } switch ( alt6 ) { case 1 : // hql . g : 200:39 : asAlias
{ pushFollow ( FOLLOW_asAlias_in_optionalFromTokenFromClause757 ) ; asAlias25 = asAlias ( ) ; state . _fsp -- ; stream_asAlias . add ( asAlias25 . getTree ( ) ) ; } break ; } // AST REWRITE
// elements : asAlias , path
// token labels :
// rule labels : retval
// token list labels :
// rule list labels :
// wildcard labels :
retval . tree = root_0 ; RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream ( adaptor , "rule retval" , retval != null ? retval . getTree ( ) : null ) ; root_0 = ( CommonTree ) adaptor . nil ( ) ; // 201:3 : - > ^ ( FROM ^ ( RANGE path ( asAlias ) ? ) )
{ // hql . g : 201:6 : ^ ( FROM ^ ( RANGE path ( asAlias ) ? ) )
{ CommonTree root_1 = ( CommonTree ) adaptor . nil ( ) ; root_1 = ( CommonTree ) adaptor . becomeRoot ( adaptor . create ( FROM , "FROM" ) , root_1 ) ; // hql . g : 201:13 : ^ ( RANGE path ( asAlias ) ? )
{ CommonTree root_2 = ( CommonTree ) adaptor . nil ( ) ; root_2 = ( CommonTree ) adaptor . becomeRoot ( adaptor . create ( RANGE , "RANGE" ) , root_2 ) ; adaptor . addChild ( root_2 , stream_path . nextTree ( ) ) ; // hql . g : 201:26 : ( asAlias ) ?
if ( stream_asAlias . hasNext ( ) ) { adaptor . addChild ( root_2 , stream_asAlias . nextTree ( ) ) ; } stream_asAlias . reset ( ) ; adaptor . addChild ( root_1 , root_2 ) ; } adaptor . addChild ( root_0 , root_1 ) ; } } retval . tree = root_0 ; } retval . stop = input . LT ( - 1 ) ; retval . tree = ( CommonTree ) adaptor . rulePostProcessing ( root_0 ) ; adaptor . setTokenBoundaries ( retval . tree , retval . start , retval . stop ) ; } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; retval . tree = ( CommonTree ) adaptor . errorNode ( input , retval . start , input . LT ( - 1 ) , re ) ; } finally { // do for sure before leaving
} return retval ; |
public class LibraryLoader { /** * Search and load the dynamic library which is fitting the
* current operating system ( 32 or 64bits operating system . . . ) .
* A 64 bits library is assumed to be named < code > libname64 . dll < / code >
* on Windows & reg ; and < code > liblibname64 . so < / code > on Unix .
* A 32 bits library is assumed to be named < code > libname32 . dll < / code >
* on Windows & reg ; and < code > liblibname32 . so < / code > on Unix .
* A library which could be ran either on 32 and 64 platforms is assumed
* to be named < code > libname . dll < / code > on Windows & reg ; and
* < code > liblibname . so < / code > on Unix .
* @ param path is the resource ' s path where the library was located .
* @ param libname is the name of the library .
* @ throws IOException when reading error occurs .
* @ throws SecurityException if a security manager exists and its
* < code > checkLink < / code > method doesn ' t allow
* loading of the specified dynamic library
* @ throws UnsatisfiedLinkError if the file does not exist .
* @ throws NullPointerException if < code > filename < / code > is
* < code > null < / code >
* @ see java . lang . System # load ( java . lang . String ) */
public static void loadPlatformDependentLibrary ( String path , String libname ) throws IOException { } } | loadPlatformDependentLibrary ( libname , null , path ) ; |
public class CustomFunctions { /** * Takes a single parameter ( administrative boundary as a string ) and returns the name of the leaf boundary */
public static String format_location ( EvaluationContext ctx , Object text ) { } } | String _text = Conversions . toString ( text , ctx ) ; String [ ] splits = _text . split ( ">" ) ; return splits [ splits . length - 1 ] . trim ( ) ; |
public class PlanExecutor { /** * Creates an executor that runs the plan locally in a multi - threaded environment .
* @ return A local executor .
* @ see eu . stratosphere . client . LocalExecutor */
public static PlanExecutor createLocalExecutor ( ) { } } | Class < ? extends PlanExecutor > leClass = loadExecutorClass ( LOCAL_EXECUTOR_CLASS ) ; try { return leClass . newInstance ( ) ; } catch ( Throwable t ) { throw new RuntimeException ( "An error occurred while loading the local executor (" + LOCAL_EXECUTOR_CLASS + ")." , t ) ; } |
public class Widgets { /** * Creates an image button that changes appearance when you click and hover over it . */
public static PushButton newImageButton ( String style , ClickHandler onClick ) { } } | PushButton button = new PushButton ( ) ; maybeAddClickHandler ( button , onClick ) ; return setStyleNames ( button , style , "actionLabel" ) ; |
public class OVSImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . OVS__BYPSIDEN : setBYPSIDEN ( ( Integer ) newValue ) ; return ; case AfplibPackage . OVS__OVERCHAR : setOVERCHAR ( ( Integer ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class PluginProxy { /** * Prints the help related to the plugin to a specified output .
* @ param out
* the writer where the help should be written */
public void printHelp ( final PrintWriter out ) { } } | HelpFormatter hf = new HelpFormatter ( ) ; StringBuilder sbDivider = new StringBuilder ( "=" ) ; while ( sbDivider . length ( ) < hf . getPageWidth ( ) ) { sbDivider . append ( '=' ) ; } out . println ( sbDivider . toString ( ) ) ; out . println ( "PLUGIN NAME : " + proxyedPluginDefinition . getName ( ) ) ; if ( description != null && description . trim ( ) . length ( ) != 0 ) { out . println ( sbDivider . toString ( ) ) ; out . println ( "Description : " ) ; out . println ( ) ; out . println ( description ) ; } hf . setGroup ( mainOptionsGroup ) ; // hf . setHeader ( m _ pluginDef . getName ( ) ) ;
hf . setDivider ( sbDivider . toString ( ) ) ; hf . setPrintWriter ( out ) ; hf . print ( ) ; // hf . printHelp ( m _ pluginDef . getName ( ) , m _ Options ) ; |
public class Clock { public final static String toClockString ( int value ) { } } | if ( value < 10 ) return "0" + Integer . toString ( value ) ; return Integer . toString ( value ) ; |
public class DateTimeZone { /** * Gets the millisecond offset to add to UTC to get local time .
* @ param instant instant to get the offset for , null means now
* @ return the millisecond offset to add to UTC to get local time */
public final int getOffset ( ReadableInstant instant ) { } } | if ( instant == null ) { return getOffset ( DateTimeUtils . currentTimeMillis ( ) ) ; } return getOffset ( instant . getMillis ( ) ) ; |
public class HTMLUtil { /** * Restrict HTML except for the specified tags .
* @ param allowFormatting enables & lt ; i & gt ; , & lt ; b & gt ; , & lt ; u & gt ; ,
* & lt ; font & gt ; , & lt ; br & gt ; , & lt ; p & gt ; , and
* & lt ; hr & gt ; .
* @ param allowImages enabled & lt ; img . . . & gt ; .
* @ param allowLinks enabled & lt ; a href . . . & gt ; . */
public static String restrictHTML ( String src , boolean allowFormatting , boolean allowImages , boolean allowLinks ) { } } | // TODO : these regexes should probably be checked to make
// sure that javascript can ' t live inside a link
ArrayList < String > allow = new ArrayList < String > ( ) ; if ( allowFormatting ) { allow . add ( "<b>" ) ; allow . add ( "</b>" ) ; allow . add ( "<i>" ) ; allow . add ( "</i>" ) ; allow . add ( "<u>" ) ; allow . add ( "</u>" ) ; allow . add ( "<font [^\"<>!-]*(\"[^\"<>!-]*\"[^\"<>!-]*)*>" ) ; allow . add ( "</font>" ) ; allow . add ( "<br>" ) ; allow . add ( "</br>" ) ; allow . add ( "<br/>" ) ; allow . add ( "<p>" ) ; allow . add ( "</p>" ) ; allow . add ( "<hr>" ) ; allow . add ( "</hr>" ) ; allow . add ( "<hr/>" ) ; } if ( allowImages ) { // Until I find a way to disallow " - - - " , no - can be in a url
allow . add ( "<img [^\"<>!-]*(\"[^\"<>!-]*\"[^\"<>!-]*)*>" ) ; allow . add ( "</img>" ) ; } if ( allowLinks ) { allow . add ( "<a href=[^\"<>!-]*(\"[^\"<>!-]*\"[^\"<>!-]*)*>" ) ; allow . add ( "</a>" ) ; } return restrictHTML ( src , allow . toArray ( new String [ allow . size ( ) ] ) ) ; |
public class CaptureSearchResult { /** * { @ code true } if HTTP response code is either { @ code 4xx } or { @ code 5xx } .
* @ return */
public boolean isHttpError ( ) { } } | if ( isRevisitDigest ( ) && ( getDuplicatePayload ( ) != null ) ) { return getDuplicatePayload ( ) . isHttpError ( ) ; } String httpCode = getHttpCode ( ) ; return ( httpCode . startsWith ( "4" ) || httpCode . startsWith ( "5" ) ) ; |
public class GrouperEntityGroupStore { /** * / * ( non - Javadoc )
* @ see org . apereo . portal . groups . IEntityGroupStore # contains ( org . apereo . portal . groups . IEntityGroup , org . apereo . portal . groups . IGroupMember ) */
@ Override public boolean contains ( IEntityGroup group , IGroupMember member ) throws GroupsException { } } | String groupContainerName = group . getLocalKey ( ) ; String groupMemberName = member . getKey ( ) ; if ( ! validKey ( groupContainerName ) || ! validKey ( groupMemberName ) ) { return false ; } GcHasMember gcHasMember = new GcHasMember ( ) ; gcHasMember . assignGroupName ( groupContainerName ) ; gcHasMember . addSubjectLookup ( new WsSubjectLookup ( null , "g:gsa" , groupMemberName ) ) ; WsHasMemberResults wsHasMemberResults = gcHasMember . execute ( ) ; if ( GrouperClientUtils . length ( wsHasMemberResults . getResults ( ) ) == 1 ) { WsHasMemberResult wsHasMemberResult = wsHasMemberResults . getResults ( ) [ 0 ] ; return StringUtils . equals ( "IS_MEMBER" , wsHasMemberResult . getResultMetadata ( ) . getResultCode ( ) ) ; } return false ; |
public class AlpineQueryManager { /** * Updates a EventServiceLog .
* @ param eventServiceLog the EventServiceLog to update
* @ return an updated EventServiceLog */
public EventServiceLog updateEventServiceLog ( EventServiceLog eventServiceLog ) { } } | if ( eventServiceLog != null ) { final EventServiceLog log = getObjectById ( EventServiceLog . class , eventServiceLog . getId ( ) ) ; if ( log != null ) { pm . currentTransaction ( ) . begin ( ) ; log . setCompleted ( new Timestamp ( new Date ( ) . getTime ( ) ) ) ; pm . currentTransaction ( ) . commit ( ) ; return pm . getObjectById ( EventServiceLog . class , log . getId ( ) ) ; } } return null ; |
public class JdbcClient { /** * GetJob helper - String predicates are all created the same way , so this factors some code . */
private String getStringPredicate ( String fieldName , List < String > filterValues , List < Object > prms ) { } } | if ( filterValues != null && ! filterValues . isEmpty ( ) ) { String res = "" ; for ( String filterValue : filterValues ) { if ( filterValue == null ) { continue ; } if ( ! filterValue . isEmpty ( ) ) { prms . add ( filterValue ) ; if ( filterValue . contains ( "%" ) ) { res += String . format ( "(%s LIKE ?) OR " , fieldName ) ; } else { res += String . format ( "(%s = ?) OR " , fieldName ) ; } } else { res += String . format ( "(%s IS NULL OR %s = '') OR " , fieldName , fieldName ) ; } } if ( ! res . isEmpty ( ) ) { res = "AND (" + res . substring ( 0 , res . length ( ) - 4 ) + ") " ; return res ; } } return "" ; |
public class RedirectFilter { /** * Computes the URI where the request need to be transferred .
* @ param request the request
* @ return the URI
* @ throws java . net . URISyntaxException if the URI cannot be computed */
public URI rewriteURI ( Request request ) throws URISyntaxException { } } | String path = request . path ( ) ; if ( ! path . startsWith ( prefix ) ) { return null ; } StringBuilder uri = new StringBuilder ( redirectTo ) ; if ( redirectTo . endsWith ( "/" ) ) { uri . setLength ( uri . length ( ) - 1 ) ; } String rest = path . substring ( prefix . length ( ) ) ; if ( ! rest . startsWith ( "/" ) && ! rest . isEmpty ( ) ) { uri . append ( "/" ) ; } uri . append ( rest ) ; // Do we have a query String
int index = request . uri ( ) . indexOf ( "?" ) ; String query = null ; if ( index != - 1 ) { // Remove the ?
query = request . uri ( ) . substring ( index + 1 ) ; } if ( ! Strings . isNullOrEmpty ( query ) ) { uri . append ( "?" ) . append ( query ) ; } return URI . create ( uri . toString ( ) ) . normalize ( ) ; |
public class MutableBkTree { /** * Adds all of the given elements to this tree .
* @ param elements elements */
@ SafeVarargs public final void addAll ( E ... elements ) { } } | if ( elements == null ) throw new NullPointerException ( ) ; addAll ( Arrays . asList ( elements ) ) ; |
public class XGBoostSetupTask { /** * Finds what nodes actually do carry some of data of a given Frame
* @ param fr frame to find nodes for
* @ return FrameNodes */
public static FrameNodes findFrameNodes ( Frame fr ) { } } | // Count on how many nodes the data resides
boolean [ ] nodesHoldingFrame = new boolean [ H2O . CLOUD . size ( ) ] ; Vec vec = fr . anyVec ( ) ; for ( int chunkNr = 0 ; chunkNr < vec . nChunks ( ) ; chunkNr ++ ) { int home = vec . chunkKey ( chunkNr ) . home_node ( ) . index ( ) ; if ( ! nodesHoldingFrame [ home ] ) nodesHoldingFrame [ home ] = true ; } return new FrameNodes ( fr , nodesHoldingFrame ) ; |
public class TopLevel { /** * Get the cached native error constructor from this scope with the
* given < code > type < / code > . Returns null if { @ link # cacheBuiltins ( ) } has not
* been called on this object .
* @ param type the native error type
* @ return the native error constructor */
BaseFunction getNativeErrorCtor ( NativeErrors type ) { } } | return errors != null ? errors . get ( type ) : null ; |
public class HttpChannelPool { /** * Returns an array whose index signifies { @ link SessionProtocol # ordinal ( ) } . Similar to { @ link EnumMap } . */
private static < T > T [ ] newEnumMap ( Class < ? > elementType , Function < SessionProtocol , T > factory , SessionProtocol ... allowedProtocols ) { } } | @ SuppressWarnings ( "unchecked" ) final T [ ] maps = ( T [ ] ) Array . newInstance ( elementType , SessionProtocol . values ( ) . length ) ; // Attempting to access the array with an unallowed protocol will trigger NPE ,
// which will help us find a bug .
for ( SessionProtocol p : allowedProtocols ) { maps [ p . ordinal ( ) ] = factory . apply ( p ) ; } return maps ; |
public class SimpleClickSupport { /** * Handler click event on item
* @ param targetView the view that trigger the click event , not the view respond the cell !
* @ param cell the corresponding cell
* @ param eventType click event type , defined by developer . */
public void onClick ( View targetView , BaseCell cell , int eventType ) { } } | if ( cell instanceof Cell ) { onClick ( targetView , ( Cell ) cell , eventType ) ; } else { onClick ( targetView , cell , eventType , null ) ; } |
public class ModelSerializer { /** * Write a model to an output stream
* @ param model the model to save
* @ param stream the output stream to write to
* @ param saveUpdater whether to save the updater for the model or not
* @ throws IOException */
public static void writeModel ( @ NonNull Model model , @ NonNull OutputStream stream , boolean saveUpdater ) throws IOException { } } | writeModel ( model , stream , saveUpdater , null ) ; |
public class BoxIteratorEnterpriseEvents { /** * Gets the next position in the event stream that you should request in order to get the next events .
* @ return next position in the event stream to request in order to get the next events . */
public Long getNextStreamPosition ( ) { } } | String longValue = getPropertyAsString ( FIELD_NEXT_STREAM_POSITION ) ; return Long . parseLong ( longValue . replace ( "\"" , "" ) ) ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EncodingSchemeIDESidUD createEncodingSchemeIDESidUDFromString ( EDataType eDataType , String initialValue ) { } } | EncodingSchemeIDESidUD result = EncodingSchemeIDESidUD . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class ZWaveWakeUpCommandClass { /** * { @ inheritDoc } */
@ Override public void handleApplicationCommandRequest ( SerialMessage serialMessage , int offset , int endpoint ) { } } | logger . trace ( "Handle Message Wake Up Request" ) ; logger . debug ( String . format ( "Received Wake Up Request for Node ID = %d" , this . getNode ( ) . getNodeId ( ) ) ) ; int command = serialMessage . getMessagePayloadByte ( offset ) ; switch ( command ) { case WAKE_UP_INTERVAL_SET : case WAKE_UP_INTERVAL_GET : case WAKE_UP_INTERVAL_CAPABILITIES_GET : case WAKE_UP_NO_MORE_INFORMATION : logger . warn ( String . format ( "Command 0x%02X not implemented." , command ) ) ; return ; case WAKE_UP_INTERVAL_REPORT : logger . trace ( "Process Wake Up Interval" ) ; // according to open - zwave : it seems that some devices send incorrect interval report messages . Don ' t know if they are spurious .
// if not we should advance the node stage .
if ( serialMessage . getMessagePayload ( ) . length < offset + 4 ) { logger . error ( "Unusual response: WAKE_UP_INTERVAL_REPORT with length = {}. Ignored." , serialMessage . getMessagePayload ( ) . length ) ; return ; } int targetNodeId = serialMessage . getMessagePayloadByte ( offset + 4 ) ; int receivedInterval = ( ( serialMessage . getMessagePayloadByte ( offset + 1 ) ) << 16 ) | ( ( serialMessage . getMessagePayloadByte ( offset + 2 ) ) << 8 ) | ( serialMessage . getMessagePayloadByte ( offset + 3 ) ) ; logger . debug ( String . format ( "Wake up interval report for nodeId = %d, value = %d seconds, targetNodeId = %d" , this . getNode ( ) . getNodeId ( ) , receivedInterval , targetNodeId ) ) ; if ( targetNodeId != this . getController ( ) . getOwnNodeId ( ) ) return ; this . interval = receivedInterval ; logger . debug ( "Wake up interval set for node {}" , this . getNode ( ) . getNodeId ( ) ) ; this . initializationComplete = true ; this . getNode ( ) . advanceNodeStage ( ) ; break ; case WAKE_UP_INTERVAL_CAPABILITIES_REPORT : logger . trace ( "Process Wake Up Interval Capabilities" ) ; this . minInterval = ( ( serialMessage . getMessagePayloadByte ( offset + 1 ) ) << 16 ) | ( ( serialMessage . getMessagePayloadByte ( offset + 2 ) ) << 8 ) | ( serialMessage . getMessagePayloadByte ( offset + 3 ) ) ; this . maxInterval = ( ( serialMessage . getMessagePayloadByte ( offset + 4 ) ) << 16 ) | ( ( serialMessage . getMessagePayloadByte ( offset + 5 ) ) << 8 ) | ( serialMessage . getMessagePayloadByte ( offset + 6 ) ) ; this . defaultInterval = ( ( serialMessage . getMessagePayloadByte ( offset + 7 ) ) << 16 ) | ( ( serialMessage . getMessagePayloadByte ( offset + 8 ) ) << 8 ) | ( serialMessage . getMessagePayloadByte ( offset + 9 ) ) ; this . intervalStep = ( ( serialMessage . getMessagePayloadByte ( offset + 10 ) ) << 16 ) | ( ( serialMessage . getMessagePayloadByte ( offset + 11 ) ) << 8 ) | ( serialMessage . getMessagePayloadByte ( offset + 12 ) ) ; logger . debug ( String . format ( "Wake up interval capabilities report for nodeId = %d" , this . getNode ( ) . getNodeId ( ) ) ) ; logger . debug ( String . format ( "Minimum interval = %d" , this . minInterval ) ) ; logger . debug ( String . format ( "Maximum interval = %d" , this . maxInterval ) ) ; logger . debug ( String . format ( "Default interval = %d" , this . defaultInterval ) ) ; logger . debug ( String . format ( "Interval step = %d" , this . intervalStep ) ) ; this . initializationComplete = true ; this . getNode ( ) . advanceNodeStage ( ) ; break ; case WAKE_UP_NOTIFICATION : logger . trace ( "Process Wake Up Notification" ) ; logger . debug ( "Node {} is awake" , this . getNode ( ) . getNodeId ( ) ) ; this . setAwake ( true ) ; serialMessage . setTransActionCanceled ( true ) ; // if this node has not gone through it ' s query stages yet , finish it .
if ( this . getNode ( ) . getNodeStage ( ) != NodeStage . NODEBUILDINFO_DONE && ! this . initializationComplete ) { logger . info ( "Got Wake Up Notification from node {}, continuing initialization." , this . getNode ( ) . getNodeId ( ) ) ; this . getNode ( ) . setNodeStage ( NodeStage . NODEBUILDINFO_WAKEUP ) ; this . getNode ( ) . advanceNodeStage ( ) ; return ; } logger . debug ( "Sending {} messages from the wake-up queue of node {}" , this . wakeUpQueue . size ( ) , this . getNode ( ) . getNodeId ( ) ) ; // reset node stage , apparently we woke up again .
this . getNode ( ) . setNodeStage ( NodeStage . NODEBUILDINFO_DONE ) ; // handle all messages in the wake - up queue for this node .
while ( ! this . wakeUpQueue . isEmpty ( ) ) { serialMessage = this . wakeUpQueue . poll ( ) ; this . getController ( ) . sendData ( serialMessage ) ; } // no more information . Go back to sleep .
logger . trace ( "No more messages, go back to sleep node {}" , this . getNode ( ) . getNodeId ( ) ) ; this . getController ( ) . sendData ( this . getNoMoreInformationMessage ( ) ) ; break ; default : logger . warn ( String . format ( "Unsupported Command 0x%02X for command class %s (0x%02X)." , command , this . getCommandClass ( ) . getLabel ( ) , this . getCommandClass ( ) . getKey ( ) ) ) ; } |
public class HelloSignClient { /** * Retrieves the PDF file backing the Template specified by the provided
* Template ID .
* @ param templateId String Template ID
* @ return File PDF file object
* @ throws HelloSignException thrown if there ' s a problem processing the
* HTTP request or the JSON response . */
public File getTemplateFile ( String templateId ) throws HelloSignException { } } | String url = BASE_URI + TEMPLATE_FILE_URI + "/" + templateId ; String fileName = TEMPLATE_FILE_NAME + "." + TEMPLATE_FILE_EXT ; return httpClient . withAuth ( auth ) . get ( url ) . asFile ( fileName ) ; |
public class Bankverbindung { /** * Liefert die einzelnen Attribute einer Bankverbindung als Map .
* @ return Attribute als Map */
@ Override public Map < String , Object > toMap ( ) { } } | Map < String , Object > map = new HashMap < > ( ) ; map . put ( "kontoinhaber" , getKontoinhaber ( ) ) ; map . put ( "iban" , getIban ( ) ) ; getBic ( ) . ifPresent ( b -> map . put ( "bic" , b ) ) ; return map ; |
public class AbstractTagLibrary { /** * Add a ValidateHandler for the specified validatorId
* @ see javax . faces . view . facelets . ValidatorHandler
* @ see javax . faces . application . Application # createValidator ( java . lang . String )
* @ param name
* name to use , " foo " would be & lt ; my : foo / >
* @ param validatorId
* id to pass to Application instance */
protected final void addValidator ( String name , String validatorId ) { } } | _factories . put ( name , new ValidatorHandlerFactory ( validatorId ) ) ; |
public class ManagementProtocolHeader { /** * Validate the header signature .
* @ param input The input to read the signature from
* @ throws IOException If any read problems occur */
protected static void validateSignature ( final DataInput input ) throws IOException { } } | final byte [ ] signatureBytes = new byte [ 4 ] ; input . readFully ( signatureBytes ) ; if ( ! Arrays . equals ( ManagementProtocol . SIGNATURE , signatureBytes ) ) { throw ProtocolLogger . ROOT_LOGGER . invalidSignature ( Arrays . toString ( signatureBytes ) ) ; } |
public class StorageDir { /** * Removes a block from this storage dir .
* @ param blockMeta the metadata of the block
* @ throws BlockDoesNotExistException if no block is found */
public void removeBlockMeta ( BlockMeta blockMeta ) throws BlockDoesNotExistException { } } | Preconditions . checkNotNull ( blockMeta , "blockMeta" ) ; long blockId = blockMeta . getBlockId ( ) ; BlockMeta deletedBlockMeta = mBlockIdToBlockMap . remove ( blockId ) ; if ( deletedBlockMeta == null ) { throw new BlockDoesNotExistException ( ExceptionMessage . BLOCK_META_NOT_FOUND , blockId ) ; } reclaimSpace ( blockMeta . getBlockSize ( ) , true ) ; |
public class WebSiteManagementClientImpl { /** * Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules .
* Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules .
* @ param parameters VNET information
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the VnetValidationFailureDetailsInner object */
public Observable < VnetValidationFailureDetailsInner > verifyHostingEnvironmentVnetAsync ( VnetParameters parameters ) { } } | return verifyHostingEnvironmentVnetWithServiceResponseAsync ( parameters ) . map ( new Func1 < ServiceResponse < VnetValidationFailureDetailsInner > , VnetValidationFailureDetailsInner > ( ) { @ Override public VnetValidationFailureDetailsInner call ( ServiceResponse < VnetValidationFailureDetailsInner > response ) { return response . body ( ) ; } } ) ; |
public class CommsByteBuffer { /** * Reads some message handles from the buffer .
* @ return Returns a array of SIMessageHandle objects */
public synchronized SIMessageHandle [ ] getSIMessageHandles ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getSIMessageHandles" ) ; int arrayCount = getInt ( ) ; // BIT32 ArrayCount
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "arrayCount" , arrayCount ) ; SIMessageHandle [ ] msgHandles = new SIMessageHandle [ arrayCount ] ; JsMessageHandleFactory jsMsgHandleFactory = JsMessageHandleFactory . getInstance ( ) ; // Get arrayCount SIMessageHandles
for ( int msgHandleIndex = 0 ; msgHandleIndex < msgHandles . length ; ++ msgHandleIndex ) { long msgHandleValue = getLong ( ) ; byte [ ] msgHandleUuid = get ( 8 ) ; msgHandles [ msgHandleIndex ] = jsMsgHandleFactory . createJsMessageHandle ( new SIBUuid8 ( msgHandleUuid ) , msgHandleValue ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getSIMessageHandles" , msgHandles ) ; return msgHandles ; |
public class StructureTools { /** * Returns the set of intra - chain contacts for the given chain for all non - H
* atoms of non - hetatoms , i . e . the contact map . Uses a geometric hashing
* algorithm that speeds up the calculation without need of full distance
* matrix . The parsing mode
* { @ link FileParsingParameters # setAlignSeqRes ( boolean ) } needs to be set to
* true for this to work .
* @ param chain
* @ param cutoff
* @ return */
public static AtomContactSet getAtomsInContact ( Chain chain , double cutoff ) { } } | return getAtomsInContact ( chain , ( String [ ] ) null , cutoff ) ; |
public class CmsHtmlImport { /** * Imports all resources from the real file system , stores them into the correct locations
* in the OpenCms VFS and modifies all links . This method is called form the JSP to start the
* import process . < p >
* @ param report StringBuffer for reporting
* @ throws Exception if something goes wrong */
public void startImport ( I_CmsReport report ) throws Exception { } } | try { m_report = report ; m_report . println ( Messages . get ( ) . container ( Messages . RPT_HTML_IMPORT_BEGIN_0 ) , I_CmsReport . FORMAT_HEADLINE ) ; boolean isStream = ! CmsStringUtil . isEmptyOrWhitespaceOnly ( m_httpDir ) ; File streamFolder = null ; if ( isStream ) { // the input is starting through the HTTP upload
streamFolder = unzipStream ( ) ; m_inputDir = streamFolder . getAbsolutePath ( ) ; } // first build the index of all resources
buildIndex ( m_inputDir ) ; // build list with all parent resources of input directory for links to outside import folder
buildParentPath ( ) ; // copy and parse all HTML files first . during the copy process we will collect all
// required data for downloads and images
copyHtmlFiles ( m_inputDir ) ; // now copy the other files
copyOtherFiles ( m_inputDir ) ; // finally create all the external links
createExternalLinks ( ) ; if ( isStream && ( streamFolder != null ) ) { m_report . println ( Messages . get ( ) . container ( Messages . RPT_HTML_DELETE_0 ) , I_CmsReport . FORMAT_NOTE ) ; // delete the files of the zip file
CmsFileUtil . purgeDirectory ( streamFolder ) ; // deletes the zip file
File file = new File ( m_httpDir ) ; if ( file . exists ( ) && file . canWrite ( ) ) { file . delete ( ) ; } } m_report . println ( Messages . get ( ) . container ( Messages . RPT_HTML_IMPORT_END_0 ) , I_CmsReport . FORMAT_HEADLINE ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } |
public class Cron4jNow { @ Override public OptionalThing < Cron4jJob > findJobByKey ( LaJobKey jobKey ) { } } | assertArgumentNotNull ( "jobKey" , jobKey ) ; final Cron4jJob found = jobKeyJobMap . get ( jobKey ) ; return OptionalThing . ofNullable ( found , ( ) -> { String msg = "Not found the job by the key: " + jobKey + " existing=" + jobKeyJobMap . keySet ( ) ; throw new JobNotFoundException ( msg ) ; } ) ; |
public class HijriCalendar { /** * / * [ deutsch ]
* < p > Subtrahiert die angegebenen Zeiteinheiten von dieser Instanz . < / p >
* @ param amount amount to be subtracted ( maybe negative )
* @ param unit calendrical unit
* @ return result of subtraction as changed copy , this instance remains unaffected
* @ throws ArithmeticException in case of numerical overflow
* @ since 3.14/4.10 */
public HijriCalendar minus ( int amount , Unit unit ) { } } | return this . plus ( MathUtils . safeNegate ( amount ) , unit ) ; |
public class CancelSpotFleetRequestsRequest { /** * The IDs of the Spot Fleet requests .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setSpotFleetRequestIds ( java . util . Collection ) } or { @ link # withSpotFleetRequestIds ( java . util . Collection ) }
* if you want to override the existing values .
* @ param spotFleetRequestIds
* The IDs of the Spot Fleet requests .
* @ return Returns a reference to this object so that method calls can be chained together . */
public CancelSpotFleetRequestsRequest withSpotFleetRequestIds ( String ... spotFleetRequestIds ) { } } | if ( this . spotFleetRequestIds == null ) { setSpotFleetRequestIds ( new com . amazonaws . internal . SdkInternalList < String > ( spotFleetRequestIds . length ) ) ; } for ( String ele : spotFleetRequestIds ) { this . spotFleetRequestIds . add ( ele ) ; } return this ; |
public class GetCampaignsWithAwql { /** * Runs the example .
* @ param adWordsServices the services factory .
* @ param session the session .
* @ throws ApiException if the API request failed with one or more service errors .
* @ throws RemoteException if the API request failed due to other errors . */
public static void runExample ( AdWordsServicesInterface adWordsServices , AdWordsSession session ) throws RemoteException { } } | // Get the CampaignService .
CampaignServiceInterface campaignService = adWordsServices . get ( session , CampaignServiceInterface . class ) ; ServiceQuery serviceQuery = new ServiceQuery . Builder ( ) . fields ( CampaignField . Id , CampaignField . Name , CampaignField . Status ) . orderBy ( CampaignField . Name ) . limit ( 0 , PAGE_SIZE ) . build ( ) ; CampaignPage page = null ; do { serviceQuery . nextPage ( page ) ; // Get all campaigns .
page = campaignService . query ( serviceQuery . toString ( ) ) ; // Display campaigns .
if ( page . getEntries ( ) != null ) { for ( Campaign campaign : page . getEntries ( ) ) { System . out . printf ( "Campaign with name '%s' and ID %d was found.%n" , campaign . getName ( ) , campaign . getId ( ) ) ; } } else { System . out . println ( "No campaigns were found." ) ; } } while ( serviceQuery . hasNext ( page ) ) ; |
public class SubscriptionManager { /** * Note : never returns null ! */
public Collection < Subscription > getSubscriptionsByMessageType ( Class messageType ) { } } | Set < Subscription > subscriptions = new TreeSet < Subscription > ( Subscription . SubscriptionByPriorityDesc ) ; ReadLock readLock = readWriteLock . readLock ( ) ; try { readLock . lock ( ) ; Subscription subscription ; ArrayList < Subscription > subsPerMessage = subscriptionsPerMessage . get ( messageType ) ; if ( subsPerMessage != null ) { subscriptions . addAll ( subsPerMessage ) ; } Class [ ] types = ReflectionUtils . getSuperTypes ( messageType ) ; for ( int i = 0 , n = types . length ; i < n ; i ++ ) { Class eventSuperType = types [ i ] ; ArrayList < Subscription > subs = subscriptionsPerMessage . get ( eventSuperType ) ; if ( subs != null ) { for ( int j = 0 , m = subs . size ( ) ; j < m ; j ++ ) { subscription = subs . get ( j ) ; if ( subscription . handlesMessageType ( messageType ) ) { subscriptions . add ( subscription ) ; } } } } } finally { readLock . unlock ( ) ; } return subscriptions ; |
public class LimitAsyncOperations { /** * Same as getLastPendingOperation but never return null ( return an unblocked synchronization point instead ) . */
public ISynchronizationPoint < OutputErrorType > flush ( ) { } } | SynchronizationPoint < OutputErrorType > sp = new SynchronizationPoint < > ( ) ; Runnable callback = new Runnable ( ) { @ Override public void run ( ) { AsyncWork < OutputResultType , OutputErrorType > last = null ; synchronized ( waiting ) { if ( error != null ) sp . error ( error ) ; else if ( cancelled != null ) sp . cancel ( cancelled ) ; else if ( isReady ) sp . unblock ( ) ; else last = lastWrite ; } if ( last != null ) last . listenInline ( this ) ; } } ; callback . run ( ) ; return sp ; |
public class FluentMatchingR { /** * Sets a { @ link Function } to be run if no match is found . */
public FluentMatchingR < T , R > orElse ( Function < T , R > function ) { } } | patterns . add ( Pattern . of ( t -> true , function :: apply ) ) ; return this ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcAxis1Placement ( ) { } } | if ( ifcAxis1PlacementEClass == null ) { ifcAxis1PlacementEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 31 ) ; } return ifcAxis1PlacementEClass ; |
public class CollectionExtensions { /** * Adds all of the specified elements to the specified collection .
* @ param collection
* the collection into which the { @ code elements } are to be inserted . May not be < code > null < / code > .
* @ param elements
* the elements to insert into the { @ code collection } . May not be < code > null < / code > but may contain
* < code > null < / code > entries if the { @ code collection } allows that .
* @ return < code > true < / code > if the collection changed as a result of the call */
@ SafeVarargs public static < T > boolean addAll ( Collection < ? super T > collection , T ... elements ) { } } | return collection . addAll ( Arrays . asList ( elements ) ) ; |
public class MPEGAudioFrameHeader { /** * Read in all the information found in the mpeg header .
* @ param location the location of the header ( found by findFrame )
* @ exception FileNotFoundException if an error occurs
* @ exception IOException if an error occurs */
private void readHeader ( RandomAccessInputStream raf , long location ) throws IOException { } } | byte [ ] head = new byte [ HEADER_SIZE ] ; raf . seek ( location ) ; if ( raf . read ( head ) != HEADER_SIZE ) { throw new IOException ( "Error reading MPEG frame header." ) ; } version = ( head [ 1 ] & 0x18 ) >> 3 ; layer = ( head [ 1 ] & 0x06 ) >> 1 ; crced = ( head [ 1 ] & 0x01 ) == 0 ; bitRate = findBitRate ( ( head [ 2 ] & 0xF0 ) >> 4 , version , layer ) ; sampleRate = findSampleRate ( ( head [ 2 ] & 0x0C ) >> 2 , version ) ; channelMode = ( head [ 3 ] & 0xC0 ) >> 6 ; copyrighted = ( head [ 3 ] & 0x08 ) != 0 ; original = ( head [ 3 ] & 0x04 ) != 0 ; emphasis = head [ 3 ] & 0x03 ; |
public class AWSFMSClient { /** * Disassociates the account that has been set as the AWS Firewall Manager administrator account . To set a different
* account as the administrator account , you must submit an < code > AssociateAdminAccount < / code > request .
* @ param disassociateAdminAccountRequest
* @ return Result of the DisassociateAdminAccount operation returned by the service .
* @ throws InvalidOperationException
* The operation failed because there was nothing to do . For example , you might have submitted an
* < code > AssociateAdminAccount < / code > request , but the account ID that you submitted was already set as the
* AWS Firewall Manager administrator .
* @ throws ResourceNotFoundException
* The specified resource was not found .
* @ throws InternalErrorException
* The operation failed because of a system problem , even though the request was valid . Retry your request .
* @ sample AWSFMS . DisassociateAdminAccount
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / fms - 2018-01-01 / DisassociateAdminAccount " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public DisassociateAdminAccountResult disassociateAdminAccount ( DisassociateAdminAccountRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDisassociateAdminAccount ( request ) ; |
public class VomsProxyDestroy { /** * Get option values from a { @ link CommandLine } object to build a
* { @ link ProxyDestroyParams } object containing the parameters for
* voms - proxy - destroy .
* @ param commandLine
* @ return the parameters for the { @ link VomsProxyDestroy } command */
private ProxyDestroyParams getProxyDestroyParamsFromCommandLine ( CommandLine commandLine ) { } } | ProxyDestroyParams params = new ProxyDestroyParams ( ) ; if ( commandLineHasOption ( ProxyDestroyOptions . DRY ) ) { params . setDryRun ( true ) ; } if ( commandLineHasOption ( ProxyDestroyOptions . FILE ) ) { params . setProxyFile ( getOptionValue ( ProxyDestroyOptions . FILE ) ) ; } return params ; |
public class LWJGFont { /** * Draws the text given by the specified string , using this font instance ' s current color . < br >
* Note that the specified destination coordinates is a left point of the rendered string ' s baseline .
* @ param text the string to be drawn .
* @ param dstX the x coordinate to render the string .
* @ param dstY the y coordinate to render the string .
* @ param dstZ the z coordinate to render the string .
* @ throws IOException Indicates a failure to read font images as textures . */
public final void drawString ( String text , float dstX , float dstY , float dstZ ) throws IOException { } } | DrawPoint drawPoint = new DrawPoint ( dstX , dstY , dstZ ) ; MappedCharacter character ; if ( ! LwjgFontUtil . isEmpty ( text ) ) { for ( int i = 0 ; i < text . length ( ) ; i ++ ) { char ch = text . charAt ( i ) ; if ( ch == LineFeed . getCharacter ( ) ) { // LF は改行扱いにする
drawPoint . dstX = dstX ; drawPoint . dstY -= getLineHeight ( ) ; continue ; } else if ( ch == CarriageReturn . getCharacter ( ) ) { // CR は無視する
continue ; } character = retreiveCharacter ( ch ) ; drawCharacter ( drawPoint , character ) ; } } |
public class DoubleConstantRange { /** * Range operations . */
@ Override public boolean isOverlapping ( ConstantRange r ) { } } | if ( ! ( r instanceof DoubleConstantRange ) ) throw new IllegalArgumentException ( ) ; if ( ! isValid ( ) || ! r . isValid ( ) ) return false ; DoubleConstantRange dr = ( DoubleConstantRange ) r ; DoubleConstant rh = dr . high ; boolean rhi = dr . highIncl ; if ( ! low . equals ( NEG_INF ) && ( ( lowIncl && ( ( rhi && rh . compareTo ( low ) < 0 ) || ( ! rhi && rh . compareTo ( low ) <= 0 ) ) ) || ( ! lowIncl && rh . compareTo ( low ) <= 0 ) ) ) return false ; DoubleConstant rl = dr . low ; boolean rli = dr . lowIncl ; if ( ! high . equals ( INF ) && ( ( highIncl && ( ( rli && rl . compareTo ( high ) > 0 ) || ( ! rli && rl . compareTo ( high ) >= 0 ) ) ) || ( ! highIncl && rl . compareTo ( high ) >= 0 ) ) ) return false ; return true ; |
public class JDBCCallableStatement { /** * # ifdef JAVA6 */
public synchronized void setClob ( String parameterName , Clob x ) throws SQLException { } } | super . setClob ( findParameterIndex ( parameterName ) , x ) ; |
public class XmlRepositoryFactory { /** * Package private function used by { @ link XmlInputOutputHandler } to retrieve query string from repository
* @ param inputHandler Xml input / output handler
* @ return override values ( if present )
* @ throws MjdbcRuntimeException if query name wasn ' t loaded to repository */
static Overrider getOverride ( AbstractXmlInputOutputHandler inputHandler ) { } } | AssertUtils . assertNotNull ( inputHandler ) ; Overrider result = null ; if ( xmlOverrideMap . containsKey ( inputHandler . getName ( ) ) == false ) { throw new MjdbcRuntimeException ( "Failed to find query by name: " + inputHandler . getName ( ) + ". Please ensure that relevant file was loaded into repository" ) ; } result = xmlOverrideMap . get ( inputHandler . getName ( ) ) ; return result ; |
public class SVG { /** * Returns the viewBox attribute of the current SVG document .
* @ return the document ' s viewBox attribute as a { @ code android . graphics . RectF } object , or null if not set .
* @ throws IllegalArgumentException if there is no current SVG document loaded . */
@ SuppressWarnings ( { } } | "WeakerAccess" , "unused" } ) public RectF getDocumentViewBox ( ) { if ( this . rootElement == null ) throw new IllegalArgumentException ( "SVG document is empty" ) ; if ( this . rootElement . viewBox == null ) return null ; return this . rootElement . viewBox . toRectF ( ) ; |
public class OWLObjectSomeValuesFromImpl_CustomFieldSerializer { /** * Serializes the content of the object into the
* { @ link com . google . gwt . user . client . rpc . SerializationStreamWriter } .
* @ param streamWriter the { @ link com . google . gwt . user . client . rpc . SerializationStreamWriter } to write the
* object ' s content to
* @ param instance the object instance to serialize
* @ throws com . google . gwt . user . client . rpc . SerializationException
* if the serialization operation is not
* successful */
@ Override public void serializeInstance ( SerializationStreamWriter streamWriter , OWLObjectSomeValuesFromImpl instance ) throws SerializationException { } } | serialize ( streamWriter , instance ) ; |
public class PolynomialOps { /** * TODO try using a linear search alg here */
public static double refineRoot ( Polynomial poly , double root , int maxIterations ) { } } | // for ( int i = 0 ; i < maxIterations ; i + + ) {
// double v = poly . c [ poly . size - 1 ] ;
// double d = v * ( poly . size - 1 ) ;
// for ( int j = poly . size - 1 ; j > 0 ; j - - ) {
// v = poly . c [ j ] + v * root ;
// d = poly . c [ j ] * j + d * root ;
// v = poly . c [ 0 ] + v * root ;
// if ( d = = 0 )
// return root ;
// root - = v / d ;
// return root ;
Polynomial deriv = new Polynomial ( poly . size ( ) ) ; derivative ( poly , deriv ) ; for ( int i = 0 ; i < maxIterations ; i ++ ) { double v = poly . evaluate ( root ) ; double d = deriv . evaluate ( root ) ; if ( d == 0 ) return root ; root -= v / d ; } return root ; |
public class SoyExpression { /** * Unboxes this to a { @ link SoyExpression } with a List runtime type .
* < p > This method is appropriate when you know ( likely via inspection of the { @ link # soyType ( ) } ,
* or other means ) that the value does have the appropriate type but you prefer to interact with
* it as its unboxed representation . */
public SoyExpression unboxAsList ( ) { } } | if ( alreadyUnboxed ( List . class ) ) { return this ; } assertBoxed ( List . class ) ; Expression unboxedList ; if ( delegate . isNonNullable ( ) ) { unboxedList = delegate . checkedCast ( SOY_LIST_TYPE ) . invoke ( MethodRef . SOY_LIST_AS_JAVA_LIST ) ; } else { unboxedList = new Expression ( BytecodeUtils . LIST_TYPE , features ( ) ) { @ Override protected void doGen ( CodeBuilder adapter ) { Label end = new Label ( ) ; delegate . gen ( adapter ) ; BytecodeUtils . nullCoalesce ( adapter , end ) ; adapter . checkCast ( SOY_LIST_TYPE ) ; MethodRef . SOY_LIST_AS_JAVA_LIST . invokeUnchecked ( adapter ) ; adapter . mark ( end ) ; } ; } ; } ListType asListType ; if ( soyType ( ) . getKind ( ) != Kind . NULL && soyRuntimeType . asNonNullable ( ) . isKnownListOrUnionOfLists ( ) ) { asListType = soyRuntimeType . asNonNullable ( ) . asListType ( ) ; } else { Kind kind = soyType ( ) . getKind ( ) ; if ( kind == Kind . UNKNOWN || kind == Kind . NULL ) { asListType = ListType . of ( UnknownType . getInstance ( ) ) ; } else { // The type checker should have already rejected all of these
throw new UnsupportedOperationException ( "Can't convert " + soyRuntimeType + " to List" ) ; } } return forList ( asListType , unboxedList ) ; |
public class WebsocketClientEndpoint { /** * Close the connection */
@ Override public void close ( ) { } } | if ( userSession == null ) { return ; } try { final CloseReason closeReason = new CloseReason ( CloseCodes . NORMAL_CLOSURE , "Socket closed" ) ; userSession . close ( closeReason ) ; } catch ( Throwable e ) { logger . error ( "Got exception while closing socket" , e ) ; } userSession = null ; |
public class ByteUtil { /** * Returns the index ( start position ) of the first occurrence of the specified
* { @ code target } within { @ code array } starting at { @ code fromIndex } , or
* { @ code - 1 } if there is no such occurrence .
* Returns the lowest index { @ code k } such that { @ code k > = fromIndex } and
* { @ code java . util . Arrays . copyOfRange ( array , k , k + target . length ) } contains
* exactly the same elements as { @ code target } .
* @ param array
* the array to search for the sequence { @ code target }
* @ param target
* the array to search for as a sub - sequence of { @ code array }
* @ param fromIndex
* the index to start the search from in { @ code array } */
public static int indexOf ( byte [ ] array , byte [ ] target , int fromIndex ) { } } | if ( array == null || target == null ) { return - 1 ; } // Target cannot be beyond array boundaries
if ( fromIndex < 0 || ( fromIndex > ( array . length - target . length ) ) ) { return - 1 ; } // Empty is assumed to be at the fromIndex of any non - null array ( after
// boundary check )
if ( target . length == 0 ) { return fromIndex ; } firstbyte : for ( int i = fromIndex ; i < array . length - target . length + 1 ; i ++ ) { for ( int j = 0 ; j < target . length ; j ++ ) { if ( array [ i + j ] != target [ j ] ) { continue firstbyte ; } } return i ; } return - 1 ; |
public class AbstractSingleton { /** * Implementation of { @ link IScopeDestructionAware } . Calls the protected
* { @ link # onDestroy ( ) } method . */
@ Override public final void onScopeDestruction ( @ Nonnull final IScope aScopeInDestruction ) throws Exception { } } | if ( LOGGER . isDebugEnabled ( ) ) LOGGER . debug ( "onScopeDestruction for '" + toString ( ) + "' in scope " + aScopeInDestruction . toString ( ) ) ; // Check init state
if ( isInInstantiation ( ) ) { if ( LOGGER . isWarnEnabled ( ) ) LOGGER . warn ( "Object currently in instantiation is now destroyed: " + toString ( ) ) ; } else if ( ! isInstantiated ( ) ) { if ( LOGGER . isWarnEnabled ( ) ) LOGGER . warn ( "Object not instantiated is now destroyed: " + toString ( ) ) ; } // Check destruction state
if ( ! isInPreDestruction ( ) ) { if ( LOGGER . isErrorEnabled ( ) ) LOGGER . error ( "Object should be in pre destruction phase but is not: " + toString ( ) ) ; } if ( isInDestruction ( ) ) { if ( LOGGER . isErrorEnabled ( ) ) LOGGER . error ( "Object already in destruction is now destroyed again: " + toString ( ) ) ; } else if ( isDestroyed ( ) ) { if ( LOGGER . isErrorEnabled ( ) ) LOGGER . error ( "Object already destroyed is now destroyed again: " + toString ( ) ) ; } setInDestruction ( true ) ; // Set after destruction is set to true
setInPreDestruction ( false ) ; try { onDestroy ( aScopeInDestruction ) ; } finally { // Ensure scope is marked as " destroyed "
setDestroyed ( true ) ; // Ensure field is reset even in case of an exception
setInDestruction ( false ) ; } |
public class RepositoryCreationSynchronizer { /** * Make the current node wait until being released by the coordinator */
private void waitForCoordinator ( ) { } } | LOG . info ( "Waiting to be released by the coordinator" ) ; try { lock . await ( ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; } |
public class Fields { /** * < p > Filters the { @ link Field } s which are annotated with < b > all < / b > the given annotations and returns
* a new instance of { @ link Fields } that wrap the filtered collection . < / p >
* @ param annotation
* the { @ link Field } s annotated with < b > all < / b > these types will be filtered
* < br > < br >
* @ return a < b > new instance < / b > of { @ link Fields } which wraps the filtered { @ link Field } s
* < br > < br >
* @ since 1.3.0 */
public Fields annotatedWithAll ( final Class < ? extends Annotation > ... annotations ) { } } | assertNotNull ( annotations , Class [ ] . class ) ; return new Fields ( filter ( new Criterion ( ) { @ Override public boolean evaluate ( Field field ) { boolean hasAllAnnotations = true ; for ( Class < ? extends Annotation > annotation : annotations ) { if ( ! field . isAnnotationPresent ( annotation ) ) { hasAllAnnotations = false ; break ; } } return hasAllAnnotations ; } } ) ) ; |
public class CollectionItemMatcher { /** * { @ inheritDoc } */
public boolean matches ( Iterable < ? extends T > target ) { } } | for ( T value : target ) { if ( matcher . matches ( value ) ) { return true ; } } return false ; |
public class Response { /** * Returns the json content from http response
* @ return
* @ throws ConnectionException */
public String getContent ( ) throws ConnectionException { } } | logger . debug ( "Enter Response::getContent" ) ; if ( content != null ) { logger . debug ( "content already available " ) ; return content ; } BufferedReader rd = new BufferedReader ( new InputStreamReader ( stream ) ) ; StringBuffer result = new StringBuffer ( ) ; String line = "" ; try { while ( ( line = rd . readLine ( ) ) != null ) { result . append ( line ) ; } } catch ( IOException e ) { logger . error ( "Exception while retrieving content" , e ) ; throw new ConnectionException ( e . getMessage ( ) ) ; } content = result . toString ( ) ; logger . debug ( "End Response::getContent" ) ; return content ; |
public class PUInfoImpl { /** * Private method that takes a list of InMemoryMappingFiles and copies them by assigning a new
* id while sharing the same underlying byte array . This method avoids unnecessarily create
* identical byte arrays . Once all references to a byte array are deleted , the garbage
* collector will cleanup the byte array . */
private List < InMemoryMappingFile > copyInMemoryMappingFiles ( List < InMemoryMappingFile > copyIMMF ) { } } | List < InMemoryMappingFile > immf = new ArrayList < InMemoryMappingFile > ( ) ; for ( InMemoryMappingFile file : copyIMMF ) { immf . add ( new InMemoryMappingFile ( file . getMappingFile ( ) ) ) ; } return immf ; |
public class AbstractMaterialDialogBuilder { /** * Obtains the title color from a specific theme .
* @ param themeResourceId
* The resource id of the theme , the title color should be obtained from , as an { @ link
* Integer } value */
private void obtainTitleColor ( @ StyleRes final int themeResourceId ) { } } | TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogTitleColor } ) ; int defaultColor = ThemeUtil . getColor ( getContext ( ) , themeResourceId , android . R . attr . textColorPrimary ) ; setTitleColor ( typedArray . getColor ( 0 , defaultColor ) ) ; |
public class A_CmsSelectCell { /** * Adds a new event handler to the widget . < p >
* This method is used because we want the select box to register some event handlers on this widget ,
* but we can ' t use { @ link com . google . gwt . user . client . ui . Widget # addDomHandler } directly , since it ' s both protected
* and final .
* @ param < H > the event type
* @ param handler the new event handler
* @ param type the event type object
* @ return the HandlerRegistration for removing the event handler */
public < H extends EventHandler > HandlerRegistration registerDomHandler ( final H handler , DomEvent . Type < H > type ) { } } | return addDomHandler ( handler , type ) ; |
public class HeapAnotB { /** * Sketch A is either unordered compact or hash table */
private void scanAllAsearchB ( ) { } } | final long [ ] scanAArr = a_ . getCache ( ) ; final int arrLongsIn = scanAArr . length ; cache_ = new long [ arrLongsIn ] ; for ( int i = 0 ; i < arrLongsIn ; i ++ ) { final long hashIn = scanAArr [ i ] ; if ( ( hashIn <= 0L ) || ( hashIn >= thetaLong_ ) ) { continue ; } final int foundIdx = hashSearch ( bHashTable_ , lgArrLongsHT_ , hashIn ) ; if ( foundIdx > - 1 ) { continue ; } cache_ [ curCount_ ++ ] = hashIn ; } |
public class OWLAnnotationImpl_CustomFieldSerializer { /** * Deserializes the content of the object from the
* { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } .
* @ param streamReader the { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } to read the
* object ' s content from
* @ param instance the object instance to deserialize
* @ throws com . google . gwt . user . client . rpc . SerializationException
* if the deserialization operation is not
* successful */
@ Override public void deserializeInstance ( SerializationStreamReader streamReader , OWLAnnotationImpl instance ) throws SerializationException { } } | deserialize ( streamReader , instance ) ; |
public class StringUtils { /** * Escape slashes and / or commas in the given value .
* @ param value
* @ return */
String escapeValue ( String value ) { } } | int start = 0 ; int pos = getNextLocation ( start , value ) ; if ( pos == - 1 ) { return value ; } StringBuilder builder = new StringBuilder ( ) ; while ( pos != - 1 ) { builder . append ( value , start , pos ) ; builder . append ( '\\' ) ; builder . append ( value . charAt ( pos ) ) ; start = pos + 1 ; pos = getNextLocation ( start , value ) ; } builder . append ( value , start , value . length ( ) ) ; return builder . toString ( ) ; |
public class SourceStreamManager { /** * This method should only be called when the PtoPOutputHandler was created
* with an unknown targetCellule and WLM has now told us correct targetCellule .
* This can only happen when the SourceStreamManager is owned by a
* PtoPOutputHandler within a LinkHandler */
public synchronized void updateTargetCellule ( SIBUuid8 targetMEUuid ) throws SIResourceException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "updateTargetCellule" , targetMEUuid ) ; if ( pointTopoint ) { this . targetMEUuid = targetMEUuid ; StreamSet streamSet = getStreamSet ( ) ; // We may not have had any messages yet in which case there
// is no streamSet to update
if ( streamSet != null ) { // Update the cellule in the StreamSet
// and persist this
streamSet . updateCellule ( targetMEUuid ) ; Transaction tran = txManager . createAutoCommitTransaction ( ) ; try { streamSet . requestUpdate ( tran ) ; } catch ( MessageStoreException e ) { // MessageStoreException shouldn ' t occur so FFDC .
FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.gd.SourceStreamManager.updateTargetCellule" , "1:1384:1.102" , this ) ; SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "updateTargetCellule" , e ) ; throw new SIResourceException ( e ) ; } // iterate over the non - null streams
Iterator itr = streamSet . iterator ( ) ; while ( itr . hasNext ( ) ) { SourceStream stream = ( SourceStream ) itr . next ( ) ; stream . noGuessesInStream ( ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "updateTargetCellule" ) ; |
public class CUresult { /** * Returns the String identifying the given CUresult
* @ param result The CUresult value
* @ return The String identifying the given CUresult */
public static String stringFor ( int result ) { } } | switch ( result ) { case CUDA_SUCCESS : return "CUDA_SUCCESS" ; case CUDA_ERROR_INVALID_VALUE : return "CUDA_ERROR_INVALID_VALUE" ; case CUDA_ERROR_OUT_OF_MEMORY : return "CUDA_ERROR_OUT_OF_MEMORY" ; case CUDA_ERROR_NOT_INITIALIZED : return "CUDA_ERROR_NOT_INITIALIZED" ; case CUDA_ERROR_DEINITIALIZED : return "CUDA_ERROR_DEINITIALIZED" ; case CUDA_ERROR_PROFILER_DISABLED : return "CUDA_ERROR_PROFILER_DISABLED" ; case CUDA_ERROR_PROFILER_NOT_INITIALIZED : return "CUDA_ERROR_PROFILER_NOT_INITIALIZED" ; case CUDA_ERROR_PROFILER_ALREADY_STARTED : return "CUDA_ERROR_PROFILER_ALREADY_STARTED" ; case CUDA_ERROR_PROFILER_ALREADY_STOPPED : return "CUDA_ERROR_PROFILER_ALREADY_STOPPED" ; case CUDA_ERROR_NO_DEVICE : return "CUDA_ERROR_NO_DEVICE" ; case CUDA_ERROR_INVALID_DEVICE : return "CUDA_ERROR_INVALID_DEVICE" ; case CUDA_ERROR_INVALID_IMAGE : return "CUDA_ERROR_INVALID_IMAGE" ; case CUDA_ERROR_INVALID_CONTEXT : return "CUDA_ERROR_INVALID_CONTEXT" ; case CUDA_ERROR_CONTEXT_ALREADY_CURRENT : return "CUDA_ERROR_CONTEXT_ALREADY_CURRENT" ; case CUDA_ERROR_MAP_FAILED : return "CUDA_ERROR_MAP_FAILED" ; case CUDA_ERROR_UNMAP_FAILED : return "CUDA_ERROR_UNMAP_FAILED" ; case CUDA_ERROR_ARRAY_IS_MAPPED : return "CUDA_ERROR_ARRAY_IS_MAPPED" ; case CUDA_ERROR_ALREADY_MAPPED : return "CUDA_ERROR_ALREADY_MAPPED" ; case CUDA_ERROR_NO_BINARY_FOR_GPU : return "CUDA_ERROR_NO_BINARY_FOR_GPU" ; case CUDA_ERROR_ALREADY_ACQUIRED : return "CUDA_ERROR_ALREADY_ACQUIRED" ; case CUDA_ERROR_NOT_MAPPED : return "CUDA_ERROR_NOT_MAPPED" ; case CUDA_ERROR_NOT_MAPPED_AS_ARRAY : return "CUDA_ERROR_NOT_MAPPED_AS_ARRAY" ; case CUDA_ERROR_NOT_MAPPED_AS_POINTER : return "CUDA_ERROR_NOT_MAPPED_AS_POINTER" ; case CUDA_ERROR_ECC_UNCORRECTABLE : return "CUDA_ERROR_ECC_UNCORRECTABLE" ; case CUDA_ERROR_UNSUPPORTED_LIMIT : return "CUDA_ERROR_UNSUPPORTED_LIMIT" ; case CUDA_ERROR_CONTEXT_ALREADY_IN_USE : return "CUDA_ERROR_CONTEXT_ALREADY_IN_USE" ; case CUDA_ERROR_PEER_ACCESS_UNSUPPORTED : return "CUDA_ERROR_PEER_ACCESS_UNSUPPORTED" ; case CUDA_ERROR_INVALID_PTX : return "CUDA_ERROR_INVALID_PTX" ; case CUDA_ERROR_INVALID_GRAPHICS_CONTEXT : return "CUDA_ERROR_INVALID_GRAPHICS_CONTEXT" ; case CUDA_ERROR_NVLINK_UNCORRECTABLE : return "CUDA_ERROR_NVLINK_UNCORRECTABLE" ; case CUDA_ERROR_JIT_COMPILER_NOT_FOUND : return "CUDA_ERROR_JIT_COMPILER_NOT_FOUND" ; case CUDA_ERROR_INVALID_SOURCE : return "CUDA_ERROR_INVALID_SOURCE" ; case CUDA_ERROR_FILE_NOT_FOUND : return "CUDA_ERROR_FILE_NOT_FOUND" ; case CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND : return "CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND" ; case CUDA_ERROR_SHARED_OBJECT_INIT_FAILED : return "CUDA_ERROR_SHARED_OBJECT_INIT_FAILED" ; case CUDA_ERROR_OPERATING_SYSTEM : return "CUDA_ERROR_OPERATING_SYSTEM" ; case CUDA_ERROR_INVALID_HANDLE : return "CUDA_ERROR_INVALID_HANDLE" ; case CUDA_ERROR_ILLEGAL_STATE : return "CUDA_ERROR_ILLEGAL_STATE" ; case CUDA_ERROR_NOT_FOUND : return "CUDA_ERROR_NOT_FOUND" ; case CUDA_ERROR_NOT_READY : return "CUDA_ERROR_NOT_READY" ; case CUDA_ERROR_ILLEGAL_ADDRESS : return "CUDA_ERROR_ILLEGAL_ADDRESS" ; case CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES : return "CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES" ; case CUDA_ERROR_LAUNCH_TIMEOUT : return "CUDA_ERROR_LAUNCH_TIMEOUT" ; case CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING : return "CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING" ; case CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED : return "CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED" ; case CUDA_ERROR_PEER_ACCESS_NOT_ENABLED : return "CUDA_ERROR_PEER_ACCESS_NOT_ENABLED" ; case CUDA_ERROR_PEER_MEMORY_ALREADY_REGISTERED : return "CUDA_ERROR_PEER_MEMORY_ALREADY_REGISTERED" ; case CUDA_ERROR_PEER_MEMORY_NOT_REGISTERED : return "CUDA_ERROR_PEER_MEMORY_NOT_REGISTERED" ; case CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE : return "CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE" ; case CUDA_ERROR_CONTEXT_IS_DESTROYED : return "CUDA_ERROR_CONTEXT_IS_DESTROYED" ; case CUDA_ERROR_ASSERT : return "CUDA_ERROR_ASSERT" ; case CUDA_ERROR_TOO_MANY_PEERS : return "CUDA_ERROR_TOO_MANY_PEERS" ; case CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED : return "CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED" ; case CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED : return "CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED" ; case CUDA_ERROR_HARDWARE_STACK_ERROR : return "CUDA_ERROR_HARDWARE_STACK_ERROR" ; case CUDA_ERROR_ILLEGAL_INSTRUCTION : return "CUDA_ERROR_ILLEGAL_INSTRUCTION" ; case CUDA_ERROR_MISALIGNED_ADDRESS : return "CUDA_ERROR_MISALIGNED_ADDRESS" ; case CUDA_ERROR_INVALID_ADDRESS_SPACE : return "CUDA_ERROR_INVALID_ADDRESS_SPACE" ; case CUDA_ERROR_INVALID_PC : return "CUDA_ERROR_INVALID_PC" ; case CUDA_ERROR_LAUNCH_FAILED : return "CUDA_ERROR_LAUNCH_FAILED" ; case CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE : return "CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE" ; case CUDA_ERROR_NOT_PERMITTED : return "CUDA_ERROR_NOT_PERMITTED" ; case CUDA_ERROR_NOT_SUPPORTED : return "CUDA_ERROR_NOT_SUPPORTED" ; case CUDA_ERROR_SYSTEM_NOT_READY : return "CUDA_ERROR_SYSTEM_NOT_READY" ; case CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED : return "CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED" ; case CUDA_ERROR_STREAM_CAPTURE_INVALIDATED : return "CUDA_ERROR_STREAM_CAPTURE_INVALIDATED" ; case CUDA_ERROR_STREAM_CAPTURE_MERGE : return "CUDA_ERROR_STREAM_CAPTURE_MERGE" ; case CUDA_ERROR_STREAM_CAPTURE_UNMATCHED : return "CUDA_ERROR_STREAM_CAPTURE_UNMATCHED" ; case CUDA_ERROR_STREAM_CAPTURE_UNJOINED : return "CUDA_ERROR_STREAM_CAPTURE_UNJOINED" ; case CUDA_ERROR_STREAM_CAPTURE_ISOLATION : return "CUDA_ERROR_STREAM_CAPTURE_ISOLATION" ; case CUDA_ERROR_STREAM_CAPTURE_IMPLICIT : return "CUDA_ERROR_STREAM_CAPTURE_IMPLICIT" ; case CUDA_ERROR_CAPTURED_EVENT : return "CUDA_ERROR_CAPTURED_EVENT" ; case CUDA_ERROR_UNKNOWN : return "CUDA_ERROR_UNKNOWN" ; } return "INVALID CUresult: " + result ; |
public class A_CmsAttributeAwareApp { /** * Replaces the app ' s main component with the given component . < p >
* This also handles the attributes for the component , just as if the given component was returned by an app ' s
* getComponentForState method .
* @ param comp the component to set as the main component */
public void updateMainComponent ( Component comp ) { } } | comp . setSizeFull ( ) ; m_rootLayout . setMainContent ( comp ) ; Map < String , Object > attributes = getAttributesForComponent ( comp ) ; updateAppAttributes ( attributes ) ; |
public class TrustedAdvisorResourceDetail { /** * Additional information about the identified resource . The exact metadata and its order can be obtained by
* inspecting the < a > TrustedAdvisorCheckDescription < / a > object returned by the call to
* < a > DescribeTrustedAdvisorChecks < / a > . < b > Metadata < / b > contains all the data that is shown in the Excel download ,
* even in those cases where the UI shows just summary data .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setMetadata ( java . util . Collection ) } or { @ link # withMetadata ( java . util . Collection ) } if you want to override
* the existing values .
* @ param metadata
* Additional information about the identified resource . The exact metadata and its order can be obtained by
* inspecting the < a > TrustedAdvisorCheckDescription < / a > object returned by the call to
* < a > DescribeTrustedAdvisorChecks < / a > . < b > Metadata < / b > contains all the data that is shown in the Excel
* download , even in those cases where the UI shows just summary data .
* @ return Returns a reference to this object so that method calls can be chained together . */
public TrustedAdvisorResourceDetail withMetadata ( String ... metadata ) { } } | if ( this . metadata == null ) { setMetadata ( new com . amazonaws . internal . SdkInternalList < String > ( metadata . length ) ) ; } for ( String ele : metadata ) { this . metadata . add ( ele ) ; } return this ; |
public class JDBCTableSiteIdentifier { /** * documentation inherited */
public int getSiteId ( String siteString ) { } } | checkReloadSites ( ) ; Site site = _sitesByString . get ( siteString ) ; return ( site == null ) ? _defaultSiteId : site . siteId ; |
public class MonthArrayTitleFormatter { /** * { @ inheritDoc } */
@ Override public CharSequence format ( CalendarDay day ) { } } | return new SpannableStringBuilder ( ) . append ( monthLabels [ day . getMonth ( ) - 1 ] ) . append ( " " ) . append ( String . valueOf ( day . getYear ( ) ) ) ; |
public class KeyVaultClientBaseImpl { /** * Imports a certificate into a specified key vault .
* Imports an existing valid certificate , containing a private key , into Azure Key Vault . The certificate to be imported can be in either PFX or PEM format . If the certificate is in PEM format the PEM file must contain the key as well as x509 certificates . This operation requires the certificates / import permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param certificateName The name of the certificate .
* @ param base64EncodedCertificate Base64 encoded representation of the certificate object to import . This certificate needs to contain the private key .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the CertificateBundle object */
public Observable < CertificateBundle > importCertificateAsync ( String vaultBaseUrl , String certificateName , String base64EncodedCertificate ) { } } | return importCertificateWithServiceResponseAsync ( vaultBaseUrl , certificateName , base64EncodedCertificate ) . map ( new Func1 < ServiceResponse < CertificateBundle > , CertificateBundle > ( ) { @ Override public CertificateBundle call ( ServiceResponse < CertificateBundle > response ) { return response . body ( ) ; } } ) ; |
public class CmsMessageBundleEditorModel { /** * Saves messages to a propertyvfsbundle file .
* @ throws CmsException thrown if writing to the file fails . */
private void saveToPropertyVfsBundle ( ) throws CmsException { } } | for ( Locale l : m_changedTranslations ) { SortedProperties props = m_localizations . get ( l ) ; LockedFile f = m_lockedBundleFiles . get ( l ) ; if ( ( null != props ) && ( null != f ) ) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( ) ; Writer writer = new OutputStreamWriter ( outputStream , f . getEncoding ( ) ) ; props . store ( writer , null ) ; byte [ ] contentBytes = outputStream . toByteArray ( ) ; CmsFile file = f . getFile ( ) ; file . setContents ( contentBytes ) ; String contentEncodingProperty = m_cms . readPropertyObject ( file , CmsPropertyDefinition . PROPERTY_CONTENT_ENCODING , false ) . getValue ( ) ; if ( ( null == contentEncodingProperty ) || ! contentEncodingProperty . equals ( f . getEncoding ( ) ) ) { m_cms . writePropertyObject ( m_cms . getSitePath ( file ) , new CmsProperty ( CmsPropertyDefinition . PROPERTY_CONTENT_ENCODING , f . getEncoding ( ) , f . getEncoding ( ) ) ) ; } m_cms . writeFile ( file ) ; } catch ( IOException e ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . ERR_READING_FILE_UNSUPPORTED_ENCODING_2 , f . getFile ( ) . getRootPath ( ) , f . getEncoding ( ) ) , e ) ; } } } |
public class CommandLineExecutor { /** * < p > executeAndWait . < / p >
* @ throws java . lang . Exception if any . */
public void executeAndWait ( ) throws Exception { } } | Process p = launchProcess ( ) ; checkForErrors ( p ) ; if ( log . isDebugEnabled ( ) ) { // GP - 551 : Keep trace of outputs
if ( isNotBlank ( getOutput ( ) ) ) { log . debug ( "System Output during execution : \n" + getOutput ( ) ) ; } if ( gobbler . hasErrors ( ) ) { log . debug ( "System Error Output during execution : \n" + getError ( ) ) ; } } |
public class Validator { /** * 验证是否相等 , 不相等抛出异常 < br >
* @ param t1 对象1
* @ param t2 对象2
* @ param errorMsg 错误信息
* @ return 相同值
* @ throws ValidateException 验证异常 */
public static Object validateEqual ( Object t1 , Object t2 , String errorMsg ) throws ValidateException { } } | if ( false == equal ( t1 , t2 ) ) { throw new ValidateException ( errorMsg ) ; } return t1 ; |
public class NodeSupport { /** * Return true if the node is the local framework node . Compares the ( logical ) node names
* of the nodes after eliding any embedded ' user @ ' parts .
* @ param node the node
* @ return true if the node ' s name is the same as the framework ' s node name */
@ Override public boolean isLocalNode ( INodeDesc node ) { } } | final String fwkNodeName = getFrameworkNodeName ( ) ; return fwkNodeName . equals ( node . getNodename ( ) ) ; |
public class JobScheduleUpdateOptions { /** * Set a timestamp indicating the last modified time of the resource known to the client . The operation will be performed only if the resource on the service has not been modified since the specified time .
* @ param ifUnmodifiedSince the ifUnmodifiedSince value to set
* @ return the JobScheduleUpdateOptions object itself . */
public JobScheduleUpdateOptions withIfUnmodifiedSince ( DateTime ifUnmodifiedSince ) { } } | if ( ifUnmodifiedSince == null ) { this . ifUnmodifiedSince = null ; } else { this . ifUnmodifiedSince = new DateTimeRfc1123 ( ifUnmodifiedSince ) ; } return this ; |
public class ForestDBViewStore { /** * Opens the index , specifying ForestDB database flags
* in CBLView . m
* - ( MapReduceIndex * ) openIndexWithOptions : ( Database : : openFlags ) options */
private View openIndex ( int flags , boolean dryRun ) throws ForestException { } } | if ( _view == null ) { // Flags :
if ( _dbStore . getAutoCompact ( ) ) flags |= Database . AutoCompact ; // Encryption :
SymmetricKey encryptionKey = _dbStore . getEncryptionKey ( ) ; int enAlgorithm = Database . NoEncryption ; byte [ ] enKey = null ; if ( encryptionKey != null ) { enAlgorithm = Database . AES256Encryption ; enKey = encryptionKey . getKey ( ) ; } _view = new View ( _dbStore . forest , _path , flags , enAlgorithm , enKey , name , dryRun ? "0" : delegate . getMapVersion ( ) ) ; if ( dryRun ) { closeIndex ( ) ; } } return _view ; |
public class WebhooksInner { /** * Triggers a ping event to be sent to the webhook .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ param webhookName The name of the webhook .
* @ 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 < EventInfoInner > pingAsync ( String resourceGroupName , String registryName , String webhookName , final ServiceCallback < EventInfoInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( pingWithServiceResponseAsync ( resourceGroupName , registryName , webhookName ) , serviceCallback ) ; |
public class CodedConstant { /** * Gets the filed type .
* @ param type the type
* @ param isList the is list
* @ return the filed type */
public static String getFiledType ( FieldType type , boolean isList ) { } } | if ( ( type == FieldType . STRING || type == FieldType . BYTES ) && ! isList ) { return "com.google.protobuf.ByteString" ; } // add null check
String defineType = type . getJavaType ( ) ; if ( isList ) { defineType = "List" ; } return defineType ; |
public class CalculateThreads { /** * Calculate optimal threads . If they exceed the specified executorThreads , use optimal threads
* instead . Emit appropriate logging
* @ param executorThreads executor threads - what the caller wishes to use for size
* @ param name client pool name . Used for logging .
* @ return int actual threads to use */
public static int calculateThreads ( final int executorThreads , final String name ) { } } | // For current standard 8 core machines this is 10 regardless .
// On Java 10 , you might get less than 8 core reported , but it will still size as if it ' s 8
// Beyond 8 core you MIGHT undersize if running on Docker , but otherwise should be fine .
final int optimalThreads = Math . max ( BASE_OPTIMAL_THREADS , ( Runtime . getRuntime ( ) . availableProcessors ( ) + THREAD_OVERHEAD ) ) ; int threadsChosen = optimalThreads ; if ( executorThreads > optimalThreads ) { // They requested more , sure we can do that !
threadsChosen = executorThreads ; LOG . warn ( "Requested more than optimal threads. This is not necessarily an error, but you may be overallocating." ) ; } else { // They weren ' t auto tuning ( < 0 ) )
if ( executorThreads > 0 ) { LOG . warn ( "You requested less than optimal threads. We've ignored that." ) ; } } LOG . debug ( "For factory {}, Optimal Threads {}, Configured Threads {}" , name , optimalThreads , threadsChosen ) ; return threadsChosen ; |
public class Application { /** * Short form for getting an Goolge Guice injected class by
* calling getInstance ( . . . )
* @ param clazz The class to retrieve from the injector
* @ param < T > JavaDoc requires this ( just ignore it )
* @ return An instance of the requested class */
public static < T > T getInstance ( Class < T > clazz ) { } } | Objects . requireNonNull ( clazz , Required . CLASS . toString ( ) ) ; return injector . getInstance ( clazz ) ; |
public class ModulesInner { /** * Retrieve a list of modules .
* ServiceResponse < PageImpl < ModuleInner > > * @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the PagedList & lt ; ModuleInner & gt ; object wrapped in { @ link ServiceResponse } if successful . */
public Observable < ServiceResponse < Page < ModuleInner > > > listByAutomationAccountNextSinglePageAsync ( final String nextPageLink ) { } } | if ( nextPageLink == null ) { throw new IllegalArgumentException ( "Parameter nextPageLink is required and cannot be null." ) ; } String nextUrl = String . format ( "%s" , nextPageLink ) ; return service . listByAutomationAccountNext ( nextUrl , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Page < ModuleInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < ModuleInner > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < PageImpl < ModuleInner > > result = listByAutomationAccountNextDelegate ( response ) ; return Observable . just ( new ServiceResponse < Page < ModuleInner > > ( result . body ( ) , result . response ( ) ) ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class DescribeAvailablePatchesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeAvailablePatchesRequest describeAvailablePatchesRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeAvailablePatchesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeAvailablePatchesRequest . getFilters ( ) , FILTERS_BINDING ) ; protocolMarshaller . marshall ( describeAvailablePatchesRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( describeAvailablePatchesRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class BigDecimalUtil { /** * return a Number formatted or empty string if null .
* @ param bd */
public static String percentFormat ( final BigDecimal bd ) { } } | return bd != null ? NUMBER_FORMAT . format ( bd . movePointRight ( 2 ) ) : "" ; |
public class UdpClient { /** * Setup a callback called when { @ link io . netty . channel . Channel } is
* disconnected .
* @ param doOnDisconnected a consumer observing client stop event
* @ return a new { @ link UdpClient } */
public final UdpClient doOnDisconnected ( Consumer < ? super Connection > doOnDisconnected ) { } } | Objects . requireNonNull ( doOnDisconnected , "doOnDisconnected" ) ; return new UdpClientDoOn ( this , null , null , doOnDisconnected ) ; |
public class BottouSchedule { /** * Gets the learning rate for the current iteration .
* @ param iterCount The current iteration .
* @ param i The index of the current model parameter . */
@ Override public double getLearningRate ( int iterCount , int i ) { } } | // We use the learning rate suggested in Leon Bottou ' s ( 2012 ) SGD Tricks paper .
// \ gamma _ t = \ frac { \ gamma _ 0 } { ( 1 + \ gamma _ 0 \ lambda t ) ^ p }
// For SGD p = 1.0 , for ASGD p = 0.75
if ( prm . power == 1.0 ) { return prm . initialLr / ( 1 + prm . initialLr * prm . lambda * iterCount ) ; } else { return prm . initialLr / Math . pow ( 1 + prm . initialLr * prm . lambda * iterCount , prm . power ) ; } |
public class Environment { /** * Reads the environment variables and stores them in a Properties object .
* @ param cmdExec The command to execute to get hold of the environment variables .
* @ param properties The Properties object to be populated with the environment variables .
* @ return The exit value of the OS level process upon its termination . */
private static int readEnvironment ( String cmdExec , Properties properties ) { } } | // fire up the shell and get echo ' d results on stdout
BufferedReader reader = null ; Process process = null ; int exitValue = 99 ; try { String [ ] args = new String [ ] { cmdExec } ; process = startProcess ( args ) ; reader = createReader ( process ) ; processLinesOfEnvironmentVariables ( reader , properties ) ; process . waitFor ( ) ; reader . close ( ) ; } catch ( InterruptedException t ) { throw new EnvironmentException ( "NA" , t ) ; } catch ( IOException t ) { throw new EnvironmentException ( "NA" , t ) ; } finally { if ( process != null ) { process . destroy ( ) ; exitValue = process . exitValue ( ) ; } close ( reader ) ; } return exitValue ; |
public class KeyVaultClientBaseImpl { /** * Recovers the deleted certificate back to its current version under / certificates .
* The RecoverDeletedCertificate operation performs the reversal of the Delete operation . The operation is applicable in vaults enabled for soft - delete , and must be issued during the retention interval ( available in the deleted certificate ' s attributes ) . This operation requires the certificates / recover permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param certificateName The name of the deleted certificate
* @ 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 < CertificateBundle > recoverDeletedCertificateAsync ( String vaultBaseUrl , String certificateName , final ServiceCallback < CertificateBundle > serviceCallback ) { } } | return ServiceFuture . fromResponse ( recoverDeletedCertificateWithServiceResponseAsync ( vaultBaseUrl , certificateName ) , serviceCallback ) ; |
public class ToStringStyle { /** * < p > Sets the content start text . < / p >
* < p > < code > null < / code > is accepted , but will be converted to
* an empty String . < / p >
* @ param contentStart the new content start text */
protected void setContentStart ( String contentStart ) { } } | if ( contentStart == null ) { contentStart = StringUtils . EMPTY ; } this . contentStart = contentStart ; |
public class ExecutionContext { /** * Creates an OrFuture that is already completed with a { @ link Bad } .
* @ param bad the failure value
* @ param < G > the success type
* @ return an instance of OrFuture */
public < G , B > OrFuture < G , B > badFuture ( B bad ) { } } | return this . < G , B > promise ( ) . failure ( bad ) . future ( ) ; |
public class JDKHttp { /** * 使用POST方式请求目标网站
* @ param bodyString 传输字符串数据
* @ param bodyByteArray 传输byte数据 * 若bodyString已设值 则该参数无效
* @ return
* @ author acexy @ thankjava . com
* @ date 2016年1月4日 下午5:59:17
* @ version 1.0 */
public static String post ( String url , String bodyString , byte [ ] bodyByteArray , Map < String , String > ... head ) { } } | BufferedReader in = null ; StringBuilder sb = new StringBuilder ( ) ; try { URL realUrl = new URL ( url ) ; URLConnection connection = realUrl . openConnection ( ) ; if ( head != null && head . length != 0 ) { Map < String , String > header = head [ 0 ] ; for ( Map . Entry < String , String > h : header . entrySet ( ) ) { connection . setRequestProperty ( h . getKey ( ) , h . getValue ( ) ) ; } } connection . setDoOutput ( true ) ; connection . setDoInput ( true ) ; if ( bodyString != null ) { OutputStreamWriter outputStream = new OutputStreamWriter ( connection . getOutputStream ( ) ) ; outputStream . write ( bodyString ) ; outputStream . flush ( ) ; outputStream . close ( ) ; } if ( bodyByteArray != null ) { OutputStream outputStream = connection . getOutputStream ( ) ; outputStream . write ( bodyByteArray ) ; outputStream . flush ( ) ; outputStream . close ( ) ; } connection . connect ( ) ; in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ( ) ) ) ; String line ; while ( ( line = in . readLine ( ) ) != null ) { sb . append ( line ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } finally { try { if ( in != null ) { in . close ( ) ; } } catch ( IOException ex ) { ex . printStackTrace ( ) ; } } return sb . toString ( ) ; |
public class SessionUtil { /** * Renew a session .
* Use cases :
* - Session and Master tokens are provided . No Id token :
* - succeed in getting a new Session token .
* - fail and raise SnowflakeReauthenticationRequest because Master
* token expires . Since no id token exists , the exception is thrown
* to the upstream .
* - Session and Id tokens are provided . No Master token :
* - fail and raise SnowflakeReauthenticationRequest and
* issue a new Session token
* - fail and raise SnowflakeReauthenticationRequest and fail
* to issue a new Session token as the
* @ param loginInput login information
* @ return login output
* @ throws SFException if unexpected uri information
* @ throws SnowflakeSQLException if failed to renew the session */
static public LoginOutput renewSession ( LoginInput loginInput ) throws SFException , SnowflakeSQLException { } } | try { return tokenRequest ( loginInput , TokenRequestType . RENEW ) ; } catch ( SnowflakeReauthenticationRequest ex ) { if ( Strings . isNullOrEmpty ( loginInput . getIdToken ( ) ) ) { throw ex ; } return tokenRequest ( loginInput , TokenRequestType . ISSUE ) ; } |
public class Bytes { /** * Writes a big - endian 8 - byte long at an offset in the given array .
* @ param b The array to write to .
* @ param offset The offset in the array to start writing at .
* @ throws IndexOutOfBoundsException if the byte array is too small . */
public static void setLong ( final byte [ ] b , final long n , final int offset ) { } } | b [ offset + 0 ] = ( byte ) ( n >>> 56 ) ; b [ offset + 1 ] = ( byte ) ( n >>> 48 ) ; b [ offset + 2 ] = ( byte ) ( n >>> 40 ) ; b [ offset + 3 ] = ( byte ) ( n >>> 32 ) ; b [ offset + 4 ] = ( byte ) ( n >>> 24 ) ; b [ offset + 5 ] = ( byte ) ( n >>> 16 ) ; b [ offset + 6 ] = ( byte ) ( n >>> 8 ) ; b [ offset + 7 ] = ( byte ) ( n >>> 0 ) ; |
public class ResourceManager { /** * make sure you call this with a graph lock - either read or write */
private void getAllDescendants ( Resource < L > parent , List < Resource < L > > descendants ) { } } | for ( Resource < L > child : getChildren ( parent ) ) { if ( ! descendants . contains ( child ) ) { getAllDescendants ( child , descendants ) ; descendants . add ( child ) ; } } return ; |
public class ParserUtils { /** * Gets the url of a page using the meta tags in head
* @ param doc the jsoup document to extract the page url from
* @ return the url of the document */
static String getSherdogPageUrl ( Document doc ) { } } | String url = Optional . ofNullable ( doc . head ( ) ) . map ( h -> h . select ( "meta" ) ) . map ( es -> es . stream ( ) . filter ( e -> e . attr ( "property" ) . equalsIgnoreCase ( "og:url" ) ) . findFirst ( ) . orElse ( null ) ) . map ( m -> m . attr ( "content" ) ) . orElse ( "" ) ; if ( url . startsWith ( "//" ) ) { // 2018-10-10 bug in sherdog where ig : url starts with / / ?
url = url . replaceFirst ( "//" , "http://" ) ; } return url . replace ( "http://" , "https://" ) ; |
public class EjbRelationTypeImpl { /** * If not already created , a new < code > ejb - relationship - role < / code > element will be created and returned .
* Otherwise , the first existing < code > ejb - relationship - role < / code > element will be returned .
* @ return the instance defined for the element < code > ejb - relationship - role < / code > */
public EjbRelationshipRoleType < EjbRelationType < T > > getOrCreateEjbRelationshipRole ( ) { } } | List < Node > nodeList = childNode . get ( "ejb-relationship-role" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new EjbRelationshipRoleTypeImpl < EjbRelationType < T > > ( this , "ejb-relationship-role" , childNode , nodeList . get ( 0 ) ) ; } return createEjbRelationshipRole ( ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.