signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class JSONUtils { /** * Return true for objects that can be converted directly to and from string representation .
* @ param obj
* the object
* @ return true , if the object is null or of basic value type */
static boolean isBasicValueType ( final Object obj ) { } } | return obj == null || obj instanceof String || obj instanceof Integer || obj instanceof Boolean || obj instanceof Long || obj instanceof Float || obj instanceof Double || obj instanceof Short || obj instanceof Byte || obj instanceof Character || obj . getClass ( ) . isEnum ( ) ; |
public class CacheManager { /** * Handle the generate hash option .
* @ param option { @ link Option } the option to fetch the cli argument from */
protected void handleGenerateHash ( Option option ) { } } | String hashFileLocation = option . getValue ( ) ; reportable . output ( "Generating checksum for file: " + hashFileLocation ) ; File hashFile = new File ( hashFileLocation ) ; if ( ! hashFile . exists ( ) || ! hashFile . canRead ( ) ) { reportable . error ( "File cannot be read" ) ; bail ( GENERAL_FAILURE ) ; } String hashContents = null ; try { hashContents = FileUtils . readFileToString ( hashFile ) ; } catch ( IOException e ) { reportable . error ( "Unable to read file" ) ; reportable . error ( "Reason: " + e . getMessage ( ) ) ; bail ( GENERAL_FAILURE ) ; } Hasher hasher = Hasher . INSTANCE ; try { String generatedhash = hasher . hashValue ( hashContents ) ; reportable . output ( "Checksum: " + generatedhash ) ; } catch ( Exception e ) { reportable . error ( "Unable to created checksum" ) ; reportable . error ( "Reason: " + e . getMessage ( ) ) ; bail ( GENERAL_FAILURE ) ; } |
public class DataNode { /** * returns the associated key ( if it exists ) . If the key has no associated
* value but the key has defined a default value then the value is returned
* instead . If the key was defined to be not nullable but is null due to its
* value or because it does not exist , then an IllegalStateException is thrown
* @ param < T >
* @ param key
* @ return */
public < T > T getObject ( DataKey < T > key ) { } } | if ( key == null ) { throw new IllegalArgumentException ( "key must not be null" ) ; } final Object object = data . get ( key . getName ( ) ) ; if ( containsKey ( key ) ) { if ( object != null ) { if ( ! key . getDataClass ( ) . isAssignableFrom ( object . getClass ( ) ) ) { throw new IllegalStateException ( "the type of the key (" + key . getDataClass ( ) . getCanonicalName ( ) + ") is not a supertype of the value's class (" + object . getClass ( ) . getCanonicalName ( ) + ")" ) ; } } } else { if ( key . getDefaultValue ( ) != null ) { return key . getDefaultValue ( ) ; } } if ( object == null && ! key . allowNull ( ) ) { throw new IllegalStateException ( "key \"" + key . getName ( ) + "\" does not allow null values but the object is null" ) ; } return ( T ) object ; |
public class IvyConfigurationProvider { /** * Ivy configuration initialization
* @ throws ParseException
* If an error occurs when loading ivy settings file
* ( ivysettings . xml )
* @ throws IOException
* If an error occurs when reading ivy settings file
* ( ivysettings . xml )
* @ throws ConfigurationException
* If ivy settings file ( ivysettings . xml ) is not found in
* classpath */
public void initIvy ( ) throws ParseException , IOException , ConfigurationException { } } | if ( ivy == null ) { // creates clear ivy settings
IvySettings ivySettings = new IvySettings ( ) ; File settingsFile = new File ( IVY_SETTINGS_FILE ) ; if ( settingsFile . exists ( ) ) { ivySettings . load ( settingsFile ) ; } else { URL settingsURL = ClassLoader . getSystemResource ( IVY_SETTINGS_FILE ) ; if ( settingsURL == null ) { // file not found in System classloader , we try the current one
settingsURL = this . getClass ( ) . getClassLoader ( ) . getResource ( IVY_SETTINGS_FILE ) ; // extra validation to avoid uncontrolled NullPointerException
// when invoking toURI ( )
if ( settingsURL == null ) throw new ConfigurationException ( "Ivy settings file (" + IVY_SETTINGS_FILE + ") could not be found in classpath" ) ; } ivySettings . load ( settingsURL ) ; } // creates an Ivy instance with settings
ivy = Ivy . newInstance ( ivySettings ) ; } ivyfile = File . createTempFile ( "ivy" , ".xml" ) ; ivyfile . deleteOnExit ( ) ; applyVerbose ( ) ; String [ ] confs = new String [ ] { "default" } ; resolveOptions = new ResolveOptions ( ) . setConfs ( confs ) ; if ( isOffLine ) { resolveOptions = resolveOptions . setUseCacheOnly ( true ) ; } else { Map < String , Object > params = configuration . getParameters ( ) ; if ( params != null ) { Object value = params . get ( "offline" ) ; if ( value != null ) { String offlineOpt = value . toString ( ) ; if ( offlineOpt != null ) { boolean offline = Boolean . parseBoolean ( offlineOpt ) ; if ( offline ) { resolveOptions = resolveOptions . setUseCacheOnly ( true ) ; } } } } } |
public class HelloSignClient { /** * Retrieves a specific page of the current user ' s signature requests .
* @ param page int
* @ return SignatureRequestList
* @ throws HelloSignException thrown if there ' s a problem processing the
* HTTP request or the JSON response . */
public SignatureRequestList getSignatureRequests ( int page ) throws HelloSignException { } } | return new SignatureRequestList ( httpClient . withAuth ( auth ) . withGetParam ( AbstractResourceList . PAGE , Integer . toString ( page ) ) . get ( BASE_URI + SIGNATURE_REQUEST_LIST_URI ) . asJson ( ) ) ; |
public class AbstractDirector { /** * Logs a message .
* @ param level the level of the message
* @ param msg the message */
void log ( Level level , String msg ) { } } | if ( msg != null && ! msg . isEmpty ( ) ) logger . log ( level , msg ) ; |
public class Row { /** * Create a Row . Items in the values array can be null although the array cannot . If the headerDefinition has a different number of
* columns than the length of the values array then an IllegalArgumentException will be thrown .
* @ param headerDefinition the row definition , not null
* @ param values the actual values in the row , not null
* @ return a row instance */
public static Row of ( final HeaderDefinition headerDefinition , final String [ ] values ) { } } | ArgumentChecker . notNull ( headerDefinition , "headerDefinition" ) ; ArgumentChecker . notNull ( values , "values" ) ; return new Row ( headerDefinition , values ) ; |
public class ThreadDeathWatcher { /** * Cancels the task scheduled via { @ link # watch ( Thread , Runnable ) } . */
public static void unwatch ( Thread thread , Runnable task ) { } } | if ( thread == null ) { throw new NullPointerException ( "thread" ) ; } if ( task == null ) { throw new NullPointerException ( "task" ) ; } schedule ( thread , task , false ) ; |
public class BuildTool { /** * health status index uuid pri rep docs . count docs . deleted store . size pri . store . size
* @ param esIndice
* @ param indiceHeaders
* @ param position
* @ param token
* @ param format */
private static void putField ( ESIndice esIndice , Map < Integer , IndiceHeader > indiceHeaders , int position , StringBuilder token , SimpleDateFormat format ) { } } | IndiceHeader indiceHeader = indiceHeaders . get ( position ) ; if ( indiceHeader . getHeaderName ( ) . equals ( "health" ) ) { esIndice . setHealth ( token . toString ( ) ) ; token . setLength ( 0 ) ; } else if ( indiceHeader . getHeaderName ( ) . equals ( "status" ) ) { esIndice . setStatus ( token . toString ( ) ) ; token . setLength ( 0 ) ; } else if ( indiceHeader . getHeaderName ( ) . equals ( "index" ) ) { esIndice . setIndex ( token . toString ( ) ) ; putGendate ( esIndice , format ) ; token . setLength ( 0 ) ; } else if ( indiceHeader . getHeaderName ( ) . equals ( "uuid" ) ) { esIndice . setUuid ( token . toString ( ) ) ; token . setLength ( 0 ) ; } else if ( indiceHeader . getHeaderName ( ) . equals ( "pri" ) ) { esIndice . setPri ( Integer . parseInt ( token . toString ( ) ) ) ; token . setLength ( 0 ) ; } else if ( indiceHeader . getHeaderName ( ) . equals ( "rep" ) ) { esIndice . setRep ( Integer . parseInt ( token . toString ( ) ) ) ; token . setLength ( 0 ) ; } else if ( indiceHeader . getHeaderName ( ) . equals ( "docs.count" ) ) { esIndice . setDocsCcount ( Long . parseLong ( token . toString ( ) ) ) ; token . setLength ( 0 ) ; } else if ( indiceHeader . getHeaderName ( ) . equals ( "docs.deleted" ) ) { esIndice . setDocsDeleted ( Long . parseLong ( token . toString ( ) ) ) ; token . setLength ( 0 ) ; } else if ( indiceHeader . getHeaderName ( ) . equals ( "store.size" ) ) { esIndice . setStoreSize ( token . toString ( ) ) ; token . setLength ( 0 ) ; } else if ( indiceHeader . getHeaderName ( ) . equals ( "pri.store.size" ) ) { esIndice . setPriStoreSize ( token . toString ( ) ) ; token . setLength ( 0 ) ; } else { esIndice . addOtherData ( indiceHeader . getHeaderName ( ) , token . toString ( ) ) ; token . setLength ( 0 ) ; } |
public class StartTaskExecutionRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( StartTaskExecutionRequest startTaskExecutionRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( startTaskExecutionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( startTaskExecutionRequest . getTaskArn ( ) , TASKARN_BINDING ) ; protocolMarshaller . marshall ( startTaskExecutionRequest . getOverrideOptions ( ) , OVERRIDEOPTIONS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class WSManagedConnectionFactoryImpl { /** * Set the log writer for this ManagedConnectionFactory instance .
* The log writer is a character output stream to which all logging and tracing
* messages for this ManagedConnectionfactory instance will be printed .
* ApplicationServer manages the association of output stream with the
* ManagedConnectionFactory . When a ManagedConnectionFactory object is created the
* log writer is initially null , in other words , logging is disabled . Once a log
* writer is associated with a ManagedConnectionFactory , logging and tracing for
* ManagedConnectionFactory instance is enabled .
* The ManagedConnection instances created by ManagedConnectionFactory " inherits "
* the log writer , which can be overridden by ApplicationServer using
* ManagedConnection . setLogWriter to set ManagedConnection specific logging and
* tracing .
* @ param PrintWriter out - an out stream for error logging and tracing
* @ exception ResourceException - Possible causes for this exception are :
* 1 ) setLogWriter on the physical datasource fails */
public final void setLogWriter ( final PrintWriter out ) throws ResourceException { } } | // removed content of this method . This method is typically called by J2c . J2c had some special
// logic in their code not to call this method on the RRA since RRA seperates Resource Adapter logging / tracing
// and database backend logging / tracing . However , J2c changed their code and removed
// special logic and started calling it indiscriminately on al resources adapters . That meant that
// if the RRA trace is on , the database trace is on as well which is not a desired behavior .
// Therefore , we am making this method a no - op .
// normal users won ' t go through this leg of code when setting the logwriter on their datasource .
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "setLogWriter on the mcf is a no-op when calling this method" ) ; |
public class CmsDirectEditToolbarHandler { /** * Inserts the context menu . < p >
* @ param menuBeans the menu beans from the server
* @ param structureId the structure id of the resource at which the workplace should be opened */
public void insertContextMenu ( List < CmsContextMenuEntryBean > menuBeans , CmsUUID structureId ) { } } | List < I_CmsContextMenuEntry > menuEntries = transformEntries ( menuBeans , structureId ) ; m_contextButton . showMenu ( menuEntries ) ; |
public class WsByteBufferImpl { /** * Copy the targeted number of bytes from the backing direct buffers .
* @ param bytesRead */
public void copyFromDirectBuffer ( int bytesRead ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "copyFromDirectBuffer: " + bytesRead ) ; } int newPosition = this . oWsBBDirect . position ( ) ; int cachePosition = this . oByteBuffer . position ( ) ; if ( this . quickBufferAction == NOT_ACTIVATED ) { // copy the bytes read from the old position
this . oWsBBDirect . position ( cachePosition ) ; if ( bytesRead == - 1 ) { // copy all the bytes up to the limit
this . oWsBBDirect . get ( oByteBuffer . array ( ) , cachePosition + oByteBuffer . arrayOffset ( ) , oByteBuffer . remaining ( ) ) ; } else if ( bytesRead > 0 ) { // copy just the bytes that were read
this . oWsBBDirect . get ( oByteBuffer . array ( ) , cachePosition + oByteBuffer . arrayOffset ( ) , bytesRead ) ; } // set to the position
this . oByteBuffer . position ( newPosition ) ; } else { synchronized ( wsBBRoot . actionAccess ) { if ( wsBBRoot . actionState == PooledWsByteBufferImpl . COPY_WHEN_NEEDED_STATE1 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "actionState: STATE1 - nothing will be copied" ) ; } // don ' t do the copy now , just update the position pointer
this . oByteBuffer . position ( newPosition ) ; int min = cachePosition ; int max = newPosition - 1 ; // in STATE1 readMin and readMax keep track of the data that will
// need to be moved up to the nonDirect buffer upon entering STATE2.
// This area can be expanded to contain some bytes which were not
// read into , since nothing has been put into the NonDirect buffer ,
// so any gaps in the read data will be uninitialized data anyway .
if ( ( wsBBRoot . readMin == - 1 ) || ( min < wsBBRoot . readMin ) ) { wsBBRoot . readMin = min ; } if ( ( wsBBRoot . readMax == - 1 ) || ( max > wsBBRoot . readMax ) ) { wsBBRoot . readMax = max ; } // if getMin and getMax are not outside of the new read , then reset them ,
// so that the next get ( . . . ) will pull up the new data .
if ( ( wsBBRoot . getMax >= wsBBRoot . readMin ) && ( wsBBRoot . getMin <= wsBBRoot . readMax ) ) { wsBBRoot . getMax = - 1 ; wsBBRoot . getMin = - 1 ; } } else { // actionState must equal COPY _ WHEN _ NEEDED _ STATE2 or
// BUFFER _ MGMT _ COPY _ ALL _ FINAL ( if another thread just changed it ) .
if ( wsBBRoot . actionState == PooledWsByteBufferImpl . COPY_WHEN_NEEDED_STATE2 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "actionState: STATE2, first copy up any previously read data" ) ; } // first copy up to the nonDirect buffer any data that was read before
// entering STATE 2
if ( ( wsBBRoot . readMin != - 1 ) && ( wsBBRoot . readMax != - 1 ) ) { moveUpUsingGetMinMax ( wsBBRoot . readMin , wsBBRoot . readMax , 0 ) ; } } this . wsBBRoot . actionState = PooledWsByteBufferImpl . COPY_ALL_FINAL ; this . quickBufferAction = NOT_ACTIVATED ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "actionState: COPY_ALL_FINAL, copy currently read data to NonDirect buffer " ) ; } // copy the bytes read from the old position
this . oWsBBDirect . position ( cachePosition ) ; if ( bytesRead == - 1 ) { // copy all the bytes up to the limit
this . oWsBBDirect . get ( oByteBuffer . array ( ) , cachePosition + oByteBuffer . arrayOffset ( ) , oByteBuffer . remaining ( ) ) ; } else if ( bytesRead > 0 ) { // copy just the bytes that were read
this . oWsBBDirect . get ( oByteBuffer . array ( ) , cachePosition + oByteBuffer . arrayOffset ( ) , bytesRead ) ; } // set to the position
this . oByteBuffer . position ( newPosition ) ; } } // end - sync
} if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "copyFromDirectBuffer" ) ; } |
public class CnvTfsObject { /** * < p > Convert from string . < / p >
* @ param pAddParam additional params , e . g . IRequestData
* to fill owner itsVersion .
* @ param pStrVal string representation
* @ return M model
* @ throws Exception - an exception */
@ Override public final T fromString ( final Map < String , Object > pAddParam , final String pStrVal ) throws Exception { } } | if ( pStrVal == null || "" . equals ( pStrVal ) ) { return null ; } T object = this . objectClass . newInstance ( ) ; for ( String fldValStr : pStrVal . split ( "," ) ) { int eqIdx = fldValStr . indexOf ( "=" ) ; String fldName = fldValStr . substring ( 0 , eqIdx ) ; String cnvrtName = this . fieldConverterNamesHolder . getFor ( this . objectClass , fldName ) ; if ( cnvrtName != null ) { // e . g . transient field
IConverterToFromString cnvrt = this . fieldsConvertersFatory . lazyGet ( null , cnvrtName ) ; Method fldSetter = this . settersRapiHolder . getFor ( this . objectClass , fldName ) ; String strVal = fldValStr . substring ( eqIdx + 1 ) ; Object fldVal = cnvrt . fromString ( pAddParam , strVal ) ; fldSetter . invoke ( object , fldVal ) ; } } return object ; |
public class AbstractLockTableHandler { /** * Opens connection to database . */
protected Connection openConnection ( ) throws SQLException { } } | return SecurityHelper . doPrivilegedSQLExceptionAction ( new PrivilegedExceptionAction < Connection > ( ) { public Connection run ( ) throws SQLException { return ds . getConnection ( ) ; } } ) ; |
public class ProviderManager { /** * Removes an extension provider with the specified element name and namespace . This
* method is typically called to cleanup providers that are programmatically added
* using the { @ link # addExtensionProvider ( String , String , Object ) addExtensionProvider } method .
* @ param elementName the XML element name .
* @ param namespace the XML namespace .
* @ return the key of the removed stanza extension provider */
public static String removeExtensionProvider ( String elementName , String namespace ) { } } | String key = getKey ( elementName , namespace ) ; extensionProviders . remove ( key ) ; return key ; |
public class AbstractXMPPConnection { /** * Same as { @ link # login ( CharSequence , String , Resourcepart ) } , but takes the resource from the connection
* configuration .
* @ param username
* @ param password
* @ throws XMPPException
* @ throws SmackException
* @ throws IOException
* @ throws InterruptedException
* @ see # login */
public synchronized void login ( CharSequence username , String password ) throws XMPPException , SmackException , IOException , InterruptedException { } } | login ( username , password , config . getResource ( ) ) ; |
public class Async { /** * Return an Observable that calls the given Runnable and emits the given result when an Observer
* subscribes .
* < img width = " 640 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / fromRunnable . s . png " alt = " " >
* @ param < R > the return type
* @ param run the runnable to invoke on each subscription
* @ param scheduler the Scheduler where the function is called and the result is emitted
* @ param result the result to emit to observers
* @ return an Observable that calls the given Runnable and emits the given result when an Observer
* subscribes
* @ see < a href = " https : / / github . com / ReactiveX / RxJava / wiki / Async - Operators # wiki - fromrunnable " > RxJava Wiki : fromRunnable ( ) < / a > */
public static < R > Observable < R > fromRunnable ( final Runnable run , final R result , Scheduler scheduler ) { } } | return Observable . create ( OperatorFromFunctionals . fromRunnable ( run , result ) ) . subscribeOn ( scheduler ) ; |
public class SNISSLExplorer { /** * struct {
* ExtensionType extension _ type ;
* opaque extension _ data < 0 . . 2 ^ 16-1 > ;
* } Extension ;
* enum {
* server _ name ( 0 ) , max _ fragment _ length ( 1 ) ,
* client _ certificate _ url ( 2 ) , trusted _ ca _ keys ( 3 ) ,
* truncated _ hmac ( 4 ) , status _ request ( 5 ) , ( 65535)
* } ExtensionType ; */
private static ExtensionInfo exploreExtensions ( ByteBuffer input ) throws SSLException { } } | List < SNIServerName > sni = Collections . emptyList ( ) ; List < String > alpn = Collections . emptyList ( ) ; int length = getInt16 ( input ) ; // length of extensions
while ( length > 0 ) { int extType = getInt16 ( input ) ; // extension type
int extLen = getInt16 ( input ) ; // length of extension data
if ( extType == 0x00 ) { // 0x00 : type of server name indication
sni = exploreSNIExt ( input , extLen ) ; } else if ( extType == 0x10 ) { // 0x10 : type of alpn
alpn = exploreALPN ( input , extLen ) ; } else { // ignore other extensions
ignoreByteVector ( input , extLen ) ; } length -= extLen + 4 ; } return new ExtensionInfo ( sni , alpn ) ; |
public class DefaultTransactionManager { /** * Returns True if rollback DID NOT HAPPEN ( i . e . if commit should continue ) .
* @ param config transaction configuration
* @ param e The exception to test for rollback */
private boolean canRecover ( final TxConfig config , final Throwable e ) { } } | boolean commit = config . getRollbackOn ( ) . size ( ) > 0 ; // check rollback clauses
for ( Class < ? extends Exception > rollBackOn : config . getRollbackOn ( ) ) { // if one matched , try to perform a rollback
if ( rollBackOn . isInstance ( e ) ) { commit = false ; break ; } } // check ignore clauses ( supercedes rollback clause )
for ( Class < ? extends Exception > exceptOn : config . getIgnore ( ) ) { // An exception to the rollback clause was found , DON ' T rollback
// ( i . e . commit and throw anyway )
if ( exceptOn . isInstance ( e ) ) { commit = true ; break ; } } return commit ; |
public class AppTrackerImpl { /** * { @ inheritDoc } */
@ Override public void onStartup ( Set < Class < ? > > arg0 , ServletContext ctx ) throws ServletException { } } | IServletContext isc = ( IServletContext ) ctx ; AppModuleName pair = setAppModuleNames ( isc ) ; if ( pair != null ) { isc . addListener ( new AppTrackerServletContextListener ( pair , this ) ) ; } |
public class VisibilityAlgorithm { /** * Split originalSegments that intersects . Run this method after calling the last addSegment before calling getIsoVist */
private static List < SegmentString > fixSegments ( List < SegmentString > segments ) { } } | MCIndexNoder mCIndexNoder = new MCIndexNoder ( ) ; RobustLineIntersector robustLineIntersector = new RobustLineIntersector ( ) ; mCIndexNoder . setSegmentIntersector ( new IntersectionAdder ( robustLineIntersector ) ) ; mCIndexNoder . computeNodes ( segments ) ; Collection nodedSubstring = mCIndexNoder . getNodedSubstrings ( ) ; ArrayList < SegmentString > ret = new ArrayList < > ( nodedSubstring . size ( ) ) ; for ( Object aNodedSubstring : nodedSubstring ) { ret . add ( ( SegmentString ) aNodedSubstring ) ; } return ret ; |
public class HttpEndpointImpl { /** * The specific sslOptions is selected by a filter set through metatype that matches a specific
* user - configured option set or falls back to a default .
* @ param service */
@ Trivial @ Reference ( name = "sslOptions" , service = ChannelConfiguration . class , policy = ReferencePolicy . DYNAMIC , policyOption = ReferencePolicyOption . GREEDY , cardinality = ReferenceCardinality . OPTIONAL ) protected void setSslOptions ( ServiceReference < ChannelConfiguration > service ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "set ssl options " + service . getProperty ( "id" ) , this ) ; } this . sslOptions . setReference ( service ) ; if ( endpointConfig != null ) { performAction ( updateAction ) ; } |
public class InternalPureXbaseParser { /** * InternalPureXbase . g : 1492:1 : ruleOpCompare returns [ AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken ( ) ] : ( kw = ' > = ' | ( kw = ' < ' kw = ' = ' ) | kw = ' > ' | kw = ' < ' ) ; */
public final AntlrDatatypeRuleToken ruleOpCompare ( ) throws RecognitionException { } } | AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken ( ) ; Token kw = null ; enterRule ( ) ; try { // InternalPureXbase . g : 1498:2 : ( ( kw = ' > = ' | ( kw = ' < ' kw = ' = ' ) | kw = ' > ' | kw = ' < ' ) )
// InternalPureXbase . g : 1499:2 : ( kw = ' > = ' | ( kw = ' < ' kw = ' = ' ) | kw = ' > ' | kw = ' < ' )
{ // InternalPureXbase . g : 1499:2 : ( kw = ' > = ' | ( kw = ' < ' kw = ' = ' ) | kw = ' > ' | kw = ' < ' )
int alt27 = 4 ; switch ( input . LA ( 1 ) ) { case 30 : { alt27 = 1 ; } break ; case 28 : { int LA27_2 = input . LA ( 2 ) ; if ( ( LA27_2 == EOF || ( LA27_2 >= RULE_STRING && LA27_2 <= RULE_ID ) || ( LA27_2 >= 14 && LA27_2 <= 15 ) || LA27_2 == 28 || ( LA27_2 >= 44 && LA27_2 <= 45 ) || LA27_2 == 50 || ( LA27_2 >= 58 && LA27_2 <= 59 ) || LA27_2 == 61 || LA27_2 == 64 || LA27_2 == 66 || ( LA27_2 >= 69 && LA27_2 <= 80 ) ) ) { alt27 = 4 ; } else if ( ( LA27_2 == 20 ) ) { alt27 = 2 ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return current ; } NoViableAltException nvae = new NoViableAltException ( "" , 27 , 2 , input ) ; throw nvae ; } } break ; case 29 : { alt27 = 3 ; } break ; default : if ( state . backtracking > 0 ) { state . failed = true ; return current ; } NoViableAltException nvae = new NoViableAltException ( "" , 27 , 0 , input ) ; throw nvae ; } switch ( alt27 ) { case 1 : // InternalPureXbase . g : 1500:3 : kw = ' > = '
{ kw = ( Token ) match ( input , 30 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpCompareAccess ( ) . getGreaterThanSignEqualsSignKeyword_0 ( ) ) ; } } break ; case 2 : // InternalPureXbase . g : 1506:3 : ( kw = ' < ' kw = ' = ' )
{ // InternalPureXbase . g : 1506:3 : ( kw = ' < ' kw = ' = ' )
// InternalPureXbase . g : 1507:4 : kw = ' < ' kw = ' = '
{ kw = ( Token ) match ( input , 28 , FOLLOW_13 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpCompareAccess ( ) . getLessThanSignKeyword_1_0 ( ) ) ; } kw = ( Token ) match ( input , 20 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpCompareAccess ( ) . getEqualsSignKeyword_1_1 ( ) ) ; } } } break ; case 3 : // InternalPureXbase . g : 1519:3 : kw = ' > '
{ kw = ( Token ) match ( input , 29 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpCompareAccess ( ) . getGreaterThanSignKeyword_2 ( ) ) ; } } break ; case 4 : // InternalPureXbase . g : 1525:3 : kw = ' < '
{ kw = ( Token ) match ( input , 28 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getOpCompareAccess ( ) . getLessThanSignKeyword_3 ( ) ) ; } } break ; } } if ( state . backtracking == 0 ) { leaveRule ( ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class ColumnImpl { /** * Returns the < code > length < / code > attribute
* @ return the value defined for the attribute < code > length < / code > */
public Integer getLength ( ) { } } | if ( childNode . getAttribute ( "length" ) != null && ! childNode . getAttribute ( "length" ) . equals ( "null" ) ) { return Integer . valueOf ( childNode . getAttribute ( "length" ) ) ; } return null ; |
public class NativeIO { /** * Call ioprio _ set ( ioprio _ value ) for this thread .
* @ throws NativeIOException
* if there is an error with the syscall */
public static void ioprioSetIfPossible ( int ioprio_value ) throws IOException { } } | if ( nativeLoaded && ioprioPossible ) { try { ioprio_set ( ioprio_value ) ; } catch ( UnsupportedOperationException uoe ) { LOG . warn ( "ioprioSetIfPossible() failed" , uoe ) ; ioprioPossible = false ; } catch ( UnsatisfiedLinkError ule ) { LOG . warn ( "ioprioSetIfPossible() failed" , ule ) ; ioprioPossible = false ; } catch ( NativeIOException nie ) { LOG . warn ( "ioprioSetIfPossible() failed" , nie ) ; throw nie ; } } |
public class SourceLocator { /** * Scans from { @ code nextIndex } to { @ code ind } and saves all indices of line break characters
* into { @ code lineBreakIndices } and adjusts the current column number as it goes . The location of
* the character on { @ code ind } is returned .
* < p > After this method returns , { @ code nextIndex } and { @ code nextColumnIndex } will point to the
* next character to be scanned or the EOF if the end of input is encountered . */
@ Private Location scanTo ( int index ) { } } | boolean eof = false ; if ( index == source . length ( ) ) { // The eof has index size ( ) + 1
eof = true ; index -- ; } int columnIndex = nextColumnIndex ; for ( int i = nextIndex ; i <= index ; i ++ ) { char c = source . charAt ( i ) ; if ( c == LINE_BREAK ) { lineBreakIndices . add ( i ) ; columnIndex = 0 ; } else columnIndex ++ ; } this . nextIndex = index + 1 ; this . nextColumnIndex = columnIndex ; int lines = lineBreakIndices . size ( ) ; if ( eof ) return location ( lines , columnIndex ) ; if ( columnIndex == 0 ) return getLineBreakLocation ( lines - 1 ) ; return location ( lines , columnIndex - 1 ) ; |
public class Schema { /** * Used for ColumnFamily data eviction out from the schema
* @ param cfm The ColumnFamily Definition to evict */
public void purge ( CFMetaData cfm ) { } } | cfIdMap . remove ( Pair . create ( cfm . ksName , cfm . cfName ) ) ; cfm . markPurged ( ) ; |
public class CmsPatternPanelDailyController { /** * Set the " everyWorkingDay " flag .
* @ param isEveryWorkingDay flag , indicating if the event should take place every working day . */
public void setEveryWorkingDay ( final boolean isEveryWorkingDay ) { } } | if ( m_model . isEveryWorkingDay ( ) != isEveryWorkingDay ) { removeExceptionsOnChange ( new Command ( ) { public void execute ( ) { m_model . setEveryWorkingDay ( Boolean . valueOf ( isEveryWorkingDay ) ) ; m_model . setInterval ( getPatternDefaultValues ( ) . getInterval ( ) ) ; onValueChange ( ) ; } } ) ; } |
import java . util . * ; import java . lang . Math ; class CalculateSquaredSum { /** * Given a list of numbers , this function calculates the sum of each number squared ,
* but each element is rounded up ( to its Ceiling ) before squaring .
* Parameters :
* numbers ( List ) : The list of numbers .
* Returns :
* The sum of the squares of the rounded numbers .
* Examples :
* For numbers = [ 1,2,3 ] the output should be 14
* For numbers = [ 1,4,9 ] the output should be 98
* For numbers = [ 1,3,5,7 ] the output should be 84
* For numbers = [ 1.4,4.2,0 ] the output should be 29
* For numbers = [ - 2.4,1,1 ] the output should be 6 */
public static double calculateSquaredSum ( List < Double > numbers ) { } } | double squareSum = 0 ; for ( double num : numbers ) { squareSum += Math . pow ( Math . ceil ( num ) , 2 ) ; } return squareSum ; |
public class AbstractWrapAdapter { /** * overwrite the unregisterAdapterDataObserver to correctly forward all events to the FastAdapter
* @ param observer */
@ Override public void unregisterAdapterDataObserver ( RecyclerView . AdapterDataObserver observer ) { } } | super . unregisterAdapterDataObserver ( observer ) ; if ( mAdapter != null ) { mAdapter . unregisterAdapterDataObserver ( observer ) ; } |
public class Base64 { /** * package - private for testing */
static int encodedBufferSize ( int len , boolean breakLines ) { } } | // Cast len to long to prevent overflow
long len43 = ( ( long ) len << 2 ) / 3 ; // Account for padding
long ret = ( len43 + 3 ) & ~ 3 ; if ( breakLines ) { ret += len43 / MAX_LINE_LENGTH ; } return ret < Integer . MAX_VALUE ? ( int ) ret : Integer . MAX_VALUE ; |
public class ReconciliationReportRow { /** * Sets the lineItemCostPerUnit value for this ReconciliationReportRow .
* @ param lineItemCostPerUnit * The { @ link LineItem # costPerUnit } of the line item this row
* represents .
* This attribute is read - only . */
public void setLineItemCostPerUnit ( com . google . api . ads . admanager . axis . v201805 . Money lineItemCostPerUnit ) { } } | this . lineItemCostPerUnit = lineItemCostPerUnit ; |
public class ConfigUtil { /** * - - - - - Boolean */
public static Boolean getBoolean ( boolean validate , String key ) { } } | return Boolean . valueOf ( getString ( validate , key ) ) ; |
public class MatcherDescription { /** * { @ inheritDoc } */
@ Override public void describeTo ( Description d ) { } } | Nested . describeTo ( false , matcher , d , description ) ; |
public class BindM2MBuilder { /** * Generate .
* @ param filer
* the filer
* @ param model
* the model
* @ return the pair
* @ throws Exception
* the exception */
public static Pair < Set < GeneratedTypeElement > , Set < GeneratedTypeElement > > generate ( Filer filer , M2MModel model ) { } } | entityResult . clear ( ) ; daoResult . clear ( ) ; BindM2MBuilder visitor = new BindM2MBuilder ( filer ) ; for ( M2MEntity item : model . getEntities ( ) ) { visitor . generate ( item ) ; } Pair < Set < GeneratedTypeElement > , Set < GeneratedTypeElement > > result = new Pair < > ( ) ; result . value0 = entityResult ; result . value1 = daoResult ; return result ; |
public class RDN { /** * Returns a printable form of this RDN using the algorithm defined in
* RFC 2253 . Only RFC 2253 attribute type keywords are emitted .
* If canonical is true , then additional canonicalizations
* documented in X500Principal . getName are performed . */
public String toRFC2253String ( boolean canonical ) { } } | if ( canonical == false ) { return toRFC2253StringInternal ( false , Collections . < String , String > emptyMap ( ) ) ; } String c = canonicalString ; if ( c == null ) { c = toRFC2253StringInternal ( true , Collections . < String , String > emptyMap ( ) ) ; canonicalString = c ; } return c ; |
public class AlertBean { /** * Creates default alert without animation , with square borders and full width . */
public static AlertBean create ( AlertType type , String message ) { } } | AlertBean result = new AlertBean ( type , message ) ; result . setAnimate ( false ) ; result . setFullWidth ( true ) ; result . setRoundBorders ( false ) ; return result ; |
public class TerminMonitor { /** * 阻塞获取对应的process的termin事件 */
public Long waitForProcess ( ) throws InterruptedException { } } | Long processId = waitProcessIds . peek ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "## {} get termin id [{}]" , getPipelineId ( ) , processId ) ; } return processId ; |
public class ACLWriter { /** * Write AccessControlList data .
* @ param out
* The ObjectWriter
* @ param acl
* The AccessControlList object
* @ throws IOException
* If an I / O error has occurred . */
public void write ( ObjectWriter out , AccessControlList acl ) throws IOException { } } | // write id
out . writeInt ( SerializationConstants . ACCESS_CONTROL_LIST ) ; // Writing owner
String owner = acl . getOwner ( ) ; if ( owner != null ) { out . writeByte ( SerializationConstants . NOT_NULL_DATA ) ; out . writeString ( owner ) ; } else { out . writeByte ( SerializationConstants . NULL_DATA ) ; } // writing access control entries size
List < AccessControlEntry > accessList = acl . getPermissionEntries ( ) ; out . writeInt ( accessList . size ( ) ) ; for ( AccessControlEntry entry : accessList ) { // writing access control entrys identity
out . writeString ( entry . getIdentity ( ) ) ; // writing permission
out . writeString ( entry . getPermission ( ) ) ; } |
public class WDDXConverter { /** * deserialize a WDDX Package ( XML Element ) to a runtime object
* @ param element
* @ return deserialized Element
* @ throws ConverterException */
private Object _deserialize ( Element element ) throws ConverterException { } } | String nodeName = element . getNodeName ( ) . toLowerCase ( ) ; // NULL
if ( nodeName . equals ( "null" ) ) { return null ; } // String
else if ( nodeName . equals ( "string" ) ) { return _deserializeString ( element ) ; /* * Node data = element . getFirstChild ( ) ; if ( data = = null ) return " " ;
* String value = data . getNodeValue ( ) ;
* if ( value = = null ) return " " ; return XMLUtil . unescapeXMLString ( value ) ; */
} // Number
else if ( nodeName . equals ( "number" ) ) { try { Node data = element . getFirstChild ( ) ; if ( data == null ) return new Double ( 0 ) ; return Caster . toDouble ( data . getNodeValue ( ) ) ; } catch ( Exception e ) { throw toConverterException ( e ) ; } } // Boolean
else if ( nodeName . equals ( "boolean" ) ) { try { return Caster . toBoolean ( element . getAttribute ( "value" ) ) ; } catch ( PageException e ) { throw toConverterException ( e ) ; } } // Array
else if ( nodeName . equals ( "array" ) ) { return _deserializeArray ( element ) ; } // Component
else if ( nodeName . equals ( "component" ) || nodeName . equals ( "class" ) ) { return _deserializeComponent ( element ) ; } // Struct
else if ( nodeName . equals ( "struct" ) ) { return _deserializeStruct ( element ) ; } // Query
else if ( nodeName . equals ( "recordset" ) ) { return _deserializeQuery ( element ) ; } // DateTime
else if ( nodeName . equalsIgnoreCase ( "dateTime" ) ) { try { return DateCaster . toDateAdvanced ( element . getFirstChild ( ) . getNodeValue ( ) , timeZone ) ; } catch ( Exception e ) { throw toConverterException ( e ) ; } } // Query
else if ( nodeName . equals ( "binary" ) ) { return _deserializeBinary ( element ) ; } else throw new ConverterException ( "can't deserialize Element of type [" + nodeName + "] to a Object representation" ) ; |
public class SarlSpaceImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case SarlPackage . SARL_SPACE__EXTENDS : return extends_ != null ; } return super . eIsSet ( featureID ) ; |
public class Elements { /** * Get the elements in the list that are at the indexes .
* @ since 1.4.0 */
public static < T > List < T > slice ( List < T > list , int ... indexes ) { } } | List < T > slice = new ArrayList < > ( indexes . length ) ; for ( int i : indexes ) { slice . add ( list . get ( i ) ) ; } return slice ; |
public class SelectionController { @ Override protected void selectRectangle ( Bbox selectedArea ) { } } | // we can clear here !
if ( ! shiftOrCtrl ) { MapModel mapModel = mapWidget . getMapModel ( ) ; mapModel . clearSelectedFeatures ( ) ; } GwtCommand commandRequest = new GwtCommand ( SearchByLocationRequest . COMMAND ) ; SearchByLocationRequest request = new SearchByLocationRequest ( ) ; request . setLayerIds ( getSelectionLayerIds ( ) ) ; for ( Layer < ? > layer : mapWidget . getMapModel ( ) . getLayers ( ) ) { if ( layer . isShowing ( ) && layer instanceof VectorLayer ) { request . setFilter ( layer . getServerLayerId ( ) , ( ( VectorLayer ) layer ) . getFilter ( ) ) ; } } Polygon polygon = mapWidget . getMapModel ( ) . getGeometryFactory ( ) . createPolygon ( selectedArea ) ; request . setLocation ( GeometryConverter . toDto ( polygon ) ) ; request . setCrs ( mapWidget . getMapModel ( ) . getCrs ( ) ) ; request . setQueryType ( SearchByLocationRequest . QUERY_INTERSECTS ) ; request . setRatio ( coverageRatio ) ; request . setSearchType ( SearchByLocationRequest . SEARCH_ALL_LAYERS ) ; request . setFeatureIncludes ( GwtCommandDispatcher . getInstance ( ) . getLazyFeatureIncludesSelect ( ) ) ; commandRequest . setCommandRequest ( request ) ; GwtCommandDispatcher . getInstance ( ) . execute ( commandRequest , new AbstractCommandCallback < SearchByLocationResponse > ( ) { public void execute ( SearchByLocationResponse response ) { Map < String , List < org . geomajas . layer . feature . Feature > > featureMap = response . getFeatureMap ( ) ; for ( String layerId : featureMap . keySet ( ) ) { selectFeatures ( layerId , featureMap . get ( layerId ) ) ; } } } ) ; |
public class ControlCurve { /** * return index of control point near to ( x , y ) or - 1 if nothing near */
public int selectPoint ( double x , double y ) { } } | double mind = Double . POSITIVE_INFINITY ; selection = - 1 ; for ( int i = 0 ; i < pts . size ( ) ; i ++ ) { Coordinate coordinate = pts . get ( i ) ; double d = sqr ( coordinate . x - x ) + sqr ( coordinate . y - y ) ; if ( d < mind && d < EPSILON ) { mind = d ; selection = i ; } } return selection ; |
public class TomcatDetector { /** * { @ inheritDoc }
* @ param pMBeanServerExecutor */
public ServerHandle detect ( MBeanServerExecutor pMBeanServerExecutor ) { } } | String serverInfo = getSingleStringAttribute ( pMBeanServerExecutor , "*:type=Server" , "serverInfo" ) ; if ( serverInfo == null ) { return null ; } Matcher matcher = SERVER_INFO_PATTERN . matcher ( serverInfo ) ; if ( matcher . matches ( ) ) { String product = matcher . group ( 1 ) ; String version = matcher . group ( 2 ) ; // TODO : Extract access URL
if ( product . toLowerCase ( ) . contains ( "tomcat" ) ) { return new ServerHandle ( "Apache" , "tomcat" , version , null ) ; } } return null ; |
public class ScopeContext { /** * Returns the current Cluster Scope , if there is no current Cluster Scope and create is true ,
* returns a new Cluster Scope . If create is false and the request has no valid Cluster Scope , this
* method returns null .
* @ param config
* @ param create
* @ return
* @ throws PageException */
public static Cluster getClusterScope ( Config config , boolean create ) throws PageException { } } | if ( cluster == null && create ) { cluster = ( ( ConfigImpl ) config ) . createClusterScope ( ) ; } return cluster ; |
public class CertificateOperations { /** * Cancels a failed deletion of the specified certificate . This operation can be performed only when
* the certificate is in the { @ link com . microsoft . azure . batch . protocol . models . CertificateState # DELETE _ FAILED Delete Failed } state , and restores
* the certificate to the { @ link com . microsoft . azure . batch . protocol . models . CertificateState # ACTIVE Active } state .
* @ param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter . This must be sha1.
* @ param thumbprint The thumbprint of the certificate that failed to delete .
* @ throws BatchErrorException Exception thrown when an error response is received from the Batch service .
* @ throws IOException Exception thrown when there is an error in serialization / deserialization of data sent to / received from the Batch service . */
public void cancelDeleteCertificate ( String thumbprintAlgorithm , String thumbprint ) throws BatchErrorException , IOException { } } | cancelDeleteCertificate ( thumbprintAlgorithm , thumbprint , null ) ; |
public class FunctionInjector { /** * Inline a function into the call site . */
Node inline ( Reference ref , String fnName , Node fnNode ) { } } | checkState ( compiler . getLifeCycleStage ( ) . isNormalized ( ) ) ; return internalInline ( ref , fnName , fnNode ) ; |
public class MenuScreen { /** * Process the command .
* @ param strCommand The command to process .
* @ param sourceSField The source screen field ( to avoid echos ) .
* @ param iCommandOptions If this command creates a new screen , create in a new window ?
* @ param true if success . */
public boolean doCommand ( String strCommand , ScreenField sourceSField , int iCommandOptions ) { } } | int iIndex = strCommand . indexOf ( DBParams . MENU + '=' ) ; if ( iIndex != - 1 ) if ( ( strCommand . indexOf ( DBParams . TASK + '=' ) != - 1 ) || ( strCommand . indexOf ( DBParams . APPLET + '=' ) != - 1 ) || ( strCommand . indexOf ( DBParams . SCREEN + '=' ) != - 1 ) ) iIndex = - 1 ; // Special case - thin menu ( create an applet window )
if ( iIndex == - 1 ) { String strJobCommand = DBParams . JOB + '=' ; int iCommandIndex = strCommand . indexOf ( strJobCommand ) ; if ( iCommandIndex != - 1 ) { iCommandIndex += strJobCommand . length ( ) ; strCommand = strCommand . substring ( iCommandIndex , Math . max ( strCommand . indexOf ( '&' , iCommandIndex ) , strCommand . length ( ) ) ) ; try { strCommand = URLDecoder . decode ( strCommand , DBConstants . URL_ENCODING ) ; } catch ( java . io . UnsupportedEncodingException ex ) { ex . printStackTrace ( ) ; strCommand = "" ; } } } if ( ( iIndex != - 1 ) && ( ( iCommandOptions & ScreenConstants . USE_NEW_WINDOW ) != ScreenConstants . USE_NEW_WINDOW ) ) { // Same window
// x strCommand = " ? samewindow = & " + strCommand . substring ( iIndex ) ;
if ( strCommand . indexOf ( MenuScreen . SAME_WINDOW_PARAM ) == - 1 ) strCommand = Utility . addURLParam ( strCommand , MenuScreen . SAME_WINDOW_PARAM , DBConstants . BLANK ) ; this . freeAllSFields ( false ) ; if ( this . getTask ( ) != null ) this . getTask ( ) . setProperties ( null ) ; // this . setMenuProperty ( strParam ) ; / / Set the menu to the current " menu " parameter .
m_strMenu = null ; m_strMenuObjectID = null ; m_strMenuTitle = null ; boolean bSuccess = this . getScreenFieldView ( ) . doCommand ( strCommand ) ; // Initial menu
this . resizeToContent ( this . getTitle ( ) ) ; // Container control = ( Container ) this . getScreenFieldView ( ) . getControl ( ) ; / / Redisplay
// control . validate ( ) ; / / Re - layout the container
// control . repaint ( ) ; / / Re - display this screen
this . getParentScreen ( ) . pushHistory ( strCommand , ( ( iCommandOptions & DBConstants . DONT_PUSH_TO_BROWSER ) == DBConstants . PUSH_TO_BROWSER ) ) ; // History of screens displayed
return bSuccess ; } else return super . doCommand ( strCommand , sourceSField , iCommandOptions ) ; // Do inherited |
public class JobOperations { /** * Lists the { @ link CloudJob jobs } created under the specified jobSchedule .
* @ param jobScheduleId The ID of jobSchedule .
* @ param detailLevel A { @ link DetailLevel } used for filtering the list and for controlling which properties are retrieved from the service .
* @ param additionalBehaviors A collection of { @ link BatchClientBehavior } instances that are applied to the Batch service request .
* @ return A list of { @ link CloudJob } objects .
* @ throws BatchErrorException Exception thrown when an error response is received from the Batch service .
* @ throws IOException Exception thrown when there is an error in serialization / deserialization of data sent to / received from the Batch service . */
public PagedList < CloudJob > listJobs ( String jobScheduleId , DetailLevel detailLevel , Iterable < BatchClientBehavior > additionalBehaviors ) throws BatchErrorException , IOException { } } | JobListFromJobScheduleOptions jobListOptions = new JobListFromJobScheduleOptions ( ) ; BehaviorManager bhMgr = new BehaviorManager ( this . customBehaviors ( ) , additionalBehaviors ) ; bhMgr . appendDetailLevelToPerCallBehaviors ( detailLevel ) ; bhMgr . applyRequestBehaviors ( jobListOptions ) ; return this . parentBatchClient . protocolLayer ( ) . jobs ( ) . listFromJobSchedule ( jobScheduleId , jobListOptions ) ; |
public class BackupStatusInner { /** * Get the container backup status .
* @ param azureRegion Azure region to hit Api
* @ param parameters Container Backup Status Request
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the BackupStatusResponseInner object if successful . */
public BackupStatusResponseInner get ( String azureRegion , BackupStatusRequest parameters ) { } } | return getWithServiceResponseAsync ( azureRegion , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class PagerModel { /** * Get the total number of pages . This value is useful when displaying the total number of pages in UI like :
* < pre >
* Page 4 of 10
* < / pre >
* This method returns an absolute count of the number of pages which could be displayed given the
* size of the data set and the current page size . This method requires the PagerModel know the
* total size of the data set .
* @ return the number of pages
* @ throws IllegalStateException when the size of the data set has not been set */
public int getPageCount ( ) { } } | if ( _dataSetSize != null ) return ( int ) Math . ceil ( _dataSetSize . doubleValue ( ) / ( double ) getPageSize ( ) ) ; else throw new IllegalStateException ( Bundle . getErrorString ( "PagerModel_CantCalculateLastPage" ) ) ; |
public class StandardSpawnService { /** * Notify the agent ' s listeners about its spawning .
* @ param spawningAgent the spawning agent .
* @ param context the context in which the agent was spawned .
* @ param agent the spawned agent .
* @ param initializationParameters the initialization parameters . */
protected void fireAgentSpawnedInAgent ( UUID spawningAgent , AgentContext context , Agent agent , Object ... initializationParameters ) { } } | // Notify the listeners on the lifecycle events inside
// the just spawned agent .
// Usually , only BICs and the AgentLifeCycleSupport in
// io . janusproject . kernel . bic . StandardBuiltinCapacitiesProvider
// is invoked .
final ListenerCollection < SpawnServiceListener > list ; synchronized ( this . agentLifecycleListeners ) { list = this . agentLifecycleListeners . get ( agent . getID ( ) ) ; } if ( list != null ) { final List < Agent > singleton = Collections . singletonList ( agent ) ; for ( final SpawnServiceListener l : list . getListeners ( SpawnServiceListener . class ) ) { l . agentSpawned ( spawningAgent , context , singleton , initializationParameters ) ; } } |
public class ByteArray { /** * { @ inheritDoc } */
@ Override public void readBytes ( byte [ ] bytes , int offset , int length ) { } } | dataInput . readBytes ( bytes , offset , length ) ; |
public class TemplateUtils { /** * If the parent Element is an ancestor of the maybeDescendant element ,
* this method returns the path from which the maybeDescendant can be reached
* when starting from the parent . < br / >
* If the maybeDescendant is not a descendant , the method returns null
* @ param parent The tested parent Element
* @ param maybeDescendant The tested descendant
* @ return */
public static ArrayList < Element > isDescendant ( Element parent , Element maybeDescendant ) { } } | ArrayList < Element > res = new ArrayList < > ( ) ; Element cur = maybeDescendant ; while ( cur != null ) { res . add ( 0 , cur ) ; if ( cur == parent ) return res ; cur = cur . getParentElement ( ) ; } return null ; |
public class MessagePredicates { /** * Creates a { @ link Predicate } for matching subject and body .
* @ param subjectPattern
* the regex pattern the subject must match
* @ param bodyPattern
* the regex pattern the body must match
* @ return the predicate */
public static Predicate < MailMessage > forSubjectAndBody ( final String subjectPattern , final String bodyPattern ) { } } | return forSubjectAndBody ( Pattern . compile ( subjectPattern ) , Pattern . compile ( bodyPattern ) ) ; |
public class XPathParser { /** * Starts parsing the query .
* @ throws TTXPathException */
public void parseQuery ( ) throws TTXPathException { } } | // get first token , ignore all white spaces
do { mToken = mScanner . nextToken ( ) ; } while ( mToken . getType ( ) == TokenType . SPACE ) ; // parse the query according to the rules specified in the XPath 2.0 REC
parseExpression ( ) ; // after the parsing of the expression no token must be left
if ( mToken . getType ( ) != TokenType . END ) { throw new IllegalStateException ( "The query has not been processed completely." ) ; } |
public class Reflector { /** * Get the target field value , and warp to { @ link Reflector }
* @ param name target name
* @ return Reflector
* @ throws ReflectException */
public Reflector field ( String name ) throws ReflectException { } } | try { Field field = field0 ( name ) ; return with ( field . get ( obj ) ) ; } catch ( Exception e ) { throw new ReflectException ( e ) ; } |
public class GlobalConfiguration { /** * Loads the configuration files from the specified directory . If the dynamic properties
* configuration is not null , then it is added to the loaded configuration .
* @ param configDir directory to load the configuration from
* @ param dynamicProperties configuration file containing the dynamic properties . Null if none .
* @ return The configuration loaded from the given configuration directory */
public static Configuration loadConfiguration ( final String configDir , @ Nullable final Configuration dynamicProperties ) { } } | if ( configDir == null ) { throw new IllegalArgumentException ( "Given configuration directory is null, cannot load configuration" ) ; } final File confDirFile = new File ( configDir ) ; if ( ! ( confDirFile . exists ( ) ) ) { throw new IllegalConfigurationException ( "The given configuration directory name '" + configDir + "' (" + confDirFile . getAbsolutePath ( ) + ") does not describe an existing directory." ) ; } // get Flink yaml configuration file
final File yamlConfigFile = new File ( confDirFile , FLINK_CONF_FILENAME ) ; if ( ! yamlConfigFile . exists ( ) ) { throw new IllegalConfigurationException ( "The Flink config file '" + yamlConfigFile + "' (" + confDirFile . getAbsolutePath ( ) + ") does not exist." ) ; } Configuration configuration = loadYAMLResource ( yamlConfigFile ) ; if ( dynamicProperties != null ) { configuration . addAll ( dynamicProperties ) ; } return configuration ; |
public class MethodInvoker { /** * Invokes a method .
* Examples :
* < pre >
* / / Equivalent to invoking the method ' person . setName ( " Luke " ) '
* { @ link org . fest . reflect . core . Reflection # method ( String ) method } ( " setName " ) . { @ link org . fest . reflect . method . MethodName # withParameterTypes ( Class . . . ) withParameterTypes } ( String . class )
* . { @ link org . fest . reflect . method . ParameterTypes # in ( Object ) in } ( person )
* . { @ link org . fest . reflect . method . MethodInvoker # invoke ( Object . . . ) invoke } ( " Luke " ) ;
* / / Equivalent to invoking the method ' jedi . getPowers ( ) '
* List & lt ; String & gt ; powers = { @ link org . fest . reflect . core . Reflection # method ( String ) method } ( " getPowers " ) . { @ link org . fest . reflect . method . MethodName # withReturnType ( org . fest . reflect . reference . TypeRef ) withReturnType } ( new { @ link org . fest . reflect . reference . TypeRef TypeRef } & lt ; List & lt ; String & gt ; & gt ; ( ) { } )
* . { @ link org . fest . reflect . method . ReturnTypeRef # in ( Object ) in } ( person )
* . { @ link org . fest . reflect . method . MethodInvoker # invoke ( Object . . . ) invoke } ( ) ;
* / / Equivalent to invoking the static method ' Jedi . setCommonPower ( " Jump " ) '
* { @ link org . fest . reflect . core . Reflection # method ( String ) method } ( " setCommonPower " ) . { @ link org . fest . reflect . method . MethodName # withParameterTypes ( Class . . . ) withParameterTypes } ( String . class )
* . { @ link org . fest . reflect . method . ParameterTypes # in ( Object ) in } ( Jedi . class )
* . { @ link org . fest . reflect . method . MethodInvoker # invoke ( Object . . . ) invoke } ( " Jump " ) ;
* / / Equivalent to invoking the static method ' Jedi . addPadawan ( ) '
* { @ link org . fest . reflect . core . Reflection # method ( String ) method } ( " addPadawan " ) . { @ link org . fest . reflect . method . MethodName # in ( Object ) in } ( Jedi . class ) . { @ link org . fest . reflect . method . MethodInvoker # invoke ( Object . . . ) invoke } ( ) ;
* < / pre >
* @ param args the arguments to use to call the method managed by this class .
* @ return the result of the method call .
* @ throws ReflectionError if the method cannot be invoked . */
public @ Nullable T invoke ( @ NotNull Object ... args ) { } } | checkNotNull ( args ) ; Method method = target ( ) ; boolean accessible = method . isAccessible ( ) ; try { makeAccessible ( method ) ; Object returnValue = method . invoke ( target , args ) ; return castSafely ( returnValue , checkNotNull ( returnType ) ) ; } catch ( Throwable t ) { Throwable cause = targetOf ( t ) ; if ( cause instanceof RuntimeException ) { throw ( RuntimeException ) cause ; } String format = "Unable to invoke method %s with arguments %s" ; throw new ReflectionError ( String . format ( format , quote ( method . getName ( ) ) , format ( args ) ) , cause ) ; } finally { setAccessibleIgnoringExceptions ( method , accessible ) ; } |
public class ViewRetryHandler { /** * Takes a { @ link ViewQueryResponse } , verifies their status based on fixed criteria and resubscribes if needed .
* If it needs to be retried , the resubscription will happen after 10 milliseconds to give the underlying code
* some time to recover .
* @ param input the original response .
* @ return the good response which can be parsed , or a failing observable . */
public static Observable < ViewQueryResponse > retryOnCondition ( final Observable < ViewQueryResponse > input ) { } } | return input . flatMap ( new Func1 < ViewQueryResponse , Observable < ViewQueryResponse > > ( ) { @ Override public Observable < ViewQueryResponse > call ( final ViewQueryResponse response ) { return passThroughOrThrow ( response ) ; } } ) . retryWhen ( new Func1 < Observable < ? extends Throwable > , Observable < ? > > ( ) { @ Override public Observable < ? > call ( Observable < ? extends Throwable > observable ) { return observable . flatMap ( new Func1 < Throwable , Observable < ? > > ( ) { @ Override public Observable < ? > call ( Throwable throwable ) { if ( throwable instanceof ShouldRetryViewRequestException || throwable instanceof RequestCancelledException ) { return Observable . timer ( 10 , TimeUnit . MILLISECONDS ) ; } else { return Observable . error ( throwable ) ; } } } ) ; } } ) . last ( ) ; |
public class SyncFrequency { /** * A configuration to enforce that local / remote events will be queued on the device for
* a specified amount of time ( configurable ) before they are applied .
* @ param timeInterval The amount of time in the given { @ link TimeUnit } between syncs .
* @ param timeUnit The { @ link TimeUnit } qualifier for the timeInterval number .
* @ param isConnected Whether or not the application continuously
* applying events by maintaining a sync stream
* @ return a scheduled configuration */
public static SyncFrequency scheduled ( final long timeInterval , @ Nonnull final TimeUnit timeUnit , final boolean isConnected ) { } } | return new Scheduled ( timeInterval , timeUnit , isConnected ) ; |
public class PackratParser { /** * This method processes leading tokens which are either hidden or ignored . The
* processing only happens if the configuration allows it .
* @ param node
* @ param position
* @ param id
* @ param line
* @ param progress
* @ throws TreeException
* @ throws ParserException */
private void processIgnoredLeadingTokens ( ParseTreeNode node , int position , int line , MemoEntry progress ) throws TreeException , ParserException { } } | if ( ignoredLeading ) { processIgnoredTokens ( node , position , line , progress ) ; } |
public class RegisterUtils { /** * returns the register used to store a reference
* @ param dbc
* the dismantle byte code parsing the class
* @ param seen
* the opcode of the store
* @ return the register stored into */
public static int getAStoreReg ( final DismantleBytecode dbc , final int seen ) { } } | if ( seen == Const . ASTORE ) { return dbc . getRegisterOperand ( ) ; } if ( OpcodeUtils . isAStore ( seen ) ) { return seen - Const . ASTORE_0 ; } return - 1 ; |
public class MetaMultilabelGenerator { /** * GenerateMultilabelHeader .
* @ paramsisingle - label Instances */
protected MultilabelInstancesHeader generateMultilabelHeader ( Instances si ) { } } | Instances mi = new Instances ( si , 0 , 0 ) ; mi . setClassIndex ( - 1 ) ; mi . deleteAttributeAt ( mi . numAttributes ( ) - 1 ) ; FastVector bfv = new FastVector ( ) ; bfv . addElement ( "0" ) ; bfv . addElement ( "1" ) ; for ( int i = 0 ; i < this . m_L ; i ++ ) { mi . insertAttributeAt ( new Attribute ( "class" + i , bfv ) , i ) ; } this . multilabelStreamTemplate = mi ; this . multilabelStreamTemplate . setRelationName ( "SYN_Z" + this . labelCardinalityOption . getValue ( ) + "L" + this . m_L + "X" + m_A + "S" + metaRandomSeedOption . getValue ( ) + ": -C " + this . m_L ) ; this . multilabelStreamTemplate . setClassIndex ( this . m_L ) ; return new MultilabelInstancesHeader ( multilabelStreamTemplate , m_L ) ; |
public class TypeUtil { /** * If type is a byte TypeMirror , short TypeMirror , or char TypeMirror , an int TypeMirror is
* returned . Otherwise , type is returned . See jls - 5.6.1.
* @ param type a numeric type
* @ return the result of unary numeric promotion applied to type */
public TypeMirror unaryNumericPromotion ( TypeMirror type ) { } } | TypeKind t = type . getKind ( ) ; if ( t == TypeKind . DECLARED ) { type = javacTypes . unboxedType ( type ) ; t = type . getKind ( ) ; } if ( t == TypeKind . BYTE || t == TypeKind . SHORT || t == TypeKind . CHAR ) { return getInt ( ) ; } else { return type ; } |
public class OmdbBuilder { /** * The title to search for
* @ param title
* @ return
* @ throws OMDBException */
public OmdbBuilder setTitle ( final String title ) throws OMDBException { } } | if ( StringUtils . isBlank ( title ) ) { throw new OMDBException ( ApiExceptionType . UNKNOWN_CAUSE , "Must provide a title!" ) ; } params . add ( Param . TITLE , title ) ; return this ; |
public class RowUtil { /** * 读取一行
* @ param row 行
* @ param cellEditor 单元格编辑器
* @ return 单元格值列表 */
public static List < Object > readRow ( Row row , CellEditor cellEditor ) { } } | if ( null == row ) { return new ArrayList < > ( 0 ) ; } final short length = row . getLastCellNum ( ) ; if ( length < 0 ) { return new ArrayList < > ( 0 ) ; } final List < Object > cellValues = new ArrayList < > ( ( int ) length ) ; Object cellValue ; boolean isAllNull = true ; for ( short i = 0 ; i < length ; i ++ ) { cellValue = CellUtil . getCellValue ( row . getCell ( i ) , cellEditor ) ; isAllNull &= StrUtil . isEmptyIfStr ( cellValue ) ; cellValues . add ( cellValue ) ; } if ( isAllNull ) { // 如果每个元素都为空 , 则定义为空行
return new ArrayList < > ( 0 ) ; } return cellValues ; |
public class LoggingMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Logging logging , ProtocolMarshaller protocolMarshaller ) { } } | if ( logging == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( logging . getClusterLogging ( ) , CLUSTERLOGGING_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class UserResources { /** * Creates a user .
* @ param req The HTTP request .
* @ param userDto The user to create .
* @ return The updated DTO for the created user .
* @ throws WebApplicationException If an error occurs . */
@ POST @ Produces ( MediaType . APPLICATION_JSON ) @ Consumes ( MediaType . APPLICATION_JSON ) @ Description ( "Creates a user." ) public PrincipalUserDto createPrincipalUser ( @ Context HttpServletRequest req , final PrincipalUserDto userDto ) { } } | PrincipalUser remoteUser = validateAndGetOwner ( req , null ) ; validateResourceAuthorization ( req , remoteUser , remoteUser ) ; if ( userDto == null ) { throw new WebApplicationException ( "Cannot create a null user." , Status . BAD_REQUEST ) ; } PrincipalUser user = new PrincipalUser ( remoteUser , userDto . getUserName ( ) , userDto . getEmail ( ) ) ; copyProperties ( user , userDto ) ; user = _uService . updateUser ( user ) ; return PrincipalUserDto . transformToDto ( user ) ; |
public class WorkItemConfigurationsInner { /** * Create a work item configuration for an Application Insights component .
* @ param resourceGroupName The name of the resource group .
* @ param resourceName The name of the Application Insights component resource .
* @ param workItemConfigurationProperties Properties that need to be specified to create a work item configuration of a Application Insights component .
* @ 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 < WorkItemConfigurationInner > createAsync ( String resourceGroupName , String resourceName , WorkItemCreateConfiguration workItemConfigurationProperties , final ServiceCallback < WorkItemConfigurationInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( createWithServiceResponseAsync ( resourceGroupName , resourceName , workItemConfigurationProperties ) , serviceCallback ) ; |
public class Primitives { /** * Returns the corresponding wrapper type of { @ code type } if it is a primitive
* type ; otherwise returns { @ code type } itself . Idempotent .
* < pre >
* wrap ( int . class ) = = Integer . class
* wrap ( Integer . class ) = = Integer . class
* wrap ( String . class ) = = String . class
* < / pre > */
@ SuppressWarnings ( "unchecked" ) public static < T > Class < T > wrap ( Class < T > type ) { } } | if ( type == int . class ) return ( Class < T > ) Integer . class ; if ( type == float . class ) return ( Class < T > ) Float . class ; if ( type == byte . class ) return ( Class < T > ) Byte . class ; if ( type == double . class ) return ( Class < T > ) Double . class ; if ( type == long . class ) return ( Class < T > ) Long . class ; if ( type == char . class ) return ( Class < T > ) Character . class ; if ( type == boolean . class ) return ( Class < T > ) Boolean . class ; if ( type == short . class ) return ( Class < T > ) Short . class ; if ( type == void . class ) return ( Class < T > ) Void . class ; return type ; |
public class ValidationSessionHolderImpl { /** * / * ( non - Javadoc )
* @ see nz . co . senanque . validationengine . ValidationSessionHolder # unbind ( java . lang . Object ) */
@ Override public void unbind ( Object context ) { } } | if ( m_validationSession != null && context instanceof ValidationObject ) { m_validationSession . unbind ( ( ValidationObject ) context ) ; } |
public class AbstractAnimatedZoomableController { /** * Zooms to the desired scale and positions the image so that the given image point corresponds
* to the given view point .
* < p > If this method is called while an animation or gesture is already in progress ,
* the current animation or gesture will be stopped first .
* @ param scale desired scale , will be limited to { min , max } scale factor
* @ param imagePoint 2D point in image ' s relative coordinate system ( i . e . 0 < = x , y < = 1)
* @ param viewPoint 2D point in view ' s absolute coordinate system */
@ Override public void zoomToPoint ( float scale , PointF imagePoint , PointF viewPoint ) { } } | zoomToPoint ( scale , imagePoint , viewPoint , LIMIT_ALL , 0 , null ) ; |
public class BatchDeleteImageResult { /** * Any failures associated with the call .
* @ param failures
* Any failures associated with the call . */
public void setFailures ( java . util . Collection < ImageFailure > failures ) { } } | if ( failures == null ) { this . failures = null ; return ; } this . failures = new java . util . ArrayList < ImageFailure > ( failures ) ; |
public class DefaultZoomableController { /** * Same as { @ code Matrix . isIdentity ( ) } , but with tolerance { @ code eps } . */
private boolean isMatrixIdentity ( Matrix transform , float eps ) { } } | // Checks whether the given matrix is close enough to the identity matrix :
// 1 0 0
// 0 1 0
// 0 0 1
// Or equivalently to the zero matrix , after subtracting 1.0f from the diagonal elements :
// 0 0 0
// 0 0 0
// 0 0 0
transform . getValues ( mTempValues ) ; mTempValues [ 0 ] -= 1.0f ; // m00
mTempValues [ 4 ] -= 1.0f ; // m11
mTempValues [ 8 ] -= 1.0f ; // m22
for ( int i = 0 ; i < 9 ; i ++ ) { if ( Math . abs ( mTempValues [ i ] ) > eps ) { return false ; } } return true ; |
public class PhoneIntents { /** * Creates an intent that will allow to send an SMS without specifying the phone number
* @ param phoneNumbers The phone numbers to send the SMS to
* @ return the intent */
public static Intent newEmptySmsIntent ( Context context , String [ ] phoneNumbers ) { } } | return newSmsIntent ( context , null , phoneNumbers ) ; |
public class SparseMatrix { /** * x = x + beta * A ( : , j ) , where x is a dense vector and A ( : , j ) is sparse . */
private static int scatter ( SparseMatrix A , int j , double beta , int [ ] w , double [ ] x , int mark , SparseMatrix C , int nz ) { } } | int [ ] Ap = A . colIndex ; int [ ] Ai = A . rowIndex ; double [ ] Ax = A . x ; int [ ] Ci = C . rowIndex ; for ( int p = Ap [ j ] ; p < Ap [ j + 1 ] ; p ++ ) { int i = Ai [ p ] ; // A ( i , j ) is nonzero
if ( w [ i ] < mark ) { w [ i ] = mark ; // i is new entry in column j
Ci [ nz ++ ] = i ; // add i to pattern of C ( : , j )
x [ i ] = beta * Ax [ p ] ; // x ( i ) = beta * A ( i , j )
} else { x [ i ] += beta * Ax [ p ] ; // i exists in C ( : , j ) already
} } return nz ; |
public class CPDAvailabilityEstimateLocalServiceBaseImpl { /** * Creates a new cpd availability estimate with the primary key . Does not add the cpd availability estimate to the database .
* @ param CPDAvailabilityEstimateId the primary key for the new cpd availability estimate
* @ return the new cpd availability estimate */
@ Override @ Transactional ( enabled = false ) public CPDAvailabilityEstimate createCPDAvailabilityEstimate ( long CPDAvailabilityEstimateId ) { } } | return cpdAvailabilityEstimatePersistence . create ( CPDAvailabilityEstimateId ) ; |
public class CssParser { /** * With start expected to be an IDENT token representing the property name ,
* build the declaration and return after hitting ' ; ' or ' } ' . On error ,
* issue to errhandler , return null , caller forwards . */
private CssDeclaration handleDeclaration ( CssToken name , CssTokenIterator iter , CssContentHandler doc , CssErrorHandler err , boolean isStyleAttribute ) throws CssException { } } | if ( name . type != CssToken . Type . IDENT ) { err . error ( new CssGrammarException ( GRAMMAR_EXPECTING_TOKEN , name . location , messages . getLocale ( ) , name . getChars ( ) , messages . get ( "a_property_name" ) ) ) ; return null ; } CssDeclaration declaration = new CssDeclaration ( name . getChars ( ) , name . location ) ; try { if ( ! MATCH_COLON . apply ( iter . next ( ) ) ) { err . error ( new CssGrammarException ( GRAMMAR_EXPECTING_TOKEN , name . location , messages . getLocale ( ) , iter . last . getChars ( ) , ":" ) ) ; return null ; } } catch ( NoSuchElementException nse ) { err . error ( new CssGrammarException ( GRAMMAR_PREMATURE_EOF , iter . last . location , messages . getLocale ( ) , ":" ) ) ; throw new PrematureEOFException ( ) ; } try { while ( true ) { CssToken value = iter . next ( ) ; if ( MATCH_SEMI_CLOSEBRACE . apply ( value ) ) { if ( declaration . components . size ( ) < 1 ) { err . error ( new CssGrammarException ( GRAMMAR_EXPECTING_TOKEN , iter . last . location , messages . getLocale ( ) , value . getChar ( ) , messages . get ( "a_property_value" ) ) ) ; return null ; } else { return declaration ; } } else { if ( ! handlePropertyValue ( declaration , value , iter , isStyleAttribute ) ) { err . error ( new CssGrammarException ( GRAMMAR_UNEXPECTED_TOKEN , iter . last . location , messages . getLocale ( ) , iter . last . getChars ( ) ) ) ; return null ; } else { if ( isStyleAttribute && ! iter . hasNext ( ) ) { return declaration ; } } } } } catch ( NoSuchElementException nse ) { err . error ( new CssGrammarException ( GRAMMAR_PREMATURE_EOF , iter . last . location , messages . getLocale ( ) , "';' " + messages . get ( "or" ) + " '}'" ) ) ; throw new PrematureEOFException ( ) ; } |
public class AnnotationTypeWriterImpl { /** * { @ inheritDoc } */
public void addFooter ( Content contentTree ) { } } | contentTree . addContent ( HtmlConstants . END_OF_CLASS_DATA ) ; addNavLinks ( false , contentTree ) ; addBottom ( contentTree ) ; |
public class WebAPI { /** * Lists jobs currently running . */
static void listJobs ( ) throws Exception { } } | HttpClient client = new HttpClient ( ) ; GetMethod get = new GetMethod ( URL + "/Jobs.json" ) ; int status = client . executeMethod ( get ) ; if ( status != 200 ) throw new Exception ( get . getStatusText ( ) ) ; Gson gson = new Gson ( ) ; JobsRes res = gson . fromJson ( new InputStreamReader ( get . getResponseBodyAsStream ( ) ) , JobsRes . class ) ; System . out . println ( "Running jobs:" ) ; for ( Job job : res . jobs ) System . out . println ( job . description + " " + job . destination_key ) ; get . releaseConnection ( ) ; |
public class JSONObject { /** * 将指定KEY列表的值组成新的JSONArray
* @ param names KEY列表
* @ return A JSONArray of values .
* @ throws JSONException If any of the values are non - finite numbers . */
public JSONArray toJSONArray ( Collection < String > names ) throws JSONException { } } | if ( CollectionUtil . isEmpty ( names ) ) { return null ; } final JSONArray ja = new JSONArray ( ) ; Object value ; for ( String name : names ) { value = this . get ( name ) ; if ( null != value ) { ja . put ( value ) ; } } return ja ; |
public class MediaType { /** * Sorts the given list of { @ code MediaType } objects by specificity .
* < p > Given two media types :
* < ol >
* < li > if either media type has a { @ linkplain # isWildcardType ( ) wildcard type } , then the media type without the
* wildcard is ordered before the other . < / li >
* < li > if the two media types have different { @ linkplain # getType ( ) types } , then they are considered equal and
* remain their current order . < / li >
* < li > if either media type has a { @ linkplain # isWildcardSubtype ( ) wildcard subtype } , then the media type without
* the wildcard is sorted before the other . < / li >
* < li > if the two media types have different { @ linkplain # getSubtype ( ) subtypes } , then they are considered equal
* and remain their current order . < / li >
* < li > if the two media types have different { @ linkplain # getQualityValue ( ) quality value } , then the media type
* with the highest quality value is ordered before the other . < / li >
* < li > if the two media types have a different amount of { @ linkplain # getParameter ( String ) parameters } , then the
* media type with the most parameters is ordered before the other . < / li >
* < / ol >
* < p > For example :
* < blockquote > audio / basic & lt ; audio / * & lt ; * & # 047 ; * < / blockquote >
* < blockquote > audio / * & lt ; audio / * ; q = 0.7 ; audio / * ; q = 0.3 < / blockquote >
* < blockquote > audio / basic ; level = 1 & lt ; audio / basic < / blockquote >
* < blockquote > audio / basic = = text / html < / blockquote >
* < blockquote > audio / basic = = audio / wave < / blockquote >
* @ param mediaTypes the list of media types to be sorted
* @ see < a href = " http : / / tools . ietf . org / html / rfc7231 # section - 5.3.2 " > HTTP 1.1 : Semantics
* and Content , section 5.3.2 < / a > */
public static void sortBySpecificity ( List < MediaType > mediaTypes ) { } } | checkNotNull ( mediaTypes , "'mediaTypes' must not be null" ) ; if ( mediaTypes . size ( ) > 1 ) { Collections . sort ( mediaTypes , SPECIFICITY_COMPARATOR ) ; } |
public class CipherSuiteConverter { /** * Convert from OpenSSL cipher suite name convention to java cipher suite name convention .
* @ param openSslCipherSuite An OpenSSL cipher suite name .
* @ param protocol The cryptographic protocol ( i . e . SSL , TLS , . . . ) .
* @ return The translated cipher suite name according to java conventions . This will not be { @ code null } . */
static String toJava ( String openSslCipherSuite , String protocol ) { } } | Map < String , String > p2j = o2j . get ( openSslCipherSuite ) ; if ( p2j == null ) { p2j = cacheFromOpenSsl ( openSslCipherSuite ) ; // This may happen if this method is queried when OpenSSL doesn ' t yet have a cipher setup . It will return
// " ( NONE ) " in this case .
if ( p2j == null ) { return null ; } } String javaCipherSuite = p2j . get ( protocol ) ; if ( javaCipherSuite == null ) { String cipher = p2j . get ( "" ) ; if ( cipher == null ) { return null ; } javaCipherSuite = protocol + '_' + cipher ; } return javaCipherSuite ; |
public class AbstractSimon { /** * Stores an attribute in this Simon . Attributes can be used to store any custom objects .
* @ param name a String specifying the name of the attribute
* @ param value the Object to be stored
* @ since 2.3 */
@ Override public void setAttribute ( String name , Object value ) { } } | attributesSupport . setAttribute ( name , value ) ; |
public class GSPTImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . GSPT__PATT : return getPATT ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class FactTemplateObjectType { /** * Determine if the passed < code > Object < / code > belongs to the object type
* defined by this < code > objectType < / code > instance .
* @ param object
* The < code > Object < / code > to test .
* @ return < code > true < / code > if the < code > Object < / code > matches this
* object type , else < code > false < / code > . */
public boolean matches ( final Object object ) { } } | if ( object instanceof Fact ) { return this . factTemplate . equals ( ( ( Fact ) object ) . getFactTemplate ( ) ) ; } else { return false ; } |
public class CmsHttpAuthenticationSettings { /** * Returns the browser based authentication mechanism or < code > null < / code > if unused .
* @ return " BASIC " in case of browser based basic authentication , " FORM " in case of form based authentication or the alternative mechanism or < code > null < / code > if unused . */
public String getBrowserBasedAuthenticationMechanism ( ) { } } | if ( m_useBrowserBasedHttpAuthentication ) { return AUTHENTICATION_BASIC ; } else if ( m_browserBasedAuthenticationMechanism != null ) { return m_browserBasedAuthenticationMechanism ; } else if ( m_formBasedHttpAuthenticationUri != null ) { return AUTHENTICATION_FORM ; } else { return null ; } |
public class MultiplePermissionListenerThreadDecorator { /** * Decorates de permission listener execution with a given thread
* @ param report In detail report with all the permissions that has been denied and granted */
@ Override public void onPermissionsChecked ( final MultiplePermissionsReport report ) { } } | thread . execute ( new Runnable ( ) { @ Override public void run ( ) { listener . onPermissionsChecked ( report ) ; } } ) ; |
public class BenchmarkExecutor { /** * Method to invoke a reflective invokable method .
* @ param obj on which the execution takes place
* @ param relatedAnno related annotation for the execution
* @ param meth to be executed
* @ param args args for that method
* @ return { @ link PerfidixMethodInvocationException } if invocation fails , null otherwise . */
public static PerfidixMethodInvocationException invokeMethod ( final Object obj , final Class < ? extends Annotation > relatedAnno , final Method meth , final Object ... args ) { } } | try { meth . invoke ( obj , args ) ; return null ; } catch ( final IllegalArgumentException e ) { return new PerfidixMethodInvocationException ( e , meth , relatedAnno ) ; } catch ( final IllegalAccessException e ) { return new PerfidixMethodInvocationException ( e , meth , relatedAnno ) ; } catch ( final InvocationTargetException e ) { return new PerfidixMethodInvocationException ( e . getCause ( ) , meth , relatedAnno ) ; } |
public class HistoricTaskInstanceEntityImpl { /** * persistence / / / / / */
public Object getPersistentState ( ) { } } | Map < String , Object > persistentState = new HashMap < String , Object > ( ) ; persistentState . put ( "name" , name ) ; persistentState . put ( "owner" , owner ) ; persistentState . put ( "assignee" , assignee ) ; persistentState . put ( "endTime" , endTime ) ; persistentState . put ( "durationInMillis" , durationInMillis ) ; persistentState . put ( "description" , description ) ; persistentState . put ( "deleteReason" , deleteReason ) ; persistentState . put ( "taskDefinitionKey" , taskDefinitionKey ) ; persistentState . put ( "formKey" , formKey ) ; persistentState . put ( "priority" , priority ) ; persistentState . put ( "category" , category ) ; persistentState . put ( "processDefinitionId" , processDefinitionId ) ; if ( parentTaskId != null ) { persistentState . put ( "parentTaskId" , parentTaskId ) ; } if ( dueDate != null ) { persistentState . put ( "dueDate" , dueDate ) ; } if ( claimTime != null ) { persistentState . put ( "claimTime" , claimTime ) ; } return persistentState ; |
public class VehicleManager { /** * Register a listener to receive a callback when the selected VI is
* connected .
* @ param listener The listener that should receive the callback . */
public void addOnVehicleInterfaceConnectedListener ( ViConnectionListener listener ) throws VehicleServiceException { } } | if ( mRemoteService != null ) { try { mRemoteService . addViConnectionListener ( listener ) ; } catch ( RemoteException e ) { throw new VehicleServiceException ( "Unable to add connection status listener" , e ) ; } } |
public class VersionFromManifest { /** * Init with a given filename . This is usually called from ServletContextListener with
* sce . getServletContext ( ) . getRealPath ( " / META - INF / MANIFEST . MF " )
* @ param filename
* to read the Manifest file from */
public void initFromFile ( final String filename ) { } } | try ( final InputStream is = new FileInputStream ( filename ) ) { init ( is ) ; } catch ( IOException e ) { initBackToDefaults ( ) ; } |
public class ConcatVector { /** * Sets a single component of the concat vector value as a sparse , one hot value .
* @ param component the index of the component to set
* @ param index the index of the vector to one - hot
* @ param value the value of that index */
public void setSparseComponent ( int component , int index , double value ) { } } | if ( component >= pointers . length ) { increaseSizeTo ( component + 1 ) ; } double [ ] sparseInfo = new double [ 2 ] ; sparseInfo [ 0 ] = index ; sparseInfo [ 1 ] = value ; pointers [ component ] = sparseInfo ; sparse [ component ] = true ; copyOnWrite [ component ] = false ; |
public class Type { /** * If this Type supports array lookup , then return all of the methods
* that can be called to access the array . If there are no methods , then
* an empty array is returned . Null is returned only if this Type
* doesn ' t support array lookup . */
public Method [ ] getArrayAccessMethods ( ) throws IntrospectionException { } } | if ( ! mCheckedForArrayLookup ) { checkForArrayLookup ( ) ; } return mArrayAccessMethods == null ? null : ( Method [ ] ) mArrayAccessMethods . clone ( ) ; |
public class Service { /** * Add a { @ link Runnable } ( NOT the JVM ' s < i > shutdown hook < / i > ) into the queue
* which will be run when the service is stopping .
* @ deprecated use { @ link # register ( AutoCloseable ) } instead */
@ Deprecated public void addShutdownHook ( final Runnable runnable ) { } } | closeables . offer ( new AutoCloseable ( ) { @ Override public void close ( ) { runnable . run ( ) ; } } ) ; |
public class CreateEndpointConfigRequest { /** * An array of < code > ProductionVariant < / code > objects , one for each model that you want to host at this endpoint .
* @ param productionVariants
* An array of < code > ProductionVariant < / code > objects , one for each model that you want to host at this
* endpoint . */
public void setProductionVariants ( java . util . Collection < ProductionVariant > productionVariants ) { } } | if ( productionVariants == null ) { this . productionVariants = null ; return ; } this . productionVariants = new java . util . ArrayList < ProductionVariant > ( productionVariants ) ; |
public class EventSubscriptionJobDeclaration { /** * Assumes that an activity has at most one declaration of a certain eventType . */
public static EventSubscriptionJobDeclaration findDeclarationForSubscription ( EventSubscriptionEntity eventSubscription ) { } } | List < EventSubscriptionJobDeclaration > declarations = getDeclarationsForActivity ( eventSubscription . getActivity ( ) ) ; for ( EventSubscriptionJobDeclaration declaration : declarations ) { if ( declaration . getEventType ( ) . equals ( eventSubscription . getEventType ( ) ) ) { return declaration ; } } return null ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.