signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class SaturationChecker { /** * Returns the currently maximum formable bond order for this atom .
* @ param atom The atom to be checked
* @ param ac The AtomContainer that provides the context
* @ return the currently maximum formable bond order for this atom */
public double getCurrentMaxBondOrder ( IAtom atom , IAtomContainer ac ) throws CDKException { } } | IAtomType [ ] atomTypes = getAtomTypeFactory ( atom . getBuilder ( ) ) . getAtomTypes ( atom . getSymbol ( ) ) ; if ( atomTypes . length == 0 ) return 0 ; double bondOrderSum = ac . getBondOrderSum ( atom ) ; Integer hcount = atom . getImplicitHydrogenCount ( ) == CDKConstants . UNSET ? 0 : atom . getImplicitHydrogenCount ( ) ; double max = 0 ; double current = 0 ; for ( int f = 0 ; f < atomTypes . length ; f ++ ) { current = hcount + bondOrderSum ; if ( atomTypes [ f ] . getBondOrderSum ( ) - current > max ) { max = atomTypes [ f ] . getBondOrderSum ( ) - current ; } } return max ; |
public class CmsAttributeValueView { /** * Gets the parent attribute value view , or null if none exists . < p >
* @ return the parent attribute value view */
public CmsAttributeValueView getParentView ( ) { } } | Widget ancestor = getParent ( ) ; while ( ( ancestor != null ) && ! ( ancestor instanceof CmsAttributeValueView ) ) { ancestor = ancestor . getParent ( ) ; } return ( CmsAttributeValueView ) ancestor ; |
public class ContextManager { /** * Get a directory context .
* @ return The context .
* @ throws WIMSystemException If any { @ link NamingException } s occurred . */
@ FFDCIgnore ( { } } | InterruptedException . class , NamingException . class } ) public TimedDirContext getDirContext ( ) throws WIMSystemException { final String METHODNAME = "getDirContext" ; TimedDirContext ctx = null ; long currentTimeSeconds = roundToSeconds ( System . currentTimeMillis ( ) ) ; if ( iContextPoolEnabled ) { do { // Get the lock for the current domain
synchronized ( iLock ) { if ( iContexts == null ) { try { createContextPool ( iInitPoolSize , null ) ; } catch ( NamingException e ) { String msg = Tr . formatMessage ( tc , WIMMessageKey . NAMING_EXCEPTION , WIMMessageHelper . generateMsgParms ( e . toString ( true ) ) ) ; throw new WIMSystemException ( WIMMessageKey . NAMING_EXCEPTION , msg , e ) ; } } if ( iContexts . size ( ) > 0 ) { ctx = iContexts . remove ( iContexts . size ( ) - 1 ) ; } else if ( iLiveContexts < iMaxPoolSize || iMaxPoolSize == 0 ) { // Will create later outside of the synchronized code .
iLiveContexts ++ ; } else { try { iLock . wait ( iPoolWaitTime ) ; } catch ( InterruptedException e ) { // This is ok . . . if exception occurs , then continue . . .
} continue ; } } TimedDirContext oldCtx = null ; if ( ctx != null ) { /* * Has the context from the pool expired ?
* If iPoolTimeOut > 0 , check if the DirContex expires or not . If iPoolTimeOut = 0,
* the DirContext will be used forever until it is staled . */
if ( iPoolTimeOut > 0 && ( currentTimeSeconds - ctx . getPoolTimestamp ( ) ) > iPoolTimeOut ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " ContextPool: context is time out. currentTime=" + currentTimeSeconds + ", createTime=" + ctx . getPoolTimestamp ( ) + ", iPoolTimeOut=" + iPoolTimeOut ) ; } oldCtx = ctx ; ctx = null ; } } else { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " ContextPool: no free context, create a new one..." ) ; } } if ( ctx == null ) { try { ctx = createDirContext ( getEnvironment ( URLTYPE_SEQUENCE , getActiveURL ( ) ) ) ; } catch ( NamingException e ) { iLiveContexts -- ; String msg = Tr . formatMessage ( tc , WIMMessageKey . NAMING_EXCEPTION , WIMMessageHelper . generateMsgParms ( e . toString ( true ) ) ) ; throw new WIMSystemException ( WIMMessageKey . NAMING_EXCEPTION , msg , e ) ; } } else { // Check
if ( iReturnToPrimary && ( currentTimeSeconds - iLastQueryTime ) > iQueryInterval ) { try { String currentURL = getProviderURL ( ctx ) ; String primaryURL = getPrimaryURL ( ) ; if ( ! primaryURL . equalsIgnoreCase ( currentURL ) ) { // Test if primaryURL is available
Hashtable < String , Object > env = getEnvironment ( URLTYPE_SINGLE , primaryURL ) ; boolean primaryOK = false ; try { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " Ping primary server '" + primaryURL + "'..." ) ; } TimedDirContext testCtx = createDirContext ( env ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " Ping primary server '" + primaryURL + "': success" ) ; } // Log the URL being used .
if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , WIMMessageKey . CURRENT_LDAP_SERVER , WIMMessageHelper . generateMsgParms ( getActiveURL ( ) ) ) ; primaryOK = true ; TimedDirContext tempCtx = ctx ; try { tempCtx . close ( ) ; } catch ( NamingException e ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , METHODNAME + " Can not close LDAP connection: " + e . toString ( true ) ) ; } ctx = testCtx ; } catch ( NamingException e ) { if ( tc . isInfoEnabled ( ) ) Tr . info ( tc , WIMMessageKey . CANNOT_CONNECT_LDAP_SERVER , WIMMessageHelper . generateMsgParms ( primaryURL ) ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " Ping primary server '" + primaryURL + "': fail" ) ; } } // Refresh context pool if another thread has not already done so
if ( primaryOK ) { synchronized ( iLock ) { if ( ! getActiveURL ( ) . equalsIgnoreCase ( primaryURL ) ) { createContextPool ( iLiveContexts - 1 , primaryURL ) ; ctx . setCreateTimestamp ( iPoolCreateTimestampSeconds ) ; } } } } iLastQueryTime = currentTimeSeconds ; } catch ( NamingException e ) { String msg = Tr . formatMessage ( tc , WIMMessageKey . NAMING_EXCEPTION , WIMMessageHelper . generateMsgParms ( e . toString ( true ) ) ) ; throw new WIMSystemException ( WIMMessageKey . NAMING_EXCEPTION , msg , e ) ; } } } if ( oldCtx != null ) { try { oldCtx . close ( ) ; } catch ( NamingException e ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , METHODNAME + " Can not close LDAP connection: " + e . toString ( true ) ) ; } } } while ( ctx == null ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " ContextPool: total=" + iLiveContexts + ", poolSize=" + iContexts . size ( ) + ", currentTime=" + currentTimeSeconds + ", createTime=" + ctx . getPoolTimestamp ( ) ) ; } } else { try { // Test if primaryURL is available
if ( iReturnToPrimary && ( currentTimeSeconds - iLastQueryTime ) > iQueryInterval ) { String primaryURL = getPrimaryURL ( ) ; if ( ! primaryURL . equalsIgnoreCase ( getActiveURL ( ) ) ) { Hashtable < String , Object > env = getEnvironment ( URLTYPE_SINGLE , primaryURL ) ; try { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , METHODNAME + " Ping primary server '" + primaryURL + "'..." ) ; ctx = createDirContext ( env ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , METHODNAME + " Ping primary server '" + primaryURL + "': success" ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , WIMMessageKey . CURRENT_LDAP_SERVER , WIMMessageHelper . generateMsgParms ( getActiveURL ( ) ) ) ; } catch ( NamingException e ) { if ( tc . isInfoEnabled ( ) ) Tr . info ( tc , WIMMessageKey . CANNOT_CONNECT_LDAP_SERVER , WIMMessageHelper . generateMsgParms ( primaryURL ) ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , METHODNAME + " Ping primary server '" + primaryURL + "': fail" ) ; } } iLastQueryTime = currentTimeSeconds ; } // create the connection
if ( ctx == null ) { ctx = createDirContext ( getEnvironment ( URLTYPE_SEQUENCE , getActiveURL ( ) ) ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , WIMMessageKey . CURRENT_LDAP_SERVER , WIMMessageHelper . generateMsgParms ( getActiveURL ( ) ) ) ; } } catch ( NamingException e ) { String msg = Tr . formatMessage ( tc , WIMMessageKey . NAMING_EXCEPTION , WIMMessageHelper . generateMsgParms ( e . toString ( true ) ) ) ; throw new WIMSystemException ( WIMMessageKey . NAMING_EXCEPTION , msg , e ) ; } } return ctx ; |
public class JSONArray { /** * Put a value in the JSONArray , where the value will be a JSONObject which
* is produced from a Map .
* @ param value A Map value .
* @ return this . */
public JSONArray element ( Map value , JsonConfig jsonConfig ) { } } | if ( value instanceof JSONObject ) { elements . add ( value ) ; return this ; } else { return element ( JSONObject . fromObject ( value , jsonConfig ) ) ; } |
public class VideoSelectorSettingsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( VideoSelectorSettings videoSelectorSettings , ProtocolMarshaller protocolMarshaller ) { } } | if ( videoSelectorSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( videoSelectorSettings . getVideoSelectorPid ( ) , VIDEOSELECTORPID_BINDING ) ; protocolMarshaller . marshall ( videoSelectorSettings . getVideoSelectorProgramId ( ) , VIDEOSELECTORPROGRAMID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class csvserver_appflowpolicy_binding { /** * Use this API to fetch csvserver _ appflowpolicy _ binding resources of given name . */
public static csvserver_appflowpolicy_binding [ ] get ( nitro_service service , String name ) throws Exception { } } | csvserver_appflowpolicy_binding obj = new csvserver_appflowpolicy_binding ( ) ; obj . set_name ( name ) ; csvserver_appflowpolicy_binding response [ ] = ( csvserver_appflowpolicy_binding [ ] ) obj . get_resources ( service ) ; return response ; |
public class OpentracingClientFilter { /** * < p > Handle an outgoing request . < / p >
* < p > Associate the outgoing request with the incoming request . Create
* an outgoing span . Inject the span into the outgoing request headers
* for propagation to the next server . < / p >
* < p > A tracer is expected to be available from the open tracing context
* manager . Do nothing if a tracer is not available . < / p >
* @ param clientRequestContext The outgoing request context .
* @ throws IOException Thrown if handling the request failed . */
@ Override public void filter ( ClientRequestContext clientRequestContext ) throws IOException { } } | String methodName = "filter(outgoing)" ; Tracer tracer = OpentracingTracerManager . getTracer ( ) ; if ( tracer == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " no tracer" ) ; } return ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , OpentracingUtils . getTracerText ( tracer ) ) ; } } URI outgoingUri = clientRequestContext . getUri ( ) ; String outgoingURL = outgoingUri . toURL ( ) . toString ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " outgoing URL" , outgoingURL ) ; } /* * Removing filter processing until microprofile spec for it is approved . Expect to add this code
* back in 1Q18 - smf */
// boolean process = OpentracingService . process ( outgoingUri , SpanFilterType . OUTGOING ) ;
boolean process = true ; if ( process ) { String buildSpanName = helper != null ? helper . getBuildSpanName ( clientRequestContext ) : outgoingURL ; Tracer . SpanBuilder spanBuilder = tracer . buildSpan ( buildSpanName ) ; spanBuilder . withTag ( Tags . SPAN_KIND . getKey ( ) , Tags . SPAN_KIND_CLIENT ) ; spanBuilder . withTag ( Tags . HTTP_URL . getKey ( ) , outgoingURL ) ; spanBuilder . withTag ( Tags . HTTP_METHOD . getKey ( ) , clientRequestContext . getMethod ( ) ) ; try ( ActiveSpan activeSpan = spanBuilder . startActive ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " activeSpan" , activeSpan ) ; } tracer . inject ( activeSpan . context ( ) , Format . Builtin . HTTP_HEADERS , new MultivaluedMapToTextMap ( clientRequestContext . getHeaders ( ) ) ) ; Continuation continuation = activeSpan . capture ( ) ; clientRequestContext . setProperty ( CLIENT_CONTINUATION_PROP_ID , continuation ) ; } } else { ActiveSpan currentActiveSpan = tracer . activeSpan ( ) ; if ( currentActiveSpan != null ) { tracer . inject ( currentActiveSpan . context ( ) , Format . Builtin . HTTP_HEADERS , new MultivaluedMapToTextMap ( clientRequestContext . getHeaders ( ) ) ) ; } } clientRequestContext . setProperty ( CLIENT_SPAN_SKIPPED_ID , ! process ) ; |
public class AssertMessages { /** * The value of first Parameter must be < code > false < / code > .
* @ param functionName the name of the function that should reply < code > false < / code > .
* @ return the error message . */
@ Pure @ Inline ( value = "AssertMessages.invalidTrueValue(0, $1)" , imported = { } } | AssertMessages . class } ) public static String invalidTrueValue ( String functionName ) { return invalidTrueValue ( 0 , functionName ) ; |
public class AmazonCloudDirectoryClient { /** * Does the following :
* < ol >
* < li >
* Adds new < code > Attributes < / code > , < code > Rules < / code > , or < code > ObjectTypes < / code > .
* < / li >
* < li >
* Updates existing < code > Attributes < / code > , < code > Rules < / code > , or < code > ObjectTypes < / code > .
* < / li >
* < li >
* Deletes existing < code > Attributes < / code > , < code > Rules < / code > , or < code > ObjectTypes < / code > .
* < / li >
* < / ol >
* @ param updateFacetRequest
* @ return Result of the UpdateFacet operation returned by the service .
* @ throws InternalServiceException
* Indicates a problem that must be resolved by Amazon Web Services . This might be a transient error in
* which case you can retry your request until it succeeds . Otherwise , go to the < a
* href = " http : / / status . aws . amazon . com / " > AWS Service Health Dashboard < / a > site to see if there are any
* operational issues with the service .
* @ throws InvalidArnException
* Indicates that the provided ARN value is not valid .
* @ throws RetryableConflictException
* Occurs when a conflict with a previous successful write is detected . For example , if a write operation
* occurs on an object and then an attempt is made to read the object using “ SERIALIZABLE ” consistency , this
* exception may result . This generally occurs when the previous write did not have time to propagate to the
* host serving the current request . A retry ( with appropriate backoff logic ) is the recommended response to
* this exception .
* @ throws ValidationException
* Indicates that your request is malformed in some manner . See the exception message .
* @ throws LimitExceededException
* Indicates that limits are exceeded . See < a
* href = " https : / / docs . aws . amazon . com / clouddirectory / latest / developerguide / limits . html " > Limits < / a > for more
* information .
* @ throws AccessDeniedException
* Access denied . Check your permissions .
* @ throws InvalidFacetUpdateException
* An attempt to modify a < a > Facet < / a > resulted in an invalid schema exception .
* @ throws FacetValidationException
* The < a > Facet < / a > that you provided was not well formed or could not be validated with the schema .
* @ throws ResourceNotFoundException
* The specified resource could not be found .
* @ throws FacetNotFoundException
* The specified < a > Facet < / a > could not be found .
* @ throws InvalidRuleException
* Occurs when any of the rule parameter keys or values are invalid .
* @ sample AmazonCloudDirectory . UpdateFacet
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / clouddirectory - 2017-01-11 / UpdateFacet " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public UpdateFacetResult updateFacet ( UpdateFacetRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateFacet ( request ) ; |
public class StandardJspCompiler { /** * / * ( non - Javadoc )
* @ see com . ibm . wsspi . jsp . compiler . JspCompiler # compile ( java . lang . String , java . util . Collection , java . util . List ) */
@ Override public JspCompilerResult compile ( String arg0 , Collection arg1 , List arg2 ) { } } | // TODO Auto - generated method stub
return null ; |
public class Closeables { /** * Close potential { @ linkplain Closeable } .
* An { @ linkplain IOException } caused by { @ linkplain Closeable # close ( ) } is suppressed and added to the given outer
* exception .
* @ param exception the currently handled outer exception .
* @ param object the object to check and close . */
public static void safeClose ( Throwable exception , @ Nullable Object object ) { } } | if ( object instanceof Closeable ) { try { ( ( Closeable ) object ) . close ( ) ; } catch ( IOException e ) { exception . addSuppressed ( e ) ; } } |
public class JobExistingWorkspaceRestore { /** * { @ inheritDoc } */
@ Override protected void restoreWorkspace ( ) throws WorkspaceRestoreException { } } | try { // get current workspace configuration
WorkspaceEntry wEntry = null ; ; for ( WorkspaceEntry entry : repositoryService . getRepository ( repositoryName ) . getConfiguration ( ) . getWorkspaceEntries ( ) ) { if ( entry . getName ( ) . equals ( this . wEntry . getName ( ) ) ) { wEntry = entry ; break ; } } if ( wEntry == null ) { throw new WorkspaceRestoreException ( "Workspace " + this . wEntry . getName ( ) + " did not found in current repository " + repositoryName + " configuration" ) ; } // get all backupable components
List < Backupable > backupable = repositoryService . getRepository ( repositoryName ) . getWorkspaceContainer ( wEntry . getName ( ) ) . getComponentInstancesOfType ( Backupable . class ) ; // close all session
forceCloseSession ( repositoryName , wEntry . getName ( ) ) ; repositoryService . getRepository ( repositoryName ) . removeWorkspace ( wEntry . getName ( ) ) ; // clean
for ( Backupable component : backupable ) { component . clean ( ) ; } super . restoreWorkspace ( ) ; } catch ( Throwable t ) // NOSONAR
{ throw new WorkspaceRestoreException ( "Workspace " + wEntry . getName ( ) + " was not restored" , t ) ; } |
public class OpenIabHelper { /** * See { @ link # queryInventory ( boolean , List , List ) } for details */
public @ Nullable Inventory queryInventory ( final boolean querySkuDetails , @ Nullable final List < String > moreSkus ) throws IabException { } } | return queryInventory ( querySkuDetails , moreSkus , null ) ; |
public class SessionProperties { /** * Returns the session properties as a Map . */
public Map < String , Collection < String > > toMap ( ) { } } | Map < String , Collection < String > > params = new HashMap < String , Collection < String > > ( ) ; if ( null != location ) { ArrayList < String > valueList = new ArrayList < String > ( ) ; valueList . add ( location ) ; params . put ( "location" , valueList ) ; } ArrayList < String > mediaModeValueList = new ArrayList < String > ( ) ; mediaModeValueList . add ( mediaMode . toString ( ) ) ; params . put ( "p2p.preference" , mediaModeValueList ) ; ArrayList < String > archiveModeValueList = new ArrayList < String > ( ) ; archiveModeValueList . add ( archiveMode . toString ( ) ) ; params . put ( "archiveMode" , archiveModeValueList ) ; return params ; |
public class HttpTransportFactory { /** * Create an { @ link HttpTransport } based on an type class .
* @ param type The type of HttpTransport to use .
* @ return The resulting HttpTransport .
* @ throws IllegalArgumentException If the proxy address is invalid .
* @ throws IOException If there is an issue connecting to Google ' s Certification server . */
public static HttpTransport createHttpTransport ( HttpTransportType type ) throws IOException { } } | return createHttpTransport ( type , /* proxyAddress = */
null , /* proxyUsername = */
null , /* proxyPassword = */
null ) ; |
public class LinearLayout { /** * Check if the gravity and orientation are not in conflict one with other .
* @ param gravity
* @ param orientation
* @ return true if orientation and gravity can be applied together , false - otherwise */
protected boolean isValidLayout ( Gravity gravity , Orientation orientation ) { } } | boolean isValid = true ; switch ( gravity ) { case TOP : case BOTTOM : isValid = ( ! isUnlimitedSize ( ) && orientation == Orientation . VERTICAL ) ; break ; case LEFT : case RIGHT : isValid = ( ! isUnlimitedSize ( ) && orientation == Orientation . HORIZONTAL ) ; break ; case FRONT : case BACK : isValid = ( ! isUnlimitedSize ( ) && orientation == Orientation . STACK ) ; break ; case FILL : isValid = ! isUnlimitedSize ( ) ; break ; case CENTER : break ; default : isValid = false ; break ; } if ( ! isValid ) { Log . w ( TAG , "Cannot set the gravity %s and orientation %s - " + "due to unlimited bounds or incompatibility" , gravity , orientation ) ; } return isValid ; |
public class CreateTrustRequest { /** * The IP addresses of the remote DNS server associated with RemoteDomainName .
* @ param conditionalForwarderIpAddrs
* The IP addresses of the remote DNS server associated with RemoteDomainName . */
public void setConditionalForwarderIpAddrs ( java . util . Collection < String > conditionalForwarderIpAddrs ) { } } | if ( conditionalForwarderIpAddrs == null ) { this . conditionalForwarderIpAddrs = null ; return ; } this . conditionalForwarderIpAddrs = new com . amazonaws . internal . SdkInternalList < String > ( conditionalForwarderIpAddrs ) ; |
public class Program { /** * Validates the given program tree .
* @ param program the program to validate
* @ throws NullPointerException if the given { @ code program } is { @ code null }
* @ throws IllegalArgumentException if the given operation tree is invalid ,
* which means there is at least one node where the operation arity
* and the node child count differ . */
public static void check ( final Tree < ? extends Op < ? > , ? > program ) { } } | requireNonNull ( program ) ; program . forEach ( Program :: checkArity ) ; |
public class FileUtils { /** * 字符流写文件 较快
* @ param file 文件
* @ param data 数据
* @ return 操作是否成功
* @ throws IOException 发送IO异常 */
public static boolean string2File ( File file , String data ) throws IOException { } } | if ( ! file . getParentFile ( ) . exists ( ) ) { file . getParentFile ( ) . mkdirs ( ) ; } FileWriter writer = null ; try { writer = new FileWriter ( file , false ) ; writer . write ( data ) ; } finally { if ( writer != null ) { writer . close ( ) ; } } return true ; |
public class EnvironmentConfig { /** * Sets the number of milliseconds which the database garbage collector is postponed for after the
* { @ linkplain Environment } is created . Default value is { @ code 10000 } .
* < p > Mutable at runtime : no
* @ param startInMillis number of milliseconds which the database garbage collector should be postponed for after the
* { @ linkplain Environment } is created
* @ return this { @ code EnvironmentConfig } instance
* @ throws InvalidSettingException { @ code startInMillis } is negative */
public EnvironmentConfig setGcStartIn ( final int startInMillis ) throws InvalidSettingException { } } | if ( startInMillis < 0 ) { throw new InvalidSettingException ( "GC can't be postponed for that number of milliseconds: " + startInMillis ) ; } return setSetting ( GC_START_IN , startInMillis ) ; |
public class ContentSpecValidator { /** * Validates that a Content Specification is valid by checking the META data , child levels and topics .
* @ param contentSpec The content specification to be validated .
* @ return True if the content specification is valid , otherwise false . */
public boolean preValidateContentSpec ( final ContentSpec contentSpec ) { } } | // Create the map of unique ids to spec topics
final Map < String , SpecTopic > specTopicMap = ContentSpecUtilities . getUniqueIdSpecTopicMap ( contentSpec ) ; final Map < String , InfoTopic > infoTopicMap = ContentSpecUtilities . getUniqueIdInfoTopicMap ( contentSpec ) ; // Get all server defined fixed urls
final Set < String > processedFixedUrls = new HashSet < String > ( ) ; // Check if the app should be shutdown
if ( isShuttingDown . get ( ) ) { shutdown . set ( true ) ; return false ; } boolean valid = true ; if ( isNullOrEmpty ( contentSpec . getTitle ( ) ) ) { log . error ( ProcessorConstants . ERROR_CS_NO_TITLE_MSG ) ; valid = false ; } if ( isNullOrEmpty ( contentSpec . getProduct ( ) ) ) { log . error ( ProcessorConstants . ERROR_CS_NO_PRODUCT_MSG ) ; valid = false ; } if ( ! isNullOrEmpty ( contentSpec . getVersion ( ) ) && ! contentSpec . getVersion ( ) . matches ( ProcessorConstants . PRODUCT_VERSION_VALIDATE_REGEX ) ) { log . error ( format ( ProcessorConstants . ERROR_INVALID_VERSION_NUMBER_MSG , CommonConstants . CS_VERSION_TITLE ) ) ; valid = false ; } if ( isNullOrEmpty ( contentSpec . getFormat ( ) ) ) { log . error ( ProcessorConstants . ERROR_CS_NO_DTD_MSG ) ; valid = false ; // Check that the DTD specified is a valid DTD format
} else if ( ! contentSpec . getFormat ( ) . equalsIgnoreCase ( CommonConstants . DOCBOOK_45_TITLE ) && ! contentSpec . getFormat ( ) . equalsIgnoreCase ( CommonConstants . DOCBOOK_50_TITLE ) ) { log . error ( ProcessorConstants . ERROR_CS_INVALID_DTD_MSG ) ; valid = false ; } if ( isNullOrEmpty ( contentSpec . getCopyrightHolder ( ) ) ) { log . error ( ProcessorConstants . ERROR_CS_NO_COPYRIGHT_MSG ) ; valid = false ; } // Check that the book type is valid
if ( contentSpec . getBookType ( ) == BookType . INVALID ) { log . error ( ProcessorConstants . ERROR_INVALID_BOOK_TYPE_MSG ) ; valid = false ; } // Check that the Copyright year is valid
if ( contentSpec . getCopyrightYear ( ) != null && ! contentSpec . getCopyrightYear ( ) . matches ( ProcessorConstants . COPYRIGHT_YEAR_VALIDATE_REGEX ) ) { log . error ( ProcessorConstants . ERROR_INVALID_CS_COPYRIGHT_YEAR_MSG ) ; valid = false ; } // Check the version variables are all valid
if ( contentSpec . getBookVersion ( ) != null && ! contentSpec . getBookVersion ( ) . matches ( ProcessorConstants . VERSION_VALIDATE_REGEX ) ) { log . error ( format ( ProcessorConstants . ERROR_INVALID_VERSION_NUMBER_MSG , CommonConstants . CS_BOOK_VERSION_TITLE ) ) ; valid = false ; } // Check the POM version is valid if it ' s set
if ( ! isNullOrEmpty ( contentSpec . getPOMVersion ( ) ) && ! contentSpec . getPOMVersion ( ) . matches ( ProcessorConstants . PRODUCT_VERSION_VALIDATE_REGEX ) ) { log . error ( format ( ProcessorConstants . ERROR_INVALID_VERSION_NUMBER_MSG , CommonConstants . CS_MAVEN_POM_VERSION_TITLE ) ) ; valid = false ; } if ( contentSpec . getEdition ( ) != null && ! contentSpec . getEdition ( ) . matches ( ProcessorConstants . PRODUCT_VERSION_VALIDATE_REGEX ) ) { log . error ( format ( ProcessorConstants . ERROR_INVALID_VERSION_NUMBER_MSG , CommonConstants . CS_EDITION_TITLE ) ) ; valid = false ; } // Check for a negative pubsnumber
if ( contentSpec . getPubsNumber ( ) != null && contentSpec . getPubsNumber ( ) < 0 ) { log . error ( ProcessorConstants . ERROR_INVALID_PUBSNUMBER_MSG ) ; valid = false ; } // Check that the default publican . cfg exists
if ( ! contentSpec . getDefaultPublicanCfg ( ) . equals ( CommonConstants . CS_PUBLICAN_CFG_TITLE ) ) { final String name = contentSpec . getDefaultPublicanCfg ( ) ; final Matcher matcher = CSConstants . CUSTOM_PUBLICAN_CFG_PATTERN . matcher ( name ) ; final String fixedName = matcher . find ( ) ? matcher . group ( 1 ) : name ; if ( contentSpec . getAdditionalPublicanCfg ( fixedName ) == null ) { log . error ( String . format ( ProcessorConstants . ERROR_INVALID_DEFAULT_PUBLICAN_CFG_MSG , name ) ) ; valid = false ; } } // BZ # 1091776 Check that mainfile isn ' t used
if ( doesPublicanCfgsContainValue ( contentSpec , "mainfile" ) ) { log . warn ( ProcessorConstants . WARN_MAINFILE_WILL_BE_REMOVED_MSG ) ; } // Check that any metadata topics are valid
if ( contentSpec . getRevisionHistory ( ) != null && ! preValidateTopic ( contentSpec . getRevisionHistory ( ) , specTopicMap , processedFixedUrls , contentSpec . getBookType ( ) , false , contentSpec ) ) { valid = false ; } if ( contentSpec . getLegalNotice ( ) != null && ! preValidateTopic ( contentSpec . getLegalNotice ( ) , specTopicMap , processedFixedUrls , contentSpec . getBookType ( ) , false , contentSpec ) ) { valid = false ; } if ( contentSpec . getAuthorGroup ( ) != null && ! preValidateTopic ( contentSpec . getAuthorGroup ( ) , specTopicMap , processedFixedUrls , contentSpec . getBookType ( ) , false , contentSpec ) ) { valid = false ; } if ( contentSpec . getAbstractTopic ( ) != null && ! preValidateTopic ( contentSpec . getAbstractTopic ( ) , specTopicMap , processedFixedUrls , contentSpec . getBookType ( ) , false , contentSpec ) ) { valid = false ; } // Print Warnings for content that maybe important
if ( isNullOrEmpty ( contentSpec . getSubtitle ( ) ) ) { log . warn ( ProcessorConstants . WARN_CS_NO_SUBTITLE_MSG ) ; } if ( isNullOrEmpty ( contentSpec . getAbstract ( ) ) && contentSpec . getAbstractTopic ( ) == null ) { log . warn ( ProcessorConstants . WARN_CS_NO_ABSTRACT_MSG ) ; } else if ( ! isNullOrEmpty ( contentSpec . getAbstract ( ) ) ) { // Check to make sure the abstract is at least valid XML
String wrappedAbstract = contentSpec . getAbstract ( ) ; if ( ! contentSpec . getAbstract ( ) . matches ( "^<(formal|sim)?para>(.|\\s)*" ) ) { wrappedAbstract = "<para>" + contentSpec . getAbstract ( ) + "</para>" ; } wrappedAbstract = "<abstract>" + wrappedAbstract + "</abstract>" ; if ( ! preValidateXML ( contentSpec . getAbstractNode ( ) , wrappedAbstract , contentSpec . getFormat ( ) ) ) { valid = false ; } } // Check to make sure all key value nodes a valid ( that is they have a key and value specified
for ( final Node node : contentSpec . getNodes ( ) ) { if ( node instanceof KeyValueNode ) { final KeyValueNode keyValueNode = ( KeyValueNode ) node ; if ( isNullOrEmpty ( keyValueNode . getKey ( ) ) ) { valid = false ; log . error ( format ( ProcessorConstants . ERROR_INVALID_METADATA_FORMAT_MSG , keyValueNode . getLineNumber ( ) , keyValueNode . getText ( ) ) ) ; } else { final Object value = keyValueNode . getValue ( ) ; if ( value instanceof String && isNullOrEmpty ( ( String ) value ) ) { valid = false ; log . error ( format ( ProcessorConstants . ERROR_INVALID_METADATA_NO_VALUE_MSG , keyValueNode . getLineNumber ( ) , keyValueNode . getText ( ) ) ) ; } else if ( value == null ) { valid = false ; log . error ( format ( ProcessorConstants . ERROR_INVALID_METADATA_NO_VALUE_MSG , keyValueNode . getLineNumber ( ) , keyValueNode . getText ( ) ) ) ; } // Make sure the key is a valid meta data element
if ( ! ProcessorConstants . VALID_METADATA_KEYS . contains ( keyValueNode . getKey ( ) ) && ! CSConstants . CUSTOM_PUBLICAN_CFG_PATTERN . matcher ( keyValueNode . getKey ( ) ) . matches ( ) ) { valid = false ; log . error ( format ( ProcessorConstants . ERROR_UNRECOGNISED_METADATA_MSG , keyValueNode . getLineNumber ( ) , keyValueNode . getText ( ) ) ) ; } // Make sure that the metadata is valid XML if it might be used
if ( value instanceof String && ! isNullOrEmpty ( ( String ) value ) && ProcessorConstants . METADATA_DOCBOOK_ELEMENTS . containsKey ( keyValueNode . getKey ( ) ) ) { final String element = ProcessorConstants . METADATA_DOCBOOK_ELEMENTS . get ( keyValueNode . getKey ( ) ) ; final String wrappedElement = "<" + element + ">" + value + "</" + element + ">" ; if ( ! preValidateXML ( keyValueNode , wrappedElement , contentSpec . getFormat ( ) ) ) { valid = false ; } } } } } // Content that should be checked when using the default preface
if ( contentSpec . getUseDefaultPreface ( ) ) { if ( contentSpec . getFeedback ( ) != null && ! preValidateTopic ( contentSpec . getFeedback ( ) , specTopicMap , processedFixedUrls , contentSpec . getBookType ( ) , false , contentSpec ) ) { valid = false ; } } else if ( contentSpec . getFeedback ( ) != null ) { // Feedback cannot be used when the default preface is off , so log an error .
log . error ( format ( ProcessorConstants . ERROR_FEEDBACK_USED_WITHOUT_DEFAULT_PREFACE_MSG , contentSpec . getFeedback ( ) . getText ( ) ) ) ; valid = false ; } // Validate the custom entities
if ( ! validateEntities ( contentSpec ) ) { valid = false ; } // Validate the basic bug link data
if ( ! preValidateBugLinks ( contentSpec ) ) { valid = false ; } // Check that each level is valid
if ( ! preValidateLevel ( contentSpec . getBaseLevel ( ) , specTopicMap , infoTopicMap , processedFixedUrls , contentSpec . getBookType ( ) , contentSpec ) ) { valid = false ; } // Check that the relationships are valid
if ( ! preValidateRelationships ( contentSpec ) ) { valid = false ; } /* * Ensure that no topics exist that have the same ID but different revisions . This needs to be done at the Content Spec
* level rather than the Topic level as it isn ' t the topic that would be invalid but rather the set of topics
* in the content specification . */
if ( ! checkTopicsForInvalidDuplicates ( contentSpec ) ) { valid = false ; } return valid ; |
public class OrcParser { /** * This method is written to take care of the leap seconds , leap year effects . Our original
* plan of converting number of days from epoch does not quite work out right due to all these
* leap seconds , years accumulated over the century . However , I do notice that when we are
* not correcting for the leap seconds / years , if we build a dateTime object , the hour does not
* work out to be 00 . Instead it is off . In this case , we just calculate the offset and take
* if off our straight forward timestamp calculation .
* @ param daysSinceEpoch : number of days since epoch ( 1970 1/1)
* @ return long : correct timestamp corresponding to daysSinceEpoch */
private long correctTimeStamp ( long daysSinceEpoch ) { } } | long timestamp = ( daysSinceEpoch * DAY_TO_MS + ADD_OFFSET ) ; DateTime date = new DateTime ( timestamp ) ; int hour = date . hourOfDay ( ) . get ( ) ; if ( hour == 0 ) return timestamp ; else return ( timestamp - hour * HOUR_OFFSET ) ; |
public class CertificatesInner { /** * Get the certificate .
* Returns the certificate .
* @ param resourceGroupName The name of the resource group that contains the IoT hub .
* @ param resourceName The name of the IoT hub .
* @ param certificateName The name of the certificate
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the CertificateDescriptionInner object */
public Observable < CertificateDescriptionInner > getAsync ( String resourceGroupName , String resourceName , String certificateName ) { } } | return getWithServiceResponseAsync ( resourceGroupName , resourceName , certificateName ) . map ( new Func1 < ServiceResponse < CertificateDescriptionInner > , CertificateDescriptionInner > ( ) { @ Override public CertificateDescriptionInner call ( ServiceResponse < CertificateDescriptionInner > response ) { return response . body ( ) ; } } ) ; |
public class DateUtil { /** * Adds or subtracts the specified amount of time to the given time unit ,
* based on the calendar ' s rules . For example , to subtract 5 days from the
* current time of the calendar , you can achieve it by calling :
* < code > N . roll ( date , - 5 , TimeUnit . DAYS ) < / code > .
* @ param date
* @ param amount
* @ param unit
* @ return a new instance of Date with the specified amount rolled .
* @ deprecated replaced by { @ code addYears / addMonths / addWeeks / . . . } */
@ Deprecated public static < T extends java . util . Date > T roll ( final T date , final long amount , final TimeUnit unit ) { } } | N . checkArgNotNull ( date , "date" ) ; return createDate ( date . getClass ( ) , date . getTime ( ) + unit . toMillis ( amount ) ) ; |
public class WSManRemoteShellService { /** * Configures the HttpClientInputs object with the most common http parameters .
* @ param httpClientInputs
* @ param url
* @ param wsManRequestInputs
* @ return the configured HttpClientInputs object .
* @ throws MalformedURLException */
private static HttpClientInputs setCommonHttpInputs ( HttpClientInputs httpClientInputs , URL url , WSManRequestInputs wsManRequestInputs ) throws MalformedURLException { } } | httpClientInputs . setUrl ( url . toString ( ) ) ; httpClientInputs . setUsername ( wsManRequestInputs . getUsername ( ) ) ; httpClientInputs . setPassword ( wsManRequestInputs . getPassword ( ) ) ; httpClientInputs . setAuthType ( wsManRequestInputs . getAuthType ( ) ) ; httpClientInputs . setKerberosConfFile ( wsManRequestInputs . getKerberosConfFile ( ) ) ; httpClientInputs . setKerberosLoginConfFile ( wsManRequestInputs . getKerberosLoginConfFile ( ) ) ; httpClientInputs . setKerberosSkipPortCheck ( wsManRequestInputs . getKerberosSkipPortForLookup ( ) ) ; httpClientInputs . setTrustAllRoots ( wsManRequestInputs . getTrustAllRoots ( ) ) ; httpClientInputs . setX509HostnameVerifier ( wsManRequestInputs . getX509HostnameVerifier ( ) ) ; httpClientInputs . setProxyHost ( wsManRequestInputs . getProxyHost ( ) ) ; httpClientInputs . setProxyPort ( wsManRequestInputs . getProxyPort ( ) ) ; httpClientInputs . setProxyUsername ( wsManRequestInputs . getProxyUsername ( ) ) ; httpClientInputs . setProxyPassword ( wsManRequestInputs . getProxyPassword ( ) ) ; httpClientInputs . setKeystore ( wsManRequestInputs . getKeystore ( ) ) ; httpClientInputs . setKeystorePassword ( wsManRequestInputs . getKeystorePassword ( ) ) ; httpClientInputs . setTrustKeystore ( wsManRequestInputs . getTrustKeystore ( ) ) ; httpClientInputs . setTrustPassword ( wsManRequestInputs . getTrustPassword ( ) ) ; String headers = httpClientInputs . getHeaders ( ) ; if ( StringUtils . isEmpty ( headers ) ) { httpClientInputs . setHeaders ( CONTENT_TYPE_HEADER ) ; } else { httpClientInputs . setHeaders ( headers + NEW_LINE_SEPARATOR + CONTENT_TYPE_HEADER ) ; } httpClientInputs . setMethod ( HttpPost . METHOD_NAME ) ; return httpClientInputs ; |
public class Maybe { /** * Returns an Observable that maps a success value into an Iterable and emits its items .
* < img width = " 640 " height = " 373 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / flattenAsObservable . png " alt = " " >
* < dl >
* < dt > < b > Scheduler : < / b > < / dt >
* < dd > { @ code flattenAsObservable } does not operate by default on a particular { @ link Scheduler } . < / dd >
* < / dl >
* @ param < U >
* the type of item emitted by the resulting Iterable
* @ param mapper
* a function that returns an Iterable sequence of values for when given an item emitted by the
* source Maybe
* @ return the new Observable instance
* @ see < a href = " http : / / reactivex . io / documentation / operators / flatmap . html " > ReactiveX operators documentation : FlatMap < / a > */
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U > Observable < U > flattenAsObservable ( final Function < ? super T , ? extends Iterable < ? extends U > > mapper ) { } } | ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeFlatMapIterableObservable < T , U > ( this , mapper ) ) ; |
public class InternalPureXbaseParser { /** * InternalPureXbase . g : 6478:1 : ruleJvmUpperBoundAnded returns [ EObject current = null ] : ( otherlv _ 0 = ' & ' ( ( lv _ typeReference _ 1_0 = ruleJvmTypeReference ) ) ) ; */
public final EObject ruleJvmUpperBoundAnded ( ) throws RecognitionException { } } | EObject current = null ; Token otherlv_0 = null ; EObject lv_typeReference_1_0 = null ; enterRule ( ) ; try { // InternalPureXbase . g : 6484:2 : ( ( otherlv _ 0 = ' & ' ( ( lv _ typeReference _ 1_0 = ruleJvmTypeReference ) ) ) )
// InternalPureXbase . g : 6485:2 : ( otherlv _ 0 = ' & ' ( ( lv _ typeReference _ 1_0 = ruleJvmTypeReference ) ) )
{ // InternalPureXbase . g : 6485:2 : ( otherlv _ 0 = ' & ' ( ( lv _ typeReference _ 1_0 = ruleJvmTypeReference ) ) )
// InternalPureXbase . g : 6486:3 : otherlv _ 0 = ' & ' ( ( lv _ typeReference _ 1_0 = ruleJvmTypeReference ) )
{ otherlv_0 = ( Token ) match ( input , 83 , FOLLOW_11 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { newLeafNode ( otherlv_0 , grammarAccess . getJvmUpperBoundAndedAccess ( ) . getAmpersandKeyword_0 ( ) ) ; } // InternalPureXbase . g : 6490:3 : ( ( lv _ typeReference _ 1_0 = ruleJvmTypeReference ) )
// InternalPureXbase . g : 6491:4 : ( lv _ typeReference _ 1_0 = ruleJvmTypeReference )
{ // InternalPureXbase . g : 6491:4 : ( lv _ typeReference _ 1_0 = ruleJvmTypeReference )
// InternalPureXbase . g : 6492:5 : lv _ typeReference _ 1_0 = ruleJvmTypeReference
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getJvmUpperBoundAndedAccess ( ) . getTypeReferenceJvmTypeReferenceParserRuleCall_1_0 ( ) ) ; } pushFollow ( FOLLOW_2 ) ; lv_typeReference_1_0 = ruleJvmTypeReference ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElementForParent ( grammarAccess . getJvmUpperBoundAndedRule ( ) ) ; } set ( current , "typeReference" , lv_typeReference_1_0 , "org.eclipse.xtext.xbase.Xtype.JvmTypeReference" ) ; afterParserOrEnumRuleCall ( ) ; } } } } } if ( state . backtracking == 0 ) { leaveRule ( ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class CassandraBundle { /** * Initializes the Cassandra environment : registers context binder for
* { @ link com . datastax . driver . core . Cluster } and { @ link com . datastax . driver . core . Session } instances .
* @ param configuration The configuration object
* @ param environment The application ' s Environment */
@ Override public void run ( T configuration , Environment environment ) throws Exception { } } | environment . jersey ( ) . register ( CassandraProvider . binder ( getCassandraFactory ( configuration ) , environment ) ) ; |
public class PublishMqDemoObjects { /** * region > listAll ( action ) */
@ Action ( semantics = SemanticsOf . SAFE ) @ ActionLayout ( bookmarking = BookmarkPolicy . AS_ROOT ) @ MemberOrder ( sequence = "1" ) public List < PublishMqDemoObject > listAll ( ) { } } | return container . allInstances ( PublishMqDemoObject . class ) ; |
public class SmtpResponseDecoder { /** * Parses the io . netty . handler . codec . smtp code without any allocation , which is three digits . */
private static int parseCode ( ByteBuf buffer ) { } } | final int first = parseNumber ( buffer . readByte ( ) ) * 100 ; final int second = parseNumber ( buffer . readByte ( ) ) * 10 ; final int third = parseNumber ( buffer . readByte ( ) ) ; return first + second + third ; |
public class ApplicationGatewaysInner { /** * Creates or updates the specified application gateway .
* @ param resourceGroupName The name of the resource group .
* @ param applicationGatewayName The name of the application gateway .
* @ param parameters Parameters supplied to the create or update application gateway operation .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < ApplicationGatewayInner > createOrUpdateAsync ( String resourceGroupName , String applicationGatewayName , ApplicationGatewayInner parameters , final ServiceCallback < ApplicationGatewayInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( createOrUpdateWithServiceResponseAsync ( resourceGroupName , applicationGatewayName , parameters ) , serviceCallback ) ; |
public class Matrix3d { /** * / * ( non - Javadoc )
* @ see org . joml . Matrix3dc # invert ( org . joml . Matrix3d ) */
public Matrix3d invert ( Matrix3d dest ) { } } | double s = 1.0 / determinant ( ) ; double nm00 = ( m11 * m22 - m21 * m12 ) * s ; double nm01 = ( m21 * m02 - m01 * m22 ) * s ; double nm02 = ( m01 * m12 - m11 * m02 ) * s ; double nm10 = ( m20 * m12 - m10 * m22 ) * s ; double nm11 = ( m00 * m22 - m20 * m02 ) * s ; double nm12 = ( m10 * m02 - m00 * m12 ) * s ; double nm20 = ( m10 * m21 - m20 * m11 ) * s ; double nm21 = ( m20 * m01 - m00 * m21 ) * s ; double nm22 = ( m00 * m11 - m10 * m01 ) * s ; dest . m00 = nm00 ; dest . m01 = nm01 ; dest . m02 = nm02 ; dest . m10 = nm10 ; dest . m11 = nm11 ; dest . m12 = nm12 ; dest . m20 = nm20 ; dest . m21 = nm21 ; dest . m22 = nm22 ; return dest ; |
public class TypedProperties { /** * Equivalent to { @ link # setString ( String , String )
* setString } { @ code ( key , ( value = = null ) ? null : value . name ( ) ) } . */
public < TEnum extends Enum < TEnum > > void setEnum ( String key , TEnum value ) { } } | setString ( key , ( value == null ) ? null : value . name ( ) ) ; |
public class DescribeSecurityGroupReferencesRequest { /** * The IDs of the security groups in your account .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setGroupId ( java . util . Collection ) } or { @ link # withGroupId ( java . util . Collection ) } if you want to override
* the existing values .
* @ param groupId
* The IDs of the security groups in your account .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeSecurityGroupReferencesRequest withGroupId ( String ... groupId ) { } } | if ( this . groupId == null ) { setGroupId ( new com . amazonaws . internal . SdkInternalList < String > ( groupId . length ) ) ; } for ( String ele : groupId ) { this . groupId . add ( ele ) ; } return this ; |
public class CommonAhoCorasickSegmentUtil { /** * 最长分词 , 合并未知语素
* @ param text 文本
* @ param trie 自动机
* @ param < V > 类型
* @ return 结果链表 */
public static < V > LinkedList < ResultTerm < V > > segment ( String text , AhoCorasickDoubleArrayTrie < V > trie ) { } } | return segment ( text . toCharArray ( ) , trie ) ; |
public class AptEventField { /** * Returns the ControlInterface associated with this event field */
public AptControlInterface getControlInterface ( ) { } } | if ( _controlIntf == null ) { _controlIntf = initControlInterface ( ) ; if ( _controlIntf != null ) initTypeParameterBindings ( ) ; } return _controlIntf ; |
public class AIStreamIterator { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . runtime . SIMPIterator # finished ( ) */
public void finished ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "finished" ) ; msgIterator = null ; aiStream = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "finished" ) ; |
public class dnsaction64 { /** * Use this API to fetch filtered set of dnsaction64 resources .
* filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */
public static dnsaction64 [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | dnsaction64 obj = new dnsaction64 ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; dnsaction64 [ ] response = ( dnsaction64 [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class NetworkWatchersInner { /** * Configures flow log on a specified resource .
* @ param resourceGroupName The name of the network watcher resource group .
* @ param networkWatcherName The name of the network watcher resource .
* @ param parameters Parameters that define the configuration of flow log .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < FlowLogInformationInner > setFlowLogConfigurationAsync ( String resourceGroupName , String networkWatcherName , FlowLogInformationInner parameters ) { } } | return setFlowLogConfigurationWithServiceResponseAsync ( resourceGroupName , networkWatcherName , parameters ) . map ( new Func1 < ServiceResponse < FlowLogInformationInner > , FlowLogInformationInner > ( ) { @ Override public FlowLogInformationInner call ( ServiceResponse < FlowLogInformationInner > response ) { return response . body ( ) ; } } ) ; |
public class JSDocInfoBuilder { /** * Records that the { @ link JSDocInfo } being built should have its
* { @ link JSDocInfo # isConstant ( ) } flag set to { @ code true } .
* @ return { @ code true } if the constancy was recorded and { @ code false }
* if it was already defined */
public boolean recordConstancy ( ) { } } | if ( ! currentInfo . hasConstAnnotation ( ) ) { currentInfo . setConstant ( true ) ; populated = true ; return true ; } else { return false ; } |
public class BooleansBitStore { /** * views */
@ Override public BitStore range ( int from , int to ) { } } | if ( from < 0 ) throw new IllegalArgumentException ( ) ; if ( from > to ) throw new IllegalArgumentException ( ) ; from += start ; to += start ; if ( to > finish ) throw new IllegalArgumentException ( ) ; return new BooleansBitStore ( bits , from , to , mutable ) ; |
public class CodeBlock { /** * A { @ link Collector } implementation that joins { @ link CodeBlock } instances together into one
* separated by { @ code separator } . For example , joining { @ code String s } , { @ code Object o } and
* { @ code int i } using { @ code " , " } would produce { @ code String s , Object o , int i } . */
public static Collector < CodeBlock , ? , CodeBlock > joining ( String separator , String prefix , String suffix ) { } } | Builder builder = builder ( ) . add ( "$N" , prefix ) ; return Collector . of ( ( ) -> new CodeBlockJoiner ( separator , builder ) , CodeBlockJoiner :: add , CodeBlockJoiner :: merge , joiner -> { builder . add ( CodeBlock . of ( "$N" , suffix ) ) ; return joiner . join ( ) ; } ) ; |
public class Retrier { /** * Start to do retries to perform the set action .
* @ return the result of the action , it could be null if there was an exception or if the action itself returns null
* @ throws Exception If a unallowed exception is raised during the action */
public @ CheckForNull V start ( ) throws Exception { } } | V result = null ; int currentAttempt = 0 ; boolean success = false ; while ( currentAttempt < attempts && ! success ) { currentAttempt ++ ; try { if ( LOGGER . isLoggable ( Level . INFO ) ) { LOGGER . log ( Level . INFO , Messages . Retrier_Attempt ( currentAttempt , action ) ) ; } result = callable . call ( ) ; } catch ( Exception e ) { if ( duringActionExceptions == null || Stream . of ( duringActionExceptions ) . noneMatch ( exception -> exception . isAssignableFrom ( e . getClass ( ) ) ) ) { // if the raised exception is not considered as a controlled exception doing the action , rethrow it
LOGGER . log ( Level . WARNING , Messages . Retrier_ExceptionThrown ( currentAttempt , action ) , e ) ; throw e ; } else { // if the exception is considered as a failed action , notify it to the listener
LOGGER . log ( Level . INFO , Messages . Retrier_ExceptionFailed ( currentAttempt , action ) , e ) ; if ( duringActionExceptionListener != null ) { LOGGER . log ( Level . INFO , Messages . Retrier_CallingListener ( e . getLocalizedMessage ( ) , currentAttempt , action ) ) ; result = duringActionExceptionListener . apply ( currentAttempt , e ) ; } } } // After the call and the call to the listener , which can change the result , test the result
success = checkResult . test ( currentAttempt , result ) ; if ( ! success ) { if ( currentAttempt < attempts ) { LOGGER . log ( Level . WARNING , Messages . Retrier_AttemptFailed ( currentAttempt , action ) ) ; LOGGER . log ( Level . FINE , Messages . Retrier_Sleeping ( delay , action ) ) ; try { Thread . sleep ( delay ) ; } catch ( InterruptedException ie ) { LOGGER . log ( Level . FINE , Messages . Retrier_Interruption ( action ) ) ; Thread . currentThread ( ) . interrupt ( ) ; // flag this thread as interrupted
currentAttempt = attempts ; // finish
} } else { // Failed to perform the action
LOGGER . log ( Level . INFO , Messages . Retrier_NoSuccess ( action , attempts ) ) ; } } else { LOGGER . log ( Level . INFO , Messages . Retrier_Success ( action , currentAttempt ) ) ; } } return result ; |
public class ScreenServiceImpl { /** * { @ inheritDoc } */
@ Override public void saveScreenshot ( String screenName , WebElement element ) throws IOException { } } | logger . debug ( "saveScreenshot with the scenario named [{}] and element [{}]" , screenName , element . getTagName ( ) ) ; final byte [ ] screenshot = ( ( TakesScreenshot ) Context . getDriver ( ) ) . getScreenshotAs ( OutputType . BYTES ) ; FileUtils . forceMkdir ( new File ( System . getProperty ( USER_DIR ) + File . separator + DOWNLOADED_FILES_FOLDER ) ) ; InputStream in = new ByteArrayInputStream ( screenshot ) ; BufferedImage fullImg = ImageIO . read ( in ) ; // Get the location of element on the page
Point point = element . getLocation ( ) ; // Get width and height of the element
int eleWidth = element . getSize ( ) . getWidth ( ) ; int eleHeight = element . getSize ( ) . getHeight ( ) ; // Crop the entire page screenshot to get only element screenshot
BufferedImage eleScreenshot = fullImg . getSubimage ( point . getX ( ) , point . getY ( ) , eleWidth , eleHeight ) ; ImageIO . write ( eleScreenshot , "jpg" , new File ( System . getProperty ( USER_DIR ) + File . separator + DOWNLOADED_FILES_FOLDER + File . separator + screenName + ".jpg" ) ) ; |
public class KeyPhraseMarshaller { /** * Marshall the given parameter object . */
public void marshall ( KeyPhrase keyPhrase , ProtocolMarshaller protocolMarshaller ) { } } | if ( keyPhrase == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( keyPhrase . getScore ( ) , SCORE_BINDING ) ; protocolMarshaller . marshall ( keyPhrase . getText ( ) , TEXT_BINDING ) ; protocolMarshaller . marshall ( keyPhrase . getBeginOffset ( ) , BEGINOFFSET_BINDING ) ; protocolMarshaller . marshall ( keyPhrase . getEndOffset ( ) , ENDOFFSET_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class JdbcTable { /** * Execute this SQL seek or open statement .
* Note : This code uses prepared statements to optimize the call of the
* same SQL query . Also , if the table doesn ' t exist , it can be created automatically
* and re - do the call .
* @ param strSQL The SQL statement to prepare .
* @ param vParamList The list of params for the query .
* @ param iType the type of SQL statement .
* @ return number of rows updated .
* @ exception DBException Converts and returns SQLExceptions , or if no rows updated , throws INVALID _ RECORD . */
public ResultSet executeQuery ( String strSQL , int iType , Vector < BaseField > vParamList ) throws DBException { } } | ResultSet resultSet = null ; m_bSelectAllFields = false ; m_rgiFieldColumns = null ; try { Utility . getLogger ( ) . info ( strSQL ) ; if ( SQLParams . USE_SELECT_LITERALS ) { if ( this . getStatement ( iType ) instanceof PreparedStatement ) this . setStatement ( null , iType ) ; // Close old prepared statement
if ( this . getStatement ( iType ) == null ) this . setStatement ( ( ( JdbcDatabase ) this . getDatabase ( ) ) . getJDBCConnection ( ) . createStatement ( ) , iType ) ; resultSet = this . getStatement ( iType ) . executeQuery ( strSQL ) ; } else { if ( this . getStatement ( iType ) != null ) { if ( ! strSQL . equals ( this . getLastSQLStatement ( iType ) ) ) this . setStatement ( null , iType ) ; // Not the same as last time .
} if ( this . getStatement ( iType ) == null ) this . setStatement ( ( ( JdbcDatabase ) this . getDatabase ( ) ) . getJDBCConnection ( ) . prepareStatement ( strSQL ) , iType ) ; this . setLastSQLStatement ( strSQL , iType ) ; m_iNextParam = 1 ; // First param row
this . getRecord ( ) . getKeyArea ( 0 ) ; // Primary index
if ( ( iType == DBConstants . SQL_SELECT_TYPE ) || ( iType == DBConstants . SQL_AUTOSEQUENCE_TYPE ) || ( iType == DBConstants . SQL_SEEK_TYPE ) ) // Have WHERE X = ?
{ if ( vParamList != null ) { for ( Enumeration < BaseField > e = vParamList . elements ( ) ; e . hasMoreElements ( ) ; ) { BaseField field = e . nextElement ( ) ; field . getSQLFromField ( ( PreparedStatement ) this . getStatement ( iType ) , iType , m_iNextParam ) ; m_iNextParam ++ ; } } } resultSet = ( ( PreparedStatement ) this . getStatement ( iType ) ) . executeQuery ( ) ; } } catch ( SQLException e ) { DBException ex = this . getDatabase ( ) . convertError ( e ) ; if ( this . createIfNotFoundError ( ex ) ) { // Table not found , the previous line created the table , re - do the query .
this . getRecord ( ) . setOpenMode ( ( this . getRecord ( ) . getOpenMode ( ) | DBConstants . OPEN_DONT_CREATE ) ) ; // Only try to create once .
return this . executeQuery ( strSQL , iType , vParamList ) ; } else if ( ex . getErrorCode ( ) == DBConstants . BROKEN_PIPE ) { // If there is a pipe timeout or a broken pipe , try to re - establish the connection and try again
if ( ! m_bInRecursiveCall ) { m_bInRecursiveCall = true ; this . close ( ) ; this . getDatabase ( ) . close ( ) ; // Next access will force an open .
ResultSet result = this . executeQuery ( strSQL , iType , vParamList ) ; m_bInRecursiveCall = false ; return result ; } } throw ex ; } if ( strSQL . indexOf ( '*' ) != - 1 ) { m_bSelectAllFields = true ; m_iColumn = 1 ; // First column
} return resultSet ; |
public class PresentationManager { /** * Getter for an object property value
* @ param obj The object
* @ param propertyName The property
* @ return The value of the property of the object */
public Object get ( Object obj , String propertyName ) { } } | try { if ( obj != null && propertyName != null ) { return PropertyUtils . getNestedProperty ( obj , propertyName ) ; } } catch ( NullPointerException e ) { } catch ( NestedNullException e ) { } catch ( Exception e ) { // Now I don ' t like it .
error ( e ) ; return "-undefined-" ; } return null ; |
public class JpaSearchRepository { /** * { @ inheritDoc } */
public T findById ( ID id ) { } } | T retVal = ( T ) getEntityManager ( ) . find ( getEntityClass ( ) , id ) ; return retVal ; |
public class HString { /** * Finds all occurrences of the given text in this HString starting
* @ param text the text to search for
* @ return A list of HString that are matches to the given string */
public Stream < HString > findAll ( @ NonNull String text ) { } } | return Streams . asStream ( new Iterator < HString > ( ) { Integer pos = null ; int start = 0 ; private boolean advance ( ) { if ( pos == null ) { pos = indexOf ( text , start ) ; } return pos != - 1 ; } @ Override public boolean hasNext ( ) { return advance ( ) ; } @ Override public HString next ( ) { if ( ! advance ( ) ) { throw new NoSuchElementException ( ) ; } int n = pos ; pos = null ; start = n + 1 ; // If we have tokens expand the match to the overlaping tokens .
if ( document ( ) != null && document ( ) . isCompleted ( Types . TOKEN ) ) { return union ( substring ( n , n + text . length ( ) ) . tokens ( ) ) ; } return substring ( n , n + text . length ( ) ) ; } } ) ; |
public class CollectionsInterface { /** * Retrieves a list of the current Commons institutions .
* This method does not require authentication .
* @ param collectionId
* the id of the collection ( optional - returns all if not specified ) .
* @ param userId
* the user id of the collection owner ( optional - defaults to calling user ) .
* @ return List of Institution
* @ throws FlickrException */
public List < Collection > getTree ( String collectionId , String userId ) throws FlickrException { } } | Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_TREE ) ; if ( collectionId != null ) { parameters . put ( "collection_id" , collectionId ) ; } if ( userId != null ) { parameters . put ( "user_id" , userId ) ; } Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } List < Collection > collections = new ArrayList < Collection > ( ) ; Element mElement = response . getPayload ( ) ; NodeList collectionElements = mElement . getElementsByTagName ( "collection" ) ; for ( int i = 0 ; i < collectionElements . getLength ( ) ; i ++ ) { Element element = ( Element ) collectionElements . item ( i ) ; collections . add ( parseTreeCollection ( element ) ) ; } return collections ; |
public class JettyHandler { /** * process write message and status on the response .
* @ param response
* @ param message
* @ param status
* @ throws IOException */
private void writeMessage ( final HttpServletResponse response , final String message , final int status ) throws IOException { } } | response . getWriter ( ) . println ( message ) ; response . setStatus ( status ) ; |
public class AbstractStoreResource { /** * { @ inheritDoc } */
@ Override public void open ( final StoreEvent _event ) throws EFapsException { } } | this . storeEvent = _event ; super . open ( ) ; if ( getStoreEvent ( ) . equals ( StoreEvent . READ ) || getStoreEvent ( ) . equals ( StoreEvent . WRITE ) ) { insertDefaults ( ) ; } |
public class BigtableAsyncAdmin { /** * { @ inheritDoc } */
@ Override public CompletableFuture < Boolean > isTableDisabled ( TableName tableName ) { } } | // TODO : this might require a tableExists ( ) check , and throw an exception if it doesn ' t .
return CompletableFuture . completedFuture ( disabledTables . contains ( tableName ) ) ; |
public class JBBPDslBuilder { /** * Set byte order for next fields
* @ param order order , if null then BIG _ ENDIAN
* @ return the builder instance , must not be null */
public JBBPDslBuilder ByteOrder ( final JBBPByteOrder order ) { } } | this . byteOrder = order == null ? JBBPByteOrder . BIG_ENDIAN : order ; return this ; |
public class WriteFileExtensions { /** * The Method write2File ( ) writes the File into the PrintWriter .
* @ param inputFile
* The Name from the File to read and copy .
* @ param writer
* The PrintWriter to write into .
* @ throws FileNotFoundException
* is thrown if an attempt to open the file denoted by a specified pathname has
* failed .
* @ throws IOException
* Signals that an I / O exception has occurred . */
public static void write2File ( final String inputFile , final Writer writer ) throws FileNotFoundException , IOException { } } | try ( BufferedReader bufferedReader = new BufferedReader ( new FileReader ( inputFile ) ) ; ) { write2File ( bufferedReader , writer ) ; } |
public class OpenshiftAdapterSupport { /** * Check if OpenShift API Groups are available
* @ param client The client .
* @ return True if the new < code > / apis / * . openshift . io / < / code > APIs are found in the root paths . */
static boolean isOpenShiftAPIGroups ( Client client ) { } } | Config configuration = client . getConfiguration ( ) ; if ( configuration instanceof OpenShiftConfig ) { OpenShiftConfig openShiftConfig = ( OpenShiftConfig ) configuration ; if ( openShiftConfig . isDisableApiGroupCheck ( ) ) { return false ; } } URL masterUrl = client . getMasterUrl ( ) ; if ( isOpenShift ( client ) && USES_OPENSHIFT_APIGROUPS . containsKey ( masterUrl ) ) { return USES_OPENSHIFT_APIGROUPS . get ( masterUrl ) ; } return false ; |
public class BucketPath { /** * A wrapper around
* { @ link BucketPath # replaceShorthand ( char , Map , TimeZone , boolean , int ,
* int , boolean ) }
* with the timezone set to the default .
* < p > This static method will be REMOVED in a future version of Flume < / p > */
@ Deprecated public static String replaceShorthand ( char c , Map < String , String > headers , boolean needRounding , int unit , int roundDown ) { } } | return replaceShorthand ( c , headers , null , needRounding , unit , roundDown , false ) ; |
public class BlackDuckService { public < T extends BlackDuckResponse > T getResponse ( UriSingleResponse < T > uriSingleResponse ) throws IntegrationException { } } | Request request = RequestFactory . createCommonGetRequest ( uriSingleResponse . getUri ( ) ) ; return blackDuckResponseTransformer . getResponse ( request , uriSingleResponse . getResponseClass ( ) ) ; |
public class Main { /** * Runs the grammar checker on paragraph text .
* @ param docID document ID
* @ param paraText paragraph text
* @ param locale Locale the text Locale
* @ param startOfSentencePos start of sentence position
* @ param nSuggestedBehindEndOfSentencePosition end of sentence position
* @ return ProofreadingResult containing the results of the check . */
@ Override public final ProofreadingResult doProofreading ( String docID , String paraText , Locale locale , int startOfSentencePos , int nSuggestedBehindEndOfSentencePosition , PropertyValue [ ] propertyValues ) { } } | ProofreadingResult paRes = new ProofreadingResult ( ) ; paRes . nStartOfSentencePosition = startOfSentencePos ; paRes . nStartOfNextSentencePosition = nSuggestedBehindEndOfSentencePosition ; paRes . nBehindEndOfSentencePosition = paRes . nStartOfNextSentencePosition ; paRes . xProofreader = this ; paRes . aLocale = locale ; paRes . aDocumentIdentifier = docID ; paRes . aText = paraText ; paRes . aProperties = propertyValues ; try { int [ ] footnotePositions = getPropertyValues ( "FootnotePositions" , propertyValues ) ; // since LO 4.3
paRes = documents . getCheckResults ( paraText , locale , paRes , footnotePositions ) ; if ( disabledRules == null ) { prepareConfig ( ) ; } if ( documents . doResetCheck ( ) ) { resetCheck ( ) ; documents . optimizeReset ( ) ; } } catch ( Throwable t ) { MessageHandler . showError ( t ) ; } return paRes ; |
public class VerbFeats { /** * setter for person - sets Person
* @ generated
* @ param v value to set into the feature */
public void setPerson ( String v ) { } } | if ( VerbFeats_Type . featOkTst && ( ( VerbFeats_Type ) jcasType ) . casFeat_person == null ) jcasType . jcas . throwFeatMissing ( "person" , "de.julielab.jules.types.VerbFeats" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( VerbFeats_Type ) jcasType ) . casFeatCode_person , v ) ; |
public class DefaultEntityHandler { /** * SQL _ ID文字列の生成
* @ param metadata エンティティメタ情報
* @ param entityType エイティティタイプ
* @ return SQL _ ID文字列 */
private String createSqlId ( final TableMetadata metadata , final Class < ? extends Object > entityType ) { } } | return "mapping @ " + ( entityType != null ? entityType . getSimpleName ( ) : metadata . getTableName ( ) ) ; |
public class SortedSetIterables { /** * Returns an Immutable version of powerset where the inner sets are also immutable . */
public static < T > ImmutableSortedSet < ImmutableSortedSet < T > > immutablePowerSet ( SortedSet < T > set ) { } } | return powerSet ( set ) . collect ( new Function < MutableSortedSet < T > , ImmutableSortedSet < T > > ( ) { public ImmutableSortedSet < T > valueOf ( MutableSortedSet < T > set ) { return set . toImmutable ( ) ; } } , TreeSortedSet . < ImmutableSortedSet < T > > newSet ( Comparators . < T > powerSet ( ) ) ) . toImmutable ( ) ; |
public class FlowPath { /** * This method allows to set position for next rewind within graph .
* PLEASE NOTE : This methods check , if rewind position wasn ' t set yet . If it was already set for this frame - it ' ll be no - op method
* @ param frameName
* @ param position */
public void setRewindPositionOnce ( @ NonNull String frameName , int position ) { } } | if ( getRewindPosition ( frameName ) >= 0 ) return ; frames . get ( frameName ) . setRewindPosition ( position ) ; |
public class ProgressManager { /** * Close the progress and all tasks associated with it . */
@ Override public void close ( ) { } } | synchronized ( startedTasks ) { if ( executor . isShutdown ( ) ) { return ; } // . . . stop updater thread . Do not interrupt .
executor . shutdown ( ) ; try { updater . get ( ) ; } catch ( InterruptedException | CancellationException | ExecutionException ignore ) { // Ignore these closing thread errors .
} // And stop all the tasks , do interrupting .
for ( InternalTask task : startedTasks ) { task . cancel ( true ) ; } for ( InternalTask task : queuedTasks ) { task . close ( ) ; } try { executor . awaitTermination ( 100L , TimeUnit . MILLISECONDS ) ; } catch ( InterruptedException ignore ) { Thread . currentThread ( ) . interrupt ( ) ; } } |
public class InfinispanRemoteConfiguration { /** * We provide some default values in case some properties are not set */
private void setExpectedPropertiesIfNull ( Properties hotRodConfiguration ) { } } | for ( int i = 0 ; i < expectedValuesForHotRod . length ; i ++ ) { String property = expectedValuesForHotRod [ i ] [ 0 ] ; String expectedValue = expectedValuesForHotRod [ i ] [ 1 ] ; if ( ! hotRodConfiguration . containsKey ( property ) ) { hotRodConfiguration . setProperty ( property , expectedValue ) ; } } |
public class CmsADECache { /** * Returns the cached container page under the given key and for the given project . < p >
* @ param key the cache key
* @ param online if cached in online or offline project
* @ return the cached container page or < code > null < / code > if not found */
public CmsXmlContainerPage getCacheContainerPage ( String key , boolean online ) { } } | try { m_lock . readLock ( ) . lock ( ) ; CmsXmlContainerPage retValue ; if ( online ) { retValue = m_containerPagesOnline . get ( key ) ; if ( LOG . isDebugEnabled ( ) ) { if ( retValue == null ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_DEBUG_CACHE_MISSED_ONLINE_1 , new Object [ ] { key } ) ) ; } else { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_DEBUG_CACHE_MATCHED_ONLINE_2 , new Object [ ] { key , retValue } ) ) ; } } } else { retValue = m_containerPagesOffline . get ( key ) ; if ( LOG . isDebugEnabled ( ) ) { if ( retValue == null ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_DEBUG_CACHE_MISSED_OFFLINE_1 , new Object [ ] { key } ) ) ; } else { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_DEBUG_CACHE_MATCHED_OFFLINE_2 , new Object [ ] { key , retValue } ) ) ; } } } if ( retValue != null ) { // System . out . println ( " got cached page : " + retValue . getFile ( ) . getRootPath ( ) ) ;
} return retValue ; } finally { m_lock . readLock ( ) . unlock ( ) ; } |
public class Tile { /** * Defines the behavior of the visualization where the needle / bar should
* always return to 0 after it reached the final value . This setting only makes
* sense if animated = = true and the data rate is not too high .
* Set to false when using real measured live data .
* @ param IS _ TRUE */
public void setReturnToZero ( final boolean IS_TRUE ) { } } | if ( null == returnToZero ) { _returnToZero = Double . compare ( getMinValue ( ) , 0.0 ) <= 0 && IS_TRUE ; fireTileEvent ( REDRAW_EVENT ) ; } else { returnToZero . set ( IS_TRUE ) ; } |
public class InternalSARLParser { /** * $ ANTLR start synpred41 _ InternalSARL */
public final void synpred41_InternalSARL_fragment ( ) throws RecognitionException { } } | // InternalSARL . g : 13266:6 : ( ( ( ) ( ' . ' | ( ( ' : : ' ) ) ) ( ( ruleFeatureCallID ) ) ruleOpSingleAssign ) )
// InternalSARL . g : 13266:7 : ( ( ) ( ' . ' | ( ( ' : : ' ) ) ) ( ( ruleFeatureCallID ) ) ruleOpSingleAssign )
{ // InternalSARL . g : 13266:7 : ( ( ) ( ' . ' | ( ( ' : : ' ) ) ) ( ( ruleFeatureCallID ) ) ruleOpSingleAssign )
// InternalSARL . g : 13267:7 : ( ) ( ' . ' | ( ( ' : : ' ) ) ) ( ( ruleFeatureCallID ) ) ruleOpSingleAssign
{ // InternalSARL . g : 13267:7 : ( )
// InternalSARL . g : 13268:7:
{ } // InternalSARL . g : 13269:7 : ( ' . ' | ( ( ' : : ' ) ) )
int alt393 = 2 ; int LA393_0 = input . LA ( 1 ) ; if ( ( LA393_0 == 77 ) ) { alt393 = 1 ; } else if ( ( LA393_0 == 127 ) ) { alt393 = 2 ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } NoViableAltException nvae = new NoViableAltException ( "" , 393 , 0 , input ) ; throw nvae ; } switch ( alt393 ) { case 1 : // InternalSARL . g : 13270:8 : ' . '
{ match ( input , 77 , FOLLOW_126 ) ; if ( state . failed ) return ; } break ; case 2 : // InternalSARL . g : 13272:8 : ( ( ' : : ' ) )
{ // InternalSARL . g : 13272:8 : ( ( ' : : ' ) )
// InternalSARL . g : 13273:9 : ( ' : : ' )
{ // InternalSARL . g : 13273:9 : ( ' : : ' )
// InternalSARL . g : 13274:10 : ' : : '
{ match ( input , 127 , FOLLOW_126 ) ; if ( state . failed ) return ; } } } break ; } // InternalSARL . g : 13278:7 : ( ( ruleFeatureCallID ) )
// InternalSARL . g : 13279:8 : ( ruleFeatureCallID )
{ // InternalSARL . g : 13279:8 : ( ruleFeatureCallID )
// InternalSARL . g : 13280:9 : ruleFeatureCallID
{ pushFollow ( FOLLOW_83 ) ; ruleFeatureCallID ( ) ; state . _fsp -- ; if ( state . failed ) return ; } } pushFollow ( FOLLOW_2 ) ; ruleOpSingleAssign ( ) ; state . _fsp -- ; if ( state . failed ) return ; } } |
public class Matrix4d { /** * / * ( non - Javadoc )
* @ see org . joml . Matrix4dc # get ( double [ ] , int ) */
public double [ ] get ( double [ ] dest , int offset ) { } } | dest [ offset + 0 ] = m00 ; dest [ offset + 1 ] = m01 ; dest [ offset + 2 ] = m02 ; dest [ offset + 3 ] = m03 ; dest [ offset + 4 ] = m10 ; dest [ offset + 5 ] = m11 ; dest [ offset + 6 ] = m12 ; dest [ offset + 7 ] = m13 ; dest [ offset + 8 ] = m20 ; dest [ offset + 9 ] = m21 ; dest [ offset + 10 ] = m22 ; dest [ offset + 11 ] = m23 ; dest [ offset + 12 ] = m30 ; dest [ offset + 13 ] = m31 ; dest [ offset + 14 ] = m32 ; dest [ offset + 15 ] = m33 ; return dest ; |
public class ExternalResource { /** * Creates a statement that will execute { @ code before ) and { @ code after )
* @ param base
* the base statement to be executed
* @ return
* the statement for invoking before and after */
private Statement statement ( final Statement base ) { } } | return new Statement ( ) { @ Override public void evaluate ( ) throws Throwable { before ( ) ; doStateTransition ( State . BEFORE_EXECUTED ) ; try { base . evaluate ( ) ; } finally { after ( ) ; doStateTransition ( State . AFTER_EXECUTED ) ; } } } ; |
public class Persistables { /** * Returns a newly allocated { @ link ByteBuffer # slice ( ) } , starting from the current { @ link ByteBuffer # position ( ) position } , of
* a given { @ link ByteBuffer } . The slice and the original buffer will share their contents . < br > Upon return from this
* method , the original buffer ' s { @ link ByteBuffer # position ( ) position } will have advanced by { @ code length } , and the returned
* buffer ' s position will be 0.
* This method is not thread - safe .
* @ param buffer The buffer to slice .
* @ param length The length in bytes of the slice .
* @ return A slice of the buffer .
* @ see ByteBuffer # slice ( ) */
public static ByteBuffer slice ( ByteBuffer buffer , int length ) { } } | final int l = buffer . limit ( ) ; buffer . limit ( buffer . position ( ) + length ) ; final ByteBuffer slice = buffer . slice ( ) ; buffer . limit ( l ) ; buffer . position ( buffer . position ( ) + length ) ; return slice ; |
public class ArrayOfDoublesSketch { /** * Wrap the given Memory and seed as a ArrayOfDoublesSketch
* @ param mem the given Memory
* @ param seed the given seed
* @ return an ArrayOfDoublesSketch */
public static ArrayOfDoublesSketch wrap ( final Memory mem , final long seed ) { } } | final SerializerDeserializer . SketchType sketchType = SerializerDeserializer . getSketchType ( mem ) ; if ( sketchType == SerializerDeserializer . SketchType . ArrayOfDoublesQuickSelectSketch ) { return new DirectArrayOfDoublesQuickSelectSketchR ( mem , seed ) ; } return new DirectArrayOfDoublesCompactSketch ( mem , seed ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcConic ( ) { } } | if ( ifcConicEClass == null ) { ifcConicEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 119 ) ; } return ifcConicEClass ; |
public class StoreRoutingPlan { /** * Converts from partitionId to nodeId . The list of partition IDs ,
* partitionIds , is expected to be a " replicating partition list " , i . e . , the
* mapping from partition ID to node ID should be one to one .
* @ param partitionIds List of partition IDs for which to find the Node ID
* for the Node that owns the partition .
* @ return List of node ids , one for each partition ID in partitionIds
* @ throws VoldemortException If multiple partition IDs in partitionIds map
* to the same Node ID . */
private List < Integer > getNodeIdListForPartitionIdList ( List < Integer > partitionIds ) throws VoldemortException { } } | List < Integer > nodeIds = new ArrayList < Integer > ( partitionIds . size ( ) ) ; for ( Integer partitionId : partitionIds ) { int nodeId = getNodeIdForPartitionId ( partitionId ) ; if ( nodeIds . contains ( nodeId ) ) { throw new VoldemortException ( "Node ID " + nodeId + " already in list of Node IDs." ) ; } else { nodeIds . add ( nodeId ) ; } } return nodeIds ; |
public class ConverterManager { /** * Gets the best converter for the object specified .
* @ param object the object to convert
* @ return the converter to use
* @ throws IllegalArgumentException if no suitable converter
* @ throws IllegalStateException if multiple converters match the type
* equally well */
public IntervalConverter getIntervalConverter ( Object object ) { } } | IntervalConverter converter = ( IntervalConverter ) iIntervalConverters . select ( object == null ? null : object . getClass ( ) ) ; if ( converter != null ) { return converter ; } throw new IllegalArgumentException ( "No interval converter found for type: " + ( object == null ? "null" : object . getClass ( ) . getName ( ) ) ) ; |
public class Kryo { /** * Instances of the specified class will use the specified serializer when { @ link # register ( Class ) } or
* { @ link # register ( Class , int ) } are called . Serializer instances are created as needed via
* { @ link ReflectionSerializerFactory # newSerializer ( Kryo , Class , Class ) } . By default , the following classes have a default
* serializer set :
* < table >
* < tr >
* < td > boolean < / td >
* < td > Boolean < / td >
* < td > byte < / td >
* < td > Byte < / td >
* < td > char < / td >
* < tr >
* < / tr >
* < td > Character < / td >
* < td > short < / td >
* < td > Short < / td >
* < td > int < / td >
* < td > Integer < / td >
* < tr >
* < / tr >
* < td > long < / td >
* < td > Long < / td >
* < td > float < / td >
* < td > Float < / td >
* < td > double < / td >
* < tr >
* < / tr >
* < td > Double < / td >
* < td > String < / td >
* < td > byte [ ] < / td >
* < td > char [ ] < / td >
* < td > short [ ] < / td >
* < tr >
* < / tr >
* < td > int [ ] < / td >
* < td > long [ ] < / td >
* < td > float [ ] < / td >
* < td > double [ ] < / td >
* < td > String [ ] < / td >
* < tr >
* < / tr >
* < td > Object [ ] < / td >
* < td > Map < / td >
* < td > BigInteger < / td >
* < td > BigDecimal < / td >
* < td > KryoSerializable < / td >
* < / tr >
* < tr >
* < td > Collection < / td >
* < td > Date < / td >
* < td > Collections . emptyList < / td >
* < td > Collections . singleton < / td >
* < td > Currency < / td >
* < / tr >
* < tr >
* < td > StringBuilder < / td >
* < td > Enum < / td >
* < td > Collections . emptyMap < / td >
* < td > Collections . emptySet < / td >
* < td > Calendar < / td >
* < / tr >
* < tr >
* < td > StringBuffer < / td >
* < td > Class < / td >
* < td > Collections . singletonList < / td >
* < td > Collections . singletonMap < / td >
* < td > TimeZone < / td >
* < / tr >
* < tr >
* < td > TreeMap < / td >
* < td > EnumSet < / td >
* < / tr >
* < / table >
* Note that the order default serializers are added is important for a class that may match multiple types . The above default
* serializers always have a lower priority than subsequent default serializers that are added . */
public void addDefaultSerializer ( Class type , Class < ? extends Serializer > serializerClass ) { } } | if ( type == null ) throw new IllegalArgumentException ( "type cannot be null." ) ; if ( serializerClass == null ) throw new IllegalArgumentException ( "serializerClass cannot be null." ) ; insertDefaultSerializer ( type , new ReflectionSerializerFactory ( serializerClass ) ) ; |
public class AmazonWorkLinkClient { /** * Retrieves a list of domains associated to a specified fleet .
* @ param listDomainsRequest
* @ return Result of the ListDomains operation returned by the service .
* @ throws UnauthorizedException
* You are not authorized to perform this action .
* @ throws InternalServerErrorException
* The service is temporarily unavailable .
* @ throws InvalidRequestException
* The request is not valid .
* @ throws TooManyRequestsException
* The number of requests exceeds the limit .
* @ sample AmazonWorkLink . ListDomains
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / worklink - 2018-09-25 / ListDomains " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public ListDomainsResult listDomains ( ListDomainsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListDomains ( request ) ; |
public class CPDAvailabilityEstimatePersistenceImpl { /** * Returns a range of all the cpd availability estimates where commerceAvailabilityEstimateId = & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CPDAvailabilityEstimateModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param commerceAvailabilityEstimateId the commerce availability estimate ID
* @ param start the lower bound of the range of cpd availability estimates
* @ param end the upper bound of the range of cpd availability estimates ( not inclusive )
* @ return the range of matching cpd availability estimates */
@ Override public List < CPDAvailabilityEstimate > findByCommerceAvailabilityEstimateId ( long commerceAvailabilityEstimateId , int start , int end ) { } } | return findByCommerceAvailabilityEstimateId ( commerceAvailabilityEstimateId , start , end , null ) ; |
public class ReducedArchiver { /** * Return a pre - configured manifest
* @ todo Add user attributes list and user groups list */
public Manifest getManifest ( MavenProject project , ManifestConfiguration config ) throws ManifestException , DependencyResolutionRequiredException { } } | // Added basic entries
Manifest m = new Manifest ( ) ; Manifest . Attribute buildAttr = new Manifest . Attribute ( "Built-By" , System . getProperty ( "user.name" ) ) ; m . addConfiguredAttribute ( buildAttr ) ; Manifest . Attribute createdAttr = new Manifest . Attribute ( "Created-By" , "Apache Maven" ) ; m . addConfiguredAttribute ( createdAttr ) ; if ( config . getPackageName ( ) != null ) { Manifest . Attribute packageAttr = new Manifest . Attribute ( "Package" , config . getPackageName ( ) ) ; m . addConfiguredAttribute ( packageAttr ) ; } Manifest . Attribute buildJdkAttr = new Manifest . Attribute ( "Build-Jdk" , System . getProperty ( "java.version" ) ) ; m . addConfiguredAttribute ( buildJdkAttr ) ; if ( config . isAddClasspath ( ) ) { StringBuffer classpath = new StringBuffer ( ) ; List artifacts = project . getRuntimeClasspathElements ( ) ; String classpathPrefix = config . getClasspathPrefix ( ) ; for ( Iterator iter = artifacts . iterator ( ) ; iter . hasNext ( ) ; ) { File f = new File ( ( String ) iter . next ( ) ) ; if ( f . isFile ( ) ) { if ( classpath . length ( ) > 0 ) { classpath . append ( " " ) ; } classpath . append ( classpathPrefix ) ; classpath . append ( f . getName ( ) ) ; } } if ( classpath . length ( ) > 0 ) { Manifest . Attribute classpathAttr = new Manifest . Attribute ( "Class-Path" , classpath . toString ( ) ) ; m . addConfiguredAttribute ( classpathAttr ) ; } } String mainClass = config . getMainClass ( ) ; if ( mainClass != null && ! "" . equals ( mainClass ) ) { Manifest . Attribute mainClassAttr = new Manifest . Attribute ( "Main-Class" , mainClass ) ; m . addConfiguredAttribute ( mainClassAttr ) ; } return m ; |
public class RootBeer { /** * Run all the checks apart from checking for the busybox binary . This is because it can sometimes be a false positive
* as some manufacturers leave the binary in production builds .
* @ return true , we think there ' s a good * indication * of root | false good * indication * of no root ( could still be cloaked ) */
public boolean isRootedWithoutBusyBoxCheck ( ) { } } | return detectRootManagementApps ( ) || detectPotentiallyDangerousApps ( ) || checkForBinary ( BINARY_SU ) || checkForDangerousProps ( ) || checkForRWPaths ( ) || detectTestKeys ( ) || checkSuExists ( ) || checkForRootNative ( ) || checkForMagiskBinary ( ) ; |
public class MapTileCollisionLoader { /** * Load map collision from an external file .
* @ param mapCollision The map tile collision owner .
* @ param collisionFormulas The collision formulas descriptor .
* @ param collisionGroups The tile collision groups descriptor .
* @ throws LionEngineException If error when reading collisions . */
public void loadCollisions ( MapTileCollision mapCollision , Media collisionFormulas , Media collisionGroups ) { } } | if ( collisionFormulas . exists ( ) ) { loadCollisionFormulas ( collisionFormulas ) ; } if ( collisionGroups . exists ( ) ) { loadCollisionGroups ( mapCollision , collisionGroups ) ; } loadTilesCollisions ( mapCollision ) ; applyConstraints ( ) ; |
public class BorderSpecification { /** * / * default */
char horizontals ( int row , int column ) { } } | boolean result = ( match & TOP ) == TOP && row == row1 ; result |= ( match & INNER_HORIZONTAL ) == INNER_HORIZONTAL && row > row1 && row < row2 ; result |= ( match & BOTTOM ) == BOTTOM && row == row2 ; result &= column >= column1 ; result &= column < column2 ; return result ? style . horizontalGlyph ( ) : BorderStyle . NONE ; |
public class MBeanRegistratorImpl { /** * Returns either a AnnotatedStandardMBean or a DynamicMBean implementation .
* @ param object Object to create MBean for .
* @ return either a AnnotatedStandardMBean or a DynamicMBean implementation .
* @ throws IllegalArgumentException
* @ throws NotCompliantMBeanException */
private Object toMBean ( Object object ) throws IllegalArgumentException , NotCompliantMBeanException { } } | JmxBean jmxBean = AnnotationUtils . getAnnotation ( object . getClass ( ) , JmxBean . class ) ; if ( DynamicMBean . class . isAssignableFrom ( object . getClass ( ) ) ) { return object ; } ClassIntrospector classIntrospector = new ClassIntrospectorImpl ( object . getClass ( ) ) ; Class < ? > mBeanInterface = classIntrospector . getInterface ( new ClassFilterBuilder ( ) . name ( object . getClass ( ) . getName ( ) . replace ( "." , "\\." ) + "MBean" ) . build ( ) ) ; if ( mBeanInterface != null ) { return new AnnotatedStandardMBean ( object , mBeanInterface ) ; } Class < ? > mxBeanInterface = classIntrospector . getInterface ( new ClassFilterBuilder ( ) . name ( ".*MXBean" ) . or ( ) . annotated ( MXBean . class ) . build ( ) ) ; if ( mxBeanInterface != null ) { return new AnnotatedStandardMBean ( object , mxBeanInterface , true ) ; } // Interface set on JmxBean annotation
if ( ! jmxBean . managedInterface ( ) . equals ( EmptyInterface . class ) ) { if ( implementsInterface ( object , jmxBean . managedInterface ( ) ) ) { return new AnnotatedStandardMBean ( object , jmxBean . managedInterface ( ) ) ; } else { throw new IllegalArgumentException ( JmxBean . class + " attribute managedInterface is set to " + jmxBean . managedInterface ( ) + " but " + object . getClass ( ) + " does not implement that interface" ) ; } } // Search for an implemented interface annotated with JmxInterface
Class < ? > annotatedInterface = classIntrospector . getInterface ( new ClassFilterBuilder ( ) . annotated ( JmxInterface . class ) . build ( ) ) ; if ( annotatedInterface != null ) { return new AnnotatedStandardMBean ( object , jmxBean . managedInterface ( ) ) ; } // Create DynamicMBean by using reflection and inspecting annotations
return dynamicBeanFactory . getMBeanFor ( object ) ; |
public class XFactory { /** * Get the XClass object providing information about the class named by the
* given ClassDescriptor .
* @ param classDescriptor
* a ClassDescriptor
* @ return an XClass object providing information about the class , or null
* if the class cannot be found */
public @ CheckForNull XClass getXClass ( ClassDescriptor classDescriptor ) { } } | try { IAnalysisCache analysisCache = Global . getAnalysisCache ( ) ; return analysisCache . getClassAnalysis ( XClass . class , classDescriptor ) ; } catch ( CheckedAnalysisException e ) { return null ; } |
public class DataStoreEvent { /** * Removal event .
* @ param removals Removal
* @ return Event */
public static DataStoreEvent removalEvent ( DBIDs removals ) { } } | return new DataStoreEvent ( DBIDUtil . EMPTYDBIDS , removals , DBIDUtil . EMPTYDBIDS ) ; |
public class CommerceAccountPersistenceImpl { /** * Returns the commerce account where companyId = & # 63 ; and externalReferenceCode = & # 63 ; or throws a { @ link NoSuchAccountException } if it could not be found .
* @ param companyId the company ID
* @ param externalReferenceCode the external reference code
* @ return the matching commerce account
* @ throws NoSuchAccountException if a matching commerce account could not be found */
@ Override public CommerceAccount findByC_ERC ( long companyId , String externalReferenceCode ) throws NoSuchAccountException { } } | CommerceAccount commerceAccount = fetchByC_ERC ( companyId , externalReferenceCode ) ; if ( commerceAccount == null ) { StringBundler msg = new StringBundler ( 6 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "companyId=" ) ; msg . append ( companyId ) ; msg . append ( ", externalReferenceCode=" ) ; msg . append ( externalReferenceCode ) ; msg . append ( "}" ) ; if ( _log . isDebugEnabled ( ) ) { _log . debug ( msg . toString ( ) ) ; } throw new NoSuchAccountException ( msg . toString ( ) ) ; } return commerceAccount ; |
public class ReadCommEventLogResponse { /** * readData - - input the Modbus message from din . If there was a header ,
* such as for Modbus / TCP , it will have been read already .
* @ throws java . io . IOException If the data cannot be read */
public void readData ( DataInput din ) throws IOException { } } | byteCount = din . readByte ( ) ; status = din . readUnsignedShort ( ) ; eventCount = din . readUnsignedShort ( ) ; messageCount = din . readUnsignedShort ( ) ; events = new byte [ byteCount - 6 ] ; if ( events . length > 0 ) { din . readFully ( events , 0 , events . length ) ; } |
public class HiveTask { /** * Run the specified setup query on the Hive session before running the task . */
public static void addSetupQuery ( State state , String query ) { } } | state . setProp ( SETUP_QUERIES , state . getProp ( SETUP_QUERIES , "" ) + ";" + query ) ; |
public class DateTimeKit { /** * 格式化时间戳为制定的style
* @ param style
* @ param unixtime
* @ return */
public static String formatUnixTime ( String style , BigInteger unixtime ) { } } | SimpleDateFormat sdf = new SimpleDateFormat ( style ) ; return sdf . format ( unixtime ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcZone ( ) { } } | if ( ifcZoneEClass == null ) { ifcZoneEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 653 ) ; } return ifcZoneEClass ; |
public class JQMListBindable { /** * Needed in case of renderer changed , so list has to be visually reconstructed by new renderer . */
public void rerender ( ) { } } | clear ( ) ; if ( dataItems != null ) { for ( M m : dataItems ) { addDataItem ( m ) ; } } doRefresh ( ) ; |
public class ServiceAccount { /** * Returns an instance of ServiceAccount . This factory method tries below in order .
* < ol >
* < li > Checks environment variables < code > GP _ URL < / code > ( service URL - e . g .
* https : / / gp - rest . ng . bluemix . net / translate / rest ) , < code > GP _ INSTANCE _ ID < / code >
* ( service instance ID - e . g . d3f537cd617f34c86ac6b270f3065e73 ) ,
* < code > GP _ USER _ ID < / code > ( user ID - e . g . e92a1282a0e4f97bec93aa9f56fdb838)
* and < code > GP _ PASSWORD < / code > ( password - e . g . zg5SlD + ftXYRIZDblLgEA / ILkkCNqE1y ) .
* If all of above are defined , this method calls
* { @ link # getInstance ( String , String , String , String ) } with these environment
* variable values . < / li >
* < li > Checks < code > VCAP _ SERVICES < / code > environment variable . If the variable
* is defined and an entry for IBM Globalization Pipeline service is available ,
* use the values in the JSON < code > credentials < / code > object . When multiple entries
* for IBM Globalization Pipeline service are found , the first one will be used .
* unless < code > GP _ SERVICE _ NAME < / code > and / or < code > GP _ SERVICE _ INSTANCE _ NAME < / code >
* are not defined . < / li >
* < li > If both of above failed , returns null . < / li >
* < / ol >
* @ return An instance of ServiceAccount , or null if service configuration is
* not available . */
public static ServiceAccount getInstance ( ) { } } | ServiceAccount account = getInstanceByEnvVars ( ) ; if ( account == null ) { Map < String , String > env = System . getenv ( ) ; String serviceName = env . get ( GP_SERVICE_NAME ) ; String serviceInstanceName = env . get ( GP_SERVICE_INSTANCE_NAME ) ; account = getInstanceByVcapServices ( serviceName , serviceInstanceName ) ; } return account ; |
public class RuntimeEnvironmentBuilder { /** * Builds a RuntimeEnvironment .
* @ return a RuntimeEnvironment */
public RuntimeEnvironment build ( ) { } } | final org . kie . api . runtime . manager . RuntimeEnvironmentBuilder jbpmRuntimeEnvironmentBuilder ; Manifest manifest = _manifestBuilder . build ( ) ; if ( manifest instanceof RemoteManifest ) { RemoteManifest remoteManifest = ( RemoteManifest ) manifest ; jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory . newDefaultInMemoryBuilder ( ) ; remoteManifest . addToEnvironment ( jbpmRuntimeEnvironmentBuilder ) ; // we dont ' do any other building for remote usage
return jbpmRuntimeEnvironmentBuilder . get ( ) ; } else if ( manifest instanceof ContainerManifest ) { ContainerManifest containerManifest = ( ContainerManifest ) manifest ; String baseName = containerManifest . getBaseName ( ) ; ReleaseId releaseId = containerManifest . getReleaseId ( ) ; String sessionName = containerManifest . getSessionName ( ) ; if ( releaseId != null ) { if ( baseName != null || sessionName != null ) { jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory . newDefaultBuilder ( releaseId , baseName , sessionName ) ; } else { jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory . newDefaultBuilder ( releaseId ) ; } // we can ' t update classpath containers , so no point adding it to environment below here
containerManifest . addToEnvironment ( jbpmRuntimeEnvironmentBuilder ) ; } else if ( baseName != null || sessionName != null ) { jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory . newClasspathKmoduleDefaultBuilder ( baseName , sessionName ) ; } else { jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory . newClasspathKmoduleDefaultBuilder ( ) ; } } else { if ( _persistent ) { jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory . newDefaultBuilder ( ) ; } else { jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory . newDefaultInMemoryBuilder ( ) ; } if ( manifest instanceof ResourcesManifest ) { ResourcesManifest resourcesManifest = ( ResourcesManifest ) manifest ; for ( Resource resource : resourcesManifest . buildResources ( ) ) { jbpmRuntimeEnvironmentBuilder . addAsset ( resource , resource . getResourceType ( ) ) ; } } } jbpmRuntimeEnvironmentBuilder . classLoader ( getClassLoader ( ) ) ; jbpmRuntimeEnvironmentBuilder . persistence ( _persistent ) ; // provides a noop EntityManagerFactory if no persistence
EntityManagerFactory entityManagerFactory = _entityManagerFactoryBuilder . build ( ) ; jbpmRuntimeEnvironmentBuilder . entityManagerFactory ( entityManagerFactory ) ; jbpmRuntimeEnvironmentBuilder . addEnvironmentEntry ( EnvironmentName . ENTITY_MANAGER_FACTORY , entityManagerFactory ) ; // provides an ootb UserGroupCallback if fallen - back to
UserGroupCallback userGroupCallback = _userGroupCallbackBuilder . build ( ) ; jbpmRuntimeEnvironmentBuilder . userGroupCallback ( userGroupCallback ) ; if ( _persistent ) { UserTransaction ut = TransactionManagerLocator . INSTANCE . getUserTransaction ( ) ; TransactionManager tm = TransactionManagerLocator . INSTANCE . getTransactionManager ( ) ; jbpmRuntimeEnvironmentBuilder . addEnvironmentEntry ( EnvironmentName . TRANSACTION , ut ) ; jbpmRuntimeEnvironmentBuilder . addEnvironmentEntry ( EnvironmentName . TRANSACTION_MANAGER , tm ) ; } else { // TODO : why , when no persistence , do we have to do all this ?
jbpmRuntimeEnvironmentBuilder . addEnvironmentEntry ( "IS_JTA_TRANSACTION" , Boolean . FALSE ) ; TaskEventSupport taskEventSupport = new TaskEventSupport ( ) ; CommandService executor = new TaskCommandExecutorImpl ( EnvironmentFactory . newEnvironment ( ) , taskEventSupport ) ; jbpmRuntimeEnvironmentBuilder . addEnvironmentEntry ( TaskService . class . getName ( ) , new CommandBasedTaskService ( executor , taskEventSupport ) ) ; } Properties properties = _propertiesBuilder . build ( ) ; for ( Object key : properties . keySet ( ) ) { String name = ( String ) key ; String value = properties . getProperty ( name ) ; jbpmRuntimeEnvironmentBuilder . addConfiguration ( name , value ) ; // add to KieSessionConfiguration
jbpmRuntimeEnvironmentBuilder . addEnvironmentEntry ( name , value ) ; // add to Environment ( SWITCHYARD - 2393)
} // things that need to be done to the original RuntimeEnvironment before the jBPM RuntimeEnvironmentBuilder is built ( get - > init )
/* * Access < SimpleRuntimeEnvironment > simpleREAccess = new FieldAccess < SimpleRuntimeEnvironment > (
* org . jbpm . runtime . manager . impl . RuntimeEnvironmentBuilder . class , " runtimeEnvironment " ) ;
* if ( simpleREAccess . isReadable ( ) ) {
* SimpleRuntimeEnvironment originalRE = simpleREAccess . read ( jbpmRuntimeEnvironmentBuilder ) ; */
KieScanner scanner = null ; SimpleRuntimeEnvironment originalRE = ( ( PatchedRuntimeEnvironmentBuilder ) jbpmRuntimeEnvironmentBuilder ) . getRuntimeEnvironment ( ) ; if ( originalRE != null ) { RegisterableItemsFactory originalRIF = originalRE . getRegisterableItemsFactory ( ) ; if ( originalRIF instanceof InternalRegisterableItemsFactory ) { ExtendedRegisterableItemsFactory extendedRIF = _registerableItemsFactoryBuilder . build ( ) ; CompoundRegisterableItemsFactory compoundRIF = new CompoundRegisterableItemsFactory ( ( InternalRegisterableItemsFactory ) originalRIF , extendedRIF ) ; jbpmRuntimeEnvironmentBuilder . registerableItemsFactory ( compoundRIF ) ; ExtendedRegisterableItemsFactory . Env . addToEnvironment ( jbpmRuntimeEnvironmentBuilder , compoundRIF ) ; if ( manifest instanceof ContainerManifest && originalRIF instanceof KModuleRegisterableItemsFactory ) { Access < KieContainer > kieContainerAccess = new FieldAccess < KieContainer > ( KModuleRegisterableItemsFactory . class , "kieContainer" ) ; if ( kieContainerAccess . isReadable ( ) ) { KieContainer kieContainer = kieContainerAccess . read ( originalRIF ) ; ( ( ContainerManifest ) manifest ) . setKieContainer ( kieContainer ) ; if ( ( ( ContainerManifest ) manifest ) . isScan ( ) ) { scanner = _kieServices . newKieScanner ( kieContainer ) ; scanner . start ( ( ( ContainerManifest ) manifest ) . getScanInterval ( ) . longValue ( ) ) ; } } } } Mapper mapper ; AuditMode auditMode ; if ( _persistent ) { mapper = new JPAMapper ( entityManagerFactory ) ; auditMode = AuditMode . JPA ; } else { mapper = new InMemoryMapper ( ) ; auditMode = AuditMode . NONE ; } originalRE . setMapper ( mapper ) ; Environment environmentTemplate = originalRE . getEnvironmentTemplate ( ) ; // set the patched LocalTaskServiceFactory
originalRE . addToEnvironment ( TaskServiceFactory . class . getName ( ) , new PatchedLocalTaskServiceFactory ( originalRE ) ) ; // TODO : why , when no persistence , do we have to do all this ?
DeploymentDescriptor deploymentDescriptor = ( DeploymentDescriptor ) environmentTemplate . get ( "KieDeploymentDescriptor" ) ; if ( deploymentDescriptor == null ) { deploymentDescriptor = new DeploymentDescriptorManager ( ) . getDefaultDescriptor ( ) ; originalRE . addToEnvironment ( "KieDeploymentDescriptor" , deploymentDescriptor ) ; } originalRE . addToEnvironment ( manifest . getClass ( ) . getName ( ) , manifest ) ; ( ( DeploymentDescriptorImpl ) deploymentDescriptor ) . setAuditMode ( auditMode ) ; if ( scanner != null ) { originalRE . addToEnvironment ( "KieScanner" , scanner ) ; } } RuntimeEnvironment runtimeEnvironment = jbpmRuntimeEnvironmentBuilder . get ( ) ; Environment environment = originalRE . getEnvironmentTemplate ( ) ; // our ObjectMarshallingStrategy can be added to the Environment after the jBPM RuntimeEnvironmentBuilder is built ( get - > init )
List < ObjectMarshallingStrategy > new_oms = new ArrayList < ObjectMarshallingStrategy > ( ) ; new_oms . add ( new SerializerObjectMarshallingStrategy ( SerializerFactory . create ( FormatType . JSON , null , true ) ) ) ; ObjectMarshallingStrategy [ ] old_oms = ( ObjectMarshallingStrategy [ ] ) environment . get ( EnvironmentName . OBJECT_MARSHALLING_STRATEGIES ) ; if ( old_oms != null ) { for ( int i = 0 ; i < old_oms . length ; i ++ ) { if ( old_oms [ i ] != null ) { new_oms . add ( old_oms [ i ] ) ; } } } originalRE . addToEnvironment ( EnvironmentName . OBJECT_MARSHALLING_STRATEGIES , new_oms . toArray ( new ObjectMarshallingStrategy [ new_oms . size ( ) ] ) ) ; return runtimeEnvironment ; |
public class NumberUtil { /** * 提供精确的减法运算
* @ param v1 被减数
* @ param v2 减数
* @ return 差 */
public static double sub ( float v1 , float v2 ) { } } | return sub ( Float . toString ( v1 ) , Float . toString ( v2 ) ) . doubleValue ( ) ; |
public class ArrayUtil { /** * 以 conjunction 为分隔符将数组转换为字符串
* @ param < T > 被处理的集合
* @ param array 数组
* @ param conjunction 分隔符
* @ return 连接后的字符串 */
public static < T > String join ( T [ ] array , CharSequence conjunction ) { } } | return join ( array , conjunction , null , null ) ; |
public class VMPlacementUtils { /** * Check if a VM can stay on its current node .
* @ param rp the reconfiguration problem .
* @ param vm the VM
* @ return { @ code true } iff the VM can stay */
public static boolean canStay ( ReconfigurationProblem rp , VM vm ) { } } | Mapping m = rp . getSourceModel ( ) . getMapping ( ) ; if ( m . isRunning ( vm ) ) { int curPos = rp . getNode ( m . getVMLocation ( vm ) ) ; return rp . getVMAction ( vm ) . getDSlice ( ) . getHoster ( ) . contains ( curPos ) ; } return false ; |
public class Splitter { /** * Splits the CharSequence passed in parameter .
* @ param source the sequence of characters to split
* @ return a map of key / value pairs */
public Map < String , String > split ( final CharSequence source ) { } } | java . util . Objects . requireNonNull ( source , "source" ) ; Map < String , String > parameters = new HashMap < > ( ) ; Iterator < String > i = new StringIterator ( source , pairSeparator ) ; while ( i . hasNext ( ) ) { String keyValue = i . next ( ) ; int keyValueSeparatorPosition = keyValueSeparatorStart ( keyValue ) ; if ( keyValueSeparatorPosition == 0 || keyValue . length ( ) == 0 ) { continue ; } if ( keyValueSeparatorPosition < 0 ) { parameters . put ( keyValue , null ) ; continue ; } int keyStart = 0 ; int keyEnd = keyValueSeparatorPosition ; while ( keyStart < keyEnd && keyTrimMatcher . matches ( keyValue . charAt ( keyStart ) ) ) { keyStart ++ ; } while ( keyStart < keyEnd && keyTrimMatcher . matches ( keyValue . charAt ( keyEnd - 1 ) ) ) { keyEnd -- ; } int valueStart = keyValueSeparatorPosition + keyValueSeparator . length ( ) ; int valueEnd = keyValue . length ( ) ; while ( valueStart < valueEnd && valueTrimMatcher . matches ( keyValue . charAt ( valueStart ) ) ) { valueStart ++ ; } while ( valueStart < valueEnd && valueTrimMatcher . matches ( keyValue . charAt ( valueEnd - 1 ) ) ) { valueEnd -- ; } String key = keyValue . substring ( keyStart , keyEnd ) ; String value = keyValue . substring ( valueStart , valueEnd ) ; parameters . put ( key , value ) ; } return parameters ; |
public class RepositoryResolver { /** * If any errors occurred during resolution , throw a { @ link RepositoryResolutionException } */
private void reportErrors ( ) throws RepositoryResolutionException { } } | if ( resourcesWrongProduct . isEmpty ( ) && missingTopLevelRequirements . isEmpty ( ) && missingRequirements . isEmpty ( ) ) { // Everything went fine !
return ; } Set < ProductRequirementInformation > missingProductInformation = new HashSet < > ( ) ; for ( ApplicableToProduct esa : resourcesWrongProduct ) { missingRequirements . add ( new MissingRequirement ( esa . getAppliesTo ( ) , ( RepositoryResource ) esa ) ) ; missingProductInformation . addAll ( ProductRequirementInformation . createFromAppliesTo ( esa . getAppliesTo ( ) ) ) ; } List < String > missingRequirementNames = new ArrayList < > ( ) ; for ( MissingRequirement req : missingRequirements ) { missingRequirementNames . add ( req . getRequirementName ( ) ) ; } throw new RepositoryResolutionException ( null , missingTopLevelRequirements , missingRequirementNames , missingProductInformation , missingRequirements ) ; |
public class NotesDao { /** * @ param id id of the note
* @ param text comment to be added to the note . Must not be null or empty
* @ throws OsmConflictException if the note has already been closed .
* @ throws OsmAuthorizationException if this application is not authorized to write notes
* ( Permission . WRITE _ NOTES )
* @ throws OsmNotFoundException if the note with the given id does not exist ( anymore )
* @ return the updated commented note */
public Note comment ( long id , String text ) { } } | if ( text . isEmpty ( ) ) { throw new IllegalArgumentException ( "comment must not be empty" ) ; } SingleElementHandler < Note > noteHandler = new SingleElementHandler < > ( ) ; makeSingleNoteRequest ( id , "comment" , text , new NotesParser ( noteHandler ) ) ; return noteHandler . get ( ) ; |
public class EmbeddedJavaProcessExecutor { /** * Executes the given Java { @ link Class } passing the given array of { @ link String arguments } .
* This execute method employs a { @ link JavaClassExecutor } strategy to execute the given Java { @ link Class } .
* The Java { @ link Class } is expected to either implement { @ link Runnable } , { @ link Callable } , { @ link Executable }
* or implement a { @ literal main } { @ link Method } .
* @ param < T > { @ link Class } type of the Java program return value .
* @ param type Java { @ link Class } to execute in embedded mode .
* @ param args array of { @ link String arguments } to pass to the Java { @ link Class } .
* @ return an { @ link Optional } return value from the execution of the Java { @ link Class } .
* @ throws IllegalArgumentException if the Java { @ link Class } is { @ literal null } .
* @ throws EmbeddedProcessExecutionException if the Java { @ link Class } is not executable .
* @ see org . cp . elements . process . java . EmbeddedJavaProcessExecutor . JavaClassExecutor
* @ see java . lang . Class
* @ see java . util . Optional */
@ SuppressWarnings ( "unchecked" ) public < T > Optional < T > execute ( Class type , String ... args ) { } } | Assert . notNull ( type , "Class type must not be null" ) ; return JAVA_CLASS_EXECUTORS . stream ( ) . filter ( javaClassExecutor -> javaClassExecutor . isExecutable ( type ) ) . findFirst ( ) . map ( javaClassExecutor -> javaClassExecutor . execute ( type , ( Object [ ] ) args ) ) . orElseThrow ( ( ) -> new EmbeddedProcessExecutionException ( String . format ( "Unable to execute Java class [%s];" + " Please verify that your class either implements Runnable, Callable, Executable or has a main method" , getName ( type ) ) ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.