signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CapacityUtil { /** * Returns the next possible capacity , counting from the current buffers ' size . */
public static int nextCapacity ( int current ) { } } | assert current > 0 && Long . bitCount ( current ) == 1 : "Capacity must be a power of two." ; if ( current < MIN_CAPACITY / 2 ) { current = MIN_CAPACITY / 2 ; } current <<= 1 ; if ( current < 0 ) { throw new RuntimeException ( "Maximum capacity exceeded." ) ; } return current ; |
public class DitaValReader { /** * Insert subject scheme based action into filetermap if key not present in the map
* @ param subTree subject scheme definition element
* @ param attName attribute name
* @ param action action to insert */
private void insertAction ( final Element subTree , final QName attName , fi... | if ( subTree == null || action == null ) { return ; } final LinkedList < Element > queue = new LinkedList < > ( ) ; // Skip the sub - tree root because it has been added already .
NodeList children = subTree . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { if ( children . item ( i ) . get... |
public class GeometryUtils { /** * Sets the geometry type ( in place ) for the given hive geometry bytes
* @ param geomref reference to hive geometry bytes
* @ param type OGC geometry type */
public static void setType ( BytesWritable geomref , OGCType type ) { } } | geomref . getBytes ( ) [ SIZE_WKID ] = ( byte ) type . getIndex ( ) ; |
public class LinkType { /** * Gets whether the link should produce a shared library .
* @ return boolean */
public boolean isSharedLibrary ( ) { } } | final String value = this . outputType . getValue ( ) ; // FREEHEP
return value . equals ( "shared" ) || value . equals ( "plugin" ) || value . equals ( "jni" ) ; |
public class MpScheduler { /** * aggregated / deduped here at the MPI . */
public void handleIv2InitiateTaskMessage ( Iv2InitiateTaskMessage message ) { } } | final String procedureName = message . getStoredProcedureName ( ) ; /* * If this is CL replay , use the txnid from the CL and use it to update the current txnid */
long mpTxnId ; // Timestamp is actually a pre - IV2ish style time based transaction id
long timestamp = Long . MIN_VALUE ; // Update UID if it ' s for repla... |
public class JdbcPatternUtil { /** * 兼容 { } 内出现下划线的情况 */
public static String bareError ( String pattern ) { } } | List < String > camelKeys = getCamelKeys ( pattern ) , orignalKeys = getOriginalKeys ( pattern ) ; for ( int i = 0 ; i < camelKeys . size ( ) ; i ++ ) { pattern = pattern . replaceFirst ( "\\{" + orignalKeys . get ( i ) + "\\}" , "{" + camelKeys . get ( i ) + "}" ) ; } return pattern ; |
public class AmazonAlexaForBusinessClient { /** * Determines the details for the room from which a skill request was invoked . This operation is used by skill
* developers .
* @ param resolveRoomRequest
* @ return Result of the ResolveRoom operation returned by the service .
* @ throws NotFoundException
* The... | request = beforeClientExecution ( request ) ; return executeResolveRoom ( request ) ; |
public class BaseBroadcastBoolOp { /** * Calculate the output shape for this op
* @ return */
public List < LongShapeDescriptor > calculateOutputShape ( ) { } } | if ( x == null || y == null ) return Collections . emptyList ( ) ; long [ ] shapeX = x . shape ( ) ; long [ ] shapeY = y . shape ( ) ; return Collections . singletonList ( LongShapeDescriptor . fromShape ( Shape . broadcastOutputShape ( shapeX , shapeY ) , DataType . BOOL ) ) ; |
public class SeaGlassSynthPainterImpl { /** * Paints the border of a tab of a tabbed pane . This implementation invokes
* the method of the same name without the orientation .
* @ param context SynthContext identifying the < code > JComponent < / code >
* and < code > Region < / code > to paint to
* @ param g <... | paintBorder ( context , g , x , y , w , h , null ) ; |
public class ListTrainingJobsResult { /** * An array of < code > TrainingJobSummary < / code > objects , each listing a training job .
* @ param trainingJobSummaries
* An array of < code > TrainingJobSummary < / code > objects , each listing a training job . */
public void setTrainingJobSummaries ( java . util . Co... | if ( trainingJobSummaries == null ) { this . trainingJobSummaries = null ; return ; } this . trainingJobSummaries = new java . util . ArrayList < TrainingJobSummary > ( trainingJobSummaries ) ; |
public class TaskServiceImpl { /** * Ack Task is received .
* @ param taskId Id of the task
* @ param workerId Id of the worker
* @ return ` true | false ` if task if received or not */
@ Service public String ackTaskReceived ( String taskId , String workerId ) { } } | LOGGER . debug ( "Ack received for task: {} from worker: {}" , taskId , workerId ) ; return String . valueOf ( ackTaskReceived ( taskId ) ) ; |
public class Client { /** * Helper method to rollback the partition state and stop / restart the stream .
* The stream is stopped ( if not already done ) . Then :
* The rollback seqno state is applied . Note that this will also remove all the failover logs for the partition
* that are higher than the given seqno ... | return stopStreaming ( partition ) . andThen ( Completable . create ( new Completable . OnSubscribe ( ) { @ Override public void call ( CompletableSubscriber subscriber ) { sessionState ( ) . rollbackToPosition ( partition , seqno ) ; subscriber . onCompleted ( ) ; } } ) ) . andThen ( startStreaming ( partition ) ) ; |
public class InternationalFixedDate { /** * Obtains the current { @ code InternationalFixedDate } from the specified clock .
* This will query the specified clock to obtain the current date - today .
* Using this method allows the use of an alternate clock for testing .
* The alternate clock may be introduced usi... | LocalDate now = LocalDate . now ( clock ) ; return InternationalFixedDate . ofEpochDay ( now . toEpochDay ( ) ) ; |
public class MethodInvocation { /** * Factory method used to construct a new instance of { @ link MethodInvocation } initialized with
* the given { @ link Method } and array of { @ link Object arguments } passed to the { @ link Method }
* during invocation .
* The { @ link Method } is expected to be a { @ link ja... | return newMethodInvocation ( null , method , args ) ; |
public class DatatypeConverter { /** * Print an extended attribute value .
* @ param writer parent MSPDIWriter instance
* @ param value attribute value
* @ param type type of the value being passed
* @ return string representation */
public static final String printExtendedAttribute ( MSPDIWriter writer , Objec... | String result ; if ( type == DataType . DATE ) { result = printExtendedAttributeDate ( ( Date ) value ) ; } else { if ( value instanceof Boolean ) { result = printExtendedAttributeBoolean ( ( Boolean ) value ) ; } else { if ( value instanceof Duration ) { result = printDuration ( writer , ( Duration ) value ) ; } else ... |
public class ObjectMappableProcessor { /** * Get the package name of a certain clazz
* @ param clazz The class you want the packagename for
* @ return The package name */
private String getPackageName ( ObjectMappableAnnotatedClass clazz ) { } } | PackageElement pkg = elements . getPackageOf ( clazz . getElement ( ) ) ; return pkg . isUnnamed ( ) ? "" : pkg . getQualifiedName ( ) . toString ( ) ; |
public class BucketTreeStack { /** * Trims the capacity of this < tt > BucketArrayList < / tt > instance to be the
* list ' s current size . An application can use this operation to minimize
* the storage of an < tt > BucketArrayList < / tt > instance . */
public void trimToSize ( ) { } } | modCount ++ ; while ( ( bucketDepth > 0 ) && ( bucketSize << ( ( bucketDepth - 1 ) * bucketExp ) >= size ) ) { bucket = ( Object [ ] ) bucket [ 0 ] ; } |
public class RuleBasedOptimizer { /** * Method that is used to add the indexing rules to the rule stack . This method can be overridden by subclasses when custom
* indexing rules are to be used . By default , this method simply adds the { @ link AddIndexes } rule .
* @ param ruleStack the stack where the rules shou... | ruleStack . addLast ( AddIndexes . implicitIndexes ( ) ) ; |
public class UpdateGroupQueryRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdateGroupQueryRequest updateGroupQueryRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updateGroupQueryRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateGroupQueryRequest . getGroupName ( ) , GROUPNAME_BINDING ) ; protocolMarshaller . marshall ( updateGroupQueryRequest . getResourceQuery ( ) , RESOURCEQUERY... |
public class SearchPortletController { /** * Display AJAX autocomplete search results for the last query */
@ ResourceMapping ( value = "retrieveSearchJSONResults" ) public ModelAndView showJSONSearchResults ( PortletRequest request ) { } } | PortletPreferences prefs = request . getPreferences ( ) ; int maxTextLength = Integer . parseInt ( prefs . getValue ( AUTOCOMPLETE_MAX_TEXT_LENGTH_PREF_NAME , "180" ) ) ; final Map < String , Object > model = new HashMap < > ( ) ; List < AutocompleteResultsModel > results = new ArrayList < > ( ) ; final PortletSession ... |
public class SQLPPMappingToR2RMLConverter { /** * the method to write the R2RML mappings
* from an rdf Model to a file
* @ param file the ttl file to write to */
public void write ( File file ) throws Exception { } } | try { FileOutputStream fos = new FileOutputStream ( file ) ; write ( fos ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; throw e ; } |
public class EJSHome { /** * This method creates and returns a new < code > BeanO < / code > instance
* appropriate for this home . < p >
* The returned < code > BeanO < / code > has a newly created enterprise
* bean instance associated with it , and the enterprise bean instance
* has had its set . . . Context ... | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; // d532639.2
if ( isTraceOn && tc . isEntryEnabled ( ) ) // d367572.7
Tr . entry ( tc , "createBeanO(ContainerTx, activate) activate = " + activate ) ; homeEnabled ( ) ; BeanO result = null ; // For Stateless Session beans , the number of ' active ' b... |
public class JQMListItem { /** * Sets the image to be used to the given source url .
* < br > The same as setImage ( ) , but image is marked as thumbnail class . */
public void setThumbnail ( String src ) { } } | setImage ( src ) ; if ( imageElem != null ) { imageElem . removeClassName ( "jqm4gwt-listitem-icon" ) ; imageElem . addClassName ( "jqm4gwt-listitem-thumb" ) ; } |
public class CmsPropertyChange { /** * Sets the given property with the given value to the given resource
* ( potentially recursiv ) if it has not been set before . < p >
* Returns a list with all sub resources that have been modified this way . < p >
* @ param resourceRootPath the resource on which property defi... | CmsObject cms = getCms ( ) ; // collect the resources to look up
List resources = new ArrayList ( ) ; if ( recursive ) { resources = cms . readResources ( resourceRootPath , CmsResourceFilter . IGNORE_EXPIRATION ) ; } else { resources . add ( resourceRootPath ) ; } List changedResources = new ArrayList ( resources . si... |
public class UnboundTypeReference { /** * Create a new , managed unbound type reference for the given type parameter which was
* first encountered for the given expression .
* @ param expression the expression that used / referenced the type parameter
* @ param typeParameter the type parameter
* @ param expecta... | return expectation . createUnboundTypeReference ( expression , typeParameter ) ; |
public class Transliterator { /** * Finishes any pending transliterations that were waiting for
* more characters . Clients should call this method as the last
* call after a sequence of one or more calls to
* < code > transliterate ( ) < / code > .
* @ param text the buffer holding transliterated and
* untra... | index . validate ( text . length ( ) ) ; filteredTransliterate ( text , index , false , true ) ; |
public class AmazonEnvironmentAwareClientBuilder { /** * Gets setting .
* @ param key the key
* @ param defaultValue the default value
* @ return the setting */
public String getSetting ( final String key , final String defaultValue ) { } } | val result = environment . getProperty ( this . propertyPrefix + '.' + key ) ; return StringUtils . defaultIfBlank ( result , defaultValue ) ; |
public class GobblinYarnLogSource { /** * Multiple directories may be specified in the LOG _ DIRS string . Split them up and return a list of { @ link Path } s .
* @ return list of { @ link Path } s to the log directories
* @ throws IOException */
private List < Path > getLocalLogDirs ( ) throws IOException { } } | String logDirs = System . getenv ( ApplicationConstants . Environment . LOG_DIRS . toString ( ) ) ; return COMMA_SPLITTER . splitToList ( logDirs ) . stream ( ) . map ( e -> new Path ( e ) ) . collect ( Collectors . toList ( ) ) ; |
public class CsvReader { /** * Configures the reader to read the CSV data and parse it to the given type . The type must be a subclass of
* { @ link Tuple } . The type information for the fields is obtained from the type class . The type
* consequently needs to specify all generic field types of the tuple .
* @ p... | Preconditions . checkNotNull ( targetType , "The target type class must not be null." ) ; if ( ! Tuple . class . isAssignableFrom ( targetType ) ) { throw new IllegalArgumentException ( "The target type must be a subclass of " + Tuple . class . getName ( ) ) ; } @ SuppressWarnings ( "unchecked" ) TupleTypeInfo < T > ty... |
public class AstyanaxBlockedDataReaderDAO { /** * Decodes rows returned by scanning across tables . */
private Iterator < MultiTableScanResult > scanMultiTableRows ( final TableSet tables , final DeltaPlacement placement , final ByteBufferRange rowRange , final LimitCounter limit , final boolean includeDroppedTables , ... | // Avoiding pinning multiple decoded rows into memory at once .
return limit . limit ( new AbstractIterator < MultiTableScanResult > ( ) { private PeekingIterator < Row < ByteBuffer , DeltaKey > > _iter = Iterators . peekingIterator ( rowScan ( placement , rowRange , _maxColumnsRange , LimitCounter . max ( ) , consiste... |
public class LCharToLongFuncDelta { /** * < editor - fold desc = " object " > */
public static boolean argEquals ( LCharToLongFuncDelta the , Object that ) { } } | return Null . < LCharToLongFuncDelta > equals ( the , that , ( one , two ) -> { if ( one . getClass ( ) != two . getClass ( ) ) { return false ; } LCharToLongFuncDelta other = ( LCharToLongFuncDelta ) two ; return LBiObjLongTriple . argEquals ( one . function , one . deltaFunction , one . lastValue ( ) , other . functi... |
public class BuiltInErrorProducer { /** * Called from the error handling config instance , after a configuration update or initial configuration .
* @ param errorHandlingConfig */
public void afterConfiguration ( ErrorHandlingConfig errorHandlingConfig ) { } } | if ( ! errorProducerEnabled ) return ; this . errorHandlingConfig = errorHandlingConfig ; // first create default - catchers
ErrorCatcherConfig [ ] defaultCatcherConfigs = errorHandlingConfig . getDefaultCatchers ( ) ; if ( defaultCatcherConfigs != null && defaultCatcherConfigs . length > 0 ) { defaultCatchers = new Co... |
public class Marc { /** * Transform W3C document of the record in the ISO 2709 input stream by an XSL stylesheet .
* @ param stylesheetUrl the URL of the stylesheet
* @ param result the result of the transformation
* @ throws IOException if transformation fails */
public void transform ( URL stylesheetUrl , Resul... | transform ( TransformerFactory . newInstance ( ) , stylesheetUrl , result ) ; |
public class StorePackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getBimServerInfo ( ) { } } | if ( bimServerInfoEClass == null ) { bimServerInfoEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( StorePackage . eNS_URI ) . getEClassifiers ( ) . get ( 88 ) ; } return bimServerInfoEClass ; |
public class DeviceFinder { /** * Remove any device announcements that are so old that the device seems to have gone away . */
private void expireDevices ( ) { } } | long now = System . currentTimeMillis ( ) ; // Make a copy so we don ' t have to worry about concurrent modification .
Map < InetAddress , DeviceAnnouncement > copy = new HashMap < InetAddress , DeviceAnnouncement > ( devices ) ; for ( Map . Entry < InetAddress , DeviceAnnouncement > entry : copy . entrySet ( ) ) { if ... |
public class WrappingUtils { /** * Updates the overlay - color rounding of the parent ' s child drawable .
* < ul >
* < li > If rounding mode is OVERLAY _ COLOR and the child is not a RoundedCornersDrawable ,
* a new RoundedCornersDrawable is created and the child gets wrapped with it .
* < li > If rounding mod... | Drawable child = parent . getDrawable ( ) ; if ( roundingParams != null && roundingParams . getRoundingMethod ( ) == RoundingParams . RoundingMethod . OVERLAY_COLOR ) { // Overlay rounding requested - either update the overlay params or add a new
// drawable that will do the requested rounding .
if ( child instanceof R... |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getEDI ( ) { } } | if ( ediEClass == null ) { ediEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 239 ) ; } return ediEClass ; |
public class IOUtil { /** * Reads the entries of a Header and returns a map containing the
* { @ link HeaderKey } as key and { @ link StandardField } as value .
* The map is initialized with all possible HeaderKeys of the subtype and
* empty fields .
* The passed instances must not be null and the specName must... | assert clazz != null && specFormat != null && headerbytes != null ; /* initializers */
// init a full map with default fields . Fields that can be read are
// changed subsequently
Map < T , StandardField > data = initFullEnumMap ( clazz ) ; // use the specification format to get the right indices
int descriptionIndex =... |
public class S3StorageObjectMetadata { /** * Adds the key value pair of custom user - metadata for the associated object .
* @ param key the key of user metadata
* @ param value the value of user metadata */
@ Override public void addUserMetadata ( String key , String value ) { } } | this . s3Metadata . addUserMetadata ( key , value ) ; |
public class ConversationManager { /** * region Metadata */
private ConversationMetadata resolveMetadata ( ) throws ConversationMetadataLoadException { } } | checkConversationQueue ( ) ; try { // attempt to load the encrypted metadata file
File metaFile = new File ( conversationsStorageDir , CONVERSATION_METADATA_FILE ) ; if ( metaFile . exists ( ) ) { ApptentiveLog . v ( CONVERSATION , "Loading metadata file: %s" , metaFile ) ; return ObjectSerialization . deserialize ( me... |
public class VcfVariantAnnotator { /** * Updates VariantAnnotation objects in variantAnnotationList .
* @ param variantList List of Variant objects . variantList and variantAnnotationList must contain variants in the
* SAME order : variantAnnotation at position i must correspond to variant i */
public void run ( Li... | for ( int i = 0 ; i < variantList . size ( ) ; i ++ ) { Map < String , AdditionalAttribute > customAnnotation = getCustomAnnotation ( variantList . get ( i ) ) ; // Update only if there are annotations for this variant . customAnnotation may be empty if the variant
// exists in the vcf but the info field does not conta... |
public class AWSServiceCatalogClient { /** * Copies the specified source product to the specified target product or a new product .
* You can copy a product to the same account or another account . You can copy a product to the same region or
* another region .
* This operation is performed asynchronously . To tr... | request = beforeClientExecution ( request ) ; return executeCopyProduct ( request ) ; |
public class AutoSizingTextArea { /** * Returns the size of the shadow element */
@ Override public int getShadowSize ( ) { } } | Element shadowElement = shadow . getElement ( ) ; shadowElement . setScrollTop ( 10000 ) ; return shadowElement . getScrollTop ( ) ; |
public class SpecializedOps_DDRM { /** * Creates a reflector from the provided vector and gamma . < br >
* < br >
* Q = I - & gamma ; u u < sup > T < / sup > < br >
* In practice { @ link VectorVectorMult _ DDRM # householder ( double , DMatrixD1 , DMatrixD1 , DMatrixD1 ) } multHouseholder }
* should be used fo... | if ( ! MatrixFeatures_DDRM . isVector ( u ) ) throw new IllegalArgumentException ( "u must be a vector" ) ; DMatrixRMaj Q = CommonOps_DDRM . identity ( u . getNumElements ( ) ) ; CommonOps_DDRM . multAddTransB ( - gamma , u , u , Q ) ; return Q ; |
public class AlexaInput { /** * Checks if a slot is contained in the intent request and its value is not blank .
* @ param slotName name of the slot to look after
* @ return True , if the slot exists in the intent request and is not blank . */
public boolean hasSlotNotBlank ( final String slotName ) { } } | return hasSlot ( slotName ) && StringUtils . isNotBlank ( intentRequest . getIntent ( ) . getSlot ( slotName ) . getValue ( ) ) ; |
public class CachedResponseImpl { /** * Writes the cached headers to the response
* @ param pResponse the response */
public void writeHeadersTo ( final CacheResponse pResponse ) { } } | String [ ] headers = getHeaderNames ( ) ; for ( String header : headers ) { // HACK . . .
// Strip away internal headers
if ( HTTPCache . HEADER_CACHED_TIME . equals ( header ) ) { continue ; } // TODO : Replace Last - Modified with X - Cached - At ? See CachedEntityImpl
String [ ] headerValues = getHeaderValues ( head... |
public class Broadcast { /** * Broadcast absolute max op . See : { @ link BroadcastAMax } */
public static INDArray amax ( INDArray x , INDArray y , INDArray z , int ... dimensions ) { } } | if ( dimensions == null || dimensions . length == 0 ) { validateShapesNoDimCase ( x , y , z ) ; return Nd4j . getExecutioner ( ) . exec ( new AMax ( x , y , z ) ) ; } return Nd4j . getExecutioner ( ) . exec ( new BroadcastAMax ( x , y , z , dimensions ) ) ; |
public class AuthorizationHeaderProvider { /** * Gets the OAuth2 header .
* @ throws OAuthException if the OAuth2 token could not be refreshed . */
private String getOAuth2Header ( OAuth2Compatible oAuth2Compatible ) throws OAuthException { } } | if ( adsLibConfiguration . isAutoRefreshOAuth2TokenEnabled ( ) ) { try { oAuth2Helper . refreshCredential ( oAuth2Compatible . getOAuth2Credential ( ) ) ; } catch ( IOException e ) { throw new OAuthException ( "OAuth2 token could not be refreshed." , e ) ; } } return oAuth2AuthorizationHeaderProvider . getOAuth2Authori... |
public class systemuser { /** * Use this API to update systemuser resources . */
public static base_responses update ( nitro_service client , systemuser resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { systemuser updateresources [ ] = new systemuser [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { updateresources [ i ] = new systemuser ( ) ; updateresources [ i ] . username = resources [ i ] . username ; up... |
public class ModuleDeps { /** * Calls { @ link ModuleDepInfo # resolveWith ( Features ) } on each of the values in the map .
* @ param features
* the feature set to apply .
* @ param coerceUndefinedToFalse
* if true , undefined features will be treated as false
* @ return the current object */
public ModuleDe... | for ( ModuleDepInfo info : values ( ) ) { info . resolveWith ( features , coerceUndefinedToFalse ) ; } return this ; |
public class AbstractBundleLinkRenderer { /** * Creates a link to a bundle in the page .
* @ param bundleId
* the bundle ID
* @ param bundlePrefix
* the bundle prefix
* @ param randomParam
* the flag indicating if we should use randomParam
* @ param contextPath
* the context path
* @ param isSslReques... | // When debug mode is on and the resource is generated the path must
// include a parameter
String path = bundleId ; String fullPath = null ; if ( bundler . getConfig ( ) . isDebugModeOn ( ) ) { if ( bundler . getConfig ( ) . getGeneratorRegistry ( ) . isPathGenerated ( bundleId ) ) { path = PathNormalizer . createGene... |
public class Task { /** * Retrieve the finish slack .
* @ return finish slack */
public Duration getFinishSlack ( ) { } } | Duration finishSlack = ( Duration ) getCachedValue ( TaskField . FINISH_SLACK ) ; if ( finishSlack == null ) { Duration duration = getDuration ( ) ; if ( duration != null ) { finishSlack = DateHelper . getVariance ( this , getEarlyFinish ( ) , getLateFinish ( ) , duration . getUnits ( ) ) ; set ( TaskField . FINISH_SLA... |
public class WSSubject { /** * This convenient method returns the caller principal of the
* current executing thread .
* It will extract the caller from the received credentials of
* the current thread . If the received credentials is null , then
* a value of null is returned . In the EJB and Web container ,
... | String caller = null ; SubjectManagerService sms = smServiceRef . getService ( ) ; if ( sms != null ) { Subject subject = sms . getCallerSubject ( ) ; if ( subject != null ) { WSCredential wsCred = getWSCredential ( subject ) ; if ( wsCred != null && ! wsCred . isUnauthenticated ( ) ) { try { caller = wsCred . getSecur... |
public class Task { /** * This method allows a resource assignment to be added to the
* current task .
* @ param resource the resource to assign
* @ return ResourceAssignment object */
public ResourceAssignment addResourceAssignment ( Resource resource ) { } } | ResourceAssignment assignment = getExistingResourceAssignment ( resource ) ; if ( assignment == null ) { assignment = new ResourceAssignment ( getParentFile ( ) , this ) ; m_assignments . add ( assignment ) ; getParentFile ( ) . getResourceAssignments ( ) . add ( assignment ) ; assignment . setTaskUniqueID ( getUniqueI... |
public class BaseCommandTask { /** * Prompt the user to enter text .
* Prompts twice and compares to ensure it was entered correctly .
* @ return Entered String */
private String promptForText ( ConsoleWrapper stdin , PrintStream stdout , String enterText , String reenterText , String readError , String entriesDidN... | String read1 = stdin . readMaskedText ( getMessage ( enterText ) + " " ) ; String read2 = stdin . readMaskedText ( getMessage ( reenterText ) + " " ) ; if ( read1 == null && read2 == null ) { throw new IllegalArgumentException ( "Unable to read either entry. Aborting prompt." ) ; } else if ( read1 == null || read2 == n... |
public class SibRaDynamicDestinationEndpointActivation { /** * Connects to the given messaging engine . Registers a destination listener
* and creates listeners for each of the current destinations .
* @ param messagingEngine
* the messaging engine to connect to */
synchronized protected void addMessagingEngine (... | final String methodName = "addMessagingEngine" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , messagingEngine ) ; } SibRaMessagingEngineConnection connection = null ; try { /* * Get a connection for the messaging engine */
connection = getCo... |
public class GroupContactSet { /** * Tell whether the given group pair is a contact in this GroupContactSet ,
* the comparison is done by matching residue numbers and chain identifiers
* @ param group1
* @ param group2
* @ return */
public boolean hasContact ( Group group1 , Group group2 ) { } } | return hasContact ( group1 . getResidueNumber ( ) , group2 . getResidueNumber ( ) ) ; |
public class TagSupport { /** * check if value is not empty
* @ param tagName
* @ param actionName
* @ param attributeName
* @ param attribute
* @ throws PageException */
public void required ( final String tagName , final String actionName , final String attributeName , final Object attribute ) throws PageEx... | if ( attribute == null ) { final Excepton util = CFMLEngineFactory . getInstance ( ) . getExceptionUtil ( ) ; throw util . createApplicationException ( "Attribute [" + attributeName + "] for tag [" + tagName + "] is required if attribute action has the value [" + actionName + "]" ) ; } |
public class NullnessAnalysis { /** * Returns the { @ link Nullness } of the leaf of { @ code exprPath } .
* < p > If the leaf required the compiler to generate autoboxing or autounboxing calls , { @ code
* getNullness } returns the { @ code Nullness } < i > after < / i > the boxing / unboxing . This implies that ,... | try { nullnessPropagation . setContext ( context ) . setCompilationUnit ( exprPath . getCompilationUnit ( ) ) ; return DataFlow . expressionDataflow ( exprPath , context , nullnessPropagation ) ; } finally { nullnessPropagation . setContext ( null ) . setCompilationUnit ( null ) ; } |
public class PeasyRecyclerView { /** * Present as Vertical List View
* Execute { @ link # resetItemDecorations ( ) }
* Execute { @ link # resetItemAnimator ( ) }
* @ return LinearLayoutManager */
public LinearLayoutManager asVerticalListView ( ) { } } | this . presentation = PeasyPresentation . VerticalList ; resetItemDecorations ( ) ; resetItemAnimator ( ) ; final LinearLayoutManager layoutManager = PeasyRecyclerView . VerticalList . newLayoutManager ( getContext ( ) ) ; getRecyclerView ( ) . setLayoutManager ( layoutManager ) ; getRecyclerView ( ) . addItemDecoratio... |
public class WsMessageRouterImpl { /** * Add the WsLogHandler ref . 1 or more LogHandlers may be set . */
public void setWsLogHandler ( String id , WsLogHandler ref ) { } } | if ( id != null && ref != null ) { // There can be many Reader locks , but only one writer lock .
// This ReaderWriter lock is needed to avoid duplicate messages when the class is passing on EarlyBuffer messages to the new WsLogHandler .
RERWLOCK . writeLock ( ) . lock ( ) ; try { wsLogHandlerServices . put ( id , ref ... |
public class CertifyingSigner { /** * Get a certifying signer instance from the given signer factory for a given certifier .
* @ param forSigning true for signing , and false for verifying .
* @ param certifier the certified key pair of the certifier .
* @ param factory a signer factory to create the signer .
*... | return new CertifyingSigner ( certifier . getCertificate ( ) , factory . getInstance ( forSigning , certifier . getPrivateKey ( ) ) ) ; |
public class MvcDialog { /** * Show dialog .
* @ param fragmentManager The fragment manager . Usually it ' s the child fragment manager of the
* fragment on which the dialog will show
* @ param dialogClass The class type of the dialog extending { @ link MvcDialog } */
public static void show ( FragmentManager fra... | FragmentTransaction ft = fragmentManager . beginTransaction ( ) ; MvcDialog dialogFragment = ( MvcDialog ) fragmentManager . findFragmentByTag ( dialogClass . getName ( ) ) ; if ( dialogFragment == null ) { try { dialogFragment = new ReflectUtils . newObjectByType < > ( dialogClass ) . newInstance ( ) ; } catch ( Excep... |
public class StatementMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Statement statement , ProtocolMarshaller protocolMarshaller ) { } } | if ( statement == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( statement . getMessages ( ) , MESSAGES_BINDING ) ; protocolMarshaller . marshall ( statement . getResponseCard ( ) , RESPONSECARD_BINDING ) ; } catch ( Exception e ) { throw n... |
public class EDBConverter { /** * Generate the value for a specific property of a model out of an EDBObject . */
private Object getValueForProperty ( PropertyDescriptor propertyDescriptor , EDBObject object ) { } } | Method setterMethod = propertyDescriptor . getWriteMethod ( ) ; String propertyName = propertyDescriptor . getName ( ) ; Object value = object . getObject ( propertyName ) ; Class < ? > parameterType = setterMethod . getParameterTypes ( ) [ 0 ] ; // TODO : OPENENGSB - 2719 do that in a better way than just an if - else... |
public class CrawlController { /** * Wait until this crawling session finishes . */
public void waitUntilFinish ( ) { } } | while ( ! finished ) { synchronized ( waitingLock ) { if ( config . isHaltOnError ( ) ) { Throwable t = getError ( ) ; if ( t != null && config . isHaltOnError ( ) ) { if ( t instanceof RuntimeException ) { throw ( RuntimeException ) t ; } else if ( t instanceof Error ) { throw ( Error ) t ; } else { throw new RuntimeE... |
public class Base64 { /** * Similar to { @ link # encodeBytes ( byte [ ] ) } but returns a byte array instead of
* instantiating a String . This is more efficient if you ' re working with I / O
* streams and have large data sets to encode .
* @ param source
* The data to convert
* @ return The Base64 - encode... | byte [ ] encoded ; try { encoded = encodeBytesToBytes ( source , 0 , source . length , NO_OPTIONS ) ; } catch ( final IOException ex ) { throw new IllegalStateException ( "IOExceptions only come from GZipping, which is turned off" , ex ) ; } return encoded ; |
public class ConnectController { /** * Returns a RedirectView with the URL to redirect to after a connection is created or deleted .
* Defaults to " / connect / { providerId } " relative to DispatcherServlet ' s path .
* May be overridden to handle custom redirection needs .
* @ param providerId the ID of the pro... | HttpServletRequest servletRequest = request . getNativeRequest ( HttpServletRequest . class ) ; String path = connectionStatusUrlPath + providerId + getPathExtension ( servletRequest ) ; if ( prependServletPath ( servletRequest ) ) { path = servletRequest . getServletPath ( ) + path ; } return new RedirectView ( path ,... |
public class PayCreatResponse { /** * 第三方的支付流水号 */
@ Override public PayCreatResponse retcode ( int retcode ) { } } | this . retcode = retcode ; this . retinfo = PayRetCodes . retInfo ( retcode ) ; return this ; |
public class JawrRequestHandler { /** * Create the Jawr config from the properties
* @ param props
* the properties
* @ return the Jawr config */
protected JawrConfig createJawrConfig ( Properties props ) { } } | jawrConfig = new JawrConfig ( resourceType , props , configPropResolver ) ; // Override properties which are incompatible with the build time bundle
// processing
if ( ThreadLocalJawrContext . isBundleProcessingAtBuildTime ( ) ) { jawrConfig . setUseBundleMapping ( true ) ; // Use the standard working directory
jawrCon... |
public class KeyReader { /** * Make the request to the Twilio API to perform the read .
* @ param client TwilioRestClient with which to make the request
* @ return Key ResourceSet */
@ Override public ResourceSet < Key > read ( final TwilioRestClient client ) { } } | return new ResourceSet < > ( this , client , firstPage ( client ) ) ; |
public class BoundsCalculator { /** * Calculate the bounding rectangle for a reaction set .
* @ param reactionSet the reaction set to use
* @ return the bounding rectangle of the reaction set */
public static Rectangle2D calculateBounds ( IReactionSet reactionSet ) { } } | Rectangle2D totalBounds = new Rectangle2D . Double ( ) ; for ( IReaction reaction : reactionSet . reactions ( ) ) { Rectangle2D reactionBounds = calculateBounds ( reaction ) ; if ( totalBounds . isEmpty ( ) ) { totalBounds = reactionBounds ; } else { Rectangle2D . union ( totalBounds , reactionBounds , totalBounds ) ; ... |
public class JDBCValueContentAddressStorageImpl { /** * { @ inheritDoc } */
public void addValue ( String propertyId , int orderNum , String identifier ) throws VCASException { } } | try { Connection con = dataSource . getConnection ( ) ; try { PreparedStatement ps = con . prepareStatement ( sqlAddRecord ) ; ps . setString ( 1 , propertyId ) ; ps . setInt ( 2 , orderNum ) ; ps . setString ( 3 , identifier ) ; ps . executeUpdate ( ) ; ps . close ( ) ; } finally { con . close ( ) ; } } catch ( SQLExc... |
public class MDAG { /** * 后缀查询 < br >
* Retrieves all the Strings in the MDAG that begin with a given String .
* @ param suffixStr a String that is the suffix for all the desired Strings
* @ return a HashSet containing all the Strings present in the MDAG that end with { @ code suffixStr } */
public HashSet < Stri... | HashSet < String > strHashSet = new HashSet < String > ( ) ; if ( sourceNode != null ) // if the MDAG hasn ' t been simplified
getStrings ( strHashSet , SearchCondition . SUFFIX_SEARCH_CONDITION , suffixStr , "" , sourceNode . getOutgoingTransitions ( ) ) ; else getStrings ( strHashSet , SearchCondition . SUFFIX_SEARCH... |
public class GlobalExceptionHandler { /** * 构造错误
* @ param mvc mvc
* @ param error 错误
* @ return mvc */
@ SuppressWarnings ( "rawtypes" ) private ModelAndView buildError ( ModelAndView mvc , ResultCode error ) { } } | mvc . addObject ( "data" , new ArrayList ( 0 ) ) ; mvc . addObject ( "status" , error . getCode ( ) ) ; Map < String , Object > statusInfo = Maps . newHashMapWithExpectedSize ( 1 ) ; statusInfo . put ( WebResponseConstant . MESSAGE_GLOBAL , error . getMessage ( ) . getMessage ( ) ) ; mvc . addObject ( "statusInfo" , st... |
public class HasFilteringCompilerPass { /** * This method walks the AST looking for has calls . If the condition being tested
* by the has call is specified in the features , then replace the node for the call in
* the AST with a new node for a literal true / false . We rely on the optimizer to
* detect and remov... | for ( Node cursor = n . getFirstChild ( ) ; cursor != null ; cursor = cursor . getNext ( ) ) { if ( cursor . getType ( ) == Token . CALL ) { String hasCondition = NodeUtil . conditionFromHasNode ( cursor ) ; if ( hasCondition != null ) { if ( discoveredHasConditions != null ) { discoveredHasConditions . add ( hasCondit... |
public class LazyIterate { /** * Creates a deferred flattening iterable for the specified iterable */
public static < T , V > LazyIterable < V > flatCollect ( Iterable < T > iterable , Function < ? super T , ? extends Iterable < V > > function ) { } } | return new FlatCollectIterable < T , V > ( iterable , function ) ; |
public class OfflinerQueryHandler { /** * Save a result for offline access .
* @ param url key .
* @ param result value . */
public void put ( String url , String result ) { } } | if ( TextUtils . isEmpty ( url ) ) { return ; } ContentValues contentValues = new ContentValues ( ) ; contentValues . put ( OfflinerDBHelper . REQUEST_RESULT , result ) ; contentValues . put ( OfflinerDBHelper . REQUEST_URL , url ) ; contentValues . put ( OfflinerDBHelper . REQUEST_TIMESTAMP , Calendar . getInstance ( ... |
public class ObjectBuilder { /** * Creates a MapBuilder around the passed instance
* @ param instance
* @ param < K > the key type
* @ param < V > the value type
* @ return a MapBuilder object for method chaining */
public static < K , V > MapBuilder < K , V > map ( Map < K , V > instance ) { } } | return new MapBuilder < > ( instance ) ; |
public class ListUsersResult { /** * The list of users .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setUserList ( java . util . Collection ) } or { @ link # withUserList ( java . util . Collection ) } if you want to override
* the existing values .
*... | if ( this . userList == null ) { setUserList ( new java . util . ArrayList < User > ( userList . length ) ) ; } for ( User ele : userList ) { this . userList . add ( ele ) ; } return this ; |
public class RangeVariableResolver { /** * Assigns a set of conditions to a range variable . */
void assignToRangeVariable ( RangeVariable rangeVar , int rangeVarIndex , HsqlArrayList exprList , boolean isJoin ) { } } | if ( exprList . isEmpty ( ) ) { return ; } colIndexSetEqual . clear ( ) ; colIndexSetOther . clear ( ) ; for ( int j = 0 , size = exprList . size ( ) ; j < size ; j ++ ) { Expression e = ( Expression ) exprList . get ( j ) ; if ( rangeVar . hasIndexCondition ( ) ) { rangeVar . addCondition ( e , isJoin ) ; exprList . s... |
public class ToStringOption { /** * Return a < code > ToStringOption < / code > instance with { @ link # upToClass } option set .
* if the current instance is not { @ link # DEFAULT _ OPTION default instance } then set
* on the current instance and return the current instance . Otherwise , clone the default
* ins... | ToStringOption op = this ; if ( this == DEFAULT_OPTION ) { op = new ToStringOption ( this . appendStatic , this . appendTransient ) ; } op . upToClass = c ; return op ; |
public class RythmEngine { /** * Get an new template instance by template source { @ link java . io . File file }
* and an array of arguments .
* < p > When the args array contains only one element and is of { @ link java . util . Map } type
* the the render args are passed to template
* { @ link ITemplate # _ ... | boolean typeInferenceEnabled = conf ( ) . typeInferenceEnabled ( ) ; if ( typeInferenceEnabled ) { ParamTypeInferencer . registerParams ( this , args ) ; } String key = S . str ( resourceManager ( ) . get ( file ) . getKey ( ) ) ; if ( typeInferenceEnabled ) { key += ParamTypeInferencer . uuid ( ) ; } TemplateClass tc ... |
public class LinuxFile { /** * Runs an ioctl value command on a file descriptor .
* @ param command ioctl command
* @ param value int ioctl value
* @ return result of operation . Zero if everything is OK , less than zero if there was an error . */
public void ioctl ( long command , int value ) throws IOException ... | final int response = directIOCTL ( getFileDescriptor ( ) , command , value ) ; if ( response < 0 ) throw new LinuxFileException ( ) ; |
public class EvaluatorImpl { /** * Perform logical ' and ' between BooleanValue instances */
public static Boolean and ( Boolean a , Boolean b ) { } } | return andTable [ ttIndex ( a ) ] [ ttIndex ( b ) ] ; |
public class ClassifiedTBoxImpl { /** * constructs a ClassifiedTBox that has a reduced number of classes and properties in each equivalent class
* - each object property equivalence class contains one property ( representative )
* except when the representative property is equivalent to its inverse , in which
* c... | // OBJECT PROPERTIES
SimpleDirectedGraph < Equivalences < ObjectPropertyExpression > , DefaultEdge > objectProperties = new SimpleDirectedGraph < > ( DefaultEdge . class ) ; // classify vertices for properties
for ( Equivalences < ObjectPropertyExpression > node : reasoner . objectPropertiesDAG ( ) ) { ObjectPropertyEx... |
public class Button { /** * ( non - Javadoc )
* @ see qc . automation . framework . widget . element . InteractiveElement # getLabel ( ) */
@ Override public String getLabel ( ) throws WidgetException { } } | try { return getText ( ) ; } catch ( Exception e ) { throw new WidgetException ( "Error while getting button text" , getByLocator ( ) , e ) ; } |
public class HostAndPort { /** * Splits String into host and port parts .
* String must be in ( host + " : " + port ) format .
* Port is optional
* @ param from String to parse
* @ return array of host and port strings */
public static String [ ] extractParts ( String from ) { } } | int idx = from . lastIndexOf ( ":" ) ; String host = idx != - 1 ? from . substring ( 0 , idx ) : from ; String port = idx != - 1 ? from . substring ( idx + 1 ) : "" ; return new String [ ] { host , port } ; |
public class AtlasClientV2 { /** * / * Entity Calls */
public AtlasEntityWithExtInfo getEntityByGuid ( String guid ) throws AtlasServiceException { } } | return callAPI ( GET_ENTITY_BY_GUID , AtlasEntityWithExtInfo . class , ( MultivaluedMap < String , String > ) null , guid ) ; |
public class ChangeObjects { /** * method to generate the MonomerNotation in String format
* @ param id
* id of the MonomerNotation
* @ param count
* Count of the MonomerNotation
* @ param annotation
* Annotation of the MonomerNotation
* @ return MonomerNotation in String format */
private final static St... | if ( id . length ( ) > 1 ) { id = "[" + id + "]" ; } String result = id ; try { if ( ! ( Integer . parseInt ( count ) == 1 ) ) { result += "'" + count + "'" ; } } catch ( NumberFormatException e ) { result += "'" + count + "'" ; } if ( annotation != null ) { result += "\"" + annotation + "\"" ; } return result ; |
public class InternalXbaseParser { /** * InternalXbase . g : 642:1 : ruleXMemberFeatureCall : ( ( rule _ _ XMemberFeatureCall _ _ Group _ _ 0 ) ) ; */
public final void ruleXMemberFeatureCall ( ) throws RecognitionException { } } | int stackSize = keepStackSize ( ) ; try { // InternalXbase . g : 646:2 : ( ( ( rule _ _ XMemberFeatureCall _ _ Group _ _ 0 ) ) )
// InternalXbase . g : 647:2 : ( ( rule _ _ XMemberFeatureCall _ _ Group _ _ 0 ) )
{ // InternalXbase . g : 647:2 : ( ( rule _ _ XMemberFeatureCall _ _ Group _ _ 0 ) )
// InternalXbase . g : ... |
public class RecurringData { /** * Calculate start dates for a yearly recurrence .
* @ param calendar current date
* @ param dates array of start dates */
private void getYearlyDates ( Calendar calendar , List < Date > dates ) { } } | if ( m_relative ) { getYearlyRelativeDates ( calendar , dates ) ; } else { getYearlyAbsoluteDates ( calendar , dates ) ; } |
public class MatrixFeatures_ZDRM { /** * Checks to see if a matrix is lower triangular or Hessenberg . A Hessenberg matrix of degree N
* has the following property : < br >
* < br >
* a < sub > ij < / sub > & le ; 0 for all i & lt ; j + N < br >
* < br >
* A triangular matrix is a Hessenberg matrix of degree ... | tol *= tol ; for ( int i = 0 ; i < A . numRows - hessenberg - 1 ; i ++ ) { for ( int j = i + hessenberg + 1 ; j < A . numCols ; j ++ ) { int index = ( i * A . numCols + j ) * 2 ; double real = A . data [ index ] ; double imag = A . data [ index + 1 ] ; double mag = real * real + imag * imag ; if ( ! ( mag <= tol ) ) { ... |
public class StormConfigGenerator { /** * Read yaml config object from the yaml file at specified file .
* @ param targetFile target file
* @ return config read from yaml
* @ throws IOException Fail read yaml file or convert to config object . */
@ SuppressWarnings ( "unchecked" ) public static Map < String , Obj... | Map < String , Object > configObject = null ; Yaml yaml = new Yaml ( ) ; InputStream inputStream = null ; InputStreamReader steamReader = null ; try { inputStream = new FileInputStream ( targetFile ) ; steamReader = new InputStreamReader ( inputStream , "UTF-8" ) ; configObject = ( Map < String , Object > ) yaml . load... |
public class MergingWindowSet { /** * Removes the given window from the set of in - flight windows .
* @ param window The { @ code Window } to remove . */
public void retireWindow ( W window ) { } } | W removed = this . mapping . remove ( window ) ; if ( removed == null ) { throw new IllegalStateException ( "Window " + window + " is not in in-flight window set." ) ; } |
public class HeartbeatImpl { /** * Update a server with a heartbeat update .
* @ param server the server to be updated
* @ param update the new update information */
void updateServer ( ServerHeartbeat server , UpdateServerHeartbeat update ) { } } | if ( server . isSelf ( ) ) { return ; } String externalId = update . getExternalId ( ) ; updateExternal ( server , externalId ) ; // XXX : validation
server . setSeedIndex ( update . getSeedIndex ( ) ) ; if ( server . onHeartbeatUpdate ( update ) ) { if ( server . isUp ( ) ) { onServerStart ( server ) ; } else { onServ... |
public class CurrencyUnitBuilder { /** * Returns a new instance of { @ link BuildableCurrencyUnit } and publishes it so it is
* accessible from the { @ code Monetary } singleton .
* @ param register if { @ code true } the instance created is published so it is accessible from
* the { @ code Monetary } singleton .... | BuildableCurrencyUnit cu = new BuildableCurrencyUnit ( this ) ; if ( register ) { ConfigurableCurrencyUnitProvider . registerCurrencyUnit ( cu ) ; ConfigurableCurrencyUnitProvider . registerCurrencyUnit ( cu , locale ) ; } return cu ; |
public class Packer { /** * Add gridx = RELATIVE to the constraints for the current component if how = =
* true 0 it if false . */
public Packer setXLeftRelative ( final boolean how ) { } } | if ( how == true ) { gc . gridx = GridBagConstraints . RELATIVE ; } else { gc . gridx = 0 ; } setConstraints ( comp , gc ) ; return this ; |
public class StreamUtils { /** * Copy the contents of the given byte array to the given OutputStream .
* Leaves the stream open when done .
* @ param in the byte array to copy from
* @ param out the OutputStream to copy to
* @ throws IOException in case of I / O errors */
public static void copy ( byte [ ] in ,... | Assert . notNull ( in , "No input byte array specified" ) ; Assert . notNull ( out , "No OutputStream specified" ) ; out . write ( in ) ; |
public class AbstractTable { /** * Gets the selected item id or in multiselect mode the selected ids .
* @ param table
* the table to retrieve the selected ID ( s )
* @ return the ID ( s ) which are selected in the table */
@ SuppressWarnings ( "unchecked" ) public static < T > Set < T > getTableValue ( final Tab... | final Object value = table . getValue ( ) ; Set < T > idsReturn ; if ( value == null ) { idsReturn = Collections . emptySet ( ) ; } else if ( value instanceof Collection ) { final Collection < T > ids = ( Collection < T > ) value ; idsReturn = ids . stream ( ) . filter ( Objects :: nonNull ) . collect ( Collectors . to... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.