signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class StateParser { /** * Returns the string which was actually parsed with all the substitutions * performed . NB : No CommandContext being provided , variables can ' t be * resolved . variables should be already resolved when calling this parse * method . */ public static SubstitutedLine parseLine ( Stri...
return parseLine ( str , callbackHandler , initialState , true ) ;
public class MathUtil { /** * Replies the min value . * @ param values are the values to scan . * @ return the min value . */ @ Pure public static int min ( int ... values ) { } }
if ( values == null || values . length == 0 ) { return 0 ; } int min = values [ 0 ] ; for ( final int v : values ) { if ( v < min ) { min = v ; } } return min ;
public class DirRecord { /** * getAttrVal - return first ( or only ) value for given attribute * " dn " is treated as an attribute name . * @ param attr String attribute name * @ return Object attribute value * @ throws NamingException */ public Object getAttrVal ( String attr ) throws NamingException { } }
if ( attr . equalsIgnoreCase ( "dn" ) ) { return getDn ( ) ; } Attribute a = findAttr ( attr ) ; if ( a == null ) { return null ; } return a . get ( ) ;
public class CustomHeaderClient { /** * Main start the client from the command line . */ public static void main ( String [ ] args ) throws Exception { } }
CustomHeaderClient client = new CustomHeaderClient ( "localhost" , 50051 ) ; try { /* Access a service running on the local machine on port 50051 */ String user = "world" ; if ( args . length > 0 ) { user = args [ 0 ] ; /* Use the arg as the name to greet if provided */ } client . greet ( user ) ; } finally { client . ...
public class NetWorkUtils { /** * Check whether the port is available to bind * @ param port port * @ return - 1 means unavailable , otherwise available * @ throws IOException */ public static int tryPort ( int port ) throws IOException { } }
ServerSocket socket = new ServerSocket ( port ) ; int rtn = socket . getLocalPort ( ) ; socket . close ( ) ; return rtn ;
public class WithKmeans { /** * ( The Actual Algorithm ) k - means of ( micro ) clusters , with specified initialization points . * @ param k * @ param centers - initial centers * @ param data * @ return ( macro ) clustering - SphereClusters */ protected static Clustering kMeans ( int k , Cluster [ ] centers , ...
assert ( centers . length == k ) ; assert ( k > 0 ) ; int dimensions = centers [ 0 ] . getCenter ( ) . length ; ArrayList < ArrayList < Cluster > > clustering = new ArrayList < ArrayList < Cluster > > ( ) ; for ( int i = 0 ; i < k ; i ++ ) { clustering . add ( new ArrayList < Cluster > ( ) ) ; } while ( true ) { // Ass...
public class CASableSimpleFileIOChannel { /** * Delete given property value . < br > * Special logic implemented for Values CAS . As the storage may have one file ( same hash ) for * multiple properties / values . < br > * The implementation assumes that delete operations based on { @ link # getFiles ( String ) }...
File [ ] files ; try { files = getFiles ( propertyId ) ; } catch ( RecordNotFoundException e ) { // This is workaround for CAS VS . No records found for this value at the moment . // CASableDeleteValues saves VCAS record on commit , but it ' s possible the Property just // added in this transaction and not commited . f...
public class SVGAndroidRenderer { private void render ( SVG . Image obj ) { } }
debug ( "Image render" ) ; if ( obj . width == null || obj . width . isZero ( ) || obj . height == null || obj . height . isZero ( ) ) return ; if ( obj . href == null ) return ; // " If attribute ' preserveAspectRatio ' is not specified , then the effect is as if a value of xMidYMid meet were specified . " PreserveAsp...
public class AbstractPlainSocketImpl { /** * Shutdown read - half of the socket connection ; */ protected void shutdownInput ( ) throws IOException { } }
if ( fd != null && fd . valid ( ) ) { socketShutdown ( SHUT_RD ) ; if ( socketInputStream != null ) { socketInputStream . setEOF ( true ) ; } shut_rd = true ; }
public class NetworkUtils { /** * 是否有网络连接 * @ param context Context * @ return 是否连接 */ public static boolean isConnected ( Context context ) { } }
if ( context == null ) { return true ; } ConnectivityManager cm = ( ConnectivityManager ) context . getSystemService ( Context . CONNECTIVITY_SERVICE ) ; NetworkInfo info = cm . getActiveNetworkInfo ( ) ; return info != null && info . isConnectedOrConnecting ( ) ;
public class HamcrestMatchers { /** * Creates a matcher for { @ link Iterable } s matching when the examined { @ linkplain Iterable } has all * the elements in the comparison { @ linkplain Iterable } , without repetitions . * For instance : * { @ code * List < String > comparison = Arrays . asList ( " bar " , "...
return IsIterableWithSameSize . sameSizeOf ( comparison ) ;
public class EchoServer { /** * Sends the { @ link String message } received from the Echo Client back to the Echo Client on the given { @ link Socket } . * @ param socket { @ link Socket } used to send the Echo Client ' s { @ link String message } back to the Echo Client . * @ param message { @ link String } conta...
try { getLogger ( ) . info ( ( ) -> String . format ( "Sending response [%1$s] to EchoClient [%2$s]" , message , socket . getRemoteSocketAddress ( ) ) ) ; sendMessage ( socket , message ) ; } catch ( IOException cause ) { getLogger ( ) . warning ( ( ) -> String . format ( "Failed to send response [%1$s] to EchoClient [...
public class PolicyFactoryImpl { /** * Loads a policy from a plugin . * @ param policyImpl * @ param handler */ private void doLoadFromPlugin ( final String policyImpl , final IAsyncResultHandler < IPolicy > handler ) { } }
PluginCoordinates coordinates = PluginCoordinates . fromPolicySpec ( policyImpl ) ; if ( coordinates == null ) { handler . handle ( AsyncResultImpl . < IPolicy > create ( new PolicyNotFoundException ( policyImpl ) ) ) ; return ; } int ssidx = policyImpl . indexOf ( '/' ) ; if ( ssidx == - 1 ) { handler . handle ( Async...
public class PreferredValueMakersRegistry { /** * Add a maker with custom matcher . * @ param settableMatcher * a matcher to match on com . github . huangp . entityunit . util . Settable # fullyQualifiedName ( ) * @ param maker * custom maker * @ return this */ public PreferredValueMakersRegistry add ( Matche...
Preconditions . checkNotNull ( settableMatcher ) ; Preconditions . checkNotNull ( maker ) ; makers . put ( settableMatcher , maker ) ; return this ;
public class SoitoolkitLoggerModule { /** * Log processor for level TRACE * { @ sample . xml . . / . . / . . / doc / SoitoolkitLogger - connector . xml . sample soitoolkitlogger : log } * @ param message Log - message to be processed * @ param integrationScenario Optional name of the integration scenario or busin...
return doLog ( LogLevelType . TRACE , message , integrationScenario , contractId , correlationId , extra ) ;
public class GSCDImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eSet ( int featureID , Object newValue ) { } }
switch ( featureID ) { case AfplibPackage . GSCD__DIRECTION : setDIRECTION ( ( Integer ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ;
public class GBSTree { /** * Set the depth of a T0 sub - tree . */ private int calcTZeroDepth ( int proposedK ) { } }
int d = - 1 ; if ( ( proposedK >= 0 ) && ( proposedK < _t0_d . length ) ) d = _t0_d [ proposedK ] ; if ( d < 0 ) { String x = "K Factor (" + proposedK + ") is invalid.\n" + "Valid K factors are: " + kFactorString ( ) + "." ; throw new IllegalArgumentException ( x ) ; } return d ;
public class CmsImageCacheHelper { /** * Returns the length of the given image . < p > * @ param imgName the image name * @ return the length of the given image */ public String getLength ( String imgName ) { } }
String ret = ( String ) m_lengths . get ( imgName ) ; if ( ret == null ) { return "" ; } return ret ;
public class InfoValidator { /** * { @ inheritDoc } */ @ Override public void validate ( ValidationHelper helper , Context context , String key , Info t ) { } }
if ( t != null ) { ValidatorUtils . validateRequiredField ( t . getVersion ( ) , context , "version" ) . ifPresent ( helper :: addValidationEvent ) ; ValidatorUtils . validateRequiredField ( t . getTitle ( ) , context , "title" ) . ifPresent ( helper :: addValidationEvent ) ; if ( t . getTermsOfService ( ) != null ) { ...
public class DoubleAccessor { /** * ( non - Javadoc ) * @ see * com . impetus . kundera . property . PropertyAccessor # toBytes ( java . lang . Object ) */ @ Override public byte [ ] toBytes ( Object object ) throws PropertyAccessException { } }
return object != null ? fromLong ( Double . doubleToRawLongBits ( ( Double ) object ) ) : null ;
public class TransactionFlow { /** * Execute the transactional flow - catch only specified exceptions * @ param input Initial data input * @ param classes Exception types to catch * @ return Try that represents either success ( with result ) or failure ( with errors ) */ public < Ex extends Throwable > Try < R , ...
return Try . withCatch ( ( ) -> transactionTemplate . execute ( status -> transaction . apply ( input ) ) , classes ) ;
public class CompoundReentrantTypeResolver { /** * / * @ Nullable */ @ Override public IFeatureLinkingCandidate getLinkingCandidate ( /* @ Nullable */ XAbstractFeatureCall featureCall ) { } }
if ( featureCall == null ) return null ; IResolvedTypes delegate = getDelegate ( featureCall ) ; return delegate . getLinkingCandidate ( featureCall ) ;
public class Partition { /** * Create a range partition on an { @ link AbstractLabel } that will itself be sub - partitioned * @ param sqlgGraph * @ param abstractLabel * @ param name * @ param from * @ param to * @ param partitionType * @ param partitionExpression * @ return */ static Partition createR...
Preconditions . checkArgument ( ! abstractLabel . getSchema ( ) . isSqlgSchema ( ) , "createRangePartitionWithSubPartition may not be called for \"%s\"" , Topology . SQLG_SCHEMA ) ; Preconditions . checkState ( abstractLabel . isRangePartition ( ) ) ; Partition partition = new Partition ( sqlgGraph , abstractLabel , na...
public class QueryStringSigner { /** * Calculate string to sign for signature version 2. * @ param request * The request being signed . * @ return String to sign * @ throws SdkClientException * If the string to sign cannot be calculated . */ private String calculateStringToSignV2 ( SignableRequest < ? > reque...
URI endpoint = request . getEndpoint ( ) ; StringBuilder data = new StringBuilder ( ) ; data . append ( "POST" ) . append ( "\n" ) . append ( getCanonicalizedEndpoint ( endpoint ) ) . append ( "\n" ) . append ( getCanonicalizedResourcePath ( request ) ) . append ( "\n" ) . append ( getCanonicalizedQueryString ( request...
public class Sql2o { /** * Creates a { @ link Query } * @ param query the sql query string * @ return the { @ link Query } instance * @ deprecated create queries with { @ link org . sql2o . Connection } class instead , using try - with - resource blocks * < code > * try ( Connection con = sql2o . open ( ) ) {...
Connection connection = new Connection ( this , true ) ; return connection . createQuery ( query ) ;
public class ImageLoader { /** * Tries to load Image from file and converts it to the * desired image type if needed . < br > * See { @ link BufferedImage # BufferedImage ( int , int , int ) } for details on * the available image types . * The InputStream is not closed , this is the responsibility of the caller...
BufferedImage img = loadImage ( is ) ; if ( img . getType ( ) != imageType ) { img = BufferedImageFactory . get ( img , imageType ) ; } return img ;
public class StringLiteral { /** * Converts the specified value to a String token , using " as the * enclosing quotes and escaping any characters that need escaping . */ public static String toStringToken ( String pValue ) { } }
// See if any escaping is needed if ( pValue . indexOf ( '\"' ) < 0 && pValue . indexOf ( '\\' ) < 0 ) { return "\"" + pValue + "\"" ; } // Escaping is needed else { StringBuffer buf = new StringBuffer ( ) ; buf . append ( '\"' ) ; int len = pValue . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char ch = pValue . ...
public class ParserDDL { /** * / This adapts XreadExpressions / getSimpleColumnNames output to the format originally produced by readColumnList . */ private int [ ] getColumnList ( OrderedHashSet set , Table table ) { } }
if ( set == null ) { return null ; } return table . getColumnIndexes ( set ) ;
public class Body { /** * Process the start of the Button . * @ throws javax . servlet . jsp . JspException if a JSP exception has occurred */ public int doStartTag ( ) throws JspException { } }
// we assume that tagId will over have override id if both are defined . if ( _state . id != null ) { _idScript = renderNameAndId ( ( HttpServletRequest ) pageContext . getRequest ( ) , _state , null ) ; } // render the header . . . _writer = new WriteRenderAppender ( pageContext ) ; _br = TagRenderingBase . Factory . ...
public class RESTProxyServlet { /** * < p > Set into the response the container version and a list of registered roots . < / p > * < p > Our return JSON structure is : * < pre > * " version " : int , * " roots " : [ String * ] * < / pre > * @ param response * @ throws IOException If the JSON serialization...
// Build the array of registered roots JSONArray keyArray = new JSONArray ( ) ; Iterator < String > keys = REST_HANDLER_CONTAINER . registeredKeys ( ) ; if ( keys != null ) { while ( keys . hasNext ( ) ) { keyArray . add ( keys . next ( ) ) ; } } // Add the version . JSONObject jsonObject = new OrderedJSONObject ( ) ; ...
public class CategoryWordTagFactory { /** * Make a new label with this < code > String < / code > as the " name " . * @ param labelStr The string to use as a label * @ return The newly created Label */ public Label newLabelFromString ( String labelStr ) { } }
CategoryWordTag cwt = new CategoryWordTag ( ) ; cwt . setFromString ( labelStr ) ; return cwt ;
public class IOGroovyMethods { /** * Overloads the leftShift operator to provide an append mechanism to add values to a stream . * @ param self an OutputStream * @ param value a value to append * @ return a Writer * @ throws java . io . IOException if an I / O error occurs . * @ since 1.0 */ public static Wri...
OutputStreamWriter writer = new FlushingStreamWriter ( self ) ; leftShift ( writer , value ) ; return writer ;
public class MediaClient { /** * Creates a pipeline which enable you to perform multiple transcodes in parallel . * @ param pipelineName The name of the new pipeline . * @ param sourceBucket The name of source bucket in Bos . * @ param targetBucket The name of target bucket in Bos . * @ param capacity The concu...
return createPipeline ( pipelineName , null , sourceBucket , targetBucket , capacity ) ;
public class ChildrenOrderAnalyzer { /** * { @ inheritDoc } */ @ Override public OrderAnalyzerResult analyze ( ) { } }
final PersonNavigator navigator = new PersonNavigator ( person ) ; final List < Family > families = navigator . getFamilies ( ) ; for ( final Family family : families ) { analyzeFamily ( family ) ; } return result ;
public class PolicyDefinitionsInner { /** * Creates or updates a policy definition at management group level . * @ param policyDefinitionName The name of the policy definition to create . * @ param managementGroupId The ID of the management group . * @ param parameters The policy definition properties . * @ thr...
return createOrUpdateAtManagementGroupWithServiceResponseAsync ( policyDefinitionName , managementGroupId , parameters ) . map ( new Func1 < ServiceResponse < PolicyDefinitionInner > , PolicyDefinitionInner > ( ) { @ Override public PolicyDefinitionInner call ( ServiceResponse < PolicyDefinitionInner > response ) { ret...
public class MergeMetadataMarshaller { /** * Marshall the given parameter object . */ public void marshall ( MergeMetadata mergeMetadata , ProtocolMarshaller protocolMarshaller ) { } }
if ( mergeMetadata == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( mergeMetadata . getIsMerged ( ) , ISMERGED_BINDING ) ; protocolMarshaller . marshall ( mergeMetadata . getMergedBy ( ) , MERGEDBY_BINDING ) ; } catch ( Exception e ) { thr...
public class AbstractRStarTreeNode { /** * Tests , if the parameters of the entry representing this node , are correctly * set . Subclasses may need to overwrite this method . * @ param parent the parent holding the entry representing this node * @ param index the index of the entry in the parents child array */ ...
// test if mbr is correctly set E entry = parent . getEntry ( index ) ; HyperBoundingBox mbr = computeMBR ( ) ; if ( /* entry . getMBR ( ) = = null & & */ mbr == null ) { return ; } if ( ! SpatialUtil . equals ( entry , mbr ) ) { String soll = mbr . toString ( ) ; String ist = new HyperBoundingBox ( entry ) . toString ...
public class ClassWriterImpl { /** * { @ inheritDoc } */ public Content getHeader ( String header ) { } }
String pkgname = ( classDoc . containingPackage ( ) != null ) ? classDoc . containingPackage ( ) . name ( ) : "" ; String clname = classDoc . name ( ) ; Content bodyTree = getBody ( true , getWindowTitle ( clname ) ) ; addTop ( bodyTree ) ; addNavLinks ( true , bodyTree ) ; bodyTree . addContent ( HtmlConstants . START...
public class ProjectCacheCleaner { /** * Delete all the files in parallel * @ param projectDirsToDelete a set of project dirs to delete */ @ SuppressWarnings ( "FutureReturnValueIgnored" ) private void deleteProjectDirsInParallel ( final ImmutableSet < File > projectDirsToDelete ) { } }
final int CLEANING_SERVICE_THREAD_NUM = 8 ; final ExecutorService deletionService = Executors . newFixedThreadPool ( CLEANING_SERVICE_THREAD_NUM ) ; for ( final File toDelete : projectDirsToDelete ) { deletionService . submit ( ( ) -> { log . info ( "Deleting project dir {} from project cache to free up space" , toDele...
public class StaticAnalysis { /** * Gets all free variables in { @ code expression } , i . e . , * variables whose values are determined by the environment * in which the expression is evaluated . * @ param expression * @ return */ public static Set < String > getFreeVariables ( Expression2 expression ) { } }
Set < String > freeVariables = Sets . newHashSet ( ) ; ScopeSet scopes = getScopes ( expression ) ; for ( int i = 0 ; i < expression . size ( ) ; i ++ ) { Scope scope = scopes . getScope ( i ) ; String varName = getFreeVariable ( expression , i , scope ) ; if ( varName != null ) { freeVariables . add ( varName ) ; } } ...
public class App { /** * Determines if a confirmation is present or not , and can be interacted * with . If it ' s not present , an indication that the confirmation can ' t be * clicked on is written to the log file * @ param action - the action occurring * @ param expected - the expected result * @ return Bo...
// wait for element to be present if ( ! is . confirmationPresent ( ) ) { waitFor . confirmationPresent ( ) ; } if ( ! is . confirmationPresent ( ) ) { reporter . fail ( action , expected , "Unable to click confirmation as it is not present" ) ; return true ; // indicates element not present } return false ;
public class Blob { /** * { @ inheritDoc } */ public byte [ ] getBytes ( final long pos , final int length ) throws SQLException { } }
synchronized ( this ) { if ( this . underlying == null ) { if ( pos > 1 ) { throw new SQLException ( "Invalid position: " + pos ) ; } // end of if return NO_BYTE ; } // end of if return this . underlying . getBytes ( pos , length ) ; } // end of sync
public class BufferUtils { /** * Flip the buffer to Flush mode . * The limit is set to the first unused byte ( the old position ) and * the position is set to the passed position . * This method is used as a replacement of { @ link Buffer # flip ( ) } . * @ param buffer the buffer to be flipped * @ param posi...
buffer . limit ( buffer . position ( ) ) ; buffer . position ( position ) ;
public class DeployerResolverOverriderConverter { /** * Convert the Boolean skipInjectInitScript parameter to Boolean useArtifactoryGradlePlugin * This convertion comes after a name change ( skipInjectInitScript - > useArtifactoryGradlePlugin ) */ private void overrideUseArtifactoryGradlePlugin ( T overrider , Class ...
if ( overriderClass . getSimpleName ( ) . equals ( ArtifactoryGradleConfigurator . class . getSimpleName ( ) ) ) { try { Field useArtifactoryGradlePluginField = overriderClass . getDeclaredField ( "useArtifactoryGradlePlugin" ) ; useArtifactoryGradlePluginField . setAccessible ( true ) ; Object useArtifactoryGradlePlug...
public class Duration { /** * Returns a copy of this duration multiplied by the scalar . * This instance is immutable and unaffected by this method call . * @ param multiplicand the value to multiply the duration by , positive or negative * @ return a { @ code Duration } based on this duration multiplied by the s...
if ( multiplicand == 0 ) { return ZERO ; } if ( multiplicand == 1 ) { return this ; } return create ( toSeconds ( ) . multiply ( BigDecimal . valueOf ( multiplicand ) ) ) ;
public class SpanningTree { /** * Returns an IAtomContainer which contains all the atoms and bonds which * are involved in ring systems . * @ see # getAllRings ( ) * @ see # getBasicRings ( ) * @ return the IAtomContainer as described above */ public IAtomContainer getCyclicFragmentsContainer ( ) { } }
IAtomContainer fragContainer = this . molecule . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; IAtomContainer spt = getSpanningTree ( ) ; for ( int i = 0 ; i < totalEdgeCount ; i ++ ) if ( ! bondsInTree [ i ] ) { IRing ring = getRing ( spt , molecule . getBond ( i ) ) ; for ( int b = 0 ; b < ring . getBondC...
public class OperaDesktopDriver { /** * Waits until new page is shown in the window is shown , and then returns the window id of the * window * @ param windowName - window to wait for shown event on * @ return id of window */ public int waitForWindowPageChanged ( String windowName ) { } }
if ( getScopeServices ( ) . getConnection ( ) == null ) { throw new CommunicationException ( "waiting for a window failed because Opera is not connected." ) ; } return getScopeServices ( ) . waitForDesktopWindowPageChanged ( windowName , OperaIntervals . WINDOW_EVENT_TIMEOUT . getMs ( ) ) ;
public class PacketHandlerPipeline { /** * Gets the protocol handler capable of processing the packet . * @ param packet The packet to be processed * @ return The protocol handler capable of processing the packet . < br > * Returns null in case no capable handler exists . */ public PacketHandler getHandler ( byte...
synchronized ( this . handlers ) { // Search for the first handler capable of processing the packet for ( PacketHandler protocolHandler : this . handlers ) { if ( protocolHandler . canHandle ( packet ) ) { return protocolHandler ; } } // Return null in case no handler is capable of decoding the packet return null ; }
public class AbstractParamContainerPanel { /** * Validates all panels , throwing an exception if there ' s any validation error . * The message of the exception can be shown in GUI components ( for example , an error dialogue ) callers can expect an * internationalised message . * @ throws Exception if there ' s ...
Enumeration < AbstractParamPanel > en = tablePanel . elements ( ) ; AbstractParamPanel panel = null ; while ( en . hasMoreElements ( ) ) { panel = en . nextElement ( ) ; try { panel . validateParam ( paramObject ) ; } catch ( Exception e ) { showParamPanel ( panel , panel . getName ( ) ) ; throw e ; } }
public class TextAdapterActivity { /** * The method overrides the one from the super class and perform the followings : * < ul > * < li > It gets the value of the variable with the name specified in the attribute * REQUEST _ VARIABLE . The value is typically an XML document or a string < / li > * < li > It invo...
String varname = getAttributeValue ( REQUEST_VARIABLE ) ; Object request = varname == null ? null : getParameterValue ( varname ) ; if ( hasPreScript ( ) ) { Object ret = executePreScript ( request ) ; if ( ret == null ) { // nothing returned ; requestVar may have been assigned by script request = getParameterValue ( v...
public class Sql { /** * Performs a stored procedure call with the given parameters , * calling the closure once with all result objects . * See { @ link # call ( String , List , Closure ) } for more details about * creating a < code > Hemisphere ( IN first , IN last , OUT dwells ) < / code > stored procedure . ...
List < Object > params = getParameters ( gstring ) ; String sql = asSql ( gstring , params ) ; call ( sql , params , closure ) ;
public class CDKToBeam { /** * Add extended tetrahedral stereo configuration to the Beam GraphBuilder . * @ param et stereo element specifying tetrahedral configuration * @ param gb the current graph builder * @ param indices atom indices */ private static void addExtendedTetrahedralConfiguration ( ExtendedTetrah...
IAtom [ ] ligands = et . peripherals ( ) ; int u = indices . get ( et . focus ( ) ) ; int vs [ ] = new int [ ] { indices . get ( ligands [ 0 ] ) , indices . get ( ligands [ 1 ] ) , indices . get ( ligands [ 2 ] ) , indices . get ( ligands [ 3 ] ) } ; gb . extendedTetrahedral ( u ) . lookingFrom ( vs [ 0 ] ) . neighbors...
public class AsciiSet { /** * Converts the members array to a pattern string . Used to provide a user friendly toString * implementation for the set . */ private static String toPattern ( boolean [ ] members ) { } }
StringBuilder buf = new StringBuilder ( ) ; if ( members [ '-' ] ) { buf . append ( '-' ) ; } boolean previous = false ; char s = 0 ; for ( int i = 0 ; i < members . length ; ++ i ) { if ( members [ i ] && ! previous ) { s = ( char ) i ; } else if ( ! members [ i ] && previous ) { final char e = ( char ) ( i - 1 ) ; ap...
public class AbstractExcelWriter { /** * 初始化新的一页 */ protected void initSheet ( ) throws WriteExcelException { } }
this . currentSheet = this . workbook . createSheet ( ) ; for ( int i = 0 ; i < this . properties . size ( ) ; i ++ ) { if ( MapUtils . isNotEmpty ( this . columnWidthMapping ) && null != this . columnWidthMapping . get ( this . properties . get ( i ) ) && 0 > Integer . valueOf ( 0 ) . compareTo ( this . columnWidthMap...
public class CommerceDiscountRelPersistenceImpl { /** * Removes all the commerce discount rels where commerceDiscountId = & # 63 ; from the database . * @ param commerceDiscountId the commerce discount ID */ @ Override public void removeByCommerceDiscountId ( long commerceDiscountId ) { } }
for ( CommerceDiscountRel commerceDiscountRel : findByCommerceDiscountId ( commerceDiscountId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( commerceDiscountRel ) ; }
public class ResourceConfigurationMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ResourceConfiguration resourceConfiguration , ProtocolMarshaller protocolMarshaller ) { } }
if ( resourceConfiguration == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( resourceConfiguration . getComputeType ( ) , COMPUTETYPE_BINDING ) ; protocolMarshaller . marshall ( resourceConfiguration . getVolumeSizeInGB ( ) , VOLUMESIZEINGB...
public class Breadcrumbs { /** * { @ inheritDoc } */ @ Override public void add ( final Widget w ) { } }
w . addStyleName ( Styles . ACTIVE ) ; super . add ( w ) ;
public class CommerceCurrencyPersistenceImpl { /** * Returns the commerce currency where groupId = & # 63 ; and code = & # 63 ; or throws a { @ link NoSuchCurrencyException } if it could not be found . * @ param groupId the group ID * @ param code the code * @ return the matching commerce currency * @ throws No...
CommerceCurrency commerceCurrency = fetchByG_C ( groupId , code ) ; if ( commerceCurrency == null ) { StringBundler msg = new StringBundler ( 6 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "groupId=" ) ; msg . append ( groupId ) ; msg . append ( ", code=" ) ; msg . append ( code ) ; msg . append ( "}"...
public class IPAddressSection { /** * Returns a prefix length for which the range of this address section matches the the block of addresses for that prefix . * If no such prefix exists , returns null * If this address section represents a single value , returns the bit length * @ return the prefix length or null...
if ( ! hasNoPrefixCache ( ) ) { Integer result = prefixCache . cachedEquivalentPrefix ; if ( result != null ) { if ( result < 0 ) { return null ; } return result ; } } Integer res = super . getPrefixLengthForSingleBlock ( ) ; if ( res == null ) { prefixCache . cachedEquivalentPrefix = NO_PREFIX_LENGTH ; return null ; }...
public class CmsObject { /** * Checks if the current user has required permissions to access a given resource . < p > * @ param resource the resource to check the permissions for * @ param requiredPermissions the set of permissions to check for * @ param checkLock if < code > true < / code > the lock status of th...
return I_CmsPermissionHandler . PERM_ALLOWED == m_securityManager . hasPermissions ( m_context , resource , requiredPermissions , checkLock , filter ) ;
public class TypeUtil { /** * TODO ( user ) : See jls - 5.6.2 and jls - 15.25. * @ param trueType the type of the true expression * @ param falseType the type of the false expression * @ return the inferred type of the conditional expression */ public TypeMirror inferConditionalExpressionType ( TypeMirror trueTyp...
return isAssignable ( trueType , falseType ) ? falseType : trueType ;
public class NullAway { /** * computes those fields always initialized by callee safe init methods before a read operation * ( pathToRead ) is invoked . See < a * href = " https : / / github . com / uber / NullAway / wiki / Error - Messages # initializer - method - does - not - guarantee - nonnull - field - is - in...
Set < Element > safeInitMethods = new LinkedHashSet < > ( ) ; Tree enclosingBlockOrMethod = enclosingBlockPath . getLeaf ( ) ; if ( enclosingBlockOrMethod instanceof VariableTree ) { return ImmutableSet . of ( ) ; } ImmutableSet . Builder < Element > resultBuilder = ImmutableSet . builder ( ) ; BlockTree blockTree = en...
public class FormTool { /** * Constructs a hidden element with the specified parameter name where * the value is extracted from the appropriate request parameter * unless there is no value in which case the supplied default value * is used . */ public String hidden ( String name , Object defaultValue ) { } }
return fixedHidden ( name , getValue ( name , defaultValue ) ) ;
public class BindDaoFactoryBuilder { /** * Build dao factory interface . * @ param elementUtils the element utils * @ param filer the filer * @ param schema the schema * @ return schema typeName * @ throws Exception the exception */ public TypeSpec . Builder buildDaoFactoryInterfaceInternal ( Elements element...
String schemaName = buildDaoFactoryName ( schema ) ; classBuilder = TypeSpec . interfaceBuilder ( schemaName ) . addModifiers ( Modifier . PUBLIC ) . addSuperinterface ( BindDaoFactory . class ) ; classBuilder . addJavadoc ( "<p>\n" ) ; classBuilder . addJavadoc ( "Represents dao factory interface for $L.\n" , schema ....
public class FileKeyValStore { /** * Set the value associated with name . * @ param name * @ param value */ public void setValue ( String name , String value ) { } }
Properties properties = loadProperties ( ) ; try ( OutputStream output = new FileOutputStream ( file ) ; ) { properties . setProperty ( name , value ) ; properties . store ( output , "" ) ; output . close ( ) ; } catch ( IOException e ) { logger . warn ( String . format ( "Could not save the keyvalue store, reason:%s" ...
public class LogUtils { /** * Allows both parameter substitution and a typed Throwable to be logged . * @ param logger the Logger the log to * @ param level the severity level * @ param message the log message * @ param throwable the Throwable to log * @ param parameter the parameter to substitute into messag...
if ( logger . isLoggable ( level ) ) { final String formattedMessage = MessageFormat . format ( localize ( logger , message ) , parameter ) ; doLog ( logger , level , formattedMessage , throwable ) ; }
public class CmsCopyMoveDialog { /** * Performs the single resource operation . < p > * @ param source the source * @ param target the target * @ param action the action * @ param overwrite if existing resources should be overwritten * @ param makroMap map of key - value pairs to be resolved as macro . if nul...
performSingleOperation ( source , target , getTargetName ( source , target ) , action , overwrite , makroMap ) ;
public class Unchecked { /** * Wrap a { @ link CheckedToIntBiFunction } in a { @ link ToIntBiFunction } . */ public static < T , U > ToIntBiFunction < T , U > toIntBiFunction ( CheckedToIntBiFunction < T , U > function ) { } }
return toIntBiFunction ( function , THROWABLE_TO_RUNTIME_EXCEPTION ) ;
public class NumberCodeGenerator { /** * Create class to hold global currency information . */ public TypeSpec createCurrencyUtil ( String className , Map < String , CurrencyData > currencies ) { } }
TypeSpec . Builder type = TypeSpec . classBuilder ( className ) . addModifiers ( Modifier . PUBLIC ) ; CurrencyData defaultData = currencies . get ( "DEFAULT" ) ; currencies . remove ( "DEFAULT" ) ; MethodSpec . Builder code = MethodSpec . methodBuilder ( "getCurrencyDigits" ) . addModifiers ( PUBLIC , STATIC ) . addPa...
public class CoronaJobHistory { /** * Log start time of this map task attempt . * @ param taskAttemptId task attempt id * @ param startTime start time of task attempt as reported by task tracker . * @ param trackerName name of the tracker executing the task attempt . * @ param httpPort http port of the task tra...
if ( disableHistory ) { return ; } JobID id = taskAttemptId . getJobID ( ) ; if ( ! this . jobId . equals ( id ) ) { throw new RuntimeException ( "JobId from task: " + id + " does not match expected: " + jobId ) ; } if ( null != writers ) { log ( writers , RecordTypes . MapAttempt , new Keys [ ] { Keys . TASK_TYPE , Ke...
public class Validate { /** * Checks if the given double is NOT negative . * @ param value The double value to validate . * @ param message The error message to include in the exception in case the validation fails . * @ throws ParameterException if the given double value is < code > null < / code > or smaller th...
if ( ! validation ) return ; notNull ( value ) ; notNull ( message ) ; if ( value < 0 ) throw new ParameterException ( ErrorCode . NEGATIVE , message ) ;
public class StringHelper { /** * Return a representation of the given name ensuring quoting ( wrapped with ' ` ' characters ) . If already wrapped * return name . * @ param name The name to quote . * @ return The quoted version . */ public static String quote ( String name ) { } }
if ( isEmpty ( name ) || isQuoted ( name ) ) { return name ; } // Convert the JPA2 specific quoting character ( double quote ) to Hibernate ' s ( back tick ) else if ( name . startsWith ( "\"" ) && name . endsWith ( "\"" ) ) { name = name . substring ( 1 , name . length ( ) - 1 ) ; } return new StringBuilder ( name . l...
public class OverviewMap { /** * Set a new style for the rectangle that show the target map ' s maximum extent . This style will be applied * immediately . * @ param targetMaxExtentRectangleStyle * max extent marker rectangle style * @ since 1.8.0 */ @ Api public void setTargetMaxExtentRectangleStyle ( ShapeSty...
this . targetMaxExtentRectangleStyle = targetMaxExtentRectangleStyle ; if ( targetMaxExtentRectangle != null ) { targetMaxExtentRectangle . setStyle ( targetMaxExtentRectangleStyle ) ; if ( drawTargetMaxExtent ) { render ( targetMaxExtentRectangle , RenderGroup . SCREEN , RenderStatus . UPDATE ) ; } }
public class SamlDecorator { /** * Returns an { @ link HttpResponse } for SAML authentication failure . */ private static HttpResponse fail ( ServiceRequestContext ctx , Throwable cause ) { } }
logger . trace ( "{} Cannot initiate SAML authentication" , ctx , cause ) ; return HttpResponse . of ( HttpStatus . UNAUTHORIZED ) ;
public class WktService { /** * Format a given geometry to EWKT . EWKT is an extension of WKT that adds the SRID into the returned string . The * result is something like : " SRID = 4326 ; POINT ( - 44.3 60.1 ) " * @ param geometry * The geometry to format . * @ return Returns the EWKT string . * @ throws Wkt...
return "SRID=" + geometry . getSrid ( ) + ";" + WktService . toWkt ( geometry ) ;
public class JspWriterImpl { /** * Flush the output buffer to the underlying character stream , without * flushing the stream itself . This method is non - private only so that it * may be invoked by PrintStream . */ protected final void flushBuffer ( ) throws IOException { } }
if ( bufferSize == 0 ) return ; flushed = true ; // defect 312981 begin // ensureOpen ( ) ; if ( closed ) { throw new IOException ( "Stream closed" ) ; } // defect 312981 end if ( nextChar == 0 ) { // PK90190 - start // add check for property to create the writer even when the buffer is empty if ( WCCustomProperties . ...
public class TimeAxis { /** * / * [ deutsch ] * < p > Sind die angegebenen Zeiteinheiten ineinander konvertierbar ? < / p > * < p > Konvertierbarkeit bedeutet , da & szlig ; immer ein konstanter * ganzzahliger Faktor zur Umrechnung zwischen den Zeiteinheiten * angewandt werden kann . Beispiele f & uuml ; r konv...
Set < U > set = this . convertibleUnits . get ( unit1 ) ; return ( ( set != null ) && set . contains ( unit2 ) ) ;
public class GCFARCImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case AfplibPackage . GCFARC__MH : return getMH ( ) ; case AfplibPackage . GCFARC__MFR : return getMFR ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
public class JsonWriter { /** * Writes a { @ code Boolean } object to a character stream . * @ param value a { @ code Boolean } object to write to a character - output stream * @ return this JsonWriter * @ throws IOException if an I / O error has occurred */ public JsonWriter writeValue ( Boolean value ) throws I...
if ( ! willWriteValue ) { indent ( ) ; } writer . write ( value . toString ( ) ) ; willWriteValue = false ; return this ;
public class JsonParser { /** * Skips the values of all keys in the current object until it finds one of the given keys . * < p > Before this method is called , the parser must either point to the start or end of a JSON * object or to a field name . After this method ends , the current token will either be the { @ ...
JsonToken curToken = startParsingObjectOrArray ( ) ; while ( curToken == JsonToken . FIELD_NAME ) { String key = getText ( ) ; nextToken ( ) ; if ( keysToFind . contains ( key ) ) { return key ; } skipChildren ( ) ; curToken = nextToken ( ) ; } return null ;
public class MapParser { /** * helper to convert to integer */ private static int convertAttributeToInt ( final String attribute ) { } }
if ( attribute == null ) { return 0 ; } try { return Integer . parseInt ( attribute ) ; } catch ( final Exception ignore ) { return 0 ; }
public class BufferedByteOutputStream { /** * Waits until the buffer has been written to underlying stream . * Flushes the underlying stream . */ public void flush ( ) throws IOException { } }
// check if the stream has been closed checkError ( ) ; // how many bytes were written to the buffer long totalBytesWritten = buffer . totalWritten ( ) ; // unblock reads from the buffer buffer . unblockReads ( ) ; // wait until the write thread transfers everything from the // buffer to the stream while ( writeThread ...
public class Statistics { /** * Sets the number of distinct values statistic for the given column . */ public Statistics columnDistinctCount ( String columnName , Long ndv ) { } }
this . columnStats . computeIfAbsent ( columnName , column -> new HashMap < > ( ) ) . put ( DISTINCT_COUNT , String . valueOf ( ndv ) ) ; return this ;
public class Server { /** * Add Web Applications . * Add auto webapplications to the server . The name of the * webapp directory or war is used as the context name . If a * webapp is called " root " it is added at " / " . * @ param webapps Directory file name or URL to look for auto webapplication . * @ excep...
return addWebApplications ( null , webapps , null , false ) ;
public class ServicePool { /** * Execute a callback on a specific end point . * NOTE : This method is package private specifically so that { @ link AsyncServicePool } can call it . */ < R > R executeOnEndPoint ( ServiceEndPoint endPoint , ServiceCallback < S , R > callback ) throws Exception { } }
ServiceHandle < S > handle = null ; try { handle = _serviceCache . checkOut ( endPoint ) ; Timer . Context timer = _callbackExecutionTime . time ( ) ; try { return callback . call ( handle . getService ( ) ) ; } finally { timer . stop ( ) ; } } catch ( NoCachedInstancesAvailableException e ) { LOG . info ( "Service cac...
public class SmbResourceLocatorImpl { /** * { @ inheritDoc } * @ see jcifs . SmbResourceLocator # getCanonicalURL ( ) */ @ Override public String getCanonicalURL ( ) { } }
String str = this . url . getAuthority ( ) ; if ( str != null && ! str . isEmpty ( ) ) { return "smb://" + this . url . getAuthority ( ) + this . getURLPath ( ) ; } return "smb://" ;
public class PackageUseWriter { /** * Add a row for the class that uses the given package . * @ param usedClass the class that uses the given package * @ param pkg the package to which the class belongs * @ param contentTree the content tree to which the row will be added */ protected void addClassRow ( TypeEleme...
DocPath dp = pathString ( usedClass , DocPaths . CLASS_USE . resolve ( DocPath . forName ( utils , usedClass ) ) ) ; StringContent stringContent = new StringContent ( utils . getSimpleName ( usedClass ) ) ; Content thType = HtmlTree . TH_ROW_SCOPE ( HtmlStyle . colFirst , getHyperLink ( dp . fragment ( getPackageAnchor...
public class ScopeServices { /** * Connects and resets any settings and services that the client used earlier . */ private void connect ( ) { } }
ClientInfo . Builder info = ClientInfo . newBuilder ( ) . setFormat ( "protobuf" ) ; executeMessage ( ScopeMessage . CONNECT , info ) ;
public class JCudnn { /** * < pre > * DEPRECATED routines to be removed next release : * User should use the non - suffixed version ( which has the API and functionality of _ v6 version ) * Routines with _ v5 suffix has the functionality of the non - suffixed routines in the CUDNN V6 * < / pre > */ public stati...
return checkResult ( cudnnSetRNNDescriptor_v6Native ( handle , rnnDesc , hiddenSize , numLayers , dropoutDesc , inputMode , direction , mode , algo , dataType ) ) ;
public class MobileCommand { /** * This method forms a { @ link java . util . Map } of parameters for the * keyboard hiding . * @ param keyName The button pressed by the mobile driver to attempt hiding the * keyboard . * @ return a key - value pair . The key is the command name . The value is a * { @ link jav...
return new AbstractMap . SimpleEntry < > ( HIDE_KEYBOARD , prepareArguments ( "keyName" , keyName ) ) ;
public class Minimizer { /** * Adds a block to the partition . */ private void addToPartition ( Block < S , L > block ) { } }
ElementReference ref = partition . referencedAdd ( block ) ; block . setPartitionReference ( ref ) ;
public class FileUtil { /** * splits given fileName into name and extension . * @ param fileName fileName * @ return string array is of length 2 , where 1st item is name and 2nd item is extension ( null if no extension ) */ public static String [ ] split ( String fileName ) { } }
int dot = fileName . lastIndexOf ( '.' ) ; if ( dot == - 1 ) return new String [ ] { fileName , null } ; else return new String [ ] { fileName . substring ( 0 , dot ) , fileName . substring ( dot + 1 ) } ;
import java . io . * ; import java . lang . * ; import java . util . * ; import java . math . * ; class CountUniquePairs { /** * The function calculates the number of unique pairs in a given list . * Args : * elements : The list of elements . * elements _ count : The count of elements in the list . * Returns : ...
int uniquePairsCount = 0 ; for ( int index = 0 ; index < elementsCount ; index ++ ) { for ( int nextIndex = index + 1 ; nextIndex < elementsCount ; nextIndex ++ ) { if ( ! elements . get ( index ) . equals ( elements . get ( nextIndex ) ) ) { uniquePairsCount += 1 ; } } } return uniquePairsCount ;
public class SimpleMDAGNode { /** * 二分搜索 * @ param mdagDataArray * @ param node * @ return */ private int binarySearch ( SimpleMDAGNode [ ] mdagDataArray , char node ) { } }
if ( transitionSetSize < 1 ) { return - 1 ; } int high = transitionSetBeginIndex + transitionSetSize - 1 ; int low = transitionSetBeginIndex ; while ( low <= high ) { int mid = ( ( low + high ) >>> 1 ) ; int cmp = mdagDataArray [ mid ] . getLetter ( ) - node ; if ( cmp < 0 ) low = mid + 1 ; else if ( cmp > 0 ) high = m...
public class BusNetwork { /** * Add a bus stop inside the bus network . * @ param busStop is the bus stop to insert . * @ return < code > true < / code > if the bus stop was added , otherwise < code > false < / code > */ public boolean addBusStop ( BusStop busStop ) { } }
if ( busStop == null ) { return false ; } if ( this . validBusStops . contains ( busStop ) ) { return false ; } if ( ListUtil . contains ( this . invalidBusStops , INVALID_STOP_COMPARATOR , busStop ) ) { return false ; } final boolean isValidPrimitive = busStop . isValidPrimitive ( ) ; if ( isValidPrimitive ) { if ( ! ...
public class RelatedTablesCoreExtension { /** * Adds a relationship between the base and user related table . Creates a * default user mapping table and the related table if needed . * @ param baseTableName * base table name * @ param relatedTable * user related table * @ param relationName * relation nam...
UserMappingTable userMappingTable = UserMappingTable . create ( mappingTableName ) ; return addRelationship ( baseTableName , relatedTable , relationName , userMappingTable ) ;
public class DrizzleStatement { /** * Retrieves the first warning reported by calls on this < code > Statement < / code > object . Subsequent * < code > Statement < / code > object warnings will be chained to this < code > SQLWarning < / code > object . * < p > The warning chain is automatically cleared each time a...
if ( ! warningsCleared && queryResult != null && queryResult . getWarnings ( ) > 0 ) { return new SQLWarning ( queryResult . getMessage ( ) ) ; } return null ;
public class ObjectUnderFileSystem { /** * Gets a ( partial ) object listing for the given path . * @ param path of pseudo - directory * @ param recursive whether to request immediate children only , or all descendants * @ return chunked object listing , or null if the path does not exist as a pseudo - directory ...
// Check if anything begins with < folder _ path > / String dir = stripPrefixIfPresent ( path ) ; ObjectListingChunk objs = getObjectListingChunk ( dir , recursive ) ; // If there are , this is a folder and we can create the necessary metadata if ( objs != null && ( ( objs . getObjectStatuses ( ) != null && objs . getO...
public class SoapUIExtensionMockAsWarGenerator { /** * we should provide a PR to let us inject implementation of the MockAsWar */ @ Override protected boolean runRunner ( ) throws Exception { } }
WsdlProject project = ( WsdlProject ) ProjectFactoryRegistry . getProjectFactory ( "wsdl" ) . createNew ( getProjectFile ( ) , getProjectPassword ( ) ) ; String pFile = getProjectFile ( ) ; project . getSettings ( ) . setString ( ProjectSettings . SHADOW_PASSWORD , null ) ; File tmpProjectFile = new File ( System . get...
public class PropertyNameResolver { /** * Indicates whether or not the expression contains nested property expressions or not . * @ param expression The property expression * @ return The next property expression */ public boolean hasNested ( String expression ) { } }
if ( expression == null || expression . length ( ) == 0 ) return false ; else return remove ( expression ) != null ;