signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Math { /** * Minimize a function along a search direction by find a step which satisfies
* a sufficient decrease condition and a curvature condition .
* At each stage this function updates an interval of uncertainty with
* endpoints < code > stx < / code > and < code > sty < / code > . The interval of
* uncertainty is initially chosen so that it contains a
* minimizer of the modified function
* < pre >
* f ( x + stp * s ) - f ( x ) - ftol * stp * ( gradf ( x ) ' s ) .
* < / pre >
* If a step is obtained for which the modified function
* has a nonpositive function value and nonnegative derivative ,
* then the interval of uncertainty is chosen so that it
* contains a minimizer of < code > f ( x + stp * s ) < / code > .
* The algorithm is designed to find a step which satisfies
* the sufficient decrease condition
* < pre >
* f ( x + stp * s ) & lt ; = f ( X ) + ftol * stp * ( gradf ( x ) ' s ) ,
* < / pre >
* and the curvature condition
* < pre >
* abs ( gradf ( x + stp * s ) ' s ) ) & lt ; = gtol * abs ( gradf ( x ) ' s ) .
* < / pre >
* If < code > ftol < / code > is less than < code > gtol < / code > and if , for example ,
* the function is bounded below , then there is always a step which
* satisfies both conditions . If no step can be found which satisfies both
* conditions , then the algorithm usually stops when rounding
* errors prevent further progress . In this case < code > stp < / code > only
* satisfies the sufficient decrease condition .
* @ param xold on input this contains the base point for the line search .
* @ param fold on input this contains the value of the objective function
* at < code > x < / code > .
* @ param g on input this contains the gradient of the objective function
* at < code > x < / code > .
* @ param p the search direction .
* @ param x on output , it contains < code > xold + alam * p < / code > .
* @ param stpmax specify upper bound for the step in the line search so that
* we do not try to evaluate the function in regions where it is
* undefined or subject to overflow .
* @ return the new function value . */
static double linesearch ( MultivariateFunction func , double [ ] xold , double fold , double [ ] g , double [ ] p , double [ ] x , double stpmax ) { } } | if ( stpmax <= 0 ) { throw new IllegalArgumentException ( "Invalid upper bound of linear search step: " + stpmax ) ; } // Termination occurs when the relative width of the interval
// of uncertainty is at most xtol .
final double xtol = EPSILON ; // Tolerance for the sufficient decrease condition .
final double ftol = 1.0E-4 ; int n = xold . length ; // Scale if attempted step is too big
double pnorm = norm ( p ) ; if ( pnorm > stpmax ) { double r = stpmax / pnorm ; for ( int i = 0 ; i < n ; i ++ ) { p [ i ] *= r ; } } // Check if s is a descent direction .
double slope = 0.0 ; for ( int i = 0 ; i < n ; i ++ ) { slope += g [ i ] * p [ i ] ; } if ( slope >= 0 ) { throw new IllegalArgumentException ( "Line Search: the search direction is not a descent direction, which may be caused by roundoff problem." ) ; } // Calculate minimum step .
double test = 0.0 ; for ( int i = 0 ; i < n ; i ++ ) { double temp = abs ( p [ i ] ) / max ( xold [ i ] , 1.0 ) ; if ( temp > test ) { test = temp ; } } double alammin = xtol / test ; double alam = 1.0 ; double alam2 = 0.0 , f2 = 0.0 ; double a , b , disc , rhs1 , rhs2 , tmpalam ; while ( true ) { // Evaluate the function and gradient at stp
// and compute the directional derivative .
for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = xold [ i ] + alam * p [ i ] ; } double f = func . f ( x ) ; // Convergence on & Delta ; x .
if ( alam < alammin ) { System . arraycopy ( xold , 0 , x , 0 , n ) ; return f ; } else if ( f <= fold + ftol * alam * slope ) { // Sufficient function decrease .
return f ; } else { // Backtrack
if ( alam == 1.0 ) { // First time
tmpalam = - slope / ( 2.0 * ( f - fold - slope ) ) ; } else { // Subsequent backtracks .
rhs1 = f - fold - alam * slope ; rhs2 = f2 - fold - alam2 * slope ; a = ( rhs1 / ( alam * alam ) - rhs2 / ( alam2 * alam2 ) ) / ( alam - alam2 ) ; b = ( - alam2 * rhs1 / ( alam * alam ) + alam * rhs2 / ( alam2 * alam2 ) ) / ( alam - alam2 ) ; if ( a == 0.0 ) { tmpalam = - slope / ( 2.0 * b ) ; } else { disc = b * b - 3.0 * a * slope ; if ( disc < 0.0 ) { tmpalam = 0.5 * alam ; } else if ( b <= 0.0 ) { tmpalam = ( - b + sqrt ( disc ) ) / ( 3.0 * a ) ; } else { tmpalam = - slope / ( b + sqrt ( disc ) ) ; } } if ( tmpalam > 0.5 * alam ) { tmpalam = 0.5 * alam ; } } } alam2 = alam ; f2 = f ; alam = max ( tmpalam , 0.1 * alam ) ; } |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcDuctSegmentType ( ) { } } | if ( ifcDuctSegmentTypeEClass == null ) { ifcDuctSegmentTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 180 ) ; } return ifcDuctSegmentTypeEClass ; |
public class PasswordAuthorizer { @ Override public String authUserInfo ( ) { } } | if ( this . username != null && this . password != null ) { return this . username + ':' + this . password ; } return null ; |
public class TargetStreamManager { /** * Create a new StreamSet for a given streamID and sourceCellule .
* @ param streamID
* @ param sourceCellule
* @ param remoteDestUuid This may not always be the same as the
* Uuid of the local destination
* @ param remoteBusUuid
* @ return A new StreamSet
* @ throws SIResourceException if the message store outofcache space exception is caught */
private StreamSet addNewStreamSet ( SIBUuid12 streamID , SIBUuid8 sourceMEUuid , SIBUuid12 remoteDestUuid , SIBUuid8 remoteBusUuid , String linkTarget ) throws SIRollbackException , SIConnectionLostException , SIIncorrectCallException , SIResourceException , SIErrorException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addNewStreamSet" , new Object [ ] { streamID , sourceMEUuid , remoteDestUuid , remoteBusUuid , linkTarget } ) ; StreamSet streamSet = null ; try { LocalTransaction tran = txManager . createLocalTransaction ( false ) ; Transaction msTran = txManager . resolveAndEnlistMsgStoreTransaction ( tran ) ; // create a persistent stream set
streamSet = new StreamSet ( streamID , sourceMEUuid , remoteDestUuid , remoteBusUuid , protocolItemStream , txManager , 0 , destination . isLink ( ) ? StreamSet . Type . LINK_TARGET : StreamSet . Type . TARGET , tran , linkTarget ) ; protocolItemStream . addItem ( streamSet , msTran ) ; tran . commit ( ) ; synchronized ( streamSets ) { streamSets . put ( streamID , streamSet ) ; sourceMap . put ( streamID , sourceMEUuid ) ; } } catch ( OutOfCacheSpace e ) { // No FFDC code needed
SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addNewStreamSet" , e ) ; throw new SIResourceException ( e ) ; } catch ( MessageStoreException e ) { // MessageStoreException shouldn ' t occur so FFDC .
FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.gd.TargetStreamManager.addNewStreamSet" , "1:471:1.69" , this ) ; SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addNewStreamSet" , e ) ; throw new SIResourceException ( e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addNewStreamSet" , streamSet ) ; return streamSet ; |
public class NodeSet { /** * Set the current position in the node set .
* @ param i Must be a valid index .
* @ throws RuntimeException thrown if this NodeSet is not of
* a cached type , and thus doesn ' t permit indexed access . */
public void setCurrentPos ( int i ) { } } | if ( ! m_cacheNodes ) throw new RuntimeException ( XSLMessages . createXPATHMessage ( XPATHErrorResources . ER_NODESET_CANNOT_INDEX , null ) ) ; // " This NodeSet can not do indexing or counting functions ! " ) ;
m_next = i ; |
public class BindableASTTransformation { /** * Convenience method to see if an annotated node is { @ code @ Bindable } .
* @ param node the node to check
* @ return true if the node is bindable */
public static boolean hasBindableAnnotation ( AnnotatedNode node ) { } } | for ( AnnotationNode annotation : node . getAnnotations ( ) ) { if ( boundClassNode . equals ( annotation . getClassNode ( ) ) ) { return true ; } } return false ; |
public class Hyaline { /** * It lets you create a new DTO from scratch . This means that any annotation
* from JAXB , Jackson or whatever serialization framework you are using on
* your entity T will be ignored . The only annotation - based configuration
* that will be used is the one you are defining in this invocation .
* @ param < T >
* the generic type
* @ param entity
* the entity you are going proxy .
* @ param dtoTemplate
* the DTO template passed as an anonymous class .
* @ return a proxy that extends the type of entity , holding the same
* instance variables values as entity and configured according to
* dtoTemplate
* @ throws HyalineException
* if the dynamic type could be created . */
public static < T > T dtoFromScratch ( T entity , DTO dtoTemplate ) throws HyalineException { } } | return dtoFromScratch ( entity , dtoTemplate , "Hyaline$Proxy$" + System . currentTimeMillis ( ) ) ; |
public class ArticleConsumerLogMessages { /** * Logs the occurance of an ArticleReaderException .
* @ param logger
* reference to the logger
* @ param e
* reference to the exception */
public static void logTaskReaderException ( final Logger logger , final ArticleReaderException e ) { } } | logger . logException ( Level . ERROR , "TaskReaderException" , e ) ; |
public class AbstractBaseJnlpMojo { /** * Log as info when verbose or info is enabled , as debug otherwise .
* @ param msg the message to display */
protected void verboseLog ( String msg ) { } } | if ( isVerbose ( ) ) { getLog ( ) . info ( msg ) ; } else { getLog ( ) . debug ( msg ) ; } |
public class RoleResource1 { /** * RESTful endpoint for creating a role . */
@ POST @ Path ( "{group}/{id}" ) @ Consumes ( MediaType . APPLICATION_JSON ) public Response createRole ( @ PathParam ( "group" ) String group , @ PathParam ( "id" ) String id , EmoRole role , final @ Authenticated Subject subject ) { } } | checkArgument ( role . getId ( ) . equals ( new EmoRoleKey ( group , id ) ) , "Body contains conflicting role identifier" ) ; return createRoleFromUpdateRequest ( group , id , new CreateEmoRoleRequest ( ) . setName ( role . getName ( ) ) . setDescription ( role . getDescription ( ) ) . setPermissions ( role . getPermissions ( ) ) , subject ) ; |
public class PromotionalCredit { public static AddRequest add ( ) throws IOException { } } | String uri = uri ( "promotional_credits" , "add" ) ; return new AddRequest ( Method . POST , uri ) ; |
public class Main { /** * Runs the tool using the provided settings .
* @ param editor the XML configuration file , parsed by the XmlEditor utility
* @ param name the name of the RPM file to create
* @ param version the version of the created RPM
* @ param release the release version of the created RPM
* @ param include the contents to include in the generated RPM file
* @ param destination the destination file to use in creating the RPM
* @ throws NoSuchAlgorithmException if an operation attempted during RPM creation fails due
* to a missing encryption algorithm
* @ throws IOException if an IO error occurs either in reading the configuration file , reading
* an input file to the RPM , or during RPM creation */
public void run ( XmlEditor editor , String name , String version , String release , Contents include , File destination ) throws NoSuchAlgorithmException , IOException { } } | Builder builder = new Builder ( ) ; builder . setPackage ( name , version , release ) ; RpmType type = RpmType . valueOf ( editor . getValue ( "rpm:type" , BINARY . toString ( ) ) ) ; builder . setType ( type ) ; Architecture arch = Architecture . valueOf ( editor . getValue ( "rpm:architecture" , NOARCH . toString ( ) ) ) ; Os os = Os . valueOf ( editor . getValue ( "rpm:os" , LINUX . toString ( ) ) ) ; builder . setPlatform ( arch , os ) ; builder . setSummary ( editor . getValue ( "rpm:summary/text()" ) ) ; builder . setDescription ( editor . getValue ( "rpm:description/text()" ) ) ; builder . setBuildHost ( editor . getValue ( "rpm:host/text()" , InetAddress . getLocalHost ( ) . getHostName ( ) ) ) ; builder . setLicense ( editor . getValue ( "rpm:license/text()" ) ) ; builder . setGroup ( editor . getValue ( "rpm:group/text()" ) ) ; builder . setPackager ( editor . getValue ( "rpm:packager/text()" , System . getProperty ( "user.name" ) ) ) ; builder . setVendor ( editor . getValue ( "rpm:vendor/text()" , null ) ) ; builder . setUrl ( editor . getValue ( "rpm:url/text()" , null ) ) ; builder . setProvides ( editor . getValue ( "rpm:provides/text()" , name ) ) ; builder . setFiles ( include ) ; builder . build ( destination ) ; |
public class Attributes { /** * Associates the specified value with the specified attribute name ,
* specified as a String . The attributes name is case - insensitive .
* If the Map previously contained a mapping for the attribute name ,
* the old value is replaced .
* This method is defined as :
* < pre >
* return ( String ) put ( new Attributes . Name ( name ) , value ) ;
* < / pre >
* @ param name the attribute name as a string
* @ param value the attribute value
* @ return the previous value of the attribute , or null if none
* @ exception IllegalArgumentException if the attribute name is invalid */
public String putValue ( String name , String value ) { } } | return ( String ) put ( new Name ( name ) , value ) ; |
public class SecurityManager { /** * Tries to authenticate an AuthenticationToken .
* @ param authenticationToken
* @ return an Account instance if authentication is successful , otherwise throws an AuthenticationException */
public Account check ( AuthenticationToken authenticationToken ) { } } | Account account = authenticate ( authenticationToken ) ; if ( account == null ) { throw new AuthenticationException ( "Invalid credentials" ) ; } return account ; |
public class AdministratorImpl { /** * < p > Delete a subscription . < / p >
* @ param name The destination name
* @ param force The force deletion switch
* @ return */
public void deleteSubscription ( String subId , boolean force ) throws SINotAuthorizedException , SIDurableSubscriptionNotFoundException , SIDestinationLockedException , SIResourceException , SIIncorrectCallException , SINotPossibleInCurrentConfigurationException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "deleteSubscription" , new Object [ ] { subId , new Boolean ( force ) } ) ; checkStarted ( ) ; if ( subId == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "deleteSubscription" , "SubId is null" ) ; throw new SIDurableSubscriptionNotFoundException ( nls . getFormattedMessage ( "SUBSCRIPTION_DOESNT_EXIST_ERROR_CWSIP0072" , new Object [ ] { null , messageProcessor . getMessagingEngineName ( ) } , null ) ) ; } HashMap durableSubs = destinationManager . getDurableSubscriptionsTable ( ) ; synchronized ( durableSubs ) { // Look up the consumer dispatcher for this subId in the system durable subs list
ConsumerDispatcher cd = ( ConsumerDispatcher ) durableSubs . get ( subId ) ; // Does the subscription exist , if it doesn ' t , throw a
// SIDestinationNotFoundException
if ( cd == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "deleteSubscription" , "SIDurableSubscriptionNotFoundException" ) ; throw new SIDurableSubscriptionNotFoundException ( nls . getFormattedMessage ( "SUBSCRIPTION_DOESNT_EXIST_ERROR_CWSIP0146" , new Object [ ] { subId , messageProcessor . getMessagingEngineName ( ) } , null ) ) ; } // Obtain the destination from the queueing points
DestinationHandler destination = cd . getDestination ( ) ; // Call the deleteDurableSubscription method on the destination
// NOTE : this assumes the durable subscription is always local
destination . deleteDurableSubscription ( subId , messageProcessor . getMessagingEngineName ( ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "deleteSubscription" ) ; |
public class XPathBuilder { /** * < p > < b > Used for finding element process ( to generate xpath address ) < / b > < / p >
* @ param searchLabelTypes accepted values are : { @ link SearchType }
* @ param < T > the element which calls this method
* @ return this element */
@ SuppressWarnings ( "unchecked" ) private < T extends XPathBuilder > T setSearchLabelType ( SearchType ... searchLabelTypes ) { } } | this . searchLabelType = new ArrayList < > ( ) ; if ( searchLabelTypes != null ) { this . searchLabelType . addAll ( 0 , Arrays . asList ( searchLabelTypes ) ) ; } this . searchLabelType = cleanUpSearchType ( this . searchLabelType ) ; return ( T ) this ; |
public class Resolve { /** * Resolve an unqualified method identifier .
* @ param pos The position to use for error reporting .
* @ param env The environment current at the method invocation .
* @ param name The identifier ' s name .
* @ param argtypes The types of the invocation ' s value arguments .
* @ param typeargtypes The types of the invocation ' s type arguments . */
Symbol resolveMethod ( DiagnosticPosition pos , Env < AttrContext > env , Name name , List < Type > argtypes , List < Type > typeargtypes ) { } } | return lookupMethod ( env , pos , env . enclClass . sym , resolveMethodCheck , new BasicLookupHelper ( name , env . enclClass . sym . type , argtypes , typeargtypes ) { @ Override Symbol doLookup ( Env < AttrContext > env , MethodResolutionPhase phase ) { return findFun ( env , name , argtypes , typeargtypes , phase . isBoxingRequired ( ) , phase . isVarargsRequired ( ) ) ; } } ) ; |
public class BaseFileResourceModelSource { /** * Writes the data to a temp file , and attempts to parser it , then if successful it will
* call { @ link # writeFileData ( InputStream ) } to invoke the sub class
* @ param data data
* @ return number of bytes written
* @ throws IOException if an IO error occurs
* @ throws ResourceModelSourceException if an error occurs parsing the data . */
@ Override public long writeData ( final InputStream data ) throws IOException , ResourceModelSourceException { } } | if ( ! isDataWritable ( ) ) { throw new IllegalArgumentException ( "Cannot write to file, it is not configured to be writeable" ) ; } ResourceFormatParser resourceFormat = getResourceFormatParser ( ) ; // validate data
File temp = Files . createTempFile ( "temp" , "." + resourceFormat . getPreferredFileExtension ( ) ) . toFile ( ) ; temp . deleteOnExit ( ) ; try { try ( FileOutputStream fos = new FileOutputStream ( temp ) ) { Streams . copyStream ( data , fos ) ; } final ResourceFormatParser parser = getResourceFormatParser ( ) ; try { final INodeSet set = parser . parseDocument ( temp ) ; } catch ( ResourceFormatParserException e ) { throw new ResourceModelSourceException ( e ) ; } try ( FileInputStream tempStream = new FileInputStream ( temp ) ) { return writeFileData ( tempStream ) ; } } finally { temp . delete ( ) ; } |
public class PortablePositionNavigator { /** * Token without quantifier . It means it ' s just a simple field , not an array . */
private static PortablePosition navigateToPathTokenWithoutQuantifier ( PortableNavigatorContext ctx , PortablePathCursor path ) throws IOException { } } | if ( path . isLastToken ( ) ) { // if it ' s a token that ' s on the last position we calculate its direct access position and return it for
// reading in the value reader .
return createPositionForReadAccess ( ctx , path ) ; } else { // if it ' s not a token that ' s on the last position in the path we advance the position to the next token
// we also adjust the context , since advancing means that we are in the context of other
// ( and possibly different ) portable type .
if ( ! navigateContextToNextPortableTokenFromPortableField ( ctx ) ) { // we return null if we didn ' t manage to advance from the current token to the next one .
// For example : it may happen if the current token points to a null object .
return nilNotLeafPosition ( ) ; } } return null ; |
public class ExpressionUtils { /** * If you register a CustomExpression with the name " customExpName " , then this will create the text needed
* to invoke it in a JRDesignExpression
* @ param customExpName
* @ param usePreviousFieldValues
* @ return */
public static String createCustomExpressionInvocationText ( CustomExpression customExpression , String customExpName , boolean usePreviousFieldValues ) { } } | String stringExpression ; if ( customExpression instanceof DJSimpleExpression ) { DJSimpleExpression varexp = ( DJSimpleExpression ) customExpression ; String symbol ; switch ( varexp . getType ( ) ) { case DJSimpleExpression . TYPE_FIELD : symbol = "F" ; break ; case DJSimpleExpression . TYPE_VARIABLE : symbol = "V" ; break ; case DJSimpleExpression . TYPE_PARAMATER : symbol = "P" ; break ; default : throw new DJException ( "Invalid DJSimpleExpression, type must be FIELD, VARIABLE or PARAMETER" ) ; } stringExpression = "$" + symbol + "{" + varexp . getVariableName ( ) + "}" ; } else { String fieldsMap = "((" + DJDefaultScriptlet . class . getName ( ) + ")$P{REPORT_SCRIPTLET}).getCurrentFields()" ; if ( usePreviousFieldValues ) { fieldsMap = "((" + DJDefaultScriptlet . class . getName ( ) + ")$P{REPORT_SCRIPTLET}).getPreviousFields()" ; } String parametersMap = "((" + DJDefaultScriptlet . class . getName ( ) + ")$P{REPORT_SCRIPTLET}).getCurrentParams()" ; String variablesMap = "((" + DJDefaultScriptlet . class . getName ( ) + ")$P{REPORT_SCRIPTLET}).getCurrentVariables()" ; stringExpression = "((" + CustomExpression . class . getName ( ) + ")$P{REPORT_PARAMETERS_MAP}.get(\"" + customExpName + "\"))." + CustomExpression . EVAL_METHOD_NAME + "( " + fieldsMap + ", " + variablesMap + ", " + parametersMap + " )" ; } return stringExpression ; |
public class ComponentBorder { /** * The insets need to be determined so they are included in the preferred
* size of the component the Border is attached to .
* The alignment of the component is determined here so it doesn ' t need
* to be recalculated every time the Border is painted . */
private void determineInsetsAndAlignment ( ) { } } | borderInsets = new Insets ( 0 , 0 , 0 , 0 ) ; // The insets will only be updated for the edge the component will be
// diplayed on .
// The X , Y alignment of the component is controlled by both the edge
// and alignment parameters
if ( edge == Edge . TOP ) { borderInsets . top = component . getPreferredSize ( ) . height + gap ; component . setAlignmentX ( alignment ) ; component . setAlignmentY ( 0.0f ) ; } else if ( edge == Edge . BOTTOM ) { borderInsets . bottom = component . getPreferredSize ( ) . height + gap ; component . setAlignmentX ( alignment ) ; component . setAlignmentY ( 1.0f ) ; } else if ( edge == Edge . LEFT ) { borderInsets . left = component . getPreferredSize ( ) . width + gap ; component . setAlignmentX ( 0.0f ) ; component . setAlignmentY ( alignment ) ; } else if ( edge == Edge . RIGHT ) { borderInsets . right = component . getPreferredSize ( ) . width + gap ; component . setAlignmentX ( 1.0f ) ; component . setAlignmentY ( alignment ) ; } if ( adjustInsets ) { adjustBorderInsets ( ) ; } |
public class AoInterfaceCodeGen { /** * Output class
* @ param def definition
* @ param out Writer
* @ throws IOException ioException */
@ Override public void writeClassBody ( Definition def , Writer out ) throws IOException { } } | out . write ( "public interface " + getClassName ( def ) ) ; if ( def . isAdminObjectImplRaAssociation ( ) ) { out . write ( " extends Referenceable, Serializable" ) ; } writeLeftCurlyBracket ( out , 0 ) ; writeEol ( out ) ; int indent = 1 ; writeConfigProps ( def , out , indent ) ; writeRightCurlyBracket ( out , 0 ) ; |
public class ColorChooserFrame { /** * GEN - LAST : event _ okButtonActionPerformed */
private void cancelButtonActionPerformed ( java . awt . event . ActionEvent evt ) { } } | // GEN - FIRST : event _ cancelButtonActionPerformed
feedback = UserFeedback . Cancel ; synchronized ( WAITER_LOCK ) { okButton . setEnabled ( false ) ; cancelButton . setEnabled ( false ) ; WAITER_LOCK . notifyAll ( ) ; } |
public class Team { /** * List all oTask / Activity records within a team by specified code ( s )
* @ param company Company ID
* @ paramteam Team ID
* @ param code Specific code ( s )
* @ throwsJSONException If error occurred
* @ return { @ link JSONObject } */
public JSONObject getSpecificList ( String company , String team , String code ) throws JSONException { } } | return _getByType ( company , team , code ) ; |
public class Maybe { /** * If the value is present , return it ; otherwise , throw the { @ link Throwable } supplied by
* < code > throwableSupplier < / code > .
* @ param throwableSupplier the supplier of the potentially thrown { @ link Throwable }
* @ param < E > the Throwable type
* @ return the value , if present
* @ throws E the throwable , if the value is absent */
public final < E extends Throwable > A orElseThrow ( Supplier < E > throwableSupplier ) throws E { } } | return orElseGet ( ( CheckedSupplier < E , A > ) ( ) -> { throw throwableSupplier . get ( ) ; } ) ; |
public class CheckJSDoc { /** * Checks that deprecated annotations such as @ expose are not present */
private void validateDeprecatedJsDoc ( Node n , JSDocInfo info ) { } } | if ( info != null && info . isExpose ( ) ) { report ( n , ANNOTATION_DEPRECATED , "@expose" , "Use @nocollapse or @export instead." ) ; } |
public class DefaultItemDataCopyVisitor { /** * { @ inheritDoc } */
@ Override protected void entering ( PropertyData property , int level ) throws RepositoryException { } } | InternalQName qname = property . getQPath ( ) . getName ( ) ; List < ValueData > values ; if ( ntManager . isNodeType ( Constants . MIX_REFERENCEABLE , curParent ( ) . getPrimaryTypeName ( ) , curParent ( ) . getMixinTypeNames ( ) ) && qname . equals ( Constants . JCR_UUID ) ) { values = new ArrayList < ValueData > ( 1 ) ; values . add ( new TransientValueData ( curParent ( ) . getIdentifier ( ) ) ) ; } else { values = copyValues ( property ) ; } TransientPropertyData newProperty = new TransientPropertyData ( QPath . makeChildPath ( curParent ( ) . getQPath ( ) , qname ) , keepIdentifiers ? property . getIdentifier ( ) : IdGenerator . generate ( ) , - 1 , property . getType ( ) , curParent ( ) . getIdentifier ( ) , property . isMultiValued ( ) , values ) ; itemAddStates . add ( new ItemState ( newProperty , ItemState . ADDED , true , ancestorToSave , level != 0 ) ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcEnergyMeasure ( ) { } } | if ( ifcEnergyMeasureEClass == null ) { ifcEnergyMeasureEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 805 ) ; } return ifcEnergyMeasureEClass ; |
public class EJSContainer { /** * Tell the container that the given container transaction has
* completed . < p > */
public void containerTxCompleted ( ContainerTx containerTx ) { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; // d532639.2
if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "containerTxCompleted (" + ContainerTx . uowIdToString ( containerTx . ivTxKey ) + ")" ) ; // Release any Option A locks not released as part of normal afterCompletion
// processing . This serves as a way to release locks from failed bean
// creates ( DuplicateKeyExceptions ) and internal Container problems . d110984
if ( lockManager != null ) // added 173022.11
lockManager . unlock ( containerTx ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "containerTxCompleted" ) ; |
public class RouterMiddleware { /** * Creates a { @ link Route } object and adds it to the routes list . It will respond to the POST HTTP method and the
* specified < code > path < / code > invoking the { @ link RouteHandler } object .
* @ param path the path to which this route will respond .
* @ param handler the object that will be invoked when the route matches . */
public void post ( String path , RouteHandler handler ) { } } | try { addRoute ( HttpMethod . POST , path , handler , "handle" ) ; } catch ( NoSuchMethodException e ) { // shouldn ' t happen unless we change the name of the method in RouteHandler
throw new RuntimeException ( e ) ; } |
public class P2sVpnGatewaysInner { /** * Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group .
* @ param resourceGroupName The name of the resource group .
* @ param gatewayName The name of the P2SVpnGateway .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < ServiceResponse < VpnProfileResponseInner > > generateVpnProfileWithServiceResponseAsync ( String resourceGroupName , String gatewayName ) { } } | if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( gatewayName == null ) { throw new IllegalArgumentException ( "Parameter gatewayName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } final String apiVersion = "2018-08-01" ; final AuthenticationMethod authenticationMethod = null ; P2SVpnProfileParameters parameters = new P2SVpnProfileParameters ( ) ; parameters . withAuthenticationMethod ( null ) ; Observable < Response < ResponseBody > > observable = service . generateVpnProfile ( resourceGroupName , gatewayName , this . client . subscriptionId ( ) , apiVersion , this . client . acceptLanguage ( ) , parameters , this . client . userAgent ( ) ) ; return client . getAzureClient ( ) . getPostOrDeleteResultAsync ( observable , new TypeToken < VpnProfileResponseInner > ( ) { } . getType ( ) ) ; |
public class DssatXFileOutput { /** * To check if there is plot info data existed in the experiment
* @ param expData experiment data holder
* @ return the boolean value for if plot info exists */
private boolean isPlotInfoExist ( Map expData ) { } } | String [ ] plotIds = { "plta" , "pltr#" , "pltln" , "pldr" , "pltsp" , "pllay" , "pltha" , "plth#" , "plthl" , "plthm" } ; for ( String plotId : plotIds ) { if ( ! getValueOr ( expData , plotId , "" ) . equals ( "" ) ) { return true ; } } return false ; |
public class MsgSettingController { /** * Download api all .
* @ param req the req
* @ param res the res */
@ GetMapping ( "/setting/download/api/excel/all" ) public void downloadApiAll ( HttpServletRequest req , HttpServletResponse res ) { } } | this . validationSessionComponent . sessionCheck ( req ) ; PoiWorkBook workBook = this . msgExcelService . getAllExcels ( ) ; workBook . writeFile ( "ValidationApis_" + System . currentTimeMillis ( ) , res ) ; |
public class SwitchSliderTileSkin { /** * * * * * * Initialization * * * * * */
@ Override protected void initGraphics ( ) { } } | super . initGraphics ( ) ; mouseEventHandler = e -> { final EventType TYPE = e . getEventType ( ) ; final Object SRC = e . getSource ( ) ; if ( MouseEvent . MOUSE_PRESSED == TYPE ) { if ( SRC . equals ( thumb ) ) { dragStart = thumb . localToParent ( e . getX ( ) , e . getY ( ) ) ; formerThumbPos = ( tile . getCurrentValue ( ) - minValue ) / range ; tile . fireTileEvent ( VALUE_CHANGING ) ; } else if ( SRC . equals ( switchBorder ) ) { tile . setActive ( ! tile . isActive ( ) ) ; tile . fireEvent ( SWITCH_PRESSED ) ; } } else if ( MouseEvent . MOUSE_DRAGGED == TYPE ) { Point2D currentPos = thumb . localToParent ( e . getX ( ) , e . getY ( ) ) ; double dragPos = currentPos . getX ( ) - dragStart . getX ( ) ; thumbDragged ( ( formerThumbPos + dragPos / trackLength ) ) ; } else if ( MouseEvent . MOUSE_RELEASED == TYPE ) { if ( SRC . equals ( thumb ) ) { tile . fireTileEvent ( VALUE_CHANGED ) ; } else if ( SRC . equals ( switchBorder ) ) { tile . fireEvent ( SWITCH_RELEASED ) ; } } } ; selectedListener = o -> moveThumb ( ) ; valueListener = o -> { if ( tile . isActive ( ) && tile . getValue ( ) != tile . getMinValue ( ) ) { thumb . setFill ( tile . getBarColor ( ) ) ; } else { thumb . setFill ( tile . getForegroundColor ( ) ) ; } } ; timeline = new Timeline ( ) ; timeline . setOnFinished ( event -> thumb . setFill ( tile . isActive ( ) ? tile . getBarColor ( ) : tile . getForegroundColor ( ) ) ) ; titleText = new Text ( ) ; titleText . setFill ( tile . getTitleColor ( ) ) ; Helper . enableNode ( titleText , ! tile . getTitle ( ) . isEmpty ( ) ) ; text = new Text ( tile . getText ( ) ) ; text . setFill ( tile . getUnitColor ( ) ) ; Helper . enableNode ( text , tile . isTextVisible ( ) ) ; valueText = new Text ( String . format ( locale , formatString , ( ( tile . getValue ( ) - minValue ) / range * 100 ) ) ) ; valueText . setFill ( tile . getValueColor ( ) ) ; Helper . enableNode ( valueText , tile . isValueVisible ( ) ) ; unitText = new Text ( tile . getUnit ( ) ) ; unitText . setFill ( tile . getUnitColor ( ) ) ; Helper . enableNode ( unitText , ! tile . getUnit ( ) . isEmpty ( ) ) ; valueUnitFlow = new TextFlow ( valueText , unitText ) ; valueUnitFlow . setTextAlignment ( TextAlignment . RIGHT ) ; description = new Label ( tile . getDescription ( ) ) ; description . setAlignment ( tile . getDescriptionAlignment ( ) ) ; description . setWrapText ( true ) ; description . setTextFill ( tile . getTextColor ( ) ) ; Helper . enableNode ( description , ! tile . getDescription ( ) . isEmpty ( ) ) ; barBackground = new Rectangle ( PREFERRED_WIDTH * 0.795 , PREFERRED_HEIGHT * 0.0275 ) ; bar = new Rectangle ( 0 , PREFERRED_HEIGHT * 0.0275 ) ; thumb = new Circle ( PREFERRED_WIDTH * 0.09 ) ; thumb . setEffect ( shadow ) ; switchBorder = new Rectangle ( ) ; switchBackground = new Rectangle ( ) ; switchBackground . setMouseTransparent ( true ) ; switchBackground . setFill ( tile . isActive ( ) ? tile . getActiveColor ( ) : tile . getBackgroundColor ( ) ) ; switchThumb = new Circle ( ) ; switchThumb . setMouseTransparent ( true ) ; switchThumb . setEffect ( shadow ) ; getPane ( ) . getChildren ( ) . addAll ( titleText , text , valueUnitFlow , description , barBackground , bar , thumb , switchBorder , switchBackground , switchThumb ) ; |
public class HttpHeaderOperation { /** * Parse { @ code value } as < em > byte - content - range - spec < / em > .
* < em > byte - range - resp - spec < / em > is parsed with { @ link # parseRange ( String ) } .
* If < em > byte - range - resp - spec < / em > is { @ code * } , both < em > first - byte - pos < / em > and
* < em > last - byte - pos < / em > will be { @ code - 1 } .
* @ param value { @ code Content - Range } header field value .
* @ return Three element array with < em > first - byte - pos < / em > , < em > last - byte - pos + 1 < / em >
* and < em > instance - length < / em > , or { @ code null } if { @ code value } is syntactically invalid .
* @ see # parseRange */
public static long [ ] parseContentRange ( String value ) { } } | if ( ! value . startsWith ( "bytes " ) ) return null ; int s = "bytes " . length ( ) ; while ( s < value . length ( ) && value . charAt ( s ) == ' ' ) s ++ ; int pslash = value . indexOf ( '/' , s ) ; if ( pslash < 0 ) return null ; final String rangeSpec = value . substring ( s , pslash ) . trim ( ) ; long start , stop ; if ( rangeSpec . equals ( "*" ) ) start = stop = - 1 ; else { long [ ] range = parseRange ( rangeSpec ) ; if ( range == null ) return null ; if ( range [ 0 ] < 0 || range [ 1 ] < 0 ) return null ; start = range [ 0 ] ; stop = range [ 1 ] ; } final String instanceLength = value . substring ( pslash + 1 ) . trim ( ) ; long length ; if ( instanceLength . equals ( "*" ) ) length = - 1 ; else { try { length = Long . parseLong ( instanceLength ) ; } catch ( NumberFormatException ex ) { return null ; } } return new long [ ] { start , stop , length } ; |
public class SqlTileWriter { /** * Count cache tiles
* @ param pTileSourceName the tile source name ( possibly null )
* @ param pZoom the zoom level
* @ param pInclude a collection of bounding boxes to include ( possibly null / empty )
* @ param pExclude a collection of bounding boxes to exclude ( possibly null / empty )
* @ since 6.0.2
* @ return the number of corresponding tiles in the cache */
public long getRowCount ( final String pTileSourceName , final int pZoom , final Collection < Rect > pInclude , final Collection < Rect > pExclude ) { } } | return getRowCount ( getWhereClause ( pZoom , pInclude , pExclude ) + ( pTileSourceName != null ? " and " + COLUMN_PROVIDER + "=?" : "" ) , pTileSourceName != null ? new String [ ] { pTileSourceName } : null ) ; |
public class StorageProviderBase { /** * { @ inheritDoc } */
public void deleteSpace ( String spaceId ) { } } | log . debug ( "deleteSpace(" + spaceId + ")" ) ; throwIfSpaceNotExist ( spaceId ) ; Map < String , String > allProps = getAllSpaceProperties ( spaceId ) ; allProps . put ( "is-delete" , "true" ) ; doSetSpaceProperties ( spaceId , allProps ) ; SpaceDeleteWorker deleteThread = getSpaceDeleteWorker ( spaceId ) ; new Thread ( deleteThread ) . start ( ) ; |
public class DefaultDocWorkUnitHandler { /** * Recursive helper routine to getFieldDoc ( ) */
private FieldDoc getFieldDoc ( final ClassDoc classDoc , final String argumentFieldName ) { } } | for ( final FieldDoc fieldDoc : classDoc . fields ( false ) ) { if ( fieldDoc . name ( ) . equals ( argumentFieldName ) ) { return fieldDoc ; } // This can return null , specifically , we can encounter https : / / bugs . openjdk . java . net / browse / JDK - 8033735,
// which is fixed in JDK9 http : / / hg . openjdk . java . net / jdk9 / jdk9 / hotspot / rev / ba8c351b7096.
final Field field = DocletUtils . getFieldForFieldDoc ( fieldDoc ) ; if ( field == null ) { logger . warn ( String . format ( "Could not access the field definition for %s while searching for %s, presumably because the field is inaccessible" , fieldDoc . name ( ) , argumentFieldName ) ) ; } else if ( field . isAnnotationPresent ( ArgumentCollection . class ) ) { final ClassDoc typeDoc = getDoclet ( ) . getRootDoc ( ) . classNamed ( fieldDoc . type ( ) . qualifiedTypeName ( ) ) ; if ( typeDoc == null ) { throw new DocException ( "Tried to get javadocs for ArgumentCollection field " + fieldDoc + " but couldn't find the class in the RootDoc" ) ; } else { FieldDoc result = getFieldDoc ( typeDoc , argumentFieldName ) ; if ( result != null ) { return result ; } // else keep searching
} } } // if we didn ' t find it here , wander up to the superclass to find the field
if ( classDoc . superclass ( ) != null ) { return getFieldDoc ( classDoc . superclass ( ) , argumentFieldName ) ; } return null ; |
public class LambdaFactory { /** * Returns a LambdaFactory instance with the given configuration .
* @ throws JavaCompilerNotFoundException if the library cannot find any java compiler and it ' s not provided
* in the configuration */
public static LambdaFactory get ( LambdaFactoryConfiguration configuration ) { } } | JavaCompiler compiler = Optional . ofNullable ( configuration . getJavaCompiler ( ) ) . orElseThrow ( JavaCompilerNotFoundException :: new ) ; return new LambdaFactory ( configuration . getDefaultHelperClassSourceProvider ( ) , configuration . getClassFactory ( ) , compiler , configuration . getImports ( ) , configuration . getStaticImports ( ) , configuration . getCompilationClassPath ( ) , configuration . getParentClassLoader ( ) ) ; |
public class Range { /** * Checks whether this range is after the specified element .
* @ param element the element to check for , null returns false
* @ return true if this range is entirely after the specified element */
public boolean isAfter ( T element ) { } } | if ( element == null ) { return false ; } return comparator . compare ( element , min ) < 0 ; |
public class BasicAgigaSentence { /** * / * ( non - Javadoc )
* @ see edu . jhu . hltcoe . sp . data . depparse . AgigaSentence # writeTags ( java . io . Writer , boolean , boolean , boolean ) */
public void writeTags ( Writer writer , boolean useLemmas , boolean useNormNer , boolean useNerTags ) throws IOException { } } | for ( int i = 0 ; i < tokens . size ( ) ; i ++ ) { AgigaToken tok = tokens . get ( i ) ; if ( useNormNer && tok . getNormNer ( ) != null ) { require ( prefs . readNormNer , "AgigaPrefs.readNormNer must be true if useNormNer=true for writeTags()" ) ; writer . write ( tok . getNormNer ( ) ) ; } else if ( useLemmas ) { require ( prefs . readLemma , "AgigaPrefs.readLemma must be true if useLemmas=true for writeTags()" ) ; writer . write ( tok . getLemma ( ) ) ; } else { require ( prefs . readWord , "AgigaPrefs.readWord must be true if useLemmas and useNormNer are false for writeTags()" ) ; writer . write ( tok . getWord ( ) ) ; } writer . write ( "/" ) ; if ( useNerTags ) { require ( prefs . readNer , "AgigaPrefs.readNer must be true if useNerTags=true for writeTags()" ) ; if ( prefs . strict ) { writer . write ( tok . getNerTag ( ) ) ; } else { if ( tok . getNerTag ( ) != null ) { writer . write ( tok . getNerTag ( ) ) ; } else { log . warning ( "Missing NER annotation written as '__MISSING_NER_ANNOTATION__'" ) ; writer . write ( "__MISSING_NER_ANNOTATION__" ) ; } } } else { require ( prefs . readPos , "AgigaPrefs.readPos must be true if useNerTags=false for writeTags()" ) ; writer . write ( tok . getPosTag ( ) ) ; } if ( i < tokens . size ( ) - 1 ) { writer . write ( " " ) ; } } writer . write ( "\n" ) ; |
public class WebSocketFrame { /** * Parse the first two bytes of the payload as a close code .
* If any payload is not set or the length of the payload is less than 2,
* this method returns 1005 ( { @ link WebSocketCloseCode # NONE } ) .
* The value returned from this method is meaningless if this frame
* is not a close frame .
* @ return
* The close code .
* @ see < a href = " http : / / tools . ietf . org / html / rfc6455 # section - 5.5.1"
* > RFC 6455 , 5.5.1 . Close < / a >
* @ see WebSocketCloseCode */
public int getCloseCode ( ) { } } | if ( mPayload == null || mPayload . length < 2 ) { return WebSocketCloseCode . NONE ; } // A close code is encoded in network byte order .
int closeCode = ( ( ( mPayload [ 0 ] & 0xFF ) << 8 ) | ( mPayload [ 1 ] & 0xFF ) ) ; return closeCode ; |
public class MessageHeader { /** * Prints the key - value pairs represented by this
* header . Also prints the RFC required blank line
* at the end . Omits pairs with a null key . */
public synchronized void print ( PrintStream p ) { } } | for ( int i = 0 ; i < nkeys ; i ++ ) if ( keys [ i ] != null ) { p . print ( keys [ i ] + ( values [ i ] != null ? ": " + values [ i ] : "" ) + "\r\n" ) ; } p . print ( "\r\n" ) ; p . flush ( ) ; |
public class AWSMediaConnectClient { /** * Removes an output from an existing flow . This request can be made only on an output that does not have an
* entitlement associated with it . If the output has an entitlement , you must revoke the entitlement instead . When
* an entitlement is revoked from a flow , the service automatically removes the associated output .
* @ param removeFlowOutputRequest
* @ return Result of the RemoveFlowOutput operation returned by the service .
* @ throws BadRequestException
* The request that you submitted is not valid .
* @ throws InternalServerErrorException
* AWS Elemental MediaConnect can ' t fulfill your request because it encountered an unexpected condition .
* @ throws ForbiddenException
* You don ' t have the required permissions to perform this operation .
* @ throws NotFoundException
* AWS Elemental MediaConnect did not find the resource that you specified in the request .
* @ throws ServiceUnavailableException
* AWS Elemental MediaConnect is currently unavailable . Try again later .
* @ throws TooManyRequestsException
* You have exceeded the service request rate limit for your AWS Elemental MediaConnect account .
* @ sample AWSMediaConnect . RemoveFlowOutput
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / mediaconnect - 2018-11-14 / RemoveFlowOutput " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public RemoveFlowOutputResult removeFlowOutput ( RemoveFlowOutputRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeRemoveFlowOutput ( request ) ; |
public class JKObjectUtil { /** * Gets the all classes in package .
* @ param packageName the package name
* @ return the all classes in package */
public static List < String > getAllClassesInPackage ( String packageName ) { } } | List < String > classesNames = new Vector < > ( ) ; // create scanner and disable default filters ( that is the ' false ' argument )
final ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider ( false ) ; // add include filters which matches all the classes ( or use your own )
provider . addIncludeFilter ( new RegexPatternTypeFilter ( Pattern . compile ( ".*" ) ) ) ; // get matching classes defined in the package
final Set < BeanDefinition > classes = provider . findCandidateComponents ( packageName ) ; // this is how you can load the class type from BeanDefinition instance
for ( BeanDefinition bean : classes ) { classesNames . add ( bean . getBeanClassName ( ) ) ; } return classesNames ; |
public class AbstractQueryProtocol { /** * Reset connection state .
* < ol >
* < li > Transaction will be rollback < / li >
* < li > transaction isolation will be reset < / li >
* < li > user variables will be removed < / li >
* < li > sessions variables will be reset to global values < / li >
* < / ol >
* @ throws SQLException if command failed */
@ Override public void reset ( ) throws SQLException { } } | cmdPrologue ( ) ; try { writer . startPacket ( 0 ) ; writer . write ( COM_RESET_CONNECTION ) ; writer . flush ( ) ; getResult ( new Results ( ) ) ; // clear prepare statement cache
if ( options . cachePrepStmts && options . useServerPrepStmts ) { serverPrepareStatementCache . clear ( ) ; } } catch ( SQLException sqlException ) { throw logQuery . exceptionWithQuery ( "COM_RESET_CONNECTION failed." , sqlException , explicitClosed ) ; } catch ( IOException e ) { throw handleIoException ( e ) ; } |
public class ThymeleafCall { /** * Render the template to a String
* @ return */
public String process ( ) { } } | Timer . Context timer = calls . time ( ) ; try { return engine . process ( name , context ) ; } catch ( Throwable e ) { failures . mark ( ) ; throw e ; } finally { timer . stop ( ) ; } |
public class RtfFont { /** * Writes the font beginning
* @ param result The < code > OutputStream < / code > to write to .
* @ throws IOException On i / o errors . */
public void writeBegin ( final OutputStream result ) throws IOException { } } | if ( this . fontNumber != Font . UNDEFINED ) { result . write ( RtfFontList . FONT_NUMBER ) ; result . write ( intToByteArray ( fontNumber ) ) ; } if ( this . fontSize != Font . UNDEFINED ) { result . write ( FONT_SIZE ) ; result . write ( intToByteArray ( fontSize * 2 ) ) ; } if ( this . fontStyle != UNDEFINED ) { if ( ( fontStyle & STYLE_BOLD ) == STYLE_BOLD ) { result . write ( FONT_BOLD ) ; } if ( ( fontStyle & STYLE_ITALIC ) == STYLE_ITALIC ) { result . write ( FONT_ITALIC ) ; } if ( ( fontStyle & STYLE_UNDERLINE ) == STYLE_UNDERLINE ) { result . write ( FONT_UNDERLINE ) ; } if ( ( fontStyle & STYLE_STRIKETHROUGH ) == STYLE_STRIKETHROUGH ) { result . write ( FONT_STRIKETHROUGH ) ; } if ( ( fontStyle & STYLE_HIDDEN ) == STYLE_HIDDEN ) { result . write ( FONT_HIDDEN ) ; } if ( ( fontStyle & STYLE_DOUBLE_STRIKETHROUGH ) == STYLE_DOUBLE_STRIKETHROUGH ) { result . write ( FONT_DOUBLE_STRIKETHROUGH ) ; result . write ( intToByteArray ( 1 ) ) ; } if ( ( fontStyle & STYLE_SHADOW ) == STYLE_SHADOW ) { result . write ( FONT_SHADOW ) ; } if ( ( fontStyle & STYLE_OUTLINE ) == STYLE_OUTLINE ) { result . write ( FONT_OUTLINE ) ; } if ( ( fontStyle & STYLE_EMBOSSED ) == STYLE_EMBOSSED ) { result . write ( FONT_EMBOSSED ) ; } if ( ( fontStyle & STYLE_ENGRAVED ) == STYLE_ENGRAVED ) { result . write ( FONT_ENGRAVED ) ; } } if ( color != null ) { color . writeBegin ( result ) ; } |
public class TaskTemplateCache { /** * Return the latest task id for the given logical ID */
public static TaskTemplate getTaskTemplate ( String logicalId ) { } } | for ( int i = 0 ; i < taskVoCache . size ( ) ; i ++ ) { TaskTemplate task = taskVoCache . get ( i ) ; if ( logicalId . equals ( task . getLogicalId ( ) ) ) { return task ; } } return null ; |
public class DeepWalk { /** * Initialize the DeepWalk model with a given graph . */
public void initialize ( IGraph < V , E > graph ) { } } | int nVertices = graph . numVertices ( ) ; int [ ] degrees = new int [ nVertices ] ; for ( int i = 0 ; i < nVertices ; i ++ ) degrees [ i ] = graph . getVertexDegree ( i ) ; initialize ( degrees ) ; |
public class ScriptPluginProviderLoader { /** * Return the version string metadata value for the plugin file , or null if it is not available or could not
* loaded
* @ param file file
* @ return version string */
static String getVersionForFile ( final File file ) { } } | try { final PluginMeta pluginMeta = loadMeta ( file ) ; return pluginMeta . getVersion ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return null ; |
public class ResourceModelFactory { /** * Factory method to create a new { @ link StringResourceModel } from the given resource key and
* given component .
* @ param resourceKey
* the resource key
* @ param component
* the component
* @ return a new { @ link StringResourceModel } as an { @ link IModel } */
public static IModel < String > newResourceModel ( final String resourceKey , final Component component ) { } } | return newResourceModel ( resourceKey , component , null , "" ) ; |
public class GroovyShell { /** * Evaluates some script against the current Binding and returns the result
* @ param scriptText the text of the script
* @ param fileName is the logical file name of the script ( which is used to create the class name of the script ) */
public Object evaluate ( String scriptText , String fileName ) throws CompilationFailedException { } } | return evaluate ( scriptText , fileName , DEFAULT_CODE_BASE ) ; |
public class StringUtils { /** * < p > Strips any of a set of characters from the start and end of every
* String in an array . < / p >
* < p > Whitespace is defined by { @ link CharUtils # isWhitespace ( char ) } . < / p >
* < p > A new array is returned each time , except for length zero .
* A { @ code null } array will return { @ code null } .
* An empty array will return itself .
* A { @ code null } array entry will be ignored .
* A { @ code null } stripChars will strip whitespace as defined by
* { @ link CharUtils # isWhitespace ( char ) } . < / p >
* < pre >
* StringUtils . stripAll ( null , * ) = null
* StringUtils . stripAll ( [ ] , * ) = [ ]
* StringUtils . stripAll ( [ " abc " , " abc " ] , null ) = [ " abc " , " abc " ]
* StringUtils . stripAll ( [ " abc " , null ] , null ) = [ " abc " , null ]
* StringUtils . stripAll ( [ " abc " , null ] , " yz " ) = [ " abc " , null ]
* StringUtils . stripAll ( [ " yabcz " , null ] , " yz " ) = [ " abc " , null ]
* < / pre >
* @ param strs the array to remove characters from , may be null
* @ param stripChars the characters to remove , null treated as whitespace
* @ return the stripped Strings , { @ code null } if null array input */
public static String [ ] stripAll ( final String [ ] strs , final String stripChars ) { } } | int strsLen ; if ( strs == null || ( strsLen = strs . length ) == 0 ) { return strs ; } final String [ ] newArr = new String [ strsLen ] ; for ( int i = 0 ; i < strsLen ; i ++ ) { newArr [ i ] = strip ( strs [ i ] , stripChars ) ; } return newArr ; |
public class ComputeExample { /** * List addresses , Insert an address , and then delete the address . Use ResourceNames in the
* request objects . */
public static void main ( String [ ] args ) throws IOException { } } | AddressClient client = createCredentialedClient ( ) ; System . out . println ( "Running with Gapic Client." ) ; AddressClient . ListAddressesPagedResponse listResponse = listAddresses ( client ) ; verifyListAddressWithGets ( client , listResponse ) ; System . out . println ( "Running with Gapic Client and Resource Name." ) ; String newAddressName = "new_address_name" ; System . out . println ( "Inserting address:" ) ; insertNewAddressJustClient ( client , newAddressName ) ; listAddresses ( client ) ; System . out . println ( "Deleting address:" ) ; Operation deleteResponse = client . deleteAddress ( ProjectRegionAddressName . of ( newAddressName , PROJECT_NAME , REGION ) ) ; System . out . format ( "Result of delete: %s\n" , deleteResponse . toString ( ) ) ; int sleepTimeInSeconds = 3 ; System . out . format ( "Waiting %d seconds for server to update...\n" , sleepTimeInSeconds ) ; // Wait for the delete operation to finish on the server .
try { TimeUnit . SECONDS . sleep ( sleepTimeInSeconds ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } listAddresses ( client ) ; |
public class SpaceResource { /** * Provides a listing of all spaces for a customer . Open spaces are
* always included in the list , closed spaces are included based
* on user authorization .
* @ param storeID
* @ return XML listing of spaces */
public String getSpaces ( String storeID ) throws ResourceException { } } | Element spacesElem = new Element ( "spaces" ) ; try { StorageProvider storage = storageProviderFactory . getStorageProvider ( storeID ) ; Iterator < String > spaces = storage . getSpaces ( ) ; while ( spaces . hasNext ( ) ) { String spaceID = spaces . next ( ) ; Element spaceElem = new Element ( "space" ) ; spaceElem . setAttribute ( "id" , spaceID ) ; spacesElem . addContent ( spaceElem ) ; } } catch ( Exception e ) { storageProviderFactory . expireStorageProvider ( storeID ) ; throw new ResourceException ( "Error attempting to build spaces XML" , e ) ; } Document doc = new Document ( spacesElem ) ; XMLOutputter xmlConverter = new XMLOutputter ( ) ; return xmlConverter . outputString ( doc ) ; |
public class BasicCastUtils { /** * Check if objects have equals types , even if they are primitive */
public static boolean areEquals ( final Class < ? > firstClass , final Class < ? > secondClass ) { } } | final boolean isFirstShort = firstClass . isAssignableFrom ( Short . class ) ; final boolean isSecondShort = secondClass . isAssignableFrom ( Short . class ) ; if ( isFirstShort && isSecondShort || isFirstShort && secondClass . equals ( short . class ) || firstClass . equals ( short . class ) && isSecondShort ) return true ; final boolean isFirstByte = firstClass . isAssignableFrom ( Byte . class ) ; final boolean isSecondByte = secondClass . isAssignableFrom ( Byte . class ) ; if ( isFirstByte && isSecondByte || isFirstByte && secondClass . equals ( byte . class ) || firstClass . equals ( byte . class ) && isSecondByte ) return true ; final boolean isFirstInt = firstClass . isAssignableFrom ( Integer . class ) ; final boolean isSecondInt = secondClass . isAssignableFrom ( Integer . class ) ; if ( isFirstInt && isSecondInt || isFirstInt && secondClass . equals ( int . class ) || firstClass . equals ( int . class ) && isSecondInt ) return true ; final boolean isFirstLong = firstClass . isAssignableFrom ( Long . class ) ; final boolean isSecondLong = secondClass . isAssignableFrom ( Long . class ) ; if ( isFirstLong && isSecondLong || isFirstLong && secondClass . equals ( long . class ) || firstClass . equals ( long . class ) && isSecondLong ) return true ; final boolean isFirstDouble = firstClass . isAssignableFrom ( Double . class ) ; final boolean isSecondDouble = secondClass . isAssignableFrom ( Double . class ) ; if ( isFirstDouble && isSecondDouble || isFirstDouble && secondClass . equals ( double . class ) || firstClass . equals ( double . class ) && isSecondDouble ) return true ; final boolean isFirstFloat = firstClass . isAssignableFrom ( Float . class ) ; final boolean isSecondFloat = secondClass . isAssignableFrom ( Float . class ) ; if ( isFirstFloat && isSecondFloat || isFirstFloat && secondClass . equals ( float . class ) || firstClass . equals ( float . class ) && isSecondFloat ) return true ; final boolean isFirstChar = firstClass . isAssignableFrom ( Character . class ) ; final boolean isSecondChar = secondClass . isAssignableFrom ( Character . class ) ; if ( isFirstChar && isSecondChar || isFirstChar && secondClass . equals ( char . class ) || firstClass . equals ( char . class ) && isSecondChar ) return true ; final boolean isFirstBool = firstClass . isAssignableFrom ( Boolean . class ) ; final boolean isSecondBool = secondClass . isAssignableFrom ( Boolean . class ) ; if ( isFirstBool && isSecondBool || isFirstChar && secondClass . equals ( boolean . class ) || firstClass . equals ( boolean . class ) && isSecondChar ) return true ; return firstClass . equals ( secondClass ) ; |
public class JcrServiceFactory { /** * - - - - - < factories > - - - */
private Map < String , JcrRepository > loadRepositories ( ) { } } | Map < String , JcrRepository > list = new HashMap < > ( ) ; Set < String > names = RepositoryManager . getJcrRepositoryNames ( ) ; for ( String repositoryId : names ) { try { Repository repository = RepositoryManager . getRepository ( repositoryId ) ; list . put ( repositoryId , new JcrMsRepository ( repository , pathManager , typeManager , typeHandlerManager ) ) ; log . debug ( "--- loaded repository " + repositoryId ) ; } catch ( NoSuchRepositoryException e ) { // should never happen ;
} } return list ; |
public class CharacterApi { /** * Character affiliation Bulk lookup of character IDs to corporation ,
* alliance and faction - - - This route is cached for up to 3600 seconds
* @ param requestBody
* The character IDs to fetch affiliations for . All characters
* must exist , or none will be returned ( required )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ return List & lt ; CharacterAffiliationResponse & gt ;
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public List < CharacterAffiliationResponse > postCharactersAffiliation ( List < Integer > requestBody , String datasource ) throws ApiException { } } | ApiResponse < List < CharacterAffiliationResponse > > resp = postCharactersAffiliationWithHttpInfo ( requestBody , datasource ) ; return resp . getData ( ) ; |
public class ServiceRegistry { /** * 获取服务注册对象
* @ return 服务注册信息保存者 */
@ SuppressWarnings ( "unchecked" ) public static < E > ServiceRegistry < E > getInstance ( ) { } } | if ( instance == null ) { synchronized ( ServiceRegistry . class ) { if ( instance == null ) { instance = new ServiceRegistry < E > ( ) ; } } } return instance ; |
public class QDate { /** * Returns the week in the year . */
public int getWeek ( ) { } } | int dow4th = ( int ) ( ( _dayOfEpoch - _dayOfYear + 3 ) % 7 + 10 ) % 7 ; int ww1monday = 3 - dow4th ; if ( _dayOfYear < ww1monday ) return 53 ; int week = ( _dayOfYear - ww1monday ) / 7 + 1 ; if ( _dayOfYear >= 360 ) { int days = 365 + ( _isLeapYear ? 1 : 0 ) ; long nextNewYear = ( _dayOfEpoch - _dayOfYear + days ) ; int dowNext4th = ( int ) ( ( nextNewYear + 3 ) % 7 + 10 ) % 7 ; int nextWw1Monday = 3 - dowNext4th ; if ( days <= _dayOfYear - nextWw1Monday ) return 1 ; } return week ; |
public class Matrix3d { /** * / * ( non - Javadoc )
* @ see org . joml . Matrix3dc # positiveX ( org . joml . Vector3d ) */
public Vector3d positiveX ( Vector3d dir ) { } } | dir . x = m11 * m22 - m12 * m21 ; dir . y = m02 * m21 - m01 * m22 ; dir . z = m01 * m12 - m02 * m11 ; return dir . normalize ( dir ) ; |
public class HtmlRendererUtils { /** * Renders a html string type attribute . If the value retrieved from the component
* property is " " , the attribute is rendered .
* @ param writer
* @ param component
* @ param componentProperty
* @ param htmlAttrName
* @ return
* @ throws IOException */
public static final boolean renderHTMLStringPreserveEmptyAttribute ( ResponseWriter writer , UIComponent component , String componentProperty , String htmlAttrName ) throws IOException { } } | String value = ( String ) component . getAttributes ( ) . get ( componentProperty ) ; if ( ! isDefaultStringPreserveEmptyAttributeValue ( value ) ) { writer . writeAttribute ( htmlAttrName , value , componentProperty ) ; return true ; } return false ; |
public class CreateUserPoolRequest { /** * Specifies whether email addresses or phone numbers can be specified as usernames when a user signs up .
* @ param usernameAttributes
* Specifies whether email addresses or phone numbers can be specified as usernames when a user signs up .
* @ see UsernameAttributeType */
public void setUsernameAttributes ( java . util . Collection < String > usernameAttributes ) { } } | if ( usernameAttributes == null ) { this . usernameAttributes = null ; return ; } this . usernameAttributes = new java . util . ArrayList < String > ( usernameAttributes ) ; |
public class AWSOrganizationsClient { /** * Retrieves information about a previously requested handshake . The handshake ID comes from the response to the
* original < a > InviteAccountToOrganization < / a > operation that generated the handshake .
* You can access handshakes that are ACCEPTED , DECLINED , or CANCELED for only 30 days after they change to that
* state . They are then deleted and no longer accessible .
* This operation can be called from any account in the organization .
* @ param describeHandshakeRequest
* @ return Result of the DescribeHandshake operation returned by the service .
* @ throws AccessDeniedException
* You don ' t have permissions to perform the requested operation . The user or role that is making the
* request must have at least one IAM permissions policy attached that grants the required permissions . For
* more information , see < a href = " https : / / docs . aws . amazon . com / IAM / latest / UserGuide / access . html " > Access
* Management < / a > in the < i > IAM User Guide < / i > .
* @ throws ConcurrentModificationException
* The target of the operation is currently being modified by a different request . Try again later .
* @ throws HandshakeNotFoundException
* We can ' t find a handshake with the < code > HandshakeId < / code > that you specified .
* @ throws InvalidInputException
* The requested operation failed because you provided invalid values for one or more of the request
* parameters . This exception includes a reason that contains additional information about the violated
* limit : < / p > < note >
* Some of the reasons in the following list might not be applicable to this specific API or operation :
* < / note >
* < ul >
* < li >
* IMMUTABLE _ POLICY : You specified a policy that is managed by AWS and can ' t be modified .
* < / li >
* < li >
* INPUT _ REQUIRED : You must include a value for all required parameters .
* < / li >
* < li >
* INVALID _ ENUM : You specified a value that isn ' t valid for that parameter .
* < / li >
* < li >
* INVALID _ FULL _ NAME _ TARGET : You specified a full name that contains invalid characters .
* < / li >
* < li >
* INVALID _ LIST _ MEMBER : You provided a list to a parameter that contains at least one invalid value .
* < / li >
* < li >
* INVALID _ PARTY _ TYPE _ TARGET : You specified the wrong type of entity ( account , organization , or email ) as a
* party .
* < / li >
* < li >
* INVALID _ PAGINATION _ TOKEN : Get the value for the < code > NextToken < / code > parameter from the response to a
* previous call of the operation .
* < / li >
* < li >
* INVALID _ PATTERN : You provided a value that doesn ' t match the required pattern .
* < / li >
* < li >
* INVALID _ PATTERN _ TARGET _ ID : You specified a policy target ID that doesn ' t match the required pattern .
* < / li >
* < li >
* INVALID _ ROLE _ NAME : You provided a role name that isn ' t valid . A role name can ' t begin with the reserved
* prefix < code > AWSServiceRoleFor < / code > .
* < / li >
* < li >
* INVALID _ SYNTAX _ ORGANIZATION _ ARN : You specified an invalid Amazon Resource Name ( ARN ) for the
* organization .
* < / li >
* < li >
* INVALID _ SYNTAX _ POLICY _ ID : You specified an invalid policy ID .
* < / li >
* < li >
* MAX _ FILTER _ LIMIT _ EXCEEDED : You can specify only one filter parameter for the operation .
* < / li >
* < li >
* MAX _ LENGTH _ EXCEEDED : You provided a string parameter that is longer than allowed .
* < / li >
* < li >
* MAX _ VALUE _ EXCEEDED : You provided a numeric parameter that has a larger value than allowed .
* < / li >
* < li >
* MIN _ LENGTH _ EXCEEDED : You provided a string parameter that is shorter than allowed .
* < / li >
* < li >
* MIN _ VALUE _ EXCEEDED : You provided a numeric parameter that has a smaller value than allowed .
* < / li >
* < li >
* MOVING _ ACCOUNT _ BETWEEN _ DIFFERENT _ ROOTS : You can move an account only between entities in the same root .
* < / li >
* @ throws ServiceException
* AWS Organizations can ' t complete your request because of an internal service error . Try again later .
* @ throws TooManyRequestsException
* You ' ve sent too many requests in too short a period of time . The limit helps protect against
* denial - of - service attacks . Try again later . < / p >
* For information on limits that affect Organizations , see < a
* href = " https : / / docs . aws . amazon . com / organizations / latest / userguide / orgs _ reference _ limits . html " > Limits of
* AWS Organizations < / a > in the < i > AWS Organizations User Guide < / i > .
* @ sample AWSOrganizations . DescribeHandshake
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / organizations - 2016-11-28 / DescribeHandshake "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DescribeHandshakeResult describeHandshake ( DescribeHandshakeRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeHandshake ( request ) ; |
public class AsyncConditions { /** * Waits until all evaluate blocks have completed or the specified timeout
* ( in seconds ) expires . If one of the evaluate blocks throws an exception , it is rethrown
* from this method .
* @ param seconds the timeout ( in seconds )
* @ throws InterruptedException if the calling thread is interrupted
* @ throws Throwable the first exception thrown by an evaluate block */
public void await ( double seconds ) throws Throwable { } } | latch . await ( ( long ) ( seconds * 1000 ) , TimeUnit . MILLISECONDS ) ; if ( ! exceptions . isEmpty ( ) ) throw exceptions . poll ( ) ; long pendingEvalBlocks = latch . getCount ( ) ; if ( pendingEvalBlocks > 0 ) { String msg = String . format ( "Async conditions timed out " + "after %1.2f seconds; %d out of %d evaluate blocks did not complete in time" , seconds , pendingEvalBlocks , numEvalBlocks ) ; throw new SpockTimeoutError ( seconds , msg ) ; } |
public class gslbvserver_binding { /** * Use this API to fetch gslbvserver _ binding resource of given name . */
public static gslbvserver_binding get ( nitro_service service , String name ) throws Exception { } } | gslbvserver_binding obj = new gslbvserver_binding ( ) ; obj . set_name ( name ) ; gslbvserver_binding response = ( gslbvserver_binding ) obj . get_resource ( service ) ; return response ; |
public class EntityUrl { /** * Get Resource Url for DeleteEntity
* @ param entityListFullName The full name of the EntityList including namespace in name @ nameSpace format
* @ param id Unique identifier of the customer segment to retrieve .
* @ return String Resource Url */
public static MozuUrl deleteEntityUrl ( String entityListFullName , String id ) { } } | UrlFormatter formatter = new UrlFormatter ( "/api/platform/entitylists/{entityListFullName}/entities/{id}" ) ; formatter . formatUrl ( "entityListFullName" , entityListFullName ) ; formatter . formatUrl ( "id" , id ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; |
public class DisksInner { /** * Gets information about a disk .
* @ param resourceGroupName The name of the resource group .
* @ param diskName The name of the managed disk that is being created . The name can ' t be changed after the disk is created . Supported characters for the name are a - z , A - Z , 0-9 and _ . The maximum name length is 80 characters .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the DiskInner object */
public Observable < DiskInner > getByResourceGroupAsync ( String resourceGroupName , String diskName ) { } } | return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , diskName ) . map ( new Func1 < ServiceResponse < DiskInner > , DiskInner > ( ) { @ Override public DiskInner call ( ServiceResponse < DiskInner > response ) { return response . body ( ) ; } } ) ; |
public class ReferenceBasedOutlierDetection { /** * Update the density estimates for each object .
* @ param rbod _ score Density storage
* @ param referenceDists Distances from current reference point */
protected void updateDensities ( WritableDoubleDataStore rbod_score , DoubleDBIDList referenceDists ) { } } | DoubleDBIDListIter it = referenceDists . iter ( ) ; for ( int l = 0 ; l < referenceDists . size ( ) ; l ++ ) { double density = computeDensity ( referenceDists , it , l ) ; // computeDensity modified the iterator , reset :
it . seek ( l ) ; // NaN indicates the first run .
if ( ! ( density > rbod_score . doubleValue ( it ) ) ) { rbod_score . putDouble ( it , density ) ; } } |
public class ListAvailableManagementCidrRangesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListAvailableManagementCidrRangesRequest listAvailableManagementCidrRangesRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listAvailableManagementCidrRangesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listAvailableManagementCidrRangesRequest . getManagementCidrRangeConstraint ( ) , MANAGEMENTCIDRRANGECONSTRAINT_BINDING ) ; protocolMarshaller . marshall ( listAvailableManagementCidrRangesRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( listAvailableManagementCidrRangesRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class SpinWait { /** * / * ( non - Javadoc )
* @ see cyclops2 . async . wait . WaitStrategy # offer ( cyclops2 . async . wait . WaitStrategy . Offerable ) */
@ Override public boolean offer ( final WaitStrategy . Offerable o ) throws InterruptedException { } } | while ( ! o . offer ( ) ) { LockSupport . parkNanos ( 1l ) ; } return true ; |
public class CmsSourceSearchFilesDialog { /** * Returns a list of list items from a list of resources . < p >
* @ return a list of { @ link CmsListItem } objects */
@ Override protected List < CmsListItem > getListItems ( ) { } } | List < CmsListItem > ret = new ArrayList < CmsListItem > ( ) ; applyColumnVisibilities ( ) ; CmsHtmlList list = getList ( ) ; CmsListColumnDefinition colPermissions = list . getMetadata ( ) . getColumnDefinition ( A_CmsListExplorerDialog . LIST_COLUMN_PERMISSIONS ) ; boolean showPermissions = ( colPermissions . isVisible ( ) || colPermissions . isPrintable ( ) ) ; CmsListColumnDefinition colDateLastMod = list . getMetadata ( ) . getColumnDefinition ( A_CmsListExplorerDialog . LIST_COLUMN_DATELASTMOD ) ; boolean showDateLastMod = ( colDateLastMod . isVisible ( ) || colDateLastMod . isPrintable ( ) ) ; CmsListColumnDefinition colUserLastMod = list . getMetadata ( ) . getColumnDefinition ( A_CmsListExplorerDialog . LIST_COLUMN_USERLASTMOD ) ; boolean showUserLastMod = ( colUserLastMod . isVisible ( ) || colUserLastMod . isPrintable ( ) ) ; CmsListColumnDefinition colDateCreate = list . getMetadata ( ) . getColumnDefinition ( A_CmsListExplorerDialog . LIST_COLUMN_DATECREATE ) ; boolean showDateCreate = ( colDateCreate . isVisible ( ) || colDateCreate . isPrintable ( ) ) ; CmsListColumnDefinition colUserCreate = list . getMetadata ( ) . getColumnDefinition ( A_CmsListExplorerDialog . LIST_COLUMN_USERCREATE ) ; boolean showUserCreate = ( colUserCreate . isVisible ( ) || colUserCreate . isPrintable ( ) ) ; CmsListColumnDefinition colDateRel = list . getMetadata ( ) . getColumnDefinition ( A_CmsListExplorerDialog . LIST_COLUMN_DATEREL ) ; boolean showDateRel = ( colDateRel . isVisible ( ) || colDateRel . isPrintable ( ) ) ; CmsListColumnDefinition colDateExp = list . getMetadata ( ) . getColumnDefinition ( A_CmsListExplorerDialog . LIST_COLUMN_DATEEXP ) ; boolean showDateExp = ( colDateExp . isVisible ( ) || colDateExp . isPrintable ( ) ) ; CmsListColumnDefinition colState = list . getMetadata ( ) . getColumnDefinition ( A_CmsListExplorerDialog . LIST_COLUMN_STATE ) ; boolean showState = ( colState . isVisible ( ) || colState . isPrintable ( ) ) ; CmsListColumnDefinition colLockedBy = list . getMetadata ( ) . getColumnDefinition ( A_CmsListExplorerDialog . LIST_COLUMN_LOCKEDBY ) ; boolean showLockedBy = ( colLockedBy . isVisible ( ) || colLockedBy . isPrintable ( ) ) ; CmsListColumnDefinition colSite = list . getMetadata ( ) . getColumnDefinition ( A_CmsListExplorerDialog . LIST_COLUMN_SITE ) ; boolean showSite = ( colSite . isVisible ( ) || colSite . isPrintable ( ) ) ; // get content
Iterator < CmsResource > itRes = m_files . iterator ( ) ; while ( itRes . hasNext ( ) ) { CmsResource resource = itRes . next ( ) ; CmsListItem item = createResourceListItem ( resource , list , showPermissions , showDateLastMod , showUserLastMod , showDateCreate , showUserCreate , showDateRel , showDateExp , showState , showLockedBy , showSite ) ; ret . add ( item ) ; } return ret ; |
public class OmemoManager { /** * Distrust the fingerprint / OmemoDevice tuple .
* The fingerprint must be the lowercase , hexadecimal fingerprint of the identityKey of the device and must
* be of length 64.
* @ param device device
* @ param fingerprint fingerprint */
public void distrustOmemoIdentity ( OmemoDevice device , OmemoFingerprint fingerprint ) { } } | if ( trustCallback == null ) { throw new IllegalStateException ( "No TrustCallback set." ) ; } trustCallback . setTrust ( device , fingerprint , TrustState . untrusted ) ; |
public class EmailAddressValidator { /** * Set the global " check MX record " flag .
* @ param bPerformMXRecordCheck
* < code > true < / code > to enable , < code > false < / code > otherwise . */
public static void setPerformMXRecordCheck ( final boolean bPerformMXRecordCheck ) { } } | s_aPerformMXRecordCheck . set ( bPerformMXRecordCheck ) ; if ( LOGGER . isInfoEnabled ( ) ) LOGGER . info ( "Email address record check is " + ( bPerformMXRecordCheck ? "enabled" : "disabled" ) ) ; |
public class SectionLoader { /** * Fetches the { @ link SectionHeader } of the section the data directory entry
* for the dataDirKey points into .
* Returns absent if the data directory doesn ' t exist .
* @ param dataDirKey
* the data directory key
* @ return the section table entry the data directory entry of that key
* points into or absent if there is no data dir entry for the key
* available */
public Optional < SectionHeader > maybeGetSectionHeader ( DataDirectoryKey dataDirKey ) { } } | Optional < DataDirEntry > dataDir = optHeader . maybeGetDataDirEntry ( dataDirKey ) ; if ( dataDir . isPresent ( ) ) { return dataDir . get ( ) . maybeGetSectionTableEntry ( table ) ; } logger . warn ( "data dir entry " + dataDirKey + " doesn't exist" ) ; return Optional . absent ( ) ; |
public class Blob { /** * Returns an { @ link InputStream } for this blob content . */
public InputStream asInputStream ( ) { } } | final ByteBuffer byteBuffer = asReadOnlyByteBuffer ( ) ; return new InputStream ( ) { @ Override public int read ( ) { return ! byteBuffer . hasRemaining ( ) ? - 1 : byteBuffer . get ( ) & 0xFF ; } } ; |
public class TransactionSnippets { /** * [ VARIABLE " my _ second _ key _ name " ] */
public List < Entity > getMultiple ( String firstKeyName , String secondKeyName ) { } } | Datastore datastore = transaction . getDatastore ( ) ; // TODO change so that it ' s not necessary to hold the entities in a list for integration testing
// [ START getMultiple ]
KeyFactory keyFactory = datastore . newKeyFactory ( ) . setKind ( "MyKind" ) ; Key firstKey = keyFactory . newKey ( firstKeyName ) ; Key secondKey = keyFactory . newKey ( secondKeyName ) ; Iterator < Entity > entitiesIterator = transaction . get ( firstKey , secondKey ) ; List < Entity > entities = Lists . newArrayList ( ) ; while ( entitiesIterator . hasNext ( ) ) { Entity entity = entitiesIterator . next ( ) ; // do something with the entity
entities . add ( entity ) ; } transaction . commit ( ) ; // [ END getMultiple ]
return entities ; |
public class DevicesManagementApi { /** * Returns the all the tasks for a device type .
* Returns the all the tasks for a device type .
* @ param dtid Device Type ID . ( required )
* @ param count Max results count . ( optional )
* @ param offset Result starting offset . ( optional )
* @ param status Status filter . Comma - separated statuses . ( optional )
* @ param order Sort results by a field . Valid fields : createdOn . ( optional )
* @ param sort Sort order . Valid values : asc or desc . ( optional )
* @ return ApiResponse & lt ; TaskListEnvelope & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < TaskListEnvelope > getTasksWithHttpInfo ( String dtid , Integer count , Integer offset , String status , String order , String sort ) throws ApiException { } } | com . squareup . okhttp . Call call = getTasksValidateBeforeCall ( dtid , count , offset , status , order , sort , null , null ) ; Type localVarReturnType = new TypeToken < TaskListEnvelope > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class Reflections { /** * Tries to load a class using the specified ResourceLoader . Returns null if the class is not found .
* @ param className
* @ param resourceLoader
* @ return the loaded class or null if the given class cannot be loaded */
public static < T > Class < T > loadClass ( String className , ResourceLoader resourceLoader ) { } } | try { return cast ( resourceLoader . classForName ( className ) ) ; } catch ( ResourceLoadingException e ) { return null ; } catch ( SecurityException e ) { return null ; } |
public class Alias { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . runtime . SIMPAliasControllable # getMaxReliability ( ) */
public Reliability getMaxReliability ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getMaxReliability" ) ; Reliability maxRel = aliasDest . getMaxReliability ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getMaxReliability" , maxRel ) ; return maxRel ; |
public class DefaultHardwareClock { /** * / * ( non - Javadoc )
* @ see org . fishwife . jrugged . clocks . HardwareClock # getGranularity ( ) */
public long getGranularity ( ) { } } | long now = env . currentTimeMillis ( ) ; long curr = lastSampleTime . get ( ) ; if ( now - curr > periodMillis && lastSampleTime . compareAndSet ( curr , now ) ) { samples [ sampleIndex ] = sampleGranularity ( ) ; sampleIndex = ( sampleIndex + 1 ) % samples . length ; long max = 0L ; for ( long sample : samples ) { if ( sample > max ) max = sample ; } maxGranularity = max ; } return maxGranularity ; |
public class ProfileSummaryBuilder { /** * Build the summary for the enums in the package .
* @ param node the XML element that specifies which components to document
* @ param packageSummaryContentTree the tree to which the enum summary will
* be added */
public void buildEnumSummary ( XMLNode node , Content packageSummaryContentTree ) { } } | String enumTableSummary = configuration . getText ( "doclet.Member_Table_Summary" , configuration . getText ( "doclet.Enum_Summary" ) , configuration . getText ( "doclet.enums" ) ) ; String [ ] enumTableHeader = new String [ ] { configuration . getText ( "doclet.Enum" ) , configuration . getText ( "doclet.Description" ) } ; ClassDoc [ ] enums = pkg . enums ( ) ; if ( enums . length > 0 ) { profileWriter . addClassesSummary ( enums , configuration . getText ( "doclet.Enum_Summary" ) , enumTableSummary , enumTableHeader , packageSummaryContentTree ) ; } |
public class Module { /** * < p > This will add items to the Gosu classpath , but only under very specific circumstances .
* < p > If both of the following conditions are met :
* < ul >
* < li > The JAR ' s manifest contains a Class - Path entry < / li >
* < li > The Class - Path entry contains a space - delimited list of URIs < / li >
* < / ul >
* < p > Then the entries will be parsed and added to the Gosu classpath .
* < p > This logic also handles strange libraries packaged pre - Maven such as xalan : xalan : 2.4.1
* < p > The xalan JAR above has a Class - Path attribute referencing the following :
* < pre >
* Class - Path : xercesImpl . jar xml - apis . jar
* < / pre >
* These unqualified references should have been resolved by the build tooling , and if we try to interfere and resolve
* the references , we may cause classpath confusion . Therefore any Class - Path entry not resolvable to an absolute
* path on disk ( and , therefore , can be listed as a URL ) will be skipped .
* @ see java . util . jar . Attributes . Name # CLASS _ PATH
* @ param classpath The module ' s Java classpath
* @ return The original classpath , possibly with dependencies listed in JAR manifests Class - Path extracted and explicitly listed */
private List < IDirectory > addFromManifestClassPath ( List < IDirectory > classpath ) { } } | if ( classpath == null ) { return classpath ; } ArrayList < IDirectory > newClasspath = new ArrayList < > ( ) ; for ( IDirectory root : classpath ) { // add the root JAR itself first , preserving ordering
if ( ! newClasspath . contains ( root ) ) { newClasspath . add ( root ) ; } if ( root instanceof JarFileDirectoryImpl ) { JarFile jarFile = ( ( JarFileDirectoryImpl ) root ) . getJarFile ( ) ; try { Manifest manifest = jarFile . getManifest ( ) ; if ( manifest != null ) { Attributes man = manifest . getMainAttributes ( ) ; String paths = man . getValue ( Attributes . Name . CLASS_PATH ) ; if ( paths != null && ! paths . isEmpty ( ) ) { // We found a Jar with a Class - Path listing .
// Note sometimes happens when running from IntelliJ where the
// classpath would otherwise make the command line to java . exe
// too long .
for ( String j : paths . split ( " " ) ) { // Add each of the paths to our classpath
URL url ; try { url = new URL ( j ) ; } catch ( MalformedURLException e ) { // Class - Path contained an invalid URL , skip it
continue ; } File dirOrJar = new File ( url . toURI ( ) ) ; IDirectory idir = CommonServices . getFileSystem ( ) . getIDirectory ( dirOrJar ) ; if ( ! newClasspath . contains ( idir ) ) { newClasspath . add ( idir ) ; } } } } } catch ( Exception e ) { throw GosuExceptionUtil . forceThrow ( e ) ; } } } return newClasspath ; |
public class MongodbQueue { /** * { @ inheritDoc } */
@ Override public void finish ( IQueueMessage < ID , DATA > msg ) { } } | if ( ! isEphemeralDisabled ( ) ) { getCollection ( ) . deleteOne ( Filters . and ( Filters . ne ( COLLECTION_FIELD_EPHEMERAL_KEY , null ) , Filters . eq ( COLLECTION_FIELD_ID , msg . getId ( ) ) ) ) ; } |
public class MyAuthHandler { /** * Checks whether the request has right permission to access the service . In this example , a { @ code Cookie }
* header is used to hold the information . If a { @ code username } key exists in the { @ code Cookie } header ,
* the request is treated as authenticated . */
@ Override public CompletionStage < Boolean > authorize ( ServiceRequestContext ctx , HttpRequest data ) { } } | final String cookie = data . headers ( ) . get ( HttpHeaderNames . COOKIE ) ; if ( cookie == null ) { return CompletableFuture . completedFuture ( false ) ; } final boolean authenticated = ServerCookieDecoder . LAX . decode ( cookie ) . stream ( ) . anyMatch ( c -> "username" . equals ( c . name ( ) ) && ! Strings . isNullOrEmpty ( c . value ( ) ) ) ; return CompletableFuture . completedFuture ( authenticated ) ; |
public class ImportApi { /** * Validate the import file .
* Performs pre - validation on the specified CSV / XLS file .
* @ param csvfile The CSV / XLS file to import . ( optional )
* @ return ApiSuccessResponse
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiSuccessResponse validateImportFile ( File csvfile ) throws ApiException { } } | ApiResponse < ApiSuccessResponse > resp = validateImportFileWithHttpInfo ( csvfile ) ; return resp . getData ( ) ; |
public class StructrSchema { /** * Extend the current Structr schema by the elements contained in the given new schema .
* @ param app
* @ param newSchema the new schema to add to the current Structr schema
* @ throws FrameworkException
* @ throws URISyntaxException */
public static void extendDatabaseSchema ( final App app , final JsonSchema newSchema ) throws FrameworkException , URISyntaxException { } } | try ( final Tx tx = app . tx ( ) ) { newSchema . createDatabaseSchema ( app , JsonSchema . ImportMode . extend ) ; tx . success ( ) ; } |
public class Compression { /** * Returns the registered { @ code Compression } format matching the extension in the file name
* supplied , or the { @ code fallback } specified if none matches .
* @ param fileName
* the file name , not null
* @ param fallback
* the { @ code Compression } to return if none matches
* @ return the matching { @ code Compression } , or the { @ code fallback } one if none of the
* registered { @ code Compression } s matches */
@ Nullable public static Compression forFileName ( final String fileName , @ Nullable final Compression fallback ) { } } | final int index = fileName . lastIndexOf ( '.' ) ; final String extension = ( index < 0 ? fileName : fileName . substring ( index + 1 ) ) . toLowerCase ( ) ; for ( final Compression compression : register ) { final List < String > extensions = compression . fileExtensions ; if ( ! extensions . isEmpty ( ) && extensions . get ( 0 ) . equals ( extension ) ) { return compression ; } } for ( final Compression compression : register ) { if ( compression . fileExtensions . contains ( extension ) ) { return compression ; } } return fallback ; |
public class AtomicBiInteger { /** * Atomically adds the given delta to the current hi value , returning the updated hi value .
* @ param delta the delta to apply
* @ return the updated hi value */
public int addAndGetHi ( int delta ) { } } | while ( true ) { long encoded = get ( ) ; int hi = getHi ( encoded ) + delta ; long update = encodeHi ( encoded , hi ) ; if ( compareAndSet ( encoded , update ) ) return hi ; } |
public class AddAttachmentsToSetRequest { /** * One or more attachments to add to the set . The limit is 3 attachments per set , and the size limit is 5 MB per
* attachment .
* @ return One or more attachments to add to the set . The limit is 3 attachments per set , and the size limit is 5 MB
* per attachment . */
public java . util . List < Attachment > getAttachments ( ) { } } | if ( attachments == null ) { attachments = new com . amazonaws . internal . SdkInternalList < Attachment > ( ) ; } return attachments ; |
public class TemplatedProcessor { /** * - - - - - @ Templated types */
@ Override protected boolean onProcess ( Set < ? extends TypeElement > annotations , RoundEnvironment roundEnv ) { } } | List < TypeElement > deferredTypes = deferredTypeNames . stream ( ) . map ( deferred -> processingEnv . getElementUtils ( ) . getTypeElement ( deferred ) ) . collect ( Collectors . toList ( ) ) ; if ( roundEnv . processingOver ( ) ) { // This means that the previous round didn ' t generate any new sources , so we can ' t have found
// any new instances of @ Templated ; and we can ' t have any new types that are the reason a type
// was in deferredTypes .
for ( TypeElement type : deferredTypes ) { error ( type , "Did not generate @%s class for %s because it references undefined types" , Templated . class . getSimpleName ( ) , type ) ; } return false ; } Collection < ? extends Element > annotatedElements = roundEnv . getElementsAnnotatedWith ( Templated . class ) ; List < TypeElement > types = new ImmutableList . Builder < TypeElement > ( ) . addAll ( deferredTypes ) . addAll ( ElementFilter . typesIn ( annotatedElements ) ) . build ( ) ; deferredTypeNames . clear ( ) ; for ( TypeElement type : types ) { try { Templated templated = type . getAnnotation ( Templated . class ) ; validateType ( type , templated ) ; boolean isInjectable = templated . injectable ( ) == Injectable . TRUE || ( templated . injectable ( ) == Injectable . IF_DI_DETECTED && diInClasspath ( ) ) ; processType ( type , templated , isInjectable ? "@javax.inject.Inject" : "" ) ; } catch ( AbortProcessingException e ) { // We abandoned this type ; continue with the next .
} catch ( MissingTypeException e ) { // We abandoned this type , but only because we needed another type that it references and
// that other type was missing . It is possible that the missing type will be generated by
// further annotation processing , so we will try again on the next round ( perhaps failing
// again and adding it back to the list ) . We save the name of the @ Templated type rather
// than its TypeElement because it is not guaranteed that it will be represented by
// the same TypeElement on the next round .
deferredTypeNames . add ( type . getQualifiedName ( ) . toString ( ) ) ; } catch ( RuntimeException e ) { // Don ' t propagate this exception , which will confusingly crash the compiler .
// Instead , report a compiler error with the stack trace .
String trace = Throwables . getStackTraceAsString ( e ) ; error ( type , "@%s processor threw an exception: %s" , Templated . class . getSimpleName ( ) , trace ) ; } } return false ; // never claim annotation , because who knows what other processors want ? |
public class Bits { /** * Measures the number of bytes required to encode a string , taking multibyte characters into account . Measures
* strings written by { @ link DataOutput # writeUTF ( String ) } .
* @ param str the string
* @ return the number of bytes required for encoding str */
public static int sizeUTF ( String str ) { } } | int len = str != null ? str . length ( ) : 0 , utflen = 2 ; if ( len == 0 ) return utflen ; for ( int i = 0 ; i < len ; i ++ ) { int c = str . charAt ( i ) ; if ( ( c >= 0x0001 ) && ( c <= 0x007F ) ) utflen ++ ; else if ( c > 0x07FF ) utflen += 3 ; else utflen += 2 ; } return utflen ; |
public class BootstrapTools { /** * Starts an Actor System at a specific port .
* @ param configuration The Flink configuration .
* @ param listeningAddress The address to listen at .
* @ param listeningPort The port to listen at .
* @ param logger the logger to output log information .
* @ param actorSystemExecutorConfiguration configuration for the ActorSystem ' s underlying executor
* @ return The ActorSystem which has been started .
* @ throws Exception */
public static ActorSystem startActorSystem ( Configuration configuration , String listeningAddress , int listeningPort , Logger logger , ActorSystemExecutorConfiguration actorSystemExecutorConfiguration ) throws Exception { } } | return startActorSystem ( configuration , AkkaUtils . getFlinkActorSystemName ( ) , listeningAddress , listeningPort , logger , actorSystemExecutorConfiguration ) ; |
public class AbstractJaxb { /** * set data - * attribute
* < pre >
* Div div = new Div ( ) ;
* div . setData ( & quot ; foo & quot ; , & quot ; bar & quot ; ) ;
* / / you get & lt ; div data - foo = & quot ; bar & quot ; & gt ; & lt ; / div & gt ;
* < / pre >
* @ param key
* data - " key " */
public void setData ( String key , String value ) { } } | QName qn = new QName ( "data-" + key ) ; this . getOtherAttributes ( ) . put ( qn , value ) ; |
public class RegionDiskClient { /** * Creates a snapshot of this regional disk .
* < p > Sample code :
* < pre > < code >
* try ( RegionDiskClient regionDiskClient = RegionDiskClient . create ( ) ) {
* ProjectRegionDiskName disk = ProjectRegionDiskName . of ( " [ PROJECT ] " , " [ REGION ] " , " [ DISK ] " ) ;
* Snapshot snapshotResource = Snapshot . newBuilder ( ) . build ( ) ;
* Operation response = regionDiskClient . createSnapshotRegionDisk ( disk . toString ( ) , snapshotResource ) ;
* < / code > < / pre >
* @ param disk Name of the regional persistent disk to snapshot .
* @ param snapshotResource A persistent disk snapshot resource . ( = = resource _ for beta . snapshots
* = = ) ( = = resource _ for v1 . snapshots = = )
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Operation createSnapshotRegionDisk ( String disk , Snapshot snapshotResource ) { } } | CreateSnapshotRegionDiskHttpRequest request = CreateSnapshotRegionDiskHttpRequest . newBuilder ( ) . setDisk ( disk ) . setSnapshotResource ( snapshotResource ) . build ( ) ; return createSnapshotRegionDisk ( request ) ; |
public class AbstractBatchTypeResolver { /** * / * @ NonNull */
@ Override public final IResolvedTypes resolveTypes ( final /* @ Nullable */
EObject object , CancelIndicator monitor ) { } } | if ( object == null || object . eIsProxy ( ) ) { return IResolvedTypes . NULL ; } Resource resource = object . eResource ( ) ; validateResourceState ( resource ) ; if ( resource instanceof JvmMemberInitializableResource ) { ( ( JvmMemberInitializableResource ) resource ) . ensureJvmMembersInitialized ( ) ; } return doResolveTypes ( object , monitor ) ; |
public class ClassHelper { /** * Creates an array of ClassNodes using an array of classes .
* For each of the given classes a new ClassNode will be
* created
* @ param classes an array of classes used to create the ClassNodes
* @ return an array of ClassNodes
* @ see # make ( Class ) */
public static ClassNode [ ] make ( Class [ ] classes ) { } } | ClassNode [ ] cns = new ClassNode [ classes . length ] ; for ( int i = 0 ; i < cns . length ; i ++ ) { cns [ i ] = make ( classes [ i ] ) ; } return cns ; |
public class arp { /** * Use this API to fetch filtered set of arp resources .
* filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */
public static arp [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | arp obj = new arp ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; arp [ ] response = ( arp [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class JCuda { /** * < pre >
* _ _ host _ _ cudaError _ t cudaMallocManaged (
* void * * devPtr ,
* size _ t size ,
* unsigned int flags = cudaMemAttachGlobal )
* < / pre >
* < div > Allocates memory that will be automatically managed by the Unified
* Memory system . < / div > < div >
* < h6 > Description < / h6 >
* Allocates < tt > size < / tt > bytes of managed memory on the device and returns
* in < tt > * devPtr < / tt > a pointer to the allocated memory . If the device
* doesn ' t support allocating managed memory , cudaErrorNotSupported is
* returned . Support for managed memory can be queried using the device
* attribute cudaDevAttrManagedMemory . The allocated memory is suitably
* aligned for any kind of variable . The memory is not cleared . If
* < tt > size < / tt > is 0 , cudaMallocManaged returns cudaErrorInvalidValue . The
* pointer is valid on the CPU and on all GPUs in the system that support
* managed memory . All accesses to this pointer must obey the Unified Memory
* programming model .
* < tt > flags < / tt > specifies the default stream association for this
* allocation . < tt > flags < / tt > must be one of cudaMemAttachGlobal or
* cudaMemAttachHost . The default value for < tt > flags < / tt > is
* cudaMemAttachGlobal . If cudaMemAttachGlobal is specified , then this
* memory is accessible from any stream on any device . If cudaMemAttachHost
* is specified , then the allocation is created with initial visibility
* restricted to host access only ; an explicit call to
* cudaStreamAttachMemAsync will be required to enable access on the device .
* If the association is later changed via cudaStreamAttachMemAsync to a
* single stream , the default association , as specifed during
* cudaMallocManaged , is restored when that stream is destroyed . For
* _ _ managed _ _ variables , the default association is always
* cudaMemAttachGlobal . Note that destroying a stream is an asynchronous
* operation , and as a result , the change to default association won ' t
* happen until all work in the stream has completed .
* Memory allocated with cudaMallocManaged should be released with cudaFree .
* On a multi - GPU system with peer - to - peer support , where multiple GPUs
* support managed memory , the physical storage is created on the GPU which
* is active at the time cudaMallocManaged is called . All other GPUs will
* reference the data at reduced bandwidth via peer mappings over the PCIe
* bus . The Unified Memory management system does not migrate memory between
* GPUs .
* On a multi - GPU system where multiple GPUs support managed memory , but not
* all pairs of such GPUs have peer - to - peer support between them , the
* physical storage is created in ' zero - copy ' or system memory . All GPUs
* will reference the data at reduced bandwidth over the PCIe bus . In these
* circumstances , use of the environment variable , CUDA _ VISIBLE _ DEVICES , is
* recommended to restrict CUDA to only use those GPUs that have
* peer - to - peer support . Alternatively , users can also set
* CUDA _ MANAGED _ FORCE _ DEVICE _ ALLOC to a non - zero value to force the driver
* to always use device memory for physical storage . When this environment
* variable is set to a non - zero value , all devices used in that process
* that support managed memory have to be peer - to - peer compatible with each
* other . The error cudaErrorInvalidDevice will be returned if a device that
* supports managed memory is used and it is not peer - to - peer compatible
* with any of the other managed memory supporting devices that were
* previously used in that process , even if cudaDeviceReset has been called
* on those devices . These environment variables are described in the CUDA
* programming guide under the " CUDA environment variables " section .
* < / div >
* @ param devPtr The device pointer
* @ param size The size in bytes
* @ param flags The flags
* @ return cudaSuccess , cudaErrorMemoryAllocationcudaErrorNotSupported ,
* cudaErrorInvalidValue
* @ see JCuda # cudaMallocPitch
* @ see JCuda # cudaFree
* @ see JCuda # cudaMallocArray
* @ see JCuda # cudaFreeArray
* @ see JCuda # cudaMalloc3D
* @ see JCuda # cudaMalloc3DArray
* @ see JCuda # cudaMallocHost
* @ see JCuda # cudaFreeHost
* @ see JCuda # cudaHostAlloc
* @ see JCuda # cudaDeviceGetAttribute
* @ see JCuda # cudaStreamAttachMemAsync */
public static int cudaMallocManaged ( Pointer devPtr , long size , int flags ) { } } | return checkResult ( cudaMallocManagedNative ( devPtr , size , flags ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.