signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class NaetherImpl { /** * / * ( non - Javadoc )
* @ see com . tobedevoured . naether . api . Naether # resolveDependencies ( boolean , java . util . Map ) */
public void resolveDependencies ( boolean downloadArtifacts , Map < String , String > properties ) throws URLException , DependencyException { } } | log . debug ( "Resolving Dependencies" ) ; log . debug ( "Local Repo Path: {}" , localRepoPath ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Remote Repositories:" ) ; for ( RemoteRepository repo : getRemoteRepositories ( ) ) { log . debug ( " {}" , repo . toString ( ) ) ; } } RepositoryClient repoClient = new RepositoryClient ( this . getLocalRepoPath ( ) ) ; if ( properties != null ) { repoClient . setProperties ( properties ) ; } // If there are local build artifacts , create a BuildWorkspaceReader to
// override remote artifacts with the local build artifacts .
if ( buildArtifacts . size ( ) > 0 ) { repoClient . setBuildWorkspaceReader ( buildArtifacts ) ; } CollectRequest collectRequest = new CollectRequest ( ) ; collectRequest . setDependencies ( new ArrayList < Dependency > ( getDependencies ( ) ) ) ; try { collectRequest . addRepository ( RepoBuilder . remoteRepositoryFromUrl ( "file:" + this . getLocalRepoPath ( ) ) ) ; } catch ( MalformedURLException e ) { throw new URLException ( "Failed to add local repo to request" , e ) ; } for ( RemoteRepository repo : getRemoteRepositories ( ) ) { collectRequest . addRepository ( repo ) ; } CollectResult collectResult ; try { collectResult = repoClient . collectDependencies ( collectRequest ) ; } catch ( DependencyCollectionException e ) { throw new DependencyException ( e ) ; } preorderedNodeList = new PreorderNodeListGenerator ( ) ; if ( downloadArtifacts ) { DependencyRequest dependencyRequest = new DependencyRequest ( collectRequest , null ) ; log . debug ( "Resolving dependencies to files" ) ; DependencyResult dependencyResult ; try { dependencyResult = repoClient . resolveDependencies ( dependencyRequest ) ; } catch ( DependencyResolutionException e ) { throw new DependencyException ( e ) ; } dependencyResult . getRoot ( ) . accept ( preorderedNodeList ) ; } else { collectResult . getRoot ( ) . accept ( preorderedNodeList ) ; } // this . setDependencies ( new HashSet < Dependency > ( preorderedNodeList . getDependencies ( true ) ) ) ;
log . debug ( "Setting resolved dependencies: {}" , this . getDependencies ( ) ) ; |
public class LLEImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . LLE__LNK_TYPE : return getLnkType ( ) ; case AfplibPackage . LLE__RG : return getRG ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class AbstractQueryRunner { /** * Converts array of parameter values ( as array ) and converts it into
* array of { @ link QueryParameters }
* Used during batch invocation
* @ param params
* @ return */
protected QueryParameters [ ] getQueryParams ( Object [ ] [ ] params ) { } } | QueryParameters [ ] result = new QueryParameters [ params . length ] ; for ( int i = 0 ; i < params . length ; i ++ ) { result [ i ] = new QueryParameters ( params [ i ] ) ; } return result ; |
public class UpdateObjectAttributesRequest { /** * The attributes update structure .
* @ param attributeUpdates
* The attributes update structure . */
public void setAttributeUpdates ( java . util . Collection < ObjectAttributeUpdate > attributeUpdates ) { } } | if ( attributeUpdates == null ) { this . attributeUpdates = null ; return ; } this . attributeUpdates = new java . util . ArrayList < ObjectAttributeUpdate > ( attributeUpdates ) ; |
public class AWSCognitoIdentityProviderClient { /** * Lists a history of user activity and any risks detected as part of Amazon Cognito advanced security .
* @ param adminListUserAuthEventsRequest
* @ return Result of the AdminListUserAuthEvents operation returned by the service .
* @ throws InvalidParameterException
* This exception is thrown when the Amazon Cognito service encounters an invalid parameter .
* @ throws ResourceNotFoundException
* This exception is thrown when the Amazon Cognito service cannot find the requested resource .
* @ throws TooManyRequestsException
* This exception is thrown when the user has made too many requests for a given operation .
* @ throws NotAuthorizedException
* This exception is thrown when a user is not authorized .
* @ throws UserNotFoundException
* This exception is thrown when a user is not found .
* @ throws UserPoolAddOnNotEnabledException
* This exception is thrown when user pool add - ons are not enabled .
* @ throws InternalErrorException
* This exception is thrown when Amazon Cognito encounters an internal error .
* @ sample AWSCognitoIdentityProvider . AdminListUserAuthEvents
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / cognito - idp - 2016-04-18 / AdminListUserAuthEvents "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public AdminListUserAuthEventsResult adminListUserAuthEvents ( AdminListUserAuthEventsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeAdminListUserAuthEvents ( request ) ; |
public class vrid { /** * Use this API to add vrid . */
public static base_response add ( nitro_service client , vrid resource ) throws Exception { } } | vrid addresource = new vrid ( ) ; addresource . id = resource . id ; addresource . priority = resource . priority ; addresource . preemption = resource . preemption ; addresource . sharing = resource . sharing ; addresource . tracking = resource . tracking ; return addresource . add_resource ( client ) ; |
public class RocksDBCache { /** * Initializes this instance of the RocksDB cache . This method must be invoked before the cache can be used . */
void initialize ( ) { } } | Preconditions . checkState ( this . database . get ( ) == null , "%s has already been initialized." , this . logId ) ; try { clear ( true ) ; this . database . set ( openDatabase ( ) ) ; } catch ( Exception ex ) { // Make sure we cleanup anything we may have created in case of failure .
try { close ( ) ; } catch ( Exception closeEx ) { ex . addSuppressed ( closeEx ) ; } throw ex ; } log . info ( "{}: Initialized." , this . logId ) ; |
public class PointTrackerKltPyramid { /** * Creates a new feature track at the specified location . Must only be called after
* { @ link # process ( ImageGray ) } has been called . It can fail if there
* is insufficient texture
* @ param x x - coordinate
* @ param y y - coordinate
* @ return the new track if successful or null if no new track could be created */
public PointTrack addTrack ( double x , double y ) { } } | if ( ! input . isInBounds ( ( int ) x , ( int ) y ) ) return null ; // grow the number of tracks if needed
if ( unused . isEmpty ( ) ) addTrackToUnused ( ) ; // TODO make sure the feature is inside the image
PyramidKltFeature t = unused . remove ( unused . size ( ) - 1 ) ; t . setPosition ( ( float ) x , ( float ) y ) ; tracker . setDescription ( t ) ; PointTrack p = ( PointTrack ) t . cookie ; p . set ( x , y ) ; if ( checkValidSpawn ( p ) ) { active . add ( t ) ; return p ; } return null ; |
public class Dictionary { /** * Gets a property ' s value as a Number . Returns null if the value doesn ' t exist , or its value is not a Number .
* @ param key the key
* @ return the Number or nil . */
@ Override public Number getNumber ( @ NonNull String key ) { } } | if ( key == null ) { throw new IllegalArgumentException ( "key cannot be null." ) ; } synchronized ( lock ) { final Object obj = getMValue ( internalDict , key ) . asNative ( internalDict ) ; return CBLConverter . asNumber ( obj ) ; } |
public class ReflectionHelper { /** * Gets the map of String to { @ link org . wisdom . content . converters . ReflectionHelper . Property } . These properties
* are extracted from the given class . Properties are identified using the ` setX ` methods and fields . The map
* entry are the property name .
* @ param clazz the class
* @ param genericType the class with generic parameter if any
* @ return the map containing the extracted properties */
public static Map < String , Property > getProperties ( Class clazz , Type genericType ) { } } | Map < String , Property > map = new TreeMap < > ( String . CASE_INSENSITIVE_ORDER ) ; // Start by methods - public only , including overridden
Method [ ] methods = clazz . getMethods ( ) ; for ( Method method : methods ) { if ( method . getName ( ) . startsWith ( "set" ) && method . getParameterTypes ( ) . length == 1 ) { // it ' s a setter .
String name = method . getName ( ) . substring ( "set" . length ( ) ) ; Property property = map . get ( name ) ; if ( property == null ) { property = new Property ( ) ; map . put ( name , property ) ; } property . setter ( method ) ; } } // All fields , but will not do anything for existing properties .
for ( Field field : getAllFields ( clazz ) ) { String name = field . getName ( ) ; Property property = map . get ( name ) ; if ( property == null ) { property = new Property ( ) ; property . field ( field ) ; map . put ( name , property ) ; } // Else the property has already a setter , the setter has to be used .
} return map ; |
public class SARLValidator { /** * Check for unused capacities .
* @ param uses the capacity use declaration . */
@ Check ( CheckType . NORMAL ) public void checkUnusedCapacities ( SarlCapacityUses uses ) { } } | if ( ! isIgnored ( UNUSED_AGENT_CAPACITY ) ) { final XtendTypeDeclaration container = uses . getDeclaringType ( ) ; final JvmDeclaredType jvmContainer = ( JvmDeclaredType ) this . associations . getPrimaryJvmElement ( container ) ; final Map < String , JvmOperation > importedFeatures = CollectionLiterals . newHashMap ( ) ; for ( final JvmOperation operation : jvmContainer . getDeclaredOperations ( ) ) { if ( Utils . isNameForHiddenCapacityImplementationCallingMethod ( operation . getSimpleName ( ) ) ) { importedFeatures . put ( operation . getSimpleName ( ) , operation ) ; } } final boolean isSkill = container instanceof SarlSkill ; int index = 0 ; for ( final JvmTypeReference capacity : uses . getCapacities ( ) ) { final LightweightTypeReference lreference = toLightweightTypeReference ( capacity ) ; if ( isSkill && lreference . isAssignableFrom ( jvmContainer ) ) { addIssue ( MessageFormat . format ( Messages . SARLValidator_22 , capacity . getSimpleName ( ) ) , uses , SARL_CAPACITY_USES__CAPACITIES , index , UNUSED_AGENT_CAPACITY , capacity . getSimpleName ( ) ) ; } else { final String fieldName = Utils . createNameForHiddenCapacityImplementationAttribute ( capacity . getIdentifier ( ) ) ; final String operationName = Utils . createNameForHiddenCapacityImplementationCallingMethodFromFieldName ( fieldName ) ; final JvmOperation operation = importedFeatures . get ( operationName ) ; if ( operation != null && ! isLocallyUsed ( operation , container ) ) { addIssue ( MessageFormat . format ( Messages . SARLValidator_78 , capacity . getSimpleName ( ) ) , uses , SARL_CAPACITY_USES__CAPACITIES , index , UNUSED_AGENT_CAPACITY , capacity . getSimpleName ( ) ) ; } } ++ index ; } } |
public class TypeUtil { /** * Visit all declared types in the hierarchy using a depth - first traversal , visiting classes
* before interfaces . */
public boolean visitTypeHierarchy ( TypeMirror type , TypeVisitor visitor ) { } } | boolean result = true ; if ( type == null ) { return result ; } if ( type . getKind ( ) == TypeKind . DECLARED ) { result = visitor . accept ( ( DeclaredType ) type ) ; } for ( TypeMirror superType : directSupertypes ( type ) ) { if ( ! result ) { return false ; } result = visitTypeHierarchy ( superType , visitor ) ; } return result ; |
public class WebServiceRefInfo { /** * Returns the List < WebServiceFeature > associated with the specified SEI class name . */
public List < WebServiceFeature > getWSFeatureForSEIClass ( String seiClassName ) { } } | PortComponentRefInfo portComponentRefInfo = seiNamePortComponentRefInfoMap . get ( seiClassName ) ; if ( portComponentRefInfo == null ) { return Collections . emptyList ( ) ; } List < WebServiceFeatureInfo > featureInfos = portComponentRefInfo . getWebServiceFeatureInfos ( ) ; if ( featureInfos . isEmpty ( ) ) { return Collections . emptyList ( ) ; } List < WebServiceFeature > wsFeatures = new ArrayList < WebServiceFeature > ( featureInfos . size ( ) ) ; for ( WebServiceFeatureInfo featureInfo : featureInfos ) { wsFeatures . add ( featureInfo . getWebServiceFeature ( ) ) ; } return wsFeatures ; |
public class ProxyFilter { /** * Event is stored in an { @ link IoSessionEventQueue } for later delivery to the next filter
* in the chain when the handshake would have succeed . This will prevent the rest of
* the filter chain from being affected by this filter internals .
* @ param nextFilter the next filter in filter chain
* @ param session the session object */
@ Override public void sessionClosed ( NextFilter nextFilter , IoSession session ) throws Exception { } } | ProxyIoSession proxyIoSession = ( ProxyIoSession ) session . getAttribute ( ProxyIoSession . PROXY_SESSION ) ; proxyIoSession . getEventQueue ( ) . enqueueEventIfNecessary ( new IoSessionEvent ( nextFilter , session , IoSessionEventType . CLOSED ) ) ; |
public class VJournal { /** * Sets the level of sensitivity of the journal entry . If not specified , the
* data within the journal entry should be considered " public " .
* @ param classification the classification level ( e . g . " CONFIDENTIAL " ) or
* null to remove
* @ return the property that was created
* @ see < a href = " http : / / tools . ietf . org / html / rfc5545 # page - 82 " > RFC 5545
* p . 82-3 < / a >
* @ see < a href = " http : / / tools . ietf . org / html / rfc2445 # page - 79 " > RFC 2445
* p . 79-80 < / a > */
public Classification setClassification ( String classification ) { } } | Classification prop = ( classification == null ) ? null : new Classification ( classification ) ; setClassification ( prop ) ; return prop ; |
public class EnglishStemmer { /** * { @ inheritDoc } */
public String stem ( String token ) { } } | englishStemmer stemmer = new englishStemmer ( ) ; stemmer . setCurrent ( token ) ; stemmer . stem ( ) ; return stemmer . getCurrent ( ) ; |
public class StandardResourceDescriptionResolver { /** * { @ inheritDoc } */
@ Override public String getOperationParameterValueTypeDescription ( String operationName , String paramName , Locale locale , ResourceBundle bundle , String ... suffixes ) { } } | String [ ] fixed ; if ( reuseAttributesForAdd && ADD . equals ( operationName ) ) { fixed = new String [ ] { paramName } ; } else { fixed = new String [ ] { operationName , paramName } ; } return bundle . getString ( getVariableBundleKey ( fixed , suffixes ) ) ; |
public class ExecToolCommandLogger { /** * Process string specified by the framework . log . dispatch . console . format property replacing any well known tokens with values
* from the event .
* @ param event The BuildEvent
* @ param message The concatenated message
* @ return message string with tokens replaced by values . */
private String expandMessage ( final BuildEvent event , final String message ) { } } | final HashMap < String , String > data = new HashMap < String , String > ( ) ; final String user = retrieveUserName ( event ) ; if ( null != user ) { data . put ( "user" , user ) ; } final String node = retrieveNodeName ( event ) ; if ( null != node ) { data . put ( "node" , node ) ; } data . put ( "level" , logLevelToString ( event . getPriority ( ) ) ) ; if ( null != formatter ) { return formatter . reformat ( data , message ) ; } else { return message ; } |
public class XTryCatchFinallyExpressionImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setFinallyExpression ( XExpression newFinallyExpression ) { } } | if ( newFinallyExpression != finallyExpression ) { NotificationChain msgs = null ; if ( finallyExpression != null ) msgs = ( ( InternalEObject ) finallyExpression ) . eInverseRemove ( this , EOPPOSITE_FEATURE_BASE - XbasePackage . XTRY_CATCH_FINALLY_EXPRESSION__FINALLY_EXPRESSION , null , msgs ) ; if ( newFinallyExpression != null ) msgs = ( ( InternalEObject ) newFinallyExpression ) . eInverseAdd ( this , EOPPOSITE_FEATURE_BASE - XbasePackage . XTRY_CATCH_FINALLY_EXPRESSION__FINALLY_EXPRESSION , null , msgs ) ; msgs = basicSetFinallyExpression ( newFinallyExpression , msgs ) ; if ( msgs != null ) msgs . dispatch ( ) ; } else if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , XbasePackage . XTRY_CATCH_FINALLY_EXPRESSION__FINALLY_EXPRESSION , newFinallyExpression , newFinallyExpression ) ) ; |
public class BootstrapTools { /** * Writes a Flink YAML config file from a Flink Configuration object .
* @ param cfg The Flink config
* @ param file The File to write to
* @ throws IOException */
public static void writeConfiguration ( Configuration cfg , File file ) throws IOException { } } | try ( FileWriter fwrt = new FileWriter ( file ) ; PrintWriter out = new PrintWriter ( fwrt ) ) { for ( String key : cfg . keySet ( ) ) { String value = cfg . getString ( key , null ) ; out . print ( key ) ; out . print ( ": " ) ; out . println ( value ) ; } } |
public class UEL { /** * Get the trigger character for the specified delimited expression .
* @ param delimitedExpression
* @ return first non - whitespace character of { @ code delimitedExpression }
* @ throws IllegalArgumentException if argument expression is not delimited */
public static char getTrigger ( final String delimitedExpression ) { } } | final String expr = StringUtils . trimToEmpty ( delimitedExpression ) ; Validate . isTrue ( isDelimited ( expr ) ) ; return expr . charAt ( 0 ) ; |
public class ST_AddPoint { /** * Adds a vertex into a Polygon with a given tolerance .
* @ param polygon
* @ param vertexPoint
* @ param tolerance
* @ return
* @ throws SQLException */
private static Polygon insertVertexInPolygon ( Polygon polygon , Point vertexPoint , double tolerance ) throws SQLException { } } | Polygon geom = polygon ; LineString linearRing = polygon . getExteriorRing ( ) ; int index = - 1 ; for ( int i = 0 ; i < polygon . getNumInteriorRing ( ) ; i ++ ) { double distCurr = computeDistance ( polygon . getInteriorRingN ( i ) , vertexPoint , tolerance ) ; if ( distCurr < tolerance ) { index = i ; } } if ( index == - 1 ) { // The point is a on the exterior ring .
LinearRing inserted = insertVertexInLinearRing ( linearRing , vertexPoint , tolerance ) ; if ( inserted != null ) { LinearRing [ ] holes = new LinearRing [ polygon . getNumInteriorRing ( ) ] ; for ( int i = 0 ; i < holes . length ; i ++ ) { holes [ i ] = ( LinearRing ) polygon . getInteriorRingN ( i ) ; } geom = FACTORY . createPolygon ( inserted , holes ) ; } } else { // We add the vertex on the first hole
LinearRing [ ] holes = new LinearRing [ polygon . getNumInteriorRing ( ) ] ; for ( int i = 0 ; i < holes . length ; i ++ ) { if ( i == index ) { holes [ i ] = insertVertexInLinearRing ( polygon . getInteriorRingN ( i ) , vertexPoint , tolerance ) ; } else { holes [ i ] = ( LinearRing ) polygon . getInteriorRingN ( i ) ; } } geom = FACTORY . createPolygon ( ( LinearRing ) linearRing , holes ) ; } if ( geom != null ) { if ( ! geom . isValid ( ) ) { throw new SQLException ( "Geometry not valid" ) ; } } return geom ; |
public class AdminParserUtils { /** * Checks if there ' s at most one option that exists among all opts .
* @ param parser OptionParser to checked
* @ param opts List of options to be checked
* @ throws VoldemortException */
public static void checkOptional ( OptionSet options , List < String > opts ) throws VoldemortException { } } | List < String > optCopy = Lists . newArrayList ( ) ; for ( String opt : opts ) { if ( options . has ( opt ) ) { optCopy . add ( opt ) ; } } if ( optCopy . size ( ) > 1 ) { System . err . println ( "Conflicting options:" ) ; for ( String opt : optCopy ) { System . err . println ( "--" + opt ) ; } throw new VoldemortException ( "Conflicting options detected." ) ; } |
public class CreateAssessmentTemplateRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateAssessmentTemplateRequest createAssessmentTemplateRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createAssessmentTemplateRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createAssessmentTemplateRequest . getAssessmentTargetArn ( ) , ASSESSMENTTARGETARN_BINDING ) ; protocolMarshaller . marshall ( createAssessmentTemplateRequest . getAssessmentTemplateName ( ) , ASSESSMENTTEMPLATENAME_BINDING ) ; protocolMarshaller . marshall ( createAssessmentTemplateRequest . getDurationInSeconds ( ) , DURATIONINSECONDS_BINDING ) ; protocolMarshaller . marshall ( createAssessmentTemplateRequest . getRulesPackageArns ( ) , RULESPACKAGEARNS_BINDING ) ; protocolMarshaller . marshall ( createAssessmentTemplateRequest . getUserAttributesForFindings ( ) , USERATTRIBUTESFORFINDINGS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class VirtualHost { /** * Method getMimeType .
* @ param file
* @ return String */
public String getMimeType ( String withDot , String withoutDot ) { } } | String type = vHostConfig . getMimeType ( withoutDot ) ; if ( type == null ) type = vHostConfig . getMimeType ( withDot ) ; return type ; |
public class CalendarPickerView { /** * Select a new date . Respects the { @ link SelectionMode } this CalendarPickerView is configured
* with : if you are in { @ link SelectionMode # SINGLE } , the previously selected date will be
* un - selected . In { @ link SelectionMode # MULTIPLE } , the new date will be added to the list of
* selected dates .
* If the selection was made ( selectable date , in range ) , the view will scroll to the newly
* selected date if it ' s not already visible .
* @ return - whether we were able to set the date */
public boolean selectDate ( Date date , boolean smoothScroll ) { } } | validateDate ( date ) ; MonthCellWithMonthIndex monthCellWithMonthIndex = getMonthCellWithIndexByDate ( date ) ; if ( monthCellWithMonthIndex == null || ! isDateSelectable ( date ) ) { return false ; } boolean wasSelected = doSelectDate ( date , monthCellWithMonthIndex . cell ) ; if ( wasSelected ) { scrollToSelectedMonth ( monthCellWithMonthIndex . monthIndex , smoothScroll ) ; } return wasSelected ; |
public class WebDriverTool { /** * Returns the size of an element and its position relative to the viewport . Uses JavaScript
* calling Element . getBoundingClientRect ( ) .
* @ param by
* the { @ link By } used to locate the element
* @ return the rectangle */
public Rectangle getBoundingClientRect ( final By by ) { } } | WebElement el = findElement ( by ) ; @ SuppressWarnings ( "unchecked" ) Map < String , Number > result = ( Map < String , Number > ) executeScript ( JS_GET_BOUNDING_CLIENT_RECT , el ) ; Rectangle rectangle = new Rectangle ( result . get ( "top" ) . intValue ( ) , result . get ( "left" ) . intValue ( ) , result . get ( "bottom" ) . intValue ( ) , result . get ( "right" ) . intValue ( ) , result . get ( "width" ) . intValue ( ) , result . get ( "height" ) . intValue ( ) ) ; LOGGER . info ( "Bounding client rect for {}: {}" , by , rectangle ) ; return rectangle ; |
public class StreamEx { /** * Returns an array containing all the stream elements using the supplied
* element type class to allocate an array .
* This is a < a href = " package - summary . html # StreamOps " > terminal < / a >
* operation .
* @ param < A > the element type of the resulting array
* @ param elementClass the type of array elements
* @ return an array containing the elements in this stream
* @ throws ArrayStoreException if the runtime type of the array returned
* from the array generator is not a supertype of the runtime type
* of every element in this stream
* @ see # toArray ( java . util . function . IntFunction )
* @ since 0.6.3 */
@ SuppressWarnings ( "unchecked" ) public < A > A [ ] toArray ( Class < A > elementClass ) { } } | return stream ( ) . toArray ( size -> ( A [ ] ) Array . newInstance ( elementClass , size ) ) ; |
public class PersistentCookieStore { /** * Returns cookie decoded from cookie string
* @ param cookieString string of cookie as returned from http request
* @ return decoded cookie or null if exception occured */
protected Cookie decodeCookie ( String cookieString ) { } } | byte [ ] bytes = hexStringToByteArray ( cookieString ) ; ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream ( bytes ) ; Cookie cookie = null ; try { ObjectInputStream objectInputStream = new ObjectInputStream ( byteArrayInputStream ) ; cookie = ( ( SerializableHttpCookie ) objectInputStream . readObject ( ) ) . getCookie ( ) ; } catch ( IOException e ) { Util . log ( "IOException in decodeCookie" , e ) ; } catch ( ClassNotFoundException e ) { Util . log ( "ClassNotFoundException in decodeCookie" , e ) ; } return cookie ; |
public class RepositoryResolver { /** * Removes the version from the end of a feature symbolic name
* The version is presumed to start after the last dash character in the name .
* E . g . { @ code getFeatureBaseName ( " com . example . featureA - 1.0 " ) } returns { @ code " com . example . featureA - " }
* @ param nameAndVersion the feature symbolic name
* @ return the feature symbolic name with any version stripped */
String getFeatureBaseName ( String nameAndVersion ) { } } | int dashPosition = nameAndVersion . lastIndexOf ( '-' ) ; if ( dashPosition != - 1 ) { return nameAndVersion . substring ( 0 , dashPosition + 1 ) ; } else { return nameAndVersion ; } |
public class OmemoManager { /** * Send a ratchet update message . This can be used to advance the ratchet of a session in order to maintain forward
* secrecy .
* @ param recipient recipient
* @ throws CorruptedOmemoKeyException When the used identityKeys are corrupted
* @ throws CryptoFailedException When something fails with the crypto
* @ throws CannotEstablishOmemoSessionException When we can ' t establish a session with the recipient
* @ throws SmackException . NotLoggedInException
* @ throws InterruptedException
* @ throws SmackException . NoResponseException
* @ throws NoSuchAlgorithmException
* @ throws SmackException . NotConnectedException */
public void sendRatchetUpdateMessage ( OmemoDevice recipient ) throws SmackException . NotLoggedInException , CorruptedOmemoKeyException , InterruptedException , SmackException . NoResponseException , NoSuchAlgorithmException , SmackException . NotConnectedException , CryptoFailedException , CannotEstablishOmemoSessionException { } } | synchronized ( LOCK ) { Message message = new Message ( ) ; message . setFrom ( getOwnJid ( ) ) ; message . setTo ( recipient . getJid ( ) ) ; OmemoElement element = getOmemoService ( ) . createRatchetUpdateElement ( new LoggedInOmemoManager ( this ) , recipient ) ; message . addExtension ( element ) ; // Set MAM Storage hint
StoreHint . set ( message ) ; connection ( ) . sendStanza ( message ) ; } |
public class Refunds { /** * 申请退款
* @ param request 退款请求对象
* @ return RefundResponse对象 , 或抛WepayException */
public RefundApplyResponse apply ( RefundApplyRequest request ) { } } | checkApplyParams ( request ) ; Map < String , String > applyParams = buildApplyParams ( request ) ; return doHttpsPost ( APPLY , applyParams , RefundApplyResponse . class ) ; |
public class FilesystemConnector { /** * gets a path like ' ff / ff ' from first 4 hex chars of pid md5 digest */
static String getPath ( String pid ) { } } | String hex = DigestUtils . md5Hex ( pid ) ; return "" + hex . charAt ( 0 ) + hex . charAt ( 1 ) + '/' + hex . charAt ( 2 ) + hex . charAt ( 3 ) ; |
public class ProfileHandler { /** * Push a profile update .
* @ param profile A { @ link Map } , with keys as strings , and values as { @ link String } ,
* { @ link Integer } , { @ link Long } , { @ link Boolean } , { @ link Float } , { @ link Double } ,
* { @ link java . util . Date } , or { @ link Character }
* @ deprecated use { @ link CleverTapAPI # pushProfile ( Map profile ) } */
@ Deprecated public void push ( final Map < String , Object > profile ) { } } | CleverTapAPI cleverTapAPI = weakReference . get ( ) ; if ( cleverTapAPI == null ) { Logger . d ( "CleverTap Instance is null." ) ; } else { cleverTapAPI . pushProfile ( profile ) ; } |
public class Event { /** * Retrieves the details of an event . Supply the unique identifier of the event , which you might
* have received in a webhook . */
public static Event retrieve ( String id , RequestOptions options ) throws StripeException { } } | return retrieve ( id , null , options ) ; |
public class Config { /** * Returns a read - only reliable topic configuration for the given name .
* The name is matched by pattern to the configuration and by stripping the
* partition ID qualifier from the given { @ code name } .
* If there is no config found by the name , it will return the configuration
* with the name { @ code default } .
* @ param name name of the reliable topic config
* @ return the reliable topic configuration
* @ throws ConfigurationException if ambiguous configurations are found
* @ see StringPartitioningStrategy # getBaseName ( java . lang . String )
* @ see # setConfigPatternMatcher ( ConfigPatternMatcher )
* @ see # getConfigPatternMatcher ( )
* @ see EvictionConfig # setSize ( int ) */
public ReliableTopicConfig findReliableTopicConfig ( String name ) { } } | name = getBaseName ( name ) ; ReliableTopicConfig config = lookupByPattern ( configPatternMatcher , reliableTopicConfigs , name ) ; if ( config != null ) { return config . getAsReadOnly ( ) ; } return getReliableTopicConfig ( "default" ) . getAsReadOnly ( ) ; |
public class DomainsInner { /** * Delete a domain .
* Delete a domain .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param domainName Name of the domain .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */
public void delete ( String resourceGroupName , String domainName ) { } } | deleteWithServiceResponseAsync ( resourceGroupName , domainName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class Options { /** * Returns an object of the same type as { @ code o } , or null if it is not retained . */
private Object retainAll ( Schema schema , MarkSet markSet , ProtoType type , Object o ) { } } | if ( ! markSet . contains ( type ) ) { return null ; // Prune this type .
} else if ( o instanceof Map ) { ImmutableMap . Builder < ProtoMember , Object > builder = ImmutableMap . builder ( ) ; for ( Map . Entry < ? , ? > entry : ( ( Map < ? , ? > ) o ) . entrySet ( ) ) { ProtoMember protoMember = ( ProtoMember ) entry . getKey ( ) ; if ( ! markSet . contains ( protoMember ) ) continue ; // Prune this field .
Field field = schema . getField ( protoMember ) ; Object retainedValue = retainAll ( schema , markSet , field . type ( ) , entry . getValue ( ) ) ; if ( retainedValue != null ) { builder . put ( protoMember , retainedValue ) ; // This retained field is non - empty .
} } ImmutableMap < ProtoMember , Object > map = builder . build ( ) ; return ! map . isEmpty ( ) ? map : null ; } else if ( o instanceof List ) { ImmutableList . Builder < Object > builder = ImmutableList . builder ( ) ; for ( Object value : ( ( List ) o ) ) { Object retainedValue = retainAll ( schema , markSet , type , value ) ; if ( retainedValue != null ) { builder . add ( retainedValue ) ; // This retained value is non - empty .
} } ImmutableList < Object > list = builder . build ( ) ; return ! list . isEmpty ( ) ? list : null ; } else { return o ; } |
public class AsyncLibrary { /** * @ see com . ibm . io . async . IAsyncProvider # multiIO3 ( long , long , int , boolean , boolean , long , boolean ) */
@ Override public boolean multiIO3 ( long iobufferAddress , long position , int count , boolean isRead , boolean forceQueue , long bytesRequested , boolean useJITBuffer ) throws AsyncException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "multiIO3: pos=" + position + " count=" + count ) ; } return aio_multiIO3 ( iobufferAddress , position , count , isRead , forceQueue , bytesRequested , useJITBuffer ) ; |
public class GeometryCollection { /** * Create a new instance of this class by giving the collection a list of { @ link Geometry } .
* @ param geometries a non - null list of geometry which makes up this collection
* @ param bbox optionally include a bbox definition as a double array
* @ return a new instance of this class defined by the values passed inside this static factory
* method
* @ since 1.0.0 */
public static GeometryCollection fromGeometries ( @ NonNull List < Geometry > geometries , @ Nullable BoundingBox bbox ) { } } | return new GeometryCollection ( TYPE , bbox , geometries ) ; |
public class ToggleCommentAction { /** * Implementation of the < code > IAction < / code > prototype . Checks if the selected
* lines are all commented or not and uncomments / comments them respectively . */
public void run ( ) { } } | if ( fOperationTarget == null || fDocumentPartitioning == null || fPrefixesMap == null ) return ; ITextEditor editor = getTextEditor ( ) ; if ( editor == null ) return ; if ( ! validateEditorInputState ( ) ) return ; final int operationCode ; if ( isSelectionCommented ( editor . getSelectionProvider ( ) . getSelection ( ) ) ) operationCode = ITextOperationTarget . STRIP_PREFIX ; else operationCode = ITextOperationTarget . PREFIX ; Shell shell = editor . getSite ( ) . getShell ( ) ; if ( ! fOperationTarget . canDoOperation ( operationCode ) ) { if ( shell != null ) MessageDialog . openError ( shell , "ToggleComment_error_title" , "ToggleComment_error_message" ) ; return ; } Display display = null ; if ( shell != null && ! shell . isDisposed ( ) ) display = shell . getDisplay ( ) ; BusyIndicator . showWhile ( display , new Runnable ( ) { public void run ( ) { fOperationTarget . doOperation ( operationCode ) ; } } ) ; |
public class RegistriesInner { /** * Gets the properties of the specified container registry .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the RegistryInner object if successful . */
public RegistryInner getByResourceGroup ( String resourceGroupName , String registryName ) { } } | return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , registryName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class AbstractArakhneMojo { /** * Retreive the extended artifact definition of the given artifact .
* @ param mavenArtifact - the artifact to resolve
* @ return the artifact definition .
* @ throws MojoExecutionException on error . */
public final Artifact resolveArtifact ( Artifact mavenArtifact ) throws MojoExecutionException { } } | final org . eclipse . aether . artifact . Artifact aetherArtifact = createArtifact ( mavenArtifact ) ; final ArtifactRequest request = new ArtifactRequest ( ) ; request . setArtifact ( aetherArtifact ) ; request . setRepositories ( getRemoteRepositoryList ( ) ) ; final ArtifactResult result ; try { result = getRepositorySystem ( ) . resolveArtifact ( getRepositorySystemSession ( ) , request ) ; } catch ( ArtifactResolutionException e ) { throw new MojoExecutionException ( e . getMessage ( ) , e ) ; } return createArtifact ( result . getArtifact ( ) ) ; |
public class WSRdbManagedConnectionImpl { /** * Destroy an unwanted statement . This method should close the statement .
* @ param unwantedStatement a statement we don ' t want in the cache anymore . */
private void destroyStatement ( Object unwantedStatement ) { } } | try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Statement cache at capacity. Discarding a statement." , AdapterUtil . toString ( unwantedStatement ) ) ; ( ( Statement ) unwantedStatement ) . close ( ) ; } catch ( SQLException closeX ) { FFDCFilter . processException ( closeX , getClass ( ) . getName ( ) + ".discardStatement" , "511" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Error closing statement" , AdapterUtil . toString ( unwantedStatement ) , closeX ) ; } |
public class WaybackRequest { /** * extract REFERER , remote IP and authorization information from the
* HttpServletRequest
* @ param httpRequest
* @ throws BadQueryException */
public void extractHttpRequestInfo ( HttpServletRequest httpRequest ) { } } | putUnlessNull ( REQUEST_REFERER_URL , httpRequest . getHeader ( "REFERER" ) ) ; String remoteAddr = httpRequest . getHeader ( "X-Forwarded-For" ) ; remoteAddr = ( remoteAddr == null ) ? httpRequest . getRemoteAddr ( ) : remoteAddr + ", " + httpRequest . getRemoteAddr ( ) ; putUnlessNull ( REQUEST_REMOTE_ADDRESS , remoteAddr ) ; // Check for AJAX
String x_req_with = httpRequest . getHeader ( "X-Requested-With" ) ; if ( x_req_with != null ) { if ( x_req_with . equals ( "XMLHttpRequest" ) ) { this . setAjaxRequest ( true ) ; } } else if ( this . getRefererUrl ( ) != null && httpRequest . getParameter ( "ajaxpipe" ) != null ) { this . setAjaxRequest ( true ) ; } if ( isMementoEnabled ( ) ) { // Check for Memento Accept - Datetime
String acceptDateTime = httpRequest . getHeader ( MementoUtils . ACCEPT_DATETIME ) ; if ( acceptDateTime != null ) { this . setMementoAcceptDatetime ( true ) ; } } putUnlessNull ( REQUEST_WAYBACK_HOSTNAME , httpRequest . getLocalName ( ) ) ; putUnlessNull ( REQUEST_AUTH_TYPE , httpRequest . getAuthType ( ) ) ; putUnlessNull ( REQUEST_REMOTE_USER , httpRequest . getRemoteUser ( ) ) ; putUnlessNull ( REQUEST_AUTHORIZATION , httpRequest . getHeader ( REQUEST_AUTHORIZATION ) ) ; putUnlessNull ( REQUEST_WAYBACK_PORT , String . valueOf ( httpRequest . getLocalPort ( ) ) ) ; putUnlessNull ( REQUEST_WAYBACK_CONTEXT , httpRequest . getContextPath ( ) ) ; Locale l = null ; if ( accessPoint != null ) { l = accessPoint . getLocale ( ) ; } if ( l == null ) { l = httpRequest . getLocale ( ) ; } // setLocale ( l ) ;
this . locale = l ; putUnlessNull ( REQUEST_LOCALE_LANG , l . getDisplayLanguage ( ) ) ; Cookie [ ] cookies = httpRequest . getCookies ( ) ; if ( cookies != null ) { for ( Cookie cookie : cookies ) { String name = cookie . getName ( ) ; String value = cookie . getValue ( ) ; String oldVal = get ( name ) ; if ( oldVal == null || oldVal . length ( ) == 0 ) { put ( name , value ) ; } } } |
public class ShellCommandParser { /** * Parses a shell command line
* @ param line the command line
* @ return the parser result
* @ throws IntrospectionException if a { @ link de . undercouch . citeproc . tool . CSLToolCommand }
* could not be introspected
* @ throws InvalidOptionException if the command line contains an
* option ( only commands are allowed in the interactive shell ) */
public static Result parse ( String line ) throws IntrospectionException , InvalidOptionException { } } | return parse ( line , Collections . < Class < ? extends Command > > emptyList ( ) ) ; |
public class ServerSection { /** * Adds a binding address to the list . The format of a binding address is
* [ SSL / ] address [ : port ] :
* < ul >
* < li > SSL / : if present means than JNRPE must create an SSL socket
* < li > : port : is the port where JNRPE must listen to
* < / ul >
* @ param bindAddress
* The address to add */
final void addBindAddress ( final String bindAddress ) { } } | boolean ssl = bindAddress . toUpperCase ( ) . startsWith ( "SSL/" ) ; String sAddress ; if ( ssl ) { sAddress = bindAddress . substring ( "SSL/" . length ( ) ) ; } else { sAddress = bindAddress ; } addBindAddress ( sAddress , ssl ) ; |
public class CmsResourceWrapperUtils { /** * Removes the UTF - 8 marker from the beginning of the byte array . < p >
* @ param content the byte array where to remove the UTF - 8 marker
* @ return the byte with the removed UTF - 8 marker at the beginning */
public static byte [ ] removeUtf8Marker ( byte [ ] content ) { } } | if ( ( content != null ) && ( content . length >= 3 ) && ( content [ 0 ] == UTF8_MARKER [ 0 ] ) && ( content [ 1 ] == UTF8_MARKER [ 1 ] ) && ( content [ 2 ] == UTF8_MARKER [ 2 ] ) ) { byte [ ] ret = new byte [ content . length - UTF8_MARKER . length ] ; System . arraycopy ( content , 3 , ret , 0 , content . length - UTF8_MARKER . length ) ; return ret ; } return content ; |
public class Range { /** * Returns intersection range with { @ code other } range .
* @ param other other range
* @ return intersection range with { @ code other } range or null if ranges not intersects */
public Range intersection ( Range other ) { } } | if ( ! intersectsWith ( other ) ) return null ; return new Range ( Math . max ( lower , other . lower ) , Math . min ( upper , other . upper ) , reversed && other . reversed ) ; |
public class IonCharacterReader { /** * Readers a buffer ' s worth of data . This implementation
* simply leverages { @ link # read ( ) } over the buffer . */
@ Override public int read ( char [ ] cbuf , int off , int len ) throws IOException { } } | assert len >= 0 ; assert off >= 0 ; int amountRead = 0 ; final int endIndex = off + len ; for ( int index = off ; index < endIndex ; index ++ ) { int readChar = read ( ) ; if ( readChar == - 1 ) { break ; } cbuf [ index ] = ( char ) readChar ; amountRead ++ ; } return amountRead == 0 ? - 1 : amountRead ; |
public class Shell { /** * < p > Executes the given command as if it had been executed from the command line of the host OS
* ( cmd . exe on windows , / bin / sh on * nix ) and returns all content sent to standard out as a string . If the command
* finishes with a non zero return value , a { @ link CommandFailedException } is thrown . < / p >
* < p > Content sent to standard error by the command will be forwarded to standard error for this JVM . If you wish
* to capture StdErr as well , use { @ link # buildProcess ( String ) } to create a ProcessStarter and call the { @ link ProcessStarter # withStdErrHandler ( gw . util . ProcessStarter . OutputHandler ) }
* method . < / p >
* < p > This method blocks on the execution of the command . < / p >
* < b > Example Usages : < / b >
* < pre >
* var currentDir = Shell . exec ( " dir " ) / / windows
* var currentDir = Shell . exec ( " ls " ) / / * nix
* Shell . exec ( " rm - rf " + directoryToNuke )
* < / pre >
* @ param command the command to execute
* @ return the content of standard out
* @ throws CommandFailedException if the process finishes with a non - zero return value
* < p > < b > Note : < b > On windows , CMD . EXE will be used to interpret " command " so that commands like " dir " work as expected . This can
* occasionally cause problems due to limitations of CMD . EXE ( e . g . a command string may be too long for it . ) In these cases consider
* using the { @ link # buildProcess ( String ) } */
public static String exec ( String command , String cs ) { } } | return buildProcess ( command ) . withCharset ( cs ) . withCMD ( ) . exec ( ) ; |
public class DistributableShootistSipServlet { /** * ( non - Javadoc )
* @ see javax . servlet . sip . SipServletListener # servletInitialized ( javax . servlet . sip . SipServletContextEvent ) */
public void servletInitialized ( SipServletContextEvent ce ) { } } | String sendOnInit = ce . getServletContext ( ) . getInitParameter ( "send-on-init" ) ; String method = ce . getServletContext ( ) . getInitParameter ( "method" ) ; logger . info ( "Send on Init : " + sendOnInit ) ; if ( sendOnInit == null || "true" . equals ( sendOnInit ) ) { SipFactory sipFactory = ( SipFactory ) getServletContext ( ) . getAttribute ( SIP_FACTORY ) ; SipApplicationSession sipApplicationSession = sipFactory . createApplicationSession ( ) ; if ( method . equalsIgnoreCase ( "INVITE" ) ) { sendMessage ( sipFactory . createApplicationSession ( ) , method ) ; } else { timerService . createTimer ( sipApplicationSession , 10000 , 20000 , true , true , method ) ; } } |
public class MetadataClient { /** * Removes the task definition of a task type from the conductor server .
* Use with caution .
* @ param taskType Task type to be unregistered . */
public void unregisterTaskDef ( String taskType ) { } } | Preconditions . checkArgument ( StringUtils . isNotBlank ( taskType ) , "Task type cannot be blank" ) ; delete ( "metadata/taskdefs/{tasktype}" , taskType ) ; |
public class PasswordService { /** * Checks the validity of the asserted password against a ManagedUsers actual hashed password .
* @ param assertedPassword the clear text password to check
* @ param user The ManagedUser to check the password of
* @ return true if assertedPassword matches the expected password of the ManangedUser , false if not
* @ since 1.0.0 */
public static boolean matches ( final char [ ] assertedPassword , final ManagedUser user ) { } } | final char [ ] prehash = createSha512Hash ( assertedPassword ) ; // Todo : remove String when Jbcrypt supports char [ ]
return BCrypt . checkpw ( new String ( prehash ) , user . getPassword ( ) ) ; |
public class MaterialAPI { /** * 获取素材列表
* @ param access _ token access _ token
* @ param type素材的类型 , 图片 ( image ) 、 视频 ( video ) 、 语音 ( voice ) 、 图文 ( news )
* @ param offset从全部素材的该偏移位置开始返回 , 0表示从第一个素材 返回
* @ param count返回素材的数量 , 取值在1到20之间
* @ return MaterialBatchgetResult */
public static MaterialBatchgetResult batchget_material ( String access_token , String type , int offset , int count ) { } } | HttpUriRequest httpUriRequest = RequestBuilder . post ( ) . setHeader ( jsonHeader ) . setUri ( BASE_URI + "/cgi-bin/material/batchget_material" ) . addParameter ( PARAM_ACCESS_TOKEN , API . accessToken ( access_token ) ) . setEntity ( new StringEntity ( "{\"type\":\"" + type + "\",\"offset\":" + offset + ",\"count\":" + count + "}" , Charset . forName ( "utf-8" ) ) ) . build ( ) ; return LocalHttpClient . executeJsonResult ( httpUriRequest , MaterialBatchgetResult . class ) ; |
public class DBCleanService { /** * Returns database cleaner for repository .
* @ param jdbcConn
* database connection which need to use
* @ param rEntry
* repository configuration
* @ return DBCleanerTool
* @ throws DBCleanException */
public static DBCleanerTool getRepositoryDBCleaner ( Connection jdbcConn , RepositoryEntry rEntry ) throws DBCleanException { } } | SecurityHelper . validateSecurityPermission ( JCRRuntimePermissions . MANAGE_REPOSITORY_PERMISSION ) ; WorkspaceEntry wsEntry = rEntry . getWorkspaceEntries ( ) . get ( 0 ) ; boolean multiDb = getMultiDbParameter ( wsEntry ) ; if ( multiDb ) { throw new DBCleanException ( "It is not possible to create cleaner with common connection for multi database repository configuration" ) ; } String dialect = resolveDialect ( jdbcConn , wsEntry ) ; boolean autoCommit = dialect . startsWith ( DialectConstants . DB_DIALECT_SYBASE ) ; DBCleaningScripts scripts = DBCleaningScriptsFactory . prepareScripts ( dialect , rEntry ) ; return new DBCleanerTool ( jdbcConn , autoCommit , scripts . getCleaningScripts ( ) , scripts . getCommittingScripts ( ) , scripts . getRollbackingScripts ( ) ) ; |
public class UUID { /** * Generate a random uuid of the specified length , and radix . Examples :
* < ul >
* < li > uuid ( 8 , 2 ) returns " 01001010 " ( 8 character ID , base = 2)
* < li > uuid ( 8 , 10 ) returns " 47473046 " ( 8 character ID , base = 10)
* < li > uuid ( 8 , 16 ) returns " 098F4D35 " ( 8 character ID , base = 16)
* < / ul >
* @ param len
* the desired number of characters
* @ param radix
* the number of allowable values for each character ( must be < =
* 62) */
public static String uuid ( int len , int radix ) { } } | if ( radix > CHARS . length ) { throw new IllegalArgumentException ( ) ; } char [ ] uuid = new char [ len ] ; // Compact form
for ( int i = 0 ; i < len ; i ++ ) { uuid [ i ] = CHARS [ ( int ) ( Math . random ( ) * radix ) ] ; } return new String ( uuid ) ; |
public class CmsUgcSession { /** * Adds the given values to the content document . < p >
* @ param file the content file
* @ param contentValues the values to add
* @ return the content document
* @ throws CmsException if writing the XML fails */
protected CmsXmlContent addContentValues ( CmsFile file , Map < String , String > contentValues ) throws CmsException { } } | CmsXmlContent content = unmarshalXmlContent ( file ) ; Locale locale = m_cms . getRequestContext ( ) . getLocale ( ) ; addContentValues ( content , locale , contentValues ) ; return content ; |
public class HttpUploadRequest { /** * Sets the custom user agent to use for this upload request .
* Note ! If you set the " User - Agent " header by using the " addHeader " method ,
* that setting will be overwritten by the value set with this method .
* @ param customUserAgent custom user agent string
* @ return self instance */
public B setCustomUserAgent ( String customUserAgent ) { } } | if ( customUserAgent != null && ! customUserAgent . isEmpty ( ) ) { httpParams . customUserAgent = customUserAgent ; } return self ( ) ; |
public class HttpAsyncClientImpl { /** * { @ inheritDoc } */
@ Override public < T > CompletionStage < T > get ( URI uri , Map < String , String > headers , JsonParser < T > parser ) { } } | return request ( uri , headers , null , parser ) ; |
public class RecordList { /** * Lookup this record for this recordowner .
* @ param The record ' s name ( if null , return the screenrecord , if blank , return the main record ) .
* @ return The record with this name ( or null if not found ) . */
public Record getRecord ( String strFileName ) { } } | if ( strFileName == null ) return this . getScreenRecord ( ) ; if ( strFileName . length ( ) == 0 ) return this . getMainRecord ( ) ; for ( Enumeration < Rec > e = this . elements ( ) ; e . hasMoreElements ( ) ; ) { // This should only be called for Imaged GridScreens ( Child windows would be deleted by now if Component )
Record record = ( Record ) e . nextElement ( ) ; record = record . getRecord ( strFileName ) ; if ( record != null ) return record ; } return null ; // Not found |
public class NameRegistryClient { /** * Registers an ( identifier , address ) mapping .
* @ param id an identifier
* @ param addr an Internet socket address */
@ Override public void register ( final Identifier id , final InetSocketAddress addr ) throws Exception { } } | // needed to keep threads from reading the wrong response
// TODO : better fix matches replies to threads with a map after REEF - 198
synchronized ( this ) { LOG . log ( Level . FINE , "Register {0} : {1}" , new Object [ ] { id , addr } ) ; final Link < NamingMessage > link = this . transport . open ( this . serverSocketAddr , this . codec , new LoggingLinkListener < NamingMessage > ( ) ) ; link . write ( new NamingRegisterRequest ( new NameAssignmentTuple ( id , addr ) ) ) ; for ( ; ; ) { try { this . replyQueue . poll ( this . timeout , TimeUnit . MILLISECONDS ) ; break ; } catch ( final InterruptedException e ) { LOG . log ( Level . INFO , "Interrupted" , e ) ; throw new NamingException ( e ) ; } } } |
public class PhoenixReader { /** * See the notes above .
* @ param parentTask parent task . */
private void updateDates ( Task parentTask ) { } } | if ( parentTask . hasChildTasks ( ) ) { int finished = 0 ; Date plannedStartDate = parentTask . getStart ( ) ; Date plannedFinishDate = parentTask . getFinish ( ) ; Date actualStartDate = parentTask . getActualStart ( ) ; Date actualFinishDate = parentTask . getActualFinish ( ) ; Date earlyStartDate = parentTask . getEarlyStart ( ) ; Date earlyFinishDate = parentTask . getEarlyFinish ( ) ; Date lateStartDate = parentTask . getLateStart ( ) ; Date lateFinishDate = parentTask . getLateFinish ( ) ; for ( Task task : parentTask . getChildTasks ( ) ) { updateDates ( task ) ; plannedStartDate = DateHelper . min ( plannedStartDate , task . getStart ( ) ) ; plannedFinishDate = DateHelper . max ( plannedFinishDate , task . getFinish ( ) ) ; actualStartDate = DateHelper . min ( actualStartDate , task . getActualStart ( ) ) ; actualFinishDate = DateHelper . max ( actualFinishDate , task . getActualFinish ( ) ) ; earlyStartDate = DateHelper . min ( earlyStartDate , task . getEarlyStart ( ) ) ; earlyFinishDate = DateHelper . max ( earlyFinishDate , task . getEarlyFinish ( ) ) ; lateStartDate = DateHelper . min ( lateStartDate , task . getLateStart ( ) ) ; lateFinishDate = DateHelper . max ( lateFinishDate , task . getLateFinish ( ) ) ; if ( task . getActualFinish ( ) != null ) { ++ finished ; } } parentTask . setStart ( plannedStartDate ) ; parentTask . setFinish ( plannedFinishDate ) ; parentTask . setActualStart ( actualStartDate ) ; parentTask . setEarlyStart ( earlyStartDate ) ; parentTask . setEarlyFinish ( earlyFinishDate ) ; parentTask . setLateStart ( lateStartDate ) ; parentTask . setLateFinish ( lateFinishDate ) ; // Only if all child tasks have actual finish dates do we
// set the actual finish date on the parent task .
if ( finished == parentTask . getChildTasks ( ) . size ( ) ) { parentTask . setActualFinish ( actualFinishDate ) ; } Duration duration = null ; if ( plannedStartDate != null && plannedFinishDate != null ) { duration = m_projectFile . getDefaultCalendar ( ) . getWork ( plannedStartDate , plannedFinishDate , TimeUnit . DAYS ) ; parentTask . setDuration ( duration ) ; } } |
public class AbstractDLock { /** * { @ inheritDoc }
* @ since 0.1.2 */
@ Override public LockResult lock ( int waitWeight , String clientId ) { } } | return lock ( waitWeight , clientId , DEFAULT_LOCK_DURATION_MS ) ; |
public class TieredBlockStore { /** * Moves a block to new location only if allocator finds available space in newLocation . This
* method will not trigger any eviction . Returns { @ link MoveBlockResult } .
* @ param sessionId session id
* @ param blockId block id
* @ param oldLocation the source location of the block
* @ param newLocation new location to move this block
* @ return the resulting information about the move operation
* @ throws BlockDoesNotExistException if block is not found
* @ throws BlockAlreadyExistsException if a block with same id already exists in new location
* @ throws InvalidWorkerStateException if the block to move is a temp block */
private MoveBlockResult moveBlockInternal ( long sessionId , long blockId , BlockStoreLocation oldLocation , BlockStoreLocation newLocation ) throws BlockDoesNotExistException , BlockAlreadyExistsException , InvalidWorkerStateException , IOException { } } | long lockId = mLockManager . lockBlock ( sessionId , blockId , BlockLockType . WRITE ) ; try { long blockSize ; String srcFilePath ; String dstFilePath ; BlockMeta srcBlockMeta ; BlockStoreLocation srcLocation ; BlockStoreLocation dstLocation ; try ( LockResource r = new LockResource ( mMetadataReadLock ) ) { if ( mMetaManager . hasTempBlockMeta ( blockId ) ) { throw new InvalidWorkerStateException ( ExceptionMessage . MOVE_UNCOMMITTED_BLOCK , blockId ) ; } srcBlockMeta = mMetaManager . getBlockMeta ( blockId ) ; srcLocation = srcBlockMeta . getBlockLocation ( ) ; srcFilePath = srcBlockMeta . getPath ( ) ; blockSize = srcBlockMeta . getBlockSize ( ) ; } if ( ! srcLocation . belongsTo ( oldLocation ) ) { throw new BlockDoesNotExistException ( ExceptionMessage . BLOCK_NOT_FOUND_AT_LOCATION , blockId , oldLocation ) ; } TempBlockMeta dstTempBlock = createBlockMetaInternal ( sessionId , blockId , newLocation , blockSize , false ) ; if ( dstTempBlock == null ) { return new MoveBlockResult ( false , blockSize , null , null ) ; } // When ` newLocation ` is some specific location , the ` newLocation ` and the ` dstLocation ` are
// just the same ; while for ` newLocation ` with a wildcard significance , the ` dstLocation `
// is a specific one with specific tier and dir which belongs to newLocation .
dstLocation = dstTempBlock . getBlockLocation ( ) ; // When the dstLocation belongs to srcLocation , simply abort the tempBlockMeta just created
// internally from the newLocation and return success with specific block location .
if ( dstLocation . belongsTo ( srcLocation ) ) { mMetaManager . abortTempBlockMeta ( dstTempBlock ) ; return new MoveBlockResult ( true , blockSize , srcLocation , dstLocation ) ; } dstFilePath = dstTempBlock . getCommitPath ( ) ; // Heavy IO is guarded by block lock but not metadata lock . This may throw IOException .
FileUtils . move ( srcFilePath , dstFilePath ) ; try ( LockResource r = new LockResource ( mMetadataWriteLock ) ) { // If this metadata update fails , we panic for now .
// TODO ( bin ) : Implement rollback scheme to recover from IO failures .
mMetaManager . moveBlockMeta ( srcBlockMeta , dstTempBlock ) ; } catch ( BlockAlreadyExistsException | BlockDoesNotExistException | WorkerOutOfSpaceException e ) { // WorkerOutOfSpaceException is only possible if session id gets cleaned between
// createBlockMetaInternal and moveBlockMeta .
throw Throwables . propagate ( e ) ; // we shall never reach here
} return new MoveBlockResult ( true , blockSize , srcLocation , dstLocation ) ; } finally { mLockManager . unlockBlock ( lockId ) ; } |
public class Curve25519 { /** * / * A = P + Q where
* X ( A ) = ax / az
* X ( P ) = ( t1 + t2 ) / ( t1 - t2)
* X ( Q ) = ( t3 + t4 ) / ( t3 - t4)
* X ( P - Q ) = dx
* clobbers t1 and t2 , preserves t3 and t4 */
private static final void mont_add ( long10 t1 , long10 t2 , long10 t3 , long10 t4 , long10 ax , long10 az , long10 dx ) { } } | mul ( ax , t2 , t3 ) ; mul ( az , t1 , t4 ) ; add ( t1 , ax , az ) ; sub ( t2 , ax , az ) ; sqr ( ax , t1 ) ; sqr ( t1 , t2 ) ; mul ( az , t1 , dx ) ; |
public class LongStreamEx { /** * Returns the maximum element of this stream according to the provided
* { @ code Comparator } .
* This is a terminal operation .
* @ param comparator a non - interfering , stateless { @ link Comparator } to
* compare elements of this stream
* @ return an { @ code OptionalLong } describing the maximum element of this
* stream , or an empty { @ code OptionalLong } if the stream is empty */
public OptionalLong max ( Comparator < Long > comparator ) { } } | return reduce ( ( a , b ) -> comparator . compare ( a , b ) >= 0 ? a : b ) ; |
public class Roster { /** * Returns the roster for the user .
* This method will never return < code > null < / code > , instead if the user has not yet logged into
* the server all modifying methods of the returned roster object
* like { @ link Roster # createEntry ( BareJid , String , String [ ] ) } ,
* { @ link Roster # removeEntry ( RosterEntry ) } , etc . except adding or removing
* { @ link RosterListener } s will throw an IllegalStateException .
* @ param connection the connection the roster should be retrieved for .
* @ return the user ' s roster . */
public static synchronized Roster getInstanceFor ( XMPPConnection connection ) { } } | Roster roster = INSTANCES . get ( connection ) ; if ( roster == null ) { roster = new Roster ( connection ) ; INSTANCES . put ( connection , roster ) ; } return roster ; |
public class VirtualHostMapper { /** * ( non - Javadoc )
* @ see com . ibm . ws . webcontainer . core . RequestMapper # exists ( java . lang . String ) */
public boolean exists ( String path ) { } } | Iterator i = vHostTable . keySet ( ) . iterator ( ) ; while ( i . hasNext ( ) ) { try { String pattern = ( String ) i . next ( ) ; // System . out . println ( " Pattern = " + pattern ) ;
if ( path . matches ( pattern ) ) return true ; } catch ( Exception e ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Caught an exception in exists():" , e ) ; } return false ; } } return false ; |
public class TableFactor { /** * Gets a { @ code TableFactor } over { @ code vars } which assigns weight 1 to all
* assignments . The weights are represented in log space .
* @ param vars
* @ return */
public static TableFactor logUnity ( VariableNumMap vars ) { } } | TableFactorBuilder builder = new TableFactorBuilder ( vars , SparseTensorBuilder . getFactory ( ) ) ; return builder . buildSparseInLogSpace ( ) ; |
public class CommerceCountryPersistenceImpl { /** * Caches the commerce country in the entity cache if it is enabled .
* @ param commerceCountry the commerce country */
@ Override public void cacheResult ( CommerceCountry commerceCountry ) { } } | entityCache . putResult ( CommerceCountryModelImpl . ENTITY_CACHE_ENABLED , CommerceCountryImpl . class , commerceCountry . getPrimaryKey ( ) , commerceCountry ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_UUID_G , new Object [ ] { commerceCountry . getUuid ( ) , commerceCountry . getGroupId ( ) } , commerceCountry ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_G_TW , new Object [ ] { commerceCountry . getGroupId ( ) , commerceCountry . getTwoLettersISOCode ( ) } , commerceCountry ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_G_N , new Object [ ] { commerceCountry . getGroupId ( ) , commerceCountry . getNumericISOCode ( ) } , commerceCountry ) ; commerceCountry . resetOriginalValues ( ) ; |
public class ThingAttribute { /** * A list of thing attributes which are name - value pairs .
* @ param attributes
* A list of thing attributes which are name - value pairs .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ThingAttribute withAttributes ( java . util . Map < String , String > attributes ) { } } | setAttributes ( attributes ) ; return this ; |
public class DistributerMap { /** * Sets local directory for base of mapping .
* @ param value
* value */
public void setLocal ( final File value ) { } } | if ( value == null ) { throw new NullPointerException ( "value" ) ; } if ( value . exists ( ) && ! value . isDirectory ( ) ) { throw new BuildException ( "local should be a directory" ) ; } this . localName = value ; try { this . canonicalPath = this . localName . getCanonicalPath ( ) ; } catch ( final IOException ex ) { throw new BuildException ( ex ) ; } |
public class ErrorOutputStream { /** * Enables colored output
* @ return true if the colored output was already enabled before
* @ throws IOException if writing to the underlying output stream failed */
private boolean enableRed ( ) throws IOException { } } | boolean oldwriting = writing ; if ( ! writing ) { writing = true ; byte [ ] en = "\u001B[31m" . getBytes ( ) ; super . write ( en , 0 , en . length ) ; } return oldwriting ; |
public class Solve { /** * Solves the linear equation A * X = B . */
public static FloatMatrix solve ( FloatMatrix A , FloatMatrix B ) { } } | A . assertSquare ( ) ; FloatMatrix X = B . dup ( ) ; int [ ] ipiv = new int [ B . rows ] ; SimpleBlas . gesv ( A . dup ( ) , ipiv , X ) ; return X ; |
public class StringUtil { /** * check if the specified string it Latin numeric
* @ param str
* @ param beginIndex
* @ param endIndex
* @ return boolean */
public static boolean isNumeric ( String str , int beginIndex , int endIndex ) { } } | for ( int i = beginIndex ; i < endIndex ; i ++ ) { char chr = str . charAt ( i ) ; if ( ! StringUtil . isEnNumeric ( chr ) ) { return false ; } } return true ; |
public class MethodUtils { /** * Returns the methods declared by clazz which matches the supplied
* method filter .
* @ param clazz
* The class to inspect
* @ param methodFilter
* The method filter to apply .
* @ return methods that match which matches the supplied
* method filter . */
public static Set < Method > getDeclaredMethods ( Class < ? > clazz , MethodFilter methodFilter ) { } } | Method [ ] methods = clazz . getDeclaredMethods ( ) ; Set < Method > matches = new HashSet < Method > ( ) ; for ( Method method : methods ) { if ( methodFilter . passFilter ( method ) ) { matches . add ( method ) ; } } return matches ; |
public class RegisteredResources { /** * Attempts to add a one - Phase XA Resource to this unit of work .
* @ param xaRes The XAResource to add to this unit of work
* @ return true if the resource was added , false if not .
* @ throws RollbackException if enlistment fails
* @ throws SystemException if unexpected error occurs */
public boolean enlistResource ( XAResource xaRes ) throws RollbackException , SystemException , IllegalStateException { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "enlistResource" , xaRes ) ; // Determine if we are attempting to enlist a second resource within a transaction
// that can ' t support 2PC anyway .
if ( _disableTwoPhase && ( _resourceObjects . size ( ) > 0 ) ) { final String msg = "Unable to enlist a second resource within the transaction. Two phase support is disabled " + "as the recovery log was not available at transaction start" ; final IllegalStateException ise = new IllegalStateException ( msg ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "enlistResource (SPI)" , ise ) ; throw ise ; } // Create the resource wrapper and see if it already exists in the table
OnePhaseResourceImpl jtaRes = new OnePhaseResourceImpl ( ( OnePhaseXAResource ) xaRes , _txServiceXid ) ; boolean register = true ; // See if any other resource has been enlisted
// Allow 1PC and 2PC to be enlisted , it will be rejected at prepare time if LPS is not enabled
// Reject multiple 1PC enlistments
if ( _onePhaseResourceEnlisted != null ) { if ( _onePhaseResourceEnlisted . equals ( jtaRes ) ) { register = false ; jtaRes = _onePhaseResourceEnlisted ; } else { Tr . error ( tc , "WTRN0062_ILLEGAL_ENLIST_FOR_MULTIPLE_1PC_RESOURCES" ) ; final String msg = "Illegal attempt to enlist multiple 1PC XAResources" ; final IllegalStateException ise = new IllegalStateException ( msg ) ; // FFDC in TransactionImpl
if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "enlistResource (SPI)" , ise ) ; throw ise ; } } // start association of Resource object and register if first time with JTA
// and record that a 1PC resource has now been registered with the transaction .
try { this . startRes ( jtaRes ) ; if ( register ) { jtaRes . setResourceStatus ( StatefulResource . REGISTERED ) ; // This is 1PC then we need to insert at element 0
// of the list so we can ensure it is processed last
// at completion time .
_resourceObjects . add ( 0 , jtaRes ) ; // Check and update LPS enablement state for the application - LIDB1673.22
checkLPSEnablement ( ) ; if ( tc . isEventEnabled ( ) ) Tr . event ( tc , "(SPI) RESOURCE registered with Transaction. TX: " + _transaction . getLocalTID ( ) + ", Resource: " + jtaRes ) ; _onePhaseResourceEnlisted = jtaRes ; } } catch ( RollbackException rbe ) { FFDCFilter . processException ( rbe , "com.ibm.tx.jta.impl.RegisteredResources.enlistResource" , "480" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "enlistResource" , rbe ) ; throw rbe ; } catch ( SystemException se ) { FFDCFilter . processException ( se , "com.ibm.tx.jta.impl.RegisteredResources.enlistResource" , "487" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "enlistResource" , se ) ; throw se ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "enlistResource" , Boolean . TRUE ) ; return true ; |
public class TransactionScope { /** * Exits all transactions and closes all cursors . Should be called only
* when repository is closed . */
void close ( ) throws RepositoryException { } } | mLock . lock ( ) ; if ( mClosed ) { mLock . unlock ( ) ; return ; } Map < Class < ? > , CursorList < TransactionImpl < Txn > > > cursors ; try { cursors = mCursors ; // Ensure that map is freed promptly . Thread - local reference to
// this scope otherwise keeps map and its contents lingering around
// for a very long time .
mCursors = null ; while ( mActive != null ) { mActive . exit ( ) ; } } finally { // Swap TransactionManager out with a dummy one , to allow the
// original one to get freed .
mTxnMgr = ( TransactionManager < Txn > ) TransactionManager . Closed . THE ; mClosed = true ; mLock . unlock ( ) ; } // Close cursors without lock held , to prevent deadlock . Cursor close
// operation might acquire its own lock , which in turn acquires a lock
// on this scope .
if ( cursors != null ) { for ( CursorList < TransactionImpl < Txn > > cursorList : cursors . values ( ) ) { cursorList . closeCursors ( ) ; } } |
public class ServiceManagerResourceRestServiceImpl { /** * N . B . no { @ link Transactional } annotation because the inner service does transaction management
* @ param templateName
* @ param parameters
* @ return */
@ Override public ResourceInstanceDTO provision ( final String templateName , final ProvisionResourceParametersDTO parameters ) { } } | final Map < String , String > metadata = ResourceKVP . toMap ( parameters . metadata ) ; ResourceInstanceEntity entity = service . newInstance ( templateName , metadata ) ; return getInstanceById ( entity . getId ( ) ) ; |
public class ns { /** * Use this operation to reboot NetScaler Instance . */
public static ns reboot ( nitro_service client , ns resource ) throws Exception { } } | return ( ( ns [ ] ) resource . perform_operation ( client , "reboot" ) ) [ 0 ] ; |
public class ByteAmount { /** * Creates a ByteAmount value in gigabytes . If the gigabytes value
* is & gt ; = Long . MAX _ VALUE / 1024 / 1024 / 1024,
* the byte representation is capped at Long . MAX _ VALUE .
* @ param gigabytes value in gigabytes to represent
* @ return a ByteAmount object repressing the number of GBs passed */
public static ByteAmount fromGigabytes ( long gigabytes ) { } } | if ( gigabytes >= MAX_GB ) { return new ByteAmount ( Long . MAX_VALUE ) ; } else { return new ByteAmount ( gigabytes * GB ) ; } |
public class JSSEProviderFactory { private static String getProviderFromProviderList ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getProviderFromProviderList" ) ; Provider [ ] providerList = Security . getProviders ( ) ; for ( int i = 0 ; i < providerList . length ; i ++ ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Provider name [" + i + "]: " + providerList [ i ] . getName ( ) ) ; if ( providerList [ i ] . getName ( ) . equalsIgnoreCase ( Constants . IBMJSSE2_NAME ) ) { providerFromProviderList = Constants . IBMJSSE2_NAME ; break ; } else if ( providerList [ i ] . getName ( ) . equalsIgnoreCase ( Constants . IBMJSSE_NAME ) ) { providerFromProviderList = Constants . IBMJSSE_NAME ; break ; } else if ( providerList [ i ] . getName ( ) . equalsIgnoreCase ( Constants . SUNJSSE_NAME ) ) { providerFromProviderList = Constants . SUNJSSE_NAME ; break ; } } if ( providerFromProviderList == null ) { providerFromProviderList = Constants . IBMJSSE2_NAME ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getProviderFromProviderList -> " + providerFromProviderList ) ; return providerFromProviderList ; |
public class DTMChildIterNodeList { /** * Returns the < code > index < / code > th item in the collection . If
* < code > index < / code > is greater than or equal to the number of nodes in
* the list , this returns < code > null < / code > .
* @ param index Index into the collection .
* @ return The node at the < code > index < / code > th position in the
* < code > NodeList < / code > , or < code > null < / code > if that is not a valid
* index . */
public Node item ( int index ) { } } | int handle = m_firstChild ; while ( -- index >= 0 && handle != DTM . NULL ) { handle = m_parentDTM . getNextSibling ( handle ) ; } if ( handle == DTM . NULL ) { return null ; } return m_parentDTM . getNode ( handle ) ; |
public class ScalpelFrameLayout { /** * Set the view border chrome shadow color . */
public void setChromeShadowColor ( int color ) { } } | if ( chromeShadowColor != color ) { viewBorderPaint . setShadowLayer ( 1 , - 1 , 1 , color ) ; chromeShadowColor = color ; invalidate ( ) ; } |
public class FileSystem { /** * For a path of N components , return a list of paths that match the
* components [ < code > level < / code > , < code > N - 1 < / code > ] . */
private Path [ ] globPathsLevel ( Path [ ] parents , String [ ] filePattern , int level , boolean [ ] hasGlob ) throws IOException { } } | if ( level == filePattern . length - 1 ) return parents ; if ( parents == null || parents . length == 0 ) { return null ; } GlobFilter fp = new GlobFilter ( filePattern [ level ] ) ; if ( fp . hasPattern ( ) ) { parents = FileUtil . stat2Paths ( listStatus ( parents , fp ) ) ; hasGlob [ 0 ] = true ; } else { for ( int i = 0 ; i < parents . length ; i ++ ) { parents [ i ] = new Path ( parents [ i ] , filePattern [ level ] ) ; } } return globPathsLevel ( parents , filePattern , level + 1 , hasGlob ) ; |
public class VFS { /** * Mount a filesystem on a mount point in the VFS . The mount point is any valid file name , existent or non - existent .
* If a relative path is given , it will be treated as relative to the VFS root .
* @ param mountPoint the mount point
* @ param fileSystem the file system to mount
* @ return a handle which can be used to unmount the filesystem
* @ throws IOException if an I / O error occurs , such as a filesystem already being mounted at the given mount point */
public static Closeable mount ( VirtualFile mountPoint , FileSystem fileSystem ) throws IOException { } } | final VirtualFile parent = mountPoint . getParent ( ) ; if ( parent == null ) { throw VFSMessages . MESSAGES . rootFileSystemAlreadyMounted ( ) ; } final String name = mountPoint . getName ( ) ; final Mount mount = new Mount ( fileSystem , mountPoint ) ; final ConcurrentMap < VirtualFile , Map < String , Mount > > mounts = VFS . mounts ; for ( ; ; ) { Map < String , Mount > childMountMap = mounts . get ( parent ) ; Map < String , Mount > newMap ; if ( childMountMap == null ) { childMountMap = mounts . putIfAbsent ( parent , Collections . singletonMap ( name , mount ) ) ; if ( childMountMap == null ) { return mount ; } } newMap = new HashMap < String , Mount > ( childMountMap ) ; if ( newMap . put ( name , mount ) != null ) { throw VFSMessages . MESSAGES . fileSystemAlreadyMountedAtMountPoint ( mountPoint ) ; } if ( mounts . replace ( parent , childMountMap , newMap ) ) { VFSLogger . ROOT_LOGGER . tracef ( "Mounted filesystem %s on mount point %s" , fileSystem , mountPoint ) ; return mount ; } } |
public class TypeSignature { /** * Parse a type signature .
* @ param typeDescriptor
* The type descriptor or type signature to parse .
* @ param definingClass
* The class containing the type descriptor .
* @ return The parsed type descriptor or type signature .
* @ throws ParseException
* If the type signature could not be parsed . */
static TypeSignature parse ( final String typeDescriptor , final String definingClass ) throws ParseException { } } | final Parser parser = new Parser ( typeDescriptor ) ; TypeSignature typeSignature ; typeSignature = parse ( parser , definingClass ) ; if ( typeSignature == null ) { throw new ParseException ( parser , "Could not parse type signature" ) ; } if ( parser . hasMore ( ) ) { throw new ParseException ( parser , "Extra characters at end of type descriptor" ) ; } return typeSignature ; |
public class GeoTargetTypeSetting { /** * Gets the positiveGeoTargetType value for this GeoTargetTypeSetting .
* @ return positiveGeoTargetType * The setting used for positive geotargeting in this particular
* campaign .
* < p > Again , the campaign can be positively targeted
* using solely LOP , solely
* AOI , or either . Positive targeting triggers ads
* < i > only < / i > for users
* whose location is related to the given locations .
* < p > The default value is DONT _ CARE . */
public com . google . api . ads . adwords . axis . v201809 . cm . GeoTargetTypeSettingPositiveGeoTargetType getPositiveGeoTargetType ( ) { } } | return positiveGeoTargetType ; |
public class ParamFactory { protected < T , C extends Collection < T > > ParamListValidator < T , C > getListValidator ( ParamValidator < T > validator ) { } } | if ( validator == null ) { return null ; } return new ParamListValidator < T , C > ( validator ) ; |
public class Timer { /** * Stop the timer and record the times that have passed since its start . The
* times that have passed are added to the internal state and can be
* retrieved with { @ link # getTotalCpuTime ( ) } etc .
* If CPU times are recorded , then the method returns the CPU time that has
* passed since the timer was last started ; otherwise - 1 is returned .
* @ return CPU time that the timer was running , or - 1 if timer not running
* or CPU time unavailable for other reasons */
public synchronized long stop ( ) { } } | long totalTime = - 1 ; if ( ( todoFlags & RECORD_CPUTIME ) != 0 && ( currentStartCpuTime != - 1 ) ) { long cpuTime = getThreadCpuTime ( threadId ) ; if ( cpuTime != - 1 ) { // may fail if thread already dead
totalTime = cpuTime - currentStartCpuTime ; totalCpuTime += totalTime ; } } if ( ( todoFlags & RECORD_WALLTIME ) != 0 && ( currentStartWallTime != - 1 ) ) { long wallTime = System . nanoTime ( ) ; totalWallTime += wallTime - currentStartWallTime ; } if ( isRunning ) { measurements += 1 ; isRunning = false ; } currentStartWallTime = - 1 ; currentStartCpuTime = - 1 ; return totalTime ; |
public class CmsSecurityManager { /** * Checks if the project in the given database context is not the " Online " project ,
* and throws an Exception if this is the case . < p >
* This is used to ensure a user is in an " Offline " project
* before write access to VFS resources is granted . < p >
* @ param dbc the current OpenCms users database context
* @ throws CmsVfsException if the project in the given database context is the " Online " project */
public void checkOfflineProject ( CmsDbContext dbc ) throws CmsVfsException { } } | if ( dbc . currentProject ( ) . isOnlineProject ( ) ) { throw new CmsVfsException ( org . opencms . file . Messages . get ( ) . container ( org . opencms . file . Messages . ERR_NOT_ALLOWED_IN_ONLINE_PROJECT_0 ) ) ; } |
public class JsonLdProcessor { /** * Converts an RDF dataset to JSON - LD .
* @ param dataset
* a serialized string of RDF in a format specified by the format
* option or an RDF dataset to convert .
* @ param options
* the options to use : [ format ] the format if input is not an
* array : ' application / nquads ' for N - Quads ( default ) .
* [ useRdfType ] true to use rdf : type , false to use @ type
* ( default : false ) . [ useNativeTypes ] true to convert XSD types
* into native types ( boolean , integer , double ) , false not to
* ( default : true ) .
* @ return A JSON - LD object .
* @ throws JsonLdError
* If there is an error converting the dataset to JSON - LD . */
public static Object fromRDF ( Object dataset , JsonLdOptions options ) throws JsonLdError { } } | // handle non specified serializer case
RDFParser parser = null ; if ( options . format == null && dataset instanceof String ) { // attempt to parse the input as nquads
options . format = JsonLdConsts . APPLICATION_NQUADS ; } if ( rdfParsers . containsKey ( options . format ) ) { parser = rdfParsers . get ( options . format ) ; } else { throw new JsonLdError ( JsonLdError . Error . UNKNOWN_FORMAT , options . format ) ; } // convert from RDF
return fromRDF ( dataset , options , parser ) ; |
public class Artwork { /** * Serializes this artwork object to a { @ link ContentValues } representation .
* @ return a { @ link ContentValues } appropriate to insert into
* { @ link com . google . android . apps . muzei . api . MuzeiContract . Artwork # CONTENT _ URI } . */
@ NonNull public ContentValues toContentValues ( ) { } } | ContentValues values = new ContentValues ( ) ; values . put ( MuzeiContract . Artwork . COLUMN_NAME_SOURCE_COMPONENT_NAME , ( mComponentName != null ) ? mComponentName . flattenToShortString ( ) : null ) ; values . put ( MuzeiContract . Artwork . COLUMN_NAME_IMAGE_URI , ( mImageUri != null ) ? mImageUri . toString ( ) : null ) ; values . put ( MuzeiContract . Artwork . COLUMN_NAME_TITLE , mTitle ) ; values . put ( MuzeiContract . Artwork . COLUMN_NAME_BYLINE , mByline ) ; values . put ( MuzeiContract . Artwork . COLUMN_NAME_ATTRIBUTION , mAttribution ) ; values . put ( MuzeiContract . Artwork . COLUMN_NAME_TOKEN , mToken ) ; values . put ( MuzeiContract . Artwork . COLUMN_NAME_VIEW_INTENT , ( mViewIntent != null ) ? mViewIntent . toUri ( Intent . URI_INTENT_SCHEME ) : null ) ; values . put ( MuzeiContract . Artwork . COLUMN_NAME_META_FONT , mMetaFont ) ; values . put ( MuzeiContract . Artwork . COLUMN_NAME_DATE_ADDED , mDateAdded != null ? mDateAdded . getTime ( ) : 0 ) ; return values ; |
public class FulltextMatch { /** * Sets the matching patterns .
* @ param patterns
* the matching patterns */
public FulltextMatch setPatterns ( final Collection < String > patterns ) { } } | if ( patterns == null || patterns . size ( ) == 0 ) { clearPatterns ( ) ; return this ; } synchronized ( patterns ) { for ( String pattern : patterns ) { if ( pattern == null || pattern . length ( ) == 0 ) { throw new IllegalArgumentException ( "null element" ) ; } } clearPatterns ( ) ; for ( String pattern : patterns ) { addPattern ( pattern ) ; } } return this ; |
public class StaxParser { /** * parse XML stream :
* @ param xmlReader - java . io . Reader = input file
* @ exception XMLStreamException javax . xml . stream . XMLStreamException */
public void parse ( Reader xmlReader ) throws XMLStreamException { } } | if ( isoControlCharsAwareParser ) { throw new XMLStreamException ( "Method call not supported when isoControlCharsAwareParser=true" ) ; } parse ( inf . rootElementCursor ( xmlReader ) ) ; |
public class JsHdrsImpl { /** * Clear all of the Exception fields from the message header .
* Javadoc description supplied by SIBusMessage interface . */
public void clearExceptionData ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "clearExceptionData" ) ; getHdr2 ( ) . setChoiceField ( JsHdr2Access . EXCEPTION , JsHdr2Access . IS_EXCEPTION_EMPTY ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "clearExceptionData" ) ; |
public class GenericConverter { /** * Reads the content of the converter file
* @ param filename The file
* @ throws ConverterException */
public void readFile ( String filename ) throws ConverterException { } } | try { content = "" ; final InputStream input = ResourceManager . getInputStream ( filename ) ; while ( input . available ( ) > 0 ) { content = content + ( char ) input . read ( ) ; } input . close ( ) ; } catch ( Exception e ) { throw new ConverterException ( e ) ; } |
public class DefaultElementProducer { /** * Creates and styles a cell with data in it . If the data is an instance of Element it is added as is to the cell ,
* otherwise a { @ link # createPhrase ( java . lang . Object , java . util . Collection ) phrase } is created from the data .
* @ param data
* @ param stylers
* @ return
* @ throws VectorPrintException */
public PdfPCell createCell ( Object data , Collection < ? extends BaseStyler > stylers ) throws VectorPrintException { } } | DebuggablePdfPCell cell ; /* * only when creating an instance of PdfPCell with its content ( Phrase / Image / Chunk ) in the constructor
* alignment will work ! */
if ( null != data ) { if ( data instanceof Phrase ) { cell = new DebuggablePdfPCell ( ( Phrase ) data ) ; } else if ( data instanceof Chunk ) { cell = new DebuggablePdfPCell ( new Phrase ( ( Chunk ) data ) ) ; } else if ( data instanceof Image ) { cell = new DebuggablePdfPCell ( ( Image ) data ) ; } else if ( data instanceof Element ) { if ( data instanceof PdfPTable ) { cell = new DebuggablePdfPCell ( ( PdfPTable ) data ) ; } else { throw new VectorPrintException ( String . format ( "%s not supported for a cell" , data . getClass ( ) . getName ( ) ) ) ; } } else { cell = new DebuggablePdfPCell ( createPhrase ( data , stylers ) ) ; } } else { cell = new DebuggablePdfPCell ( ) ; } StylerFactoryHelper . SETTINGS_ANNOTATION_PROCESSOR . initSettings ( cell , settings ) ; return styleHelper . style ( cell , data , stylers ) ; |
public class CClassNode { /** * add _ ctype _ to _ cc */
public void addCType ( int ctype , boolean not , boolean asciiRange , ScanEnvironment env , IntHolder sbOut ) { } } | Encoding enc = env . enc ; int [ ] ranges = enc . ctypeCodeRange ( ctype , sbOut ) ; if ( ranges != null ) { if ( asciiRange ) { CClassNode ccWork = new CClassNode ( ) ; ccWork . addCTypeByRange ( ctype , not , env , sbOut . value , ranges ) ; if ( not ) { ccWork . addCodeRangeToBuf ( env , 0x80 , CodeRangeBuffer . LAST_CODE_POINT , false ) ; } else { CClassNode ccAscii = new CClassNode ( ) ; if ( enc . minLength ( ) > 1 ) { ccAscii . addCodeRangeToBuf ( env , 0x00 , 0x7F ) ; } else { ccAscii . bs . setRange ( env , 0x00 , 0x7F ) ; } ccWork . and ( ccAscii , env ) ; } or ( ccWork , env ) ; } else { addCTypeByRange ( ctype , not , env , sbOut . value , ranges ) ; } return ; } int maxCode = asciiRange ? 0x80 : BitSet . SINGLE_BYTE_SIZE ; switch ( ctype ) { case CharacterType . ALPHA : case CharacterType . BLANK : case CharacterType . CNTRL : case CharacterType . DIGIT : case CharacterType . LOWER : case CharacterType . PUNCT : case CharacterType . SPACE : case CharacterType . UPPER : case CharacterType . XDIGIT : case CharacterType . ASCII : case CharacterType . ALNUM : if ( not ) { for ( int c = 0 ; c < BitSet . SINGLE_BYTE_SIZE ; c ++ ) { if ( ! enc . isCodeCType ( c , ctype ) ) bs . set ( env , c ) ; } addAllMultiByteRange ( env ) ; } else { for ( int c = 0 ; c < BitSet . SINGLE_BYTE_SIZE ; c ++ ) { if ( enc . isCodeCType ( c , ctype ) ) bs . set ( env , c ) ; } } break ; case CharacterType . GRAPH : case CharacterType . PRINT : if ( not ) { for ( int c = 0 ; c < BitSet . SINGLE_BYTE_SIZE ; c ++ ) { if ( ! enc . isCodeCType ( c , ctype ) || c >= maxCode ) bs . set ( env , c ) ; } if ( asciiRange ) addAllMultiByteRange ( env ) ; } else { for ( int c = 0 ; c < maxCode ; c ++ ) { if ( enc . isCodeCType ( c , ctype ) ) bs . set ( env , c ) ; } if ( ! asciiRange ) addAllMultiByteRange ( env ) ; } break ; case CharacterType . WORD : if ( ! not ) { for ( int c = 0 ; c < maxCode ; c ++ ) { if ( enc . isSbWord ( c ) ) bs . set ( env , c ) ; } if ( ! asciiRange ) addAllMultiByteRange ( env ) ; } else { for ( int c = 0 ; c < BitSet . SINGLE_BYTE_SIZE ; c ++ ) { if ( enc . codeToMbcLength ( c ) > 0 && /* check invalid code point */
! ( enc . isWord ( c ) || c >= maxCode ) ) bs . set ( env , c ) ; } if ( asciiRange ) addAllMultiByteRange ( env ) ; } break ; default : throw new InternalException ( ErrorMessages . PARSER_BUG ) ; } // switch |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.