signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AuthenticationService { /** * Authenticates a user using the given credentials and optional
* authentication token , returning the authentication token associated with
* the user ' s Guacamole session , which may be newly generated . If an
* existing token is provided , the authentication procedure w... | // Pull existing session if token provided
GuacamoleSession existingSession ; if ( token != null ) existingSession = tokenSessionMap . get ( token ) ; else existingSession = null ; // Get up - to - date AuthenticatedUser and associated UserContexts
AuthenticatedUser authenticatedUser = getAuthenticatedUser ( existingSe... |
public class GetStageResult { /** * A map that defines the stage variables for a < a > Stage < / a > resource . Variable names can have alphanumeric and
* underscore characters , and the values must match < code > [ A - Za - z0-9 - . _ ~ : / ? # & amp ; = , ] + < / code > .
* @ param variables
* A map that define... | setVariables ( variables ) ; return this ; |
public class AuroraProtocol { /** * Connect aurora probable master . Aurora master change in time . The only way to check that a
* server is a master is to asked him .
* @ param listener aurora failover to call back if master is found
* @ param globalInfo server global variables information
* @ param probableMa... | AuroraProtocol protocol = getNewProtocol ( listener . getProxy ( ) , globalInfo , listener . getUrlParser ( ) ) ; try { protocol . setHostAddress ( probableMaster ) ; protocol . connect ( ) ; listener . removeFromBlacklist ( protocol . getHostAddress ( ) ) ; if ( listener . isMasterHostFailReconnect ( ) && protocol . i... |
public class SerializerIntrinsics { /** * ! and pop register stack . */
public final void fstp ( Mem dst ) { } } | assert ( dst . size ( ) == 4 || dst . size ( ) == 8 || dst . size ( ) == 10 ) ; emitX86 ( INST_FSTP , dst ) ; |
public class PeerMessage { /** * Parse the given buffer into a peer protocol message .
* Parses the provided byte array and builds the corresponding PeerMessage
* subclass object .
* @ param buffer The byte buffer containing the message data .
* @ param torrent The torrent this message is about .
* @ return A... | int length = buffer . getInt ( ) ; if ( length == 0 ) { return KeepAliveMessage . parse ( buffer , torrent ) ; } else if ( length != buffer . remaining ( ) ) { throw new ParseException ( "Message size did not match announced " + "size!" , 0 ) ; } Type type = Type . get ( buffer . get ( ) ) ; if ( type == null ) { throw... |
public class CDL { /** * Produce a comma delimited text row from a JSONArray . Values containing
* the comma character will be quoted . Troublesome characters may be
* removed .
* @ param ja A JSONArray of strings .
* @ return A string ending in NEWLINE . */
public static String rowToString ( JSONArray ja ) { }... | StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < ja . length ( ) ; i += 1 ) { if ( i > 0 ) { sb . append ( ',' ) ; } Object object = ja . opt ( i ) ; if ( object != null ) { String string = object . toString ( ) ; if ( string . length ( ) > 0 && ( string . indexOf ( ',' ) >= 0 || string . indexOf ( '\n'... |
public class ContentBasedLocalBundleRepository { /** * This method can be used to obtain the ' base ' bundle for a given ' selected ' bundle .
* The { @ link ContentBasedLocalBundleRepository # selectBundle } Will select a Bundle , which may or
* may not be an ifix .
* When the selectedBundle is an ifix , this me... | readCache ( ) ; return selectResource ( baseLocation , symbolicName , versionRange , true , // performURICheck = true
true // selectBaseBundle = true
) ; |
public class StackTraceFilter { /** * Example how the filter works ( + / - means good / bad ) :
* [ a + , b + , c - , d + , e + , f - , g + ] - > [ a + , b + , d + , e + , g + ]
* Basically removes all bad from the middle .
* < strike > If any good are in the middle of bad those are also removed . < / strike > */... | // TODO : profile
// TODO : investigate " keepTop " commit history - no effect !
final List < StackTraceElement > filtered = new ArrayList < StackTraceElement > ( ) ; for ( StackTraceElement element : target ) { if ( CLEANER . isIn ( element ) ) { filtered . add ( element ) ; } } StackTraceElement [ ] result = new Stac... |
public class ZooKeeperUpdatingListener { /** * Creates a ZooKeeper server listener , which registers server into ZooKeeper .
* < p > If you need a fully customized { @ link ZooKeeperUpdatingListener } instance , use
* { @ link ZooKeeperUpdatingListenerBuilder } instead .
* @ param zkConnectionStr ZooKeeper connec... | return new ZooKeeperUpdatingListenerBuilder ( zkConnectionStr , zNodePath ) . build ( ) ; |
public class MultiRowIterator { /** * to move the iterator to the next item */
void advance ( ) { } } | // we are always at the leaf level when this method is invoked
// so we calculate the seed for generating the row by combining the seed that generated the clustering components
int depth = clusteringComponents . length - 1 ; long parentSeed = clusteringSeeds [ depth ] ; long rowSeed = seed ( clusteringComponents [ dept... |
public class PipedReader { /** * Tell whether this stream is ready to be read . A piped character
* stream is ready if the circular buffer is not empty .
* @ exception IOException if the pipe is
* < a href = PipedInputStream . html # BROKEN > < code > broken < / code > < / a > ,
* { @ link # connect ( java . io... | if ( ! connected ) { throw new IOException ( "Pipe not connected" ) ; } else if ( closedByReader ) { throw new IOException ( "Pipe closed" ) ; } else if ( writeSide != null && ! writeSide . isAlive ( ) && ! closedByWriter && ( in < 0 ) ) { throw new IOException ( "Write end dead" ) ; } if ( in < 0 ) { return false ; } ... |
public class CmdLineParser { /** * Wraps a line so that the resulting parts are not longer than a given maximum length .
* @ param line Line to wrap
* @ param maxLength maximum length for the resulting parts
* @ return list of all wrapped parts */
private List < String > wrapLines ( String line , final int maxLen... | List < String > rv = new ArrayList < String > ( ) ; for ( String restOfLine : line . split ( "\\n" ) ) { while ( restOfLine . length ( ) > maxLength ) { // try to wrap at space , but don ' t try too hard as some languages don ' t even have whitespaces .
int lineLength ; String candidate = restOfLine . substring ( 0 , m... |
public class TextBuilder { /** * Create a link in the current paragraph .
* @ param text the text
* @ param url the destination
* @ return this for fluent style */
public TextBuilder link ( final String text , final URL url ) { } } | this . curParagraphBuilder . link ( text , url ) ; return this ; |
public class RegularExpressionConverter { /** * Converts a PERL style regular expression into Java style . < br >
* < br >
* The leading and ending slash and the modifiers will be removed .
* @ param regex
* A PERL style regular expression
* @ param faultTolerant
* Fault - tolerant translating the flags
*... | Check . notNull ( regex , "regex" ) ; String pattern = regex . trim ( ) ; final Matcher matcher = faultTolerant ? PERL_STYLE_TOLERANT . matcher ( pattern ) : PERL_STYLE . matcher ( pattern ) ; if ( ! matcher . matches ( ) ) { throw new IllegalArgumentException ( "The given regular expression '" + pattern + "' seems to ... |
public class LimitHandler { /** * Handles the next request in the handler chain
* @ param exchange The HttpServerExchange
* @ throws Exception Thrown when an exception occurs */
protected void nextHandler ( HttpServerExchange exchange ) throws Exception { } } | if ( this . attachment . hasBasicAuthentication ( ) ) { HttpHandler httpHandler = RequestUtils . wrapBasicAuthentication ( Application . getInstance ( LocaleHandler . class ) , this . attachment . getUsername ( ) , getPassword ( ) ) ; httpHandler . handleRequest ( exchange ) ; } else { Application . getInstance ( Local... |
public class UntagResourceRequest { /** * A list of one or more tag keys for the tags that you are removing . Specify only the tag keys , not the tag values .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setTagKeyList ( java . util . Collection ) } or { @ ... | if ( this . tagKeyList == null ) { setTagKeyList ( new java . util . ArrayList < String > ( tagKeyList . length ) ) ; } for ( String ele : tagKeyList ) { this . tagKeyList . add ( ele ) ; } return this ; |
public class Check { /** * Ensures that a passed { @ code byte } is less than another { @ code byte } .
* @ param expected
* Expected value
* @ param check
* Comparable to be checked
* @ return the passed { @ code byte } argument { @ code check }
* @ throws IllegalNotLesserThanException
* if the argument ... | if ( expected <= check ) { throw new IllegalNotLesserThanException ( check ) ; } return check ; |
public class ListManagementImagesImpl { /** * Add an image to the list with list Id equal to list Id passed .
* @ param listId List Id of the image list .
* @ param imageStream The image file .
* @ param addImageFileInputOptionalParameter the object representing the optional parameters to be set before calling th... | if ( this . client . baseUrl ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.baseUrl() is required and cannot be null." ) ; } if ( listId == null ) { throw new IllegalArgumentException ( "Parameter listId is required and cannot be null." ) ; } if ( imageStream == null ) { throw new IllegalAr... |
public class DataSourceFactory { /** * Get a pooled data source for the provided connection parameters .
* @ param url The JDBC database URL of the form < code > jdbc : subprotocol : subname < / code >
* @ param properties A list of key / value configuration parameters to pass as connection arguments . Normally at ... | // assert in private method
assert url != null : "The url cannot be null" ; assert properties != null : "The properties cannot be null" ; assert poolSpec != null : "The pol spec cannot be null" ; LOG . debug ( "Creating new pooled data source for '" + url + "'" ) ; // convert the properties hashmap to java properties
f... |
public class AbstractJUnit4InitMethodNotRun { /** * Matches if all of the following conditions are true : 1 ) The method matches { @ link
* # methodMatcher ( ) } , ( looks like setUp ( ) or tearDown ( ) , and none of the overrides in the
* hierarchy of the method have the appropriate @ Before or @ After annotations... | boolean matches = allOf ( methodMatcher ( ) , not ( hasAnnotationOnAnyOverriddenMethod ( JUNIT_TEST ) ) , enclosingClass ( isJUnit4TestClass ) ) . matches ( methodTree , state ) ; if ( ! matches ) { return Description . NO_MATCH ; } // For each annotationReplacement , replace the first annotation that matches . If any ... |
public class MultiWordChunker2 { /** * Lazy init , thanks to Artur Trzewik */
private void lazyInit ( ) { } } | if ( tokenToPosTagMap != null ) { return ; } Map < String , List < MultiWordEntry > > map = new HashMap < > ( ) ; try ( InputStream stream = JLanguageTool . getDataBroker ( ) . getFromResourceDirAsStream ( filename ) ) { List < String > posTokens = loadWords ( stream ) ; for ( String posToken : posTokens ) { String [ ]... |
public class SoyErrors { /** * Performs a case insensitive Levenshtein edit distance based on the 2 rows implementation .
* @ param s The first string
* @ param t The second string
* @ param maxDistance The distance to beat , if we can ' t do better , stop trying
* @ return an integer describing the number of e... | // create two work vectors of integer distances
// it is possible to reduce this to only one array , but performance isn ' t that important here .
// We could also avoid calculating a lot of the entries by taking maxDistance into account in
// the inner loop . This would only be worth optimizing if it showed up in a pr... |
public class IssuingCardPinService { /** * Create a IssuingCardPinService with the provided { @ link EphemeralKeyProvider } .
* @ param keyProvider an { @ link EphemeralKeyProvider } used to get
* { @ link CustomerEphemeralKey EphemeralKeys } as needed */
@ NonNull public static IssuingCardPinService create ( @ Non... | return new IssuingCardPinService ( keyProvider , new StripeApiHandler ( context ) ) ; |
public class ToTextStream { /** * Called when a Comment is to be constructed .
* Note that Xalan will normally invoke the other version of this method .
* % REVIEW % In fact , is this one ever needed , or was it a mistake ?
* @ param data The comment data .
* @ throws org . xml . sax . SAXException Any SAX exce... | final int length = data . length ( ) ; if ( length > m_charsBuff . length ) { m_charsBuff = new char [ length * 2 + 1 ] ; } data . getChars ( 0 , length , m_charsBuff , 0 ) ; comment ( m_charsBuff , 0 , length ) ; |
public class Index { /** * set the value collection Specifies a collection name . If you are indexing an external collection
* external = " Yes " , specify the collection name , including fully qualified path .
* @ param collection value to set
* @ throws PageException */
public void setCollection ( String collec... | try { this . collection = pageContext . getConfig ( ) . getSearchEngine ( pageContext ) . getCollectionByName ( collection . toLowerCase ( ) . trim ( ) ) ; } catch ( SearchException e ) { throw Caster . toPageException ( e ) ; } |
public class DatatypeConverter { /** * Parse the string representation of a double .
* @ param value string representation
* @ return Java representation
* @ throws ParseException */
public static Number parseDouble ( String value ) throws ParseException { } } | Number result = null ; value = parseString ( value ) ; // If we still have a value
if ( value != null && ! value . isEmpty ( ) && ! value . equals ( "-1 -1" ) ) { int index = value . indexOf ( "E+" ) ; if ( index != - 1 ) { value = value . substring ( 0 , index ) + 'E' + value . substring ( index + 2 , value . length (... |
public class RubyObject { /** * Executes a method of any Object by Java reflection .
* @ param o
* an Object
* @ param methodName
* name of the method
* @ param arg
* a Float
* @ return the result of the method called */
public static < E > E send ( Object o , String methodName , Float arg ) { } } | return send ( o , methodName , ( Object ) arg ) ; |
public class SheetBindingErrors { /** * フィールドに対するフォーマッタを登録する 。
* @ since 2.0
* @ param field フィールド名
* @ param fieldType フィールドのクラスタイプ
* @ param formatter フォーマッタ
* @ param strippedIndex 登録するときにフィールドパスから 、 インデックス情報を除去するかどうか 。 */
@ SuppressWarnings ( { } } | "unchecked" , "rawtypes" } ) public void registerFieldFormatter ( final String field , final Class < ? > fieldType , final FieldFormatter < ? > formatter , final boolean strippedIndex ) { String fieldPath = buildFieldPath ( field ) ; if ( strippedIndex ) { // パスからインデックスやキーを削除する
List < String > strippedPaths = new Arr... |
public class AwtExceptionHandlerAdapterHack { /** * Sets the { @ link # SUN _ AWT _ EXCEPTION _ HANDLER _ KEY } system property to register this class as the event thread ' s
* exception handler . When called back , this class simply forwards to the delegate .
* @ param exceptionHandlerDelegate the " real " excepti... | AwtExceptionHandlerAdapterHack . exceptionHandlerDelegate = exceptionHandlerDelegate ; // Registers this class with the system properties so Sun ' s JDK can pick it up . Always sets even if previously set .
System . getProperties ( ) . put ( SUN_AWT_EXCEPTION_HANDLER_KEY , AwtExceptionHandlerAdapterHack . class . getNa... |
public class JUtils { /** * Format a prefixed name as MACRO _ CASE .
* @ param name The name to macro - case .
* @ return THE _ MACRO _ CASED _ NAME */
public static String macroCase ( String name ) { } } | return Strings . c_case ( name ) . toUpperCase ( Locale . US ) ; |
public class DisassociateDelegateFromResourceRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DisassociateDelegateFromResourceRequest disassociateDelegateFromResourceRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( disassociateDelegateFromResourceRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( disassociateDelegateFromResourceRequest . getOrganizationId ( ) , ORGANIZATIONID_BINDING ) ; protocolMarshaller . marshall ( disassociateDelegate... |
public class IFixUtils { /** * This method checks to see whether any of the ifix jars or any ifix static content files are missing from the runtime . It ensures that
* ifix jar files have their base bundles available , and all hashes of the new versions of the ifix files are checked against any they find
* within t... | Set < String > ifixesToReApply = new HashSet < String > ( ) ; Map < File , Map < String , Version > > allBaseBundleJarContent = new HashMap < File , Map < String , Version > > ( ) ; Set < File > allBundleJarContent = new HashSet < File > ( ) ; Set < File > allStaticFileContent = new HashSet < File > ( ) ; // Process al... |
public class MessageMgrBuilder { /** * Activate a message type and sets a type handler with max count set to 100.
* An existing handler will be overwritten .
* @ param type message type to be activated , nothing will be set if null
* @ return self to allow for chaining */
public MessageMgrBuilder setHandler ( E_M... | if ( type != null ) { this . messageHandlers . put ( type , new MessageTypeHandler ( type ) ) ; } else { this . buildErrors . addError ( "{}: cannot add handler for empty type" , this . getClass ( ) . getSimpleName ( ) ) ; } return this ; |
public class VectorPackingPropagator { /** * the fix point procedure without heap , on each dimension :
* - check rule 1.0 : if sumItemSizes < sumBinLoadInf or sumItemSizes > sumBinLoadSups then fail
* - filter according to rule 1.1 , for each bin : sumItemSizes - ( sumBinLoadSup - sup ( binLoad ) ) < = binLoad < =... | boolean noFixPoint = true ; while ( noFixPoint ) { for ( int d = 0 ; d < nbDims ; d ++ ) { if ( sumISizes [ d ] > sumLoadSup [ d ] . get ( ) || sumISizes [ d ] < sumLoadInf [ d ] . get ( ) ) { fails ( ) ; } } noFixPoint = false ; for ( int d = 0 ; d < nbDims ; d ++ ) { for ( int b = 0 ; b < nbBins ; b ++ ) { assert ( l... |
public class ApplicationProxy { /** * Constructor . */
public void init ( String strServer , String strBaseServletPath , String strRemoteApp ) { } } | super . init ( null , null ) ; m_strServer = strServer ; m_strBaseServletPath = strBaseServletPath ; m_strRemoteApp = strRemoteApp ; |
public class ConfigManager { /** * Check if the config files have changed since they were last read
* @ return true if the modification time of the file is greater
* than that of the last successful reload , false otherwise
* @ param init true when the config manager is being initialized .
* false on reloads */... | if ( init && ( configFileName == null || ( poolsConfigFileName == null && conf . onlyAllowConfiguredPools ( ) ) ) ) { throw new IOException ( "ClusterManager needs a config and a " + "pools file to start" ) ; } if ( configFileName == null && poolsConfigFileName == null ) { return false ; } boolean configChanged = false... |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public MediaEjectControlReserved createMediaEjectControlReservedFromString ( EDataType eDataType , String initialValue ) { } } | MediaEjectControlReserved result = MediaEjectControlReserved . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class PaxWicketPageTracker { /** * { @ inheritDoc }
* Default implementation of the
* { @ code ServiceTrackerCustomizer . addingService } method .
* This method is only called when this < code > ServiceTracker < / code > object
* has been constructed with a < code > null ServiceTrackerCustomizer < / code... | PageFactory < ? extends IRequestablePage > pageSource = super . addingService ( reference ) ; paxWicketPageFactory . add ( pageSource ) ; return pageSource ; |
public class NamedParameterStatement { /** * - - - - - PRIVATE METHODS */
private void processQuery ( ) throws SQLException { } } | if ( preparedStatement != null ) { return ; } if ( query == null ) { throw new RuntimeException ( "Invalid NamedParameterStatement: no query!" ) ; } logger . debug ( "Orig Query: {}" , query ) ; StringBuffer builder = new StringBuffer ( ) ; String queryByPlugin = query ; for ( INpsPlugin plugin : plugins ) { queryByPlu... |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcPixelTexture ( ) { } } | if ( ifcPixelTextureEClass == null ) { ifcPixelTextureEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 423 ) ; } return ifcPixelTextureEClass ; |
public class AbstractChainableEvent { /** * Assigns the chain identifier for the specified event to the chain identifier
* value of this instance . This requires the specified event to be an instance
* of ChainableEvent .
* @ param event the event to chain
* @ return a chained event */
private Event linkChainId... | if ( event instanceof ChainableEvent ) { ChainableEvent chainableEvent = ( ChainableEvent ) event ; chainableEvent . setChainIdentifier ( this . getChainIdentifier ( ) ) ; return chainableEvent ; } return event ; |
public class ApiOvhEmailexchange { /** * Add new mailing list member
* REST : POST / email / exchange / { organizationName } / service / { exchangeService } / mailingList / { mailingListAddress } / member / contact
* @ param memberAccountId [ required ] Member account id
* @ param memberContactId [ required ] Mem... | String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}/member/contact" ; StringBuilder sb = path ( qPath , organizationName , exchangeService , mailingListAddress ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "memberAccount... |
public class NodeArbitrateEvent { /** * 创建相应的node节点 , 说明 : node节点的生命周期为EPHEMERAL
* < pre >
* 1 . 是个同步调用
* < / pre > */
public void init ( Long nid ) { } } | String path = ManagePathUtils . getNode ( nid ) ; try { zookeeper . create ( path , new byte [ 0 ] , CreateMode . EPHEMERAL ) ; // 创建为临时节点
} catch ( ZkException e ) { throw new ArbitrateException ( "Node_init" , nid . toString ( ) , e ) ; } |
public class UnifiedResponse { /** * Utility method for setting the MimeType application / force - download and set
* the respective content disposition filename .
* @ param sFilename
* The filename to be used .
* @ return this */
@ Nonnull public final UnifiedResponse setDownloadFilename ( @ Nonnull @ Nonempty... | setMimeType ( CMimeType . APPLICATION_FORCE_DOWNLOAD ) ; setContentDispositionFilename ( sFilename ) ; return this ; |
public class BootstrapContextImpl { /** * DS method to activate this component .
* Best practice : this should be a protected method , not public or private
* @ param context DeclarativeService defined / populated component context
* @ throws Exception if unable to start the resource adapter */
@ Trivial protecte... | Dictionary < String , ? > props = context . getProperties ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "activate" , props ) ; resourceAdapterID = ( String ) props . get ( "id" ) ; contextProviders . activate ( context ) ; bvalRef . activate ( context ) ; tran... |
public class MwRevisionImpl { /** * Resets all member fields that hold information about the revision that is
* currently being processed . */
void resetCurrentRevisionData ( ) { } } | this . revisionId = NO_REVISION_ID ; // impossible as an id in MediaWiki
this . parentRevisionId = NO_REVISION_ID ; this . text = null ; this . comment = null ; this . format = null ; this . timeStamp = null ; this . model = null ; |
public class CodeBuilderFactory { /** * Create an injector that override the given injectors with the modules .
* @ param originalInjector the original injector .
* @ param modules the overriding modules .
* @ return the new injector . */
public static Injector createOverridingInjector ( Injector originalInjector... | final Map < Key < ? > , Binding < ? > > bindings = originalInjector . getBindings ( ) ; return Guice . createInjector ( Modules2 . mixin ( ( binder ) -> { for ( Binding < ? > binding : bindings . values ( ) ) { final Type typeLiteral = binding . getKey ( ) . getTypeLiteral ( ) . getType ( ) ; if ( typeLiteral != null )... |
public class LambdaDslObject { /** * Accepts any key , and each key is mapped to a map that must match the following object definition .
* Note : this needs the Java system property " pact . matching . wildcard " set to value " true " when the pact file is verified .
* @ param exampleKey Example key to use for gene... | final PactDslJsonBody objectLike = object . eachKeyLike ( exampleKey ) ; final LambdaDslObject dslObject = new LambdaDslObject ( objectLike ) ; nestedObject . accept ( dslObject ) ; objectLike . closeObject ( ) ; return this ; |
public class WorkspaceContainerFacade { /** * Returns current workspace state . */
public int getState ( ) { } } | boolean hasSuspendedComponents = false ; boolean hasResumedComponents = false ; List < Suspendable > suspendableComponents = getComponentInstancesOfType ( Suspendable . class ) ; for ( Suspendable component : suspendableComponents ) { if ( component . isSuspended ( ) ) { hasSuspendedComponents = true ; } else { hasResu... |
public class RSAUtils { /** * Encrypt data with RSA public key .
* Note : input data is divided into chunks of
* { @ code size = key ' s size ( in bytes ) - paddingSizeInBytes } , so that long input data can be
* encrypted .
* @ param base64PublicKeyData
* RSA public key in base64 ( base64 of { @ link RSAPubl... | RSAPublicKey publicKey = buildPublicKey ( base64PublicKeyData ) ; return encrypt ( publicKey , data , cipherTransformation , paddingSizeInBytes ) ; |
public class ReceiveMessageRequest { /** * The name of the message attribute , where < i > N < / i > is the index .
* < ul >
* < li >
* The name can contain alphanumeric characters and the underscore ( < code > _ < / code > ) , hyphen ( < code > - < / code > ) , and
* period ( < code > . < / code > ) .
* < / ... | if ( this . messageAttributeNames == null ) { setMessageAttributeNames ( new com . amazonaws . internal . SdkInternalList < String > ( messageAttributeNames . length ) ) ; } for ( String ele : messageAttributeNames ) { this . messageAttributeNames . add ( ele ) ; } return this ; |
public class Metadata { /** * Gets a metadata value , returning the appropriate value when multiple are found .
* @ param name the name of the metadata .
* @ return the tiff object with the value of the metadata . */
public TiffObject get ( String name ) { } } | TiffObject result = null ; String container = null ; ArrayList < TiffObject > found = new ArrayList < > ( ) ; if ( contains ( name ) ) { // Find objects with this exact name
if ( metadata . get ( name ) . getObjectList ( ) . size ( ) == 1 ) { found . add ( getFirst ( name ) ) ; } else { for ( TiffObject to : metadata .... |
public class CodeVisitor { /** * Sets a short value . */
public void setShort ( int offset , int value ) { } } | byte [ ] code = getCode ( ) ; code [ offset + 0 ] = ( byte ) ( value >> 8 ) ; code [ offset + 1 ] = ( byte ) ( value ) ; |
public class BufferedISPNCache { /** * { @ inheritDoc } */
public Object putIfAbsent ( CacheKey key , Object value , long lifespan , TimeUnit unit ) { } } | return parentCache . putIfAbsent ( key , value , lifespan , unit ) ; |
public class DateParameter { /** * Write data to socket in binary format .
* @ param pos socket output stream
* @ throws IOException if socket error occur */
public void writeBinary ( final PacketOutputStream pos ) throws IOException { } } | Calendar calendar = Calendar . getInstance ( timeZone ) ; calendar . setTimeInMillis ( date . getTime ( ) ) ; pos . write ( ( byte ) 7 ) ; // length
pos . writeShort ( ( short ) calendar . get ( Calendar . YEAR ) ) ; pos . write ( ( byte ) ( ( calendar . get ( Calendar . MONTH ) + 1 ) & 0xff ) ) ; pos . write ( ( byte ... |
public class ZookeeperPathUtils { /** * 客户端当前正在工作的running节点 */
public static String getDestinationClientRunning ( String destination , short clientId ) { } } | return MessageFormat . format ( DESTINATION_CLIENTID_RUNNING_NODE , destination , String . valueOf ( clientId ) ) ; |
public class MetadataService { /** * Restores a { @ link ProjectMetadata } whose name equals to the specified { @ code projectName } . */
public CompletableFuture < Revision > restoreProject ( Author author , String projectName ) { } } | requireNonNull ( author , "author" ) ; requireNonNull ( projectName , "projectName" ) ; final Change < JsonNode > change = Change . ofJsonPatch ( METADATA_JSON , new RemoveOperation ( PROJECT_REMOVAL ) . toJsonNode ( ) ) ; return metadataRepo . push ( projectName , Project . REPO_DOGMA , author , "Restore the project: ... |
public class Tools { /** * LibO shortens menu items with more than ~ 100 characters by dropping text in the middle .
* That isn ' t really sensible , so we shorten the text here in order to preserve the important parts . */
public static String shortenComment ( String comment ) { } } | int maxCommentLength = 100 ; String shortComment = comment ; if ( shortComment . length ( ) > maxCommentLength ) { // if there is text in brackets , drop it ( beginning at the end )
while ( shortComment . lastIndexOf ( " [" ) > 0 && shortComment . lastIndexOf ( ']' ) > shortComment . lastIndexOf ( " [" ) && shortCommen... |
public class CassandraExtractor { /** * Returns a list of hosts on which the given split resides . */
@ Override public List < String > getPreferredLocations ( Partition tokenRange ) { } } | return ( ( DeepPartition ) tokenRange ) . splitWrapper ( ) . getReplicas ( ) ; |
public class HtmlEscape { /** * Perform an HTML 4 level 2 ( result is ASCII ) < strong > escape < / strong > operation on a < tt > Reader < / tt > input ,
* writing results to a < tt > Writer < / tt > .
* < em > Level 2 < / em > means this method will escape :
* < ul >
* < li > The five markup - significant cha... | escapeHtml ( reader , writer , HtmlEscapeType . HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL , HtmlEscapeLevel . LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT ) ; |
public class WebAppSecurityConfigImpl { /** * { @ inheritDoc } */
@ Override public boolean getAllowFailOverToFormLogin ( ) { } } | if ( allowFailOverToAuthMethod != null && allowFailOverToAuthMethod . equalsIgnoreCase ( LoginConfiguration . FORM ) ) return true ; else return false ; |
public class xHelmNotationParser { /** * Extracts the HELM string from the root node of the XHELM document
* @ param rootElement root element
* @ return the complex notation string */
public static String getHELMNotationString ( Element rootElement ) { } } | Element helmNotationElement = rootElement . getChild ( "HelmNotation" ) ; return helmNotationElement . getText ( ) ; |
public class PollingThread { /** * Creates a request packet for the specified action .
* @ param action Action to perform .
* @ param session Session receiving the request .
* @ return The fully formed request . */
private Request getRequest ( Action action , BrokerSession session ) { } } | switch ( action ) { case QUERY : if ( query == null ) { query = new Request ( action ) ; query . addParameter ( "UID" , session . getId ( ) ) ; } return query ; case PING : if ( ping == null ) { ping = new Request ( action ) ; } return ping ; default : return null ; } |
public class CPFriendlyURLEntryUtil { /** * Returns the cp friendly url entry where groupId = & # 63 ; and classNameId = & # 63 ; and classPK = & # 63 ; and languageId = & # 63 ; and urlTitle = & # 63 ; or returns < code > null < / code > if it could not be found . Uses the finder cache .
* @ param groupId the group ... | return getPersistence ( ) . fetchByG_C_C_L_U ( groupId , classNameId , classPK , languageId , urlTitle ) ; |
public class ClassLoaderUtil { /** * Check whether a classloader can load the given class . */
@ SuppressWarnings ( "unchecked" ) public static < T > boolean hasClass ( Class < T > type , ClassLoader classloader ) { } } | try { loadClass ( type . getName ( ) , classloader ) ; return true ; } catch ( RuntimeException e ) { if ( e . getCause ( ) instanceof ClassNotFoundException ) { return false ; } throw e ; } |
public class MarkLogicClientImpl { /** * executes INSERT of single triple
* @ param baseURI
* @ param subject
* @ param predicate
* @ param object
* @ param tx
* @ param contexts
* @ throws MarkLogicSesameException */
public void performAdd ( String baseURI , Resource subject , URI predicate , Value objec... | StringBuilder sb = new StringBuilder ( ) ; if ( notNull ( contexts ) && contexts . length > 0 ) { if ( notNull ( baseURI ) ) sb . append ( "BASE <" + baseURI + ">\n" ) ; sb . append ( "INSERT DATA { " ) ; for ( int i = 0 ; i < contexts . length ; i ++ ) { if ( notNull ( contexts [ i ] ) ) { sb . append ( "GRAPH <" + co... |
public class AbstractJTACrud { /** * Deletes the given entity instance ( specified by its id ) . The instance is removed from the persistent layer .
* @ param id the id */
@ Override public void delete ( final I id ) { } } | if ( entity != null ) { inTransaction ( new Callable < Void > ( ) { @ Override public Void call ( ) throws Exception { final T entity = findOne ( id ) ; T attached = getAttached ( entity ) ; if ( attached != null ) { entityManager . remove ( attached ) ; } return null ; } } ) ; } |
public class DescribeAccountAttributesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeAccountAttributesRequest describeAccountAttributesRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeAccountAttributesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Validate { /** * Method without varargs to increase performance */
public static < T > void isNull ( final T object , final String message ) { } } | INSTANCE . isNull ( object , message ) ; |
public class BitUtil { /** * Is an address aligned on a boundary .
* @ param address to be tested .
* @ param alignment boundary the address is tested against .
* @ return true if the address is on the aligned boundary otherwise false .
* @ throws IllegalArgumentException if the alignment is not a power of 2. *... | if ( ! BitUtil . isPowerOfTwo ( alignment ) ) { throw new IllegalArgumentException ( "alignment must be a power of 2: alignment=" + alignment ) ; } return ( address & ( alignment - 1 ) ) == 0 ; |
public class Token { /** * Escape given string so that tokenize ( escapeString ( str ) ) . get ( 0 ) . getString = = = str .
* @ param input String to be escaped
* @ return escaped string */
public static String escapeString ( String input ) { } } | StringBuilder escaped = new StringBuilder ( input . length ( ) + 10 ) ; escaped . append ( '"' ) ; for ( int i = 0 ; i < input . length ( ) ; i ++ ) { if ( input . charAt ( i ) == '"' ) { escaped . append ( "\"\"" ) ; } else { escaped . append ( input . charAt ( i ) ) ; } } escaped . append ( '"' ) ; return escaped . t... |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getExternalAlgorithmALGTYPE ( ) { } } | if ( externalAlgorithmALGTYPEEEnum == null ) { externalAlgorithmALGTYPEEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 120 ) ; } return externalAlgorithmALGTYPEEEnum ; |
public class CmsGalleryService { /** * Gets an initialized CmsObject to be used for the actual search for a given search bean . < p >
* @ param searchObj the search object
* @ return the initialized CmsObject
* @ throws CmsException if something goes wrong */
protected CmsObject getSearchCms ( CmsGallerySearchBea... | CmsObject searchCms = getCmsObject ( ) ; if ( searchObj . isIncludeExpired ( ) ) { searchCms = OpenCms . initCmsObject ( getCmsObject ( ) ) ; searchCms . getRequestContext ( ) . setRequestTime ( CmsResource . DATE_RELEASED_EXPIRED_IGNORE ) ; } return searchCms ; |
public class Album { /** * Preview Album . */
public static BasicGalleryWrapper < GalleryAlbumWrapper , AlbumFile , String , AlbumFile > galleryAlbum ( Activity activity ) { } } | return new GalleryAlbumWrapper ( activity ) ; |
public class FilterValues { /** * Returns a new FilterValues instance with the next blank parameters filled in .
* @ param values parameter values to fill in ; if null or empty , this
* FilterValues instance is returned
* @ throws IllegalStateException if no blank parameters or if too many
* parameter values su... | if ( values == null ) { return this ; } if ( values . length > getBlankParameterCount ( ) ) { throw new IllegalStateException ( "Too many values supplied" ) ; } FilterValues < S > filterValues = this ; for ( Object value : values ) { filterValues = filterValues . with ( value ) ; } return filterValues ; |
public class N { /** * Returns an immutable empty map if the specified Map is < code > null < / code > , otherwise itself is returned .
* @ param map
* @ return */
public static < K , V > Map < K , V > nullToEmpty ( final Map < K , V > map ) { } } | return map == null ? N . < K , V > emptyMap ( ) : map ; |
public class OcAgentTraceExporterHandler { /** * One stub can be used for both Export RPC and Config RPC . */
private static TraceServiceGrpc . TraceServiceStub getTraceServiceStub ( String endPoint , Boolean useInsecure , SslContext sslContext ) { } } | ManagedChannelBuilder < ? > channelBuilder ; if ( useInsecure ) { channelBuilder = ManagedChannelBuilder . forTarget ( endPoint ) . usePlaintext ( ) ; } else { channelBuilder = NettyChannelBuilder . forTarget ( endPoint ) . negotiationType ( NegotiationType . TLS ) . sslContext ( sslContext ) ; } ManagedChannel channel... |
public class BlockSelectorMarkupHandler { /** * DOCTYPE Clause events */
@ Override public void handleDocType ( final char [ ] buffer , final int keywordOffset , final int keywordLen , final int keywordLine , final int keywordCol , final int elementNameOffset , final int elementNameLen , final int elementNameLine , fin... | if ( ! this . insideAllSelectorMatchingBlock ) { this . someSelectorsMatch = false ; for ( int i = 0 ; i < this . selectorsLen ; i ++ ) { if ( this . matchingMarkupLevelsPerSelector [ i ] > this . markupLevel ) { this . selectorMatches [ i ] = this . selectorFilters [ i ] . matchDocTypeClause ( true , this . markupLeve... |
public class Channel { /** * Shutdown the channel with all resources released .
* @ param force force immediate shutdown . */
public synchronized void shutdown ( boolean force ) { } } | if ( shutdown ) { return ; } String ltransactionListenerProcessorHandle = transactionListenerProcessorHandle ; transactionListenerProcessorHandle = null ; if ( null != ltransactionListenerProcessorHandle ) { try { unregisterBlockListener ( ltransactionListenerProcessorHandle ) ; } catch ( Exception e ) { logger . error... |
public class StringParser { /** * Parse the given { @ link Object } as { @ link Integer } with radix
* { @ value # DEFAULT _ RADIX } .
* @ param aObject
* The object to parse . May be < code > null < / code > .
* @ return < code > null < / code > if the object does not represent a valid value . */
@ Nullable pu... | return parseIntObj ( aObject , DEFAULT_RADIX , null ) ; |
public class AbstractInterval { /** * Does this time interval contain the specified millisecond instant .
* Non - zero duration intervals are inclusive of the start instant and
* exclusive of the end . A zero duration interval cannot contain anything .
* @ param millisInstant the instant to compare to ,
* milli... | long thisStart = getStartMillis ( ) ; long thisEnd = getEndMillis ( ) ; return ( millisInstant >= thisStart && millisInstant < thisEnd ) ; |
public class DateUtil { /** * 偏移天
* @ param date 日期
* @ param offset 偏移天数 , 正数向未来偏移 , 负数向历史偏移
* @ return 偏移后的日期 */
public static DateTime offsetDay ( Date date , int offset ) { } } | return offset ( date , DateField . DAY_OF_YEAR , offset ) ; |
public class URLHelper { /** * Get the final representation of the URL using the specified elements .
* @ param sPath
* The main path . May be < code > null < / code > .
* @ param sQueryParams
* The set of all query parameters already concatenated with the
* correct characters ( & amp ; and = ) . May be < cod... | final boolean bHasPath = StringHelper . hasText ( sPath ) ; final boolean bHasQueryParams = StringHelper . hasText ( sQueryParams ) ; final boolean bHasAnchor = StringHelper . hasText ( sAnchor ) ; if ( GlobalDebug . isDebugMode ( ) ) { // Consistency checks
if ( bHasPath ) { if ( sPath . contains ( QUESTIONMARK_STR ) ... |
public class Quint { /** * < p > next . < / p >
* @ param t1 a T1 object .
* @ param t2 a T2 object .
* @ param t3 a T3 object .
* @ param t4 a T4 object .
* @ param t5 a T5 object .
* @ param < T1 > a T1 object .
* @ param < T2 > a T2 object .
* @ param < T3 > a T3 object .
* @ param < T4 > a T4 obje... | return new Quint < > ( t1 , t2 , t3 , t4 , t5 ) ; |
public class ChangesLog { /** * Returns workspace changed size accumulated during
* some period . */
public long getWorkspaceChangedSize ( ) { } } | long wsDelta = 0 ; Iterator < ChangesItem > changes = iterator ( ) ; while ( changes . hasNext ( ) ) { wsDelta += changes . next ( ) . getWorkspaceChangedSize ( ) ; } return wsDelta ; |
public class IncrementalIndexRow { /** * bytesInMemory estimates the size of IncrementalIndexRow key , it takes into account the timestamp ( long ) ,
* dims ( Object Array ) and dimensionDescsList ( List ) . Each of these are calculated as follows :
* < ul >
* < li > timestamp : Long . BYTES
* < li > dims array... | long sizeInBytes = Long . BYTES + Integer . BYTES * dims . length + Long . BYTES + Long . BYTES ; sizeInBytes += dimsKeySize ; return sizeInBytes ; |
public class ParameterFinder { /** * Test .
* @ param args */
public static void main ( String [ ] args ) { } } | HashMap < String , String > props = new HashMap < > ( ) ; props . put ( "Params_1.TAN2StepParams3.ParTAN2Step4.TAN2StepParams2.secfunc" , "Test 1" ) ; props . put ( "Params_2.TAN2StepParams3.ParTAN2Step4.TAN2StepParams2.1secfunc" , "Test 2" ) ; props . put ( "Params_1.PIN2StepParams3.ParTAN2Step4.TAN2StepParams2.2secfu... |
public class BoundedBuffer { /** * Inserts an object into the buffer . Note that
* since there is no synchronization , it is assumed
* that this is done outside the scope of this call . */
private final void insert ( T t ) { } } | buffer [ putIndex ] = t ; if ( ++ putIndex >= buffer . length ) { putIndex = 0 ; } |
public class CPSpecificationOptionPersistenceImpl { /** * Caches the cp specification option in the entity cache if it is enabled .
* @ param cpSpecificationOption the cp specification option */
@ Override public void cacheResult ( CPSpecificationOption cpSpecificationOption ) { } } | entityCache . putResult ( CPSpecificationOptionModelImpl . ENTITY_CACHE_ENABLED , CPSpecificationOptionImpl . class , cpSpecificationOption . getPrimaryKey ( ) , cpSpecificationOption ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_UUID_G , new Object [ ] { cpSpecificationOption . getUuid ( ) , cpSpecificationOption... |
public class TwoDropDownChoicesBean { /** * Gets the child choices .
* @ return the child choices */
public List < T > getChildChoices ( ) { } } | final List < T > childChoices = getModelsMap ( ) . get ( getSelectedRootOption ( ) ) ; if ( CollectionExtensions . isEmpty ( childChoices ) ) { return Collections . emptyList ( ) ; } return childChoices ; |
public class HashBasedHipsterGraph { /** * Returns a list of the edges in the graph .
* @ return edges of the graph . */
@ Override public Iterable < GraphEdge < V , E > > edges ( ) { } } | return F . map ( vedges ( ) , new Function < Map . Entry < V , GraphEdge < V , E > > , GraphEdge < V , E > > ( ) { @ Override public GraphEdge < V , E > apply ( Map . Entry < V , GraphEdge < V , E > > entry ) { return entry . getValue ( ) ; } } ) ; |
public class MetricsNames { /** * Create an MetricKey object based on metric name , metric type and tags associated .
* The MetricKey object contains cache key for cache lookup and registry key for registry lookup .
* @ param metric the metric name .
* @ param tags the tag ( s ) associated with the metric .
* @... | if ( tags == null || tags . length == 0 ) { // if no tags supplied , the original metric name is used for both cache key and registry key .
return new MetricKey ( metric , metric ) ; } else { // if tag is supplied , append tag value to form cache key ; original metric name is registry key .
StringBuilder sb = new Strin... |
public class Headers { /** * Indicates if a header exists with the given name
* @ param name The header name
* @ return true if a header exists with the given name , false otherwise */
public boolean contains ( String name ) { } } | for ( Header header : headers ) { if ( header . getName ( ) . equals ( name ) ) { return true ; } } return false ; |
public class EntryUtility { /** * Gets the entry ID based on the specified entry file name . */
public static long getEntryId ( String entryFileName ) { } } | int ind1 = entryFileName . indexOf ( "_" ) + 1 ; if ( ind1 > 0 ) { int ind2 = entryFileName . indexOf ( "_" , ind1 ) ; if ( ind2 > ind1 ) { String str = entryFileName . substring ( ind1 , ind2 ) ; try { return Long . parseLong ( str ) ; } catch ( Exception e ) { } } } return 0 ; |
public class CollectionValuedMap { /** * Replaces current Collection mapped to key with the specified Collection .
* Use carefully ! */
public Collection < V > put ( K key , Collection < V > collection ) { } } | return map . put ( key , collection ) ; |
public class CmsVfsService { /** * Helper method for converting a map which maps resources to resources to a list of " broken link " beans ,
* which have beans representing the source of the corresponding link as children . < p >
* @ param linkMap a multimap from resource to resources
* @ return a list of beans r... | CmsBrokenLinkRenderer brokenLinkRenderer = new CmsBrokenLinkRenderer ( getCmsObject ( ) ) ; Multimap < CmsBrokenLinkBean , CmsBrokenLinkBean > resultMap = HashMultimap . create ( ) ; for ( CmsResource source : linkMap . keySet ( ) ) { for ( CmsResource target : linkMap . get ( source ) ) { CmsBrokenLinkBean targetBean ... |
public class SchemeMatchFilter { /** * / * ( non - Javadoc )
* @ see org . archive . wayback . util . ObjectFilter # filterObject ( java . lang . Object ) */
@ Override public int filterObject ( CaptureSearchResult r ) { } } | String captureScheme = UrlOperations . urlToScheme ( r . getOriginalUrl ( ) ) ; if ( scheme == null ) { if ( captureScheme == null ) { return FILTER_INCLUDE ; } else { annotationTarget . addCloseMatch ( r . getOriginalHost ( ) , r . getOriginalUrl ( ) ) ; return FILTER_EXCLUDE ; } } if ( scheme . equals ( captureScheme... |
public class WikipediaTemplateInfo { /** * Returns a list containing the ids of all pages that do not contain a template
* the name of which equals any of the given Strings .
* @ param templateNames
* the names of the template that we want to match
* @ return A list with the ids of all pages that do not contain... | return getFilteredPageIds ( templateNames , false ) ; |
public class ApiOvhIp { /** * Alter this object properties
* REST : PUT / ip / { ip } / game / { ipOnGame }
* @ param body [ required ] New object properties
* @ param ip [ required ]
* @ param ipOnGame [ required ] */
public void ip_game_ipOnGame_PUT ( String ip , String ipOnGame , OvhGameMitigation body ) thr... | String qPath = "/ip/{ip}/game/{ipOnGame}" ; StringBuilder sb = path ( qPath , ip , ipOnGame ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ; |
public class UserDao { /** * Select users by ids , including disabled users . An empty list is returned
* if list of ids is empty , without any db round trips .
* Used by the Governance plugin */
public List < UserDto > selectByIds ( DbSession session , Collection < Integer > ids ) { } } | return executeLargeInputs ( ids , mapper ( session ) :: selectByIds ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.