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_SIZE ; i ++ ) { build . insert ( 0 , 0 ) ; } ret = build . toString ( ) ; } return ret ; |
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 < ? , ? > methodDescriptor , StreamObserver < ? > responseObserver ) { } } | 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 validateSeedBrokers ( String [ ] seedBrokers , Exception exception ) { } } | 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 ++ ; } } // throw meaningful exception if all the provided hosts are invalid
if ( unknownHosts == seedBrokers . length ) { throw new IllegalArgumentException ( "All the servers provided in: '" + ConsumerConfig . BOOTSTRAP_SERVERS_CONFIG + "' config are invalid. (unknown hosts)" ) ; } |
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 */
public void setBaseCalendar ( String val ) { } } | 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 the
* existing values .
* @ param tasks
* A list of up to 100 task IDs or full ARN entries .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeTasksRequest withTasks ( String ... tasks ) { } } | 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 > population , int numberOfParentsForCrossover ) { } } | 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 ( progressTracker ) ; offset . m_inputGeometry = inputGeometry ; offset . m_distance = distance ; offset . m_tolerance = tolerance ; offset . m_joins = joins ; offset . m_miterLimit = miterLimit ; return offset . _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 . getErasedType ( ) , logger , context ) ; } if ( parent . hasGetter ( propertyDescriptor ) ) { final JClassType type = parent . getAssociationType ( propertyDescriptor , false ) ; this . createHelper ( type . getErasedType ( ) , logger , context ) ; } } else { if ( serverSideValidator . getConstraintsForClass ( elementClass ) . isBeanConstrained ( ) ) { this . createHelper ( elementClass , logger , context ) ; } } |
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 . isOnSeparator ( ) ) { if ( stack != null && stack . peek ( ) != null ) { stack . peek ( ) . addChild ( currentState ) ; currentState = stack . pop ( ) ; if ( ! currentState . isComposite ( ) ) { if ( stack . peek ( ) != null ) { stack . peek ( ) . addChild ( currentState ) ; currentState = stack . pop ( ) ; } } } } } else if ( QuotesState . ID . equals ( stateId ) ) { flag ^= QUOTES ; currentState . quoted ( ) ; } else if ( EscapeCharacterState . ID . equals ( stateId ) ) { flag ^= ESCAPE ; } |
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 , policyexpression_args args ) throws Exception { } } | 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 trimLeadingCharacter ( final String str , final char leadingCharacter ) { } } | 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 < tt > count < / tt > bytes from the memory area pointed to by < tt > src < / tt > to the memory area pointed to by < tt > dst < / tt > , where < tt > kind < / tt > is one of cudaMemcpyHostToHost , cudaMemcpyHostToDevice ,
* cudaMemcpyDeviceToHost , or cudaMemcpyDeviceToDevice , and specifies the
* direction of the copy . The memory areas may not overlap . Calling
* cudaMemcpyAsync ( ) with < tt > dst < / tt > and < tt > src < / tt > pointers that
* do not match the direction of the copy results in an undefined
* behavior .
* < p > cudaMemcpyAsync ( ) is asynchronous with
* respect to the host , so the call may return before the copy is complete .
* The copy can optionally be
* associated to a stream by passing a
* non - zero < tt > stream < / tt > argument . If < tt > kind < / tt > is
* cudaMemcpyHostToDevice or cudaMemcpyDeviceToHost and the < tt > stream < / tt >
* is non - zero , the copy may overlap with operations in other streams .
* < div >
* < span > Note : < / span >
* < ul >
* < li >
* < p > Note that this function may
* also return error codes from previous , asynchronous launches .
* < / li >
* < li >
* < p > This function exhibits
* asynchronous behavior for most use cases .
* < / li >
* < / ul >
* < / div >
* < / div >
* @ param dst Destination memory address
* @ param src Source memory address
* @ param count Size in bytes to copy
* @ param kind Type of transfer
* @ param stream Stream identifier
* @ return cudaSuccess , cudaErrorInvalidValue , cudaErrorInvalidDevicePointer ,
* cudaErrorInvalidMemcpyDirection
* @ see JCuda # cudaMemcpy
* @ see JCuda # cudaMemcpy2D
* @ see JCuda # cudaMemcpyToArray
* @ see JCuda # cudaMemcpy2DToArray
* @ see JCuda # cudaMemcpyFromArray
* @ see JCuda # cudaMemcpy2DFromArray
* @ see JCuda # cudaMemcpyArrayToArray
* @ see JCuda # cudaMemcpy2DArrayToArray
* @ see JCuda # cudaMemcpyToSymbol
* @ see JCuda # cudaMemcpyFromSymbol
* @ see JCuda # cudaMemcpy2DAsync
* @ see JCuda # cudaMemcpyToArrayAsync
* @ see JCuda # cudaMemcpy2DToArrayAsync
* @ see JCuda # cudaMemcpyFromArrayAsync
* @ see JCuda # cudaMemcpy2DFromArrayAsync
* @ see JCuda # cudaMemcpyToSymbolAsync
* @ see JCuda # cudaMemcpyFromSymbolAsync */
public static int cudaMemcpyAsync ( Pointer dst , Pointer src , long count , int cudaMemcpyKind_kind , cudaStream_t stream ) { } } | 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 += 4 ; SMBUtil . writeInt2 ( dstIndex - getHeaderStart ( ) , dst , offsetOffset ) ; System . arraycopy ( data , 0 , dst , dstIndex , data . length ) ; dstIndex += data . length ; return dstIndex - start ; |
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 JerseyOptions jerseyOptions ) { } } | 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 ( RuntimeException e ) { d . reject ( e ) ; } return d . getPromise ( ) ; |
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 ( ) ; } } } catch ( Throwable t ) { LOG . error ( "Exception when shutting down: " + t . getMessage ( ) , t ) ; } } } ) ; init ( args ) ; start ( ) ; shutdownLatch . await ( ) ; |
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 parameter
* @ return the numeric path parameter , or null of no such path parameter is
* defined , or if it cannot be parsed to int */
@ Override public Integer parameterFromPathAsInteger ( String key ) { } } | 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 can be removed , < code > null < / code > is returned .
* Note that first , a random number of deletions is picked ( uniformly distributed ) from the valid range and then ,
* a random subset of this size is sampled from the currently selected IDs , to be removed ( again , all possible
* subsets are uniformly distributed , within the fixed size ) . Because the amount of possible moves increases with
* the number of performed deletions , the probability of generating each specific move thus decreases with the
* number of deletions . In other words , randomly generated moves are < b > not < / b > uniformly distributed across
* different numbers of performed deletions , but each specific move performing fewer deletions is more likely
* to be selected than each specific move performing more deletions .
* @ param solution solution for which a random multi deletion move is generated
* @ param rnd source of randomness used to generate random move
* @ return random multi deletion move , < code > null < / code > if no items can be removed */
@ Override public SubsetMove getRandomMove ( SubsetSolution solution , Random rnd ) { } } | // 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 ; } // pick number of deletions ( in [ 1 , curMaxDel ] )
int numDel = rnd . nextInt ( curMaxDel ) + 1 ; // pick random IDs to remove from selection
Set < Integer > del = SetUtilities . getRandomSubset ( delCandidates , numDel , rnd ) ; // create and return move
return new GeneralSubsetMove ( Collections . emptySet ( ) , del ) ; |
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 ; } if ( theta < 0 ) { oldTheta = 360 + oldTheta ; } float len = length ( ) ; x = len * ( float ) FastTrig . cos ( StrictMath . toRadians ( theta ) ) ; y = len * ( float ) FastTrig . sin ( StrictMath . toRadians ( theta ) ) ; // x = x / ( float ) FastTrig . cos ( StrictMath . toRadians ( oldTheta ) )
// * ( float ) FastTrig . cos ( StrictMath . toRadians ( theta ) ) ;
// y = x / ( float ) FastTrig . sin ( StrictMath . toRadians ( oldTheta ) )
// * ( float ) FastTrig . sin ( StrictMath . toRadians ( theta ) ) ; |
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 :
* < ul >
* < li >
* The call must refer to an existing email template . You can create email templates using the < a > CreateTemplate < / a >
* operation .
* < / li >
* < li >
* The message must be sent from a verified email address or domain .
* < / li >
* < li >
* If your account is still in the Amazon SES sandbox , you may only send to verified addresses or domains , or to
* email addresses associated with the Amazon SES Mailbox Simulator . For more information , see < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / verify - addresses - and - domains . html " > Verifying Email
* Addresses and Domains < / a > in the < i > Amazon SES Developer Guide . < / i >
* < / li >
* < li >
* The maximum message size is 10 MB .
* < / li >
* < li >
* Each < code > Destination < / code > parameter must include at least one recipient email address . The recipient address
* can be a To : address , a CC : address , or a BCC : address . If a recipient email address is invalid ( that is , it is
* not in the format < i > UserName @ [ SubDomain . ] Domain . TopLevelDomain < / i > ) , the entire message will be rejected , even
* if the message contains other recipients that are valid .
* < / li >
* < li >
* The message may not include more than 50 recipients , across the To : , CC : and BCC : fields . If you need to send an
* email message to a larger audience , you can divide your recipient list into groups of 50 or fewer , and then call
* the < code > SendBulkTemplatedEmail < / code > operation several times to send the message to each group .
* < / li >
* < li >
* The number of destinations you can contact in a single call to the API may be limited by your account ' s maximum
* sending rate .
* < / li >
* < / ul >
* @ param sendBulkTemplatedEmailRequest
* Represents a request to send a templated email to multiple destinations using Amazon SES . For more
* information , see the < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / send - personalized - email - api . html " > Amazon SES
* Developer Guide < / a > .
* @ return Result of the SendBulkTemplatedEmail operation returned by the service .
* @ throws MessageRejectedException
* Indicates that the action failed , and the message could not be sent . Check the error stack for more
* information about what caused the error .
* @ throws MailFromDomainNotVerifiedException
* Indicates that the message could not be sent because Amazon SES could not read the MX record required to
* use the specified MAIL FROM domain . For information about editing the custom MAIL FROM domain settings
* for an identity , see the < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / mail - from - edit . html " > Amazon SES Developer
* Guide < / a > .
* @ throws ConfigurationSetDoesNotExistException
* Indicates that the configuration set does not exist .
* @ throws TemplateDoesNotExistException
* Indicates that the Template object you specified does not exist in your Amazon SES account .
* @ throws ConfigurationSetSendingPausedException
* Indicates that email sending is disabled for the configuration set . < / p >
* You can enable or disable email sending for a configuration set using
* < a > UpdateConfigurationSetSendingEnabled < / a > .
* @ throws AccountSendingPausedException
* Indicates that email sending is disabled for your entire Amazon SES account .
* You can enable or disable email sending for your Amazon SES account using
* < a > UpdateAccountSendingEnabled < / a > .
* @ sample AmazonSimpleEmailService . SendBulkTemplatedEmail
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / email - 2010-12-01 / SendBulkTemplatedEmail " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public SendBulkTemplatedEmailResult sendBulkTemplatedEmail ( SendBulkTemplatedEmailRequest request ) { } } | 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 < ? > completeConnection ( OAuth1ConnectionFactory < ? > connectionFactory , NativeWebRequest request ) { } } | String verifier = request . getParameter ( "oauth_verifier" ) ; AuthorizedRequestToken requestToken = new AuthorizedRequestToken ( extractCachedRequestToken ( request ) , verifier ) ; OAuthToken accessToken = connectionFactory . getOAuthOperations ( ) . exchangeForAccessToken ( requestToken , null ) ; return connectionFactory . createConnection ( accessToken ) ; |
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 > . google . appengine . v1 . BasicScaling basic _ scaling = 4 ; < / code > */
public com . google . appengine . v1 . BasicScalingOrBuilder getBasicScalingOrBuilder ( ) { } } | 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 sessionId ) { } } | if ( clazz . equals ( ClientCCASession . class ) ) { ClientCCASessionDataLocalImpl data = new ClientCCASessionDataLocalImpl ( ) ; data . setSessionId ( sessionId ) ; return data ; } else if ( clazz . equals ( ServerCCASession . class ) ) { ServerCCASessionDataLocalImpl data = new ServerCCASessionDataLocalImpl ( ) ; data . setSessionId ( sessionId ) ; return data ; } throw new IllegalArgumentException ( clazz . toString ( ) ) ; |
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 > networkSourceIpV6 ) { } } | 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 merge ID
* @ param mbrs The set of members from which we expect responses . Guaranteed to be non - null */
public void handleMergeRequest ( Address sender , MergeId merge_id , Collection < ? extends Address > mbrs ) { } } | 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 org . apache . xpath . patterns . NodeTest # SCORE _ NSWILD } ,
* { @ link org . apache . xpath . patterns . NodeTest # SCORE _ QNAME } , or
* { @ link org . apache . xpath . patterns . NodeTest # SCORE _ OTHER } .
* @ throws javax . xml . transform . TransformerException */
public XObject execute ( XPathContext xctxt ) throws javax . xml . transform . TransformerException { } } | 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 == bestScore ) { bestScore = NodeTest . SCORE_NONE ; } return bestScore ; |
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 */
public OperationTransformerEntry resolveOperationTransformer ( final PathAddress address , final String operationName , PlaceholderResolver placeholderResolver ) { } } | 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 # MAX _ VALUE } bytes .
* @ param file the file to map
* @ param mode the mode to use when mapping { @ code file }
* @ return a buffer reflecting { @ code file }
* @ throws FileNotFoundException if the { @ code file } does not exist
* @ throws IOException if an I / O error occurs
* @ see FileChannel # map ( MapMode , long , long )
* @ since 2.0 */
public static MappedByteBuffer map ( File file , MapMode mode ) throws IOException { } } | 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 ( Entry < Object , Object > item : getProps ( ) . entrySet ( ) ) { if ( item . getKey ( ) instanceof String && item . getValue ( ) instanceof String ) { result . put ( ( String ) item . getKey ( ) , ( String ) item . getValue ( ) ) ; } } return result . entrySet ( ) . iterator ( ) ; |
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 . setMaxTicks ( 5 ) ; tickLineColor = Color . color ( tile . getChartGridColor ( ) . getRed ( ) , tile . getChartGridColor ( ) . getGreen ( ) , tile . getChartGridColor ( ) . getBlue ( ) , 0.5 ) ; horizontalTickLines = new ArrayList < > ( 5 ) ; tickLabelsY = new ArrayList < > ( 5 ) ; for ( int i = 0 ; i < 5 ; i ++ ) { Line hLine = new Line ( 0 , 0 , 0 , 0 ) ; hLine . getStrokeDashArray ( ) . addAll ( 1.0 , 2.0 ) ; hLine . setStroke ( Color . TRANSPARENT ) ; horizontalTickLines . add ( hLine ) ; Text tickLabelY = new Text ( "" ) ; tickLabelY . setFill ( Color . TRANSPARENT ) ; tickLabelsY . add ( tickLabelY ) ; } gradientLookup = new GradientLookup ( tile . getGradientStops ( ) ) ; low = tile . getMaxValue ( ) ; lastLow = low ; high = tile . getMinValue ( ) ; lastHigh = high ; stdDeviation = 0 ; movingAverage = tile . getMovingAverage ( ) ; noOfDatapoints = tile . getAveragingPeriod ( ) ; dataList = new LinkedList < > ( ) ; // To get smooth lines in the chart we need at least 4 values
if ( noOfDatapoints < 4 ) throw new IllegalArgumentException ( "Please increase the averaging period to a value larger than 3." ) ; graphBounds = new Rectangle ( PREFERRED_WIDTH * 0.05 , PREFERRED_HEIGHT * 0.5 , PREFERRED_WIDTH * 0.9 , PREFERRED_HEIGHT * 0.45 ) ; titleText = new Text ( tile . getTitle ( ) ) ; titleText . setFill ( tile . getTitleColor ( ) ) ; Helper . enableNode ( titleText , ! tile . getTitle ( ) . isEmpty ( ) ) ; valueText = new Text ( String . format ( locale , formatString , tile . getValue ( ) ) ) ; valueText . setFill ( tile . getValueColor ( ) ) ; Helper . enableNode ( valueText , tile . isValueVisible ( ) ) ; unitText = new Text ( tile . getUnit ( ) ) ; unitText . setFill ( tile . getUnitColor ( ) ) ; Helper . enableNode ( unitText , ! tile . getUnit ( ) . isEmpty ( ) ) ; valueUnitFlow = new TextFlow ( valueText , unitText ) ; valueUnitFlow . setTextAlignment ( TextAlignment . RIGHT ) ; averageText = new Text ( String . format ( locale , formatString , tile . getAverage ( ) ) ) ; averageText . setFill ( Tile . FOREGROUND ) ; Helper . enableNode ( averageText , tile . isAverageVisible ( ) ) ; highText = new Text ( ) ; highText . setTextOrigin ( VPos . BOTTOM ) ; highText . setFill ( tile . getValueColor ( ) ) ; lowText = new Text ( ) ; lowText . setTextOrigin ( VPos . TOP ) ; lowText . setFill ( tile . getValueColor ( ) ) ; text = new Text ( tile . getText ( ) ) ; text . setTextOrigin ( VPos . TOP ) ; text . setFill ( tile . getTextColor ( ) ) ; timeSpanText = new Text ( "" ) ; timeSpanText . setTextOrigin ( VPos . TOP ) ; timeSpanText . setFill ( tile . getTextColor ( ) ) ; Helper . enableNode ( timeSpanText , ! tile . isTextVisible ( ) ) ; stdDeviationArea = new Rectangle ( ) ; Helper . enableNode ( stdDeviationArea , tile . isAverageVisible ( ) ) ; averageLine = new Line ( ) ; averageLine . setStroke ( Tile . FOREGROUND ) ; averageLine . getStrokeDashArray ( ) . addAll ( PREFERRED_WIDTH * 0.005 , PREFERRED_WIDTH * 0.005 ) ; Helper . enableNode ( averageLine , tile . isAverageVisible ( ) ) ; pathElements = new ArrayList < > ( noOfDatapoints ) ; pathElements . add ( 0 , new MoveTo ( ) ) ; for ( int i = 1 ; i < noOfDatapoints ; i ++ ) { pathElements . add ( i , new LineTo ( ) ) ; } sparkLine = new Path ( ) ; sparkLine . getElements ( ) . addAll ( pathElements ) ; sparkLine . setFill ( null ) ; sparkLine . setStroke ( tile . getBarColor ( ) ) ; sparkLine . setStrokeWidth ( PREFERRED_WIDTH * 0.0075 ) ; sparkLine . setStrokeLineCap ( StrokeLineCap . ROUND ) ; sparkLine . setStrokeLineJoin ( StrokeLineJoin . ROUND ) ; dot = new Circle ( ) ; dot . setFill ( tile . getBarColor ( ) ) ; getPane ( ) . getChildren ( ) . addAll ( titleText , valueUnitFlow , stdDeviationArea , averageLine , sparkLine , dot , averageText , highText , lowText , timeSpanText , text ) ; getPane ( ) . getChildren ( ) . addAll ( horizontalTickLines ) ; getPane ( ) . getChildren ( ) . addAll ( tickLabelsY ) ; |
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 ( groupByFields ) ; conf . setRollupFrom ( rollupFrom ) ; if ( fieldsToPartition != null && fieldsToPartition . length != 0 ) { conf . setCustomPartitionFields ( Arrays . asList ( fieldsToPartition ) ) ; } Criteria convertedCommonOrder = convertCommonSortByToCriteria ( commonOrderBy ) ; if ( commonOrderBy != null && commonOrderBy . getSchemaOrder ( ) != null ) { conf . setSourceOrder ( commonOrderBy . getSchemaOrder ( ) ) ; } else { conf . setSourceOrder ( Order . ASC ) ; // by default source order is ASC
} conf . setCommonCriteria ( convertedCommonOrder ) ; if ( commonOrderBy != null ) { Map < String , Criteria > convertedParticularOrderings = getSecondarySortBys ( commonOrderBy , schemas , specificsOrderBy ) ; for ( Map . Entry < String , Criteria > entry : convertedParticularOrderings . entrySet ( ) ) { conf . setSecondarySortBy ( entry . getKey ( ) , entry . getValue ( ) ) ; } } return conf ; |
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 . */
public Coordinate transform ( Coordinate coordinate , Matrix matrix ) { } } | 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 ) ; } return null ; |
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 getOutboundSSLEngine ( SSLContext context , SSLLinkConfig config , String host , int port , SSLConnectionLink connLink ) { } } | // 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 . OUTBOUND , config , connLink ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "getOutboundSSLEngine, hc=" + engine . hashCode ( ) ) ; } return engine ; |
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 . matcher ( jdbcCall ) ; if ( m . matches ( ) ) { return new ParsedCall ( m . group ( 1 ) , 0 ) ; } return null ; |
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 ( "unchecked" ) public static < T > T getEntity ( InputStream in , TypeReference < T > reference ) { } } | // 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 ( ) ) ) { Type elementType = ( ( ParameterizedType ) type ) . getActualTypeArguments ( ) [ 0 ] ; return ( T ) streamingIterator ( in , typeReferenceFrom ( elementType ) ) ; } // Use Jackson to deserialize the input stream .
try { return JsonHelper . readJson ( in , reference ) ; } catch ( IOException e ) { throw Throwables . propagate ( e ) ; } |
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 body
* @ return MessageInteractionCreator capable of executing the create */
public static MessageInteractionCreator creator ( final String pathServiceSid , final String pathSessionSid , final String pathParticipantSid , final String body ) { } } | 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 < URL > findResources ( String name ) { } } | 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 ) ; if ( scriptNode == null ) { throw new IllegalArgumentException ( "Bad module: " + module . getName ( ) ) ; } toSource ( cb , i , scriptNode ) ; } return cb . toString ( ) ; } ) ; |
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 , String noWordSep ) { } } | 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 Ready " + shorthand ( ds ) , thisNodeId , groupName ) ; return ret ; |
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
* error from the reporting service .
* @ throws ReportDownloadResponseException if the report request failed with a general error from
* the reporting service .
* @ throws ReportException if the report request failed due to a transport layer error .
* @ throws IOException if the report ' s contents could not be written to { @ code reportFile } . */
public static void runExample ( AdWordsServicesInterface adWordsServices , AdWordsSession session , String reportFile ) throws ReportDownloadResponseException , ReportException , IOException { } } | // 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 ( ReportDefinitionDateRangeType . LAST_7_DAYS ) . build ( ) ; // Optional : Set the reporting configuration of the session to suppress header , column name , or
// summary rows in the report output . You can also configure this via your ads . properties
// configuration file . See AdWordsSession . Builder . from ( Configuration ) for details .
// In addition , you can set whether you want to explicitly include or exclude zero impression
// rows .
ReportingConfiguration reportingConfiguration = new ReportingConfiguration . Builder ( ) . skipReportHeader ( false ) . skipColumnHeader ( false ) . skipReportSummary ( false ) // Set to false to exclude rows with zero impressions .
. includeZeroImpressions ( true ) . build ( ) ; session . setReportingConfiguration ( reportingConfiguration ) ; ReportDownloaderInterface reportDownloader = adWordsServices . getUtility ( session , ReportDownloaderInterface . class ) ; // Set the property api . adwords . reportDownloadTimeout or call
// ReportDownloader . setReportDownloadTimeout to set a timeout ( in milliseconds )
// for CONNECT and READ in report downloads .
ReportDownloadResponse response = reportDownloader . downloadReport ( query . toString ( ) , DownloadFormat . CSV ) ; response . saveToFile ( reportFile ) ; System . out . printf ( "Report successfully downloaded to: %s%n" , reportFile ) ; |
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 packet is attached and has
* a non - zero status code . < / p >
* < p > Returns false if an exception is attached . < / p >
* < p > Make sure you use the Feedback Service to cleanup your list of
* invalid device tokens , as Apple ' s documentation says . < / p >
* @ return true if push was successful , false otherwise */
public boolean isSuccessful ( ) { } } | 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 TTIOException ( exc ) ; } |
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 . */
public void addNamingObjectListener ( NamingObjectListener nol ) { } } | 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 an exception */
public < T > T readValue ( String json , Class < T > clazz ) { } } | 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 . class , FakeDataModule . class ) ; |
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 StringBuilder # append ( String ) append } the options
* help output .
* @ param modeOptions the { @ link Collection } with the options to print for the current mode .
* @ return the maximum width in characters of the option column in the text output . */
private int printHelpOptions ( CliOutputSettings settings , Map < CliOption , CliOptionHelpInfo > option2HelpMap , StringBuilder parameters , Collection < CliOptionContainer > modeOptions ) { } } | 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 ( ! option . getSetter ( ) . getPropertyClass ( ) . equals ( boolean . class ) ) { parameters . append ( " " ) ; parameters . append ( cliOption . operand ( ) ) ; if ( option . isArrayMapOrCollection ( ) ) { CliContainerStyle containerStyle = option . getContainerStyle ( this . cliState . getCliStyle ( ) ) ; switch ( containerStyle ) { case COMMA_SEPARATED : parameters . append ( ",..." ) ; break ; case MULTIPLE_OCCURRENCE : parameters . append ( "*" ) ; break ; default : throw new IllegalCaseException ( CliContainerStyle . class , containerStyle ) ; } } } if ( ! cliOption . required ( ) ) { parameters . append ( "]" ) ; } CliOptionHelpInfo helpInfo = option2HelpMap . get ( cliOption ) ; if ( helpInfo == null ) { helpInfo = new CliOptionHelpInfo ( option , this . dependencies , settings ) ; option2HelpMap . put ( cliOption , helpInfo ) ; } if ( helpInfo . length > maxOptionColumnWidth ) { maxOptionColumnWidth = helpInfo . length ; } } return maxOptionColumnWidth ; |
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 ( heartbeatFrame ) ; websocket . sendFrame ( heartbeatFrame ) ; |
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 , Class < ? extends CompressionCodec > codecClass ) { } } | 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 " always succeed " .
* @ param source the source JSON object ( Map , List , String , Number )
* @ param paths varargs path you want to travel
* @ return the object of Type < T > at final destination
* @ throws UnsupportedOperationException if there was any problem walking the JSON tree structure */
public static < T > T navigateStrict ( final Object source , final Object ... paths ) throws UnsupportedOperationException { } } | 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 . containsKey ( path ) ) { // if we don ' t check for containsKey first , then the Map . get call
// would return null for keys that don ' t actually exist .
destination = ( ( Map ) destination ) . get ( path ) ; } else { throw new UnsupportedOperationException ( "no entry for '" + path + "' found while traversing the JSON" ) ; } } else if ( destination instanceof List ) { if ( ! ( path instanceof Integer ) ) { throw new UnsupportedOperationException ( "path '" + path + "' is trying to be used as an array index" ) ; } List destList = ( List ) destination ; int pathInt = ( Integer ) path ; if ( pathInt < 0 || pathInt > destList . size ( ) ) { throw new UnsupportedOperationException ( "path '" + path + "' is negative or outside the range of the list" ) ; } destination = destList . get ( pathInt ) ; } else { throw new UnsupportedOperationException ( "Navigation supports only Map and List source types and non-null String and Integer path types" ) ; } } return cast ( destination ) ; |
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 to 31.
* A workload of 12 is a very reasonable safe default as of 2013.
* This automatically handles secure 128 - bit salt generation and storage within the hash .
* @ param plaintext The account ' s plaintext password as provided during account creation ,
* or when changing an account ' s password .
* @ return String - a string of length 60 that is the bcrypt hashed password in crypt ( 3 ) format . */
public static String hashPassword ( String plaintext ) { } } | 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 == null ) return ; switch ( obj . type ) { case PdfObject . STREAM : listStream ( ( PRStream ) obj , readerInst ) ; break ; case PdfObject . ARRAY : for ( Iterator i = ( ( PdfArray ) obj ) . listIterator ( ) ; i . hasNext ( ) ; ) { PdfObject o = PdfReader . getPdfObject ( ( PdfObject ) i . next ( ) ) ; listStream ( ( PRStream ) o , readerInst ) ; out . println ( "-----------" ) ; } break ; } |
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 ConstraintDefinitionTypeImpl < ValidationMappingDescriptor > ( this , "constraint-definition" , model , node ) ; list . add ( type ) ; } return list ; |
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 used . The returned message
* provides an explanation of the error value .
* @ throws ResourceAlreadyExistsException
* The specified resource already exists .
* @ throws LimitExceededException
* The requested resource exceeds the maximum number allowed , or the number of concurrent stream requests
* exceeds the maximum number allowed .
* @ throws ThrottlingException
* AWS RoboMaker is temporarily unable to process the request . Try your call again .
* @ throws InternalServerException
* AWS RoboMaker experienced a service issue . Try your call again .
* @ throws IdempotentParameterMismatchException
* The request uses the same client token as a previous , but non - identical request . Do not reuse a client
* token with different requests , unless the requests are identical .
* @ sample AWSRoboMaker . CreateRobotApplication
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / robomaker - 2018-06-29 / CreateRobotApplication "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public CreateRobotApplicationResult createRobotApplication ( CreateRobotApplicationRequest request ) { } } | 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 virtualNetworkGatewayName The name of the virtual network gateway .
* @ param vpnclientIpsecParams Parameters supplied to the Begin Set vpnclient ipsec parameters of Virtual Network Gateway P2S client operation through Network resource provider .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < VpnClientIPsecParametersInner > setVpnclientIpsecParametersAsync ( String resourceGroupName , String virtualNetworkGatewayName , VpnClientIPsecParametersInner vpnclientIpsecParams ) { } } | return setVpnclientIpsecParametersWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayName , vpnclientIpsecParams ) . map ( new Func1 < ServiceResponse < VpnClientIPsecParametersInner > , VpnClientIPsecParametersInner > ( ) { @ Override public VpnClientIPsecParametersInner call ( ServiceResponse < VpnClientIPsecParametersInner > response ) { return response . body ( ) ; } } ) ; |
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 . . .
* @ param screenBounds
* the bounds of the screen
* @ param diagramBounds
* the bounds of the diagram
* @ return the shape that the screen should be */
public Rectangle shift ( Rectangle screenBounds , Rectangle diagramBounds ) { } } | 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 = diagramMaxX - screenMaxX ; int topOverlap = screenBounds . y - diagramBounds . y ; int bottomOverlap = diagramMaxY - screenMaxY ; int dx = 0 ; int dy = 0 ; int width = screenBounds . width ; int height = screenBounds . height ; if ( leftOverlap > 0 ) { dx = leftOverlap ; } if ( rightOverlap > 0 ) { width += rightOverlap ; } if ( topOverlap > 0 ) { dy = topOverlap ; } if ( bottomOverlap > 0 ) { height += bottomOverlap ; } if ( dx != 0 || dy != 0 ) { this . shiftDrawCenter ( dx , dy ) ; } return new Rectangle ( dx , dy , width , height ) ; |
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 default one ) , delete all route tables associated with the VPC ( except
* the default one ) , and so on .
* @ param deleteVpcRequest
* @ return Result of the DeleteVpc operation returned by the service .
* @ sample AmazonEC2 . DeleteVpc
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / DeleteVpc " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DeleteVpcResult deleteVpc ( DeleteVpcRequest request ) { } } | 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
* The original length , expressed in the coordinate reference system of the given map .
* @ return Returns a string that is the formatted distance of the given length . Preference goes to meters or yards
* ( depending on the configured unit type ) , but when the number is larger than 10000 , it will switch
* automatically to kilometer / mile . */
public static String asMapLength ( MapWidget map , double length ) { } } | 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 ; unit = "km" ; } } else if ( map . getMapModel ( ) . getMapInfo ( ) . getDisplayUnitType ( ) == UnitType . ENGLISH ) { if ( distance / METERS_IN_YARD > 10000 ) { // More than 10000 yard ; switch to mile :
distance = distance / METERS_IN_MILE ; unit = "mi" ; } else { distance /= METERS_IN_YARD ; // use yards .
unit = "yd" ; } } else if ( map . getMapModel ( ) . getMapInfo ( ) . getDisplayUnitType ( ) == UnitType . ENGLISH_FOOT ) { if ( distance * FEET_IN_METER > FEET_IN_MILE ) { // More than 1 mile ( 5280 feet ) ; switch to mile :
distance = distance / METERS_IN_MILE ; unit = "mi" ; } else { distance *= FEET_IN_METER ; // use feet .
unit = "ft" ; } } else if ( map . getMapModel ( ) . getMapInfo ( ) . getDisplayUnitType ( ) == UnitType . CRS ) { unit = "u" ; } String formatted = NumberFormat . getDecimalFormat ( ) . format ( distance ) ; return formatted + unit ; |
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 objects .
* @ return true if deny - uncovered - http - methods attribute is set , false otherwise . */
private boolean isDenyUncoveredHttpMethods ( List < SecurityConstraint > scList ) { } } | 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 , 0-9 and _ . The max name length is 80 characters .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the SnapshotInner object if successful . */
public SnapshotInner getByResourceGroup ( String resourceGroupName , String snapshotName ) { } } | 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 parsed , false is returned .
* @ param fieldValue the value of the boolean string field */
public static boolean castToBoolean ( String fieldValue ) { } } | 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 "1" : return true ; } return false ; |
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 SynchronizationCallback via the LI850 SPIs or if
* the Activity service needs the tx identifier . */
public byte [ ] getOtidBytes ( ) { } } | 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 . length ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getOtidBytes" , _otid ) ; return Util . duplicateByteArray ( _otid ) ; |
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 static DomainCommandBuilder of ( final String wildflyHome ) { } } | 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 > inSerializer = getOperatorInfo ( ) . getInputType ( ) . createSerializer ( executionConfig ) ; TypeSerializer < OUT > outSerializer = getOperatorInfo ( ) . getOutputType ( ) . createSerializer ( executionConfig ) ; CopyingIterator < IN > source = new CopyingIterator < IN > ( inputData . iterator ( ) , inSerializer ) ; CopyingListCollector < OUT > resultCollector = new CopyingListCollector < OUT > ( result , outSerializer ) ; function . mapPartition ( source , resultCollector ) ; result . trimToSize ( ) ; FunctionUtils . closeFunction ( function ) ; return result ; |
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_mm ) . lastIndexOf ( "H" ) ; if ( idx_H >= 0 ) { return offsetHM . substring ( 0 , idx_H + 1 ) ; } throw new RuntimeException ( "Bad time zone hour pattern data" ) ; |
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 ( ByteBuf buffer ) { } } | 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.