signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ColumnRef { /** * The following Java method tests if a string matches a wildcard expression
* ( supporting ? for exactly one character or * for an arbitrary number of characters ) :
* @ param text Text to test
* @ param pattern ( Wildcard ) pattern to test
* @ return True if the text matches the wi... | if ( pattern == null ) return false ; return text . matches ( pattern . replace ( "?" , ".?" ) . replace ( "*" , ".*?" ) ) ; |
public class DefaultGroovyMethods { /** * Returns the last item from the List .
* < pre class = " groovyTestCase " >
* def list = [ 3 , 4 , 2]
* assert list . last ( ) = = 2
* / / check original is unaltered
* assert list = = [ 3 , 4 , 2]
* < / pre >
* @ param self a List
* @ return the last item from t... | if ( self . isEmpty ( ) ) { throw new NoSuchElementException ( "Cannot access last() element from an empty List" ) ; } return self . get ( self . size ( ) - 1 ) ; |
public class HalParser { /** * Parse embedded items of a given link - relation type not as HalRepresentation , but as a sub - type of
* HalRepresentation , so extra attributes of the embedded items can be accessed .
* @ param type the Java class used to map JSON to .
* @ param typeInfo type information of the emb... | final List < EmbeddedTypeInfo > typeInfos = new ArrayList < > ( ) ; typeInfos . add ( typeInfo ) ; if ( moreTypeInfo != null ) { typeInfos . addAll ( asList ( moreTypeInfo ) ) ; } return as ( type , typeInfos ) ; |
public class FullEnumerationFormulaGenerator { /** * Calculates the exact mass of the currently evaluated formula . Basically ,
* it multiplies the currentCounts [ ] array by the masses of the isotopes in
* the isotopes [ ] array . */
private double calculateCurrentMass ( ) { } } | double mass = 0 ; for ( int i = 0 ; i < isotopes . length ; i ++ ) { mass += currentCounts [ i ] * isotopes [ i ] . getExactMass ( ) ; } return mass ; |
public class DCEventSource { /** * The listeners are called when the preInvalidate method is invoked .
* @ param event The invalidation event to be pre - invalidated . */
public boolean shouldInvalidate ( Object id , int sourceOfInvalidation , int causeOfInvalidation ) { } } | boolean retVal = true ; if ( preInvalidationListenerCount > 0 ) { // In external implementation , catch any exceptions and process
try { retVal = currentPreInvalidationListener . shouldInvalidate ( id , sourceOfInvalidation , causeOfInvalidation ) ; } catch ( Throwable t ) { com . ibm . ws . ffdc . FFDCFilter . process... |
public class DialogPlus { /** * It is called to set whether the dialog is cancellable by pressing back button or
* touching the black overlay */
private void initCancelable ( ) { } } | if ( ! isCancelable ) { return ; } View view = rootView . findViewById ( R . id . dialogplus_outmost_container ) ; view . setOnTouchListener ( onCancelableTouchListener ) ; |
public class HttpMethodBase { /** * This method is invoked immediately after
* { @ link # readResponseHeaders ( HttpState , HttpConnection ) } and can be overridden by
* sub - classes in order to provide custom response headers processing .
* This implementation will handle the < tt > Set - Cookie < / tt > and
... | LOG . trace ( "enter HttpMethodBase.processResponseHeaders(HttpState, " + "HttpConnection)" ) ; CookieSpec parser = getCookieSpec ( state ) ; // process set - cookie headers
Header [ ] headers = getResponseHeaderGroup ( ) . getHeaders ( "set-cookie" ) ; processCookieHeaders ( parser , headers , state , conn ) ; // see ... |
public class Logging { /** * Begin a new algorithm step ( unless { @ code null } ) .
* < b > Important : < / b > Do not use this method when the parameter are not static .
* In these cases , check whether logging is enabled first , to avoid computing
* method parameters !
* @ param prog Progress to increment , ... | if ( prog != null ) { prog . beginStep ( step , title , this ) ; } |
public class ServletCallInterceptor { /** * { @ inheritDoc } */
public void init ( ServletConfig config ) throws ServletException { } } | LOG . info ( "Init servlet..." ) ; // We must init the superfilters first . . .
List < SuperFilter > superFilterList = applicationFactory . getSuperFilterList ( ) ; Filter [ ] superFilter = new Filter [ superFilterList . size ( ) ] ; if ( superFilter . length > 0 ) { LOG . info ( "Init {} superfilters..." , superFilter... |
public class ServiceMapper { /** * getMethodDefBindings : creates an array of operation bindings in the form
* of an array of Fedora MethodDefOperationBind objects . The creation of a
* MethodDefOperationBind object requires information from a WSDL service
* definition and a related Fedora Method Map . The Fedora... | return merge ( getService ( wsdlSource ) , getMethodMap ( methodMapSource ) ) ; |
public class CurrencyAmount { /** * Converts an amount from it ' s canonical string representation back into a big decimal . A < code > null < / code > argument will return
* < code > null < / code > .
* @ param amount
* Amount string to convert .
* @ return String as big decimal . */
public static BigDecimal s... | if ( amount == null ) { return null ; } final int dot = amount . indexOf ( '.' ) ; final int scale ; final String unscaledStr ; if ( dot == - 1 ) { scale = 0 ; unscaledStr = amount ; } else { scale = amount . length ( ) - dot - 1 ; unscaledStr = amount . substring ( 0 , dot ) + amount . substring ( dot + 1 ) ; } final ... |
public class RestController { /** * Deletes all entities for the given entity name */
@ DeleteMapping ( "/{entityTypeId}" ) @ ResponseStatus ( NO_CONTENT ) public void deleteAll ( @ PathVariable ( "entityTypeId" ) String entityTypeId ) { } } | dataService . deleteAll ( entityTypeId ) ; |
public class PersistenceXMLLoader { /** * Validates an xml object graph against its schema . Therefore it reads the
* version from the root tag and tries to load the related xsd file from the
* classpath .
* @ param xmlRootNode
* root xml node of the document to validate
* @ throws InvalidConfigurationExcepti... | final Element rootElement = xmlRootNode . getDocumentElement ( ) ; final String version = rootElement . getAttribute ( "version" ) ; String schemaFileName = "persistence_" + version . replace ( "." , "_" ) + ".xsd" ; try { final List validationErrors = new ArrayList ( ) ; final String schemaLanguage = XMLConstants . W3... |
public class AWSLambdaClient { /** * Creates a mapping between an event source and an AWS Lambda function . Lambda reads items from the event source
* and triggers the function .
* For details about each event source type , see the following topics .
* < ul >
* < li >
* < a href = " https : / / docs . aws . a... | request = beforeClientExecution ( request ) ; return executeCreateEventSourceMapping ( request ) ; |
public class SparseDataset { /** * Returns an array containing all of the elements in this dataset in
* proper sequence ( from first to last element ) ; the runtime type of the
* returned array is that of the specified array . If the dataset fits in
* the specified array , it is returned therein . Otherwise , a n... | int m = data . size ( ) ; if ( a . length < m ) { a = new SparseArray [ m ] ; } for ( int i = 0 ; i < m ; i ++ ) { a [ i ] = get ( i ) . x ; } for ( int i = m ; i < a . length ; i ++ ) { a [ i ] = null ; } return a ; |
public class CatalogUtil { /** * Set the security setting in the catalog from the deployment file
* @ param catalog the catalog to be updated
* @ param security security element of the deployment xml */
private static void setSecurityEnabled ( Catalog catalog , SecurityType security ) { } } | Cluster cluster = catalog . getClusters ( ) . get ( "cluster" ) ; Database database = cluster . getDatabases ( ) . get ( "database" ) ; cluster . setSecurityenabled ( security . isEnabled ( ) ) ; database . setSecurityprovider ( security . getProvider ( ) . value ( ) ) ; |
public class VarBindingDef { /** * Changes this input variable binding . */
public VarBindingDef bind ( VarDef varDef , VarValueDef valueDef ) { } } | if ( valueDef != null && ! varDef . isApplicable ( valueDef ) ) { throw new IllegalArgumentException ( "Value=" + valueDef + " is not defined for var=" + varDef ) ; } varDef_ = varDef ; valueDef_ = valueDef ; effCondition_ = null ; return this ; |
public class FastByteArrayInputStream { /** * Reads up to < code > len < / code > bytes of data into an array of bytes
* from this input stream .
* If < code > pos < / code > equals < code > count < / code > ,
* then < code > - 1 < / code > is returned to indicate
* end of file . Otherwise , the number < code >... | if ( b == null ) { throw new NullPointerException ( ) ; } else if ( off < 0 || len < 0 || len > b . length - off ) { throw new IndexOutOfBoundsException ( ) ; } if ( pos >= count ) { return - 1 ; } if ( pos + len > count ) { len = count - pos ; } if ( len <= 0 ) { return 0 ; } System . arraycopy ( data . bytes , pos , ... |
public class Ftp { /** * 下载文件
* @ param path 文件路径
* @ param outFile 输出文件或目录 */
@ Override public void download ( String path , File outFile ) { } } | final String fileName = FileUtil . getName ( path ) ; final String dir = StrUtil . removeSuffix ( path , fileName ) ; download ( dir , fileName , outFile ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link FeaturePropertyType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link FeaturePropertyType } { @ co... | return new JAXBElement < FeaturePropertyType > ( _Using_QNAME , FeaturePropertyType . class , null , value ) ; |
public class ChannelMappingMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ChannelMapping channelMapping , ProtocolMarshaller protocolMarshaller ) { } } | if ( channelMapping == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( channelMapping . getOutputChannels ( ) , OUTPUTCHANNELS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . ... |
public class AbstractCSSParser { /** * Returns a new locator for the given token .
* @ param t the token to generate the locator for
* @ return a new locator */
protected Locator createLocator ( final Token t ) { } } | return new Locator ( getInputSource ( ) . getURI ( ) , t == null ? 0 : t . beginLine , t == null ? 0 : t . beginColumn ) ; |
public class Exec { /** * Execute a command in a container . If there are multiple containers in the pod , uses the first
* container in the Pod .
* @ param pod The pod where the command is run .
* @ param command The command to run
* @ param stdin If true , pass a stdin stream into the container */
public Proc... | return exec ( pod , command , null , stdin , false ) ; |
public class AbstractBoundaryEventBuilder { /** * Sets an escalation definition for the given escalation code . If already an escalation
* with this code exists it will be used , otherwise a new escalation is created .
* @ param escalationCode the code of the escalation
* @ return the builder object */
public B e... | EscalationEventDefinition escalationEventDefinition = createEscalationEventDefinition ( escalationCode ) ; element . getEventDefinitions ( ) . add ( escalationEventDefinition ) ; return myself ; |
public class CmsLinkManager { /** * Returns a link < i > from < / i > the URI stored in the provided OpenCms user context
* < i > to < / i > the given < code > link < / code > , for use on web pages . < p >
* A number of tests are performed with the < code > link < / code > in order to find out how to create the li... | if ( CmsStringUtil . isEmpty ( link ) ) { return "" ; } String sitePath = link ; String siteRoot = null ; if ( hasScheme ( link ) ) { // the link has a scheme , that is starts with something like " http : / / "
// usually this should be a link to an external resource , but check anyway
sitePath = getRootPath ( cms , li... |
public class WasEndedBy { /** * Gets the value of the ender property .
* @ return
* possible object is
* { @ link org . openprovenance . prov . sql . IDRef } */
@ ManyToOne ( targetEntity = org . openprovenance . prov . sql . QualifiedName . class , cascade = { } } | CascadeType . ALL } ) @ JoinColumn ( name = "ENDER" ) public org . openprovenance . prov . model . QualifiedName getEnder ( ) { return ender ; |
public class JMFiles { /** * Read string string .
* @ param filePath the file path
* @ param charsetName the charset name
* @ return the string */
public static String readString ( String filePath , String charsetName ) { } } | return readString ( getPath ( filePath ) , charsetName ) ; |
public class AuthCommand { /** * Hashes a password the shiro way .
* @ return */
private String hashPasswordForShiro ( ) { } } | // Hash password
HashFormatFactory HASH_FORMAT_FACTORY = new DefaultHashFormatFactory ( ) ; SecureRandomNumberGenerator generator = new SecureRandomNumberGenerator ( ) ; int byteSize = 128 / 8 ; ByteSource salt = generator . nextBytes ( byteSize ) ; SimpleHash hash = new SimpleHash ( "SHA-256" , password , salt , 10 ) ... |
public class ModifyReplicationGroupShardConfigurationRequest { /** * Specifies the preferred availability zones for each node group in the cluster . If the value of
* < code > NodeGroupCount < / code > is greater than the current number of node groups ( shards ) , you can use this
* parameter to specify the preferr... | if ( reshardingConfiguration == null ) { this . reshardingConfiguration = null ; return ; } this . reshardingConfiguration = new com . amazonaws . internal . SdkInternalList < ReshardingConfiguration > ( reshardingConfiguration ) ; |
public class BusItinerary { private void onBusHaltChanged ( BusItineraryHalt halt ) { } } | if ( halt . getContainer ( ) == this ) { final boolean oldValidity = ! ListUtil . contains ( this . invalidHalts , INVALID_HALT_COMPARATOR , halt ) ; final boolean currentValidity = halt . isValidPrimitive ( ) ; if ( oldValidity != currentValidity ) { if ( currentValidity ) { ListUtil . remove ( this . invalidHalts , I... |
public class EntityMetadata { /** * Sets the created timestamp metadata to the given value .
* @ param createdTimestampMetadata
* the created timestamp metadata */
public void setCreatedTimestampMetadata ( PropertyMetadata createdTimestampMetadata ) { } } | if ( this . createdTimestampMetadata != null ) { throwDuplicateAnnotationException ( entityClass , CreatedTimestamp . class , this . createdTimestampMetadata , createdTimestampMetadata ) ; } this . createdTimestampMetadata = createdTimestampMetadata ; |
public class HttpJsonRpcClient { /** * Perform a GET request .
* @ param url
* @ param headers
* @ param urlParams
* @ return */
public RequestResponse doGet ( String url , Map < String , Object > headers , Map < String , Object > urlParams ) { } } | RequestResponse requestResponse = initRequestResponse ( "GET" , url , headers , urlParams , null ) ; Request . Builder requestBuilder = buildRequest ( url , headers , urlParams ) . get ( ) ; return doCall ( client , requestBuilder . build ( ) , requestResponse ) ; |
public class CmsSourceDialog { /** * Sets the search index to show information about . < p >
* @ param searchindex to be displayed */
public void setSource ( String searchindex ) { } } | Label label = new Label ( ) ; label . setContentMode ( ContentMode . HTML ) ; label . setValue ( getSources ( searchindex ) ) ; m_layout . removeAllComponents ( ) ; m_layout . addComponent ( label ) ; |
public class ToStream { /** * Receive notification of an XML comment anywhere in the document . This
* callback will be used for comments inside or outside the document
* element , including comments in the external DTD subset ( if read ) .
* @ param ch An array holding the characters in the comment .
* @ param... | int start_old = start ; if ( m_inEntityRef ) return ; if ( m_elemContext . m_startTagOpen ) { closeStartTag ( ) ; m_elemContext . m_startTagOpen = false ; } else if ( m_needToCallStartDocument ) { startDocumentInternal ( ) ; m_needToCallStartDocument = false ; } try { final int limit = start + length ; boolean wasDash ... |
public class NaiveTokenizer { /** * Sets the maximum allowed length for any token . Any token discovered
* exceeding the length will not be accepted and skipped over . The default
* is unbounded .
* @ param maxTokenLength the maximum token length to accept as a valid token */
public void setMaxTokenLength ( int m... | if ( maxTokenLength < 1 ) throw new IllegalArgumentException ( "Max token length must be positive, not " + maxTokenLength ) ; if ( maxTokenLength <= minTokenLength ) throw new IllegalArgumentException ( "Max token length must be larger than the min token length" ) ; this . maxTokenLength = maxTokenLength ; |
public class Statics { /** * Force all bits of the hash to avalanche . Used for finalizing the hash . */
public static int avalanche ( int h ) { } } | h ^= h >>> 16 ; h *= 0x85ebca6b ; h ^= h >>> 13 ; h *= 0xc2b2ae35 ; h ^= h >>> 16 ; return h ; |
public class ChameleonInstanceHolder { /** * Stores a reference on a running chameleon .
* @ param chameleon the chameleon */
public static synchronized void set ( Chameleon chameleon ) { } } | if ( INSTANCE != null && chameleon != null ) { throw new IllegalStateException ( "A Chameleon instance is already stored" ) ; } INSTANCE = chameleon ; if ( chameleon == null ) { // Reset metadata
HOST_NAME = null ; HTTP_PORT = - 1 ; HTTPS_PORT = - 1 ; } |
public class RemoteRecordOwner { /** * Initialize the RecordOwner .
* @ param parentSessionObject Parent that created this session object .
* @ param record Main record for this session ( opt ) .
* @ param objectID ObjectID of the object that this SessionObject represents ( usually a URL or bookmark ) . */
public... | m_sessionObjectParent = parent ; if ( m_sessionObjectParent != null ) m_sessionObjectParent . addRecordOwner ( this ) ; else if ( ! this . getClass ( ) . getName ( ) . endsWith ( "TaskSession" ) ) Utility . getLogger ( ) . warning ( "Remote Session does not have parent" ) ; if ( recordMain == null ) recordMain = this .... |
public class VirtualNetworkGatewayConnectionsInner { /** * Creates or updates a virtual network gateway connection in the specified resource group .
* @ param resourceGroupName The name of the resource group .
* @ param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection .
* @ p... | return beginCreateOrUpdateWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayConnectionName , parameters ) . map ( new Func1 < ServiceResponse < VirtualNetworkGatewayConnectionInner > , VirtualNetworkGatewayConnectionInner > ( ) { @ Override public VirtualNetworkGatewayConnectionInner call ( ServiceRes... |
public class SXDocument { /** * Closes this document .
* < b > NOTICE : < / b > It is < b > absolutely necessary < / b > to call this method in the end ,
* as otherwise the last added child node will not be appropriately finished ! */
public void close ( ) throws IOException { } } | // close last tag , if present
if ( lastChildNode != null ) { lastChildNode . close ( ) ; lastChildNode = null ; } writer . write ( "\n" ) ; writer . flush ( ) ; isOpen = false ; |
public class GenUtil { /** * " Boxes " the supplied argument , ie . turning an < code > int < / code > into an < code > Integer < / code >
* object . */
public static String boxArgument ( Class < ? > clazz , String name ) { } } | if ( clazz == Boolean . TYPE ) { return "Boolean.valueOf(" + name + ")" ; } else if ( clazz == Byte . TYPE ) { return "Byte.valueOf(" + name + ")" ; } else if ( clazz == Character . TYPE ) { return "Character.valueOf(" + name + ")" ; } else if ( clazz == Short . TYPE ) { return "Short.valueOf(" + name + ")" ; } else if... |
public class TThreadedSelectorServerWithFix { /** * Start the accept and selector threads running to deal with clients .
* @ return true if everything went ok , false if we couldn ' t start for some
* reason . */
@ Override protected boolean startThreads ( ) { } } | LOGGER . info ( "Starting {}" , TThreadedSelectorServerWithFix . class . getSimpleName ( ) ) ; try { for ( int i = 0 ; i < args . selectorThreads ; ++ i ) { selectorThreads . add ( new SelectorThread ( args . acceptQueueSizePerThread ) ) ; } acceptThread = new AcceptThread ( ( TNonblockingServerTransport ) serverTransp... |
public class PutFootnotesMacro { /** * Generate the footnote reference ( link ) that should be inserted at the location of the macro , and should point to
* the actual footnote at the end of the document .
* @ param counter the current footnote counter
* @ return the generated reference element , displayed as { @... | Block result = new WordBlock ( String . valueOf ( counter ) ) ; DocumentResourceReference reference = new DocumentResourceReference ( null ) ; reference . setAnchor ( FOOTNOTE_ID_PREFIX + counter ) ; result = new LinkBlock ( Collections . singletonList ( result ) , reference , false ) ; result = new FormatBlock ( Colle... |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcBoolean ( ) { } } | if ( ifcBooleanEClass == null ) { ifcBooleanEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 659 ) ; } return ifcBooleanEClass ; |
public class Matchers { /** * Matches a class in which any of / all of its constructors match the given constructorMatcher . */
public static MultiMatcher < ClassTree , MethodTree > constructor ( MatchType matchType , Matcher < MethodTree > constructorMatcher ) { } } | return new ConstructorOfClass ( matchType , constructorMatcher ) ; |
public class Timex2 { /** * setter for mod - sets
* @ generated
* @ param v value to set into the feature */
public void setMod ( String v ) { } } | if ( Timex2_Type . featOkTst && ( ( Timex2_Type ) jcasType ) . casFeat_mod == null ) jcasType . jcas . throwFeatMissing ( "mod" , "de.julielab.jules.types.ace.Timex2" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Timex2_Type ) jcasType ) . casFeatCode_mod , v ) ; |
public class TypeVariableToken { /** * Transforms a type variable into a type variable token with its bounds detached .
* @ param typeVariable A type variable in its attached state .
* @ param matcher A matcher that identifies types to detach from the upper bound types .
* @ return A token representing the detach... | return new TypeVariableToken ( typeVariable . getSymbol ( ) , typeVariable . getUpperBounds ( ) . accept ( new TypeDescription . Generic . Visitor . Substitutor . ForDetachment ( matcher ) ) , typeVariable . getDeclaredAnnotations ( ) ) ; |
public class ESResponseWrapper { /** * Parses the response .
* @ param response
* the response
* @ param aggregation
* the aggregation
* @ param fieldsToSelect
* the fields to select
* @ param metaModel
* the meta model
* @ param clazz
* the clazz
* @ param entityMetadata
* the entity metadata
... | logger . debug ( "Response of query: " + response ) ; List results = new ArrayList ( ) ; EntityType entityType = metaModel . entity ( clazz ) ; if ( aggregation == null ) { SearchHits hits = response . getHits ( ) ; if ( fieldsToSelect != null && fieldsToSelect . length > 1 && ! ( fieldsToSelect [ 1 ] == null ) ) { for... |
public class ImagePathTag { /** * ( non - Javadoc )
* @ see net . jawr . web . taglib . jsf . AbstractImageTag # render ( javax . faces . context .
* FacesContext ) */
protected void render ( FacesContext context ) throws IOException { } } | String src = ( String ) getAttributes ( ) . get ( "src" ) ; boolean base64 = Boolean . parseBoolean ( ( String ) getAttributes ( ) . get ( "src" ) ) ; String imagePath = getImageUrl ( context , src , base64 ) ; ResponseWriter writer = context . getResponseWriter ( ) ; writer . write ( imagePath ) ; |
public class DescribeDBInstanceAutomatedBackupsResult { /** * A list of < a > DBInstanceAutomatedBackup < / a > instances .
* @ return A list of < a > DBInstanceAutomatedBackup < / a > instances . */
public java . util . List < DBInstanceAutomatedBackup > getDBInstanceAutomatedBackups ( ) { } } | if ( dBInstanceAutomatedBackups == null ) { dBInstanceAutomatedBackups = new com . amazonaws . internal . SdkInternalList < DBInstanceAutomatedBackup > ( ) ; } return dBInstanceAutomatedBackups ; |
public class Strs { /** * Search target string to find the first index of any string in the given string list , starting at the specified index
* @ param target
* @ param fromIndex
* @ param indexWith
* @ return */
public static int indexAny ( String target , Integer fromIndex , List < String > indexWith ) { } ... | if ( isNull ( target ) ) { return INDEX_NONE_EXISTS ; } return matcher ( target ) . indexs ( fromIndex , checkNotNull ( indexWith ) . toArray ( new String [ indexWith . size ( ) ] ) ) ; |
public class CmsEditor { /** * Returns the edit state for the given resource structure id . < p >
* @ param resourceId the resource structure is
* @ param plainText if plain text / source editing is required
* @ param backLink the back link location
* @ return the state */
public static String getEditState ( Cm... | try { backLink = URLEncoder . encode ( backLink , CmsEncoder . ENCODING_UTF_8 ) ; } catch ( UnsupportedEncodingException e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } String state = "" ; state = A_CmsWorkplaceApp . addParamToState ( state , CmsEditor . RESOURCE_ID_PREFIX , resourceId . toString ( ) ) ; stat... |
public class SVD { /** * Returns { @ code true } if Matlab is available */
public static boolean isMatlabAvailable ( ) { } } | try { Process matlab = Runtime . getRuntime ( ) . exec ( "matlab -h" ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( matlab . getInputStream ( ) ) ) ; // Read the output to avoid some platform specific bugs where the
// waitFor ( ) call does not return . Thanks to Fabian for noticing
// this
for ( ... |
public class CarePlan { /** * syntactic sugar */
public CarePlanRelatedPlanComponent addRelatedPlan ( ) { } } | CarePlanRelatedPlanComponent t = new CarePlanRelatedPlanComponent ( ) ; if ( this . relatedPlan == null ) this . relatedPlan = new ArrayList < CarePlanRelatedPlanComponent > ( ) ; this . relatedPlan . add ( t ) ; return t ; |
public class FileXML { /** * Get the value of the tag under a base element
* @ param base
* @ param tag
* @ return */
protected String getValue ( Element base , String tag ) { } } | Element element = null ; String result = "" ; try { // ZAP : Removed unnecessary cast .
element = getElement ( base , tag ) ; result = getText ( element ) ; } catch ( Exception e ) { } return result ; |
public class Transaction { /** * Retrieves an Issuing < code > Transaction < / code > object . */
public static Transaction retrieve ( String transaction , RequestOptions options ) throws StripeException { } } | return retrieve ( transaction , ( Map < String , Object > ) null , options ) ; |
public class Operation { /** * Calculate two colors . The calculation occur for every color channel .
* @ param left the left color
* @ param right the right color
* @ return color value as long */
private double doubleValue2Colors ( double left , double right ) { } } | return rgba ( doubleValue ( red ( left ) , red ( right ) ) , doubleValue ( green ( left ) , green ( right ) ) , doubleValue ( blue ( left ) , blue ( right ) ) , 1 ) ; |
public class Jetty8ServerAdapter { /** * Stop Jetty server after it has been started .
* This is unlikely to ever be called by H2O until H2O supports graceful shutdown .
* @ throws Exception - */
@ Override public void stop ( ) throws IOException { } } | if ( jettyServer != null ) { try { jettyServer . stop ( ) ; } catch ( IOException e ) { throw e ; } catch ( Exception e ) { throw new IOException ( e ) ; } } |
public class Dataframe { /** * It extracts the values of a particular column from all records and
* stores them into an FlatDataList .
* @ param column
* @ return */
public FlatDataList getXColumn ( Object column ) { } } | FlatDataList flatDataList = new FlatDataList ( ) ; for ( Record r : values ( ) ) { flatDataList . add ( r . getX ( ) . get ( column ) ) ; } return flatDataList ; |
public class CmsVfsBundleManager { /** * Adds an XML based message bundle . < p >
* @ param xmlBundle the XML content containing the message bundle data */
private void addXmlBundle ( CmsResource xmlBundle ) { } } | String name = xmlBundle . getName ( ) ; String path = xmlBundle . getRootPath ( ) ; m_bundleBaseNames . add ( name ) ; LOG . info ( String . format ( "Adding property VFS bundle (path=%s, name=%s)" , xmlBundle . getRootPath ( ) , name ) ) ; for ( Locale locale : getAllLocales ( ) ) { CmsVfsBundleParameters params = new... |
public class SessionListener { /** * pour Jenkins / jira / confluence / bamboo */
void unregisterSessionIfNeeded ( HttpSession session ) { } } | if ( session != null ) { try { session . getCreationTime ( ) ; // https : / / issues . jenkins - ci . org / browse / JENKINS - 20532
// https : / / bugs . eclipse . org / bugs / show _ bug . cgi ? id = 413019
session . getLastAccessedTime ( ) ; } catch ( final IllegalStateException e ) { // session . getCreationTime ( ... |
public class Leader { /** * Waits until the new epoch is established .
* @ throws InterruptedException if anything wrong happens .
* @ throws TimeoutException in case of timeout . */
void waitEpochAckFromQuorum ( ) throws InterruptedException , TimeoutException { } } | int ackCount = 0 ; // Waits the Ack from all other peers in the quorum set .
while ( ackCount < this . quorumMap . size ( ) ) { MessageTuple tuple = filter . getExpectedMessage ( MessageType . ACK_EPOCH , null , config . getTimeoutMs ( ) ) ; Message msg = tuple . getMessage ( ) ; String source = tuple . getServerId ( )... |
public class CmsGalleryControllerHandler { /** * Sets the list content of the types tab . < p >
* @ param typeInfos the type info beans
* @ param selectedTypes the selected types */
public void setTypesTabContent ( List < CmsResourceTypeBean > typeInfos , List < String > selectedTypes ) { } } | m_galleryDialog . getTypesTab ( ) . fillContent ( typeInfos , selectedTypes ) ; |
public class SparseHashArray { /** * { @ inheritDoc } */
public void set ( int index , T value ) { } } | // If we are setting a non - null value , then always add it to the array
if ( value != null ) { // Check whether the put call actually modified the map , and if so
// invalidate any previous set of indices ;
if ( indexToValue . put ( index , value ) == null ) indices = null ; } // Otherwise , check whether an existing... |
public class SignerFactory { /** * Create an instance of the given signer .
* @ param signerType The signer type .
* @ return The new signer instance . */
private static Signer createSigner ( String signerType ) { } } | Class < ? extends Signer > signerClass = SIGNERS . get ( signerType ) ; Signer signer ; try { signer = signerClass . newInstance ( ) ; } catch ( InstantiationException ex ) { throw new IllegalStateException ( "Cannot create an instance of " + signerClass . getName ( ) , ex ) ; } catch ( IllegalAccessException ex ) { th... |
public class FormUploader { /** * 上传数据 , 并以指定的key保存文件
* @ param client HTTP连接管理器
* @ param data 上传的数据
* @ param key 上传的数据保存的文件名
* @ param token 上传凭证
* @ param options 上传时的可选参数
* @ return 响应信息 ResponseInfo # response 响应体 , 序列化后 json 格式 */
public static ResponseInfo syncUpload ( Client client , Configuration ... | try { return syncUpload0 ( client , config , data , null , key , token , options ) ; } catch ( Exception e ) { return ResponseInfo . create ( null , ResponseInfo . UnknownError , "" , "" , "" , "" , "" , "" , 0 , 0 , 0 , e . getMessage ( ) , token , data != null ? data . length : 0 ) ; } |
public class Utf8CharacterMapping { /** * codes ported from iconv lib in utf8 . h utf8 _ codepointtomb */
@ Override public int [ ] toIdList ( int codePoint ) { } } | int count ; if ( codePoint < 0x80 ) count = 1 ; else if ( codePoint < 0x800 ) count = 2 ; else if ( codePoint < 0x10000 ) count = 3 ; else if ( codePoint < 0x200000 ) count = 4 ; else if ( codePoint < 0x4000000 ) count = 5 ; else if ( codePoint <= 0x7fffffff ) count = 6 ; else return EMPTYLIST ; int [ ] r = new int [ c... |
public class BatchUploader { /** * This method start uploading object to server .
* @ param meta Object metadata .
* @ param streamProvider Stream provider .
* @ return Return future with upload result . For same objects can return same future . */
@ NotNull public CompletableFuture < Meta > upload ( @ NotNull fi... | return enqueue ( meta , streamProvider ) ; |
public class JmsConnectionImpl { /** * ( non - Javadoc )
* @ see com . ibm . ws . sib . api . jms . JmsConnInternals # getConnectedMEName ( ) */
@ Override public String getConnectedMEName ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getConnectedMEName" ) ; String meName = coreConnection . getMeName ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getConnectedMEName" , meName ) ; return ... |
public class TransactionLocalMap { /** * Remove the entry for key .
* @ param key to remove */
public void remove ( TransactionLocal key ) { } } | Entry [ ] tab = table ; int len = tab . length ; int i = key . hashCode & ( len - 1 ) ; for ( Entry e = tab [ i ] ; e != null ; e = tab [ i = nextIndex ( i , len ) ] ) { if ( e . key == key ) { expungeStaleEntry ( i ) ; return ; } } |
public class SeaGlassSliderUI { /** * { @ inheritDoc } */
@ Override protected void paintMajorTickForHorizSlider ( Graphics g , Rectangle tickBounds , int x ) { } } | setTickColor ( g ) ; super . paintMajorTickForHorizSlider ( g , tickBounds , x ) ; |
public class AuthenticationApi { /** * Get user information by access token
* Get information about a user by their OAuth 2 access token .
* @ param authorization The OAuth 2 bearer access token . For example : \ & quot ; Authorization : bearer a4b5da75 - a584-4053-9227-0f0ab23ff06e \ & quot ; ( required )
* @ re... | try { return authenticationApi . getInfo1 ( authorization ) ; } catch ( ApiException e ) { throw new AuthenticationApiException ( "Error getting userinfo" , e ) ; } |
public class CommerceWarehousePersistenceImpl { /** * Creates a new commerce warehouse with the primary key . Does not add the commerce warehouse to the database .
* @ param commerceWarehouseId the primary key for the new commerce warehouse
* @ return the new commerce warehouse */
@ Override public CommerceWarehous... | CommerceWarehouse commerceWarehouse = new CommerceWarehouseImpl ( ) ; commerceWarehouse . setNew ( true ) ; commerceWarehouse . setPrimaryKey ( commerceWarehouseId ) ; commerceWarehouse . setCompanyId ( companyProvider . getCompanyId ( ) ) ; return commerceWarehouse ; |
public class CmsJspActionElement { /** * Includes a named sub - element suppressing all Exceptions that occur during the include ,
* otherwise the same as using { @ link # include ( String , String , Map ) } . < p >
* This is a convenience method that allows to include elements on a page without checking
* if the... | try { include ( target , element , null ) ; } catch ( Throwable t ) { // ignore
} |
public class DefaultDiskStorage { /** * Checks that the file is placed in the correct shard according to its filename ( and hence the
* represented key ) . If it ' s correct its FileInfo is returned .
* @ param file the file to check
* @ return the corresponding FileInfo object if shard is correct , null otherwis... | FileInfo info = FileInfo . fromFile ( file ) ; if ( info == null ) { return null ; // file with incorrect name / extension
} File expectedDirectory = getSubdirectory ( info . resourceId ) ; boolean isCorrect = expectedDirectory . equals ( file . getParentFile ( ) ) ; return isCorrect ? info : null ; |
public class MultipartBody { /** * Either writes this request to { @ code sink } or measures its content length . We have one method
* do double - duty to make sure the counting and content are consistent , particularly when it comes
* to awkward operations like measuring the encoded length of header strings , or t... | long byteCount = 0L ; Buffer byteCountBuffer = null ; if ( countBytes ) { sink = byteCountBuffer = new Buffer ( ) ; } for ( int p = 0 , partCount = parts . size ( ) ; p < partCount ; p ++ ) { Part part = parts . get ( p ) ; Headers headers = part . headers ; RequestBody body = part . body ; sink . write ( DASHDASH ) ; ... |
public class StreamPersistedValueData { /** * { @ inheritDoc } */
@ Override public long read ( OutputStream stream , long length , long position ) throws IOException { } } | if ( url != null ) { if ( tempFile != null ) { return readFromFile ( stream , tempFile , length , position ) ; } else if ( spoolContent ) { spoolContent ( ) ; return readFromFile ( stream , tempFile , length , position ) ; } InputStream is = url . openStream ( ) ; try { is . skip ( position ) ; byte [ ] bytes = new byt... |
public class ExtendedLikeFilterImpl { /** * See convertToSQL92.
* @ return SQL like sub - expression
* @ throws IllegalArgumentException oops */
public String getSQL92LikePattern ( ) throws IllegalArgumentException { } } | if ( escape . length ( ) != 1 ) { throw new IllegalArgumentException ( "Like Pattern --> escape char should be of length exactly 1" ) ; } if ( wildcardSingle . length ( ) != 1 ) { throw new IllegalArgumentException ( "Like Pattern --> wildcardSingle char should be of length exactly 1" ) ; } if ( wildcardMulti . length ... |
public class TypeInfo { /** * Create a new instance .
* @ param fields
* @ return */
public T newInstance ( Map < String , Object > fields ) { } } | try { FactoryDefinition < T > bestDef = factories [ 0 ] ; int bestScore = bestDef . getScore ( fields ) ; for ( int i = 1 , n = factories . length ; i < n ; i ++ ) { int score = factories [ i ] . getScore ( fields ) ; if ( score > bestScore ) { bestDef = factories [ i ] ; bestScore = score ; } } return bestDef . create... |
public class HeapCache { /** * Executed in loader thread . Load the entry again . After the load we copy the entry to the
* refresh hash and expire it in the main hash . The entry needs to stay in the main hash
* during the load , to block out concurrent reads . */
private void refreshEntry ( final Entry < K , V > ... | synchronized ( e ) { e . waitForProcessing ( ) ; if ( e . isGone ( ) ) { return ; } e . startProcessing ( Entry . ProcessingState . REFRESH ) ; } boolean _finished = false ; try { load ( e ) ; _finished = true ; } catch ( CacheClosedException ignore ) { } catch ( Throwable ex ) { logAndCountInternalException ( "Refresh... |
public class SARLReadAndWriteTracking { /** * Replies if the given object was marked as assigned within the current compilation unit .
* @ param object the object to test .
* @ return { @ code true } if the object was written within the current compilation unit ;
* { @ code false } if is is not written within the... | assert object != null ; return object . eAdapters ( ) . contains ( ASSIGNMENT_MARKER ) ; |
public class ProxyRequestHelper { /** * Get url encoded query string . Pay special attention to single parameters with no
* values and parameter names with colon ( : ) from use of UriTemplate .
* @ param params Un - encoded request parameters
* @ return url - encoded query String built from provided parameters */... | if ( params . isEmpty ( ) ) { return "" ; } StringBuilder query = new StringBuilder ( ) ; Map < String , Object > singles = new HashMap < > ( ) ; for ( String param : params . keySet ( ) ) { int i = 0 ; for ( String value : params . get ( param ) ) { query . append ( "&" ) ; query . append ( param ) ; if ( ! "" . equal... |
public class HiveRegister { /** * Add a partition to a table if not exists , or alter a partition if exists .
* @ param table the { @ link HiveTable } to which the partition belongs .
* @ param partition a { @ link HivePartition } to which the existing partition should be updated .
* @ throws IOException */
publi... | if ( ! addPartitionIfNotExists ( table , partition ) ) { alterPartition ( table , partition ) ; } |
public class FloatBuffer { /** * Creates a float buffer based on a newly allocated float array .
* @ param capacity the capacity of the new buffer .
* @ return the created float buffer .
* @ throws IllegalArgumentException if { @ code capacity } is less than zero . */
public static FloatBuffer allocate ( int capa... | if ( capacity < 0 ) { throw new IllegalArgumentException ( ) ; } ByteBuffer bb = ByteBuffer . allocateDirect ( capacity * 4 ) ; bb . order ( ByteOrder . nativeOrder ( ) ) ; return bb . asFloatBuffer ( ) ; |
public class Arbitrator { /** * Called by the proxy builder to register the listener for arbitration results ( DiscoveryAgent Instance ) .
* If the arbitration is already running or even finished the current state and in case of a successful arbitration
* the result is set at the newly registered listener .
* @ p... | this . arbitrationListener = arbitrationListener ; // listener is now ready to receive arbitration result / status
arbitrationListenerSemaphore . release ( ) ; if ( arbitrationStatus == ArbitrationStatus . ArbitrationSuccessful ) { arbitrationFinished ( arbitrationStatus , arbitrationResult ) ; } |
public class ConfirmedPublisher { /** * { @ inheritDoc } */
@ Override public void publish ( Message message , DeliveryOptions deliveryOptions ) throws IOException { } } | for ( int attempt = 1 ; attempt <= DEFAULT_RETRY_ATTEMPTS ; attempt ++ ) { if ( attempt > 1 ) { LOGGER . info ( "Attempt {} to send message" , attempt ) ; } try { Channel channel = provideChannel ( ) ; message . publish ( channel , deliveryOptions ) ; LOGGER . info ( "Waiting for publisher ack" ) ; channel . waitForCon... |
public class MultipartContent { /** * Configures a file part with the specified properties . Encoders must be configured on the { @ link HttpBuilder } to handle the content type
* of each configured part .
* @ param fieldName the field name
* @ param fileName the file name
* @ param contentType the part content... | entries . add ( new MultipartPart ( fieldName , fileName , contentType , content ) ) ; return this ; |
public class ParosTableScan { /** * / * ( non - Javadoc )
* @ see org . parosproxy . paros . db . paros . TableScan # insert ( long , java . lang . String ) */
@ Override public synchronized RecordScan insert ( long sessionId , String scanName ) throws DatabaseException { } } | try { psInsert . setLong ( 1 , sessionId ) ; psInsert . setString ( 2 , scanName ) ; psInsert . executeUpdate ( ) ; int id ; try ( ResultSet rs = psGetIdLastInsert . executeQuery ( ) ) { rs . next ( ) ; id = rs . getInt ( 1 ) ; } return read ( id ) ; } catch ( SQLException e ) { throw new DatabaseException ( e ) ; } |
public class RtfDocumentHeader { /** * initializes the RtfDocumentHeader . */
protected void init ( ) { } } | this . codePage = new RtfCodePage ( this . document ) ; this . colorList = new RtfColorList ( this . document ) ; this . fontList = new RtfFontList ( this . document ) ; this . listTable = new RtfListTable ( this . document ) ; this . stylesheetList = new RtfStylesheetList ( this . document ) ; this . infoGroup = new R... |
public class ManualDescriptor { /** * indexed setter for keywordList - sets an indexed value - A collection of objects of type uima . julielab . uima . Keyword , O
* @ generated
* @ param i index in the array to set
* @ param v value to set into the array */
public void setKeywordList ( int i , Keyword v ) { } } | if ( ManualDescriptor_Type . featOkTst && ( ( ManualDescriptor_Type ) jcasType ) . casFeat_keywordList == null ) jcasType . jcas . throwFeatMissing ( "keywordList" , "de.julielab.jules.types.pubmed.ManualDescriptor" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( ManualDescripto... |
public class JpaBaseRepository { /** * { @ inheritDoc } */
@ Override public T persist ( T entity ) { } } | // Case of new , non - persisted entity
if ( extractId ( entity ) == null ) { getEntityManager ( ) . persist ( entity ) ; } else if ( ! getEntityManager ( ) . contains ( entity ) ) { // In the case of an attached entity , we do nothing ( it
// will be persisted automatically on synchronisation )
// But . . . in the cas... |
public class Ifc4FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public IfcPermitTypeEnum createIfcPermitTypeEnumFromString ( EDataType eDataType , String initialValue ) { } } | IfcPermitTypeEnum result = IfcPermitTypeEnum . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class Predicates { /** * Check for universal equality ( Object # equals )
* Filtering example
* < pre >
* { @ code
* ReactiveSeq . of ( 1,2,3 ) . filter ( anyOf ( not ( eq ( 2 ) ) , in ( 1,10,20 ) ) ) ;
* / / ReactiveSeq [ 1]
* < / pre >
* Pattern Matching Example
* < pre >
* { @ code
* Eval ... | return test -> Objects . equals ( test , value ) ; |
public class StencilOperands { /** * Given a Number , return back the value attempting to narrow it to a target
* class .
* @ param original
* the original number
* @ param narrow
* the attempted target class
* @ return the narrowed number or the source if no narrowing was possible */
protected Number narro... | if ( original == null ) { return original ; } Number result = original ; if ( original instanceof BigDecimal ) { BigDecimal bigd = ( BigDecimal ) original ; // if it ' s bigger than a double it can ' t be narrowed
if ( bigd . compareTo ( BIGD_DOUBLE_MAX_VALUE ) > 0 ) { return original ; } else { try { long l = bigd . l... |
public class TheMovieDbApi { /** * Check to see if an item is already on a list .
* @ param listId listId
* @ param mediaId mediaId
* @ return true if the item is on the list
* @ throws MovieDbException exception */
public boolean checkItemStatus ( String listId , Integer mediaId ) throws MovieDbException { } } | return tmdbList . checkItemStatus ( listId , mediaId ) ; |
public class MiniTemplatorParser { /** * Returns false if the command should be treatet as normal template text . */
private boolean processTemplateCommand ( String cmdLine , int cmdTPosBegin , int cmdTPosEnd ) throws MiniTemplator . TemplateSyntaxException { } } | int p0 = skipBlanks ( cmdLine , 0 ) ; if ( p0 >= cmdLine . length ( ) ) { return false ; } int p = skipNonBlanks ( cmdLine , p0 ) ; String cmd = cmdLine . substring ( p0 , p ) ; String parms = cmdLine . substring ( p ) ; /* select */
if ( cmd . equalsIgnoreCase ( "$beginBlock" ) ) { processBeginBlockCmd ( parms , cmdTP... |
public class AWSMediaStoreClient { /** * Retrieves the properties of the requested container . This request is commonly used to retrieve the endpoint of a
* container . An endpoint is a value assigned by the service when a new container is created . A container ' s endpoint
* does not change after it has been assig... | request = beforeClientExecution ( request ) ; return executeDescribeContainer ( request ) ; |
public class DayEntryViewSkin { /** * This methods updates the styles of the node according to the entry
* settings . */
protected void updateStyles ( ) { } } | DayEntryView view = getSkinnable ( ) ; Entry < ? > entry = getEntry ( ) ; Calendar calendar = entry . getCalendar ( ) ; if ( entry instanceof DraggedEntry ) { calendar = ( ( DraggedEntry ) entry ) . getOriginalCalendar ( ) ; } // when the entry gets removed from its calendar then the calendar can
// be null
if ( calend... |
public class CommandLineParser { /** * Parses an array of arguments
* @ param args The command line arguments .
* @ return the non - config / option parameters */
public String [ ] parse ( @ NonNull String [ ] args ) { } } | List < String > filtered = new ArrayList < > ( ) ; List < String > cleanedArgs = new ArrayList < > ( ) ; // Pass through the args once to do a clean up will make the next round easier to parser .
for ( String c : args ) { if ( c . endsWith ( KEY_VALUE_SEPARATOR ) && isOptionName ( c ) ) { // If it is ends with a key / ... |
public class BaseRecordOwner { /** * Set this property .
* @ param strProperty The property key .
* @ param strValue The property value .
* Override this to do something . */
public void setProperty ( String strProperty , String strValue ) { } } | if ( this . getParentRecordOwner ( ) != null ) this . getParentRecordOwner ( ) . setProperty ( strProperty , strValue ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.