signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class TreeFileIOChannel { /** * not useful , as it slow in read / write */
protected String buildPathX ( String fileName ) { } } | char [ ] chs = fileName . toCharArray ( ) ; StringBuilder path = new StringBuilder ( ) ; for ( char ch : chs ) { path . append ( File . separator ) . append ( ch ) ; } return path . toString ( ) ; |
public class CollationBuilder { /** * Returns the secondary or tertiary weight preceding the current node ' s weight .
* node = nodes [ index ] . */
private int getWeight16Before ( int index , long node , int level ) { } } | assert ( strengthFromNode ( node ) < level || ! isTailoredNode ( node ) ) ; // Collect the root CE weights if this node is for a root CE .
// If it is not , then return the low non - primary boundary for a tailored CE .
int t ; if ( strengthFromNode ( node ) == Collator . TERTIARY ) { t = weight16FromNode ( node ) ; } ... |
public class DefaultServiceRegistry { /** * Initializes ServiceRegistry instance .
* @ param broker
* parent ServiceBroker */
@ Override public void started ( ServiceBroker broker ) throws Exception { } } | super . started ( broker ) ; // Local nodeID
this . nodeID = broker . getNodeID ( ) ; // Set components
ServiceBrokerConfig cfg = broker . getConfig ( ) ; this . executor = cfg . getExecutor ( ) ; this . scheduler = cfg . getScheduler ( ) ; this . strategyFactory = cfg . getStrategyFactory ( ) ; this . contextFactory =... |
public class LoggingSupport { /** * java . util . logging and read its configuration */
static String getSimpleFormat ( boolean useProxy ) { } } | String format = AccessController . doPrivileged ( new PrivilegedAction < String > ( ) { public String run ( ) { return System . getProperty ( FORMAT_PROP_KEY ) ; } } ) ; if ( useProxy && proxy != null && format == null ) { format = proxy . getProperty ( FORMAT_PROP_KEY ) ; } if ( format != null ) { try { // validate th... |
public class MessageUpdater { /** * Add the requested post parameters to the Request .
* @ param request Request to add post params to */
private void addPostParams ( final Request request ) { } } | if ( body != null ) { request . addPostParam ( "Body" , body ) ; } if ( attributes != null ) { request . addPostParam ( "Attributes" , attributes ) ; } |
public class BeanPath { /** * Create a new Simple path
* @ param < A >
* @ param property property name
* @ param type property type
* @ return property path */
@ SuppressWarnings ( "unchecked" ) protected < A > SimplePath < A > createSimple ( String property , Class < ? super A > type ) { } } | return add ( new SimplePath < A > ( ( Class < A > ) type , forProperty ( property ) ) ) ; |
public class ProcessApplicationContext { /** * < p > Takes a callable and executes all engine API invocations within that callable in the context
* of the given process application
* < p > Equivalent to
* < pre >
* try {
* ProcessApplicationContext . setCurrentProcessApplication ( " someProcessApplication " )... | try { setCurrentProcessApplication ( processApplication ) ; return callable . call ( ) ; } finally { clear ( ) ; } |
public class YamlWriter { /** * Save a given { @ link Object } to the yml - file .
* @ param fileName
* The file name of the yml - file .
* @ param object
* The { @ link Object } to be stored .
* @ throws IOException
* If the file could not be opened , created ( when it doesn ' t
* exist ) or the given fi... | ObjectChecks . checkForNullReference ( fileName , "fileName is null" ) ; ObjectChecks . checkForNullReference ( object , "object is null" ) ; FileWriter fileWriter = null ; File f = null ; try { fileWriter = new FileWriter ( fileName ) ; } catch ( IOException e ) { f = new File ( fileName ) ; if ( f . isDirectory ( ) )... |
public class CredentialFactory { /** * Creates an OAuth2 credential from client secrets , which may require an interactive authorization prompt .
* Use this method when the Application Default Credential is not sufficient .
* @ param clientSecretsFile The { @ code client _ secrets . json } file path .
* @ param c... | Preconditions . checkArgument ( clientSecretsFile != null ) ; Preconditions . checkArgument ( credentialId != null ) ; HttpTransport httpTransport ; try { httpTransport = GoogleNetHttpTransport . newTrustedTransport ( ) ; } catch ( IOException | GeneralSecurityException e ) { throw new RuntimeException ( "Could not cre... |
public class ConcurrentBlockingObjectQueue { /** * { @ inheritDoc } */
public boolean offer ( E value ) { } } | // non volatile read ( which is quicker )
final int writeLocation = this . producerWriteLocation ; // sets the nextWriteLocation my moving it on by 1 , this may cause it it wrap back to the start .
final int nextWriteLocation = ( writeLocation + 1 == capacity ) ? 0 : writeLocation + 1 ; if ( nextWriteLocation == capaci... |
public class WorkManagerUtil { /** * Get should distribute override
* @ param work The work instance
* @ return The override , if none return null */
public static Boolean getShouldDistribute ( DistributableWork work ) { } } | if ( work != null && work instanceof WorkContextProvider ) { List < WorkContext > contexts = ( ( WorkContextProvider ) work ) . getWorkContexts ( ) ; if ( contexts != null ) { for ( WorkContext wc : contexts ) { if ( wc instanceof DistributableContext ) { DistributableContext dc = ( DistributableContext ) wc ; return d... |
public class QueueManager { /** * Challange a QueueMemberStatusEvent . Called from AsteriskServerImpl
* whenever a member state changes .
* @ param event that was triggered by Asterisk server . */
void handleQueueMemberStatusEvent ( QueueMemberStatusEvent event ) { } } | AsteriskQueueImpl queue = getInternalQueueByName ( event . getQueue ( ) ) ; if ( queue == null ) { logger . error ( "Ignored QueueMemberStatusEvent for unknown queue " + event . getQueue ( ) ) ; return ; } AsteriskQueueMemberImpl member = queue . getMemberByLocation ( event . getLocation ( ) ) ; if ( member == null ) {... |
public class LocalQPConsumerKey { /** * Detach this consumer */
public void detach ( ) throws SIResourceException , SINotPossibleInCurrentConfigurationException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "detach" ) ; // Make sure we are not ready
notReady ( ) ; // Remove us from any group we are a member of
if ( keyGroup != null ) keyGroup . removeMember ( this ) ; // Remove this consumer from the CD ' s knowledge
consumerDi... |
public class FlyWeightFlatXmlDataSetBuilder { /** * Sets the flat XML input source from which the { @ link FlyWeightFlatXmlDataSet } is to be built
* @ param xmlReader The flat XML input as { @ link Reader }
* @ return The created { @ link FlyWeightFlatXmlDataSet }
* @ throws DataSetException */
public FlyWeightF... | InputSource inputSource = new InputSource ( xmlReader ) ; return buildInternal ( inputSource ) ; |
public class CompDiagMatrix { /** * Finds the size of the requested diagonal to be allocated */
private int getDiagSize ( int diagonal ) { } } | if ( diagonal < 0 ) return Math . min ( numRows + diagonal , numColumns ) ; else return Math . min ( numRows , numColumns - diagonal ) ; |
public class DnsBatch { /** * Adds a request representing the " list record sets " operation in the zone specified by { @ code
* zoneName } to this batch . The { @ code options } can be used to restrict the fields returned or
* provide page size limits in the same way as for { @ link Dns # listRecordSets ( String ,... | DnsBatchResult < Page < RecordSet > > result = new DnsBatchResult < > ( ) ; Map < DnsRpc . Option , ? > optionMap = DnsImpl . optionMap ( options ) ; RpcBatch . Callback < ResourceRecordSetsListResponse > callback = createListRecordSetsCallback ( zoneName , result , optionMap ) ; batch . addListRecordSets ( zoneName , ... |
public class GetJournalImageServlet { /** * Build path to fetch image at given txid for the given journal .
* This path does not contain address . */
public static String buildPath ( String journalId , long txid , NamespaceInfo nsInfo , boolean throttle ) { } } | StringBuilder path = new StringBuilder ( "/getImage?getimage=1&" ) ; try { path . append ( JOURNAL_ID_PARAM ) . append ( "=" ) . append ( URLEncoder . encode ( journalId , "UTF-8" ) ) ; path . append ( "&" + TXID_PARAM ) . append ( "=" ) . append ( txid ) ; path . append ( "&" + THROTTLE_PARAM ) . append ( "=" ) . appe... |
public class Visitors { /** * Using a visitor , obtain the { @ link Subquery } objects that are contained within the supplied { @ link Visitable object } . This
* method does find Subquery objets nested in other Subquery objects .
* @ param visitable the visitable
* @ param includeNestedSubqueries true if any Sub... | final Collection < Subquery > subqueries = new LinkedList < Subquery > ( ) ; Visitors . visitAll ( visitable , new Visitors . AbstractVisitor ( ) { @ Override public void visit ( Subquery subquery ) { subqueries . add ( subquery ) ; if ( includeNestedSubqueries ) { // Now look for any subqueries in the subquery . . .
s... |
public class ServerSets { /** * Creates a service instance object deserialized from byte array .
* @ param data the byte array contains a serialized Thrift service instance
* @ param codec the codec to use to deserialize the byte array */
public static ServiceInstance deserializeServiceInstance ( byte [ ] data , Co... | return codec . deserialize ( new ByteArrayInputStream ( data ) ) ; |
public class PredecessorReader { /** * Convert an integer to a RelationType instance .
* @ param type integer value
* @ return RelationType instance */
private RelationType getRelationType ( int type ) { } } | RelationType result ; if ( type > 0 && type < RELATION_TYPES . length ) { result = RELATION_TYPES [ type ] ; } else { result = RelationType . FINISH_START ; } return result ; |
public class AuthorizationFlow { /** * Creates a new credential for the given user ID based on the given token
* response and store in the credential store .
* @ param response implicit authorization token response
* @ param userId user ID or { @ code null } if not using a persisted credential
* store
* @ ret... | Credential credential = newCredential ( userId ) . setAccessToken ( implicitResponse . getAccessToken ( ) ) . setExpiresInSeconds ( implicitResponse . getExpiresInSeconds ( ) ) ; CredentialStore credentialStore = getCredentialStore ( ) ; if ( credentialStore != null ) { credentialStore . store ( userId , credential ) ;... |
public class CollectionJsonDeserializer { /** * < p > newInstance < / p >
* @ param deserializer { @ link JsonDeserializer } used to deserialize the objects inside the { @ link Collection } .
* @ param < T > Type of the elements inside the { @ link Collection }
* @ return a new instance of { @ link CollectionJson... | return new CollectionJsonDeserializer < T > ( deserializer ) ; |
public class InvokableAPIDescriptor { /** * Invoke the Java callback underlying this API descriptor . Note : this method
* may only be invoked after
* { @ link # canExecute ( IRequestWebScopeWithoutResponse , MutableInt ) } returned
* < code > true < / code > !
* @ param aRequestScope
* Current request scope ... | final IAPIExecutor aExecutor = m_aDescriptor . getExecutorFactory ( ) . get ( ) ; if ( aExecutor == null ) throw new IllegalStateException ( "Failed to created API executor for: " + toString ( ) ) ; // Go go go
aExecutor . invokeAPI ( m_aDescriptor , m_sPath , m_aPathVariables , aRequestScope , aUnifiedResponse ) ; |
public class ParserFactory { /** * D190462 - START */
public static Document parseDocument ( DocumentBuilder builder , File file ) throws IOException , SAXException { } } | final DocumentBuilder docBuilder = builder ; final File parsingFile = file ; try { return ( Document ) AccessController . doPrivileged ( new PrivilegedExceptionAction ( ) { public Object run ( ) throws SAXException , IOException { Thread currThread = Thread . currentThread ( ) ; ClassLoader oldLoader = currThread . get... |
public class DeviceInterface { public CommandInfo getCommandInfo ( String commandName ) { } } | for ( CommandInfo commandInfo : commandInfoList ) if ( commandInfo . cmd_name . toLowerCase ( ) . equals ( commandName . toLowerCase ( ) ) ) return commandInfo ; return null ; |
public class DistCp { /** * Initialize DFSCopyFileMapper specific job - configuration .
* @ param conf : The dfs / mapred configuration .
* @ param jobConf : The handle to the jobConf object to be initialized .
* @ param args Arguments
* @ return true if it is necessary to launch a job . */
private static boole... | jobConf . set ( DST_DIR_LABEL , args . dst . toUri ( ) . toString ( ) ) ; // set boolean values
final boolean update = args . flags . contains ( Options . UPDATE ) ; final boolean skipCRCCheck = args . flags . contains ( Options . SKIPCRC ) ; final boolean overwrite = ! update && args . flags . contains ( Options . OVE... |
public class JacksonRequest { /** * Converts a base URL , endpoint , and parameters into a full URL
* @ param method The { @ link com . android . volley . Request . Method } of the URL
* @ param baseUrl The base URL
* @ param endpoint The endpoint being hit
* @ param params The parameters to be appended to the ... | if ( params != null ) { for ( Map . Entry < String , String > entry : params . entrySet ( ) ) { if ( entry . getValue ( ) == null || entry . getValue ( ) . equals ( "null" ) ) { entry . setValue ( "" ) ; } } } if ( method == Method . GET && params != null && ! params . isEmpty ( ) ) { final StringBuilder result = new S... |
public class hqlLexer { /** * $ ANTLR start " NEW " */
public final void mNEW ( ) throws RecognitionException { } } | try { int _type = NEW ; int _channel = DEFAULT_TOKEN_CHANNEL ; // hql . g : 47:5 : ( ' new ' )
// hql . g : 47:7 : ' new '
{ match ( "new" ) ; if ( state . failed ) return ; } state . type = _type ; state . channel = _channel ; } finally { // do for sure before leaving
} |
public class ListInstanceProfilesResult { /** * An object containing information about your instance profiles .
* @ param instanceProfiles
* An object containing information about your instance profiles . */
public void setInstanceProfiles ( java . util . Collection < InstanceProfile > instanceProfiles ) { } } | if ( instanceProfiles == null ) { this . instanceProfiles = null ; return ; } this . instanceProfiles = new java . util . ArrayList < InstanceProfile > ( instanceProfiles ) ; |
public class UNode { /** * Get the value of the child VALUE node ( member ) of this UNode with the given name .
* If this is not a MAP , has no children , there is no child node with the given name ,
* or the child node isn ' t a VALUE node , then null is returned .
* @ param name Candidate name of a child member... | if ( m_childNodeMap == null ) { return null ; } UNode childNode = m_childNodeMap . get ( name ) ; return childNode != null && childNode . isValue ( ) ? childNode . getValue ( ) : null ; |
public class ConvertRaster { /** * A faster convert that works directly with a specific raster */
static void bufferedToPlanar_F32 ( DataBufferByte buffer , WritableRaster src , Planar < GrayF32 > dst ) { } } | byte [ ] srcData = buffer . getData ( ) ; int numBands = src . getNumBands ( ) ; int srcStride = stride ( src ) ; int srcOffset = getOffset ( src ) ; if ( BoofConcurrency . USE_CONCURRENT ) { if ( numBands == 3 ) { ImplConvertRaster_MT . from_3BU8_to_PLF32 ( srcData , srcStride , srcOffset , dst ) ; } else if ( numBand... |
public class XmlObjectSerializer { /** * Set the output of the serializer .
* @ param serializerContext
* A { @ link SerializerContext } .
* @ param out
* The { @ link OutputStream } to write to .
* @ param charset
* The charset . The serializer will use " UTF - 8 " if this is < code > null < / code > .
*... | try { serializerContext . serializer . setOutput ( out , charset == null ? "UTF-8" : charset ) ; } catch ( IllegalArgumentException e ) { throw new SerializerException ( "can't configure serializer" , e ) ; } catch ( IllegalStateException e ) { throw new SerializerException ( "can't configure serializer" , e ) ; } retu... |
public class CollectionUtil { /** * Helper method to easily create a map .
* Takes as input a varargs containing the key1 , value1 , key2 , value2 , etc . Note : although an Object , we will cast the key to String internally . */
public static Map < String , Object > map ( Object ... objects ) { } } | if ( objects . length % 2 != 0 ) { throw new ActivitiIllegalArgumentException ( "The input should always be even since we expect a list of key-value pairs!" ) ; } Map < String , Object > map = new HashMap < String , Object > ( ) ; for ( int i = 0 ; i < objects . length ; i += 2 ) { map . put ( ( String ) objects [ i ] ... |
public class StringValueMap { /** * Appends new elements to this map .
* @ param map a map with elements to be added . */
public void append ( Map < ? , ? > map ) { } } | if ( map == null || map . size ( ) == 0 ) return ; for ( Map . Entry < ? , ? > entry : map . entrySet ( ) ) { put ( StringConverter . toString ( entry . getKey ( ) ) , StringConverter . toNullableString ( entry . getValue ( ) ) ) ; } |
public class Iterables { /** * Note : copy from Google Guava under Apache License v2.
* < br / >
* Returns a { @ link Collection } of all the permutations of the specified
* { @ link Iterable } .
* < p > < i > Notes : < / i > This is an implementation of the algorithm for
* Lexicographical Permutations Genera... | return orderedPermutations ( elements , Comparators . naturalOrder ( ) ) ; |
public class GreetingServiceImpl { /** * Escape an html string . Escaping data received from the client helps to
* prevent cross - site script vulnerabilities .
* @ param html the html string to escape
* @ return the escaped string */
private String escapeHtml ( String html ) { } } | if ( html == null ) { return null ; } return html . replaceAll ( "&" , "&" ) . replaceAll ( "<" , "<" ) . replaceAll ( ">" , ">" ) ; |
public class SubQuery { /** * This results in the following sort order :
* view subqueries , then other subqueries
* view subqueries :
* views sorted by creation order ( earlier declaration first )
* other subqueries :
* subqueries sorted by depth within select query ( deep = = higher level ) */
@ Override pu... | SubQuery sqa = ( SubQuery ) a ; SubQuery sqb = ( SubQuery ) b ; if ( sqa . parentView == null && sqb . parentView == null ) { return sqb . level - sqa . level ; } else if ( sqa . parentView != null && sqb . parentView != null ) { int ia = database . schemaManager . getTableIndex ( sqa . parentView ) ; int ib = database... |
public class InheritedChannel { /** * If standard inherited channel is connected to a socket then return a Channel
* of the appropriate type based standard input . */
private static Channel createChannel ( ) throws IOException { } } | // dup the file descriptor - we do this so that for two reasons : -
// 1 . Avoids any timing issues with FileDescriptor . in being closed
// or redirected while we create the channel .
// 2 . Allows streams based on file descriptor 0 to co - exist with
// the channel ( closing one doesn ' t impact the other )
int fdVal... |
public class IntAVLTree { /** * Return the largest node under < code > node < / code > . */
public int last ( int node ) { } } | while ( true ) { final int right = right ( node ) ; if ( right == NIL ) { break ; } node = right ; } return node ; |
public class Range { /** * Given a list of unwrapped ranges sorted by left position , return an
* equivalent list of ranges but with no overlapping ranges . */
private static < T extends RingPosition < T > > List < Range < T > > deoverlap ( List < Range < T > > ranges ) { } } | if ( ranges . isEmpty ( ) ) return ranges ; List < Range < T > > output = new ArrayList < Range < T > > ( ) ; Iterator < Range < T > > iter = ranges . iterator ( ) ; Range < T > current = iter . next ( ) ; @ SuppressWarnings ( "unchecked" ) T min = ( T ) current . partitioner . minValue ( current . left . getClass ( ) ... |
public class ControlBuilder { /** * Tells if the specified directory is ignored by default ( . svn , cvs , etc )
* @ param directory */
private boolean isDefaultExcludes ( File directory ) { } } | for ( String pattern : DirectoryScanner . getDefaultExcludes ( ) ) { if ( DirectoryScanner . match ( pattern , directory . getAbsolutePath ( ) . replace ( "\\" , "/" ) ) ) { return true ; } } return false ; |
public class SnapshotFile { /** * Creates a snapshot file name from the given parameters . */
@ VisibleForTesting static String createSnapshotFileName ( String serverName , long index ) { } } | return String . format ( "%s-%d.%s" , serverName , index , EXTENSION ) ; |
public class HttpURLConnection { /** * Set the method for the URL request , one of :
* < UL >
* < LI > GET
* < LI > POST
* < LI > HEAD
* < LI > OPTIONS
* < LI > PUT
* < LI > DELETE
* < LI > TRACE
* < / UL > are legal , subject to protocol restrictions . The default
* method is GET .
* @ param meth... | if ( connected ) { throw new ProtocolException ( "Can't reset method: already connected" ) ; } // This restriction will prevent people from using this class to
// experiment w / new HTTP methods using java . But it should
// be placed for security - the request String could be
// arbitrarily long .
for ( int i = 0 ; i ... |
public class InternalPyExprUtils { /** * Wraps an expression with the proper SanitizedContent constructor .
* @ param contentKind The kind of sanitized content .
* @ param pyExpr The expression to wrap . */
static PyExpr wrapAsSanitizedContent ( SanitizedContentKind contentKind , PyExpr pyExpr ) { } } | String sanitizer = NodeContentKinds . toPySanitizedContentOrdainer ( contentKind ) ; String approval = "sanitize.IActuallyUnderstandSoyTypeSafetyAndHaveSecurityApproval(" + "'Internally created Sanitization.')" ; return new PyExpr ( sanitizer + "(" + pyExpr . getText ( ) + ", approval=" + approval + ")" , Integer . MAX... |
public class ElementWithCardinalityImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case SimpleAntlrPackage . ELEMENT_WITH_CARDINALITY__ELEMENT : return element != null ; case SimpleAntlrPackage . ELEMENT_WITH_CARDINALITY__CARDINALITY : return CARDINALITY_EDEFAULT == null ? cardinality != null : ! CARDINALITY_EDEFAULT . equals ( cardinality ) ; } return super . eIsSet ( featureI... |
public class VideoDescriptionMarshaller { /** * Marshall the given parameter object . */
public void marshall ( VideoDescription videoDescription , ProtocolMarshaller protocolMarshaller ) { } } | if ( videoDescription == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( videoDescription . getAfdSignaling ( ) , AFDSIGNALING_BINDING ) ; protocolMarshaller . marshall ( videoDescription . getAntiAlias ( ) , ANTIALIAS_BINDING ) ; protocolMa... |
public class NativeJpegTranscoder { /** * Transcodes an image to match the specified exif orientation and the scale factor .
* @ param inputStream The { @ link InputStream } of the image that will be transcoded .
* @ param outputStream The { @ link OutputStream } where the newly created image is written to .
* @ ... | NativeJpegTranscoderSoLoader . ensure ( ) ; Preconditions . checkArgument ( scaleNumerator >= MIN_SCALE_NUMERATOR ) ; Preconditions . checkArgument ( scaleNumerator <= MAX_SCALE_NUMERATOR ) ; Preconditions . checkArgument ( quality >= MIN_QUALITY ) ; Preconditions . checkArgument ( quality <= MAX_QUALITY ) ; Preconditi... |
public class DirectionalComponent { /** * Gets the { @ link PropertyDirection } used by the block .
* @ param block the block
* @ return the property */
public static PropertyDirection getProperty ( Block block ) { } } | DirectionalComponent dc = IComponent . getComponent ( DirectionalComponent . class , block ) ; return dc != null ? dc . getProperty ( ) : null ; |
public class VirtualNetworksInner { /** * Gets the specified virtual network by resource group .
* @ param resourceGroupName The name of the resource group .
* @ param virtualNetworkName The name of the virtual network .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws Clo... | return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , virtualNetworkName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class TypeName { /** * Returns an unboxed type if this is a boxed primitive type ( like { @ code int } for { @ code
* Integer } ) or { @ code Void } . Returns this type if it is already unboxed .
* @ throws UnsupportedOperationException if this type isn ' t eligible for unboxing . */
public TypeName unbox ( ... | if ( keyword != null ) return this ; // Already unboxed .
if ( this . equals ( BOXED_VOID ) ) return VOID ; if ( this . equals ( BOXED_BOOLEAN ) ) return BOOLEAN ; if ( this . equals ( BOXED_BYTE ) ) return BYTE ; if ( this . equals ( BOXED_SHORT ) ) return SHORT ; if ( this . equals ( BOXED_INT ) ) return INT ; if ( t... |
public class SortedCursor { /** * Creates a dotted name string using the bean property names . */
private static String chainToBeanString ( ChainedProperty property ) { } } | int count = property . getChainCount ( ) ; if ( count <= 0 ) { return property . getPrimeProperty ( ) . getBeanName ( ) ; } StringBuilder b = new StringBuilder ( ) ; b . append ( property . getPrimeProperty ( ) . getBeanName ( ) ) ; for ( int i = 0 ; i < count ; i ++ ) { b . append ( '.' ) ; b . append ( property . get... |
public class AcroFields { /** * Adds a substitution font to the list . The fonts in this list will be used if the original
* font doesn ' t contain the needed glyphs .
* @ param font the font */
public void addSubstitutionFont ( BaseFont font ) { } } | if ( substitutionFonts == null ) substitutionFonts = new ArrayList ( ) ; substitutionFonts . add ( font ) ; |
public class XmlSchemaParser { /** * Check name against validity for C + + and Java naming . Warning if not valid .
* @ param node to have the name checked .
* @ param name of the node to be checked . */
public static void checkForValidName ( final Node node , final String name ) { } } | if ( ! ValidationUtil . isSbeCppName ( name ) ) { handleWarning ( node , "name is not valid for C++: " + name ) ; } if ( ! ValidationUtil . isSbeJavaName ( name ) ) { handleWarning ( node , "name is not valid for Java: " + name ) ; } if ( ! ValidationUtil . isSbeGolangName ( name ) ) { handleWarning ( node , "name is n... |
public class JBBPParser { /** * Prepare a parser for a script with default bit order ( LSB0 ) use and with defined custom type field processor .
* @ param script a text script contains field order and types reference , it
* must not be null
* @ param customFieldTypeProcessor custom field type processor , can be n... | return JBBPParser . prepare ( script , JBBPBitOrder . LSB0 , customFieldTypeProcessor , 0 ) ; |
public class ApiFutureUtils { /** * Creates api future from ValueSourceFuture . We have to send all Future API calls to ValueSourceFuture . */
public static < T > ApiFuture < T > createApiFuture ( ValueSourceFuture < T > valueSourceFuture ) { } } | if ( valueSourceFuture instanceof ApiFutureBackedValueSourceFuture ) { return ( ( ApiFutureBackedValueSourceFuture < T > ) valueSourceFuture ) . getWrappedFuture ( ) ; } else { return new ValueSourceFutureBackedApiFuture < > ( valueSourceFuture ) ; } |
public class FlowTypeCheck { /** * Check the type for a given arithmetic operator . Such an operator has the type
* int , and all children should also produce values of type int .
* @ param expr
* @ return */
private SemanticType checkIntegerOperator ( Expr . BinaryOperator expr , Environment environment ) { } } | checkOperand ( Type . Int , expr . getFirstOperand ( ) , environment ) ; checkOperand ( Type . Int , expr . getSecondOperand ( ) , environment ) ; return Type . Int ; |
public class VertexAttribute { /** * Replaces the current buffer data with a copy of the given { @ link java . nio . ByteBuffer } This method arbitrarily creates data for the ByteBuffer regardless of the data type of the vertex
* attribute .
* @ param buffer to set */
public void setData ( ByteBuffer buffer ) { } } | buffer . rewind ( ) ; this . buffer = CausticUtil . createByteBuffer ( buffer . capacity ( ) ) ; this . buffer . put ( buffer ) ; |
public class WebServiceConfiguration { /** * { @ inheritDoc } */
@ Override public void validate ( ) { } } | // Check if endpoint has been specified .
if ( StringUtil . isBlank ( endpoint ) ) { throw new IllegalArgumentException ( "Endpoint cannot be null or empty." ) ; } // Check if servicename has been specified .
if ( StringUtil . isBlank ( servicename ) ) { throw new IllegalArgumentException ( "Service name cannot be null... |
public class AbstractResourceBundleHandler { /** * ( non - Javadoc )
* @ see
* net . jawr . web . resource . ResourceHandler # storeJawrBundleMapping ( java . util
* . Properties ) */
@ Override public void storeJawrBundleMapping ( Properties bundleMapping ) { } } | File bundleMappingFile = new File ( tempDirPath , mappingFileName ) ; OutputStream out = null ; try { out = new FileOutputStream ( bundleMappingFile ) ; bundleMapping . store ( out , "Jawr mapping" ) ; } catch ( IOException e ) { LOGGER . error ( "Unable to store the bundle mapping" ) ; } finally { IOUtils . close ( ou... |
public class Vectors { /** * Returns true if vectors ( x1 , y1 ) and ( x2 , y2 ) are aligned ( ox , oy ) centered
* coordinate .
* @ param ox
* @ param oy
* @ param x1
* @ param y1
* @ param x2
* @ param y2
* @ return */
public static final boolean areAligned ( double ox , double oy , double x1 , double... | return areAligned ( x1 - ox , y1 - oy , x2 - ox , y2 - oy ) ; |
public class AtomContainerRenderer { /** * Given a bond length for a model , calculate the scale that will transform
* this length to the on screen bond length in RendererModel .
* @ param modelBondLength the average bond length of the model
* @ return the scale necessary to transform this to a screen bond */
@ O... | if ( Double . isNaN ( modelBondLength ) || modelBondLength == 0 ) { return DEFAULT_SCALE ; } else { return rendererModel . getParameter ( BondLength . class ) . getValue ( ) / modelBondLength ; } |
public class XMLWriterSettings { /** * Set the serialization charset .
* @ param aCharset
* The charset to be used . May not be < code > null < / code > .
* @ return this */
@ Nonnull public final XMLWriterSettings setCharset ( @ Nonnull final Charset aCharset ) { } } | m_aCharset = ValueEnforcer . notNull ( aCharset , "Charset" ) ; return this ; |
public class CoreRemoteMongoCollectionImpl { /** * Finds all documents in the collection .
* @ param filter the query filter
* @ param resultClass the class to decode each document into
* @ param < ResultT > the target document type of the iterable .
* @ return the find iterable interface */
public < ResultT > ... | return createFindIterable ( filter , resultClass ) ; |
public class MarkdownParser { /** * Create the id of a section header .
* < p > The ID format follows the ReadCarpet standards .
* @ param headerNumber the number of the header , or { @ code null } .
* @ param headerText the section header text .
* @ return the identifier . */
public static String computeHeader... | final String fullText = Strings . emptyIfNull ( headerNumber ) + " " + Strings . emptyIfNull ( headerText ) ; // $ NON - NLS - 1 $
return computeHeaderId ( fullText ) ; |
public class TypeDefUtils { /** * Convert an { @ link javax . lang . model . element . ExecutableElement } to a { @ link io . sundr . codegen . model . TypeDef }
* @ param context The context of the operation .
* @ param executableElement The target element .
* @ return An instance of { @ link io . sundr . codege... | // Do generate the interface
Boolean multiple = executableElement . getAnnotation ( Multiple . class ) != null ; Boolean isEntryPoint = executableElement . getAnnotation ( EntryPoint . class ) != null ; Boolean isTerminal = executableElement . getAnnotation ( Terminal . class ) != null || ! isVoid ( executableElement )... |
public class ProcessGroovyMethods { /** * Gets the output and error streams from a process and reads them
* to keep the process from blocking due to a full output buffer .
* The processed stream data is appended to the supplied Appendable .
* For this , two Threads are started , so this method will return immedia... | consumeProcessOutputStream ( self , output ) ; consumeProcessErrorStream ( self , error ) ; |
public class DurationUtilImpl { /** * This method gets the singleton instance of { @ link DurationUtil } . < br >
* < b > ATTENTION : < / b > < br >
* Please prefer dependency - injection instead of using this method .
* @ return the singleton instance . */
public static DurationUtil getInstance ( ) { } } | if ( instance == null ) { synchronized ( DurationUtilImpl . class ) { if ( instance == null ) { instance = new DurationUtilImpl ( ) ; } } } return instance ; |
public class JdbcMapperFactory { /** * Will create a DynamicMapper on the specified type .
* @ param target the type
* @ param < T > the jdbcMapper target type
* @ return the DynamicMapper */
public < T > DynamicJdbcMapper < T > newMapper ( final Type target ) { } } | final ClassMeta < T > classMeta = getClassMeta ( target ) ; return new DynamicJdbcSetRowMapper < T > ( new SetRowMapperFactory < T > ( classMeta ) , new MapperKeyFactory ( ) , new MapperKeyFactory ( ) ) ; |
public class HtmlDocletWriter { /** * Adds the user specified bottom .
* @ param body the content tree to which user specified bottom will be added */
public void addBottom ( Content body ) { } } | Content bottom = new RawHtml ( replaceDocRootDir ( configuration . bottom ) ) ; Content small = HtmlTree . SMALL ( bottom ) ; Content p = HtmlTree . P ( HtmlStyle . legalCopy , small ) ; body . addContent ( p ) ; |
public class CommercePriceListPersistenceImpl { /** * Returns the first commerce price list in the ordered set where companyId = & # 63 ; .
* @ param companyId the company ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commer... | CommercePriceList commercePriceList = fetchByCompanyId_First ( companyId , orderByComparator ) ; if ( commercePriceList != null ) { return commercePriceList ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "companyId=" ) ; msg . append ( companyId ) ; msg . ap... |
public class MapConstraints { /** * Returns a constrained view of the specified set multimap , using the
* specified constraint . Any operations that add new mappings will call the
* provided constraint . However , this method does not verify that existing
* mappings satisfy the constraint .
* < p > Note that t... | return new ConstrainedSetMultimap < K , V > ( multimap , constraint ) ; |
public class xen_health_resource_sw { /** * < pre >
* Converts API response of bulk operation into object and returns the object array in case of get request .
* < / pre > */
protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } } | xen_health_resource_sw_responses result = ( xen_health_resource_sw_responses ) service . get_payload_formatter ( ) . string_to_resource ( xen_health_resource_sw_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro... |
public class RollingFileAppender { /** * { @ inheritDoc } */
protected void subAppend ( final LoggingEvent event ) { } } | // The rollover check must precede actual writing . This is the
// only correct behavior for time driven triggers .
AccessController . doPrivileged ( new PrivilegedAction < Void > ( ) { @ Override public Void run ( ) { if ( triggeringPolicy . isTriggeringEvent ( RollingFileAppender . this , event , getFile ( ) , getFil... |
public class YahooFinance { /** * Sends a request with the historical quotes included
* starting from the specified { @ link Calendar } date
* at the default interval ( monthly ) .
* Returns null if the data can ' t be retrieved from Yahoo Finance .
* @ param symbol the symbol of the stock for which you want to... | return YahooFinance . get ( symbol , from , HistQuotesRequest . DEFAULT_TO , HistQuotesRequest . DEFAULT_INTERVAL ) ; |
public class AmazonAppStreamClient { /** * Retrieves the name of the stack with which the specified fleet is associated .
* @ param listAssociatedStacksRequest
* @ return Result of the ListAssociatedStacks operation returned by the service .
* @ sample AmazonAppStream . ListAssociatedStacks
* @ see < a href = "... | request = beforeClientExecution ( request ) ; return executeListAssociatedStacks ( request ) ; |
public class JsonObject { /** * Sets the value of the member with the specified name to the JSON representation of the
* specified < code > int < / code > value . If this object does not contain a member with this name , a
* new member is added at the end of the object . If this object contains multiple members wit... | set ( name , Json . value ( value ) ) ; return this ; |
public class CmsXmlContainerPageHandler { /** * Validates container names , so that they are unique in the page . < p >
* @ param cms the cms context
* @ param value the value to validate
* @ param content the container page to validate
* @ throws CmsXmlException if there are duplicated names */
protected void ... | // get the current name
Locale locale = value . getLocale ( ) ; String namePath = CmsXmlUtils . concatXpath ( value . getPath ( ) , CmsXmlContainerPage . XmlNode . Name . name ( ) ) ; String name = content . getValue ( namePath , locale ) . getStringValue ( cms ) ; // iterate over all containers
Iterator < I_CmsXmlCont... |
public class ServletRegistrationBean { /** * Configure registration settings . Subclasses can override this method to perform
* additional configuration if required .
* @ param registration the registration */
@ Override protected void configure ( ServletRegistration . Dynamic registration ) { } } | super . configure ( registration ) ; String [ ] urlMapping = StringUtils . toStringArray ( this . urlMappings ) ; if ( urlMapping . length == 0 && this . alwaysMapUrl ) { urlMapping = DEFAULT_MAPPINGS ; } if ( ! ObjectUtils . isEmpty ( urlMapping ) ) { registration . addMapping ( urlMapping ) ; } registration . setLoad... |
public class Kb { /** * ZAP : Added the type arguments . */
private void add ( TreeMap < String , Object > map , String key , Object value ) { } } | // ZAP : Added the type argument .
Vector < Object > v = getList ( map , key ) ; if ( v == null ) { // ZAP : Added the type argument .
v = new Vector < > ( ) ; synchronized ( map ) { map . put ( key , v ) ; } } if ( ! v . contains ( value ) ) { v . add ( value ) ; } |
public class ChannelSelector { /** * * Selects a set of keys whose corresponding channels are ready for I / O operations .
* This method performs a non - blocking selection operation . If no channels have become selectable since the previous
* selection operation then this method immediately returns empty selected ... | FastSet < ChannelSelectionKey > selectedKey = new FastSet < ChannelSelectionKey > ( ) ; selector . selectNow ( ) ; Set < SelectionKey > selection = selector . selectedKeys ( ) ; for ( SelectionKey key : selection ) { ChannelSelectionKey k = ( ChannelSelectionKey ) key . attachment ( ) ; try { if ( key . isValid ( ) ) {... |
public class HelloSignClient { /** * Creates a template draft that can be used for embedded template creation .
* @ param req EmbeddedRequest
* @ return Template the unclaimed template draft
* @ throws HelloSignException thrown if there ' s a problem processing the
* HTTP request or the JSON response . */
publi... | return new TemplateDraft ( httpClient . withAuth ( auth ) . withPostFields ( req . getPostFields ( ) ) . post ( BASE_URI + TEMPLATE_CREATE_EMBEDDED_DRAFT_URI ) . asJson ( ) ) ; |
public class FileLocator { /** * Get a list of all sub - directories ( as Files ) located in the provided
* directory
* @ param root
* Starting directory
* @ return List of File objects ( one per sub - directory ) , or null
* @ see File # listFiles ( FileFilter ) */
public static List < File > getDirectories ... | if ( root == null ) return Collections . emptyList ( ) ; FileFilter filter = new DirsOnlyFilter ( ) ; File fileList [ ] = root . listFiles ( filter ) ; if ( fileList == null ) return Collections . emptyList ( ) ; else return Arrays . asList ( fileList ) ; |
public class HBCIUtils { /** * Wandelt ein Byte - Array in eine entsprechende hex - Darstellung um .
* @ param data das Byte - Array , für das eine Hex - Darstellung erzeugt werden soll
* @ return einen String , der für jedes Byte aus < code > data < / code >
* zwei Zeichen ( 0-9 , A - F ) enthält . */
public ... | StringBuffer ret = new StringBuffer ( ) ; for ( int i = 0 ; i < data . length ; i ++ ) { String st = Integer . toHexString ( data [ i ] ) ; if ( st . length ( ) == 1 ) { st = '0' + st ; } st = st . substring ( st . length ( ) - 2 ) ; ret . append ( st ) . append ( " " ) ; } return ret . toString ( ) ; |
public class AbstractHBCIJob { /** * speichert die HBCI - Rückgabewerte für diesen GV im outStore ab . Dazu
* werden alle RetSegs durchgesehen ; diejenigen , die den aktuellen GV
* betreffen , werden im @ c data Property unter dem namen @ c ret _ i . *
* gespeichert . @ i entspricht dabei dem @ c retValCounter ... | List < HBCIRetVal > retVals = status . segStatus . getRetVals ( ) ; String segref = Integer . toString ( sref ) ; retVals . forEach ( retVal -> { if ( retVal . segref != null && retVal . segref . equals ( segref ) ) { jobResult . jobStatus . addRetVal ( retVal ) ; } } ) ; /* bei Jobs , die mehrere Nachrichten benötigt... |
public class DTMNodeProxy { /** * Method hasAttribute
* @ param name */
public boolean hasAttribute ( String name ) { } } | return DTM . NULL != dtm . getAttributeNode ( node , null , name ) ; |
public class XMLDataStorer { /** * Initializes XML - Data .
* @ param classname
* Name of the testclass */
public void createXMLData ( final String classname ) { } } | data = new Kopemedata ( ) ; data . setTestcases ( new Testcases ( ) ) ; final Testcases tc = data . getTestcases ( ) ; tc . setClazz ( classname ) ; storeData ( ) ; |
public class FeedTaskFactoryImpl { /** * { @ inheritDoc } */
@ Override public FeedDownloadTask get ( CombinedFeed feed ) { } } | return new FeedDownloadTask ( feedDownloader , datastore , feed . getId ( ) ) ; |
public class HttpRequest { /** * < pre >
* The scheme ( http , https ) , the host name , the path and the query
* portion of the URL that was requested .
* Example : ` " http : / / example . com / some / info ? color = red " ` .
* < / pre >
* < code > string request _ url = 2 ; < / code > */
public java . lan... | java . lang . Object ref = requestUrl_ ; if ( ref instanceof java . lang . String ) { return ( java . lang . String ) ref ; } else { com . google . protobuf . ByteString bs = ( com . google . protobuf . ByteString ) ref ; java . lang . String s = bs . toStringUtf8 ( ) ; requestUrl_ = s ; return s ; } |
public class XMLGISElementUtil { /** * Read a map element from the XML description .
* @ param < T > is the type of the element to create .
* @ param element is the XML node to read .
* @ param elementNodeName is the name of the XML node that should contains the map element data .
* It must be one of { @ link #... | "unchecked" , "checkstyle:cyclomaticcomplexity" , "checkstyle:npathcomplexity" } ) public static < T extends MapElement > T readMapElement ( Element element , String elementNodeName , Class < T > type , PathBuilder pathBuilder , XMLResources resources ) throws IOException { final UUID id = XMLUtil . getAttributeUUIDWit... |
public class InternalAnnotationDefinitionConverter { /** * { @ inheritDoc } */
@ Override public XBELInternalAnnotationDefinition convert ( AnnotationDefinition t ) { } } | if ( t == null || t . getURL ( ) != null ) { return null ; } XBELInternalAnnotationDefinition dest = new XBELInternalAnnotationDefinition ( ) ; String description = t . getDescription ( ) ; String id = t . getId ( ) ; String usage = t . getUsage ( ) ; // If null , set equal to an empty string so that the document can b... |
public class MathUtil { /** * Find the next power of 2.
* Classic bit operation , for signed 32 - bit . Valid for positive integers only
* ( 0 otherwise ) .
* @ param x original integer
* @ return Next power of 2 */
public static int nextPow2Int ( int x ) { } } | -- x ; x |= x >>> 1 ; x |= x >>> 2 ; x |= x >>> 4 ; x |= x >>> 8 ; x |= x >>> 16 ; return ++ x ; |
public class ProjectClient { /** * Moves a persistent disk from one zone to another .
* < p > Sample code :
* < pre > < code >
* try ( ProjectClient projectClient = ProjectClient . create ( ) ) {
* ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ;
* DiskMoveRequest diskMoveRequestResource = DiskMov... | MoveDiskProjectHttpRequest request = MoveDiskProjectHttpRequest . newBuilder ( ) . setProject ( project ) . setDiskMoveRequestResource ( diskMoveRequestResource ) . build ( ) ; return moveDiskProject ( request ) ; |
public class AssociateSurfBasic { /** * Splits the set of input features into positive and negative laplacian lists .
* Keep track of the feature ' s index in the original input list . This is
* the index that needs to be returned . */
private void sort ( FastQueue < BrightFeature > input , FastQueue < Helper > pos... | pos . reset ( ) ; neg . reset ( ) ; for ( int i = 0 ; i < input . size ; i ++ ) { BrightFeature f = input . get ( i ) ; if ( f . white ) { pos . grow ( ) . wrap ( f , i ) ; } else { neg . grow ( ) . wrap ( f , i ) ; } } |
public class DescribeStackResourceDriftsRequest { /** * The resource drift status values to use as filters for the resource drift results returned .
* < ul >
* < li >
* < code > DELETED < / code > : The resource differs from its expected template configuration in that the resource has been
* deleted .
* < / l... | if ( stackResourceDriftStatusFilters == null ) { stackResourceDriftStatusFilters = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return stackResourceDriftStatusFilters ; |
public class Disruptor { /** * Create a group of event processors to be used as a dependency .
* @ param processors the event processors , previously set up with { @ link # handleEventsWith ( com . lmax . disruptor . EventProcessor . . . ) } ,
* that will form the barrier for subsequent handlers or processors .
*... | for ( final EventProcessor processor : processors ) { consumerRepository . add ( processor ) ; } return new EventHandlerGroup < > ( this , consumerRepository , Util . getSequencesFor ( processors ) ) ; |
public class RebootRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( RebootRequest rebootRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( rebootRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( rebootRequest . getWorkspaceId ( ) , WORKSPACEID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessa... |
public class InternalAuthentication { /** * Save user lists to the file on the disk
* @ throws IOException if fail to save to file */
private void saveUsers ( ) throws IOException { } } | if ( file_store != null ) { try { file_store . store ( new FileOutputStream ( file_path ) , "" ) ; } catch ( Exception e ) { throw new IOException ( e ) ; } } |
public class XAbstractFeatureCallImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case XbasePackage . XABSTRACT_FEATURE_CALL__FEATURE : return feature != null ; case XbasePackage . XABSTRACT_FEATURE_CALL__TYPE_ARGUMENTS : return typeArguments != null && ! typeArguments . isEmpty ( ) ; case XbasePackage . XABSTRACT_FEATURE_CALL__IMPLICIT_RECEIVER : return implicitReceiver != nu... |
public class DynamicAccessImpl { /** * Maybe these methods ' exposure needs to be re - thought ? */
public FieldSearchResult findObjects ( Context context , String [ ] resultFields , int maxResults , FieldSearchQuery query ) throws ServerException { } } | return null ; |
public class OpenALStreamPlayer { /** * Seeks to a position in the music .
* @ param position Position in seconds .
* @ return True if the setting of the position was successful */
public boolean setPosition ( float position ) { } } | try { if ( getPosition ( ) > position ) { initStreams ( ) ; } float sampleRate = audio . getRate ( ) ; float sampleSize ; if ( audio . getChannels ( ) > 1 ) { sampleSize = 4 ; // AL10 . AL _ FORMAT _ STEREO16
} else { sampleSize = 2 ; // AL10 . AL _ FORMAT _ MONO16
} while ( positionOffset < position ) { int count = au... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.