signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Ssh2Context { /** * Set the preferred compression for the Server - > Client stream .
* @ param name
* @ throws SshException */
public void setPreferredCompressionSC ( String name ) throws SshException { } } | if ( name == null ) return ; if ( compressionsSC . contains ( name ) ) { prefCompressionSC = name ; } else { throw new SshException ( name + " is not supported" , SshException . UNSUPPORTED_ALGORITHM ) ; } |
public class UnclosableOutputStream { /** * Call directly the function { @ link OutputStream # write ( byte [ ] , int , int ) } on the filtered stream . */
@ Override public void write ( byte [ ] buffer , int offset , int len ) throws IOException { } } | this . out . write ( buffer , offset , len ) ; |
public class BytesUtils { /** * Convert byte array to binary String
* @ param pBytes
* byte array to convert
* @ return a binary representation of the byte array */
public static String toBinary ( final byte [ ] pBytes ) { } } | String ret = null ; if ( pBytes != null && pBytes . length > 0 ) { BigInteger val = new BigInteger ( bytesToStringNoSpace ( pBytes ) , HEXA ) ; StringBuilder build = new StringBuilder ( val . toString ( 2 ) ) ; // left pad with 0 to fit byte size
for ( int i = build . length ( ) ; i < pBytes . length * BitUtils . BYTE_... |
public class BinaryStringUtils { /** * Returns { @ code binaryString } zero - padded separated by { @ code seaparator } in groups of 4. */
public static final String prettyPrint ( final String binaryString , final char separator ) { } } | String paddedBinaryString = zeroPadString ( binaryString ) ; List < String > splitted = Splitter . fixedLength ( 4 ) . splitToList ( paddedBinaryString ) ; return Joiner . on ( separator ) . join ( splitted ) ; |
public class ServerCalls { /** * Sets unimplemented status for method on given response stream for unary call .
* @ param methodDescriptor of method for which error will be thrown .
* @ param responseObserver on which error will be set . */
public static void asyncUnimplementedUnaryCall ( MethodDescriptor < ? , ? >... | checkNotNull ( methodDescriptor , "methodDescriptor" ) ; checkNotNull ( responseObserver , "responseObserver" ) ; responseObserver . onError ( Status . UNIMPLEMENTED . withDescription ( String . format ( "Method %s is unimplemented" , methodDescriptor . getFullMethodName ( ) ) ) . asRuntimeException ( ) ) ; |
public class Kafka08PartitionDiscoverer { /** * Validate that at least one seed broker is valid in case of a
* ClosedChannelException .
* @ param seedBrokers
* array containing the seed brokers e . g . [ " host1 : port1 " ,
* " host2 : port2 " ]
* @ param exception
* instance */
private static void validate... | if ( ! ( exception instanceof ClosedChannelException ) ) { return ; } int unknownHosts = 0 ; for ( String broker : seedBrokers ) { URL brokerUrl = NetUtils . getCorrectHostnamePort ( broker . trim ( ) ) ; try { InetAddress . getByName ( brokerUrl . getHost ( ) ) ; } catch ( UnknownHostException e ) { unknownHosts ++ ; ... |
public class Resource { /** * Sets the Base Calendar field indicates which calendar is the base calendar
* for a resource calendar . The list includes the three built - in calendars ,
* as well as any new base calendars you have created in the Change Working
* Time dialog box .
* @ param val calendar name */
pu... | set ( ResourceField . BASE_CALENDAR , val == null || val . length ( ) == 0 ? "Standard" : val ) ; |
public class DescribeTasksRequest { /** * A list of up to 100 task IDs or full ARN entries .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setTasks ( java . util . Collection ) } or { @ link # withTasks ( java . util . Collection ) } if you want to override... | if ( this . tasks == null ) { setTasks ( new com . amazonaws . internal . SdkInternalList < String > ( tasks . length ) ) ; } for ( String ele : tasks ) { this . tasks . add ( ele ) ; } return this ; |
public class AbstractGeneticAlgorithm { /** * A crossover operator is applied to a number of parents , and it assumed that the population contains
* a valid number of solutions . This method checks that .
* @ param population
* @ param numberOfParentsForCrossover */
protected void checkNumberOfParents ( List < S ... | if ( ( population . size ( ) % numberOfParentsForCrossover ) != 0 ) { throw new JMetalException ( "Wrong number of parents: the remainder if the " + "population size (" + population . size ( ) + ") is not divisible by " + numberOfParentsForCrossover ) ; } |
public class ConstructOffset { /** * static */
static Geometry execute ( Geometry inputGeometry , double distance , OperatorOffset . JoinType joins , double miterLimit , double tolerance , ProgressTracker progressTracker ) { } } | if ( inputGeometry == null ) throw new IllegalArgumentException ( ) ; if ( inputGeometry . getDimension ( ) < 1 ) // can offset Polygons and
// Polylines only
throw new IllegalArgumentException ( ) ; if ( distance == 0 || inputGeometry . isEmpty ( ) ) return inputGeometry ; ConstructOffset offset = new ConstructOffset ... |
public class BeanHelperCache { /** * Creates the appropriate BeanHelper for a property on a bean . */
private void doCreateHelperForProp ( final PropertyDescriptor propertyDescriptor , final BeanHelper parent , final TreeLogger logger , final GeneratorContext context ) throws UnableToCompleteException { } } | final Class < ? > elementClass = propertyDescriptor . getElementClass ( ) ; if ( GwtSpecificValidatorCreator . isIterableOrMap ( elementClass ) ) { if ( parent . hasField ( propertyDescriptor ) ) { final JClassType type = parent . getAssociationType ( propertyDescriptor , true ) ; this . createHelper ( type . getErased... |
public class ArgumentValueCallbackHandler { /** * / * ( non - Javadoc )
* @ see org . jboss . as . cli . parsing . ParsingStateCallbackHandler # leavingState ( org . jboss . as . cli . parsing . ParsingContext ) */
@ Override public void leavingState ( ParsingContext ctx ) throws CommandFormatException { } } | final String stateId = ctx . getState ( ) . getId ( ) ; // System . out . println ( " left " + stateId + " ' " + ctx . getCharacter ( ) + " ' " ) ;
if ( ArgumentValueState . ID . equals ( stateId ) || CompositeState . OBJECT . equals ( stateId ) || CompositeState . LIST . equals ( stateId ) ) { if ( ! currentState . is... |
public class policyexpression { /** * Use this API to fetch all the policyexpression resources that are configured on netscaler .
* This uses policyexpression _ args which is a way to provide additional arguments while fetching the resources . */
public static policyexpression [ ] get ( nitro_service service , policy... | policyexpression obj = new policyexpression ( ) ; options option = new options ( ) ; option . set_args ( nitro_util . object_to_string_withoutquotes ( args ) ) ; policyexpression [ ] response = ( policyexpression [ ] ) obj . get_resources ( service , option ) ; return response ; |
public class StringUtils { /** * Trim all occurrences of the supplied leading character from the given { @ code String } .
* @ param str the { @ code String } to check
* @ param leadingCharacter the leading character to be trimmed
* @ return the trimmed { @ code String } */
public static String trimLeadingCharact... | if ( ! StringUtils . hasLength ( str ) ) { return str ; } final StringBuilder sb = new StringBuilder ( str ) ; while ( sb . length ( ) > 0 && sb . charAt ( 0 ) == leadingCharacter ) { sb . deleteCharAt ( 0 ) ; } return sb . toString ( ) ; |
public class JCuda { /** * Copies data between host and device .
* < pre >
* cudaError _ t cudaMemcpyAsync (
* void * dst ,
* const void * src ,
* size _ t count ,
* cudaMemcpyKind kind ,
* cudaStream _ t stream = 0 )
* < / pre >
* < div >
* < p > Copies data between host and device .
* Copies < t... | return checkResult ( cudaMemcpyAsyncNative ( dst , src , count , cudaMemcpyKind_kind , stream ) ) ; |
public class Smb2TreeConnectRequest { /** * { @ inheritDoc }
* @ see jcifs . internal . smb2 . ServerMessageBlock2 # writeBytesWireFormat ( byte [ ] , int ) */
@ Override protected int writeBytesWireFormat ( byte [ ] dst , int dstIndex ) { } } | int start = dstIndex ; SMBUtil . writeInt2 ( 9 , dst , dstIndex ) ; SMBUtil . writeInt2 ( this . treeFlags , dst , dstIndex + 2 ) ; dstIndex += 4 ; byte [ ] data = this . path . getBytes ( StandardCharsets . UTF_16LE ) ; int offsetOffset = dstIndex ; SMBUtil . writeInt2 ( data . length , dst , dstIndex + 2 ) ; dstIndex... |
public class AbstractCalculator { /** * Append value to expression
* @ param value
* @ return */
public CALC val ( Object value ) { } } | Num val = null ; if ( value instanceof Num ) val = ( Num ) value ; else val = new Num ( value ) ; infix . add ( val ) ; return getThis ( ) ; |
public class DefaultWhenJerseyServer { /** * Returns a promise for asynchronously creating a { @ link JerseyServer }
* @ param options
* @ param jerseyOptions
* @ return a promise for the server */
@ Override public Promise < JerseyServer > createServer ( @ Nullable JerseyServerOptions options , @ Nullable Jersey... | final Deferred < JerseyServer > d = when . defer ( ) ; try { JerseyServer jerseyServer = jerseyServerProvider . get ( ) ; jerseyServer . start ( options , jerseyOptions , result -> { if ( result . succeeded ( ) ) { d . resolve ( jerseyServer ) ; } else { d . reject ( result . cause ( ) ) ; } } ) ; } catch ( RuntimeExce... |
public class AsmMetric { /** * a faster sampling way */
protected boolean sample ( ) { } } | if ( curr . increment ( ) >= freq ) { curr . set ( 0 ) ; target . set ( rand . nextInt ( freq ) ) ; } return curr . get ( ) == target . get ( ) ; |
public class SVGParser { /** * supported if we are to render this element */
private static Set < String > parseRequiredFormats ( String val ) { } } | TextScanner scan = new TextScanner ( val ) ; HashSet < String > result = new HashSet < > ( ) ; while ( ! scan . empty ( ) ) { String mimetype = scan . nextToken ( ) ; result . add ( mimetype ) ; scan . skipWhitespace ( ) ; } return result ; |
public class TransactionServiceMain { /** * The main method . It simply call methods in the same sequence
* as if the program is started by jsvc . */
public void doMain ( final String [ ] args ) throws Exception { } } | final CountDownLatch shutdownLatch = new CountDownLatch ( 1 ) ; Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ) { @ Override public void run ( ) { try { try { TransactionServiceMain . this . stop ( ) ; } finally { try { TransactionServiceMain . this . destroy ( ) ; } finally { shutdownLatch . countDown ( ) ... |
public class AbstractValueHolder { /** * Set the last time this entry was accessed in milliseconds .
* @ param lastAccessTime last time the entry was accessed */
public void setLastAccessTime ( long lastAccessTime ) { } } | while ( true ) { long current = this . lastAccessTime ; if ( current >= lastAccessTime ) { break ; } if ( ACCESSTIME_UPDATER . compareAndSet ( this , current , lastAccessTime ) ) { break ; } } |
public class ContextFromVertx { /** * Get the path parameter for the given key and convert it to Integer .
* The parameter will be decoded based on the RFCs .
* Check out http : / / docs . oracle . com / javase / 6 / docs / api / java / net / URI . html for
* more information .
* @ param key the key of the path... | String parameter = parameterFromPath ( key ) ; if ( parameter == null ) { return null ; } else { return Integer . parseInt ( parameter ) ; } |
public class MultiDeletionNeighbourhood { /** * Generates a move for the given subset solution that deselects a random subset of currently selected IDs .
* Possible fixed IDs are not considered to be deselected . The maximum number of deletions \ ( k \ ) and minimum
* allowed subset size are respected . If no items... | // get set of candidate IDs for deletion ( fixed IDs are discarded )
Set < Integer > delCandidates = getRemoveCandidates ( solution ) ; // compute maximum number of deletions
int curMaxDel = maxDeletions ( delCandidates , solution ) ; // return null if no removals are possible
if ( curMaxDel == 0 ) { return null ; } //... |
public class Vector2f { /** * Calculate the components of the vectors based on a angle
* @ param theta The angle to calculate the components from ( in degrees ) */
public void setTheta ( double theta ) { } } | // Next lines are to prevent numbers like - 1.8369701E - 16
// when working with negative numbers
if ( ( theta < - 360 ) || ( theta > 360 ) ) { theta = theta % 360 ; } if ( theta < 0 ) { theta = 360 + theta ; } double oldTheta = getTheta ( ) ; if ( ( theta < - 360 ) || ( theta > 360 ) ) { oldTheta = oldTheta % 360 ; } ... |
public class BatchCSVRecord { /** * Add a record
* @ param record */
public void add ( SingleCSVRecord record ) { } } | if ( records == null ) records = new ArrayList < > ( ) ; records . add ( record ) ; |
public class AmazonSimpleEmailServiceClient { /** * Composes an email message to multiple destinations . The message body is created using an email template .
* In order to send email using the < code > SendBulkTemplatedEmail < / code > operation , your call to the API must meet
* the following requirements :
* <... | request = beforeClientExecution ( request ) ; return executeSendBulkTemplatedEmail ( request ) ; |
public class ConnectSupport { /** * Complete the connection to the OAuth1 provider .
* @ param connectionFactory the service provider ' s connection factory e . g . FacebookConnectionFactory
* @ param request the current web request
* @ return a new connection to the service provider */
public Connection < ? > co... | String verifier = request . getParameter ( "oauth_verifier" ) ; AuthorizedRequestToken requestToken = new AuthorizedRequestToken ( extractCachedRequestToken ( request ) , verifier ) ; OAuthToken accessToken = connectionFactory . getOAuthOperations ( ) . exchangeForAccessToken ( requestToken , null ) ; return connection... |
public class Version { /** * < pre >
* A service with basic scaling will create an instance when the application
* receives a request . The instance will be turned down when the app becomes
* idle . Basic scaling is ideal for work that is intermittent or driven by
* user activity .
* < / pre >
* < code > . ... | if ( scalingCase_ == 4 ) { return ( com . google . appengine . v1 . BasicScaling ) scaling_ ; } return com . google . appengine . v1 . BasicScaling . getDefaultInstance ( ) ; |
public class AbstractMetaCache { /** * Removes the given object from the cache
* @ param oid oid of the object to remove */
public void remove ( Identity oid ) { } } | if ( oid == null ) return ; ObjectCache cache = getCache ( oid , null , METHOD_REMOVE ) ; if ( cache != null ) { cache . remove ( oid ) ; } |
public class AstRoot { /** * Add a comment to the comment set .
* @ param comment the comment node .
* @ throws IllegalArgumentException if comment is { @ code null } */
public void addComment ( Comment comment ) { } } | assertNotNull ( comment ) ; if ( comments == null ) { comments = new TreeSet < Comment > ( new AstNode . PositionComparator ( ) ) ; } comments . add ( comment ) ; comment . setParent ( this ) ; |
public class FiltersBuilder { /** * Filter by labels
* @ param labels
* { @ link Map } of labels that contains label keys and values */
public FiltersBuilder withLabels ( Map < String , String > labels ) { } } | withFilter ( "label" , labelsMapToList ( labels ) . toArray ( new String [ labels . size ( ) ] ) ) ; return this ; |
public class CCALocalSessionDataFactory { /** * / * ( non - Javadoc )
* @ see org . jdiameter . common . api . app . IAppSessionDataFactory # getAppSessionData ( java . lang . Class , java . lang . String ) */
@ Override public ICCASessionData getAppSessionData ( Class < ? extends AppSession > clazz , String sessionI... | if ( clazz . equals ( ClientCCASession . class ) ) { ClientCCASessionDataLocalImpl data = new ClientCCASessionDataLocalImpl ( ) ; data . setSessionId ( sessionId ) ; return data ; } else if ( clazz . equals ( ServerCCASession . class ) ) { ServerCCASessionDataLocalImpl data = new ServerCCASessionDataLocalImpl ( ) ; dat... |
public class AwsSecurityFindingFilters { /** * The source IPv6 address of network - related information about a finding .
* @ param networkSourceIpV6
* The source IPv6 address of network - related information about a finding . */
public void setNetworkSourceIpV6 ( java . util . Collection < IpFilter > networkSource... | if ( networkSourceIpV6 == null ) { this . networkSourceIpV6 = null ; return ; } this . networkSourceIpV6 = new java . util . ArrayList < IpFilter > ( networkSourceIpV6 ) ; |
public class ApplicationTenancyEvaluatorUsingPaths { /** * Protected visibility so can be overridden if required , eg using wildcard matches . */
protected boolean objectVisibleToUser ( String objectTenancyPath , String userTenancyPath ) { } } | // if in " same hierarchy "
return objectTenancyPath . startsWith ( userTenancyPath ) || userTenancyPath . startsWith ( objectTenancyPath ) ; |
public class Iterables { /** * Combine the iterables into a single one .
* @ param iterables
* @ return a single combined iterable */
public static < T > Iterable < T > concat ( final Iterable < ? extends Iterable < ? extends T > > iterables ) { } } | return ( ) -> Iterators . concat ( iterators ( iterables ) ) ; |
public class ContextUtils { /** * check whether is launcher or not .
* @ param intent
* @ return */
public static boolean isLauncherActivity ( Intent intent ) { } } | if ( intent == null ) return false ; if ( StringUtils . isNullOrEmpty ( intent . getAction ( ) ) ) { return false ; } if ( intent . getCategories ( ) == null ) return false ; return Intent . ACTION_MAIN . equals ( intent . getAction ( ) ) && intent . getCategories ( ) . contains ( Intent . CATEGORY_LAUNCHER ) ; |
public class Merger { /** * Get the view and digest and send back both ( MergeData ) in the form of a MERGE _ RSP to the sender .
* If a merge is already in progress , send back a MergeData with the merge _ rejected field set to true .
* @ param sender The address of the merge leader
* @ param merge _ id The merg... | try { _handleMergeRequest ( sender , merge_id , mbrs ) ; } catch ( Throwable t ) { log . error ( "%s: failure handling the merge request: %s" , gms . local_addr , t . getMessage ( ) ) ; cancelMerge ( merge_id ) ; sendMergeRejectedResponse ( sender , merge_id ) ; } |
public class UnionPattern { /** * Test a node to see if it matches any of the patterns in the union .
* @ param xctxt XPath runtime context .
* @ return { @ link org . apache . xpath . patterns . NodeTest # SCORE _ NODETEST } ,
* { @ link org . apache . xpath . patterns . NodeTest # SCORE _ NONE } ,
* { @ link ... | XObject bestScore = null ; int n = m_patterns . length ; for ( int i = 0 ; i < n ; i ++ ) { XObject score = m_patterns [ i ] . execute ( xctxt ) ; if ( score != NodeTest . SCORE_NONE ) { if ( null == bestScore ) bestScore = score ; else if ( score . num ( ) > bestScore . num ( ) ) bestScore = score ; } } if ( null == b... |
public class OperationTransformerRegistry { /** * Resolve an operation transformer entry .
* @ param address the address
* @ param operationName the operation name
* @ param placeholderResolver a placeholder resolver used to resolve children of a placeholder registration
* @ return the transformer entry */
publ... | final Iterator < PathElement > iterator = address . iterator ( ) ; final OperationTransformerEntry entry = resolveOperationTransformer ( iterator , operationName , placeholderResolver ) ; if ( entry != null ) { return entry ; } // Default is forward unchanged
return FORWARD ; |
public class BlackDuckService { public Response get ( String uri ) throws IntegrationException { } } | Request request = RequestFactory . createCommonGetRequest ( uri ) ; return execute ( request ) ; |
public class InternalQueries { /** * Converts array of something to non - null set .
* @ param items source items to convert , can be { @ code null } .
* @ return non - null , set of something . */
@ SuppressWarnings ( "unchecked" ) @ NonNull public static Set < String > nonNullSet ( @ Nullable String [ ] items ) {... | return items == null || items . length == 0 ? Collections . < String > emptySet ( ) : new HashSet < String > ( asList ( items ) ) ; |
public class Files { /** * Fully maps a file in to memory as per
* { @ link FileChannel # map ( java . nio . channels . FileChannel . MapMode , long , long ) } using the requested
* { @ link MapMode } .
* < p > Files are mapped from offset 0 to its length .
* < p > This only works for files < = { @ link Integer... | checkNotNull ( file ) ; checkNotNull ( mode ) ; if ( ! file . exists ( ) ) { throw new FileNotFoundException ( file . toString ( ) ) ; } return map ( file , mode , file . length ( ) ) ; |
public class EastAsianCS { /** * local midnight */
Moment midnight ( long utcDays ) { } } | return PlainDate . of ( utcDays , EpochDays . UTC ) . atStartOfDay ( ) . at ( this . getOffset ( utcDays ) ) ; |
public class TextRankSummaryExtractor { /** * text doc to sentence
* @ param reader
* @ return List < Sentence >
* @ throws IOException */
List < Sentence > textToSentence ( Reader reader ) throws IOException { } } | List < Sentence > sentence = new ArrayList < Sentence > ( ) ; Sentence sen = null ; sentenceSeg . reset ( reader ) ; while ( ( sen = sentenceSeg . next ( ) ) != null ) { sentence . add ( sen ) ; } return sentence ; |
public class Configuration { /** * Get an { @ link Iterator } to go through the list of < code > String < / code >
* key - value pairs in the configuration .
* @ return an iterator over the entries . */
@ Override public Iterator < Entry < String , String > > iterator ( ) { } } | // Get a copy of just the string to string pairs . After the old object
// methods that allow non - strings to be put into configurations are removed ,
// we could replace properties with a Map < String , String > and get rid of this
// code .
Map < String , String > result = new HashMap < String , String > ( ) ; for (... |
public class SparkLineTileSkin { /** * * * * * * Initialization * * * * * */
@ Override protected void initGraphics ( ) { } } | super . initGraphics ( ) ; averagingListener = o -> handleEvents ( "AVERAGING" ) ; timeFormatter = DateTimeFormatter . ofPattern ( "HH:mm" , tile . getLocale ( ) ) ; if ( tile . isAutoScale ( ) ) tile . calcAutoScale ( ) ; niceScaleY = new NiceScale ( tile . getMinValue ( ) , tile . getMaxValue ( ) ) ; niceScaleY . set... |
public class TupleMRConfigBuilder { /** * Creates a brand new and immutable { @ link TupleMRConfig } instance . */
public TupleMRConfig buildConf ( ) throws TupleMRException { } } | failIfEmpty ( schemas , " Need to declare at least one intermediate schema" ) ; failIfEmpty ( groupByFields , " Need to declare group by fields" ) ; TupleMRConfig conf = new TupleMRConfig ( ) ; conf . setIntermediateSchemas ( schemas ) ; conf . setSchemaFieldAliases ( fieldAliases ) ; conf . setGroupByFields ( groupByF... |
public class WorldViewTransformer { /** * Transform a single coordinate by a given < code > Matrix < / code > .
* @ param coordinate
* The coordinate to transform .
* @ param matrix
* The transformation matrix .
* @ return Returns a transformed coordinate , or null if one of the given parameters was null . */... | if ( coordinate != null && matrix != null ) { double x = matrix . getXx ( ) * coordinate . getX ( ) + matrix . getXy ( ) * coordinate . getY ( ) + matrix . getDx ( ) ; double y = matrix . getYx ( ) * coordinate . getX ( ) + matrix . getYy ( ) * coordinate . getY ( ) + matrix . getDy ( ) ; return new Coordinate ( x , y ... |
public class JumblrClient { /** * Get the blogs the given user is following
* @ param options the options
* @ return a List of blogs */
public List < Blog > userFollowing ( Map < String , ? > options ) { } } | return requestBuilder . get ( "/user/following" , options ) . getBlogs ( ) ; |
public class SSLUtils { /** * Create an SSL engine with the input parameters . The host and port values
* allow the re - use of possible cached SSL session ids .
* @ param context
* @ param config
* @ param host
* @ param port
* @ param connLink
* @ return SSLEngine */
public static SSLEngine getOutboundS... | // PK46069 - use engine that allows session id re - use
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "getOutboundSSLEngine, host=" + host + ", port=" + port ) ; } SSLEngine engine = context . createSSLEngine ( host , port ) ; configureEngine ( engine , FlowType . OUTBOU... |
public class JDBCParser { /** * Parse call statements for JDBC .
* @ param jdbcCall statement to parse
* @ return object with parsed data or null if it didn ' t parse
* @ throws SQLParser . Exception */
public static ParsedCall parseJDBCCall ( String jdbcCall ) throws SQLParser . Exception { } } | Matcher m = PAT_CALL_WITH_PARAMETERS . matcher ( jdbcCall ) ; if ( m . matches ( ) ) { String sql = m . group ( 1 ) ; int parameterCount = PAT_CLEAN_CALL_PARAMETERS . matcher ( m . group ( 2 ) ) . replaceAll ( "" ) . length ( ) ; return new ParsedCall ( sql , parameterCount ) ; } m = PAT_CALL_WITHOUT_PARAMETERS . match... |
public class EntityHelper { /** * Reads the entity input stream and deserializes the JSON content to the given type reference . If the
* type reference is for an iterator then a { @ link JsonStreamingArrayParser } will be returned to stream
* the deserialized contents to the caller . */
@ SuppressWarnings ( "unchec... | // If the entity type is an iterator then return a streaming iterator to prevent Jackson instantiating
// the entire response in memory .
Type type = reference . getType ( ) ; if ( type instanceof ParameterizedType && Iterator . class . isAssignableFrom ( ( Class < ? > ) ( ( ParameterizedType ) type ) . getRawType ( ) ... |
public class Util { /** * Returns an array list of elements */
public static < A > List < A > list ( A ... elements ) { } } | final List < A > list = new ArrayList < A > ( elements . length ) ; for ( A element : elements ) { list . add ( element ) ; } return list ; |
public class MessageInteraction { /** * Create a MessageInteractionCreator to execute create .
* @ param pathServiceSid The SID of the parent Service resource
* @ param pathSessionSid The SID of the parent Session resource
* @ param pathParticipantSid The SID of the Participant resource
* @ param body Message b... | return new MessageInteractionCreator ( pathServiceSid , pathSessionSid , pathParticipantSid , body ) ; |
public class WebSocketClassLoader { /** * Returns an enumeration of URL objects representing all the resources with th given name .
* Currently , WebSocketClassLoader returns only the first element .
* @ param name The name of a resource .
* @ return All founded resources . */
@ Override protected Enumeration < U... | URL url = findResource ( name ) ; Vector < URL > urls = new Vector < > ( ) ; if ( url != null ) { urls . add ( url ) ; } return urls . elements ( ) ; |
public class Compiler { /** * Converts the parse tree for a module back to JS code . */
public String toSource ( final JSModule module ) { } } | return runInCompilerThread ( ( ) -> { List < CompilerInput > inputs = module . getInputs ( ) ; int numInputs = inputs . size ( ) ; if ( numInputs == 0 ) { return "" ; } CodeBuilder cb = new CodeBuilder ( ) ; for ( int i = 0 ; i < numInputs ; i ++ ) { Node scriptNode = inputs . get ( i ) . getAstRoot ( Compiler . this )... |
public class CryptoUtils { /** * Generates a random secret key .
* @ return a random secret key . */
public static String generateSecretKey ( ) { } } | return hmacDigest ( UUID . randomUUID ( ) . toString ( ) , UUID . randomUUID ( ) . toString ( ) , HMAC_SHA256 ) ; |
public class BufferedWriter { /** * Writes a single character .
* @ exception IOException If an I / O error occurs */
public void write ( int c ) throws IOException { } } | synchronized ( lock ) { ensureOpen ( ) ; if ( nextChar >= nChars ) flushBuffer ( ) ; cb [ nextChar ++ ] = ( char ) c ; } |
public class BFGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . BFG__FEG_NAME : setFEGName ( FEG_NAME_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class TextUtilities { /** * Locates the end of the word at the specified position .
* @ param line The text
* @ param pos The position
* @ param noWordSep Characters that are non - alphanumeric , but
* should be treated as word characters anyway */
public static int findWordEnd ( String line , int pos , ... | return findWordEnd ( line , pos , noWordSep , true ) ; |
public class GSCHImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . GSCH__HX : setHX ( ( Integer ) newValue ) ; return ; case AfplibPackage . GSCH__HY : setHY ( ( Integer ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class ShardState { /** * This makes sure all of the destinations are full . */
boolean isReady ( ) { } } | final C [ ] ds = destinations . get ( ) ; if ( ds == null ) return false ; for ( final C d : ds ) if ( d == null ) return false ; final boolean ret = ds . length != 0 ; // this method is only called in tests and this needs to be true there .
if ( ret && LOGGER . isDebugEnabled ( ) ) LOGGER . debug ( "at {} to {} is Rea... |
public class DownloadCriteriaReportWithAwql { /** * Runs the example .
* @ param adWordsServices the services factory .
* @ param session the session .
* @ param reportFile the output file for the report contents .
* @ throws DetailedReportDownloadResponseException if the report request failed with a detailed
... | // Create query .
ReportQuery query = new ReportQuery . Builder ( ) . fields ( "CampaignId" , "AdGroupId" , "Id" , "Criteria" , "CriteriaType" , "Impressions" , "Clicks" , "Cost" ) . from ( ReportDefinitionReportType . CRITERIA_PERFORMANCE_REPORT ) . where ( "Status" ) . in ( "ENABLED" , "PAUSED" ) . during ( ReportDef... |
public class PushedNotification { /** * < p > Returns true if no response packet was received for this notification ,
* or if one was received but is not an error - response ( ie command 8 ) ,
* or if one was received but its status is 0 ( no error occurred ) . < / p >
* < p > Returns false if an error - response... | if ( ! transmissionCompleted ) return false ; if ( response == null ) return true ; if ( ! response . isValidErrorMessage ( ) ) return true ; return false ; |
public class Instance { /** * Wraps the protobuf . This method is considered an internal implementation detail and not meant
* to be used by applications . */
@ InternalApi public static Instance fromProto ( @ Nonnull com . google . bigtable . admin . v2 . Instance proto ) { } } | return new Instance ( proto ) ; |
public class IndirectBucket { /** * { @ inheritDoc } */
@ Override public void serialize ( final DataOutput pOutput ) throws TTIOException { } } | try { pOutput . writeInt ( IConstants . INDIRCTBUCKET ) ; pOutput . writeLong ( mBucketKey ) ; for ( long key : mReferenceKeys ) { pOutput . writeLong ( key ) ; } for ( byte [ ] hash : mReferenceHashs ) { pOutput . writeInt ( hash . length ) ; pOutput . write ( hash ) ; } } catch ( final IOException exc ) { throw new T... |
public class BeanPropertyMapFactory { /** * Returns a fixed - size map backed by the given bean . Map remove operations
* are unsupported , as is access to excluded properties .
* @ throws IllegalArgumentException if bean is null */
public static SortedMap < String , Object > asMap ( Object bean ) { } } | if ( bean == null ) { throw new IllegalArgumentException ( ) ; } BeanPropertyMapFactory factory = forClass ( bean . getClass ( ) ) ; return factory . createMap ( bean ) ; |
public class CssCharStream { /** * Start . */
@ Override public final char BeginToken ( ) throws java . io . IOException { } } | tokenBegin = - 1 ; char c = readChar ( ) ; tokenBegin = bufpos ; return c ; |
public class CircularImageView { /** * Allow shadow when in checked state .
* @ param allow */
public void allowCheckStateShadow ( boolean allow ) { } } | if ( allow != mAllowCheckStateShadow ) { mAllowCheckStateShadow = allow ; setShadowInternal ( mShadowRadius , mShadowColor , true ) ; } |
public class DocEnv { /** * Print a message .
* @ param msg message to print . */
public void printNotice ( SourcePosition pos , String msg ) { } } | if ( silent || quiet ) return ; messager . printNotice ( pos , msg ) ; |
public class NameService { /** * This method will add a < code > NamingObjectListener < / code > to the set of listeners for the NamingObject event .
* @ param nol The < code > NamingObjectListener < / code > to add as a listener . This must not be null .
* @ throws IllegalArgumentException when nol is null . */
pu... | if ( nol == null ) throw new IllegalArgumentException ( "The NameingObjectListener must not be null" ) ; ArrayList listener = getListener ( ) ; synchronized ( listener ) { if ( listener . contains ( nol ) ) return ; listener . add ( nol ) ; } |
public class JsonHandler { /** * Converts a JSON string into an object . In case of an exception returns null and
* logs the exception .
* @ param < T > type of the object to create
* @ param json string with the JSON
* @ param clazz class of object to create
* @ return the converted object , null if there is... | try { return this . mapper . readValue ( json , clazz ) ; } catch ( Exception e ) { LogFactory . getLog ( JsonHandler . class ) . info ( "deserialize json to object" , e ) ; return null ; } |
public class DemoAppAppManifest { /** * Load all services and entities found in ( the packages and subpackages within ) these modules */
@ Override public List < Class < ? > > getModules ( ) { } } | return Arrays . asList ( CommunicationsModuleDomModule . class , DocumentModule . class , CountryModule . class , DemoModuleDomSubmodule . class , DemoAppApplicationModuleFixtureSubmodule . class , DemoAppApplicationModuleServicesSubmodule . class , PdfBoxModule . class , CommandModule . class , FreeMarkerModule . clas... |
public class AbstractCliParser { /** * Prints the options for the help usage output .
* @ param settings are the { @ link CliOutputSettings } .
* @ param option2HelpMap is the { @ link Map } with the { @ link CliOptionHelpInfo } .
* @ param parameters is the { @ link StringBuilder } where to { @ link StringBuilde... | int maxOptionColumnWidth = 0 ; for ( CliOptionContainer option : modeOptions ) { CliOption cliOption = option . getOption ( ) ; if ( parameters . length ( ) > 0 ) { parameters . append ( " " ) ; } if ( ! cliOption . required ( ) ) { parameters . append ( "[" ) ; } parameters . append ( cliOption . name ( ) ) ; if ( ! o... |
public class DiscordWebSocketAdapter { /** * Sends the heartbeat .
* @ param websocket The websocket the heartbeat should be sent to . */
private void sendHeartbeat ( WebSocket websocket ) { } } | ObjectNode heartbeatPacket = JsonNodeFactory . instance . objectNode ( ) ; heartbeatPacket . put ( "op" , GatewayOpcode . HEARTBEAT . getCode ( ) ) ; heartbeatPacket . put ( "d" , lastSeq ) ; WebSocketFrame heartbeatFrame = WebSocketFrame . createTextFrame ( heartbeatPacket . toString ( ) ) ; nextHeartbeatFrame . set (... |
public class FileOutputFormat { /** * Set the { @ link CompressionCodec } to be used to compress job outputs .
* @ param conf the { @ link JobConf } to modify
* @ param codecClass the { @ link CompressionCodec } to be used to
* compress the job outputs */
public static void setOutputCompressorClass ( JobConf conf... | setCompressOutput ( conf , true ) ; conf . setClass ( "mapred.output.compression.codec" , codecClass , CompressionCodec . class ) ; |
public class Rect { /** * Updates limits so that circle is visible .
* @ param x
* @ param y
* @ param radius */
public void update ( double x , double y , double radius ) { } } | update ( x , y ) ; update ( x - radius , y - radius ) ; update ( x + radius , y - radius ) ; update ( x - radius , y + radius ) ; update ( x + radius , y + radius ) ; |
public class JoltUtils { /** * Navigate a JSON tree ( made up of Maps and Lists ) to " lookup " the value
* at a particular path .
* You will either get your data , or an exception will be thrown .
* This method should generally only be used in situations where you " know "
* that the navigate call will " alway... | Object destination = source ; for ( Object path : paths ) { if ( path == null ) { throw new UnsupportedOperationException ( "path is null" ) ; } if ( destination == null ) { throw new UnsupportedOperationException ( "source is null" ) ; } if ( destination instanceof Map ) { Map temp = ( Map ) destination ; if ( temp . ... |
public class PasswordKit { /** * This method can be used to generate a string representing an account password
* suitable for storing in a database . It will be an OpenBSD - style crypt ( 3 ) formatted
* hash string of length = 60
* The bcrypt workload is specified in the above static variable , a value from 10 t... | String salt = BCrypt . gensalt ( workload ) ; return BCrypt . hashpw ( plaintext , salt ) ; |
public class PdfLister { /** * Visualizes an imported page
* @ param iPage */
public void listPage ( PdfImportedPage iPage ) { } } | int pageNum = iPage . getPageNumber ( ) ; PdfReaderInstance readerInst = iPage . getPdfReaderInstance ( ) ; PdfReader reader = readerInst . getReader ( ) ; PdfDictionary page = reader . getPageN ( pageNum ) ; listDict ( page ) ; PdfObject obj = PdfReader . getPdfObject ( page . get ( PdfName . CONTENTS ) ) ; if ( obj =... |
public class ValidationMappingDescriptorImpl { /** * Returns all < code > constraint - definition < / code > elements
* @ return list of < code > constraint - definition < / code > */
public List < ConstraintDefinitionType < ValidationMappingDescriptor > > getAllConstraintDefinition ( ) { } } | List < ConstraintDefinitionType < ValidationMappingDescriptor > > list = new ArrayList < ConstraintDefinitionType < ValidationMappingDescriptor > > ( ) ; List < Node > nodeList = model . get ( "constraint-definition" ) ; for ( Node node : nodeList ) { ConstraintDefinitionType < ValidationMappingDescriptor > type = new ... |
public class AWSRoboMakerClient { /** * Creates a robot application .
* @ param createRobotApplicationRequest
* @ return Result of the CreateRobotApplication operation returned by the service .
* @ throws InvalidParameterException
* A parameter specified in a request is not valid , is unsupported , or cannot be... | request = beforeClientExecution ( request ) ; return executeCreateRobotApplication ( request ) ; |
public class VirtualNetworkGatewaysInner { /** * The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource provider .
* @ param resourceGroupName The name of the resource group .
* @ param virtualNetw... | return setVpnclientIpsecParametersWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayName , vpnclientIpsecParams ) . map ( new Func1 < ServiceResponse < VpnClientIPsecParametersInner > , VpnClientIPsecParametersInner > ( ) { @ Override public VpnClientIPsecParametersInner call ( ServiceResponse < VpnCl... |
public class AbstractRenderer { /** * Determine the overlap of the diagram with the screen , and shift ( if
* necessary ) the diagram draw center . It returns a rectangle only because
* that is a convenient class to hold the four parameters calculated , but it
* is not a rectangle representing an area . . .
* @... | int screenMaxX = screenBounds . x + screenBounds . width ; int screenMaxY = screenBounds . y + screenBounds . height ; int diagramMaxX = diagramBounds . x + diagramBounds . width ; int diagramMaxY = diagramBounds . y + diagramBounds . height ; int leftOverlap = screenBounds . x - diagramBounds . x ; int rightOverlap = ... |
public class AmazonEC2Client { /** * Deletes the specified VPC . You must detach or delete all gateways and resources that are associated with the VPC
* before you can delete it . For example , you must terminate all instances running in the VPC , delete all security
* groups associated with the VPC ( except the de... | request = beforeClientExecution ( request ) ; return executeDeleteVpc ( request ) ; |
public class DistanceFormat { /** * Distance formatting method . Requires a length as parameter , expressed in the CRS units of the given map .
* @ param map
* The map for which a distance should be formatted . This map may be configured to use the metric system
* or the English system .
* @ param length
* Th... | double unitLength = map . getUnitLength ( ) ; double distance = length * unitLength ; String unit = "m" ; if ( map . getMapModel ( ) . getMapInfo ( ) . getDisplayUnitType ( ) == UnitType . METRIC ) { // Right now , the distance is expressed in meter . Switch to km ?
if ( distance > 10000 ) { distance /= METERS_IN_KM ; ... |
public class DescribeVpcEndpointServiceConfigurationsResult { /** * Information about one or more services .
* @ return Information about one or more services . */
public java . util . List < ServiceConfiguration > getServiceConfigurations ( ) { } } | if ( serviceConfigurations == null ) { serviceConfigurations = new com . amazonaws . internal . SdkInternalList < ServiceConfiguration > ( ) ; } return serviceConfigurations ; |
public class WebSecurityPropagatorImpl { /** * Returns whether deny - uncovered - http - methods attribute is set .
* In order to check this value , entire WebResourceCollection objects need to be examined ,
* since it only set properly when web . xml is processed .
* @ param scList the List of SecurityConstraint... | for ( SecurityConstraint sc : scList ) { List < WebResourceCollection > wrcList = sc . getWebResourceCollections ( ) ; for ( WebResourceCollection wrc : wrcList ) { if ( wrc . getDenyUncoveredHttpMethods ( ) ) { return true ; } } } return false ; |
public class SnapshotsInner { /** * Gets information about a snapshot .
* @ param resourceGroupName The name of the resource group .
* @ param snapshotName The name of the snapshot that is being created . The name can ' t be changed after the snapshot is created . Supported characters for the name are a - z , A - Z... | return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , snapshotName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class JSDocInfoBuilder { /** * Records that the { @ link JSDocInfo } being built should be populated
* with a { @ code typedef } ' d type . */
public boolean recordTypedef ( JSTypeExpression type ) { } } | if ( type != null && ! hasAnyTypeRelatedTags ( ) && currentInfo . declareTypedefType ( type ) ) { populated = true ; return true ; } return false ; |
public class SqlQueryUtils { /** * Cast a string representation of a boolean value to a boolean primitive .
* Used especially for Oracle representation of booleans as varchar2(1)
* Returns true for values such as [ t | true | yes | 1 ] and false for [ f | false | no ] .
* If a boolean value cannot be trivially pa... | String lowerField = fieldValue . toLowerCase ( ) ; switch ( lowerField ) { case "y" : return true ; case "n" : return false ; case "true" : return true ; case "false" : return false ; case "t" : return true ; case "f" : return false ; case "yes" : return true ; case "no" : return false ; case "0" : return false ; case ... |
public class XidImpl { /** * Gets the otid . tid style raw byte representation of this XidImpl .
* < pre >
* struct otid _ t {
* long formatID ;
* long bqual _ length ;
* sequence & lt ; octet & gt ; tid ;
* < / pre >
* This is not a huge performer . It is only called when someone
* has registered a Syn... | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getOtidBytes" ) ; if ( _otid == null ) { final int total_length = _gtrid . length + _bqual . length ; _otid = new byte [ total_length ] ; System . arraycopy ( _gtrid , 0 , _otid , 0 , _gtrid . length ) ; System . arraycopy ( _bqual , 0 , _otid , _gtrid . length , _bqual... |
public class FloatLabel { /** * Sets the EditText ' s text without animating the label
* @ param text CharSequence to set
* @ param type TextView . BufferType */
public void setTextWithoutAnimation ( CharSequence text , TextView . BufferType type ) { } } | mSkipAnimation = true ; mEditText . setText ( text , type ) ; |
public class DomainCommandBuilder { /** * Creates a command builder for a domain instance of WildFly .
* Uses the system property { @ code java . home } to find the java executable required for the default Java home .
* @ param wildflyHome the path to the WildFly home directory
* @ return a new builder */
public ... | return new DomainCommandBuilder ( Environment . validateWildFlyDir ( wildflyHome ) , Jvm . current ( ) ) ; |
public class MapPartitionOperatorBase { @ Override protected List < OUT > executeOnCollections ( List < IN > inputData , RuntimeContext ctx , ExecutionConfig executionConfig ) throws Exception { } } | MapPartitionFunction < IN , OUT > function = this . userFunction . getUserCodeObject ( ) ; FunctionUtils . setFunctionRuntimeContext ( function , ctx ) ; FunctionUtils . openFunction ( function , this . parameters ) ; ArrayList < OUT > result = new ArrayList < OUT > ( inputData . size ( ) / 4 ) ; TypeSerializer < IN > ... |
public class NatsConnectionWriter { /** * This method resets that future so mistiming can result in badness . */
void start ( Future < DataPort > dataPortFuture ) { } } | this . startStopLock . lock ( ) ; try { this . dataPortFuture = dataPortFuture ; this . running . set ( true ) ; this . outgoing . resume ( ) ; this . reconnectOutgoing . resume ( ) ; this . stopped = connection . getExecutor ( ) . submit ( this , Boolean . TRUE ) ; } finally { this . startStopLock . unlock ( ) ; } |
public class TimeZoneFormat { /** * TODO This code will be obsoleted once we add hour pattern data in CLDR */
private static String truncateOffsetPattern ( String offsetHM ) { } } | int idx_mm = offsetHM . indexOf ( "mm" ) ; if ( idx_mm < 0 ) { throw new RuntimeException ( "Bad time zone hour pattern data" ) ; } int idx_HH = offsetHM . substring ( 0 , idx_mm ) . lastIndexOf ( "HH" ) ; if ( idx_HH >= 0 ) { return offsetHM . substring ( 0 , idx_HH + 2 ) ; } int idx_H = offsetHM . substring ( 0 , idx... |
public class Unpooled { /** * Creates a new buffer whose content is a copy of the specified
* { @ code buffer } ' s readable bytes . The new buffer ' s { @ code readerIndex }
* and { @ code writerIndex } are { @ code 0 } and { @ code buffer . readableBytes }
* respectively . */
public static ByteBuf copiedBuffer ... | int readable = buffer . readableBytes ( ) ; if ( readable > 0 ) { ByteBuf copy = buffer ( readable ) ; copy . writeBytes ( buffer , buffer . readerIndex ( ) , readable ) ; return copy ; } else { return EMPTY_BUFFER ; } |
public class NotificationHandler { /** * Cancel notification by its id .
* @ param entryId */
public void cancel ( int entryId ) { } } | NotificationEntry entry = mCenter . getEntry ( ID , entryId ) ; if ( entry != null ) { cancel ( entry ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.