signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class LBiCharFunctionBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */
@ Nonnull public static < R > LBiCharFunction < R > biCharFunctionFrom ( Consumer < LBiCharFunctionBuilder < R > > buildingFunction ) { ... | LBiCharFunctionBuilder builder = new LBiCharFunctionBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class IntBitRelation { /** * Returns all right values from the relation that have the
* left value specified .
* @ param left left value required
* @ param result where to return the result */
public void addRightWhere ( int left , IntBitSet result ) { } } | if ( line [ left ] != null ) { result . addAll ( line [ left ] ) ; } |
public class StrutsUtil { /** * Return a boolean property value or the default
* @ param msg MessageResources object
* @ param pname String name of the property
* @ param def boolean default value
* @ return boolean property value or default
* @ throws Throwable on error */
public static boolean getBoolProper... | String p = msg . getMessage ( pname ) ; if ( p == null ) { return def ; } return Boolean . valueOf ( p ) ; |
public class CollectionFactory { /** * Sort a copy of the input collection ; if the ordering is unstable and an
* error is thrown ( due to the use of TimSort in JDK 1.7 and newer ) , catch
* it and leave the collection unsorted . NOTE : use this method if ordering
* is desirable but not necessary .
* @ param to... | List < T > list = new ArrayList < > ( toReturn ) ; try { Collections . sort ( list ) ; } catch ( IllegalArgumentException e ) { // catch possible sorting misbehaviour
if ( ! e . getMessage ( ) . contains ( "Comparison method violates its general contract!" ) ) { throw e ; } // otherwise print a warning and leave the li... |
public class GroupDeviceElement { /** * Ping the underlying device , return true if alive , false otherwise */
@ Override boolean ping_i ( final boolean fwd ) { } } | if ( proxy == null ) { return false ; } try { proxy . ping ( ) ; } catch ( final DevFailed df ) { return false ; } return true ; |
public class SqlDocument { /** * Override to apply syntax highlighting after the document has been updated */
public void insertString ( int offset , String str , AttributeSet a ) throws BadLocationException { } } | if ( str . equals ( "{" ) ) str = addMatchingBrace ( offset ) ; super . insertString ( offset , str , a ) ; processChangedLines ( offset , str . length ( ) ) ; |
public class Roles { /** * For creating a new role or a new role / user relationship . */
@ Override @ Path ( "/{roleName}/users/{cuid}" ) @ ApiOperation ( value = "Create a role or add a user to an existing role" , notes = "If users/{cuid} is present, user is added to role." , response = StatusMessage . class ) @ ApiI... | @ ApiImplicitParam ( name = "Workgroup" , paramType = "body" , dataType = "com.centurylink.mdw.model.user.Role" ) } ) public JSONObject post ( String path , JSONObject content , Map < String , String > headers ) throws ServiceException , JSONException { String name = getSegment ( path , 1 ) ; String rel = getSegment ( ... |
public class RepositoryResourceImpl { /** * { @ inheritDoc } */
@ Override public String getProviderUrl ( ) { } } | return _asset . getProvider ( ) == null ? null : _asset . getProvider ( ) . getUrl ( ) ; |
public class PagedList { /** * Call this when mLowest / HighestIndexAccessed are changed , or
* mBoundaryCallbackBegin / EndDeferred is set . */
private void tryDispatchBoundaryCallbacks ( boolean post ) { } } | final boolean dispatchBegin = mBoundaryCallbackBeginDeferred && mLowestIndexAccessed <= mConfig . prefetchDistance ; final boolean dispatchEnd = mBoundaryCallbackEndDeferred && mHighestIndexAccessed >= size ( ) - 1 - mConfig . prefetchDistance ; if ( ! dispatchBegin && ! dispatchEnd ) { return ; } if ( dispatchBegin ) ... |
public class StudyEntry { public String getFormatAsString ( ) { } } | return impl . getFormat ( ) == null ? null : String . join ( ":" , impl . getFormat ( ) ) ; |
public class A_CmsSerialDateValue { /** * Set the end type as derived from other values . */
protected final void setDerivedEndType ( ) { } } | m_endType = getPatternType ( ) . equals ( PatternType . NONE ) || getPatternType ( ) . equals ( PatternType . INDIVIDUAL ) ? EndType . SINGLE : null != getSeriesEndDate ( ) ? EndType . DATE : EndType . TIMES ; |
public class RoboconfMessageQueue { /** * So , we only override offer ( ) . */
@ Override public boolean offer ( Message e ) { } } | boolean result = super . offer ( e ) ; if ( result ) { this . receivedMessagesCount . incrementAndGet ( ) ; this . timestampOfLastReceivedMessage . set ( new Date ( ) . getTime ( ) ) ; } return result ; |
public class GBOXImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . GBOX__RES : return RES_EDEFAULT == null ? res != null : ! RES_EDEFAULT . equals ( res ) ; case AfplibPackage . GBOX__XPOS0 : return XPOS0_EDEFAULT == null ? xpos0 != null : ! XPOS0_EDEFAULT . equals ( xpos0 ) ; case AfplibPackage . GBOX__YPOS0 : return YPOS0_EDEFAULT == null ... |
public class Record { /** * Create and initialize the record that has this class name .
* @ param className Full class name .
* @ param recordOwner The recordowner to add this record to .
* @ param bErrorIfNotFound Display an error if not found .
* @ return The new record . */
public static Record makeRecordFro... | Record record = null ; try { record = ( Record ) ClassServiceUtility . getClassService ( ) . makeObjectFromClassName ( className , null , bErrorIfNotFound ) ; } catch ( RuntimeException ex ) { if ( className . startsWith ( "." ) ) if ( recordOwner != null ) if ( ! recordOwner . getClass ( ) . getName ( ) . startsWith (... |
public class DefaultTokenManager { /** * Set the client config that is been used on the s3client
* @ param clientConfiguration */
public void setClientConfiguration ( ClientConfiguration clientConfiguration ) { } } | this . clientConfiguration = clientConfiguration ; if ( clientConfiguration != null ) { this . httpClientSettings = HttpClientSettings . adapt ( clientConfiguration ) ; if ( getProvider ( ) instanceof DefaultTokenProvider ) { DefaultTokenProvider defaultProvider = ( DefaultTokenProvider ) getProvider ( ) ; defaultProvi... |
public class MultiMEProxyHandler { /** * Forwards the subscribe Events onto the Neighbouring ME ' s
* This will be called for Subscriptions that have arrived from Neighbouring
* ME ' s and need to be forwarded onto other ME ' s outside of the Bus that the
* message arrived from .
* This method is called from th... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "subscribeEvent" , new Object [ ] { topics , topicSpaces , busId , transaction } ) ; try { // Get the lock Manager lock
// multiple subscribes can happen at the same time -
// this is allowed .
_lockManager . lock ( ) ; if (... |
public class CompilationUnitMerger { /** * Util method to make source merge more convenient
* @ param first merge params , specifically for the existing source
* @ param second merge params , specifically for the new source
* @ return merged result
* @ throws ParseException cannot parse the input params */
publ... | JavaParser . setDoNotAssignCommentsPreceedingEmptyLines ( false ) ; CompilationUnit cu1 = JavaParser . parse ( new StringReader ( first ) , true ) ; CompilationUnit cu2 = JavaParser . parse ( new StringReader ( second ) , true ) ; AbstractMerger < CompilationUnit > merger = AbstractMerger . getMerger ( CompilationUnit ... |
public class DescribeOrderableDBInstanceOptionsResult { /** * An < a > OrderableDBInstanceOption < / a > structure containing information about orderable options for the DB instance .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setOrderableDBInstanceOptio... | if ( this . orderableDBInstanceOptions == null ) { setOrderableDBInstanceOptions ( new java . util . ArrayList < OrderableDBInstanceOption > ( orderableDBInstanceOptions . length ) ) ; } for ( OrderableDBInstanceOption ele : orderableDBInstanceOptions ) { this . orderableDBInstanceOptions . add ( ele ) ; } return this ... |
public class SAML2LogoutValidator { /** * Validates the SAML logout response .
* @ param logoutResponse the logout response
* @ param context the context
* @ param engine the signature engine */
protected void validateLogoutResponse ( final LogoutResponse logoutResponse , final SAML2MessageContext context , final... | validateSuccess ( logoutResponse . getStatus ( ) ) ; validateSignatureIfItExists ( logoutResponse . getSignature ( ) , context , engine ) ; validateIssueInstant ( logoutResponse . getIssueInstant ( ) ) ; validateIssuerIfItExists ( logoutResponse . getIssuer ( ) , context ) ; verifyEndpoint ( context . getSPSSODescripto... |
public class AtomContactSet { /** * Returns the list of contacts from this set that are within the given distance .
* @ param distance
* @ return
* @ throws IllegalArgumentException if given distance is larger than distance cutoff
* used for calculation of contacts */
public List < AtomContact > getContactsWith... | if ( distance >= cutoff ) throw new IllegalArgumentException ( "Given distance " + String . format ( "%.2f" , distance ) + " is larger than contacts' distance cutoff " + String . format ( "%.2f" , cutoff ) ) ; List < AtomContact > list = new ArrayList < AtomContact > ( ) ; for ( AtomContact contact : this . contacts . ... |
public class SessionUtil { /** * Query IDP token url to authenticate and retrieve access token
* @ param loginInput
* @ param tokenUrl
* @ return
* @ throws SnowflakeSQLException */
private static String federatedFlowStep3 ( LoginInput loginInput , String tokenUrl ) throws SnowflakeSQLException { } } | String oneTimeToken = "" ; try { URL url = new URL ( tokenUrl ) ; URI tokenUri = url . toURI ( ) ; final HttpPost postRequest = new HttpPost ( tokenUri ) ; StringEntity params = new StringEntity ( "{\"username\":\"" + loginInput . getUserName ( ) + "\",\"password\":\"" + loginInput . getPassword ( ) + "\"}" ) ; postReq... |
public class RecommendationsInner { /** * Reset all recommendation opt - out settings for a subscription .
* Reset all recommendation opt - out settings for a subscription .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown i... | return ServiceFuture . fromResponse ( resetAllFiltersWithServiceResponseAsync ( ) , serviceCallback ) ; |
public class MPD9AbstractReader { /** * Process a task .
* @ param row task data */
protected void processTask ( Row row ) { } } | Integer uniqueID = row . getInteger ( "TASK_UID" ) ; if ( uniqueID != null && uniqueID . intValue ( ) >= 0 ) { Task task = m_project . addTask ( ) ; TimeUnit durationFormat = MPDUtility . getDurationTimeUnits ( row . getInt ( "TASK_DUR_FMT" ) ) ; task . setActualCost ( row . getCurrency ( "TASK_ACT_COST" ) ) ; task . s... |
public class OrganizationResourceImpl { /** * Creates a new client version .
* @ param bean
* @ param client
* @ throws StorageException */
protected ClientVersionBean createClientVersionInternal ( NewClientVersionBean bean , ClientBean client ) throws StorageException { } } | if ( ! BeanUtils . isValidVersion ( bean . getVersion ( ) ) ) { throw new StorageException ( "Invalid/illegal client version: " + bean . getVersion ( ) ) ; // $ NON - NLS - 1 $
} ClientVersionBean newVersion = new ClientVersionBean ( ) ; newVersion . setClient ( client ) ; newVersion . setCreatedBy ( securityContext . ... |
public class ConstraintMessage { /** * Gets a method parameter ( or a parameter field ) name , if the violation raised in it . */
private static Optional < String > getMemberName ( ConstraintViolation < ? > violation , Invocable invocable ) { } } | final List < Path . Node > propertyPath = Lists . of ( violation . getPropertyPath ( ) ) ; final int size = propertyPath . size ( ) ; if ( size < 2 ) { return Optional . empty ( ) ; } final Path . Node parent = propertyPath . get ( size - 2 ) ; final Path . Node member = propertyPath . get ( size - 1 ) ; switch ( paren... |
public class TagLibraryInfo { /** * Get the FunctionInfo for a given function name , looking through all the
* functions in this tag library .
* @ param name The name ( no prefix ) of the function
* @ return the FunctionInfo for the function with the given name , or null
* if no such function exists
* @ since... | if ( functions == null || functions . length == 0 ) { System . err . println ( "No functions" ) ; return null ; } for ( int i = 0 ; i < functions . length ; i ++ ) { if ( functions [ i ] . getName ( ) . equals ( name ) ) { return functions [ i ] ; } } return null ; |
public class StandardDdlParser { /** * Utility method subclasses can override to check unknown tokens and perform additional node manipulation . Example would be
* in Oracle dialect for CREATE FUNCTION statements that can end with an ' / ' character because statement can contain multiple
* statements .
* @ param ... | assert tokens != null ; assert tokenValue != null ; // DEFAULT IMPLEMENTATION DOES NOTHING
return null ; |
public class GeometryExpressions { /** * Create a new GeometryExpression
* @ param value Geometry
* @ return new GeometryExpression */
public static < T extends Geometry > GeometryExpression < T > asGeometry ( T value ) { } } | return asGeometry ( Expressions . constant ( value ) ) ; |
public class CPDAvailabilityEstimatePersistenceImpl { /** * Returns the cpd availability estimates before and after the current cpd availability estimate in the ordered set where commerceAvailabilityEstimateId = & # 63 ; .
* @ param CPDAvailabilityEstimateId the primary key of the current cpd availability estimate
... | CPDAvailabilityEstimate cpdAvailabilityEstimate = findByPrimaryKey ( CPDAvailabilityEstimateId ) ; Session session = null ; try { session = openSession ( ) ; CPDAvailabilityEstimate [ ] array = new CPDAvailabilityEstimateImpl [ 3 ] ; array [ 0 ] = getByCommerceAvailabilityEstimateId_PrevAndNext ( session , cpdAvailabil... |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getMMT ( ) { } } | if ( mmtEClass == null ) { mmtEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 301 ) ; } return mmtEClass ; |
public class ClasspathOrder { /** * Test to see if a RelativePath has been filtered out by the user .
* @ param classpathElementPath
* the classpath element path
* @ return true , if not filtered out */
private boolean filter ( final String classpathElementPath ) { } } | if ( scanSpec . classpathElementFilters != null ) { for ( final ClasspathElementFilter filter : scanSpec . classpathElementFilters ) { if ( ! filter . includeClasspathElement ( classpathElementPath ) ) { return false ; } } } return true ; |
public class TextWriterImageVisitor { /** * Write parameter to output file ( and possibly screen ) .
* @ param toWrite Text to write to file */
protected void write ( String toWrite ) throws IOException { } } | if ( ! okToWrite ) throw new IOException ( "file not open for writing." ) ; if ( printToScreen ) System . out . print ( toWrite ) ; try { out . write ( DFSUtil . string2Bytes ( toWrite ) ) ; } catch ( IOException e ) { okToWrite = false ; throw e ; } |
public class JsRuntime { /** * Returns the field containing the extension object for the given field descriptor . */
public static Expression extensionField ( FieldDescriptor desc ) { } } | String jsExtensionImport = ProtoUtils . getJsExtensionImport ( desc ) ; String jsExtensionName = ProtoUtils . getJsExtensionName ( desc ) ; return symbolWithNamespace ( jsExtensionImport , jsExtensionName ) ; |
public class WordVectorSerializer { /** * TODO : this method needs better name : ) */
public static WordVectors loadStaticModel ( @ NonNull File file ) { } } | if ( ! file . exists ( ) || file . isDirectory ( ) ) throw new RuntimeException ( new FileNotFoundException ( "File [" + file . getAbsolutePath ( ) + "] was not found" ) ) ; int originalFreq = Nd4j . getMemoryManager ( ) . getOccasionalGcFrequency ( ) ; boolean originalPeriodic = Nd4j . getMemoryManager ( ) . isPeriodi... |
public class SibRaDispatcher { /** * This method is used as a workaround to increase the retry count on a message .
* The better solution is to allow us to unlock a message passing in a parameter
* which states if we wish to increase the retry count or not
* @ param msg The message to increase the retry count on ... | final String methodName = "increaseRetryCount" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } try { SIUncoordinatedTransaction localTran = _connection . createUncoordinatedTransaction ( ) ; deleteMessages ( new SIMessageHandle [ ] { msgH... |
public class GVRInputManager { /** * Get the first controller of a specified type
* @ param type controller type to search for
* @ return controller found or null if no controllers of the given type */
public GVRCursorController findCursorController ( GVRControllerType type ) { } } | for ( int index = 0 , size = cache . size ( ) ; index < size ; index ++ ) { int key = cache . keyAt ( index ) ; GVRCursorController controller = cache . get ( key ) ; if ( controller . getControllerType ( ) . equals ( type ) ) { return controller ; } } return null ; |
public class ServiceUtils { /** * Returns the part size of the part
* @ param getObjectRequest the request to check
* @ param s3 the s3 client
* @ param partNumber the part number
* @ return the part size */
@ SdkInternalApi public static long getPartSize ( GetObjectRequest getObjectRequest , AmazonS3 s3 , int ... | ValidationUtils . assertNotNull ( s3 , "S3 client" ) ; ValidationUtils . assertNotNull ( getObjectRequest , "GetObjectRequest" ) ; GetObjectMetadataRequest getObjectMetadataRequest = RequestCopyUtils . createGetObjectMetadataRequestFrom ( getObjectRequest ) . withPartNumber ( partNumber ) ; return s3 . getObjectMetadat... |
public class CommercePriceEntryPersistenceImpl { /** * Returns a range of all the commerce price entries where groupId = & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are ... | return findByGroupId ( groupId , start , end , null ) ; |
public class IPv6Network { /** * Split a network in smaller subnets of a given size .
* @ param size size ( expressed as { @ link com . googlecode . ipv6 . IPv6NetworkMask } ) of the subnets
* @ return iterator of the splitted subnets .
* @ throws IllegalArgumentException if the requested size is bigger than the ... | if ( size . asPrefixLength ( ) < this . getNetmask ( ) . asPrefixLength ( ) ) throw new IllegalArgumentException ( String . format ( "Can not split a network of size %s in subnets of larger size %s" , this . getNetmask ( ) . asPrefixLength ( ) , size . asPrefixLength ( ) ) ) ; return new IPv6NetworkSplitsIterator ( siz... |
public class TransparentToolTipDialog { /** * Initializes the components of the tooltip window . */
private void initComponents ( ) { } } | // Avoid warning on Mac OS X when changing the alpha
getRootPane ( ) . putClientProperty ( "apple.awt.draggableWindowBackground" , Boolean . FALSE ) ; toolTip = new JToolTip ( ) ; toolTip . addMouseListener ( new TransparencyAdapter ( ) ) ; owner . addComponentListener ( locationAdapter ) ; owner . addAncestorListener ... |
public class NormalizedKeySorter { /** * Writes a given record to this sort buffer . The written record will be appended and take
* the last logical position .
* @ param record The record to be written .
* @ return True , if the record was successfully written , false , if the sort buffer was full .
* @ throws ... | // check whether we need a new memory segment for the sort index
if ( this . currentSortIndexOffset > this . lastIndexEntryOffset ) { if ( memoryAvailable ( ) ) { this . currentSortIndexSegment = nextMemorySegment ( ) ; this . sortIndex . add ( this . currentSortIndexSegment ) ; this . currentSortIndexOffset = 0 ; this... |
public class ServiceOperations { /** * Initialize a service .
* The service state is checked < i > before < / i > the operation begins .
* This process is < i > not < / i > thread safe .
* @ param service a service that must be in the state
* { @ link Service . STATE # NOTINITED }
* @ param configuration the ... | Service . STATE state = service . getServiceState ( ) ; ensureCurrentState ( state , Service . STATE . NOTINITED ) ; service . init ( configuration ) ; |
public class TreeGraphNode { /** * Sets the children of this < code > TreeGraphNode < / code > . If
* given < code > null < / code > , this method sets
* the node ' s children to the canonical zero - length Tree [ ] array .
* @ param children an array of child trees */
@ Override public void setChildren ( Tree [ ... | if ( children == null || children . length == 0 ) { this . children = ZERO_TGN_CHILDREN ; } else { if ( children instanceof TreeGraphNode [ ] ) { this . children = ( TreeGraphNode [ ] ) children ; } else { this . children = new TreeGraphNode [ children . length ] ; for ( int i = 0 ; i < children . length ; i ++ ) { thi... |
public class CmsXmlContentDefinition { /** * Factory method to unmarshal ( read ) a XML content definition instance from a byte array
* that contains XML data . < p >
* @ param xmlData the XML data in a byte array
* @ param schemaLocation the location from which the XML schema was read ( system id )
* @ param r... | schemaLocation = translateSchema ( schemaLocation ) ; CmsXmlContentDefinition result = getCachedContentDefinition ( schemaLocation , resolver ) ; if ( result == null ) { // content definition was not found in the cache , unmarshal the XML document
result = unmarshalInternal ( CmsXmlUtils . unmarshalHelper ( xmlData , r... |
public class MessageStoreImpl { /** * ( non - Javadoc )
* @ see com . ibm . ws . sib . admin . JsEngineComponent # start ( int ) */
@ Override public void start ( int arg0 ) throws Exception { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "start" ) ; // Venu Liberty change
// activating the Alarm manager ( i . e this triggers Alarm manager ' s Activate ) . .
// Alaram manager has to be ready for Message Store Expirer
alarmManagerRef . getService ( ) ; ... |
public class DefaultGrailsApplication { /** * Get or create the cache of classes for the specified artefact type .
* @ param artefactType The name of an artefact type
* @ param create Set to true if you want non - existent caches to be created
* @ return The cache of classes for the type , or null if no cache exi... | DefaultArtefactInfo cache = ( DefaultArtefactInfo ) artefactInfo . get ( artefactType ) ; if ( cache == null && create ) { cache = new DefaultArtefactInfo ( ) ; artefactInfo . put ( artefactType , cache ) ; cache . updateComplete ( ) ; } return cache ; |
public class ClaimBean { /** * { @ inheritDoc } */
@ Override public void destroy ( T instance , CreationalContext < T > creationalContext ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "destroy" , instance , creationalContext ) ; } creationalContext . release ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "destroy" ) ; } |
public class DisparityToColorPointCloud { /** * Stereo and intrinsic camera parameters
* @ param baseline Stereo baseline ( world units )
* @ param K Intrinsic camera calibration matrix of rectified camera
* @ param rectifiedToColor Transform from rectified pixels to the color image pixels .
* @ param minDispar... | this . K = K ; ConvertMatrixData . convert ( rectifiedR , this . rectifiedR ) ; this . rectifiedToColor = rectifiedToColor ; this . baseline = ( float ) baseline ; this . focalLengthX = ( float ) K . get ( 0 , 0 ) ; this . focalLengthY = ( float ) K . get ( 1 , 1 ) ; this . centerX = ( float ) K . get ( 0 , 2 ) ; this ... |
public class CmsReport { /** * Returns if the report generated an error output . < p >
* @ return true if the report generated an error , otherwise false */
public boolean hasError ( ) { } } | A_CmsReportThread thread = OpenCms . getThreadStore ( ) . retrieveThread ( m_paramThread ) ; if ( thread != null ) { return thread . hasError ( ) ; } else { return false ; } |
public class InstanceChangeStreamListenerImpl { /** * Starts all streams . */
public void start ( ) { } } | instanceLock . writeLock ( ) . lock ( ) ; try { for ( final Map . Entry < MongoNamespace , NamespaceChangeStreamListener > streamerEntry : nsStreamers . entrySet ( ) ) { streamerEntry . getValue ( ) . start ( ) ; } } finally { instanceLock . writeLock ( ) . unlock ( ) ; } |
public class DkimAttributesMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DkimAttributes dkimAttributes , ProtocolMarshaller protocolMarshaller ) { } } | if ( dkimAttributes == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( dkimAttributes . getSigningEnabled ( ) , SIGNINGENABLED_BINDING ) ; protocolMarshaller . marshall ( dkimAttributes . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller... |
public class PermissionUtil { /** * Gets the { @ code long } representation of the effective permissions allowed for this { @ link net . dv8tion . jda . core . entities . Role Role }
* in this { @ link net . dv8tion . jda . core . entities . Channel Channel } . This can be used in conjunction with
* { @ link net . ... | Checks . notNull ( channel , "Channel" ) ; Checks . notNull ( role , "Role" ) ; Guild guild = channel . getGuild ( ) ; if ( ! guild . equals ( role . getGuild ( ) ) ) throw new IllegalArgumentException ( "Provided channel and role are not of the same guild!" ) ; long permissions = role . getPermissionsRaw ( ) | guild .... |
public class NetworkUtils { /** * Tests if a network location is reachable . This is best effort and may give false
* not reachable .
* @ param endpoint the endpoint to connect to
* @ param timeout Open connection will wait for this timeout .
* @ param retryCount In case of connection timeout try retryCount tim... | int retryLeft = retryCount ; while ( retryLeft > 0 ) { try ( Socket s = new Socket ( ) ) { s . connect ( endpoint , ( int ) timeout . toMillis ( ) ) ; return true ; } catch ( IOException e ) { } finally { SysUtils . sleep ( retryInterval ) ; retryLeft -- ; } } LOG . log ( Level . FINE , "Failed to connect to: {0}" , en... |
public class GoogleCloudStorageImpl { /** * See { @ link GoogleCloudStorage # listObjectInfo ( String , String , String ) } for details about
* expected behavior . */
@ Override public List < GoogleCloudStorageItemInfo > listObjectInfo ( String bucketName , String objectNamePrefix , String delimiter ) throws IOExcept... | return listObjectInfo ( bucketName , objectNamePrefix , delimiter , MAX_RESULTS_UNLIMITED ) ; |
public class StringUtils { /** * Take a { @ code String } that is a delimited list and convert it into
* a { @ code String } array .
* < p > A single { @ code delimiter } may consist of more than one character ,
* but it will still be considered as a single delimiter string , rather
* than as bunch of potential... | if ( str == null ) { return new String [ 0 ] ; } if ( delimiter == null ) { return new String [ ] { str } ; } List < String > result = new ArrayList < > ( ) ; if ( "" . equals ( delimiter ) ) { for ( int i = 0 ; i < str . length ( ) ; i ++ ) { result . add ( deleteAny ( str . substring ( i , i + 1 ) , charsToDelete ) )... |
public class MessageProcessor { /** * Send the given message to its destinations across the message bus and any response sent back will be passed to
* the given listener . Use this for request - response messages where you expect to get a non - void response back .
* The response listener should close its associate... | if ( context == null ) { throw new IllegalArgumentException ( "context must not be null" ) ; } if ( basicMessage == null ) { throw new IllegalArgumentException ( "message must not be null" ) ; } if ( responseListener == null ) { throw new IllegalArgumentException ( "response listener must not be null" ) ; } // create t... |
public class HttpApiFactory { /** * TODO hacky . . . */
private static HeaderMap wrapMultiMap ( MultiMap headers ) { } } | return new HeaderMap ( ) { private static final long serialVersionUID = - 1406124274678587935L ; @ Override ( ) public String get ( String key ) { return headers . get ( key ) ; } } ; |
public class NameServerImpl { /** * Finds an address for an identifier locally .
* @ param id an identifier
* @ return an Internet socket address */
@ Override public InetSocketAddress lookup ( final Identifier id ) { } } | LOG . log ( Level . FINE , "id: {0}" , id ) ; return idToAddrMap . get ( id ) ; |
public class AbstractValidate { /** * Method without varargs to increase performance */
public < T > T [ ] validIndex ( final T [ ] array , final int index , final String message ) { } } | notNull ( array ) ; if ( index < 0 || index >= array . length ) { failIndexOutOfBounds ( message ) ; } return array ; |
public class NamedResolverMap { /** * Return the string value indicated by the given numeric key .
* @ param key The key of the value to return .
* @ param dfl The default value to return , if the key is absent .
* @ return The string value stored under the given key , or dfl .
* @ throws IllegalArgumentExcepti... | Any3 < Boolean , Integer , String > value = data . getOrDefault ( Any2 . < Integer , String > left ( key ) , Any3 . < Boolean , Integer , String > create3 ( dfl ) ) ; return value . get3 ( ) . orElseThrow ( ( ) -> new IllegalArgumentException ( "expected string argument for param " + key ) ) ; |
public class RecordConverter { /** * Convert a set of records in to a matrix
* @ param matrix the records ot convert
* @ return the matrix for the records */
public static List < List < Writable > > toRecords ( INDArray matrix ) { } } | List < List < Writable > > ret = new ArrayList < > ( ) ; for ( int i = 0 ; i < matrix . rows ( ) ; i ++ ) { ret . add ( RecordConverter . toRecord ( matrix . getRow ( i ) ) ) ; } return ret ; |
public class Log { /** * Send a { @ link # Constants . DEBUG } log message .
* @ param msg
* The message you would like logged . */
public static int d ( String msg ) { } } | // This is a quick check to avoid the expensive stack trace reflection .
if ( ! activated ) { return 0 ; } String caller = LogHelper . getCaller ( ) ; if ( caller != null ) { return d ( caller , msg ) ; } return 0 ; |
public class DataBindingUtils { /** * Associations both sides of any bidirectional relationships found in the object and source map to bind
* @ param object The object
* @ param source The source map
* @ param persistentEntity The PersistentEntity for the object */
public static void assignBidirectionalAssociatio... | if ( source == null ) { return ; } for ( Object key : source . keySet ( ) ) { String propertyName = key . toString ( ) ; if ( propertyName . indexOf ( '.' ) > - 1 ) { propertyName = propertyName . substring ( 0 , propertyName . indexOf ( '.' ) ) ; } PersistentProperty prop = persistentEntity . getPropertyByName ( prope... |
public class CmsLoginUI { /** * Initializes the login view . < p >
* @ param preselectedOu a potential preselected OU */
public void showLoginView ( String preselectedOu ) { } } | VerticalLayout content = new VerticalLayout ( ) ; content . setSizeFull ( ) ; m_targetOpener = new CmsLoginTargetOpener ( A_CmsUI . get ( ) ) ; // content . setExpandRatio ( m _ targetOpener , 0f ) ;
content . addComponent ( m_loginForm ) ; content . setComponentAlignment ( m_loginForm , Alignment . MIDDLE_CENTER ) ; c... |
public class MessageResolver { /** * ロケールとキーを指定してメッセージを取得する 。
* < p > ロケールに該当する値を取得する 。
* @ param locale ロケール
* @ param key メッセージキー
* @ return 該当するロケールのメッセージが見つからない場合は 、 デフォルトのリソースから取得する 。 */
public String getMessage ( final MSLocale locale , final String key ) { } } | if ( locale == null ) { return loadResource ( null ) . getMessage ( key ) ; } else { return loadResource ( locale . getLocale ( ) ) . getMessage ( key ) ; } |
public class ConfigUtil { /** * Convert the value to a boolean .
* @ param value The value instance .
* @ return The boolean value . */
public static boolean asBoolean ( Object value ) { } } | if ( value instanceof Boolean ) { return ( Boolean ) value ; } else if ( value instanceof Double || value instanceof Float ) { throw new IncompatibleValueException ( "Unable to convert double value to boolean" ) ; } else if ( value instanceof Number ) { long l = ( ( Number ) value ) . longValue ( ) ; if ( l == 0L ) ret... |
public class StringArrayDecoder { /** * Converts an object array containing an exported row values into an
* array of their string representations */
@ Override public String [ ] decode ( long generation , String tableName , List < VoltType > types , List < String > names , String [ ] to , Object [ ] fields ) throws ... | Preconditions . checkArgument ( fields != null && fields . length > m_firstFieldOffset , "null or inapropriately sized export row array" ) ; /* * Builds a list of string formatters that reflects the row
* column types . */
StringFieldDecoder [ ] fieldDecoders ; if ( ! m_fieldDecoders . containsKey ( generation ) ) { ... |
public class JSONObjectException { /** * Method that can be called to either create a new JsonMappingException
* ( if underlying exception is not a JsonMappingException ) , or augment
* given exception with given path / reference information .
* This version of method is called when the reference is through an
... | return wrapWithPath ( src , new Reference ( refFrom , index ) ) ; |
public class CSSColorHelper { /** * Get the passed values as CSS HSL color value
* @ param fHue
* Hue - is scaled to 0-359
* @ param fSaturation
* Saturation - is scaled to 0-100
* @ param fLightness
* Lightness - is scaled to 0-100
* @ return The CSS string to use */
@ Nonnull @ Nonempty public static St... | return new StringBuilder ( 18 ) . append ( CCSSValue . PREFIX_HSL_OPEN ) . append ( getHSLHueValue ( fHue ) ) . append ( ',' ) . append ( getHSLPercentageValue ( fSaturation ) ) . append ( "%," ) . append ( getHSLPercentageValue ( fLightness ) ) . append ( "%" ) . append ( CCSSValue . SUFFIX_HSL_CLOSE ) . toString ( ) ... |
public class DeleteXssMatchSetRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteXssMatchSetRequest deleteXssMatchSetRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteXssMatchSetRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteXssMatchSetRequest . getXssMatchSetId ( ) , XSSMATCHSETID_BINDING ) ; protocolMarshaller . marshall ( deleteXssMatchSetRequest . getChangeToken ( ) , CHAN... |
public class ListLens { /** * Convenience static factory method for creating a lens over a copy of a list . Useful for composition to avoid
* mutating a list reference .
* @ param < X > the list element type
* @ return a lens that focuses on copies of lists */
public static < X > Lens . Simple < List < X > , List... | return simpleLens ( ArrayList :: new , ( xs , ys ) -> ys ) ; |
public class DefaultWardenService { /** * ~ Methods * * * * * */
@ Override public void dispose ( ) { } } | super . dispose ( ) ; _alertService . dispose ( ) ; _userService . dispose ( ) ; _metricService . dispose ( ) ; _serviceManagementRecordService . dispose ( ) ; _dashboardService . dispose ( ) ; _shutdownScheduledExecutorService ( ) ; |
public class UpdateBuilder { /** * Updates the fields in the document referred to by this DocumentReference . If the document
* doesn ' t exist yet , the update will fail .
* @ param documentReference The DocumentReference to update .
* @ param field The first field to set .
* @ param value The first value to s... | return performUpdate ( documentReference , Precondition . exists ( true ) , FieldPath . fromDotSeparatedString ( field ) , value , moreFieldsAndValues ) ; |
public class JTAUserTransactionAdapter { /** * / * ( non - Javadoc )
* @ see javax . batch . spi . TransactionManagerSPI # setTransactionTimeout ( int ) */
@ Override public void setTransactionTimeout ( int seconds ) throws TransactionManagementException { } } | logger . entering ( CLASSNAME , "setTransactionTimeout" , seconds ) ; try { userTran . setTransactionTimeout ( seconds ) ; } catch ( SystemException e ) { throw new TransactionManagementException ( e ) ; } logger . exiting ( CLASSNAME , "setTransactionTimeout" ) ; |
public class DSClientFactory { /** * Gets the socket options .
* @ param connectionProperties
* the connection properties
* @ return the socket options */
private SocketOptions getSocketOptions ( Properties connectionProperties ) { } } | // SocketOptions
SocketOptions socketConfig = new SocketOptions ( ) ; String connectTimeoutMillis = connectionProperties . getProperty ( CassandraConstants . SOCKET_TIMEOUT ) ; String readTimeoutMillis = connectionProperties . getProperty ( "readTimeoutMillis" ) ; String keepAlive = connectionProperties . getProperty (... |
public class ClientConnectionTimingsBuilder { /** * Returns a newly - created { @ link ClientConnectionTimings } instance . */
public ClientConnectionTimings build ( ) { } } | if ( socketConnectStartTimeMicros > 0 && ! socketConnectEndSet ) { logger . warn ( "Should call socketConnectEnd() if socketConnectStart() was invoked." ) ; } if ( pendingAcquisitionStartTimeMicros > 0 && ! pendingAcquisitionEndSet ) { logger . warn ( "Should call pendingAcquisitionEnd() if pendingAcquisitionStart() wa... |
public class AddMetadata { /** * If any operation requires an API key we generate a setter on the builder .
* @ return True if any operation requires an API key . False otherwise . */
private static boolean requiresApiKey ( ServiceModel serviceModel ) { } } | return serviceModel . getOperations ( ) . values ( ) . stream ( ) . anyMatch ( Operation :: requiresApiKey ) ; |
public class Utilities { /** * This method splits the input string into several json objects . This is
* needed because Atmosphere sends more than one json in a single response .
* < br >
* For example for the input { { test } { test2 } } { test3 } it would produce the
* following list : [ { { test } { test2 } ... | List < String > result = new ArrayList < > ( ) ; int numberOfOpeningBraces = 0 ; boolean isInsideString = false ; /* * A string starts with an unescaped " and ends with an unescaped " } or
* { within a string must be ignored . */
StringBuilder jsonBuffer = new StringBuilder ( ) ; for ( int i = 0 ; i < combinedJsonStr... |
public class LogRecordTextHandler { /** * Stops this handler and close its output streams . */
public void stop ( ) { } } | if ( this . writer != null ) { this . writer . stop ( ) ; this . writer . getLogRepositoryManager ( ) . stop ( ) ; this . writer = null ; } |
public class JSONML { /** * Parse XML values and store them in a JSONArray .
* @ param x The XMLTokener containing the source string .
* @ param arrayForm true if array form , false if object form .
* @ param ja The JSONArray that is containing the current tag or null
* if we are at the outermost level .
* @ ... | String attribute ; char c ; String closeTag = null ; int i ; JSONArray newja = null ; JSONObject newjo = null ; Object token ; String tagName = null ; // Test for and skip past these forms :
while ( true ) { if ( ! x . more ( ) ) { throw x . syntaxError ( "Bad XML" ) ; } token = x . nextContent ( ) ; if ( token == XML ... |
public class CanonicalStore { /** * Store the given { @ link ClassLoader } indexed by the given { @ link ClassLoaderIdentity } .
* This method can safely be called from multiple threads concurrently , but the
* ordering of concurrent store operations for the same key is unspecified . */
public void store ( K key , ... | // Clean up stale entries on every put .
// This should avoid a slow memory leak of reference objects .
cleanUpStaleEntries ( ) ; map . put ( key , new WeakKeyedRef < K , V > ( key , loader , q ) ) ; |
public class DateUtil { /** * 设置分钟 , 0-59. */
public static Date setMinutes ( @ NotNull final Date date , int amount ) { } } | return DateUtils . setMinutes ( date , amount ) ; |
public class SdpParserPipeline { /** * Adds an attribute parser to the pipeline .
* @ param parser
* The parser to be registered */
public void addAttributeParser ( String type , SdpParser < ? extends AttributeField > parser ) { } } | synchronized ( this . attributeParsers ) { this . attributeParsers . put ( type , parser ) ; } |
public class BitMatrix { /** * < p > Flips the given bit . < / p >
* @ param x The horizontal component ( i . e . which column )
* @ param y The vertical component ( i . e . which row ) */
public void flip ( int x , int y ) { } } | int offset = y * rowSize + ( x / 32 ) ; bits [ offset ] ^= 1 << ( x & 0x1f ) ; |
public class DoubleHistogram { /** * Produce textual representation of the value distribution of histogram data by percentile . The distribution is
* output with exponentially increasing resolution , with each exponentially decreasing half - distance containing
* < i > dumpTicksPerHalf < / i > percentile reporting ... | integerValuesHistogram . outputPercentileDistribution ( printStream , percentileTicksPerHalfDistance , outputValueUnitScalingRatio / integerToDoubleValueConversionRatio , useCsvFormat ) ; |
public class PropertiesInputGridScreen { /** * Add the navigation button ( s ) to the left of the grid row . */
public void addNavButtons ( ) { } } | if ( ( m_iDisplayFieldDesc & ScreenConstants . SELECT_MODE ) != ScreenConstants . SELECT_MODE ) new SCannedBox ( this . getNextLocation ( ScreenConstants . FIRST_SCREEN_LOCATION , ScreenConstants . SET_ANCHOR ) , this , null , ScreenConstants . DEFAULT_DISPLAY , null , null , MenuConstants . DELETE , MenuConstants . DE... |
public class ICalComponent { /** * Removes all sub - components of the given class from this component .
* @ param clazz the class of the components to remove ( e . g . " VEvent . class " )
* @ param < T > the component class
* @ return the removed components ( this list is immutable ) */
public < T extends ICalC... | List < ICalComponent > removed = components . removeAll ( clazz ) ; return castList ( removed , clazz ) ; |
public class WikipediaXMLReader { /** * Returns the next RevisionTask .
* @ return RevisionTask .
* @ throws ArticleReaderException
* if the parsing of the input fails */
public Task < Revision > next ( ) throws ArticleReaderException { } } | try { this . keywords . reset ( ) ; // if new article read header , otherwise use old one
if ( this . lastTaskCompleted ) { this . lastTaskCompleted = false ; this . taskPartCounter = 1 ; this . taskRevisionCounter = - 1 ; if ( ! readHeader ( ) ) { this . lastTaskCompleted = true ; return null ; } } else { this . taskP... |
public class ModelHelper { /** * Helper to convert Segment Id into Segment object .
* @ param segment The Segment Id .
* @ return New instance of Segment . */
public static final Segment encode ( final SegmentId segment ) { } } | Preconditions . checkNotNull ( segment , "segment" ) ; return new Segment ( segment . getStreamInfo ( ) . getScope ( ) , segment . getStreamInfo ( ) . getStream ( ) , segment . getSegmentId ( ) ) ; |
public class RedisClusterClient { /** * Shutdown this client and close all open connections asynchronously . The client should be discarded after calling
* shutdown .
* @ param quietPeriod the quiet period as described in the documentation
* @ param timeout the maximum amount of time to wait until the executor is... | if ( clusterTopologyRefreshActivated . compareAndSet ( true , false ) ) { ScheduledFuture < ? > scheduledFuture = clusterTopologyRefreshFuture . get ( ) ; try { scheduledFuture . cancel ( false ) ; clusterTopologyRefreshFuture . set ( null ) ; } catch ( Exception e ) { logger . debug ( "Could not cancel Cluster topolog... |
public class JmolTools { /** * TODO : move this to AtomInfo class */
public static final String getPdbInfo ( Atom a , boolean printResName ) { } } | String aa3 = "" ; String chain1 = "" ; String res1 = "" ; if ( a != null ) { Group g1 = a . getGroup ( ) ; if ( g1 != null ) { aa3 = g1 . getPDBName ( ) ; res1 = g1 . getResidueNumber ( ) . toString ( ) ; Chain ch1 = g1 . getChain ( ) ; if ( ch1 != null ) chain1 = ch1 . getId ( ) ; } } StringBuffer buf = new StringBuff... |
public class CommonTypeFactory { /** * When first level commodity found , complete types must be build ( including all generics ) so the entire
* process is restarted for generic types and using all this final type is built .
* This is the only place where { @ code alwaysIncludeInterfaces } actually required ! When... | removeDuplicateContracts ( type , contracts ) ; final List < Type > res = new ArrayList < Type > ( ) ; if ( type != Object . class ) { res . add ( buildCommonType ( type , firstContext , secondContext , alwaysIncludeInterfaces , cache ) ) ; } // resolve interfaces only for root type resolution or if root class cant be ... |
public class UniqueNameGenerator { /** * Reserves the name , useful for keywords . */
public void reserve ( String name ) { } } | checkName ( name ) ; // if this is new
if ( reserved . add ( name ) ) { // add it to names , so that generateName will still work for reserved names ( they will just
// get suffixes ) .
if ( ! names . add ( name ) ) { names . remove ( name ) ; throw new IllegalArgumentException ( "newly reserved name: " + name + " was ... |
public class BindUploader { /** * Return whether the bind map uses array binds
* @ param bindValues the bind map
* @ return whether the bind map uses array binds */
public static boolean isArrayBind ( Map < String , ParameterBindingDTO > bindValues ) { } } | if ( bindValues == null || bindValues . size ( ) == 0 ) { return false ; } ParameterBindingDTO bindSample = bindValues . values ( ) . iterator ( ) . next ( ) ; return bindSample . getValue ( ) instanceof List ; |
public class JSParser { /** * Ref : : = " < " < IDENTIFIER > " > " */
final public JSDynamic Ref ( Map refs ) throws ParseException { } } | Token tok ; JSDynamic ans = new JSDynamic ( ) ; jj_consume_token ( 11 ) ; tok = jj_consume_token ( IDENTIFIER ) ; jj_consume_token ( 12 ) ; addRef ( refs , tok . image , ans ) ; { if ( true ) return ans ; } throw new Error ( "Missing return statement in function" ) ; |
public class TSNE { /** * Squared distance , in projection space .
* @ param v1 First vector
* @ param v2 Second vector
* @ return Squared distance */
protected double sqDist ( double [ ] v1 , double [ ] v2 ) { } } | assert ( v1 . length == v2 . length ) : "Lengths do not agree: " + v1 . length + " " + v2 . length ; double sum = 0 ; for ( int i = 0 ; i < v1 . length ; i ++ ) { final double diff = v1 [ i ] - v2 [ i ] ; sum += diff * diff ; } ++ projectedDistances ; return sum ; |
public class KubernetesDeserializer { /** * Registers a Custom Resource Definition Kind */
public static void registerCustomKind ( String kind , Class < ? extends KubernetesResource > clazz ) { } } | registerCustomKind ( null , kind , clazz ) ; |
public class BoundingBox { /** * Get the overlapping bounding box with the provided bounding box
* @ param boundingBox
* bounding box
* @ param allowEmpty
* allow empty ranges when determining overlap
* @ return bounding box
* @ since 3.1.0 */
public BoundingBox overlap ( BoundingBox boundingBox , boolean a... | double minLongitude = Math . max ( getMinLongitude ( ) , boundingBox . getMinLongitude ( ) ) ; double maxLongitude = Math . min ( getMaxLongitude ( ) , boundingBox . getMaxLongitude ( ) ) ; double minLatitude = Math . max ( getMinLatitude ( ) , boundingBox . getMinLatitude ( ) ) ; double maxLatitude = Math . min ( getM... |
public class ConfigDocumentFactory { /** * Parses a Reader into a ConfigDocument instance .
* @ param reader
* the reader to parse
* @ param options
* parse options to control how the reader is interpreted
* @ return the parsed configuration
* @ throws com . typesafe . config . ConfigException on IO or pars... | return Parseable . newReader ( reader , options ) . parseConfigDocument ( ) ; |
public class WebSocketUtils { /** * Transfer the data from the source to the sink using the given through buffer to pass data through . */
public static long transfer ( final ReadableByteChannel source , final long count , final ByteBuffer throughBuffer , final WritableByteChannel sink ) throws IOException { } } | long total = 0L ; while ( total < count ) { throughBuffer . clear ( ) ; if ( count - total < throughBuffer . remaining ( ) ) { throughBuffer . limit ( ( int ) ( count - total ) ) ; } try { long res = source . read ( throughBuffer ) ; if ( res <= 0 ) { return total == 0L ? res : total ; } } finally { throughBuffer . fli... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.