signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AvatarShell { /** * main ( ) has some simple utility methods */
public static void main ( String argv [ ] ) throws Exception { } } | DnsMonitorSecurityManager . setTheManager ( ) ; AvatarShell shell = null ; try { shell = new AvatarShell ( ) ; } catch ( RPC . VersionMismatch v ) { System . err . println ( "Version Mismatch between client and server" + "... command aborted." ) ; System . exit ( - 1 ) ; } catch ( IOException e ) { System . err . print... |
public class EncodingUtilsImpl { /** * @ see com . ibm . websphere . http . EncodingUtils # getCharsetFromContentType ( java . lang . String ) */
@ Override public String getCharsetFromContentType ( String type ) { } } | if ( null != type ) { int index = type . indexOf ( ';' ) ; if ( - 1 != index ) { index = type . indexOf ( "charset=" , ( index + 1 ) ) ; if ( - 1 != index ) { String charset = type . substring ( index + 8 ) . trim ( ) ; int end = charset . length ( ) - 1 ; if ( - 1 == end ) { // empty value following charset =
return n... |
public class ConfigurationReader { /** * Parses the input parameter section .
* @ param node
* Reference to the current used xml node
* @ param config
* Reference to the ConfigSettings */
private void parseInputConfig ( final Node node , final ConfigSettings config ) { } } | String name , value ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ) ; if ( name . equals ( KEY_WIKIPEDIA_ENCODING ) ) { value = nnode . getChildNodes ( ) . i... |
public class Curve25519 { /** * / * Signature generation primitive , calculates ( x - h ) s mod q
* v [ out ] signature value
* h [ in ] signature hash ( of message , signature pub key , and context data )
* x [ in ] signature private key
* s [ in ] private key for signing
* returns true on success , false on... | /* v = ( x - h ) s mod q */
byte [ ] tmp1 = new byte [ 65 ] ; byte [ ] tmp2 = new byte [ 33 ] ; int w ; int i ; for ( i = 0 ; i < 32 ; i ++ ) v [ i ] = 0 ; i = mula_small ( v , x , 0 , h , 32 , - 1 ) ; mula_small ( v , v , 0 , ORDER , 32 , ( 15 - v [ 31 ] ) / 16 ) ; mula32 ( tmp1 , v , s , 32 , 1 ) ; divmod ( tmp2 , tm... |
public class PublicIPAddressesInner { /** * Get the specified public IP address in a virtual machine scale set .
* @ param resourceGroupName The name of the resource group .
* @ param virtualMachineScaleSetName The name of the virtual machine scale set .
* @ param virtualmachineIndex The virtual machine index .
... | return getVirtualMachineScaleSetPublicIPAddressWithServiceResponseAsync ( resourceGroupName , virtualMachineScaleSetName , virtualmachineIndex , networkInterfaceName , ipConfigurationName , publicIpAddressName , expand ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class OrmLiteConfigUtil { /** * Write a configuration file to an output stream with the configuration for classes . */
public static void writeConfigFile ( OutputStream outputStream , Class < ? > [ ] classes ) throws SQLException , IOException { } } | writeConfigFile ( outputStream , classes , false ) ; |
public class CHAlgoFactoryDecorator { /** * This method changes the number of threads used for preparation on import . Default is 1 . Make
* sure that you have enough memory when increasing this number ! */
public void setPreparationThreads ( int preparationThreads ) { } } | this . preparationThreads = preparationThreads ; this . threadPool = java . util . concurrent . Executors . newFixedThreadPool ( preparationThreads ) ; |
public class HttpSender { /** * Sets whether or not circular redirects are allowed .
* Circular redirects happen when a request redirects to itself , or when a same request was already accessed in a chain of
* redirects .
* Since 2.5.0 , the default is to allow circular redirects .
* @ param allow { @ code true... | client . getParams ( ) . setBooleanParameter ( HttpClientParams . ALLOW_CIRCULAR_REDIRECTS , allow ) ; clientViaProxy . getParams ( ) . setBooleanParameter ( HttpClientParams . ALLOW_CIRCULAR_REDIRECTS , allow ) ; |
public class MDict { /** * / * Public methods */
public boolean clear ( ) { } } | if ( ! isMutable ( ) ) { throw new IllegalStateException ( "Cannot clear a non-mutable MDict" ) ; } if ( valCount == 0 ) { return true ; } mutate ( ) ; valueMap . clear ( ) ; if ( flDict != null ) { final FLDictIterator itr = new FLDictIterator ( ) ; try { itr . begin ( flDict ) ; String key ; while ( ( key = itr . get... |
public class ImageUtils { /** * Calculate coordinates in an image , assuming the image has been scaled from ( oH x oW ) pixels to ( nH x nW ) pixels
* @ param x X position ( pixels ) to translate
* @ param y Y position ( pixels ) to translate
* @ param origImageW Original image width ( pixels )
* @ param origIm... | double newX = x * newImageW / origImageW ; double newY = y * newImageH / origImageH ; return new double [ ] { newX , newY } ; |
public class DateTimeFormatter { /** * Prints a ReadablePartial to a new String .
* Neither the override chronology nor the override zone are used
* by this method .
* @ param partial partial to format
* @ return the printed result */
public String print ( ReadablePartial partial ) { } } | StringBuilder buf = new StringBuilder ( requirePrinter ( ) . estimatePrintedLength ( ) ) ; try { printTo ( ( Appendable ) buf , partial ) ; } catch ( IOException ex ) { // StringBuilder does not throw IOException
} return buf . toString ( ) ; |
public class TransactionToDispatchableMap { /** * In the event that the connection is going down , we need to ensure that the dispatchable
* table is cleared of all references to transactions that were created by that connection .
* @ param clientId */
public void removeAllDispatchablesForTransaction ( int clientId... | if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "removeAllDispatchablesForTransaction" , clientId ) ; idToFirstLevelEntryMap . remove ( clientId ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "removeAllDispatchablesForTransaction" ) ; |
public class TableToReloadMarshaller { /** * Marshall the given parameter object . */
public void marshall ( TableToReload tableToReload , ProtocolMarshaller protocolMarshaller ) { } } | if ( tableToReload == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( tableToReload . getSchemaName ( ) , SCHEMANAME_BINDING ) ; protocolMarshaller . marshall ( tableToReload . getTableName ( ) , TABLENAME_BINDING ) ; } catch ( Exception e )... |
public class RuleCallImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public AbstractRule getRule ( ) { } } | if ( rule != null && rule . eIsProxy ( ) ) { InternalEObject oldRule = ( InternalEObject ) rule ; rule = ( AbstractRule ) eResolveProxy ( oldRule ) ; if ( rule != oldRule ) { if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . RESOLVE , XtextPackage . RULE_CALL__RULE , oldRule , rul... |
public class ConstantsSummaryBuilder { /** * Parse the package name . We only want to display package name up to
* 2 levels . */
private String parsePackageName ( String pkgname ) { } } | int index = - 1 ; for ( int j = 0 ; j < MAX_CONSTANT_VALUE_INDEX_LENGTH ; j ++ ) { index = pkgname . indexOf ( "." , index + 1 ) ; } if ( index != - 1 ) { pkgname = pkgname . substring ( 0 , index ) ; } return pkgname ; |
public class WaveformDetailComponent { /** * Figure out the starting waveform segment that corresponds to the specified coordinate in the window .
* @ param x the column being drawn
* @ return the offset into the waveform at the current scale and playback time that should be drawn there */
private int getSegmentFor... | if ( autoScroll . get ( ) ) { int playHead = ( x - ( getWidth ( ) / 2 ) ) ; int offset = Util . timeToHalfFrame ( getFurthestPlaybackPosition ( ) ) / scale . get ( ) ; return ( playHead + offset ) * scale . get ( ) ; } return x * scale . get ( ) ; |
public class Project { /** * Set Repositories
* @ param urls List
* @ throws ProjectException exception */
public void setRepositories ( List < String > urls ) throws ProjectException { } } | List < Repository > repositories = new ArrayList < Repository > ( ) ; for ( String url : urls ) { try { Repository repository = RepoBuilder . repositoryFromUrl ( url ) ; repositories . add ( repository ) ; } catch ( MalformedURLException e ) { throw new ProjectException ( e ) ; } } getMavenModel ( ) . setRepositories (... |
public class AkkaInvocationHandler { /** * Checks whether any of the annotations is of type { @ link RpcTimeout } .
* @ param annotations Array of annotations
* @ return True if { @ link RpcTimeout } was found ; otherwise false */
private static boolean isRpcTimeout ( Annotation [ ] annotations ) { } } | for ( Annotation annotation : annotations ) { if ( annotation . annotationType ( ) . equals ( RpcTimeout . class ) ) { return true ; } } return false ; |
public class MessageUtil { /** * Compose a message with String args . This is just a convenience so callers do not have to
* cast their String [ ] to an Object [ ] . */
public static String compose ( String key , String ... args ) { } } | return compose ( key , ( Object [ ] ) args ) ; |
public class FlakeView { /** * Add the specified number of droidflakes . */
void addFlakes ( int quantity ) { } } | for ( int i = 0 ; i < quantity ; ++ i ) { flakes . add ( Flake . createFlake ( getWidth ( ) , droid ) ) ; } setNumFlakes ( numFlakes + quantity ) ; |
public class LssClient { /** * List all your live security policys .
* @ return The list of all your live security policys */
public ListSecurityPoliciesResponse listSecurityPolicies ( ) { } } | ListSecurityPoliciesRequest request = new ListSecurityPoliciesRequest ( ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . GET , request , LIVE_SECURITY_POLICY ) ; return invokeHttpClient ( internalRequest , ListSecurityPoliciesResponse . class ) ; |
public class Engine { /** * Checks if all given variables are there and if so , that they evaluate to true inside an if . */
public boolean variablesAvailable ( Map < String , Object > model , String ... vars ) { } } | final TemplateContext context = new TemplateContext ( null , null , null , new ScopedMap ( model ) , modelAdaptor , this , new SilentErrorHandler ( ) , null ) ; for ( String var : vars ) { final IfToken token = new IfToken ( var , false ) ; if ( ! ( Boolean ) token . evaluate ( context ) ) { return false ; } } return t... |
public class JavaWriter { /** * Prints a string */
public void print ( String s ) throws IOException { } } | if ( _startLine ) printIndent ( ) ; if ( s == null ) { _lastCr = false ; _os . print ( "null" ) ; return ; } int len = s . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { int ch = s . charAt ( i ) ; if ( ch == '\n' && ! _lastCr ) _destLine ++ ; else if ( ch == '\r' ) _destLine ++ ; _lastCr = ch == '\r' ; _os . print ... |
public class NamedRootsMap { /** * Have to be performed after the " normal " objects be written
* to DB and before method { @ link # performInsert ( ) } . */
public void performDeletion ( ) { } } | if ( deletionMap == null ) return ; else { PersistenceBroker broker = tx . getBroker ( ) ; Iterator it = deletionMap . values ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { NamedEntry namedEntry = ( NamedEntry ) it . next ( ) ; broker . delete ( namedEntry ) ; } } |
public class ConcurrentSoftCache { /** * { @ inheritDoc } */
@ Override public Object convertValue ( SoftReference < V > value ) { } } | if ( null == value ) { return null ; } return value . get ( ) ; |
public class VorbisFile { /** * additional data to offer since last call ( or at beginning of stream ) */
public int bitrate_instant ( ) { } } | int _link = ( seekable ? current_link : 0 ) ; if ( samptrack == 0 ) return ( - 1 ) ; int ret = ( int ) ( bittrack / samptrack * vi [ _link ] . rate + .5 ) ; bittrack = 0.f ; samptrack = 0.f ; return ( ret ) ; |
public class HsqlDbms { /** * Return a quick datasource for the given hsqldatabase . */
DataSource getFastDataSource ( HsqlDatabaseDescriptor hsqlDatabase ) { } } | BasicDataSource bds = new BasicDataSource ( ) ; bds . setDriverClassName ( hsqlDatabase . getDriverClassName ( ) ) ; bds . setUsername ( hsqlDatabase . getUsername ( ) ) ; bds . setPassword ( hsqlDatabase . getPassword ( ) ) ; bds . setUrl ( hsqlDatabase . getUrl ( ) ) ; return bds ; |
public class HttpClientResponseBuilder { /** * Adds action which returns provided response in UTF - 8 with status code .
* @ param statusCode status to return
* @ param response response to return
* @ return response builder */
public HttpClientResponseBuilder doReturn ( int statusCode , String response ) { } } | return doReturn ( statusCode , response , Charset . forName ( "UTF-8" ) ) ; |
public class ByteUtils { /** * Converts a short into a byte array .
* @ param s
* a short
* @ param bo
* a ByteOrder
* @ return byte array */
public static byte [ ] toByteArray ( short s , ByteOrder bo ) { } } | return ByteBuffer . allocate ( 2 ) . order ( bo ) . putShort ( s ) . array ( ) ; |
public class DexterInstance { /** * Method called whenever the inner activity has been created or restarted and is ready to be
* used . */
void onActivityReady ( Activity activity ) { } } | this . activity = activity ; PermissionStates permissionStates = null ; synchronized ( pendingPermissionsMutex ) { if ( activity != null ) { permissionStates = getPermissionStates ( pendingPermissions ) ; } } if ( permissionStates != null ) { handleDeniedPermissions ( permissionStates . getDeniedPermissions ( ) ) ; upd... |
public class ComputerVisionImpl { /** * This operation generates a description of an image in human readable language with complete sentences . The description is based on a collection of content tags , which are also returned by the operation . More than one description can be generated for each image . Descriptions a... | if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( url == null ) { throw new IllegalArgumentException ( "Parameter url is required and cannot be null." ) ; } ImageUrl imageUrl = new ImageUrl ( ) ; imageUrl . wi... |
public class CassandraJavaRDD { /** * Forces the rows within a selected Cassandra partition to be returned in descending order ( if
* possible ) . */
public CassandraJavaRDD < R > withDescOrder ( ) { } } | CassandraRDD < R > newRDD = rdd ( ) . withDescOrder ( ) ; return wrap ( newRDD ) ; |
public class POIProxy { /** * This method is used to get the pois from a service and return a GeoJSON
* document with the data retrieved given a longitude , latitude and a radius
* in meters .
* @ param id
* The id of the service
* @ param lon
* The longitude
* @ param lat
* The latitude
* @ param dis... | DescribeService describeService = getDescribeServiceByID ( id ) ; double [ ] bbox = Calculator . boundingCoordinates ( lon , lat , distanceInMeters ) ; POIProxyEvent beforeEvent = new POIProxyEvent ( POIProxyEventEnum . BeforeBrowseLonLat , describeService , new Extent ( bbox [ 0 ] , bbox [ 1 ] , bbox [ 2 ] , bbox [ 3 ... |
public class RendererModel { /** * Adds a change listener to the list of listeners .
* @ param listener
* The listener added to the list */
public void addCDKChangeListener ( ICDKChangeListener listener ) { } } | if ( listeners == null ) { listeners = new ArrayList < ICDKChangeListener > ( ) ; } if ( ! listeners . contains ( listener ) ) { listeners . add ( listener ) ; } |
public class HeapWalker { /** * / * TBD
* < li > { @ link Arrays # asList ( Object . . . ) } < / li >
* < li > { @ link ArrayList } ( subclasses would be reduced to { @ link ArrayList } ) < / li >
* < li > { @ link HashMap } ( subclasses including { @ link LinkedHashMap } would be reduced to { @ link ArrayList } ... | if ( obj == null ) { return null ; } JavaClass t = obj . getJavaClass ( ) ; InstanceConverter c = CONVERTERS . get ( obj . getJavaClass ( ) . getName ( ) ) ; while ( c == null && t . getSuperClass ( ) != null ) { t = t . getSuperClass ( ) ; c = CONVERTERS . get ( obj . getJavaClass ( ) . getName ( ) ) ; } if ( c == nul... |
public class DefaultFactHandle { /** * format _ version : id : identity : hashcode : recency
* @ see FactHandle */
public final String toExternalForm ( ) { } } | return getFormatVersion ( ) + ":" + this . id + ":" + getIdentityHashCode ( ) + ":" + getObjectHashCode ( ) + ":" + getRecency ( ) + ":" + ( ( this . entryPoint != null ) ? this . entryPoint . getEntryPointId ( ) : "null" ) + ":" + this . traitType . name ( ) + ":" + this . objectClassName ; |
public class IDNA { /** * IDNA2003 : Compare two IDN strings for equivalence .
* This function splits the domain names into labels and compares them .
* According to IDN RFC , whenever two labels are compared , they are
* considered equal if and only if their ASCII forms ( obtained by
* applying toASCII ) match... | if ( s1 == null || s2 == null ) { throw new IllegalArgumentException ( "One of the source buffers is null" ) ; } return IDNA2003 . compare ( s1 , s2 , options ) ; |
public class Async { /** * Invokes the specified function asynchronously on the specified Scheduler and returns an Observable that
* emits the result .
* Note : The function is called immediately and once , not whenever an observer subscribes to the resulting
* Observable . Multiple subscriptions to this Observab... | return startCallable ( func , scheduler ) ; |
public class ModelsImpl { /** * Get one entity role for a given entity .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param cEntityId The composite entity extractor ID .
* @ param roleId entity role ID .
* @ throws IllegalArgumentException thrown if parameters fail the validat... | if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( appId == null ) { throw new IllegalArgumentException ( "Parameter appId is required and cannot be null." ) ; } if ( versionId == null ) { throw new IllegalArgu... |
public class IndexVectorUtil { /** * Saves the mapping from word to { @ link TernaryVector } to the specified
* file . */
public static void save ( Map < String , TernaryVector > wordToIndexVector , File output ) { } } | try { FileOutputStream fos = new FileOutputStream ( output ) ; ObjectOutputStream outStream = new ObjectOutputStream ( fos ) ; outStream . writeObject ( wordToIndexVector ) ; outStream . close ( ) ; } catch ( IOException ioe ) { throw new IOError ( ioe ) ; } |
public class CrystalGeometryTools { /** * Calculates Cartesian vectors for unit cell axes from axes lengths and angles
* between axes .
* < p > To calculate Cartesian coordinates , it places the a axis on the x axes ,
* the b axis in the xy plane , making an angle gamma with the a axis , and places
* the c axis... | Vector3d [ ] axes = new Vector3d [ 3 ] ; /* 1 . align the a axis with x axis */
axes [ 0 ] = new Vector3d ( ) ; axes [ 0 ] . x = alength ; axes [ 0 ] . y = 0.0 ; axes [ 0 ] . z = 0.0 ; double toRadians = Math . PI / 180.0 ; /* some intermediate variables */
double cosalpha = Math . cos ( toRadians * alpha ) ; double co... |
public class GSPCOLImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . GSPCOL__RES1 : return getRES1 ( ) ; case AfplibPackage . GSPCOL__COLSPCE : return getCOLSPCE ( ) ; case AfplibPackage . GSPCOL__RES2 : return getRES2 ( ) ; case AfplibPackage . GSPCOL__COLSIZE1 : return getCOLSIZE1 ( ) ; case AfplibPackage . GSPCOL__COLSIZE2 : return getCOLSI... |
public class system_settings { /** * < pre >
* Converts API response of bulk operation into object and returns the object array in case of get request .
* < / pre > */
protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } } | system_settings_responses result = ( system_settings_responses ) service . get_payload_formatter ( ) . string_to_resource ( system_settings_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro_exception ( result .... |
public class TimeSpanFormatter { /** * / * [ deutsch ]
* < p > Interpretiert den angegebenen Text entsprechend dem
* voreingestellten Formatmuster als Dauer . < / p >
* @ param textcustom textual representation to be parsed
* @ param offset start position for the parser
* @ return parsed duration
* @ throws... | int pos = offset ; Map < Object , Long > unitsToValues = new HashMap < > ( ) ; for ( int i = 0 , n = this . items . size ( ) ; i < n ; i ++ ) { FormatItem < U > item = this . items . get ( i ) ; if ( item == OrItem . INSTANCE ) { break ; } int reply = item . parse ( unitsToValues , text , pos ) ; if ( reply < 0 ) { int... |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link BigInteger }
* { @ code > } */
@ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "skipCount" , scope = GetChildren . class ) public JAXBElement < BigInteger > createGetChi... | return new JAXBElement < BigInteger > ( _GetTypeChildrenSkipCount_QNAME , BigInteger . class , GetChildren . class , value ) ; |
public class Instance { /** * < pre >
* Name of the virtual machine where this instance lives . Only applicable
* for instances in App Engine flexible environment .
* & # 64 ; OutputOnly
* < / pre >
* < code > string vm _ name = 5 ; < / code > */
public java . lang . String getVmName ( ) { } } | java . lang . Object ref = vmName_ ; if ( ref instanceof java . lang . String ) { return ( java . lang . String ) ref ; } else { com . google . protobuf . ByteString bs = ( com . google . protobuf . ByteString ) ref ; java . lang . String s = bs . toStringUtf8 ( ) ; vmName_ = s ; return s ; } |
public class ParsedSelectStmt { /** * Concat elements to the XXXColumns list */
private static void insertToColumnList ( List < ParsedColInfo > columnList , List < ParsedColInfo > newCols ) { } } | for ( ParsedColInfo col : newCols ) { if ( ! columnList . contains ( col ) ) { columnList . add ( col ) ; } } |
public class BigRational { /** * private , because we want to hide that we use BigDecimal internally */
private BigRational multiply ( BigDecimal value ) { } } | BigDecimal n = numerator . multiply ( value ) ; BigDecimal d = denominator ; return of ( n , d ) ; |
public class CollUtil { /** * 新建LinkedList
* @ param values 数组
* @ param < T > 类型
* @ return LinkedList
* @ since 4.1.2 */
@ SafeVarargs public static < T > LinkedList < T > newLinkedList ( T ... values ) { } } | return ( LinkedList < T > ) list ( true , values ) ; |
public class StructureTools { /** * Check to see if an Deuterated atom has a non deuterated brother in the group .
* @ param atom the input atom that is putatively deuterium
* @ param currentGroup the group the atom is in
* @ return true if the atom is deuterated and it ' s hydrogen equive exists . */
public stat... | if ( atom . getElement ( ) == Element . D && currentGroup . hasAtom ( replaceFirstChar ( atom . getName ( ) , 'D' , 'H' ) ) ) { // If it ' s deuterated and has a non - deuterated brother
return true ; } return false ; |
public class OffHeapConcurrentMap { /** * Performs the actual put operation putting the new address into the memory lookups . The write lock for the given
* key < b > must < / b > be held before calling this method .
* @ param bucketHeadAddress the entry address of the first element in the lookup
* @ param actual... | // Have to start new linked node list
if ( bucketHeadAddress == 0 ) { memoryLookup . putMemoryAddress ( key , newAddress ) ; entryCreated ( newAddress ) ; size . incrementAndGet ( ) ; return null ; } else { boolean replaceHead = false ; boolean foundPrevious = false ; // Whether the key was found or not - short circuit... |
public class VisualStudioParser { /** * { @ inheritDoc } */
@ Override public void processReport ( File report , final Map < String , CoverageMeasures > coverageData ) throws XMLStreamException { } } | LOG . debug ( "Parsing 'Visual Studio' format" ) ; StaxParser parser = new StaxParser ( ( SMHierarchicCursor rootCursor ) -> { rootCursor . advance ( ) ; collectModuleMeasures ( rootCursor . descendantElementCursor ( "module" ) , coverageData ) ; } ) ; parser . parse ( report ) ; |
public class RecordSetsInner { /** * Lists all record sets in a DNS zone .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; RecordSetInner & gt ; ... | return listByDnsZoneNextSinglePageAsync ( nextPageLink ) . concatMap ( new Func1 < ServiceResponse < Page < RecordSetInner > > , Observable < ServiceResponse < Page < RecordSetInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < RecordSetInner > > > call ( ServiceResponse < Page < RecordSetInner ... |
public class StubRunnerConfiguration { /** * Bean that initializes stub runners , runs them and on shutdown closes them . Upon its
* instantiation JAR with stubs is downloaded and unpacked to a temporary folder and
* WireMock server are started for each of those stubs
* @ return the batch stub runner bean */
@ Be... | StubRunnerOptionsBuilder builder = builder ( ) ; if ( this . props . getProxyHost ( ) != null ) { builder . withProxy ( this . props . getProxyHost ( ) , this . props . getProxyPort ( ) ) ; } StubRunnerOptions stubRunnerOptions = builder . build ( ) ; BatchStubRunner batchStubRunner = new BatchStubRunnerFactory ( stubR... |
public class MicrochipPotentiometerDeviceController { /** * Receives the current wiper ' s value from the device .
* @ param channel Which wiper
* @ param nonVolatile volatile or non - volatile value
* @ return The wiper ' s value
* @ throws IOException Thrown if communication fails or device returned a malform... | if ( channel == null ) { throw new RuntimeException ( "null-channel is not allowed. For devices " + "knowing just one wiper Channel.A is mandatory for " + "parameter 'channel'" ) ; } // choose proper memory address ( see TABLE 4-1)
byte memAddr = nonVolatile ? channel . getNonVolatileMemoryAddress ( ) : channel . getVo... |
public class Interceptors { /** * Get a chained interceptor which passes the invocation through the given interceptors .
* @ param instances the interceptors to pass through
* @ return the chained interceptor */
public static Interceptor getChainedInterceptor ( Collection < Interceptor > instances ) { } } | final int size = instances . size ( ) ; return size == 1 ? instances . iterator ( ) . next ( ) : new ChainedInterceptor ( instances . toArray ( Interceptor . EMPTY_ARRAY ) ) ; |
public class Schema { /** * Compute the difference in { @ link ColumnMetaData }
* between this schema and the passed in schema .
* This is useful during the { @ link org . datavec . api . transform . TransformProcess }
* to identify what a process will do to a given { @ link Schema } .
* @ param schema the sche... | List < ColumnMetaData > ret = new ArrayList < > ( ) ; for ( int i = 0 ; i < schema . numColumns ( ) ; i ++ ) { if ( ! columnMetaData . contains ( schema . getMetaData ( i ) ) ) ret . add ( schema . getMetaData ( i ) ) ; } return ret ; |
public class ListDominantLanguageDetectionJobsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListDominantLanguageDetectionJobsRequest listDominantLanguageDetectionJobsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listDominantLanguageDetectionJobsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listDominantLanguageDetectionJobsRequest . getFilter ( ) , FILTER_BINDING ) ; protocolMarshaller . marshall ( listDominantLanguageDetectionJobsR... |
public class DateOffsetScanListener { /** * Init Method . */
public void init ( RecordOwnerParent parent , String strSourcePrefix ) { } } | super . init ( parent , strSourcePrefix ) ; if ( this . getProperty ( "dayOffset" ) != null ) dayOffset = Integer . parseInt ( this . getProperty ( "dayOffset" ) ) ; if ( this . getProperty ( "monthOffset" ) != null ) monthOffset = Integer . parseInt ( this . getProperty ( "monthOffset" ) ) ; if ( this . getProperty ( ... |
public class RoundRobin { /** * Return whether this { @ link RoundRobin } is still consistent and contains all items from the master { @ link Collection } and
* vice versa .
* @ param master the master collection containing source elements for this { @ link RoundRobin } .
* @ return { @ literal true } if this { @... | Collection < ? extends V > collection = this . collection ; return collection . containsAll ( master ) && master . containsAll ( collection ) ; |
public class Configuration { /** * Returns the configuration setting corresponding to the specified key .
* @ param key The key to the configuration setting .
* @ return The configuration setting corresponding to the specified key . */
@ SuppressWarnings ( "unchecked" ) public < T > T get ( String key ) { } } | Preconditions . checkArgument ( key != null && ! key . isEmpty ( ) , "Parameter 'key' must not be [" + key + "]" ) ; Context context = factory . enterContext ( ) ; try { if ( values . containsKey ( key ) ) { Object value = values . get ( key ) ; return ( T ) ( ( value instanceof Function ) ? ( ( Function ) value ) . ca... |
public class DummyRPCServiceImpl { /** * { @ inheritDoc } */
public List < Object > executeCommandOnAllNodes ( RemoteCommand command , boolean synchronous , Serializable ... args ) throws RPCException , SecurityException { } } | List < Object > result = new ArrayList < Object > ( 1 ) ; result . add ( executeCommand ( command , args ) ) ; return result ; |
public class ClientSharedObject { /** * Broadcast send event to listeners
* @ param method
* Method name
* @ param params
* Params */
protected void notifySendMessage ( String method , List < ? > params ) { } } | for ( ISharedObjectListener listener : listeners ) { listener . onSharedObjectSend ( this , method , params ) ; } |
public class BlurBuilder { /** * Sets the blur algorithm .
* NOTE : this probably never is necessary to do except for testing purpose , the default
* algorithm , which uses Android ' s { @ link android . support . v8 . renderscript . ScriptIntrinsicBlur }
* which is the best and fastest you getFromDiskCache on An... | data . blurAlgorithm = BuilderUtil . getIBlurAlgorithm ( algorithm , data . contextWrapper ) ; return this ; |
public class SamoaToWekaInstanceConverter { /** * Weka attribute .
* @ param index the index
* @ param attribute the attribute
* @ return the weka . core . attribute */
protected weka . core . Attribute wekaAttribute ( int index , Attribute attribute ) { } } | weka . core . Attribute wekaAttribute ; if ( attribute . isNominal ( ) ) { wekaAttribute = new weka . core . Attribute ( attribute . name ( ) , attribute . getAttributeValues ( ) , index ) ; } else { wekaAttribute = new weka . core . Attribute ( attribute . name ( ) , index ) ; } // System . out . println ( wekaAttribu... |
public class FileIO { /** * Writes from an InputStream to a temporary file */
public static File writeToTempFile ( InputStream inputStream , String prefix , String suffix ) throws IOException { } } | File file = File . createTempFile ( prefix , "." + suffix ) ; writeToFile ( inputStream , file ) ; return file ; |
public class GZipServletResponseWrapper { /** * Flushes all the streams for this response .
* @ throws IOException maybe */
public void flush ( ) throws IOException { } } | if ( printWriter != null ) { printWriter . flush ( ) ; } if ( gzipOutputStream != null ) { gzipOutputStream . flush ( ) ; } |
public class JDBCInputFormat { /** * Closes all resources used .
* @ throws IOException Indicates that a resource could not be closed . */
@ Override public void close ( ) throws IOException { } } | try { resultSet . close ( ) ; } catch ( SQLException se ) { LOG . info ( "Inputformat couldn't be closed - " + se . getMessage ( ) ) ; } catch ( NullPointerException npe ) { } try { statement . close ( ) ; } catch ( SQLException se ) { LOG . info ( "Inputformat couldn't be closed - " + se . getMessage ( ) ) ; } catch (... |
public class MpMessages { /** * 群发视频消息给特定分组的人
* @ param group
* @ param mediaId
* @ param title
* @ param desc
* @ return */
public long video ( int group , String mediaId , String title , String desc ) { } } | return video ( new Filter ( false , String . valueOf ( group ) ) , null , mediaId , title , desc ) ; |
public class AmqpChannel { /** * Fired when channel is Closed
* @ param e */
private void fireOnError ( ChannelEvent e ) { } } | List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onError ( e ) ; } |
public class ScrollableArea { /** * Creates and returns a new scrollable area .
* @ param top
* The top - most area , which should be scrollable , as a value of the enum { @ link Area } or
* null , if no area should be scrollable
* @ param bottom
* The bottom - most area , which should be scrollable , as a va... | return new ScrollableArea ( top , bottom ) ; |
public class RowCell { /** * A comparator that compares the cells by Bigtable native ordering :
* < ul >
* < li > Family lexicographically ascending
* < li > Qualifier lexicographically ascending
* < li > Timestamp in reverse chronological order
* < / ul >
* < p > Labels and values are not included in the c... | return new Comparator < RowCell > ( ) { @ Override public int compare ( RowCell c1 , RowCell c2 ) { return ComparisonChain . start ( ) . compare ( c1 . getFamily ( ) , c2 . getFamily ( ) ) . compare ( c1 . getQualifier ( ) , c2 . getQualifier ( ) , ByteStringComparator . INSTANCE ) . compare ( c2 . getTimestamp ( ) , c... |
public class SecurityServletConfiguratorHelper { /** * Creates a list of zero or more security constraint objects that represent the
* security - constraint elements in web . xml and / or web - fragment . xml files .
* @ param securityConstraints a list of security constraints */
private void processSecurityConstra... | List < SecurityConstraint > securityConstraints = new ArrayList < SecurityConstraint > ( ) ; for ( com . ibm . ws . javaee . dd . web . common . SecurityConstraint archiveSecurityConstraint : archiveSecurityConstraints ) { SecurityConstraint securityConstraint = createSecurityConstraint ( archiveSecurityConstraint , de... |
public class HttpHeaders { /** * Returns { @ code value } as a positive integer , or 0 if it is negative , or { @ code defaultValue } if
* it cannot be parsed . */
public static int parseSeconds ( String value , int defaultValue ) { } } | try { long seconds = Long . parseLong ( value ) ; if ( seconds > Integer . MAX_VALUE ) { return Integer . MAX_VALUE ; } else if ( seconds < 0 ) { return 0 ; } else { return ( int ) seconds ; } } catch ( NumberFormatException e ) { return defaultValue ; } |
public class CommerceOrderItemLocalServiceBaseImpl { /** * Performs a dynamic query on the database and returns the matching rows .
* @ param dynamicQuery the dynamic query
* @ return the matching rows */
@ Override public < T > List < T > dynamicQuery ( DynamicQuery dynamicQuery ) { } } | return commerceOrderItemPersistence . findWithDynamicQuery ( dynamicQuery ) ; |
public class CharsTrie { /** * pos is already after the leadUnit , and the lead unit has bit 15 reset . */
private static int readValue ( CharSequence chars , int pos , int leadUnit ) { } } | int value ; if ( leadUnit < kMinTwoUnitValueLead ) { value = leadUnit ; } else if ( leadUnit < kThreeUnitValueLead ) { value = ( ( leadUnit - kMinTwoUnitValueLead ) << 16 ) | chars . charAt ( pos ) ; } else { value = ( chars . charAt ( pos ) << 16 ) | chars . charAt ( pos + 1 ) ; } return value ; |
public class TmdbTV { /** * Get the cast & crew information about a TV series .
* @ param tvID
* @ param language
* @ return
* @ throws com . omertron . themoviedbapi . MovieDbException */
public MediaCreditList getTVCredits ( int tvID , String language ) throws MovieDbException { } } | TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . ID , tvID ) ; parameters . add ( Param . LANGUAGE , language ) ; URL url = new ApiUrl ( apiKey , MethodBase . TV ) . subMethod ( MethodSub . CREDITS ) . buildUrl ( parameters ) ; String webpage = httpTools . getRequest ( url ) ; try { retur... |
public class WhiteboxImpl { /** * Throw exception when multiple constructor matches found .
* @ param constructors the constructors */
static void throwExceptionWhenMultipleConstructorMatchesFound ( Constructor < ? > [ ] constructors ) { } } | if ( constructors == null || constructors . length < 2 ) { throw new IllegalArgumentException ( "Internal error: throwExceptionWhenMultipleConstructorMatchesFound needs at least two constructors." ) ; } StringBuilder sb = new StringBuilder ( ) ; sb . append ( "Several matching constructors found, please specify the arg... |
public class DFSUtil { /** * Given the InetSocketAddress for any configured communication with a
* namenode , this method determines whether it is the configured
* communication channel for the " default " namenode .
* It does a reverse lookup on the list of default communication parameters
* to see if the give... | for ( String key : keys ) { String candidateAddress = conf . get ( key ) ; if ( candidateAddress != null && address . equals ( NetUtils . createSocketAddr ( candidateAddress ) ) ) return true ; } return false ; |
public class KUrl { /** * removes www , protocol and country
* @ return */
public KUrl unified ( ) { } } | KUrl res = new KUrl ( toUrlString ( false ) ) ; res . elements [ 0 ] = normalizeDomain ( elements [ 0 ] ) ; return res ; |
public class RtfChapter { /** * Writes the RtfChapter and its contents */
public void writeContent ( final OutputStream result ) throws IOException { } } | if ( this . document . getLastElementWritten ( ) != null && ! ( this . document . getLastElementWritten ( ) instanceof RtfChapter ) ) { result . write ( DocWriter . getISOBytes ( "\\page" ) ) ; } result . write ( DocWriter . getISOBytes ( "\\sectd" ) ) ; document . getDocumentHeader ( ) . writeSectionDefinition ( resul... |
public class NDCG { /** * Computes the ideal < a
* href = " http : / / recsyswiki . com / wiki / Discounted _ Cumulative _ Gain "
* target = " _ blank " > discounted cumulative gain < / a > ( IDCG ) given the test set
* ( groundtruth items ) for a user .
* @ param user the user
* @ param userTestItems the gro... | double idcg = 0.0 ; // sort the items according to their relevance level
List < Double > sortedList = rankScores ( userTestItems ) ; int rank = 1 ; for ( double itemRel : sortedList ) { idcg += computeDCG ( itemRel , rank ) ; // compute at a particular cutoff
for ( int at : getCutoffs ( ) ) { if ( rank == at ) { Map < ... |
public class DrawerActivity { /** * Initializes the list that controls which fragment will be shown . */
private void initializeList ( ) { } } | mListView = ( ListView ) findViewById ( R . id . drawer_list ) ; mListAdapter = new ArrayAdapter < String > ( this , android . R . layout . simple_list_item_1 ) ; mListView . setAdapter ( mListAdapter ) ; mListView . setOnItemClickListener ( new AdapterView . OnItemClickListener ( ) { @ Override public void onItemClick... |
public class SourceFile { /** * Reads the code from the supplied source file . */
public void readFrom ( File source ) throws IOException { } } | // slurp our source file into newline separated strings
_lines = Lists . newArrayList ( ) ; BufferedReader bin = new BufferedReader ( new FileReader ( source ) ) ; String line = null ; while ( ( line = bin . readLine ( ) ) != null ) { _lines . add ( line ) ; } bin . close ( ) ; // now determine where to insert our stat... |
public class RepositoryManager { /** * Returns the { @ link Repository } instance with the given name .
* @ param repositoryName a { @ code non - null } string
* @ return a { @ link Repository } instance , never { @ code null }
* @ throws NoSuchRepositoryException if no repository with the given name exists . */
... | Repository repository = null ; try { repository = repositoriesContainer . getRepository ( repositoryName , Collections . unmodifiableMap ( factoryParams ) ) ; } catch ( RepositoryException e ) { throw new NoSuchRepositoryException ( WebJcrI18n . cannotInitializeRepository . text ( repositoryName ) , e ) ; } if ( reposi... |
public class FolderJob { /** * Create a folder on the server ( as a subfolder of this folder )
* @ param folderName name of the folder to be created .
* @ param crumbFlag true / false .
* @ return
* @ throws IOException in case of an error . */
public FolderJob createFolder ( String folderName , Boolean crumbFl... | // https : / / gist . github . com / stuart - warren / 7786892 was slightly helpful
// here
// TODO : JDK9 + : Map . of ( . . . )
Map < String , String > params = new HashMap < > ( ) ; params . put ( "mode" , "com.cloudbees.hudson.plugins.folder.Folder" ) ; params . put ( "name" , folderName ) ; params . put ( "from" ,... |
public class FunctionsInner { /** * Retrieves the default definition of a function based on the parameters specified .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param jobName The name of t... | return ServiceFuture . fromResponse ( retrieveDefaultDefinitionWithServiceResponseAsync ( resourceGroupName , jobName , functionName ) , serviceCallback ) ; |
public class WebPage { /** * Constructs shortName from dir and extension ( if available ) , used in RssGenerator
* @ return Name */
public String constructShortName ( ) { } } | String result = shortName ; if ( dir != null ) { result = dir + "/" + result ; } if ( extension != null ) { result = result + "." + extension ; } return result ; |
public class GuiUtilities { /** * Adds to a textfield and button the necessary to browse for a file .
* @ param pathTextField
* @ param browseButton
* @ param allowedExtensions */
public static void setFileBrowsingOnWidgets ( JTextField pathTextField , JButton browseButton , String [ ] allowedExtensions , Runnabl... | FileFilter filter = null ; if ( allowedExtensions != null ) { filter = new FileFilter ( ) { @ Override public String getDescription ( ) { return Arrays . toString ( allowedExtensions ) ; } @ Override public boolean accept ( File f ) { if ( f . isDirectory ( ) ) { return true ; } String name = f . getName ( ) ; for ( St... |
public class StandardPacketOutputStream { /** * Flush the internal buffer .
* @ param commandEnd command end
* @ throws IOException id connection error occur . */
protected void flushBuffer ( boolean commandEnd ) throws IOException { } } | if ( pos > 4 ) { buf [ 0 ] = ( byte ) ( pos - 4 ) ; buf [ 1 ] = ( byte ) ( ( pos - 4 ) >>> 8 ) ; buf [ 2 ] = ( byte ) ( ( pos - 4 ) >>> 16 ) ; buf [ 3 ] = ( byte ) this . seqNo ++ ; checkMaxAllowedLength ( pos - 4 ) ; out . write ( buf , 0 , pos ) ; cmdLength += pos - 4 ; if ( traceCache != null && permitTrace ) { // t... |
public class CmsSiteManagerImpl { /** * Set webserver script configuration . < p >
* @ param webserverscript path
* @ param targetpath path
* @ param configtemplate path
* @ param securetemplate path
* @ param filenameprefix to add to files
* @ param loggingdir path */
public void setWebServerScripting ( St... | m_apacheConfig = new HashMap < String , String > ( ) ; m_apacheConfig . put ( WEB_SERVER_CONFIG_WEBSERVERSCRIPT , webserverscript ) ; m_apacheConfig . put ( WEB_SERVER_CONFIG_TARGETPATH , targetpath ) ; m_apacheConfig . put ( WEB_SERVER_CONFIG_CONFIGTEMPLATE , configtemplate ) ; m_apacheConfig . put ( WEB_SERVER_CONFIG... |
public class TimedMapImpl { /** * 移除缓存对象并通知事件
* @ param key
* @ param expire 是否超时才执行的移除
* @ return */
protected TimedEntry < K , V > removeAndListener ( Object key , final boolean expire ) { } } | final TimedEntry < K , V > entry = entryMap . remove ( key ) ; try { if ( entry != null ) { // 通知被移除
final EventListener < K , V > listener = entry . listener ; entry . setListener ( null ) ; if ( listener != null ) { lisenterExecutor . execute ( new Runnable ( ) { @ Override public void run ( ) { try { listener . remo... |
public class SampleExceptionHandler { /** * Exception handler that simply log progress state and progress information . */
@ Override public void handleException ( ProcessingLibraryException exception ) { } } | ProgressStatus status = exception . getStatus ( ) ; ProgressState state = status . getProgressState ( ) ; ProgressInfo info = status . getProgressInfo ( ) ; logger . error ( String . format ( "Exception. Progress State: %s. Progress Information: %s." , state , info ) ) ; |
public class Widgets { /** * Retrieve the text from the TextBox , unless it is the specified default , in which case
* we return " " . */
public static String getText ( TextBoxBase box , String defaultAsBlank ) { } } | String s = box . getText ( ) . trim ( ) ; return s . equals ( defaultAsBlank ) ? "" : s ; |
public class ResourceAdapterImpl { /** * Force adminobjects with new content .
* This method is thread safe
* @ param newContent the list of new properties */
public synchronized void forceAdminObjects ( List < AdminObject > newContent ) { } } | if ( newContent != null ) { this . adminobjects = new ArrayList < AdminObject > ( newContent ) ; } else { this . adminobjects = new ArrayList < AdminObject > ( 0 ) ; } |
public class FileUtil { /** * 创建 { @ link RandomAccessFile }
* @ param path 文件Path
* @ param mode 模式 , 见 { @ link FileMode }
* @ return { @ link RandomAccessFile }
* @ since 4.5.2 */
public static RandomAccessFile createRandomAccessFile ( Path path , FileMode mode ) { } } | return createRandomAccessFile ( path . toFile ( ) , mode ) ; |
public class AbstractCommand { /** * / * ( non - Javadoc )
* @ see ca . eandb . util . args . Command # process ( java . util . Queue , java . lang . Object ) */
public final void process ( Queue < String > argq , T state ) { } } | String [ ] args = argq . toArray ( new String [ argq . size ( ) ] ) ; argq . clear ( ) ; run ( args , state ) ; |
public class AuthTokens { /** * The basic authentication scheme , using a username and a password .
* @ param username this is the " principal " , identifying who this token represents
* @ param password this is the " credential " , proving the identity of the user
* @ param realm this is the " realm " , specifie... | Objects . requireNonNull ( username , "Username can't be null" ) ; Objects . requireNonNull ( password , "Password can't be null" ) ; Map < String , Value > map = newHashMapWithSize ( 4 ) ; map . put ( SCHEME_KEY , value ( "basic" ) ) ; map . put ( PRINCIPAL_KEY , value ( username ) ) ; map . put ( CREDENTIALS_KEY , va... |
public class ListVocabulariesResult { /** * A list of objects that describe the vocabularies that match the search criteria in the request .
* @ param vocabularies
* A list of objects that describe the vocabularies that match the search criteria in the request . */
public void setVocabularies ( java . util . Collec... | if ( vocabularies == null ) { this . vocabularies = null ; return ; } this . vocabularies = new java . util . ArrayList < VocabularyInfo > ( vocabularies ) ; |
public class WorkspaceQuotaManager { /** * { @ inheritDoc } */
public void start ( ) { } } | boolean isCoordinator ; try { isCoordinator = rpcService . isCoordinator ( ) ; } catch ( RPCException e ) { throw new IllegalStateException ( e . getMessage ( ) , e ) ; } if ( isCoordinator ) { try { quotaPersister . getWorkspaceDataSize ( rName , wsName ) ; } catch ( UnknownDataSizeException e ) { calculateWorkspaceDa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.