signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ImmutableUnificationTools { /** * TODO : make it replace computeMGUS ( ) */
public Optional < ImmutableSubstitution < NonFunctionalTerm > > computeMGUS2 ( ImmutableSubstitution < NonFunctionalTerm > s1 , ImmutableSubstitution < NonFunctionalTerm > s2 ) { } } | return computeMGUS ( s1 , s2 ) . map ( u -> ( ImmutableSubstitution < NonFunctionalTerm > ) ( ImmutableSubstitution < ? > ) u ) ; |
public class PhoneNumberUtil { /** * check if phone number is empty .
* @ param pphoneNumberData phone number to check
* @ return true if number is empty */
public final boolean isPhoneNumberEmpty ( final PhoneNumberInterface pphoneNumberData ) { } } | return pphoneNumberData == null || StringUtils . isBlank ( pphoneNumberData . getCountryCode ( ) ) || StringUtils . isBlank ( pphoneNumberData . getLineNumber ( ) ) ; |
public class QueryLexer { /** * $ ANTLR start " HexDigit " */
public final void mHexDigit ( ) throws RecognitionException { } } | try { // src / riemann / Query . g : 120:5 : ( ' 0 ' . . ' 9 ' | ' A ' . . ' F ' | ' a ' . . ' f ' )
// src / riemann / Query . g :
{ if ( ( input . LA ( 1 ) >= '0' && input . LA ( 1 ) <= '9' ) || ( input . LA ( 1 ) >= 'A' && input . LA ( 1 ) <= 'F' ) || ( input . LA ( 1 ) >= 'a' && input . LA ( 1 ) <= 'f' ) ) { input ... |
public class Mask { /** * Mask the input string with a list of patterns indexed by key in string section in mask . json
* This is usually used to mask header values , query parameters and uri parameters
* @ param input String The source of the string that needs to be masked
* @ param key String The key that maps ... | String output = input ; Map < String , Object > stringConfig = ( Map < String , Object > ) config . get ( MASK_TYPE_STRING ) ; if ( stringConfig != null ) { Map < String , Object > keyConfig = ( Map < String , Object > ) stringConfig . get ( key ) ; if ( keyConfig != null ) { Set < String > patterns = keyConfig . keySe... |
public class JsonRestService { /** * Retrieve an existing entity or relationship . */
@ GET public JSONObject get ( String path , Map < String , String > headers ) throws ServiceException , JSONException { } } | throw new ServiceException ( ServiceException . NOT_ALLOWED , "GET not implemented" ) ; |
public class JsxResourceConverter { /** * / * ( non - Javadoc )
* @ see com . ibm . jaggr . core . resource . IResourceConverter # convert ( java . net . URI , com . ibm . jaggr . core . resource . IResource ) */
@ Override public IResource convert ( final IResource resource ) { } } | final String sourceMethod = "convert" ; // $ NON - NLS - 1 $
final boolean isTraceLogging = log . isLoggable ( Level . FINER ) ; if ( isTraceLogging ) { log . entering ( sourceMethod , sourceMethod , new Object [ ] { resource } ) ; } IResource result = resource ; if ( ! isSkipResourceConversion . get ( ) ) { if ( ! res... |
public class AbstractTriangle3F { /** * Replies the baricentric coordinates ( in the triangle ) of the
* intersection between a triangle and a segment .
* If the segment and the triangle are not intersecting , this
* function replies { @ link Double # NaN } .
* Otherwise the replied value is the factor that cou... | // Input : Triangle ( V1 , V2 , V3 ) ; Segment ( Q1 , Q2)
// A = Q1 - V3
double Ax = sx1 - tx3 ; double Ay = sy1 - ty3 ; double Az = sz1 - tz3 ; // B = V1 - V3
double Bx = tx1 - tx3 ; double By = ty1 - ty3 ; double Bz = tz1 - tz3 ; // C = V2 - V3
double Cx = tx2 - tx3 ; double Cy = ty2 - ty3 ; double Cz = tz2 - tz3 ; /... |
public class GradientSobel_Outer { /** * Computes derivative of GrayU8 . Inputs can be sub - images . */
public static void process_sub ( GrayU8 orig , GrayS16 derivX , GrayS16 derivY ) { } } | final byte [ ] data = orig . data ; final short [ ] imgX = derivX . data ; final short [ ] imgY = derivY . data ; final int width = orig . getWidth ( ) ; final int height = orig . getHeight ( ) - 1 ; final int strideSrc = orig . getStride ( ) ; // CONCURRENT _ BELOW BoofConcurrency . loopFor ( 1 , height , y - > {
for ... |
public class MemStore { /** * ( non - Javadoc )
* @ see com . taobao . common . store . Store # add ( byte [ ] , byte [ ] ) */
@ Override public void add ( final byte [ ] key , final byte [ ] data ) throws IOException { } } | this . datas . put ( new BytesKey ( key ) , data ) ; |
public class JobStepsInner { /** * Gets a job step in a job ' s current version .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ param jobAgentNa... | return ServiceFuture . fromResponse ( getWithServiceResponseAsync ( resourceGroupName , serverName , jobAgentName , jobName , stepName ) , serviceCallback ) ; |
public class Solo { /** * Searches for a text in the EditText objects currently displayed and returns true if found . Will automatically scroll when needed .
* @ param text the text to search for
* @ return { @ code true } if an { @ link EditText } displaying the specified text is found or { @ code false } if it is... | if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "searchEditText(\"" + text + "\")" ) ; } return searcher . searchWithTimeoutFor ( EditText . class , text , 1 , true , false ) ; |
public class XMLCharHelper { /** * Check if the passed character is invalid for a CDATA node .
* @ param eXMLVersion
* XML version to be used . May not be < code > null < / code > .
* @ param c
* char to check
* @ return < code > true < / code > if the char is invalid */
public static boolean isInvalidXMLCDAT... | switch ( eXMLVersion ) { case XML_10 : return INVALID_VALUE_CHAR_XML10 . get ( c ) ; case XML_11 : return INVALID_CDATA_VALUE_CHAR_XML11 . get ( c ) ; case HTML : return INVALID_CHAR_HTML . get ( c ) ; default : throw new IllegalArgumentException ( "Unsupported XML version " + eXMLVersion + "!" ) ; } |
public class OgnlResolution { /** * < p > expressionsListToResolve . < / p >
* @ return a { @ link java . util . List } object . */
public List < String > expressionsListToResolve ( ) { } } | String [ ] parts = expression . trim ( ) . split ( "\\s+" ) ; List < String > expressionsList = new ArrayList < String > ( ) ; withDots ( expressionsList , parts ) ; noDots ( expressionsList , parts ) ; asIs ( expressionsList , parts ) ; return expressionsList ; |
public class TagsApi { /** * Get a Stream of repository tags from a project , sorted by name in reverse alphabetical order .
* < pre > < code > GitLab Endpoint : GET / projects / : id / repository / tags < / code > < / pre >
* @ param projectIdOrPath id , path of the project , or a Project instance holding the proj... | return ( getTags ( projectIdOrPath , getDefaultPerPage ( ) ) . stream ( ) ) ; |
public class Clock { /** * Returns the duration for which this clock was running in the given timeunit .
* @ return The duration for which this clock was running in the given timeunit .
* @ throws IllegalStateException If the clock is not yet stopped . */
public long getDuration ( TimeUnit targetUnit ) { } } | if ( isRunning ( ) ) { throw new IllegalStateException ( "The clock is not yet stopped." ) ; } return targetUnit . convert ( durationNanos , TimeUnit . NANOSECONDS ) ; |
public class RamlCompilerMojo { /** * Create the . raml file from the java source file .
* @ param input The java source file .
* @ return The File where the raml spec , for the given input , will be written . */
private File getRamlOutputFile ( File input ) { } } | String ramlFileName = input . getName ( ) . substring ( 0 , input . getName ( ) . length ( ) - 4 ) + "raml" ; File outDir ; if ( outputDirectory == null ) { outDir = new File ( WatcherUtils . getExternalAssetsDestination ( basedir ) , "raml" ) ; } else { outDir = new File ( basedir , outputDirectory ) ; } return new Fi... |
public class StreamExecutionEnvironment { /** * Creates a new data stream that contains the strings received infinitely from a socket . Received strings are
* decoded by the system ' s default character set . On the termination of the socket server connection retries can be
* initiated .
* < p > Let us note that ... | return addSource ( new SocketTextStreamFunction ( hostname , port , delimiter , maxRetry ) , "Socket Stream" ) ; |
public class ProcessRetrieveRequest { /** * Returns the search Index according to the indexName Parameter of the ASTP
* if no Parameter was in the request the default index will be used . if the
* parameter did not match any known index the default index will be used .
* returns null if the default index is reque... | String indexName = request . getParameter ( ProtocolConstants . INDEX_PARAMETER ) ; SuggestTree index = null ; // if no indexName Parameter was provided use the default index .
if ( indexName == null ) { indexName = ProtocolConstants . DEFAULT_INDEX_NAME ; response . addIndexWarning ( RetrieveStatusCodes . NO_INDEX_GIV... |
public class DeploymentUtils { /** * Set the disabled - time { stamp } attribute of deployment to the current timestamp . Useful to track the deployment disable events .
* @ param model */
static void disableAttribute ( ModelNode model ) { } } | Date enabledTime = new Date ( ) ; DateFormat df = new SimpleDateFormat ( DATEFORMAT_ATTR ) ; model . get ( DeploymentAttributes . DISABLED_TIME . getName ( ) ) . set ( enabledTime . getTime ( ) ) ; model . get ( DeploymentAttributes . DISABLED_TIMESTAMP . getName ( ) ) . set ( df . format ( enabledTime ) ) ; |
public class MultiUserChat { /** * Invites another user to the room in which one is an occupant . The invitation
* will be sent to the room which in turn will forward the invitation to the invitee . < p >
* If the room is password - protected , the invitee will receive a password to use to join
* the room . If th... | invite ( new Message ( ) , user , reason ) ; |
public class Validator { /** * 验证字符串是否全部为大写字母
* @ param < T > 字符串类型
* @ param value 表单值
* @ param errorMsg 验证错误的信息
* @ return 验证后的值
* @ throws ValidateException 验证异常
* @ since 3.3.0 */
public static < T extends CharSequence > T validateUpperCase ( T value , String errorMsg ) throws ValidateException { } } | if ( false == isUpperCase ( value ) ) { throw new ValidateException ( errorMsg ) ; } return value ; |
public class SimpleSolrPersistentProperty { /** * ( non - Javadoc )
* @ see org . springframework . data . solr . core . mapping . SolrPersistentProperty # getDefaultValue ( ) */
@ Override public Object getDefaultValue ( ) { } } | Indexed indexedAnnotation = getIndexAnnotation ( ) ; if ( indexedAnnotation != null && StringUtils . hasText ( indexedAnnotation . defaultValue ( ) ) ) { return indexedAnnotation . defaultValue ( ) ; } return null ; |
public class Application { /** * Return the singleton , stateless , thread - safe < code > { @ link ResourceHandler } < / code > for this application . The JSF
* implementation must support the following techniques for declaring an alternate implementation of < code >
* ResourceHandler < / code > .
* < ul >
* <... | Application application = getMyfacesApplicationInstance ( ) ; if ( application != null ) { return application . getResourceHandler ( ) ; } throw new UnsupportedOperationException ( ) ; |
public class SecurityContextImpl { /** * Authentication can be represented as being at one of many states with different transitions depending on desired outcome .
* NOT _ ATTEMPTED
* ATTEMPTED
* AUTHENTICATED
* CHALLENGED _ SENT */
@ Override public boolean authenticate ( ) { } } | UndertowLogger . SECURITY_LOGGER . debugf ( "Attempting to authenticate %s, authentication required: %s" , exchange . getRequestPath ( ) , isAuthenticationRequired ( ) ) ; if ( authenticationState == AuthenticationState . ATTEMPTED || ( authenticationState == AuthenticationState . CHALLENGE_SENT && ! exchange . isRespo... |
public class TypeUtil { /** * Convert String value to instance .
* @ param type classname or type ( eg int )
* @ param value The value as a string .
* @ return The value as an Object . */
public static Object valueOf ( String type , String value ) { } } | return valueOf ( fromName ( type ) , value ) ; |
public class Predict { /** * 获得预测结果的得分
* @ param i 位置
* @ return 第i个预测结果的得分 ; 不存在为Double . NEGATIVE _ INFINITY */
public float getScore ( int i ) { } } | if ( i < 0 || i >= scores . size ( ) ) return Float . NEGATIVE_INFINITY ; return scores . get ( i ) ; |
public class ApiOvhIp { /** * Ip subnet used to send probes to your backends
* REST : GET / ip / loadBalancing / { serviceName } / probeIp
* @ param zone [ required ] one of your ip loadbalancing ' s zone
* @ param serviceName [ required ] The internal name of your IP load balancing */
public ArrayList < String >... | String qPath = "/ip/loadBalancing/{serviceName}/probeIp" ; StringBuilder sb = path ( qPath , serviceName ) ; query ( sb , "zone" , zone ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t2 ) ; |
public class DefaultGroovyMethods { /** * Wraps a map using the decorator pattern with a wrapper that intercepts all calls
* to < code > get ( key ) < / code > . If an unknown key is found , a default value will be
* stored into the Map before being returned . The default value stored will be the
* result of call... | return MapWithDefault . newInstance ( self , init ) ; |
public class ValidationViolationChecker { /** * This method checks if the validation violations matches the violations
* given in a ViolationException .
* @ param exception
* the { @ link ConstraintViolationException } containig all
* violations
* @ param expectedValidationViolations
* list of expected vali... | if ( exception != null && expectedValidationViolations != null ) { List < String > givenViolations = new ArrayList < String > ( ) ; for ( ConstraintViolation < ? > violation : exception . getConstraintViolations ( ) ) { givenViolations . add ( violation . getMessageTemplate ( ) ) ; } checkViolations ( givenViolations ,... |
public class VirtualCdj { /** * Controls whether we are currently staying in sync with the tempo master . Will only be meaningful if we are
* sending status packets .
* @ param sync if { @ code true } , our status packets will be tempo and beat aligned with the tempo master */
public synchronized void setSynced ( b... | if ( synced . get ( ) != sync ) { // We are changing sync state , so add or remove our master listener as appropriate .
if ( sync && isSendingStatus ( ) ) { addMasterListener ( ourSyncMasterListener ) ; } else { removeMasterListener ( ourSyncMasterListener ) ; } // Also , if there is a tempo master , and we just got sy... |
public class ElementKindVisitor7 { /** * Visits a { @ code RESOURCE _ VARIABLE } variable element by calling
* { @ code defaultAction } .
* @ param e { @ inheritDoc }
* @ param p { @ inheritDoc }
* @ return the result of { @ code defaultAction } */
@ Override public R visitVariableAsResourceVariable ( VariableE... | return defaultAction ( e , p ) ; |
public class OlsonTimeZone { /** * 60 * 60 * 24; */
private void getHistoricalOffset ( long date , boolean local , int NonExistingTimeOpt , int DuplicatedTimeOpt , int [ ] offsets ) { } } | if ( transitionCount != 0 ) { long sec = Grego . floorDivide ( date , Grego . MILLIS_PER_SECOND ) ; if ( ! local && sec < transitionTimes64 [ 0 ] ) { // Before the first transition time
offsets [ 0 ] = initialRawOffset ( ) * Grego . MILLIS_PER_SECOND ; offsets [ 1 ] = initialDstOffset ( ) * Grego . MILLIS_PER_SECOND ; ... |
public class UnicodeCompressor { /** * Find the least - recently defined window */
private int getLRDefinedWindow ( ) { } } | int leastRU = Integer . MAX_VALUE ; int whichWindow = INVALIDWINDOW ; // find least recently used window
// supposedly faster to count down
// for ( int i = 0 ; i < NUMWINDOWS ; i + + ) {
for ( int i = NUMWINDOWS - 1 ; i >= 0 ; -- i ) { if ( fTimeStamps [ i ] < leastRU ) { leastRU = fTimeStamps [ i ] ; whichWindow = i ... |
public class ActiveProfilesChooser { /** * Get the final host name that will be used to choose the active profiles .
* @ return the ( overridden ) host name or the ( overriden ) host name + / + the ( overriden ) sub host name */
private String getHostname ( ) { } } | String hostname = null ; try { // Use the OS hostname first .
hostname = InetAddress . getLocalHost ( ) . getHostName ( ) . toLowerCase ( ) ; } catch ( UnknownHostException e ) { logger . warn ( "Cannot find hostname." , e ) ; } // Override by a system property second . Sometimes set when running in a container .
Strin... |
public class SubsamplingFilter { /** * { @ code ImageFilter } implementation , do not invoke . */
public void setDimensions ( int pWidth , int pHeight ) { } } | destWidth = ( pWidth + xSub - 1 ) / xSub ; destHeight = ( pHeight + ySub - 1 ) / ySub ; // System . out . println ( " Subsampling : " + xSub + " , " + ySub + " - > " + destWidth + " , " + destHeight ) ;
super . setDimensions ( pWidth , pHeight ) ; |
public class BaseExceptionRenderer { /** * / * ERROR HANDLING RESPONSES : */
protected boolean requestIsEmbedded ( HttpServletRequest httpRequest , WaybackRequest wbRequest ) { } } | // without a wbRequest , assume it is not embedded : send back HTML
if ( wbRequest == null ) { return false ; } String referer = wbRequest . getRefererUrl ( ) ; return ( referer != null && referer . length ( ) > 0 ) ; |
public class API { /** * Returns a one time nonce to be used with the API call specified by the URL
* @ param apiUrl the API URL
* @ return a one time nonce
* @ since 2.6.0 */
public String getOneTimeNonce ( String apiUrl ) { } } | String nonce = Long . toHexString ( random . nextLong ( ) ) ; this . nonces . put ( nonce , new Nonce ( nonce , apiUrl , true ) ) ; return nonce ; |
public class Extern { /** * Get the Extern Item object associated with this package name .
* @ param pkgName Package name . */
private Item findPackageItem ( String pkgName ) { } } | if ( packageToItemMap == null ) { return null ; } return packageToItemMap . get ( pkgName ) ; |
public class MvcFragment { /** * Called when the fragment is no longer in use . This is called after onStop ( ) and before onDetach ( ) .
* Event2C bus will be unregistered in the method .
* < p > < b > Note that , when a new fragment to create and pushes this fragment to back stack ,
* onDestroy of this fragment... | super . onDestroy ( ) ; releaseDependencies ( ) ; Mvc . graph ( ) . unregisterMonitor ( graphMonitor ) ; eventRegister = null ; |
public class AVLGroupTree { /** * Return the last node so that the sum of counts of nodes that are before
* it is less than or equal to < code > sum < / code > . */
@ SuppressWarnings ( "WeakerAccess" ) public int floorSum ( long sum ) { } } | int floor = IntAVLTree . NIL ; for ( int node = tree . root ( ) ; node != IntAVLTree . NIL ; ) { final int left = tree . left ( node ) ; final long leftCount = aggregatedCounts [ left ] ; if ( leftCount <= sum ) { floor = node ; sum -= leftCount + count ( node ) ; node = tree . right ( node ) ; } else { node = tree . l... |
public class EasyAdapter { /** * Append a collection of items and refresh the { @ code AdapterView } by calling
* { @ code notifyDataSetChanged ( ) } .
* @ param items collection of items to append
* @ return true if any data was modified by this operation , false otherwise . */
public boolean addItems ( Collecti... | if ( mListItems . addAll ( items ) ) { notifyDataSetChanged ( ) ; return true ; } return false ; |
public class NNDescent { /** * Bound the size of a set by random sampling .
* @ param set Set to process
* @ param items Maximum size */
private void boundSize ( HashSetModifiableDBIDs set , int items ) { } } | if ( set . size ( ) > items ) { DBIDs sample = DBIDUtil . randomSample ( set , items , rnd ) ; set . clear ( ) ; set . addDBIDs ( sample ) ; } |
public class vpnvserver { /** * Use this API to update vpnvserver resources . */
public static base_responses update ( nitro_service client , vpnvserver resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { vpnvserver updateresources [ ] = new vpnvserver [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { updateresources [ i ] = new vpnvserver ( ) ; updateresources [ i ] . name = resources [ i ] . name ; updatereso... |
public class JsonDBTemplate { /** * / * ( non - Javadoc )
* @ see io . jsondb . JsonDBOperations # isCollectionReadonly ( java . lang . String ) */
@ Override public < T > boolean isCollectionReadonly ( String collectionName ) { } } | CollectionMetaData cmd = cmdMap . get ( collectionName ) ; return cmd . isReadOnly ( ) ; |
public class MatlabSparseMatrixBuilder { /** * { @ inheritDoc } */
public synchronized int addColumn ( SparseArray < ? extends Number > column ) { } } | if ( isFinished ) throw new IllegalStateException ( "Cannot add columns to a MatrixBuilder that is finished" ) ; for ( int r : column . getElementIndices ( ) ) { // NB : Matlab sparse format is in [ row col val ] format
// NOTE : Matlab indices start at 1 , not 0 , so update all the row
// and column values to be Matla... |
public class StreamExecutionEnvironment { /** * Creates a data stream from the given non - empty collection . The type of the data stream is that of the
* elements in the collection .
* < p > The framework will try and determine the exact type from the collection elements . In case of generic
* elements , it may ... | Preconditions . checkNotNull ( data , "Collection must not be null" ) ; if ( data . isEmpty ( ) ) { throw new IllegalArgumentException ( "Collection must not be empty" ) ; } OUT first = data . iterator ( ) . next ( ) ; if ( first == null ) { throw new IllegalArgumentException ( "Collection must not contain null element... |
public class Utils { /** * Find the first element into the given array .
* @ param < T > the type of the elements to filter .
* @ param original the original array .
* @ param filter the filtering action .
* @ return the first element . */
public static < T extends AnnotationDesc > T findFirst ( T [ ] original ... | for ( final T element : original ) { if ( filter . test ( element ) ) { return element ; } } return null ; |
import java . lang . Math ; import java . util . ArrayList ; import java . util . List ; class LargestTupleDiff { /** * This function computes the highest difference among pairs within a provided list of tuples .
* Args :
* tuple _ list : A list of tuples
* Returns :
* An integer denoting the highest absolute d... | List < Integer > differences = new ArrayList < > ( ) ; for ( List < Integer > tuple : tupleList ) { differences . add ( Math . abs ( tuple . get ( 0 ) - tuple . get ( 1 ) ) ) ; } return differences . stream ( ) . max ( Integer :: compare ) . get ( ) ; |
public class ZipUtil { /** * Repacks a provided ZIP input stream into a ZIP file with a given compression level .
* @ param is
* ZIP input stream .
* @ param dstZip
* destination ZIP file .
* @ param compressionLevel
* compression level . */
public static void repack ( InputStream is , File dstZip , int com... | log . debug ( "Repacking from input stream into '{}'." , dstZip ) ; RepackZipEntryCallback callback = new RepackZipEntryCallback ( dstZip , compressionLevel ) ; try { iterate ( is , callback ) ; } finally { callback . closeStream ( ) ; } |
public class MergeRequestApi { /** * Get all merge requests for the specified project .
* < pre > < code > GitLab Endpoint : GET / projects / : id / merge _ requests < / code > < / pre >
* @ param projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance
* @ param state ... | Form formData = new GitLabApiForm ( ) . withParam ( "state" , state ) . withParam ( PAGE_PARAM , page ) . withParam ( PER_PAGE_PARAM , perPage ) ; Response response = get ( Response . Status . OK , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "merge_requests" ) ; return ( response . read... |
public class AmazonAutoScalingClient { /** * Moves the specified instances into the standby state .
* For more information , see < a
* href = " https : / / docs . aws . amazon . com / autoscaling / ec2 / userguide / as - enter - exit - standby . html " > Temporarily Removing
* Instances from Your Auto Scaling Gro... | request = beforeClientExecution ( request ) ; return executeEnterStandby ( request ) ; |
public class CmsWorkplace { /** * Creates a link for the OpenCms workplace that will reload the whole workplace , switch to the explorer view , the
* site of the given explorerRootPath and show the folder given in the explorerRootPath .
* @ param cms
* the cms object
* @ param explorerRootPath
* a root relati... | // split the root site :
String targetSiteRoot = OpenCms . getSiteManager ( ) . getSiteRoot ( explorerRootPath ) ; if ( targetSiteRoot == null ) { if ( OpenCms . getSiteManager ( ) . startsWithShared ( explorerRootPath ) ) { targetSiteRoot = OpenCms . getSiteManager ( ) . getSharedFolder ( ) ; } else { targetSiteRoot =... |
public class ManifestAsset { /** * Conversion method from Manifest to String .
* @ param manifest Manifest to be transformed into String
* @ return String representation of the Manifest */
private static String manifestAsString ( Manifest manifest ) { } } | ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; try { manifest . write ( baos ) ; return baos . toString ( "UTF-8" ) ; } catch ( IOException e ) { throw new IllegalStateException ( "Unable to write MANIFEST.MF to an archive Asset" , e ) ; } finally { try { baos . close ( ) ; } catch ( IOException e ) { } } |
public class FormatUtilities { /** * Returns the given date formatted using the given format , timezone and country .
* @ param dt The date to be formatted
* @ param format The format to use to display the date
* @ param tz The timezone associated with the date
* @ param country The country associated with the ... | return getFormattedDateTime ( dt , format , tz , country , 0L ) ; |
public class Filters { /** * Algorithms for rejecting the supplied object if at least one of the supplied Filters does not accept it .
* @ param object The object to reject ( or not ) .
* @ param filters The non - null list of Filters to examine the supplied object .
* @ param < T > The Filter type .
* @ return... | // Check sanity
Validate . notNull ( filters , "filters" ) ; boolean rejectedByAtLeastOneFilter = false ; for ( Filter < T > current : filters ) { if ( ! current . accept ( object ) ) { rejectedByAtLeastOneFilter = true ; break ; } } // All done .
return rejectedByAtLeastOneFilter ; |
public class WSRealmNameCallbackImpl { /** * Return the realm name . If the realm name set in < code > WSRealmNameCallbackImpl . setRealmName ( ) < / code >
* is < code > null < / code > , then < code > null < / code > is returned .
* @ return The realm name , could be < code > null < / code > . */
public String ge... | if ( realmName == null || realmName . trim ( ) . equals ( "" ) ) { realmName = getDefaultRealmName ( ) ; } return realmName ; |
public class DatabaseHelper { /** * This method is used to reset the client information on the backend database
* connection . Information will be reset only if it has been set .
* @ param mc WSRdbManagedConnectionImpl to reset the client information on
* @ exception SQLException
* java . sql . SQLException if ... | if ( mc . mcf . jdbcDriverSpecVersion >= 40 && ( mc . clientInfoExplicitlySet || mc . clientInfoImplicitlySet ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "resetClientInformation" , mc ) ; try { mc . sqlConn . setClientInfo ( mc . mcf . defaultClientInfo ) ; ... |
public class DatastreamResource { /** * < p > Add or modify a datastream .
* < / p > < p >
* POST / objects / { pid } / datastreams / { dsID } ? controlGroup dsLocation altIDs
* dsLabel versionable dsState formatURI checksumType checksum logMessage
* < / p > < p >
* Successful Response : Status : 201 Created ... | return addOrUpdateDatastream ( true , pid , dsID , m_headers . getMediaType ( ) , mimeType , controlGroup , dsLocation , altIDs , dsLabel , versionable , dsState , formatURI , checksumType , checksum , logMessage , false , null , flash ) ; |
public class DescribeDhcpOptionsRequest { /** * The IDs of one or more DHCP options sets .
* Default : Describes all your DHCP options sets .
* @ return The IDs of one or more DHCP options sets . < / p >
* Default : Describes all your DHCP options sets . */
public java . util . List < String > getDhcpOptionsIds (... | if ( dhcpOptionsIds == null ) { dhcpOptionsIds = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return dhcpOptionsIds ; |
public class BaseSerializingTranscoder { /** * Encode a string into the current character set . */
protected byte [ ] encodeString ( String in ) { } } | byte [ ] rv = null ; try { rv = in . getBytes ( this . charset ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; } return rv ; |
public class ServiceIdCache { /** * Get service information , reading from cache if possible
* @ param serviceId
* @ return */
public ServiceInstanceEntity get ( final String serviceId ) { } } | try { return serviceCache . get ( serviceId , ( ) -> dao . getById ( serviceId ) ) ; } catch ( Exception e ) { throw new RuntimeException ( "Error loading service: " + serviceId , e ) ; } |
public class BehindRefList { /** * Removes the first AIL in the list of AILs behind the current position of the cursor .
* The list may empty completely as a result . */
private final void _remove ( final BehindRef removeref ) { } } | if ( _firstLinkBehind != null ) { if ( removeref == _firstLinkBehind ) { // It ' s the first in the list . . .
if ( removeref == _lastLinkBehind ) { // . . . and the only entry , the list is now empty
_firstLinkBehind = null ; _lastLinkBehind = null ; } else { // . . . and there are more entries , the first will change... |
public class ObjectWrapper { /** * Internal static version of { @ link ObjectWrapper # getValue ( String ) } . */
private static Object getValue ( Object obj , String propertyPattern , ObjectWrapper options ) { } } | if ( propertyPattern == null ) { throw new IllegalArgumentException ( "Cannot get the value from a property with a 'null' propertyPattern." ) ; } if ( obj == null ) { // NullPointerException as it is throwed only when traversing a null object ( ex : " foo . null . bar " )
throw new NullPointerException ( "Cannot get th... |
public class AWSServiceCatalogClient { /** * Creates a self - service action .
* @ param createServiceActionRequest
* @ return Result of the CreateServiceAction operation returned by the service .
* @ throws InvalidParametersException
* One or more parameters provided to the operation are not valid .
* @ thro... | request = beforeClientExecution ( request ) ; return executeCreateServiceAction ( request ) ; |
public class BigDecimalUtil { /** * Returns a value rounded to p digits after decimal .
* If p is negative , then the number is rounded to
* places to the left of the decimal point . eg .
* 10.23 rounded to - 1 will give : 10 . If p is zero ,
* the returned value is rounded to the nearest integral
* value .
... | double retval ; if ( Double . isNaN ( n ) || Double . isInfinite ( n ) ) { retval = Double . NaN ; } else { if ( p != 0 ) { final double temp = Math . pow ( 10 , p ) ; retval = sign ( n ) * Math . round ( Math . abs ( n ) * temp - ROUNDING_UP_FLOAT ) / temp ; } else { retval = ( long ) n ; } } return retval ; |
public class CreateSingleRequestBuilder { /** * Execute the request using the supplied client
* @ param client the client
* @ return The request */
public T execute ( HyperionClient client ) { } } | EntityList < T > response = client . create ( build ( ) ) ; List < T > entries = response . getEntries ( ) ; return entries . size ( ) == 0 ? null : entries . get ( 0 ) ; |
public class RenameShapesProcessor { /** * Rename shapes for Member , Input , Output , ErrorMap , as well as the key for two maps :
* serviceModel . shape ( ) and shapeModifiers */
@ Override public void preprocess ( ServiceModel serviceModel ) { } } | if ( renameShapes == null || renameShapes . isEmpty ( ) ) return ; // sanity check
for ( Entry < String , String > entry : renameShapes . entrySet ( ) ) { String originalName = entry . getKey ( ) ; String newName = entry . getValue ( ) ; Shape originalShape = serviceModel . getShapes ( ) . get ( originalName ) ; if ( o... |
public class ImageDownloader { /** * Gets an image download result from the pool , waiting if necessary .
* @ return the download result
* @ throws Exception
* for a failed download task */
public ImageDownloadResult getImageDownloadResultWait ( ) throws Exception { } } | try { ImageDownloadResult imdr = pool . take ( ) . get ( ) ; return imdr ; } catch ( Exception e ) { throw e ; } finally { // in any case ( Exception or not ) the numPendingTask should be reduced
numPendingTasks -- ; } |
public class VariableNames { /** * Replies the name of an property that corresponds to the name of a bootique variable .
* @ param bootiqueVariable the name of the bootique variable .
* @ return the name of the property . */
public static String toPropertyName ( String bootiqueVariable ) { } } | if ( Strings . isNullOrEmpty ( bootiqueVariable ) ) { return null ; } return BOOTIQUE_PROPERTY_PREFIX + bootiqueVariable ; |
public class AbstractAnalyticProduct { /** * / * ( non - Javadoc )
* @ see net . finmath . marketdata . products . ProductInterface # getValue ( double , net . finmath . marketdata . products . ModelInterface ) */
@ Override public Object getValue ( double evaluationTime , Model model ) { } } | throw new IllegalArgumentException ( "The product " + this . getClass ( ) + " cannot be valued against a model " + model . getClass ( ) + "." + "It requires a model of type " + AnalyticModel . class + "." ) ; |
public class RegistryUtility { /** * Adds codec to Registry only , it will not handle the manipulating of encoders or decoders list in Registry . < br >
* 仅仅把codec直接加入到Registry中 , 而不处理加入到Registry里的encoders或decoders列表中 。
* If a codec with the same name already exists in the Registry , IllegalArgumentException will b... | Object oldValue = registry . lookup ( name ) ; if ( oldValue != null && oldValue != codec ) { throw new IllegalArgumentException ( "Codec name '" + name + "' is already in use in at least one of the registries." ) ; } registry . getDefaultSimpleRegistry ( ) . put ( name , codec ) ; |
public class JPAIssues { /** * parses the current class for spring - tx and jpa annotations , as well as hashCode and equals methods .
* @ param clz
* the currently parsed class */
private void catalogClass ( JavaClass clz ) { } } | transactionalMethods = new HashMap < > ( ) ; isEntity = false ; hasId = false ; hasGeneratedValue = false ; hasEagerOneToMany = false ; hasHCEquals = false ; for ( AnnotationEntry entry : clz . getAnnotationEntries ( ) ) { if ( "Ljavax/persistence/Entity;" . equals ( entry . getAnnotationType ( ) ) ) { isEntity = true ... |
public class UpdateInventorySlotsMessage { /** * Sends a { @ link Packet } to player to update the inventory slots .
* @ param inventoryId the inventory id
* @ param slots the slots
* @ param player the player
* @ param windowId the window id */
public static void updateSlots ( int inventoryId , List < MalisisS... | Packet packet = new Packet ( inventoryId , windowId ) ; for ( MalisisSlot slot : slots ) packet . addSlot ( slot ) ; MalisisCore . network . sendTo ( packet , player ) ; |
public class CmsWorkplaceManager { /** * Sets the system - wide file view settings for the workplace . < p >
* @ param cms the CmsObject for ensuring security constraints .
* @ param fileViewSettings the system - wide file view settings for the workplace to set
* @ throws CmsRoleViolationException if the current ... | if ( OpenCms . getRunLevel ( ) > OpenCms . RUNLEVEL_2_INITIALIZING ) { OpenCms . getRoleManager ( ) . checkRole ( cms , CmsRole . ROOT_ADMIN ) ; } m_fileViewSettings = fileViewSettings ; // disallow modifications of this " new original "
m_fileViewSettings . setFrozen ( true ) ; |
public class HealthModule { /** * Convert a Set of HealthDependency instances into a Map of them keyed by dependency name .
* < p > Fails fast if there are duplicate names . */
@ Provides @ Singleton Map < String , HealthDependency > provideHealthDependencyMap ( Set < HealthDependency > healthDependencySet ) { } } | Map < String , HealthDependency > result = Maps . newHashMap ( ) ; for ( HealthDependency dependency : healthDependencySet ) { if ( result . containsKey ( dependency . getName ( ) ) ) { throw new IllegalStateException ( "Dependency name " + dependency . getName ( ) + " is used by both " + dependency . getName ( ) + " a... |
public class PowerMock { /** * Mock a single static method ( nice ) .
* @ param clazz The class where the method is specified in .
* @ param methodNameToMock The first argument
* @ param firstArgumentType The first argument type .
* @ param additionalArgumentTypes Optional additional argument types . */
public ... | doMockSpecific ( clazz , new NiceMockStrategy ( ) , new String [ ] { methodNameToMock } , null , mergeArgumentTypes ( firstArgumentType , additionalArgumentTypes ) ) ; |
public class N { /** * Mostly it ' s designed for one - step operation to complete the operation in one step .
* < code > java . util . stream . Stream < / code > is preferred for multiple phases operation .
* @ param a
* @ param fromIndex
* @ param toIndex
* @ param func
* @ return */
public static < T , E... | checkFromToIndex ( fromIndex , toIndex , len ( a ) ) ; N . checkArgNotNull ( func ) ; if ( N . isNullOrEmpty ( a ) ) { return new CharList ( ) ; } final CharList result = new CharList ( toIndex - fromIndex ) ; for ( int i = fromIndex ; i < toIndex ; i ++ ) { result . add ( func . applyAsChar ( a [ i ] ) ) ; } return re... |
public class ProjectFilterSettings { /** * set the hidden bug categories on the specifed ProjectFilterSettings from
* an encoded string
* @ param result
* the ProjectFilterSettings from which to remove bug categories
* @ param s
* the encoded string
* @ see ProjectFilterSettings # hiddenFromEncodedString ( ... | if ( s . length ( ) > 0 ) { int bar = s . indexOf ( FIELD_DELIMITER ) ; String categories ; if ( bar >= 0 ) { categories = s . substring ( 0 , bar ) ; } else { categories = s ; } StringTokenizer t = new StringTokenizer ( categories , LISTITEM_DELIMITER ) ; while ( t . hasMoreTokens ( ) ) { String category = t . nextTok... |
public class CompletableFutures { /** * Useful for composing an async call in response to exceptional cases .
* For example :
* { @ code
* return thenHandleCompose ( myFuture , ( success , th ) - > {
* if ( th ! = null ) {
* return newCompletableFuture ( ) ;
* } else {
* return CompletableFuture . complet... | return completionStage . handle ( ( success , throwable ) -> new SuccessOrThrowable < > ( success , throwable ) ) . thenCompose ( pair -> fn . apply ( pair . item , pair . ex ) ) . toCompletableFuture ( ) ; |
public class ReplicatedTree { /** * Adds a key and value to a given node . If the node doesn ' t exist , it will be created . If the node
* already existed , a nodeModified ( ) notification will be generated . Otherwise a
* nodeCreated ( ) motification will be emitted .
* @ param fqn The fully qualified name of t... | if ( ! remote_calls ) { _put ( fqn , key , value ) ; return ; } // Changes done by < aos >
// if true , propagate action to the group
if ( send_message ) { if ( channel == null ) { if ( log . isErrorEnabled ( ) ) log . error ( "channel is null, cannot broadcast PUT request" ) ; return ; } try { channel . send ( new Mes... |
public class DynamicPath { /** * Resolves all patterns and generates a real path for a ( new ) file .
* @ return Generated path */
public String resolve ( ) { } } | Timestamp timestamp = RuntimeProvider . createTimestamp ( ) ; StringBuilder builder = new StringBuilder ( ) ; for ( Segment segment : segments ) { builder . append ( segment . createToken ( builder . toString ( ) , timestamp ) ) ; } return builder . toString ( ) ; |
public class DocumentRootImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public NotificationChain basicSetStringParameter ( StringParameterType newStringParameter , NotificationChain msgs ) { } } | return ( ( FeatureMap . Internal ) getMixed ( ) ) . basicAdd ( BpsimPackage . Literals . DOCUMENT_ROOT__STRING_PARAMETER , newStringParameter , msgs ) ; |
public class SectionLoader { /** * Loads all bytes and information of the resource section .
* The file on disk is read to fetch the information .
* @ return { @ link ResourceSection } of the given file
* @ throws IOException
* if unable to read the file
* @ throws IllegalStateException
* if section can not... | Optional < ResourceSection > rsrc = maybeLoadResourceSection ( ) ; return ( ResourceSection ) getOrThrow ( rsrc , "unable to load resource section" ) ; |
public class DefaultAsProvider { /** * Returns the value of the { @ link As } annotation .
* Otherwise , this transforms the class name into a readable sentence and returns it . */
@ Override public String as ( As annotation , Class < ? > scenarioClass ) { } } | if ( annotation != null && annotationHasExplicitValue ( annotation ) ) { return annotation . value ( ) ; } AbstractJGivenConfiguration configuration = ConfigurationUtil . getConfiguration ( scenarioClass ) ; String regEx = configuration . getTestClassSuffixRegEx ( ) ; String classNameWithoutSuffix = scenarioClass . get... |
public class CssFormatter { /** * Append a decimal number to the output .
* @ param value the number
* @ return a reference to this object */
CssFormatter append ( double value ) { } } | if ( value == ( int ) value ) { output . append ( Integer . toString ( ( int ) value ) ) ; } else { output . append ( decFormat . format ( value ) ) ; } return this ; |
public class MolecularFormula { /** * True , if the MolecularFormula contains the given IIsotope object and not
* the instance . The method looks for other isotopes which has the same
* symbol , natural abundance and exact mass .
* @ param isotope The IIsotope this MolecularFormula is searched for
* @ return Tr... | for ( IIsotope thisIsotope : isotopes ( ) ) { if ( isTheSame ( thisIsotope , isotope ) ) { return true ; } } return false ; |
public class BridgeUtils { /** * get input securityName .
* @ param input security attribute defined in the realm .
* @ param input security name value .
* @ param loginAccount or Group .
* @ return uniqueName if the property is an IdentifierType property , principalName otherwise . */
protected String getRealI... | boolean isInputAttrValueDN = UniqueNameHelper . isDN ( id ) != null ; boolean isInputAttrIdentifier = isIdentifierTypeProperty ( inputAttrName ) ; if ( ! isInputAttrIdentifier && isInputAttrValueDN ) { // To suppress the below message from coming in trace . log due to defect 94474
/* * if ( tc . isWarningEnabled ( ) ) ... |
public class FileUtils { /** * 获取文件名称
* @ param response
* @ return */
public static String getFileName ( TaskResponse response ) { } } | List < String > name = response . header ( "content-disposition" ) ; System . out . println ( name ) ; if ( null != name ) { return Arrays . stream ( name . get ( 0 ) . split ( "; " ) ) . filter ( item -> { return item . trim ( ) . startsWith ( "filename=\"" ) ; } ) . map ( filename -> { return filename . replaceAll ( ... |
public class FormFieldValidator { /** * Gets the parameter as a file . */
protected final File getFileParameter ( String paramName ) { } } | return new File ( Util . fixNull ( request . getParameter ( paramName ) ) ) ; |
public class AWSShieldClient { /** * Activates AWS Shield Advanced for an account .
* As part of this request you can specify < code > EmergencySettings < / code > that automaticaly grant the DDoS response
* team ( DRT ) needed permissions to assist you during a suspected DDoS attack . For more information see < a ... | request = beforeClientExecution ( request ) ; return executeCreateSubscription ( request ) ; |
public class GerritQueryHandler { /** * Creates a new SSH connection used to execute the queries .
* @ return a fresh instance of { @ link SshConnection }
* @ throws IOException for IO issues */
protected SshConnection getConnection ( ) throws IOException { } } | return SshConnectionFactory . getConnection ( gerritHostName , gerritSshPort , gerritProxy , authentication , connectionTimeout ) ; |
public class CleverTapAPI { /** * Launches an asynchronous task to download the notification icon from CleverTap ,
* and create the Android notification .
* If your app is using CleverTap SDK ' s built in FCM / GCM message handling ,
* this method does not need to be called explicitly .
* Use this method when i... | // noinspection ConstantConditions
if ( extras == null || extras . get ( Constants . NOTIFICATION_TAG ) == null ) { return ; } if ( config . isAnalyticsOnly ( ) ) { getConfigLogger ( ) . debug ( getAccountId ( ) , "Instance is set for Analytics only, cannot create notification" ) ; return ; } try { postAsyncSafely ( "C... |
public class AbstractAmazonRDSAsync { /** * Simplified method form for invoking the DescribeDBSecurityGroups operation with an AsyncHandler .
* @ see # describeDBSecurityGroupsAsync ( DescribeDBSecurityGroupsRequest , com . amazonaws . handlers . AsyncHandler ) */
@ Override public java . util . concurrent . Future <... | return describeDBSecurityGroupsAsync ( new DescribeDBSecurityGroupsRequest ( ) , asyncHandler ) ; |
public class MutationsUtil { /** * Encodes mutations in compact human - readable string , that can be decoded by method { @ link # decode ( String ,
* com . milaboratory . core . sequence . Alphabet ) } .
* < p > For format see { @ link com . milaboratory . core . mutations . Mutation # encode ( int ,
* com . mil... | if ( mutations . length == 0 ) return "" ; StringBuilder builder = new StringBuilder ( ) ; for ( int mut : mutations ) builder . append ( Mutation . encode ( mut , alphabet ) ) . append ( separator ) ; builder . delete ( builder . length ( ) - separator . length ( ) , builder . length ( ) ) ; return builder . toString ... |
public class GoogleAnalyticsController { /** * Check if the user is a member of the specified group name
* < p > Internal search , thus case sensitive . */
private boolean isMember ( IGroupMember groupMember , String groupName ) { } } | try { IEntityGroup group = GroupService . findGroup ( groupName ) ; if ( group != null ) { return groupMember . isDeepMemberOf ( group ) ; } final EntityIdentifier [ ] results = GroupService . searchForGroups ( groupName , GroupService . SearchMethod . DISCRETE , IPerson . class ) ; if ( results == null || results . le... |
public class PropertyConverter { /** * Given an RDF predicate value ( namespace URI + local name ) , figure out
* what JCR property to use
* @ param node the JCR node we want a property for
* @ param predicate the predicate to map to a property name
* @ param namespaceMapping prefix to uri namespace mapping
*... | final NamespaceRegistry namespaceRegistry = ( NamespaceRegistry ) getNamespaceRegistry ( node . getSession ( ) ) ; return getPropertyNameFromPredicate ( namespaceRegistry , predicate , namespaceMapping ) ; |
public class ListVaultsResult { /** * List of vaults .
* @ param vaultList
* List of vaults . */
public void setVaultList ( java . util . Collection < DescribeVaultOutput > vaultList ) { } } | if ( vaultList == null ) { this . vaultList = null ; return ; } this . vaultList = new java . util . ArrayList < DescribeVaultOutput > ( vaultList ) ; |
public class MCP3x0xGpioProvider { /** * This method will perform an immediate data acquisition directly to the ADC chip to get the requested pin ' s input
* conversion value .
* @ param pin requested input pin to acquire conversion value
* @ return conversion value for requested analog input pin
* @ throws IOE... | if ( isInitiated ( ) ) { // read in value from ADC chip
final double value = readAnalog ( toCommand ( ( short ) pin . getAddress ( ) ) ) ; // validate value withing acceptable range
if ( value >= MIN_VALUE && value <= MAX_VALUE ) { getPinCache ( pin ) . setAnalogValue ( value ) ; return value ; } } return INVALID_VALUE... |
public class PortletExecutionManager { /** * This method handles portlets that are slow to warm up . The default config multiplies the
* portlet ' s configured timeout by 20 the first 5 times it executes . The key is the portlet
* descriptor so even if you have the same portlet ( web proxy for example ) published 2... | final IPortletDescriptorKey portletDescriptorKey = portletDefinition . getPortletDescriptorKey ( ) ; final AtomicInteger counter = this . executionCount . get ( portletDescriptorKey ) ; final int executionCount = counter . get ( ) ; if ( executionCount > extendedTimeoutExecutions ) { return timeout ; } if ( logger . is... |
public class TransferListener { /** * Returns the number of active sessions for transaction .
* @ param xferId
* @ return int */
private int numberOfSessionsInTransaction ( String xferId ) { } } | int sessionCount = 0 ; List < String > sessions = transactionSessions . get ( xferId ) ; if ( sessions != null ) sessionCount = sessions . size ( ) ; return sessionCount ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.