signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class MCWrapper { /** * Called by the Connection manager during reassociate to check if an unshared connection
* is currently involved in a transaction . */
protected boolean involvedInTransaction ( ) { } } | final boolean isTracingEnabled = TraceComponent . isAnyTracingEnabled ( ) ; if ( state == STATE_TRAN_WRAPPER_INUSE ) { if ( isTracingEnabled && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "involvedInTransaction: true" ) ; } return true ; } else { if ( isTracingEnabled && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "involvedInTransaction: false" ) ; } return false ; } |
public class TimeMeasure { /** * Calls { @ link # failIfNotSucceeded ( ) } and the logs the status and { @ link # getDurationAsString ( ) duration } of this
* measure .
* @ param logger is the { @ link Logger } .
* @ param operation represents the operation that was measured . Typically a { @ link String } . Its
* { @ link Object # toString ( ) string representation } is logged and shall be a brief description of the measured
* operation . */
public void log ( Logger logger , Object operation ) { } } | if ( ! isCompleted ( ) ) { failIfNotSucceeded ( ) ; } if ( isFailure ( ) ) { logger . warn ( "Operation {} failed after duration of {}" , operation , getDurationAsString ( ) ) ; } else { logger . info ( "Operation {} succeeded after duration of {}" , operation , getDurationAsString ( ) ) ; } |
public class GBSDeleteFringe { /** * Handle the case where we deleted from a left fringe . */
private void leftFringe ( DeleteStack . Linearizer lxx , DeleteStack . FringeNote xx , InsertStack istack , GBSNode f , GBSNode g , boolean gLeft , int t0_depth ) { } } | GBSNode w = f . rightChild ( ) ; /* The right brother of delete fringe */
GBSNode s = f . leftChild ( ) ; /* t0 fringe from which we deleted */
GBSNode bfather = g ; GBSNode sh = null ; /* The linearized s */
GBSNode p = null ; int fbalance = f . balance ( ) ; f . clearBalance ( ) ; if ( w == null ) /* There is no right brother */
{ sh = linearize ( lxx , s ) ; f . setRightChild ( null ) ; combine ( lastInList ( sh ) , f ) ; /* [ s , f ] */
p = sh ; xx . depthDecrease = true ; } else /* There is a right brother */
{ p = linearize ( lxx , s ) ; f . setChildren ( null , null ) ; combine ( lastInList ( p ) , f ) ; /* [ s , f ] */
sh = p ; /* Assume linear list or single t0 */
GBSNode wh = w . leftMostChild ( istack ) ; int zpoints = istack . index ( ) ; if ( zpoints > 0 ) /* Is a t0 fringe ( possibly more */
{ /* than one level down ) */
zpoints -- ; int ztop = 0 ; /* Assume top of entire tree */
if ( zpoints >= t0_depth ) /* Have more than a whole t0 fringe */
{ ztop = zpoints - t0_depth + 1 ; sh = w ; /* We will elevate w */
bfather = istack . node ( ztop - 1 ) ; bfather . setLeftChild ( p ) ; /* Father of left - most fringe */
/* points to linear list */
} /* Linearize left - most fringe */
wh = linearize ( lxx , istack . node ( ztop ) ) ; } combine ( lastInList ( p ) , wh ) ; /* Add w onto f ( now [ s , f , w ] ) */
leftDepth ( xx , fbalance ) ; /* Check for depth change */
} if ( gLeft ) { g . setLeftChild ( sh ) ; } else { g . setRightChild ( sh ) ; } boolean bLeft = true ; if ( bfather . rightChild ( ) == p ) { bLeft = false ; } int maxBal = g . kFactor ( ) - 1 ; if ( maxBal < 3 ) { maxBal = 3 ; } istack . start ( bfather , "GBSDeleteFringe.leftFringe" ) ; istack . setNode ( 1 , null ) ; istack . resetBalancePointIndex ( ) ; int fpidx = 1 ; if ( g . kFactor ( ) > 2 ) { GBSInsertFringe . singleInstance ( ) . balance ( g . kFactor ( ) , istack , p , fpidx , maxBal ) ; } xx . newg = bfather ; if ( bLeft ) { xx . newf = bfather . leftChild ( ) ; } else { xx . newf = bfather . rightChild ( ) ; } |
public class StringUtils { /** * Reads the contents of a file into a string using the UTF - 8 character set encoding .
* @ param aFile The file from which to read
* @ return The information read from the file
* @ throws IOException If the supplied file could not be read */
public static String read ( final File aFile ) throws IOException { } } | String string = new String ( readBytes ( aFile ) , StandardCharsets . UTF_8 . name ( ) ) ; if ( string . endsWith ( EOL ) ) { string = string . substring ( 0 , string . length ( ) - 1 ) ; } return string ; |
public class ModuleDepInfo { /** * Adds the terms and comments from the specified object to this object .
* @ param other
* The object to add
* @ return True if this object was modified */
public boolean add ( ModuleDepInfo other ) { } } | Boolean modified = false ; if ( formula . isTrue ( ) ) { // No terms added to a true formula will change the evaluation .
return false ; } if ( other . formula . isTrue ( ) ) { // Adding true to this formula makes this formula true .
modified = ! formula . isTrue ( ) ; formula = new BooleanFormula ( true ) ; if ( modified && other . comment != null && other . commentTermSize < commentTermSize ) { comment = other . comment ; commentTermSize = other . commentTermSize ; } return modified ; } // Add the terms
modified = formula . addAll ( other . formula ) ; // Copy over plugin name if needed
if ( ! isPluginNameDeclared && other . isPluginNameDeclared ) { pluginName = other . pluginName ; isPluginNameDeclared = true ; modified = true ; } // And comments . . .
if ( other . comment != null && other . commentTermSize < commentTermSize ) { comment = other . comment ; commentTermSize = other . commentTermSize ; } return modified ; |
public class DateMapperBuilder { /** * Returns the { @ link DateMapper } represented by this { @ link MapperBuilder } .
* @ param field the name of the field to be built
* @ return the { @ link DateMapper } represented by this */
@ Override public DateMapper build ( String field ) { } } | return new DateMapper ( field , column , validated , pattern ) ; |
public class AbstractResourceBundleHandler { /** * Creates a file . If dir is not created for some reason a runtimeexception
* is thrown .
* @ param path
* @ return
* @ throws IOException */
private File createNewFile ( String path ) throws IOException { } } | // In windows , pathnames with spaces are returned as % 20
if ( path . contains ( "%20" ) ) path = path . replaceAll ( "%20" , " " ) ; File newFile = new File ( path ) ; if ( ! newFile . exists ( ) && ! newFile . createNewFile ( ) ) { throw new BundlingProcessException ( "Unable to create a temporary file at " + path ) ; } if ( LOGGER . isDebugEnabled ( ) ) LOGGER . debug ( "Created file: " + newFile . getCanonicalPath ( ) ) ; return newFile ; |
public class DialectFactory { /** * 通过JDBC URL等信息识别JDBC驱动名
* @ param nameContainsProductInfo 包含数据库标识的字符串
* @ return 驱动 */
public static String identifyDriver ( String nameContainsProductInfo ) { } } | if ( StrUtil . isBlank ( nameContainsProductInfo ) ) { return null ; } // 全部转为小写 , 忽略大小写
nameContainsProductInfo = StrUtil . cleanBlank ( nameContainsProductInfo . toLowerCase ( ) ) ; String driver = null ; if ( nameContainsProductInfo . contains ( "mysql" ) ) { driver = ClassLoaderUtil . isPresent ( DRIVER_MYSQL_V6 ) ? DRIVER_MYSQL_V6 : DRIVER_MYSQL ; } else if ( nameContainsProductInfo . contains ( "oracle" ) ) { driver = ClassLoaderUtil . isPresent ( DRIVER_ORACLE ) ? DRIVER_ORACLE : DRIVER_ORACLE_OLD ; } else if ( nameContainsProductInfo . contains ( "postgresql" ) ) { driver = DRIVER_POSTGRESQL ; } else if ( nameContainsProductInfo . contains ( "sqlite" ) ) { driver = DRIVER_SQLLITE3 ; } else if ( nameContainsProductInfo . contains ( "sqlserver" ) ) { driver = DRIVER_SQLSERVER ; } else if ( nameContainsProductInfo . contains ( "hive" ) ) { driver = DRIVER_HIVE ; } else if ( nameContainsProductInfo . contains ( "h2" ) ) { driver = DRIVER_H2 ; } else if ( nameContainsProductInfo . startsWith ( "jdbc:derby://" ) ) { // Derby数据库网络连接方式
driver = DRIVER_DERBY ; } else if ( nameContainsProductInfo . contains ( "derby" ) ) { // 嵌入式Derby数据库
driver = DRIVER_DERBY_EMBEDDED ; } else if ( nameContainsProductInfo . contains ( "hsqldb" ) ) { // HSQLDB
driver = DRIVER_HSQLDB ; } else if ( nameContainsProductInfo . contains ( "dm" ) ) { // 达梦7
driver = DRIVER_DM7 ; } return driver ; |
public class WebACRolesProvider { /** * This maps a Collection of acl : agentGroup values to a List of agents .
* Any out - of - domain URIs are silently ignored . */
private List < String > dereferenceAgentGroups ( final Collection < String > agentGroups ) { } } | final FedoraSession internalSession = sessionFactory . getInternalSession ( ) ; final IdentifierConverter < Resource , FedoraResource > translator = new DefaultIdentifierTranslator ( getJcrSession ( internalSession ) ) ; final List < String > members = agentGroups . stream ( ) . flatMap ( agentGroup -> { if ( agentGroup . startsWith ( FEDORA_INTERNAL_PREFIX ) ) { // strip off trailing hash .
final int hashIndex = agentGroup . indexOf ( "#" ) ; final String agentGroupNoHash = hashIndex > 0 ? agentGroup . substring ( 0 , hashIndex ) : agentGroup ; final String hashedSuffix = hashIndex > 0 ? agentGroup . substring ( hashIndex ) : null ; final FedoraResource resource = nodeService . find ( internalSession , agentGroupNoHash . substring ( FEDORA_INTERNAL_PREFIX . length ( ) ) ) ; return getAgentMembers ( translator , resource , hashedSuffix ) ; } else if ( agentGroup . equals ( FOAF_AGENT_VALUE ) ) { return of ( agentGroup ) ; } else { LOGGER . info ( "Ignoring agentGroup: {}" , agentGroup ) ; return empty ( ) ; } } ) . collect ( toList ( ) ) ; if ( LOGGER . isDebugEnabled ( ) && ! agentGroups . isEmpty ( ) ) { LOGGER . debug ( "Found {} members in {} agentGroups resources" , members . size ( ) , agentGroups . size ( ) ) ; } return members ; |
public class TypeUtil { public static void toHex ( byte b , Appendable buf ) { } } | try { int bi = _0XFF & b ; int c = '0' + ( bi / SIXTEEN ) % SIXTEEN ; if ( c > '9' ) { c = 'A' + ( c - '0' - TEN ) ; } buf . append ( ( char ) c ) ; c = '0' + bi % SIXTEEN ; if ( c > '9' ) { c = 'A' + ( c - '0' - TEN ) ; } buf . append ( ( char ) c ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } |
public class InternalUtilities { /** * Get input content source .
* @ param conf job configuration
* @ param host host to connect to
* @ return content source
* @ throws IOException
* @ throws XccConfigException */
public static ContentSource getInputContentSource ( Configuration conf , String host ) throws XccConfigException , IOException { } } | String user = conf . get ( INPUT_USERNAME , "" ) ; String password = conf . get ( INPUT_PASSWORD , "" ) ; String port = conf . get ( INPUT_PORT , "8000" ) ; String db = conf . get ( INPUT_DATABASE_NAME ) ; int portInt = Integer . parseInt ( port ) ; boolean useSsl = conf . getBoolean ( INPUT_USE_SSL , false ) ; if ( useSsl ) { return getSecureContentSource ( host , portInt , user , password , db , getInputSslOptions ( conf ) ) ; } return ContentSourceFactory . newContentSource ( host , portInt , user , password , db ) ; |
public class ArgumentParser { /** * Handle the - - uninstall argument */
private void handleArgUninstall ( final String arg , final Deque < String > args ) { } } | install = true ; String name = arg ; final int posEq = name . indexOf ( "=" ) ; String value ; if ( posEq != - 1 ) { value = name . substring ( posEq + 1 ) ; } else { value = args . peek ( ) ; if ( value != null && ! value . startsWith ( "-" ) ) { value = args . pop ( ) ; } else { value = null ; } } if ( value == null ) { throw new BuildException ( "You must specify a installation package when using the --uninstall argument" ) ; } uninstallId = value ; |
public class Maths { /** * Calculates the factorial of n where n is a number in the
* range 0 - 20 . Zero factorial is equal to 1 . For values of
* n greater than 20 you must use { @ link # bigFactorial ( int ) } .
* @ param n The factorial to calculate .
* @ return The factorial of n .
* @ see # bigFactorial ( int ) */
public static long factorial ( int n ) { } } | if ( n < 0 || n > MAX_LONG_FACTORIAL ) { throw new IllegalArgumentException ( "Argument must be in the range 0 - 20." ) ; } long factorial = 1 ; for ( int i = n ; i > 1 ; i -- ) { factorial *= i ; } return factorial ; |
public class CleverTapAPI { /** * Push */
private void cacheFCMToken ( String token ) { } } | try { if ( token == null || alreadyHaveFCMToken ( token ) ) return ; final SharedPreferences prefs = getPreferences ( ) ; if ( prefs == null ) return ; SharedPreferences . Editor editor = prefs . edit ( ) ; editor . putString ( storageKeyWithSuffix ( Constants . FCM_PROPERTY_REG_ID ) , token ) ; StorageHelper . persist ( editor ) ; } catch ( Throwable t ) { getConfigLogger ( ) . verbose ( getAccountId ( ) , "FcmManager: Unable to cache FCM Token" , t ) ; } |
public class Builder { /** * < b > Required Field < / b > . Distribution tag listing the distributable package .
* @ param distribution the distribution . */
public void setDistribution ( final CharSequence distribution ) { } } | if ( distribution != null ) format . getHeader ( ) . createEntry ( DISTRIBUTION , distribution ) ; |
public class Channel { /** * Query namespaces . Takes no specific arguments returns namespaces including chaincode names that have been committed .
* @ param queryNamespaceDefinitionsRequest the request see { @ link LifecycleQueryNamespaceDefinitionsRequest }
* @ param peers to send the request .
* @ return A { @ link LifecycleQueryNamespaceDefinitionsProposalResponse }
* @ throws InvalidArgumentException
* @ throws ProposalException */
public Collection < LifecycleQueryNamespaceDefinitionsProposalResponse > lifecycleQueryNamespaceDefinitions ( LifecycleQueryNamespaceDefinitionsRequest queryNamespaceDefinitionsRequest , Collection < Peer > peers ) throws InvalidArgumentException , ProposalException { } } | if ( null == queryNamespaceDefinitionsRequest ) { throw new InvalidArgumentException ( "The queryNamespaceDefinitionsRequest parameter can not be null." ) ; } checkChannelState ( ) ; checkPeers ( peers ) ; try { logger . trace ( format ( "lifecycleQueryNamespaceDefinitions channel: %s" , name ) ) ; TransactionContext context = getTransactionContext ( queryNamespaceDefinitionsRequest ) ; LifecycleQueryNamespaceDefinitionsBuilder q = LifecycleQueryNamespaceDefinitionsBuilder . newBuilder ( ) ; q . context ( context ) ; SignedProposal qProposal = getSignedProposal ( context , q . build ( ) ) ; return sendProposalToPeers ( peers , qProposal , context , LifecycleQueryNamespaceDefinitionsProposalResponse . class ) ; } catch ( Exception e ) { throw new ProposalException ( format ( "QueryNamespaceDefinitions %s channel failed. " + e . getMessage ( ) , name ) , e ) ; } |
public class DebugHelper { /** * This method will append to the pdf a legend explaining the visual feedback in the pdf , an overview of the styles
* used and an overview of the properties used .
* @ throws DocumentException */
public static void appendDebugInfo ( PdfWriter writer , Document document , EnhancedMap settings , StylerFactory stylerFactory ) throws DocumentException , VectorPrintException { } } | PdfContentByte canvas = writer . getDirectContent ( ) ; canvas . setFontAndSize ( FontFactory . getFont ( FontFactory . COURIER ) . getBaseFont ( ) , 8 ) ; canvas . setColorFill ( itextHelper . fromColor ( settings . getColorProperty ( Color . MAGENTA , ReportConstants . DEBUGCOLOR ) ) ) ; canvas . setColorStroke ( itextHelper . fromColor ( settings . getColorProperty ( Color . MAGENTA , ReportConstants . DEBUGCOLOR ) ) ) ; Font f = FontFactory . getFont ( FontFactory . COURIER , 8 ) ; f . setColor ( itextHelper . fromColor ( settings . getColorProperty ( Color . MAGENTA , ReportConstants . DEBUGCOLOR ) ) ) ; float top = document . getPageSize ( ) . getTop ( ) ; document . add ( new Phrase ( new Chunk ( "table: " , f ) . setLocalDestination ( DEBUGPAGE ) ) ) ; document . add ( Chunk . NEWLINE ) ; document . add ( new Phrase ( "cell: " , f ) ) ; document . add ( Chunk . NEWLINE ) ; document . add ( new Phrase ( "image: " , f ) ) ; document . add ( Chunk . NEWLINE ) ; document . add ( new Phrase ( "text: " , f ) ) ; document . add ( Chunk . NEWLINE ) ; document . add ( new Phrase ( "background color is shown in a small rectangle" , f ) ) ; document . add ( Chunk . NEWLINE ) ; canvas . setLineWidth ( 2 ) ; canvas . setLineDash ( new float [ ] { 0.3f , 5 } , 0 ) ; float left = document . leftMargin ( ) ; canvas . rectangle ( left + 80 , top - 25 , left + 80 , 8 ) ; canvas . closePathStroke ( ) ; canvas . setLineWidth ( 0.3f ) ; canvas . setLineDash ( new float [ ] { 2 , 2 } , 0 ) ; canvas . rectangle ( left + 80 , top - 37 , left + 80 , 8 ) ; canvas . closePathStroke ( ) ; canvas . setLineDash ( new float [ ] { 1 , 0 } , 0 ) ; canvas . rectangle ( left + 80 , top - 50 , left + 80 , 8 ) ; canvas . closePathStroke ( ) ; canvas . setLineDash ( new float [ ] { 0.3f , 5 } , 0 ) ; canvas . rectangle ( left + 80 , top - 63 , left + 80 , 8 ) ; canvas . closePathStroke ( ) ; document . add ( Chunk . NEWLINE ) ; document . add ( new Phrase ( "fonts available: " + FontFactory . getRegisteredFonts ( ) , f ) ) ; document . add ( Chunk . NEWLINE ) ; if ( settings . getBooleanProperty ( false , DEBUG ) ) { document . add ( new Phrase ( "OVERVIEW OF STYLES FOR THIS REPORT" , f ) ) ; document . add ( Chunk . NEWLINE ) ; document . add ( Chunk . NEWLINE ) ; } Font b = new Font ( f ) ; b . setStyle ( "bold" ) ; Set < Map . Entry < String , String > > entrySet = stylerFactory . getStylerSetup ( ) . entrySet ( ) ; for ( Map . Entry < String , String > styleInfo : entrySet ) { String key = styleInfo . getKey ( ) ; document . add ( new Chunk ( key , b ) . setLocalDestination ( key ) ) ; document . add ( new Chunk ( ": " + styleInfo . getValue ( ) , f ) ) ; document . add ( Chunk . NEWLINE ) ; document . add ( new Phrase ( " styling configured by " + key + ": " , f ) ) ; for ( BaseStyler st : ( Collection < BaseStyler > ) stylerFactory . getBaseStylersFromCache ( ( key ) ) ) { document . add ( Chunk . NEWLINE ) ; document . add ( new Chunk ( " " , f ) ) ; document . add ( new Chunk ( st . getClass ( ) . getSimpleName ( ) , DebugHelper . debugFontLink ( canvas , settings ) ) . setLocalGoto ( st . getClass ( ) . getSimpleName ( ) ) ) ; document . add ( new Chunk ( ":" , f ) ) ; document . add ( Chunk . NEWLINE ) ; document . add ( new Phrase ( " non default parameters for " + st . getClass ( ) . getSimpleName ( ) + ": " + getParamInfo ( st ) , f ) ) ; document . add ( Chunk . NEWLINE ) ; if ( ! st . getConditions ( ) . isEmpty ( ) ) { document . add ( new Phrase ( " conditions for this styler: " , f ) ) ; } for ( StylingCondition sc : ( Collection < StylingCondition > ) st . getConditions ( ) ) { document . add ( Chunk . NEWLINE ) ; document . add ( new Chunk ( " " , f ) ) ; document . add ( new Chunk ( sc . getClass ( ) . getSimpleName ( ) , DebugHelper . debugFontLink ( canvas , settings ) ) . setLocalGoto ( sc . getClass ( ) . getSimpleName ( ) ) ) ; document . add ( Chunk . NEWLINE ) ; document . add ( new Phrase ( " non default parameters for " + sc . getClass ( ) . getSimpleName ( ) + ": " + getParamInfo ( sc ) , f ) ) ; } } document . add ( Chunk . NEWLINE ) ; document . add ( Chunk . NEWLINE ) ; } document . newPage ( ) ; document . add ( new Phrase ( "Properties used for the report" , f ) ) ; document . add ( Chunk . NEWLINE ) ; ByteArrayOutputStream bo = new ByteArrayOutputStream ( ) ; PrintStream ps = new PrintStream ( bo ) ; settings . listProperties ( ps ) ; ps . close ( ) ; document . add ( new Paragraph ( bo . toString ( ) , f ) ) ; document . newPage ( ) ; try { bo = new ByteArrayOutputStream ( ) ; ps = new PrintStream ( bo ) ; Help . printHelpHeader ( ps ) ; ps . close ( ) ; document . add ( new Paragraph ( bo . toString ( ) , f ) ) ; Help . printStylerHelp ( document , f ) ; Help . printConditionrHelp ( document , f ) ; } catch ( IOException | ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException ex ) { log . log ( Level . SEVERE , null , ex ) ; } |
public class Code { /** * Awaits the lock on { @ code monitor } , and acquires it . */
public void monitorEnter ( Local < ? > monitor ) { } } | addInstruction ( new ThrowingInsn ( Rops . MONITOR_ENTER , sourcePosition , RegisterSpecList . make ( monitor . spec ( ) ) , catches ) ) ; |
public class JstlLocalization { /** * Looks up a configuration variable in the request , session and application scopes . If none is found , return by
* { @ link ServletContext # getInitParameter ( String ) } method . */
private Object findByKey ( String key ) { } } | Object value = Config . get ( request , key ) ; if ( value != null ) { return value ; } value = Config . get ( request . getSession ( createNewSession ( ) ) , key ) ; if ( value != null ) { return value ; } value = Config . get ( request . getServletContext ( ) , key ) ; if ( value != null ) { return value ; } return request . getServletContext ( ) . getInitParameter ( key ) ; |
public class CFMLEngineFactorySupport { /** * cast a lucee string version to a int version
* @ param version
* @ return int version */
public static Version toVersion ( String version , final Version defaultValue ) { } } | // remove extension if there is any
final int rIndex = version . lastIndexOf ( ".lco" ) ; if ( rIndex != - 1 ) version = version . substring ( 0 , rIndex ) ; try { return Version . parseVersion ( version ) ; } catch ( final IllegalArgumentException iae ) { return defaultValue ; } |
public class Quaternionf { /** * Apply a rotation to this quaternion that maps the given direction to the positive Z axis .
* Because there are multiple possibilities for such a rotation , this method will choose the one that ensures the given up direction to remain
* parallel to the plane spanned by the < code > up < / code > and < code > dir < / code > vectors .
* If < code > Q < / code > is < code > this < / code > quaternion and < code > R < / code > the quaternion representing the
* specified rotation , then the new quaternion will be < code > Q * R < / code > . So when transforming a
* vector < code > v < / code > with the new quaternion by using < code > Q * R * v < / code > , the
* rotation added by this method will be applied first !
* Reference : < a href = " http : / / answers . unity3d . com / questions / 467614 / what - is - the - source - code - of - quaternionlookrotation . html " > http : / / answers . unity3d . com < / a >
* @ see # lookAlong ( float , float , float , float , float , float , Quaternionf )
* @ param dir
* the direction to map to the positive Z axis
* @ param up
* the vector which will be mapped to a vector parallel to the plane
* spanned by the given < code > dir < / code > and < code > up < / code >
* @ return this */
public Quaternionf lookAlong ( Vector3fc dir , Vector3fc up ) { } } | return lookAlong ( dir . x ( ) , dir . y ( ) , dir . z ( ) , up . x ( ) , up . y ( ) , up . z ( ) , this ) ; |
public class AbstractCircleController { private void stopDragging ( ) { } } | if ( dragging ) { dragging = false ; getContainer ( ) . remove ( circle ) ; getContainer ( ) . remove ( line ) ; } |
public class CommitsApi { /** * Get a specific commit identified by the commit hash or name of a branch or tag as an Optional instance
* < pre > < code > GitLab Endpoint : GET / projects / : id / repository / commits / : sha / refs < / code > < / pre >
* @ param projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance
* @ param sha a commit hash or name of a branch or tag
* @ return Get all references ( from branches or tags ) a commit is pushed to
* @ throws GitLabApiException GitLabApiException if any exception occurs during execution
* @ since Gitlab 10.6 */
public List < CommitRef > getCommitRefs ( Object projectIdOrPath , String sha ) throws GitLabApiException { } } | return ( getCommitRefs ( projectIdOrPath , sha , RefType . ALL ) ) ; |
public class HadoopProxy { /** * Kill all Spawned Hadoop Jobs
* @ param jobProps job properties
* @ param logger logger handler */
public void killAllSpawnedHadoopJobs ( Props jobProps , final Logger logger ) { } } | if ( tokenFile == null ) { return ; // do null check for tokenFile
} final String logFilePath = jobProps . getString ( CommonJobProperties . JOB_LOG_FILE ) ; logger . info ( "Log file path is: " + logFilePath ) ; HadoopJobUtils . proxyUserKillAllSpawnedHadoopJobs ( logFilePath , jobProps , tokenFile , logger ) ; |
public class Utils { /** * Copy the given file .
* @ param filename the file to copy .
* @ param configuration the configuration . */
public static void performCopy ( String filename , SarlConfiguration configuration ) { } } | if ( filename . isEmpty ( ) ) { return ; } try { final DocFile fromfile = DocFile . createFileForInput ( configuration , filename ) ; final DocPath path = DocPath . create ( fromfile . getName ( ) ) ; final DocFile toFile = DocFile . createFileForOutput ( configuration , path ) ; if ( toFile . isSameFile ( fromfile ) ) { return ; } configuration . message . notice ( ( SourcePosition ) null , "doclet.Copying_File_0_To_File_1" , // $ NON - NLS - 1 $
fromfile . toString ( ) , path . getPath ( ) ) ; toFile . copyFile ( fromfile ) ; } catch ( IOException exc ) { configuration . message . error ( ( SourcePosition ) null , "doclet.perform_copy_exception_encountered" , // $ NON - NLS - 1 $
exc . toString ( ) ) ; throw new DocletAbortException ( exc ) ; } |
public class UnrelatedCollectionContents { /** * implements the visitor to create and destroy the stack and member collections
* @ param classContext
* the context object for the currently parsed class */
@ Override public void visitClassContext ( final ClassContext classContext ) { } } | try { stack = new OpcodeStack ( ) ; memberCollections = new HashMap < > ( ) ; memberSourceLineAnnotations = new HashMap < > ( ) ; super . visitClassContext ( classContext ) ; } finally { stack = null ; memberCollections = null ; memberSourceLineAnnotations = null ; } |
public class BplusTree { /** * Find node that can hold the key
* @ param key
* @ return LeafNode < K , V > containing the key or null if not found */
private final LeafNode < K , V > findLeafNode ( final K key , final boolean tracePath ) { } } | Node < K , V > node = getNode ( rootIdx ) ; if ( tracePath ) { stackNodes . clear ( ) ; stackSlots . clear ( ) ; } while ( ! node . isLeaf ( ) ) { final InternalNode < K , V > nodeInternal = ( InternalNode < K , V > ) node ; int slot = node . findSlotByKey ( key ) ; slot = ( ( slot < 0 ) ? ( - slot ) - 1 : slot + 1 ) ; if ( tracePath ) { stackNodes . push ( nodeInternal ) ; stackSlots . push ( slot ) ; } node = getNode ( nodeInternal . childs [ slot ] ) ; if ( node == null ) { log . error ( "ERROR childs[" + slot + "] in node=" + nodeInternal ) ; return null ; } } return ( node . isLeaf ( ) ? ( LeafNode < K , V > ) node : null ) ; |
public class AbstractEndpoint { /** * Loads a PropertyMap from the current security context that was previously stored
* there by one of the Notions that was executed before this relationship creation .
* @ param securityContext the security context
* @ param type the entity type
* @ param storageKey the key for which the PropertyMap was stored
* @ return a PropertyMap or null */
protected PropertyMap getNotionProperties ( final SecurityContext securityContext , final Class type , final String storageKey ) { } } | final Map < String , PropertyMap > notionPropertyMap = ( Map < String , PropertyMap > ) securityContext . getAttribute ( "notionProperties" ) ; if ( notionPropertyMap != null ) { final Set < PropertyKey > keySet = Services . getInstance ( ) . getConfigurationProvider ( ) . getPropertySet ( type , PropertyView . Public ) ; final PropertyMap notionProperties = notionPropertyMap . get ( storageKey ) ; if ( notionProperties != null ) { for ( final Iterator < PropertyKey > it = notionProperties . keySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { final PropertyKey key = it . next ( ) ; if ( ! keySet . contains ( key ) ) { it . remove ( ) ; } } return notionProperties ; } } return null ; |
public class SpatialiteCommonMethods { /** * Check for compatibility issues with other databases .
* @ param sql the original sql .
* @ return the fixed sql . */
public static String checkCompatibilityIssues ( String sql ) { } } | sql = sql . replaceAll ( "LONG PRIMARY KEY AUTOINCREMENT" , "INTEGER PRIMARY KEY AUTOINCREMENT" ) ; sql = sql . replaceAll ( "AUTO_INCREMENT" , "AUTOINCREMENT" ) ; return sql ; |
public class ZooKeeperMasterModel { /** * rollingUpdateUndeploy is used to undeploy jobs during a rolling update . It enables the
* ' skipRedundantUndeploys ' flag , which enables the redundantDeployment ( ) check . */
private RollingUpdateOp rollingUpdateUndeploy ( final ZooKeeperClient client , final RollingUpdateOpFactory opFactory , final DeploymentGroup deploymentGroup , final String host ) { } } | return rollingUpdateUndeploy ( client , opFactory , deploymentGroup , host , true ) ; |
public class AdminServlet { public void doGet ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { } } | if ( request . getQueryString ( ) != null && request . getQueryString ( ) . length ( ) > 0 ) { String target = doAction ( request ) ; response . sendRedirect ( request . getContextPath ( ) + request . getServletPath ( ) + ( request . getPathInfo ( ) != null ? request . getPathInfo ( ) : "" ) + ( target != null ? ( "#" + target ) : "" ) ) ; return ; } Page page = new Page ( ) ; page . title ( getServletInfo ( ) ) ; page . addHeader ( "" ) ; page . attribute ( "text" , "#000000" ) ; page . attribute ( Page . BGCOLOR , "#FFFFFF" ) ; page . attribute ( "link" , "#606CC0" ) ; page . attribute ( "vlink" , "#606CC0" ) ; page . attribute ( "alink" , "#606CC0" ) ; page . add ( new Block ( Block . Bold ) . add ( new Font ( 3 , true ) . add ( getServletInfo ( ) ) ) ) ; page . add ( Break . rule ) ; Form form = new Form ( request . getContextPath ( ) + request . getServletPath ( ) + "?A=exit" ) ; form . method ( "GET" ) ; form . add ( new Input ( Input . Submit , "A" , "Exit All Servers" ) ) ; page . add ( form ) ; page . add ( Break . rule ) ; page . add ( new Heading ( 3 , "Components:" ) ) ; List sList = new List ( List . Ordered ) ; page . add ( sList ) ; String id1 ; int i1 = 0 ; Iterator s = _servers . iterator ( ) ; while ( s . hasNext ( ) ) { id1 = "" + i1 ++ ; HttpServer server = ( HttpServer ) s . next ( ) ; Composite sItem = sList . newItem ( ) ; sItem . add ( "<B>HttpServer " ) ; sItem . add ( lifeCycle ( request , id1 , server ) ) ; sItem . add ( "</B>" ) ; sItem . add ( Break . line ) ; sItem . add ( "<B>Listeners:</B>" ) ; List lList = new List ( List . Unordered ) ; sItem . add ( lList ) ; HttpListener [ ] listeners = server . getListeners ( ) ; for ( int i2 = 0 ; i2 < listeners . length ; i2 ++ ) { HttpListener listener = listeners [ i2 ] ; String id2 = id1 + ":" + listener ; lList . add ( lifeCycle ( request , id2 , listener ) ) ; } Map hostMap = server . getHostMap ( ) ; sItem . add ( "<B>Contexts:</B>" ) ; List hcList = new List ( List . Unordered ) ; sItem . add ( hcList ) ; Iterator i2 = hostMap . entrySet ( ) . iterator ( ) ; while ( i2 . hasNext ( ) ) { Map . Entry hEntry = ( Map . Entry ) ( i2 . next ( ) ) ; String host = ( String ) hEntry . getKey ( ) ; PathMap contexts = ( PathMap ) hEntry . getValue ( ) ; Iterator i3 = contexts . entrySet ( ) . iterator ( ) ; while ( i3 . hasNext ( ) ) { Map . Entry cEntry = ( Map . Entry ) ( i3 . next ( ) ) ; String contextPath = ( String ) cEntry . getKey ( ) ; java . util . List contextList = ( java . util . List ) cEntry . getValue ( ) ; Composite hcItem = hcList . newItem ( ) ; if ( host != null ) hcItem . add ( "Host=" + host + ":" ) ; hcItem . add ( "ContextPath=" + contextPath ) ; String id3 = id1 + ":" + host + ":" + ( contextPath . length ( ) > 2 ? contextPath . substring ( 0 , contextPath . length ( ) - 2 ) : contextPath ) ; List cList = new List ( List . Ordered ) ; hcItem . add ( cList ) ; for ( int i4 = 0 ; i4 < contextList . size ( ) ; i4 ++ ) { String id4 = id3 + ":" + i4 ; Composite cItem = cList . newItem ( ) ; HttpContext hc = ( HttpContext ) contextList . get ( i4 ) ; cItem . add ( lifeCycle ( request , id4 , hc ) ) ; cItem . add ( "<BR>ResourceBase=" + hc . getResourceBase ( ) ) ; cItem . add ( "<BR>ClassPath=" + hc . getClassPath ( ) ) ; List hList = new List ( List . Ordered ) ; cItem . add ( hList ) ; int handlers = hc . getHandlers ( ) . length ; for ( int i5 = 0 ; i5 < handlers ; i5 ++ ) { String id5 = id4 + ":" + i5 ; HttpHandler handler = hc . getHandlers ( ) [ i5 ] ; Composite hItem = hList . newItem ( ) ; hItem . add ( lifeCycle ( request , id5 , handler , handler . getName ( ) ) ) ; if ( handler instanceof ServletHandler ) { hItem . add ( "<BR>" + ( ( ServletHandler ) handler ) . getServletMap ( ) ) ; } } } } } sItem . add ( "<P>" ) ; } response . setContentType ( "text/html" ) ; response . setHeader ( "Pragma" , "no-cache" ) ; response . setHeader ( "Cache-Control" , "no-cache,no-store" ) ; Writer writer = response . getWriter ( ) ; page . write ( writer ) ; writer . flush ( ) ; |
public class FilterCell { /** * Add a new succeeding cell to this cell , based on a new valid address value
* that
* can follow this cell ' s value , into the address tree . This is done
* by adding the new cell to the hashtable of next cells .
* @ param newValue
* a valid value , that can follow this cell ' s value , in the address
* tree
* @ return the new cell that was added . */
public FilterCell addNewCell ( int newValue ) { } } | if ( newValue != - 1 ) { if ( nextCell == null ) { nextCell = new FastSynchHashTable ( ) ; } FilterCell newCell = new FilterCell ( ) ; nextCell . put ( newValue , newCell ) ; return newCell ; } if ( wildcardCell == null ) { wildcardCell = new FilterCell ( ) ; } return wildcardCell ; |
public class CmsWaitHandle { /** * Waits for a maximum of waitTime , but returns if another thread calls release ( ) . < p >
* @ param waitTime the maximum wait time */
public synchronized void enter ( long waitTime ) { } } | if ( m_singleUse && m_released ) { return ; } try { wait ( waitTime ) ; } catch ( InterruptedException e ) { // should never happen , but log it just in case . . .
LOG . error ( e . getLocalizedMessage ( ) , e ) ; } |
public class WampAnnotationMethodMessageHandler { /** * Configure the complete list of supported argument types effectively overriding the
* ones configured by default . This is an advanced option . For most use cases it
* should be sufficient to use { @ link # setCustomArgumentResolvers ( java . util . List ) } . */
public void setArgumentResolvers ( List < HandlerMethodArgumentResolver > argumentResolvers ) { } } | if ( argumentResolvers == null ) { this . argumentResolvers . clear ( ) ; return ; } this . argumentResolvers . addResolvers ( argumentResolvers ) ; |
public class ImageTexture { /** * Provide array of String results from inputOutput MFString field named url .
* @ array saved in valueDestination */
public String [ ] getUrl ( ) { } } | String [ ] valueDestination = new String [ url . size ( ) ] ; this . url . getValue ( valueDestination ) ; return valueDestination ; |
public class VanillaNetworkContext { /** * Close the connection atomically .
* @ return true if state changed to closed ; false if nothing changed . */
protected boolean closeAtomically ( ) { } } | if ( isClosed . compareAndSet ( false , true ) ) { Closeable . closeQuietly ( networkStatsListener ) ; return true ; } else { // was already closed .
return false ; } |
public class XsValueImpl { /** * utilities */
private static void checkType ( String typeName , QName type ) { } } | if ( ! typeName . equals ( type . getLocalPart ( ) ) ) { throw new IllegalArgumentException ( "requires " + typeName + " instead of " + type . getLocalPart ( ) ) ; } |
public class MediaTypes { /** * Contains any of these types ?
* @ param types Types
* @ return TRUE if any of these types are present inside this . list */
public boolean contains ( final MediaTypes types ) { } } | boolean contains = false ; for ( final MediaType type : types . list ) { if ( this . contains ( type ) ) { contains = true ; break ; } } return contains ; |
public class List { /** * setter for itemList - sets contains items of the level 1 . The items of the level 1 could contain further items of next level and so on in order to represent an iterative structure of list items .
* @ generated
* @ param v value to set into the feature */
public void setItemList ( FSArray v ) { } } | if ( List_Type . featOkTst && ( ( List_Type ) jcasType ) . casFeat_itemList == null ) jcasType . jcas . throwFeatMissing ( "itemList" , "de.julielab.jules.types.List" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( List_Type ) jcasType ) . casFeatCode_itemList , jcasType . ll_cas . ll_getFSRef ( v ) ) ; |
public class TemplateLocation { /** * Determine if this template location exists using the specified
* { @ link ResourcePatternResolver } .
* @ param resolver the resolver used to test if the location exists
* @ return { @ code true } if the location exists . */
public boolean exists ( ResourcePatternResolver resolver ) { } } | Assert . notNull ( resolver , "Resolver must not be null" ) ; if ( resolver . getResource ( this . path ) . exists ( ) ) { return true ; } try { return anyExists ( resolver ) ; } catch ( IOException ex ) { return false ; } |
public class TenantServiceClient { /** * Lists all tenants associated with the project .
* < p > Sample code :
* < pre > < code >
* try ( TenantServiceClient tenantServiceClient = TenantServiceClient . create ( ) ) {
* ProjectName parent = ProjectName . of ( " [ PROJECT ] " ) ;
* for ( Tenant element : tenantServiceClient . listTenants ( parent . toString ( ) ) . iterateAll ( ) ) {
* / / doThingsWith ( element ) ;
* < / code > < / pre >
* @ param parent Required .
* < p > Resource name of the project under which the tenant is created .
* < p > The format is " projects / { project _ id } " , for example , " projects / api - test - project " .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final ListTenantsPagedResponse listTenants ( String parent ) { } } | ListTenantsRequest request = ListTenantsRequest . newBuilder ( ) . setParent ( parent ) . build ( ) ; return listTenants ( request ) ; |
public class PersistenceUtil { /** * Will create a publisher that parallelizes each publisher returned from the < b > publisherFunction < / b > by executing
* them on the executor as needed .
* Note that returned publisher will be publishing entries from the invocation of the executor . Thus any subscription
* will not block the thread it was invoked on , unless explicitly configured to do so .
* @ param segments segments to parallelize across
* @ param executor the executor execute parallelized operations on
* @ param publisherFunction function that creates a different publisher for each segment
* @ param < R > the returned value
* @ return a publisher that */
public static < R > Publisher < R > parallelizePublisher ( IntSet segments , Executor executor , IntFunction < Publisher < R > > publisherFunction ) { } } | return org . infinispan . persistence . internal . PersistenceUtil . parallelizePublisher ( segments , Schedulers . from ( executor ) , publisherFunction ) ; |
public class AbstractProbeListener { /** * Build a stack trace string
* @ param failure The failure to get the exceptions and so on
* @ return The stack trace stringified */
protected String createAndlogStackTrace ( Failure failure ) { } } | StringBuilder sb = new StringBuilder ( ) ; if ( failure . getMessage ( ) != null && ! failure . getMessage ( ) . isEmpty ( ) ) { sb . append ( "Failure message: " ) . append ( failure . getMessage ( ) ) ; } if ( failure . getException ( ) != null ) { sb . append ( "\n\n" ) ; sb . append ( failure . getException ( ) . getClass ( ) . getCanonicalName ( ) ) . append ( ": " ) . append ( failure . getMessage ( ) ) . append ( "\n" ) ; for ( StackTraceElement ste : failure . getException ( ) . getStackTrace ( ) ) { sb . append ( "\tat " ) . append ( ste . getClassName ( ) ) . append ( "." ) . append ( ste . getMethodName ( ) ) . append ( "(" ) . append ( ste . getFileName ( ) ) . append ( ":" ) . append ( ste . getLineNumber ( ) ) . append ( ")\n" ) ; if ( ! fullStackTraces && ste . getClassName ( ) . equals ( failure . getDescription ( ) . getClassName ( ) ) ) { sb . append ( "\t...\n" ) ; break ; } } if ( fullStackTraces && failure . getException ( ) . getCause ( ) != null ) { sb . append ( "Cause: " ) . append ( failure . getException ( ) . getCause ( ) . getMessage ( ) ) . append ( "\n" ) ; for ( StackTraceElement ste : failure . getException ( ) . getCause ( ) . getStackTrace ( ) ) { sb . append ( "\tat " ) . append ( ste . getClassName ( ) ) . append ( "." ) . append ( ste . getMethodName ( ) ) . append ( "(" ) . append ( ste . getFileName ( ) ) . append ( ":" ) . append ( ste . getLineNumber ( ) ) . append ( ")\n" ) ; } } LOGGER . info ( "\n" + failure . getTestHeader ( ) + "\n" + sb . toString ( ) ) ; } return sb . toString ( ) ; |
public class TokenSequencePreservingPartialParsingHelper { /** * Investigates the composite nodes containing the changed region and collects a list of nodes which could possibly
* replaced by a partial parse . Such a node has a parent that consumes all his current lookahead tokens and all of
* these tokens are located before the changed region . */
protected List < ICompositeNode > internalFindValidReplaceRootNodeForChangeRegion ( List < ICompositeNode > nodesEnclosingRegion ) { } } | List < ICompositeNode > result = new ArrayList < ICompositeNode > ( ) ; boolean mustSkipNext = false ; for ( int i = 0 ; i < nodesEnclosingRegion . size ( ) ; i ++ ) { ICompositeNode node = nodesEnclosingRegion . get ( i ) ; if ( node . getGrammarElement ( ) != null ) { if ( ! mustSkipNext ) { result . add ( node ) ; if ( isActionNode ( node ) ) { mustSkipNext = true ; } } else { mustSkipNext = isActionNode ( node ) ; } } } return result ; |
public class Queue { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . runtime . SIMPQueueControllable # getRemoteQueuePointIterator ( ) */
public SIMPIterator getRemoteQueuePointIterator ( ) throws SIMPException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getRemoteQueuePointIterator" ) ; assertMessageHandlerNotCorrupt ( ) ; Index index = baseDest . getRemoteQueuePoints ( ) ; SIMPIterator itr = index . iterator ( ) ; SIMPIterator returnItr = new BasicSIMPIterator ( itr ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getRemoteQueuePointIterator" , returnItr ) ; return returnItr ; |
public class PermissionsImpl { /** * Gets the list of user emails that have permissions to access your application .
* @ param appId The application ID .
* @ 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 < UserAccessList > listAsync ( UUID appId , final ServiceCallback < UserAccessList > serviceCallback ) { } } | return ServiceFuture . fromResponse ( listWithServiceResponseAsync ( appId ) , serviceCallback ) ; |
public class FileSnap { /** * deserialize the datatree from an inputarchive
* @ param dt the datatree to be serialized into
* @ param sessions the sessions to be filled up
* @ param ia the input archive to restore from
* @ throws IOException */
public void deserialize ( DataTree dt , Map < Long , Long > sessions , InputArchive ia ) throws IOException { } } | FileHeader header = new FileHeader ( ) ; header . deserialize ( ia , "fileheader" ) ; if ( header . getMagic ( ) != SNAP_MAGIC ) { throw new IOException ( "mismatching magic headers " + header . getMagic ( ) + " != " + FileSnap . SNAP_MAGIC ) ; } SerializeUtils . deserializeSnapshot ( dt , ia , sessions ) ; |
public class CollectorRegistry { /** * Register a Collector .
* A collector can be registered to multiple CollectorRegistries . */
public void register ( Collector m ) { } } | List < String > names = collectorNames ( m ) ; synchronized ( collectorsToNames ) { for ( String name : names ) { if ( namesToCollectors . containsKey ( name ) ) { throw new IllegalArgumentException ( "Collector already registered that provides name: " + name ) ; } } for ( String name : names ) { namesToCollectors . put ( name , m ) ; } collectorsToNames . put ( m , names ) ; } |
public class InApplicationMonitorJMXConnector { /** * / * operations that can be invoked via JMX */
private void addStatsdPlugin ( String host , Integer port , String appName , Double sampleRate ) { } } | StatsdPlugin statsdPlugin ; try { statsdPlugin = new StatsdPlugin ( host , port , appName , sampleRate ) ; InApplicationMonitor . getInstance ( ) . registerPlugin ( statsdPlugin ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } |
public class WMenu { /** * Override handleRequest in order to perform processing specific to WMenu .
* @ param request the request being handled . */
@ Override public void handleRequest ( final Request request ) { } } | if ( isDisabled ( ) ) { // Protect against client - side tampering of disabled / read - only fields .
return ; } if ( isPresent ( request ) ) { List < MenuItemSelectable > selectedItems = new ArrayList < > ( ) ; // Unfortunately , we need to recurse through all the menu / sub - menus
findSelections ( request , this , selectedItems ) ; setSelectedMenuItems ( selectedItems ) ; } |
public class ListAssignmentsForHITRequest { /** * The status of the assignments to return : Submitted | Approved | Rejected
* @ param assignmentStatuses
* The status of the assignments to return : Submitted | Approved | Rejected
* @ return Returns a reference to this object so that method calls can be chained together .
* @ see AssignmentStatus */
public ListAssignmentsForHITRequest withAssignmentStatuses ( AssignmentStatus ... assignmentStatuses ) { } } | java . util . ArrayList < String > assignmentStatusesCopy = new java . util . ArrayList < String > ( assignmentStatuses . length ) ; for ( AssignmentStatus value : assignmentStatuses ) { assignmentStatusesCopy . add ( value . toString ( ) ) ; } if ( getAssignmentStatuses ( ) == null ) { setAssignmentStatuses ( assignmentStatusesCopy ) ; } else { getAssignmentStatuses ( ) . addAll ( assignmentStatusesCopy ) ; } return this ; |
public class MerkleTreeUtil { /** * Returns the breadth - first order of the rightmost leaf in the
* subtree selected by { @ code nodeOrder } as the root of the subtree
* @ param nodeOrder The order of the node as the root of the subtree
* @ param depth The depth of the tree
* @ return the breadth - first order of the rightmost leaf under the
* provided node */
static int getRightMostLeafUnderNode ( int nodeOrder , int depth ) { } } | if ( isLeaf ( nodeOrder , depth ) ) { return nodeOrder ; } int levelOfNode = getLevelOfNode ( nodeOrder ) ; int distanceFromLeafLevel = depth - levelOfNode - 1 ; int leftMostLeafUnderNode = getLeftMostLeafUnderNode ( nodeOrder , depth ) ; int leavesOfSubtreeUnderNode = getNodesOnLevel ( distanceFromLeafLevel ) ; return leftMostLeafUnderNode + leavesOfSubtreeUnderNode - 1 ; |
public class ThrottlingException { /** * The payload associated with the exception .
* { @ code ByteBuffer } s are stateful . Calling their { @ code get } methods changes their { @ code position } . We recommend
* using { @ link java . nio . ByteBuffer # asReadOnlyBuffer ( ) } to create a read - only view of the buffer with an independent
* { @ code position } , and calling { @ code get } methods on this rather than directly on the returned { @ code ByteBuffer } .
* Doing so will ensure that anyone else using the { @ code ByteBuffer } will not be affected by changes to the
* { @ code position } .
* @ return The payload associated with the exception . */
@ com . fasterxml . jackson . annotation . JsonProperty ( "payload" ) public java . nio . ByteBuffer getPayload ( ) { } } | return this . payload ; |
public class BasicChecker { /** * Internal method to check that cert has a valid DN to be next in a chain */
private void verifyNameChaining ( X509Certificate cert ) throws CertPathValidatorException { } } | if ( prevSubject != null ) { String msg = "subject/issuer name chaining" ; if ( debug != null ) debug . println ( "---checking " + msg + "..." ) ; X500Principal currIssuer = cert . getIssuerX500Principal ( ) ; // reject null or empty issuer DNs
if ( X500Name . asX500Name ( currIssuer ) . isEmpty ( ) ) { throw new CertPathValidatorException ( msg + " check failed: " + "empty/null issuer DN in certificate is invalid" , null , null , - 1 , PKIXReason . NAME_CHAINING ) ; } if ( ! ( currIssuer . equals ( prevSubject ) ) ) { throw new CertPathValidatorException ( msg + " check failed" , null , null , - 1 , PKIXReason . NAME_CHAINING ) ; } if ( debug != null ) debug . println ( msg + " verified." ) ; } |
public class ConnectionsInner { /** * Update a connection .
* @ param resourceGroupName Name of an Azure Resource group .
* @ param automationAccountName The name of the automation account .
* @ param connectionName The parameters supplied to the update a connection operation .
* @ param parameters The parameters supplied to the update a connection operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the ConnectionInner object */
public Observable < ConnectionInner > updateAsync ( String resourceGroupName , String automationAccountName , String connectionName , ConnectionUpdateParameters parameters ) { } } | return updateWithServiceResponseAsync ( resourceGroupName , automationAccountName , connectionName , parameters ) . map ( new Func1 < ServiceResponse < ConnectionInner > , ConnectionInner > ( ) { @ Override public ConnectionInner call ( ServiceResponse < ConnectionInner > response ) { return response . body ( ) ; } } ) ; |
public class CliClassContainer { /** * This method adds the given { @ link CliMode } .
* @ param mode is the { @ link CliMode } to add . */
protected void addMode ( CliModeContainer mode ) { } } | CliModeObject old = this . id2ModeMap . put ( mode . getId ( ) , mode ) ; if ( old != null ) { CliStyleHandling handling = this . cliStyle . modeDuplicated ( ) ; DuplicateObjectException exception = new DuplicateObjectException ( mode , mode . getMode ( ) . id ( ) ) ; if ( handling != CliStyleHandling . OK ) { handling . handle ( LOG , exception ) ; } } |
public class PDClient { /** * The main execution routine . Overwrite this method to add additional
* properties to the call .
* @ param aRequest
* The request to be executed . Never < code > null < / code > .
* @ param aHandler
* The response handler to be used . May not be < code > null < / code > .
* @ return The return value of the response handler . Never < code > null < / code > .
* @ throws IOException
* On HTTP error
* @ param < T >
* Response type */
@ Nonnull @ OverrideOnDemand protected < T > T executeRequest ( @ Nonnull final HttpRequestBase aRequest , @ Nonnull final ResponseHandler < T > aHandler ) throws IOException { } } | // Contextual attributes set the local context level will take
// precedence over those set at the client level .
final HttpContext aContext = HttpClientHelper . createHttpContext ( m_aProxy , m_aProxyCredentials ) ; return m_aHttpClientMgr . execute ( aRequest , aContext , aHandler ) ; |
public class PartitionBalance { /** * Go through all node IDs and determine which node
* @ param cluster
* @ param storeRoutingPlan
* @ return */
private Map < Integer , Integer > getNodeIdToNaryCount ( Cluster cluster , StoreRoutingPlan storeRoutingPlan ) { } } | Map < Integer , Integer > nodeIdToNaryCount = Maps . newHashMap ( ) ; for ( int nodeId : cluster . getNodeIds ( ) ) { nodeIdToNaryCount . put ( nodeId , storeRoutingPlan . getZoneNAryPartitionIds ( nodeId ) . size ( ) ) ; } return nodeIdToNaryCount ; |
public class BaasUser { /** * Asynchronously requests to follow the user .
* @ param flags { @ link RequestOptions }
* @ param handler an handler to be invoked when the request completes
* @ return a { @ link com . baasbox . android . RequestToken } to manage the request */
public RequestToken follow ( int flags , BaasHandler < BaasUser > handler ) { } } | BaasBox box = BaasBox . getDefaultChecked ( ) ; Follow follow = new Follow ( box , true , this , RequestOptions . DEFAULT , handler ) ; return box . submitAsync ( follow ) ; |
public class Unpickler { /** * Process a single pickle stream opcode . */
protected Object dispatch ( short key ) throws PickleException , IOException { } } | switch ( key ) { case Opcodes . MARK : load_mark ( ) ; break ; case Opcodes . STOP : Object value = stack . pop ( ) ; stack . clear ( ) ; return value ; // final result value
case Opcodes . POP : load_pop ( ) ; break ; case Opcodes . POP_MARK : load_pop_mark ( ) ; break ; case Opcodes . DUP : load_dup ( ) ; break ; case Opcodes . FLOAT : load_float ( ) ; break ; case Opcodes . INT : load_int ( ) ; break ; case Opcodes . BININT : load_binint ( ) ; break ; case Opcodes . BININT1 : load_binint1 ( ) ; break ; case Opcodes . LONG : load_long ( ) ; break ; case Opcodes . BININT2 : load_binint2 ( ) ; break ; case Opcodes . NONE : load_none ( ) ; break ; case Opcodes . PERSID : load_persid ( ) ; break ; case Opcodes . BINPERSID : load_binpersid ( ) ; break ; case Opcodes . REDUCE : load_reduce ( ) ; break ; case Opcodes . STRING : load_string ( ) ; break ; case Opcodes . BINSTRING : load_binstring ( ) ; break ; case Opcodes . SHORT_BINSTRING : load_short_binstring ( ) ; break ; case Opcodes . UNICODE : load_unicode ( ) ; break ; case Opcodes . BINUNICODE : load_binunicode ( ) ; break ; case Opcodes . APPEND : load_append ( ) ; break ; case Opcodes . BUILD : load_build ( ) ; break ; case Opcodes . GLOBAL : load_global ( ) ; break ; case Opcodes . DICT : load_dict ( ) ; break ; case Opcodes . EMPTY_DICT : load_empty_dictionary ( ) ; break ; case Opcodes . APPENDS : load_appends ( ) ; break ; case Opcodes . GET : load_get ( ) ; break ; case Opcodes . BINGET : load_binget ( ) ; break ; case Opcodes . INST : load_inst ( ) ; break ; case Opcodes . LONG_BINGET : load_long_binget ( ) ; break ; case Opcodes . LIST : load_list ( ) ; break ; case Opcodes . EMPTY_LIST : load_empty_list ( ) ; break ; case Opcodes . OBJ : load_obj ( ) ; break ; case Opcodes . PUT : load_put ( ) ; break ; case Opcodes . BINPUT : load_binput ( ) ; break ; case Opcodes . LONG_BINPUT : load_long_binput ( ) ; break ; case Opcodes . SETITEM : load_setitem ( ) ; break ; case Opcodes . TUPLE : load_tuple ( ) ; break ; case Opcodes . EMPTY_TUPLE : load_empty_tuple ( ) ; break ; case Opcodes . SETITEMS : load_setitems ( ) ; break ; case Opcodes . BINFLOAT : load_binfloat ( ) ; break ; // protocol 2
case Opcodes . PROTO : load_proto ( ) ; break ; case Opcodes . NEWOBJ : load_newobj ( ) ; break ; case Opcodes . EXT1 : case Opcodes . EXT2 : case Opcodes . EXT4 : throw new PickleException ( "Unimplemented opcode EXT1/EXT2/EXT4 encountered. Don't use extension codes when pickling via copyreg.add_extension() to avoid this error." ) ; case Opcodes . TUPLE1 : load_tuple1 ( ) ; break ; case Opcodes . TUPLE2 : load_tuple2 ( ) ; break ; case Opcodes . TUPLE3 : load_tuple3 ( ) ; break ; case Opcodes . NEWTRUE : load_true ( ) ; break ; case Opcodes . NEWFALSE : load_false ( ) ; break ; case Opcodes . LONG1 : load_long1 ( ) ; break ; case Opcodes . LONG4 : load_long4 ( ) ; break ; // Protocol 3 ( Python 3 . x )
case Opcodes . BINBYTES : load_binbytes ( ) ; break ; case Opcodes . SHORT_BINBYTES : load_short_binbytes ( ) ; break ; // Protocol 4 ( Python 3.4 + )
case Opcodes . BINUNICODE8 : load_binunicode8 ( ) ; break ; case Opcodes . SHORT_BINUNICODE : load_short_binunicode ( ) ; break ; case Opcodes . BINBYTES8 : load_binbytes8 ( ) ; break ; case Opcodes . EMPTY_SET : load_empty_set ( ) ; break ; case Opcodes . ADDITEMS : load_additems ( ) ; break ; case Opcodes . FROZENSET : load_frozenset ( ) ; break ; case Opcodes . MEMOIZE : load_memoize ( ) ; break ; case Opcodes . FRAME : load_frame ( ) ; break ; case Opcodes . NEWOBJ_EX : load_newobj_ex ( ) ; break ; case Opcodes . STACK_GLOBAL : load_stack_global ( ) ; break ; default : throw new InvalidOpcodeException ( "invalid pickle opcode: " + key ) ; } return NO_RETURN_VALUE ; |
public class AgentServlet { /** * OPTION requests are treated as CORS preflight requests
* @ param req the original request
* @ param resp the response the answer are written to */
@ Override protected void doOptions ( HttpServletRequest req , HttpServletResponse resp ) throws ServletException , IOException { } } | Map < String , String > responseHeaders = requestHandler . handleCorsPreflightRequest ( getOriginOrReferer ( req ) , req . getHeader ( "Access-Control-Request-Headers" ) ) ; for ( Map . Entry < String , String > entry : responseHeaders . entrySet ( ) ) { resp . setHeader ( entry . getKey ( ) , entry . getValue ( ) ) ; } |
public class FormPrintServiceImpl { /** * This method is used to generate byte stream of forms
* @ param pdDoc
* ProposalDevelopmentDocumentContract
* @ return ByteArrayOutputStream [ ] PDF byte Array */
protected PrintableResult getPDFStream ( ProposalDevelopmentDocumentContract pdDoc ) throws S2SException { } } | List < AuditError > errors = new ArrayList < > ( ) ; DevelopmentProposalContract developmentProposal = pdDoc . getDevelopmentProposal ( ) ; String proposalNumber = developmentProposal . getProposalNumber ( ) ; List < String > sortedNameSpaces = getSortedNameSpaces ( proposalNumber , developmentProposal . getS2sOppForms ( ) ) ; List < S2SPrintable > formPrintables = new ArrayList < > ( ) ; boolean formEntryFlag = true ; getNarrativeService ( ) . deleteSystemGeneratedNarratives ( pdDoc . getDevelopmentProposal ( ) . getNarratives ( ) ) ; Forms forms = Forms . Factory . newInstance ( ) ; for ( String namespace : sortedNameSpaces ) { FormMappingInfo info = formMappingService . getFormInfo ( namespace , proposalNumber ) ; if ( info == null ) continue ; S2SFormGenerator s2sFormGenerator = s2SFormGeneratorService . getS2SGenerator ( proposalNumber , info . getNameSpace ( ) ) ; XmlObject formObject = s2sFormGenerator . getFormObject ( pdDoc ) ; errors . addAll ( s2sFormGenerator . getAuditErrors ( ) ) ; if ( s2SValidatorService . validate ( formObject , errors , info . getFormName ( ) ) && errors . isEmpty ( ) && StringUtils . isNotBlank ( info . getStyleSheet ( ) ) ) { String applicationXml = formObject . xmlText ( s2SFormGeneratorService . getXmlOptionsPrefixes ( ) ) ; String filteredApplicationXml = s2SDateTimeService . removeTimezoneFactor ( applicationXml ) ; byte [ ] formXmlBytes = filteredApplicationXml . getBytes ( ) ; GenericPrintable formPrintable = new GenericPrintable ( ) ; // Linkedhashmap is used to preserve the order of entry .
Map < String , byte [ ] > formXmlDataMap = new LinkedHashMap < > ( ) ; formXmlDataMap . put ( info . getFormName ( ) , formXmlBytes ) ; formPrintable . setStreamMap ( formXmlDataMap ) ; ArrayList < Source > templates = new ArrayList < > ( ) ; DefaultResourceLoader resourceLoader = new DefaultResourceLoader ( ClassLoaderUtils . getDefaultClassLoader ( ) ) ; Resource resource = resourceLoader . getResource ( info . getStyleSheet ( ) ) ; Source xsltSource ; try { xsltSource = new StreamSource ( resource . getInputStream ( ) ) ; } catch ( IOException e ) { throw new S2SException ( e ) ; } templates . add ( xsltSource ) ; formPrintable . setXSLTemplates ( templates ) ; List < AttachmentData > attachmentList = s2sFormGenerator . getAttachments ( ) ; try { if ( developmentProposal . getGrantsGovSelectFlag ( ) ) { List < S2sAppAttachmentsContract > attachmentLists = new ArrayList < > ( ) ; setFormObject ( forms , formObject ) ; saveGrantsGovXml ( pdDoc , formEntryFlag , forms , attachmentList , attachmentLists ) ; formEntryFlag = false ; } } catch ( Exception e ) { LOG . error ( e . getMessage ( ) , e ) ; } Map < String , byte [ ] > formAttachments = new LinkedHashMap < > ( ) ; if ( attachmentList != null && ! attachmentList . isEmpty ( ) ) { for ( AttachmentData attachmentData : attachmentList ) { if ( ! isPdfType ( attachmentData . getContent ( ) ) ) continue ; StringBuilder attachment = new StringBuilder ( ) ; attachment . append ( " ATT : " ) ; attachment . append ( attachmentData . getContentId ( ) ) ; formAttachments . put ( attachment . toString ( ) , attachmentData . getContent ( ) ) ; } } if ( formAttachments . size ( ) > 0 ) { formPrintable . setAttachments ( formAttachments ) ; } formPrintables . add ( formPrintable ) ; } } final PrintableResult result = new PrintableResult ( ) ; result . errors = errors ; result . printables = formPrintables ; return result ; |
public class GenomicsUtils { /** * Gets CallSets for a given variantSetId using the Genomics API .
* @ param variantSetId The id of the variantSet to query .
* @ param auth The OfflineAuth for the API request .
* @ return The list of callSet names in the variantSet .
* @ throws IOException If variantSet does not contain any CallSets . */
public static Iterable < CallSet > getCallSets ( String variantSetId , OfflineAuth auth ) throws IOException { } } | Genomics genomics = GenomicsFactory . builder ( ) . build ( ) . fromOfflineAuth ( auth ) ; return Paginator . Callsets . create ( genomics ) . search ( new SearchCallSetsRequest ( ) . setVariantSetIds ( Lists . newArrayList ( variantSetId ) ) , "callSets,nextPageToken" ) ; |
public class FixedJitterBuffer { /** * Resets buffer . */
public void reset ( ) { } } | boolean locked = false ; try { locked = lock . tryLock ( ) || lock . tryLock ( 5 , TimeUnit . MILLISECONDS ) ; if ( locked ) { while ( queue . size ( ) > 0 ) { queue . remove ( 0 ) . recycle ( ) ; } } } catch ( InterruptedException e ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Could not acquire lock to reset jitter buffer." ) ; } } finally { if ( locked ) { lock . unlock ( ) ; } } |
public class SingleLockedMessageEnumerationImpl { /** * Peek at the next message on the enumeration .
* In the SingleLockedMessageEnumeration there is only one message .
* If the nextLocked hasn ' t been called then the message will be returned ,
* otherwise a null will be returned . */
public SIBusMessage peek ( ) throws SISessionUnavailableException , SIResourceException , SIIncorrectCallException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "peek" ) ; checkValidState ( "peek" ) ; _localConsumerPoint . checkNotClosed ( ) ; SIBusMessage nextMessage = null ; if ( ! _seenSingleMessage ) { // Because this message is not in the message store there is no need to copy it
// before giving it to a caller unless this is pubsub , in which case there may be
// other subscriptions referencing the same message , in which case we must copy the
// message ( unless the caller indicates that they won ' t be altering it )
if ( _isPubsub && ( ( ConnectionImpl ) ( _localConsumerPoint . getConsumerSession ( ) . getConnection ( ) ) ) . getMessageCopiedWhenReceived ( ) ) { try { nextMessage = ( _singleMessage . getMessage ( ) ) . getReceived ( ) ; } catch ( MessageCopyFailedException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.SingleLockedMessageEnumerationImpl.peek" , "1:456:1.44" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.impl.SingleLockedMessageEnumerationImpl" , "1:463:1.44" , e } ) ; _seenSingleMessage = false ; _messageAvailable = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && CoreSPILockedMessageEnumeration . tc . isEntryEnabled ( ) ) SibTr . exit ( CoreSPILockedMessageEnumeration . tc , "peek" , e ) ; throw new SIResourceException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.impl.SingleLockedMessageEnumerationImpl" , "1:477:1.44" , e } , null ) , e ) ; } } else nextMessage = _singleMessage . getMessage ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "peek" , nextMessage ) ; return nextMessage ; |
public class BlockDataHandler { /** * Creates the { @ link ChunkData } for specified identifier for the { @ link Chunk } at the { @ link BlockPos } .
* @ param < T > the generic type
* @ param identifier the identifier
* @ param world the world
* @ param pos the pos
* @ return the chunk data */
@ SuppressWarnings ( "unchecked" ) private < T > ChunkData < T > createChunkData ( String identifier , World world , BlockPos pos ) { } } | Chunk chunk = world . getChunkFromBlockCoords ( pos ) ; // System . out . println ( " createChunkData ( " + chunk . xPosition + " / " + chunk . zPosition + " ) for " + identifier ) ;
ChunkData < T > chunkData = new ChunkData < > ( ( HandlerInfo < T > ) handlerInfos . get ( identifier ) ) ; datas . get ( ) . put ( identifier , chunk , chunkData ) ; return chunkData ; |
public class MixedRealityClientImpl { /** * Check Name Availability for global uniqueness .
* @ param location The location in which uniqueness will be verified .
* @ param checkNameAvailability Check Name Availability Request .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the CheckNameAvailabilityResponseInner object if successful . */
public CheckNameAvailabilityResponseInner checkNameAvailabilityLocal ( String location , CheckNameAvailabilityRequest checkNameAvailability ) { } } | return checkNameAvailabilityLocalWithServiceResponseAsync ( location , checkNameAvailability ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class XmlUtil { /** * Write a pretty version of the Element to the OutputStream .
* @ param element the Element to serialize
* @ param os the OutputStream to write to */
public static void serialize ( Element element , OutputStream os ) { } } | Source source = new DOMSource ( element ) ; serialize ( source , os ) ; |
public class ArrayUtil { /** * Un - flatten a one - dimensional array into an multi - dimensional array based on the provided dimensions .
* @ param array the 1 - dimensional array to un - flatten .
* @ param dimensions the dimensions to un - flatten to .
* @ return a multi - dimensional array of the provided dimensions . */
public static Object unflatten ( Object array , int [ ] dimensions ) { } } | Class < ? > type = getType ( array ) ; return unflatten ( type , array , dimensions , 0 ) ; |
public class JVnSenSegmenter { /** * main method of JVnSenSegmenter
* to use this tool from command line .
* @ param args the arguments */
public static void main ( String args [ ] ) { } } | if ( args . length != 4 ) { displayHelp ( ) ; System . exit ( 1 ) ; } try { JVnSenSegmenter senSegmenter = new JVnSenSegmenter ( ) ; senSegmenter . init ( args [ 1 ] ) ; String option = args [ 2 ] ; if ( option . equalsIgnoreCase ( "-inputfile" ) ) { senSegmentFile ( args [ 3 ] , args [ 3 ] + ".sent" , senSegmenter ) ; } else if ( option . equalsIgnoreCase ( "-inputdir" ) ) { // segment only files ends with . txt
File inputDir = new File ( args [ 3 ] ) ; File [ ] childrent = inputDir . listFiles ( new FilenameFilter ( ) { public boolean accept ( File dir , String name ) { return name . endsWith ( ".txt" ) ; } } ) ; for ( int i = 0 ; i < childrent . length ; ++ i ) { System . out . println ( "Segmenting sentences in " + childrent [ i ] ) ; senSegmentFile ( childrent [ i ] . getPath ( ) , childrent [ i ] . getPath ( ) + ".sent" , senSegmenter ) ; } } else displayHelp ( ) ; } catch ( Exception e ) { System . out . println ( e . getMessage ( ) ) ; return ; } |
public class PostProcessorCssImageUrlRewriter { /** * ( non - Javadoc )
* @ see net . jawr . web . resource . bundle . css . CssImageUrlRewriter #
* getRewrittenImagePath ( java . lang . String , java . lang . String ,
* java . lang . String ) */
@ Override protected String getRewrittenImagePath ( String originalCssPath , String newCssPath , String url ) throws IOException { } } | String imgUrl = null ; // Retrieve the current CSS file from which the CSS image is referenced
String currentCss = originalCssPath ; boolean generatedImg = false ; if ( binaryRsHandler != null ) { GeneratorRegistry imgRsGeneratorRegistry = binaryRsHandler . getConfig ( ) . getGeneratorRegistry ( ) ; generatedImg = imgRsGeneratorRegistry . isGeneratedBinaryResource ( url ) ; } boolean cssGeneratorIsHandleCssImage = isCssGeneratorHandlingCssImage ( currentCss ) ; String rootPath = currentCss ; // If the CSS image is taken from the classpath , add the classpath cache
// prefix
if ( generatedImg || cssGeneratorIsHandleCssImage ) { String tempUrl = url ; // If it ' s a classpath CSS , the url of the CSS image is defined
// relatively to it .
if ( cssGeneratorIsHandleCssImage && ! generatedImg ) { tempUrl = PathNormalizer . concatWebPath ( rootPath , url ) ; } // generate image cache URL
imgUrl = rewriteURL ( tempUrl , binaryServletPath , newCssPath , binaryRsHandler ) ; } else { if ( config . getGeneratorRegistry ( ) . isPathGenerated ( rootPath ) ) { rootPath = rootPath . substring ( rootPath . indexOf ( GeneratorRegistry . PREFIX_SEPARATOR ) + 1 ) ; } // Generate the image URL from the current CSS path
imgUrl = PathNormalizer . concatWebPath ( rootPath , url ) ; imgUrl = rewriteURL ( imgUrl , binaryServletPath , newCssPath , binaryRsHandler ) ; } // This following condition should never be true .
// If it does , it means that the image path is wrongly defined .
if ( imgUrl == null ) { LOGGER . error ( "The CSS image path for '" + url + "' defined in '" + currentCss + "' is out of the application context. Please check your CSS file." ) ; } return imgUrl ; |
public class AAFConDME2 { /** * / * ( non - Javadoc )
* @ see com . att . cadi . aaf . v2_0 . AAFCon # rclient ( java . net . URI , com . att . cadi . SecuritySetter ) */
@ Override protected Rcli < DME2Client > rclient ( URI uri , SecuritySetter < DME2Client > ss ) { } } | DRcli dc = new DRcli ( uri , ss ) ; dc . setProxy ( isProxy ) ; dc . setManager ( manager ) ; return dc ; |
public class PackageUseWriter { /** * Generate the package use list .
* @ throws DocFileIOException if there is a problem generating the package use page */
protected void generatePackageUseFile ( ) throws DocFileIOException { } } | HtmlTree body = getPackageUseHeader ( ) ; HtmlTree div = new HtmlTree ( HtmlTag . DIV ) ; div . addStyle ( HtmlStyle . contentContainer ) ; if ( usingPackageToUsedClasses . isEmpty ( ) ) { div . addContent ( contents . getContent ( "doclet.ClassUse_No.usage.of.0" , utils . getPackageName ( packageElement ) ) ) ; } else { addPackageUse ( div ) ; } if ( configuration . allowTag ( HtmlTag . MAIN ) ) { mainTree . addContent ( div ) ; body . addContent ( mainTree ) ; } else { body . addContent ( div ) ; } HtmlTree tree = ( configuration . allowTag ( HtmlTag . FOOTER ) ) ? HtmlTree . FOOTER ( ) : body ; addNavLinks ( false , tree ) ; addBottom ( tree ) ; if ( configuration . allowTag ( HtmlTag . FOOTER ) ) { body . addContent ( tree ) ; } printHtmlDocument ( null , true , body ) ; |
public class TableColumn { /** * Set the width of the column form an attribute or CSS
* @ param width the new width */
public void setSpecifiedWidth ( String width ) { } } | colwidth = width ; try { content = new Dimension ( 0 , 0 ) ; content . width = Integer . parseInt ( width ) ; bounds . width = content . width ; abswidth = content . width ; wset = true ; } catch ( NumberFormatException e ) { if ( ! width . equals ( "" ) ) log . warn ( "Invalid width value: " + width ) ; } |
public class CloudTrailEventData { /** * Get the resources used in the operation .
* @ return A list of resources used in this operation . */
@ SuppressWarnings ( "unchecked" ) public List < Resource > getResources ( ) { } } | return ( List < Resource > ) get ( CloudTrailEventField . resources . name ( ) ) ; |
public class GitChangelogApi { /** * Get the changelog . */
public String render ( ) throws GitChangelogRepositoryException { } } | final Writer writer = new StringWriter ( ) ; render ( writer ) ; return writer . toString ( ) ; |
public class HttpResponse { /** * Reset the response .
* Clears any data that exists in the buffer as well as the status
* code . If the response has been committed , this method throws an
* < code > IllegalStateException < / code > .
* @ exception IllegalStateException if the response has already been
* committed */
public void reset ( ) { } } | if ( isCommitted ( ) ) throw new IllegalStateException ( "Already committed" ) ; try { ( ( HttpOutputStream ) getOutputStream ( ) ) . resetBuffer ( ) ; _status = __200_OK ; _reason = null ; super . reset ( ) ; setField ( HttpFields . __Date , getRequest ( ) . getTimeStampStr ( ) ) ; if ( ! Version . isParanoid ( ) ) setField ( HttpFields . __Server , Version . getDetail ( ) ) ; } catch ( Exception e ) { log . warn ( LogSupport . EXCEPTION , e ) ; throw new IllegalStateException ( e . toString ( ) ) ; } |
public class BearerTokenExtractor { /** * Extract the OAuth bearer token from a header .
* @ param request The request .
* @ return The token , or null if no OAuth authorization header was supplied . */
protected String extractHeaderToken ( HttpServletRequest request ) { } } | Enumeration < String > headers = request . getHeaders ( "Authorization" ) ; while ( headers . hasMoreElements ( ) ) { // typically there is only one ( most servers enforce that )
String value = headers . nextElement ( ) ; if ( ( value . toLowerCase ( ) . startsWith ( OAuth2AccessToken . BEARER_TYPE . toLowerCase ( ) ) ) ) { String authHeaderValue = value . substring ( OAuth2AccessToken . BEARER_TYPE . length ( ) ) . trim ( ) ; // Add this here for the auth details later . Would be better to change the signature of this method .
request . setAttribute ( OAuth2AuthenticationDetails . ACCESS_TOKEN_TYPE , value . substring ( 0 , OAuth2AccessToken . BEARER_TYPE . length ( ) ) . trim ( ) ) ; int commaIndex = authHeaderValue . indexOf ( ',' ) ; if ( commaIndex > 0 ) { authHeaderValue = authHeaderValue . substring ( 0 , commaIndex ) ; } return authHeaderValue ; } } return null ; |
public class OverviewPlot { /** * When a subplot was selected , forward the event to listeners .
* @ param it PlotItem selected */
protected void triggerSubplotSelectEvent ( PlotItem it ) { } } | // forward event to all listeners .
for ( ActionListener actionListener : actionListeners ) { actionListener . actionPerformed ( new DetailViewSelectedEvent ( this , ActionEvent . ACTION_PERFORMED , null , 0 , it ) ) ; } |
public class CmsHtmlExtractor { /** * Extract the text from a HTML page . < p >
* @ param content the html content
* @ param encoding the encoding of the content
* @ return the extracted text from the page
* @ throws ParserException if the parsing of the HTML failed
* @ throws UnsupportedEncodingException if the given encoding is not supported */
public static String extractText ( String content , String encoding ) throws ParserException , UnsupportedEncodingException { } } | if ( CmsStringUtil . isEmpty ( content ) ) { // if there is no HTML , then we don ' t need to extract anything
return content ; } // we must make sure that the content passed to the parser always is
// a " valid " HTML page , i . e . is surrounded by < html > < body > . . . < / body > < / html >
// otherwise you will get strange results for some specific HTML constructs
StringBuffer newContent = new StringBuffer ( content . length ( ) + 32 ) ; newContent . append ( CmsLinkProcessor . HTML_START ) ; newContent . append ( content ) ; newContent . append ( CmsLinkProcessor . HTML_END ) ; // make sure the Lexer uses the right encoding
InputStream in = new ByteArrayInputStream ( newContent . toString ( ) . getBytes ( encoding ) ) ; // use the stream based version to process the results
return extractText ( in , encoding ) ; |
public class NetworkService { /** * { @ inheritDoc } */
@ Override public boolean isDisconnecting ( ) { } } | NetworkInfo networkInfo = isAvailable ( ) ; return ( networkInfo == null ) ? false : ( networkInfo . getState ( ) . equals ( State . DISCONNECTING ) ) ? true : false ; |
public class CmsContainerElementBean { /** * Sets the settings map . < p >
* @ param settings the settings */
private void setSettings ( Map < String , String > settings ) { } } | if ( settings == null ) { m_settings = null ; } else { m_settings = new CmsNullIgnoringConcurrentMap < String , String > ( settings ) ; } |
public class MACAddressSection { /** * Replaces segments starting from startIndex and ending before endIndex with the segments starting at replacementStartIndex and
* ending before replacementEndIndex from the replacement section
* @ param startIndex
* @ param endIndex
* @ param replacement
* @ param replacementStartIndex
* @ param replacementEndIndex
* @ throws IndexOutOfBoundsException
* @ throws AddressValueException if the resulting section would exceed the maximum segment count for this address type and version
* @ return */
public MACAddressSection replace ( int startIndex , int endIndex , MACAddressSection replacement , int replacementStartIndex , int replacementEndIndex ) { } } | return replace ( startIndex , endIndex , replacement , replacementStartIndex , replacementEndIndex , false ) ; |
public class FirewallRulesInner { /** * Gets the specified Data Lake Store firewall rule .
* @ param resourceGroupName The name of the Azure resource group .
* @ param accountName The name of the Data Lake Store account .
* @ param firewallRuleName The name of the firewall rule to retrieve .
* @ 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 < FirewallRuleInner > getAsync ( String resourceGroupName , String accountName , String firewallRuleName , final ServiceCallback < FirewallRuleInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( getWithServiceResponseAsync ( resourceGroupName , accountName , firewallRuleName ) , serviceCallback ) ; |
public class CRFClassifier { /** * Convert an ObjectBank to corresponding collection of data features and
* labels .
* @ return A List of pairs , one for each document , where the first element is
* an int [ ] [ ] [ ] representing the data and the second element is an
* int [ ] representing the labels . */
public List < Pair < int [ ] [ ] [ ] , int [ ] > > documentsToDataAndLabelsList ( Collection < List < IN > > documents ) { } } | int numDatums = 0 ; List < Pair < int [ ] [ ] [ ] , int [ ] > > docList = new ArrayList < Pair < int [ ] [ ] [ ] , int [ ] > > ( ) ; for ( List < IN > doc : documents ) { Pair < int [ ] [ ] [ ] , int [ ] > docPair = documentToDataAndLabels ( doc ) ; docList . add ( docPair ) ; numDatums += doc . size ( ) ; } System . err . println ( "numClasses: " + classIndex . size ( ) + ' ' + classIndex ) ; System . err . println ( "numDocuments: " + docList . size ( ) ) ; System . err . println ( "numDatums: " + numDatums ) ; System . err . println ( "numFeatures: " + featureIndex . size ( ) ) ; return docList ; |
public class CoinbaseAccountServiceRaw { /** * Authenticated resource which returns an order for a new button .
* @ param button A { @ code CoinbaseButton } containing information to create a one time order .
* @ return The newly created { @ code CoinbaseOrder } .
* @ throws IOException
* @ see < a
* href = " https : / / coinbase . com / api / doc / 1.0 / orders / create . html " > coinbase . com / api / doc / 1.0 / orders / create . html < / a > */
public CoinbaseOrder createCoinbaseOrder ( CoinbaseButton button ) throws IOException { } } | final CoinbaseOrder createdOrder = coinbase . createOrder ( button , exchange . getExchangeSpecification ( ) . getApiKey ( ) , signatureCreator , exchange . getNonceFactory ( ) ) ; return handleResponse ( createdOrder ) ; |
public class VolumesFrom { /** * Parses a volume from specification to a { @ link VolumesFrom } .
* @ param serialized
* the specification , e . g . < code > container : ro < / code >
* @ return a { @ link VolumesFrom } matching the specification
* @ throws IllegalArgumentException
* if the specification cannot be parsed */
public static VolumesFrom parse ( String serialized ) { } } | try { String [ ] parts = serialized . split ( ":" ) ; switch ( parts . length ) { case 1 : { return new VolumesFrom ( parts [ 0 ] ) ; } case 2 : { return new VolumesFrom ( parts [ 0 ] , AccessMode . valueOf ( parts [ 1 ] ) ) ; } default : { throw new IllegalArgumentException ( ) ; } } } catch ( Exception e ) { throw new IllegalArgumentException ( "Error parsing Bind '" + serialized + "'" ) ; } |
public class FessMailDeliveryDepartmentCreator { protected String resolveLabelIfNeeds ( final MessageManager messageManager , final Locale locale , final String label ) { } } | return label . startsWith ( "labels." ) ? messageManager . getMessage ( locale , label ) : label ; |
public class Utils { /** * Convert the given JSON string into an object using
* < a href = " https : / / github . com / google / gson " > Gson < / a > .
* @ param json
* The input JSON .
* @ param klass
* The class of the resultant object .
* @ return
* A new object generated based on the input JSON .
* @ since 2.0 */
public static < T > T fromJson ( String json , Class < T > klass ) { } } | return GSON . fromJson ( json , klass ) ; |
public class URLStreamHandlerAdapter { /** * OSGi Core 4.3 , section 52.3.5 */
@ SuppressWarnings ( "unused" ) public URLConnection openConnection ( URL url , Proxy proxy ) throws IOException { } } | try { return ( URLConnection ) _openConnectionProxy . invoke ( getInstance ( ) , new Object [ ] { url , proxy } ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , getClass ( ) . getName ( ) , "openConnection" , new Object [ ] { url , proxy } ) ; return null ; } |
public class SchemaTypeAdapter { /** * Constructs { @ link Schema . Type # RECORD RECORD } type schema from the json input .
* @ param reader The { @ link JsonReader } for streaming json input tokens .
* @ param knownRecords Set of record name already encountered during the reading .
* @ return A { @ link Schema } of type { @ link Schema . Type # RECORD RECORD } .
* @ throws java . io . IOException When fails to construct a valid schema from the input . */
private Schema readRecord ( JsonReader reader , Set < String > knownRecords ) throws IOException { } } | if ( ! "name" . equals ( reader . nextName ( ) ) ) { throw new IOException ( "Property \"name\" missing for record." ) ; } String recordName = reader . nextString ( ) ; // Read in fields schemas
if ( ! "fields" . equals ( reader . nextName ( ) ) ) { throw new IOException ( "Property \"fields\" missing for record." ) ; } knownRecords . add ( recordName ) ; ImmutableList . Builder < Schema . Field > fieldBuilder = ImmutableList . builder ( ) ; reader . beginArray ( ) ; while ( reader . peek ( ) != JsonToken . END_ARRAY ) { reader . beginObject ( ) ; if ( ! "name" . equals ( reader . nextName ( ) ) ) { throw new IOException ( "Property \"name\" missing for record field." ) ; } String fieldName = reader . nextString ( ) ; fieldBuilder . add ( Schema . Field . of ( fieldName , readInnerSchema ( reader , "type" , knownRecords ) ) ) ; reader . endObject ( ) ; } reader . endArray ( ) ; return Schema . recordOf ( recordName , fieldBuilder . build ( ) ) ; |
public class AWSAmplifyClient { /** * Create a new DomainAssociation on an App
* @ param updateDomainAssociationRequest
* Request structure for update Domain Association request .
* @ return Result of the UpdateDomainAssociation operation returned by the service .
* @ throws BadRequestException
* Exception thrown when a request contains unexpected data .
* @ throws UnauthorizedException
* Exception thrown when an operation fails due to a lack of access .
* @ throws NotFoundException
* Exception thrown when an entity has not been found during an operation .
* @ throws InternalFailureException
* Exception thrown when the service fails to perform an operation due to an internal issue .
* @ throws DependentServiceFailureException
* Exception thrown when an operation fails due to a dependent service throwing an exception .
* @ sample AWSAmplify . UpdateDomainAssociation
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / amplify - 2017-07-25 / UpdateDomainAssociation "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public UpdateDomainAssociationResult updateDomainAssociation ( UpdateDomainAssociationRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateDomainAssociation ( request ) ; |
public class GetThreatIntelSetRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetThreatIntelSetRequest getThreatIntelSetRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getThreatIntelSetRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getThreatIntelSetRequest . getDetectorId ( ) , DETECTORID_BINDING ) ; protocolMarshaller . marshall ( getThreatIntelSetRequest . getThreatIntelSetId ( ) , THREATINTELSETID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Throwables { /** * Constructs the error item message from the log message and the throwable ' s message
* @ param logMessage The log message ( can be null )
* @ param throwableMessage The throwable ' s message ( can be null )
* @ return The error item message */
private static String toErrorItemMessage ( final String logMessage , final String throwableMessage ) { } } | StringBuilder sb = new StringBuilder ( ) ; if ( ( throwableMessage != null ) && ( ! throwableMessage . isEmpty ( ) ) ) { sb . append ( throwableMessage ) ; if ( ( logMessage != null ) && ( ! logMessage . isEmpty ( ) ) ) { sb . append ( " (" ) ; sb . append ( logMessage ) ; sb . append ( ")" ) ; } } else { sb . append ( logMessage ) ; } return sb . toString ( ) ; |
public class ServiceCapabilitiesReportGenerator { /** * Generate a report for the specified service . The report contains the available
* capabilities as advertised by the root endpoint .
* @ param url the url of the service
* @ return the report that describes the service
* @ throws IOException if the report cannot be generated */
public String generate ( String url ) throws IOException { } } | Object content = this . initializrService . loadServiceCapabilities ( url ) ; if ( content instanceof InitializrServiceMetadata ) { return generateHelp ( url , ( InitializrServiceMetadata ) content ) ; } return content . toString ( ) ; |
public class ContextRepresenters { /** * Fetch the context with the given ID .
* @ param contextId
* @ return */
public synchronized EvaluatorContext getContext ( final String contextId ) { } } | for ( final EvaluatorContext context : this . contextStack ) { if ( context . getId ( ) . equals ( contextId ) ) { return context ; } } throw new RuntimeException ( "Unknown evaluator context " + contextId ) ; |
public class ArmeriaMessageDeframer { /** * Processes the gRPC compression header which is composed of the compression flag and the outer
* frame length . */
private void readHeader ( ) { } } | final int type = readUnsignedByte ( ) ; if ( ( type & RESERVED_MASK ) != 0 ) { throw new ArmeriaStatusException ( StatusCodes . INTERNAL , DEBUG_STRING + ": Frame header malformed: reserved bits not zero" ) ; } compressedFlag = ( type & COMPRESSED_FLAG_MASK ) != 0 ; // Update the required length to include the length of the frame .
requiredLength = readInt ( ) ; if ( requiredLength < 0 || requiredLength > maxMessageSizeBytes ) { throw new ArmeriaStatusException ( StatusCodes . RESOURCE_EXHAUSTED , String . format ( "%s: Frame size %d exceeds maximum: %d. " , DEBUG_STRING , requiredLength , maxMessageSizeBytes ) ) ; } // Continue reading the frame body .
state = State . BODY ; |
public class MoneyUtils { /** * Subtracts the second { @ code BigMoney } from the first , handling null .
* This returns { @ code money1 - money2 } where null is ignored .
* If both input values are null , then null is returned .
* @ param money1 the first money instance , null treated as zero
* @ param money2 the first money instance , null returns money1
* @ return the total , where null is ignored , null if both inputs are null
* @ throws CurrencyMismatchException if the currencies differ */
public static BigMoney subtract ( BigMoney money1 , BigMoney money2 ) { } } | if ( money2 == null ) { return money1 ; } if ( money1 == null ) { return money2 . negated ( ) ; } return money1 . minus ( money2 ) ; |
public class StAXDecoder { /** * Returns a QName for the current START _ ELEMENT or END _ ELEMENT event
* ( non - Javadoc )
* @ see javax . xml . stream . XMLStreamReader # getName ( ) */
public QName getName ( ) { } } | // Returns a QName for the current START _ ELEMENT or END _ ELEMENT event
QName qn = new QName ( element . getNamespaceUri ( ) , element . getLocalName ( ) , this . getPrefix ( ) ) ; return qn ; |
public class RESTClient { /** * Send a REST command with the given method , URI , headers , and body to the
* server and return the response in a { @ link RESTResponse } object .
* @ param method HTTP method such as " GET " or " POST " .
* @ param uri URI such as " / foo / bar ? baz "
* @ param headers Headers to be included in the request , including content - type
* if a body is included . Content - type is set automatically .
* @ param body Input entity to send with request in binary .
* @ return { @ link RESTResponse } containing response from server .
* @ throws IOException If an error occurs on the socket . */
public RESTResponse sendRequest ( HttpMethod method , String uri , Map < String , String > headers , byte [ ] body ) throws IOException { } } | // Compress body using GZIP and add a content - encoding header if compression is requested .
byte [ ] entity = body ; if ( m_bCompress && body != null && body . length > 0 ) { entity = Utils . compressGZIP ( body ) ; headers . put ( HttpDefs . CONTENT_ENCODING , "gzip" ) ; } return sendAndReceive ( method , uri , headers , entity ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.