signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class LNGVector { /** * Replaces the contents of this vector with the contents of another vector in - place . * @ param other the other vector * @ throws IllegalArgumentException if you try to replace a vector with itself */ @ SuppressWarnings ( "unchecked" ) public void replaceInplace ( final LNGVector < ? ...
if ( this == other ) throw new IllegalArgumentException ( "cannot replace a vector in-place with itself" ) ; this . elements = ( T [ ] ) new Object [ other . size ( ) ] ; for ( int i = 0 ; i < other . size ( ) ; i ++ ) this . elements [ i ] = other . get ( i ) ; this . size = other . size ;
public class StoreLabelsResponseExtractor { /** * Parse the response , which includes label settings and command status . * We expect only one FETCH response as we only set labels on one msg . * http : / / code . google . com / apis / gmail / imap / # x - gm - labels * C : a011 STORE _ FLAGS 1 + X - GM - LABELS (...
boolean gotFetch = false ; Set < String > result = null ; // Find FETCH , throw error if none or more than one , or if we receive an error response . String fetchStr = null ; for ( int i = 0 , messagesSize = messages . size ( ) ; i < messagesSize ; i ++ ) { String message = messages . get ( i ) ; if ( null == message |...
public class SecurityServiceImpl { /** * { @ inheritDoc } */ @ Override public AuthorizationService getAuthorizationService ( ) { } }
AuthorizationService service = authzService . get ( ) ; if ( service == null ) { if ( isConfigurationDefinedInFile ( ) ) { String id = getEffectiveSecurityConfiguration ( ) . getAuthorizationServiceId ( ) ; service = getAuthorizationService ( id ) ; } else { service = autoDetectAuthorizationService ( ) ; } // remember ...
public class CurdDaoImpl { /** * 更新实体之前的处理 * @ param entity * @ return */ private T onBeforeUpdate ( T entity ) { } }
// TODO 更新前的操作 Class < ? > cls = entity . getClass ( ) ; String entityName = cls . getName ( ) ; String idFieldName = getIdFieldName ( cls ) ; ID id = entity . getId ( ) ; String indexName = DaoHelper . getExtendFieldName ( cls , ExtendField . Index ) ; String pathName = DaoHelper . getExtendFieldName ( cls , ExtendFie...
public class Cells { /** * Returns the { @ code URL } value of the { @ link Cell } ( associated to { @ code table } ) whose name iscellName , or null if * this Cells object contains no cell whose name is cellName . * @ param nameSpace the name of the owning table * @ param cellName the name of the Cell we want to...
return getValue ( nameSpace , cellName , URL . class ) ;
public class AuthenticationContext { /** * Acquires a security token from the authority using a Refresh Token * previously received . * @ param refreshToken * Refresh Token to use in the refresh flow . * @ param credential * object representing Private Key to use for token acquisition . * @ param resource ...
return acquireTokenByRefreshToken ( refreshToken , credential . getClientId ( ) , JwtHelper . buildJwt ( credential , this . authenticationAuthority . getSelfSignedJwtAudience ( ) ) , resource , callback ) ;
public class ReefEventStateManager { /** * convert time from long to formatted string . * @ param time * @ return */ private String convertTime ( final long time ) { } }
final Date date = new Date ( time ) ; return FORMAT . format ( date ) ;
public class IOGroovyMethods { /** * This method tries to read subsequent buffers from the reader using a mark */ private static String readLineFromReaderWithMark ( final Reader input ) throws IOException { } }
char [ ] cbuf = new char [ charBufferSize ] ; try { input . mark ( charBufferSize ) ; } catch ( IOException e ) { // this should never happen LOG . warning ( "Caught exception setting mark on supporting reader: " + e ) ; // fallback return readLineFromReaderWithoutMark ( input ) ; } // could be changed into do . . whil...
public class StringUtils { /** * Generates the MD5 checksum for the specified message . * @ param message The message . * @ return The hexadecimal checksum . */ public static String md5 ( final String message ) { } }
byte [ ] res ; try { MessageDigest instance = MessageDigest . getInstance ( "MD5" ) ; instance . reset ( ) ; instance . update ( message . getBytes ( ) ) ; res = instance . digest ( ) ; } catch ( final NoSuchAlgorithmException ex ) { throw new RuntimeException ( ex ) ; } StringBuilder hexString = new StringBuilder ( ) ...
public class BasicODataClientQuery { /** * Returns a StringBuilder that is consisted of filtering and expanding parameters that in turn are appended * to the query string used for Odata Client . * An Odata Client query can have either one of filter or expand parameters ( with multiple properties * if desired ) or...
StringBuilder parameters = new StringBuilder ( ) ; if ( filterMap == null && expandParameters == null ) { return parameters ; } parameters . append ( '?' ) ; int filterParameterCounter = 0 ; if ( filterMap != null && ! filterMap . isEmpty ( ) ) { parameters . append ( FILTER_PREFIX ) ; for ( Map . Entry < String , Stri...
public class VPTree { /** * Euclidean distance * @ return the distance between the two points */ public float distance ( INDArray arr1 , INDArray arr2 ) { } }
if ( scalars == null ) scalars = new ThreadLocal < > ( ) ; if ( Nd4j . scalar ( 0.0f ) . equals ( scalars . get ( ) ) ) scalars . set ( Nd4j . scalar ( 0.0 ) ) ; switch ( similarityFunction ) { case "jaccard" : float ret7 = Nd4j . getExecutioner ( ) . execAndReturn ( new JaccardDistance ( arr1 , arr2 , scalars . get ( ...
public class DRL5Lexer { /** * $ ANTLR start " MINUS " */ public final void mMINUS ( ) throws RecognitionException { } }
try { int _type = MINUS ; int _channel = DEFAULT_TOKEN_CHANNEL ; // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 309:7 : ( ' - ' ) // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 309:9 : ' - ' { match ( '-' ) ; if ( state . failed ) return ; } state . type = _ty...
public class SpaceGroup { /** * Given a rotation matrix calculates the rotation axis and angle for it . * The angle is calculated from the trace , the axis from the eigenvalue * decomposition . * If given matrix is improper rotation or identity matrix then * axis ( 0,0,0 ) and angle 0 are returned . * @ param...
double determinant = m . determinant ( ) ; if ( ! ( Math . abs ( determinant ) - 1.0 < DELTA ) ) throw new IllegalArgumentException ( "Given matrix is not a rotation matrix" ) ; AxisAngle4d axisAndAngle = new AxisAngle4d ( new Vector3d ( 0 , 0 , 0 ) , 0 ) ; double [ ] d = { m . m00 , m . m10 , m . m20 , m . m01 , m . m...
public class MaxTxId { /** * Store the specified transaction in ZooKeeper irrespective of what the * current max transaction id is ( can be used to reset the max transaction * to an older one ) . * @ param maxTxId The max transaction id to set * @ throws StaleVersionException If last max transaction id read by ...
maxTxIdWritable . set ( maxTxId ) ; try { byte [ ] data = WritableUtil . writableToByteArray ( maxTxIdWritable ) ; if ( lastZNodeStat != null ) { try { zooKeeper . setData ( fullyQualifiedZNode , data , lastZNodeStat . getVersion ( ) ) ; } catch ( KeeperException . BadVersionException e ) { LOG . error ( fullyQualified...
public class Interceptors { /** * Extracts a set of interceptor bindings from a collection of annotations . * @ param beanManager * @ param annotations * @ return */ public static Set < Annotation > filterInterceptorBindings ( BeanManagerImpl beanManager , Collection < Annotation > annotations ) { } }
Set < Annotation > interceptorBindings = new InterceptorBindingSet ( beanManager ) ; for ( Annotation annotation : annotations ) { if ( beanManager . isInterceptorBinding ( annotation . annotationType ( ) ) ) { interceptorBindings . add ( annotation ) ; } } return interceptorBindings ;
public class FrameHandler { /** * Return a safe copy of all registered { @ link MessageHandler } s . */ public final Set < MessageHandler > getHandlers ( ) { } }
Set < MessageHandler > msgHandlers = new HashSet < > ( ) ; for ( HandlerWrapper handler : handlers . values ( ) ) { msgHandlers . add ( handler . getHandler ( ) ) ; } return msgHandlers ;
public class ProductSegmentation { /** * Gets the deviceManufacturerSegment value for this ProductSegmentation . * @ return deviceManufacturerSegment * The device manufacturer segmentation . { @ link DeviceFamilyTargeting # isTargeted } * must be { @ code * true } . * < p > This attribute is optional . */ publi...
return deviceManufacturerSegment ;
public class WebAppDescriptorImpl { /** * If not already created , a new < code > servlet < / code > element will be created and returned . * Otherwise , the first existing < code > servlet < / code > element will be returned . * @ return the instance defined for the element < code > servlet < / code > */ public Se...
List < Node > nodeList = model . get ( "servlet" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new ServletTypeImpl < WebAppDescriptor > ( this , "servlet" , model , nodeList . get ( 0 ) ) ; } return createServlet ( ) ;
public class SessionCreateManager { /** * Sets id of current authentication process . * @ param sessionAuthId id of current authentication process . */ void setId ( String sessionAuthId ) { } }
synchronized ( lock ) { if ( isCreatingSession . get ( ) ) { this . sessionAuthId = sessionAuthId ; } lock . notifyAll ( ) ; }
public class DbxWebAuth { /** * Starts authorization and returns an " authorization URL " on the Dropbox website that * let the user grant your app access to their Dropbox account . * < p > If a redirect URI was specified ( { @ link Request . Builder # withRedirectUri } ) , then users * will be redirected to the ...
if ( deprecatedRequest != null ) { throw new IllegalStateException ( "Must create this instance using DbxWebAuth(DbxRequestConfig,DbxAppInfo) to call this method." ) ; } if ( ! appInfo . hasSecret ( ) ) { throw new IllegalStateException ( "For native apps, please use DbxPKCEWebAuth" ) ; } return authorizeImpl ( request...
public class ConfigRepository { /** * Loads up the configuration data for the specified object . * @ return a map containing field / value pairs for all stored configuration data . */ public HashMap < String , String > loadConfig ( String node , String object ) { } }
HashMap < String , String > data = Maps . newHashMap ( ) ; for ( ConfigRecord record : from ( ConfigRecord . class ) . where ( ConfigRecord . OBJECT . eq ( object ) , ConfigRecord . NODE . eq ( node ) ) . select ( ) ) { data . put ( record . field , record . value ) ; } return data ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link CompanyCurrency } { @ code > } } */ @ XmlElementDecl ( namespace = "http://schema.intuit.com/finance/v3" , name = "CompanyCurrency" , substitutionHeadNamespace = "http://schema.intuit.com/finance/v3" , substitutionHead...
return new JAXBElement < CompanyCurrency > ( _CompanyCurrency_QNAME , CompanyCurrency . class , null , value ) ;
public class ImportStringsAction { /** * get result . */ @ Override public void getResult ( final ContentHandler buf ) throws SAXException { } }
final String templateFilePath = paramTable . get ( FileGenerator . PARAM_TEMPLATE ) ; for ( final Value value : valueSet ) { buf . startElement ( NULL_NS_URI , "stringfile" , "stringfile" , new AttributesBuilder ( ) . build ( ) ) ; final char [ ] location = FileUtils . getRelativeUnixPath ( templateFilePath , value . v...
public class CPDAvailabilityEstimateServiceUtil { /** * NOTE FOR DEVELOPERS : * Never modify this class directly . Add custom service methods to { @ link com . liferay . commerce . service . impl . CPDAvailabilityEstimateServiceImpl } and rerun ServiceBuilder to regenerate this class . */ public static com . liferay ...
return getService ( ) . fetchCPDAvailabilityEstimateByCPDefinitionId ( cpDefinitionId ) ;
public class CmsPreferences { /** * Sets the " direct edit button style " setting . < p > * @ param value a String representation of an int value to set the " direct edit button style " setting */ public void setParamTabEdDirectEditButtonStyle ( String value ) { } }
try { m_userSettings . setDirectEditButtonStyle ( Integer . parseInt ( value ) ) ; } catch ( Throwable t ) { // should usually never happen }
public class J { /** * Aliases of nested joins are determined at runtime . To refer a nested join , this method should be used to get a correct alias . * For example , there is a query * < code > Q . from ( QGroup . group ) . joins ( J . left ( QPerson . person ) . nested ( J . left ( QContact . contact ) . nested ...
Assert . notNull ( father ) ; Assert . notNull ( grandFather ) ; EntityPath < ? > parentPath = path ( grandFather , father ) ; return path ( parentPath , path ) ;
public class PointLocationFormatter { /** * Formats a point location as an ISO 6709 string . * @ param pointLocation * Point location to format * @ return Formatted string */ private static String formatISO6709Short ( final PointLocation pointLocation ) { } }
final Latitude latitude = pointLocation . getLatitude ( ) ; final Longitude longitude = pointLocation . getLongitude ( ) ; String string = formatLatitudeShort ( latitude ) + formatLongitudeShort ( longitude ) ; final double altitude = pointLocation . getAltitude ( ) ; string = string + formatAltitudeWithSign ( altitude...
public class CollapsibleSplitLayoutPanel { /** * Sets whether or not double - clicking on the splitter should toggle the * display of the widget . * @ param child the child whose display toggling will be allowed or not . * @ param allowed whether or not display toggling is allowed for this widget */ public void s...
assertIsChild ( child ) ; Splitter splitter = getAssociatedSplitter ( child ) ; // The splitter is null for the center element . if ( splitter != null ) { splitter . setToggleDisplayAllowed ( allowed ) ; }
public class RhythmicalTomcat { protected Context createContext ( Host host , String url ) { } }
// similar to super class ' s private method String contextClass = StandardContext . class . getName ( ) ; if ( host == null ) { host = this . getHost ( ) ; } if ( host instanceof StandardHost ) { contextClass = ( ( StandardHost ) host ) . getContextClass ( ) ; } final Context ctx ; try { ctx = ( Context ) Class . forN...
public class CacheEntryViews { /** * Creates a { @ link DefaultCacheEntryView } instance . * @ param key the key to be wrapped * @ param value the value to be wrapped * @ param record { @ link CacheRecord } instance to gather additional entry view properties like access time , * expiration time and access hit ...
CacheEntryView entryView = new DefaultCacheEntryView ( key , value , record . getCreationTime ( ) , record . getExpirationTime ( ) , record . getLastAccessTime ( ) , record . getAccessHit ( ) , expiryPolicy ) ; return entryView ;
public class ColorUtil { /** * Blends the two supplied colors , using the supplied percentage * as the amount of the first color to use . * @ param firstperc The percentage of the first color to use , from 0.0f * to 1.0f inclusive . */ public static final Color blend ( Color c1 , Color c2 , float firstperc ) { } ...
float p2 = 1.0f - firstperc ; return new Color ( ( int ) ( c1 . getRed ( ) * firstperc + c2 . getRed ( ) * p2 ) , ( int ) ( c1 . getGreen ( ) * firstperc + c2 . getGreen ( ) * p2 ) , ( int ) ( c1 . getBlue ( ) * firstperc + c2 . getBlue ( ) * p2 ) ) ;
public class PackagesToContainingMavenArtifactsIndex { /** * For given API artifact , finds the projects whose Java classes use artifact ' s classes , * and links them in the graph . */ public boolean moduleContainsPackagesFromAPI ( ProjectModel projectModel , MavenCoord apiCoords ) { } }
ArchiveCoordinateModel archive = new ArchiveCoordinateService ( graphContext , ArchiveCoordinateModel . class ) . findSingle ( apiCoords . getGroupId ( ) , apiCoords . getArtifactId ( ) , null ) ; if ( archive == null ) return false ; // return graphContext . testIncidence ( projectModel . asVertex ( ) , archive . asVe...
public class ModelErrorException { /** * Original status code . * @ param originalStatusCode * Original status code . */ @ com . fasterxml . jackson . annotation . JsonProperty ( "OriginalStatusCode" ) public void setOriginalStatusCode ( Integer originalStatusCode ) { } }
this . originalStatusCode = originalStatusCode ;
public class SecurityUtil { /** * Redirect < code > System . out < / code > and < code > System . err < / code > streams to the given SLF4J loggers . * This is a benefit if you have a legacy console logger application . Does not provide * benefit of a full implementation . For example , no hierarchical or logger in...
SecurityUtil . sysOutLogger = sysOutLogger ; SecurityUtil . sysErrLogger = sysErrLogger ; bindSystemStreamsToSLF4J ( ) ;
public class AddMultiAssetResponsiveDisplayAd { /** * Creates and uploads an { @ link ImageAsset } for the specified URL . * @ return the ID of the { @ link ImageAsset } . * @ throws IOException if unable to read the image from the specified URL . */ private static long uploadImageAsset ( AdWordsServicesInterface a...
AssetServiceInterface assetService = adWordsServices . get ( session , AssetServiceInterface . class ) ; // Create the image asset . ImageAsset image = new ImageAsset ( ) ; // Optional : Provide a unique friendly name to identify your asset . If you specify the assetName // field , then both the asset name and the imag...
public class Instance { /** * < pre > * Availability of the instance . * & # 64 ; OutputOnly * < / pre > * < code > . google . appengine . v1 . Instance . Availability availability = 4 ; < / code > */ public com . google . appengine . v1 . Instance . Availability getAvailability ( ) { } }
com . google . appengine . v1 . Instance . Availability result = com . google . appengine . v1 . Instance . Availability . valueOf ( availability_ ) ; return result == null ? com . google . appengine . v1 . Instance . Availability . UNRECOGNIZED : result ;
public class FilteredJobLifecycleListener { /** * { @ inheritDoc } */ @ Override public void onStageTransition ( JobExecutionState state , String previousStage , String newStage ) { } }
if ( this . filter . apply ( state . getJobSpec ( ) ) ) { this . delegate . onStageTransition ( state , previousStage , newStage ) ; }
public class CRFClassifier { /** * end class TestSequenceModel */ @ Override public List < IN > classify ( List < IN > document ) { } }
if ( flags . doGibbs ) { try { return classifyGibbs ( document ) ; } catch ( Exception e ) { System . err . println ( "Error running testGibbs inference!" ) ; e . printStackTrace ( ) ; return null ; } } else if ( flags . crfType . equalsIgnoreCase ( "maxent" ) ) { return classifyMaxEnt ( document ) ; } else { throw new...
public class GlobalizationPreferences { /** * Gets a date format according to the current settings . If there * is an explicit ( non - null ) date / time format set , a copy of that * is returned . Otherwise , the language priority list is used . * DF _ NONE should be used for the style , where only the date or ...
if ( dateStyle == DF_NONE && timeStyle == DF_NONE || dateStyle < 0 || dateStyle >= DF_LIMIT || timeStyle < 0 || timeStyle >= DF_LIMIT ) { throw new IllegalArgumentException ( "Illegal date format style arguments" ) ; } DateFormat result = null ; if ( dateFormats != null ) { result = dateFormats [ dateStyle ] [ timeStyl...
public class NfsCreateResponse { /** * ( non - Javadoc ) * @ see com . emc . ecs . nfsclient . nfs . NfsResponseBase # unmarshalling ( com . emc . ecs . * nfsclient . rpc . Xdr ) */ public void unmarshalling ( Xdr xdr ) throws RpcException { } }
super . unmarshalling ( xdr ) ; if ( stateIsOk ( ) ) { unmarshallingFileHandle ( xdr ) ; unmarshallingAttributes ( xdr ) ; } _directoryWccData = new NfsWccData ( xdr ) ;
public class Hashes { /** * Constant - time SpookyHash 4 - word - state hashing reusing precomputed state * partially . * @ param bv * a bit vector . * @ param seed * a seed for the hash . * @ param state * the state vector returned by * { @ link # preprocessSpooky4 ( BitVector , long ) } ; note that ...
"fallthrough" } ) public static void spooky4 ( final BitVector bv , final long prefixLength , final long seed , final long [ ] state , final long [ ] tuple ) { long h0 , h1 , h2 , h3 ; h0 = seed ; h1 = seed ; h2 = ARBITRARY_BITS ; h3 = ARBITRARY_BITS ; long pos ; if ( prefixLength >= 2 * Long . SIZE ) { final int p = 4...
public class DeviceProxyDAODefaultImpl { private void setRequestArgsForReadAttr ( final Request request , final String [ ] names , final DevSource src , final ClntIdent ident , final TypeCode return_type ) { } }
Any any ; any = request . add_in_arg ( ) ; DevVarStringArrayHelper . insert ( any , names ) ; // Add source if any if ( src != null ) { any = request . add_in_arg ( ) ; DevSourceHelper . insert ( any , src ) ; } if ( ident != null ) { any = request . add_in_arg ( ) ; ClntIdentHelper . insert ( any , ident ) ; } request...
public class DefaultCompanyProvider { /** * In case of the illegal hostname characters in company name * and truncate it if it is too long ( length & gt ; 10 ) after escape * It is compatible with other non - latin language and will not change the original result for latin language . * P . S . Actually the best w...
if ( domain != null ) { return ; } String host = TextUtils . stripAccents ( StringUtils . strip ( StringUtils . deleteWhitespace ( name . toLowerCase ( ) ) , "." ) . replace ( "/" , "" ) ) ; int len1 = host . length ( ) ; host = StringEscapeUtils . escapeJava ( host ) . replaceAll ( "\\\\u" , "" ) ; int len2 = host . l...
public class CertUtil { /** * Writes certificate to the specified output stream in PEM format . */ public static void writeCertificate ( OutputStream out , X509Certificate cert ) throws IOException , CertificateEncodingException { } }
CertificateIOUtil . writeCertificate ( out , cert ) ;
public class OptionUtil { /** * Format a parameter description . * @ param param Parameter * @ return Parameter description */ public static String getFullDescription ( Parameter < ? > param ) { } }
StringBuilder description = new StringBuilder ( 1000 ) . append ( param . getShortDescription ( ) ) . append ( FormatUtil . NEWLINE ) ; param . describeValues ( description ) ; if ( ! FormatUtil . endsWith ( description , FormatUtil . NEWLINE ) ) { description . append ( FormatUtil . NEWLINE ) ; } if ( param . hasDefau...
public class AmazonCloudSearchDomainClient { /** * Retrieves autocomplete suggestions for a partial query string . You can use suggestions enable you to display * likely matches before users finish typing . In Amazon CloudSearch , suggestions are based on the contents of a * particular text field . When you request...
request = beforeClientExecution ( request ) ; return executeSuggest ( request ) ;
public class CheckSumUtils { /** * Returns the MD5 Checksum of the input stream * @ param is * the input stream * @ return the Checksum of the input stream * @ throws IOException * if an IO exception occurs */ public static String getMD5Checksum ( InputStream is ) throws IOException { } }
byte [ ] digest = null ; try { MessageDigest md = MessageDigest . getInstance ( JawrConstant . MD5_ALGORITHM ) ; InputStream digestIs = new DigestInputStream ( is , md ) ; // read stream to EOF as normal . . . while ( digestIs . read ( ) != - 1 ) { } digest = md . digest ( ) ; } catch ( NoSuchAlgorithmException e ) { t...
public class CmsGroupTable { /** * Updates the app . < p > * @ param uuid of current group */ protected void updateApp ( String uuid ) { } }
try { CmsGroup group = m_cms . readGroup ( new CmsUUID ( uuid ) ) ; m_app . update ( group . getOuFqn ( ) , m_type , group . getId ( ) , "" ) ; } catch ( CmsException e ) { LOG . error ( "unable to read group." , e ) ; }
public class ObservableSupport { /** * public methods - - - - - */ public void addObservableListener ( ObservableListener < T > listener ) { } }
checkNotNull ( listener , "listener cannot be null" ) ; listeners . add ( ObservableListener . class , listener ) ;
public class FTPServerFacade { /** * Convert the exception to a negative 451 reply , and pipe * it to the provided control channel . */ public static void exceptionToControlChannel ( Throwable e , String msg , BasicServerControlChannel control ) { } }
// how to convert exception stack trace to string ? // i am sure it can be done easier . java . io . StringWriter writer = new java . io . StringWriter ( ) ; e . printStackTrace ( new java . io . PrintWriter ( writer ) ) ; String stack = writer . toString ( ) ; // 451 Requested action aborted : local error in processin...
public class RaftNodeImpl { /** * Executes query operation sets execution result to the future . */ public void runQueryOperation ( Object operation , SimpleCompletableFuture resultFuture ) { } }
long commitIndex = state . commitIndex ( ) ; Object result = raftIntegration . runOperation ( operation , commitIndex ) ; resultFuture . setResult ( result ) ;
public class FunctionExpression { /** * Get the idx parameter from the parameter list as double . * @ param idx * the index starting with 0 * @ param defaultValue * the result if such a parameter idx does not exists . * @ param formatter * current formatter * @ return the expression */ private double getD...
if ( parameters . size ( ) <= idx ) { return defaultValue ; } return parameters . get ( idx ) . doubleValue ( formatter ) ;
public class SdkInstaller { /** * Configure and create a new Installer instance . * @ param managedSdkDirectory home directory of google cloud java managed cloud SDKs * @ param version version of the Cloud SDK we want to install * @ param osInfo target operating system for installation * @ param userAgentString...
DownloaderFactory downloaderFactory = new DownloaderFactory ( userAgentString ) ; ExtractorFactory extractorFactory = new ExtractorFactory ( ) ; InstallerFactory installerFactory = version == Version . LATEST ? new InstallerFactory ( osInfo , usageReporting ) : null ; FileResourceProviderFactory fileResourceProviderFac...
public class GrailsHibernateUtil { /** * Configures the criteria instance to cache based on the configured mapping . * @ param targetClass The target class * @ param criteria The criteria */ public static void cacheCriteriaByMapping ( Class < ? > targetClass , Criteria criteria ) { } }
Mapping m = GrailsDomainBinder . getMapping ( targetClass ) ; if ( m != null && m . getCache ( ) != null && m . getCache ( ) . getEnabled ( ) ) { criteria . setCacheable ( true ) ; }
public class Element { /** * Add element Attributes . * The attributes are added to the Element attributes ( separated with * a space ) . The attributes are available to the derived class in the * protected member String < I > attributes < / I > * @ param attributes String of HTML attributes to add to the eleme...
if ( log . isDebugEnabled ( ) && attributes != null && attributes . indexOf ( '=' ) >= 0 ) log . warn ( "Set attribute with old method: " + attributes + " on " + getClass ( ) . getName ( ) ) ; if ( attributes == null || this . attributes == null || this . attributes == noAttributes || this . attributes . length ( ) == ...
public class Common { /** * Write a transaction to the Log . * @ param info The type of transaction to log . * @ param cause The cause of the transaction . * @ param causeReason The reason of the cause * @ param account The account being impacted by the change * @ param amount The amount of money in this tran...
if ( getMainConfig ( ) . getBoolean ( "System.Logging.Enabled" ) ) { getStorageHandler ( ) . getStorageEngine ( ) . saveLog ( info , cause , causeReason , account , amount , currency , worldName ) ; }
public class SingleValueReference { /** * Set a string value to bean based on known conversion rule and value reference * @ param bean Bean to set value to * @ param value String expression of value to set */ void setValue ( T bean , String value ) { } }
ref . writeValue ( converter . fromCharacters ( value ) , bean ) ;
public class TextReport { /** * Filter stack trace if { @ link # addConfigured ( StackTraceFilter ) } . */ private String filterStackTrace ( String trace ) { } }
for ( StackTraceFilter filter : stackFilters ) { trace = filter . apply ( trace ) ; } return trace ;
public class ResourceConverter { /** * Creates relationship object by consuming provided ' data ' node . * @ param relationshipDataNode relationship data node * @ param type object type * @ return created object or < code > null < / code > in case data node is not valid * @ throws IOException * @ throws Illeg...
if ( ValidationUtils . isRelationshipParsable ( relationshipDataNode ) ) { String identifier = createIdentifier ( relationshipDataNode ) ; if ( resourceCache . contains ( identifier ) ) { return resourceCache . get ( identifier ) ; } else { // Never cache relationship objects resourceCache . lock ( ) ; try { return rea...
public class CacheSpec { /** * Gets cache type . * @ return the cache type */ public CacheEngine getEngine ( ) { } }
if ( StringUtils . isNullOrBlank ( cacheEngine ) ) { return CacheEngines . get ( "Guava" ) ; } return CacheEngines . get ( cacheEngine ) ;
public class AmazonRoute53DomainsClient { /** * This operation sets the transfer lock on the domain ( specifically the < code > clientTransferProhibited < / code > * status ) to prevent domain transfers . Successful submission returns an operation ID that you can use to track the * progress and completion of the ac...
request = beforeClientExecution ( request ) ; return executeEnableDomainTransferLock ( request ) ;
public class HarrisFast { /** * 角点的生成和过滤 * @ param sigma * @ param k * @ param minDistance * , 该邻域内只取算子最大的特征点 */ public void filter ( double sigma , double k , int minDistance ) { } }
computeDerivatives ( sigma ) ; // fastComputeDerivatives ( ) ; float [ ] [ ] harrismap = computeHarrisMap ( k ) ; for ( int y = 1 ; y < height - 1 ; y ++ ) { for ( int x = 1 ; x < width - 1 ; x ++ ) { float h = harrismap [ x ] [ y ] ; if ( h <= 1E-3 ) continue ; if ( ! isSpatialMaxima ( harrismap , x , y ) ) continue ;...
public class POICellFormatter { /** * ブランクセルの結果を作成する 。 * @ since 0.7 * @ return */ private CellFormatResult createBlankCellResult ( ) { } }
CellFormatResult result = new CellFormatResult ( ) ; result . setCellType ( FormatCellType . Blank ) ; result . setText ( "" ) ; return result ;
public class LocalisationManager { /** * Method assignQueuePointOutputHandler . * @ param outputHandler * < p > Add the outputHandler to the set of queuePointOutputHanders < / p > */ public void assignQueuePointOutputHandler ( OutputHandler outputHandler , SIBUuid8 messagingEngineUuid ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "assignQueuePointOutputHandler" , new Object [ ] { outputHandler , messagingEngineUuid } ) ; synchronized ( _queuePointOutputHandlers ) { _queuePointOutputHandlers . put ( messagingEngineUuid , outputHandler ) ; } if ( Trace...
public class CmsCategoryTreeEntry { /** * Gets the title of the category , or the name if the title is not set . < p > * @ return the title or name */ public Object getTitleOrName ( ) { } }
String result = getTitle ( ) ; if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( result ) ) { result = getPath ( ) ; } return result ;
public class AmazonWorkMailClient { /** * Lists the mailbox permissions associated with a user , group , or resource mailbox . * @ param listMailboxPermissionsRequest * @ return Result of the ListMailboxPermissions operation returned by the service . * @ throws EntityNotFoundException * The identifier supplied ...
request = beforeClientExecution ( request ) ; return executeListMailboxPermissions ( request ) ;
public class AbstractCIBase { /** * Computer API uses package protection heavily */ private void updateComputer ( Node n , Map < String , Computer > byNameMap , Set < Computer > used , boolean automaticSlaveLaunch ) { } }
Map < Node , Computer > computers = getComputerMap ( ) ; Computer c ; c = byNameMap . get ( n . getNodeName ( ) ) ; if ( c != null ) { try { c . setNode ( n ) ; // reuse used . add ( c ) ; } catch ( RuntimeException e ) { LOGGER . log ( Level . WARNING , "Error updating node " + n . getNodeName ( ) + ", continuing" , e...
public class FacesConfigRenderKitTypeImpl { /** * Returns all < code > renderer < / code > elements * @ return list of < code > renderer < / code > */ public List < FacesConfigRendererType < FacesConfigRenderKitType < T > > > getAllRenderer ( ) { } }
List < FacesConfigRendererType < FacesConfigRenderKitType < T > > > list = new ArrayList < FacesConfigRendererType < FacesConfigRenderKitType < T > > > ( ) ; List < Node > nodeList = childNode . get ( "renderer" ) ; for ( Node node : nodeList ) { FacesConfigRendererType < FacesConfigRenderKitType < T > > type = new Fac...
public class Reporter { /** * Records the performed check as a pass to the output file . A screenshot will be taken for traceability * This method takes in a check being performed , and determines if a wait is * occurring or not . If no wait , no action is recorded . If a wait was performed , that wait is * added...
passes ++ ; recordStep ( getAction ( check , waitFor ) , "Expected " + check , getActual ( actual , timeTook ) , true , Success . PASS ) ;
public class S3LocationMarshaller { /** * Marshall the given parameter object . */ public void marshall ( S3Location s3Location , ProtocolMarshaller protocolMarshaller ) { } }
if ( s3Location == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( s3Location . getBucketName ( ) , BUCKETNAME_BINDING ) ; protocolMarshaller . marshall ( s3Location . getPrefix ( ) , PREFIX_BINDING ) ; protocolMarshaller . marshall ( s3Loca...
public class OMVRBTree { /** * Returns the predecessor of the specified Entry , or null if no such . */ public static < K , V > OMVRBTreeEntry < K , V > predecessor ( final OMVRBTreeEntry < K , V > t ) { } }
if ( t == null ) return null ; else if ( t . getLeft ( ) != null ) { OMVRBTreeEntry < K , V > p = t . getLeft ( ) ; while ( p . getRight ( ) != null ) p = p . getRight ( ) ; return p ; } else { OMVRBTreeEntry < K , V > p = t . getParent ( ) ; Entry < K , V > ch = t ; while ( p != null && ch == p . getLeft ( ) ) { ch = ...
public class TCAPProviderImpl { /** * ( non - Javadoc ) * @ see org . restcomm . protocols . ss7 . tcap . api . TCAPProvider # getNewDialog ( org . mobicents * . protocols . ss7 . sccp . parameter . SccpAddress , org . restcomm . protocols . ss7 . sccp . parameter . SccpAddress ) */ public Dialog getNewDialog ( Scc...
DialogImpl res = getNewDialog ( localAddress , remoteAddress , getNextSeqControl ( ) , null ) ; if ( this . stack . getStatisticsEnabled ( ) ) { this . stack . getCounterProviderImpl ( ) . updateAllLocalEstablishedDialogsCount ( ) ; this . stack . getCounterProviderImpl ( ) . updateAllEstablishedDialogsCount ( ) ; } th...
public class CmsUgcSession { /** * Adds the given values to the content document . < p > * @ param content the content document * @ param locale the content locale * @ param contentValues the values * @ throws CmsXmlException if writing the XML fails */ protected void addContentValues ( CmsXmlContent content , ...
if ( ! content . hasLocale ( locale ) ) { content . addLocale ( m_cms , locale ) ; } List < String > paths = new ArrayList < String > ( contentValues . keySet ( ) ) ; // first delete all null values // use reverse index ordering for similar elements Collections . sort ( paths , new PathComparator ( true ) ) ; String la...
public class SftpFsHelper { /** * Executes a get SftpCommand and returns an input stream to the file * @ param cmd is the command to execute * @ param sftp is the channel to execute the command on * @ throws SftpException */ @ Override public InputStream getFileStream ( String file ) throws FileBasedHelperExcepti...
SftpGetMonitor monitor = new SftpGetMonitor ( ) ; try { ChannelSftp channel = getSftpChannel ( ) ; return new SftpFsFileInputStream ( channel . get ( file , monitor ) , channel ) ; } catch ( SftpException e ) { throw new FileBasedHelperException ( "Cannot download file " + file + " due to " + e . getMessage ( ) , e ) ;...
public class StrictDateTimeField { /** * Does a bounds check before setting the value . * @ throws IllegalArgumentException if the value is invalid */ public long set ( long instant , int value ) { } }
FieldUtils . verifyValueBounds ( this , value , getMinimumValue ( instant ) , getMaximumValue ( instant ) ) ; return super . set ( instant , value ) ;
public class XMLDatabase { /** * { @ inheritDoc } */ @ Override public void moveUpTextNodes ( ITextNode [ ] textNodes ) { } }
for ( ITextNode textNode : textNodes ) { int index = textNodeList . indexOf ( textNode ) ; if ( index > 0 ) { ITextNode previousTextNode = textNodeList . get ( index - 1 ) ; textNodeList . set ( index , previousTextNode ) ; textNodeList . set ( index - 1 , textNode ) ; } } fireTextNodesMoved ( textNodes ) ;
public class CommerceNotificationQueueEntryPersistenceImpl { /** * Returns the last commerce notification queue entry in the ordered set where sent = & # 63 ; . * @ param sent the sent * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the last matchi...
int count = countBySent ( sent ) ; if ( count == 0 ) { return null ; } List < CommerceNotificationQueueEntry > list = findBySent ( sent , count - 1 , count , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ;
public class LPIntegerNormDistanceFunction { /** * Compute unscaled distance in a range of dimensions . * @ param v1 First object * @ param v2 Second object * @ param start First dimension * @ param end Exclusive last dimension * @ return Aggregated values . */ private double preDistance ( NumberVector v1 , N...
double agg = 0. ; for ( int d = start ; d < end ; d ++ ) { final double xd = v1 . doubleValue ( d ) , yd = v2 . doubleValue ( d ) ; final double delta = xd >= yd ? xd - yd : yd - xd ; agg += MathUtil . powi ( delta , intp ) ; } return agg ;
public class DoubleMatrix { /** * Aij - = v * @ param i * @ param j * @ param v */ public void sub ( int i , int j , double v ) { } }
consumer . set ( i , j , supplier . get ( i , j ) - v ) ;
public class ByteBuddy { /** * Rebases the given type where any intercepted method that is declared by the redefined type is preserved within the * rebased type ' s class such that the class ' s original can be invoked from the new method implementations . Rebasing a * type can be seen similarly to creating a subcl...
if ( type . isArray ( ) || type . isPrimitive ( ) ) { throw new IllegalArgumentException ( "Cannot rebase array or primitive type: " + type ) ; } return new RebaseDynamicTypeBuilder < T > ( instrumentedTypeFactory . represent ( type ) , classFileVersion , auxiliaryTypeNamingStrategy , annotationValueFilterFactory , ann...
public class InternalService { /** * Applies given profile patch if required permission is granted . * @ param profileId Id of an profile to patch . * @ param profileDetails Profile details . * @ param eTag ETag for server to check if local version of the data is the same as the one the server side . * @ return...
final String token = getToken ( ) ; if ( sessionController . isCreatingSession ( ) ) { return getTaskQueue ( ) . queuePatchProfile ( profileDetails , eTag ) ; } else if ( TextUtils . isEmpty ( token ) ) { return Observable . error ( getSessionStateErrorDescription ( ) ) ; } else { return doPatchProfile ( token , dataMg...
public class SchemaToJava { /** * Create the Java */ private static void createCode ( String packageName , String className , ObjectSchema schema , Set < SyntaxToJavaClass . ClassInfo > imports , File outputFile ) throws IOException , TemplateException { } }
Configuration freeMarkerConfiguration = new Configuration ( ) ; freeMarkerConfiguration . setClassForTemplateLoading ( DEFAULT_LOADER_CLASS , "" ) ; freeMarkerConfiguration . setObjectWrapper ( new DefaultObjectWrapper ( ) ) ; // Build the model for FreeMarker Map < String , Object > model = new HashMap < String , Obje...
public class BehaviorHistoryInfo { /** * 对应deleteCount的数据统计平均值 */ public Long getFileCountAvg ( ) { } }
Long fileCountAvg = 0L ; if ( items . size ( ) != 0 ) { for ( TableStat item : items ) { if ( item . getEndTime ( ) . equals ( item . getStartTime ( ) ) ) { fileCountAvg += item . getFileCount ( ) ; } else { fileCountAvg += item . getFileCount ( ) * 1000 / ( item . getEndTime ( ) . getTime ( ) - item . getStartTime ( )...
public class AWSDataSyncClient { /** * Returns metadata such as the name , the network interfaces , and the status ( that is , whether the agent is running * or not ) for an agent . To specify which agent to describe , use the Amazon Resource Name ( ARN ) of the agent in your * request . * @ param describeAgentRe...
request = beforeClientExecution ( request ) ; return executeDescribeAgent ( request ) ;
public class DefaultGroovyMethods { /** * Truncate the value * @ param number a Float * @ return the Float truncated to 0 decimal places * @ since 1.6.0 */ public static float trunc ( Float number ) { } }
if ( number < 0f ) { return ( float ) Math . ceil ( number . doubleValue ( ) ) ; } return ( float ) Math . floor ( number . doubleValue ( ) ) ;
public class BeanUtil { /** * 获得Bean类属性描述 * @ param clazz Bean类 * @ param fieldName 字段名 * @ param ignoreCase 是否忽略大小写 * @ return PropertyDescriptor * @ throws BeanException 获取属性异常 */ public static PropertyDescriptor getPropertyDescriptor ( Class < ? > clazz , final String fieldName , boolean ignoreCase ) throw...
final Map < String , PropertyDescriptor > map = getPropertyDescriptorMap ( clazz , ignoreCase ) ; return ( null == map ) ? null : map . get ( fieldName ) ;
public class SepaVersion { /** * Liefert die SEPA - Version aus dem URN . * @ param urn URN . * In der Form " urn : iso : std : iso : 20022 : tech : xsd : pain . 001.002.03 " oder in * der alten Form " sepade . pain . 001.001.02 . xsd " . * @ return die SEPA - Version . */ public static SepaVersion byURN ( Stri...
SepaVersion test = new SepaVersion ( null , 0 , urn , null , false ) ; if ( urn == null || urn . length ( ) == 0 ) return test ; for ( List < SepaVersion > types : knownVersions . values ( ) ) { for ( SepaVersion v : types ) { if ( v . equals ( test ) ) return v ; } } // keine passende Version gefunden . Dann erzeugen ...
public class XPathParser { /** * Look ahead of the current token in order to * make a branching decision . * @ param s the string to compare it to . * @ param n number of tokens to lookahead . Must be * greater than 1. * @ return true if the token behind the current token matches the string * argument . */ ...
boolean isToken ; if ( ( m_queueMark + n ) <= m_ops . getTokenQueueSize ( ) ) { String lookahead = ( String ) m_ops . m_tokenQueue . elementAt ( m_queueMark + ( n - 1 ) ) ; isToken = ( lookahead != null ) ? lookahead . equals ( s ) : ( s == null ) ; } else { isToken = ( null == s ) ; } return isToken ;
public class ns_ssl_certkey { /** * < pre > * Use this operation to get certificates on NetScaler Instance ( s ) . * < / pre > */ public static ns_ssl_certkey [ ] get ( nitro_service client ) throws Exception { } }
ns_ssl_certkey resource = new ns_ssl_certkey ( ) ; resource . validate ( "get" ) ; return ( ns_ssl_certkey [ ] ) resource . get_resources ( client ) ;
public class PaymentChannelClientState { /** * Skips saving state in the wallet for testing */ @ VisibleForTesting synchronized void fakeSave ( ) { } }
try { wallet . commitTx ( getContractInternal ( ) ) ; } catch ( VerificationException e ) { throw new RuntimeException ( e ) ; // We created it } stateMachine . transition ( State . PROVIDE_MULTISIG_CONTRACT_TO_SERVER ) ;
public class GenericInMemoryCatalog { /** * - - - - - functions - - - - - */ @ Override public void createFunction ( ObjectPath functionPath , CatalogFunction function , boolean ignoreIfExists ) throws FunctionAlreadyExistException , DatabaseNotExistException { } }
checkNotNull ( functionPath ) ; checkNotNull ( function ) ; if ( ! databaseExists ( functionPath . getDatabaseName ( ) ) ) { throw new DatabaseNotExistException ( catalogName , functionPath . getDatabaseName ( ) ) ; } if ( functionExists ( functionPath ) ) { if ( ! ignoreIfExists ) { throw new FunctionAlreadyExistExcep...
public class MapLayer { /** * Clear the current bounding box to force the computation of it at * the next call to { @ link # getBoundingBox ( ) } . */ @ Override public void resetBoundingBox ( ) { } }
super . resetBoundingBox ( ) ; final GISLayerContainer < ? > parent = getContainer ( ) ; if ( parent != null ) { parent . resetBoundingBox ( ) ; }
public class BackpressureManagingHandler { /** * Intercepts a write on the channel . The following message types are handled : * < ul > * < li > String : If the pipeline is not configured to write a String , this converts the string to a { @ link io . netty . buffer . ByteBuf } and * then writes it on the channel...
if ( msg instanceof Observable ) { @ SuppressWarnings ( "rawtypes" ) Observable observable = ( Observable ) msg ; /* One can write heterogeneous objects on a channel . */ final WriteStreamSubscriber subscriber = bytesWriteInterceptor . newSubscriber ( ctx , promise ) ; subscriber . subscribeTo ( observable ) ; } else {...
public class AutocompleteUtil { /** * Get an { @ code autocomplete } attribute value for a named auto - fill section . * For information on sections see * < a href = " https : / / html . spec . whatwg . org / multipage / form - control - infrastructure . html # attr - fe - autocomplete - section " target = " _ blan...
if ( Util . empty ( sectionName ) ) { throw new IllegalArgumentException ( "argument must not be empty" ) ; } return SECTION_PREFIX . concat ( sectionName ) ;
public class CmsJspActionElement { /** * Include a named sub - element with parameters from the OpenCms VFS , same as * using the < code > & lt ; cms : include file = " * * * " element = " * * * " / & gt ; < / code > tag * with parameters in the tag body . < p > * @ param target the target URI of the file in the ...
include ( target , element , false , parameterMap ) ;
public class DataStream { /** * Sets the partitioning of the { @ link DataStream } so that the output elements * are broadcasted to every parallel instance of the next operation . In addition , * it implicitly as many { @ link org . apache . flink . api . common . state . BroadcastState broadcast states } * as th...
Preconditions . checkNotNull ( broadcastStateDescriptors ) ; final DataStream < T > broadcastStream = setConnectionType ( new BroadcastPartitioner < > ( ) ) ; return new BroadcastStream < > ( environment , broadcastStream , broadcastStateDescriptors ) ;
public class DateUtils { /** * Converts a two - digit input year to a four - digit year . As the current calendar year * approaches a century , we assume small values to mean the next century . For instance , if * the current year is 2090 , and the input value is " 18 " , the user probably means 2118, * not 2018 ...
return convertTwoDigitYearToFour ( inputYear , Calendar . getInstance ( ) ) ;
public class ParsedSwapStmt { /** * Parse the arguments to a SWAP TABLE statement . * SWAP TABLE statements use simple String attributes * as the " VoltXML " representation for their target tables . * They don ' t need all the complexity of the child table nodes * used in other kinds of statements . * SWAP TA...
// parseTablesAndParameters may have been called on this // SWAP TABLE statement , but the simplified VoltXML representation // for SWAP TABLE gave that method nothing to do . assert ( stmtNode . children . isEmpty ( ) ) ; assert ( m_tableList . isEmpty ( ) ) ; addTabletoList ( stmtNode , "thetable" ) ; addTabletoList ...
public class QrCodeBinaryGridToPixel { /** * Outside corners on position patterns are more likely to be damaged , so remove them */ public void removeOutsideCornerFeatures ( ) { } }
if ( pairs2D . size ( ) != storagePairs2D . size ) throw new RuntimeException ( "This can only be called when all the features have been added" ) ; pairs2D . remove ( 11 ) ; pairs2D . remove ( 5 ) ; pairs2D . remove ( 0 ) ;
public class AdaGrad { /** * Gets feature specific learning rates * Adagrad keeps a history of gradients being passed in . * Note that each gradient passed in becomes adapted over time , hence * the opName adagrad * @ param gradient the gradient to get learning rates for * @ param iteration * @ return the f...
if ( historicalGradient == null ) throw new IllegalStateException ( "Updater has not been initialized with view state" ) ; historicalGradient . addi ( gradient . mul ( gradient ) ) ; INDArray sqrtHistory = sqrt ( historicalGradient . dup ( gradientReshapeOrder ) , false ) . addi ( epsilon ) ; // lr * gradient / ( sqrt ...