signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AcceptVpcPeeringConnectionRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < AcceptVpcPeeringConnectionRequest > getDryRunRequest ( ) { } } | Request < AcceptVpcPeeringConnectionRequest > request = new AcceptVpcPeeringConnectionRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class Gauge { /** * Defines if custom ticklabels should be used instead of the
* automatically calculated ones . This could be useful for gauges
* like a compass where you need " N " , " E " , " S " and " W " instead of
* numbers .
* @ param ENABLED */
public void setCustomTickLabelsEnabled ( final boolean ENABLED ) { } } | if ( null == customTickLabelsEnabled ) { _customTickLabelsEnabled = ENABLED ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { customTickLabelsEnabled . set ( ENABLED ) ; } |
public class ExecutionList { /** * Submits the given runnable to the given { @ link Executor } catching and logging all { @ linkplain
* RuntimeException runtime exceptions } thrown by the executor . */
private static void executeListener ( Runnable runnable , Executor executor ) { } } | try { executor . execute ( runnable ) ; } catch ( RuntimeException e ) { // Log it and keep going - - bad runnable and / or executor . Don ' t punish the other runnables if
// we ' re given a bad one . We only catch RuntimeException because we want Errors to propagate
// up .
log . fatal ( "RuntimeException while executing runnable " + runnable + " with executor " + executor , e ) ; } |
public class Base64 { /** * Decodes data from Base64 notation .
* @ param s the string to decode
* @ return the decoded data
* @ throws NullPointerException if < code > s < / code > is null */
public static byte [ ] decode ( String s ) { } } | if ( s == null ) { throw new NullPointerException ( "Input string was null." ) ; } byte [ ] bytes = s . getBytes ( UTF_8 ) ; return decode ( bytes , 0 , bytes . length ) ; |
public class GroupCombineChainedDriver { @ Override public void close ( ) { } } | try { sortAndReduce ( ) ; } catch ( Exception e ) { throw new ExceptionInChainedStubException ( this . taskName , e ) ; } this . outputCollector . close ( ) ; |
public class TokenKeyEndpoint { /** * Get the verification key for the token signatures wrapped into keys array .
* Wrapping done for compatibility with some clients expecting this even for single key , like mod _ auth _ openidc .
* The principal has to be provided only if the key is secret
* ( shared not public ) .
* @ param principal the currently authenticated user if there is one
* @ return the key used to verify tokens , wrapped in keys array */
public VerificationKeysListResponse getKeys ( Principal principal ) { } } | boolean includeSymmetric = includeSymmetricalKeys ( principal ) ; Map < String , KeyInfo > keys = keyInfoService . getKeys ( ) ; List < VerificationKeyResponse > keyResponses = keys . values ( ) . stream ( ) . filter ( k -> includeSymmetric || RSA . name ( ) . equals ( k . type ( ) ) ) . map ( TokenKeyEndpoint :: getVerificationKeyResponse ) . collect ( Collectors . toList ( ) ) ; return new VerificationKeysListResponse ( keyResponses ) ; |
public class DefaultEntityResolve { /** * 处理 KeySql 注解
* @ param entityTable
* @ param entityColumn
* @ param keySql */
protected void processKeySql ( EntityTable entityTable , EntityColumn entityColumn , KeySql keySql ) { } } | if ( keySql . useGeneratedKeys ( ) ) { entityColumn . setIdentity ( true ) ; entityColumn . setGenerator ( "JDBC" ) ; entityTable . setKeyProperties ( entityColumn . getProperty ( ) ) ; entityTable . setKeyColumns ( entityColumn . getColumn ( ) ) ; } else if ( keySql . dialect ( ) == IdentityDialect . DEFAULT ) { entityColumn . setIdentity ( true ) ; entityColumn . setOrder ( ORDER . AFTER ) ; } else if ( keySql . dialect ( ) != IdentityDialect . NULL ) { // 自动增长
entityColumn . setIdentity ( true ) ; entityColumn . setOrder ( ORDER . AFTER ) ; entityColumn . setGenerator ( keySql . dialect ( ) . getIdentityRetrievalStatement ( ) ) ; } else if ( StringUtil . isNotEmpty ( keySql . sql ( ) ) ) { entityColumn . setIdentity ( true ) ; entityColumn . setOrder ( keySql . order ( ) ) ; entityColumn . setGenerator ( keySql . sql ( ) ) ; } else if ( keySql . genSql ( ) != GenSql . NULL . class ) { entityColumn . setIdentity ( true ) ; entityColumn . setOrder ( keySql . order ( ) ) ; try { GenSql genSql = keySql . genSql ( ) . newInstance ( ) ; entityColumn . setGenerator ( genSql . genSql ( entityTable , entityColumn ) ) ; } catch ( Exception e ) { log . error ( "实例化 GenSql 失败: " + e , e ) ; throw new MapperException ( "实例化 GenSql 失败: " + e , e ) ; } } else if ( keySql . genId ( ) != GenId . NULL . class ) { entityColumn . setIdentity ( false ) ; entityColumn . setGenIdClass ( keySql . genId ( ) ) ; } else { throw new MapperException ( entityTable . getEntityClass ( ) . getCanonicalName ( ) + " 类中的 @KeySql 注解配置无效!" ) ; } |
public class UpdateSwaggerJson { /** * Creates a JSon object from a serialization result .
* @ param serialization the serialization result
* @ param className a class or type name
* @ param newDef the new definition object to update */
public static void convertToTypes ( String serialization , String className , JsonObject newDef ) { } } | JsonParser jsonParser = new JsonParser ( ) ; JsonElement jsonTree = jsonParser . parse ( serialization ) ; // Creating the swagger definition
JsonObject innerObject = new JsonObject ( ) ; // Start adding basic properties
innerObject . addProperty ( "title" , className ) ; innerObject . addProperty ( "definition" , "" ) ; innerObject . addProperty ( "type" , jsonTree . isJsonObject ( ) ? "object" : jsonTree . isJsonArray ( ) ? "array" : "string" ) ; // Prevent errors with classic Swagger UI
innerObject . addProperty ( "properties" , "" ) ; // Inner properties
innerObject . add ( "example" , jsonTree . getAsJsonObject ( ) ) ; // Update our global definition
newDef . add ( "json_" + className , innerObject ) ; |
public class ConnectionValues { /** * Find the enumerated object that matchs the input name using the given
* offset and length into that name . If none exist , then a null value is
* returned .
* @ param name
* @ param offset
* - starting point in that name
* @ param length
* - length to use from that offset
* @ return ConnectionValues */
public static ConnectionValues match ( byte [ ] name , int offset , int length ) { } } | if ( null == name ) return null ; return ( ConnectionValues ) myMatcher . match ( name , offset , length ) ; |
public class CmsSitesWebserverThread { /** * Updates LetsEncrypt configuration . */
private void updateLetsEncrypt ( ) { } } | getReport ( ) . println ( Messages . get ( ) . container ( Messages . RPT_STARTING_LETSENCRYPT_UPDATE_0 ) ) ; CmsLetsEncryptConfiguration config = OpenCms . getLetsEncryptConfig ( ) ; if ( ( config == null ) || ! config . isValidAndEnabled ( ) ) { return ; } CmsSiteConfigToLetsEncryptConfigConverter converter = new CmsSiteConfigToLetsEncryptConfigConverter ( config ) ; boolean ok = converter . run ( getReport ( ) , OpenCms . getSiteManager ( ) ) ; if ( ok ) { getReport ( ) . println ( org . opencms . ui . apps . Messages . get ( ) . container ( org . opencms . ui . apps . Messages . RPT_LETSENCRYPT_FINISHED_0 ) , I_CmsReport . FORMAT_OK ) ; } |
public class TunnelResource { /** * Intercepts and returns the entire contents of a specific stream .
* @ param streamIndex
* The index of the stream to intercept .
* @ param mediaType
* The media type ( mimetype ) of the data within the stream .
* @ param filename
* The filename to use for the sake of identifying the data returned .
* @ return
* A response through which the entire contents of the intercepted
* stream will be sent .
* @ throws GuacamoleException
* If the session associated with the given auth token cannot be
* retrieved , or if no such tunnel exists . */
@ Path ( "streams/{index}/{filename}" ) public StreamResource getStream ( @ PathParam ( "index" ) final int streamIndex , @ QueryParam ( "type" ) @ DefaultValue ( DEFAULT_MEDIA_TYPE ) String mediaType , @ PathParam ( "filename" ) String filename ) throws GuacamoleException { } } | return new StreamResource ( tunnel , streamIndex , mediaType ) ; |
public class JournalConsumer { /** * Reject API calls from outside while we are in recovery mode . */
public String ingest ( Context context , InputStream serialization , String logMessage , String format , String encoding , String pid ) throws ServerException { } } | throw rejectCallsFromOutsideWhileInRecoveryMode ( ) ; |
public class CommerceOrderLocalServiceUtil { /** * Returns the commerce order matching the UUID and group .
* @ param uuid the commerce order ' s UUID
* @ param groupId the primary key of the group
* @ return the matching commerce order , or < code > null < / code > if a matching commerce order could not be found */
public static com . liferay . commerce . model . CommerceOrder fetchCommerceOrderByUuidAndGroupId ( String uuid , long groupId ) { } } | return getService ( ) . fetchCommerceOrderByUuidAndGroupId ( uuid , groupId ) ; |
public class TaskInProgress { /** * Save diagnostic information for a given task .
* @ param taskId id of the task
* @ param diagInfo diagnostic information for the task */
public void addDiagnosticInfo ( TaskAttemptID taskId , String diagInfo ) { } } | List < String > diagHistory = taskDiagnosticData . get ( taskId ) ; if ( diagHistory == null ) { diagHistory = new ArrayList < String > ( ) ; taskDiagnosticData . put ( taskId , diagHistory ) ; } diagHistory . add ( diagInfo ) ; |
public class FontFilter { /** * { @ inheritDoc }
* < p > The { @ link FontFilter } does not use any cleaningParameters passed in . < / p > */
@ Override public void filter ( Document document , Map < String , String > cleaningParameters ) { } } | List < Element > fontTags = filterDescendants ( document . getDocumentElement ( ) , new String [ ] { TAG_FONT } ) ; for ( Element fontTag : fontTags ) { Element span = document . createElement ( TAG_SPAN ) ; moveChildren ( fontTag , span ) ; StringBuffer buffer = new StringBuffer ( ) ; if ( fontTag . hasAttribute ( ATTRIBUTE_FONTCOLOR ) ) { buffer . append ( String . format ( "color:%s;" , fontTag . getAttribute ( ATTRIBUTE_FONTCOLOR ) ) ) ; } if ( fontTag . hasAttribute ( ATTRIBUTE_FONTFACE ) ) { buffer . append ( String . format ( "font-family:%s;" , fontTag . getAttribute ( ATTRIBUTE_FONTFACE ) ) ) ; } if ( fontTag . hasAttribute ( ATTRIBUTE_FONTSIZE ) ) { String fontSize = fontTag . getAttribute ( ATTRIBUTE_FONTSIZE ) ; String fontSizeCss = FONT_SIZE_MAP . get ( fontSize ) ; fontSizeCss = ( fontSizeCss != null ) ? fontSizeCss : fontSize ; buffer . append ( String . format ( "font-size:%s;" , fontSizeCss ) ) ; } if ( fontTag . hasAttribute ( ATTRIBUTE_STYLE ) && fontTag . getAttribute ( ATTRIBUTE_STYLE ) . trim ( ) . length ( ) == 0 ) { buffer . append ( fontTag . getAttribute ( ATTRIBUTE_STYLE ) ) ; } if ( buffer . length ( ) > 0 ) { span . setAttribute ( ATTRIBUTE_STYLE , buffer . toString ( ) ) ; } fontTag . getParentNode ( ) . insertBefore ( span , fontTag ) ; fontTag . getParentNode ( ) . removeChild ( fontTag ) ; } |
public class DescribeNetworkInterfacePermissionsRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < DescribeNetworkInterfacePermissionsRequest > getDryRunRequest ( ) { } } | Request < DescribeNetworkInterfacePermissionsRequest > request = new DescribeNetworkInterfacePermissionsRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class CompoundPainter { /** * Set a transform to be applied to all painters contained in this CompoundPainter
* @ param transform a new AffineTransform */
public void setTransform ( AffineTransform transform ) { } } | AffineTransform old = getTransform ( ) ; this . transform = transform ; setDirty ( true ) ; firePropertyChange ( "transform" , old , transform ) ; |
public class JawrScssStylesheet { /** * ( non - Javadoc )
* @ see com . vaadin . sass . internal . ScssStylesheet # resolveStylesheet ( java . lang .
* String , com . vaadin . sass . internal . ScssStylesheet ) */
@ Override public InputSource resolveStylesheet ( String identifier , ScssStylesheet parentStylesheet ) { } } | return resolver . resolve ( parentStylesheet , identifier ) ; |
public class ClassNodeResolver { /** * Search for classes using ASM decompiler */
private LookupResult findDecompiled ( String name , CompilationUnit compilationUnit , GroovyClassLoader loader ) { } } | ClassNode node = ClassHelper . make ( name ) ; if ( node . isResolved ( ) ) { return new LookupResult ( null , node ) ; } DecompiledClassNode asmClass = null ; String fileName = name . replace ( '.' , '/' ) + ".class" ; URL resource = loader . getResource ( fileName ) ; if ( resource != null ) { try { asmClass = new DecompiledClassNode ( AsmDecompiler . parseClass ( resource ) , new AsmReferenceResolver ( this , compilationUnit ) ) ; if ( ! asmClass . getName ( ) . equals ( name ) ) { // this may happen under Windows because getResource is case insensitive under that OS !
asmClass = null ; } } catch ( IOException e ) { // fall through and attempt other search strategies
} } if ( asmClass != null ) { if ( isFromAnotherClassLoader ( loader , fileName ) ) { return tryAsScript ( name , compilationUnit , asmClass ) ; } return new LookupResult ( null , asmClass ) ; } return null ; |
public class ReactionManipulator { /** * < p > Converts a reaction to an ' inlined ' reaction stored as a molecule . All
* reactants , agents , products are added to the molecule as disconnected
* components with atoms flagged as to their role { @ link ReactionRole } and
* component group . < / p >
* The inlined reaction , stored in a molecule can be converted back to an explicit
* reaction with { @ link # toReaction } . Data stored on the individual components ( e . g .
* titles is lost in the conversion ) .
* @ param rxn reaction to convert
* @ return inlined reaction stored in a molecule
* @ see # toReaction */
public static IAtomContainer toMolecule ( IReaction rxn ) { } } | if ( rxn == null ) throw new IllegalArgumentException ( "Null reaction provided" ) ; final IChemObjectBuilder bldr = rxn . getBuilder ( ) ; final IAtomContainer mol = bldr . newInstance ( IAtomContainer . class ) ; mol . setProperties ( rxn . getProperties ( ) ) ; mol . setID ( rxn . getID ( ) ) ; int grpId = 0 ; for ( IAtomContainer comp : rxn . getReactants ( ) . atomContainers ( ) ) { assignRoleAndGrp ( comp , ReactionRole . Reactant , ++ grpId ) ; mol . add ( comp ) ; } for ( IAtomContainer comp : rxn . getAgents ( ) . atomContainers ( ) ) { assignRoleAndGrp ( comp , ReactionRole . Agent , ++ grpId ) ; mol . add ( comp ) ; } for ( IAtomContainer comp : rxn . getProducts ( ) . atomContainers ( ) ) { assignRoleAndGrp ( comp , ReactionRole . Product , ++ grpId ) ; mol . add ( comp ) ; } return mol ; |
public class TileTOCRGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . TILE_TOCRG__XOFFSET : return XOFFSET_EDEFAULT == null ? xoffset != null : ! XOFFSET_EDEFAULT . equals ( xoffset ) ; case AfplibPackage . TILE_TOCRG__YOFFSET : return YOFFSET_EDEFAULT == null ? yoffset != null : ! YOFFSET_EDEFAULT . equals ( yoffset ) ; case AfplibPackage . TILE_TOCRG__THSIZE : return THSIZE_EDEFAULT == null ? thsize != null : ! THSIZE_EDEFAULT . equals ( thsize ) ; case AfplibPackage . TILE_TOCRG__TVSIZE : return TVSIZE_EDEFAULT == null ? tvsize != null : ! TVSIZE_EDEFAULT . equals ( tvsize ) ; case AfplibPackage . TILE_TOCRG__RELRES : return RELRES_EDEFAULT == null ? relres != null : ! RELRES_EDEFAULT . equals ( relres ) ; case AfplibPackage . TILE_TOCRG__COMPR : return COMPR_EDEFAULT == null ? compr != null : ! COMPR_EDEFAULT . equals ( compr ) ; case AfplibPackage . TILE_TOCRG__DATAPOS : return DATAPOS_EDEFAULT == null ? datapos != null : ! DATAPOS_EDEFAULT . equals ( datapos ) ; } return super . eIsSet ( featureID ) ; |
public class HpelPlainFormatter { /** * Gets the file header information . Implementations of the HpelPlainFormatter class
* will have a non - XML - based header .
* @ return the formatter ' s header as a String */
@ Override public String [ ] getHeader ( ) { } } | ArrayList < String > result = new ArrayList < String > ( ) ; if ( customHeader . length > 0 ) { for ( CustomHeaderLine line : customHeader ) { String formattedLine = line . formatLine ( headerProps ) ; if ( formattedLine != null ) { result . add ( formattedLine ) ; } } } else { for ( String prop : headerProps . stringPropertyNames ( ) ) { result . add ( prop + " = " + headerProps . getProperty ( prop ) ) ; } } return result . toArray ( new String [ result . size ( ) ] ) ; |
public class BMOImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setOvlyName ( String newOvlyName ) { } } | String oldOvlyName = ovlyName ; ovlyName = newOvlyName ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . BMO__OVLY_NAME , oldOvlyName , ovlyName ) ) ; |
public class Stream { /** * Creates a new Stream over the elements returned by the supplied Iterator .
* @ param iterator
* an Iterator returning non - null elements
* @ param < T >
* the type of elements
* @ return a Stream over the elements returned by the supplied Iterator */
public static < T > Stream < T > create ( final Iterator < ? extends T > iterator ) { } } | if ( iterator . hasNext ( ) ) { return new IteratorStream < T > ( iterator ) ; } else { return new EmptyStream < T > ( ) ; } |
public class PuiSpanRenderer { /** * private static final Logger LOGGER = Logger . getLogger ( " de . beyondjava . angularFaces . components . puiSpan . PuiSpanRenderer " ) ; */
@ Override public void encodeBegin ( FacesContext context , UIComponent component ) throws IOException { } } | ResponseWriter writer = context . getResponseWriter ( ) ; writer . startElement ( "span" , component ) ; String keys = ( String ) component . getAttributes ( ) . get ( "attributeNames" ) ; if ( null != keys ) { String [ ] keyArray = keys . split ( "," ) ; for ( String key : keyArray ) { writer . writeAttribute ( key , AttributeUtilities . getAttributeAsString ( component , key ) , key ) ; } } |
public class ScriptHandler { /** * < pre >
* Path to the script from the application root directory .
* < / pre >
* < code > string script _ path = 1 ; < / code > */
public com . google . protobuf . ByteString getScriptPathBytes ( ) { } } | java . lang . Object ref = scriptPath_ ; if ( ref instanceof java . lang . String ) { com . google . protobuf . ByteString b = com . google . protobuf . ByteString . copyFromUtf8 ( ( java . lang . String ) ref ) ; scriptPath_ = b ; return b ; } else { return ( com . google . protobuf . ByteString ) ref ; } |
public class Utils { /** * / * @ pure @ */
public static boolean report ( String name , boolean res , Object ... params ) { } } | if ( res ) { return true ; } StringBuilder sb = new StringBuilder ( ) ; sb . append ( name ) ; sb . append ( '(' ) ; if ( params . length > 1 ) { String del = ", " ; String eq = " = " ; sb . append ( params [ 0 ] ) ; sb . append ( eq ) ; sb . append ( Utils . toString ( params [ 1 ] ) ) ; for ( int i = 2 ; i < params . length ; i = i + 2 ) { sb . append ( del ) ; sb . append ( params [ i ] ) ; sb . append ( eq ) ; sb . append ( Utils . toString ( params [ i + 1 ] ) ) ; } } sb . append ( ')' ) ; sb . append ( " is " + res ) ; sb . append ( '\n' ) ; System . out . println ( sb . toString ( ) ) ; AssertionError error = new AssertionError ( ) ; error . printStackTrace ( System . out ) ; throw error ; |
public class Neo4JClient { /** * ( non - Javadoc )
* @ see com . impetus . kundera . client . Client # findAll ( java . lang . Class ,
* java . lang . String [ ] , java . lang . Object [ ] ) */
@ Override public < E > List < E > findAll ( Class < E > entityClass , String [ ] columnsToSelect , Object ... keys ) { } } | List entities = new ArrayList < E > ( ) ; for ( Object key : keys ) { entities . add ( find ( entityClass , key ) ) ; } return entities ; |
public class DatabaseSpec { /** * Connect to cluster .
* @ param clusterType DB type ( Cassandra | Mongo | Elasticsearch )
* @ param url url where is started Cassandra cluster */
@ Given ( "^I( securely)? connect to '(Cassandra|Mongo|Elasticsearch)' cluster at '(.+)'$" ) public void connect ( String secured , String clusterType , String url ) throws DBException , UnknownHostException { } } | switch ( clusterType ) { case "Cassandra" : commonspec . getCassandraClient ( ) . setHost ( url ) ; commonspec . getCassandraClient ( ) . connect ( secured ) ; break ; case "Mongo" : commonspec . getMongoDBClient ( ) . connect ( ) ; break ; case "Elasticsearch" : LinkedHashMap < String , Object > settings_map = new LinkedHashMap < String , Object > ( ) ; settings_map . put ( "cluster.name" , System . getProperty ( "ES_CLUSTER" , ES_DEFAULT_CLUSTER_NAME ) ) ; commonspec . getElasticSearchClient ( ) . setSettings ( settings_map ) ; commonspec . getElasticSearchClient ( ) . connect ( ) ; break ; default : throw new DBException ( "Unknown cluster type" ) ; } |
public class route { /** * Use this API to delete route . */
public static base_response delete ( nitro_service client , route resource ) throws Exception { } } | route deleteresource = new route ( ) ; deleteresource . network = resource . network ; deleteresource . netmask = resource . netmask ; deleteresource . gateway = resource . gateway ; deleteresource . td = resource . td ; return deleteresource . delete_resource ( client ) ; |
public class FSDirectory { /** * Return the byte array representing the given inode ' s full path name
* @ param inode an inode
* @ return the byte array representation of the full path of the inode
* @ throws IOException if the inode is invalid */
static byte [ ] [ ] getINodeByteArray ( INode inode ) throws IOException { } } | // calculate the depth of this inode from root
int depth = getPathDepth ( inode ) ; byte [ ] [ ] names = new byte [ depth ] [ ] ; // fill up the inodes in the path from this inode to root
for ( int i = 0 ; i < depth ; i ++ ) { names [ depth - i - 1 ] = inode . getLocalNameBytes ( ) ; inode = inode . parent ; } return names ; |
public class HttpMessage { /** * Get Attribute names .
* @ return Enumeration of Strings */
public Enumeration getAttributeNames ( ) { } } | if ( _attributes == null ) return Collections . enumeration ( Collections . EMPTY_LIST ) ; return Collections . enumeration ( _attributes . keySet ( ) ) ; |
public class KeystoreManager { /** * Make sure that the provided keystore will be reusable .
* @ param server the server the keystore is intended for
* @ param keystore a keystore containing your private key and the certificate signed by Apple ( File , InputStream , byte [ ] , KeyStore or String for a file path )
* @ return a reusable keystore
* @ throws KeystoreException */
static Object ensureReusableKeystore ( AppleServer server , Object keystore ) throws KeystoreException { } } | if ( keystore instanceof InputStream ) keystore = loadKeystore ( server , keystore , false ) ; return keystore ; |
public class AmazonEC2Client { /** * Describes the specified conversion tasks or all your conversion tasks . For more information , see the < a
* href = " https : / / docs . aws . amazon . com / vm - import / latest / userguide / " > VM Import / Export User Guide < / a > .
* For information about the import manifest referenced by this API action , see < a
* href = " https : / / docs . aws . amazon . com / AWSEC2 / latest / APIReference / manifest . html " > VM Import Manifest < / a > .
* @ param describeConversionTasksRequest
* Contains the parameters for DescribeConversionTasks .
* @ return Result of the DescribeConversionTasks operation returned by the service .
* @ sample AmazonEC2 . DescribeConversionTasks
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / DescribeConversionTasks " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public DescribeConversionTasksResult describeConversionTasks ( DescribeConversionTasksRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeConversionTasks ( request ) ; |
public class N { /** * Returns a new array with removes all the occurrences of specified elements from < code > a < / code >
* @ param a
* @ param elements
* @ return
* @ see Collection # removeAll ( Collection ) */
@ SafeVarargs public static long [ ] removeAll ( final long [ ] a , final long ... elements ) { } } | if ( N . isNullOrEmpty ( a ) ) { return N . EMPTY_LONG_ARRAY ; } else if ( N . isNullOrEmpty ( elements ) ) { return a . clone ( ) ; } else if ( elements . length == 1 ) { return removeAllOccurrences ( a , elements [ 0 ] ) ; } final LongList list = LongList . of ( a . clone ( ) ) ; list . removeAll ( LongList . of ( elements ) ) ; return list . trimToSize ( ) . array ( ) ; |
public class LibertyTracePreprocessInstrumentation { /** * Find the described field in the list of { @ code FieldNode } s .
* @ param desc the field type descriptor
* @ param fields the list of fields
* @ return the fields the match the provided descriptor */
private List < FieldNode > getFieldsByDesc ( String desc , List < FieldNode > fields ) { } } | List < FieldNode > result = new ArrayList < FieldNode > ( ) ; for ( FieldNode fn : fields ) { if ( desc . equals ( fn . desc ) ) { result . add ( fn ) ; } } return result ; |
public class IonReaderTextRawTokensX { /** * peeks into the input stream to see if the next token
* would be a double colon . If indeed this is the case
* it skips the two colons and returns true . If not
* it unreads the 1 or 2 real characters it read and
* return false .
* It always consumes any preceding whitespace .
* @ return true if the next token is a double colon , false otherwise
* @ throws IOException */
public final boolean skipDoubleColon ( ) throws IOException { } } | int c = skip_over_whitespace ( ) ; if ( c != ':' ) { unread_char ( c ) ; return false ; } c = read_char ( ) ; if ( c != ':' ) { unread_char ( c ) ; unread_char ( ':' ) ; return false ; } return true ; |
public class SibRaMessagingEngineConnection { /** * Closes this connection and any associated listeners and dispatchers . */
void close ( boolean alreadyClosed ) { } } | final String methodName = "close" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , alreadyClosed ) ; } _closed = true ; /* * 238811:
* Stop all of the listeners - do not close them as the dispatchers
* might still be using them . Close them after the dispatchers have
* stopped . */
/* * We close dispatchers as soon as they are finished with so no longer have to
* close them here . */
if ( ! alreadyClosed ) { for ( final Iterator iterator = _listeners . values ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { final SibRaListener listener = ( SibRaListener ) iterator . next ( ) ; listener . stop ( ) ; } } // The connection is closing so throw away the connection name
SibRaDispatcher . resetMEName ( ) ; // We want this thread to wait until all the dispatchers have finished their work
// ( which will happen when the dispatcherCount hits 0 . We put the thread into a
// wait state if there are any dispatchers still going , the thread will be notified
// each time a dispatcher closes ( when it has finished its work ) .
synchronized ( _dispatcherCount ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( this , TRACE , "There are still " + _dispatcherCount . get ( ) + " open dispatchers" ) ; } if ( _dispatcherCount . get ( ) > 0 ) { Long mdbQuiescingTimeout = getMDBQuiescingTimeoutProperty ( ) ; waitForDispatchersToFinish ( mdbQuiescingTimeout ) ; } } /* * Close all of the listeners */
if ( ! alreadyClosed ) { for ( final Iterator iterator = _listeners . values ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { final SibRaListener listener = ( SibRaListener ) iterator . next ( ) ; listener . close ( ) ; } } _listeners . clear ( ) ; /* * Close the connection */
try { _connection . removeConnectionListener ( _connectionListener ) ; // It should be ok to call close on an already closed connection but comms
// FFDCs thjis ( processor seems ok with it though ) . No need to close the connection
// again anyway so we ' ll check and if we are being called as part of MeTerminated or
// connectionError then the connection will have been closed so dont close again .
if ( ! alreadyClosed ) { _connection . close ( ) ; } } catch ( final SIException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , "1:1023:1.59" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } } catch ( final SIErrorException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , "1:1031:1.59" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } |
public class HikariPool { /** * Log the current pool state at debug level .
* @ param prefix an optional prefix to prepend the log message */
void logPoolState ( String ... prefix ) { } } | if ( logger . isDebugEnabled ( ) ) { logger . debug ( "{} - {}stats (total={}, active={}, idle={}, waiting={})" , poolName , ( prefix . length > 0 ? prefix [ 0 ] : "" ) , getTotalConnections ( ) , getActiveConnections ( ) , getIdleConnections ( ) , getThreadsAwaitingConnection ( ) ) ; } |
public class DynamoDBMapper { /** * Returns a new map object that merges the two sets of expected value
* conditions ( user - specified or imposed by the internal implementation of
* DynamoDBMapper ) . Internal assertion on an attribute will be overridden by
* any user - specified condition on the same attribute .
* Exception is thrown if the two sets of conditions cannot be combined
* together . */
private static Map < String , ExpectedAttributeValue > mergeExpectedAttributeValueConditions ( Map < String , ExpectedAttributeValue > internalAssertions , Map < String , ExpectedAttributeValue > userProvidedConditions , String userProvidedConditionOperator ) { } } | // If any of the condition map is null , simply return a copy of the other one .
if ( ( internalAssertions == null || internalAssertions . isEmpty ( ) ) && ( userProvidedConditions == null || userProvidedConditions . isEmpty ( ) ) ) { return null ; } else if ( internalAssertions == null ) { return new HashMap < String , ExpectedAttributeValue > ( userProvidedConditions ) ; } else if ( userProvidedConditions == null ) { return new HashMap < String , ExpectedAttributeValue > ( internalAssertions ) ; } // Start from a copy of the internal conditions
Map < String , ExpectedAttributeValue > mergedExpectedValues = new HashMap < String , ExpectedAttributeValue > ( internalAssertions ) ; // Remove internal conditions that are going to be overlaid by user - provided ones .
for ( String attrName : userProvidedConditions . keySet ( ) ) { mergedExpectedValues . remove ( attrName ) ; } // All the generated internal conditions must be joined by AND .
// Throw an exception if the user specifies an OR operator , and that the
// internal conditions are not totally overlaid by the user - provided
// ones .
if ( ConditionalOperator . OR . toString ( ) . equals ( userProvidedConditionOperator ) && ! mergedExpectedValues . isEmpty ( ) ) { throw new IllegalArgumentException ( "Unable to assert the value of the fields " + mergedExpectedValues . keySet ( ) + ", since the expected value conditions cannot be combined " + "with user-specified conditions joined by \"OR\". You can use SaveBehavior.CLOBBER to " + "skip the assertion on these fields." ) ; } mergedExpectedValues . putAll ( userProvidedConditions ) ; return mergedExpectedValues ; |
public class ServiceManagerSparql { /** * Given the URI of a modelReference , this method figures out all the services
* that have this as model references .
* This method uses SPARQL 1.1 to avoid using regexs for performance .
* @ param modelReference the type of output sought for
* @ return a Set of URIs of operations that generate this output type . */
@ Override public Set < URI > listServicesWithModelReference ( URI modelReference ) { } } | if ( modelReference == null ) { return ImmutableSet . of ( ) ; } StringBuilder queryBuilder = new StringBuilder ( ) ; queryBuilder . append ( "PREFIX msm: <" ) . append ( MSM . getURI ( ) ) . append ( "> " ) . append ( "PREFIX rdf: <" ) . append ( RDF . getURI ( ) ) . append ( "> " ) . append ( "PREFIX sawsdl: <" ) . append ( SAWSDL . getURI ( ) ) . append ( "> " ) . append ( "SELECT ?service WHERE { ?service rdf:type msm:Service . ?service sawsdl:modelReference <" ) . append ( modelReference ) . append ( "> . }" ) ; String query = queryBuilder . toString ( ) ; return this . graphStoreManager . listResourcesByQuery ( query , "service" ) ; |
public class ImageMath { /** * Bilinear interpolation of ARGB values .
* @ param x the X interpolation parameter 0 . . 1
* @ param y the y interpolation parameter 0 . . 1
* @ param rgb array of four ARGB values in the order NW , NE , SW , SE
* @ return the interpolated value */
public static int bilinearInterpolate ( float x , float y , int nw , int ne , int sw , int se ) { } } | float m0 , m1 ; int a0 = ( nw >> 24 ) & 0xff ; int r0 = ( nw >> 16 ) & 0xff ; int g0 = ( nw >> 8 ) & 0xff ; int b0 = nw & 0xff ; int a1 = ( ne >> 24 ) & 0xff ; int r1 = ( ne >> 16 ) & 0xff ; int g1 = ( ne >> 8 ) & 0xff ; int b1 = ne & 0xff ; int a2 = ( sw >> 24 ) & 0xff ; int r2 = ( sw >> 16 ) & 0xff ; int g2 = ( sw >> 8 ) & 0xff ; int b2 = sw & 0xff ; int a3 = ( se >> 24 ) & 0xff ; int r3 = ( se >> 16 ) & 0xff ; int g3 = ( se >> 8 ) & 0xff ; int b3 = se & 0xff ; float cx = 1.0f - x ; float cy = 1.0f - y ; m0 = cx * a0 + x * a1 ; m1 = cx * a2 + x * a3 ; int a = ( int ) ( cy * m0 + y * m1 ) ; m0 = cx * r0 + x * r1 ; m1 = cx * r2 + x * r3 ; int r = ( int ) ( cy * m0 + y * m1 ) ; m0 = cx * g0 + x * g1 ; m1 = cx * g2 + x * g3 ; int g = ( int ) ( cy * m0 + y * m1 ) ; m0 = cx * b0 + x * b1 ; m1 = cx * b2 + x * b3 ; int b = ( int ) ( cy * m0 + y * m1 ) ; return ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | b ; |
public class BS { /** * Returns a < a href =
* " http : / / docs . aws . amazon . com / amazondynamodb / latest / developerguide / Expressions . SpecifyingConditions . html # ConditionExpressionReference . Comparators "
* > comparator condition < / a > ( that evaluates to true if the value of the
* current attribute is equal to the set of specified values ) for building condition
* expression . */
public ComparatorCondition eq ( ByteBuffer ... values ) { } } | return new ComparatorCondition ( "=" , this , new LiteralOperand ( new LinkedHashSet < ByteBuffer > ( Arrays . asList ( values ) ) ) ) ; |
public class TaskManagementFunctionResponseParser { /** * { @ inheritDoc } */
@ Override protected final void checkIntegrity ( ) throws InternetSCSIException { } } | String exceptionMessage ; do { BasicHeaderSegment bhs = protocolDataUnit . getBasicHeaderSegment ( ) ; if ( bhs . getTotalAHSLength ( ) != 0 ) { exceptionMessage = "TotalAHSLength must be 0!" ; break ; } if ( bhs . getDataSegmentLength ( ) != 0 ) { exceptionMessage = "DataSegmentLength must be 0!" ; break ; } Utils . isReserved ( logicalUnitNumber ) ; // message is checked correctly
return ; } while ( false ) ; throw new InternetSCSIException ( exceptionMessage ) ; |
public class MatrixFeatures_DSCC { /** * Checks to see if the matrix is positive definite .
* x < sup > T < / sup > A x & gt ; 0 < br >
* for all x where x is a non - zero vector and A is a symmetric matrix .
* @ param A square symmetric matrix . Not modified .
* @ return True if it is positive definite and false if it is not . */
public static boolean isPositiveDefinite ( DMatrixSparseCSC A ) { } } | if ( A . numRows != A . numCols ) return false ; CholeskySparseDecomposition < DMatrixSparseCSC > chol = new CholeskyUpLooking_DSCC ( ) ; return chol . decompose ( A ) ; |
public class ReferenceObjectCache { /** * Run through all maps and remove any references that have been null ' d out by the GC . */
public < T > void cleanNullReferencesAll ( ) { } } | for ( Map < Object , Reference < Object > > objectMap : classMaps . values ( ) ) { cleanMap ( objectMap ) ; } |
public class Utils { /** * Executes command , and waits for the expected phrase in console printout .
* @ param command command line
* @ return console output as a list of strings
* @ throws IOException for command error
* @ throws InterruptedException when interrupted */
public static List < String > cmd ( String command ) throws IOException , InterruptedException { } } | return cmd ( command . split ( " " ) ) ; |
public class ProcessControlHelper { /** * Run the relevant command for dumping the system
* @ param javaDumpActions the java dump actions to take place
* @ param systemDump whether this is a full dump ( true ) or just javadump ( false )
* @ param dumpTimestamp the timestamp on the server dump packager of the full dump
* @ return the return code from attempting to run the dump */
private ReturnCode createDumps ( Set < JavaDumpAction > javaDumpActions , boolean introspect , String dumpTimestamp ) { } } | ServerLock serverLock = ServerLock . createTestLock ( bootProps ) ; ReturnCode dumpRc = ReturnCode . OK ; // The lock file may have been ( erroneously ) deleted : this can happen on linux
boolean lockExists = serverLock . lockFileExists ( ) ; if ( lockExists ) { if ( serverLock . testServerRunning ( ) ) { // server is running
ServerCommandClient scc = new ServerCommandClient ( bootProps ) ; if ( scc . isValid ( ) ) { // check . sCommand exist
if ( introspect ) { dumpRc = scc . introspectServer ( dumpTimestamp , javaDumpActions ) ; } else { dumpRc = scc . javaDump ( javaDumpActions ) ; } } else { // we have a server holding a lock that we can ' t talk to . . .
// the dump is likely fine . . but we don ' t know / can ' t tell
dumpRc = ReturnCode . SERVER_UNKNOWN_STATUS ; } } else { // nope : lock not held , we ' re not running
dumpRc = ReturnCode . SERVER_INACTIVE_STATUS ; } } else { // no lock file : we assume the server is not running .
dumpRc = ReturnCode . SERVER_INACTIVE_STATUS ; } return dumpRc ; |
public class JvmAnnotationTargetImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public NotificationChain eInverseRemove ( InternalEObject otherEnd , int featureID , NotificationChain msgs ) { } } | switch ( featureID ) { case TypesPackage . JVM_ANNOTATION_TARGET__ANNOTATIONS : return ( ( InternalEList < ? > ) getAnnotations ( ) ) . basicRemove ( otherEnd , msgs ) ; } return super . eInverseRemove ( otherEnd , featureID , msgs ) ; |
public class ExpressionBuilder { /** * Appends a not equals test to the condition .
* @ param trigger the trigger field .
* @ param compare the value to use in the compare .
* @ return this ExpressionBuilder . */
public ExpressionBuilder notEquals ( final SubordinateTrigger trigger , final Object compare ) { } } | BooleanExpression exp = new CompareExpression ( CompareType . NOT_EQUAL , trigger , compare ) ; appendExpression ( exp ) ; return this ; |
public class WriterUtf8 { /** * Writes a short string . */
private int writeShort ( String value , int offset , int end ) throws IOException { } } | int ch ; OutputStreamWithBuffer os = _os ; byte [ ] buffer = os . buffer ( ) ; int bOffset = os . offset ( ) ; end = Math . min ( end , offset + buffer . length - bOffset ) ; for ( ; offset < end && ( ch = value . charAt ( offset ) ) < 0x80 ; offset ++ ) { buffer [ bOffset ++ ] = ( byte ) ch ; } os . offset ( bOffset ) ; return offset ; |
public class EventhubDataWriter { /** * Send an encoded string to the Eventhub using post method */
private int request ( String encoded ) throws IOException { } } | refreshSignature ( ) ; HttpPost httpPost = new HttpPost ( targetURI ) ; httpPost . setHeader ( "Content-type" , "application/vnd.microsoft.servicebus.json" ) ; httpPost . setHeader ( "Authorization" , signature ) ; httpPost . setHeader ( "Host" , namespaceName + ".servicebus.windows.net " ) ; StringEntity entity = new StringEntity ( encoded ) ; httpPost . setEntity ( entity ) ; HttpResponse response = httpclient . execute ( httpPost ) ; StatusLine status = response . getStatusLine ( ) ; HttpEntity entity2 = response . getEntity ( ) ; // do something useful with the response body
// and ensure it is fully consumed
EntityUtils . consume ( entity2 ) ; int returnCode = status . getStatusCode ( ) ; if ( returnCode != HttpStatus . SC_CREATED ) { LOG . error ( new IOException ( status . getReasonPhrase ( ) ) . toString ( ) ) ; throw new IOException ( status . getReasonPhrase ( ) ) ; } return returnCode ; |
public class FilePath { /** * Executes some program on the machine that this { @ link FilePath } exists ,
* so that one can perform local file operations . */
public < T > T act ( final FileCallable < T > callable ) throws IOException , InterruptedException { } } | return act ( callable , callable . getClass ( ) . getClassLoader ( ) ) ; |
public class FileSystemLocationScanner { /** * Finds all the resource names contained in this file system folder .
* @ param classPathRootOnDisk The location of the classpath root on disk , with a trailing slash .
* @ param scanRootLocation The root location of the scan on the classpath , without leading or trailing slashes .
* @ param folder The folder to look for resources under on disk .
* @ return The resource names ; */
private Set < String > findResourceNamesFromFileSystem ( String classPathRootOnDisk , String scanRootLocation , File folder ) { } } | LOGGER . debug ( "Scanning for resources in path: {} ({})" , folder . getPath ( ) , scanRootLocation ) ; File [ ] files = folder . listFiles ( ) ; if ( files == null ) { return emptySet ( ) ; } Set < String > resourceNames = new TreeSet < > ( ) ; for ( File file : files ) { if ( file . canRead ( ) ) { if ( file . isDirectory ( ) ) { resourceNames . addAll ( findResourceNamesFromFileSystem ( classPathRootOnDisk , scanRootLocation , file ) ) ; } else { resourceNames . add ( toResourceNameOnClasspath ( classPathRootOnDisk , file ) ) ; } } } return resourceNames ; |
public class AnalyticsQuery { /** * Creates an { @ link AnalyticsQuery } with named parameters as part of the query .
* @ param statement the statement to send .
* @ param namedParams the named parameters which will be put in for the placeholders .
* @ return a { @ link AnalyticsQuery } . */
public static ParameterizedAnalyticsQuery parameterized ( final String statement , final JsonObject namedParams ) { } } | return new ParameterizedAnalyticsQuery ( statement , null , namedParams , null ) ; |
public class RepositoryFileApi { /** * Get file from repository . Allows you to receive information about file in repository like name , size , and optionally content .
* Note that file content is Base64 encoded .
* < pre > < code > GitLab Endpoint : GET / projects / : id / repository / files < / code > < / pre >
* @ param projectIdOrPath the id , path of the project , or a Project instance holding the project ID or path
* @ param filePath ( required ) - Full path to the file . Ex . lib / class . rb
* @ param ref ( required ) - The name of branch , tag or commit
* @ param includeContent if true will also fetch file content
* @ return a RepositoryFile instance with the file info and optionally file content
* @ throws GitLabApiException if any exception occurs */
public RepositoryFile getFile ( Object projectIdOrPath , String filePath , String ref , boolean includeContent ) throws GitLabApiException { } } | if ( ! includeContent ) { return ( getFileInfo ( projectIdOrPath , filePath , ref ) ) ; } Form form = new Form ( ) ; addFormParam ( form , "ref" , ref , true ) ; Response response = get ( Response . Status . OK , form . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "files" , urlEncode ( filePath ) ) ; return ( response . readEntity ( RepositoryFile . class ) ) ; |
public class ResultUtil { /** * 如果对象有ESId注解标识的字段 , 则注入parent和
* @ param data */
private static void injectAnnotationESId ( ClassUtil . PropertieDescription injectAnnotationESId , Object data , BaseSearchHit hit ) { } } | if ( data == null ) return ; Object id = hit . getId ( ) ; // ClassUtil . PropertieDescription propertieDescription = classInfo . getEsIdProperty ( ) ;
_injectAnnotationES ( injectAnnotationESId , data , hit , id ) ; |
public class EndianAwareDataInputStream { /** * end readFloat ( ) */
@ Override public void readFully ( byte [ ] b ) throws IOException { } } | in . readFully ( b ) ; readTally += b . length ; |
public class LongBitSet { /** * this = this AND other */
void and ( LongBitSet other ) { } } | int pos = Math . min ( numWords , other . numWords ) ; while ( -- pos >= 0 ) { bits [ pos ] &= other . bits [ pos ] ; } if ( numWords > other . numWords ) { Arrays . fill ( bits , other . numWords , numWords , 0L ) ; } |
public class WrappingSecurityTokenServiceClaimsHandler { /** * Create processed claim processed claim .
* @ param requestClaim the request claim
* @ param parameters the parameters
* @ return the processed claim */
protected ProcessedClaim createProcessedClaim ( final Claim requestClaim , final ClaimsParameters parameters ) { } } | val claim = new ProcessedClaim ( ) ; claim . setClaimType ( createProcessedClaimType ( requestClaim , parameters ) ) ; claim . setIssuer ( this . issuer ) ; claim . setOriginalIssuer ( this . issuer ) ; claim . setValues ( requestClaim . getValues ( ) ) ; return claim ; |
public class BasicRandomRoutingTable { /** * Add a group of TrustGraphNeighbors to the routing table .
* A maximum of one route is disrupted by this operation ,
* as many routes as possible are assigned within the group .
* Any previously mapped neighbors will be ignored .
* @ param neighbor the set of TrustGraphNieghbors to add
* @ see addNeighbor
* @ see RandomRoutingTable . addNeighbors ( Collection < TrustGraphNeighbor > ) */
@ Override public void addNeighbors ( final Collection < TrustGraphNodeId > neighborsIn ) { } } | if ( neighborsIn . isEmpty ( ) ) { return ; } // all modification operations are serialized
synchronized ( this ) { /* filter out any neighbors that are already in the routing table
* and the new ones to the newNeighbors list */
final LinkedList < TrustGraphNodeId > newNeighbors = new LinkedList < TrustGraphNodeId > ( ) ; for ( TrustGraphNodeId n : neighborsIn ) { if ( ! contains ( n ) ) { newNeighbors . add ( n ) ; } } // if there is nothing new , we ' re done .
if ( newNeighbors . size ( ) == 0 ) { return ; } // handle list of length 1 the same way as a single insertion
else if ( newNeighbors . size ( ) == 1 ) { addNeighbor ( newNeighbors . get ( 0 ) ) ; return ; } // otherwise there is more than one new neighbor to add .
/* if there are existing routes , a random route in the
* table will be split . It is picked prior to adding
* any of the new routes . */
Map . Entry < TrustGraphNodeId , TrustGraphNodeId > split = null ; if ( ! routingTable . isEmpty ( ) ) { // Pick a random existing route X - > Y to split
split = randomRoute ( ) ; } /* Create a random permutation of the list .
* Add in new neighbors from this permutation , routing
* i - > i + 1 . These routes do not disturb any existing
* routes and create no self references . */
Collections . shuffle ( newNeighbors , rng ) ; final Iterator < TrustGraphNodeId > i = newNeighbors . iterator ( ) ; TrustGraphNodeId key = i . next ( ) ; while ( i . hasNext ( ) ) { final TrustGraphNodeId val = i . next ( ) ; routingTable . put ( key , val ) ; key = val ; } /* if there was nothing in the routing table yet , the first
* item in the permutation is routed to the last . */
if ( split == null ) { // loop around , bind the last to the first
routingTable . put ( newNeighbors . getLast ( ) , newNeighbors . getFirst ( ) ) ; } /* Otherwise , split the route chosen beforehand . Map the
* key to the first node in the chain , and map the
* last node in the chain to the value . ie X - > Y becomes
* X - > first - > . . . . - > last - > Y . Similarly to the single
* neighbor add method above , this preserves the structure
* of the routing table forming some circular chain of
* nodes of length equal to the size of the table . */
else { TrustGraphNodeId splitKey = split . getKey ( ) ; TrustGraphNodeId splitVal = split . getValue ( ) ; /* * Add routes X - > first and last - > Y . The new route last - > Y is
* inserted first . This preserves the existing routing behavior
* for readers until the entire operation is complete . */
routingTable . put ( newNeighbors . getLast ( ) , splitVal ) ; routingTable . replace ( splitKey , newNeighbors . getFirst ( ) ) ; } /* add the new neighbors into the ordering */
addNeighborsToOrdering ( newNeighbors ) ; } |
public class CmsErrorBean { /** * Returns the localized Message , if the argument is a CmsException , or
* the message otherwise . < p >
* @ param t the Throwable to get the message from
* @ return returns the localized Message , if the argument is a CmsException , or
* the message otherwise */
public String getMessage ( Throwable t ) { } } | if ( ( t instanceof I_CmsThrowable ) && ( ( ( I_CmsThrowable ) t ) . getMessageContainer ( ) != null ) ) { StringBuffer result = new StringBuffer ( 256 ) ; if ( m_throwable instanceof CmsMultiException ) { CmsMultiException exc = ( CmsMultiException ) m_throwable ; String message = exc . getMessage ( m_locale ) ; if ( CmsStringUtil . isNotEmpty ( message ) ) { result . append ( message ) ; result . append ( '\n' ) ; } } I_CmsThrowable cmsThrowable = ( I_CmsThrowable ) t ; result . append ( cmsThrowable . getLocalizedMessage ( m_locale ) ) ; return result . toString ( ) ; } else { String message = t . getMessage ( ) ; if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( message ) ) { // no error message found ( e . g . for NPE ) , provide default message text
message = m_messages . key ( Messages . GUI_ERROR_UNKNOWN_0 ) ; } return message ; } |
public class RowLevelSecurityRepositoryDecorator { /** * Finds out what permission to check for an operation that is being performed on this repository .
* @ param operation the Operation that is being performed on the repository
* @ return the EntityPermission to check */
private EntityPermission getPermission ( Action operation ) { } } | EntityPermission result ; switch ( operation ) { case COUNT : case READ : result = EntityPermission . READ ; break ; case UPDATE : result = EntityPermission . UPDATE ; break ; case DELETE : result = EntityPermission . DELETE ; break ; case CREATE : throw new UnexpectedEnumException ( Action . CREATE ) ; default : throw new IllegalArgumentException ( "Illegal operation" ) ; } return result ; |
public class ModelsImpl { /** * Get one entity role for a given entity .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param entityId entity ID .
* @ param roleId entity role ID .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the EntityRole object */
public Observable < EntityRole > getRegexEntityRoleAsync ( UUID appId , String versionId , UUID entityId , UUID roleId ) { } } | return getRegexEntityRoleWithServiceResponseAsync ( appId , versionId , entityId , roleId ) . map ( new Func1 < ServiceResponse < EntityRole > , EntityRole > ( ) { @ Override public EntityRole call ( ServiceResponse < EntityRole > response ) { return response . body ( ) ; } } ) ; |
public class ProbeResponseResource { /** * Inbound JSON responses get processed here .
* @ param probeResponseJSON - the actual wireline response payload
* @ return some innocuous string */
@ POST @ Path ( "/probeResponse" ) @ Consumes ( "application/json" ) public String handleJSONProbeResponse ( String probeResponseJSON ) { } } | JSONSerializer serializer = new JSONSerializer ( ) ; ResponseWrapper response ; try { response = serializer . unmarshal ( probeResponseJSON ) ; } catch ( ResponseParseException e ) { String errorResponseString = "Incoming Response could not be parsed. Error message is: " + e . getMessage ( ) ; Console . error ( errorResponseString ) ; Console . error ( "Wireline message that could no be parsed is:" ) ; Console . error ( probeResponseJSON ) ; return errorResponseString ; } for ( ServiceWrapper service : response . getServices ( ) ) { service . setResponseID ( response . getResponseID ( ) ) ; service . setProbeID ( response . getProbeID ( ) ) ; cache . cache ( new ExpiringService ( service ) ) ; } String statusString = "Successfully cached " + response . getServices ( ) . size ( ) + " services" ; updateCacheListener ( statusString ) ; return statusString ; |
public class AmazonSimpleDBUtil { /** * Decodes byte [ ] value from the string representation created using encodeDate ( . . ) function .
* @ param value
* string representation of the date value
* @ return original byte [ ] value */
public static byte [ ] decodeByteArray ( String value ) throws ParseException { } } | try { return Base64 . decodeBase64 ( value . getBytes ( UTF8_ENCODING ) ) ; } catch ( UnsupportedEncodingException e ) { throw new MappingException ( "Could not decode byteArray to UTF8 encoding" , e ) ; } |
public class LoadBalancerDescription { /** * The listeners for the load balancer .
* @ param listenerDescriptions
* The listeners for the load balancer . */
public void setListenerDescriptions ( java . util . Collection < ListenerDescription > listenerDescriptions ) { } } | if ( listenerDescriptions == null ) { this . listenerDescriptions = null ; return ; } this . listenerDescriptions = new com . amazonaws . internal . SdkInternalList < ListenerDescription > ( listenerDescriptions ) ; |
public class TypeFactory { /** * { @ code literal ( new L < List < String > > ( ) { } ) = = List < String > } .
* Method mostly exists to remind about { @ link TypeLiteral } , which can be used directly like
* { @ code new TypeLiteral < List < String > > ( ) { } . getType ( ) } .
* @ param literal literal with type declaration
* @ param < T > actual type
* @ return type declared in literal */
public static < T > Type literal ( final L < T > literal ) { } } | if ( literal . getClass ( ) . equals ( L . class ) ) { throw new IllegalArgumentException ( "Incorrect usage: literal type must be an anonymous class: new L<Some>(){}" ) ; } return literal . getType ( ) ; |
public class FacebookLikeBox { /** * Background thread */
protected void processUrl ( final String url ) { } } | try { final Result result = mProcessor . processUrl ( url ) ; post ( new Runnable ( ) { @ Override public void run ( ) { if ( isAttachedToWindow ( ) ) { postProcessUrl ( url , result ) ; } } } ) ; } catch ( Throwable ex ) { if ( LOGGING ) { Log . wtf ( LOG_TAG , ex ) ; } } |
public class SoapUtils { /** * A method to extract the content of the SOAP body .
* @ param soapMessage
* the SOAP message .
* @ return the content of the body of the input SOAP message .
* @ author Simone Gianfranceschi */
public static Document getSoapBody ( Document soapMessage ) throws Exception { } } | Element envelope = soapMessage . getDocumentElement ( ) ; Element body = DomUtils . getChildElement ( DomUtils . getElementByTagName ( envelope , envelope . getPrefix ( ) + ":Body" ) ) ; Document content = DomUtils . createDocument ( body ) ; Element documentRoot = content . getDocumentElement ( ) ; addNSdeclarations ( envelope , documentRoot ) ; addNSdeclarations ( body , documentRoot ) ; return content ; |
public class GenericResponseBuilder { /** * Sets the response entity body on the builder .
* < p > A specific media type can be set using the { @ code type ( . . . ) } methods .
* @ param entity the response entity body
* @ param annotations annotations , in addition to the annotations on the resource method returning
* the response , to be passed to the { @ link MessageBodyWriter }
* @ return this builder
* @ see # type ( MediaType )
* @ see # type ( String ) */
public GenericResponseBuilder < T > entity ( T entity , Annotation [ ] annotations ) { } } | if ( hasErrorEntity ) { throw new IllegalStateException ( "errorEntity already set. Only one of entity and errorEntity may be set" ) ; } this . body = entity ; rawBuilder . entity ( entity , annotations ) ; return this ; |
public class StaticFilesConfiguration { /** * Attempt consuming using either static resource handlers or jar resource handlers
* @ param httpRequest The HTTP servlet request .
* @ param httpResponse The HTTP servlet response .
* @ return true if consumed , false otherwise .
* @ throws IOException in case of IO error . */
public boolean consume ( HttpServletRequest httpRequest , HttpServletResponse httpResponse ) throws IOException { } } | try { if ( consumeWithFileResourceHandlers ( httpRequest , httpResponse ) ) { return true ; } } catch ( DirectoryTraversal . DirectoryTraversalDetection directoryTraversalDetection ) { httpResponse . setStatus ( 400 ) ; httpResponse . getWriter ( ) . write ( "Bad request" ) ; httpResponse . getWriter ( ) . flush ( ) ; LOG . warn ( directoryTraversalDetection . getMessage ( ) + " directory traversal detection for path: " + httpRequest . getPathInfo ( ) ) ; } return false ; |
public class FixedCallbackHandler { /** * / * ( non - Javadoc )
* @ see javax . security . auth . callback . CallbackHandler # handle ( javax . security . auth . callback . Callback [ ] ) */
public void handle ( Callback [ ] callbacks ) throws UnsupportedCallbackException { } } | for ( Callback callback : callbacks ) { if ( callback instanceof NameCallback ) { ( ( NameCallback ) callback ) . setName ( name ) ; } else if ( callback instanceof PasswordCallback ) { ( ( PasswordCallback ) callback ) . setPassword ( password ) ; } else { throw new UnsupportedCallbackException ( callback ) ; } } |
public class JsAdminService { /** * Does the specified string contain characters valid in a JMX key property ?
* @ param s the string to be checked
* @ return boolean if true , indicates the string is valid , otherwise false */
public static boolean isValidJmxPropertyValue ( String s ) { } } | if ( ( s . indexOf ( ":" ) >= 0 ) || ( s . indexOf ( "*" ) >= 0 ) || ( s . indexOf ( '"' ) >= 0 ) || ( s . indexOf ( "?" ) >= 0 ) || ( s . indexOf ( "," ) >= 0 ) || ( s . indexOf ( "=" ) >= 0 ) ) { return false ; } else return true ; |
public class MapKeyLoader { /** * Triggers key and value loading if there is no ongoing or completed
* key loading task , otherwise does nothing .
* The actual loading is done on a separate thread .
* @ param mapStoreContext the map store context for this map
* @ param replaceExistingValues if the existing entries for the loaded keys should be replaced
* @ return a future representing pending completion of the key loading task */
public Future < ? > startLoading ( MapStoreContext mapStoreContext , boolean replaceExistingValues ) { } } | role . nextOrStay ( Role . SENDER ) ; if ( state . is ( State . LOADING ) ) { return keyLoadFinished ; } state . next ( State . LOADING ) ; return sendKeys ( mapStoreContext , replaceExistingValues ) ; |
public class CEMILDataEx { /** * Adds additional information to the message .
* It replaces additional information of the same type , if any was previously added .
* @ param infoType type ID of additional information
* @ param info additional information data */
public synchronized void addAdditionalInfo ( int infoType , byte [ ] info ) { } } | if ( infoType < 0 || infoType >= ADDINFO_ESC ) throw new KNXIllegalArgumentException ( "info type out of range [0..254]" ) ; if ( ! checkAddInfoLength ( infoType , info . length ) ) throw new KNXIllegalArgumentException ( "wrong info data length, expected " + ADDINFO_LENGTHS [ infoType ] + " bytes" ) ; putAddInfo ( infoType , info ) ; |
public class AvroParser { /** * The main method transforming Avro record into a row in H2O frame .
* @ param gr Avro generic record
* @ param columnNames Column names prepared by parser setup
* @ param inSchema Flattenized Avro schema which corresponds to passed column names
* @ param columnTypes Target H2O types
* @ param dout Parser writer */
private static void write2frame ( GenericRecord gr , String [ ] columnNames , Schema . Field [ ] inSchema , byte [ ] columnTypes , ParseWriter dout ) { } } | assert inSchema . length == columnTypes . length : "AVRO field flatenized schema has to match to parser setup" ; BufferedString bs = new BufferedString ( ) ; for ( int cIdx = 0 ; cIdx < columnNames . length ; cIdx ++ ) { int inputFieldIdx = inSchema [ cIdx ] . pos ( ) ; Schema . Type inputType = toPrimitiveType ( inSchema [ cIdx ] . schema ( ) ) ; byte targetType = columnTypes [ cIdx ] ; // FIXME : support target conversions
Object value = gr . get ( inputFieldIdx ) ; if ( value == null ) { dout . addInvalidCol ( cIdx ) ; } else { switch ( inputType ) { case BOOLEAN : dout . addNumCol ( cIdx , ( ( Boolean ) value ) ? 1 : 0 ) ; break ; case INT : dout . addNumCol ( cIdx , ( ( Integer ) value ) , 0 ) ; break ; case LONG : dout . addNumCol ( cIdx , ( ( Long ) value ) , 0 ) ; break ; case FLOAT : dout . addNumCol ( cIdx , ( Float ) value ) ; break ; case DOUBLE : dout . addNumCol ( cIdx , ( Double ) value ) ; break ; case ENUM : // Note : this code expects ordering of categoricals provided by Avro remain same
// as in H2O ! ! !
GenericData . EnumSymbol es = ( GenericData . EnumSymbol ) value ; dout . addNumCol ( cIdx , es . getSchema ( ) . getEnumOrdinal ( es . toString ( ) ) ) ; break ; case BYTES : dout . addStrCol ( cIdx , bs . set ( ( ( ByteBuffer ) value ) . array ( ) ) ) ; break ; case STRING : dout . addStrCol ( cIdx , bs . set ( ( ( Utf8 ) value ) . getBytes ( ) ) ) ; break ; case NULL : dout . addInvalidCol ( cIdx ) ; break ; } } } |
public class ConfigurationOption { /** * Constructs a { @ link ConfigurationOptionBuilder } whose value is of type { @ link Map } & lt ; { @ link Pattern } , { @ link
* String } & gt ;
* @ return a { @ link ConfigurationOptionBuilder } whose value is of type { @ link Map } & lt ; { @ link Pattern } , { @ link
* String } & gt ; */
public static ConfigurationOptionBuilder < Map < Pattern , String > > regexMapOption ( ) { } } | return new ConfigurationOptionBuilder < Map < Pattern , String > > ( MapValueConverter . REGEX_MAP_VALUE_CONVERTER , Map . class ) . defaultValue ( Collections . < Pattern , String > emptyMap ( ) ) ; |
public class RegexpParser { /** * Classifies the warning message : tries to guess a category from the
* warning message .
* @ param message
* the message to check
* @ return warning category , empty string if unknown */
protected String classifyWarning ( final String message ) { } } | if ( StringUtils . contains ( message , "proprietary" ) ) { return PROPRIETARY_API ; } if ( StringUtils . contains ( message , "deprecated" ) ) { return DEPRECATION ; } return StringUtils . EMPTY ; |
public class ConstantPool { /** * Get or create a constant from the constant pool representing a method
* in any class . If the method returns void , set ret to null . */
public ConstantMethodInfo addConstantMethod ( String className , String methodName , TypeDesc ret , TypeDesc [ ] params ) { } } | MethodDesc md = MethodDesc . forArguments ( ret , params ) ; return ConstantMethodInfo . make ( this , ConstantClassInfo . make ( this , className ) , ConstantNameAndTypeInfo . make ( this , methodName , md ) ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getIfcTimeSeriesDataTypeEnum ( ) { } } | if ( ifcTimeSeriesDataTypeEnumEEnum == null ) { ifcTimeSeriesDataTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 916 ) ; } return ifcTimeSeriesDataTypeEnumEEnum ; |
public class JmsBytesMessageImpl { /** * Write a Java object to the stream message .
* < P > Note that this method only works for the objectified primitive
* object types ( Integer , Double , Long . . . ) , String ' s and byte arrays .
* @ param value the Java object to be written .
* @ exception MessageNotWriteableException if message in read - only mode .
* @ exception MessageFormatException if object is invalid type .
* @ exception JMSException if JMS fails to write message due to
* some internal JMS error . */
@ Override public void writeObject ( Object value ) throws JMSException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "writeObject" ) ; // Check if the producer has promised not to modify the payload after it ' s been set
checkProducerPromise ( "writeObject(Object)" , "JmsBytesMessageImpl.writeObject#1" ) ; // Check that we are in write mode ( doing this test here ensures
// any error message refers to the correct method )
checkBodyWriteable ( "writeObject" ) ; if ( value instanceof byte [ ] ) writeBytes ( ( byte [ ] ) value ) ; else if ( value instanceof String ) writeUTF ( ( String ) value ) ; else if ( value instanceof Integer ) writeInt ( ( ( Integer ) value ) . intValue ( ) ) ; else if ( value instanceof Byte ) writeByte ( ( ( Byte ) value ) . byteValue ( ) ) ; else if ( value instanceof Short ) writeShort ( ( ( Short ) value ) . shortValue ( ) ) ; else if ( value instanceof Long ) writeLong ( ( ( Long ) value ) . longValue ( ) ) ; else if ( value instanceof Float ) writeFloat ( ( ( Float ) value ) . floatValue ( ) ) ; else if ( value instanceof Double ) writeDouble ( ( ( Double ) value ) . doubleValue ( ) ) ; else if ( value instanceof Character ) writeChar ( ( ( Character ) value ) . charValue ( ) ) ; else if ( value instanceof Boolean ) writeBoolean ( ( ( Boolean ) value ) . booleanValue ( ) ) ; else if ( value == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "given null, throwing NPE" ) ; throw new NullPointerException ( ) ; } else { // d238447 FFDC review . Passing in an object of the wrong type is an app error ,
// so no FFDC needed here .
throw ( JMSException ) JmsErrorUtils . newThrowable ( MessageFormatException . class , "BAD_OBJECT_CWSIA0185" , new Object [ ] { value . getClass ( ) . getName ( ) } , tc ) ; } // Invalidate the cached toString object .
cachedBytesToString = null ; // Ensure that the new data gets exported when the time comes .
bodySetInJsMsg = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writeObject" ) ; |
public class SimpleDateFormat { /** * Returns the default date and time pattern ( SHORT ) for the default locale .
* This method is only used by the default SimpleDateFormat constructor . */
private static synchronized String getDefaultPattern ( ) { } } | ULocale defaultLocale = ULocale . getDefault ( Category . FORMAT ) ; if ( ! defaultLocale . equals ( cachedDefaultLocale ) ) { cachedDefaultLocale = defaultLocale ; Calendar cal = Calendar . getInstance ( cachedDefaultLocale ) ; try { // Load the calendar data directly .
ICUResourceBundle rb = ( ICUResourceBundle ) UResourceBundle . getBundleInstance ( ICUData . ICU_BASE_NAME , cachedDefaultLocale ) ; String resourcePath = "calendar/" + cal . getType ( ) + "/DateTimePatterns" ; ICUResourceBundle patternsRb = rb . findWithFallback ( resourcePath ) ; if ( patternsRb == null ) { patternsRb = rb . findWithFallback ( "calendar/gregorian/DateTimePatterns" ) ; } if ( patternsRb == null || patternsRb . getSize ( ) < 9 ) { cachedDefaultPattern = FALLBACKPATTERN ; } else { int defaultIndex = 8 ; if ( patternsRb . getSize ( ) >= 13 ) { defaultIndex += ( SHORT + 1 ) ; } String basePattern = patternsRb . getString ( defaultIndex ) ; cachedDefaultPattern = SimpleFormatterImpl . formatRawPattern ( basePattern , 2 , 2 , patternsRb . getString ( SHORT ) , patternsRb . getString ( SHORT + 4 ) ) ; } } catch ( MissingResourceException e ) { cachedDefaultPattern = FALLBACKPATTERN ; } } return cachedDefaultPattern ; |
public class ISUPMessageFactoryImpl { /** * ( non - Javadoc )
* @ see org . restcomm . protocols . ss7 . isup . ISUPMessageFactory # createUBA ( int cic ) */
public UnblockingAckMessage createUBA ( ) { } } | UnblockingAckMessage msg = new UnblockingAckMessageImpl ( _UBA_HOLDER . mandatoryCodes , _UBA_HOLDER . mandatoryVariableCodes , _UBA_HOLDER . optionalCodes , _UBA_HOLDER . mandatoryCodeToIndex , _UBA_HOLDER . mandatoryVariableCodeToIndex , _UBA_HOLDER . optionalCodeToIndex ) ; return msg ; |
public class DataSynchronizer { /** * Resolves a conflict between a synchronized document ' s local and remote state . The resolution
* will result in either the document being desynchronized or being replaced with some resolved
* state based on the conflict resolver specified for the document . Uses the last uncommitted
* local event as the local state .
* @ param nsConfig the namespace synchronization config of the namespace where the document
* lives .
* @ param docConfig the configuration of the document that describes the resolver and current
* state .
* @ param remoteEvent the remote change event that is conflicting . */
@ CheckReturnValue private LocalSyncWriteModelContainer resolveConflict ( final NamespaceSynchronizationConfig nsConfig , final CoreDocumentSynchronizationConfig docConfig , final ChangeEvent < BsonDocument > remoteEvent ) { } } | return resolveConflict ( nsConfig , docConfig , docConfig . getLastUncommittedChangeEvent ( ) , remoteEvent ) ; |
public class CompositeEnumeration { /** * Fluent method for chaining additions of subsequent enumerations . */
public CompositeEnumeration < T > add ( Enumeration < T > enumeration ) { } } | // optimise out empty enumerations up front
if ( enumeration . hasMoreElements ( ) ) enumerations . add ( enumeration ) ; return this ; |
public class ObjectInputStream { /** * Avoid recursive defining . */
private static void checkedSetSuperClassDesc ( ObjectStreamClass desc , ObjectStreamClass superDesc ) throws StreamCorruptedException { } } | if ( desc . equals ( superDesc ) ) { throw new StreamCorruptedException ( ) ; } desc . setSuperclass ( superDesc ) ; |
public class TrainingsImpl { /** * Get image with its prediction for a given project iteration .
* This API supports batching and range selection . By default it will only return first 50 images matching images .
* Use the { take } and { skip } parameters to control how many images to return in a given batch .
* The filtering is on an and / or relationship . For example , if the provided tag ids are for the " Dog " and
* " Cat " tags , then only images tagged with Dog and / or Cat will be returned .
* @ param projectId The project id
* @ param iterationId The iteration id . Defaults to workspace
* @ param getImagePerformancesOptionalParameter the object representing the optional parameters to be set before calling this API
* @ 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 List & lt ; ImagePerformance & gt ; object if successful . */
public List < ImagePerformance > getImagePerformances ( UUID projectId , UUID iterationId , GetImagePerformancesOptionalParameter getImagePerformancesOptionalParameter ) { } } | return getImagePerformancesWithServiceResponseAsync ( projectId , iterationId , getImagePerformancesOptionalParameter ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class SARLProposalProvider { /** * Complete for obtaining SARL behaviors if the proposals are enabled .
* @ param allowBehaviorType is < code > true < / code > for enabling the { @ link Behavior } type to be in the proposals .
* @ param isExtensionFilter indicates if the type filter is for " extends " or only based on visibility .
* @ param context the completion context .
* @ param acceptor the proposal acceptor .
* @ see # isSarlProposalEnabled ( ) */
protected void completeSarlBehaviors ( boolean allowBehaviorType , boolean isExtensionFilter , ContentAssistContext context , ICompletionProposalAcceptor acceptor ) { } } | if ( isSarlProposalEnabled ( ) ) { completeSubJavaTypes ( Behavior . class , allowBehaviorType , context , TypesPackage . Literals . JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE , getQualifiedNameValueConverter ( ) , isExtensionFilter ? createExtensionFilter ( context , IJavaSearchConstants . CLASS ) : createVisibilityFilter ( context , IJavaSearchConstants . CLASS ) , acceptor ) ; } |
public class WebSiteManagementClientImpl { /** * Gets list of available geo regions plus ministamps .
* Gets list of available geo regions plus ministamps .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the DeploymentLocationsInner object */
public Observable < ServiceResponse < DeploymentLocationsInner > > getSubscriptionDeploymentLocationsWithServiceResponseAsync ( ) { } } | if ( this . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.subscriptionId() is required and cannot be null." ) ; } if ( this . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.apiVersion() is required and cannot be null." ) ; } return service . getSubscriptionDeploymentLocations ( this . subscriptionId ( ) , this . apiVersion ( ) , this . acceptLanguage ( ) , this . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < DeploymentLocationsInner > > > ( ) { @ Override public Observable < ServiceResponse < DeploymentLocationsInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < DeploymentLocationsInner > clientResponse = getSubscriptionDeploymentLocationsDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class EurekaClinicalClient { /** * Extracts the id of the resource specified in the response body from a
* POST call .
* @ param uri The URI .
* @ return the id of the resource . */
protected Long extractId ( URI uri ) { } } | String uriStr = uri . toString ( ) ; return Long . valueOf ( uriStr . substring ( uriStr . lastIndexOf ( "/" ) + 1 ) ) ; |
public class VorbisFile { /** * returns zero on success , nonzero on failure */
public int pcm_seek ( long pos ) { } } | int link = - 1 ; long total = pcm_total ( - 1 ) ; if ( ! seekable ) return ( - 1 ) ; // don ' t dump machine if we can ' t seek
if ( pos < 0 || pos > total ) { // goto seek _ error ;
pcm_offset = - 1 ; decode_clear ( ) ; return - 1 ; } // which bitstream section does this pcm offset occur in ?
for ( link = links - 1 ; link >= 0 ; link -- ) { total -= pcmlengths [ link ] ; if ( pos >= total ) break ; } // search within the logical bitstream for the page with the highest
// pcm _ pos preceeding ( or equal to ) pos . There is a danger here ;
// missing pages or incorrect frame number information in the
// bitstream could make our task impossible . Account for that ( it
// would be an error condition )
{ long target = pos - total ; long end = offsets [ link + 1 ] ; long begin = offsets [ link ] ; int best = ( int ) begin ; Page og = new Page ( ) ; while ( begin < end ) { long bisect ; int ret ; if ( end - begin < CHUNKSIZE ) { bisect = begin ; } else { bisect = ( end + begin ) / 2 ; } seek_helper ( bisect ) ; ret = get_next_page ( og , end - bisect ) ; if ( ret == - 1 ) { end = bisect ; } else { long granulepos = og . granulepos ( ) ; if ( granulepos < target ) { best = ret ; // raw offset of packet with granulepos
begin = offset ; // raw offset of next packet
} else { end = bisect ; } } } // found our page . seek to it ( call raw _ seek ) .
if ( raw_seek ( best ) != 0 ) { // goto seek _ error ;
pcm_offset = - 1 ; decode_clear ( ) ; return - 1 ; } } // verify result
if ( pcm_offset >= pos ) { // goto seek _ error ;
pcm_offset = - 1 ; decode_clear ( ) ; return - 1 ; } if ( pos > pcm_total ( - 1 ) ) { // goto seek _ error ;
pcm_offset = - 1 ; decode_clear ( ) ; return - 1 ; } // discard samples until we reach the desired position . Crossing a
// logical bitstream boundary with abandon is OK .
while ( pcm_offset < pos ) { int target = ( int ) ( pos - pcm_offset ) ; float [ ] [ ] [ ] _pcm = new float [ 1 ] [ ] [ ] ; int [ ] _index = new int [ getInfo ( - 1 ) . channels ] ; int samples = vd . synthesis_pcmout ( _pcm , _index ) ; if ( samples > target ) samples = target ; vd . synthesis_read ( samples ) ; pcm_offset += samples ; if ( samples < target ) if ( process_packet ( 1 ) == 0 ) { pcm_offset = pcm_total ( - 1 ) ; // eof
} } return 0 ; // seek _ error :
// dump machine so we ' re in a known state
// pcm _ offset = - 1;
// decode _ clear ( ) ;
// return - 1; |
public class TypesafeConfigurator { /** * Retrieves the default cache settings from the configuration resource .
* @ param config the configuration resource
* @ param < K > the type of keys maintained the cache
* @ param < V > the type of cached values
* @ return the default configuration for a cache */
public static < K , V > CaffeineConfiguration < K , V > defaults ( Config config ) { } } | return new Configurator < K , V > ( config , "default" ) . configure ( ) ; |
public class BindDataSourceBuilder { /** * Generate on create .
* @ param schema
* the schema
* @ param orderedEntities
* the ordered entities
* @ return true , if successful */
private boolean generateOnCreate ( SQLiteDatabaseSchema schema , List < SQLiteEntity > orderedEntities ) { } } | boolean useForeignKey = false ; MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "onCreate" ) . addAnnotation ( Override . class ) . addModifiers ( Modifier . PUBLIC ) ; methodBuilder . addParameter ( SQLiteDatabase . class , "database" ) ; methodBuilder . addJavadoc ( "onCreate\n" ) ; methodBuilder . addCode ( "// generate tables\n" ) ; if ( schema . isLogEnabled ( ) ) { // generate log section - BEGIN
methodBuilder . addComment ( "log section create BEGIN" ) ; methodBuilder . beginControlFlow ( "if (this.logEnabled)" ) ; methodBuilder . beginControlFlow ( "if (options.inMemory)" ) ; methodBuilder . addStatement ( "$T.info(\"Create database in memory\")" , Logger . class ) ; methodBuilder . nextControlFlow ( "else" ) ; methodBuilder . addStatement ( "$T.info(\"Create database '%s' version %s\",this.name, this.version)" , Logger . class ) ; methodBuilder . endControlFlow ( ) ; // generate log section - END
methodBuilder . endControlFlow ( ) ; methodBuilder . addComment ( "log section create END" ) ; } for ( SQLiteEntity item : orderedEntities ) { if ( schema . isLogEnabled ( ) ) { // generate log section - BEGIN
methodBuilder . addComment ( "log section create BEGIN" ) ; methodBuilder . beginControlFlow ( "if (this.logEnabled)" ) ; methodBuilder . addStatement ( "$T.info(\"DDL: %s\",$T.CREATE_TABLE_SQL)" , Logger . class , BindTableGenerator . tableClassName ( null , item ) ) ; // generate log section - END
methodBuilder . endControlFlow ( ) ; methodBuilder . addComment ( "log section create END" ) ; } methodBuilder . addStatement ( "database.execSQL($T.CREATE_TABLE_SQL)" , BindTableGenerator . tableClassName ( null , item ) ) ; if ( item . referedEntities . size ( ) > 0 ) { useForeignKey = true ; } } // use generated entities too
// if we have generated entities , we use foreign key for sure
if ( schema . generatedEntities . size ( ) > 0 ) useForeignKey = true ; for ( GeneratedTypeElement item : schema . generatedEntities ) { if ( schema . isLogEnabled ( ) ) { // generate log section - BEGIN
methodBuilder . addComment ( "log section BEGIN" ) ; methodBuilder . beginControlFlow ( "if (this.logEnabled)" ) ; methodBuilder . addStatement ( "$T.info(\"DDL: %s\",$T.CREATE_TABLE_SQL)" , Logger . class , TypeUtility . className ( BindTableGenerator . getTableClassName ( item . getQualifiedName ( ) ) ) ) ; // generate log section - END
methodBuilder . endControlFlow ( ) ; methodBuilder . addComment ( "log section END" ) ; } methodBuilder . addStatement ( "database.execSQL($T.CREATE_TABLE_SQL)" , TypeUtility . className ( BindTableGenerator . getTableClassName ( item . getQualifiedName ( ) ) ) ) ; } methodBuilder . beginControlFlow ( "if (options.databaseLifecycleHandler != null)" ) ; methodBuilder . addStatement ( "options.databaseLifecycleHandler.onCreate(database)" ) ; methodBuilder . endControlFlow ( ) ; methodBuilder . addStatement ( "justCreated=true" ) ; classBuilder . addMethod ( methodBuilder . build ( ) ) ; return useForeignKey ; |
public class XNElement { /** * Add a new XElement with the given local name and no namespace .
* @ param name the name of the new element
* @ return the created XElement child */
public XNElement add ( String name ) { } } | XNElement e = new XNElement ( name ) ; e . parent = this ; children . add ( e ) ; return e ; |
public class SynchroReader { /** * Common mechanism to convert Synchro commentary recorss into notes .
* @ param rows commentary table rows
* @ return note text */
private String getNotes ( List < MapRow > rows ) { } } | String result = null ; if ( rows != null && ! rows . isEmpty ( ) ) { StringBuilder sb = new StringBuilder ( ) ; for ( MapRow row : rows ) { sb . append ( row . getString ( "TITLE" ) ) ; sb . append ( '\n' ) ; sb . append ( row . getString ( "TEXT" ) ) ; sb . append ( "\n\n" ) ; } result = sb . toString ( ) ; } return result ; |
public class Functions { /** * Get the result of dividend divided by divisor with given scale .
* Any numeric string recognized by { @ code BigDecimal } is supported .
* @ param dividend A valid number string
* @ param divisor A valid number strings
* @ param scale scale of the { @ code BigDecimal } quotient to be returned .
* @ return < code > dividend / divisor < / code >
* @ see BigDecimal */
public static String divide ( String dividend , String divisor , int scale ) { } } | BigDecimal bdDividend ; BigDecimal bdDivisor ; try { bdDividend = new BigDecimal ( dividend ) ; bdDivisor = new BigDecimal ( divisor ) ; return bdDividend . divide ( bdDivisor , scale , RoundingMode . HALF_UP ) . toString ( ) ; } catch ( Exception e ) { return null ; } |
public class WrappedCache { /** * Puts the entry into both the cache and backing map . The old value in
* the backing map is returned . */
public Object put ( Object key , Object value ) { } } | mCacheMap . put ( key , value ) ; return mBackingMap . put ( key , value ) ; |
public class BCCertificateParser { /** * get certificate info */
@ SuppressWarnings ( "unchecked" ) public List < CertificateMeta > parse ( ) throws CertificateException { } } | CMSSignedData cmsSignedData ; try { cmsSignedData = new CMSSignedData ( data ) ; } catch ( CMSException e ) { throw new CertificateException ( e ) ; } Store < X509CertificateHolder > certStore = cmsSignedData . getCertificates ( ) ; SignerInformationStore signerInfos = cmsSignedData . getSignerInfos ( ) ; Collection < SignerInformation > signers = signerInfos . getSigners ( ) ; List < X509Certificate > certificates = new ArrayList < > ( ) ; for ( SignerInformation signer : signers ) { Collection < X509CertificateHolder > matches = certStore . getMatches ( signer . getSID ( ) ) ; for ( X509CertificateHolder holder : matches ) { certificates . add ( new JcaX509CertificateConverter ( ) . setProvider ( provider ) . getCertificate ( holder ) ) ; } } return CertificateMetas . from ( certificates ) ; |
public class IoUtil { /** * Writes the specified { @ code message } to the specified { @ code sessions } .
* If the specified { @ code message } is an { @ link IoBuffer } , the buffer is
* automatically duplicated using { @ link IoBuffer # duplicate ( ) } . */
public static List < WriteFuture > broadcast ( Object message , Iterable < IoSession > sessions ) { } } | List < WriteFuture > answer = new ArrayList < > ( ) ; broadcast ( message , sessions . iterator ( ) , answer ) ; return answer ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.