signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class NginxStubStatusParser { /** * Parse NGINX stub status into StatusData & lt ; NginxMetrics & gt ; . * @ param nginxStatus retrieved stub status . * @ return parsed metrics , put into StatusData . */ public StatusData < NginxMetrics > parse ( String nginxStatus ) { } }
StatusData < NginxMetrics > status = new StatusData < > ( ) ; if ( StringUtils . isEmpty ( nginxStatus ) ) { throw new IllegalArgumentException ( "nginx status is empty!" ) ; } else { Matcher matcher = pattern . matcher ( nginxStatus ) ; if ( matcher . matches ( ) ) { status . put ( NginxMetrics . ACTIVE , Long . parse...
public class AbstractDiscretePartitionRefiner { /** * Setup the group and refiner ; it is important to call this method before * calling { @ link # refine } otherwise the refinement process will fail . * @ param group a group ( possibly empty ) of automorphisms * @ param refiner the equitable refiner */ public vo...
this . bestExist = false ; this . best = null ; this . group = group ; this . equitableRefiner = refiner ;
public class JsonServiceDocumentWriter { /** * Build an embedded json object that will have key - value attributes like * ' name ' and ' url ' ( they are MUST ) , ' title ' and ' kind ' . * @ param jsonGenerator jsonGenerator * @ param entity entitySet or singleton * @ throws IOException */ private void writeOb...
jsonGenerator . writeStartObject ( ) ; writeName ( jsonGenerator , entity ) ; writeKind ( jsonGenerator , entity ) ; writeURL ( jsonGenerator , entity ) ; jsonGenerator . writeEndObject ( ) ;
public class DescribeAnalysisSchemesRequest { /** * The analysis schemes you want to describe . * @ param analysisSchemeNames * The analysis schemes you want to describe . */ public void setAnalysisSchemeNames ( java . util . Collection < String > analysisSchemeNames ) { } }
if ( analysisSchemeNames == null ) { this . analysisSchemeNames = null ; return ; } this . analysisSchemeNames = new com . amazonaws . internal . SdkInternalList < String > ( analysisSchemeNames ) ;
public class ClassNode { /** * Specify the class represented by this ` ClassNode ` implements * an interface specified by the given name * @ param name the name of the interface class * @ return this ` ClassNode ` instance */ public ClassNode addInterface ( String name ) { } }
ClassNode intf = infoBase . node ( name ) ; addInterface ( intf ) ; return this ;
public class DescribeConditionalForwardersRequest { /** * The fully qualified domain names ( FQDN ) of the remote domains for which to get the list of associated conditional * forwarders . If this member is null , all conditional forwarders are returned . * @ return The fully qualified domain names ( FQDN ) of the ...
if ( remoteDomainNames == null ) { remoteDomainNames = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return remoteDomainNames ;
public class TreeHashGenerator { /** * Calculates a hex encoded binary hash using a tree hashing algorithm for * the data in the specified file . * @ param file * The file containing the data to hash . * @ return The hex encoded binary tree hash for the data in the specified * file . * @ throws AmazonClient...
ResettableInputStream is = null ; try { is = new ResettableInputStream ( file ) ; return calculateTreeHash ( is ) ; } catch ( IOException e ) { throw new AmazonClientException ( "Unable to compute hash for file: " + file . getAbsolutePath ( ) , e ) ; } finally { if ( is != null ) is . release ( ) ; }
public class CryptoFileSystemProvider { /** * Typesafe alternative to { @ link FileSystems # newFileSystem ( URI , Map ) } . Default way to retrieve a CryptoFS instance . * @ param pathToVault Path to this vault ' s storage location * @ param properties Parameters used during initialization of the file system * @...
URI uri = CryptoFileSystemUri . create ( pathToVault . toAbsolutePath ( ) ) ; return ( CryptoFileSystem ) FileSystems . newFileSystem ( uri , properties ) ;
public class CommonOps_ZDRM { /** * Extracts the diagonal elements ' src ' write it to the ' dst ' vector . ' dst ' * can either be a row or column vector . * @ param src Matrix whose diagonal elements are being extracted . Not modified . * @ param dst A vector the results will be written into . Modified . */ pub...
int N = Math . min ( src . numRows , src . numCols ) ; // reshape if it ' s not the right size if ( ! MatrixFeatures_ZDRM . isVector ( dst ) || dst . numCols * dst . numCols != N ) { dst . reshape ( N , 1 ) ; } for ( int i = 0 ; i < N ; i ++ ) { int index = src . getIndex ( i , i ) ; dst . data [ i * 2 ] = src . data [...
public class ClassUtils { /** * Extracts the package name from the given class object */ public static String getPackage ( Class < ? > cls ) { } }
// cls . getPackage ( ) sometimes returns null , in which case fall back to string massaging . java . lang . Package pkg = cls . isArray ( ) ? cls . getComponentType ( ) . getPackage ( ) : cls . getPackage ( ) ; if ( pkg == null ) { int dotPos ; int dolPos = cls . getName ( ) . indexOf ( '$' ) ; if ( dolPos > 0 ) { // ...
public class TreeWitnessRewriter { /** * rewrites a given connected CQ with the rules put into output */ private Collection < CQIE > rewriteCC ( QueryConnectedComponent cc , Function headAtom , Multimap < Predicate , CQIE > edgeDP ) { } }
List < CQIE > outputRules = new LinkedList < > ( ) ; TreeWitnessSet tws = TreeWitnessSet . getTreeWitnesses ( cc , reasoner , generators , immutabilityTools ) ; if ( cc . hasNoFreeTerms ( ) ) { if ( ! cc . isDegenerate ( ) || cc . getLoop ( ) != null ) for ( Function a : getAtomsForGenerators ( tws . getGeneratorsOfDet...
public class XcodeProjectWriter { /** * Create PBXProject . * @ param buildConfigurationList * build configuration list . * @ param mainGroup * main group . * @ param projectDirPath * project directory path . * @ param targets * targets . * @ param projectRoot * projectRoot directory relative to *...
final Map map = new HashMap ( ) ; map . put ( "isa" , "PBXProject" ) ; map . put ( "buildConfigurationList" , buildConfigurationList . getID ( ) ) ; map . put ( "hasScannedForEncodings" , "0" ) ; map . put ( "mainGroup" , mainGroup . getID ( ) ) ; map . put ( "projectDirPath" , projectDirPath ) ; map . put ( "targets" ...
public class PPatternAssistantTC { /** * Get a set of definitions for the pattern ' s variables . Note that if the pattern includes duplicate variable names , * these are collapse into one . * @ param rp * @ param ptype * @ param scope * @ return */ public List < PDefinition > getDefinitions ( PPattern rp , P...
PDefinitionSet set = af . createPDefinitionSet ( ) ; set . addAll ( af . createPPatternAssistant ( ) . getAllDefinitions ( rp , ptype , scope ) ) ; List < PDefinition > result = new Vector < PDefinition > ( set ) ; return result ;
public class Stream { /** * Returns { @ code Stream } with elements that does not satisfy the given predicate . * < p > This is an intermediate operation . * @ param predicate the predicate used to filter elements * @ return the new stream */ @ NotNull public Stream < T > filterNot ( @ NotNull final Predicate < ?...
return filter ( Predicate . Util . negate ( predicate ) ) ;
public class ApiOvhCaasregistry { /** * Update image * REST : PUT / caas / registry / { serviceName } / namespaces / { namespaceId } / images / { imageId } * @ param body [ required ] A container image * @ param imageId [ required ] Image id * @ param namespaceId [ required ] Namespace id * @ param serviceNam...
String qPath = "/caas/registry/{serviceName}/namespaces/{namespaceId}/images/{imageId}" ; StringBuilder sb = path ( qPath , serviceName , namespaceId , imageId ) ; String resp = exec ( qPath , "PUT" , sb . toString ( ) , body ) ; return convertTo ( resp , OvhImage . class ) ;
public class NetworkUtil { /** * Only use the given interface on the given network interface if it is up and supports multicast */ private static boolean useInetAddress ( NetworkInterface networkInterface , InetAddress interfaceAddress ) { } }
return checkMethod ( networkInterface , isUp ) && checkMethod ( networkInterface , supportsMulticast ) && // TODO : IpV6 support ! ( interfaceAddress instanceof Inet6Address ) && ! interfaceAddress . isLoopbackAddress ( ) ;
public class WriterHandler { /** * Initialize the log . */ @ PostConstruct public void init ( ) throws ConfigException { } }
try { _pathLog . init ( ) ; super . init ( ) ; // WriteBuffer os = _ pathLog . getRotateStream ( ) . getStream ( ) ; /* if ( _ timestamp ! = null ) { _ timestampFilter = new TimestampFilter ( ) ; _ timestampFilter . setTimestamp ( _ timestamp ) ; */ /* String encoding = System . getProperty ( " file . encoding " ) ...
public class DocumentTemplateRepository { /** * Returns all templates for a type , ordered by application tenancy and date desc . */ @ Programmatic public List < DocumentTemplate > findByType ( final DocumentType documentType ) { } }
return repositoryService . allMatches ( new QueryDefault < > ( DocumentTemplate . class , "findByType" , "type" , documentType ) ) ;
public class Helper { /** * Gets or creates a web resource to the ANNIS service . * This is a convenience wrapper to { @ link # getAnnisWebResource ( java . lang . String , annis . security . AnnisUser ) * that does not need any arguments * @ return A reference to the ANNIS service root resource . */ public stati...
VaadinSession vSession = VaadinSession . getCurrent ( ) ; // get URI used by the application String uri = null ; if ( vSession != null ) { uri = ( String ) VaadinSession . getCurrent ( ) . getAttribute ( KEY_WEB_SERVICE_URL ) ; } // if already authentificated the REST client is set as the " user " property AnnisUser us...
public class GridGenerator { /** * Method transforms the grid to an array . */ public double [ ] gridToGridArray ( double [ ] [ ] [ ] grid ) { } }
if ( grid == null ) { grid = this . grid ; } gridArray = new double [ dim [ 0 ] * dim [ 1 ] * dim [ 2 ] + 3 ] ; int dimCounter = 0 ; for ( int z = 0 ; z < grid [ 0 ] [ 0 ] . length ; z ++ ) { for ( int y = 0 ; y < grid [ 0 ] . length ; y ++ ) { for ( int x = 0 ; x < grid . length ; x ++ ) { gridArray [ dimCounter ] = g...
public class AuthResolver { /** * Get an AuthProvider that can handle a given strategy and connection name , or null if there are no * providers to handle them . * @ param strategy to handle * @ param connection to handle * @ return an AuthProvider to handle the authentication or null if no providers are availa...
if ( authHandlers == null ) { return null ; } AuthProvider provider = null ; for ( AuthHandler p : authHandlers ) { provider = p . providerFor ( strategy , connection ) ; if ( provider != null ) { break ; } } return provider ;
public class Encoding { /** * Construct an Encoding for a given database encoding . * @ param databaseEncoding the name of the database encoding * @ return an Encoding instance for the specified encoding , or an Encoding instance for the * default JVM encoding if the specified encoding is unavailable . */ public ...
if ( "UTF8" . equals ( databaseEncoding ) ) { return UTF8_ENCODING ; } // If the backend encoding is known and there is a suitable // encoding in the JVM we use that . Otherwise we fall back // to the default encoding of the JVM . String [ ] candidates = encodings . get ( databaseEncoding ) ; if ( candidates != null ) ...
public class WebApplicationContext { public void writeExternal ( java . io . ObjectOutput out ) throws java . io . IOException { } }
out . writeObject ( getContextPath ( ) ) ; out . writeObject ( getVirtualHosts ( ) ) ; HttpHandler [ ] handlers = getHandlers ( ) ; for ( int i = 0 ; i < handlers . length ; i ++ ) { if ( handlers [ i ] instanceof WebApplicationHandler ) break ; out . writeObject ( handlers [ i ] ) ; } out . writeObject ( getAttributes...
public class CommonExpectations { /** * Sets expectations that will check : * < ol > * < li > The provided WebClient contains a cookie with the default JWT SSO cookie name , its value is a JWT , is NOT marked secure , and is marked HttpOnly * < / ol > */ public static Expectations jwtCookieExists ( String testAct...
Expectations expectations = new Expectations ( ) ; expectations . addExpectation ( new CookieExpectation ( testAction , webClient , jwtCookieName , JwtFatConstants . JWT_REGEX , JwtFatConstants . NOT_SECURE , JwtFatConstants . HTTPONLY ) ) ; return expectations ;
public class ServiceRegistryMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ServiceRegistry serviceRegistry , ProtocolMarshaller protocolMarshaller ) { } }
if ( serviceRegistry == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( serviceRegistry . getRegistryArn ( ) , REGISTRYARN_BINDING ) ; protocolMarshaller . marshall ( serviceRegistry . getPort ( ) , PORT_BINDING ) ; protocolMarshaller . mars...
public class JsMainImpl { /** * Start a messaging engine * @ param busName * @ param name */ public void startMessagingEngine ( String busName , String name ) throws Exception { } }
String thisMethodName = CLASS_NAME + ".startMessagingEngine(String, String)" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , new Object [ ] { busName , name } ) ; } BaseMessagingEngineImpl me = ( BaseMessagingEngineImpl ) getMessagingEngine ( busName ...
public class KAFDocument { /** * Creates an Entity object to load an existing entity . It receives the ID as an argument . The entity is added to the document object . * @ param id the ID of the named entity . * @ param type entity type . 8 values are posible : Person , Organization , Location , Date , Time , Money...
idManager . updateCounter ( AnnotationType . ENTITY , id ) ; Entity newEntity = new Entity ( id , references ) ; annotationContainer . add ( newEntity , Layer . ENTITIES , AnnotationType . ENTITY ) ; return newEntity ;
public class SeleniumSpec { /** * Takes the content of a webElement and stores it in the thread environment variable passed as parameter * @ param index position of the element in the array of webElements found * @ param envVar name of the thread environment variable where to store the text */ @ Then ( "^I save con...
assertThat ( this . commonspec , commonspec . getPreviousWebElements ( ) ) . as ( "There are less found elements than required" ) . hasAtLeast ( index ) ; String text = commonspec . getPreviousWebElements ( ) . getPreviousWebElements ( ) . get ( index ) . getText ( ) ; ThreadProperty . set ( envVar , text ) ;
public class Constraints { /** * Returns a ConditionalPropertyConstraint : one property will trigger the * validation of another . * @ see ConditionalPropertyConstraint */ public PropertyConstraint ifTrue ( PropertyConstraint ifConstraint , PropertyConstraint [ ] thenConstraints ) { } }
return new ConditionalPropertyConstraint ( ifConstraint , new CompoundPropertyConstraint ( new And ( thenConstraints ) ) ) ;
public class SSLWriteServiceContext { /** * @ see com . ibm . wsspi . tcpchannel . TCPWriteRequestContext # write ( long , com . ibm . wsspi . tcpchannel . TCPWriteCompletedCallback , boolean , int ) */ @ Override public VirtualConnection write ( long numBytes , TCPWriteCompletedCallback userCallback , boolean forceQue...
return write ( numBytes , userCallback , forceQueue , timeout , false ) ;
public class TraceEventHelper { /** * ToC : Connection listeners * @ param data The data * @ return The events * @ exception Exception If an error occurs */ public static Map < String , List < TraceEvent > > tocConnectionListeners ( List < TraceEvent > data ) throws Exception { } }
Map < String , List < TraceEvent > > result = new TreeMap < String , List < TraceEvent > > ( ) ; for ( TraceEvent te : data ) { if ( te . getType ( ) == TraceEvent . GET_CONNECTION_LISTENER || te . getType ( ) == TraceEvent . GET_CONNECTION_LISTENER_NEW || te . getType ( ) == TraceEvent . GET_INTERLEAVING_CONNECTION_LI...
public class StatementExecutor { /** * Return a raw row mapper suitable for use with { @ link Dao # queryRaw ( String , RawRowMapper , String . . . ) } . */ public RawRowMapper < T > getRawRowMapper ( ) { } }
if ( rawRowMapper == null ) { rawRowMapper = new RawRowMapperImpl < T , ID > ( dao ) ; } return rawRowMapper ;
public class ContextFromVertx { /** * Get the path parameter for the given key . * The parameter will be decoded based on the RFCs . * Check out http : / / docs . oracle . com / javase / 6 / docs / api / java / net / URI . html for * more information . * @ param name The name of the path parameter in a route . ...
String encodedParameter = route . getPathParametersEncoded ( path ( ) ) . get ( name ) ; if ( encodedParameter == null ) { return null ; } else { // #514 - If the encoded parameter contains : it should be encoded manually . // Some library don ' t meaning that the URI creation fails as : is not allowed . if ( encodedPa...
public class EncryptionUtil { /** * Reads the given resource as a string . * @ param resourceName * The name of the resource to read . * @ return The content of the resource as a string . * @ throws IOException * When it was not possible to read the resource . */ private String readResource ( final String res...
return new BufferedReader ( new InputStreamReader ( getClass ( ) . getResourceAsStream ( resourceName ) , DEFAULT_CHARSET ) ) . lines ( ) . collect ( Collectors . joining ( "\n" ) ) ;
public class LongTuples { /** * Creates a new tuple that is a < i > view < / i > * on the specified portion of the given parent . Changes in the * parent will be visible in the returned tuple . * @ param parent The parent tuple * @ param fromIndex The start index in the parent , inclusive * @ param toIndex Th...
return new SubLongTuple ( parent , fromIndex , toIndex ) ;
public class ResultSetDataModel { /** * < p > Return < code > true < / code > if there is < code > wrappedData < / code > * available , and the result of calling < code > absolute ( ) < / code > on the * underlying < code > ResultSet < / code > , passing the current value of * < code > rowIndex < / code > plus on...
if ( resultSet == null ) { return ( false ) ; } else if ( index < 0 ) { return ( false ) ; } try { if ( resultSet . absolute ( index + 1 ) ) { return ( true ) ; } else { return ( false ) ; } } catch ( SQLException e ) { throw new FacesException ( e ) ; }
public class ParentFinder { /** * { @ inheritDoc } */ @ Override public Collection < String > findBySurnamesBeginWith ( final FinderObject owner , final String beginsWith ) { } }
return owner . findInParentBySurnamesBeginWith ( beginsWith ) ;
public class BigRational { /** * Calculates the addition ( + ) of this rational number and the specified argument . * < p > The result has no loss of precision . < / p > * @ param value the rational number to add * @ return the resulting rational number */ public BigRational add ( BigRational value ) { } }
if ( denominator . equals ( value . denominator ) ) { return of ( numerator . add ( value . numerator ) , denominator ) ; } BigDecimal n = numerator . multiply ( value . denominator ) . add ( value . numerator . multiply ( denominator ) ) ; BigDecimal d = denominator . multiply ( value . denominator ) ; return of ( n ,...
public class BeanMapping { /** * 読み込み用の { @ link CellProcessor } を取得する 。 * @ return カラムの位置順に整列されている { @ link CellProcessor } の一覧 。 */ public CellProcessor [ ] getCellProcessorsForReading ( ) { } }
return columns . stream ( ) . map ( c -> c . getCellProcessorForReading ( ) ) . toArray ( n -> new CellProcessor [ n ] ) ;
public class DefaultWebApplicationFactory { /** * < p > register . < / p > */ public void register ( ) { } }
if ( registration != null ) { throw new IllegalStateException ( "Webapplication is already registered." ) ; } validateNotNull ( applicationName , "applicationName" ) ; validateNotNull ( mountPoint , "mountPoint" ) ; Hashtable < String , Object > props = new Hashtable < String , Object > ( ) ; props . put ( Constants . ...
public class CSSUnits { /** * Converts the font size given by an identifier to absolute length in pixels . * @ param parent Parent font size ( taken as 1em ) * @ param value The size specification to be converted * @ return absolute font size in px */ public static double convertFontSize ( double parent , CSSProp...
double em = parent ; double ret = em ; if ( value == CSSProperty . FontSize . MEDIUM ) ret = medium_font ; else if ( value == CSSProperty . FontSize . SMALL ) ret = medium_font / font_step ; else if ( value == CSSProperty . FontSize . X_SMALL ) ret = medium_font / font_step / font_step ; else if ( value == CSSProperty ...
public class BitsUtil { /** * Creates a new BitSet of fixed cardinality with randomly set bits . * @ param card the cardinality of the BitSet to create * @ param capacity the capacity of the BitSet to create - the randomly * generated indices of the bits set to true will be uniformly * distributed between 0 ( i...
if ( card < 0 || card > capacity ) { throw new IllegalArgumentException ( "Cannot set " + card + " out of " + capacity + " bits." ) ; } // FIXME : Avoid recomputing the cardinality . if ( card < capacity >>> 1 ) { long [ ] bitset = BitsUtil . zero ( capacity ) ; for ( int todo = card ; todo > 0 ; todo = ( todo == 1 ) ?...
public class ReflectionMbean { /** * Find attribute methods from our object that will be exposed via JMX . */ private void discoverAttributeFields ( Map < String , JmxAttributeFieldInfo > attributeFieldInfoMap , Set < String > attributeNameSet , List < MBeanAttributeInfo > attributes ) { } }
for ( Class < ? > clazz = target . getClass ( ) ; clazz != Object . class ; clazz = clazz . getSuperclass ( ) ) { discoverAttributeFields ( attributeFieldInfoMap , attributeNameSet , attributes , clazz ) ; }
public class AnnotationsUtil { /** * Small utility to easily get an annotation and will throw an exception if not provided . * @ param annotatedType The source type to tcheck the annotation on * @ param annotationClass The annotation to look for * @ param < T > The annotation subtype * @ return The annotation t...
return getAnnotation ( annotatedType , annotationClass , null ) ;
public class CreateLocationNfsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CreateLocationNfsRequest createLocationNfsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( createLocationNfsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createLocationNfsRequest . getSubdirectory ( ) , SUBDIRECTORY_BINDING ) ; protocolMarshaller . marshall ( createLocationNfsRequest . getServerHostname ( ) , SER...
public class VortexFuture { /** * Called by VortexMaster to let the user know that the Tasklet completed . */ @ Private @ Override public void completed ( final int pTaskletId , final TOutput result ) { } }
assert taskletId == pTaskletId ; this . userResult = Optional . ofNullable ( result ) ; if ( callbackHandler != null ) { executor . execute ( new Runnable ( ) { @ Override public void run ( ) { callbackHandler . onSuccess ( userResult . get ( ) ) ; } } ) ; } this . countDownLatch . countDown ( ) ;
public class AlertsEngineCache { /** * Register a new DataEntry ( triggerId , conditionId , dataId ) * @ param dataEntry to register on this node */ public void add ( DataEntry dataEntry ) { } }
activeDataEntries . add ( dataEntry ) ; DataId newDataId = new DataId ( dataEntry . getTenantId ( ) , dataEntry . getDataId ( ) ) ; if ( ! activeDataIds . contains ( newDataId ) ) { activeDataIds . add ( newDataId ) ; }
public class MetaModelBuilder { /** * On declared fields . * @ param < X > * the generic type * @ param clazz * the clazz * @ param managedType * the managed type */ private < X > void onDeclaredFields ( Class < X > clazz , AbstractManagedType < X > managedType ) { } }
Field [ ] embeddedFields = clazz . getDeclaredFields ( ) ; for ( Field f : embeddedFields ) { if ( isNonTransient ( f ) ) { new TypeBuilder < T > ( f ) . build ( managedType , f . getType ( ) ) ; } }
public class AntClassLoader { /** * Sets the current thread ' s context loader to this classloader , storing * the current loader value for later resetting . */ public void setThreadContextLoader ( ) { } }
if ( isContextLoaderSaved ) { throw new BuildException ( "Context loader has not been reset" ) ; } if ( LoaderUtils . isContextLoaderAvailable ( ) ) { savedContextLoader = LoaderUtils . getContextClassLoader ( ) ; ClassLoader loader = this ; if ( project != null && "only" . equals ( project . getProperty ( "build.syscl...
public class Optional { /** * Apply a predicate to the optional , if the optional is present , and the predicate is true , return the optional , otherwise * return empty . * @ param predicate the predicate to apply * @ return the optional if the predicate is true , empty if not * @ since 1.7 */ public Optional ...
if ( isPresent ( ) && predicate . test ( get ( ) ) ) { return this ; } return empty ( ) ;
public class ManagedBeanDestroyer { /** * Listens to PreDestroyCustomScopeEvent and PreDestroyViewMapEvent * and invokes destroy ( ) for every managed bean in the associated scope . */ public void processEvent ( SystemEvent event ) { } }
Map < String , Object > scope = null ; if ( event instanceof PreDestroyViewMapEvent ) { UIViewRoot viewRoot = ( UIViewRoot ) ( ( PreDestroyViewMapEvent ) event ) . getComponent ( ) ; scope = viewRoot . getViewMap ( false ) ; if ( scope == null ) { // view map does not exist - - > nothing to destroy return ; } } else if...
public class StandardAccessManager { /** * Cleans up expired sessions . * @ param officialTime */ public void onPageEvent ( long officialTime ) { } }
// cleanup expired sessions ArrayList garbage = new ArrayList ( sessionsMirror . size ( ) ) ; Iterator i ; StandardSession session ; synchronized ( sessionsMirror ) { i = sessionsMirror . values ( ) . iterator ( ) ; while ( i . hasNext ( ) ) { session = ( StandardSession ) i . next ( ) ; if ( session . isExpired ( ) ) ...
public class DriverFactory { /** * Sets the target browser binary path in chromeOptions if it exists in configuration . * @ param capabilities * The global DesiredCapabilities */ private void setChromeOptions ( final DesiredCapabilities capabilities , ChromeOptions chromeOptions ) { } }
// Set custom downloaded file path . When you check content of downloaded file by robot . final HashMap < String , Object > chromePrefs = new HashMap < > ( ) ; chromePrefs . put ( "download.default_directory" , System . getProperty ( USER_DIR ) + File . separator + DOWNLOADED_FILES_FOLDER ) ; chromeOptions . setExperim...
public class GeoBBoxCondition { /** * { @ inheritDoc } */ @ Override public Query doQuery ( SpatialStrategy strategy ) { } }
Rectangle rectangle = CONTEXT . makeRectangle ( minLongitude , maxLongitude , minLatitude , maxLatitude ) ; SpatialArgs args = new SpatialArgs ( SpatialOperation . Intersects , rectangle ) ; return strategy . makeQuery ( args ) ;
public class ConfigUtils { /** * Method is used to return an enum value from a given string . * @ param enumClass Class for the resulting enum value * @ param config config to read the value from * @ param key key for the value * @ param < T > Enum class to return type for . * @ return enum value for the give...
Preconditions . checkNotNull ( enumClass , "enumClass cannot be null" ) ; Preconditions . checkState ( enumClass . isEnum ( ) , "enumClass must be an enum." ) ; String textValue = config . getString ( key ) ; return Enum . valueOf ( enumClass , textValue ) ;
public class FixBondOrdersTool { /** * Gets the List of bond nos corresponding to a particular set of fused rings . * @ param { @ link IAtomContainer } molecule * @ param ringGroup * @ param { @ link IRingSet } ringSet * @ return List of bond numbers for each set */ private List < Integer > getBondNosForRingGro...
List < Integer > btc = new ArrayList < Integer > ( ) ; for ( Integer i : ringGroup ) { for ( IBond bond : ringSet . getAtomContainer ( i ) . bonds ( ) ) { if ( btc . size ( ) > 0 ) { if ( ! btc . contains ( molecule . indexOf ( bond ) ) ) { btc . add ( molecule . indexOf ( bond ) ) ; } } else { btc . add ( molecule . i...
public class SimpleClassLoadHelper { /** * Enable sharing of the class - loader with 3rd party . * @ return the class - loader user be the helper . */ public ClassLoader getClassLoader ( ) { } }
// To follow the same behavior of Class . forName ( . . . ) I had to play // dirty ( Supported by Sun , IBM & BEA JVMs ) try { // Get a reference to this class ' class - loader final ClassLoader cl = getClass ( ) . getClassLoader ( ) ; // Create a method instance representing the protected // getCallerClassLoader metho...
public class HttpParser { /** * / * Quick lookahead for the start state looking for a request method or a HTTP version , * otherwise skip white space until something else to parse . */ private boolean quickStart ( ByteBuffer buffer ) { } }
if ( _requestHandler != null ) { _method = HttpMethod . lookAheadGet ( buffer ) ; if ( _method != null ) { _methodString = _method . asString ( ) ; buffer . position ( buffer . position ( ) + _methodString . length ( ) + 1 ) ; setState ( State . SPACE1 ) ; return false ; } } else if ( _responseHandler != null ) { _vers...
public class Client { /** * Send batch request to the LFS - server . * @ param batchReq Batch request . * @ return Object metadata . * @ throws IOException */ @ NotNull public BatchRes postBatch ( @ NotNull final BatchReq batchReq ) throws IOException { } }
return doWork ( auth -> doRequest ( auth , new JsonPost < > ( batchReq , BatchRes . class ) , AuthHelper . join ( auth . getHref ( ) , PATH_BATCH ) ) , batchReq . getOperation ( ) ) ;
public class ELCSSBundleTag { /** * ( non - Javadoc ) * @ see javax . servlet . jsp . tagext . TagSupport # release ( ) */ @ Override public void release ( ) { } }
super . release ( ) ; setSrcExpr ( null ) ; setUseRandomParamExpr ( null ) ; setMediaExpr ( null ) ; setTitleExpr ( null ) ; setAlternateExpr ( null ) ; setDisplayAlternateExpr ( null ) ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcPropertyEnumeratedValue ( ) { } }
if ( ifcPropertyEnumeratedValueEClass == null ) { ifcPropertyEnumeratedValueEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 469 ) ; } return ifcPropertyEnumeratedValueEClass ;
public class AmazonAutoScalingClient { /** * Describes the notification actions associated with the specified Auto Scaling group . * @ param describeNotificationConfigurationsRequest * @ return Result of the DescribeNotificationConfigurations operation returned by the service . * @ throws InvalidNextTokenExceptio...
request = beforeClientExecution ( request ) ; return executeDescribeNotificationConfigurations ( request ) ;
public class PeriodFormatter { /** * Prints a ReadablePeriod to a Writer . * @ param out the formatted period is written out * @ param period the period to format , not null */ public void printTo ( Writer out , ReadablePeriod period ) throws IOException { } }
checkPrinter ( ) ; checkPeriod ( period ) ; getPrinter ( ) . printTo ( out , period , iLocale ) ;
public class HolderMBean { protected void defineManagedResource ( ) { } }
super . defineManagedResource ( ) ; defineAttribute ( "name" ) ; defineAttribute ( "displayName" ) ; defineAttribute ( "className" ) ; defineAttribute ( "initParameters" , READ_ONLY , ON_MBEAN ) ; _holder = ( Holder ) getManagedResource ( ) ;
public class WikipediaCleaner { /** * Remove wiki citations of the form " { { cite . . . } } " , which links to some * text or another wikipedia link . * @ param article The article text to clean . */ private void removeDoubleBraceMarkup ( StringBuilder article ) { } }
int braceStart = article . indexOf ( "{{" ) ; // Repeatedly loop while { { } } text still exists in the document while ( braceStart >= 0 ) { // Find the matching closing } } if it exists . Some wikipedia // text is malformated , with no matching brace . so take no // action in this case . int braceEnd = article . index...
public class AbstractJcrNode { /** * Obtain an iterator over the nodes that reference this node . * @ param referenceType specification of the type of references to include ; may not be null * @ return the iterator over the referencing nodes ; never null * @ throws RepositoryException if an error occurs while obt...
if ( ! this . isReferenceable ( ) ) { return JcrEmptyNodeIterator . INSTANCE ; } // Get all of the nodes that are referring to this node . . . Set < NodeKey > keys = node ( ) . getReferrers ( sessionCache ( ) , referenceType ) ; if ( keys . isEmpty ( ) ) return JcrEmptyNodeIterator . INSTANCE ; return new JcrNodeIterat...
public class JstormYarnUtils { /** * Join an array of strings with a separator that appears after every * instance in the list - optionally at the end * @ param collection strings * @ param separator separator string * @ param trailing add a trailing entry or not * @ return the joined entries */ public static...
return join ( Arrays . asList ( collection ) , separator , trailing ) ;
public class GBSTree { /** * Add to predecssor or current . * < ol > * < li > There is no left child . * < li > There might or might not be a right child * < li > INSERT _ KEY < MEDIAN of current node * < li > INSERT _ KEY > MEDIAN of predecessor ( if there is one ) * < / ol > * < p > In the example below...
if ( r == null ) /* There is no upper predecessor */ leftAddNoPredecessor ( p , new1 , ip , point ) ; else /* There is an upper predecessor */ leftAddWithPredecessor ( p , r , new1 , ip , point ) ;
public class DITypeInfo { /** * Retrieves the maximum Long . MAX _ VALUE bounded length , in bytes , for * character types . < p > * @ return the maximum Long . MAX _ VALUE bounded length , in * bytes , for character types */ Long getCharOctLenAct ( ) { } }
switch ( type ) { case Types . SQL_CHAR : case Types . SQL_NCHAR : case Types . SQL_VARCHAR : case Types . SQL_NVARCHAR : return ValuePool . getLong ( 2L * Integer . MAX_VALUE ) ; case Types . SQL_CLOB : case Types . NCLOB : return ValuePool . getLong ( Long . MAX_VALUE ) ; default : return null ; }
public class ByteUtil { /** * increment byte array as a number until max is reached * @ param bytes * byte [ ] * @ return boolean */ public static boolean increment ( byte [ ] bytes ) { } }
final int startIndex = 0 ; int i ; for ( i = bytes . length - 1 ; i >= startIndex ; i -- ) { bytes [ i ] ++ ; if ( bytes [ i ] != 0 ) break ; } // we return false when all bytes are 0 again return ( i >= startIndex || bytes [ startIndex ] != 0 ) ;
public class HashIntSet { /** * documentation inherited from interface IntSet */ public Interator interator ( ) { } }
return new AbstractInterator ( ) { public boolean hasNext ( ) { checkConcurrentModification ( ) ; return _pos < _size ; } public int nextInt ( ) { checkConcurrentModification ( ) ; if ( _pos >= _size ) { throw new NoSuchElementException ( ) ; } if ( _idx == 0 ) { // start after a sentinel . if we don ' t and instead st...
public class ServerStatisticsServlet { /** * Handle all requests to Statistics Servlet { @ inheritDoc } */ @ Override protected void doPost ( final HttpServletRequest req , final HttpServletResponse resp ) throws ServletException , IOException { } }
final boolean noCache = null != req && Boolean . valueOf ( req . getParameter ( noCacheParamName ) ) ; if ( noCache || System . currentTimeMillis ( ) - lastRefreshedTime > cacheTimeInMilliseconds ) { this . populateStatistics ( noCache ) ; } JSONUtils . toJSON ( cachedstats , resp . getOutputStream ( ) , true ) ;
public class ListMath { /** * Raises each value in a list to the same power . * @ param data The list of numbers to raise to a power * @ param expon The power to raise each number in the list to * @ return result [ x ] = data [ x ] * * expon */ public static ListDouble pow ( final ListNumber data , final double e...
return new ListDouble ( ) { @ Override public double getDouble ( int index ) { return Math . pow ( data . getDouble ( index ) , expon ) ; } @ Override public int size ( ) { return data . size ( ) ; } } ;
public class XClaimArgs { /** * This is the same as IDLE but instead of a relative amount of milliseconds , it sets the idle time to a specific unix time * ( in milliseconds ) . This is useful in order to rewrite the AOF file generating XCLAIM commands . * @ param timestamp idle time . * @ return { @ code this } ...
LettuceAssert . notNull ( timestamp , "Timestamp must not be null" ) ; return time ( Instant . from ( timestamp ) . toEpochMilli ( ) ) ;
public class PagingTableModel { /** * Sets the maximum size of the page . * If the given maximum size is greater than the current maximum size a new page will be loaded , otherwise the current page * will be shrunk to meet the given maximum size . In both cases the { @ code TableModelListener } will be notified of ...
if ( maxPageSize <= 0 ) { throw new IllegalArgumentException ( "Parameter maxPageSize must be greater than zero." ) ; } if ( this . maxPageSize == maxPageSize ) { return ; } int oldMaxPageSize = this . maxPageSize ; setMaxPageSizeWithoutPageChanges ( maxPageSize ) ; int rowCount = getRowCount ( ) ; if ( rowCount > 0 ) ...
public class AbstractPersistingLongIDFactory { /** * Note : this implementation must be synchronized because the method calling * this only uses a readLock ! */ public final long getNewID ( ) { } }
return m_aLock . locked ( ( ) -> { if ( m_nID >= m_nLastID ) { // Read new IDs final long nNewID = readAndUpdateIDCounter ( m_nReserveCount ) ; // the existing ID may not be < than the previously used ID ! if ( m_nLastID >= 0 && nNewID < m_nID ) throw new IllegalStateException ( "The read value " + nNewID + " is smalle...
public class ISOBlueDevice { /** * Create a pair of { @ link BufferedISOBUSSocket } s which will receive all * { @ link Message } s stored by ISOBlue coming after the specified one . < br > * One socket will receive engine bus messages and the other will receive * implement bus messages . * @ param fromId * t...
BufferedISOBUSSocket [ ] socks = new BufferedISOBUSSocket [ 2 ] ; Serializable toId ; toId = getStartId ( ) ; // Create socket for past engine messages socks [ 0 ] = new BufferedISOBUSSocket ( fromId , toId , mEngineBus , null , null ) ; // Create socket for past implement messages socks [ 1 ] = new BufferedISOBUSSocke...
public class LoggerRepositoryExImpl { /** * Return this repository ' s own scheduler . * The scheduler is lazily instantiated . * @ return this repository ' s own scheduler . */ public Scheduler getScheduler ( ) { } }
if ( scheduler == null ) { scheduler = new Scheduler ( ) ; scheduler . setDaemon ( true ) ; scheduler . start ( ) ; } return scheduler ;
public class AbstractEngineSync { /** * Returns the last modified time for the cache entry * @ param filename File to look for */ public long lastModified ( final String filename ) { } }
LRUCache . CacheEntry < String , T > cacheEntry = cache . get ( filename ) ; if ( cacheEntry == null ) { return - 1 ; } return cacheEntry . lastModified ;
public class GlobalConfiguration { /** * Loads a YAML - file of key - value pairs . * Colon and whitespace " : " separate key and value ( one per line ) . The hash tag " # " starts a single - line comment . * Example : * < pre > * jobmanager . rpc . address : localhost # network address for communication with t...
BufferedReader reader = null ; try { reader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( file ) ) ) ; String line = null ; while ( ( line = reader . readLine ( ) ) != null ) { // 1 . check for comments String [ ] comments = line . split ( "#" , 2 ) ; String conf = comments [ 0 ] ; // 2 . get key...
public class EntityCachingService { /** * Removes the entity identified by type and key from the cache and notifies peer caches . * @ param type Class * @ param key String * @ exception org . apereo . portal . concurrency . CachingException */ @ Override public void remove ( Class < ? extends IBasicEntity > type ...
EntityCachingServiceLocator . getEntityCachingService ( ) . remove ( type , key ) ;
public class AppServiceCertificateOrdersInner { /** * List all certificates associated with a certificate order . * List all certificates associated with a certificate order . * @ param resourceGroupName Name of the resource group to which the resource belongs . * @ param certificateOrderName Name of the certific...
ServiceResponse < Page < AppServiceCertificateResourceInner > > response = listCertificatesSinglePageAsync ( resourceGroupName , certificateOrderName ) . toBlocking ( ) . single ( ) ; return new PagedList < AppServiceCertificateResourceInner > ( response . body ( ) ) { @ Override public Page < AppServiceCertificateReso...
public class NTLMResponses { /** * Calculates the NTLM Response for the given challenge , using the * specified password . * @ param password The user ' s password . * @ param challenge The Type 2 challenge from the server . * @ return The NTLM Response . */ public static byte [ ] getNTLMResponse ( String passw...
byte [ ] ntlmHash = ntlmHash ( password ) ; return lmResponse ( ntlmHash , challenge ) ;
public class RedisClient { /** * ( non - Javadoc ) * @ see com . impetus . kundera . persistence . api . Batcher # executeBatch ( ) */ @ Override public int executeBatch ( ) { } }
Object connection = getConnection ( ) ; // Create a hashset and populate data into it Pipeline pipeLine = null ; if ( isBoundTransaction ( ) ) { pipeLine = ( ( Jedis ) connection ) . pipelined ( ) ; } try { for ( Node node : nodes ) { if ( node . isDirty ( ) ) { node . handlePreEvent ( ) ; // delete can not be executed...
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link TexturedSurfaceType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link TexturedSurfaceType } { @ co...
return new JAXBElement < TexturedSurfaceType > ( _TexturedSurface_QNAME , TexturedSurfaceType . class , null , value ) ;
public class AbsListViewFragment { /** * The default content for a ListFragment has a TextView that can * be shown when the list is empty . If you would like to have it * shown , call this method to supply the text it should use . */ public void setEmptyText ( CharSequence text ) { } }
ensureList ( ) ; if ( mStandardEmptyView == null ) { throw new IllegalStateException ( "Can't be used with a custom content view" ) ; } mStandardEmptyView . setText ( text ) ; if ( mEmptyText == null ) { mList . setEmptyView ( mStandardEmptyView ) ; } mEmptyText = text ;
public class ProviderInfoWeightManager { /** * Recover weight of provider info , and set default status * @ param providerInfo ProviderInfo * @ param originWeight origin weight */ public static void recoverOriginWeight ( ProviderInfo providerInfo , int originWeight ) { } }
providerInfo . setStatus ( ProviderStatus . AVAILABLE ) ; providerInfo . setWeight ( originWeight ) ;
public class JDesktopPaneLayout { /** * Validate the layout after internal frames have been added * or removed */ public void validate ( ) { } }
Dimension size = desktopPane . getSize ( ) ; size . height -= computeDesktopIconsSpace ( ) ; layoutInternalFrames ( size ) ;
public class SampledRowKeysAdapter { /** * < p > adaptResponse . < / p > * @ param responses a { @ link java . util . List } object . * @ return a { @ link java . util . List } object . */ public List < HRegionLocation > adaptResponse ( List < KeyOffset > responses ) { } }
List < HRegionLocation > regions = new ArrayList < > ( ) ; // Starting by the first possible row , iterate over the sorted sampled row keys and create regions . byte [ ] startKey = HConstants . EMPTY_START_ROW ; for ( KeyOffset response : responses ) { byte [ ] endKey = response . getKey ( ) . toByteArray ( ) ; // Avoi...
public class ConfigRuleComplianceFiltersMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ConfigRuleComplianceFilters configRuleComplianceFilters , ProtocolMarshaller protocolMarshaller ) { } }
if ( configRuleComplianceFilters == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( configRuleComplianceFilters . getConfigRuleName ( ) , CONFIGRULENAME_BINDING ) ; protocolMarshaller . marshall ( configRuleComplianceFilters . getComplianceT...
public class Entry { /** * Returns a newly - created { @ link Entry } of a directory . * @ param revision the revision of the directory * @ param path the path of the directory */ public static Entry < Void > ofDirectory ( Revision revision , String path ) { } }
return new Entry < > ( revision , path , EntryType . DIRECTORY , null ) ;
public class SimpleJob { /** * Easily supports the Join . To use the setSimpleJoin , * you must be a size master data appear in the memory of the task . * @ param masterLabels label of master data * @ param masterColumns master column ' s * @ param dataColumns data column ' s * @ param masterPath master data ...
String separator = conf . get ( SEPARATOR ) ; return setSimpleJoin ( masterLabels , masterColumns , dataColumns , masterPath , separator , false ) ;
public class SessionUtil { /** * Extracts post back url from the HTML returned by the IDP * @ param html * @ return */ static private String getPostBackUrlFromHTML ( String html ) { } }
Document doc = Jsoup . parse ( html ) ; Elements e1 = doc . getElementsByTag ( "body" ) ; Elements e2 = e1 . get ( 0 ) . getElementsByTag ( "form" ) ; String postBackUrl = e2 . first ( ) . attr ( "action" ) ; return postBackUrl ;
public class SignalRsInner { /** * Regenerate SignalR service access key . PrimaryKey and SecondaryKey cannot be regenerated at the same time . * @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal . * @ pa...
if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( resourc...
public class ExpressionsRetinaApiImpl { /** * { @ inheritDoc } */ @ Override public List < List < Term > > getSimilarTermsBulk ( PosType posType , Model ... models ) throws JsonProcessingException , ApiException { } }
return getSimilarTermsBulk ( null , posType , models ) ;
public class CommerceAccountUserRelLocalServiceUtil { /** * Returns a range of all the commerce account user rels . * Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the r...
return getService ( ) . getCommerceAccountUserRels ( start , end ) ;
public class CmsJspStandardContextBean { /** * Initializes the requested container page . < p > * @ throws CmsException in case reading the requested resource fails */ public void initPage ( ) throws CmsException { } }
if ( ( m_page == null ) && ( m_cms != null ) ) { String requestUri = m_cms . getRequestContext ( ) . getUri ( ) ; // get the container page itself , checking the history first CmsResource pageResource = ( CmsResource ) CmsHistoryResourceHandler . getHistoryResource ( m_request ) ; if ( pageResource == null ) { pageReso...
public class VFSUtils { /** * Fix a name ( removes any trailing slash ) * @ param name the name to fix * @ return the fixed name * @ throws IllegalArgumentException for a null name */ public static String fixName ( String name ) { } }
if ( name == null ) { throw MESSAGES . nullArgument ( "name" ) ; } int length = name . length ( ) ; if ( length <= 1 ) { return name ; } if ( name . charAt ( length - 1 ) == '/' ) { return name . substring ( 0 , length - 1 ) ; } return name ;
public class Host2NodesMap { /** * Check if node is already in the map . */ boolean contains ( DatanodeDescriptor node ) { } }
if ( node == null ) { return false ; } String host = node . getHost ( ) ; hostmapLock . readLock ( ) . lock ( ) ; try { DatanodeDescriptor [ ] nodes = map . get ( host ) ; if ( nodes != null ) { for ( DatanodeDescriptor containedNode : nodes ) { if ( node == containedNode ) { return true ; } } } } finally { hostmapLock...
public class Rule { /** * Creates a copy of this Rule with a new instance of the generated rule class if present . * This prevents sharing instances across threads , which is not supported for performance reasons . * Otherwise the generated code would need to be thread safe , adding to the runtime overhead . * In...
final Builder builder = toBuilder ( ) ; final Class < ? extends GeneratedRule > ruleClass = generatedRuleClass ( ) ; if ( ruleClass != null ) { try { // noinspection unchecked final Set < Constructor > constructors = ReflectionUtils . getConstructors ( ruleClass ) ; final Constructor onlyElement = Iterables . getOnlyEl...