signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class NettyUtils { /** * Create a pooled ByteBuf allocator but disables the thread - local cache . Thread - local caches
* are disabled for TransportClients because the ByteBufs are allocated by the event loop thread ,
* but released by the executor thread rather than the event loop thread . Those thread - local
* caches actually delay the recycling of buffers , leading to larger memory usage . */
public static PooledByteBufAllocator createPooledByteBufAllocator ( boolean allowDirectBufs , boolean allowCache , int numCores ) { } } | if ( numCores == 0 ) { numCores = Runtime . getRuntime ( ) . availableProcessors ( ) ; } return new PooledByteBufAllocator ( allowDirectBufs && PlatformDependent . directBufferPreferred ( ) , Math . min ( PooledByteBufAllocator . defaultNumHeapArena ( ) , numCores ) , Math . min ( PooledByteBufAllocator . defaultNumDirectArena ( ) , allowDirectBufs ? numCores : 0 ) , PooledByteBufAllocator . defaultPageSize ( ) , PooledByteBufAllocator . defaultMaxOrder ( ) , allowCache ? PooledByteBufAllocator . defaultTinyCacheSize ( ) : 0 , allowCache ? PooledByteBufAllocator . defaultSmallCacheSize ( ) : 0 , allowCache ? PooledByteBufAllocator . defaultNormalCacheSize ( ) : 0 , allowCache ? PooledByteBufAllocator . defaultUseCacheForAllThreads ( ) : false ) ; |
public class DomainSpecificValue { /** * Sort DomainSpecificValue in reverse order as specified by ordering , changeSet and patternStr .
* This ordering defines the order of resolution that Roperty uses when a key is accessed .
* Values with a changeSet are ordered before values without a changeSet .
* Values with a changeSet are ordered alphabetically with other changeSets .
* Values with the same ordering ( and changeSet ) are ordered by patternStr , just to define a consistent ordering . */
@ Override public int compareTo ( final DomainSpecificValue other ) { } } | int order = other . ordering - this . ordering ; if ( order == 0 ) { if ( changeSet != null && other . changeSet != null ) { int changeSetCompare = other . changeSet . compareTo ( changeSet ) ; if ( changeSetCompare != 0 ) return changeSetCompare ; else return patternStr . compareTo ( other . patternStr ) ; } if ( changeSet != null ) { // other . changeSet is null here
return - 1 ; } if ( other . changeSet != null ) { // changeSet is null here
return 1 ; } return patternStr . compareTo ( other . patternStr ) ; } return order ; |
public class CloseableReference { /** * Returns the cloned reference if valid , null otherwise .
* @ param ref the reference to clone */
@ Nullable public static < T > CloseableReference < T > cloneOrNull ( @ Nullable CloseableReference < T > ref ) { } } | return ( ref != null ) ? ref . cloneOrNull ( ) : null ; |
public class LdiSrl { /** * Extract sub - string by begin index . ( skip front string )
* < pre >
* substring ( " flute " , 2)
* returns " ute "
* < / pre >
* @ param str The target string . ( NotNull )
* @ param beginIndex The from - index .
* @ return The part of string . ( NotNull ) */
public static String substring ( final String str , final int beginIndex ) { } } | assertStringNotNull ( str ) ; if ( str . length ( ) < beginIndex ) { String msg = "The length of the string was smaller than the begin index:" ; msg = msg + " str=" + str + ", beginIndex=" + beginIndex ; throw new StringIndexOutOfBoundsException ( msg ) ; } return str . substring ( beginIndex ) ; |
public class AccountManager { /** * Sets the email for the currently logged in client account .
* @ param email
* The new email
* @ param currentPassword
* The < b > valid < / b > current password for the represented account
* @ throws net . dv8tion . jda . core . exceptions . AccountTypeException
* If the currently logged in account is not from { @ link net . dv8tion . jda . core . AccountType # CLIENT }
* @ throws IllegalArgumentException
* < ul >
* < li > If the provided { @ code currentPassword } or the provided { @ code email } is { @ code null } or empty
* < li > If the provided { @ code email } is not valid . < / li >
* < / ul >
* @ return AccountManager for chaining convenience */
@ CheckReturnValue public AccountManager setEmail ( String email , String currentPassword ) { } } | Checks . notNull ( email , "email" ) ; this . currentPassword = currentPassword ; this . email = email ; set |= EMAIL ; return this ; |
public class FnFunc { /** * Builds a function that will execute the specified function < tt > thenFunction < / tt >
* only if the result of executing < tt > condition < / tt > on the target object is false ,
* and will execute the specified function < tt > elseFunction < / tt > otherwise .
* The built function can effectively change the target type ( receive < tt > T < / tt > and
* return < tt > R < / tt > ) if both < tt > thenFunction < / tt > and < tt > elseFunction < / tt > return
* the same type , and this is different than the target type < tt > T < / tt > .
* @ param targetType the target type
* @ param condition the condition to be executed on the target object
* @ param thenFunction the function to be executed on the target object if condition is false
* @ param elseFunction the function to be executed on the target object otherwise
* @ return a function that executes the " thenFunction " if " condition " is false and " elseFunction " otherwise . */
public static final < T , R > Function < T , R > ifFalseThenElse ( final Type < T > targetType , final IFunction < ? super T , Boolean > condition , final IFunction < ? super T , R > thenFunction , final IFunction < ? super T , R > elseFunction ) { } } | return new IfThenElse < T , R > ( false , targetType , condition , thenFunction , elseFunction ) ; |
public class CmsToolDialog { /** * Initializes the admin tool main view . < p >
* @ return the new modified parameters array
* @ throws CmsRoleViolationException in case the dialog is opened by a user without the necessary privileges */
public Map < String , String [ ] > initAdminTool ( ) throws CmsRoleViolationException { } } | Map < String , String [ ] > params = new HashMap < String , String [ ] > ( getParameterMap ( ) ) ; // initialize
getToolManager ( ) . initParams ( this ) ; // adjust parameters if called as default
if ( ! useNewStyle ( ) ) { params . put ( PARAM_STYLE , new String [ ] { CmsToolDialog . STYLE_NEW } ) ; setParamStyle ( CmsToolDialog . STYLE_NEW ) ; } try { // a dialog just to access the close link parameter
CmsDialog wp = ( CmsDialog ) this ; // set close link
if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( wp . getParamCloseLink ( ) ) ) { if ( ! getToolManager ( ) . getBaseToolPath ( this ) . equals ( getToolManager ( ) . getCurrentToolPath ( this ) ) ) { Map < String , String [ ] > args = getToolManager ( ) . resolveAdminTool ( getParamRoot ( ) , getParentPath ( ) ) . getHandler ( ) . getParameters ( wp ) ; wp . setParamCloseLink ( CmsToolManager . linkForToolPath ( getJsp ( ) , getParentPath ( ) , args ) ) ; params . put ( CmsDialog . PARAM_CLOSELINK , new String [ ] { wp . getParamCloseLink ( ) } ) ; } } } catch ( Exception e ) { // ignore
} if ( ! getToolManager ( ) . getCurrentTool ( this ) . getHandler ( ) . isEnabled ( this ) ) { throw new CmsRoleViolationException ( Messages . get ( ) . container ( Messages . ERR_ADMIN_INSUFFICIENT_RIGHTS_0 ) ) ; } return params ; |
public class HttpSessionImpl { /** * Method removeAttribute
* @ see javax . servlet . http . HttpSession # removeAttribute ( java . lang . String ) */
public void removeAttribute ( String attributeName ) { } } | synchronized ( _iSession ) { if ( ! _iSession . isValid ( ) ) throw new IllegalStateException ( ) ; Object object = _iSession . removeAttribute ( attributeName ) ; } |
public class AbstractGpxParserWpt { /** * Fires whenever an XML end markup is encountered . It catches attributes of
* the waypoint and saves them in corresponding values [ ] .
* @ param uri URI of the local element
* @ param localName Name of the local element ( without prefix )
* @ param qName qName of the local element ( with prefix )
* @ throws SAXException Any SAX exception , possibly wrapping another
* exception */
@ Override public void endElement ( String uri , String localName , String qName ) throws SAXException { } } | // currentElement represents the last string encountered in the document
setCurrentElement ( getElementNames ( ) . pop ( ) ) ; if ( getCurrentElement ( ) . equalsIgnoreCase ( GPXTags . WPT ) ) { // if < / wpt > markup is found , the currentPoint is added in the table wptdbd and the default contentHandler is setted .
try { PreparedStatement pStm = getWptPreparedStmt ( ) ; int i = 1 ; Object [ ] values = getCurrentPoint ( ) . getValues ( ) ; for ( Object object : values ) { pStm . setObject ( i , object ) ; i ++ ; } pStm . execute ( ) ; } catch ( SQLException ex ) { throw new SAXException ( "Cannot import the waypoint." , ex ) ; } getReader ( ) . setContentHandler ( parent ) ; } else { getCurrentPoint ( ) . setAttribute ( getCurrentElement ( ) , getContentBuffer ( ) ) ; } |
public class RTPDataChannel { /** * Enables WebRTC encryption for the RTP channel .
* @ param remotePeerFingerprint */
public void enableWebRTC ( Text remotePeerFingerprint ) { } } | this . isWebRtc = true ; if ( this . webRtcHandler == null ) { this . webRtcHandler = new DtlsHandler ( this . dtlsServerProvider ) ; } this . webRtcHandler . setRemoteFingerprint ( "sha-256" , remotePeerFingerprint . toString ( ) ) ; |
public class ExtractorUtils { /** * Find first child node none recursive .
* @ param node start node
* @ param ruleName rule name
* @ return matched node */
public static Optional < ParserRuleContext > findFirstChildNodeNoneRecursive ( final ParserRuleContext node , final RuleName ruleName ) { } } | if ( isMatchedNode ( node , ruleName ) ) { return Optional . of ( node ) ; } for ( int i = 0 ; i < node . getChildCount ( ) ; i ++ ) { if ( node . getChild ( i ) instanceof ParserRuleContext ) { ParserRuleContext child = ( ParserRuleContext ) node . getChild ( i ) ; if ( isMatchedNode ( child , ruleName ) ) { return Optional . of ( child ) ; } } } return Optional . absent ( ) ; |
public class AdminToolPropertiesService { /** * returns the spring environment properties
* @ return */
public Map < String , String > getEnvProperty ( ) { } } | Map < String , String > res = new TreeMap < String , String > ( ) ; MutablePropertySources mps = env . getPropertySources ( ) ; Iterator < PropertySource < ? > > iter = mps . iterator ( ) ; while ( iter . hasNext ( ) ) { PropertySource < ? > ps = iter . next ( ) ; if ( ps instanceof EnumerablePropertySource < ? > ) { for ( String propName : ( ( EnumerablePropertySource < ? > ) ps ) . getPropertyNames ( ) ) { try { res . put ( propName , env . getProperty ( propName ) ) ; } catch ( Exception e ) { LOGGER . warn ( "unresolveable property: " + propName ) ; res . put ( propName , "UNRESOLVEABLE" ) ; } } } } return res ; |
public class DefaultGroovyMethods { /** * Power of a BigInteger to a BigInteger certain exponent . Called by the ' * * ' operator .
* @ param self a BigInteger
* @ param exponent a BigInteger exponent
* @ return a BigInteger to the power of a the exponent
* @ since 2.3.8 */
public static BigInteger power ( BigInteger self , BigInteger exponent ) { } } | if ( ( exponent . signum ( ) >= 0 ) && ( exponent . compareTo ( BI_INT_MAX ) <= 0 ) ) { return self . pow ( exponent . intValue ( ) ) ; } else { return BigDecimal . valueOf ( Math . pow ( self . doubleValue ( ) , exponent . doubleValue ( ) ) ) . toBigInteger ( ) ; } |
public class Responses { /** * Creates a response object for a successful command execution .
* @ param sessionId ID of the session that executed the command .
* @ param value the command result value .
* @ return the new response object . */
public static Response success ( SessionId sessionId , Object value ) { } } | Response response = new Response ( ) ; response . setSessionId ( sessionId != null ? sessionId . toString ( ) : null ) ; response . setValue ( value ) ; response . setStatus ( ErrorCodes . SUCCESS ) ; response . setState ( ErrorCodes . SUCCESS_STRING ) ; return response ; |
public class FilterListSlowStr { /** * Determine , recursively , if an address is in the address tree .
* @ param address
* address to look for as a string array .
* The 0th index of the array is the rightmost substring of
* the string and so on . Each substring is the chars between
* two periods ( " . " ) in a URL address .
* @ param index
* the next index in the address array to match against the tree .
* @ param cell
* the current cell in the tree that we are matching against
* @ param endIndex
* the last index in the address array that we need to match
* @ return true if this address is found in the address tree , false if
* it is not . */
private boolean findInList ( String [ ] address , int index , FilterCellSlowStr cell , int endIndex ) { } } | if ( cell . getWildcardCell ( ) != null ) { // a wildcard , match found
return true ; } // no wildcard so far , see if there is a still a path
FilterCellSlowStr nextCell = cell . findNextCell ( address [ index ] ) ; if ( nextCell != null ) { // see if we are at the end of a valid path
if ( index == endIndex ) { // this path found a match , unwind returning true
return true ; } // ok so far , recursively search this path
return findInList ( address , index + 1 , nextCell , endIndex ) ; } // this path did not find a match .
return false ; |
public class NodeUtil { /** * Retrieves the nodes id .
* @ return a hopefully useful ID ( not < code > null < / code > ) */
public String getId ( Node node ) { } } | String id = null ; try { id = node . getIdentifier ( ) ; } catch ( RepositoryException e ) { id = node . toString ( ) ; // use Java ' ID '
} return id ; |
public class ExtensionForcedUser { /** * Sets the forced user for a context .
* @ param contextId the context id
* @ param user the user */
public void setForcedUser ( int contextId , User user ) { } } | if ( user != null ) this . contextForcedUsersMap . put ( contextId , user ) ; else this . contextForcedUsersMap . remove ( contextId ) ; this . updateForcedUserModeToggleButtonState ( ) ; |
public class ComponentPropertyResolver { /** * Get property .
* @ param name Property name
* @ param type Property type
* @ param < T > Parameter type
* @ return Property value or null if not set */
public @ Nullable < T > T get ( @ NotNull String name , @ NotNull Class < T > type ) { } } | @ Nullable T value = getPageProperty ( currentPage , name , type ) ; if ( value == null ) { value = getComponentProperty ( currentComponent , name , type ) ; } return value ; |
public class AnimatorSet { /** * Sets up this AnimatorSet to play each of the supplied animations when the
* previous animation ends .
* @ param items The animations that will be started one after another . */
public void playSequentially ( Animator ... items ) { } } | if ( items != null ) { mNeedsSort = true ; if ( items . length == 1 ) { play ( items [ 0 ] ) ; } else { for ( int i = 0 ; i < items . length - 1 ; ++ i ) { play ( items [ i ] ) . before ( items [ i + 1 ] ) ; } } } |
public class Parser { private void findUsefulDissectorsFromField ( final Set < String > possibleTargets , final Set < String > locatedTargets , final String subRootType , final String subRootName , final boolean thisIsTheRoot ) { } } | String subRootId = subRootType + ':' + subRootName ; // When we reach this point we have dissectors to get here .
// So we store this to later validate if we have everything .
if ( locatedTargets . contains ( subRootId ) ) { // We already found this one .
return ; // Avoid infinite recursion
} locatedTargets . add ( subRootId ) ; LOG . debug ( "findUsefulDissectors:\"{}\" \"{}\"" , subRootType , subRootName ) ; for ( DissectorPhase dissector : availableDissectors ) { if ( ! ( dissector . inputType . equals ( subRootType ) ) ) { continue ; // Wrong type
} // If it starts with a . it extends .
// If it doesn ' t then it starts at the beginning
Set < String > checkFields = new HashSet < > ( ) ; // If true then this dissector can output any name instead of just one
boolean isWildCardDissector = dissector . name . equals ( "*" ) ; if ( isWildCardDissector ) { // Ok , this is special
// We need to see if any of the wanted types start with the
// subRootName ( it may have a ' . ' in the rest of the line ! )
String subRootNameMatch = subRootName + '.' ; for ( String possibleTarget : possibleTargets ) { if ( possibleTarget . startsWith ( subRootNameMatch ) ) { checkFields . add ( possibleTarget ) ; } } } else if ( thisIsTheRoot ) { checkFields . add ( dissector . name ) ; } else if ( dissector . name . isEmpty ( ) ) { checkFields . add ( subRootName ) ; } else { checkFields . add ( subRootName + '.' + dissector . name ) ; } for ( String checkField : checkFields ) { if ( possibleTargets . contains ( checkField ) && ! compiledDissectors . containsKey ( dissector . outputType + ":" + checkField ) ) { Set < DissectorPhase > subRootPhases = compiledDissectors . get ( subRootId ) ; if ( subRootPhases == null ) { // New so we can simply add it .
subRootPhases = new HashSet < > ( ) ; compiledDissectors . put ( subRootId , subRootPhases ) ; usefulIntermediateFields . add ( subRootName ) ; } Class < ? extends Dissector > clazz = dissector . instance . getClass ( ) ; DissectorPhase dissectorPhaseInstance = findDissectorInstance ( subRootPhases , clazz ) ; if ( dissectorPhaseInstance == null ) { dissectorPhaseInstance = new DissectorPhase ( dissector . inputType , dissector . outputType , checkField , dissector . instance . getNewInstance ( ) ) ; subRootPhases . add ( dissectorPhaseInstance ) ; } // Tell the dissector instance what to expect
if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Informing : ({}){} --> {} --> ({}){}" , dissector . inputType , subRootName , dissector . instance . getClass ( ) . getName ( ) , dissector . outputType , checkField ) ; } castsOfTargets . put ( dissector . outputType + ':' + checkField , dissectorPhaseInstance . instance . prepareForDissect ( subRootName , checkField ) ) ; // Recurse from this point down
findUsefulDissectorsFromField ( possibleTargets , locatedTargets , dissector . outputType , checkField , false ) ; } } } Set < String > mappings = typeRemappings . get ( subRootName ) ; if ( mappings != null ) { for ( String mappedType : mappings ) { if ( ! compiledDissectors . containsKey ( mappedType + ':' + subRootName ) ) { // Retyped targets are ALWAYS String ONLY .
castsOfTargets . put ( mappedType + ':' + subRootName , STRING_ONLY ) ; findUsefulDissectorsFromField ( possibleTargets , locatedTargets , mappedType , subRootName , false ) ; } } } |
public class PageFlowUtils { /** * Make sure that when this page is rendered , it will set headers in the response to prevent caching .
* Because these headers are lost on server forwards , we set a request attribute to cause the headers
* to be set right before the page is rendered . This attribute can be read via
* { @ link # isPreventCache ( javax . servlet . ServletRequest ) } .
* @ param request the servlet request */
static void setPreventCache ( ServletRequest request ) { } } | assert request != null ; request . setAttribute ( PREVENT_CACHE_ATTR , Boolean . TRUE ) ; |
public class CassandraEntityReader { /** * Method responsible for reading back entity and relations using secondary
* indexes ( if it holds any relation ) , else retrieve row keys using lucene .
* @ param m entity meta data
* @ param client client instance
* @ param maxResults the max results
* @ return list of wrapped enhance entities . */
@ Override public List < EnhanceEntity > populateRelation ( EntityMetadata m , Client client , int maxResults ) { } } | if ( log . isInfoEnabled ( ) ) { log . info ( "On populate relation via JPQL" ) ; } List < EnhanceEntity > ls = null ; List < String > relationNames = m . getRelationNames ( ) ; boolean isParent = m . isParent ( ) ; boolean isRowKeyQuery = conditions != null ? conditions . keySet ( ) . iterator ( ) . next ( ) : false ; // If Query is not for find by range .
if ( ! isRowKeyQuery ) { // If holding associations .
if ( ! isParent ) { // In case need to use secondary indexes .
if ( MetadataUtils . useSecondryIndex ( ( ( ClientBase ) client ) . getClientMetadata ( ) ) ) { ls = ( ( CassandraClientBase ) client ) . find ( m , relationNames , this . conditions . get ( isRowKeyQuery ) , maxResults , null ) ; } else { // prepare lucene query and find .
Set < String > rSet = fetchDataFromLucene ( m . getEntityClazz ( ) , client ) ; try { ls = ( List < EnhanceEntity > ) ( ( CassandraClientBase ) client ) . find ( m . getEntityClazz ( ) , relationNames , true , m , rSet . toArray ( new Object [ ] { } ) ) ; } catch ( Exception e ) { log . error ( "Error while executing handleAssociation for cassandra, Caused by: " , e ) ; throw new QueryHandlerException ( e ) ; } } } else { if ( MetadataUtils . useSecondryIndex ( ( ( ClientBase ) client ) . getClientMetadata ( ) ) ) { // in case need to search on secondry columns and it is not
// set
// to true !
ls = ( ( CassandraClientBase ) client ) . find ( this . conditions . get ( isRowKeyQuery ) , m , true , m . getRelationNames ( ) , maxResults , null ) ; } else { ls = onAssociationUsingLucene ( m , client , ls ) ; } } } else { ls = handleFindByRange ( m , client , ls , conditions , isRowKeyQuery , null , maxResults ) ; } return ls ; |
public class OpportunitiesApi { /** * Get opportunities group ( asynchronously ) Return information of an
* opportunities group - - - This route expires daily at 11:05
* @ param groupId
* ID of an opportunities group ( required )
* @ param acceptLanguage
* Language to use in the response ( optional , default to en - us )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param ifNoneMatch
* ETag from a previous request . A 304 will be returned if this
* matches the current ETag ( optional )
* @ param language
* Language to use in the response , takes precedence over
* Accept - Language ( optional , default to en - us )
* @ param callback
* The callback to be executed when the API call finishes
* @ return The request call
* @ throws ApiException
* If fail to process the API call , e . g . serializing the request
* body object */
public com . squareup . okhttp . Call getOpportunitiesGroupsGroupIdAsync ( Integer groupId , String acceptLanguage , String datasource , String ifNoneMatch , String language , final ApiCallback < OpportunitiesGroupResponse > callback ) throws ApiException { } } | com . squareup . okhttp . Call call = getOpportunitiesGroupsGroupIdValidateBeforeCall ( groupId , acceptLanguage , datasource , ifNoneMatch , language , callback ) ; Type localVarReturnType = new TypeToken < OpportunitiesGroupResponse > ( ) { } . getType ( ) ; apiClient . executeAsync ( call , localVarReturnType , callback ) ; return call ; |
public class AbstractLauncher { /** * Check if remote files are newer then local files . Return true if files are updated , triggering the whatsnew option else false .
* Also return false and do not check for updates if the < code > - - offline < / code > commandline argument is set .
* @ return true if new files have been downloaded , false otherwise .
* @ throws Exception */
protected boolean syncFiles ( ) throws Exception { } } | Path cacheDir = manifest . resolveCacheDir ( getParameters ( ) . getNamed ( ) ) ; log . info ( String . format ( "Using cache dir %s" , cacheDir ) ) ; phase = "File Synchronization" ; if ( getParameters ( ) . getUnnamed ( ) . contains ( "--offline" ) ) { log . info ( "not updating files from remote, offline selected" ) ; return false ; // to signal that nothing has changed .
} List < LibraryFile > needsUpdate = manifest . files . stream ( ) . filter ( LibraryFile :: loadForCurrentPlatform ) . filter ( it -> it . needsUpdate ( cacheDir ) ) . collect ( Collectors . toList ( ) ) ; if ( needsUpdate . isEmpty ( ) ) return false ; Long totalBytes = needsUpdate . stream ( ) . mapToLong ( f -> f . size ) . sum ( ) ; Long totalWritten = 0L ; for ( LibraryFile lib : needsUpdate ) { Path target = cacheDir . resolve ( lib . file ) . toAbsolutePath ( ) ; Files . createDirectories ( target . getParent ( ) ) ; URI uri ; // We avoid using uri . resolve ( ) here so as to not break UNC paths . See issue # 143
String separator = manifest . uri . getPath ( ) . endsWith ( "/" ) ? "" : "/" ; uri = URI . create ( manifest . uri . toString ( ) + separator + lib . file ) ; try ( InputStream input = openDownloadStream ( uri ) ; OutputStream output = Files . newOutputStream ( target ) ) { byte [ ] buf = new byte [ 65536 ] ; int read ; while ( ( read = input . read ( buf ) ) > - 1 ) { output . write ( buf , 0 , read ) ; totalWritten += read ; Double progress = totalWritten . doubleValue ( ) / totalBytes . doubleValue ( ) ; updateProgress ( progress ) ; } } } return true ; |
public class ReadyBuilder { /** * Build an online constraint .
* @ param args must be 1 set of vms . The set must not be empty
* @ return a constraint */
@ Override public List < SatConstraint > buildConstraint ( BtrPlaceTree t , List < BtrpOperand > args ) { } } | if ( checkConformance ( t , args ) ) { @ SuppressWarnings ( "unchecked" ) List < VM > s = ( List < VM > ) params [ 0 ] . transform ( this , t , args . get ( 0 ) ) ; if ( s == null ) { return Collections . emptyList ( ) ; } return s . stream ( ) . map ( Ready :: new ) . collect ( Collectors . toList ( ) ) ; } return Collections . emptyList ( ) ; |
public class PackageWriterImpl { /** * Add the package deprecation information to the documentation tree .
* @ param div the content tree to which the deprecation information will be added */
public void addDeprecationInfo ( Content div ) { } } | Tag [ ] deprs = packageDoc . tags ( "deprecated" ) ; if ( utils . isDeprecated ( packageDoc ) ) { HtmlTree deprDiv = new HtmlTree ( HtmlTag . DIV ) ; deprDiv . addStyle ( HtmlStyle . deprecatedContent ) ; Content deprPhrase = HtmlTree . SPAN ( HtmlStyle . deprecatedLabel , deprecatedPhrase ) ; deprDiv . addContent ( deprPhrase ) ; if ( deprs . length > 0 ) { Tag [ ] commentTags = deprs [ 0 ] . inlineTags ( ) ; if ( commentTags . length > 0 ) { addInlineDeprecatedComment ( packageDoc , deprs [ 0 ] , deprDiv ) ; } } div . addContent ( deprDiv ) ; } |
public class JSCompatibleMessageImpl { /** * Return the underlying encoding */
final JMFNativePart getEncodingMessage ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . entry ( this , tc , "getEncodingMessage" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . exit ( this , tc , "getEncodingMessage" , encoding ) ; return encoding ; |
public class SearchIndex { /** * Log unindexed changes into error . log
* @ param removed
* set of removed node uuids
* @ param added
* map of added node states and uuids
* @ throws IOException */
public void logErrorChanges ( ErrorLog errorLog , Set < String > removed , Set < String > added ) throws IOException { } } | // backup the remove and add iterators
if ( errorLog != null ) { errorLog . writeChanges ( removed , added ) ; } |
public class PackageWriterImpl { /** * { @ inheritDoc } */
public void addPackageTags ( Content packageContentTree ) { } } | Content htmlTree = ( configuration . allowTag ( HtmlTag . SECTION ) ) ? sectionTree : packageContentTree ; addTagsInfo ( packageDoc , htmlTree ) ; |
public class PropertiesReader { /** * Reads a long property .
* @ param property The property name .
* @ return The property value .
* @ throws ConfigurationException if the property is not present */
public long getLong ( String property ) { } } | return getProperty ( property , value -> { try { return Long . valueOf ( value ) ; } catch ( NumberFormatException e ) { throw new ConfigurationException ( "malformed property value: " + property + " must be a long" ) ; } } ) ; |
public class Stylesheet { /** * Read the stylesheet from a serialization stream .
* @ param stream Input stream to read from
* @ throws IOException
* @ throws TransformerException */
private void readObject ( ObjectInputStream stream ) throws IOException , TransformerException { } } | // System . out . println ( " Reading Stylesheet " ) ;
try { stream . defaultReadObject ( ) ; } catch ( ClassNotFoundException cnfe ) { throw new TransformerException ( cnfe ) ; } // System . out . println ( " Done reading Stylesheet " ) ; |
public class MilestonesApi { /** * Update the specified milestone .
* @ param projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance
* @ param milestoneId the milestone ID to update
* @ param title the updated title for the milestone
* @ param description the updated description for the milestone
* @ param dueDate the updated due date for the milestone
* @ param startDate the updated start date for the milestone
* @ param milestoneState the updated milestone state
* @ return the updated Milestone instance
* @ throws GitLabApiException if any exception occurs */
public Milestone updateMilestone ( Object projectIdOrPath , Integer milestoneId , String title , String description , Date dueDate , Date startDate , MilestoneState milestoneState ) throws GitLabApiException { } } | if ( milestoneId == null ) { throw new RuntimeException ( "milestoneId cannot be null" ) ; } GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "title" , title , true ) . withParam ( "description" , description ) . withParam ( "due_date" , dueDate ) . withParam ( "start_date" , startDate ) . withParam ( "state_event" , milestoneState ) ; Response response = put ( Response . Status . OK , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "milestones" , milestoneId ) ; return ( response . readEntity ( Milestone . class ) ) ; |
public class DataUtil { /** * little - endian or intel format . */
public static void writeShortLittleEndian ( ByteBuffer io , short value ) { } } | io . put ( ( byte ) ( value & 0xFF ) ) ; io . put ( ( byte ) ( ( value >> 8 ) & 0xFF ) ) ; |
public class ServerHandshaker { /** * For Kerberos ciphers , the premaster secret is encrypted using
* the session key . See RFC 2712. */
private SecretKey clientKeyExchange ( KerberosClientKeyExchange mesg ) throws IOException { } } | if ( debug != null && Debug . isOn ( "handshake" ) ) { mesg . print ( System . out ) ; } // Record the principals involved in exchange
session . setPeerPrincipal ( mesg . getPeerPrincipal ( ) ) ; session . setLocalPrincipal ( mesg . getLocalPrincipal ( ) ) ; byte [ ] b = mesg . getUnencryptedPreMasterSecret ( ) ; return new SecretKeySpec ( b , "TlsPremasterSecret" ) ; |
public class AuthorityKeyIdentifierExtension { /** * Delete the attribute value . */
public void delete ( String name ) throws IOException { } } | if ( name . equalsIgnoreCase ( KEY_ID ) ) { id = null ; } else if ( name . equalsIgnoreCase ( AUTH_NAME ) ) { names = null ; } else if ( name . equalsIgnoreCase ( SERIAL_NUMBER ) ) { serialNum = null ; } else { throw new IOException ( "Attribute name not recognized by " + "CertAttrSet:AuthorityKeyIdentifier." ) ; } encodeThis ( ) ; |
public class ComputerVisionImpl { /** * Optical Character Recognition ( OCR ) detects printed text in an image and extracts the recognized characters into a machine - usable character stream . Upon success , the OCR results will be returned . Upon failure , the error code together with an error message will be returned . The error code can be one of InvalidImageUrl , InvalidImageFormat , InvalidImageSize , NotSupportedImage , NotSupportedLanguage , or InternalServerError .
* @ param detectOrientation Whether detect the text orientation in the image . With detectOrientation = true the OCR service tries to detect the image orientation and correct it before further processing ( e . g . if it ' s upside - down ) .
* @ param url Publicly reachable URL of an image
* @ param recognizePrintedTextOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the OcrResult object */
public Observable < OcrResult > recognizePrintedTextAsync ( boolean detectOrientation , String url , RecognizePrintedTextOptionalParameter recognizePrintedTextOptionalParameter ) { } } | return recognizePrintedTextWithServiceResponseAsync ( detectOrientation , url , recognizePrintedTextOptionalParameter ) . map ( new Func1 < ServiceResponse < OcrResult > , OcrResult > ( ) { @ Override public OcrResult call ( ServiceResponse < OcrResult > response ) { return response . body ( ) ; } } ) ; |
public class LinearScanPrimitiveDistanceKNNQuery { /** * Main loop of the linear scan .
* @ param relation Data relation
* @ param iter ID iterator
* @ param obj Query object
* @ param heap Output heap
* @ return Heap */
private KNNHeap linearScan ( Relation < ? extends O > relation , DBIDIter iter , final O obj , KNNHeap heap ) { } } | final PrimitiveDistanceFunction < ? super O > rawdist = this . rawdist ; double max = Double . POSITIVE_INFINITY ; while ( iter . valid ( ) ) { final double dist = rawdist . distance ( obj , relation . get ( iter ) ) ; if ( dist <= max ) { max = heap . insert ( dist , iter ) ; } iter . advance ( ) ; } return heap ; |
public class HtmlDataTable { /** * < p > Set the value of the < code > frame < / code > property . < / p > */
public void setFrame ( java . lang . String frame ) { } } | getStateHelper ( ) . put ( PropertyKeys . frame , frame ) ; handleAttribute ( "frame" , frame ) ; |
public class Datastream { /** * Creates and adds a new datastream version with an automatically
* generated id that is unique within the existing versions . The id
* will start with < code > this . id ( ) + " . " < / code > and have a numeric suffix .
* @ param createdDate the created date to use for the new datastream
* version , possibly < code > null < / code > .
* @ return the new version . */
public DatastreamVersion addVersion ( Date createdDate ) { } } | int n = versions . size ( ) ; while ( hasVersion ( id + "." + n ) ) { n ++ ; } DatastreamVersion dsv = new DatastreamVersion ( id + "." + n , createdDate ) ; versions . add ( dsv ) ; return dsv ; |
public class EventLostEvent { /** * Returns next event type ID .
* @ return next event type ID
* @ see EntryEventType */
private static int getNextEntryEventTypeId ( ) { } } | int higherTypeId = Integer . MIN_VALUE ; int i = 0 ; EntryEventType [ ] values = EntryEventType . values ( ) ; for ( EntryEventType value : values ) { int typeId = value . getType ( ) ; if ( i == 0 ) { higherTypeId = typeId ; } else { if ( typeId > higherTypeId ) { higherTypeId = typeId ; } } i ++ ; } int eventFlagPosition = Integer . numberOfTrailingZeros ( higherTypeId ) ; return 1 << ++ eventFlagPosition ; |
public class ThemeManager { /** * Clear modifier from default theme
* @ see # modifyDefaultTheme ( int )
* @ see # setDefaultTheme ( int )
* @ see # getDefaultTheme ( ) */
public static void modifyDefaultThemeClear ( int mod ) { } } | mod &= ThemeManager . _THEME_MASK ; ThemeManager . _DEFAULT_THEME |= mod ; ThemeManager . _DEFAULT_THEME ^= mod ; |
public class AbstractJsonProvider { /** * Converts given array to an { @ link Iterable }
* @ param obj an array
* @ return an Iterable that iterates over the entries of an array */
@ SuppressWarnings ( "unchecked" ) public Iterable < ? > toIterable ( Object obj ) { } } | if ( isArray ( obj ) ) return ( ( Iterable ) obj ) ; else throw new JsonPathException ( "Cannot iterate over " + obj != null ? obj . getClass ( ) . getName ( ) : "null" ) ; |
public class PointLocationParser { /** * Parses a string representation of the point location .
* @ param representation
* String representation of the point location
* @ return Point location
* @ throws ParserException
* On an exception */
public static PointLocation parsePointLocation ( final String representation ) throws ParserException { } } | if ( StringUtils . isBlank ( representation ) ) { throw new ParserException ( "No point location value provided" ) ; } if ( ! StringUtils . endsWith ( representation , "/" ) ) { throw new ParserException ( "Point location value must be terminated with /" ) ; } final PointLocationParser parser = new PointLocationParser ( ) ; final CoordinateParser coordinateParser = new CoordinateParser ( ) ; // Split by group
final List < String > tokens = parser . split ( representation ) ; if ( tokens . size ( ) != 4 ) { throw new ParserException ( "Cannot parse " + representation ) ; } final Latitude latitude = coordinateParser . parseLatitude ( tokens . get ( 0 ) ) ; final Longitude longitude = coordinateParser . parseLongitude ( tokens . get ( 1 ) ) ; final double altitude = NumberUtils . toDouble ( tokens . get ( 2 ) ) ; final String coordinateReferenceSystemIdentifier = StringUtils . trimToEmpty ( tokens . get ( 3 ) ) ; final PointLocation pointLocation = new PointLocation ( latitude , longitude , altitude , coordinateReferenceSystemIdentifier ) ; return pointLocation ; |
public class LayerBuilder { /** * Aggregates the readers associated with { @ code futures } together with
* contributions from the transport into the response .
* @ return The built layer
* @ throws IOException */
String build ( ) throws IOException { } } | if ( built ) { // Can call build only once per instance
throw new IllegalStateException ( ) ; } built = true ; Map < String , String > moduleCacheInfo = null ; if ( request . getAttribute ( LayerImpl . LAYERCACHEINFO_PROPNAME ) != null ) { moduleCacheInfo = new HashMap < String , String > ( ) ; request . setAttribute ( IModuleCache . MODULECACHEINFO_PROPNAME , moduleCacheInfo ) ; } if ( RequestUtil . isDependencyExpansionLogging ( request ) ) { DependencyList depList = ( DependencyList ) request . getAttribute ( LayerImpl . EXPANDEDDEPS_PROPNAME ) ; if ( depList != null ) { // Output dependency expansion logging
writer . append ( dependencyExpansionLogging ( depList ) ) ; } } List < ModuleBuildFuture > futures = collectFutures ( moduleList , request ) ; SortedReaders sorted = new SortedReaders ( futures , request ) ; /* * Set layer dependent features attribute . The build readers add the layer dependent features
* to this collection as they are read . */
request . setAttribute ( ILayer . DEPENDENT_FEATURES , dependentFeatures ) ; writer . append ( notifyLayerListeners ( EventType . BEGIN_LAYER , request , null ) ) ; addTransportContribution ( LayerContributionType . BEGIN_RESPONSE , null ) ; // Add script files to the layer first . Scripts have no transport contribution
for ( Map . Entry < IModule , ModuleBuildReader > entry : sorted . getScripts ( ) . entrySet ( ) ) { processReader ( entry . getKey ( ) , entry . getValue ( ) ) ; } if ( sorted . getCacheEntries ( ) . size ( ) > 0 || sorted . getModules ( ) . size ( ) > 0 ) { writer . append ( notifyLayerListeners ( EventType . BEGIN_AMD , request , null ) ) ; // Now add the loader cache entries .
if ( sorted . getCacheEntries ( ) . size ( ) > 0 ) { addTransportContribution ( LayerContributionType . BEGIN_LAYER_MODULES , moduleList . getRequiredModules ( ) ) ; int i = 0 ; for ( Map . Entry < IModule , ModuleBuildReader > entry : sorted . getCacheEntries ( ) . entrySet ( ) ) { writer . append ( notifyLayerListeners ( EventType . BEGIN_MODULE , request , entry . getKey ( ) ) ) ; ModuleInfo info = new ModuleInfo ( entry . getKey ( ) . getModuleId ( ) , entry . getValue ( ) . isScript ( ) ) ; LayerContributionType type = ( i ++ == 0 ) ? LayerContributionType . BEFORE_FIRST_LAYER_MODULE : LayerContributionType . BEFORE_SUBSEQUENT_LAYER_MODULE ; addTransportContribution ( type , info ) ; processReader ( entry . getKey ( ) , entry . getValue ( ) ) ; addTransportContribution ( LayerContributionType . AFTER_LAYER_MODULE , info ) ; } addTransportContribution ( LayerContributionType . END_LAYER_MODULES , moduleList . getRequiredModules ( ) ) ; } // Now add the loader requested modules
if ( sorted . getModules ( ) . size ( ) > 0 ) { Set < String > mids = new LinkedHashSet < String > ( ) ; for ( IModule module : sorted . getModules ( ) . keySet ( ) ) { mids . add ( module . getModuleId ( ) ) ; } addTransportContribution ( LayerContributionType . BEGIN_MODULES , mids ) ; int i = 0 ; for ( Map . Entry < IModule , ModuleBuildReader > entry : sorted . getModules ( ) . entrySet ( ) ) { writer . append ( notifyLayerListeners ( EventType . BEGIN_MODULE , request , entry . getKey ( ) ) ) ; ModuleInfo info = new ModuleInfo ( entry . getKey ( ) . getModuleId ( ) , entry . getValue ( ) . isScript ( ) ) ; LayerContributionType type = ( i ++ == 0 ) ? LayerContributionType . BEFORE_FIRST_MODULE : LayerContributionType . BEFORE_SUBSEQUENT_MODULE ; addTransportContribution ( type , info ) ; processReader ( entry . getKey ( ) , entry . getValue ( ) ) ; addTransportContribution ( LayerContributionType . AFTER_MODULE , info ) ; } addTransportContribution ( LayerContributionType . END_MODULES , mids ) ; } } writer . append ( notifyLayerListeners ( EventType . END_LAYER , request , null ) ) ; addTransportContribution ( LayerContributionType . END_RESPONSE , null ) ; moduleList . getDependentFeatures ( ) . addAll ( dependentFeatures ) ; // Output any messages to the console if debug mode is enabled
if ( options . isDebugMode ( ) || options . isDevelopmentMode ( ) ) { for ( String errorMsg : errorMessages ) { writer . append ( "\r\nconsole.error(\"" + errorMsg + "\");" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
} for ( String msg : nonErrorMessages ) { writer . append ( "\r\nconsole.warn(\"" + msg + "\");" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
} } // Help out the GC
sorted . clear ( ) ; futures . clear ( ) ; layerListenerModuleList . clear ( ) ; if ( sectionCount > 0 ) { // If any of the modules in the layer contained source map info , then
// create a source map for the layer and include the source mapping URL
// in the response .
writer . append ( "\n" ) . append ( getSourcesMappingEpilogue ( ) ) ; // $ NON - NLS - 1 $
finalizeSourceMap ( ) ; } return writer . toString ( ) ; |
public class DefaultApidocExcluder { /** * $ NON - NLS - 1 $ */
@ Override public boolean isExcluded ( Doc doc ) { } } | if ( Utils . isHiddenMember ( doc . name ( ) ) ) { return true ; } if ( doc . tags ( EXCLUDE_FROM_JAVADOC_TAG ) . length > 0 ) { return true ; } if ( doc instanceof ProgramElementDoc ) { final ProgramElementDoc element = ( ProgramElementDoc ) doc ; if ( element . containingPackage ( ) . tags ( EXCLUDE_FROM_JAVADOC_TAG ) . length > 0 ) { return true ; } if ( Utils . findFirst ( element . annotations ( ) , it -> Utils . qualifiedNameEquals ( Utils . getKeywords ( ) . getSyntheticMemberAnnotationName ( ) , it . annotationType ( ) . qualifiedName ( ) ) ) != null ) { return true ; } } // nothing above found a reason to exclude
return false ; |
public class TextAdapterActivity { /** * This is only used by activities , not connection pools
* @ return */
private int countTries ( ) throws ActivityException { } } | Integer [ ] statuses = { WorkStatus . STATUS_FAILED } ; // note the current activity is at in - progress status . Failed status must be counted
// It is debatable if we should include other statuses
int count ; try { count = this . getEngine ( ) . countActivityInstances ( getProcessInstanceId ( ) , this . getActivityId ( ) , statuses ) ; count += 1 ; // add the current instance - it is not yet in failed status
} catch ( Exception e ) { setReturnCode ( null ) ; // override " RETRY "
throw new ActivityException ( - 1 , "Failed to get count on failed tries" , e ) ; } return count ; |
public class SetTopBoxCreative { /** * Gets the licenseWindowStartDateTime value for this SetTopBoxCreative .
* @ return licenseWindowStartDateTime * The date and time that this creative can begin serving from
* a local cable video - on - demand
* server . This attribute is optional . */
public com . google . api . ads . admanager . axis . v201808 . DateTime getLicenseWindowStartDateTime ( ) { } } | return licenseWindowStartDateTime ; |
public class WebAppTypeImpl { /** * If not already created , a new < code > welcome - file - list < / code > element will be created and returned .
* Otherwise , the first existing < code > welcome - file - list < / code > element will be returned .
* @ return the instance defined for the element < code > welcome - file - list < / code > */
public WelcomeFileListType < WebAppType < T > > getOrCreateWelcomeFileList ( ) { } } | List < Node > nodeList = childNode . get ( "welcome-file-list" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new WelcomeFileListTypeImpl < WebAppType < T > > ( this , "welcome-file-list" , childNode , nodeList . get ( 0 ) ) ; } return createWelcomeFileList ( ) ; |
public class EM { /** * Assigns the current probability values to the instances in the database and
* compute the expectation value of the current mixture of distributions .
* Computed as the sum of the logarithms of the prior probability of each
* instance .
* @ param relation the database used for assignment to instances
* @ param models Cluster models
* @ param probClusterIGivenX Output storage for cluster probabilities
* @ return the expectation value of the current mixture of distributions */
public static double assignProbabilitiesToInstances ( Relation < ? extends NumberVector > relation , List < ? extends EMClusterModel < ? > > models , WritableDataStore < double [ ] > probClusterIGivenX ) { } } | final int k = models . size ( ) ; double emSum = 0. ; for ( DBIDIter iditer = relation . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { NumberVector vec = relation . get ( iditer ) ; double [ ] probs = new double [ k ] ; for ( int i = 0 ; i < k ; i ++ ) { double v = models . get ( i ) . estimateLogDensity ( vec ) ; probs [ i ] = v > MIN_LOGLIKELIHOOD ? v : MIN_LOGLIKELIHOOD ; } final double logP = logSumExp ( probs ) ; for ( int i = 0 ; i < k ; i ++ ) { probs [ i ] = FastMath . exp ( probs [ i ] - logP ) ; } probClusterIGivenX . put ( iditer , probs ) ; emSum += logP ; } return emSum / relation . size ( ) ; |
public class TurfJoins { /** * Takes a { @ link Point } and a { @ link Polygon } and determines if the point resides inside the
* polygon . The polygon can be convex or concave . The function accounts for holes .
* @ param point which you ' d like to check if inside the polygon
* @ param polygon which you ' d like to check if the points inside
* @ return true if the Point is inside the Polygon ; false if the Point is not inside the Polygon
* @ see < a href = " http : / / turfjs . org / docs / # inside " > Turf Inside documentation < / a >
* @ since 1.3.0 */
public static boolean inside ( Point point , Polygon polygon ) { } } | // This API needs to get better
List < List < Point > > coordinates = polygon . coordinates ( ) ; List < List < List < Point > > > multiCoordinates = new ArrayList < > ( ) ; multiCoordinates . add ( coordinates ) ; return inside ( point , MultiPolygon . fromLngLats ( multiCoordinates ) ) ; |
public class ImageManager { /** * Creates a buffered image , optimized for display on our graphics device . */
public BufferedImage createImage ( int width , int height , int transparency ) { } } | return _icreator . createImage ( width , height , transparency ) ; |
public class WorkerImpl { /** * Creates a unique name , suitable for use with Resque .
* @ return a unique name for this worker */
protected String createName ( ) { } } | final StringBuilder buf = new StringBuilder ( 128 ) ; try { buf . append ( InetAddress . getLocalHost ( ) . getHostName ( ) ) . append ( COLON ) . append ( ManagementFactory . getRuntimeMXBean ( ) . getName ( ) . split ( "@" ) [ 0 ] ) // PID
. append ( '-' ) . append ( this . workerId ) . append ( COLON ) . append ( JAVA_DYNAMIC_QUEUES ) ; for ( final String queueName : this . queueNames ) { buf . append ( ',' ) . append ( queueName ) ; } } catch ( UnknownHostException uhe ) { throw new RuntimeException ( uhe ) ; } return buf . toString ( ) ; |
public class CommerceWishListItemLocalServiceBaseImpl { /** * Returns a range of all the commerce wish list items .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link com . liferay . commerce . wish . list . model . impl . CommerceWishListItemModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param start the lower bound of the range of commerce wish list items
* @ param end the upper bound of the range of commerce wish list items ( not inclusive )
* @ return the range of commerce wish list items */
@ Override public List < CommerceWishListItem > getCommerceWishListItems ( int start , int end ) { } } | return commerceWishListItemPersistence . findAll ( start , end ) ; |
public class Transporter { /** * Closes transporter . */
@ Override public void stopped ( ) { } } | // Stop heartbeat timer
if ( heartBeatTimer != null ) { heartBeatTimer . cancel ( false ) ; heartBeatTimer = null ; } // Stop timeout checker ' s timer
if ( checkTimeoutTimer != null ) { checkTimeoutTimer . cancel ( false ) ; checkTimeoutTimer = null ; } // Send " disconnected " packet
sendDisconnectPacket ( ) ; // Clear all stored data
nodes . clear ( ) ; |
public class AcceptableUsagePolicyStatus { /** * Gets property or default .
* @ param name the name
* @ param defaultValue the default value
* @ return the property or default */
public Collection < Object > getPropertyOrDefault ( final String name , final Object defaultValue ) { } } | return getPropertyOrDefault ( name , CollectionUtils . wrapList ( defaultValue ) ) ; |
public class DatabasesInner { /** * Gets a database inside of a recommented elastic pool .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ param recommendedElasticPoolName The name of the elastic pool to be retrieved .
* @ param databaseName The name of the database to be retrieved .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the DatabaseInner object */
public Observable < ServiceResponse < DatabaseInner > > getByRecommendedElasticPoolWithServiceResponseAsync ( String resourceGroupName , String serverName , String recommendedElasticPoolName , String databaseName ) { } } | if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( serverName == null ) { throw new IllegalArgumentException ( "Parameter serverName is required and cannot be null." ) ; } if ( recommendedElasticPoolName == null ) { throw new IllegalArgumentException ( "Parameter recommendedElasticPoolName is required and cannot be null." ) ; } if ( databaseName == null ) { throw new IllegalArgumentException ( "Parameter databaseName is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } return service . getByRecommendedElasticPool ( this . client . subscriptionId ( ) , resourceGroupName , serverName , recommendedElasticPoolName , databaseName , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < DatabaseInner > > > ( ) { @ Override public Observable < ServiceResponse < DatabaseInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < DatabaseInner > clientResponse = getByRecommendedElasticPoolDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class Allocation { /** * Returns the sum of the { @ link # size sizes } of the allocations . */
static long getTotalSize ( Collection < Allocation > allocations ) { } } | long totalSize = 0 ; for ( Allocation allocation : allocations ) { totalSize += allocation . size ; } return totalSize ; |
public class InputMedia { /** * Use this setter to send new file as stream .
* @ param mediaStream File to send
* @ return This object */
public T setMedia ( InputStream mediaStream , String fileName ) { } } | this . newMediaStream = mediaStream ; this . isNewMedia = true ; this . mediaName = fileName ; this . media = "attach://" + fileName ; return ( T ) this ; |
public class JSMessageData { /** * Locking : private method , lock will be held by the caller */
private void checkDynamic ( int accessor ) throws JMFSchemaViolationException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . entry ( this , tc , "checkDynamic" , new Object [ ] { Integer . valueOf ( accessor ) } ) ; JSField field = getFieldDef ( accessor , false ) ; if ( field instanceof JSDynamic ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . exit ( this , tc , "checkDynamic" ) ; return ; } JMFSchemaViolationException e = new JMFSchemaViolationException ( "Field type at accessor " + accessor + " is not Dynamic" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . exit ( this , tc , "checkDynamic" , e ) ; throw e ; |
public class AbstractCachingInterceptor { /** * Get the requested object from the cache . The key is either obtained from the pipeline context ( keyKey ) if
* possible . Alternatively , the { @ link CacheContainer } is built to determine the cache key .
* @ param keyKey key to put the cache key in the pipeline context
* @ param contextKey key to put the cache context in the pipeline context
* @ param keys keys which need to be include in the cache context
* @ param category cache category
* @ param pipelineContext pipeline context
* @ param containerClass container class
* @ param < CONTAINER > container class
* @ return cache container */
protected < CONTAINER extends CacheContainer > CONTAINER getContainer ( String keyKey , String contextKey , String [ ] keys , CacheCategory category , PipelineContext pipelineContext , Class < CONTAINER > containerClass ) { } } | return cachingSupportService . getContainer ( keyKey , contextKey , keys , category , pipelineContext , this , containerClass ) ; |
public class ASMUtil { /** * return a array of new Label ( used for switch / case generation )
* @ param cnt
* number of label to return */
public static Label [ ] newLabels ( int cnt ) { } } | Label [ ] r = new Label [ cnt ] ; for ( int i = 0 ; i < cnt ; i ++ ) r [ i ] = new Label ( ) ; return r ; |
public class LogContext { /** * Adds the given key / value pair to this logging context . If the key cannot be repeated , and
* there is already a value for the key in the metadata , then the existing value is replaced ,
* otherwise the value is added at the end of the metadata .
* @ param key the metadata key ( see { @ link LogData } ) .
* @ param value the metadata value . */
protected final < T > void addMetadata ( MetadataKey < T > key , T value ) { } } | if ( metadata == null ) { metadata = new MutableMetadata ( ) ; } metadata . addValue ( key , value ) ; |
public class GPXPoint { /** * Set the horizontal dilution of precision of a point .
* @ param contentBuffer Contains the information to put in the table */
public final void setHdop ( StringBuilder contentBuffer ) { } } | ptValues [ GpxMetadata . PTHDOP ] = Double . parseDouble ( contentBuffer . toString ( ) ) ; |
public class ListByteMatchSetsResult { /** * An array of < a > ByteMatchSetSummary < / a > objects .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setByteMatchSets ( java . util . Collection ) } or { @ link # withByteMatchSets ( java . util . Collection ) } if you want
* to override the existing values .
* @ param byteMatchSets
* An array of < a > ByteMatchSetSummary < / a > objects .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListByteMatchSetsResult withByteMatchSets ( ByteMatchSetSummary ... byteMatchSets ) { } } | if ( this . byteMatchSets == null ) { setByteMatchSets ( new java . util . ArrayList < ByteMatchSetSummary > ( byteMatchSets . length ) ) ; } for ( ByteMatchSetSummary ele : byteMatchSets ) { this . byteMatchSets . add ( ele ) ; } return this ; |
public class TableRef { /** * Applies a filter to the table . When fetched , it will return the items lesser than the filter property value .
* < pre >
* StorageRef storage = new StorageRef ( " your _ app _ key " , " your _ token " ) ;
* TableRef tableRef = storage . table ( " your _ table " ) ;
* / / Retrieve all items that have their " itemProperty " value lesser than 10
* tableRef . lessThan ( " itemProperty " , new ItemAttribute ( 10 ) ) . getItems ( new OnItemSnapshot ( ) {
* & # 064 ; Override
* public void run ( ItemSnapshot itemSnapshot ) {
* if ( itemSnapshot ! = null ) {
* Log . d ( " TableRef " , " Item retrieved : " + itemSnapshot . val ( ) ) ;
* } , new OnError ( ) {
* & # 064 ; Override
* public void run ( Integer code , String errorMessage ) {
* Log . e ( " TableRef " , " Error retrieving items : " + errorMessage ) ;
* < / pre >
* @ param attributeName
* The name of the property to filter .
* @ param value
* The value of the property to filter .
* @ return Current table reference */
public TableRef lessThan ( String attributeName , ItemAttribute value ) { } } | filters . add ( new Filter ( StorageFilter . LESSERTHAN , attributeName , value , null ) ) ; return this ; |
public class AppenderFile { /** * Gets rx observable that reads the log files and appends to string .
* @ return Observable that reads the log files and appends to string . */
private Observable < String > loadLogsObservable ( ) { } } | return Observable . fromCallable ( ( ) -> { StringBuilder sb = new StringBuilder ( ) ; Context context = appContextRef . get ( ) ; if ( context != null ) { synchronized ( sharedLock ) { try { File dir = context . getFilesDir ( ) ; String line ; for ( int i = 1 ; i <= maxFiles ; i ++ ) { File file = new File ( dir , name ( i ) ) ; if ( file . exists ( ) ) { inputStream = new FileInputStream ( file ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; while ( ( line = reader . readLine ( ) ) != null ) { sb . append ( line ) . append ( '\n' ) ; } reader . close ( ) ; } } } catch ( Exception e ) { throw Exceptions . propagate ( e ) ; } finally { sharedLock . notifyAll ( ) ; } } } return sb . toString ( ) ; } ) ; |
public class POContextStack { /** * ( non - Javadoc )
* @ see org . overture . pog . IPOContextStack # getName ( ) */
@ Override public String getName ( ) { } } | StringBuilder result = new StringBuilder ( ) ; String prefix = "" ; for ( IPOContext ctxt : this ) { String name = ctxt . getName ( ) ; if ( name . length ( ) > 0 ) { result . append ( prefix ) ; result . append ( name ) ; prefix = ", " ; } } return result . toString ( ) ; |
public class MBeanServerProxy { /** * { @ inheritDoc } */
public ObjectInputStream deserialize ( ObjectName name , byte [ ] data ) throws OperationsException { } } | return delegate . deserialize ( name , data ) ; |
public class AmazonEC2Client { /** * Deletes the specified EC2 Fleet .
* After you delete an EC2 Fleet , it launches no new instances . You must specify whether an EC2 Fleet should also
* terminate its instances . If you terminate the instances , the EC2 Fleet enters the
* < code > deleted _ terminating < / code > state . Otherwise , the EC2 Fleet enters the < code > deleted _ running < / code > state ,
* and the instances continue to run until they are interrupted or you terminate them manually .
* @ param deleteFleetsRequest
* @ return Result of the DeleteFleets operation returned by the service .
* @ sample AmazonEC2 . DeleteFleets
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / DeleteFleets " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DeleteFleetsResult deleteFleets ( DeleteFleetsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDeleteFleets ( request ) ; |
public class TimeUtils { /** * Convert from a TimeUnit to a influxDB timeunit String .
* @ param t time unit
* @ return the String representation . */
public static String toTimePrecision ( final TimeUnit t ) { } } | switch ( t ) { case HOURS : return "h" ; case MINUTES : return "m" ; case SECONDS : return "s" ; case MILLISECONDS : return "ms" ; case MICROSECONDS : return "u" ; case NANOSECONDS : return "n" ; default : EnumSet < TimeUnit > allowedTimeunits = EnumSet . of ( TimeUnit . HOURS , TimeUnit . MINUTES , TimeUnit . SECONDS , TimeUnit . MILLISECONDS , TimeUnit . MICROSECONDS , TimeUnit . NANOSECONDS ) ; throw new IllegalArgumentException ( "time precision must be one of:" + allowedTimeunits ) ; } |
public class JobExecutionsInner { /** * Starts an elastic job execution .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ param jobAgentName The name of the job agent .
* @ param jobName The name of the job to get .
* @ 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 < JobExecutionInner > beginCreateAsync ( String resourceGroupName , String serverName , String jobAgentName , String jobName , final ServiceCallback < JobExecutionInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( beginCreateWithServiceResponseAsync ( resourceGroupName , serverName , jobAgentName , jobName ) , serviceCallback ) ; |
public class AbstractUPCEAN { /** * Validates a UPC / EAN / GTIN / GLN message .
* @ param aChars
* the chars to validate
* @ return { @ link EValidity # VALID } if the msg is valid ,
* { @ link EValidity # INVALID } otherwise . */
@ Nonnull protected static EValidity validateMessage ( @ Nonnull final char [ ] aChars ) { } } | ValueEnforcer . notNull ( aChars , "Chars" ) ; for ( final char c : aChars ) if ( c < '0' || c > '9' ) return EValidity . INVALID ; return EValidity . VALID ; |
public class Iterators { /** * Combine the iterators into a single one .
* @ param iterators An iterator of iterators
* @ return a single combined iterator */
public static < T > Iterator < T > concat ( Iterator < ? extends Iterator < ? extends T > > iterators ) { } } | Preconditions . checkArgumentNotNull ( iterators , "iterators" ) ; return new CombinedIterator < T > ( iterators ) ; |
public class SqlFetcher { /** * Downloads the entire resultset object into a file . This avoids maintaining a
* persistent connection to the database . The retry is performed at the query execution layer .
* @ param object sql query for which the resultset is to be downloaded
* @ param outFile a file which the object data is stored
* @ return size of downloaded resultset */
@ Override protected long download ( T object , File outFile ) throws IOException { } } | openObjectFunction . open ( object , outFile ) ; return outFile . length ( ) ; |
public class Branch { /** * Method shows play store install prompt for the full app . Use this method only if you want the full app to receive a custom { @ link BranchUniversalObject } to do deferred deep link .
* Please see { @ link # showInstallPrompt ( Activity , int ) }
* NOTE :
* This method will do a synchronous generation of Branch short link for the BUO . So please consider calling this method on non UI thread
* Please make sure your instant app and full ap are using same Branch key in order for the deferred deep link working
* @ param activity Current activity
* @ param requestCode Request code for the activity to receive the result
* @ param buo { @ link BranchUniversalObject } to pass to the full app up on install
* @ return { @ code true } if install prompt is shown to user */
public static boolean showInstallPrompt ( @ NonNull Activity activity , int requestCode , @ NonNull BranchUniversalObject buo ) { } } | if ( buo != null ) { String shortUrl = buo . getShortUrl ( activity , new LinkProperties ( ) ) ; String installReferrerString = Defines . Jsonkey . ReferringLink . getKey ( ) + "=" + shortUrl ; if ( ! TextUtils . isEmpty ( installReferrerString ) ) { return showInstallPrompt ( activity , requestCode , installReferrerString ) ; } else { return showInstallPrompt ( activity , requestCode , "" ) ; } } return false ; |
public class Encoding { /** * Description of the Method
* @ param input Description of the Parameter
* @ return Description of the Return Value */
public static synchronized String rot13 ( String input ) { } } | StringBuffer output = new StringBuffer ( ) ; if ( input != null ) { for ( int i = 0 ; i < input . length ( ) ; i ++ ) { char inChar = input . charAt ( i ) ; if ( ( inChar >= 'A' ) & ( inChar <= 'Z' ) ) { inChar += 13 ; if ( inChar > 'Z' ) { inChar -= 26 ; } } if ( ( inChar >= 'a' ) & ( inChar <= 'z' ) ) { inChar += 13 ; if ( inChar > 'z' ) { inChar -= 26 ; } } output . append ( inChar ) ; } } return output . toString ( ) ; |
public class MarkupFormatter { /** * Generate HTML for preview , using markup formatter .
* Can be called from other views . */
public HttpResponse doPreviewDescription ( @ QueryParameter String text ) throws IOException { } } | StringWriter w = new StringWriter ( ) ; translate ( text , w ) ; return HttpResponses . html ( w . toString ( ) ) ; |
public class AbstractParameterizablePlugin { /** * Parses the arguments and injects values into the beans via properties . */
public int parseArgument ( Options opt , String [ ] args , int start ) throws BadCommandLineException , IOException { } } | int consumed = 0 ; final String optionPrefix = "-" + getOptionName ( ) + "-" ; final int optionPrefixLength = optionPrefix . length ( ) ; final String arg = args [ start ] ; final int equalsPosition = arg . indexOf ( '=' ) ; if ( arg . startsWith ( optionPrefix ) && equalsPosition > optionPrefixLength ) { final String propertyName = arg . substring ( optionPrefixLength , equalsPosition ) ; final String value = arg . substring ( equalsPosition + 1 ) ; consumed ++ ; try { BeanUtils . setProperty ( this , propertyName , value ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; throw new BadCommandLineException ( "Error setting property [" + propertyName + "], value [" + value + "]." ) ; } } return consumed ; |
public class BootstrapContextCoordinator { /** * Unregister boostrap context
* @ param bc The bootstrap context */
public void unregisterBootstrapContext ( CloneableBootstrapContext bc ) { } } | if ( bc != null ) { if ( bc . getName ( ) == null || bc . getName ( ) . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "The name of BootstrapContext is invalid: " + bc ) ; if ( bootstrapContexts . keySet ( ) . contains ( bc . getName ( ) ) ) { bootstrapContexts . remove ( bc . getName ( ) ) ; } } |
public class ListMultimap { /** * Replaces all values with the given values .
* @ param key the key
* @ param values the values with which to replace all existing values
* @ return the values that were replaced ( this list is immutable ) */
public List < V > replace ( K key , Collection < ? extends V > values ) { } } | List < V > replaced = removeAll ( key ) ; putAll ( key , values ) ; return replaced ; |
public class ZkConsumerCommand { /** * 获取指定主题及分区logsize
* @ param stat */
public void getTopicPartitionLogSize ( TopicPartitionInfo stat ) { } } | BrokerEndPoint leader = findLeader ( stat . getTopic ( ) , stat . getPartition ( ) ) . leader ( ) ; SimpleConsumer consumer = getConsumerClient ( leader . host ( ) , leader . port ( ) ) ; try { long logsize = getLastOffset ( consumer , stat . getTopic ( ) , stat . getPartition ( ) , kafka . api . OffsetRequest . LatestTime ( ) ) ; stat . setLogSize ( logsize ) ; } finally { consumer . close ( ) ; } |
public class ConnectionManager { /** * 获取连接并执行交易
* @ param address
* @ param command
* @ return */
public < T > T executeFdfsCmd ( InetSocketAddress address , FdfsCommand < T > command ) { } } | // 获取连接
Connection conn = getConnection ( address ) ; // 执行交易
return execute ( address , conn , command ) ; |
public class ReferenceContextImpl { /** * Merge bindings and resource references .
* @ param masterCompNSConfig the output component
* @ param compNSConfigs the input components
* @ param scope the desired scope , or null for all scopes */
static void mergeResRefsAndBindings ( ComponentNameSpaceConfiguration masterCompNSConfig , List < ComponentNameSpaceConfiguration > compNSConfigs , InjectionScope scope ) throws InjectionException { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "mergeResRefsAndBindings" ) ; Map < String , ResourceRefConfig [ ] > resRefMap = new LinkedHashMap < String , ResourceRefConfig [ ] > ( ) ; Map < JNDIEnvironmentRefType , Map < String , ComponentNameSpaceConfiguration > > allBindingComps = new EnumMap < JNDIEnvironmentRefType , Map < String , ComponentNameSpaceConfiguration > > ( JNDIEnvironmentRefType . class ) ; for ( JNDIEnvironmentRefType refType : JNDIEnvironmentRefType . VALUES ) { if ( refType . getBindingElementName ( ) != null ) { masterCompNSConfig . setJNDIEnvironmentRefBindings ( refType . getType ( ) , new HashMap < String , String > ( ) ) ; allBindingComps . put ( refType , new HashMap < String , ComponentNameSpaceConfiguration > ( ) ) ; } } Map < String , String > envEntryValues = new HashMap < String , String > ( ) ; Map < String , ComponentNameSpaceConfiguration > envEntryValueComps = new HashMap < String , ComponentNameSpaceConfiguration > ( ) ; masterCompNSConfig . setEnvEntryValues ( envEntryValues ) ; boolean refMergeSuccess = true ; for ( int componentIndex = 0 ; componentIndex < compNSConfigs . size ( ) ; componentIndex ++ ) { ComponentNameSpaceConfiguration compNSConfig = compNSConfigs . get ( componentIndex ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "merging component " + componentIndex + ": " + compNSConfig . getJ2EEName ( ) ) ; // d643480 - Build map of resource reference arrays for merging .
ResourceRefConfigList resRefs = compNSConfig . getResourceRefConfigList ( ) ; if ( resRefs != null ) { for ( int i = 0 , size = resRefs . size ( ) ; i < size ; i ++ ) { ResourceRefConfig resRef = resRefs . getResourceRefConfig ( i ) ; String resRefName = resRef . getName ( ) ; if ( scope == null || scope == InjectionScope . match ( resRefName ) ) { ResourceRefConfig [ ] resRefArray = resRefMap . get ( resRefName ) ; if ( resRefArray == null ) { resRefArray = new ResourceRefConfig [ compNSConfigs . size ( ) ] ; resRefMap . put ( resRefName , resRefArray ) ; } // Like in previous releases , we won ' t error if an individual
// component has conflicting ResRefs . ResRefList . findByName
// has always returned the first ResRef in the list , so
// ignore subsequent ResRefs for this component .
if ( resRefArray [ componentIndex ] == null ) { resRefArray [ componentIndex ] = resRef ; } } } } for ( JNDIEnvironmentRefType refType : JNDIEnvironmentRefType . VALUES ) { if ( refType . getBindingElementName ( ) != null ) { refMergeSuccess &= mergeBindings ( compNSConfig , scope , refType . getBindingElementName ( ) , refType . getBindingAttributeName ( ) , compNSConfig . getJNDIEnvironmentRefBindings ( refType . getType ( ) ) , masterCompNSConfig . getJNDIEnvironmentRefBindings ( refType . getType ( ) ) , allBindingComps . get ( refType ) ) ; } } refMergeSuccess &= mergeBindings ( compNSConfig , scope , "env-entry" , "value" , compNSConfig . getEnvEntryValues ( ) , envEntryValues , envEntryValueComps ) ; } refMergeSuccess &= mergeResRefs ( masterCompNSConfig , compNSConfigs , resRefMap ) ; // d643480
if ( ! refMergeSuccess ) { throw new InjectionConfigurationException ( "There were conflicting references. " + "See CWNEN0061E messages in log for details." ) ; } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "mergeResRefsAndBindings" ) ; |
public class CommonOps_DDF4 { /** * Performs an in - place element by element scalar multiplication . < br >
* < br >
* a < sub > ij < / sub > = & alpha ; * a < sub > ij < / sub >
* @ param a The vector that is to be scaled . Modified .
* @ param alpha the amount each element is multiplied by . */
public static void scale ( double alpha , DMatrix4 a ) { } } | a . a1 *= alpha ; a . a2 *= alpha ; a . a3 *= alpha ; a . a4 *= alpha ; |
public class ThriftDeserialization { /** * Deserializes byte - array into thrift object .
* Supporting binary , compact and json protocols ,
* and the byte array could be or not be encoded by Base64.
* @ param bytes the byte - array to deserialize
* @ param thriftObj the output thrift object
* @ return the output thrift object , or null if error occurs */
public static < T extends TBase > T detectAndDeserialize ( final byte [ ] bytes , final T thriftObj ) throws TException { } } | Preconditions . checkNotNull ( thriftObj ) ; try { final byte [ ] src = decodeB64IfNeeded ( bytes ) ; final TProtocolFactory protocolFactory = TProtocolUtil . guessProtocolFactory ( src , null ) ; Preconditions . checkNotNull ( protocolFactory ) ; if ( protocolFactory instanceof TCompactProtocol . Factory ) { DESERIALIZER_COMPACT . get ( ) . deserialize ( thriftObj , src ) ; } else if ( protocolFactory instanceof TBinaryProtocol . Factory ) { DESERIALIZER_BINARY . get ( ) . deserialize ( thriftObj , src ) ; } else { DESERIALIZER_JSON . get ( ) . deserialize ( thriftObj , src ) ; } } catch ( final IllegalArgumentException e ) { throw new TException ( e ) ; } return thriftObj ; |
public class ConstantsSummaryWriterImpl { /** * { @ inheritDoc } */
public void addPackageName ( PackageElement pkg , Content summariesTree , boolean first ) { } } | Content pkgNameContent ; if ( ! first && configuration . allowTag ( HtmlTag . SECTION ) ) { summariesTree . addContent ( summaryTree ) ; } if ( pkg . isUnnamed ( ) ) { summariesTree . addContent ( getMarkerAnchor ( SectionName . UNNAMED_PACKAGE_ANCHOR ) ) ; pkgNameContent = contents . defaultPackageLabel ; } else { String parsedPackageName = utils . parsePackageName ( pkg ) ; summariesTree . addContent ( getMarkerAnchor ( parsedPackageName ) ) ; pkgNameContent = getPackageLabel ( parsedPackageName ) ; } Content headingContent = new StringContent ( ".*" ) ; Content heading = HtmlTree . HEADING ( HtmlConstants . PACKAGE_HEADING , true , pkgNameContent ) ; heading . addContent ( headingContent ) ; if ( configuration . allowTag ( HtmlTag . SECTION ) ) { summaryTree = HtmlTree . SECTION ( heading ) ; } else { summariesTree . addContent ( heading ) ; } |
public class JCalendar { /** * JCalendar is a PropertyChangeListener , for its day , month and year
* chooser .
* @ param evt
* the property change event */
public void propertyChange ( PropertyChangeEvent evt ) { } } | if ( calendar != null ) { Calendar c = ( Calendar ) calendar . clone ( ) ; if ( evt . getPropertyName ( ) . equals ( "day" ) ) { c . set ( Calendar . DAY_OF_MONTH , ( ( Integer ) evt . getNewValue ( ) ) . intValue ( ) ) ; setCalendar ( c , false ) ; } else if ( evt . getPropertyName ( ) . equals ( "month" ) ) { c . set ( Calendar . MONTH , ( ( Integer ) evt . getNewValue ( ) ) . intValue ( ) ) ; setCalendar ( c , false ) ; } else if ( evt . getPropertyName ( ) . equals ( "year" ) ) { c . set ( Calendar . YEAR , ( ( Integer ) evt . getNewValue ( ) ) . intValue ( ) ) ; setCalendar ( c , false ) ; } else if ( evt . getPropertyName ( ) . equals ( "date" ) ) { c . setTime ( ( Date ) evt . getNewValue ( ) ) ; setCalendar ( c , true ) ; } } |
public class RadarChartTileSkin { /** * * * * * * Initialization * * * * * */
@ Override protected void initGraphics ( ) { } } | super . initGraphics ( ) ; radarChart = new RadarChart ( tile . getChartData ( ) ) ; radarChart . setMaxValue ( tile . getMaxValue ( ) ) ; radarChart . setUnit ( tile . getUnit ( ) ) ; radarChart . setLegendVisible ( true ) ; radarChart . setThresholdVisible ( tile . isThresholdVisible ( ) ) ; radarChart . setMode ( tile . getRadarChartMode ( ) ) ; radarChart . setGridColor ( tile . getChartGridColor ( ) ) ; radarChart . setChartTextColor ( tile . getTextColor ( ) ) ; radarChart . setThresholdColor ( tile . getThresholdColor ( ) ) ; radarChart . setGradientStops ( tile . getGradientStops ( ) ) ; chartEventListener = e -> radarChart . redraw ( ) ; tile . getChartData ( ) . forEach ( chartData -> chartData . addChartDataEventListener ( chartEventListener ) ) ; chartDataListener = c -> { while ( c . next ( ) ) { if ( c . wasAdded ( ) ) { c . getAddedSubList ( ) . forEach ( addedItem -> addedItem . addChartDataEventListener ( chartEventListener ) ) ; } else if ( c . wasRemoved ( ) ) { c . getRemoved ( ) . forEach ( removedItem -> removedItem . removeChartDataEventListener ( chartEventListener ) ) ; } } radarChart . redraw ( ) ; } ; titleText = new Text ( ) ; titleText . setFill ( tile . getTitleColor ( ) ) ; Helper . enableNode ( titleText , ! tile . getTitle ( ) . isEmpty ( ) ) ; text = new Text ( tile . getText ( ) ) ; text . setFill ( tile . getTextColor ( ) ) ; Helper . enableNode ( text , tile . isTextVisible ( ) ) ; getPane ( ) . getChildren ( ) . addAll ( titleText , radarChart , text ) ; |
public class ObjectOffsetImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . OBJECT_OFFSET__OBJ_TPE : setObjTpe ( OBJ_TPE_EDEFAULT ) ; return ; case AfplibPackage . OBJECT_OFFSET__OBJ_OSET : setObjOset ( OBJ_OSET_EDEFAULT ) ; return ; case AfplibPackage . OBJECT_OFFSET__OBJ_OST_HI : setObjOstHi ( OBJ_OST_HI_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class ScriptRuntime { /** * Prepare for calling & lt ; expression & gt ; ( . . . ) : return function corresponding to
* & lt ; expression & gt ; and make parent scope of the function available
* as ScriptRuntime . lastStoredScriptable ( ) for consumption as thisObj .
* The caller must call ScriptRuntime . lastStoredScriptable ( ) immediately
* after calling this method . */
public static Callable getValueFunctionAndThis ( Object value , Context cx ) { } } | if ( ! ( value instanceof Callable ) ) { throw notFunctionError ( value ) ; } Callable f = ( Callable ) value ; Scriptable thisObj = null ; if ( f instanceof Scriptable ) { thisObj = ( ( Scriptable ) f ) . getParentScope ( ) ; } if ( thisObj == null ) { if ( cx . topCallScope == null ) throw new IllegalStateException ( ) ; thisObj = cx . topCallScope ; } if ( thisObj . getParentScope ( ) != null ) { if ( thisObj instanceof NativeWith ) { // functions defined inside with should have with target
// as their thisObj
} else if ( thisObj instanceof NativeCall ) { // nested functions should have top scope as their thisObj
thisObj = ScriptableObject . getTopLevelScope ( thisObj ) ; } } storeScriptable ( cx , thisObj ) ; return f ; |
public class CircularBarPager { /** * Apply a { @ link android . support . v4 . view . ViewPager # setPadding ( int , int , int , int ) } and
* { @ link android . support . v4 . view . ViewPager # setPageMargin ( int ) } in order to get a nicer animation
* on the { @ link android . support . v4 . view . ViewPager } inside the { @ link CircularBar } */
@ Override protected void onMeasure ( int widthMeasureSpec , int heightMeasureSpec ) { } } | super . onMeasure ( widthMeasureSpec , heightMeasureSpec ) ; if ( ! isPaddingSet && mViewPager != null ) { int paddingForViewPager = this . getMeasuredWidth ( ) / mPaddingRatio ; mViewPager . setPadding ( paddingForViewPager , mViewPager . getPaddingTop ( ) , paddingForViewPager , mViewPager . getPaddingBottom ( ) ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . HONEYCOMB ) { mViewPager . setPageMargin ( - ( int ) ( ( ( float ) mViewPager . getPaddingLeft ( ) + ( float ) mViewPager . getPaddingRight ( ) ) * 2.0f ) ) ; } isPaddingSet = true ; } |
public class Injection { /** * Inject a value into an object property
* @ param object The object
* @ param propertyName The property name
* @ param propertyValue The property value
* @ param propertyType The property type as a fully quilified class name
* @ param includeFields Should fields be included for injection if a method can ' t be found
* @ exception NoSuchMethodException If the property method cannot be found
* @ exception IllegalAccessException If the property method cannot be accessed
* @ exception InvocationTargetException If the property method cannot be executed */
@ SuppressWarnings ( "unchecked" ) public void inject ( Object object , String propertyName , Object propertyValue , String propertyType , boolean includeFields ) throws NoSuchMethodException , IllegalAccessException , InvocationTargetException { } } | if ( object == null ) throw new IllegalArgumentException ( "Object is null" ) ; if ( propertyName == null || propertyName . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "PropertyName is undefined" ) ; String methodName = "set" + propertyName . substring ( 0 , 1 ) . toUpperCase ( Locale . US ) ; if ( propertyName . length ( ) > 1 ) { methodName += propertyName . substring ( 1 ) ; } Method method = findMethod ( object . getClass ( ) , methodName , propertyType ) ; if ( method != null ) { Class < ? > parameterClass = method . getParameterTypes ( ) [ 0 ] ; Object parameterValue = null ; try { parameterValue = getValue ( propertyName , parameterClass , propertyValue , SecurityActions . getClassLoader ( object . getClass ( ) ) ) ; } catch ( Throwable t ) { throw new InvocationTargetException ( t , t . getMessage ( ) ) ; } if ( ! parameterClass . isPrimitive ( ) || parameterValue != null ) method . invoke ( object , new Object [ ] { parameterValue } ) ; } else { if ( ! includeFields ) throw new NoSuchMethodException ( "Method " + methodName + " not found" ) ; // Ok , we didn ' t find a method - assume field
Field field = findField ( object . getClass ( ) , propertyName , propertyType ) ; if ( field != null ) { Class < ? > fieldClass = field . getType ( ) ; Object fieldValue = null ; try { fieldValue = getValue ( propertyName , fieldClass , propertyValue , SecurityActions . getClassLoader ( object . getClass ( ) ) ) ; } catch ( Throwable t ) { throw new InvocationTargetException ( t , t . getMessage ( ) ) ; } field . set ( object , fieldValue ) ; } else { throw new NoSuchMethodException ( "Field " + propertyName + " not found" ) ; } } |
public class SamplingSubgraphIterator { /** * If the { @ code nextSubgraphs } queue is empty , expands the graph frontier
* of the next available vertex , if one exists , and the subgraphs reachable
* from it to the queue . */
private void advance ( ) { } } | while ( nextSubgraphs . isEmpty ( ) && vertexIter . hasNext ( ) ) { Integer nextVertex = vertexIter . next ( ) ; // Determine the set of vertices that are greater than this vertex
Set < Integer > extension = new HashSet < Integer > ( ) ; for ( Integer v : g . getNeighbors ( nextVertex ) ) if ( v > nextVertex ) extension . add ( v ) ; Set < Integer > subgraph = new HashSet < Integer > ( ) ; subgraph . add ( nextVertex ) ; extendSubgraph ( subgraph , extension , nextVertex ) ; } |
public class TransactionRomanticSnapshotBuilder { protected void setupEntryMethodExp ( StringBuilder sb , RomanticTransaction tx ) { } } | final Method entryMethod = tx . getEntryMethod ( ) ; if ( entryMethod != null ) { final String appPkg = getApplicationPackageKeyword ( ) ; final String classExp = Srl . substringFirstRear ( entryMethod . getDeclaringClass ( ) . getName ( ) , appPkg ) ; sb . append ( ", " ) . append ( classExp ) . append ( "@" ) . append ( entryMethod . getName ( ) ) . append ( "()" ) ; } |
public class CheckArg { /** * Check that the argument is positive ( > 0 ) .
* @ param argument The argument
* @ param name The name of the argument
* @ throws IllegalArgumentException If argument is non - positive ( < = 0) */
public static void isPositive ( long argument , String name ) { } } | if ( argument <= 0 ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBePositive . text ( name , argument ) ) ; } |
public class A_CmsSelectWidget { /** * Adds a new select option to this widget . < p >
* @ param option the select option to add */
public void addSelectOption ( CmsSelectWidgetOption option ) { } } | if ( m_selectOptions == null ) { m_selectOptions = new ArrayList < CmsSelectWidgetOption > ( ) ; } m_selectOptions . add ( option ) ; |
public class URLResolver { /** * Parses a given specification using the algorithm depicted in < a
* href = " https : / / tools . ietf . org / html / rfc1808 # section - 2.4 " > RFC1808 - Section 2.4 < / a > :
* < blockquote >
* < h3 > Section 2.4 : Parsing a URL < / h3 >
* An accepted method for parsing URLs is useful to clarify the generic - RL syntax of Section 2.2
* and to describe the algorithm for resolving relative URLs presented in Section 4 . This
* section describes the parsing rules for breaking down a URL ( relative or absolute ) into the
* component parts described in Section 2.1 . The rules assume that the URL has already been
* separated from any surrounding text and copied to a " parse string " . The rules are listed in
* the order in which they would be applied by the parser .
* < / blockquote >
* @ param spec The specification to parse .
* @ return the parsed specification . */
private static Url parseUrl ( final String spec ) { } } | final Url url = new Url ( ) ; int startIndex = 0 ; int endIndex = spec . length ( ) ; // Section 2.4.1 : Parsing the Fragment Identifier
// If the parse string contains a crosshatch " # " character , then the
// substring after the first ( left - most ) crosshatch " # " and up to the
// end of the parse string is the < fragment > identifier . If the
// crosshatch is the last character , or no crosshatch is present , then
// the fragment identifier is empty . The matched substring , including
// the crosshatch character , is removed from the parse string before
// continuing .
// Note that the fragment identifier is not considered part of the URL .
// However , since it is often attached to the URL , parsers must be able
// to recognize and set aside fragment identifiers as part of the
// process .
final int crosshatchIndex = indexOf ( spec , '#' , startIndex , endIndex ) ; if ( crosshatchIndex >= 0 ) { url . fragment_ = spec . substring ( crosshatchIndex + 1 , endIndex ) ; endIndex = crosshatchIndex ; } // Section 2.4.2 : Parsing the Scheme
// If the parse string contains a colon " : " after the first character
// and before any characters not allowed as part of a scheme name ( i . e . ,
// any not an alphanumeric , plus " + " , period " . " , or hyphen " - " ) , the
// < scheme > of the URL is the substring of characters up to but not
// including the first colon . These characters and the colon are then
// removed from the parse string before continuing .
final int colonIndex = indexOf ( spec , ':' , startIndex , endIndex ) ; if ( colonIndex > 0 ) { final String scheme = spec . substring ( startIndex , colonIndex ) ; if ( isValidScheme ( scheme ) ) { url . scheme_ = scheme ; startIndex = colonIndex + 1 ; } } // Section 2.4.3 : Parsing the Network Location / Login
// If the parse string begins with a double - slash " / / " , then the
// substring of characters after the double - slash and up to , but not
// including , the next slash " / " character is the network location / login
// ( < net _ loc > ) of the URL . If no trailing slash " / " is present , the
// entire remaining parse string is assigned to < net _ loc > . The double -
// slash and < net _ loc > are removed from the parse string before
// continuing .
// Note : We also accept a question mark " ? " or a semicolon " ; " character as
// delimiters for the network location / login ( < net _ loc > ) of the URL .
final int locationStartIndex ; int locationEndIndex ; if ( spec . startsWith ( "//" , startIndex ) ) { locationStartIndex = startIndex + 2 ; locationEndIndex = indexOf ( spec , '/' , locationStartIndex , endIndex ) ; if ( locationEndIndex >= 0 ) { startIndex = locationEndIndex ; } } else { locationStartIndex = - 1 ; locationEndIndex = - 1 ; } // Section 2.4.4 : Parsing the Query Information
// If the parse string contains a question mark " ? " character , then the
// substring after the first ( left - most ) question mark " ? " and up to the
// end of the parse string is the < query > information . If the question
// mark is the last character , or no question mark is present , then the
// query information is empty . The matched substring , including the
// question mark character , is removed from the parse string before
// continuing .
final int questionMarkIndex = indexOf ( spec , '?' , startIndex , endIndex ) ; if ( questionMarkIndex >= 0 ) { if ( ( locationStartIndex >= 0 ) && ( locationEndIndex < 0 ) ) { // The substring of characters after the double - slash and up to , but not
// including , the question mark " ? " character is the network location / login
// ( < net _ loc > ) of the URL .
locationEndIndex = questionMarkIndex ; startIndex = questionMarkIndex ; } url . query_ = spec . substring ( questionMarkIndex + 1 , endIndex ) ; endIndex = questionMarkIndex ; } // Section 2.4.5 : Parsing the Parameters
// If the parse string contains a semicolon " ; " character , then the
// substring after the first ( left - most ) semicolon " ; " and up to the end
// of the parse string is the parameters ( < params > ) . If the semicolon
// is the last character , or no semicolon is present , then < params > is
// empty . The matched substring , including the semicolon character , is
// removed from the parse string before continuing .
final int semicolonIndex = indexOf ( spec , ';' , startIndex , endIndex ) ; if ( semicolonIndex >= 0 ) { if ( ( locationStartIndex >= 0 ) && ( locationEndIndex < 0 ) ) { // The substring of characters after the double - slash and up to , but not
// including , the semicolon " ; " character is the network location / login
// ( < net _ loc > ) of the URL .
locationEndIndex = semicolonIndex ; startIndex = semicolonIndex ; } url . parameters_ = spec . substring ( semicolonIndex + 1 , endIndex ) ; endIndex = semicolonIndex ; } // Section 2.4.6 : Parsing the Path
// After the above steps , all that is left of the parse string is the URL < path > and the
// slash " / " that may precede it . Even though the initial slash is not part of the URL path ,
// the parser must remember whether or not it was present so that later processes can
// differentiate between relative and absolute paths . Often this is done by simply storing
// the preceding slash along with the path .
if ( ( locationStartIndex >= 0 ) && ( locationEndIndex < 0 ) ) { // The entire remaining parse string is assigned to the network location / login
// ( < net _ loc > ) of the URL .
locationEndIndex = endIndex ; } else if ( startIndex < endIndex ) { url . path_ = spec . substring ( startIndex , endIndex ) ; } // Set the network location / login ( < net _ loc > ) of the URL .
if ( ( locationStartIndex >= 0 ) && ( locationEndIndex >= 0 ) ) { url . location_ = spec . substring ( locationStartIndex , locationEndIndex ) ; } return url ; |
public class LeafNode { /** * Publishes multiple events to the node . Same rules apply as in { @ link # send ( Item ) } .
* In addition , if { @ link ConfigureForm # isPersistItems ( ) } = false , only the last item in the input
* list will get stored on the node , assuming it stores the last sent item .
* @ param items - The collection of { @ link Item } objects being sent
* @ param < T > type of the items .
* @ throws XMPPErrorException
* @ throws NoResponseException
* @ throws NotConnectedException
* @ throws InterruptedException */
public < T extends Item > void publish ( Collection < T > items ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } } | PubSub packet = createPubsubPacket ( Type . set , new PublishItem < > ( getId ( ) , items ) ) ; pubSubManager . getConnection ( ) . createStanzaCollectorAndSend ( packet ) . nextResultOrThrow ( ) ; |
public class DemoFescarWebLauncher { /** * 用于页面显示数据 */
@ Ok ( "json:full" ) @ At ( "/api/info" ) public NutMap info ( ) { } } | NutMap re = new NutMap ( ) ; NutMap data = new NutMap ( ) ; data . put ( "account" , dao . fetch ( Account . class , Cnd . where ( "userId" , "=" , "U100001" ) ) ) ; data . put ( "storage" , dao . fetch ( Storage . class , Cnd . where ( "commodityCode" , "=" , "C00321" ) ) ) ; return re . setv ( "data" , data ) . setv ( "ok" , true ) ; |
public class ExceptionClassFilterImpl { /** * If not already created , a new < code > include < / code > element will be created and returned .
* Otherwise , the first existing < code > include < / code > element will be returned .
* @ return the instance defined for the element < code > include < / code > */
public Include < ExceptionClassFilter < T > > getOrCreateInclude ( ) { } } | List < Node > nodeList = childNode . get ( "include" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new IncludeImpl < ExceptionClassFilter < T > > ( this , "include" , childNode , nodeList . get ( 0 ) ) ; } return createInclude ( ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.