signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ElementMatchers { /** * Matches { @ link MethodDescription } s that return a given erasure type .
* @ param type The raw type the matched method is expected to return .
* @ param < T > The type of the matched object .
* @ return An element matcher that matches a given return type for a method descrip... | return returnsGeneric ( erasure ( type ) ) ; |
public class CmsEditModuleForm { /** * Adds a new resource selection widget to the list of module resources . < p >
* @ param moduleResource the initial value for the new widget */
void addExcludedResource ( String moduleResource ) { } } | CmsModuleResourceSelectField resField = createModuleResourceField ( moduleResource ) ; if ( resField != null ) { m_excludedResourcesGroup . addRow ( resField ) ; } |
public class HeaderMap { /** * contains */
public boolean contains ( HttpString headerName ) { } } | final HeaderValues headerValues = getEntry ( headerName ) ; if ( headerValues == null ) { return false ; } final Object v = headerValues . value ; if ( v instanceof String ) { return true ; } final String [ ] list = ( String [ ] ) v ; for ( int i = 0 ; i < list . length ; i ++ ) { if ( list [ i ] != null ) { return tru... |
public class Matrix4f { /** * Compute a normal matrix from the upper left 3x3 submatrix of < code > this < / code >
* and store it into the upper left 3x3 submatrix of < code > dest < / code > .
* All other values of < code > dest < / code > will be set to { @ link # identity ( ) identity } .
* The normal matrix ... | if ( ( properties & PROPERTY_IDENTITY ) != 0 ) return dest . identity ( ) ; else if ( ( properties & PROPERTY_ORTHONORMAL ) != 0 ) return normalOrthonormal ( dest ) ; return normalGeneric ( dest ) ; |
public class GeometryRendererImpl { /** * Used in creating the " edges " , " selection " and " vertices " groups for LineStrings and LinearRings . */
private Composite getOrCreateGroup ( Object parent , String name ) { } } | if ( groups . containsKey ( name ) ) { return groups . get ( name ) ; } Composite group = new Composite ( name ) ; mapWidget . getVectorContext ( ) . drawGroup ( parent , group ) ; groups . put ( name , group ) ; return group ; |
public class InMemoryCacheEntry { /** * / * ( non - Javadoc )
* @ see com . gistlabs . mechanize . cache . InMemoryCacheEntry # prepareConditionalGet ( org . apache . http . client . methods . HttpUriRequest ) */
@ Override public void prepareConditionalGet ( final HttpUriRequest newRequest ) { } } | transferFirstHeader ( "ETag" , "If-None-Match" , this . response , newRequest ) ; transferFirstHeader ( "Last-Modified" , "If-Modified-Since" , this . response , newRequest ) ; |
public class Settings { /** * Get a property by name
* @ param key the property name */
public int getIntProperty ( String key , int defaultValue ) { } } | String value = SystemTools . replaceSystemProperties ( settings . getProperty ( key ) ) ; if ( value == null ) return defaultValue ; try { return Integer . parseInt ( value ) ; } catch ( Exception e ) { return defaultValue ; } |
public class NotificationPacket { /** * / * ( non - Javadoc )
* @ see net . timewalker . ffmq4 . network . packet . AbstractPacket # unserializeFrom ( net . timewalker . ffmq4 . utils . RawDataInputStream ) */
@ Override protected void unserializeFrom ( RawDataBuffer in ) { } } | super . unserializeFrom ( in ) ; sessionId = new IntegerID ( in . readInt ( ) ) ; consumerId = new IntegerID ( in . readInt ( ) ) ; message = MessageSerializer . unserializeFrom ( in , false ) ; donePrefetching = in . readBoolean ( ) ; |
public class CommentUtil { /** * Returns the first comment found for the given docx object . Note that an object is
* only considered commented if the comment STARTS within the object . Comments
* spanning several objects are not supported by this method .
* @ param object the object whose comment to load .
* @... | try { for ( Object contentObject : object . getContent ( ) ) { if ( contentObject instanceof CommentRangeStart ) { try { BigInteger id = ( ( CommentRangeStart ) contentObject ) . getId ( ) ; CommentsPart commentsPart = ( CommentsPart ) document . getParts ( ) . get ( new PartName ( "/word/comments.xml" ) ) ; Comments c... |
public class AnnotationFunctionImportFactory { /** * Add function import to builder of this factory by specified class .
* @ param cls function import class */
public void addFunctionImport ( Class < ? > cls ) { } } | EdmFunctionImport functionImportAnnotation = cls . getAnnotation ( EdmFunctionImport . class ) ; FunctionImportImpl . Builder functionImportBuilder = new FunctionImportImpl . Builder ( ) . setEntitySetName ( functionImportAnnotation . entitySet ( ) ) . setFunctionName ( functionImportAnnotation . namespace ( ) + "." + ... |
public class PGPRGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setSHside ( Integer newSHside ) { } } | Integer oldSHside = sHside ; sHside = newSHside ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . PGPRG__SHSIDE , oldSHside , sHside ) ) ; |
public class JcValue { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div >
* < div color = ' red ' style = " font - size : 18px ; color : red " > < i > return the receiver as a JcString < / i > < / div >
* < br / > */
public JcString... | JcString ret = new JcString ( null , this , null ) ; QueryRecorder . recordInvocationConditional ( this , "asString" , ret ) ; return ret ; |
public class ArrayList { /** * Removes from this list all of the elements whose index is between
* { @ code fromIndex } , inclusive , and { @ code toIndex } , exclusive .
* Shifts any succeeding elements to the left ( reduces their index ) .
* This call shortens the list by { @ code ( toIndex - fromIndex ) } elem... | // Android - changed : Throw an IOOBE if toIndex < fromIndex as documented .
// All the other cases ( negative indices , or indices greater than the size
// will be thrown by System # arrayCopy .
if ( toIndex < fromIndex ) { throw new IndexOutOfBoundsException ( "toIndex < fromIndex" ) ; } modCount ++ ; int numMoved = ... |
public class IOUtils { /** * Serializes the given object value to an output stream , and close the output stream .
* @ param value object value to serialize
* @ param outputStream output stream to serialize into
* @ since 1.16 */
public static void serialize ( Object value , OutputStream outputStream ) throws IOE... | try { new ObjectOutputStream ( outputStream ) . writeObject ( value ) ; } finally { outputStream . close ( ) ; } |
public class OAuthCredentialsCache { /** * Refreshes the OAuth2 token asynchronously . This method will only start an async refresh if
* there isn ' t a currently running asynchronous refresh and the current token is not " Good " . */
Future < HeaderCacheElement > asyncRefresh ( ) { } } | LOG . trace ( "asyncRefresh" ) ; synchronized ( lock ) { try { if ( futureToken != null ) { return futureToken ; } if ( headerCache . getCacheState ( ) == CacheState . Good ) { return Futures . immediateFuture ( headerCache ) ; } Future < HeaderCacheElement > future = executor . submit ( new Callable < HeaderCacheEleme... |
public class ResourceChangeMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ResourceChange resourceChange , ProtocolMarshaller protocolMarshaller ) { } } | if ( resourceChange == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( resourceChange . getAction ( ) , ACTION_BINDING ) ; protocolMarshaller . marshall ( resourceChange . getLogicalResourceId ( ) , LOGICALRESOURCEID_BINDING ) ; protocolMars... |
public class ParameterMap { /** * Set the given parameters under .
* @ param params the other parameter map */
public void setAll ( Map < String , String > params ) { } } | for ( Map . Entry < String , String > entry : params . entrySet ( ) ) { setParameter ( entry . getKey ( ) , entry . getValue ( ) ) ; } |
public class Train { /** * save feature index */
private void saveFeatureIndexes ( FeatureIndex [ ] index , ZipModel model ) throws IOException { } } | logger . info ( "save feature index (" + index . length + ")" ) ; // save the indexes
for ( int i = 0 ; i < index . length ; i ++ ) { logger . debug ( "dic" + i + " size " + index [ i ] . size ( ) ) ; File tmp = File . createTempFile ( "dic" + i , null ) ; tmp . deleteOnExit ( ) ; BufferedWriter bwd = new BufferedWrite... |
public class GenUtil { /** * Return an " @ Generated " annotation .
* @ param clazz the class doing the code generation , NOT the generation target .
* @ param indent the number of spaces that the annotation is indented .
* @ param includeDate include the date ?
* @ param comments joined by a space and used as ... | final int LINE_LENGTH = 100 ; String comm = StringUtil . join ( comments , " " ) ; boolean hasComment = ! StringUtil . isBlank ( comm ) ; String anno = "@Generated(value={\"" + clazz . getName ( ) + "\"}" ; if ( includeDate ) { anno += "," ; // ISO 8601 date
String date = " date=\"" + new SimpleDateFormat ( "yyyy-MM-dd... |
public class AbstractObjectStore { /** * ( non - Javadoc )
* @ see com . ibm . ws . objectManager . ObjectStore # captureStatistics ( ) */
public java . util . Map captureStatistics ( ) throws ObjectManagerException { } } | if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "captureStatistics" ) ; java . util . Map statistics = new java . util . HashMap ( ) ; // inMemoryTokens set to null after close ( ) .
if ( inMemoryTokens != null ) statistics . put ( "inMemoryTokens.size()" , Integer... |
public class WstxInputFactory { /** * Another internal factory method , used when dealing with a generic
* Source base type . One thing worth noting is that ' auto - closing '
* will be enabled if the input source or Reader is constructed ( and
* thus owned ) by Woodstox .
* @ param forER True , if the reader i... | ReaderConfig cfg = createPrivateConfig ( ) ; Reader r = null ; InputStream in = null ; String pubId = null ; String sysId = null ; String encoding = null ; boolean autoCloseInput ; InputBootstrapper bs = null ; if ( src instanceof Stax2Source ) { Stax2Source ss = ( Stax2Source ) src ; sysId = ss . getSystemId ( ) ; pub... |
public class Math { /** * Element - wise subtraction of two arrays y = y - x .
* @ param y minuend matrix
* @ param x subtrahend matrix */
public static void minus ( double [ ] y , double [ ] x ) { } } | if ( x . length != y . length ) { throw new IllegalArgumentException ( String . format ( "Arrays have different length: x[%d], y[%d]" , x . length , y . length ) ) ; } for ( int i = 0 ; i < x . length ; i ++ ) { y [ i ] -= x [ i ] ; } |
public class JConsole { /** * If not in the event thread run via SwingUtilities . invokeAndWait ( ) */
private void invokeAndWait ( Runnable run ) { } } | if ( ! SwingUtilities . isEventDispatchThread ( ) ) { try { SwingUtilities . invokeAndWait ( run ) ; } catch ( Exception e ) { // shouldn ' t happen
e . printStackTrace ( ) ; } } else { run . run ( ) ; } |
public class Promises { /** * Transforms an { @ link AsyncSupplier } { @ code tasks }
* to a collection of { @ code Promise } s . */
@ SafeVarargs public static < T > Iterator < Promise < T > > asPromises ( @ NotNull AsyncSupplier < ? extends T > ... tasks ) { } } | return asPromises ( asList ( tasks ) ) ; |
public class MPXReader { /** * Populates a task instance .
* @ param record MPX record
* @ param task task instance
* @ throws MPXJException */
private void populateTask ( Record record , Task task ) throws MPXJException { } } | String falseText = LocaleData . getString ( m_locale , LocaleData . NO ) ; int mpxFieldID = 0 ; String field ; int i = 0 ; int length = record . getLength ( ) ; int [ ] model = m_taskModel . getModel ( ) ; while ( i < length ) { mpxFieldID = model [ i ] ; if ( mpxFieldID == - 1 ) { break ; } field = record . getString ... |
public class ClassLocator { /** * Possible calls :
* < ul >
* < li >
* adams . core . ClassLocator & lt ; packages & gt ; < br >
* Prints all the packages in the current classpath
* < / li >
* < li >
* adams . core . ClassLocator & lt ; classname & gt ; & lt ; packagename ( s ) & gt ; < br >
* Prints th... | List < String > list ; List < String > packages ; int i ; StringTokenizer tok ; if ( ( args . length == 1 ) && ( args [ 0 ] . equals ( "packages" ) ) ) { list = getSingleton ( ) . findPackages ( ) ; for ( i = 0 ; i < list . size ( ) ; i ++ ) System . out . println ( list . get ( i ) ) ; } else if ( args . length == 2 )... |
public class Computer { /** * Returns projects that are tied on this node . */
public List < AbstractProject > getTiedJobs ( ) { } } | Node node = getNode ( ) ; return ( node != null ) ? node . getSelfLabel ( ) . getTiedJobs ( ) : Collections . EMPTY_LIST ; |
public class NotifierUtils { /** * Get file associated with the given URI */
public static File uriToFile ( URI u ) throws IOException { } } | if ( ! u . getScheme ( ) . equals ( NNStorage . LOCAL_URI_SCHEME ) ) { throw new IOException ( "URI does not represent a file" ) ; } return new File ( u . getPath ( ) ) ; |
public class SearchExpressionFacade { /** * Resolves a list of { @ link UIComponent } clientIds and / or passtrough expressions for the given expression or expressions .
* @ param context The { @ link FacesContext } .
* @ param source The source component . E . g . a button .
* @ param expressions The search expr... | return resolveClientIds ( context , source , expressions , SearchExpressionHint . NONE ) ; |
public class UsageMeteringMessage { /** * Escapes value for a CSV line and appends it to the ' target ' . */
private void escapeValueTo ( final String field , final StringBuilder target ) { } } | if ( field == null ) { target . append ( DETAILS_QUOTE_CHAR ) ; target . append ( DETAILS_QUOTE_CHAR ) ; return ; } target . append ( DETAILS_QUOTE_CHAR ) ; if ( field . indexOf ( DETAILS_ESCAPE_CHAR ) == - 1 && field . indexOf ( DETAILS_QUOTE_CHAR ) == - 1 ) { target . append ( field ) ; } else { final int len = field... |
public class StringUtilities { /** * Converts a string so that it can be used in a regular expression .
* @ param input The string to be converted .
* @ return An escaped string that can be used in a regular expression . */
public static String convertToRegexString ( final String input ) { } } | return input . replaceAll ( "\\\\" , "\\\\" ) . replaceAll ( "\\*" , "\\*" ) . replaceAll ( "\\+" , "\\+" ) . replaceAll ( "\\]" , "\\]" ) . replaceAll ( "\\[" , "\\[" ) . replaceAll ( "\\(" , "\\(" ) . replaceAll ( "\\)" , "\\)" ) . replaceAll ( "\\?" , "\\?" ) . replaceAll ( "\\$" , "\\$" ) . replaceAll ( "\\|" , "\\... |
public class ProxyServlet { /** * Destroy this Servlet and any active applications .
* This is only called when all users are done using this Servlet . */
public void destroy ( ) { } } | super . destroy ( ) ; if ( m_servletTask != null ) m_servletTask . free ( ) ; m_servletTask = null ; ServletTask . destroyServlet ( ) ; |
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 .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
... | return ServiceFuture . fromResponse ( getCustomEntityRoleWithServiceResponseAsync ( appId , versionId , entityId , roleId ) , serviceCallback ) ; |
public class TransactionableResourceManager { /** * Registers an object to be shared within the XidContext
* @ param key the key of the shared object
* @ param value the shared object */
public void putSharedObject ( String key , Object value ) { } } | TransactionContext ctx = contexts . get ( ) ; if ( ctx == null ) { throw new IllegalStateException ( "There is no active transaction context" ) ; } XidContext xidCtx = ctx . getXidContext ( ) ; if ( xidCtx == null ) { throw new IllegalStateException ( "There is no active xid context" ) ; } xidCtx . putSharedObject ( ke... |
public class FastAdapterDiffUtil { /** * convenient function for { @ link # set ( FastItemAdapter , List , DiffCallback , boolean ) }
* @ return the adapter to allow chaining */
public static < A extends ModelAdapter < Model , Item > , Model , Item extends IItem > A set ( final A adapter , final List < Item > items ,... | return set ( adapter , items , callback , true ) ; |
public class DashletImpl { /** * Determines the dashlet type from the given type string .
* @ param typeString string to parse ( from JSON )
* @ return the dashlet type
* @ throws UnknownDashletTypeException if no such type was found */
private Type findType ( String typeString ) throws UnknownDashletTypeExceptio... | if ( "viewReport" . equalsIgnoreCase ( typeString ) ) { return Type . VIEW ; } else if ( "textContent" . equalsIgnoreCase ( typeString ) ) { return Type . TEXT ; } throw new UnknownDashletTypeException ( typeString ) ; |
public class br_remotelicense { /** * < pre >
* Use this operation to configure Remote license server on Repeater Instances .
* < / pre > */
public static br_remotelicense configureremotelicense ( nitro_service client , br_remotelicense resource ) throws Exception { } } | return ( ( br_remotelicense [ ] ) resource . perform_operation ( client , "configureremotelicense" ) ) [ 0 ] ; |
public class JobTracker { /** * Test Methods */
synchronized Set < ReasonForBlackListing > getReasonForBlackList ( String host ) { } } | FaultInfo fi = faultyTrackers . getFaultInfo ( host , false ) ; if ( fi == null ) { return new HashSet < ReasonForBlackListing > ( ) ; } return fi . getReasonforblacklisting ( ) ; |
public class ViewSet { /** * Creates a system context view , where the scope of the view is the specified software system .
* @ param softwareSystem the SoftwareSystem object representing the scope of the view
* @ param key the key for the view ( must be unique )
* @ param description a description of the view
... | assertThatTheSoftwareSystemIsNotNull ( softwareSystem ) ; assertThatTheViewKeyIsSpecifiedAndUnique ( key ) ; SystemContextView view = new SystemContextView ( softwareSystem , key , description ) ; view . setViewSet ( this ) ; systemContextViews . add ( view ) ; return view ; |
public class Pipes { /** * Register a Queue , and getValue back a listening LazyFutureStream that runs on a single thread
* ( not the calling thread )
* < pre >
* { @ code
* Pipes . register ( " test " , QueueFactories .
* < String > boundedNonBlockingQueue ( 100)
* . build ( ) ) ;
* LazyFutureStream < St... | registered . put ( key , adapter ) ; |
public class AssociateProductWithPortfolioRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AssociateProductWithPortfolioRequest associateProductWithPortfolioRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( associateProductWithPortfolioRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( associateProductWithPortfolioRequest . getAcceptLanguage ( ) , ACCEPTLANGUAGE_BINDING ) ; protocolMarshaller . marshall ( associateProductWithPortfo... |
public class RegistriesInner { /** * Updates the policies for the specified container registry .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ param registryPoliciesUpdateParameters The parameter... | return ServiceFuture . fromResponse ( updatePoliciesWithServiceResponseAsync ( resourceGroupName , registryName , registryPoliciesUpdateParameters ) , serviceCallback ) ; |
public class MetricsClient { /** * Creates or updates a logs - based metric .
* < p > Sample code :
* < pre > < code >
* try ( MetricsClient metricsClient = MetricsClient . create ( ) ) {
* MetricName metricName = ProjectMetricName . of ( " [ PROJECT ] " , " [ METRIC ] " ) ;
* LogMetric metric = LogMetric . n... | UpdateLogMetricRequest request = UpdateLogMetricRequest . newBuilder ( ) . setMetricName ( metricName ) . setMetric ( metric ) . build ( ) ; return updateLogMetric ( request ) ; |
public class ListenerList { /** * Adds a listener to the listener list in the supplied map . If no list exists , one will be
* created and mapped to the supplied key . */
public static < L , K > void addListener ( Map < K , ListenerList < L > > map , K key , L listener ) { } } | ListenerList < L > list = map . get ( key ) ; if ( list == null ) { map . put ( key , list = new ListenerList < L > ( ) ) ; } list . add ( listener ) ; |
public class Alias { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . runtime . SIMPMessageHandlerControllable # isForeign ( ) */
public boolean isForeign ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "isForeign" ) ; boolean isForeign = aliasDest . isForeign ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "isForeign" , new Boolean ( isForeign ) ) ; return isForeign ; |
public class CmsVfsDriver { /** * Removes a resource physically in the database . < p >
* @ param dbc the current database context
* @ param currentProject the current project
* @ param resource the folder to remove
* @ throws CmsDataAccessException if something goes wrong */
protected void internalRemoveFolder... | PreparedStatement stmt = null ; Connection conn = null ; try { conn = m_sqlManager . getConnection ( dbc ) ; // delete the structure record
stmt = m_sqlManager . getPreparedStatement ( conn , currentProject , "C_STRUCTURE_DELETE_BY_STRUCTUREID" ) ; stmt . setString ( 1 , resource . getStructureId ( ) . toString ( ) ) ;... |
public class PrefixMappedItemCache { /** * Checks if the { @ link CacheValue } has expired .
* @ param value the value to check .
* @ return true if the value has expired , false otherwise . */
private < V > boolean isExpired ( CacheValue < V > value ) { } } | long diff = ticker . read ( ) - value . getCreationTime ( ) ; return diff > maxEntryAgeNanos ; |
public class TypeHelper { /** * Unwinds parametrized type into plain list that contains all parameters for the given type including nested parameterized types ,
* for example calling the method for the following type
* < code >
* GType < GType < GDoubleType < GType < GDoubleType < Parent , Parent > > , Parent > >... | Validate . notNull ( type , "type cannot be null" ) ; List < Type > types = new ArrayList < Type > ( ) ; TreeTraverser < Type > typeTraverser = new TreeTraverser < Type > ( ) { @ Override public Iterable < Type > children ( Type root ) { if ( root instanceof ParameterizedType ) { ParameterizedType pType = ( Parameteriz... |
public class Query { /** * Returns a new { @ link GqlQuery } builder .
* < p > Example of creating and running a typed GQL query .
* < pre > { @ code
* String kind = " my _ kind " ;
* String gqlQuery = " select * from " + kind ;
* Query < Entity > query = Query . newGqlQueryBuilder ( Query . ResultType . ENTI... | return new GqlQuery . Builder < > ( resultType , gql ) ; |
public class BELScriptParser { /** * BELScript . g : 88:1 : unset : ' UNSET ' ( OBJECT _ IDENT | IDENT _ LIST ) ; */
public final BELScriptParser . unset_return unset ( ) throws RecognitionException { } } | BELScriptParser . unset_return retval = new BELScriptParser . unset_return ( ) ; retval . start = input . LT ( 1 ) ; Object root_0 = null ; Token string_literal31 = null ; Token set32 = null ; Object string_literal31_tree = null ; Object set32_tree = null ; paraphrases . push ( "in unset." ) ; try { // BELScript . g : ... |
public class JSONObject { /** * Internal method for doing a simple indention write .
* @ param writer The writer to use while writing the JSON text .
* @ param indentDepth How deep to indent the text .
* @ throws IOException Trhown if an error occurs on write . */
private void writeIndention ( Writer writer , int... | if ( logger . isLoggable ( Level . FINER ) ) logger . entering ( className , "writeIndention(Writer, int)" ) ; try { for ( int i = 0 ; i < indentDepth ; i ++ ) { writer . write ( indent ) ; } } catch ( Exception ex ) { IOException iox = new IOException ( "Error occurred on serialization of JSON text." ) ; iox . initCau... |
public class MurmurHash3 { /** * Hashes a byte - array fragment using MurmurHash3.
* @ param array a byte array .
* @ param offset the first valid byte in { @ code array } .
* @ param length the number of valid elements in { @ code array } .
* @ param seed a seed .
* @ return a 64 - bit MurmurHash3 hash for t... | long h1 = 0x9368e53c2f6af274L ^ seed ; long h2 = 0x586dcd208f7cd3fdL ^ seed ; long c1 = 0x87c37b91114253d5L ; long c2 = 0x4cf5ad432745937fL ; long k1 = 0 ; long k2 = 0 ; for ( int i = 0 ; i < length / 16 ; i ++ ) { k1 = getblock ( array , offset + i * 2 * 8 ) ; k2 = getblock ( array , offset + ( i * 2 + 1 ) * 8 ) ; k1 ... |
public class InstanceGroupClient { /** * Retrieves the list of instance groups and sorts them by zone .
* < p > Sample code :
* < pre > < code >
* try ( InstanceGroupClient instanceGroupClient = InstanceGroupClient . create ( ) ) {
* ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ;
* for ( Instanc... | AggregatedListInstanceGroupsHttpRequest request = AggregatedListInstanceGroupsHttpRequest . newBuilder ( ) . setProject ( project ) . build ( ) ; return aggregatedListInstanceGroups ( request ) ; |
public class CreateDirectConnectGatewayAssociationProposalRequest { /** * The Amazon VPC prefixes to advertise to the Direct Connect gateway .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setAddAllowedPrefixesToDirectConnectGateway ( java . util . Collecti... | if ( this . addAllowedPrefixesToDirectConnectGateway == null ) { setAddAllowedPrefixesToDirectConnectGateway ( new com . amazonaws . internal . SdkInternalList < RouteFilterPrefix > ( addAllowedPrefixesToDirectConnectGateway . length ) ) ; } for ( RouteFilterPrefix ele : addAllowedPrefixesToDirectConnectGateway ) { thi... |
public class NumberUtil { /** * 生成不重复随机数 根据给定的最小数字和最大数字 , 以及随机数的个数 , 产生指定的不重复的数组
* @ param begin 最小数字 ( 包含该数 )
* @ param end 最大数字 ( 不包含该数 )
* @ param size 指定产生随机数的个数
* @ return 随机int数组 */
public static Integer [ ] generateBySet ( int begin , int end , int size ) { } } | if ( begin > end ) { int temp = begin ; begin = end ; end = temp ; } // 加入逻辑判断 , 确保begin < end并且size不能大于该表示范围
if ( ( end - begin ) < size ) { throw new UtilException ( "Size is larger than range between begin and end!" ) ; } Random ran = new Random ( ) ; Set < Integer > set = new HashSet < Integer > ( ) ; while ( set .... |
public class InternalSARLParser { /** * InternalSARL . g : 10103:1 : ruleXConstructorCall returns [ EObject current = null ] : ( this _ XbaseConstructorCall _ 0 = ruleXbaseConstructorCall ( ( ( ( ( ) ' { ' ) ) = > ( ( ) otherlv _ 2 = ' { ' ) ) ( ( lv _ members _ 3_0 = ruleMember ) ) * otherlv _ 4 = ' } ' ) ? ) ; */
pub... | EObject current = null ; Token otherlv_2 = null ; Token otherlv_4 = null ; EObject this_XbaseConstructorCall_0 = null ; EObject lv_members_3_0 = null ; enterRule ( ) ; try { // InternalSARL . g : 10109:2 : ( ( this _ XbaseConstructorCall _ 0 = ruleXbaseConstructorCall ( ( ( ( ( ) ' { ' ) ) = > ( ( ) otherlv _ 2 = ' { '... |
public class AkkaInvocationHandler { /** * Sends the message to the RPC endpoint and returns a future containing
* its response .
* @ param message to send to the RPC endpoint
* @ param timeout time to wait until the response future is failed with a { @ link TimeoutException }
* @ return Response future */
prot... | return FutureUtils . toJava ( Patterns . ask ( rpcEndpoint , message , timeout . toMilliseconds ( ) ) ) ; |
public class AbstractCassandraStorage { /** * get pig type for the cassandra data type */
protected byte getPigType ( AbstractType type ) { } } | if ( type instanceof LongType || type instanceof DateType || type instanceof TimestampType ) // DateType is bad and it should feel bad
return DataType . LONG ; else if ( type instanceof IntegerType || type instanceof Int32Type ) // IntegerType will overflow at 2 * * 31 , but is kept for compatibility until pig has a Bi... |
public class XmlSlurper { /** * / * ( non - Javadoc )
* @ see org . xml . sax . helpers . DefaultHandler # startPrefixMapping ( java . lang . String , java . lang . String ) */
public void startPrefixMapping ( final String tag , final String uri ) throws SAXException { } } | if ( namespaceAware ) namespaceTagHints . put ( tag , uri ) ; |
public class TypeSignature { /** * Creates a new type signature for the map with the specified key and value type signatures .
* This method is a shortcut of :
* < pre > { @ code
* ofMap ( " map " , keyTypeSignature , valueTypeSignature ) ;
* } < / pre > */
public static TypeSignature ofMap ( TypeSignature keyT... | requireNonNull ( keyTypeSignature , "keyTypeSignature" ) ; requireNonNull ( valueTypeSignature , "valueTypeSignature" ) ; return ofContainer ( "map" , keyTypeSignature , valueTypeSignature ) ; |
public class CommerceAccountPersistenceImpl { /** * Returns the first commerce account in the ordered set where userId = & # 63 ; and type = & # 63 ; .
* @ param userId the user ID
* @ param type the type
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ ... | List < CommerceAccount > list = findByU_T ( userId , type , 0 , 1 , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ; |
public class CmsEncoder { /** * Checks if a given encoding name is actually supported , and if so
* resolves it to it ' s canonical name , if not it returns the given fallback
* value . < p >
* Charsets have a set of aliases . For example , valid aliases for " UTF - 8"
* are " UTF8 " , " utf - 8 " or " utf8 " .... | String result = m_encodingCache . get ( encoding ) ; if ( result != null ) { return result ; } try { result = Charset . forName ( encoding ) . name ( ) ; m_encodingCache . put ( encoding , result ) ; return result ; } catch ( Throwable t ) { // we will use the default value as fallback
} return fallback ; |
public class HubertKappaAgreement { /** * Calculates the expected inter - rater agreement that assumes the same
* distribution for all raters and annotations .
* @ throws NullPointerException if the annotation study is null .
* @ throws ArithmeticException if there are no items in the
* annotation study . */
@ ... | Map < Object , int [ ] > annotationsPerCategory = CodingAnnotationStudy . countAnnotationsPerCategory ( study ) ; BigDecimal result = BigDecimal . ZERO ; for ( Object category : study . getCategories ( ) ) { int [ ] annotationCounts = annotationsPerCategory . get ( category ) ; for ( int m = 0 ; m < study . getRaterCou... |
public class ValidatorRESTHandler { /** * Populate JSON object for a top level exception or error .
* @ param errorInfo additional information to append to exceptions and causes
* @ param error the top level exception or error .
* @ return JSON object representing the Throwable . */
@ SuppressWarnings ( "unchecke... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "toJSONObjectForThrowable" , errorInfo , error ) ; LinkedHashMap < String , List < ? > > addedInfo = new LinkedHashMap < String , List < ? > > ( ) ; for ( Map . Entry < String , ? > entry : errorInfo . entrySet ( ) ) { O... |
public class SemaphoreBulkhead { /** * { @ inheritDoc } */
@ Override public void changeConfig ( final BulkheadConfig newConfig ) { } } | synchronized ( configChangesLock ) { int delta = newConfig . getMaxConcurrentCalls ( ) - config . getMaxConcurrentCalls ( ) ; if ( delta < 0 ) { semaphore . acquireUninterruptibly ( - delta ) ; } else if ( delta > 0 ) { semaphore . release ( delta ) ; } config = newConfig ; } |
public class BoxTableExtractor { /** * Adjusts the table column information by analyzing the coordinate information of each text pieces in the table bounday area
* @ param cc
* the number of the table column
* @ param b
* the X - axis of the left - end of the current table piece
* @ param e
* the X - axis o... | for ( int bb = 0 ; bb < cc ; bb ++ ) { float c = leftX_tableColumns [ bb ] ; float d = rightX_tableColumns [ bb ] ; if ( ( bb > 0 ) && ( bb < ( cc - 1 ) ) ) { float a = rightX_tableColumns [ bb - 1 ] ; float f = leftX_tableColumns [ bb + 1 ] ; if ( ( a < b ) && ( b <= c ) && ( d <= e ) && ( e < f ) ) { // case 1 : both... |
public class RectifyImageOps { /** * Adjust the rectification such that only pixels which overlap the original left image can be seen . For use with
* uncalibrated images with unknown baselines . Image processing is easier since only the " true " image pixels
* are visible , but information along the image border h... | ImplRectifyImageOps_F32 . allInsideLeft ( imageWidth , imageHeight , rectifyLeft , rectifyRight ) ; |
public class FinalMappings { /** * { @ inheritDoc } */
@ Override synchronized public Iterator < Map < Integer , Integer > > getIterator ( ) { } } | Iterator < Map < Integer , Integer > > iterator = mappings . iterator ( ) ; return iterator ; |
public class Migrator { /** * Loads { @ link GitHubPushTrigger . DescriptorImpl } and migrate all values
* to { @ link org . jenkinsci . plugins . github . config . GitHubPluginConfig }
* @ throws IOException if any read - save problems as it critical to work process of this plugin */
public void migrate ( ) throws... | LOGGER . debug ( "Check if GitHub Plugin needs config migration" ) ; GitHubPushTrigger . DescriptorImpl descriptor = GitHubPushTrigger . DescriptorImpl . get ( ) ; descriptor . load ( ) ; if ( isNotEmpty ( descriptor . getCredentials ( ) ) ) { LOGGER . warn ( "Migration for old GitHub Plugin credentials started" ) ; Gi... |
public class StreamMessageImpl { /** * / * ( non - Javadoc )
* @ see net . timewalker . ffmq4 . common . message . AbstractMessage # unserializeBodyFrom ( net . timewalker . ffmq4 . utils . RawDataInputStream ) */
@ Override protected void unserializeBodyFrom ( RawDataBuffer in ) { } } | int size = in . readInt ( ) ; body . ensureCapacity ( size ) ; for ( int n = 0 ; n < size ; n ++ ) { Object value = in . readGeneric ( ) ; body . add ( value ) ; } |
public class InstanceAdminClient { /** * Lists all instances in the given project .
* < p > Sample code :
* < pre > < code >
* try ( InstanceAdminClient instanceAdminClient = InstanceAdminClient . create ( ) ) {
* ProjectName parent = ProjectName . of ( " [ PROJECT ] " ) ;
* for ( Instance element : instanceA... | ListInstancesRequest request = ListInstancesRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . build ( ) ; return listInstances ( request ) ; |
public class AbstractGoogleClientRequest { /** * Create a request suitable for use against this service . */
private HttpRequest buildHttpRequest ( boolean usingHead ) throws IOException { } } | Preconditions . checkArgument ( uploader == null ) ; Preconditions . checkArgument ( ! usingHead || requestMethod . equals ( HttpMethods . GET ) ) ; String requestMethodToUse = usingHead ? HttpMethods . HEAD : requestMethod ; final HttpRequest httpRequest = getAbstractGoogleClient ( ) . getRequestFactory ( ) . buildReq... |
public class HttpSupport { /** * Redirects to given controller , action " index " without any parameters .
* @ param controllerClass controller class where to send redirect .
* @ return { @ link HttpSupport . HttpBuilder } , to accept additional information . */
protected < T extends AppController > HttpBuilder red... | return redirect ( controllerClass , new HashMap ( ) ) ; |
public class DescribeClusterSnapshotsRequest { /** * @ return */
public java . util . List < SnapshotSortingEntity > getSortingEntities ( ) { } } | if ( sortingEntities == null ) { sortingEntities = new com . amazonaws . internal . SdkInternalList < SnapshotSortingEntity > ( ) ; } return sortingEntities ; |
public class LabelGenerator { /** * Makes sure that a given label will be unique amongst a set of other labels . */
static String generateUniqueLabel ( String label , Set < String > existingLabels ) { } } | StringBuilder newLabel = new StringBuilder ( label ) ; while ( existingLabels . contains ( newLabel . toString ( ) ) ) { newLabel . append ( POSTFIX ) ; } return newLabel . toString ( ) ; |
public class AdUnit { /** * Sets the appliedLabelFrequencyCaps value for this AdUnit .
* @ param appliedLabelFrequencyCaps * The set of label frequency caps applied directly to this ad
* unit . There
* is a limit of 10 label frequency caps per ad unit . */
public void setAppliedLabelFrequencyCaps ( com . google .... | this . appliedLabelFrequencyCaps = appliedLabelFrequencyCaps ; |
public class MoveAnalysis { @ Override public void visitAssert ( Stmt . Assert stmt , Boolean consumed ) { } } | visitExpression ( stmt . getCondition ( ) , false ) ; |
public class GitHubProjectMojo { /** * Create client
* Subclasses can override to do any custom client configuration
* @ param hostname
* @ return non - null client
* @ throws MojoExecutionException */
protected GitHubClient createClient ( String hostname ) throws MojoExecutionException { } } | if ( ! hostname . contains ( "://" ) ) return new RateLimitedGitHubClient ( hostname ) ; try { URL hostUrl = new URL ( hostname ) ; return new RateLimitedGitHubClient ( hostUrl . getHost ( ) , hostUrl . getPort ( ) , hostUrl . getProtocol ( ) ) ; } catch ( MalformedURLException e ) { throw new MojoExecutionException ( ... |
public class DBFUtils { /** * Trims right spaces from string
* @ param b _ array the string
* @ return the string without right spaces */
public static byte [ ] trimRightSpaces ( byte [ ] b_array ) { } } | if ( b_array == null || b_array . length == 0 ) { return new byte [ 0 ] ; } int pos = getRightPos ( b_array ) ; int length = pos + 1 ; byte [ ] newBytes = new byte [ length ] ; System . arraycopy ( b_array , 0 , newBytes , 0 , length ) ; return newBytes ; |
public class BeaconManager { /** * Binds an Android < code > Activity < / code > or < code > Service < / code > to the < code > BeaconService < / code > . The
* < code > Activity < / code > or < code > Service < / code > must implement the < code > beaconConsumer < / code > interface so
* that it can get a callback... | if ( ! isBleAvailableOrSimulated ( ) ) { LogManager . w ( TAG , "Method invocation will be ignored." ) ; return ; } synchronized ( consumers ) { ConsumerInfo newConsumerInfo = new ConsumerInfo ( ) ; ConsumerInfo alreadyBoundConsumerInfo = consumers . putIfAbsent ( consumer , newConsumerInfo ) ; if ( alreadyBoundConsume... |
public class DepsFileParser { /** * Parses the given file and returns a list of dependency information that it
* contained .
* It uses the passed in fileContents instead of reading the file .
* @ param filePath Path to the file to parse .
* @ param fileContents The contents to parse .
* @ return A list of Dep... | return parseFileReader ( filePath , new StringReader ( fileContents ) ) ; |
public class SliceUtf8 { /** * Does the slice contain only 7 - bit ASCII characters . */
public static boolean isAscii ( Slice utf8 ) { } } | int length = utf8 . length ( ) ; int offset = 0 ; // Length rounded to 8 bytes
int length8 = length & 0x7FFF_FFF8 ; for ( ; offset < length8 ; offset += 8 ) { if ( ( utf8 . getLongUnchecked ( offset ) & TOP_MASK64 ) != 0 ) { return false ; } } // Enough bytes left for 32 bits ?
if ( offset + 4 < length ) { if ( ( utf8 ... |
public class Delivery { /** * Show / Create a DialogFragment on the provided FragmentManager with
* the given tag .
* @ see android . app . DialogFragment # show ( android . app . FragmentManager , String )
* @ param manager the fragment manager used to add the Dialog into the UI
* @ param tag the tag for the d... | mActiveMail = generateDialogFragment ( ) ; mActiveMail . show ( manager , tag ) ; |
public class LinkUtil { /** * Determines the ' final URL ' of a link to a resource by traversing along the ' redirect ' properties .
* @ param resource the addressed resource
* @ param trace the list of paths traversed before ( to detect loops in redirects )
* @ return a ' final ' path or URL ; < code > null < / ... | String finalTarget = null ; if ( resource . isValid ( ) ) { String path = resource . getPath ( ) ; if ( trace . contains ( path ) ) { // throw an exception if a loop has been detected
throw new RedirectLoopException ( trace , path ) ; } // search for redirects and resolve them . . .
String redirect = resource . getProp... |
public class PurandareFirstOrder { /** * Returns the index in the co - occurence matrix for this word . If the word
* was not previously assigned an index , this method adds one for it and
* returns that index . */
private final int getIndexFor ( String word ) { } } | Integer index = termToIndex . get ( word ) ; if ( index == null ) { synchronized ( this ) { // recheck to see if the term was added while blocking
index = termToIndex . get ( word ) ; // if another thread has not already added this word while the
// current thread was blocking waiting on the lock , then add it .
if ( i... |
public class CommercePriceListUserSegmentEntryRelLocalServiceUtil { /** * Deletes the commerce price list user segment entry rel from the database . Also notifies the appropriate model listeners .
* @ param commercePriceListUserSegmentEntryRel the commerce price list user segment entry rel
* @ return the commerce p... | return getService ( ) . deleteCommercePriceListUserSegmentEntryRel ( commercePriceListUserSegmentEntryRel ) ; |
public class AccuracyClassificationPulldownAction { /** * Fill the classification menu . */
private void fillMenu ( ) { } } | isBugItem = new MenuItem ( menu , SWT . RADIO ) ; isBugItem . setText ( "Bug" ) ; notBugItem = new MenuItem ( menu , SWT . RADIO ) ; notBugItem . setText ( "Not Bug" ) ; isBugItem . addSelectionListener ( new SelectionAdapter ( ) { /* * ( non - Javadoc )
* @ see
* org . eclipse . swt . events . SelectionAdapter # w... |
public class StatsFactory { /** * Registers a StatsTemplateLookup object with the PMI service ( WebSphere internal use only ) .
* @ param lookupClass An instance of { @ link com . ibm . wsspi . pmi . factory . StatsTemplateLookup } */
public static void registerStatsTemplateLookup ( StatsTemplateLookup lookupClass ) ... | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , new StringBuffer ( "registerStatsTemplateLookup: " ) . append ( lookupClass . getClass ( ) . getName ( ) ) . toString ( ) ) ; PerfModules . registerTemplateLookupClass ( lookupClass ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "registerStatsTemplateLookup" ) ; |
public class JsonObject { /** * 添加结果数据
* @ param key
* @ param value */
public JsonObject < V > addData ( String key , Object value ) { } } | if ( key == null ) { return this ; } if ( this . data == null ) { this . data = new HashMap < String , Object > ( ) ; } this . data . put ( key , value ) ; return this ; |
public class RestClient { /** * This method will issue a HEAD to all of the assets in massive and returns the { @ link HttpURLConnection # getHeaderFields ( ) } .
* @ return The { @ link HttpURLConnection # getHeaderFields ( ) } for the HEAD request
* @ throws IOException
* @ throws RequestFailureException if the... | HttpURLConnection connection = createHeadConnection ( "/assets" ) ; testResponseCode ( connection ) ; return connection . getHeaderFields ( ) ; |
public class TypeInference { /** * For functions that use template types , specialize the function type for the call target based
* on the call - site specific arguments . Specifically , this enables inference to set the type of
* any function literal parameters based on these inferred types . */
private boolean in... | ImmutableList < TemplateType > keys = fnType . getTemplateTypeMap ( ) . getTemplateKeys ( ) ; if ( keys . isEmpty ( ) ) { return false ; } // Try to infer the template types
Map < TemplateType , JSType > rawInferrence = inferTemplateTypesFromParameters ( fnType , n , scope ) ; Map < TemplateType , JSType > inferred = M... |
public class CachedCertDAO { /** * Pass through Cert ID Lookup
* @ param trans
* @ param ns
* @ return */
public Result < List < CertDAO . Data > > readID ( AuthzTrans trans , final String id ) { } } | return dao ( ) . readID ( trans , id ) ; |
public class DirectoryScanner { /** * Process included file .
* @ param name path of the file relative to the directory of the FileSet .
* @ param file included File . */
private void accountForIncludedFile ( String name , File file ) { } } | processIncluded ( name , file , filesIncluded , filesExcluded , filesDeselected ) ; |
public class DCEventSource { /** * This removes a specified listener for Invalidation listener . If it was not already registered
* then this call is ignored .
* @ param listener The listener to be removed . */
public void removeListener ( InvalidationListener listener ) { } } | synchronized ( hsInvalidationListeners ) { hsInvalidationListeners . remove ( listener ) ; invalidationListenerCount = hsInvalidationListeners . size ( ) ; bUpdateInvalidationListener = true ; } |
public class FeatureExpressionServiceImpl { /** * Fetch the specified expression from the cache or create it if necessary .
* @ param expressionString the expression string
* @ return the expression
* @ throws ParseException oops */
private Expression getExpression ( String expressionString ) throws ParseExceptio... | if ( ! expressionCache . containsKey ( expressionString ) ) { Expression expression ; expression = parser . parseExpression ( expressionString ) ; expressionCache . put ( expressionString , expression ) ; } return expressionCache . get ( expressionString ) ; |
public class SQLRunner { /** * Adds the where . */
private void addWhere4ObjectPrint ( final ObjectPrint _print ) { } } | final SQLWhere where = sqlSelect . getWhere ( ) ; where . addCriteria ( 0 , "ID" , Comparison . EQUAL , String . valueOf ( _print . getInstance ( ) . getId ( ) ) , Connection . AND ) ; |
public class CommonMpJwtFat { /** * Adds expectations for specific claims that we ' ll find in the JWTs that we test with .
* We check to see that the various forms of injection retrieve the claims properly
* TODO - replace jwtTokenTools
* @ param jwtTokenTools
* @ param testAppClass - the test class invoked
... | try { Expectations expectations = new Expectations ( ) ; if ( ! testAppClass . contains ( "ClaimInjection" ) || ( testAppClass . contains ( "ClaimInjection" ) && testAppClass . contains ( "RequestScoped" ) ) ) { expectations . addExpectation ( addApiOutputExpectation ( "getRawToken" , MpJwtFatConstants . MP_JWT_TOKEN ,... |
public class MediaDetails { /** * Check whether the media seems to have changed since a saved version of it was used . We ignore changes in
* free space because those probably just reflect history entries being added .
* @ param originalMedia the media details when information about it was saved
* @ return true i... | if ( ! hashKey ( ) . equals ( originalMedia . hashKey ( ) ) ) { throw new IllegalArgumentException ( "Can't compare media details with different hashKey values" ) ; } return playlistCount != originalMedia . playlistCount || trackCount != originalMedia . trackCount ; |
public class SimplifySpanBuild { /** * append multi clickable SpecialUnit or String to first ( Behind the existing BeforeContent )
* @ param specialClickableUnit SpecialClickableUnit
* @ param specialUnitOrStrings Unit Or String
* @ return */
public SimplifySpanBuild appendMultiClickableToFirst ( SpecialClickable... | processMultiClickableSpecialUnit ( true , specialClickableUnit , specialUnitOrStrings ) ; return this ; |
public class JsonObjectExpectation { /** * Verifies that the specified key is present ( if expected to be present ) or is not present ( if not expected to be present ) in
* the JSON data . */
private void verifyKeyExistenceMatchesExpectation ( JsonObject jsonDataToValidate ) { } } | boolean jsonDataContainsKey = jsonDataToValidate . containsKey ( validationKey ) ; if ( expCheckType == JsonCheckType . KEY_DOES_NOT_EXIST ) { assertFalse ( "The provided content contains a \"" + validationKey + "\" key but should not. The content to validate was: [" + jsonDataToValidate + "]." , jsonDataContainsKey ) ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.