signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class SingletonLaContainerFactory { protected static void setupScriptEngine ( ) { } } | new Thread ( ( ) -> { /* first getEngineByName ( ) costs about 0.5 seconds so initialize it background */
final Class < ? > engineType = LastaDiProperties . getInstance ( ) . getDiXmlScriptExpressionEngineType ( ) ; if ( engineType == null ) { /* use default */
new ScriptEngineManager ( ) . getEngineByName ( "javascrip... |
public class ViewState { /** * encode a object to a base64 string
* @ param o is a implemented java . io . Serializable object
* @ return the encoded object */
public static String encode ( Serializable o ) { } } | ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; try { ObjectOutputStream oos = new ObjectOutputStream ( bos ) ; try { oos . writeObject ( o ) ; oos . flush ( ) ; } finally { oos . close ( ) ; } return Base64 . encodeBytes ( bos . toByteArray ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e... |
public class Attachment { /** * Creates a non - binary attachment from the given file .
* @ throws IOException if an I / O error occurs
* @ throws java . lang . IllegalArgumentException if mediaType is binary
* @ deprecated use fromTextInputStream without charSet with a mediaType that has a specified charSet */
@... | return fromText ( CharStreams . toString ( new InputStreamReader ( inputStream , charset ) ) , mediaType ) ; |
public class Fragments { /** * Default unlimited - depth sub - edge traversal
* @ param traversal
* @ param < T >
* @ return */
static < T > GraphTraversal < T , Vertex > inSubs ( GraphTraversal < T , Vertex > traversal ) { } } | return inSubs ( traversal , TRAVERSE_ALL_SUB_EDGES ) ; |
public class BCrypt { /** * Perform the central password hashing step in the bcrypt scheme
* @ param password the password to hash
* @ param salt the binary salt to hash with the password
* @ param log _ rounds the binary logarithm of the number of rounds of hashing to
* apply
* @ return an array containing t... | int rounds , i , j ; final int cdata [ ] = bf_crypt_ciphertext . clone ( ) ; final int clen = cdata . length ; byte ret [ ] ; if ( ( log_rounds < 4 ) || ( log_rounds > 31 ) ) { throw new IllegalArgumentException ( "Bad number of rounds" ) ; } rounds = 1 << log_rounds ; if ( salt . length != BCRYPT_SALT_LEN ) { throw ne... |
public class Enter { /** * Complain about a duplicate class . */
protected void duplicateClass ( DiagnosticPosition pos , ClassSymbol c ) { } } | log . error ( pos , "duplicate.class" , c . fullname ) ; |
public class NIOServerCnxn { /** * clean up the socket related to a command and also make sure we flush the
* data before we do that
* @ param pwriter
* the pwriter for a command socket */
private void cleanupWriterSocket ( PrintWriter pwriter ) { } } | try { if ( pwriter != null ) { pwriter . flush ( ) ; pwriter . close ( ) ; } } catch ( Exception e ) { LOG . info ( "Error closing PrintWriter " , e ) ; } finally { try { close ( ) ; } catch ( Exception e ) { LOG . error ( "Error closing a command socket " , e ) ; } } |
public class DisruptorFactory { /** * if there are many consumers , execution order will be alphabetical list by
* Name of @ Consumer class .
* @ param topic
* @ return */
protected Collection loadEvenHandler ( String topic ) { } } | Collection ehs = new ArrayList ( ) ; Collection < String > consumers = ( Collection < String > ) containerWrapper . lookup ( ConsumerLoader . TOPICNAME + topic ) ; if ( consumers == null || consumers . size ( ) == 0 ) { Debug . logWarning ( "[Jdonframework]there is no any consumer class annotated with @Consumer(" + top... |
public class AwsS3ServiceClientImpl { /** * Puts an object .
* @ param bucket the bucket to put the object in .
* @ param key the key ( or name ) of the object .
* @ param acl the ACL to apply to the object ( e . g . private ) .
* @ param contentType the content type of the object ( e . g . application / json )... | return dispatcher . dispatchTask ( new Callable < AwsS3PutObjectResult > ( ) { @ Override public AwsS3PutObjectResult call ( ) throws IOException { return proxy . putObject ( bucket , key , acl , contentType , body ) ; } } ) ; |
public class MemberSummaryBuilder { /** * Build the inherited member summary for the given methods .
* @ param writer the writer for this member summary .
* @ param visibleMemberMap the map for the members to document .
* @ param summaryTreeList list of content trees to which the documentation will be added */
pr... | for ( ClassDoc inhclass : visibleMemberMap . getVisibleClassesList ( ) ) { if ( ! ( inhclass . isPublic ( ) || utils . isLinkable ( inhclass , configuration ) ) ) { continue ; } if ( inhclass == classDoc ) { continue ; } List < ProgramElementDoc > inhmembers = visibleMemberMap . getMembersFor ( inhclass ) ; if ( inhmem... |
public class CmsEditableDataJSO { /** * Gets the element view . < p >
* @ return the element view */
public CmsUUID getElementView ( ) { } } | String elementViewString = getString ( CmsEditorConstants . ATTR_ELEMENT_VIEW ) ; if ( elementViewString == null ) { return null ; } return new CmsUUID ( elementViewString ) ; |
public class Proxy { /** * Marks this proxy object as being open . */
protected void setOpen ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setOpen" ) ; closed = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setOpen" ) ; |
public class AbstractInputFlowlet { /** * This process method consumes the records queued in dataManager and invokes the associated " process " methods for
* each output query */
@ Tick ( delay = 200L , unit = TimeUnit . MILLISECONDS ) protected void processGDATRecords ( ) throws InvocationTargetException , IllegalAc... | stopwatch . reset ( ) ; stopwatch . start ( ) ; while ( ! recordQueue . isEmpty ( ) ) { // Time since start of processing in Seconds
long elapsedTime = stopwatch . elapsedTime ( TimeUnit . SECONDS ) ; if ( elapsedTime >= Constants . TICKER_TIMEOUT ) { break ; } Map . Entry < String , GDATDecoder > record = recordQueue ... |
public class ObjectType { /** * Determine if { @ code this } is a an implicit subtype of { @ code superType } . */
final boolean isStructuralSubtype ( ObjectType superType , ImplCache implicitImplCache , SubtypingMode subtypingMode ) { } } | // Union types should be handled by isSubtype already
checkArgument ( ! this . isUnionType ( ) ) ; checkArgument ( ! superType . isUnionType ( ) ) ; Preconditions . checkArgument ( superType . isStructuralType ( ) , "isStructuralSubtype should be called with structural supertype. Found %s" , superType ) ; MatchStatus c... |
public class GeneratorConfig { /** * Copy the values of the given generator configuration . */
public GeneratorConfig copy ( final GeneratorConfig other ) { } } | this . generateExpressions = other . generateExpressions ; this . generateSyntheticSuppressWarnings = other . generateSyntheticSuppressWarnings ; this . generateGeneratedAnnotation = other . generateGeneratedAnnotation ; this . includeDateInGeneratedAnnotation = other . includeDateInGeneratedAnnotation ; this . generat... |
public class RecurrencePropertyScribe { /** * Parses an integer string , where the sign is at the end of the string
* instead of at the beginning ( for example , " 5 - " ) .
* @ param value the string
* @ return the value
* @ throws NumberFormatException if the string cannot be parsed as an
* integer */
priva... | int negate = 1 ; if ( value . endsWith ( "+" ) ) { value = value . substring ( 0 , value . length ( ) - 1 ) ; } else if ( value . endsWith ( "-" ) ) { value = value . substring ( 0 , value . length ( ) - 1 ) ; negate = - 1 ; } return Integer . parseInt ( value ) * negate ; |
public class MemoryLogHandler { /** * Returns LogRecords that are equal or above the severity level .
* @ param severity Asciidoctor severity level
* @ return list of filtered logRecords */
public List < LogRecord > filter ( Severity severity ) { } } | // FIXME : find better name or replace with stream
final List < LogRecord > records = new ArrayList < > ( ) ; for ( LogRecord record : this . records ) { if ( record . getSeverity ( ) . ordinal ( ) >= severity . ordinal ( ) ) records . add ( record ) ; } return records ; |
public class SCXMLGapper { /** * Takes a model and an SCXMLFrontier and decomposes the Frontier into a Map of Strings to Strings
* These strings can be sent over a network to get a Frontier past a ' gap '
* @ param frontier the Frontier
* @ param modelText the model
* @ return the map of strings representing a ... | if ( ! ( frontier instanceof SCXMLFrontier ) ) { return null ; } TransitionTarget target = ( ( SCXMLFrontier ) frontier ) . getRoot ( ) . nextState ; Map < String , String > variables = ( ( SCXMLFrontier ) frontier ) . getRoot ( ) . variables ; Map < String , String > decomposition = new HashMap < String , String > ( )... |
public class StorageConnector { /** * The names of the domains for the account .
* @ param domains
* The names of the domains for the account . */
public void setDomains ( java . util . Collection < String > domains ) { } } | if ( domains == null ) { this . domains = null ; return ; } this . domains = new java . util . ArrayList < String > ( domains ) ; |
public class PutDestinationRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( PutDestinationRequest putDestinationRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( putDestinationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( putDestinationRequest . getDestinationName ( ) , DESTINATIONNAME_BINDING ) ; protocolMarshaller . marshall ( putDestinationRequest . getTargetArn ( ) , TARGETARN_B... |
public class CommentProcessor { /** * Produce a copy of a list of JavaDoc comments by pulling specified parameter tags out of an orignal list of comments .
* Block and EOL comments are skipped . JavaDoc comments are stripped down to only have the content of the specified
* param tag */
public List < JavaComment > p... | final List < JavaComment > results = new ArrayList < JavaComment > ( originals . size ( ) ) ; for ( JavaComment original : originals ) { original . _switch ( new JavaComment . SwitchBlock ( ) { @ Override public void _case ( JavaDocComment x ) { paramDocSections ( paramName , x . tagSections , results ) ; } @ Override ... |
public class PlaceholderSupport { /** * Adds placeholder support to a { @ link DifferenceEngineConfigurer } considering an additional { @ link DifferenceEvaluator } .
* @ param configurer the configurer to add support to
* @ param evaluator the additional evaluator - placeholder support is
* { @ link DifferenceEv... | return withPlaceholderSupportUsingDelimitersChainedAfter ( configurer , null , null , evaluator ) ; |
public class SocketStream { /** * Writes bytes to the socket .
* @ param buf byte buffer containing the bytes
* @ param offset offset into the buffer
* @ param length number of bytes to read
* @ param isEnd if the write is at a close .
* @ exception throws ClientDisconnectException if the connection is droppe... | if ( _os == null ) { if ( _s == null ) { return ; } _os = _s . getOutputStream ( ) ; } try { _needsFlush = true ; _os . write ( buf , offset , length ) ; _totalWriteBytes += length ; } catch ( IOException e ) { IOException exn = ClientDisconnectException . create ( this + ":" + e , e ) ; try { close ( ) ; } catch ( IOE... |
public class BinaryNode { /** * { @ inheritDoc } */
public Node mutate ( Random rng , Probability mutationProbability , TreeFactory treeFactory ) { } } | if ( mutationProbability . nextEvent ( rng ) ) { return treeFactory . generateRandomCandidate ( rng ) ; } else { Node newLeft = left . mutate ( rng , mutationProbability , treeFactory ) ; Node newRight = right . mutate ( rng , mutationProbability , treeFactory ) ; if ( newLeft != left && newRight != right ) { return ne... |
public class URLUtils { /** * Use URL context and one or more relocations to build end URL .
* @ param context first URL used like a context root for all relocation changes
* @ param relocations array of relocation URLs
* @ return end url after all changes made on context with relocations
* @ throws AssertionEr... | URL url = context ; for ( String move : relocations ) { try { url = new URL ( url , move ) ; } catch ( MalformedURLException e ) { throw new AssertionError ( "URL('" + url + "', '" + move + "') isn't valid URL" ) ; } } return url ; |
public class BackendBucketClient { /** * Adds a key for validating requests with signed URLs for this backend bucket .
* < p > Sample code :
* < pre > < code >
* try ( BackendBucketClient backendBucketClient = BackendBucketClient . create ( ) ) {
* ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBac... | AddSignedUrlKeyBackendBucketHttpRequest request = AddSignedUrlKeyBackendBucketHttpRequest . newBuilder ( ) . setBackendBucket ( backendBucket == null ? null : backendBucket . toString ( ) ) . setSignedUrlKeyResource ( signedUrlKeyResource ) . build ( ) ; return addSignedUrlKeyBackendBucket ( request ) ; |
public class EnaValidator { /** * Inits the arguments .
* @ param args the args
* @ param message the message
* @ throws SQLException
* @ throws IOException */
protected void init ( String [ ] args , String message ) throws SQLException , IOException { } } | Params params = new Params ( ) ; JCommander jc = new JCommander ( params ) ; jc . setProgramName ( "ena_validator <files>" ) ; try { jc . parse ( args ) ; } catch ( Exception e ) { System . err . println ( "Invalid options" ) ; if ( message == null ) { jc . usage ( ) ; writeReturnCodes ( ) ; } else System . out . print... |
public class DummyInternalTransaction { /** * ( non - Javadoc )
* @ see com . ibm . ws . objectManager . InternalTransaction # replaceFromCheckpoint ( com . ibm . ws . objectManager . ManagedObject , byte [ ] , com . ibm . ws . objectManager . Transaction ) */
public synchronized void replaceFromCheckpoint ( ManagedO... | throw new InvalidStateException ( this , InternalTransaction . stateTerminated , InternalTransaction . stateNames [ InternalTransaction . stateTerminated ] ) ; |
public class Selectors { /** * Find elements having attribute with given value .
* Examples :
* { @ code < div binding = " fieldValue " > < / div > }
* Find element with attribute ' binding ' EXACTLY containing text ' fieldValue ' , use :
* byAttribute ( " binding " , " fieldValue " )
* For finding difficult ... | return By . cssSelector ( String . format ( "[%s='%s']" , attributeName , attributeValue ) ) ; |
public class FormSpec { /** * Computes the maximum size for the given list of components , using this form spec and the
* specified measure . < p >
* Invoked by FormLayout to determine the size of one of my elements
* @ param container the layout container
* @ param components the list of components to measure ... | return size . maximumSize ( container , components , minMeasure , prefMeasure , defaultMeasure ) ; |
public class KamStoreServiceImpl { /** * { @ inheritDoc } */
@ Override public List < Citation > getCitations ( KamHandle kamHandle , CitationType citationType , List < String > valueList , BelDocument belDocument ) throws KamStoreServiceException { } } | List < Citation > list = new ArrayList < Citation > ( ) ; final String handle = kamHandle . getHandle ( ) ; try { org . openbel . framework . api . Kam objKam ; objKam = kamCacheService . getKam ( handle ) ; if ( objKam == null ) { throw new KamStoreServiceException ( format ( KAM_REQUEST_NO_KAM_FOR_HANDLE , kamHandle ... |
public class DateTimeExpression { /** * Create an expression representing the current time instant as a DateTimeExpression instance
* @ return current timestamp */
public static < T extends Comparable > DateTimeExpression < T > currentTimestamp ( Class < T > cl ) { } } | return Expressions . dateTimeOperation ( cl , Ops . DateTimeOps . CURRENT_TIMESTAMP ) ; |
public class Agg { /** * Get a { @ link Collector } that calculates the < code > MODE ( ) < / code > function . */
public static < T , U > Collector < T , ? , Seq < T > > modeAllBy ( Function < ? super T , ? extends U > function ) { } } | return Collector . of ( ( ) -> new LinkedHashMap < U , List < T > > ( ) , ( m , t ) -> m . compute ( function . apply ( t ) , ( k , l ) -> { List < T > result = l != null ? l : new ArrayList < > ( ) ; result . add ( t ) ; return result ; } ) , ( m1 , m2 ) -> { for ( Entry < U , List < T > > e : m2 . entrySet ( ) ) { Li... |
public class RefersToDaggerCodegen { /** * instead of checking for subtypes of generated code */
private static boolean isGeneratedFactoryType ( ClassSymbol symbol , VisitorState state ) { } } | // TODO ( ronshapiro ) : check annotation creators , inaccessible map key proxies , or inaccessible
// module constructor proxies ?
return GENERATED_BASE_TYPES . stream ( ) . anyMatch ( baseType -> isGeneratedBaseType ( symbol , state , baseType ) ) ; |
public class InternalSimpleExpressionsParser { /** * InternalSimpleExpressions . g : 67:1 : entryRuleIfCondition returns [ EObject current = null ] : iv _ ruleIfCondition = ruleIfCondition EOF ; */
public final EObject entryRuleIfCondition ( ) throws RecognitionException { } } | EObject current = null ; EObject iv_ruleIfCondition = null ; try { // InternalSimpleExpressions . g : 68:2 : ( iv _ ruleIfCondition = ruleIfCondition EOF )
// InternalSimpleExpressions . g : 69:2 : iv _ ruleIfCondition = ruleIfCondition EOF
{ newCompositeNode ( grammarAccess . getIfConditionRule ( ) ) ; pushFollow ( FO... |
public class Roster { /** * Changes the presence of available contacts offline by simulating an unavailable
* presence sent from the server . */
private void setOfflinePresences ( ) { } } | Presence packetUnavailable ; outerloop : for ( Jid user : presenceMap . keySet ( ) ) { Map < Resourcepart , Presence > resources = presenceMap . get ( user ) ; if ( resources != null ) { for ( Resourcepart resource : resources . keySet ( ) ) { packetUnavailable = new Presence ( Presence . Type . unavailable ) ; EntityB... |
public class MessageBuilder { /** * Appends a sting with or without decoration to the message .
* @ param message The string to append .
* @ param decorations The decorations of the string .
* @ return The current instance in order to chain call methods . */
public MessageBuilder append ( String message , Message... | delegate . append ( message , decorations ) ; return this ; |
public class TypedLinkAttributeDefinition { /** * Validation rules that are attached to the attribute definition .
* @ param rules
* Validation rules that are attached to the attribute definition .
* @ return Returns a reference to this object so that method calls can be chained together . */
public TypedLinkAttr... | setRules ( rules ) ; return this ; |
public class CompileStack { /** * Causes the state - stack to add an element and sets
* the given scope as new current variable scope . Creates
* a element for the state stack so pop has to be called later */
public void pushVariableScope ( VariableScope el ) { } } | pushState ( ) ; scope = el ; superBlockNamedLabels = new HashMap ( superBlockNamedLabels ) ; superBlockNamedLabels . putAll ( currentBlockNamedLabels ) ; currentBlockNamedLabels = new HashMap ( ) ; |
public class Checker { /** * 检查Short是否为null
* @ param value 值
* @ param elseValue 为null返回的值
* @ return { @ link Short }
* @ since 1.0.8 */
public static Short checkNull ( Short value , short elseValue ) { } } | return checkNull ( value , Short . valueOf ( elseValue ) ) ; |
public class RevisionApi { /** * Returns the by the article ID and revisionCounter specified revision . Note that this method
* returns the revision in chronological order .
* @ param articleID
* ID of the article
* @ param revisionCounter
* number of revision
* @ return Revision
* @ throws WikiApiExcepti... | try { if ( articleID < 1 || revisionCounter < 1 ) { throw new IllegalArgumentException ( ) ; } int revisionIndex = checkMapping ( articleID , revisionCounter ) ; String fullRevisions , revCounters ; PreparedStatement statement = null ; ResultSet result = null ; try { statement = this . connection . prepareStatement ( "... |
public class DataSinkTask { /** * Initializes the OutputFormat implementation and configuration .
* @ throws RuntimeException
* Throws if instance of OutputFormat implementation can not be
* obtained . */
private void initOutputFormat ( ) { } } | if ( this . userCodeClassLoader == null ) { try { this . userCodeClassLoader = LibraryCacheManager . getClassLoader ( getEnvironment ( ) . getJobID ( ) ) ; } catch ( IOException ioe ) { throw new RuntimeException ( "Library cache manager could not be instantiated." , ioe ) ; } } // obtain task configuration ( including... |
public class SBT013Logger { /** * Send a message to the user in the < b > error < / b > error level
* if the < b > error < / b > error level is enabled .
* @ param msg message */
@ Override public void error ( F0 < String > msg ) { } } | if ( compilerLogger . isErrorEnabled ( ) ) { String msgString = msg . apply ( ) ; errors . append ( msgString ) . append ( '\n' ) ; compilerLogger . error ( msgString ) ; } |
public class CookieBasedSessionManagementHelper { /** * Modifies a message so its Request Header / Body matches the web session provided .
* @ param message the message
* @ param requestCookies a pre - computed list with the request cookies ( for optimization reasons )
* @ param session the session */
public stat... | // Make a copy of the session tokens set , as they will be modified
HttpSessionTokensSet tokensSet = session . getTokensNames ( ) ; // If no tokens exists create dummy Object - > NPE
if ( tokensSet == null ) { tokensSet = new HttpSessionTokensSet ( ) ; } Set < String > unsetSiteTokens = new LinkedHashSet < > ( tokensSe... |
public class ArgumentProvider { /** * Removes matrix params from path
* @ param path to clean up
* @ param definition to check if matrix params are present
* @ return cleaned up path */
private static String removeMatrixFromPath ( String path , RouteDefinition definition ) { } } | // simple removal . . . we don ' t care what matrix attributes were given
if ( definition . hasMatrixParams ( ) ) { int index = path . indexOf ( ";" ) ; if ( index > 0 ) { return path . substring ( 0 , index ) ; } } return path ; |
public class Admin { /** * @ throws PageException */
private void doVerifyDatasource ( ) throws PageException { } } | ClassDefinition cd = new ClassDefinitionImpl ( Caster . toString ( attributes . get ( "classname" , null ) , null ) , Caster . toString ( attributes . get ( "bundleName" , null ) , null ) , Caster . toString ( attributes . get ( "bundleVersion" , null ) , null ) , config . getIdentification ( ) ) ; String connStr = ( S... |
public class ObjectSwingRenderer { /** * Calls { @ link Object # toString ( ) } on the specified entity and creates
* a { @ link JTextArea } containing that text .
* @ param entity The evolved entity to render .
* @ return A text area containing the string representation of the entity . */
public JComponent rende... | JTextArea text = new JTextArea ( entity . toString ( ) ) ; text . setEditable ( false ) ; text . setBackground ( null ) ; text . setLineWrap ( true ) ; text . setWrapStyleWord ( true ) ; return text ; |
public class Bzip2BlockDecompressor { /** * Decodes a byte from the Burrows - Wheeler Transform stage . If the block has randomisation
* applied , reverses the randomisation .
* @ return The decoded byte */
private int decodeNextBWTByte ( ) { } } | int mergedPointer = bwtCurrentMergedPointer ; int nextDecodedByte = mergedPointer & 0xff ; bwtCurrentMergedPointer = bwtMergedPointers [ mergedPointer >>> 8 ] ; if ( blockRandomised ) { if ( -- randomCount == 0 ) { nextDecodedByte ^= 1 ; randomIndex = ( randomIndex + 1 ) % 512 ; randomCount = Bzip2Rand . rNums ( random... |
public class AppcastManager { /** * Fetch an appcast from the given URL
* @ param url The update URL
* @ param proxy proxy data
* @ param connectTimeout the connect timeout in milliseconds
* @ param readTimeout the read timeout in milliseconds
* @ return The fetched appcast content
* @ throws AppcastExcepti... | return fetch ( url , proxy , connectTimeout , readTimeout , null ) ; |
public class QueryCacheUtil { /** * Returns { @ code PartitionAccumulatorRegistry } of a { @ code QueryCache } .
* @ see PartitionAccumulatorRegistry */
public static PartitionAccumulatorRegistry getAccumulatorRegistryOrNull ( QueryCacheContext context , String mapName , String cacheId ) { } } | PublisherContext publisherContext = context . getPublisherContext ( ) ; MapPublisherRegistry mapPublisherRegistry = publisherContext . getMapPublisherRegistry ( ) ; PublisherRegistry publisherRegistry = mapPublisherRegistry . getOrNull ( mapName ) ; if ( publisherRegistry == null ) { return null ; } return publisherReg... |
public class Stream { /** * Terminal operation returning the number of elements in this Stream . Note that only few
* elements are materialized at any time , so it is safe to use this method with arbitrarily
* large Streams .
* @ return the number of elements in this Stream */
public final long count ( ) { } } | final AtomicLong result = new AtomicLong ( ) ; toHandler ( new Handler < T > ( ) { private long count ; @ Override public void handle ( final T element ) { if ( element != null ) { ++ this . count ; } else { result . set ( this . count ) ; } } } ) ; return result . get ( ) ; |
public class SyncMembersInner { /** * Lists sync members in the given sync group .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; SyncMemberInne... | return listBySyncGroupNextSinglePageAsync ( nextPageLink ) . concatMap ( new Func1 < ServiceResponse < Page < SyncMemberInner > > , Observable < ServiceResponse < Page < SyncMemberInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < SyncMemberInner > > > call ( ServiceResponse < Page < SyncMember... |
public class QueryUtil { /** * Get a similarity query , automatically choosing a relation .
* @ param < O > Object type
* @ param database Database
* @ param similarityFunction Similarity function
* @ param hints Optimizer hints
* @ return Similarity Query */
public static < O > SimilarityQuery < O > getSimil... | final Relation < O > objectQuery = database . getRelation ( similarityFunction . getInputTypeRestriction ( ) , hints ) ; return database . getSimilarityQuery ( objectQuery , similarityFunction , hints ) ; |
public class ViolationThresholdComparator { /** * Computes the feasibility ratio
* Return the ratio of feasible solutions */
public double feasibilityRatio ( List < S > solutionSet ) { } } | double aux = 0.0 ; for ( int i = 0 ; i < solutionSet . size ( ) ; i ++ ) { if ( overallConstraintViolation . getAttribute ( solutionSet . get ( i ) ) < 0 ) { aux = aux + 1.0 ; } } return aux / ( double ) solutionSet . size ( ) ; |
public class JOGLTypeConversions { /** * Convert framebuffer status to GL constants .
* @ param status The status .
* @ return The resulting GL constant . */
public static int framebufferStatusToGL ( final JCGLFramebufferStatus status ) { } } | switch ( status ) { case FRAMEBUFFER_STATUS_COMPLETE : return GL . GL_FRAMEBUFFER_COMPLETE ; case FRAMEBUFFER_STATUS_ERROR_INCOMPLETE_ATTACHMENT : return GL . GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT ; case FRAMEBUFFER_STATUS_ERROR_MISSING_IMAGE_ATTACHMENT : return GL . GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT ; case F... |
public class CPDefinitionLinkLocalServiceBaseImpl { /** * Performs a dynamic query on the database and returns the matching rows .
* @ param dynamicQuery the dynamic query
* @ return the matching rows */
@ Override public < T > List < T > dynamicQuery ( DynamicQuery dynamicQuery ) { } } | return cpDefinitionLinkPersistence . findWithDynamicQuery ( dynamicQuery ) ; |
public class SafeTypeface { /** * Create a new typeface from the specified font file .
* @ param path The full path to the font data .
* @ return The new typeface . */
public static Typeface createFromFile ( @ Nullable String path ) { } } | Typeface typeface = TYPEFACES . get ( path ) ; if ( typeface != null ) { return typeface ; } else { typeface = Typeface . createFromFile ( path ) ; TYPEFACES . put ( path , typeface ) ; return typeface ; } |
public class LiteralType { /** * Parses the .
* @ param input the input
* @ return the literal type */
public static LiteralType parse ( String input ) { } } | LiteralType result = new LiteralType ( ) ; parse ( result , input ) ; return result ; |
public class LinkedWorkspacesInner { /** * Retrieve the linked workspace for the account id .
* @ param resourceGroupName Name of an Azure Resource group .
* @ param automationAccountName The name of the automation account .
* @ param serviceCallback the async ServiceCallback to handle successful and failed respo... | return ServiceFuture . fromResponse ( getWithServiceResponseAsync ( resourceGroupName , automationAccountName ) , serviceCallback ) ; |
public class BinaryTreeAddressableHeap { /** * { @ inheritDoc } */
@ Override @ LogarithmicTime @ SuppressWarnings ( "unchecked" ) public AddressableHeap . Handle < K , V > insert ( K key , V value ) { } } | if ( key == null ) { throw new NullPointerException ( "Null keys not permitted" ) ; } Node n = new Node ( key , value ) ; // easy special cases
if ( size == 0 ) { root = n ; size = 1 ; return n ; } else if ( size == 1 ) { int c ; if ( comparator == null ) { c = ( ( Comparable < ? super K > ) key ) . compareTo ( root . ... |
public class IdDt { /** * Returns a view of this ID as a fully qualified URL , given a server base and resource name ( which will only be used if the ID does not already contain those respective parts ) . Essentially ,
* because IdDt can contain either a complete URL or a partial one ( or even jut a simple ID ) , thi... | if ( isLocal ( ) || isUrn ( ) ) { return new IdDt ( getValueAsString ( ) ) ; } return new IdDt ( theServerBase , theResourceType , getIdPart ( ) , getVersionIdPart ( ) ) ; |
public class ListJobTemplatesResult { /** * List of Job templates .
* @ param jobTemplates
* List of Job templates . */
public void setJobTemplates ( java . util . Collection < JobTemplate > jobTemplates ) { } } | if ( jobTemplates == null ) { this . jobTemplates = null ; return ; } this . jobTemplates = new java . util . ArrayList < JobTemplate > ( jobTemplates ) ; |
public class VFSUtils { /** * Copy input stream to output stream and close them both
* @ param is input stream
* @ param os output stream
* @ throws IOException for any error */
public static void copyStreamAndClose ( InputStream is , OutputStream os ) throws IOException { } } | copyStreamAndClose ( is , os , DEFAULT_BUFFER_SIZE ) ; |
public class DeleteReplicationInstanceRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteReplicationInstanceRequest deleteReplicationInstanceRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteReplicationInstanceRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteReplicationInstanceRequest . getReplicationInstanceArn ( ) , REPLICATIONINSTANCEARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientExcep... |
public class AuthorizationPrincipalHelper { /** * Convenience method for converting an IPerson to an IAuthorizationPrincipal .
* @ param user a non - null valid IPerson
* @ return an IAuthorizationPrincipal representing that user
* @ throws IllegalArgumentException if the user object is null or defective .
* @ ... | Validate . notNull ( user , "Cannot determine an authorization principal for null user." ) ; final EntityIdentifier userEntityIdentifier = user . getEntityIdentifier ( ) ; Validate . notNull ( user , "The user object is defective: lacks entity identifier." ) ; final String userEntityKey = userEntityIdentifier . getKey ... |
public class CircuitBreaker { /** * - - - CALL SERVICE - - - */
@ Override protected Promise call ( String name , Tree params , Options opts , PacketStream stream , Context parent , String targetID , int remaining ) { } } | EndpointKey endpointKey = null ; ErrorCounter errorCounter = null ; try { // Get the first recommended Endpoint and Error Counter
ActionEndpoint action = ( ActionEndpoint ) serviceRegistry . getAction ( name , targetID ) ; String nodeID = action . getNodeID ( ) ; endpointKey = new EndpointKey ( nodeID , name ) ; errorC... |
public class LocalDeviceResourceDataMarshaller { /** * Marshall the given parameter object . */
public void marshall ( LocalDeviceResourceData localDeviceResourceData , ProtocolMarshaller protocolMarshaller ) { } } | if ( localDeviceResourceData == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( localDeviceResourceData . getGroupOwnerSetting ( ) , GROUPOWNERSETTING_BINDING ) ; protocolMarshaller . marshall ( localDeviceResourceData . getSourcePath ( ) , ... |
public class DocFinder { /** * Search for the requested comments in the given element . If it does not
* have comments , return documentation from the overridden element if possible .
* If the overridden element does not exist or does not have documentation to
* inherit , search for documentation to inherit from ... | Output output = new Output ( ) ; Utils utils = configuration . utils ; if ( input . isInheritDocTag ) { // Do nothing because " element " does not have any documentation .
// All it has is { @ inheritDoc } .
} else if ( input . taglet == null ) { // We want overall documentation .
output . inlineTags = input . isFirstS... |
public class PocketKnife { /** * Bind annotated fields in the specified { @ link android . support . v4 . app . Fragment } from its arguments .
* @ param fragment fragment to bind the arguments ; */
public static void bindArguments ( android . support . v4 . app . Fragment fragment ) { } } | bindArguments ( fragment , fragment . getArguments ( ) ) ; |
public class GetContentModerationResult { /** * The detected moderation labels and the time ( s ) they were detected .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setModerationLabels ( java . util . Collection ) } or { @ link # withModerationLabels ( java... | if ( this . moderationLabels == null ) { setModerationLabels ( new java . util . ArrayList < ContentModerationDetection > ( moderationLabels . length ) ) ; } for ( ContentModerationDetection ele : moderationLabels ) { this . moderationLabels . add ( ele ) ; } return this ; |
public class El { /** * Returns method in text form . Format is
* & lt ; canonical name of method class & gt ; ' ' & lt ; method name & gt ; ' ( ' arguments ' ) '
* Arguments is a comma separated list of argument type names . Argument type name
* is canonical name of argument class . Arrays however are printed wi... | if ( method == null ) { return "" ; } StringBuilder sb = new StringBuilder ( ) ; TypeElement te = ( TypeElement ) method . getEnclosingElement ( ) ; sb . append ( te . getQualifiedName ( ) ) ; sb . append ( ' ' ) ; sb . append ( method . getSimpleName ( ) ) ; sb . append ( '(' ) ; boolean f = true ; for ( VariableEleme... |
public class AbstractMetricGroup { public void close ( ) { } } | synchronized ( this ) { if ( ! closed ) { closed = true ; // close all subgroups
for ( AbstractMetricGroup group : groups . values ( ) ) { group . close ( ) ; } groups . clear ( ) ; // un - register all directly contained metrics
for ( Map . Entry < String , Metric > metric : metrics . entrySet ( ) ) { registry . unreg... |
public class PropertiesEscape { /** * Perform a Java Properties Key level 1 ( only basic set ) < strong > escape < / strong > operation
* on a < tt > Reader < / tt > input , writing results to a < tt > Writer < / tt > .
* < em > Level 1 < / em > means this method will only escape the Java Properties Key basic escap... | escapePropertiesKey ( reader , writer , PropertiesKeyEscapeLevel . LEVEL_1_BASIC_ESCAPE_SET ) ; |
public class GoogleAuthenticatorAccountCouchDbRepository { /** * Delete token without revision checks .
* @ param token token to delete */
@ UpdateHandler ( name = "delete_token_account" , file = "CouchDbOneTimeTokenAccount_delete.js" ) public void deleteTokenAccount ( final CouchDbGoogleAuthenticatorAccount token ) ... | db . callUpdateHandler ( stdDesignDocumentId , "delete_token_account" , token . getCid ( ) , null ) ; |
public class SequenceScalePanel { /** * draw the Scale
* @ param g2D
* @ param y the height on which to draw the scale
* @ return the new y position */
protected int drawScale ( Graphics2D g2D , int y ) { } } | // only draw within the ranges of the Clip
Rectangle drawHere = g2D . getClipBounds ( ) ; g2D . setColor ( SCALE_COLOR ) ; int aminosize = Math . round ( 1 * scale ) ; if ( aminosize < 1 ) aminosize = 1 ; int startpos = coordManager . getSeqPos ( drawHere . x ) ; int endpos = coordManager . getSeqPos ( drawHere . x + d... |
public class AcsURLEncoder { /** * used for encoding queries or form data */
public static String encode ( String value ) throws UnsupportedEncodingException { } } | if ( isNullOrEmpty ( value ) ) return value ; return URLEncoder . encode ( value , URL_ENCODING ) ; |
public class CompiledTemplate { /** * This method is called by JavaClassGenerator during the compile phase . It overrides the
* method in CompilationUnit and returns just the reflected template signature . */
public Template getParseTree ( ) { } } | getTemplateClass ( ) ; if ( findExecuteMethod ( ) == null ) throw new IllegalArgumentException ( "Cannot locate compiled template entry point." ) ; reflectParameters ( ) ; mTree = new Template ( mCallerInfo , new Name ( mCallerInfo , getName ( ) ) , mParameters , mSubParam , null , null ) ; mTree . setReturnType ( new ... |
public class TypeSpecificSerializer { /** * / * PRIMITIVES */
@ Override public Void process ( ByteBuffer buf , boolean value ) { } } | buf . put ( Ser . bool2byte ( value ) ) ; return null ; |
public class nsip6 { /** * Use this API to unset the properties of nsip6 resources .
* Properties that need to be unset are specified in args array . */
public static base_responses unset ( nitro_service client , String ipv6address [ ] , String args [ ] ) throws Exception { } } | base_responses result = null ; if ( ipv6address != null && ipv6address . length > 0 ) { nsip6 unsetresources [ ] = new nsip6 [ ipv6address . length ] ; for ( int i = 0 ; i < ipv6address . length ; i ++ ) { unsetresources [ i ] = new nsip6 ( ) ; unsetresources [ i ] . ipv6address = ipv6address [ i ] ; } result = unset_b... |
public class FileHandlerUtil { /** * Generate output file path .
* @ param path the path
* @ param fileName the file name
* @ return the string */
public static String generateOutputFilePath ( String path , String fileName ) { } } | String tempPath = separatorsToSystem ( path ) ; tempPath = tempPath + File . separatorChar + fileName ; return tempPath ; |
public class VersionsHandler { /** * Find - out the last release version in a list of version ( regarding Axway Conventions )
* @ param versions
* @ return String
* @ throws IncomparableException */
public String getLastRelease ( final Collection < String > versions ) { } } | final List < Version > sorted = versions . stream ( ) . filter ( Version :: isValid ) // filter invalid input values
. map ( Version :: make ) . filter ( Optional :: isPresent ) . map ( Optional :: get ) . filter ( Version :: isRelease ) . sorted ( ( v1 , v2 ) -> { try { return v1 . compare ( v2 ) ; } catch ( Incompara... |
public class Math { /** * This method solves the unconstrained minimization problem
* < pre >
* min f ( x ) , x = ( x1 , x2 , . . . , x _ n ) ,
* < / pre >
* using the BFGS method .
* @ param func the function to be minimized .
* @ param x on initial entry this must be set by the user to the values
* of t... | // The convergence criterion on x values .
final double TOLX = 4 * EPSILON ; // The scaled maximum step length allowed in line searches .
final double STPMX = 100.0 ; double den , fac , fad , fae , sumdg , sumxi , temp , test ; int n = x . length ; double [ ] dg = new double [ n ] ; double [ ] g = new double [ n ] ; do... |
public class AbstractHandlerDefinition { /** * Creates the default { @ linkplain org . jboss . as . controller . SimpleResourceDefinition . Parameters parameters } for
* creating the source .
* @ param path the resource path
* @ param type the known type of the resource or { @ code null } if the type is unknown
... | return new Parameters ( path , LoggingExtension . getResourceDescriptionResolver ( path . getKey ( ) ) ) . setAddHandler ( new HandlerOperations . HandlerAddOperationStepHandler ( propertySorter , type , addAttributes , constructionProperties ) ) . setRemoveHandler ( HandlerOperations . REMOVE_HANDLER ) . setCapabiliti... |
public class ZaurusTableForm { /** * generate the Where - condition for the words */
private String generateWhere ( String [ ] words , boolean allWords , boolean ignoreCase , boolean noMatchWhole ) { } } | String result = "" ; // if all words must match use AND between the different conditions
String join ; if ( allWords ) { join = " AND " ; } else { join = " OR " ; } // end of else
for ( int wordInd = 0 ; wordInd < words . length ; wordInd ++ ) { String oneCondition = "" ; for ( int col = 0 ; col < columns . length ; co... |
public class DITableInfo { /** * Retrieves whether the specified column is nullable . < p >
* If the column is nullable , " YES " is retrieved , else " NO " . < p >
* @ param i zero - based column index
* @ return the nullability of the specified column */
String getColIsNullable ( int i ) { } } | ColumnSchema column = table . getColumn ( i ) ; return ( column . isNullable ( ) && ! column . isPrimaryKey ( ) ) ? "YES" : "NO" ; |
public class DefaultComparisonFormatter { /** * Formats a processing instruction for { @ link # getShortString } .
* @ param sb the builder to append to
* @ param instr the processing instruction
* @ since XMLUnit 2.4.0 */
protected void appendProcessingInstruction ( StringBuilder sb , ProcessingInstruction instr... | sb . append ( "<?" ) . append ( instr . getTarget ( ) ) . append ( ' ' ) . append ( instr . getData ( ) ) . append ( "?>" ) ; |
public class CommercePaymentMethodGroupRelPersistenceImpl { /** * Returns the commerce payment method group rel with the primary key or returns < code > null < / code > if it could not be found .
* @ param primaryKey the primary key of the commerce payment method group rel
* @ return the commerce payment method gro... | Serializable serializable = entityCache . getResult ( CommercePaymentMethodGroupRelModelImpl . ENTITY_CACHE_ENABLED , CommercePaymentMethodGroupRelImpl . class , primaryKey ) ; if ( serializable == nullModel ) { return null ; } CommercePaymentMethodGroupRel commercePaymentMethodGroupRel = ( CommercePaymentMethodGroupRe... |
public class CompilingLoader { /** * Checks that the case is okay for the source . */
boolean checkSource ( PathImpl sourceDir , String javaName ) { } } | try { while ( javaName != null && ! javaName . equals ( "" ) ) { int p = javaName . indexOf ( '/' ) ; String head ; if ( p >= 0 ) { head = javaName . substring ( 0 , p ) ; javaName = javaName . substring ( p + 1 ) ; } else { head = javaName ; javaName = null ; } String [ ] names = sourceDir . list ( ) ; int i ; for ( i... |
public class References { /** * do not return full paths - - security ! */
public static String location ( Node node ) { } } | String name ; int idx ; if ( node instanceof ZipNode ) { name = ( ( ZipNode ) node ) . getRoot ( ) . getZip ( ) . getName ( ) ; idx = name . lastIndexOf ( '/' ) ; if ( idx >= 0 ) { name = name . substring ( idx + 1 ) ; } return "zip:" + name + "/" + node . getPath ( ) ; } else if ( node instanceof FileNode ) { return "... |
public class StepProgress { /** * Do a new step and log it
* @ param step Step number
* @ param stepTitle Step title
* @ param logger Logger to report to . */
public void beginStep ( int step , String stepTitle , Logging logger ) { } } | setProcessed ( step - 1 ) ; this . stepTitle = stepTitle ; logger . progress ( this ) ; |
public class CaretSelectionBindImpl { /** * Assumes that { @ code getArea ( ) . getLength ! = 0 } is true and { @ link BreakIterator # setText ( String ) } has been called */
private int calculatePositionViaBreakingForwards ( int numOfBreaks , BreakIterator breakIterator , int position ) { } } | breakIterator . following ( position ) ; for ( int i = 1 ; i < numOfBreaks ; i ++ ) { breakIterator . next ( numOfBreaks ) ; } return breakIterator . current ( ) ; |
public class Utils { /** * Strips a string from HTML markup . Elements { @ code < br > } , { @ code < p > } , { @ code < h1 > } ,
* { @ code < h2 > } and { @ code < h3 > } are replaced with with new line . This produces
* a string which is readable as plain text .
* Note : The method is simple and crude . It will... | if ( str == null ) { return null ; } if ( str . isEmpty ( ) ) { return str ; } boolean intag = false ; boolean tagHasEnded = false ; StringBuilder outp = new StringBuilder ( ) ; StringBuilder tagName = new StringBuilder ( ) ; boolean ignoreContents = false ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { char ch = s... |
public class PluginsAlertConditionCache { /** * Adds the condition list to the conditions for the account .
* @ param conditions The conditions to add */
public void add ( Collection < PluginsAlertCondition > conditions ) { } } | for ( PluginsAlertCondition condition : conditions ) this . conditions . put ( condition . getId ( ) , condition ) ; |
public class ClassFile { /** * Add a constructor to this class .
* @ param params May be null if constructor accepts no parameters . */
public MethodInfo addConstructor ( Modifiers modifiers , TypeDesc ... params ) { } } | String [ ] paramNames = MethodDesc . createGenericParameterNames ( params ) ; return addConstructor ( modifiers , params , paramNames ) ; |
public class GetStatusPResponse { /** * < code > optional . alluxio . grpc . file . FileInfo fileInfo = 1 ; < / code > */
public alluxio . grpc . FileInfo getFileInfo ( ) { } } | return fileInfo_ == null ? alluxio . grpc . FileInfo . getDefaultInstance ( ) : fileInfo_ ; |
public class MainPartExtracter { /** * 对问题进行分词 如 : APDPlat的发起人是谁 ? 分词之后返回 : apdplat 的 发起人 是 谁 ?
* @ param question 问题
* @ return 分词之后的用空格顺序连接的结果 */
private String questionParse ( String question ) { } } | // 分词
LOG . info ( "对问题进行分词:" + question ) ; List < Word > words = WordParser . parse ( question ) ; StringBuilder wordStr = new StringBuilder ( ) ; for ( Word word : words ) { wordStr . append ( word . getText ( ) ) . append ( " " ) ; } LOG . info ( "分词结果为:" + wordStr . toString ( ) . trim ( ) ) ; return wordStr . toS... |
public class IncomingDataPoints { /** * Copies the specified byte array at the specified offset in the row key .
* @ param row
* The row key into which to copy the bytes .
* @ param offset
* The offset in the row key to start writing at .
* @ param bytes
* The bytes to copy . */
private static void copyInRo... | System . arraycopy ( bytes , 0 , row , offset , bytes . length ) ; |
public class EntryInfo { /** * This gets the inactivity timer for this cache entry .
* @ return the inactivity timer for this cache entry .
* @ ibm - private - in - use */
public int getInactivity ( ) { } } | // CPF - Inactivity
if ( com . ibm . ws . cache . TimeLimitDaemon . UNIT_TEST_INACTIVITY ) { System . out . println ( "EntryInfo.getInactivity() " + inactivity ) ; } return inactivity ; |
public class XmlInputStream { /** * Reads the next length of bytes from the stream into the given byte array
* at the given offset .
* @ param data the buffer to store the data read
* @ param offset the offset in the buffer to start writing
* @ param length the length of data to read
* @ return the number of ... | final StringBuilder s = read ( length ) ; int n = 0 ; for ( int i = 0 ; i < Math . min ( length , s . length ( ) ) ; i ++ ) { data [ offset + i ] = ( byte ) s . charAt ( i ) ; n += 1 ; } given ( s , length , n ) ; return n > 0 ? n : - 1 ; |
public class AlluxioStatusException { /** * Converts a gRPC StatusRuntimeException to an Alluxio status exception .
* @ param e a gRPC StatusRuntimeException
* @ return the converted { @ link AlluxioStatusException } */
public static AlluxioStatusException fromStatusRuntimeException ( StatusRuntimeException e ) { }... | return AlluxioStatusException . from ( e . getStatus ( ) . withCause ( e ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.