signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class BizwifiAPI { /** * 连Wi - Fi小程序 - 设置顶部banner跳转小程序接口
* 场景介绍 :
* 用户连Wi - Fi后长期逗留在场所内 , 可以在连接Wi - Fi后进入微信点击微信聊首页欢迎语 , 即可进入预先设置的小程序中获得资讯或服务 。
* 注 : 只能跳转与公众号关联的小程序 。
* @ param accessToken accessToken
* @ param homePageSet homePageSet
* @ return BaseResult */
public static BaseResult homepageSet ( Str... | return homepageSet ( accessToken , JsonUtil . toJSONString ( homePageSet ) ) ; |
public class FactorMaxMarginalSet { /** * Performs a depth - first search of { @ code cliqueTree } , starting at
* { @ code factorNum } , to find an assignment with maximal probability . If
* multiple maximal probability assignments exist , this method returns an
* arbitrary one .
* @ param cliqueTree factor gr... | Factor curFactor = cliqueTree . getMarginal ( factorNum ) ; List < Assignment > bestAssignments = curFactor . conditional ( a ) . getMostLikelyAssignments ( 1 ) ; if ( bestAssignments . size ( ) == 0 ) { // This condition implies that the factor graph does not have a positive
// probability assignment .
throw new ZeroP... |
public class ByteAmount { /** * Creates a ByteAmount value in megabytes . If the megabytes value
* is $ lt ; = Long . MAX _ VALUE / 1024 / 1024 , the byte representation is capped at Long . MAX _ VALUE .
* @ param megabytes value in megabytes to represent
* @ return a ByteAmount object repressing the number of MB... | if ( megabytes >= MAX_MB ) { return new ByteAmount ( Long . MAX_VALUE ) ; } else { return new ByteAmount ( megabytes * MB ) ; } |
public class CommerceShipmentItemPersistenceImpl { /** * Clears the cache for the commerce shipment item .
* The { @ link EntityCache } and { @ link FinderCache } are both cleared by this method . */
@ Override public void clearCache ( CommerceShipmentItem commerceShipmentItem ) { } } | entityCache . removeResult ( CommerceShipmentItemModelImpl . ENTITY_CACHE_ENABLED , CommerceShipmentItemImpl . class , commerceShipmentItem . getPrimaryKey ( ) ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; |
public class SequenceManagerHelper { /** * Database sequence properties helper method .
* Return sequence < em > cycle < / em > Booelan or < em > null < / em >
* if not set .
* @ param prop The { @ link java . util . Properties } instance to use .
* @ return The found expression or < em > null < / em > . */
pub... | String result = prop . getProperty ( PROP_SEQ_CYCLE , null ) ; if ( result != null ) { return Boolean . valueOf ( result ) ; } else { return null ; } |
public class RoadPolyline { /** * Replies the last connection point of this segment .
* @ param < CT > is the type of the connection to reply
* @ param connectionClass is the type of the connection to reply
* @ return the last point of < code > null < / code > */
@ Pure < CT extends RoadConnection > CT getEndPoin... | final StandardRoadConnection connection = this . lastConnection ; if ( connection == null ) { return null ; } if ( connectionClass . isAssignableFrom ( StandardRoadConnection . class ) ) { return connectionClass . cast ( connection ) ; } if ( connectionClass . isAssignableFrom ( RoadConnectionWithArrivalSegment . class... |
public class ClassUtil { /** * getValueOfField .
* @ param field
* a { @ link java . lang . reflect . Field } object .
* @ param ref
* a { @ link java . lang . Object } object .
* @ return a { @ link java . lang . Object } object . */
public static Object getValueOfField ( Field field , Object ref ) { } } | field . setAccessible ( true ) ; Object value = null ; try { value = field . get ( ref ) ; } catch ( IllegalArgumentException e ) { } catch ( IllegalAccessException e ) { } return value ; |
public class MapFixture { /** * Gets value from map .
* @ param name name of ( possibly nested ) property to get value from .
* @ param map map to get value from .
* @ return value found , if it could be found , null otherwise . */
public Object valueIn ( String name , Map < String , Object > map ) { } } | return getMapHelper ( ) . getValue ( map , name ) ; |
public class GeneratorUtil { /** * Computes foldername and creates the folders that does not already exist
* @ param inFolder , left out if null
* @ return */
private String getFolderAndCreateIfMissing ( String inFolder ) { } } | String folder = outputFolder ; if ( inFolder != null ) { folder += "/" + inFolder ; } mkdirs ( folder ) ; return folder ; |
public class CoverageTask { /** * Call the Coverage Task . */
public GridCoverage2D call ( ) { } } | try { BufferedImage coverageImage = this . tiledLayer . createBufferedImage ( this . tilePreparationInfo . getImageWidth ( ) , this . tilePreparationInfo . getImageHeight ( ) ) ; Graphics2D graphics = coverageImage . createGraphics ( ) ; try { for ( SingleTilePreparationInfo tileInfo : this . tilePreparationInfo . getS... |
public class Matrix { /** * create and return the N - by - N identity matrix */
public static Matrix identity ( int N ) { } } | Matrix I = new Matrix ( N , N ) ; for ( int i = 0 ; i < N ; i ++ ) { I . data [ i ] [ i ] = 1 ; } return I ; |
public class MemcacheUtils { /** * Parse Memcache key into ( MapName , Key ) pair . */
public static MapNameAndKeyPair parseMemcacheKey ( String key ) { } } | key = decodeKey ( key , "UTF-8" ) ; String mapName = DEFAULT_MAP_NAME ; int index = key . indexOf ( ':' ) ; if ( index != - 1 ) { mapName = MAP_NAME_PREFIX + key . substring ( 0 , index ) ; key = key . substring ( index + 1 ) ; } return new MapNameAndKeyPair ( mapName , key ) ; |
public class PropertyMappingPanel { /** * GEN - LAST : event _ cmdAddActionPerformed */
private void showPopup ( MouseEvent evt ) { } } | if ( evt . isPopupTrigger ( ) ) { popMenu . show ( evt . getComponent ( ) , evt . getX ( ) , evt . getY ( ) ) ; } |
public class Utils { /** * 根据属性名与属性类型获取字段内容
* @ param bean 对象
* @ param name 字段名
* @ param value 字段类型 */
public static void copyProperty ( Object bean , String name , Object value ) throws Excel4JException { } } | if ( null == name || null == value ) return ; Field field = matchClassField ( bean . getClass ( ) , name ) ; if ( null == field ) return ; Method method ; try { method = getterOrSetter ( bean . getClass ( ) , name , FieldAccessType . SETTER ) ; if ( value . getClass ( ) == field . getType ( ) ) { method . invoke ( bean... |
public class QuartzSchedulerResources { /** * Set the name for the < code > { @ link QuartzSchedulerThread } < / code > .
* @ exception IllegalArgumentException
* if name is null or empty . */
public void setThreadName ( final String threadName ) { } } | if ( threadName == null || threadName . trim ( ) . length ( ) == 0 ) { throw new IllegalArgumentException ( "Scheduler thread name cannot be empty." ) ; } m_sThreadName = threadName ; |
public class NearestEdgeSnapAlgorithm { /** * Execute the snap operation .
* @ param coordinate The original location .
* @ param distance The maximum distance allowed for snapping .
* @ return The new location . If no snapping target was found , this may return the original location . */
public Coordinate snap (... | // Some initialization :
calculatedDistance = distance ; hasSnapped = false ; Coordinate snappingPoint = coordinate ; // Calculate the distances for all coordinate arrays :
for ( Coordinate [ ] coordinateArray : coordinates ) { if ( coordinateArray . length > 1 ) { for ( int j = 1 ; j < coordinateArray . length ; j ++ ... |
public class DefaultGroovyMethods { /** * Swaps two elements at the specified positions .
* Example :
* < pre class = " groovyTestCase " >
* assert ( [ " a " , " c " , " b " , " d " ] as String [ ] ) = = ( [ " a " , " b " , " c " , " d " ] as String [ ] ) . swap ( 1 , 2)
* < / pre >
* @ param self an array
... | T tmp = self [ i ] ; self [ i ] = self [ j ] ; self [ j ] = tmp ; return self ; |
public class PropertyInfo { /** * This is a convenience method for returning a named configuration value that is expected to be
* a double floating point number .
* @ param key The configuration value ' s key .
* @ param dflt Default value .
* @ return Configuration value as a double or default value if not fou... | try { return Double . parseDouble ( getConfigValue ( key ) ) ; } catch ( Exception e ) { return dflt ; } |
public class PriorityQueue { /** * Blocks until a close operation has completed . I . e . the priority queue has been
* drained . If the queue is already closed , this method returns immeidately . */
public void waitForCloseToComplete ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "waitForCloseToComplete" ) ; closeWaitersMonitor . waitOn ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "waitForCloseToComplete" ) ; |
public class JDBCConnection { /** * < ! - - start generic documentation - - >
* Creates a < code > Statement < / code > object that will generate
* < code > ResultSet < / code > objects with the given type and concurrency .
* This method is the same as the < code > createStatement < / code > method
* above , bu... | checkClosed ( ) ; return new JDBCStatement ( this , resultSetType , resultSetConcurrency , rsHoldability ) ; |
public class UpdateChecker { /** * Show the Notice only if it ' s the first time or the number of the checks made is a multiple of the argument of setSuccessfulChecksRequired ( int ) method . ( If you don ' t call setSuccessfulChecksRequired ( int ) the default is 5 ) . */
private boolean hasToShowNotice ( String versi... | SharedPreferences prefs = mActivity . getSharedPreferences ( PREFS_FILENAME , 0 ) ; String prefKey = SUCCESSFUL_CHEKS_PREF_KEY + versionDownloadable ; int mChecksMade = prefs . getInt ( prefKey , 0 ) ; if ( mChecksMade % mSuccessfulChecksRequired == 0 || mChecksMade == 0 ) { saveNumberOfChecksForUpdatedVersion ( versio... |
public class FeatureList { /** * Concatenate successive portions of the specified sequence
* using the feature locations in the list . The list is assumed to be appropriately
* ordered .
* @ param sequence The source sequence from which portions should be selected .
* @ return The spliced data .
* @ throws Il... | StringBuilder subData = new StringBuilder ( ) ; Location last = null ; for ( FeatureI f : this ) { Location loc = f . location ( ) ; if ( last == null || loc . startsAfter ( last ) ) { subData . append ( sequence . getSubSequence ( loc . start ( ) , loc . end ( ) ) . toString ( ) ) ; last = loc ; } else { throw new Ill... |
public class SQLiteDatabaseSchema { /** * Fill clazz .
* @ param configClazz
* the config clazz
* @ param clazz
* the clazz
* @ return the string */
private String fillClazz ( String configClazz , String clazz ) { } } | if ( ! clazz . equals ( configClazz ) ) { return configClazz ; } else { return null ; } |
public class UUID { /** * Static factory to retrieve a type 4 ( pseudo randomly generated ) UUID .
* The < code > UUID < / code > is generated using a cryptographically strong
* pseudo random number generator .
* Source code was got from sources of java
* @ return a randomly generated < tt > UUID < / tt > . */
... | SecureRandom ng = numberGenerator ; if ( ng == null ) { numberGenerator = ng = new SecureRandom ( ) ; } byte [ ] randomBytes = new byte [ 16 ] ; ng . nextBytes ( randomBytes ) ; randomBytes [ 6 ] &= 0x0f ; /* clear version */
randomBytes [ 6 ] |= 0x40 ; /* set to version 4 */
randomBytes [ 8 ] &= 0x3f ; /* clear varian... |
public class AutoscalePolicyService { /** * remove autoscale policy on server
* @ param server server
* @ return OperationFuture wrapper for server */
public OperationFuture < Server > removeAutoscalePolicyOnServer ( Server server ) { } } | autoscalePolicyClient . removeAutoscalePolicyOnServer ( serverService . findByRef ( server ) . getId ( ) ) ; return new OperationFuture < > ( server , new NoWaitingJobFuture ( ) ) ; |
public class ResourceFinder { /** * Reads the contents of all non - directory URLs immediately under the specified
* location and returns them in a map keyed by the file name .
* Any URLs that cannot be read will cause an exception to be thrown .
* Example classpath :
* META - INF / serializables / one
* META... | Map < String , String > strings = new HashMap < > ( ) ; Map < String , URL > resourcesMap = getResourcesMap ( uri ) ; for ( Iterator iterator = resourcesMap . entrySet ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) iterator . next ( ) ; String name = ( String ) entry . getKey ( ) ... |
public class ValidateMetadataDeployer { /** * { @ inheritDoc } */
public Deployment deploy ( URL url , Context context , ClassLoader parent ) throws DeployException { } } | Connector c = ( Connector ) context . get ( Constants . ATTACHMENT_MERGED_METADATA ) ; if ( c == null ) c = ( Connector ) context . get ( Constants . ATTACHMENT_RA_XML_METADATA ) ; if ( c == null ) throw new DeployException ( "No metadata for " + url . toExternalForm ( ) + " found" ) ; try { c . validate ( ) ; return n... |
public class MatFileReader { /** * Reads MAT - file header .
* Modifies < code > buf < / code > position .
* @ param buf
* < code > ByteBuffer < / code >
* @ throws IOException
* if reading from buffer fails or if this is not a valid
* MAT - file */
private void readHeader ( ByteBuffer buf ) throws IOExcept... | // header values
String description ; int version ; byte [ ] endianIndicator = new byte [ 2 ] ; // This part of the header is missing if the file isn ' t a regular mat file . So ignore .
if ( matType == MatFileType . Regular ) { // descriptive text 116 bytes
byte [ ] descriptionBuffer = new byte [ 116 ] ; buf . get ( d... |
public class Async { /** * Convert a synchronous function call into an asynchronous function call through an Observable .
* < img width = " 640 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / toAsync . png " alt = " " >
* @ param < R > the result type
* @ param fun... | return toAsync ( func , Schedulers . computation ( ) ) ; |
public class ProcessedInput { /** * Returns parameter name by specifying it ' s position
* @ param position position of parameter
* @ return name of parameter , null if list of names is empty */
public String getParameterName ( Integer position ) { } } | String name = null ; if ( this . sqlParameterNames != null ) { name = this . sqlParameterNames . get ( position ) ; } return name ; |
public class ProtoLexer { /** * $ ANTLR start " SEMICOLON " */
public final void mSEMICOLON ( ) throws RecognitionException { } } | try { int _type = SEMICOLON ; int _channel = DEFAULT_TOKEN_CHANNEL ; // com / dyuproject / protostuff / parser / ProtoLexer . g : 67:5 : ( ' ; ' )
// com / dyuproject / protostuff / parser / ProtoLexer . g : 67:9 : ' ; '
{ match ( ';' ) ; } state . type = _type ; state . channel = _channel ; } finally { } |
public class CloudantDatabaseService { /** * Invoked when a cloudant Database is injected or looked up .
* @ param info resource ref info , or null if direct lookup .
* @ return instance of com . cloudant . client . api . Database */
@ Override public Object createResource ( ResourceInfo info ) throws Exception { }... | ComponentMetaData cData = ComponentMetaDataAccessorImpl . getComponentMetaDataAccessor ( ) . getComponentMetaData ( ) ; if ( cData != null ) applications . add ( cData . getJ2EEName ( ) . getApplication ( ) ) ; return cloudantSvc . createResource ( ( String ) props . get ( "databaseName" ) , ( Boolean ) props . get ( "... |
public class ApiOvhDomain { /** * Get this object properties
* REST : GET / domain / zone / { zoneName } / redirection / { id }
* @ param zoneName [ required ] The internal name of your zone
* @ param id [ required ] Id of the object */
public OvhRedirection zone_zoneName_redirection_id_GET ( String zoneName , Lo... | String qPath = "/domain/zone/{zoneName}/redirection/{id}" ; StringBuilder sb = path ( qPath , zoneName , id ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhRedirection . class ) ; |
public class DOTranslationUtility { /** * Certain serviceDeployment datastreams require special processing to
* fix / complete URLs and do variable substitution ( such as replacing
* ' local . fedora . server ' with fedora ' s baseURL ) */
public void normalizeDatastreams ( DigitalObject obj , int transContext , St... | if ( transContext == AS_IS ) { return ; } if ( obj . hasContentModel ( Models . SERVICE_DEPLOYMENT_3_0 ) ) { Iterator < String > datastreams = obj . datastreamIdIterator ( ) ; while ( datastreams . hasNext ( ) ) { String dsid = datastreams . next ( ) ; if ( dsid . equals ( "WSDL" ) || dsid . equals ( "SERVICE-PROFILE" ... |
public class JdbcTable { /** * This is a special method - If the db doesn ' t allow multiple keys indexes ,
* see if this field is a first field on an index ( non - primary ) .
* @ return true if true . */
public boolean checkIndexField ( BaseField field ) { } } | for ( int iKeySeq = 0 ; iKeySeq < this . getRecord ( ) . getKeyAreaCount ( ) ; iKeySeq ++ ) { KeyArea keyArea = this . getRecord ( ) . getKeyArea ( iKeySeq ) ; if ( keyArea . getField ( 0 ) == field ) if ( field != this . getRecord ( ) . getCounterField ( ) ) return true ; } return false ; |
public class TelemetryUtils { /** * Do not call this method outside of activity ! ! ! */
public static String retrieveVendorId ( ) { } } | if ( MapboxTelemetry . applicationContext == null ) { return updateVendorId ( ) ; } SharedPreferences sharedPreferences = obtainSharedPreferences ( MapboxTelemetry . applicationContext ) ; String mapboxVendorId = sharedPreferences . getString ( MAPBOX_SHARED_PREFERENCE_KEY_VENDOR_ID , "" ) ; if ( TelemetryUtils . isEmp... |
public class GobblinYarnAppLauncher { /** * Stop this { @ link GobblinYarnAppLauncher } instance .
* @ throws IOException if this { @ link GobblinYarnAppLauncher } instance fails to clean up its working directory . */
public synchronized void stop ( ) throws IOException , TimeoutException { } } | if ( this . stopped ) { return ; } LOGGER . info ( "Stopping the " + GobblinYarnAppLauncher . class . getSimpleName ( ) ) ; try { if ( this . applicationId . isPresent ( ) && ! this . applicationCompleted ) { // Only send the shutdown message if the application has been successfully submitted and is still running
sendS... |
public class CmsJspNavElement { /** * Helper to get locale specific properties .
* @ return the locale specific properties map . */
private Map < String , String > getLocaleProperties ( ) { } } | if ( m_localeProperties == null ) { m_localeProperties = CmsCollectionsGenericWrapper . createLazyMap ( new CmsProperty . CmsPropertyLocaleTransformer ( m_properties , m_locale ) ) ; } return m_localeProperties ; |
public class Providers { /** * Provide a Provider from the resource found in class loader with the provided encoding . < br / > As resource is
* accessed through a class loader , a leading " / " is not allowed in pathToResource */
public static Provider resourceProvider ( ClassLoader classLoader , String pathToResour... | InputStream resourceAsStream = classLoader . getResourceAsStream ( pathToResource ) ; if ( resourceAsStream == null ) { throw new IOException ( "Cannot find " + pathToResource ) ; } return provider ( resourceAsStream , encoding ) ; |
public class WCOutputStream { /** * @ see javax . servlet . ServletOutputStream # println ( char ) */
public void println ( char c ) throws IOException { } } | this . singleByte [ 0 ] = ( byte ) c ; this . output . write ( this . singleByte , 0 , 1 ) ; this . output . write ( CRLF , 0 , 2 ) ; |
public class MarketApi { /** * List historical orders from a corporation ( asynchronously ) List cancelled
* and expired market orders placed on behalf of a corporation up to 90 days
* in the past . - - - This route is cached for up to 3600 seconds - - - Requires
* one of the following EVE corporation role ( s ) ... | com . squareup . okhttp . Call call = getCorporationsCorporationIdOrdersHistoryValidateBeforeCall ( corporationId , datasource , ifNoneMatch , page , token , callback ) ; Type localVarReturnType = new TypeToken < List < CorporationOrdersHistoryResponse > > ( ) { } . getType ( ) ; apiClient . executeAsync ( call , local... |
public class FindNullDeref { /** * We have a method invocation in which a possibly or definitely null
* parameter is passed . Check it against the library of nonnull annotations .
* @ param location
* @ param cpg
* @ param typeDataflow
* @ param invokeInstruction
* @ param nullArgSet
* @ param definitelyN... | if ( inExplicitCatchNullBlock ( location ) ) { return ; } boolean caught = inIndirectCatchNullBlock ( location ) ; if ( caught && skipIfInsideCatchNull ( ) ) { return ; } if ( invokeInstruction instanceof INVOKEDYNAMIC ) { return ; } XMethod m = XFactory . createXMethod ( invokeInstruction , cpg ) ; INullnessAnnotation... |
public class Util { /** * Transforms a stream into a string .
* @ param is
* the stream to be transformed
* @ param charsetName
* encoding of the file
* @ return the string containing the content of the stream */
public static String streamToString ( InputStream is , String charsetName ) { } } | try { Reader r = null ; try { r = new BufferedReader ( new InputStreamReader ( is , charsetName ) ) ; return readerToString ( r ) ; } finally { if ( r != null ) { try { r . close ( ) ; } catch ( IOException e ) { } } } } catch ( Exception e ) { throw new RuntimeException ( e ) ; } |
public class ManifestFileProcessor { /** * This API for install used only . */
public Map < String , ProvisioningFeatureDefinition > getCoreFeatureDefinitionsExceptPlatform ( ) { } } | Map < String , ProvisioningFeatureDefinition > features = new TreeMap < String , ProvisioningFeatureDefinition > ( ) ; File featureDir = getCoreFeatureDir ( ) ; // the feature directory may not exist if the packaged server had no features installed when minified
if ( ! featureDir . isDirectory ( ) && ! featureDir . mkd... |
public class SequenceGibbsSampler { /** * Samples the complete sequence once in the forward direction
* Destructively modifies the sequence in place .
* @ param sequence the sequence to start with . */
public void sampleSequenceForward ( SequenceModel model , int [ ] sequence , double temperature ) { } } | // System . err . println ( " Sampling forward " ) ;
for ( int pos = 0 ; pos < sequence . length ; pos ++ ) { samplePosition ( model , sequence , pos , temperature ) ; } |
public class QueryParserBase { /** * Append field list to { @ link SolrQuery }
* @ param solrQuery
* @ param fields */
protected void appendProjectionOnFields ( SolrQuery solrQuery , List < Field > fields , @ Nullable Class < ? > domainType ) { } } | if ( CollectionUtils . isEmpty ( fields ) ) { return ; } List < String > solrReadableFields = new ArrayList < > ( ) ; for ( Field field : fields ) { if ( field instanceof CalculatedField ) { solrReadableFields . add ( createCalculatedFieldFragment ( ( CalculatedField ) field , domainType ) ) ; } else { solrReadableFiel... |
public class ExpressionDecomposer { /** * Finds the statement containing { @ code subExpression } .
* < p > If { @ code subExpression } is not contained by a statement where inlining is known to be
* possible , { @ code null } is returned . For example , the condition expression of a WHILE loop . */
@ Nullable priv... | Node child = subExpression ; for ( Node current : child . getAncestors ( ) ) { Node parent = current . getParent ( ) ; switch ( current . getToken ( ) ) { // Supported expression roots :
// SWITCH and IF can have multiple children , but the CASE , DEFAULT ,
// or BLOCK will be encountered first for any of the children ... |
public class RTMPConnection { /** * Return channel id for given stream id .
* @ param streamId
* Stream id
* @ return ID of channel that belongs to the stream */
public int getChannelIdForStreamId ( Number streamId ) { } } | int channelId = ( int ) ( streamId . doubleValue ( ) * 5 ) - 1 ; if ( log . isTraceEnabled ( ) ) { log . trace ( "Channel id: {} requested for stream id: {}" , channelId , streamId ) ; } return channelId ; |
public class ConnecClient { /** * Update an entity remotely
* @ param entity
* name
* @ param groupId
* customer group id
* @ param entityId
* id of the entity to retrieve
* @ param hash
* entity attributes to update
* @ return updated entity
* @ throws AuthenticationException
* @ throws ApiExcept... | return update ( entityName , groupId , entityId , hash , getAuthenticatedClient ( ) ) ; |
public class XmlProcessor { /** * Get from pool , or create one without locking , if needed . */
private DocumentBuilder getDocumentBuilderFromPool ( ) throws ParserConfigurationException { } } | DocumentBuilder builder = documentBuilderPool . pollFirst ( ) ; if ( builder == null ) { builder = getDomFactory ( ) . newDocumentBuilder ( ) ; } builder . setErrorHandler ( errorHandler ) ; return builder ; |
public class AtomTypeAwareSaturationChecker { /** * Check if the bond order can be increased . This method assumes that the
* bond is between only two atoms .
* @ param bond The bond to check
* @ param atomContainer The { @ link IAtomContainer } that the bond belongs to
* @ return True if it is possibly to incr... | boolean atom0isUnsaturated = false , atom1isUnsaturated = false ; double sum ; if ( bond . getBegin ( ) . getBondOrderSum ( ) == null ) { sum = getAtomBondordersum ( bond . getEnd ( ) , atomContainer ) ; } else sum = bond . getBegin ( ) . getBondOrderSum ( ) ; if ( bondsUsed ( bond . getBegin ( ) , atomContainer ) < su... |
public class SharedPreferenceUtils { /** * Extract number from string , failsafe . If the string is not a proper number it will always return 0;
* @ param string
* : String that should be converted into a number
* @ return : 0 if conversion to number is failed anyhow , otherwise converted number is returned */
pu... | int number = 0 ; if ( ! isEmptyString ( string ) ) { if ( TextUtils . isDigitsOnly ( string ) ) { number = Integer . parseInt ( string . toString ( ) ) ; } } return number ; |
public class Logger { /** * Reset the Logger , i . e . remove all appenders and set the log level to the
* default level . */
public synchronized void resetLogger ( ) { } } | Logger . appenderList . clear ( ) ; Logger . stopWatch . stop ( ) ; Logger . stopWatch . reset ( ) ; Logger . firstLogEvent = true ; |
public class QualityOfServiceBlockingQueue { /** * / * ( non - Javadoc )
* @ see java . util . concurrent . BlockingQueue # drainTo ( java . util . Collection , int ) */
@ Override public final int drainTo ( Collection < ? super T > c , int maxElements ) { } } | // Short circuit using read - lock
if ( this . isEmpty ( ) ) { return 0 ; } this . writeLock . lock ( ) ; try { int count = 0 ; while ( count < this . size && count < maxElements ) { final K key = this . getNextElementKey ( ) ; final Queue < T > queue = this . keyedQueues . get ( key ) ; if ( queue == null || queue . i... |
public class Http2ClientChannel { /** * Gets the in - flight message associated with the a particular stream id .
* @ param streamId stream id
* @ return in - flight message associated with the a particular stream id */
public OutboundMsgHolder getInFlightMessage ( int streamId ) { } } | if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Getting in flight message for stream id: {} from channel: {}" , streamId , this ) ; } return inFlightMessages . get ( streamId ) ; |
import java . io . * ; import java . lang . * ; import java . util . * ; import java . math . * ; class SumTwoDigitElements { /** * This function returns the sum of the numbers with maximum two digits
* from the first ' count ' numbers of a non - empty list ' numbers ' .
* Args :
* numbers : non - empty list of i... | int sum = 0 ; for ( int i = 0 ; i < count ; i ++ ) { int num = numbers . get ( i ) ; if ( num >= - 99 && num <= 99 ) { sum += num ; } } return sum ; |
public class ProjectModel { /** * Check if all classes belong to a module */
public void checkAllClassesInModule ( List < String > errors ) { } } | for ( ClassModel clazz : classes . values ( ) ) { if ( clazz . getModule ( ) == null ) { errors . add ( "Class " + clazz + " is in no module" ) ; } } |
public class NlsRuntimeException { /** * @ see # createCopy ( ExceptionTruncation )
* @ param truncation the { @ link ExceptionTruncation } settings .
* @ return the ( truncated ) copy .
* @ deprecated will be removed */
@ Deprecated protected NlsRuntimeException createCopyViaClone ( ExceptionTruncation truncatio... | try { NlsRuntimeException copy = ( NlsRuntimeException ) clone ( ) ; ThrowableHelper . removeDetails ( copy , truncation ) ; return copy ; } catch ( CloneNotSupportedException e ) { throw new IllegalStateException ( e ) ; } |
public class AddAdCustomizer { /** * Creates expanded text ads that use ad customizations for the specified ad group IDs . */
private static void createAdsWithCustomizations ( AdWordsServicesInterface adWordsServices , AdWordsSession session , List < Long > adGroupIds , String feedName ) throws RemoteException { } } | // Get the AdGroupAdService .
AdGroupAdServiceInterface adGroupAdService = adWordsServices . get ( session , AdGroupAdServiceInterface . class ) ; ExpandedTextAd textAd = new ExpandedTextAd ( ) ; textAd . setHeadlinePart1 ( String . format ( "Luxury Cruise to {=%s.Name}" , feedName ) ) ; textAd . setHeadlinePart2 ( Str... |
public class Config { /** * Creates a fixed configuration for the supplied { @ link AbstractConfiguration } objects . Only key / value
* pairs from these objects will be present in the final configuration .
* There is no implicit override from system properties . */
public static Config getFixedConfig ( @ Nullable ... | final CombinedConfiguration cc = new CombinedConfiguration ( new OverrideCombiner ( ) ) ; if ( configs != null ) { for ( final AbstractConfiguration config : configs ) { cc . addConfiguration ( config ) ; } } return new Config ( cc ) ; |
public class BinarySerde { /** * This method returns shape databuffer from saved earlier file
* @ param readFrom
* @ return
* @ throws IOException */
public static DataBuffer readShapeFromDisk ( File readFrom ) throws IOException { } } | try ( FileInputStream os = new FileInputStream ( readFrom ) ) { FileChannel channel = os . getChannel ( ) ; // we read shapeinfo up to max _ rank value , which is 32
int len = ( int ) Math . min ( ( 32 * 2 + 3 ) * 8 , readFrom . length ( ) ) ; ByteBuffer buffer = ByteBuffer . allocateDirect ( len ) ; channel . read ( b... |
public class ListUtils { /** * Obtains a random sample without replacement from a source list and places
* it in the destination list . This is done without modifying the source list .
* @ param < T > the list content type involved
* @ param source the source of values to randomly sample from
* @ param dest the... | randomSample ( source , dest , samples , RandomUtil . getRandom ( ) ) ; |
public class Distribution { /** * This method returns a double array containing the values of random samples from this distribution .
* @ param numSamples the number of random samples to take
* @ param rand the source of randomness
* @ return a vector of the random sample values */
public DenseVector sampleVec ( ... | return DenseVector . toDenseVec ( sample ( numSamples , rand ) ) ; |
public class Scanners { /** * A scanner that scans greedily for 1 or more characters that satisfies the given CharPredicate .
* @ param predicate the predicate object .
* @ return the Parser object . */
public static Parser < Void > many1 ( CharPredicate predicate ) { } } | return Patterns . many1 ( predicate ) . toScanner ( predicate + "+" ) ; |
public class ImageIOHelper { /** * Creates a list of TIFF image files from an image file . It basically
* converts images of other formats to TIFF format , or a multi - page TIFF
* image to multiple TIFF image files .
* @ param imageFile input image file
* @ param index an index of the page ; - 1 means all page... | return createTiffFiles ( imageFile , index , false ) ; |
public class CClassLoader { /** * destroy the loader tree */
public static final void destroy ( ) { } } | if ( CClassLoader . rootLoader == null ) { return ; } System . out . println ( "Destroying YAHP ClassLoader Tree" ) ; CClassLoader . urlLoader = null ; try { Field f = Class . forName ( "java.lang.Shutdown" ) . getDeclaredField ( "hooks" ) ; f . setAccessible ( true ) ; ArrayList l = ( ArrayList ) f . get ( null ) ; fo... |
public class Predicates { /** * Returns a predicate that evaluates to { @ code true } if any one of its
* components evaluates to { @ code true } . The components are evaluated in
* order , and evaluation will be " short - circuited " as soon as as soon as a
* true predicate is found . It defensively copies the i... | return new OrPredicate < T > ( components ) ; |
public class InternalSARLParser { /** * InternalSARL . g : 13743:1 : ruleXCollectionLiteral returns [ EObject current = null ] : ( this _ XSetLiteral _ 0 = ruleXSetLiteral | this _ XListLiteral _ 1 = ruleXListLiteral ) ; */
public final EObject ruleXCollectionLiteral ( ) throws RecognitionException { } } | EObject current = null ; EObject this_XSetLiteral_0 = null ; EObject this_XListLiteral_1 = null ; enterRule ( ) ; try { // InternalSARL . g : 13749:2 : ( ( this _ XSetLiteral _ 0 = ruleXSetLiteral | this _ XListLiteral _ 1 = ruleXListLiteral ) )
// InternalSARL . g : 13750:2 : ( this _ XSetLiteral _ 0 = ruleXSetLiteral... |
public class DeleteAliasRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteAliasRequest deleteAliasRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteAliasRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteAliasRequest . getFunctionName ( ) , FUNCTIONNAME_BINDING ) ; protocolMarshaller . marshall ( deleteAliasRequest . getName ( ) , NAME_BINDING ) ; } catch ( Exce... |
public class Initialization { /** * Resolves the described entry point .
* @ param classLoaderResolver The class loader resolved to use .
* @ param groupId This project ' s group id .
* @ param artifactId This project ' s artifact id .
* @ param version This project ' s version id .
* @ param packaging This p... | if ( entryPoint == null || entryPoint . length ( ) == 0 ) { throw new MojoExecutionException ( "Entry point name is not defined" ) ; } for ( EntryPoint . Default entryPoint : EntryPoint . Default . values ( ) ) { if ( this . entryPoint . equals ( entryPoint . name ( ) ) ) { return entryPoint ; } } try { return ( EntryP... |
public class VocabularyHolder { /** * build binary tree ordered by counter .
* Based on original w2v by google */
public List < VocabularyWord > updateHuffmanCodes ( ) { } } | int min1i ; int min2i ; int b ; int i ; // get vocabulary as sorted list
List < VocabularyWord > vocab = this . words ( ) ; int count [ ] = new int [ vocab . size ( ) * 2 + 1 ] ; int parent_node [ ] = new int [ vocab . size ( ) * 2 + 1 ] ; byte binary [ ] = new byte [ vocab . size ( ) * 2 + 1 ] ; // at this point vocab... |
public class CodedConstant { /** * write list to { @ link CodedOutputStream } object .
* @ param out target output stream to write
* @ param order field order
* @ param type field type
* @ param list target list object to be serialized
* @ param packed the packed
* @ throws IOException Signals that an I / O... | if ( list == null || list . isEmpty ( ) ) { return ; } if ( packed ) { out . writeUInt32NoTag ( makeTag ( order , WireFormat . WIRETYPE_LENGTH_DELIMITED ) ) ; out . writeUInt32NoTag ( computeListSize ( order , list , type , false , null , packed , true ) ) ; } for ( Object object : list ) { if ( object == null ) { thro... |
public class Consumer { /** * Dequeues messages from the local buffer as specified by the limit . If no messages are available to dequeue , then waits for at most timeout
* milliseconds before returning .
* @ param < T > The result type .
* @ param topic The topic to dequeue messages from .
* @ param type The t... | List < T > result = new ArrayList < T > ( ) ; long cutoff = System . currentTimeMillis ( ) + timeout ; BlockingQueue < String > queue = _topics . get ( topic ) . getMessages ( ) ; while ( System . currentTimeMillis ( ) < cutoff && ( limit < 0 || result . size ( ) < limit ) ) { if ( Thread . currentThread ( ) . isInterr... |
public class TasksInner { /** * Create or update task .
* The tasks resource is a nested , proxy - only resource representing work performed by a DMS instance . The PUT method creates a new task or updates an existing one , although since tasks have no mutable custom properties , there is little reason to update an e... | return ServiceFuture . fromResponse ( createOrUpdateWithServiceResponseAsync ( groupName , serviceName , projectName , taskName , parameters ) , serviceCallback ) ; |
public class GetNextCaCertResponseHandler { /** * { @ inheritDoc } */
@ Override public CertStore getResponse ( final byte [ ] content , final String mimeType ) throws ContentException { } } | if ( mimeType . startsWith ( NEXT_CA_CERT ) ) { // http : / / tools . ietf . org / html / draft - nourse - scep - 20 # section - 4.6.1
// The response consists of a SignedData PKCS # 7 [ RFC2315 ] ,
// signed by the current CA ( or RA ) signing key .
try { CMSSignedData cmsMessageData = new CMSSignedData ( content ) ; ... |
public class VirtualMachineRunCommandsInner { /** * Lists all available run commands for a subscription in a location .
* @ param location The location upon which run commands is queried .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ... | return listWithServiceResponseAsync ( location ) . map ( new Func1 < ServiceResponse < Page < RunCommandDocumentBaseInner > > , Page < RunCommandDocumentBaseInner > > ( ) { @ Override public Page < RunCommandDocumentBaseInner > call ( ServiceResponse < Page < RunCommandDocumentBaseInner > > response ) { return response... |
public class AmazonGameLiftClient { /** * Updates settings for a game session queue , which determines how new game session requests in the queue are
* processed . To update settings , specify the queue name to be updated and provide the new settings . When updating
* destinations , provide a complete list of desti... | request = beforeClientExecution ( request ) ; return executeUpdateGameSessionQueue ( request ) ; |
public class CredentialsConfig { /** * Not like getPassword this will return the username of the current Credentials mode of the system ( legacy / credentials plugin )
* @ return the password that should be apply in this configuration */
public String providePassword ( Item item ) { } } | return isUsingCredentialsPlugin ( ) ? PluginsUtils . credentialsLookup ( credentialsId , item ) . getPassword ( ) : credentials . getPassword ( ) ; |
public class Model { /** * Adds an edge to the model .
* If either the source or target vertex of the edge is not in the model ,
* they will be automatically added as well .
* @ param edge The edge to be added .
* @ return The model . */
public Model addEdge ( Edge edge ) { } } | edges . add ( edge ) ; if ( isNotNull ( edge . getSourceVertex ( ) ) && ! vertices . contains ( edge . getSourceVertex ( ) ) ) { vertices . add ( edge . getSourceVertex ( ) ) ; } if ( isNotNull ( edge . getTargetVertex ( ) ) && ! vertices . contains ( edge . getTargetVertex ( ) ) ) { vertices . add ( edge . getTargetVe... |
public class TransformerRegistry { /** * Resolve the host registry .
* @ param mgmtVersion the mgmt version
* @ param subsystems the subsystems
* @ return the transformer registry */
public OperationTransformerRegistry resolveHost ( final ModelVersion mgmtVersion , final ModelNode subsystems ) { } } | return resolveHost ( mgmtVersion , resolveVersions ( subsystems ) ) ; |
public class DatabaseAccountsInner { /** * Lists the read - only access keys for the specified Azure Cosmos DB database account .
* @ param resourceGroupName Name of an Azure resource group .
* @ param accountName Cosmos DB database account name .
* @ param serviceCallback the async ServiceCallback to handle succ... | return ServiceFuture . fromResponse ( listReadOnlyKeysWithServiceResponseAsync ( resourceGroupName , accountName ) , serviceCallback ) ; |
public class StreamSet { /** * Get an iterator over all of the non - null streams . The order is not
* guaranteed .
* @ throws SIResourceException */
public Iterator < Stream > iterator ( ) throws SIResourceException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "iterator" ) ; List < Stream > streams = new ArrayList < Stream > ( ) ; for ( int j = 0 ; j < maxReliabilityIndex + 1 ; j ++ ) { ReliabilitySubset subset = getSubset ( getReliability ( j ) ) ; if ( subset != null ) { ... |
public class MeshArbiter { /** * Collect the failure site update messages from all sites This site sent
* its own mailbox the above broadcast the maximum is local to this site .
* This also ensures at least one response .
* Concurrent failures can be detected by additional reports from the FaultDistributor
* or... | long blockedOnReceiveStart = System . currentTimeMillis ( ) ; long lastReportTime = 0 ; boolean haveEnough = false ; int [ ] forwardStallCount = new int [ ] { FORWARD_STALL_COUNT } ; do { VoltMessage m = m_mailbox . recvBlocking ( receiveSubjects , 5 ) ; /* * If fault resolution takes longer then 10 seconds start loggi... |
public class RestApiClient { /** * Delete admin from chatroom .
* @ param roomName
* the room name
* @ param jid
* the jid
* @ return the response */
public Response deleteAdmin ( String roomName , String jid ) { } } | return restClient . delete ( "chatrooms/" + roomName + "/admins/" + jid , new HashMap < String , String > ( ) ) ; |
public class MembershipHandlerImpl { /** * { @ inheritDoc } */
public void addMembershipEventListener ( MembershipEventListener listener ) { } } | SecurityHelper . validateSecurityPermission ( PermissionConstants . MANAGE_LISTENERS ) ; listeners . add ( listener ) ; |
public class DescribeServicesResult { /** * The service metadata for the service or services in the response .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setServices ( java . util . Collection ) } or { @ link # withServices ( java . util . Collection ) }... | if ( this . services == null ) { setServices ( new java . util . ArrayList < Service > ( services . length ) ) ; } for ( Service ele : services ) { this . services . add ( ele ) ; } return this ; |
public class ShardingEncryptorStrategy { /** * Get sharding encryptor .
* @ param logicTableName logic table name
* @ param columnName column name
* @ return optional of sharding encryptor */
public Optional < ShardingEncryptor > getShardingEncryptor ( final String logicTableName , final String columnName ) { } } | return Collections2 . filter ( columns , new Predicate < ColumnNode > ( ) { @ Override public boolean apply ( final ColumnNode input ) { return input . equals ( new ColumnNode ( logicTableName , columnName ) ) ; } } ) . isEmpty ( ) ? Optional . < ShardingEncryptor > absent ( ) : Optional . of ( shardingEncryptor ) ; |
public class ThreadSet { /** * Run query using this as an initial thread set . */
public < T extends SingleThreadSetQuery . Result < SetType , RuntimeType , ThreadType > > T query ( SingleThreadSetQuery < T > query ) { } } | return query . < SetType , RuntimeType , ThreadType > query ( ( SetType ) this ) ; |
public class SparseMatrix { /** * Parses { @ link SparseMatrix } from the given CSV string .
* @ param csv the CSV string representing a matrix
* @ return a parsed matrix */
public static SparseMatrix fromCSV ( String csv ) { } } | return Matrix . fromCSV ( csv ) . to ( Matrices . SPARSE ) ; |
public class Record { /** * Get value { @ link Float } value
* @ param label target label
* @ return { @ link Float } value of the label . If it is not null . */
public Float getValueFloat ( String label ) { } } | PrimitiveObject o = getPrimitiveObject ( VALUE , label , ObjectUtil . FLOAT , "Float" ) ; if ( o == null ) { return null ; } return ( Float ) o . getObject ( ) ; |
public class AbstractLoader { /** * Replaces the host wildcard from an incoming config with a proper hostname .
* @ param input the input config .
* @ param hostname the hostname to replace it with .
* @ return a replaced configuration . */
protected String replaceHostWildcard ( String input , NetworkAddress host... | return input . replace ( "$HOST" , hostname . address ( ) ) ; |
public class MultiPartParser { private void setState ( FieldState state ) { } } | if ( DEBUG ) LOG . debug ( "{}:{} --> {}" , _state , _fieldState , state ) ; _fieldState = state ; |
public class ParallelTaskBuilder { /** * Sets the ssh password .
* @ param password
* the password
* @ return the parallel task builder */
public ParallelTaskBuilder setSshPassword ( String password ) { } } | this . sshMeta . setPassword ( password ) ; this . sshMeta . setSshLoginType ( SshLoginType . PASSWORD ) ; return this ; |
public class Jinx { /** * Build a multipart body request . */
private byte [ ] buildMultipartBody ( Map < String , String > params , byte [ ] photoData , String boundary ) throws JinxException { } } | ByteArrayOutputStream buffer = new ByteArrayOutputStream ( ) ; try { String filename = params . get ( "filename" ) ; if ( JinxUtils . isNullOrEmpty ( filename ) ) { filename = "image.jpg" ; } String fileMimeType = params . get ( "filemimetype" ) ; if ( JinxUtils . isNullOrEmpty ( fileMimeType ) ) { fileMimeType = "imag... |
public class GeometryService { /** * Calculate whether or not two given geometries intersect each other .
* @ param one The first geometry to check for intersection with the second .
* @ param two The second geometry to check for intersection with the first .
* @ return Returns true or false . */
public static bo... | if ( one == null || two == null || isEmpty ( one ) || isEmpty ( two ) ) { return false ; } if ( Geometry . POINT . equals ( one . getGeometryType ( ) ) ) { return intersectsPoint ( one , two ) ; } else if ( Geometry . LINE_STRING . equals ( one . getGeometryType ( ) ) ) { return intersectsLineString ( one , two ) ; } e... |
public class Perl5Util { /** * find occurence of a pattern in a string ( same like indexOf ) , but dont return first ocurence , it
* return struct with all information
* @ param strPattern
* @ param strInput
* @ param offset
* @ param caseSensitive
* @ return
* @ throws MalformedPatternException */
public... | Perl5Matcher matcher = new Perl5Matcher ( ) ; PatternMatcherInput input = new PatternMatcherInput ( strInput ) ; Array matches = new ArrayImpl ( ) ; int compileOptions = caseSensitive ? 0 : Perl5Compiler . CASE_INSENSITIVE_MASK ; compileOptions += Perl5Compiler . SINGLELINE_MASK ; if ( offset < 1 ) offset = 1 ; Pattern... |
public class Linqy { /** * Create a new iterable by applying a mapper function to each
* element of a given sequence . */
public static < F , T > Iterable < T > map ( final Iterable < F > from , final Mapper < ? super F , T > mapper ) { } } | return new Iterable < T > ( ) { @ Override public Iterator < T > iterator ( ) { return new MappingIterator < F , T > ( from . iterator ( ) , mapper ) ; } } ; |
public class Matrix4f { /** * Store the values of the given matrix < code > m < / code > into < code > this < / code > matrix .
* Note that due to the given matrix < code > m < / code > storing values in double - precision and < code > this < / code > matrix storing
* them in single - precision , there is the possi... | this . _m00 ( ( float ) m . m00 ( ) ) ; this . _m01 ( ( float ) m . m01 ( ) ) ; this . _m02 ( ( float ) m . m02 ( ) ) ; this . _m03 ( ( float ) m . m03 ( ) ) ; this . _m10 ( ( float ) m . m10 ( ) ) ; this . _m11 ( ( float ) m . m11 ( ) ) ; this . _m12 ( ( float ) m . m12 ( ) ) ; this . _m13 ( ( float ) m . m13 ( ) ) ; ... |
public class TaskDao { /** * TaskManager use only */
public void goIdle ( String id ) { } } | setTaskState ( id , Task . IDLE ) ; setActiveLogId ( id , null ) ; |
public class CurationManager { /** * Look through part of the form data for a relationship .
* @ param oid
* The object ID of the current object
* @ param field
* The full field String to store for comparisons
* @ param config
* The config relating to the relationship we are looking for
* @ param baseNode... | JsonObject newRelation = new JsonObject ( ) ; newRelation . put ( "field" , field ) ; newRelation . put ( "authority" , true ) ; // * * - 1 - * * EXCLUSIONS
List < String > exPath = config . getStringList ( "excludeCondition" , "path" ) ; String exValue = config . getString ( null , "excludeCondition" , "value" ) ; if ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.