signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class Scanner { /** * Find classpath elements whose path is a prefix of another classpath element , and record the nesting . * @ param classpathElts * the classpath elements * @ param log * the log */ private void findNestedClasspathElements ( final List < SimpleEntry < String , ClasspathElement > > clas...
// Sort classpath elements into lexicographic order CollectionUtils . sortIfNotEmpty ( classpathElts , new Comparator < SimpleEntry < String , ClasspathElement > > ( ) { @ Override public int compare ( final SimpleEntry < String , ClasspathElement > o1 , final SimpleEntry < String , ClasspathElement > o2 ) { return o1 ...
public class GregorianCalendar { /** * If the supplied millis is in daylight savings time ( DST ) and is the result of an invalid * wall clock then adjust the DST offset to ensure sensible behavior . * < p > When transitioning into DST , i . e . when the clocks spring forward ( usually by one hour ) * there is a ...
if ( dstOffset != 0 ) { // If applying the DST offset produces a time that is outside DST then it must be // an invalid wall clock so clear the DST offset to avoid that happening . if ( ! zone . inDaylightTime ( new Date ( standardTimeInZone - dstOffset ) ) ) { dstOffset = 0 ; } } return dstOffset ;
public class AbstractSequenceClassifier { /** * Loads a classifier from the file specified . If the file ' s name ends in . gz , * uses a GZIPInputStream , else uses a regular FileInputStream . This method * closes the File when done . * @ param file * Loads a classifier from this file . * @ param props * P...
Timing . startDoing ( "Loading classifier from " + file . getAbsolutePath ( ) ) ; BufferedInputStream bis ; if ( file . getName ( ) . endsWith ( ".gz" ) ) { bis = new BufferedInputStream ( new GZIPInputStream ( new FileInputStream ( file ) ) ) ; } else { bis = new BufferedInputStream ( new FileInputStream ( file ) ) ; ...
public class MessageAttributeValue { /** * Not implemented . Reserved for future use . * @ param binaryListValues * Not implemented . Reserved for future use . * @ return Returns a reference to this object so that method calls can be chained together . */ public MessageAttributeValue withBinaryListValues ( java ....
setBinaryListValues ( binaryListValues ) ; return this ;
public class MtasMaximumExpandSpans { /** * Go to next start position . * @ return true , if successful * @ throws IOException Signals that an I / O exception has occurred . */ private boolean goToNextStartPosition ( ) throws IOException { } }
int basicStartPosition ; int basicEndPosition ; if ( docId == - 1 || docId == NO_MORE_DOCS ) { throw new IOException ( "no document" ) ; } else { while ( ( basicStartPosition = subSpans . nextStartPosition ( ) ) != NO_MORE_POSITIONS ) { basicEndPosition = subSpans . endPosition ( ) ; startPosition = Math . max ( minPos...
public class OAbstractFile { /** * ( non - Javadoc ) * @ see com . orientechnologies . orient . core . storage . fs . OFileAAA # delete ( ) */ public void delete ( ) throws IOException { } }
close ( ) ; if ( osFile != null ) { boolean deleted = osFile . delete ( ) ; while ( ! deleted ) { OMemoryWatchDog . freeMemory ( 100 ) ; deleted = osFile . delete ( ) ; } }
public class BinaryTreeSoftAddressableHeap { /** * { @ inheritDoc } */ @ Override public SoftHandle < K , V > findMin ( ) { } }
if ( size == 0 ) { throw new NoSuchElementException ( ) ; } return rootList . head . suffixMin . root . cHead ;
public class CliTool { /** * Parse and execute one of the commands . * @ param args Command line arguments ( command and options ) . * @ param commands A list of commands . */ protected static void main ( String [ ] args , CliTool ... commands ) { } }
if ( commands . length == 1 ) { main ( args , commands [ 0 ] ) ; } else { JCommander jc = new JCommander ( ) ; for ( CliTool command : commands ) { jc . addCommand ( command ) ; } jc . addConverterFactory ( new CustomParameterConverters ( ) ) ; jc . setProgramName ( "" ) ; ExitStatus exitStatus = ExitStatus . SUCCESS ;...
public class GqlQuery { /** * Use { @ link # getNamedBindingsMap ( ) } instead . */ @ java . lang . Deprecated public java . util . Map < java . lang . String , com . google . datastore . v1 . GqlQueryParameter > getNamedBindings ( ) { } }
return getNamedBindingsMap ( ) ;
public class DataUnitBuilder { /** * Returns the application layer service of a given protocol data unit . * @ param apdu application layer protocol data unit , requires < code > apdu . length < / code > & gt ; 1 * @ return APDU service code */ public static int getAPDUService ( final byte [ ] apdu ) { } }
if ( apdu . length < 2 ) throw new KNXIllegalArgumentException ( "getting APDU service from [0x" + toHex ( apdu , "" ) + "], APCI length < 2" ) ; // high 4 bits of APCI final int apci4 = ( apdu [ 0 ] & 0x03 ) << 2 | ( apdu [ 1 ] & 0xC0 ) >> 6 ; // lowest 6 bits of APCI final int apci6 = apdu [ 1 ] & 0x3f ; // group val...
public class ComponentProxy { /** * { @ inheritDoc } */ public Object intercept ( Object object , Method method , Object [ ] args , MethodProxy proxy ) throws Throwable { } }
if ( isFinalizeMethod ( method ) ) { // swallow finalize call return null ; } else if ( isEqualsMethod ( method ) ) { return equals ( args [ 0 ] ) ? Boolean . TRUE : Boolean . FALSE ; } else if ( isHashCodeMethod ( method ) ) { return new Integer ( hashCode ( ) ) ; } else if ( isToStringMethod ( method ) ) { return toS...
public class CompareFacesRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CompareFacesRequest compareFacesRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( compareFacesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( compareFacesRequest . getSourceImage ( ) , SOURCEIMAGE_BINDING ) ; protocolMarshaller . marshall ( compareFacesRequest . getTargetImage ( ) , TARGETIMAGE_BINDING ) ;...
public class Unmarshaller { /** * Unmarshals the embedded fields of this entity . * @ throws Throwable * propagated */ private void unmarshalEmbeddedFields ( ) throws Throwable { } }
for ( EmbeddedMetadata embeddedMetadata : entityMetadata . getEmbeddedMetadataCollection ( ) ) { if ( embeddedMetadata . getStorageStrategy ( ) == StorageStrategy . EXPLODED ) { unmarshalWithExplodedStrategy ( embeddedMetadata , entity ) ; } else { unmarshalWithImplodedStrategy ( embeddedMetadata , entity , nativeEntit...
public class InputTextRenderer { /** * Add script to enable the input mask . If the mask attribute starts with { @ code { } } the value is expected to be a * JSON object ( and can for example be used to set a regular expression : { @ code { regex : ' [ 0-9 \ u0600 - \ u06FF ] * ' } } ) . * See https : / / github . ...
if ( inputText . getMask ( ) != null && ! inputText . getMask ( ) . isEmpty ( ) ) { rw . startElement ( "script" , inputText ) ; rw . writeText ( "Inputmask(" , null ) ; if ( inputText . getMask ( ) . trim ( ) . startsWith ( "{" ) ) { rw . writeText ( inputText . getMask ( ) . trim ( ) , null ) ; } else { rw . writeTex...
public class ServerReplicationConfigurationMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ServerReplicationConfiguration serverReplicationConfiguration , ProtocolMarshaller protocolMarshaller ) { } }
if ( serverReplicationConfiguration == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( serverReplicationConfiguration . getServer ( ) , SERVER_BINDING ) ; protocolMarshaller . marshall ( serverReplicationConfiguration . getServerReplicationP...
public class LambdaDslJsonArray { /** * Combine all the matchers using AND * @ param value Attribute example value * @ param rules Matching rules to apply */ public LambdaDslJsonArray and ( Object value , MatchingRule ... rules ) { } }
pactArray . and ( value , rules ) ; return this ;
public class ThriftCodecByteCodeGenerator { /** * Defines the code to inject data into the struct public fields . */ private void injectStructFields ( MethodDefinition read , LocalVariableDefinition instance , Map < Short , LocalVariableDefinition > structData ) { } }
for ( ThriftFieldMetadata field : metadata . getFields ( THRIFT_FIELD ) ) { injectField ( read , field , instance , structData . get ( field . getId ( ) ) ) ; }
public class Html5WebSocket { /** * { @ inheritDoc } */ @ Override public void send ( @ Nonnull final ArrayBuffer data ) throws IllegalStateException { } }
checkConnected ( ) ; _webSocket . send ( data ) ;
public class MediaSource { /** * Check if a matching rendition is found for any of the provided media formats and other media args . * The first match is returned . * @ param media Media * @ param asset Asset * @ param mediaArgs Media args * @ return true if a rendition was found */ private boolean resolveFir...
Rendition rendition = asset . getRendition ( mediaArgs ) ; if ( rendition != null ) { media . setRenditions ( ImmutableList . of ( rendition ) ) ; media . setUrl ( rendition . getUrl ( ) ) ; return true ; } return false ;
public class PersonDocumentRepositoryMongoImpl { /** * { @ inheritDoc } */ @ Override public Collection < PersonDocument > findByRootAndSurnameBeginsWith ( final RootDocument rootDocument , final String beginsWith ) { } }
logger . debug ( "Starting findByRootAndSurnameBeginsWith" ) ; if ( rootDocument == null ) { return Collections . emptyList ( ) ; } final Collection < PersonDocument > personDocuments = findByFileAndSurnameBeginsWith ( rootDocument . getFilename ( ) , beginsWith ) ; for ( final PersonDocument personDocument : personDoc...
public class Path3d { /** * Replies the coordinates of this path in an array of * double precision floating - point numbers . * @ param transform is the transformation to apply to all the coordinates . * @ return the coordinates . */ @ Pure public double [ ] toDoubleArray ( Transform3D transform ) { } }
double [ ] clone = new double [ this . numCoordsProperty . get ( ) ] ; if ( transform == null ) { for ( int i = 0 ; i < this . numCoordsProperty . get ( ) ; ++ i ) { clone [ i ] = this . coordsProperty [ i ] . get ( ) ; } } else { Point3f p = new Point3f ( ) ; for ( int i = 0 ; i < clone . length ; ) { p . x = this . c...
public class ExecutionEntityManagerImpl { /** * UPDATE METHODS */ @ Override public void updateExecutionTenantIdForDeployment ( String deploymentId , String newTenantId ) { } }
executionDataManager . updateExecutionTenantIdForDeployment ( deploymentId , newTenantId ) ;
public class EngineDefaults { /** * A list of parameters specific to a particular cache node type . Each element in the list contains detailed * information about one parameter . * @ return A list of parameters specific to a particular cache node type . Each element in the list contains detailed * information abo...
if ( cacheNodeTypeSpecificParameters == null ) { cacheNodeTypeSpecificParameters = new com . amazonaws . internal . SdkInternalList < CacheNodeTypeSpecificParameter > ( ) ; } return cacheNodeTypeSpecificParameters ;
public class TransactionalCache { /** * Put an instance into the cache . * @ param id * The id . * @ param value * The instance . * @ param mode * The mode . */ public void put ( Id id , Object value , Mode mode ) { } }
if ( Mode . WRITE . equals ( mode ) ) { writeCache . put ( id , value ) ; } readCache . put ( new CacheKey ( id ) , value ) ;
public class TextComponentUtil { /** * Eats whitespace lines after the given offset until it finds a non - whitespace line and * returns the start of the last whitespace line found , or the initial value if none was . */ public static int getDeepestWhiteSpaceLineStartAfter ( String script , int offset ) { } }
if ( offset < 0 ) { return offset ; } int i = offset ; while ( true ) { int lineStartAfter = getWhiteSpaceLineStartAfter ( script , i ) ; if ( lineStartAfter == - 1 ) { return i ; } else { i = lineStartAfter ; } }
public class AnnotationFilter { /** * { @ inheritDoc } * @ return { @ code true } if the specified { @ link Class # isAnnotationPresent ( Class ) annotation is present } for the given * { @ code type } , { @ code false } otherwise . */ @ Override public boolean accept ( Class < ? > type ) { } }
if ( type != null ) { if ( this . forceInheritence ) { Annotation annotation = this . annotationUtil . getTypeAnnotation ( type , this . annotationType ) ; return ( annotation != null ) ; } else { return type . isAnnotationPresent ( this . annotationType ) ; } } return false ;
public class AmazonCloudDirectoryClient { /** * Creates a < a > TypedLinkFacet < / a > . For more information , see < a href = * " https : / / docs . aws . amazon . com / clouddirectory / latest / developerguide / directory _ objects _ links . html # directory _ objects _ links _ typedlink " * > Typed Links < / a >...
request = beforeClientExecution ( request ) ; return executeCreateTypedLinkFacet ( request ) ;
public class Branch { /** * Enabled Strong matching check using chrome cookies . This method should be called before * Branch # getAutoInstance ( Context ) . < / p > * @ param cookieMatchDomain The domain for the url used to match the cookie ( eg . example . app . link ) * @ param delay Time in millisecond to wai...
cookieBasedMatchDomain_ = cookieMatchDomain ; BranchStrongMatchHelper . getInstance ( ) . setStrongMatchUrlHitDelay ( delay ) ;
public class ZipClient { /** * See if there are any assets under the specified directory in the zip */ @ Override protected boolean hasChildren ( final String relative ) throws IOException { } }
ZipFile zip = createZipFile ( ) ; if ( null == zip ) { return false ; } Enumeration < ? extends ZipEntry > entries = zip . entries ( ) ; while ( entries . hasMoreElements ( ) ) { ZipEntry entry = entries . nextElement ( ) ; if ( ( relative . equals ( "" ) ) || entry . getName ( ) . startsWith ( relative + File . separa...
public class MapUtil { /** * 获取Map指定key的值 , 并转换为Integer * @ param map Map * @ param key 键 * @ return 值 * @ since 4.0.6 */ public static Integer getInt ( Map < ? , ? > map , Object key ) { } }
return get ( map , key , Integer . class ) ;
public class StaticTraceInstrumentation { /** * Setup the lists of classes and jars to process based on the command * line arguments provided . */ public void processArguments ( String [ ] args ) throws IOException { } }
List < File > classFiles = new ArrayList < File > ( ) ; List < File > jarFiles = new ArrayList < File > ( ) ; String [ ] fileArgs = null ; for ( int i = 0 ; i < args . length ; i ++ ) { if ( args [ i ] . equalsIgnoreCase ( "--config" ) ) { configFileParser = new TraceConfigFileParser ( new File ( args [ ++ i ] ) ) ; co...
public class ListPullRequestsResult { /** * The system - generated IDs of the pull requests . * @ param pullRequestIds * The system - generated IDs of the pull requests . */ public void setPullRequestIds ( java . util . Collection < String > pullRequestIds ) { } }
if ( pullRequestIds == null ) { this . pullRequestIds = null ; return ; } this . pullRequestIds = new java . util . ArrayList < String > ( pullRequestIds ) ;
public class Main { /** * Initializes logging , specifically by looking for log4j . xml or * log4j . properties file in DataCleaner ' s home directory . * @ return true if a logging configuration file was found , or false * otherwise */ protected static boolean initializeLogging ( ) { } }
try { // initial logging config , used before anything else { final URL url = Main . class . getResource ( "log4j-initial.xml" ) ; assert url != null ; DOMConfigurator . configure ( url ) ; } if ( ClassLoaderUtils . IS_WEB_START ) { final URL url = Main . class . getResource ( "log4j-jnlp.xml" ) ; assert url != null ; ...
public class ICULocaleService { /** * Convenience method for callers using locales . This returns the standard * Locale list , built from the Set of visible ids . */ public Locale [ ] getAvailableLocales ( ) { } }
// TODO make this wrap getAvailableULocales later Set < String > visIDs = getVisibleIDs ( ) ; Locale [ ] locales = new Locale [ visIDs . size ( ) ] ; int n = 0 ; for ( String id : visIDs ) { Locale loc = LocaleUtility . getLocaleFromName ( id ) ; locales [ n ++ ] = loc ; } return locales ;
public class XMLDataLoader { /** * Returns a mapping from all testcases to their results for a certain collectorName . * @ param collectorName The name of the collector for loading the Results * @ return Mapping from all testcases to their results */ public Map < String , Map < Date , Long > > getData ( final Strin...
final Map < String , Map < Date , Long > > map = new HashMap < > ( ) ; final Testcases testcases = data . getTestcases ( ) ; for ( final TestcaseType tct : testcases . getTestcase ( ) ) { final Map < Date , Long > measures = new HashMap < > ( ) ; final List < Datacollector > collectorMap = tct . getDatacollector ( ) ; ...
public class RestApiClient { /** * Gets the sessions . * @ return the sessions */ public SessionEntities getSessions ( ) { } }
SessionEntities sessionEntities = restClient . get ( "sessions" , SessionEntities . class , new HashMap < String , String > ( ) ) ; return sessionEntities ;
public class TypeUtil { /** * If either type is a double TypeMirror , a double TypeMirror is returned . * Otherwise , if either type is a float TypeMirror , a float TypeMirror is returned . * Otherwise , if either type is a long TypeMirror , a long TypeMirror is returned . * Otherwise , an int TypeMirror is retur...
TypeKind t1 = type1 . getKind ( ) ; TypeKind t2 = type2 . getKind ( ) ; if ( t1 == TypeKind . DECLARED ) { t1 = javacTypes . unboxedType ( type1 ) . getKind ( ) ; } if ( t2 == TypeKind . DECLARED ) { t2 = javacTypes . unboxedType ( type2 ) . getKind ( ) ; } if ( t1 == TypeKind . DOUBLE || t2 == TypeKind . DOUBLE ) { re...
public class ValueNumberFrameModelingVisitor { /** * Load a static field . * @ param staticField * the field * @ param obj * the Instruction loading the field */ private void loadStaticField ( XField staticField , Instruction obj ) { } }
if ( RLE_DEBUG ) { System . out . println ( "[loadStaticField for field " + staticField + " in instruction " + handle ) ; } ValueNumberFrame frame = getFrame ( ) ; AvailableLoad availableLoad = new AvailableLoad ( staticField ) ; ValueNumber [ ] loadedValue = frame . getAvailableLoad ( availableLoad ) ; if ( loadedValu...
public class MapCollections { /** * Returns unmodifiable MapList . * @ param < K > * @ param < V > * @ param map * @ return */ public static final < K , V > MapList < K , V > unmodifiableMapList ( MapList < K , V > map ) { } }
return new UnmodifiableMapList ( Collections . unmodifiableMap ( map ) , map . getComparator ( ) ) ;
public class JKIOUtil { /** * Cop resources from jar to dir . * @ param sourceClassPath the source class path * @ param dest the dest */ public static void copResourcesFromJarToDir ( String sourceClassPath , File dest ) { } }
try { List < File > resourcesInnPackage = getResourcesInnPackage ( sourceClassPath ) ; for ( File file : resourcesInnPackage ) { JK . printBlock ( "Copying file: " + file . getName ( ) + " to folder " + dest . getAbsolutePath ( ) ) ; FileUtils . copyFileToDirectory ( file , dest ) ; } } catch ( IOException e ) { JK . t...
public class NonBlockingHashMap { /** * putIfMatch only returns a null if passed in an expected null . */ private static final Object putIfMatch ( final NonBlockingHashMap topmap , final Object [ ] kvs , final Object key , final Object putval , final Object expVal ) { } }
assert putval != null ; assert ! ( putval instanceof Prime ) ; assert ! ( expVal instanceof Prime ) ; final int fullhash = hash ( key ) ; // throws NullPointerException if key null final int len = len ( kvs ) ; // Count of key / value pairs , reads kvs . length final CHM chm = chm ( kvs ) ; // Reads kvs [ 0] final int ...
public class PairLineNorm { /** * Sets the value of p1 and p2 to be equal to the values of the passed in objects */ public void set ( Vector3D_F64 l1 , Vector3D_F64 l2 ) { } }
this . l1 . set ( l1 ) ; this . l2 . set ( l2 ) ;
public class Stopwatch { /** * stops the watch * @ return returns the current time or 0 if watch not was running */ public long stop ( ) { } }
if ( isRunning ) { long time = _time ( ) - start ; total += time ; count ++ ; isRunning = false ; return time ; } return 0 ;
public class EntityUtils { /** * extractIds . * @ param entities a { @ link java . util . Collection } object . * @ param < T > a T object . * @ return a { @ link java . util . List } object . */ public static < T extends Entity < ? > > List < ? > extractIds ( Collection < T > entities ) { } }
List < Object > idList = CollectUtils . newArrayList ( ) ; for ( Iterator < T > iter = entities . iterator ( ) ; iter . hasNext ( ) ; ) { Entity < ? > element = iter . next ( ) ; try { idList . add ( PropertyUtils . getProperty ( element , "id" ) ) ; } catch ( Exception e ) { logger . error ( "getProperty error" , e ) ...
public class SipSessionImpl { /** * / * ( non - Javadoc ) * @ see org . mobicents . javax . servlet . sip . SipSessionExt # setBypassLoadBalancer ( boolean ) */ @ Override public void setBypassLoadBalancer ( boolean bypassLoadBalancer ) { } }
if ( logger . isDebugEnabled ( ) ) { logger . debug ( "setting bypassLoadBalancer: " + bypassLoadBalancer + " on the sip session " + key ) ; } this . bypassLoadBalancer = bypassLoadBalancer ;
public class JwkProviderBuilder { /** * Creates a { @ link JwkProvider } * @ return a newly created { @ link JwkProvider } */ public JwkProvider build ( ) { } }
JwkProvider urlProvider = new UrlJwkProvider ( url ) ; if ( this . rateLimited ) { urlProvider = new RateLimitedJwkProvider ( urlProvider , bucket ) ; } if ( this . cached ) { urlProvider = new GuavaCachedJwkProvider ( urlProvider , cacheSize , expiresIn , expiresUnit ) ; } return urlProvider ;
public class KMeansPlusPlusSeed { /** * Computes the distance between each data point and the given centroid . If * { @ code selectMin } is set to true , then this will only overwrite the * values in { @ code distances } if the new distance is smaller . Otherwise * the new distance will always be stored in { @ co...
for ( int i = 0 ; i < distances . length ; ++ i ) { double distance = Similarity . euclideanDistance ( centroid , dataPoints . getRowVector ( i ) ) ; if ( ! selectMin || selectMin && distance < distances [ i ] ) distances [ i ] = distance ; }
public class FeatureExtractor { /** * Given a list of templates , extracts all features for the given state * @ param configuration * @ return * @ throws Exception */ public static Object [ ] extractAllParseFeatures ( Configuration configuration , int length ) { } }
if ( length == 26 ) return extractBasicFeatures ( configuration , length ) ; else if ( length == 72 ) return extractExtendedFeatures ( configuration , length ) ; else return extractExtendedFeaturesWithBrownClusters ( configuration , length ) ;
public class Evaluation { /** * Evaluate the network , with optional metadata * @ param labels Data labels * @ param predictions Network predictions * @ param recordMetaData Optional ; may be null . If not null , should have size equal to the number of outcomes / guesses */ @ Override public void eval ( INDArray ...
Triple < INDArray , INDArray , INDArray > p = BaseEvaluation . reshapeAndExtractNotMasked ( labels , predictions , mask , axis ) ; if ( p == null ) { // All values masked out ; no - op return ; } INDArray labels2d = p . getFirst ( ) ; INDArray predictions2d = p . getSecond ( ) ; INDArray maskArray = p . getThird ( ) ; ...
public class CmsDriverManager { /** * Adds an alias entry . < p > * @ param dbc the database context * @ param project the current project * @ param alias the alias to add * @ throws CmsException if something goes wrong */ public void addAlias ( CmsDbContext dbc , CmsProject project , CmsAlias alias ) throws Cm...
I_CmsVfsDriver vfsDriver = getVfsDriver ( dbc ) ; vfsDriver . insertAlias ( dbc , project , alias ) ;
public class ModelsImpl { /** * Updates an explicit list item for a Pattern . Any entity . * @ param appId The application ID . * @ param versionId The version ID . * @ param entityId The Pattern . Any entity extractor ID . * @ param itemId The explicit list item ID . * @ param updateExplicitListItemOptionalP...
return ServiceFuture . fromResponse ( updateExplicitListItemWithServiceResponseAsync ( appId , versionId , entityId , itemId , updateExplicitListItemOptionalParameter ) , serviceCallback ) ;
public class OptimizableHashSet { /** * Returns the maximum number of entries that can be filled before rehashing . * @ param n the size of the backing array . * @ param f the load factor . * @ return the maximum number of entries before rehashing . */ public static int maxFill ( int n , float f ) { } }
return Math . min ( ( int ) Math . ceil ( ( double ) ( ( float ) n * f ) ) , n - 1 ) ;
public class SbtDependencyResolver { /** * / * - - - Overridden methods - - - */ @ Override protected ResolutionResult resolveDependencies ( String projectFolder , String topLevelFolder , Set < String > bomFiles ) { } }
Collection < AgentProjectInfo > projects = new ArrayList < > ( ) ; List < File > xmlFiles = new LinkedList < > ( ) ; // run sbt compile if the user turn on the sbt . runPreStep flag if ( sbtRunPreStep ) { runPreStep ( topLevelFolder ) ; } // check if sbt . targetFolder is not blank . // if not the system trying to sear...
public class Tabs { /** * Sets the call - back for the AJAX beforeLoad event . * @ param beforeLoadEvent * The ITabsAjaxEvent . */ public Tabs setAjaxBeforeLoadEvent ( ITabsAjaxEvent beforeLoadEvent ) { } }
this . ajaxEvents . put ( TabEvent . beforeLoad , beforeLoadEvent ) ; setBeforeLoadEvent ( new TabsAjaxJsScopeUiEvent ( this , TabEvent . beforeLoad ) ) ; return this ;
public class RunIfUtils { /** * Find the { @ link RunIf } annotation on the class or on a superclass in the hierarchy . * @ param klass The class to analyze . * @ return The { @ link RunIf } annotation if found , { @ code null } otherwise . */ private static RunIf findRunIfAnnotation ( Class < ? > klass ) { } }
while ( klass != null && klass != Object . class ) { RunIf annotation = klass . getAnnotation ( RunIf . class ) ; if ( annotation != null ) { return annotation ; } klass = klass . getSuperclass ( ) ; } return null ;
public class FeatureTiles { /** * Draw a tile image from the x , y , and zoom level by querying all features . * This could be very slow if there are a lot of features * @ param x * x coordinate * @ param y * y coordinate * @ param zoom * zoom level * @ return drawn image , or null */ public BufferedIma...
BoundingBox boundingBox = TileBoundingBoxUtils . getWebMercatorBoundingBox ( x , y , zoom ) ; BufferedImage image = null ; // Query for all features FeatureResultSet resultSet = featureDao . queryForAll ( ) ; try { int totalCount = resultSet . getCount ( ) ; // Draw if at least one geometry exists if ( totalCount > 0 )...
public class MessageItem { /** * Javadoc inherited */ @ Override public long getExpiryStartTime ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getExpiryStartTime" ) ; // Set the expiry to start from the last time we updated the wait time . long startTime = getCurrentMEArrivalTimestamp ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnable...
public class BasicMonthOfYearDateTimeField { public long add ( long instant , long months ) { } }
int i_months = ( int ) months ; if ( i_months == months ) { return add ( instant , i_months ) ; } // Copied from add ( long , int ) and modified slightly : long timePart = iChronology . getMillisOfDay ( instant ) ; int thisYear = iChronology . getYear ( instant ) ; int thisMonth = iChronology . getMonthOfYear ( instant...
public class NeoUtils { /** * load the database configuration map for neo4j databases * @ param config * Graphity configuration containing the configuration values * @ return neo4j database configuration map */ private static Map < String , String > loadDatabaseConfig ( final Configuration config ) { } }
// create database configuration final Map < String , String > databaseConfig = new HashMap < String , String > ( ) ; // fill database configuration databaseConfig . put ( "cache_type" , config . getCacheType ( ) ) ; databaseConfig . put ( "use_memory_mapped_buffers" , config . getUseMemoryMappedBuffers ( ) ) ; return ...
public class HttpClient { /** * Set the unauthenticated proxy server to use . By default no proxy is configured . * @ param proxy The proxy server , e . g . { @ code new URI ( " http : / / my . proxy . com : 8000 " ) } */ public void setProxy ( URI proxy ) { } }
this . getParams ( ) . setParameter ( ConnRoutePNames . DEFAULT_PROXY , new HttpHost ( proxy . getHost ( ) , proxy . getPort ( ) , proxy . getScheme ( ) ) ) ;
public class AppsInner { /** * Check if an IoT Central application subdomain is available . * @ param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of the IoT Central application to check . * @ param serviceCallback the async ServiceCallback to handle successful and failed...
return ServiceFuture . fromResponse ( checkSubdomainAvailabilityWithServiceResponseAsync ( operationInputs ) , serviceCallback ) ;
public class AppServiceCertificateOrdersInner { /** * Retrieve the list of certificate actions . * Retrieve the list of certificate actions . * @ param resourceGroupName Name of the resource group to which the resource belongs . * @ param name Name of the certificate order . * @ throws IllegalArgumentException ...
return retrieveCertificateActionsWithServiceResponseAsync ( resourceGroupName , name ) . map ( new Func1 < ServiceResponse < List < CertificateOrderActionInner > > , List < CertificateOrderActionInner > > ( ) { @ Override public List < CertificateOrderActionInner > call ( ServiceResponse < List < CertificateOrderAction...
public class MultiphaseOverallContext { /** * Transform an operation for a server . This will also delegate to the host - controller result - transformer . */ public OperationTransformer . TransformedOperation transformServerOperation ( final String hostName , final TransformingProxyController remoteProxyController , f...
final OperationTransformer . TransformedOperation transformed = remoteProxyController . transformOperation ( transformationInputs , original ) ; final HostControllerUpdateTask . ExecutedHostRequest hostRequest = finalResultFutures . get ( hostName ) ; if ( hostRequest == null ) { // in case it ' s local hosts - control...
public class SanitizedContents { /** * Wraps an assumed - safe trusted _ resource _ uri constant . * < p > This only accepts compile - time constants , based on the assumption that trusted resource URIs * that are controlled by the application ( and not user input ) are considered safe . */ public static SanitizedC...
return fromConstant ( constant , ContentKind . TRUSTED_RESOURCE_URI , Dir . LTR ) ;
public class DynamicPipelineServiceImpl { /** * Computes the build stage of the pipeline . * Given a list of builds and commits , this method will associate builds to commits and then * add commits to the build stage of the pipeline . Only commits that are tracked by our dashboard * are added meaning that if a bu...
// sort again in case code changes in future to be safe List < Build > sortedBuilds = new ArrayList < > ( builds ) ; Collections . sort ( sortedBuilds , BUILD_NUMBER_COMPATATOR ) ; Multimap < ObjectId , Commit > buildCommits = buildBuildToCommitsMap ( sortedBuilds , commits ) ; if ( logger . isDebugEnabled ( ) ) { Stri...
public class BigFileSearcher { /** * Search bytes from big file faster with realtime result callback < br > * < br > * This callbacks the result in real time , but since the concurrency is * inferior to # searchBigFile , so the execution speed is slower than * # searchBigFile * @ param f * targetFile * @ ...
return searchBigFileRealtime ( f , searchBytes , 0 , listener ) ;
public class OperaBoolean { /** * Whether string holds a boolean - like value . It should equal " 0 " , " 1 " , " true " or " false " . This * method says nothing about whether the object is true or false . * @ param string string to check * @ return true if value is " boolesque " , false otherwise * @ throws I...
checkNotNull ( string ) ; assertBoolesque ( string ) ; return isFalsy ( string ) || isTruthy ( string ) ;
public class StringObservable { /** * Gather up all of the strings in to one string to be able to use it as one message . Don ' t use * this on infinite streams . * < img width = " 640 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / St . stringConcat . png " alt = " ...
return toString ( src . reduce ( new StringBuilder ( ) , new Func2 < StringBuilder , String , StringBuilder > ( ) { @ Override public StringBuilder call ( StringBuilder a , String b ) { return a . append ( b ) ; } } ) ) ;
public class JBaseScreen { /** * Get this field ( or return null if this field doesn ' t belong on the screen ) . * This is the method to use to filter the items to display on the screen . * @ param The index of this field in the record . * @ return The fieldinfo object . */ public Converter getFieldForScreen ( i...
if ( this . getFieldList ( ) != null ) { FieldInfo fieldInfo = this . getFieldList ( ) . getField ( iIndex ) ; if ( fieldInfo != null ) { if ( fieldInfo . isHidden ( ) ) return SKIP_THIS_FIELD ; return fieldInfo . getFieldConverter ( ) ; } } return null ;
public class SeaGlassInternalShadowEffect { /** * Create the gradient for the left of a rectangular shadow . * @ param s the shape of the gradient . This is only used for its bounds . * @ return the gradient . */ public Paint getLeftShadowGradient ( Shape s ) { } }
Rectangle2D bounds = s . getBounds2D ( ) ; float minX = ( float ) bounds . getMinX ( ) ; float maxX = ( float ) bounds . getMaxX ( ) ; float midY = ( float ) bounds . getCenterY ( ) ; return new LinearGradientPaint ( minX , midY , maxX , midY , ( new float [ ] { 0f , 1f } ) , new Color [ ] { innerShadow . bottom , tran...
public class BatchReplaceMain { /** * replaceFile . * @ param fileName a { @ link java . lang . String } object . * @ param profiles a { @ link java . util . Map } object . * @ param charset a { @ link java . lang . String } object . * @ throws java . lang . Exception if any . * @ throws java . io . FileNotFo...
File file = new File ( fileName ) ; if ( file . isFile ( ) && ! file . isHidden ( ) ) { List < Replacer > replacers = profiles . get ( Strings . substringAfterLast ( fileName , "." ) ) ; if ( null == replacers ) { return ; } logger . info ( "processing {}" , fileName ) ; String filecontent = Files . readFileToString ( ...
public class FileContentManager { /** * Saves the { @ link String } content to the specified location using the specified { @ link java . nio . charset . Charset } . * @ param content * @ param charset * @ param location * @ return */ @ Override public boolean save ( String content , Charset charset , String lo...
File file = new File ( location ) ; try { Files . writeToFile ( file , content , charset ) ; } catch ( IOException ex ) { return false ; } return true ;
public class BluetoothService { /** * secure : Socket Security type - Secure ( true ) , Insecure ( false ) */ public synchronized void connect ( BluetoothDevice device ) { } }
// Cancel any thread attempting to make a connection if ( mState == BluetoothService . STATE_CONNECTING ) { if ( mConnectThread != null ) { mConnectThread . cancel ( ) ; mConnectThread = null ; } } // Cancel any thread currently running a connection if ( mConnectedThread != null ) { mConnectedThread . cancel ( ) ; mCon...
public class ValueAnimator { /** * This function is called immediately before processing the first animation * frame of an animation . If there is a nonzero < code > startDelay < / code > , the * function is called after that delay ends . * It takes care of the final initialization steps for the * animation . ...
if ( ! mInitialized ) { int numValues = mValues . length ; for ( int i = 0 ; i < numValues ; ++ i ) { mValues [ i ] . init ( ) ; } mInitialized = true ; }
public class SarlBatchCompiler { /** * Reports the given error message . * @ param message the warning message . * @ param parameters the values of the parameters that must be dynamically replaced within the message text . * @ since 0.8 */ protected void reportInternalError ( String message , Object ... parameter...
getLogger ( ) . error ( message , parameters ) ; if ( getReportInternalProblemsAsIssues ( ) ) { final org . eclipse . emf . common . util . URI uri = null ; final Issue . IssueImpl issue = new Issue . IssueImpl ( ) ; issue . setCode ( INTERNAL_ERROR_CODE ) ; issue . setMessage ( message ) ; issue . setUriToProblem ( ur...
public class HighriskSpecialPrefixReader { /** * Make the request to the Twilio API to perform the read . * @ param client TwilioRestClient with which to make the request * @ return HighriskSpecialPrefix ResourceSet */ @ Override public ResourceSet < HighriskSpecialPrefix > read ( final TwilioRestClient client ) { ...
return new ResourceSet < > ( this , client , firstPage ( client ) ) ;
public class OssIndexAnalyzer { /** * Helper to complain if unable to parse Package - URL . */ @ Nullable private PackageUrl parsePackageUrl ( final String value ) { } }
try { return PackageUrl . parse ( value ) ; } catch ( PackageUrl . InvalidException e ) { log . warn ( "Invalid Package-URL: {}" , value , e ) ; return null ; }
public class TransactionException { /** * Thrown when creating a label which starts with a reserved character Schema . ImplicitType # RESERVED */ public static TransactionException invalidLabelStart ( Label label ) { } }
return create ( String . format ( "Cannot create a label {%s} starting with character {%s} as it is a reserved starting character" , label , Schema . ImplicitType . RESERVED . getValue ( ) ) ) ;
public class StringSupport { /** * TODO get rid of this code altogether */ public static List < String > split ( String input , String punctuationChars , String quoteSymbols , boolean sort , boolean convertToLowerCase , boolean distinct ) { } }
return new StringSplitter ( input , punctuationChars , quoteSymbols , sort , convertToLowerCase , distinct , false ) . split ( ) ;
public class DestinationTools { /** * Make sure the given destination is a light - weight serializable destination reference */ public static Topic asRef ( Topic topic ) throws JMSException { } }
if ( topic == null ) return null ; if ( topic instanceof TopicRef ) return topic ; return new TopicRef ( topic . getTopicName ( ) ) ;
public class NodeModelUtils { /** * / * @ Nullable */ private static EObject findActualSemanticObjectInChildren ( /* @ NonNull */ INode node , /* @ Nullable */ EObject grammarElement ) { } }
if ( node . hasDirectSemanticElement ( ) ) return node . getSemanticElement ( ) ; AbstractRule rule = null ; if ( grammarElement instanceof RuleCall ) { rule = ( ( RuleCall ) grammarElement ) . getRule ( ) ; } else if ( grammarElement instanceof AbstractRule ) { rule = ( AbstractRule ) grammarElement ; } if ( rule inst...
public class ClasspathElementZip { /** * / * ( non - Javadoc ) * @ see io . github . classgraph . ClasspathElement # open ( * nonapi . io . github . classgraph . concurrency . WorkQueue , nonapi . io . github . classgraph . utils . LogNode ) */ @ Override void open ( final WorkQueue < ClasspathEntryWorkUnit > workQ...
if ( ! scanSpec . scanJars ) { if ( log != null ) { log . log ( "Skipping classpath element, since jar scanning is disabled: " + rawPath ) ; } skipClasspathElement = true ; return ; } final LogNode subLog = log == null ? null : log . log ( "Opening jar: " + rawPath ) ; final int plingIdx = rawPath . indexOf ( '!' ) ; f...
public class S3AInputStream { /** * Opens a new stream at mPos if the wrapped stream mIn is null . */ private void openStream ( ) throws IOException { } }
if ( mIn != null ) { // stream is already open return ; } GetObjectRequest getReq = new GetObjectRequest ( mBucketName , mKey ) ; // If the position is 0 , setting range is redundant and causes an error if the file is 0 length if ( mPos > 0 ) { getReq . setRange ( mPos ) ; } AmazonS3Exception lastException = null ; whi...
public class AdHocCommandManager { /** * Discover the commands of an specific JID . The < code > jid < / code > is a * full JID . * @ param jid the full JID to retrieve the commands for . * @ return the discovered items . * @ throws XMPPException if the operation failed for some reason . * @ throws SmackExcep...
return serviceDiscoveryManager . discoverItems ( jid , NAMESPACE ) ;
public class servicegroup_binding { /** * Use this API to fetch servicegroup _ binding resource of given name . */ public static servicegroup_binding get ( nitro_service service , String servicegroupname ) throws Exception { } }
servicegroup_binding obj = new servicegroup_binding ( ) ; obj . set_servicegroupname ( servicegroupname ) ; servicegroup_binding response = ( servicegroup_binding ) obj . get_resource ( service ) ; return response ;
public class MavenConverter { /** * Converts MavenDepedency to Dependency representation used in Aether * @ param dependency * the Maven dependency * @ param registry * A registry of known artifact types . * @ return the corresponding Aether dependency */ public static Dependency asDependency ( MavenDependenc...
/* * Allow for undeclared scopes */ String scope = dependency . getScope ( ) . toString ( ) ; if ( dependency . isUndeclaredScope ( ) ) { scope = EMPTY ; } return new Dependency ( asArtifact ( dependency , registry ) , scope , dependency . isOptional ( ) , asExclusions ( dependency . getExclusions ( ) ) ) ;
public class RestApiConfig { /** * Enables provided REST endpoint groups . It doesn ' t replace already enabled groups . */ public RestApiConfig enableGroups ( RestEndpointGroup ... endpointGroups ) { } }
if ( endpointGroups != null ) { enabledGroups . addAll ( Arrays . asList ( endpointGroups ) ) ; } return this ;
public class SeaGlassRootPaneUI { /** * Invokes supers implementation of < code > installUI < / code > to install the * necessary state onto the passed in < code > JRootPane < / code > to render the * metal look and feel implementation of < code > RootPaneUI < / code > . If the * < code > windowDecorationStyle < ...
super . installUI ( c ) ; root = ( JRootPane ) c ; updateTextured ( ) ; int style = root . getWindowDecorationStyle ( ) ; Container parent = root . getParent ( ) ; if ( parent != null && ( parent instanceof JFrame || parent instanceof JDialog ) && style != JRootPane . NONE ) { installClientDecorations ( root ) ; }
public class CommerceDiscountPersistenceImpl { /** * Returns the first commerce discount in the ordered set where groupId = & # 63 ; . * @ param groupId the group ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the first matching commerce discou...
CommerceDiscount commerceDiscount = fetchByGroupId_First ( groupId , orderByComparator ) ; if ( commerceDiscount != null ) { return commerceDiscount ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "groupId=" ) ; msg . append ( groupId ) ; msg . append ( "}" )...
public class TextMateGenerator2 { /** * Generate the rules for the punctuation symbols . * @ param punctuation the punctuation symbols . * @ return the rules . */ protected List < Map < String , ? > > generatePunctuation ( Set < String > punctuation ) { } }
final List < Map < String , ? > > list = new ArrayList < > ( ) ; if ( ! punctuation . isEmpty ( ) ) { list . add ( pattern ( it -> { it . matches ( orRegex ( punctuation ) ) ; it . style ( PUNCTUATION_STYLE ) ; it . comment ( "Operators and Punctuations" ) ; // $ NON - NLS - 1 $ } ) ) ; } return list ;
public class LdapConfigManager { /** * public List < String > getRDNProperties ( String qualifiedEntityType , Map < String , Object > configProps , Set < String > pids , ConfigurationAdmin configAdmin ) { * / / TODO : : Extract Ldap Entity RDN * return null ; */ private void setGroupSearchScope ( Map < String , Obj...
if ( configProps . get ( "recursiveSearch" ) != null && configProps . get ( "recursiveSearch" ) instanceof Boolean ) iRecursiveSearch = ( Boolean ) configProps . get ( "recursiveSearch" ) ;
public class StyleHelper { /** * called from { @ link BaseReportGenerator } * @ param stylerFactory */ @ Override public void setStylerFactory ( StylerFactory stylerFactory ) { } }
this . stylerFactory = stylerFactory ; try { FONT . initialize ( stylerFactory . getSettings ( ) ) ; } catch ( NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException ex ) { throw new VectorPrintRuntimeException ( ex ) ; }
public class MemorySegmentFactory { /** * Allocates some unpooled off - heap memory and creates a new memory segment that * represents that memory . * @ param size The size of the off - heap memory segment to allocate . * @ param owner The owner to associate with the off - heap memory segment . * @ return A new...
ByteBuffer memory = ByteBuffer . allocateDirect ( size ) ; return wrapPooledOffHeapMemory ( memory , owner ) ;
public class NetworkUtils { /** * 获取当前网络类型 * @ return 返回网络类型 */ public static NetworkType getNetworkType ( Context context ) { } }
ConnectivityManager cm = ( ConnectivityManager ) context . getSystemService ( Context . CONNECTIVITY_SERVICE ) ; final NetworkInfo info = cm . getActiveNetworkInfo ( ) ; if ( info == null || ! info . isConnectedOrConnecting ( ) ) { return NetworkType . NONE ; } int type = info . getType ( ) ; if ( ConnectivityManager ....
public class ThreadCacheContext { public static Map < String , Object > getReadOnlyCacheMap ( ) { } }
// for framework if ( ! exists ( ) ) { return DfCollectionUtil . emptyMap ( ) ; } return Collections . unmodifiableMap ( threadLocal . get ( ) ) ;
public class LRUCache { /** * Put . * @ param key the key * @ param value the value */ public void put ( final K key , final V value ) { } }
if ( map . containsKey ( key ) ) { // remove the key from the FIFO queue queue . remove ( key ) ; } while ( queue . size ( ) >= maxSize ) { K oldestKey = queue . poll ( ) ; if ( null != oldestKey ) { if ( listener != null ) { listener . onRemove ( map . remove ( oldestKey ) ) ; } else { map . remove ( oldestKey ) ; } }...
public class LambdaToMethod { /** * Signature Generation */ private String typeSig ( Type type ) { } }
L2MSignatureGenerator sg = new L2MSignatureGenerator ( ) ; sg . assembleSig ( type ) ; return sg . toString ( ) ;
public class Facebook { /** * Restore the token , expiration time , and last update time from cached values . * These should be values obtained from getAccessToken ( ) , getAccessExpires , and * getLastAccessUpdate ( ) respectively . * This method is deprecated . See { @ link Facebook } and { @ link Session } for...
checkUserSession ( "setTokenFromCache" ) ; synchronized ( this . lock ) { this . accessToken = accessToken ; accessExpiresMillisecondsAfterEpoch = accessExpires ; lastAccessUpdateMillisecondsAfterEpoch = lastAccessUpdate ; }
public class Event { /** * getter for causes _ protein - gets * @ generated * @ return value of the feature */ public FSArray getCauses_protein ( ) { } }
if ( Event_Type . featOkTst && ( ( Event_Type ) jcasType ) . casFeat_causes_protein == null ) jcasType . jcas . throwFeatMissing ( "causes_protein" , "ch.epfl.bbp.uima.genia.Event" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Event_Type ) jcasType ) . cas...
public class ns_config_diff { /** * < pre > * Use this operation to get config diff between source and target configuration files in the tabular format in bulk . * < / pre > */ public static ns_config_diff [ ] diff_table ( nitro_service client , ns_config_diff [ ] resources ) throws Exception { } }
if ( resources == null ) throw new Exception ( "Null resource array" ) ; if ( resources . length == 1 ) return ( ( ns_config_diff [ ] ) resources [ 0 ] . perform_operation ( client , "diff_table" ) ) ; return ( ( ns_config_diff [ ] ) perform_operation_bulk_request ( client , resources , "diff_table" ) ) ;