signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class PartitionReplicaManager { /** * Checks preconditions for replica sync - if we don ' t know the owner yet , if this node is the owner or not a replica */ PartitionReplica checkAndGetPrimaryReplicaOwner ( int partitionId , int replicaIndex ) { } }
InternalPartitionImpl partition = partitionStateManager . getPartitionImpl ( partitionId ) ; PartitionReplica owner = partition . getOwnerReplicaOrNull ( ) ; if ( owner == null ) { logger . info ( "Sync replica target is null, no need to sync -> partitionId=" + partitionId + ", replicaIndex=" + replicaIndex ) ; return ...
public class TimeUUIDs { /** * Compare the embedded timestamps of the given UUIDs . This is used when it is OK to return * an equality based on timestamps alone * @ throws UnsupportedOperationException if either uuid is not a timestamp UUID */ public static int compareTimestamps ( UUID uuid1 , UUID uuid2 ) { } }
return Longs . compare ( uuid1 . timestamp ( ) , uuid2 . timestamp ( ) ) ;
public class TagsApi { /** * Creates a tag on a particular ref of the given project . * < pre > < code > GitLab Endpoint : POST / projects / : id / repository / tags < / code > < / pre > * @ param projectIdOrPath id , path of the project , or a Project instance holding the project ID or path * @ param tagName The...
return ( createTag ( projectIdOrPath , tagName , ref , null , ( String ) null ) ) ;
public class event { /** * < pre > * Use this operation to get events . * < / pre > */ public static event [ ] get ( nitro_service client ) throws Exception { } }
event resource = new event ( ) ; resource . validate ( "get" ) ; return ( event [ ] ) resource . get_resources ( client ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link TextType } * { @ code > } */ @ XmlElementDecl ( namespace = "http://www.w3.org/2005/Atom" , name = "title" , scope = SourceType . class ) public JAXBElement < TextType > createSourceTypeTitle ( TextType value ) { } }
return new JAXBElement < TextType > ( ENTRY_TYPE_TITLE_QNAME , TextType . class , SourceType . class , value ) ;
public class PlanNode { /** * Add the supplied node to the front of the list of children . * @ param child the node that should be added as the first child ; may not be null */ public void addFirstChild ( PlanNode child ) { } }
assert child != null ; this . children . addFirst ( child ) ; child . removeFromParent ( ) ; child . parent = this ;
public class NodeImpl { /** * { @ inheritDoc } */ public void restore ( Version version , String relPath , boolean removeExisting ) throws VersionException , ItemExistsException , UnsupportedRepositoryOperationException , LockException , RepositoryException , InvalidItemStateException { } }
if ( JCRPath . THIS_RELPATH . equals ( relPath ) ) { // restore at this position this . restore ( version , removeExisting ) ; } else { // restore at relPath checkValid ( ) ; if ( ! session . getAccessManager ( ) . hasPermission ( getACL ( ) , new String [ ] { PermissionType . ADD_NODE , PermissionType . SET_PROPERTY }...
public class UIInputContainer { /** * Walk the component tree branch built by the composite component and locate the input container elements . * @ return a composite object of the input container elements */ protected InputContainerElements scan ( final UIComponent component , InputContainerElements elements , final...
if ( elements == null ) { elements = new InputContainerElements ( ) ; } // NOTE we need to walk the tree ignoring rendered attribute because it ' s condition // could be based on what we discover if ( ( elements . getLabel ( ) == null ) && ( component instanceof HtmlOutputLabel ) ) { elements . setLabel ( ( HtmlOutputL...
public class SimpleCheckBoxControl { /** * Sets up event handlers for all checkboxes . */ private void setupCheckboxEventHandlers ( ) { } }
for ( int i = 0 ; i < checkboxes . size ( ) ; i ++ ) { final int j = i ; checkboxes . get ( i ) . setOnAction ( event -> { if ( checkboxes . get ( j ) . isSelected ( ) ) { field . select ( j ) ; } else { field . deselect ( j ) ; } } ) ; }
public class UserTransactionRegistryImpl { /** * Remove a provider * @ param provider The provider */ public void removeProvider ( UserTransactionProvider provider ) { } }
UserTransactionProviderImpl impl = providers . get ( provider ) ; if ( impl != null ) { delegator . removeProvider ( impl ) ; providers . remove ( provider ) ; }
public class ModifyVpcEndpointServicePermissionsRequest { /** * The Amazon Resource Names ( ARN ) of one or more principals . Permissions are granted to the principals in this * list . To grant permissions to all principals , specify an asterisk ( * ) . * @ param addAllowedPrincipals * The Amazon Resource Names (...
if ( addAllowedPrincipals == null ) { this . addAllowedPrincipals = null ; return ; } this . addAllowedPrincipals = new com . amazonaws . internal . SdkInternalList < String > ( addAllowedPrincipals ) ;
public class Primitives { /** * Converts an array of object Integer to primitives handling { @ code null } . * This method returns { @ code null } for a { @ code null } input array . * @ param a * a { @ code Integer } array , may be { @ code null } * @ param valueForNull * the value to insert if { @ code null...
if ( a == null ) { return null ; } return unbox ( a , 0 , a . length , valueForNull ) ;
public class AmazonCodeDeployAsyncClient { /** * Simplified method form for invoking the ListOnPremisesInstances operation with an AsyncHandler . * @ see # listOnPremisesInstancesAsync ( ListOnPremisesInstancesRequest , com . amazonaws . handlers . AsyncHandler ) */ @ Override public java . util . concurrent . Future...
return listOnPremisesInstancesAsync ( new ListOnPremisesInstancesRequest ( ) , asyncHandler ) ;
public class BusHandler { /** * / * ( non - Javadoc ) * @ see com . ibm . ws . sib . processor . impl . interfaces . DestinationHandler # isSendAllowed ( ) */ public boolean isSendAllowed ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "isSendAllowed" ) ; boolean sendAllowed ; if ( _sendAllowedOnTargetForeignBus . equals ( Boolean . FALSE ) ) sendAllowed = false ; else sendAllowed = _foreignDestinationDefault . isSendAllowed ( ) ; if ( TraceComponent . isA...
public class ByteBuffer { /** * method to append a part of a String * @ param str string to get part from * @ param off start index on the string * @ param len length of the sequenz to get from string * @ throws IOException */ public void append ( String str , int off , int len ) throws IOException { } }
append ( str . substring ( off , off + len ) ) ;
public class UriEscape { /** * Perform am URI query parameter ( name or value ) < strong > escape < / strong > operation * on a < tt > String < / tt > input , writing results to a < tt > Writer < / tt > . * The following are the only allowed chars in an URI query parameter ( will not be escaped ) : * < ul > * <...
if ( writer == null ) { throw new IllegalArgumentException ( "Argument 'writer' cannot be null" ) ; } if ( encoding == null ) { throw new IllegalArgumentException ( "Argument 'encoding' cannot be null" ) ; } UriEscapeUtil . escape ( new InternalStringReader ( text ) , writer , UriEscapeUtil . UriEscapeType . QUERY_PARA...
public class NotifdEventConsumer { private EventCallBackStruct getEventCallBackStruct ( String eventName ) { } }
Enumeration keys = event_callback_map . keys ( ) ; while ( keys . hasMoreElements ( ) ) { String key = ( String ) keys . nextElement ( ) ; // Notifd do not use tango host int start = key . indexOf ( '/' , "tango:// " . length ( ) ) ; String shortName = key . substring ( start + 1 ) ; if ( eventName . equalsIgnoreCase (...
public class Iterators { /** * Adds all elements in { @ code iterator } to { @ code collection } . The iterator * will be left exhausted : its { @ code hasNext ( ) } method will return * { @ code false } . * @ return { @ code true } if { @ code collection } was modified as a result of this * operation */ public...
checkNotNull ( addTo ) ; checkNotNull ( iterator ) ; boolean wasModified = false ; while ( iterator . hasNext ( ) ) { wasModified |= addTo . add ( iterator . next ( ) ) ; } return wasModified ;
public class Lexer { /** * 调用者已确定以字母或下划线开头 , 故一定可以获取到 id值 */ String scanId ( ) { } }
int idStart = forward ; while ( CharTable . isLetterOrDigit ( next ( ) ) ) { ; } return subBuf ( idStart , forward - 1 ) . toString ( ) ;
public class PerformanceCachingGoogleCloudStorage { /** * This function may return cached copies of GoogleCloudStorageItemInfo . */ @ Override public List < GoogleCloudStorageItemInfo > getItemInfos ( List < StorageResourceId > resourceIds ) throws IOException { } }
List < GoogleCloudStorageItemInfo > result = new ArrayList < > ( resourceIds . size ( ) ) ; List < StorageResourceId > request = new ArrayList < > ( resourceIds . size ( ) ) ; // Populate the result list with items in the cache , and the request list with resources that // still need to be resolved . Null items are add...
public class BeanBox { /** * This is Java configuration method equal to put a AOP annotation on method . a * AOP annotation is a kind of annotation be binded to an AOP alliance * interceptor like ctx . bind ( Tx . class , MyInterceptor . class ) ; then you can put * a @ Tx annotation on method . But this method a...
checkOrCreateMethodAops ( ) ; List < Object > aops = methodAops . get ( method ) ; if ( aops == null ) { aops = new ArrayList < Object > ( ) ; methodAops . put ( method , aops ) ; } aops . add ( BeanBoxUtils . checkAOP ( aop ) ) ; return this ;
public class Logcat { /** * Starts reading traces from the application logcat and notifying listeners if needed . */ @ Override public void run ( ) { } }
super . run ( ) ; try { process = Runtime . getRuntime ( ) . exec ( "logcat -v time" ) ; } catch ( IOException e ) { Log . e ( LOGTAG , "IOException executing logcat command." , e ) ; } readLogcat ( ) ;
public class CronTrigger { /** * Returns the next time at which the < code > CronTrigger < / code > will fire , * after the given time . If the trigger will not fire after the given time , * < code > null < / code > will be returned . * Note that the date returned is NOT validated against the related * { @ link...
Date afterTime = aAfterTime ; if ( afterTime == null ) afterTime = new Date ( ) ; if ( getStartTime ( ) . after ( afterTime ) ) { afterTime = new Date ( getStartTime ( ) . getTime ( ) - 1000l ) ; } if ( getEndTime ( ) != null && ( afterTime . compareTo ( getEndTime ( ) ) >= 0 ) ) { return null ; } final Date pot = getT...
public class RegexParser { /** * char - class : : = ' [ ' ( ' ^ ' ? range ' , ' ? ) + ' ] ' range : : = ' \ d ' | ' \ w ' | ' \ s ' | * category - block | range - char | range - char ' - ' range - char range - char : : = * ' \ [ ' | ' \ ] ' | ' \ \ ' | ' \ ' [ , - efnrtv ] | bmp - code | character - 2 bmp - code : ...
this . setContext ( S_INBRACKETS ) ; this . next ( ) ; boolean nrange = false ; RangeToken base = null ; RangeToken tok ; if ( this . read ( ) == T_CHAR && this . chardata == '^' ) { nrange = true ; this . next ( ) ; if ( useNrange ) { tok = Token . createNRange ( ) ; } else { base = Token . createRange ( ) ; base . ad...
public class JdtRecorder { /** * < pre > * Initializer : * [ static ] Block * Block : * { { Statement } } * < / pre > * @ param initializer the { @ link Initializer initializer } being recorded ( cannot be < code > null < / code > ) * @ param nodeName the name of the node being created that represents the...
final Block block = initializer . getBody ( ) ; if ( block != null ) { @ SuppressWarnings ( "unchecked" ) final List < Statement > statements = block . statements ( ) ; if ( ( statements != null ) && ! statements . isEmpty ( ) ) { final Node initializerNode = parentNode . addNode ( nodeName , ClassFileSequencerLexicon ...
public class ReservedInstancesOffering { /** * The pricing details of the Reserved Instance offering . * @ param pricingDetails * The pricing details of the Reserved Instance offering . */ public void setPricingDetails ( java . util . Collection < PricingDetail > pricingDetails ) { } }
if ( pricingDetails == null ) { this . pricingDetails = null ; return ; } this . pricingDetails = new com . amazonaws . internal . SdkInternalList < PricingDetail > ( pricingDetails ) ;
public class Dynamic { /** * Resolves this { @ link Dynamic } constant to resolve the returned instance to the supplied type . The type must be a subtype of the * bootstrap method ' s return type . Constructors cannot be resolved to a different type . * @ param typeDescription The type to resolve the bootstrapped v...
if ( typeDescription . represents ( void . class ) ) { throw new IllegalArgumentException ( "Constant value cannot represent void" ) ; } else if ( value . getBootstrapMethod ( ) . getName ( ) . equals ( MethodDescription . CONSTRUCTOR_INTERNAL_NAME ) ? ! this . typeDescription . isAssignableTo ( typeDescription ) : ( !...
public class DescribeAccountAuditConfigurationRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DescribeAccountAuditConfigurationRequest describeAccountAuditConfigurationRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( describeAccountAuditConfigurationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class HiveRegister { /** * Get an instance of { @ link HiveRegister } . * @ param props A { @ link State } object . To get a specific implementation of { @ link HiveRegister } , * specify property { @ link # HIVE _ REGISTER _ TYPE } as the class name . Otherwise , { @ link # DEFAULT _ HIVE _ REGISTER _ TYPE ...
return get ( props . getProp ( HIVE_REGISTER_TYPE , DEFAULT_HIVE_REGISTER_TYPE ) , props , metastoreURI ) ;
public class MECommsTrc { /** * Minimal trace entry for ME < - > ME comms . * Caller should check TraceComponent . isAnyTracingEnabled ( ) before calling . * @ param _ tc The caller ' s trace component * @ param operation The operation . See constants in this class . * @ param targetME The MEUUID of the target ...
// Trace if either the callers trace is enabled , or our own trace group if ( tc . isDebugEnabled ( ) || _tc . isDebugEnabled ( ) ) { StringBuilder buff = new StringBuilder ( ) ; buff . append ( "MECOMMS" ) ; try { // Append operation details buff . append ( "[" ) ; buff . append ( ( localME != null ) ? localME . getMe...
public class ClassDiscoverer { /** * Returns true if the type is a JAXBElement . In the case of JAXBElements , we want to traverse its * underlying value as opposed to the JAXBElement . * @ param type element type to test to see if its a JAXBElement * @ return true if the type is a JAXBElement */ static boolean i...
// noinspection RedundantIfStatement if ( type . fullName ( ) . startsWith ( JAXBElement . class . getName ( ) ) ) { return true ; } return false ;
public class SequenceNumber { /** * Efficiently converts a string containing a hexadecimal number from lower case to upper case */ private static String upperCaseHex ( String s ) { } }
char chars [ ] = s . toCharArray ( ) ; int length = s . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { switch ( chars [ i ] ) { case 'a' : chars [ i ] = 'A' ; break ; case 'b' : chars [ i ] = 'B' ; break ; case 'c' : chars [ i ] = 'C' ; break ; case 'd' : chars [ i ] = 'D' ; break ; case 'e' : chars [ i ] = 'E' ;...
public class FractionalPartSubstitution { /** * If in " by digits " mode , parses the string as if it were a string * of individual digits ; otherwise , uses the superclass function . * @ param text The string to parse * @ param parsePosition Ignored on entry , but updated on exit to point * to the first unmatc...
// if we ' re not in byDigits mode , we can just use the inherited // doParse ( ) if ( ! byDigits ) { return super . doParse ( text , parsePosition , baseValue , 0 , lenientParse ) ; } else { // if we ARE in byDigits mode , parse the text one digit at a time // using this substitution ' s owning rule set ( we do this b...
public class Curve { /** * compute a Catmull - Rom spline . * @ param x the input parameter * @ param numKnots the number of knots in the spline * @ param knots the array of knots * @ return the spline value */ public static float Spline ( float x , int numKnots , float [ ] knots ) { } }
int span ; int numSpans = numKnots - 3 ; float k0 , k1 , k2 , k3 ; float c0 , c1 , c2 , c3 ; if ( numSpans < 1 ) throw new IllegalArgumentException ( "Too few knots in spline" ) ; x = x > 1 ? 1 : x ; x = x < 0 ? 0 : x ; x *= numSpans ; span = ( int ) x ; if ( span > numKnots - 4 ) span = numKnots - 4 ; x -= span ; k0 =...
public class TypeUtil { /** * 获得指定类型中所有泛型参数类型 , 例如 : * < pre > * class A & lt ; T & gt ; * class B extends A & lt ; String & gt ; * < / pre > * 通过此方法 , 传入B . class即可得到String * @ param type 指定类型 * @ return 所有泛型参数类型 */ public static Type [ ] getTypeArguments ( Type type ) { } }
if ( null == type ) { return null ; } final ParameterizedType parameterizedType = toParameterizedType ( type ) ; return ( null == parameterizedType ) ? null : parameterizedType . getActualTypeArguments ( ) ;
public class BasePGPCommon { /** * read the private key from the given secret key * @ param pgpSecretKey * the secret key * @ param password * the password to unlock the private key * @ return the unlocked private key * @ throws PGPException */ protected PGPPrivateKey findPrivateKey ( PGPSecretKey pgpSecret...
LOGGER . trace ( "findPrivateKey(PGPSecretKey, String)" ) ; LOGGER . trace ( "Secret Key: {}, Password: {}" , pgpSecretKey == null ? "not set" : "set" , password == null ? "not set" : "********" ) ; PGPPrivateKey result = null ; PBESecretKeyDecryptor pbeSecretKeyDecryptor = new BcPBESecretKeyDecryptorBuilder ( new BcPG...
public class JobMarshaller { /** * Marshall the given parameter object . */ public void marshall ( Job job , ProtocolMarshaller protocolMarshaller ) { } }
if ( job == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( job . getId ( ) , ID_BINDING ) ; protocolMarshaller . marshall ( job . getData ( ) , DATA_BINDING ) ; protocolMarshaller . marshall ( job . getNonce ( ) , NONCE_BINDING ) ; protocol...
public class JMLambda { /** * Consume if true . * @ param < T > the type parameter * @ param bool the bool * @ param target the target * @ param consumer the consumer */ public static < T > void consumeIfTrue ( boolean bool , T target , Consumer < T > consumer ) { } }
if ( bool ) consumer . accept ( target ) ;
public class SetUtil { /** * set1 , set2的并集 ( 在set1或set2的对象 ) 的只读view , 不复制产生新的Set对象 . * 如果尝试写入该View会抛出UnsupportedOperationException */ public static < E > Set < E > unionView ( final Set < ? extends E > set1 , final Set < ? extends E > set2 ) { } }
return Sets . union ( set1 , set2 ) ;
public class NioUtils { /** * Convert a File into a ByteBuffer * @ param file File to be converted * @ return ByteBuffer containing the file */ public static ByteBuffer toByteBuffer ( File file ) { } }
ByteBuffer buffer = ByteBuffer . allocateDirect ( ( int ) file . length ( ) ) ; try { buffer . put ( toByteArray ( new FileInputStream ( file ) ) ) ; } catch ( IOException e ) { logger . error ( "Failed to write file to byte array: " + e . getMessage ( ) ) ; } buffer . flip ( ) ; return buffer ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link Term } { @ code > } } */ @ XmlElementDecl ( namespace = "http://schema.intuit.com/finance/v3" , name = "Term" , substitutionHeadNamespace = "http://schema.intuit.com/finance/v3" , substitutionHeadName = "IntuitObject" ...
return new JAXBElement < Term > ( _Term_QNAME , Term . class , null , value ) ;
public class GoogleMapShapeConverter { /** * Convert a { @ link Polyline } to a { @ link LineString } * @ param polyline polyline * @ param hasZ has z flag * @ param hasM has m flag * @ return line string */ public LineString toLineString ( Polyline polyline , boolean hasZ , boolean hasM ) { } }
return toLineString ( polyline . getPoints ( ) , hasZ , hasM ) ;
public class AbstractStreamOperator { /** * Creates a partitioned state handle , using the state backend configured for this task . * @ throws IllegalStateException Thrown , if the key / value state was already initialized . * @ throws Exception Thrown , if the state backend cannot create the key / value state . */...
return getPartitionedState ( VoidNamespace . INSTANCE , VoidNamespaceSerializer . INSTANCE , stateDescriptor ) ;
public class AbstractCsvAnnotationBeanReader { /** * 指定したBeanのクラスのインスタンスを作成する 。 * @ param clazz Beanのクラスタイプ 。 * @ return Beanのインスタンス 。 * @ throws SuperCsvReflectionException Beanのインスタンスの作成に失敗した場合 。 */ protected T instantiateBean ( final Class < T > clazz ) { } }
final T bean ; if ( clazz . isInterface ( ) ) { bean = BeanInterfaceProxy . createProxy ( clazz ) ; } else { try { bean = clazz . newInstance ( ) ; } catch ( InstantiationException e ) { throw new SuperCsvReflectionException ( String . format ( "error instantiating bean, check that %s has a default no-args constructor"...
public class BloomCalculations { /** * Given a maximum tolerable false positive probability , compute a Bloom * specification which will give less than the specified false positive rate , * but minimize the number of buckets per element and the number of hash * functions used . Because bandwidth ( and therefore t...
assert maxBucketsPerElement >= 1 ; assert maxBucketsPerElement <= probs . length - 1 ; int maxK = probs [ maxBucketsPerElement ] . length - 1 ; // Handle the trivial cases if ( maxFalsePosProb >= probs [ minBuckets ] [ minK ] ) { return new BloomSpecification ( 2 , optKPerBuckets [ 2 ] ) ; } if ( maxFalsePosProb < prob...
public class PublicIPAddressesInner { /** * Gets information about all public IP addresses in a virtual machine IP configuration 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 ...
ServiceResponse < Page < PublicIPAddressInner > > response = listVirtualMachineScaleSetVMPublicIPAddressesSinglePageAsync ( resourceGroupName , virtualMachineScaleSetName , virtualmachineIndex , networkInterfaceName , ipConfigurationName ) . toBlocking ( ) . single ( ) ; return new PagedList < PublicIPAddressInner > ( ...
public class Jsoup { /** * Parse HTML into a Document , using the provided Parser . You can provide an alternate parser , such as a simple XML * ( non - HTML ) parser . * @ param html HTML to parse * @ param baseUri The URL where the HTML was retrieved from . Used to resolve relative URLs to absolute URLs , that ...
return parser . parseInput ( html , baseUri ) ;
public class ParsedValues { /** * called by format processors */ void put ( ChronoElement < ? > element , int v ) { } }
int pos ; Object current ; Object [ ] keys = this . keys ; if ( keys == null ) { if ( element == PlainDate . YEAR ) { if ( this . duplicateKeysAllowed || ( this . ints [ 0 ] == Integer . MIN_VALUE ) || ( this . ints [ 0 ] == v ) ) { this . ints [ 0 ] = v ; } else { throw new AmbivalentValueException ( element ) ; } } e...
public class AbstractExtendedSet { /** * { @ inheritDoc } */ @ Override public Iterable < T > descending ( ) { } }
return new Iterable < T > ( ) { @ Override public Iterator < T > iterator ( ) { return descendingIterator ( ) ; } } ;
public class AttributesManager { /** * Retrieves current persistence attributes . If existing persistence attributes are present , they will be contained * in the returned map . If not , an empty map will be returned . Modifications to this map will not be persisted * back unless { @ link # savePersistentAttributes...
Request request = requestEnvelope . getRequest ( ) ; if ( persistenceAdapter == null ) { throw new IllegalStateException ( "Attempting to read persistence attributes without configured persistence adapter" ) ; } if ( ! persistenceAttributesSet ) { Optional < Map < String , Object > > retrievedAttributes = persistenceAd...
public class HistoryCommand { /** * Helper method to format a timestamp . * @ param timeLive * @ return */ private static String formatTimeLive ( long timeLive ) { } }
String timeString = "ms" ; timeString = ( timeLive % 1000 ) + timeString ; timeLive = timeLive / 1000 ; if ( timeLive > 0 ) { timeString = ( timeLive % 60 ) + "s" + timeString ; timeLive = timeLive / 60 ; if ( timeLive > 0 ) { timeString = ( timeLive % 60 ) + "m" + timeString ; timeLive = timeLive / 60 ; if ( timeLive ...
public class MetricContext { /** * Get a { @ link ContextAwareMeter } with a given name . * @ param name name of the { @ link ContextAwareMeter } * @ param factory a { @ link ContextAwareMetricFactory } for building { @ link ContextAwareMeter } s * @ return the { @ link ContextAwareMeter } with the given name */ ...
return this . innerMetricContext . getOrCreate ( name , factory ) ;
public class RestItemHandlerImpl { /** * Adds the content of the request as a node ( or subtree of nodes ) at the location specified by { @ code path } . * The primary type and mixin type ( s ) may optionally be specified through the { @ code jcr : primaryType } and * { @ code jcr : mixinTypes } properties . * @ ...
JsonNode requestBodyJSON = stringToJSONObject ( requestBody ) ; String parentAbsPath = parentPath ( path ) ; String newNodeName = newNodeName ( path ) ; Session session = getSession ( request , repositoryName , workspaceName ) ; Node parentNode = ( Node ) session . getItem ( parentAbsPath ) ; Node newNode = addNode ( p...
public class ExpectationMaximizationGmm_F64 { /** * For each point compute the " responsibility " for each Gaussian * @ return The sum of chi - square . Can be used to estimate the total error . */ protected double expectation ( ) { } }
double sumChiSq = 0 ; for ( int i = 0 ; i < info . size ( ) ; i ++ ) { PointInfo p = info . get ( i ) ; // identify the best cluster match and save it ' s chi - square for convergence testing double bestLikelihood = 0 ; double bestChiSq = Double . MAX_VALUE ; double total = 0 ; for ( int j = 0 ; j < mixture . size ; j ...
public class Sort { /** * Check if the short array is sorted . It loops through the entire short * array once , checking that the elements are sorted . * < br > * < br > * < i > Runtime : < / i > O ( n ) * @ param shortArray the short array to check * @ return < i > true < / i > if the short array is sorted...
for ( int i = 0 ; i < shortArray . length - 1 ; i ++ ) { if ( shortArray [ i ] > shortArray [ i + 1 ] ) { return false ; } } return true ;
public class ElasticPoolsInner { /** * Gets all elastic pools in a server . * @ 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 ; ElasticPoolInner & gt...
return listByServerNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < ElasticPoolInner > > , Page < ElasticPoolInner > > ( ) { @ Override public Page < ElasticPoolInner > call ( ServiceResponse < Page < ElasticPoolInner > > response ) { return response . body ( ) ; } } ) ;
public class ServiceLoaderModule { /** * Load services and make them available via a Set < S > binding using * multi - binding . Note that this methods loads services lazily but also * allows for additional bindings to be done via Guice modules . * @ param type */ public < S > ServiceBinder < S > bindServices ( f...
ServiceBinderImpl < S > binder = new ServiceBinderImpl < S > ( type ) ; binders . add ( binder ) ; return binder ;
public class PreambleUtil { /** * Flags */ static void insertEmptyFlag ( final WritableMemory wmem , final boolean empty ) { } }
int flags = wmem . getByte ( FLAGS_BYTE ) ; if ( empty ) { flags |= EMPTY_FLAG_MASK ; } else { flags &= ~ EMPTY_FLAG_MASK ; } wmem . putByte ( FLAGS_BYTE , ( byte ) flags ) ;
public class BaseTable { /** * Set up / do the local criteria . * This is only here to accommodate local file systems that can ' t handle * REMOTE criteria . All you have to do here to handle the remote criteria * locally is to call : return record . handleRemoteCriteria ( xx , yy ) . */ public boolean doLocalCri...
// Default BaseListener if ( this . isTable ( ) ) // For tables , do the remote criteria now return this . getRecord ( ) . handleRemoteCriteria ( strFilter , bIncludeFileName , vParamList ) ; // If can ' t handle remote else return true ; // Record okay , don ' t skip it
public class BaseStepControllerImpl { /** * The only valid states at this point are STARTED , STOPPING , or FAILED . * been able to get to STOPPED , or COMPLETED yet at this point in the code . */ private void transitionToFinalBatchStatus ( ) { } }
BatchStatus currentBatchStatus = stepContext . getBatchStatus ( ) ; if ( currentBatchStatus . equals ( BatchStatus . STARTED ) ) { updateBatchStatus ( BatchStatus . COMPLETED ) ; } else if ( currentBatchStatus . equals ( BatchStatus . STOPPING ) ) { updateBatchStatus ( BatchStatus . STOPPED ) ; } else if ( currentBatch...
public class ContextInserterWorkerImpl { /** * < p > If , after calling insertContext , an error occurs the requestFailed * method should be called . This gives the system context providers an * opportunity to react to the failure . * @ throws UnsatisfiedLinkError if the underlying list of handlers cannot be loca...
if ( _tc . isEntryEnabled ( ) ) SibTr . entry ( this , _tc , "requestFailed" ) ; // lohith liberty change // _ invoker . requestFailed ( ) ; if ( _tc . isEntryEnabled ( ) ) SibTr . exit ( this , _tc , "requestFailed" ) ;
public class TarOutputStreamImpl { /** * Put an entry on the output stream . This writes the entry ' s header record and positions the output stream for * writing the contents of the entry . Once this method is called , the stream is ready for calls to write ( ) to write * the entry ' s contents . Once the contents...
StringBuffer name = entry . getHeader ( ) . name ; // NOTE // This check is not adequate , because the maximum file length that // can be placed into a POSIX ( ustar ) header depends on the precise // locations of the path elements ( slashes ) within the file ' s full // pathname . For this reason , writeEntryHeader ( ...
public class V1OperationModel { /** * { @ inheritDoc } */ @ Override public GlobalsModel getGlobals ( ) { } }
if ( _globals == null ) { _globals = ( GlobalsModel ) getFirstChildModel ( GLOBALS ) ; } return _globals ;
public class Service { /** * Initialize this service . A warning is logged if the service has already been * initialized . This method must be called before { @ link # start ( ) } . This method * causes the service ' s state to become { @ link State # INITIALIZED } . */ public final void initialize ( ) { } }
if ( m_state . isInitialized ( ) ) { m_logger . warn ( "initialize(): Service is already initialized -- ignoring" ) ; } else { logParams ( "Initializing with the following service parameters:" ) ; this . initService ( ) ; setState ( State . INITIALIZED ) ; }
public class current_hostname { /** * Use this API to fetch filtered set of current _ hostname resources . * filter string should be in JSON format . eg : " vm _ state : DOWN , name : [ a - z ] + " */ public static current_hostname [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } }
current_hostname obj = new current_hostname ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; current_hostname [ ] response = ( current_hostname [ ] ) obj . getfiltered ( service , option ) ; return response ;
public class BloomFilter { /** * Combines this bloom filter with another bloom filter by performing a bitwise OR of the * underlying data . The mutations happen to < b > this < / b > instance . Callers must ensure the bloom * filters are appropriately sized to avoid saturating them . * @ param that The bloom filt...
N . checkArgNotNull ( that ) ; N . checkArgument ( this != that , "Cannot combine a BloomFilter with itself." ) ; N . checkArgument ( this . numHashFunctions == that . numHashFunctions , "BloomFilters must have the same number of hash functions (%s != %s)" , this . numHashFunctions , that . numHashFunctions ) ; N . che...
public class OWLDifferentIndividualsAxiomImpl_CustomFieldSerializer { /** * Deserializes the content of the object from the * { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } . * @ param streamReader the { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } t...
deserialize ( streamReader , instance ) ;
public class CmsJspTagEditable { /** * Close the direct edit tag , also prints the direct edit HTML to the current page . < p > * @ return { @ link # EVAL _ PAGE } * @ throws JspException in case something goes wrong */ @ Override public int doEndTag ( ) throws JspException { } }
if ( m_firstOnPage || m_manualPlacement ) { // only execute action for the first " editable " tag on the page ( include file ) , or in manual mode editableTagAction ( pageContext , m_provider , m_mode , m_file ) ; } if ( OpenCms . getSystemInfo ( ) . getServletContainerSettings ( ) . isReleaseTagsAfterEnd ( ) ) { // ne...
public class VMCommandLine { /** * Replies the command line including the options and the standard parameters . * @ return the command line . */ @ Pure @ SuppressWarnings ( { } }
"checkstyle:cyclomaticcomplexity" , "checkstyle:npathcomplexity" } ) public static String [ ] getAllCommandLineParameters ( ) { final int osize = commandLineOptions == null ? 0 : commandLineOptions . size ( ) ; final int psize = commandLineParameters == null ? 0 : commandLineParameters . length ; final int tsize = ( os...
public class StringToObjectConverter { /** * Returns null if a string conversion should happen */ private Object prepareForDirectUsage ( Class expectedClass , Object pArgument ) { } }
Class givenClass = pArgument . getClass ( ) ; if ( expectedClass . isArray ( ) && List . class . isAssignableFrom ( givenClass ) ) { return convertListToArray ( expectedClass , ( List ) pArgument ) ; } else { return expectedClass . isAssignableFrom ( givenClass ) ? pArgument : null ; }
public class OAuth20HandlerInterceptorAdapter { /** * Is authorization request . * @ param request the request * @ param response the response * @ return the boolean */ protected boolean isAuthorizationRequest ( final HttpServletRequest request , final HttpServletResponse response ) { } }
val requestPath = request . getRequestURI ( ) ; return doesUriMatchPattern ( requestPath , OAuth20Constants . AUTHORIZE_URL ) ;
public class SAIS { /** * / * compute SA and BWT */ private static void induceSA ( BaseArray T , int [ ] SA , BaseArray C , BaseArray B , int n , int k ) { } }
int b , i , j ; int c0 , c1 ; /* compute SAl */ if ( C == B ) { getCounts ( T , C , n , k ) ; } getBuckets ( C , B , k , false ) ; /* find starts of buckets */ j = n - 1 ; b = B . get ( c1 = T . get ( j ) ) ; SA [ b ++ ] = ( ( 0 < j ) && ( T . get ( j - 1 ) < c1 ) ) ? ~ j : j ; for ( i = 0 ; i < n ; ++ i ) { j = SA [ i...
public class Keys { /** * Returns a key for { @ code type } annotated with { @ code annotations } , * reporting failures against { @ code subject } . * @ param annotations the annotations on a single method , field or parameter . * This array may contain at most one qualifier annotation . */ public static String ...
return get ( type , extractQualifier ( annotations , subject ) ) ;
public class SmbTreeHandleImpl { /** * { @ inheritDoc } * @ see jcifs . SmbTreeHandle # getRemoteHostName ( ) */ @ Override public String getRemoteHostName ( ) { } }
try ( SmbSessionImpl session = this . treeConnection . getSession ( ) ; SmbTransportImpl transport = session . getTransport ( ) ) { return transport . getRemoteHostName ( ) ; }
public class GitCommand { /** * https : / / git - scm . com / docs / git - fetch - pack */ public void unshallow ( ConsoleOutputStreamConsumer outputStreamConsumer , Integer depth ) { } }
log ( outputStreamConsumer , "Unshallowing repository with depth %d" , depth ) ; CommandLine gitFetch = git ( environment ) . withArgs ( "fetch" , "origin" ) . withArg ( String . format ( "--depth=%d" , depth ) ) . withWorkingDir ( workingDir ) ; int result = run ( gitFetch , outputStreamConsumer ) ; if ( result != 0 )...
public class Pool { /** * - - utf encode / decode */ public static String fromUtf8 ( byte [ ] info , int ofs , int max ) { } }
StringBuilder result ; int i ; int c ; result = new StringBuilder ( max - ofs ) ; i = ofs ; while ( i < max ) { c = info [ i ] ; if ( c >= 0 ) /* same as ( c & 0x80 ) = = 0 , but more efficient */ { i += 1 ; } else { switch ( c & 0xe0 ) { case 0xc0 : // 2 bytes for 0x0000 or 0x0080 . . 0x07ff c = ( ( c & 0x1f ) << 6 ) ...
public class RobotoTypefaces { /** * Set up typeface for TextView . * @ param textView The text view * @ param fontFamily The value of " robotoFontFamily " attribute * @ param textWeight The value of " robotoTextWeight " attribute * @ param textStyle The value of " robotoTextStyle " attribute */ public static v...
setUpTypeface ( textView , obtainTypeface ( textView . getContext ( ) , fontFamily , textWeight , textStyle ) ) ;
public class TransactionJavaColonHelper { /** * { @ inheritDoc } */ @ Override public Collection < ? extends NameClassPair > listInstances ( JavaColonNamespace namespace , String nameInContext ) { } }
if ( JavaColonNamespace . COMP . equals ( namespace ) && "" . equals ( nameInContext ) ) { ArrayList < NameClassPair > retVal = new ArrayList < NameClassPair > ( ) ; if ( userTranSvcRef != null ) { NameClassPair pair = new NameClassPair ( nameInContext , EmbeddableUserTransactionImpl . class . getName ( ) ) ; retVal . ...
public class ColumnSlice { /** * Validates that the provided slice array contains only non - overlapped slices valid for a query { @ code reversed } * or not on a table using { @ code comparator } . */ public static boolean validateSlices ( ColumnSlice [ ] slices , CellNameType type , boolean reversed ) { } }
Comparator < Composite > comparator = reversed ? type . reverseComparator ( ) : type ; for ( int i = 0 ; i < slices . length ; i ++ ) { Composite start = slices [ i ] . start ; Composite finish = slices [ i ] . finish ; if ( start . isEmpty ( ) || finish . isEmpty ( ) ) { if ( start . isEmpty ( ) && i > 0 ) return fals...
public class PackageInfo { /** * The child packages of this package , or the empty list if none . * @ return the child packages , or the empty list if none . */ public PackageInfoList getChildren ( ) { } }
if ( children == null ) { return PackageInfoList . EMPTY_LIST ; } final PackageInfoList childrenSorted = new PackageInfoList ( children ) ; // Ensure children are sorted CollectionUtils . sortIfNotEmpty ( childrenSorted , new Comparator < PackageInfo > ( ) { @ Override public int compare ( final PackageInfo o1 , final ...
public class DataSourceConverter { /** * Get data source map . * @ param dataSourceConfigurationMap data source configuration map * @ return data source parameter map */ public static Map < String , YamlDataSourceParameter > getDataSourceParameterMap ( final Map < String , DataSourceConfiguration > dataSourceConfig...
Map < String , YamlDataSourceParameter > result = new LinkedHashMap < > ( dataSourceConfigurationMap . size ( ) , 1 ) ; for ( Entry < String , DataSourceConfiguration > entry : dataSourceConfigurationMap . entrySet ( ) ) { result . put ( entry . getKey ( ) , createDataSourceParameter ( entry . getValue ( ) ) ) ; } retu...
public class ManagementEnforcer { /** * removeNamedGroupingPolicy removes a role inheritance rule from the current named policy . * @ param ptype the policy type , can be " g " , " g2 " , " g3 " , . . * @ param params the " g " policy rule . * @ return succeeds or not . */ public boolean removeNamedGroupingPolicy...
return removeNamedGroupingPolicy ( ptype , Arrays . asList ( params ) ) ;
public class CmsTemplateMapperConfiguration { /** * Checks if the mapping is enabled for the given root path . < p > * @ param rootPath a VFS root path * @ return true if the configuration is enabled for the given root path */ public boolean isEnabledForPath ( String rootPath ) { } }
for ( String path : m_paths ) { if ( CmsStringUtil . isPrefixPath ( path , rootPath ) ) { return true ; } } return false ;
public class SnowflakeConnectionV1 { /** * Sets the transaction isolation level . * @ param level transaction level : TRANSACTION _ NONE or TRANSACTION _ READ _ COMMITTED * @ throws SQLException if any SQL error occurs */ @ Override public void setTransactionIsolation ( int level ) throws SQLException { } }
logger . debug ( "void setTransactionIsolation(int level), level = {}" , level ) ; raiseSQLExceptionIfConnectionIsClosed ( ) ; if ( level == Connection . TRANSACTION_NONE || level == Connection . TRANSACTION_READ_COMMITTED ) { this . transactionIsolation = level ; } else { throw new SQLFeatureNotSupportedException ( "T...
public class IntPriorityQueue { /** * Sets the given index to use the specific value * @ param e the value to store the index of * @ param i the index of the value */ private void indexArrayStore ( int e , int i ) { } }
if ( valueIndexStore . length < e ) { int oldLength = valueIndexStore . length ; valueIndexStore = Arrays . copyOf ( valueIndexStore , e + 2 ) ; Arrays . fill ( valueIndexStore , oldLength , valueIndexStore . length , - 1 ) ; } valueIndexStore [ e ] = i ;
public class MetricReader { /** * Reads the metrics from the { @ link MetricProducerManager } and exports them to the { @ code * metricExporter } . * @ param metricExporter the exporter called to export the metrics read . * @ since 0.19 */ public void readAndExport ( MetricExporter metricExporter ) { } }
Span span = tracer . spanBuilder ( spanName ) . setRecordEvents ( true ) . setSampler ( probabilitySampler ) . startSpan ( ) ; Scope scope = tracer . withSpan ( span ) ; try { ArrayList < Metric > metricsList = new ArrayList < > ( ) ; for ( MetricProducer metricProducer : metricProducerManager . getAllMetricProducer ( ...
public class XBELValidator { /** * { @ inheritDoc } */ @ Override public List < SAXParseException > validateWithErrors ( final File f ) throws SAXException , IOException { } }
final Validator errorValidator = createNewErrorValidator ( ) ; errorValidator . validate ( utf8SourceForFile ( f ) , null ) ; return ( ( Handler ) errorValidator . getErrorHandler ( ) ) . exceptions ;
public class ConstantListIndex { /** * implements the visitor to find accesses to lists or arrays using Const * @ param seen * the currently visitor opcode */ @ Override public void sawOpcode ( int seen ) { } }
try { stack . precomputation ( this ) ; switch ( state ) { case SAW_NOTHING : if ( seen == Const . ICONST_0 ) { state = State . SAW_CONSTANT_0 ; } else if ( ( seen >= Const . ICONST_1 ) && ( seen <= Const . ICONST_5 ) ) { state = State . SAW_CONSTANT ; } else if ( ( seen == Const . LDC ) || ( seen == Const . LDC_W ) ) ...
public class Reporter { /** * Formats the response parameters to be ' prettily ' printed out in HTML * @ param response - the http response to be formatted . * @ return String : a ' prettily ' formatted string that is HTML safe to output */ public static String formatResponse ( Response response ) { } }
if ( response == null ) { return "" ; } StringBuilder output = new StringBuilder ( ) ; if ( response . isData ( ) ) { output . append ( DIV_I ) ; Gson gson = new GsonBuilder ( ) . setPrettyPrinting ( ) . create ( ) ; if ( response . getArrayData ( ) != null ) { output . append ( gson . toJson ( response . getArrayData ...
public class CodeBuilder { /** * invocation style instructions */ public void invokeVirtual ( String methodName , TypeDesc ret , TypeDesc [ ] params ) { } }
invokeVirtual ( mClassFile . getClassName ( ) , methodName , ret , params ) ;
public class JSONArray { /** * Put or replace a String value in the JSONArray . If the index is greater * than the length of the JSONArray , then null elements will be added as * necessary to pad it out . < br > * The string may be a valid JSON formatted string , in tha case , it will be * transformed to a JSON...
if ( index < 0 ) { throw new JSONException ( "JSONArray[" + index + "] not found." ) ; } if ( index < size ( ) ) { if ( value == null ) { this . elements . set ( index , "" ) ; } else if ( JSONUtils . mayBeJSON ( value ) ) { try { this . elements . set ( index , JSONSerializer . toJSON ( value , jsonConfig ) ) ; } catc...
public class OtpErlangBitstr { /** * Get the size in whole bytes of the bitstr , rest bits in the last byte not * counted . * @ return the number of bytes contained in the bintstr . */ public int size ( ) { } }
if ( pad_bits == 0 ) { return bin . length ; } if ( bin . length == 0 ) { throw new java . lang . IllegalStateException ( "Impossible length" ) ; } return bin . length - 1 ;
public class MiniJPEContentHandler { /** * { @ inheritDoc } */ public Object addXToPoint ( double x , Object point ) { } }
( ( Point ) point ) . setX ( x ) ; return point ;
public class ApplicationGatewaysInner { /** * Lists all available web application firewall rule sets . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture ...
return ServiceFuture . fromResponse ( listAvailableWafRuleSetsWithServiceResponseAsync ( ) , serviceCallback ) ;
public class ContextRegisteringPolicyEnforcementPoint { /** * / * ( non - Javadoc ) * @ see org . fcrepo . server . security . PolicyEnforcementPoint # enforce ( java . lang . String , java . lang . String , java . lang . String , java . lang . String , java . lang . String , org . fcrepo . server . Context ) */ @ Su...
boolean debug = logger . isDebugEnabled ( ) ; long enforceStartTime = debug ? System . currentTimeMillis ( ) : 0 ; try { synchronized ( this ) { // wait , if pdp update is in progress } if ( ENFORCE_MODE_PERMIT_ALL_REQUESTS . equals ( m_enforceMode ) ) { logger . debug ( "permitting request because enforceMode==ENFORCE...
public class TrainingsImpl { /** * Get region proposals for an image . Returns empty array if no proposals are found . * This API will get region proposals for an image along with confidences for the region . It returns an empty array if no proposals are found . * @ param projectId The project id * @ param imageI...
return ServiceFuture . fromResponse ( getImageRegionProposalsWithServiceResponseAsync ( projectId , imageId ) , serviceCallback ) ;
public class TreeElement { /** * Remove the child node ( and all children of that child ) at the * specified position in the child list . If there are no children * or the specified child position is too large , then this method * just returns . ( I . e . no runtime exception if the offset argument * is too lar...
if ( _children == null || offset >= _children . size ( ) ) return ; TreeElement child = ( TreeElement ) _children . remove ( offset ) ; child . setParent ( null ) ; child . setName ( null ) ; // Rename all affected children int size = _children . size ( ) ; for ( int i = offset ; i < size ; i ++ ) { TreeElement thisChi...
public class BaseHolder { /** * Find the key for this BaseHolder */ public String find ( BaseHolder baseHolder ) { } }
if ( m_mapChildHolders == null ) return null ; return m_mapChildHolders . find ( baseHolder ) ;
public class Environment { /** * Get the Environment properties object . * @ param strPropertyCode The key I ' m looking for the owner to . * @ return The owner of this property key . */ public PropertyOwner retrieveUserProperties ( String strRegistrationKey ) { } }
if ( this . getDefaultApplication ( ) != null ) if ( this . getDefaultApplication ( ) != null ) return this . getDefaultApplication ( ) . retrieveUserProperties ( strRegistrationKey ) ; return null ;
public class VMInfo { /** * 创建JMX连接并构造VMInfo实例 */ public static VMInfo processNewVM ( String pid , String jmxHostAndPort ) { } }
try { final JmxClient jmxClient = new JmxClient ( ) ; jmxClient . connect ( pid , jmxHostAndPort ) ; // 注册JMXClient注销的钩子 Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( new Runnable ( ) { @ Override public void run ( ) { jmxClient . disconnect ( ) ; } } ) ) ; return new VMInfo ( jmxClient , pid ) ; } catch ( ...