signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class Descriptives { /** * Calculates Standard Error of Mean under SRS * @ param flatDataCollection * @ return */ public static double meanSE ( FlatDataCollection flatDataCollection ) { } }
double std = std ( flatDataCollection , true ) ; double meanSE = std / Math . sqrt ( count ( flatDataCollection ) ) ; return meanSE ;
public class DialogWrapper { /** * ( non - Javadoc ) * @ see javax . sip . Dialog # terminateOnBye ( boolean ) */ public void terminateOnBye ( boolean arg0 ) throws SipException { } }
this . terminateOnByeCached = arg0 ; if ( wrappedDialog != null ) { wrappedDialog . terminateOnBye ( arg0 ) ; }
public class JdbcRegistry { /** * Removes all of the api contracts from the database . * @ param client * @ param connection * @ throws SQLException */ protected void unregisterApiContracts ( Client client , Connection connection ) throws SQLException { } }
QueryRunner run = new QueryRunner ( ) ; run . update ( connection , "DELETE FROM contracts WHERE client_org_id = ? AND client_id = ? AND client_version = ?" , // $ NON - NLS - 1 $ client . getOrganizationId ( ) , client . getClientId ( ) , client . getVersion ( ) ) ;
public class VersionParser { /** * Checks for empty identifiers in the pre - release version or build metadata . * @ throws ParseException * if the pre - release version or build metadata have empty identifier ( s ) */ private void checkForEmptyIdentifier ( ) { } }
Character la = chars . lookahead ( 1 ) ; if ( CharType . DOT . isMatchedBy ( la ) || CharType . PLUS . isMatchedBy ( la ) || CharType . EOL . isMatchedBy ( la ) ) { throw new ParseException ( "Identifiers MUST NOT be empty" , new UnexpectedCharacterException ( la , chars . currentOffset ( ) , CharType . DIGIT , CharTyp...
public class XCollectionLiteralImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case XbasePackage . XCOLLECTION_LITERAL__ELEMENTS : return elements != null && ! elements . isEmpty ( ) ; } return super . eIsSet ( featureID ) ;
public class DefaultConnectionManager { /** * { @ inheritDoc } * @ see jp . co . future . uroborosql . connection . ConnectionManager # commit ( ) */ @ Override public void commit ( ) { } }
if ( conn != null ) { try { conn . commit ( ) ; } catch ( SQLException e ) { throw new UroborosqlSQLException ( e ) ; } }
public class PatternsImpl { /** * Returns an application version ' s patterns . * @ param appId The application ID . * @ param versionId The version ID . * @ param getPatternsOptionalParameter the object representing the optional parameters to be set before calling this API * @ param serviceCallback the async S...
return ServiceFuture . fromResponse ( getPatternsWithServiceResponseAsync ( appId , versionId , getPatternsOptionalParameter ) , serviceCallback ) ;
public class JDBCCallableStatement { /** * # ifdef JAVA6 */ public synchronized void setNCharacterStream ( String parameterName , Reader value ) throws SQLException { } }
super . setNCharacterStream ( findParameterIndex ( parameterName ) , value ) ;
public class Task { /** * Clones this task to a new one . If you don ' t specify a clone strategy through { @ link # TASK _ CLONER } the new task is * instantiated via reflection and { @ link # copyTo ( Task ) } is invoked . * @ return the cloned task * @ throws TaskCloneException if the task cannot be successful...
if ( TASK_CLONER != null ) { try { return TASK_CLONER . cloneTask ( this ) ; } catch ( Throwable t ) { throw new TaskCloneException ( t ) ; } } try { Task < E > clone = copyTo ( ClassReflection . newInstance ( this . getClass ( ) ) ) ; clone . guard = guard == null ? null : guard . cloneTask ( ) ; return clone ; } catc...
public class HELM1Utils { /** * method has to be changed ! ! ! including smiles - > to generate canonical * representation ; this method has to be tested in further detail */ private static Map < String , String > findAdHocMonomers ( String elements , String type ) throws HELM1FormatException , ValidationException , ...
/* find adHocMonomers */ try { Map < String , String > listMatches = new HashMap < String , String > ( ) ; String [ ] listelements = elements . split ( "\\." ) ; if ( type == "RNA" ) { for ( String element : listelements ) { List < String > monomerIds ; monomerIds = NucleotideParser . getMonomerIDListFromNucleotide ( e...
public class AsmUtils { /** * Checks if two { @ link LdcInsnNode } are equals . * @ param insn1 the insn1 * @ param insn2 the insn2 * @ return true , if successful */ public static boolean ldcInsnEqual ( LdcInsnNode insn1 , LdcInsnNode insn2 ) { } }
if ( insn1 . cst . equals ( "~" ) || insn2 . cst . equals ( "~" ) ) return true ; return insn1 . cst . equals ( insn2 . cst ) ;
public class OutputProperties { /** * Searches for the list of qname properties with the specified key in * the property list . * If the key is not found in this property list , the default property list , * and its defaults , recursively , are then checked . The method returns * < code > null < / code > if the...
String s = props . getProperty ( key ) ; if ( null != s ) { Vector v = new Vector ( ) ; int l = s . length ( ) ; boolean inCurly = false ; FastStringBuffer buf = new FastStringBuffer ( ) ; // parse through string , breaking on whitespaces . I do this instead // of a tokenizer so I can track whitespace inside of curly b...
public class FileWindow { /** * Selects a range of characters . */ public void select ( int start , int end ) { } }
int docEnd = textArea . getDocument ( ) . getLength ( ) ; textArea . select ( docEnd , docEnd ) ; textArea . select ( start , end ) ;
public class P4_InsertOrUpdateOp { /** * 判断对象是否有主键值 , 必须全部有才返回true */ private < T > boolean isWithKey ( T t , List < Field > fields ) { } }
if ( t == null || fields == null || fields . isEmpty ( ) ) { return false ; } List < Field > keyFields = DOInfoReader . getKeyColumns ( t . getClass ( ) ) ; if ( keyFields . isEmpty ( ) ) { return false ; } for ( Field keyField : keyFields ) { if ( DOInfoReader . getValue ( keyField , t ) == null ) { return false ; } }...
public class authenticationtacacspolicy_authenticationvserver_binding { /** * Use this API to fetch authenticationtacacspolicy _ authenticationvserver _ binding resources of given name . */ public static authenticationtacacspolicy_authenticationvserver_binding [ ] get ( nitro_service service , String name ) throws Exce...
authenticationtacacspolicy_authenticationvserver_binding obj = new authenticationtacacspolicy_authenticationvserver_binding ( ) ; obj . set_name ( name ) ; authenticationtacacspolicy_authenticationvserver_binding response [ ] = ( authenticationtacacspolicy_authenticationvserver_binding [ ] ) obj . get_resources ( servi...
public class TableMetaReader { /** * テーブルメタデータを読み取ります 。 * @ return テーブルメタデータ */ public List < TableMeta > read ( ) { } }
Connection con = JdbcUtil . getConnection ( dataSource ) ; try { DatabaseMetaData metaData = con . getMetaData ( ) ; List < TableMeta > tableMetas = getTableMetas ( metaData , schemaName != null ? schemaName : getDefaultSchemaName ( metaData ) ) ; for ( TableMeta tableMeta : tableMetas ) { Set < String > primaryKeySet ...
public class BiddableAdGroupCriterion { /** * Sets the firstPageCpc value for this BiddableAdGroupCriterion . * @ param firstPageCpc * First page Cpc for this criterion . * < span class = " constraint ReadOnly " > This field is * read only and will be ignored when sent to the API . < / span > */ public void setFi...
this . firstPageCpc = firstPageCpc ;
public class GlobusGSSManagerImpl { /** * Currently not implemented . */ public GSSName createName ( byte name [ ] , Oid nameType , Oid mech ) throws GSSException { } }
throw new GSSException ( GSSException . UNAVAILABLE ) ;
public class TwiML { /** * Convert TwiML object to XML . * @ return XML string of TwiML object * @ throws TwiMLException if cannot generate XML */ public String toXml ( ) throws TwiMLException { } }
try { Document doc = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) . newDocument ( ) ; doc . setXmlStandalone ( true ) ; doc . appendChild ( this . buildXmlElement ( doc ) ) ; Transformer transformer = TransformerFactory . newInstance ( ) . newTransformer ( ) ; transformer . setOutputProperty ( Outp...
public class ApplicationOperations { /** * Gets information about the specified application . * @ param applicationId The ID of the application to get . * @ param additionalBehaviors A collection of { @ link BatchClientBehavior } instances that are applied to the Batch service request . * @ return An { @ link App...
ApplicationGetOptions options = new ApplicationGetOptions ( ) ; BehaviorManager bhMgr = new BehaviorManager ( this . customBehaviors ( ) , additionalBehaviors ) ; bhMgr . applyRequestBehaviors ( options ) ; return this . parentBatchClient . protocolLayer ( ) . applications ( ) . get ( applicationId , options ) ;
public class LongRunningJobManager { /** * End a job . * @ param sJobID * The internal long running job ID created from * { @ link # onStartJob ( ILongRunningJob , String ) } . * @ param eExecSucess * Was the job execution successful or not from a technical point of * view ? May not be < code > null < / cod...
ValueEnforcer . notNull ( eExecSucess , "ExecSuccess" ) ; ValueEnforcer . notNull ( aResult , "Result" ) ; // Remove from running job list final LongRunningJobData aJobData = m_aRWLock . writeLocked ( ( ) -> { final LongRunningJobData ret = m_aRunningJobs . remove ( sJobID ) ; if ( ret == null ) throw new IllegalArgume...
public class MediaTypes { /** * Ctor . * @ param text Text to parse * @ return List of media types */ @ SuppressWarnings ( "PMD.AvoidInstantiatingObjectsInLoops" ) private static SortedSet < MediaType > parse ( final String text ) { } }
final SortedSet < MediaType > list = new TreeSet < > ( ) ; for ( final String name : new EnglishLowerCase ( text ) . string ( ) . split ( "," ) ) { if ( ! name . isEmpty ( ) ) { list . add ( new MediaType ( name ) ) ; } } return list ;
public class InteropFramework { /** * Reads a document from a file , using the format to decide which parser to read the file with . * @ param filename the file to read a document from * @ param format the format of the file * @ return a Document */ public Document readDocumentFromFile ( String filename , ProvFor...
try { switch ( format ) { case DOT : case JPEG : case PNG : case SVG : throw new UnsupportedOperationException ( ) ; // we don ' t load PROV // from these // formats case JSON : { return new org . openprovenance . prov . json . Converter ( pFactory ) . readDocument ( filename ) ; } case PROVN : { Utility u = new Utilit...
public class Caster { /** * cast a Object to a int value ( primitive value type ) * @ param o Object to cast * @ return casted int value * @ throws PageException */ public static int toIntValue ( Object o ) throws PageException { } }
if ( o instanceof Number ) return ( ( Number ) o ) . intValue ( ) ; else if ( o instanceof Boolean ) return ( ( Boolean ) o ) . booleanValue ( ) ? 1 : 0 ; else if ( o instanceof CharSequence ) return toIntValue ( o . toString ( ) . trim ( ) ) ; else if ( o instanceof Character ) return ( int ) ( ( ( Character ) o ) . c...
public class Route { /** * Return { @ code true } if all route properties are { @ code null } or empty . * @ return { @ code true } if all route properties are { @ code null } or empty */ public boolean isEmpty ( ) { } }
return _name == null && _comment == null && _description == null && _source == null && _links . isEmpty ( ) && _number == null && _points . isEmpty ( ) ;
public class MergeRequestApi { /** * Get all merge requests matching the filter . * < pre > < code > GitLab Endpoint : GET / merge _ requests < / code > < / pre > * @ param filter a MergeRequestFilter instance with the filter settings * @ return all merge requests for the specified project matching the filter *...
return ( getMergeRequests ( filter , getDefaultPerPage ( ) ) . all ( ) ) ;
public class NotifdEventConsumer { private void connectToNotificationDaemon ( DbEventImportInfo received ) throws DevFailed { } }
boolean channel_exported = received . channel_exported ; if ( channel_exported ) { org . omg . CORBA . Object event_channel_obj = orb . string_to_object ( received . channel_ior ) ; try { eventChannel = EventChannelHelper . narrow ( event_channel_obj ) ; // Set timeout on eventChannel final org . omg . CORBA . Policy p...
public class H2O { /** * Print help about command line arguments . */ public static void printHelp ( ) { } }
String defaultFlowDirMessage ; if ( DEFAULT_FLOW_DIR ( ) == null ) { // If you start h2o on Hadoop , you must set - flow _ dir . // H2O doesn ' t know how to guess a good one . // user . home doesn ' t make sense . defaultFlowDirMessage = " (The default is none; saving flows not available.)\n" ; } else { defau...
public class DatastoreSnippets { /** * [ VARIABLE " my _ key _ name2 " ] */ public void batchAddEntities ( String keyName1 , String keyName2 ) { } }
// [ START batchAddEntities ] Key key1 = datastore . newKeyFactory ( ) . setKind ( "MyKind" ) . newKey ( keyName1 ) ; Entity . Builder entityBuilder1 = Entity . newBuilder ( key1 ) ; entityBuilder1 . set ( "propertyName" , "value1" ) ; Entity entity1 = entityBuilder1 . build ( ) ; Key key2 = datastore . newKeyFactory (...
public class BeanReferenceInspector { /** * Reserves to bean reference inspection . * @ param beanId the bean id * @ param beanClass the bean class * @ param referenceable the object to be inspected * @ param ruleAppender the rule appender */ public void reserve ( String beanId , Class < ? > beanClass , BeanRef...
RefererKey key = new RefererKey ( beanClass , beanId ) ; Set < RefererInfo > refererInfoSet = refererInfoMap . get ( key ) ; if ( refererInfoSet == null ) { refererInfoSet = new LinkedHashSet < > ( ) ; refererInfoSet . add ( new RefererInfo ( referenceable , ruleAppender ) ) ; refererInfoMap . put ( key , refererInfoSe...
public class Names { /** * Subscription names must be lowercase ASCII strings . between 1 and 255 characters in length . Whitespace , ISO * control characters and certain punctuation characters that aren ' t generally allowed in file names or in * elasticsearch index names are excluded ( elasticsearch appears to al...
return subscription != null && subscription . length ( ) > 0 && subscription . length ( ) <= 255 && ! ( subscription . charAt ( 0 ) == '_' && ! subscription . startsWith ( "__" ) ) && ! ( subscription . charAt ( 0 ) == '.' && ( "." . equals ( subscription ) || ".." . equals ( subscription ) ) ) && SUBSCRIPTION_NAME_ALL...
public class ControllersInner { /** * Lists connection details for an Azure Dev Spaces Controller . * Lists connection details for the underlying container resources of an Azure Dev Spaces Controller . * @ param resourceGroupName Resource group to which the resource belongs . * @ param name Name of the resource ....
if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( name ==...
public class CountryCodes { /** * Returns the IBAN length for a given country code . * @ param countryCode a non - null , uppercase , two - character country code . * @ return the IBAN length for the given country , or - 1 if the input is not a known , two - character country code . * @ throws NullPointerExceptio...
int index = indexOf ( countryCode ) ; if ( index > - 1 ) { return CountryCodes . COUNTRY_IBAN_LENGTHS [ index ] & REMOVE_SEPA_MASK ; } return - 1 ;
public class JideApplicationPage { /** * This sets the visible flag on all show view commands that * are registered with the command manager . If the page contains * the view the command is visible , otherwise not . The registration * of the show view command with the command manager is the * responsibility of ...
ViewDescriptorRegistry viewDescriptorRegistry = ValkyrieRepository . getInstance ( ) . getApplicationConfig ( ) . viewDescriptorRegistry ( ) ; ViewDescriptor [ ] views = viewDescriptorRegistry . getViewDescriptors ( ) ; for ( ViewDescriptor view : views ) { String id = view . getId ( ) ; CommandManager commandManager =...
public class BigRational { /** * Returns the largest of the specified rational numbers . * @ param values the rational numbers to compare * @ return the largest rational number , 0 if no numbers are specified * @ see # max ( BigRational ) */ public static BigRational max ( BigRational ... values ) { } }
if ( values . length == 0 ) { return BigRational . ZERO ; } BigRational result = values [ 0 ] ; for ( int i = 1 ; i < values . length ; i ++ ) { result = result . max ( values [ i ] ) ; } return result ;
public class EmbeddedNeo4jEntityQueries { /** * Creates the node corresponding to an entity . * @ param executionEngine the { @ link GraphDatabaseService } used to run the query * @ param columnValues the values in { @ link org . hibernate . ogm . model . key . spi . EntityKey # getColumnValues ( ) } * @ return t...
Map < String , Object > params = params ( columnValues ) ; Result result = executionEngine . execute ( getCreateEntityQuery ( ) , params ) ; return singleResult ( result ) ;
public class AbstractIntSet { /** * { @ inheritDoc } */ @ Override public int compareTo ( IntSet o ) { } }
IntIterator thisIterator = this . descendingIterator ( ) ; IntIterator otherIterator = o . descendingIterator ( ) ; while ( thisIterator . hasNext ( ) && otherIterator . hasNext ( ) ) { int thisItem = thisIterator . next ( ) ; int otherItem = otherIterator . next ( ) ; if ( thisItem < otherItem ) return - 1 ; if ( this...
public class JsHdrsImpl { /** * Get the value of the Priority field from the message header . * Javadoc description supplied by SIBusMessage interface . */ public final Integer getPriority ( ) { } }
// If the transient is not set , get the int value from the message and cache it . if ( cachedPriority == null ) { cachedPriority = ( Integer ) getHdr2 ( ) . getField ( JsHdr2Access . PRIORITY ) ; } // Return the ( possibly newly ) cached value return cachedPriority ;
public class Case2Cases { /** * Matches a case class of two elements . * < p > If matched , the { @ code b } value is decomposed to 0. */ public static < T extends Case2 < A , B > , A , B , EB extends B > DecomposableMatchBuilder0 < T > case2 ( Class < T > clazz , MatchesExact < A > a , DecomposableMatchBuilder0 < EB...
List < Matcher < Object > > matchers = Lists . of ( ArgumentMatchers . eq ( a . t ) , ArgumentMatchers . any ( ) ) ; return new DecomposableMatchBuilder1 < T , EB > ( matchers , 1 , new Case2FieldExtractor < > ( clazz ) ) . decomposeFirst ( b ) ;
public class JSRemoteConsumerPoint { /** * / * ( non - Javadoc ) * @ see com . ibm . ws . sib . processor . impl . interfaces . ConsumerPoint # destinationMatches ( com . ibm . ws . sib . processor . impl . interfaces . DestinationHandler ) */ public boolean destinationMatches ( DestinationHandler destinationHandlerT...
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "destinationMatches" , new Object [ ] { destinationHandlerToCompare , consumerDispatcher } ) ; // For remote get , at the destination localising ME , the destination attached // to is never an alias as the alias resolution i...
public class JSConsumerSet { /** * Commit the adding of the active message ( remember , this is nothing to * do with the committing of the delete of the message ) . * We will have held the maxActiveMessagePrepareLock since the prepare * of the add until this method ( or a rollback ) */ public void commitAddActive...
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "commitAddActiveMessage" ) ; // Lock the active message counter lock synchronized ( maxActiveMessageLock ) { // Move the prepared add to the real count currentActiveMessages ++ ; preparedActiveMessages -- ; if ( Trace...
public class Options { /** * Add an option that only contains a short name . * The option does not take an argument . * @ param opt Short single - character name of the option . * @ param description Self - documenting description * @ return the resulting Options instance * @ since 1.3 */ public Options addOp...
addOption ( opt , null , false , description ) ; return this ;
public class SecuritySchemeValidator { /** * { @ inheritDoc } */ @ Override public void validate ( ValidationHelper helper , Context context , String key , SecurityScheme t ) { } }
String reference = t . getRef ( ) ; if ( reference != null && ! reference . isEmpty ( ) ) { ValidatorUtils . referenceValidatorHelper ( reference , t , helper , context , key ) ; return ; } Optional < ValidationEvent > op_type = ValidatorUtils . validateRequiredField ( t . getType ( ) , context , "type" ) ; if ( op_typ...
public class AlgorithmParameters { /** * Initializes this parameter object using the parameters * specified in { @ code paramSpec } . * @ param paramSpec the parameter specification . * @ exception InvalidParameterSpecException if the given parameter * specification is inappropriate for the initialization of th...
if ( this . initialized ) throw new InvalidParameterSpecException ( "already initialized" ) ; paramSpi . engineInit ( paramSpec ) ; this . initialized = true ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcInventory ( ) { } }
if ( ifcInventoryEClass == null ) { ifcInventoryEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 281 ) ; } return ifcInventoryEClass ;
public class HostProcess { /** * Gets the count of requests sent ( and received ) by all { @ code Plugin } s and the { @ code Analyser } . * @ return the count of request sent * @ since 2.5.0 * @ see # getPluginRequestCount ( int ) * @ see # getAnalyser ( ) */ public int getRequestCount ( ) { } }
synchronized ( mapPluginStats ) { int count = requestCount + getAnalyser ( ) . getRequestCount ( ) ; for ( PluginStats stats : mapPluginStats . values ( ) ) { count += stats . getMessageCount ( ) ; } return count ; }
public class MediaClient { /** * Creates a new transcoder job which converts media files in BOS buckets with specified preset . * @ param pipelineName The name of pipeline used by this job . * @ param clips The keys of the source media file in the bucket specified in the pipeline . * @ param targetKey The key of ...
return createTranscodingJob ( pipelineName , clips , targetKey , presetName , null , null ) ;
public class JNDIResourceService { /** * Associate a type with the given resource model . */ public void associateTypeJndiResource ( JNDIResourceModel resource , String type ) { } }
if ( type == null || resource == null ) { return ; } if ( StringUtils . equals ( type , "javax.sql.DataSource" ) && ! ( resource instanceof DataSourceModel ) ) { DataSourceModel ds = GraphService . addTypeToModel ( this . getGraphContext ( ) , resource , DataSourceModel . class ) ; } else if ( StringUtils . equals ( ty...
public class AmazonCloudFrontClient { /** * Delete a streaming distribution . To delete an RTMP distribution using the CloudFront API , perform the following * steps . * < b > To delete an RTMP distribution using the CloudFront API < / b > : * < ol > * < li > * Disable the RTMP distribution . * < / li > *...
request = beforeClientExecution ( request ) ; return executeDeleteStreamingDistribution ( request ) ;
public class filterhtmlinjectionvariable { /** * Use this API to fetch filtered set of filterhtmlinjectionvariable resources . * filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */ public static filterhtmlinjectionvariable [ ] get_filtered ( nitro_service service , String filter ) th...
filterhtmlinjectionvariable obj = new filterhtmlinjectionvariable ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; filterhtmlinjectionvariable [ ] response = ( filterhtmlinjectionvariable [ ] ) obj . getfiltered ( service , option ) ; return response ;
public class EncodedGradientsAccumulator { /** * This method applies accumulated updates via given StepFunction * @ param function * @ param params */ @ Override public void applyUpdate ( StepFunction function , INDArray params , INDArray updates , boolean isFinalStep ) { } }
if ( updatesApplied . get ( ) == null ) updatesApplied . set ( new AtomicLong ( 0 ) ) ; try { // nullify given updates first Nd4j . getMemoryManager ( ) . memset ( updates ) ; // updates . assign ( 0.0 ) ; int cnt = 0 ; while ( ! messages . get ( index . get ( ) ) . isEmpty ( ) ) { INDArray compressed = messages . get ...
public class GradientEditor { /** * Check if there is a control point at the specified mouse location * @ param mx The mouse x coordinate * @ param my The mouse y coordinate * @ param pt The point to check agianst * @ return True if the mouse point conincides with the control point */ private boolean checkPoint...
int dx = ( int ) Math . abs ( ( 10 + ( width * pt . pos ) ) - mx ) ; int dy = Math . abs ( ( y + barHeight + 7 ) - my ) ; if ( ( dx < 5 ) && ( dy < 7 ) ) { return true ; } return false ;
public class PropsVectors { /** * Compact the vectors : * - modify the memory * - keep only unique vectors * - store them contiguously from the beginning of the memory * - for each ( non - unique ) row , call the respective function in * CompactHandler * The handler ' s rowIndex is the index of the row in t...
if ( isCompacted ) { return ; } // Set the flag now : Sorting and compacting destroys the builder // data structure . isCompacted = true ; int valueColumns = columns - 2 ; // not counting start & limit // sort the properties vectors to find unique vector values Integer [ ] indexArray = new Integer [ rows ] ; for ( int ...
public class BasicUserProfile { /** * Build a profile from user identifier and attributes . * @ param id user identifier * @ param attributes user attributes */ public void build ( final Object id , final Map < String , Object > attributes ) { } }
setId ( ProfileHelper . sanitizeIdentifier ( this , id ) ) ; addAttributes ( attributes ) ;
public class H2ONode { /** * * interned * : there is only one per InetAddress . */ public static final H2ONode intern ( H2Okey key ) { } }
H2ONode h2o = INTERN . get ( key ) ; if ( h2o != null ) return h2o ; final int idx = UNIQUE . getAndIncrement ( ) ; h2o = new H2ONode ( key , idx ) ; H2ONode old = INTERN . putIfAbsent ( key , h2o ) ; if ( old != null ) return old ; synchronized ( H2O . class ) { while ( idx >= IDX . length ) IDX = Arrays . copyOf ( ID...
public class TextFieldExample { /** * Override preparePaintComponent to test that dynamic attributes are handled correctly . * @ param request the request that triggered the paint . */ @ Override protected void preparePaintComponent ( final Request request ) { } }
super . preparePaintComponent ( request ) ; if ( ! isInitialised ( ) ) { tf3 . setText ( "This is read only." ) ; tf4 . setText ( "This is disabled." ) ; readFields ( ) ; setInitialised ( true ) ; }
public class BatchTask { /** * Cancels all tasks via their { @ link ChainedDriver # cancelTask ( ) } method . Any occurring exception * and error is suppressed , such that the canceling method of every task is invoked in all cases . * @ param tasks The tasks to be canceled . */ public static void cancelChainedTasks...
for ( int i = 0 ; i < tasks . size ( ) ; i ++ ) { try { tasks . get ( i ) . cancelTask ( ) ; } catch ( Throwable t ) { // do nothing } }
public class Grep { /** * TODO : color */ public static void main ( String [ ] args ) throws IOException { } }
if ( args . length != 2 ) { System . err . println ( "Syntax: grep <pattern> <glob>" ) ; System . exit ( - 1 ) ; } Grep grep = new Grep ( Paths . get ( "." ) , args [ 1 ] . split ( "\\s+" ) ) ; Map < Path , List < LineMatches > > pathMatches = grep . find ( args [ 0 ] ) ; for ( Path path : pathMatches . keySet ( ) ) { ...
public class JCuda { /** * Prefetches memory to the specified destination device * < br > * Prefetches memory to the specified destination device . devPtr is the * base device pointer of the memory to be prefetched and dstDevice is the * destination device . count specifies the number of bytes to copy . stream ...
return checkResult ( cudaMemPrefetchAsyncNative ( devPtr , count , dstDevice , stream ) ) ;
public class WSX509TrustManager { /** * object prop */ private String getProperty ( String propertyName , Properties prop , boolean processIsServer ) { } }
String value = null ; if ( prop != null ) { // if client process , get system prop first , global prop second , // then sslconfig or keystore prop third ( for override compatibility ) if ( ! processIsServer ) { value = System . getProperty ( propertyName ) ; if ( value == null ) { value = SSLConfigManager . getInstance...
public class MultiIndex { /** * Returns the number of documents in this index . * @ return the number of documents in this index . * @ throws IOException * if an error occurs while reading from the index . */ int numDocs ( ) throws IOException { } }
if ( indexNames . size ( ) == 0 ) { return volatileIndex . getNumDocuments ( ) ; } else { CachingMultiIndexReader reader = getIndexReader ( ) ; try { return reader . numDocs ( ) ; } finally { reader . release ( ) ; } }
public class SystemContent { /** * Projects a single property definition onto the provided graph under the location of < code > nodeTypePath < / code > . The * operations needed to create the property definition and any of its properties will be added to the batch specified in * < code > batch < / code > . * All ...
// Find an existing node for this property definition . . . final NodeKey key = propertyDef . key ( ) ; final Name name = propertyDef . getInternalName ( ) ; MutableCachedNode propDefnNode = null ; if ( ! nodeTypeNode . isNew ( ) ) { if ( nodeTypeNode . getChildReferences ( system ) . hasChild ( key ) ) { // The node a...
public class From { /** * Creates and chains a GroupBy object to group the query result . * @ param expressions The group by expression . * @ return The GroupBy object that represents the GROUP BY clause of the query . */ @ NonNull @ Override public GroupBy groupBy ( @ NonNull Expression ... expressions ) { } }
if ( expressions == null ) { throw new IllegalArgumentException ( "expressions cannot be null." ) ; } return new GroupBy ( this , Arrays . asList ( expressions ) ) ;
public class BNFHeadersImpl { /** * Method to marshall all instances of a particular header into the * input buffers ( expanding them if need be ) . * @ param inBuffers * @ param elem * @ return WsByteBuffer [ ] */ protected WsByteBuffer [ ] marshallHeader ( WsByteBuffer [ ] inBuffers , HeaderElement elem ) { }...
if ( elem . wasRemoved ( ) ) { return inBuffers ; } WsByteBuffer [ ] buffers = inBuffers ; final byte [ ] value = elem . asRawBytes ( ) ; if ( null != value ) { buffers = putBytes ( elem . getKey ( ) . getMarshalledByteArray ( foundCompactHeader ( ) ) , buffers ) ; buffers = putBytes ( value , elem . getOffset ( ) , el...
public class SessionAttributeInitializingFilter { /** * Sets the attribute map . The specified attributes are copied into the * underlying map , so modifying the specified attributes parameter after * the call won ' t change the internal state . */ public void setAttributes ( Map < String , ? > attributes ) { } }
if ( attributes == null ) { attributes = new HashMap < > ( ) ; } this . attributes . clear ( ) ; this . attributes . putAll ( attributes ) ;
public class XGenBuff { /** * Special Case where code is dynamic , so give access to State and Trans info * @ param state * @ param trans * @ param cache * @ param code * @ throws APIException * @ throws IOException */ @ SuppressWarnings ( { } }
"unchecked" , "rawtypes" } ) public void run ( State < Env > state , Trans trans , Cache cache , DynamicCode code ) throws APIException , IOException { code . code ( state , trans , cache , xgen ) ;
public class FileUtil { /** * 删除目录及所有子目录 / 文件 * @ see { @ link Files # walkFileTree } */ public static void deleteDir ( Path dir ) throws IOException { } }
Validate . isTrue ( isDirExists ( dir ) , "%s is not exist or not a dir" , dir ) ; // 后序遍历 , 先删掉子目录中的文件 / 目录 Files . walkFileTree ( dir , deleteFileVisitor ) ;
public class JobApi { /** * Download a single artifact file from within the job ' s artifacts archive . * Only a single file is going to be extracted from the archive and streamed to a client . * < pre > < code > GitLab Endpoint : GET / projects / : id / jobs / : job _ id / artifacts / * artifact _ path < / code > ...
String path = artifactPath . toString ( ) . replace ( "\\" , "/" ) ; Response response = get ( Response . Status . OK , getDefaultPerPageParam ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "jobs" , jobId , "artifacts" , path ) ; return ( response . readEntity ( InputStream . class ) ) ;
public class ImageManipulation { /** * Zooms either in or out of an image by a supplied amount . The zooming * occurs from the center of the image . * @ param ip * The image to zoom zoomAmt The amount to zoom the image . 0 < * zoomAmt < 1 : zoom out 1 = zoomAmt : original image 1 < zoomAmt : * zoom in * @ r...
if ( zoomAmt != null ) { try { float zoom = Float . parseFloat ( zoomAmt ) ; if ( zoom < 0 ) { return ip ; } ip . scale ( zoom , zoom ) ; // if the image is being zoomed out , trim the extra whitespace around the image if ( zoom < 1 ) { int imgWidth = ip . getWidth ( ) ; int imgHeight = ip . getHeight ( ) ; // set a RO...
public class RdmaServerEndpoint { /** * Bind this server endpoint to a specific IP address / port . * @ param src ( rdma : / / host : port ) * @ return the rdma server endpoint * @ throws Exception the exception */ public synchronized RdmaServerEndpoint < C > bind ( SocketAddress src , int backlog ) throws Except...
if ( connState != CONN_STATE_INITIALIZED ) { throw new IOException ( "endpoint has to be disconnected for bind" ) ; } connState = CONN_STATE_READY_FOR_ACCEPT ; idPriv . bindAddr ( src ) ; idPriv . listen ( backlog ) ; this . pd = group . createProtectionDomainRaw ( this ) ; logger . info ( "PD value " + pd . getHandle ...
public class WxApi2Impl { /** * 模板消息 */ @ Override public WxResp template_api_set_industry ( String industry_id1 , String industry_id2 ) { } }
return postJson ( "/template/api_set_industry" , "industry_id1" , industry_id1 , "industry_id2" , industry_id2 ) ;
public class NettyHandler { /** * Handles a response . */ private void handleResponse ( ByteBuf response , ChannelHandlerContext context ) { } }
NettyConnection connection = getConnection ( context . channel ( ) ) ; if ( connection != null ) { connection . handleResponse ( response ) ; }
public class ControllerHandler { /** * Validates that the declared consumes can actually be processed by Fathom . * @ param fathomContentTypes */ protected void validateConsumes ( Collection < String > fathomContentTypes ) { } }
Set < String > ignoreConsumes = new TreeSet < > ( ) ; ignoreConsumes . add ( Consumes . ALL ) ; // these are handled by the TemplateEngine ignoreConsumes . add ( Consumes . HTML ) ; ignoreConsumes . add ( Consumes . XHTML ) ; // these are handled by the Servlet layer ignoreConsumes . add ( Consumes . FORM ) ; ignoreCon...
public class ReflectUtil { /** * Get all fields * @ param clz * @ param includeStatic include static fields or not * @ return */ public static Field [ ] getAllFields ( Class < ? > clz , boolean includeStatic ) { } }
return Arrays . stream ( getAllFields ( clz ) ) . filter ( f -> includeStatic || ! Modifier . isStatic ( f . getModifiers ( ) ) ) . toArray ( Field [ ] :: new ) ;
public class CreateDevicePoolRequest { /** * The device pool ' s rules . * @ param rules * The device pool ' s rules . */ public void setRules ( java . util . Collection < Rule > rules ) { } }
if ( rules == null ) { this . rules = null ; return ; } this . rules = new java . util . ArrayList < Rule > ( rules ) ;
public class DiscordWebSocketAdapter { /** * Disconnects from the websocket . */ public void disconnect ( ) { } }
reconnect = false ; websocket . get ( ) . sendClose ( WebSocketCloseReason . DISCONNECT . getNumericCloseCode ( ) ) ; // cancel heartbeat timer if within one minute no disconnect event was dispatched api . getThreadPool ( ) . getDaemonScheduler ( ) . schedule ( ( ) -> heartbeatTimer . updateAndGet ( future -> { if ( fu...
public class VirtualMachinesInner { /** * The operation to start a virtual machine . * @ param resourceGroupName The name of the resource group . * @ param vmName The name of the virtual machine . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalA...
return ServiceFuture . fromResponse ( startWithServiceResponseAsync ( resourceGroupName , vmName ) , serviceCallback ) ;
public class UtilityExtensions { /** * Convenience method . */ public static String formatInput ( Replaceable input , Transliterator . Position pos ) { } }
return formatInput ( ( ReplaceableString ) input , pos ) ;
public class BaseDatabase { /** * Free this database object . */ public void free ( ) { } }
this . close ( ) ; while ( m_vTableList . size ( ) > 0 ) { BaseTable table = m_vTableList . elementAt ( 0 ) ; table . free ( ) ; } m_vTableList . removeAllElements ( ) ; m_vTableList = null ; if ( m_databaseOwner != null ) m_databaseOwner . removeDatabase ( this ) ; m_databaseOwner = null ; m_strDbName = null ;
public class ModelAnnotation { /** * Gets the attribute as boolean . * @ param attribute the attribute * @ return the attribute as boolean */ public boolean getAttributeAsBoolean ( AnnotationAttributeType attribute ) { } }
String temp = attributes . get ( attribute . getValue ( ) ) ; return Boolean . parseBoolean ( temp ) ;
public class BinaryJedis { /** * Return all the values in a hash . * < b > Time complexity : < / b > O ( N ) , where N is the total number of entries * @ param key * @ return All the fields values contained into a hash . */ @ Override public List < byte [ ] > hvals ( final byte [ ] key ) { } }
checkIsInMultiOrPipeline ( ) ; client . hvals ( key ) ; return client . getBinaryMultiBulkReply ( ) ;
public class Parsers { /** * Parser that tries , in this order : * < ul > * < li > ResultType . fromString ( String ) * < li > ResultType . decode ( String ) * < li > ResultType . valueOf ( String ) * < li > new ResultType ( String ) * < / ul > */ public static < T > Parser < T > conventionalParser ( Class ...
if ( resultType == String . class ) { @ SuppressWarnings ( "unchecked" ) // T = = String Parser < T > identity = ( Parser < T > ) IDENTITY ; return identity ; } final Class < T > wrappedResultType = Primitives . wrap ( resultType ) ; for ( String methodName : CONVERSION_METHOD_NAMES ) { try { final Method method = wrap...
public class RmpAppirater { /** * Modify internal value . * If you use this method , you might need to have a good understanding of this class code . * @ param context Context * @ param reminderClickDate Date of " Remind me later " button clicked . */ public static void setReminderClickDate ( Context context , Da...
final long reminderClickDateMills = ( ( reminderClickDate != null ) ? reminderClickDate . getTime ( ) : 0 ) ; SharedPreferences prefs = getSharedPreferences ( context ) ; SharedPreferences . Editor prefsEditor = prefs . edit ( ) ; prefsEditor . putLong ( PREF_KEY_REMINDER_CLICK_DATE , reminderClickDateMills ) ; prefsEd...
public class AbstractDirector { /** * Checks if filesInstalled includes scripts in a bin folder . * @ param filesInstalled the list of files that are installed * @ return true if at least one file is in the bin path */ boolean containScript ( List < File > filesInstalled ) { } }
for ( File f : filesInstalled ) { String path = f . getAbsolutePath ( ) . toLowerCase ( ) ; if ( path . contains ( "/bin/" ) || path . contains ( "\\bin\\" ) ) { return true ; } } return false ;
public class SecurityUtils { /** * Returns the profile from authentication attribute from the current request . * @ return the profile object , or null if there ' s no authentication */ public static Profile getCurrentProfile ( ) { } }
RequestContext context = RequestContext . getCurrent ( ) ; if ( context != null ) { return getProfile ( context . getRequest ( ) ) ; } else { return null ; }
public class AWSOrganizationsClient { /** * Lists the organizational units ( OUs ) in a parent organizational unit or root . * < note > * Always check the < code > NextToken < / code > response parameter for a < code > null < / code > value when calling a * < code > List * < / code > operation . These operations ...
request = beforeClientExecution ( request ) ; return executeListOrganizationalUnitsForParent ( request ) ;
public class AndroidJus { /** * Creates a default instance of the worker pool and calls { @ link RequestQueue # start ( ) } on it . * @ param context A { @ link Context } to use for creating the cache dir . * @ param stack An { @ link HttpStack } to use for the network , or null for default . * @ return A started...
JusLog . log = new ALog ( ) ; File cacheDir = new File ( context . getCacheDir ( ) , DEFAULT_CACHE_DIR ) ; String userAgent = "jus/0" ; try { String packageName = context . getPackageName ( ) ; PackageInfo info = context . getPackageManager ( ) . getPackageInfo ( packageName , 0 ) ; userAgent = packageName + "/" + info...
public class GenIdUtil { /** * 生成 Id * @ param target * @ param property * @ param genClass * @ param table * @ param column * @ throws MapperException */ public static void genId ( Object target , String property , Class < ? extends GenId > genClass , String table , String column ) throws MapperException {...
try { GenId genId ; if ( CACHE . containsKey ( genClass ) ) { genId = CACHE . get ( genClass ) ; } else { LOCK . lock ( ) ; try { if ( ! CACHE . containsKey ( genClass ) ) { CACHE . put ( genClass , genClass . newInstance ( ) ) ; } genId = CACHE . get ( genClass ) ; } finally { LOCK . unlock ( ) ; } } MetaObject metaOb...
public class ArrayFile { /** * Updates the length of this ArrayFile to the specified value . * @ param arrayLength - the new array length * @ param renameToFile - the copy of this ArrayFile . If < code > null < / code > , no backup copy will be created . * @ throws IOException */ public synchronized void setArray...
if ( arrayLength < 0 ) { throw new IOException ( "Invalid array length: " + arrayLength ) ; } if ( this . _arrayLength == arrayLength ) return ; // Flush all the changes . this . flush ( ) ; // Change the file length . long fileLength = DATA_START_POSITION + ( ( long ) arrayLength * _elementSize ) ; RandomAccessFile ra...
public class ServiceRegistry { /** * Retrieves service registered under given name * @ param name name of the service * @ return instance of the service registered with given name * @ throws IllegalArgumentException thrown in case service with given name is not registered */ public Object service ( String name ) ...
Object service = this . services . get ( name ) ; if ( service == null ) { throw new IllegalArgumentException ( "Service '" + name + "' not found" ) ; } return service ;
public class IotHubResourcesInner { /** * Get the list of valid SKUs for an IoT hub . * Get the list of valid SKUs for an IoT hub . * ServiceResponse < PageImpl < IotHubSkuDescriptionInner > > * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentExcep...
if ( nextPageLink == null ) { throw new IllegalArgumentException ( "Parameter nextPageLink is required and cannot be null." ) ; } String nextUrl = String . format ( "%s" , nextPageLink ) ; return service . getValidSkusNext ( nextUrl , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new ...
public class ResourceInstanceHelper { /** * Returns the number of active instances of the given template name * @ param service * @ param templateName * @ return */ public int countActiveInstances ( ServiceManagerResourceRestService service , String templateName ) { } }
List < ResourceInstanceDTO > instances = activeInstances ( service , templateName ) ; return instances . size ( ) ;
public class MutableTimecodeDuration { /** * Returns a TimecodeDuration instance for given timecode string and timecode base . * What is considered acceptable input varies per selected StringType * @ param timecode * @ param timecodeBase * @ param stringType * @ return the TimecodeDuration * @ throws Illega...
MutableTimecodeDuration tc = new MutableTimecodeDuration ( ) ; return ( MutableTimecodeDuration ) tc . parse ( timecode , timecodeBase , stringType ) ;
public class DescribeTrustsRequest { /** * A list of identifiers of the trust relationships for which to obtain the information . If this member is null , all * trust relationships that belong to the current account are returned . * An empty list results in an < code > InvalidParameterException < / code > being thr...
if ( trustIds == null ) { this . trustIds = null ; return ; } this . trustIds = new com . amazonaws . internal . SdkInternalList < String > ( trustIds ) ;
public class CmsEditFieldDialog { /** * Returns a list for the indexed select box . < p > * @ return a list for the indexed select box */ private List < CmsSelectWidgetOption > getTokenizedWidgetConfiguration ( ) { } }
List < CmsSelectWidgetOption > result = new ArrayList < CmsSelectWidgetOption > ( ) ; result . add ( new CmsSelectWidgetOption ( "true" , true ) ) ; result . add ( new CmsSelectWidgetOption ( "false" , false ) ) ; result . add ( new CmsSelectWidgetOption ( "untokenized" , false ) ) ; return result ;
public class UpgradableLock { /** * Attempt to immediately acquire an upgrade lock . * @ param locker object trying to become lock owner * @ return FAILED , ACQUIRED or OWNED */ private final Result tryLockForUpgrade_ ( L locker ) { } }
int state = mState ; if ( ( state & LOCK_STATE_MASK ) == 0 ) { // no write or upgrade lock is held if ( isUpgradeFirst ( ) ) { do { if ( setUpgradeLock ( state ) ) { mOwner = locker ; incrementUpgradeCount ( ) ; return Result . ACQUIRED ; } // keep looping on CAS failure if a reader mucked with the state } while ( ( ( ...
public class RunJobFlowRequest { /** * A list of bootstrap actions to run before Hadoop starts on the cluster nodes . * @ return A list of bootstrap actions to run before Hadoop starts on the cluster nodes . */ public java . util . List < BootstrapActionConfig > getBootstrapActions ( ) { } }
if ( bootstrapActions == null ) { bootstrapActions = new com . amazonaws . internal . SdkInternalList < BootstrapActionConfig > ( ) ; } return bootstrapActions ;
public class ReflectionUtils { /** * Obtain the primitive type for the given wrapper type . * @ param wrapperType The primitive type * @ return The wrapper type */ public static Class getPrimitiveType ( Class wrapperType ) { } }
Class < ? > wrapper = WRAPPER_TO_PRIMITIVE . get ( wrapperType ) ; if ( wrapper != null ) { return wrapper ; } return wrapperType ;
public class BasicUserProfile { /** * Add attributes . * @ param attributes use attributes */ public void addAttributes ( final Map < String , Object > attributes ) { } }
if ( attributes != null ) { for ( final Map . Entry < String , Object > entry : attributes . entrySet ( ) ) { addAttribute ( entry . getKey ( ) , entry . getValue ( ) ) ; } }
public class WebFragmentDescriptorImpl { /** * If not already created , a new < code > data - source < / code > element will be created and returned . * Otherwise , the first existing < code > data - source < / code > element will be returned . * @ return the instance defined for the element < code > data - source ...
List < Node > nodeList = model . get ( "data-source" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new DataSourceTypeImpl < WebFragmentDescriptor > ( this , "data-source" , model , nodeList . get ( 0 ) ) ; } return createDataSource ( ) ;