signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class NullAwayBenchmarkHarness { /** * Some recommendations for this mode .
* < ul >
* < li > Disable all other checks but NullAway by passing { @ code - XepDisableAllChecks
* - Xep : NullAway : WARN } after other EP options
* < li > If you want to just benchmark the baseline without NullAway , only pass... | List < String > javacArgs = new ArrayList < > ( Arrays . asList ( args ) ) ; String nullawayJar = getJarFileForClass ( NullAway . class ) . getFile ( ) ; // add NullAway jar to existing processor path if found
boolean foundProcessorPath = false ; for ( int i = 0 ; i < javacArgs . size ( ) ; i ++ ) { if ( javacArgs . ge... |
public class DPTXlator { /** * Translates the < code > value < / code > according to the set datapoint ID .
* If , and only if , < code > value < / code > can successfully be translated , it gets
* stored by the translator , replacing any old items . Textual commands contained in
* < code > value < / code > are t... | final short [ ] buf = new short [ typeSize > 0 ? typeSize : 1 ] ; toDPT ( value , buf , 0 ) ; data = buf ; |
public class VirtualNetworkGatewayConnectionsInner { /** * The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider .
* @ param resourceGroupName The... | return beginSetSharedKeyWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayConnectionName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class Engine { /** * Reset the local idle timers , now that we have received some data .
* If we have set an idle timeout the client must send some data at least that often ,
* we double the timeout before checking . */
private void resetReceiveIdleTimer ( Event event ) { } } | final String methodName = "resetReceiveIdleTimer" ; logger . entry ( this , methodName , event ) ; if ( receiveScheduledFuture != null ) { receiveScheduledFuture . cancel ( false ) ; } final Transport transport = event . getTransport ( ) ; if ( transport != null ) { final int localIdleTimeOut = transport . getIdleTimeo... |
public class AUTH { /** * Handles a GMS header
* @ param gms _ hdr
* @ param msg
* @ return true if the message should be passed up , or else false */
protected boolean handleAuthHeader ( GMS . GmsHeader gms_hdr , AuthHeader auth_hdr , Message msg ) { } } | if ( needsAuthentication ( gms_hdr ) ) { if ( this . auth_token . authenticate ( auth_hdr . getToken ( ) , msg ) ) return true ; // authentication passed , send message up the stack
else { log . warn ( "%s: failed to validate AuthHeader (token: %s) from %s; dropping message and sending " + "rejection message" , local_a... |
public class DomainUtil { /** * Based on the current request represented by the HttpExchange construct a complete URL for the supplied path .
* @ param exchange - The current HttpExchange
* @ param path - The path to include in the constructed URL
* @ return The constructed URL */
public static String constructUr... | final HeaderMap headers = exchange . getRequestHeaders ( ) ; String host = headers . getFirst ( HOST ) ; String protocol = exchange . getConnection ( ) . getSslSessionInfo ( ) != null ? "https" : "http" ; return protocol + "://" + host + path ; |
public class HelpDoclet { /** * Doclet implementations ( subclasses ) should return a GSONWorkUnit - derived object if the GSON objects
* for the DocumentedFeature needs to contain custom values .
* @ return a GSONWorkUnit - derived object */
protected GSONWorkUnit createGSONWorkUnit ( final DocWorkUnit workUnit , ... | return new GSONWorkUnit ( ) ; |
public class MinMaxBinaryArrayDoubleEndedHeap { /** * Given a node at a maximum level , find its child or grandchild with the
* maximum key . This method should not be called for a node which has no
* children .
* @ param k
* a node at a maximum level
* @ return the child or grandchild with a maximum key , or... | int gc = 4 * k ; int maxgc ; K gcValue ; // 4 grandchilden
if ( gc + 3 <= size ) { gcValue = array [ gc ] ; maxgc = gc ; if ( ( ( Comparable < ? super K > ) array [ ++ gc ] ) . compareTo ( gcValue ) > 0 ) { gcValue = array [ gc ] ; maxgc = gc ; } if ( ( ( Comparable < ? super K > ) array [ ++ gc ] ) . compareTo ( gcVal... |
public class SeleniumProxyHandler { protected HttpTunnel newHttpTunnel ( HttpRequest request , HttpResponse response , InetAddress iaddr , int port , int timeoutMS ) throws IOException { } } | try { Socket socket = new Socket ( iaddr , port ) ; socket . setSoTimeout ( timeoutMS ) ; socket . setTcpNoDelay ( true ) ; return new HttpTunnel ( socket , null , null ) ; } catch ( IOException e ) { log . log ( Level . FINE , "Exception thrown" , e ) ; response . sendError ( HttpResponse . __400_Bad_Request ) ; retur... |
public class Utils { /** * Throws a IllegalArgumentException if given String is empty
* @ param str the parameter to check
* @ param message the parameter to check
* @ return the provided parameter */
public static String checkNotEmpty ( String str , String message ) { } } | if ( checkNotNull ( str ) . isEmpty ( ) ) { throw new IllegalArgumentException ( message ) ; } return str ; |
public class ERELoading { /** * = = = = Fillers and transforming them to APF entity / value / time = = = = */
private EREFiller toFiller ( final Element xml , final String docid ) { } } | final String id = generateID ( XMLUtils . requiredAttribute ( xml , "id" ) , docid ) ; final String type = XMLUtils . requiredAttribute ( xml , "type" ) ; final int extentStart = XMLUtils . requiredIntegerAttribute ( xml , "offset" ) ; final int extentEnd = extentStart + XMLUtils . requiredIntegerAttribute ( xml , "len... |
public class SqlREPL { /** * メッセージの表示
* @ throws IOException IO例外 */
private void showMessage ( final Terminal terminal , final String path ) { } } | String messageFilePath = this . getClass ( ) . getPackage ( ) . getName ( ) . replace ( "." , "/" ) + path ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( messageFilePath ) , Charset . forName ( "UTF-8" ) ) ) ) {... |
public class PelopsClient { /** * ( non - Javadoc )
* @ see
* com . impetus . kundera . client . ClientBase # onPersist ( com . impetus . kundera . metadata
* . model . EntityMetadata , java . lang . Object , java . lang . Object ,
* java . util . List ) */
@ Override protected void onPersist ( EntityMetadata m... | if ( ! isOpen ( ) ) { throw new PersistenceException ( "PelopsClient is closed." ) ; } // check for counter column
if ( isUpdate && metadata . isCounterColumnType ( ) ) { throw new UnsupportedOperationException ( "Invalid operation! Merge is not possible over counter column." ) ; } String insert_Query = null ; if ( isC... |
public class ColorDrawable { /** * Sets the drawable ' s color value . This action will clobber the results of prior calls to
* { @ link # setAlpha ( int ) } on this object , which side - affected the underlying color .
* @ param color The color to draw . */
public void setColor ( int color ) { } } | if ( mState . mBaseColor != color || mState . mUseColor != color ) { invalidateSelf ( ) ; mState . mBaseColor = mState . mUseColor = color ; } |
public class CmsLinkValidationInternalTable { /** * Reloads the table . < p > */
void reload ( ) { } } | List < CmsResource > broken = m_linkValidator . failedResources ( m_resourcesToCheck ) ; if ( broken . size ( ) > 0 ) { setVisible ( true ) ; m_introComponent . setVisible ( false ) ; m_nullComponent . setVisible ( false ) ; } else { setVisible ( false ) ; m_introComponent . setVisible ( false ) ; m_nullComponent . set... |
public class IndustryApi { /** * List character industry jobs ( asynchronously ) List industry jobs placed
* by a character - - - This route is cached for up to 300 seconds SSO Scope :
* esi - industry . read _ character _ jobs . v1
* @ param characterId
* An EVE character ID ( required )
* @ param datasource... | com . squareup . okhttp . Call call = getCharactersCharacterIdIndustryJobsValidateBeforeCall ( characterId , datasource , ifNoneMatch , includeCompleted , token , callback ) ; Type localVarReturnType = new TypeToken < List < CharacterIndustryJobsResponse > > ( ) { } . getType ( ) ; apiClient . executeAsync ( call , loc... |
public class Waiter { /** * Waits for a text to be shown .
* @ param text the text that needs to be shown , specified as a regular expression .
* @ param expectedMinimumNumberOfMatches the minimum number of matches of text that must be shown . { @ code 0 } means any number of matches
* @ param timeout the amount ... | return waitForText ( TextView . class , text , expectedMinimumNumberOfMatches , timeout , scroll , onlyVisible , hardStoppage ) ; |
public class DRConsumerDrIdTracker { /** * Merge the given tracker with the current tracker . Ranges can
* overlap . After the merge , the current tracker will be truncated to the
* larger safe point .
* @ param tracker */
public void mergeTracker ( DRConsumerDrIdTracker tracker ) { } } | final long newSafePoint = Math . max ( tracker . getSafePointDrId ( ) , getSafePointDrId ( ) ) ; m_map . addAll ( tracker . m_map ) ; truncate ( newSafePoint ) ; m_lastSpUniqueId = Math . max ( m_lastSpUniqueId , tracker . m_lastSpUniqueId ) ; m_lastMpUniqueId = Math . max ( m_lastMpUniqueId , tracker . m_lastMpUniqueI... |
public class SetTimeBasedAutoScalingRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( SetTimeBasedAutoScalingRequest setTimeBasedAutoScalingRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( setTimeBasedAutoScalingRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( setTimeBasedAutoScalingRequest . getInstanceId ( ) , INSTANCEID_BINDING ) ; protocolMarshaller . marshall ( setTimeBasedAutoScalingRequest . getAutoScalin... |
public class FNPImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . FNP__RG : getRg ( ) . clear ( ) ; getRg ( ) . addAll ( ( Collection < ? extends FNPRG > ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class HttpResponseMessageImpl { /** * Clear this message for re - use . */
@ Override public void clear ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Clearing this response: " + this ) ; } super . clear ( ) ; this . myStatusCode = StatusCodes . OK ; this . myReason = null ; this . myReasonBytes = null ; |
public class ValueEnforcer { /** * Check if
* < code > nValue & ge ; nLowerBoundInclusive & amp ; & amp ; nValue & le ; nUpperBoundInclusive < / code >
* @ param aValue
* Value
* @ param sName
* Name
* @ param aLowerBoundInclusive
* Lower bound
* @ param aUpperBoundInclusive
* Upper bound
* @ return... | if ( isEnabled ( ) ) return isBetweenInclusive ( aValue , ( ) -> sName , aLowerBoundInclusive , aUpperBoundInclusive ) ; return aValue ; |
public class MESubscription { /** * Returns the value of the topic .
* @ return The topic . */
final String getTopic ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getTopic" ) ; SibTr . exit ( tc , "getTopic" , _topic ) ; } return _topic ; |
public class ComponentFinder { /** * Gets the page if the request handler is instance of IPageRequestHandler .
* @ param requestHandler
* The { @ link IRequestHandler } to get the page .
* @ return The page or null if not found . */
public static Page getPage ( final IRequestHandler requestHandler ) { } } | if ( requestHandler instanceof IPageRequestHandler ) { final IPageRequestHandler pageRequestHandler = ( IPageRequestHandler ) requestHandler ; return ( Page ) pageRequestHandler . getPage ( ) ; } return null ; |
public class SyncRecordMessageFilterHandler { /** * On select , synchronize the records . */
public int doRecordChange ( FieldInfo field , int iChangeType , boolean bDisplayOption ) { } } | // Read a valid record
int iErrorCode = super . doRecordChange ( field , iChangeType , bDisplayOption ) ; // Initialize the record
if ( iErrorCode == DBConstants . NORMAL_RETURN ) { if ( ( iChangeType == DBConstants . ADD_TYPE ) || ( iChangeType == DBConstants . UPDATE_TYPE ) || ( iChangeType == DBConstants . DELETE_TY... |
public class Util { /** * Remove the hyphens from the beginning of < code > str < / code > and
* return the new String .
* @ param str The string from which the hyphens should be removed .
* @ return the new String . */
static String stripLeadingHyphens ( String str ) { } } | if ( str == null ) { return null ; } if ( str . startsWith ( "--" ) ) { return str . substring ( 2 , str . length ( ) ) ; } else if ( str . startsWith ( "-" ) ) { return str . substring ( 1 , str . length ( ) ) ; } return str ; |
public class Util { /** * To stream stream .
* @ param < T > the type parameter
* @ param iterator the iterator
* @ param size the size
* @ param parallel the parallel
* @ return the stream */
public static < T > Stream < T > toStream ( @ javax . annotation . Nonnull final Iterator < T > iterator , final int ... | return StreamSupport . stream ( Spliterators . spliterator ( iterator , size , Spliterator . ORDERED ) , parallel ) ; |
public class PatternKit { /** * Verify that the suffix is a picture format .
* @ param suffix filename suffix
* @ return verify that success returns true , and the failure returns false . */
public static boolean isImage ( String suffix ) { } } | if ( null != suffix && ! "" . equals ( suffix ) && suffix . contains ( "." ) ) { String regex = "(.*?)(?i)(jpg|jpeg|png|gif|bmp|webp)" ; return isMatch ( regex , suffix ) ; } return false ; |
public class ParameterizedTextureType { /** * Gets the value of the genericApplicationPropertyOfParameterizedTexture property .
* This accessor method returns a reference to the live list ,
* not a snapshot . Therefore any modification you make to the
* returned list will be present inside the JAXB object .
* T... | if ( _GenericApplicationPropertyOfParameterizedTexture == null ) { _GenericApplicationPropertyOfParameterizedTexture = new ArrayList < JAXBElement < Object > > ( ) ; } return this . _GenericApplicationPropertyOfParameterizedTexture ; |
public class HttpResponseStatus { /** * Parses the specified HTTP status line into a { @ link HttpResponseStatus } . The expected formats of the line are :
* < ul >
* < li > { @ code statusCode } ( e . g . 200 ) < / li >
* < li > { @ code statusCode } { @ code reasonPhrase } ( e . g . 404 Not Found ) < / li >
*... | return ( line instanceof AsciiString ) ? parseLine ( ( AsciiString ) line ) : parseLine ( line . toString ( ) ) ; |
public class CmsVfsTab { /** * Collects the structure ids belonging to open tree entries . < p >
* @ return the structure ids for the open tree entries */
Set < CmsUUID > getOpenElementIds ( ) { } } | Set < CmsUUID > ids = new HashSet < CmsUUID > ( ) ; for ( CmsLazyTreeItem item : m_treeItems ) { CmsVfsEntryBean entry = item . getData ( ) ; if ( item . isOpen ( ) ) { ids . add ( entry . getStructureId ( ) ) ; } } return ids ; |
public class OneDReader { /** * We ' re going to examine rows from the middle outward , searching alternately above and below the
* middle , and farther out each time . rowStep is the number of rows between each successive
* attempt above and below the middle . So we ' d scan row middle , then middle - rowStep , th... | int width = image . getWidth ( ) ; int height = image . getHeight ( ) ; BitArray row = new BitArray ( width ) ; boolean tryHarder = hints != null && hints . containsKey ( DecodeHintType . TRY_HARDER ) ; int rowStep = Math . max ( 1 , height >> ( tryHarder ? 8 : 5 ) ) ; int maxLines ; if ( tryHarder ) { maxLines = heigh... |
public class OffsetTime { /** * Returns a copy of this { @ code OffsetTime } with the specified offset ensuring
* that the result has the same local time .
* This method returns an object with the same { @ code LocalTime } and the specified { @ code ZoneOffset } .
* No calculation is needed or performed .
* For... | return offset != null && offset . equals ( this . offset ) ? this : new OffsetTime ( time , offset ) ; |
public class ConsistentColor { /** * Convert an angle in the CbCr plane to values cb , cr in the YCbCr color space .
* @ see < a href = " https : / / xmpp . org / extensions / xep - 0392 . html # algorithm - cbcr " > § 5.3 : CbCr generation < / a >
* @ param angle angel in CbCr plane .
* @ return value pair cb , ... | double cb = Math . cos ( angle ) ; double cr = Math . sin ( angle ) ; double acb = Math . abs ( cb ) ; double acr = Math . abs ( cr ) ; double factor ; if ( acr > acb ) { factor = 0.5 / acr ; } else { factor = 0.5 / acb ; } cb *= factor ; cr *= factor ; return new double [ ] { cb , cr } ; |
public class RecordSet { /** * Get the number of items already received from the server .
* @ return Nsumber of received items */
public int getNumberAvailable ( ) { } } | int result = 0 ; for ( int i = 0 ; i < data . size ( ) ; i ++ ) { if ( data . get ( i ) != null ) { result += 1 ; } } return result ; |
public class Value { /** * One of ICE , HDFS , S3 , GCS , NFS or TCP , according to where this Value is persisted .
* @ return Short String of the persitance name */
public static String nameOfPersist ( int x ) { } } | switch ( x ) { case ICE : return "ICE" ; case HDFS : return "HDFS" ; case S3 : return "S3" ; case NFS : return "NFS" ; case TCP : return "TCP" ; case GCS : return "GCS" ; default : return null ; } |
public class GitRepositoryState { /** * = $ { git . build . version } */
public static GitRepositoryState get ( ) { } } | if ( gitRepositoryState == null ) { Properties properties = new Properties ( ) ; try { properties . load ( GitRepositoryState . class . getClassLoader ( ) . getResourceAsStream ( "git.properties" ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } gitRepositoryState = new GitRepositoryState ( properties ) ; }... |
public class Annotation { /** * Compares the { @ code # start _ time } of this annotation to the given note
* @ return 1 if the local start time is greater , - 1 if it ' s less or 0 if
* equal */
@ Override public int compareTo ( Annotation note ) { } } | return start_time > note . start_time ? 1 : start_time < note . start_time ? - 1 : 0 ; |
public class HttpDispatcherChannel { /** * @ see com . ibm . wsspi . channelfw . Channel # init ( ) */
@ Override @ Trivial public void init ( ) throws ChannelException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Init channel: " + this ) ; } |
public class Context { /** * initialize Locale ( fr , en ) . */
private void initializeLocale ( ) { } } | final String locale = getProperty ( LOCALE , applicationProperties ) ; if ( locale != null && ! "" . equals ( locale ) ) { final String [ ] localeParts = locale . split ( "_" ) ; if ( localeParts . length == 2 ) { currentLocale = new Locale ( localeParts [ 0 ] , localeParts [ 1 ] ) ; } else { currentLocale = new Locale... |
public class SocketHubReceiver { /** * Fire connectors .
* @ param isReconnect true if reconnect . */
private synchronized void fireConnector ( final boolean isReconnect ) { } } | if ( active && connector == null ) { getLogger ( ) . debug ( "Starting a new connector thread." ) ; connector = new Connector ( isReconnect ) ; connector . setDaemon ( true ) ; connector . setPriority ( Thread . MIN_PRIORITY ) ; connector . start ( ) ; } |
public class EmailIntentSender { /** * Creates the message subject
* @ param context a context
* @ return the message subject */
@ NonNull protected String buildSubject ( @ NonNull Context context ) { } } | final String subject = mailConfig . subject ( ) ; if ( subject != null ) { return subject ; } return context . getPackageName ( ) + " Crash Report" ; |
public class ImmutableMultitable { /** * Guaranteed to throw an exception and leave the table unmodified .
* @ throws UnsupportedOperationException always
* @ deprecated Unsupported operation . */
@ Deprecated @ Override public boolean remove ( @ Nullable final Object rowKey , @ Nullable final Object columnKey , fi... | throw new UnsupportedOperationException ( ) ; |
public class EJSHome { /** * Gets the set of wrappers for binding this home to naming . */
public final HomeWrapperSet getWrapperSet ( ) // d648522 , d739542
throws CSIException , RemoteException { } } | EJSWrapperCommon w = getWrapper ( ) ; Remote remote = beanMetaData . homeRemoteImplClass == null ? null : w . getRemoteWrapper ( ) ; Object local = beanMetaData . homeLocalImplClass == null ? null : w . getLocalObject ( ) ; return new HomeBindingInfo ( remote , local ) ; |
public class BaseNDArrayFactory { /** * Random normal using the current time stamp
* as the seed
* @ param rows the number of rows in the matrix
* @ param columns the number of columns in the matrix
* @ return */
@ Override public INDArray randn ( long rows , long columns ) { } } | return randn ( new long [ ] { rows , columns } , System . currentTimeMillis ( ) ) ; |
public class Publisher { /** * Sends a notification for a feed located at " topic " . The feed MUST contain rel = " hub " .
* @ param topic URL for the feed
* @ param feed The feed itself
* @ throws NotificationException Any failure */
public void sendUpdateNotification ( final String topic , final SyndFeed feed ... | for ( final SyndLink link : feed . getLinks ( ) ) { if ( "hub" . equals ( link . getRel ( ) ) ) { sendUpdateNotification ( link . getRel ( ) , topic ) ; return ; } } throw new NotificationException ( "Hub link not found." ) ; |
public class ParseDateTag { /** * Evaluates expressions as necessary */
private void evaluateExpressions ( ) throws JspException { } } | /* * Note : we don ' t check for type mismatches here ; we assume
* the expression evaluator will return the expected type
* ( by virtue of knowledge we give it about what that type is ) .
* A ClassCastException here is truly unexpected , so we let it
* propagate up . */
// ' value ' attribute
if ( value_ != nu... |
public class MessageMD5ChecksumHandler { /** * Throw an exception if the MD5 checksums included in the ReceiveMessageResult do not match the
* client - side calculation on the received messages . */
private static void receiveMessageResultMd5Check ( ReceiveMessageResult receiveMessageResult ) { } } | if ( receiveMessageResult . getMessages ( ) != null ) { for ( Message messageReceived : receiveMessageResult . getMessages ( ) ) { String messageBody = messageReceived . getBody ( ) ; String bodyMd5Returned = messageReceived . getMD5OfBody ( ) ; String clientSideBodyMd5 = calculateMessageBodyMd5 ( messageBody ) ; if ( ... |
public class ConsistencyCheckerController { /** * Returns the end date given the start date end the period . The end date is
* startDate + period , but only if endDate is at least one period ago . That
* is , we always leave the last incomplete period unprocessed .
* Override this to control the job generation al... | long now = getNow ( ) . getTime ( ) ; long endDate = startDate . getTime ( ) + period ; if ( now - period > endDate ) { return new Date ( endDate ) ; } else { return null ; } |
public class CPDAvailabilityEstimatePersistenceImpl { /** * Returns an ordered range of all the cpd availability estimates where commerceAvailabilityEstimateId = & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < ... | return findByCommerceAvailabilityEstimateId ( commerceAvailabilityEstimateId , start , end , orderByComparator , true ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link SingleOperationRefType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link SingleOperationRefType } ... | return new JAXBElement < SingleOperationRefType > ( _UsesSingleOperation_QNAME , SingleOperationRefType . class , null , value ) ; |
public class StorageProviderBase { /** * Sets the properties of this space . Note that this method is intentionally
* not exposed to users , as it is not meant to be used for user properties ,
* but only for system - level properties . The names and values need to be
* kept short , and the overall number of prope... | // Add ACLs to the properties list
spaceProperties . putAll ( packACLs ( spaceACLs ) ) ; boolean success = false ; int maxLoops = 6 ; for ( int loops = 0 ; ! success && loops < maxLoops ; loops ++ ) { try { doSetSpaceProperties ( spaceId , spaceProperties ) ; success = true ; } catch ( NotFoundException e ) { success =... |
public class EjbProcessApplication { /** * determine the ee application name based on information obtained from JNDI . */
protected String lookupEeApplicationName ( ) { } } | try { InitialContext initialContext = new InitialContext ( ) ; String appName = ( String ) initialContext . lookup ( JAVA_APP_APP_NAME_PATH ) ; String moduleName = ( String ) initialContext . lookup ( MODULE_NAME_PATH ) ; // make sure that if an EAR carries multiple PAs , they are correctly
// identified by appName + m... |
public class StorageUtil { /** * store loaded data to xml file
* @ param doc
* @ param file
* @ throws IOException */
public void store ( Document doc , File file ) throws IOException { } } | store ( doc , ResourceUtil . toResource ( file ) ) ; |
public class IonTokenReader { /** * Scans a timestamp after reading < code > yyyy - < / code > .
* We can be a little lenient here since the result will be reparsed and
* validated more thoroughly by { @ link Timestamp # valueOf ( CharSequence ) } .
* @ param c the last character scanned ; must be < code > ' - ' ... | endofdate : for ( ; ; ) { // fake for loop to create a label we can jump out of ,
// because 4 or 5 levels of nested if ' s is just ugly
// at this point we will have read leading digits and exactly 1 dash
// in other words , we ' ll have read the year
if ( c == 'T' ) { // yearT is a valid timestamp value
value . appen... |
public class FastSet { /** * { @ inheritDoc } */
@ Override public boolean containsAny ( IntSet c ) { } } | if ( c == null || c . isEmpty ( ) || c == this ) { return true ; } if ( isEmpty ( ) ) { return false ; } final FastSet other = convert ( c ) ; final int [ ] localWords = words ; // faster
final int [ ] localOtherWords = other . words ; // faster
for ( int i = Math . min ( firstEmptyWord , other . firstEmptyWord ) - 1 ;... |
public class LineColumnReader { /** * Skips characters .
* @ param toSkip the number of characters to skip
* @ return The number of characters actually skipped */
@ Override public long skip ( long toSkip ) throws IOException { } } | for ( long i = 0 ; i < toSkip ; i ++ ) { int intRead = read ( ) ; if ( intRead == - 1 ) return i ; } return toSkip ; |
public class AbstractBlockBasedDataStore { /** * ( non - Javadoc )
* @ see net . timewalker . ffmq4 . utils . store . ChainedDataStore # retrieve ( int ) */
@ Override public final Object retrieve ( int handle ) throws DataStoreException { } } | if ( SAFE_MODE ) checkHandle ( handle ) ; // Compute total size
int totalSize = computeSize ( handle ) ; // Retrieve all blocks
byte [ ] data = new byte [ totalSize ] ; int offset = 0 ; int current = handle ; while ( current != - 1 ) { int blockLen = allocatedSize [ current ] ; // Read block from map file
readDataBlock... |
public class Collectors { /** * Use occurrences to save the count of largest objects if { @ code areAllSmallestSame = true } ( e . g . { @ code Number / String / . . . } ) and return a list by repeat the smallest object { @ code n } times .
* @ param atMostSize
* @ param areAllSmallestSame
* @ return
* @ see Co... | return minAll ( Fn . naturalOrder ( ) , atMostSize , areAllSmallestSame ) ; |
public class MDAGNode { /** * 获取一个字符串路径上经过的节点 < br >
* Retrieves the nodes in the _ transition path starting
* from this node corresponding to a given String .
* @ param str a String corresponding to a _ transition path starting from this node
* @ return a Stack of MDAGNodes containing the nodes in the _ transi... | Stack < MDAGNode > nodeStack = new Stack < MDAGNode > ( ) ; MDAGNode currentNode = this ; int numberOfChars = str . length ( ) ; // Iteratively _ transition through the MDAG using the chars in str ,
// putting each encountered node in nodeStack
for ( int i = 0 ; i < numberOfChars && currentNode != null ; i ++ ) { curre... |
public class Dependencies { /** * Find an entry in the allowed list by package name .
* @ param packageName
* Name to find .
* @ return Package or < code > null < / code > if no entry with the given name was found . */
public final Package < DependsOn > findAllowedByName ( final String packageName ) { } } | final List < Package < DependsOn > > list = getAllowed ( ) ; for ( final Package < DependsOn > pkg : list ) { if ( pkg . getName ( ) . equals ( packageName ) ) { return pkg ; } } return null ; |
public class BootStrapper { /** * if initialtoken was specified , use that ( split on comma ) .
* otherwise , if num _ tokens = = 1 , pick a token to assume half the load of the most - loaded node .
* else choose num _ tokens tokens at random */
public static Collection < Token > getBootstrapTokens ( final TokenMet... | Collection < String > initialTokens = DatabaseDescriptor . getInitialTokens ( ) ; // if user specified tokens , use those
if ( initialTokens . size ( ) > 0 ) { logger . debug ( "tokens manually specified as {}" , initialTokens ) ; List < Token > tokens = new ArrayList < Token > ( initialTokens . size ( ) ) ; for ( Stri... |
public class SnapToLineEdge { /** * Fits a line defined by the two points . When fitting the line the weight of the edge is used to determine .
* how influential the point is . Multiple calls might be required to get a perfect fit .
* @ param a Start of line
* @ param b End of line . .
* @ param found ( output ... | // determine the local coordinate system
center . x = ( a . x + b . x ) / 2.0 ; center . y = ( a . y + b . y ) / 2.0 ; localScale = a . distance ( center ) ; // define the line which points are going to be sampled along
double slopeX = ( b . x - a . x ) ; double slopeY = ( b . y - a . y ) ; double r = Math . sqrt ( slo... |
public class Restarter { /** * Restart the running application .
* @ param failureHandler a failure handler to deal with application that doesn ' t start */
public void restart ( FailureHandler failureHandler ) { } } | if ( ! this . enabled ) { this . logger . debug ( "Application restart is disabled" ) ; return ; } this . logger . debug ( "Restarting application" ) ; getLeakSafeThread ( ) . call ( ( ) -> { Restarter . this . stop ( ) ; Restarter . this . start ( failureHandler ) ; return null ; } ) ; |
public class CmsXmlUtils { /** * Returns the last Xpath element from the provided path ,
* without the index value . < p >
* Examples : < br >
* < code > title < / code > is left untouched < br >
* < code > title [ 1 ] < / code > becomes < code > title < / code > < br >
* < code > title / subtitle < / code > ... | int pos = path . lastIndexOf ( '/' ) ; if ( pos >= 0 ) { path = path . substring ( pos + 1 ) ; } return CmsXmlUtils . removeXpathIndex ( path ) ; |
public class JKJdbcUtil { /** * Ping .
* @ param driver the driver
* @ param url the url
* @ param user the user
* @ param password the password */
public static void ping ( String driver , String url , String user , String password ) { } } | try { Class . forName ( driver ) ; Connection connection = DriverManager . getConnection ( url , user , password ) ; connection . close ( ) ; } catch ( Exception e ) { JKExceptionUtil . handle ( e ) ; } |
public class MutableSymbolTable { /** * Remap a set of oldIndex - > newIndex such that this whole thing is done as one operation and you dont have
* to worry about the ordering to consider to be sure you dont lose any symbols
* Each indexPair is < oldId , newId >
* @ param listOfOldToNew */
public void remapAll (... | List < String > symbols = Lists . newArrayListWithCapacity ( listOfOldToNew . size ( ) ) ; int max = - 1 ; for ( int i = 0 ; i < listOfOldToNew . size ( ) ; i ++ ) { IndexPair indexPair = listOfOldToNew . get ( i ) ; symbols . add ( invert ( ) . keyForId ( indexPair . getLeft ( ) ) ) ; max = Math . max ( max , indexPai... |
public class SlotManager { /** * Unregisters the task manager identified by the given instance id and its associated slots
* from the slot manager .
* @ param instanceId identifying the task manager to unregister
* @ return True if there existed a registered task manager with the given instance id */
public boole... | checkInit ( ) ; LOG . debug ( "Unregister TaskManager {} from the SlotManager." , instanceId ) ; TaskManagerRegistration taskManagerRegistration = taskManagerRegistrations . remove ( instanceId ) ; if ( null != taskManagerRegistration ) { internalUnregisterTaskManager ( taskManagerRegistration ) ; return true ; } else ... |
public class MathUtil { /** * Return the squared distance between the given points . */
public static int distanceSq ( int x0 , int y0 , int x1 , int y1 ) { } } | return ( ( x1 - x0 ) * ( x1 - x0 ) ) + ( ( y1 - y0 ) * ( y1 - y0 ) ) ; |
public class AbstractKQueueChannel { /** * Returns an off - heap copy of the specified { @ link ByteBuf } , and releases the specified holder .
* The caller must ensure that the holder releases the original { @ link ByteBuf } when the holder is released by
* this method . */
protected final ByteBuf newDirectBuffer ... | final int readableBytes = buf . readableBytes ( ) ; if ( readableBytes == 0 ) { ReferenceCountUtil . release ( holder ) ; return Unpooled . EMPTY_BUFFER ; } final ByteBufAllocator alloc = alloc ( ) ; if ( alloc . isDirectBufferPooled ( ) ) { return newDirectBuffer0 ( holder , buf , alloc , readableBytes ) ; } final Byt... |
public class AndroidSentryClientFactory { /** * Check whether the application has been granted a certain permission .
* @ param permission Permission as a string
* @ return true if permissions is granted */
private boolean checkPermission ( String permission ) { } } | int res = ctx . checkCallingOrSelfPermission ( permission ) ; return ( res == PackageManager . PERMISSION_GRANTED ) ; |
public class ServiceQuery { /** * Returns the total number of inner landscape points in the ad group bid landscape page . */
private int getTotalLandscapePointsInPage ( AdGroupBidLandscapePage page ) { } } | int totalLandscapePointsInPage = 0 ; for ( AdGroupBidLandscape adGroupBidLandscape : page . getEntries ( ) ) { totalLandscapePointsInPage += adGroupBidLandscape . getLandscapePoints ( ) . size ( ) ; } return totalLandscapePointsInPage ; |
public class ExecutionStartedEventDetailsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ExecutionStartedEventDetails executionStartedEventDetails , ProtocolMarshaller protocolMarshaller ) { } } | if ( executionStartedEventDetails == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( executionStartedEventDetails . getInput ( ) , INPUT_BINDING ) ; protocolMarshaller . marshall ( executionStartedEventDetails . getRoleArn ( ) , ROLEARN_BIND... |
public class CommerceAddressPersistenceImpl { /** * Returns the last commerce address in the ordered set where commerceRegionId = & # 63 ; .
* @ param commerceRegionId the commerce region ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last ... | CommerceAddress commerceAddress = fetchByCommerceRegionId_Last ( commerceRegionId , orderByComparator ) ; if ( commerceAddress != null ) { return commerceAddress ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "commerceRegionId=" ) ; msg . append ( commerceRe... |
public class KeysInner { /** * Retrieve the automation keys for an account .
* @ param resourceGroupName Name of an Azure Resource group .
* @ param automationAccountName The name of the automation account .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseExc... | return listByAutomationAccountWithServiceResponseAsync ( resourceGroupName , automationAccountName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class ParallelOracleBuilders { /** * Creates a { @ link StaticParallelOracleBuilder } using the provided collection of membership oracles . The resulting
* parallel oracle will always use a { @ link PoolPolicy # FIXED } pool policy and spawn a separate thread for each of
* the provided oracles ( so that the ... | return new StaticParallelOracleBuilder < > ( oracles ) ; |
public class CmsRestoreDeletedDialog { /** * Submits the dialog . < p > */
void submit ( ) { } } | List < CmsUUID > selectedIds = getSelectedIds ( ) ; List < CmsUUID > updated = Lists . newArrayList ( ) ; CmsObject cms = m_dialogContext . getCms ( ) ; try { for ( CmsUUID selectedId : selectedIds ) { cms . restoreDeletedResource ( selectedId ) ; updated . add ( selectedId ) ; } m_dialogContext . finish ( updated ) ; ... |
public class Sets { /** * This method returns true if set A is a superset of set B
* i . e . it answers the question if A contains all items from B
* @ param setA set A
* @ param setB set B
* @ param < T > type
* @ return { @ code boolean } true if A is a superset of B */
public static < T > boolean isSuperse... | return setA . containsAll ( setB ) ; |
public class DefaultCookie { /** * Validate a cookie attribute value , throws a { @ link IllegalArgumentException } otherwise .
* Only intended to be used by { @ link io . netty . handler . codec . http . DefaultCookie } .
* @ param name attribute name
* @ param value attribute value
* @ return the trimmed , va... | return validateAttributeValue ( name , value ) ; |
public class FilePickerFragment { /** * This the method that gets notified when permission is granted / denied . By default ,
* a granted request will result in a refresh of the list .
* @ param requestCode the code you requested
* @ param permissions array of permissions you requested . empty if process was canc... | // If arrays are empty , then process was cancelled
if ( permissions . length == 0 ) { // Treat this as a cancel press
if ( mListener != null ) { mListener . onCancelled ( ) ; } } else { // if ( requestCode = = PERMISSIONS _ REQUEST _ WRITE _ EXTERNAL _ STORAGE ) {
if ( PackageManager . PERMISSION_GRANTED == grantResul... |
import java . util . * ; public class Main { /** * This function calculates the difference between the maximum and minimum value in an array .
* @ param array : list of integers
* @ return An integer representing the difference between the largest and smallest value in the given list .
* Examples :
* > > > comp... | int difference = Collections . max ( array ) - Collections . min ( array ) ; return difference ; |
public class RethinkDBClient { /** * ( non - Javadoc )
* @ see com . impetus . kundera . client . ClientBase # delete ( java . lang . Object ,
* java . lang . Object ) */
@ Override protected void delete ( Object entity , Object pKey ) { } } | EntityMetadata entityMetadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , entity . getClass ( ) ) ; r . db ( entityMetadata . getSchema ( ) ) . table ( entityMetadata . getTableName ( ) ) . get ( pKey ) . delete ( ) . run ( connection ) ; |
public class ErrorPage { /** * Use of the WAR class loader is correct . */
@ SuppressWarnings ( "rawtypes" ) public Class getException ( ) { } } | try { return Class . forName ( errorParam , true , Thread . currentThread ( ) . getContextClassLoader ( ) ) . newInstance ( ) . getClass ( ) ; } catch ( Exception e ) { return null ; } |
public class InitiatorMailbox { /** * Produce the repair log . This is idempotent . */
private void handleLogRequest ( VoltMessage message ) { } } | Iv2RepairLogRequestMessage req = ( Iv2RepairLogRequestMessage ) message ; // It is possible for a dead host to queue messages after a repair request is processed
// so make sure this can ' t happen by re - queuing this message after we know the dead host is gone
// Since we are not checking validateForeignHostId on the... |
public class CorpusAdministration { /** * Extract the zipped ANNIS corpus files to an output directory .
* @ param outDir The ouput directory .
* @ param zip ZIP - file to extract .
* @ return A list of root directories where the tab - files are located if
* found , null otherwise . */
private List < File > unz... | List < File > rootDirs = new ArrayList < > ( ) ; Enumeration < ? extends ZipEntry > zipEnum = zip . entries ( ) ; while ( zipEnum . hasMoreElements ( ) ) { ZipEntry e = zipEnum . nextElement ( ) ; File outFile = new File ( outDir , e . getName ( ) . replaceAll ( "\\/" , "/" ) ) ; if ( e . isDirectory ( ) ) { if ( ! out... |
public class Ifc4FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIfcFurnitureTypeEnumToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class JsonIOUtil { /** * Serializes the { @ code message } into a byte array using the given { @ code schema } . */
public static < T > byte [ ] toByteArray ( T message , Schema < T > schema , boolean numeric ) { } } | final ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; try { writeTo ( baos , message , schema , numeric ) ; } catch ( IOException e ) { throw new RuntimeException ( "Serializing to a byte array threw an IOException " + "(should never happen)." , e ) ; } return baos . toByteArray ( ) ; |
public class WebPExtension { /** * Determine if the GeoPackage has the extension
* @ param tableName
* table name
* @ return true if has extension */
public boolean has ( String tableName ) { } } | boolean exists = has ( EXTENSION_NAME , tableName , TileTable . COLUMN_TILE_DATA ) ; return exists ; |
public class CalendarPicker { /** * / * [ deutsch ]
* < p > Erzeugt einen neuen { @ code CalendarPicker } f & uuml ; r das persische Kalendersystem ( jalali ) . < / p >
* @ param locale the language and country configuration
* @ param todaySupplier determines the current calendar date
* @ return CalendarPicker ... | return CalendarPicker . create ( PersianCalendar . axis ( ) , new FXCalendarSystemPersian ( ) , locale , todaySupplier ) ; |
public class Predicates { /** * Returns a predicate that evaluates to { @ code true } if its
* argument does not satisfy { @ code p } . */
public static < T > Predicate < T > not ( final Predicate < ? super T > p ) { } } | return new Predicate < T > ( ) { @ Override public boolean apply ( T obj ) { return ! p . apply ( obj ) ; } } ; |
public class Environment { /** * Performs POST to supplied url of result of applying template with model .
* @ param url url to post to .
* @ param templateName name of template to use .
* @ param model model for template .
* @ param result result to populate with response .
* @ param headers headers to add .... | String request = processTemplate ( templateName , model ) ; result . setRequest ( request ) ; doHttpPost ( url , result , headers , contentType ) ; |
public class WebUtils { /** * Gets the logout requests from flow scope .
* @ param context the context
* @ return the logout requests */
public static List < SingleLogoutRequest > getLogoutRequests ( final RequestContext context ) { } } | return ( List < SingleLogoutRequest > ) context . getFlowScope ( ) . get ( PARAMETER_LOGOUT_REQUESTS ) ; |
public class HandlerEvaluator { /** * Runs the evaluator in the given class according to the valid fields
* extracted from the template ( via attribute ui : field ) .
* @ param writer
* the writer used to output the results
* @ param fieldManager
* the field manager instance
* @ param uiOwner
* the name o... | // Iterate through all methods defined in the class .
for ( JMethod method : ownerClass . getUiHandlers ( ) ) { // Evaluate the method .
String boundMethod = method . getName ( ) ; if ( method . isPrivate ( ) ) { logger . die ( "Method '%s' cannot be private." , boundMethod ) ; } // Retrieves both event and handler typ... |
public class NativeOpExecutioner { /** * This method executes previously built batch
* @ param batch */
@ Override public < T extends Aggregate > void exec ( Batch < T > batch ) { } } | // profilingHookIn ( batch ) ;
IntPointer pointer = ( IntPointer ) getPointer ( batch ) ; int maxTypes = 5 ; int maxIntArrays = batch . getSample ( ) . maxIntArrays ( ) ; int maxArraySize = batch . getSample ( ) . maxIntArraySize ( ) ; int indexPos = maxTypes * Batch . getBatchLimit ( ) ; int intArraysPos = indexPos + ... |
public class XML { public static Node findElementByName ( String elementName , Node node ) { } } | if ( node == null || node . getNodeType ( ) == Node . COMMENT_NODE || node . getNodeType ( ) == Node . TEXT_NODE ) return null ; if ( elementName . equals ( node . getNodeName ( ) ) ) { return node ; } NodeList nodeList = node . getChildNodes ( ) ; if ( nodeList == null ) return null ; int len = nodeList . getLength ( ... |
public class MemorySegment { /** * Bulk copy method . Copies { @ code numBytes } bytes from this memory segment , starting at position
* { @ code offset } to the target memory segment . The bytes will be put into the target segment
* starting at position { @ code targetOffset } .
* @ param offset The position whe... | // system arraycopy does the boundary checks anyways , no need to check extra
System . arraycopy ( this . memory , offset , target . memory , targetOffset , numBytes ) ; |
public class SSLFactoryJsse { /** * Returns the certificate file . */
private Path keyStoreFile ( ) { } } | String fileName = _config . get ( _prefix + ".ssl.key-store" ) ; if ( fileName == null ) { return null ; } return Vfs . path ( fileName ) ; |
public class VisOdomDualTrackPnP { /** * Updates the relative position of all points so that the current frame is the reference frame . Mathematically
* this is not needed , but should help keep numbers from getting too large . */
private void changePoseToReference ( ) { } } | Se3_F64 keyToCurr = currToKey . invert ( null ) ; List < PointTrack > all = trackerLeft . getAllTracks ( null ) ; for ( PointTrack t : all ) { LeftTrackInfo p = t . getCookie ( ) ; SePointOps_F64 . transform ( keyToCurr , p . location . location , p . location . location ) ; } concatMotion ( ) ; |
public class EnumParse { /** * Retrieve the enum of a given type from a given raw value . Enums must implement the
* { @ link com . punchthrough . bean . sdk . internal . utility . EnumParse . ParsableEnum } interface to ensure they have
* a { @ link com . punchthrough . bean . sdk . internal . utility . EnumParse ... | return enumWithRawValue ( enumClass , ( int ) value ) ; |
public class GenericShapeProvider { /** * { @ inheritDoc }
* @ param o { @ inheritDoc }
* @ return { @ inheritDoc }
* @ throws NotAvailableException { @ inheritDoc } */
@ Override public Shape getShape ( final Object o ) throws NotAvailableException { } } | if ( o instanceof GlyphIcons ) { return GLYPH_ICON_SHAPE_PROVIDER . getShape ( ( GlyphIcons ) o ) ; } if ( o instanceof Shape ) { return SVG_PATH_SHAPE_PROVIDER . getShape ( ( SVGPath ) o ) ; } throw new NotAvailableException ( ContextType . USE_ID_AS_CONTEXT , "ShapeProvider" , new InvalidStateException ( "Shape descr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.