signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class DefaultGroovyMethods { /** * Support the subscript operator with a collection for a char array
* @ param array a char array
* @ param indices a collection of indices for the items to retrieve
* @ return list of the chars at the given indices
* @ since 1.0 */
@ SuppressWarnings ( "unchecked" ) publi... | return primitiveArrayGet ( array , indices ) ; |
public class IndexingDaoImpl { /** * Get the last transaction id from database
* @ return */
public Long getLastTransactionID ( ) { } } | if ( logger . isDebugEnabled ( ) ) { logger . debug ( "[getLastTransactionID]" ) ; } return ( Long ) template . selectOne ( SELECT_LAST_TRANSACTION_ID ) ; |
public class IcsProgressBar { /** * < p > Set the range of the progress bar to 0 . . . < tt > max < / tt > . < / p >
* @ param max the upper range of this progress bar
* @ see # getMax ( )
* @ see # setProgress ( int )
* @ see # setSecondaryProgress ( int ) */
public synchronized void setMax ( int max ) { } } | if ( max < 0 ) { max = 0 ; } if ( max != mMax ) { mMax = max ; postInvalidate ( ) ; if ( mProgress > max ) { mProgress = max ; } refreshProgress ( android . R . id . progress , mProgress , false ) ; } |
public class TreeMap { /** * Associates the specified value with the specified key in this map . If the map previously contained a mapping for
* this key , the old value is replaced .
* @ param key with which the specified value is to be associated .
* @ param value to be associated with the specified key .
* @... | return put ( key , value , transaction , false ) ; |
public class PicocliRunner { /** * Obtains an instance of the specified { @ code Runnable } command class from the specified context ,
* injecting any beans from the specified context as required ,
* then parses the specified command line arguments , populating fields and methods annotated
* with picocli { @ link... | CommandLine . run ( cls , new MicronautFactory ( ctx ) , args ) ; |
public class PolicyManager { /** * Obtains a policy or policy set of matching policies from the policy
* store . If more than one policy is returned it creates a dynamic policy
* set that contains all the applicable policies .
* @ param eval
* the Evaluation Context
* @ return the Policy / PolicySet that appl... | Map < String , AbstractPolicy > potentialPolicies = m_policyIndex . getPolicies ( eval , m_policyFinder ) ; logger . debug ( "Obtained policies: {}" , potentialPolicies . size ( ) ) ; AbstractPolicy policy = matchPolicies ( eval , potentialPolicies ) ; logger . debug ( "Matched policies and created abstract policy." ) ... |
public class VpnSitesConfigurationsInner { /** * Gives the sas - url to download the configurations for vpn - sites in a resource group .
* @ param resourceGroupName The resource group name .
* @ param virtualWANName The name of the VirtualWAN for which configuration of all vpn - sites is needed .
* @ param reque... | return ServiceFuture . fromResponse ( downloadWithServiceResponseAsync ( resourceGroupName , virtualWANName , request ) , serviceCallback ) ; |
public class XmlMultiConfiguration { /** * Return the set of variants defined for the given configuration .
* If the given identity does not exist then an { @ code IllegalArgumentException } is thrown . If the given identity is
* not variant - ed then an empty set is returned .
* @ return the set of variants ; po... | Config config = configurations . get ( identity ) ; if ( config == null ) { throw new IllegalArgumentException ( "Identity " + identity + " does not exist." ) ; } else { return config . variants ( ) ; } |
public class FluentCloseableIterable { /** * Returns an { @ link Optional } containing the last element in this fluent iterable .
* If the iterable is empty , { @ code Optional . absent ( ) } is returned . */
public final Optional < T > last ( ) { } } | // Iterables # getLast was inlined here so we don ' t have to throw / catch a NSEE
Iterator < T > iterator = this . iterator ( ) ; if ( ! iterator . hasNext ( ) ) { return empty ( ) ; } while ( true ) { T current = iterator . next ( ) ; if ( ! iterator . hasNext ( ) ) { return Optional . of ( current ) ; } } |
public class AddOnLoaderUtils { /** * Gets the passive scan rules of the given { @ code addOn } . The passive scan rules are first loaded , if they weren ' t already .
* @ param addOn the add - on whose passive scan rules will be returned
* @ param addOnClassLoader the { @ code AddOnClassLoader } of the given { @ c... | validateNotNull ( addOn , "addOn" ) ; validateNotNull ( addOnClassLoader , "addOnClassLoader" ) ; synchronized ( addOn ) { if ( addOn . isLoadedPscanrulesSet ( ) ) { return addOn . getLoadedPscanrules ( ) ; } List < PluginPassiveScanner > pscanrules = loadDeclaredClasses ( addOnClassLoader , addOn . getPscanrules ( ) ,... |
public class Container { /** * Internal use of the listener API .
* @ param event of class CacheEntryModifiedEvent */
@ SuppressWarnings ( { } } | "rawtypes" , "unchecked" } ) @ CacheEntryModified @ CacheEntryCreated @ Deprecated public void onCacheModification ( CacheEntryEvent event ) { if ( ! event . getKey ( ) . equals ( key ) ) return ; if ( event . isPre ( ) ) return ; try { GenericJBossMarshaller marshaller = new GenericJBossMarshaller ( ) ; byte [ ] bb = ... |
public class LocaleIDParser { /** * Returns the language , script , country , and variant as separate strings . */
public String [ ] getLanguageScriptCountryVariant ( ) { } } | reset ( ) ; return new String [ ] { getString ( parseLanguage ( ) ) , getString ( parseScript ( ) ) , getString ( parseCountry ( ) ) , getString ( parseVariant ( ) ) } ; |
public class LabeledParsedStringDocument { /** * { @ inheritDoc } */
public String text ( ) { } } | StringBuilder sb = new StringBuilder ( nodes . length * 8 ) ; for ( int i = 0 ; i < nodes . length ; ++ i ) { String token = nodes [ i ] . word ( ) ; sb . append ( token ) ; if ( i + 1 < nodes . length ) sb . append ( ' ' ) ; } return sb . toString ( ) ; |
public class IntegrationAdapter { /** * Invoked when a Message is received from a Flex client . */
@ SuppressWarnings ( { } } | "unchecked" , "rawtypes" } ) @ Override public Object invoke ( flex . messaging . messages . Message flexMessage ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "received Flex Message: " + flexMessage ) ; } Message < ? > message = null ; if ( this . extractPayload ) { Map headers = flexMessage . getHeaders ( ... |
public class MsgCompiler { /** * Handles a translation consisting of a single raw text node . */
private Statement handleBasicTranslation ( List < SoyPrintDirective > escapingDirectives , Expression soyMsgParts ) { } } | // optimize for simple constant translations ( very common )
// this becomes : renderContext . getSoyMessge ( < id > ) . getParts ( ) . get ( 0 ) . getRawText ( )
SoyExpression text = SoyExpression . forString ( soyMsgParts . invoke ( MethodRef . LIST_GET , constant ( 0 ) ) . checkedCast ( SoyMsgRawTextPart . class ) .... |
public class SelfExtractor { /** * Display command line usage . */
protected static void displayCommandLineHelp ( SelfExtractor extractor ) { } } | // This method takes a SelfExtractor in case we want to tailor the help to the current archive
// Get the name of the JAR file to display in the command syntax " ) ;
String jarName = System . getProperty ( "sun.java.command" , "wlp-liberty-developers-core.jar" ) ; String [ ] s = jarName . split ( " " ) ; jarName = s [ ... |
public class ArrayCoreMap { /** * { @ inheritDoc } */
@ SuppressWarnings ( "unchecked" ) public < VALUE , KEY extends Key < CoreMap , VALUE > > VALUE remove ( Class < KEY > key ) { } } | Object rv = null ; for ( int i = 0 ; i < size ; i ++ ) { if ( keys [ i ] == key ) { rv = values [ i ] ; if ( i < size - 1 ) { System . arraycopy ( keys , i + 1 , keys , i , size - ( i + 1 ) ) ; System . arraycopy ( values , i + 1 , values , i , size - ( i + 1 ) ) ; } size -- ; break ; } } return ( VALUE ) rv ; |
public class Matrix3f { /** * Set this matrix to a rotation transformation about the X axis .
* When used with a right - handed coordinate system , the produced rotation will rotate a vector
* counter - clockwise around the rotation axis , when viewing along the negative axis direction towards the origin .
* When... | float sin , cos ; sin = ( float ) Math . sin ( ang ) ; cos = ( float ) Math . cosFromSin ( sin , ang ) ; m00 = 1.0f ; m01 = 0.0f ; m02 = 0.0f ; m10 = 0.0f ; m11 = cos ; m12 = sin ; m20 = 0.0f ; m21 = - sin ; m22 = cos ; return this ; |
public class Validate { /** * Checks if the given String is a positive integer value . < br >
* This method tries to parse an integer value and then checks if it is bigger than 0.
* @ param value The String value to validate .
* @ return The parsed integer value
* @ throws ParameterException if the given String... | Integer intValue = Validate . isInteger ( value ) ; positive ( intValue ) ; return intValue ; |
public class BatchGetImageResult { /** * A list of image objects corresponding to the image references in the request .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setImages ( java . util . Collection ) } or { @ link # withImages ( java . util . Collectio... | if ( this . images == null ) { setImages ( new java . util . ArrayList < Image > ( images . length ) ) ; } for ( Image ele : images ) { this . images . add ( ele ) ; } return this ; |
public class JSONObject { /** * Maps { @ code name } to { @ code value } , clobbering any existing name / value
* mapping with the same name .
* @ return this object . */
public JSONObject put ( String name , long value ) throws JSONException { } } | nameValuePairs . put ( checkName ( name ) , value ) ; return this ; |
public class GermanTagger { /** * Removes the irrelevant part of dash - linked words ( SSL - Zertifikat - > Zertifikat ) */
private String sanitizeWord ( String word ) { } } | String result = word ; // Find the last part of the word that is not nothing
// Skip words ending in a dash as they ' ll be misrecognized
if ( ! word . endsWith ( "-" ) ) { String [ ] splitWord = word . split ( "-" ) ; String lastPart = splitWord . length > 1 && ! splitWord [ splitWord . length - 1 ] . trim ( ) . equal... |
public class Long { /** * Returns the number of one - bits in the two ' s complement binary
* representation of the specified { @ code long } value . This function is
* sometimes referred to as the < i > population count < / i > .
* @ param i the value whose bits are to be counted
* @ return the number of one -... | // HD , Figure 5-14
i = i - ( ( i >>> 1 ) & 0x5555555555555555L ) ; i = ( i & 0x3333333333333333L ) + ( ( i >>> 2 ) & 0x3333333333333333L ) ; i = ( i + ( i >>> 4 ) ) & 0x0f0f0f0f0f0f0f0fL ; i = i + ( i >>> 8 ) ; i = i + ( i >>> 16 ) ; i = i + ( i >>> 32 ) ; return ( int ) i & 0x7f ; |
public class DataFrames { /** * Standard deviation for a column
* @ param dataFrame the dataframe to
* get the column from
* @ param columnName the name of the column to get the standard
* deviation for
* @ return the column that represents the standard deviation */
public static Column std ( DataRowsFacade d... | return functions . sqrt ( var ( dataFrame , columnName ) ) ; |
public class QuartzScheduler { /** * Unschedule a job .
* @ param jobName
* @ param groupName
* @ return true if job is found and unscheduled .
* @ throws SchedulerException */
public synchronized boolean unscheduleJob ( final String jobName , final String groupName ) throws SchedulerException { } } | return this . scheduler . deleteJob ( new JobKey ( jobName , groupName ) ) ; |
public class TypeCheck { /** * Visits the parameters of a CALL or a NEW node . */
private void visitArgumentList ( Node call , FunctionType functionType ) { } } | Iterator < Node > parameters = functionType . getParameters ( ) . iterator ( ) ; Iterator < Node > arguments = NodeUtil . getInvocationArgsAsIterable ( call ) . iterator ( ) ; checkArgumentsMatchParameters ( call , functionType , arguments , parameters , 0 ) ; |
public class Suppliers { /** * Returns a supplier which caches the instance retrieved during the first call to { @ code get ( ) }
* and returns that value on subsequent calls to { @ code get ( ) } . See :
* < a href = " http : / / en . wikipedia . org / wiki / Memoization " > memoization < / a >
* < p > The retur... | return ( delegate instanceof MemoizingSupplier ) ? delegate : new MemoizingSupplier < T > ( Preconditions . checkNotNull ( delegate ) ) ; |
public class HtmlRenderer { /** * ( non - Javadoc )
* @ see net . roboconf . doc . generator . internal . AbstractStructuredRenderer
* # renderSections ( java . util . List ) */
@ Override protected String renderSections ( List < String > sectionNames ) { } } | StringBuilder sb = new StringBuilder ( ) ; if ( this . options . containsKey ( DocConstants . OPTION_HTML_EXPLODED ) ) { if ( sectionNames . size ( ) > 0 ) { sb . append ( "<ul>\n" ) ; for ( String sectionName : sectionNames ) { int index = sectionName . lastIndexOf ( '/' ) ; String title = sectionName . substring ( in... |
public class VTimeZone { /** * Writes RFC2445 VTIMEZONE data for this time zone
* @ param writer A < code > Writer < / code > used for the output
* @ throws IOException If there were problems creating a buffered writer or writing to it . */
public void write ( Writer writer ) throws IOException { } } | BufferedWriter bw = new BufferedWriter ( writer ) ; if ( vtzlines != null ) { for ( String line : vtzlines ) { if ( line . startsWith ( ICAL_TZURL + COLON ) ) { if ( tzurl != null ) { bw . write ( ICAL_TZURL ) ; bw . write ( COLON ) ; bw . write ( tzurl ) ; bw . write ( NEWLINE ) ; } } else if ( line . startsWith ( ICA... |
public class GanttBarStyleFactory14 { /** * Maps an integer field ID to a field type .
* @ param field field ID
* @ return field type */
private TaskField getTaskField ( int field ) { } } | TaskField result = MPPTaskField14 . getInstance ( field ) ; if ( result != null ) { switch ( result ) { case START_TEXT : { result = TaskField . START ; break ; } case FINISH_TEXT : { result = TaskField . FINISH ; break ; } case DURATION_TEXT : { result = TaskField . DURATION ; break ; } default : { break ; } } } retur... |
public class ReflectionUtils { /** * Returns the getter method associated with the object ' s field .
* @ param object
* the object
* @ param fieldName
* the name of the field
* @ return the getter method
* @ throws NullPointerException
* if object or fieldName is null
* @ throws SuperCsvReflectionExcep... | if ( object == null ) { throw new NullPointerException ( "object should not be null" ) ; } else if ( fieldName == null ) { throw new NullPointerException ( "fieldName should not be null" ) ; } final Class < ? > clazz = object . getClass ( ) ; // find a standard getter
final String standardGetterName = getMethodNameForF... |
public class CreateIdentityPoolRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateIdentityPoolRequest createIdentityPoolRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createIdentityPoolRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createIdentityPoolRequest . getIdentityPoolName ( ) , IDENTITYPOOLNAME_BINDING ) ; protocolMarshaller . marshall ( createIdentityPoolRequest . getAllowUnauthen... |
public class Related { /** * An overloaded version of { @ link # with ( org . hawkular . inventory . paths . CanonicalPath , String ) } that uses one of
* the { @ link org . hawkular . inventory . api . Relationships . WellKnown } as the name of the relationship .
* @ param entityPath the entity that is the target ... | return new Related ( entityPath , relationship . name ( ) , EntityRole . SOURCE ) ; |
public class IntBitSet { /** * Add an element .
* @ param ele the element to add */
public void add ( int ele ) { } } | int idx ; idx = ele >> SHIFT ; if ( idx >= data . length ) { resize ( idx + 1 + GROW ) ; } data [ ele >> SHIFT ] |= ( 1 << ele ) ; |
public class Step { /** * Checks a checkbox type element .
* @ param element
* Target page element
* @ param checked
* Final checkbox value
* @ param args
* list of arguments to format the found selector with
* @ throws TechnicalException
* is thrown if you have a technical error ( format , configuratio... | try { final WebElement webElement = Context . waitUntil ( ExpectedConditions . elementToBeClickable ( Utilities . getLocator ( element , args ) ) ) ; if ( webElement . isSelected ( ) != checked ) { webElement . click ( ) ; } } catch ( final Exception e ) { new Result . Failure < > ( e . getMessage ( ) , Messages . form... |
public class SystemInputJson { /** * Returns the AssertNotMore condition represented by the given JSON object or an empty
* value if no such condition is found . */
private static Optional < ICondition > asNotMoreThan ( JsonObject json ) { } } | return Optional . of ( json ) . filter ( j -> j . containsKey ( NOT_MORE_THAN_KEY ) ) . map ( j -> j . getJsonObject ( NOT_MORE_THAN_KEY ) ) . map ( a -> new AssertNotMore ( a . getString ( PROPERTY_KEY ) , a . getInt ( MAX_KEY ) ) ) ; |
public class JPAAuditLogService { /** * / * ( non - Javadoc )
* @ see org . jbpm . process . audit . AuditLogService # findVariableInstances ( long ) */
@ Override public List < VariableInstanceLog > findVariableInstances ( long processInstanceId ) { } } | EntityManager em = getEntityManager ( ) ; Query query = em . createQuery ( "FROM VariableInstanceLog v WHERE v.processInstanceId = :processInstanceId ORDER BY date" ) . setParameter ( "processInstanceId" , processInstanceId ) ; return executeQuery ( query , em , VariableInstanceLog . class ) ; |
public class EmbeddedPostgresRules { /** * Returns a { @ link TestRule } to create a Postgres cluster , shared amongst all test cases in this JVM .
* The rule contributes { @ link Config } switches to configure each test case to get its own database . */
public static EmbeddedPostgresTestDatabaseRule embeddedDatabase... | return new EmbeddedPostgresTestDatabaseRule ( baseUri , personalities ) ; |
public class Isotopes { /** * Clear the isotope information from atoms that are major isotopes ( e . g .
* < sup > 12 < / sup > C , < sup > 1 < / sup > H , etc ) .
* @ param mol the molecule */
public static void clearMajorIsotopes ( IAtomContainer mol ) { } } | for ( IAtom atom : mol . atoms ( ) ) if ( isMajor ( atom ) ) { atom . setMassNumber ( null ) ; atom . setExactMass ( null ) ; atom . setNaturalAbundance ( null ) ; } |
public class ListEntitlementsResult { /** * A list of entitlements that have been granted to you from other AWS accounts .
* @ param entitlements
* A list of entitlements that have been granted to you from other AWS accounts . */
public void setEntitlements ( java . util . Collection < ListedEntitlement > entitleme... | if ( entitlements == null ) { this . entitlements = null ; return ; } this . entitlements = new java . util . ArrayList < ListedEntitlement > ( entitlements ) ; |
public class ContentMatcher { /** * Implementation of put method ( handles vacantChild ; overriding methods handle
* everything else ) . */
void put ( Conjunction selector , MatchTarget object , InternTable subExpr ) throws MatchingException { } } | vacantChild = nextMatcher ( selector , vacantChild ) ; vacantChild . put ( selector , object , subExpr ) ; |
public class XmlUtil { /** * Create a new DocumentBuilder configured for namespaces but not validating .
* @ return a new , configured DocumentBuilder */
public static DocumentBuilder newDocumentBuilder ( ) { } } | try { return PARSER_FACTORY . newDocumentBuilder ( ) ; } catch ( ParserConfigurationException e ) { throw ( Error ) new AssertionError ( ) . initCause ( e ) ; } |
public class WebSiteManagementClientImpl { /** * List all premier add - on offers .
* List all premier add - on offers .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observabl... | return listPremierAddOnOffersNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < PremierAddOnOfferInner > > , Page < PremierAddOnOfferInner > > ( ) { @ Override public Page < PremierAddOnOfferInner > call ( ServiceResponse < Page < PremierAddOnOfferInner > > response ) { return re... |
public class KernelBootstrap { /** * Get the runtime build version based on the information in the manifest of the
* kernel jar : this is not authoritative , as it won ' t include information about
* applied iFixes , etc . */
public static void showVersion ( BootstrapConfig bootProps ) { } } | BootstrapManifest bootManifest ; try { bootManifest = BootstrapManifest . readBootstrapManifest ( Boolean . parseBoolean ( bootProps . get ( BootstrapConstants . LIBERTY_BOOT_PROPERTY ) ) ) ; String kernelVersion = bootManifest . getBundleVersion ( ) ; String productInfo = getProductInfoDisplayName ( ) ; processVersion... |
public class ClassInfoList { /** * Find the intersection of this { @ link ClassInfoList } with one or more others .
* @ param others
* The other { @ link ClassInfoList } s to intersect with this one .
* @ return The intersection of this { @ link ClassInfoList } with the others . */
public ClassInfoList intersect ... | // Put the first ClassInfoList that is not being sorted by name at the head of the list ,
// so that its order is preserved in the intersection ( # 238)
final ArrayDeque < ClassInfoList > intersectionOrder = new ArrayDeque < > ( ) ; intersectionOrder . add ( this ) ; boolean foundFirst = false ; for ( final ClassInfoLi... |
public class JaxRsClientFactory { /** * Create a new { @ link Client } instance with the given name and groups .
* You own the returned client and are responsible for managing its cleanup . */
public Client newClient ( String clientName , JaxRsFeatureGroup feature , JaxRsFeatureGroup ... moreFeatures ) { } } | return newBuilder ( clientName , feature , moreFeatures ) . build ( ) ; |
public class GenerateHalDocsJsonMojo { /** * Get short description anlogous to javadoc method tile : Strip out all HTML tags and use only
* the first sentence from the description .
* @ param descriptionMarkup Description markup .
* @ return Title or null if none defined */
private static String buildShortDescrip... | if ( StringUtils . isBlank ( descriptionMarkup ) ) { return null ; } String text = Jsoup . parse ( descriptionMarkup ) . text ( ) ; if ( StringUtils . isBlank ( text ) ) { return null ; } if ( StringUtils . contains ( text , "." ) ) { return StringUtils . substringBefore ( text , "." ) + "." ; } else { return StringUti... |
public class JsonDeserializer { /** * TODO faster and less new ( ) */
public Number deserializeNumber ( String s ) { } } | if ( s . indexOf ( '.' ) >= 0 || s . indexOf ( 'e' ) >= 0 || s . indexOf ( 'E' ) >= 0 ) { return Double . valueOf ( s ) ; } else { Long l = Long . valueOf ( s ) ; if ( l > Integer . MAX_VALUE || l < Integer . MIN_VALUE ) { return l ; } else { return new Integer ( l . intValue ( ) ) ; } } |
public class CommerceAccountOrganizationRelPersistenceImpl { /** * Removes the commerce account organization rel with the primary key from the database . Also notifies the appropriate model listeners .
* @ param primaryKey the primary key of the commerce account organization rel
* @ return the commerce account orga... | Session session = null ; try { session = openSession ( ) ; CommerceAccountOrganizationRel commerceAccountOrganizationRel = ( CommerceAccountOrganizationRel ) session . get ( CommerceAccountOrganizationRelImpl . class , primaryKey ) ; if ( commerceAccountOrganizationRel == null ) { if ( _log . isDebugEnabled ( ) ) { _lo... |
public class StrategicExecutors { /** * Return a capped { @ link BalancingThreadPoolExecutor } with the given
* maximum number of threads , target utilization , smoothing weight , and
* balance after values .
* @ param maxThreads maximum number of threads to use
* @ param targetUtilization a float between 0.0 a... | ThreadPoolExecutor tpe = new ThreadPoolExecutor ( 1 , maxThreads , 60L , TimeUnit . SECONDS , new SynchronousQueue < Runnable > ( ) , new CallerBlocksPolicy ( ) ) ; return newBalancingThreadPoolExecutor ( tpe , targetUtilization , smoothingWeight , balanceAfter ) ; |
public class ResultUtils { /** * Convert result object to array .
* @ param result result object
* @ param entityType target entity type
* @ param projection true to apply projection , false otherwise
* @ return converted result */
@ SuppressWarnings ( "PMD.LooseCoupling" ) public static Object convertToArray (... | final Collection res = result instanceof Collection // no projection because its applied later
? ( Collection ) result : convertToCollectionImpl ( result , ArrayList . class , entityType , false ) ; final Object array = Array . newInstance ( entityType , res . size ( ) ) ; int i = 0 ; for ( Object obj : res ) { Array .... |
public class OpenAnalysisJobActionListener { /** * Opens a job file
* @ param file
* @ return */
public Injector openAnalysisJob ( final FileObject file ) { } } | final JaxbJobReader reader = new JaxbJobReader ( _configuration ) ; try { final AnalysisJobBuilder ajb = reader . create ( file ) ; return openAnalysisJob ( file , ajb ) ; } catch ( final NoSuchComponentException e ) { final String message ; if ( Version . EDITION_COMMUNITY . equals ( Version . getEdition ( ) ) ) { mes... |
public class TabbedPane { /** * { @ inheritDoc } */
@ Override public void insertTab ( String title , Icon icon , Component component , String tip , int index ) { } } | super . insertTab ( title , icon , component , tip , index ) ; setTabComponentAt ( index , new MButtonTabComponent ( this ) ) ; |
public class DefaultConvertableBindingBuilder { /** * { @ inheritDoc } */
public < U > TargetValidatableBindingBuilder < S , U , V > using ( Converter < S , U > converter ) { } } | return new DefaultTargetValidatableBindingBuilder < S , U , V > ( getSource ( ) , getSourceValidator ( ) , converter , getCallback ( ) ) ; |
public class InventoryConfiguration { /** * Add a field to the list of optional fields that are included in the inventory results . */
public void addOptionalField ( InventoryOptionalField optionalField ) { } } | addOptionalField ( optionalField == null ? ( String ) null : optionalField . toString ( ) ) ; |
public class TwitterEndpointServices { /** * Computes the signature for an authorized request per { @ link https : / / dev . twitter . com / oauth / overview / creating - signatures }
* @ param requestMethod
* @ param targetUrl
* @ param params
* @ param consumerSecret
* @ param tokenSecret
* @ return */
pu... | String signatureBaseString = createSignatureBaseString ( requestMethod , targetUrl , params ) ; // Hash the base string using the consumer secret ( and request token secret , if known ) as a key
String signature = "" ; try { String secretToEncode = null ; if ( consumerSecret != null ) { secretToEncode = consumerSecret ... |
public class ServicesInner { /** * Start service .
* The services resource is the top - level resource that represents the Data Migration Service . This action starts the service and the service can be used for data migration .
* @ param groupName Name of the resource group
* @ param serviceName Name of the servi... | return ServiceFuture . fromResponse ( startWithServiceResponseAsync ( groupName , serviceName ) , serviceCallback ) ; |
public class ProfileWriterImpl { /** * { @ inheritDoc } */
public Content getProfileHeader ( String heading ) { } } | String profileName = profile . name ; Content bodyTree = getBody ( true , getWindowTitle ( profileName ) ) ; addTop ( bodyTree ) ; addNavLinks ( true , bodyTree ) ; HtmlTree div = new HtmlTree ( HtmlTag . DIV ) ; div . addStyle ( HtmlStyle . header ) ; Content tHeading = HtmlTree . HEADING ( HtmlConstants . TITLE_HEADI... |
public class StoreFactoryImpl { /** * Creates the default factory implementation .
* < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public static StoreFactory init ( ) { } } | try { StoreFactory theStoreFactory = ( StoreFactory ) EPackage . Registry . INSTANCE . getEFactory ( StorePackage . eNS_URI ) ; if ( theStoreFactory != null ) { return theStoreFactory ; } } catch ( Exception exception ) { EcorePlugin . INSTANCE . log ( exception ) ; } return new StoreFactoryImpl ( ) ; |
public class HttpUtil { /** * configure custom proxy properties from connectionPropertiesMap */
public static void configureCustomProxyProperties ( Map < SFSessionProperty , Object > connectionPropertiesMap ) { } } | if ( connectionPropertiesMap . containsKey ( SFSessionProperty . USE_PROXY ) ) { useProxy = ( boolean ) connectionPropertiesMap . get ( SFSessionProperty . USE_PROXY ) ; } if ( useProxy ) { proxyHost = ( String ) connectionPropertiesMap . get ( SFSessionProperty . PROXY_HOST ) ; proxyPort = Integer . parseInt ( connect... |
public class RegistriesInner { /** * Creates a container registry with the specified parameters .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ param registry The parameters for creating a contai... | return beginCreateWithServiceResponseAsync ( resourceGroupName , registryName , registry ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class CloseHelper { /** * Close a { @ link java . lang . AutoCloseable } dealing with nulls and exceptions .
* This version re - throws exceptions as runtime exceptions .
* @ param closeable to be closed . */
public static void close ( final AutoCloseable closeable ) { } } | try { if ( null != closeable ) { closeable . close ( ) ; } } catch ( final Exception e ) { LangUtil . rethrowUnchecked ( e ) ; } |
public class PrimaveraDatabaseReader { /** * Populate data for analytics . */
private void processAnalytics ( ) throws SQLException { } } | allocateConnection ( ) ; try { DatabaseMetaData meta = m_connection . getMetaData ( ) ; String productName = meta . getDatabaseProductName ( ) ; if ( productName == null || productName . isEmpty ( ) ) { productName = "DATABASE" ; } else { productName = productName . toUpperCase ( ) ; } ProjectProperties properties = m_... |
public class BinaryEllipseDetector { /** * Detects ellipses inside the binary image and refines the edges for all detections inside the gray image
* @ param gray Grayscale image
* @ param binary Binary image of grayscale . 1 = ellipse and 0 = ignored background */
public void process ( T gray , GrayU8 binary ) { } ... | results . reset ( ) ; ellipseDetector . process ( binary ) ; if ( ellipseRefiner != null ) ellipseRefiner . setImage ( gray ) ; intensityCheck . setImage ( gray ) ; List < BinaryEllipseDetectorPixel . Found > found = ellipseDetector . getFound ( ) ; for ( BinaryEllipseDetectorPixel . Found f : found ) { if ( ! intensit... |
public class JobRunner { /** * Add useful JVM arguments so it is easier to map a running Java process to a flow , execution id
* and job */
private void insertJVMAargs ( ) { } } | final String flowName = this . node . getParentFlow ( ) . getFlowId ( ) ; final String jobId = this . node . getId ( ) ; String jobJVMArgs = String . format ( "'-Dazkaban.flowid=%s' '-Dazkaban.execid=%s' '-Dazkaban.jobid=%s'" , flowName , this . executionId , jobId ) ; final String previousJVMArgs = this . props . get ... |
public class Element { /** * ( non - Javadoc )
* @ see
* qc . automation . framework . widget . IElement # waitForNotAttribute ( java . lang
* . String , java . lang . String , java . lang . Long ) */
@ Override public void waitForNotAttribute ( String attributeName , String pattern , long timeout ) throws Widget... | waitForAttributePatternMatcher ( attributeName , pattern , timeout , false ) ; |
public class RythmEngine { /** * Restart the engine with an exception as the cause .
* < p > < b > Note < / b > , this is not supposed to be called by user application < / p >
* @ param cause */
public void restart ( RuntimeException cause ) { } } | if ( isProdMode ( ) ) throw cause ; if ( ! ( cause instanceof ClassReloadException ) ) { String msg = cause . getMessage ( ) ; if ( cause instanceof RythmException ) { RythmException re = ( RythmException ) cause ; msg = re . getSimpleMessage ( ) ; } logger . warn ( "restarting rythm engine due to %s" , msg ) ; } resta... |
public class JQLChecker { /** * Retrieve set of projected field .
* @ param jqlContext
* the jql context
* @ param jqlValue
* the jql value
* @ param entity
* the entity
* @ return the sets the */
public Set < JQLProjection > extractProjections ( final JQLContext jqlContext , String jqlValue , final Finde... | final Set < JQLProjection > result = new LinkedHashSet < JQLProjection > ( ) ; final One < Boolean > projection = new One < Boolean > ( null ) ; analyzeInternal ( jqlContext , jqlValue , new JqlBaseListener ( ) { @ Override public void enterProjected_columns ( Projected_columnsContext ctx ) { if ( projection . value0 =... |
public class UtilValidate { /** * Checks to see if the cc number is a valid Master Card number
* @ param cc a string representing a credit card number ; Sample number : 5500 0000 0000 0004(16 digits )
* @ return true , if the credit card number is a valid MasterCard number , false otherwise */
public static boolean... | int firstdig = Integer . parseInt ( cc . substring ( 0 , 1 ) ) ; int seconddig = Integer . parseInt ( cc . substring ( 1 , 2 ) ) ; if ( ( cc . length ( ) == 16 ) && ( firstdig == 5 ) && ( ( seconddig >= 1 ) && ( seconddig <= 5 ) ) ) return isCreditCard ( cc ) ; return false ; |
public class Sanitizers { /** * Checks that the input is a valid HTML attribute name with normal keyword or textual content or
* known safe attribute content . */
public static String filterHtmlAttributes ( SoyValue value ) { } } | value = normalizeNull ( value ) ; if ( isSanitizedContentOfKind ( value , SanitizedContent . ContentKind . ATTRIBUTES ) ) { // We ' re guaranteed to be in a case where key = value pairs are expected . However , if it would
// cause issues to directly abut this with more attributes , add a space . For example :
// { $ a... |
public class BoltSendableResponseCallback { /** * 初始化数据 */
protected void init ( ) { } } | // 从ThreadLocal取出当前长连接 , request等信息设置进去 , 需要接到请求时提前设置到ThreadLocal里
RpcInternalContext context = RpcInternalContext . getContext ( ) ; asyncContext = ( AsyncContext ) context . getAttachment ( RpcConstants . HIDDEN_KEY_ASYNC_CONTEXT ) ; request = ( SofaRequest ) context . getAttachment ( RpcConstants . HIDDEN_KEY_ASYNC_... |
public class ClassRenamer { /** * Rename a type - changing it to specified new name ( which should be the dotted form of the name ) . Retargets are an
* optional sequence of retargets to also perform during the rename . Retargets take the form of " a . b : a . c " which will
* change all references to a . b to a . ... | ClassReader fileReader = new ClassReader ( classbytes ) ; RenameAdapter renameAdapter = new RenameAdapter ( dottedNewName , retargets ) ; fileReader . accept ( renameAdapter , 0 ) ; byte [ ] renamed = renameAdapter . getBytes ( ) ; return renamed ; |
public class JwkSetConverter { /** * Creates a { @ link RsaJwkDefinition } based on the supplied attributes .
* @ param attributes the attributes used to create the { @ link RsaJwkDefinition }
* @ return a { @ link JwkDefinition } representation of a RSA Key
* @ throws JwkException if at least one attribute value... | // kid
String keyId = attributes . get ( KEY_ID ) ; if ( ! StringUtils . hasText ( keyId ) ) { throw new JwkException ( KEY_ID + " is a required attribute for a JWK." ) ; } // use
JwkDefinition . PublicKeyUse publicKeyUse = JwkDefinition . PublicKeyUse . fromValue ( attributes . get ( PUBLIC_KEY_USE ) ) ; if ( ! JwkDef... |
public class Symtab { /** * Enter a class into symbol table .
* @ param s The name of the class . */
private Type enterClass ( String s ) { } } | return reader . enterClass ( names . fromString ( s ) ) . type ; |
public class VerbalExpression { /** * Extract exact group from string
* @ param toTest - string to extract from
* @ param group - group to extract
* @ return extracted group
* @ since 1.1 */
public String getText ( final String toTest , final int group ) { } } | Matcher m = pattern . matcher ( toTest ) ; StringBuilder result = new StringBuilder ( ) ; while ( m . find ( ) ) { result . append ( m . group ( group ) ) ; } return result . toString ( ) ; |
public class ConfluenceGreenPepper { /** * < p > getPlatformTransactionManager . < / p >
* @ return a { @ link org . springframework . transaction . PlatformTransactionManager } object . */
public PlatformTransactionManager getPlatformTransactionManager ( ) { } } | if ( transactionManager != null ) { return transactionManager ; } transactionManager = ( PlatformTransactionManager ) ContainerManager . getComponent ( "transactionManager" ) ; return transactionManager ; |
public class TraceFactory { /** * Create a platform specific TraceFactory instance .
* @ param nls instance which holds the message catalogue to be used for info tracing .
* @ return TraceFactory instance loaded . */
public static TraceFactory getTraceFactory ( NLS nls ) { } } | return ( TraceFactory ) Utils . getImpl ( "com.ibm.ws.objectManager.utils.TraceFactoryImpl" , new Class [ ] { NLS . class } , new Object [ ] { nls } ) ; |
public class FirestoreAdminClient { /** * Lists the field configuration and metadata for this database .
* < p > Currently , [ FirestoreAdmin . ListFields ] [ google . firestore . admin . v1 . FirestoreAdmin . ListFields ]
* only supports listing fields that have been explicitly overridden . To issue this query , c... | ListFieldsRequest request = ListFieldsRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . build ( ) ; return listFields ( request ) ; |
public class WSController { /** * Return locale of client
* @ param request
* @ return */
Locale getLocale ( HandshakeRequest request ) { } } | if ( null != request ) { Map < String , List < String > > headers = request . getHeaders ( ) ; if ( null != headers ) { List < String > accepts = headers . get ( HttpHeaders . ACCEPT_LANGUAGE ) ; logger . debug ( "Get accept-language from client headers : {}" , accepts ) ; if ( null != accepts ) { for ( String accept :... |
public class MSExcelOOXMLSignUtil { /** * Cleans up tempfolder
* @ throws IOException */
public void close ( ) throws IOException { } } | try { if ( this . tempSignFileOS != null ) { this . tempSignFileOS . close ( ) ; } } finally { if ( ! this . tempSignFile . delete ( ) ) { LOG . warn ( "Could not delete temporary files used for signing" ) ; } } |
public class WeekdaySet { /** * This method encodes the given { @ code set } to a bit - mask for { @ link # getValue ( ) } .
* @ param weekdays are the { @ link Weekday } s .
* @ return the encoded { @ link # getValue ( ) value } . */
private static int encode ( Weekday ... weekdays ) { } } | int bitmask = 0 ; for ( Weekday weekday : weekdays ) { bitmask = bitmask | ( 1 << weekday . ordinal ( ) ) ; } return bitmask ; |
public class StringPrefixIterator { /** * / * ( non - Javadoc )
* @ see java . util . Iterator # hasNext ( ) */
public boolean hasNext ( ) { } } | if ( done ) return false ; if ( cachedNext != null ) { return true ; } while ( inner . hasNext ( ) ) { String tmp = inner . next ( ) ; if ( tmp . startsWith ( prefix ) ) { cachedNext = tmp ; return true ; } else if ( tmp . compareTo ( prefix ) > 0 ) { done = true ; return false ; } } return false ; |
public class SequenceDisplay { /** * calculate the float that is used for display .
* 1 * scale = size of 1 amino acid ( in pixel ) .
* maximum @ see MAX _ SCALE
* @ param zoomFactor
* @ return a float that is the display " scale " - an internal value required for paintin .
* user should only interact with th... | if ( zoomFactor > 100 ) zoomFactor = 100 ; if ( zoomFactor < 1 ) zoomFactor = 1 ; int DEFAULT_X_START = SequenceScalePanel . DEFAULT_X_START ; int DEFAULT_X_RIGHT_BORDER = SequenceScalePanel . DEFAULT_X_RIGHT_BORDER ; int seqLength = getMaxSequenceLength ( ) ; // the maximum width depends on the size of the parent Comp... |
public class QueryParser { /** * pseudo selector : has ( el ) */
private void has ( ) { } } | tq . consume ( ":has" ) ; String subQuery = tq . chompBalanced ( '(' , ')' ) ; Validate . notEmpty ( subQuery , ":has(el) subselect must not be empty" ) ; evals . add ( new StructuralEvaluator . Has ( parse ( subQuery ) ) ) ; |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getGSAP ( ) { } } | if ( gsapEClass == null ) { gsapEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 464 ) ; } return gsapEClass ; |
public class ORBConfigAdapter { /** * Create an ORB instance using the configured argument
* and property bundles .
* @ param args The String arguments passed to ORB . init ( ) .
* @ param props The property bundle passed to ORB . init ( ) .
* @ return An ORB constructed from the provided args and properties . ... | return ORB . init ( args , props ) ; |
public class ElemNumber { /** * Given an XML source node , get the count according to the
* parameters set up by the xsl : number attributes .
* @ param transformer non - null reference to the the current transform - time state .
* @ param sourceNode The source node being counted .
* @ return The count of nodes... | long [ ] list = null ; XPathContext xctxt = transformer . getXPathContext ( ) ; CountersTable ctable = transformer . getCountersTable ( ) ; if ( null != m_valueExpr ) { XObject countObj = m_valueExpr . execute ( xctxt , sourceNode , this ) ; // According to Errata E24
double d_count = java . lang . Math . floor ( count... |
public class MarvinColorModelConverter { /** * Converts a boolean array containing the pixel data in BINARY mode to an
* integer array with the pixel data in RGB mode .
* @ param binaryArray pixel binary data
* @ return pixel integer data in RGB mode . */
public static int [ ] binaryToRgb ( boolean [ ] binaryArra... | int [ ] rgbArray = new int [ binaryArray . length ] ; for ( int i = 0 ; i < binaryArray . length ; i ++ ) { if ( binaryArray [ i ] ) { rgbArray [ i ] = 0x00000000 ; } else { rgbArray [ i ] = 0x00FFFFFF ; } } return rgbArray ; |
public class Query { /** * Validates the query
* @ throws IllegalArgumentException if one or more parameters were invalid */
public void validate ( ) { } } | if ( time == null ) { throw new IllegalArgumentException ( "missing time" ) ; } validatePOJO ( time , "time" ) ; if ( metrics == null || metrics . isEmpty ( ) ) { throw new IllegalArgumentException ( "missing or empty metrics" ) ; } final Set < String > variable_ids = new HashSet < String > ( ) ; for ( Metric metric : ... |
public class NGConstants { /** * Loads the version number from a file generated by Maven . */
private static String getVersion ( ) { } } | Properties props = new Properties ( ) ; try ( InputStream is = NGConstants . class . getResourceAsStream ( "/META-INF/maven/com.facebook/nailgun-server/pom.properties" ) ) { props . load ( is ) ; } catch ( Throwable e ) { // In static initialization context , outputting or logging an exception is dangerous
// It smells... |
public class OcpiRepository { /** * findTokenByUid
* @ param uid
* @ return */
public Token findTokenByUid ( String uid ) { } } | EntityManager entityManager = getEntityManager ( ) ; try { return entityManager . createQuery ( "SELECT token FROM Token AS token WHERE uid = :uid" , Token . class ) . setParameter ( "uid" , uid ) . setMaxResults ( 1 ) . getSingleResult ( ) ; } catch ( NoResultException e ) { return null ; } finally { entityManager . c... |
public class JedisRedisClient { /** * { @ inheritDoc } */
@ SuppressWarnings ( "unchecked" ) @ Override public List < byte [ ] > multiGetAsBinary ( String ... keys ) { } } | Pipeline p = redisClient . pipelined ( ) ; for ( String key : keys ) { p . get ( SafeEncoder . encode ( key ) ) ; } List < ? > result = p . syncAndReturnAll ( ) ; return ( List < byte [ ] > ) result ; |
public class CloudwatchLogsExportConfiguration { /** * The list of log types to disable .
* @ return The list of log types to disable . */
public java . util . List < String > getDisableLogTypes ( ) { } } | if ( disableLogTypes == null ) { disableLogTypes = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return disableLogTypes ; |
public class KeyTranslatorImpl { /** * Adds a mapping from a key press to an action command string that will auto - repeat at the
* specified repeat rate . Overwrites any existing mapping and repeat rate that may have
* already been registered .
* @ param rate the number of times each second that the key press sh... | addPressCommand ( keyCode , command , rate , DEFAULT_REPEAT_DELAY ) ; |
public class WebListener { /** * Deassociates the current { @ code HttpSessionEvent } from { @ link Session }
* context .
* @ param se The event the { @ code HttpSession } is destroyed . */
@ SuppressWarnings ( "unchecked" ) public void sessionDestroyed ( HttpSessionEvent se ) { } } | WebContext < HttpSession > context = ( WebContext < HttpSession > ) container . component ( container . contexts ( ) . get ( Session . class ) ) ; context . deassociate ( se . getSession ( ) ) ; |
public class RSAUtils { /** * 从字符串中加载私钥 < br >
* 加载时使用的是PKCS8EncodedKeySpec ( PKCS # 8编码的Key指令 ) 。
* @ param privateKeyStr
* @ return
* @ throws Exception */
public static PrivateKey loadPrivateKey ( String privateKeyStr ) throws Exception { } } | try { byte [ ] buffer = base64 . decode ( privateKeyStr ) ; // X509EncodedKeySpec keySpec = new X509EncodedKeySpec ( buffer ) ;
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec ( buffer ) ; KeyFactory keyFactory = KeyFactory . getInstance ( KEY_ALGORITHM ) ; return ( RSAPrivateKey ) keyFactory . generatePrivate ( ... |
public class HeadLineInterceptor { /** * Override paint in order to perform processing specific to this interceptor . This implementation is responsible
* for rendering the headlines for the UI .
* @ param renderContext the renderContext to send the output to . */
@ Override public void paint ( final RenderContext ... | if ( renderContext instanceof WebXmlRenderContext ) { PageContentHelper . addAllHeadlines ( ( ( WebXmlRenderContext ) renderContext ) . getWriter ( ) , getUI ( ) . getHeaders ( ) ) ; } getBackingComponent ( ) . paint ( renderContext ) ; |
public class GetResourcesResult { /** * The current page of elements from this collection .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setItems ( java . util . Collection ) } or { @ link # withItems ( java . util . Collection ) } if you want to override ... | if ( this . items == null ) { setItems ( new java . util . ArrayList < Resource > ( items . length ) ) ; } for ( Resource ele : items ) { this . items . add ( ele ) ; } return this ; |
public class JobHistoryRawService { /** * returns the raw byte representation of job history from the result value
* @ param value result
* @ return byte array of job history raw
* @ throws MissingColumnInResultException */
public byte [ ] getJobHistoryRawFromResult ( Result value ) throws MissingColumnInResultEx... | if ( value == null ) { throw new IllegalArgumentException ( "Cannot create InputStream from null" ) ; } Cell cell = value . getColumnLatestCell ( Constants . RAW_FAM_BYTES , Constants . JOBHISTORY_COL_BYTES ) ; // Could be that there is no conf file ( only a history file ) .
if ( cell == null ) { throw new MissingColum... |
public class Polygon { /** * Convenience method to get a list of inner { @ link LineString } s defining holes inside the
* polygon . It is not guaranteed that this instance of Polygon contains holes and thus , might
* return a null or empty list .
* @ return a List of { @ link LineString } s defining holes inside... | List < List < Point > > coordinates = coordinates ( ) ; if ( coordinates . size ( ) <= 1 ) { return new ArrayList ( 0 ) ; } List < LineString > inner = new ArrayList < > ( coordinates . size ( ) - 1 ) ; for ( List < Point > points : coordinates . subList ( 1 , coordinates . size ( ) ) ) { inner . add ( LineString . fro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.