signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AddressUtils { /** * Guesses address type of the provided Bluetooth address . There is not any easy way to identify definitively
* address type by using Bluetooth address only , hence the following logic is used to the best make a guess .
* @ param url device URL
* @ return guessed address type */
public static AddressType guessDeviceAddressType ( URL url ) { } } | if ( url . getDeviceAddress ( ) == null ) { return AddressType . COMPOSITE ; } return guessAddressType ( url . getDeviceAddress ( ) ) ; |
public class xen_sf_storagecentervpx_image { /** * Use this API to fetch filtered set of xen _ sf _ storagecentervpx _ image resources .
* filter string should be in JSON format . eg : " vm _ state : DOWN , name : [ a - z ] + " */
public static xen_sf_storagecentervpx_image [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | xen_sf_storagecentervpx_image obj = new xen_sf_storagecentervpx_image ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; xen_sf_storagecentervpx_image [ ] response = ( xen_sf_storagecentervpx_image [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class AWSLogsClient { /** * Lists the specified log groups . You can list all your log groups or filter the results by prefix . The results are
* ASCII - sorted by log group name .
* @ param describeLogGroupsRequest
* @ return Result of the DescribeLogGroups operation returned by the service .
* @ throws InvalidParameterException
* A parameter is specified incorrectly .
* @ throws ServiceUnavailableException
* The service cannot complete the request .
* @ sample AWSLogs . DescribeLogGroups
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / logs - 2014-03-28 / DescribeLogGroups " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DescribeLogGroupsResult describeLogGroups ( DescribeLogGroupsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeLogGroups ( request ) ; |
public class HttpServiceImpl { /** * { @ inheritDoc } */
@ Override public String post ( String url , String json ) throws HttpServiceException , TechnicalException { } } | logger . debug ( "HttpService POST on url: {}" , url ) ; Response response ; try { response = getClient ( ) . newCall ( new Request . Builder ( ) . url ( url ) . post ( RequestBody . create ( MediaType . parse ( "application/json" ) , json ) ) . build ( ) ) . execute ( ) ; String jsonResponse = response . body ( ) . string ( ) ; logger . info ( "JSON response is: {}" , jsonResponse ) ; response . close ( ) ; return jsonResponse ; } catch ( IOException e ) { throw new HttpServiceException ( Messages . format ( Messages . getMessage ( HttpServiceException . HTTP_SERVICE_ERROR_MESSAGE ) ) , e ) ; } |
public class JNIWriter { /** * Emit a class file for a given class .
* @ param c The class from which a class file is generated . */
public FileObject write ( ClassSymbol c ) throws IOException { } } | String className = c . flatName ( ) . toString ( ) ; Location outLocn ; if ( multiModuleMode ) { ModuleSymbol msym = c . owner . kind == MDL ? ( ModuleSymbol ) c . owner : c . packge ( ) . modle ; outLocn = fileManager . getLocationForModule ( StandardLocation . NATIVE_HEADER_OUTPUT , msym . name . toString ( ) ) ; } else { outLocn = StandardLocation . NATIVE_HEADER_OUTPUT ; } FileObject outFile = fileManager . getFileForOutput ( outLocn , "" , className . replaceAll ( "[.$]" , "_" ) + ".h" , null ) ; PrintWriter out = new PrintWriter ( outFile . openWriter ( ) ) ; try { write ( out , c ) ; if ( verbose ) log . printVerbose ( "wrote.file" , outFile ) ; out . close ( ) ; out = null ; } finally { if ( out != null ) { // if we are propogating an exception , delete the file
out . close ( ) ; outFile . delete ( ) ; outFile = null ; } } return outFile ; // may be null if write failed |
public class KerasBatchNormalization { /** * Get layer output type .
* @ param inputType Array of InputTypes
* @ return output type as InputType
* @ throws InvalidKerasConfigurationException Invalid Keras config */
public InputType getOutputType ( InputType ... inputType ) throws InvalidKerasConfigurationException { } } | if ( inputType . length > 1 ) throw new InvalidKerasConfigurationException ( "Keras BatchNorm layer accepts only one input (received " + inputType . length + ")" ) ; return this . getBatchNormalizationLayer ( ) . getOutputType ( - 1 , inputType [ 0 ] ) ; |
public class StringUtil { /** * Convert a < code > String < / code > to a < code > BigInteger < / code > ; since 3.2 it
* handles hex ( 0x or # ) and octal ( 0 ) notations .
* Returns an empty { @ code Optional } if the string is { @ code null } or can ' t be parsed as { @ code BigInteger } .
* @ param str a < code > String < / code > to convert , may be null
* @ return */
public static Optional < BigInteger > createBigInteger ( final String str ) { } } | if ( N . isNullOrEmptyOrBlank ( str ) ) { return Optional . empty ( ) ; } int pos = 0 ; // offset within string
int radix = 10 ; boolean negate = false ; // need to negate later ?
if ( str . startsWith ( "-" ) ) { negate = true ; pos = 1 ; } if ( str . startsWith ( "0x" , pos ) || str . startsWith ( "0X" , pos ) ) { // hex
radix = 16 ; pos += 2 ; } else if ( str . startsWith ( "#" , pos ) ) { // alternative hex ( allowed by Long / Integer )
radix = 16 ; pos ++ ; } else if ( str . startsWith ( "0" , pos ) && str . length ( ) > pos + 1 ) { // octal ; so long as there are additional digits
radix = 8 ; pos ++ ; } // default is to treat as decimal
try { final BigInteger value = new BigInteger ( str . substring ( pos ) , radix ) ; return Optional . of ( negate ? value . negate ( ) : value ) ; } catch ( NumberFormatException e ) { return Optional . empty ( ) ; } |
public class Status { /** * Method to get a Status from the cache .
* @ param _ typeName name of the StatusGroup
* @ param _ key key of the Status
* @ return Status
* @ throws CacheReloadException on error */
public static Status find ( final String _typeName , final String _key ) throws CacheReloadException { } } | return Status . get ( _typeName ) . get ( _key ) ; |
public class ServiceConnectManager { /** * Start the connection manager so that any pre - connections are established . */
public void start ( ) { } } | IoFutureListener < ConnectFuture > tmpConnectListener ; if ( interval > 0 ) { tmpConnectListener = new IoFutureListener < ConnectFuture > ( ) { @ Override public void operationComplete ( ConnectFuture future ) { heartbeatFilter . setServiceConnected ( future . isConnected ( ) ) ; updateConnectTimes ( future . isConnected ( ) ) ; } } ; } else { tmpConnectListener = new IoFutureListener < ConnectFuture > ( ) { @ Override public void operationComplete ( ConnectFuture future ) { updateConnectTimes ( future . isConnected ( ) ) ; } } ; } final IoFutureListener < ConnectFuture > connectListener = tmpConnectListener ; // set a connection pool with GT 0 prepared connections in every worker thread as an optimization
Worker [ ] workers = tcpAcceptor . getWorkers ( ) ; assert preparedConnectionCount == 0 || preparedConnectionCount >= workers . length : "Prepared connection count must be 0, or >= number of IO threads" ; int minCountPerThread = preparedConnectionCount / workers . length ; int remainder = preparedConnectionCount % workers . length ; for ( Worker worker : workers ) { final int count = remainder -- > 0 ? minCountPerThread + 1 : minCountPerThread ; Runnable startConnectionPoolTask = ( ) -> { ConnectionPool currentPool = connectionPool . get ( ) ; if ( currentPool == null ) { // the first time the pool is started is needs to be created , subsequent times it should just be started
// without re - creating .
currentPool = new ConnectionPool ( serviceCtx , connectHandler , connectURI , heartbeatFilter , connectListener , count , true ) ; connectionPool . set ( currentPool ) ; } currentPool . start ( ) ; } ; worker . executeInIoThread ( startConnectionPoolTask ) ; } |
public class HttpShellJobDriver { /** * Request the evaluators . */
private synchronized void requestEvaluators ( ) { } } | assert this . state == State . INIT ; LOG . log ( Level . INFO , "Schedule on {0} Evaluators." , this . numEvaluators ) ; this . evaluatorRequestor . newRequest ( ) . setMemory ( 128 ) . setNumberOfCores ( 1 ) . setNumber ( this . numEvaluators ) . submit ( ) ; this . state = State . WAIT_EVALUATORS ; this . expectCount = this . numEvaluators ; |
public class CommerceNotificationQueueEntryUtil { /** * Returns the first commerce notification queue entry in the ordered set where sentDate & lt ; & # 63 ; .
* @ param sentDate the sent date
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce notification queue entry , or < code > null < / code > if a matching commerce notification queue entry could not be found */
public static CommerceNotificationQueueEntry fetchByLtS_First ( Date sentDate , OrderByComparator < CommerceNotificationQueueEntry > orderByComparator ) { } } | return getPersistence ( ) . fetchByLtS_First ( sentDate , orderByComparator ) ; |
public class PollingMultiFileWatcher { /** * Starts polling the watched files for changes .
* @ param files a set of one or more files to watch for changes .
* @ param callback the callback to call with the set of files that changed since the last time . */
@ Override public void start ( Set < File > files , Consumer < Set < File > > callback ) { } } | if ( isStarted ( ) ) { throw new IllegalStateException ( "start() should not be called more than once" ) ; } Set < File > filesCopy = ImmutableSet . copyOf ( files ) ; Preconditions . checkArgument ( filesCopy . size ( ) > 0 , "must specify at least 1 file to watch for changes" ) ; this . callback = requireNonNull ( callback ) ; watchedFiles = filesCopy ; executorService = MoreExecutors . listeningDecorator ( Executors . newScheduledThreadPool ( 1 ) ) ; future = executorService . scheduleAtFixedRate ( this :: scanFilesForChanges , initialDelay , interval , timeUnit ) ; |
public class CareWebShellEx { /** * Register a plugin by specifying a path and a url .
* @ param path Format is & lt ; tab name & gt ; \ & lt ; tree node path & gt ;
* @ param url Main url of plugin .
* @ return Container created for the plugin .
* @ throws Exception Unspecified exception . */
public ElementBase register ( String path , String url ) throws Exception { } } | return register ( path , url , null ) ; |
public class OpenSSHPrivateKeyFile { /** * ( non - Javadoc )
* @ see
* com . sshtools . publickey . SshPrivateKeyFile # changePassphrase ( java . lang . String
* , java . lang . String ) */
public void changePassphrase ( String oldpassphrase , String newpassphrase ) throws IOException , InvalidPassphraseException { } } | SshKeyPair pair = toKeyPair ( oldpassphrase ) ; formattedkey = encryptKey ( pair , newpassphrase ) ; |
public class GedLinkDocumentMongoToGedObjectConverterVisitor { /** * { @ inheritDoc } */
@ Override public final void visit ( final SubmitterLinkDocumentMongo document ) { } } | setGedObject ( new SubmitterLink ( getParent ( ) , "Submitter" , new ObjectId ( document . getString ( ) ) ) ) ; |
public class DecomposeHomography { /** * R = W * U ^ T
* N = v2 cross u
* ( 1 / d ) * T = ( H - R ) * N */
private void createSolution ( DMatrixRMaj W , DMatrixRMaj U , Vector3D_F64 u , DMatrixRMaj H , Se3_F64 se , Vector3D_F64 N ) { } } | CommonOps_DDRM . multTransB ( W , U , se . getR ( ) ) ; GeometryMath_F64 . cross ( v2 , u , N ) ; CommonOps_DDRM . subtract ( H , se . getR ( ) , tempM ) ; GeometryMath_F64 . mult ( tempM , N , se . getT ( ) ) ; |
public class Processor { /** * The processor parameters .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setParameters ( java . util . Collection ) } or { @ link # withParameters ( java . util . Collection ) } if you want to
* override the existing values .
* @ param parameters
* The processor parameters .
* @ return Returns a reference to this object so that method calls can be chained together . */
public Processor withParameters ( ProcessorParameter ... parameters ) { } } | if ( this . parameters == null ) { setParameters ( new java . util . ArrayList < ProcessorParameter > ( parameters . length ) ) ; } for ( ProcessorParameter ele : parameters ) { this . parameters . add ( ele ) ; } return this ; |
public class CheckChoicesListView { /** * { @ inheritDoc } */
@ Override protected void populateItem ( final ListItem < T > item ) { } } | item . add ( newLabel ( "label" , getChoiceLabel ( item . getModelObject ( ) ) ) ) ; item . add ( newCheck ( "check" , item . getModel ( ) , item . getIndex ( ) ) ) ; |
public class SelectBooleanCheckboxRenderer { /** * Renders the optional label . This method is protected in order to allow
* third - party frameworks to derive from it .
* @ param rw
* the response writer
* @ param clientId
* the id used by the label to reference the input field
* @ param selectBooleanCheckbox
* the component to render
* @ throws IOException
* may be thrown by the response writer */
protected void addLabel ( ResponseWriter rw , String clientId , SelectBooleanCheckbox selectBooleanCheckbox ) throws IOException { } } | if ( selectBooleanCheckbox . isRenderLabel ( ) ) { String label = selectBooleanCheckbox . getLabel ( ) ; if ( label != null ) { rw . startElement ( "label" , selectBooleanCheckbox ) ; generateErrorAndRequiredClass ( selectBooleanCheckbox , rw , clientId , selectBooleanCheckbox . getLabelStyleClass ( ) , Responsive . getResponsiveLabelClass ( selectBooleanCheckbox ) , "control-label" ) ; writeAttribute ( rw , "style" , selectBooleanCheckbox . getLabelStyle ( ) ) ; if ( null != selectBooleanCheckbox . getDir ( ) ) { rw . writeAttribute ( "dir" , selectBooleanCheckbox . getDir ( ) , "dir" ) ; } rw . writeAttribute ( "for" , "input_" + clientId , "for" ) ; rw . writeText ( label , null ) ; rw . endElement ( "label" ) ; } } |
public class HttpHeaders { /** * Serializes headers to an { @ link LowLevelHttpRequest } .
* @ param headers HTTP headers
* @ param logbuf log buffer or { @ code null } for none
* @ param curlbuf log buffer for logging curl requests or { @ code null } for none
* @ param logger logger or { @ code null } for none . Logger must be specified if log buffer is
* specified
* @ param lowLevelHttpRequest low level HTTP request where HTTP headers will be serialized to or
* { @ code null } for none */
static void serializeHeaders ( HttpHeaders headers , StringBuilder logbuf , StringBuilder curlbuf , Logger logger , LowLevelHttpRequest lowLevelHttpRequest ) throws IOException { } } | serializeHeaders ( headers , logbuf , curlbuf , logger , lowLevelHttpRequest , null ) ; |
public class AdminDictStemmeroverrideAction { private static OptionalEntity < StemmerOverrideItem > getEntity ( final CreateForm form ) { } } | switch ( form . crudMode ) { case CrudMode . CREATE : final StemmerOverrideItem entity = new StemmerOverrideItem ( 0 , StringUtil . EMPTY , StringUtil . EMPTY ) ; return OptionalEntity . of ( entity ) ; case CrudMode . EDIT : if ( form instanceof EditForm ) { return ComponentUtil . getComponent ( StemmerOverrideService . class ) . getStemmerOverrideItem ( form . dictId , ( ( EditForm ) form ) . id ) ; } break ; default : break ; } return OptionalEntity . empty ( ) ; |
public class ZMQ { /** * Polling on items with given selector
* CAUTION : This could be affected by jdk epoll bug
* @ param selector Open and reuse this selector and do not forget to close when it is not used .
* @ param items
* @ param count
* @ param timeout
* @ return number of events */
public static int poll ( Selector selector , PollItem [ ] items , int count , long timeout ) { } } | Utils . checkArgument ( items != null , "items have to be supplied for polling" ) ; if ( count == 0 ) { if ( timeout <= 0 ) { return 0 ; } LockSupport . parkNanos ( TimeUnit . NANOSECONDS . convert ( timeout , TimeUnit . MILLISECONDS ) ) ; return 0 ; } long now = 0L ; long end = 0L ; HashMap < SelectableChannel , SelectionKey > saved = new HashMap < SelectableChannel , SelectionKey > ( ) ; for ( SelectionKey key : selector . keys ( ) ) { if ( key . isValid ( ) ) { saved . put ( key . channel ( ) , key ) ; } } for ( int i = 0 ; i < count ; i ++ ) { PollItem item = items [ i ] ; if ( item == null ) { continue ; } SelectableChannel ch = item . getChannel ( ) ; // mailbox channel if ZMQ socket
SelectionKey key = saved . remove ( ch ) ; if ( key != null ) { if ( key . interestOps ( ) != item . interestOps ( ) ) { key . interestOps ( item . interestOps ( ) ) ; } key . attach ( item ) ; } else { try { ch . register ( selector , item . interestOps ( ) , item ) ; } catch ( ClosedSelectorException e ) { // context was closed asynchronously , exit gracefully
return - 1 ; } catch ( ClosedChannelException e ) { throw new ZError . IOException ( e ) ; } } } if ( ! saved . isEmpty ( ) ) { for ( SelectionKey deprecated : saved . values ( ) ) { deprecated . cancel ( ) ; } } boolean firstPass = true ; int nevents = 0 ; int ready ; while ( true ) { // Compute the timeout for the subsequent poll .
long waitMillis ; if ( firstPass ) { waitMillis = 0L ; } else if ( timeout < 0L ) { waitMillis = - 1L ; } else { waitMillis = TimeUnit . NANOSECONDS . toMillis ( end - now ) ; if ( waitMillis == 0 ) { waitMillis = 1L ; } } // Wait for events .
try { int rc ; if ( waitMillis < 0 ) { rc = selector . select ( 0 ) ; } else if ( waitMillis == 0 ) { rc = selector . selectNow ( ) ; } else { rc = selector . select ( waitMillis ) ; } for ( SelectionKey key : selector . keys ( ) ) { PollItem item = ( PollItem ) key . attachment ( ) ; ready = item . readyOps ( key , rc ) ; if ( ready < 0 ) { return - 1 ; } if ( ready > 0 ) { nevents ++ ; } } selector . selectedKeys ( ) . clear ( ) ; } catch ( ClosedSelectorException e ) { // context was closed asynchronously , exit gracefully
return - 1 ; } catch ( IOException e ) { throw new ZError . IOException ( e ) ; } // If timeout is zero , exit immediately whether there are events or not .
if ( timeout == 0 ) { break ; } if ( nevents > 0 ) { break ; } // At this point we are meant to wait for events but there are none .
// If timeout is infinite we can just loop until we get some events .
if ( timeout < 0 ) { if ( firstPass ) { firstPass = false ; } continue ; } // The timeout is finite and there are no events . In the first pass
// we get a timestamp of when the polling have begun . ( We assume that
// first pass have taken negligible time ) . We also compute the time
// when the polling should time out .
if ( firstPass ) { now = Clock . nowNS ( ) ; end = now + TimeUnit . MILLISECONDS . toNanos ( timeout ) ; if ( now == end ) { break ; } firstPass = false ; continue ; } // Find out whether timeout have expired .
now = Clock . nowNS ( ) ; if ( now >= end ) { break ; } } return nevents ; |
public class DescribeScalingPoliciesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeScalingPoliciesRequest describeScalingPoliciesRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeScalingPoliciesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeScalingPoliciesRequest . getPolicyNames ( ) , POLICYNAMES_BINDING ) ; protocolMarshaller . marshall ( describeScalingPoliciesRequest . getServiceNamespace ( ) , SERVICENAMESPACE_BINDING ) ; protocolMarshaller . marshall ( describeScalingPoliciesRequest . getResourceId ( ) , RESOURCEID_BINDING ) ; protocolMarshaller . marshall ( describeScalingPoliciesRequest . getScalableDimension ( ) , SCALABLEDIMENSION_BINDING ) ; protocolMarshaller . marshall ( describeScalingPoliciesRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( describeScalingPoliciesRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ScheduledInstanceRecurrence { /** * The days . For a monthly schedule , this is one or more days of the month ( 1-31 ) . For a weekly schedule , this is
* one or more days of the week ( 1-7 , where 1 is Sunday ) .
* @ return The days . For a monthly schedule , this is one or more days of the month ( 1-31 ) . For a weekly schedule ,
* this is one or more days of the week ( 1-7 , where 1 is Sunday ) . */
public java . util . List < Integer > getOccurrenceDaySet ( ) { } } | if ( occurrenceDaySet == null ) { occurrenceDaySet = new com . amazonaws . internal . SdkInternalList < Integer > ( ) ; } return occurrenceDaySet ; |
public class MemoryCacher { /** * - - - STOP CACHER - - - */
@ Override public void stopped ( ) { } } | // Stop timer
if ( timer != null ) { timer . cancel ( false ) ; timer = null ; } // Clear partitions
final long stamp = lock . writeLock ( ) ; try { partitions . clear ( ) ; } finally { lock . unlockWrite ( stamp ) ; } |
public class ScriptModuleUtils { /** * Find a class in the module that matches the given className
* @ param module the script module to search
* @ param className the class name in dotted form .
* @ return the found class , or null . */
@ Nullable public static Class < ? > findClass ( ScriptModule module , String className ) { } } | Set < Class < ? > > classes = module . getLoadedClasses ( ) ; Class < ? > targetClass = null ; for ( Class < ? > clazz : classes ) { if ( clazz . getName ( ) . equals ( className ) ) { targetClass = clazz ; break ; } } return targetClass ; |
public class RuleContainer { /** * Applies all the rules ordered accordingly to the specified { @ code statement } . */
public Statement apply ( FrameworkMethod method , Description description , Object target , Statement statement ) { } } | if ( methodRules . isEmpty ( ) && testRules . isEmpty ( ) ) { return statement ; } Statement result = statement ; for ( RuleEntry ruleEntry : getSortedEntries ( ) ) { if ( ruleEntry . type == RuleEntry . TYPE_TEST_RULE ) { result = ( ( TestRule ) ruleEntry . rule ) . apply ( result , description ) ; } else { result = ( ( MethodRule ) ruleEntry . rule ) . apply ( result , method , target ) ; } } return result ; |
public class SequentialExecutionQueue { /** * Starts using a new { @ link ExecutorService } to carry out executions .
* The older { @ link ExecutorService } will be shut down ( but it ' s still expected to
* complete whatever they are doing and scheduled . ) */
public synchronized void setExecutors ( ExecutorService svc ) { } } | ExecutorService old = this . executors ; this . executors = svc ; // gradually executions will be taken over by a new pool
old . shutdown ( ) ; |
public class JsonPayload { /** * endregion */
final JSONObject marshallForSending ( ) throws JSONException { } } | JSONObject result ; String container = getJsonContainer ( ) ; if ( container != null ) { result = new JSONObject ( ) ; result . put ( container , jsonObject ) ; } else { result = jsonObject ; } if ( isAuthenticated ( ) ) { result . put ( "token" , getConversationToken ( ) ) ; } if ( hasSessionId ( ) ) { result . put ( "session_id" , getSessionId ( ) ) ; } return result ; |
public class CmsFlexController { /** * Puts the response in a suspended state . < p > */
public void suspendFlexResponse ( ) { } } | for ( int i = 0 ; i < m_flexResponseList . size ( ) ; i ++ ) { CmsFlexResponse res = m_flexResponseList . get ( i ) ; res . setSuspended ( true ) ; } |
public class SubtitleChatOverlay { /** * Configures us for display of chat history or not . */
protected void setHistoryEnabled ( boolean historyEnabled ) { } } | if ( historyEnabled && _historyModel == null ) { _historyModel = _scrollbar . getModel ( ) ; _historyModel . addChangeListener ( this ) ; resetHistoryOffset ( ) ; // out with the subtitles , we ' ll be displaying history
clearGlyphs ( _subtitles ) ; // " scroll " down to the latest history entry
updateHistBar ( _history . size ( ) - 1 ) ; // refigure our history
figureCurrentHistory ( ) ; } else if ( ! historyEnabled && _historyModel != null ) { _historyModel . removeChangeListener ( this ) ; _historyModel = null ; // out with the history , we ' ll be displaying subtitles
clearGlyphs ( _showingHistory ) ; } |
public class XmlUtilities { /** * Change the data in this field to base64.
* WARNING - This requires 64bit encoding found in javax . mail !
* @ param field The field containing the binary data to encode .
* @ return The string encoded using base64. */
public static String encodeFieldData ( BaseField field ) { } } | if ( field . getData ( ) == null ) return DBConstants . BLANK ; ByteArrayOutputStream baOut = new ByteArrayOutputStream ( ) ; DataOutputStream daOut = new DataOutputStream ( baOut ) ; try { field . write ( daOut , false ) ; daOut . flush ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } char [ ] chOut = Base64 . encode ( baOut . toByteArray ( ) ) ; if ( chOut == null ) return DBConstants . BLANK ; // Never
return new String ( chOut ) ; |
public class HRcli { /** * Note from Thaniga on 11/5 . DME2Client is not expected to be reused . . . need a fresh one
* on each transaction , which is expected to cover the Async aspects .
* @ return
* @ throws APIException
* @ throws DME2Exception */
protected EClient < HttpURLConnection > client ( ) throws CadiException { } } | try { if ( uri == null ) { Item item = hman . loc . best ( ) ; if ( item == null ) { throw new CadiException ( "No service available for " + hman . loc . toString ( ) ) ; } uri = hman . loc . get ( item ) ; } return new HClient ( ss , uri , connectionTimeout ) ; } catch ( Exception e ) { throw new CadiException ( e ) ; } |
public class ClassUtil { /** * 获得指定类过滤后的Public方法列表
* @ param clazz 查找方法的类
* @ param excludeMethods 不包括的方法
* @ return 过滤后的方法列表 */
public static List < Method > getPublicMethods ( Class < ? > clazz , Method ... excludeMethods ) { } } | return ReflectUtil . getPublicMethods ( clazz , excludeMethods ) ; |
import java . util . * ; class ValidateTriplet { /** * The function checks if there exists a triplet that sums to the given value in the array
* Args :
* array : The input array
* size : The size of the input array
* total : The total sum we expect
* elements : Initial count of elements
* Returns :
* True if the triplet exists , otherwise False
* For example :
* > > > validate _ triplet ( [ 2 , 7 , 4 , 0 , 9 , 5 , 1 , 3 ] , 8 , 6 , 0)
* True
* > > > validate _ triplet ( [ 1 , 4 , 5 , 6 , 7 , 8 , 5 , 9 ] , 8 , 6 , 0)
* False
* > > > validate _ triplet ( [ 10 , 4 , 2 , 3 , 5 ] , 5 , 15 , 0)
* True */
public static Boolean validateTriplet ( int [ ] array , int size , int total , int elements ) { } } | if ( elements == 3 && total == 0 ) { return true ; } if ( elements == 3 || size == 0 || total < 0 ) { return false ; } return ( validateTriplet ( array , size - 1 , total - array [ size - 1 ] , elements + 1 ) || validateTriplet ( array , size - 1 , total , elements ) ) ; |
public class DefaultPojoBindingFactory { private < P > List < Facet > injectFacetBindings ( DefaultPojoBinding < P > binding , Class < P > pojoType ) { } } | List < Facet > keyFacets = new LinkedList < > ( ) ; facetProvider . getFacets ( pojoType ) . stream ( ) . forEach ( facet -> { if ( facet . hasAnnotation ( PartitionKey . class ) || facet . hasAnnotation ( ClusteringColumn . class ) ) { keyFacets . add ( facet ) ; } else { GenericType facetType = facet . getType ( ) ; Converter converter = converterRegistry . getConverter ( facetType ) ; String columnName = namingStrategy . getColumnName ( facet ) ; if ( converter != null ) { binding . addFacetBinding ( new SimpleFacetBinding ( facet , columnName , converter ) ) ; } else if ( facetType . isList ( ) ) { binding . addFacetBinding ( new ListFacetBinding ( facet , columnName , createElementBinding ( facet , facetType . getElementType ( ) ) ) ) ; } else if ( facetType . isSet ( ) ) { binding . addFacetBinding ( new SetFacetBinding ( facet , columnName , createElementBinding ( facet , facetType . getElementType ( ) ) ) ) ; } else if ( facetType . isMap ( ) ) { Converter keyConverter = converterRegistry . getConverter ( facetType . getMapKeyType ( ) ) ; if ( keyConverter == null ) { throw new HecateException ( "Invalid facet \"%s\"; no converter registered for key type \"%s\"." , facet . getName ( ) , facetType . getMapKeyType ( ) . getRawType ( ) . getCanonicalName ( ) ) ; } binding . addFacetBinding ( new MapFacetBinding ( facet , columnName , keyConverter , createElementBinding ( facet , facetType . getMapValueType ( ) ) ) ) ; } else if ( facetType . isArray ( ) ) { binding . addFacetBinding ( new ArrayFacetBinding ( facet , columnName , createElementBinding ( facet , facetType . getArrayElementType ( ) ) ) ) ; } else if ( facet . hasAnnotation ( Embedded . class ) ) { binding . addFacetBinding ( new EmbeddedFacetBinding ( facet , converterRegistry , namingStrategy ) ) ; } else { PojoBinding < ? > refBinding = createPojoBinding ( facetType . getRawType ( ) ) ; binding . addFacetBinding ( refBinding . getKeyBinding ( ) . createReferenceBinding ( facet , refBinding , namingStrategy ) ) ; } } } ) ; return keyFacets ; |
public class WeightedIntDiGraph { /** * Sets the weight of the edge s - > t to be w if the edge is present ,
* otherwise , an IndexOutOfBoundsException is thrown */
public void setWeight ( int s , int t , double w ) { } } | DiEdge e = edge ( s , t ) ; assertEdge ( e ) ; weights . put ( e , w ) ; |
public class ConnectionTypesInner { /** * Create a connectiontype .
* @ param resourceGroupName Name of an Azure Resource group .
* @ param automationAccountName The name of the automation account .
* @ param connectionTypeName The parameters supplied to the create or update connectiontype operation .
* @ param parameters The parameters supplied to the create or update connectiontype operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the ConnectionTypeInner object if successful . */
public ConnectionTypeInner createOrUpdate ( String resourceGroupName , String automationAccountName , String connectionTypeName , ConnectionTypeCreateOrUpdateParameters parameters ) { } } | return createOrUpdateWithServiceResponseAsync ( resourceGroupName , automationAccountName , connectionTypeName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class LatentRelationalAnalysis { /** * prints the { @ code Matrix } to standard out .
* @ param rows an { @ code int } containing the number of rows in m
* @ param cols an { @ code int } containing the number of cols in m
* @ param m the { @ code Matrix } to print
* @ return void */
public static void printMatrix ( int rows , int cols , Matrix m ) { } } | for ( int col_num = 0 ; col_num < cols ; col_num ++ ) { for ( int row_num = 0 ; row_num < rows ; row_num ++ ) { System . out . print ( m . get ( row_num , col_num ) + " " ) ; } System . out . print ( "\n" ) ; } System . out . print ( "\n" ) ; |
public class FileBlobStoreImpl { /** * Delete a key from the blob store
* @ param key the key to delete
* @ throws IOException on any error */
public void deleteKey ( String key ) throws IOException { } } | File keyDir = getKeyDir ( key ) ; LocalFsBlobStoreFile pf = new LocalFsBlobStoreFile ( keyDir , BlobStoreFile . BLOBSTORE_DATA_FILE ) ; pf . delete ( ) ; delete ( keyDir ) ; |
public class PersistenceBrokerImpl { /** * Extent aware Delete by Query
* @ param query
* @ param cld
* @ throws PersistenceBrokerException */
private void deleteByQuery ( Query query , ClassDescriptor cld ) throws PersistenceBrokerException { } } | if ( logger . isDebugEnabled ( ) ) { logger . debug ( "deleteByQuery " + cld . getClassNameOfObject ( ) + ", " + query ) ; } if ( query instanceof QueryBySQL ) { String sql = ( ( QueryBySQL ) query ) . getSql ( ) ; this . dbAccess . executeUpdateSQL ( sql , cld ) ; } else { // if query is Identity based transform it to a criteria based query first
if ( query instanceof QueryByIdentity ) { QueryByIdentity qbi = ( QueryByIdentity ) query ; Object oid = qbi . getExampleObject ( ) ; // make sure it ' s an Identity
if ( ! ( oid instanceof Identity ) ) { oid = serviceIdentity ( ) . buildIdentity ( oid ) ; } query = referencesBroker . getPKQuery ( ( Identity ) oid ) ; } if ( ! cld . isInterface ( ) ) { this . dbAccess . executeDelete ( query , cld ) ; } // if class is an extent , we have to delete all extent classes too
String lastUsedTable = cld . getFullTableName ( ) ; if ( cld . isExtent ( ) ) { Iterator extents = getDescriptorRepository ( ) . getAllConcreteSubclassDescriptors ( cld ) . iterator ( ) ; while ( extents . hasNext ( ) ) { ClassDescriptor extCld = ( ClassDescriptor ) extents . next ( ) ; // read same table only once
if ( ! extCld . getFullTableName ( ) . equals ( lastUsedTable ) ) { lastUsedTable = extCld . getFullTableName ( ) ; this . dbAccess . executeDelete ( query , extCld ) ; } } } } |
public class JSONAssetConverter { /** * Read a list of assets from an input stream
* @ param inputStream
* The stream to read from
* @ return The list of assets
* @ throws IOException */
public static List < Asset > readValues ( InputStream inputStream ) throws IOException { } } | return DataModelSerializer . deserializeList ( inputStream , Asset . class ) ; |
public class ShanksAgentBayesianReasoningCapability { /** * Add soft - evidence to the Bayesian network to reason with it .
* @ param bn
* @ param nodeName
* @ param softEvidence
* @ throws ShanksException */
public static void addSoftEvidence ( ProbabilisticNetwork bn , String nodeName , HashMap < String , Double > softEvidence ) throws ShanksException { } } | ProbabilisticNode targetNode = ShanksAgentBayesianReasoningCapability . getNode ( bn , nodeName ) ; boolean found = false ; for ( Node child : targetNode . getChildren ( ) ) { if ( child . getName ( ) . equals ( softEvidenceNodePrefix + nodeName ) ) { if ( child . getStatesSize ( ) == 2 && child . getStateAt ( 0 ) . equals ( triggerState ) ) { found = true ; break ; } } } if ( ! found ) { // Create soft - evidence node
ProbabilisticNode auxNode = new ProbabilisticNode ( ) ; auxNode . setName ( softEvidenceNodePrefix + nodeName ) ; auxNode . setLabel ( softEvidenceNodePrefix + nodeName ) ; auxNode . appendState ( triggerState ) ; auxNode . appendState ( "NON" + triggerState ) ; PotentialTable cpt = auxNode . getProbabilityFunction ( ) ; cpt . addVariable ( auxNode ) ; for ( int i = 0 ; i < cpt . tableSize ( ) ; i ++ ) { cpt . setValue ( i , ( float ) 0.5 ) ; } auxNode . initMarginalList ( ) ; bn . addNode ( auxNode ) ; Edge edge = new Edge ( targetNode , auxNode ) ; try { bn . addEdge ( edge ) ; cpt = auxNode . getProbabilityFunction ( ) ; for ( int i = 0 ; i < cpt . tableSize ( ) ; i ++ ) { cpt . setValue ( i , ( float ) 0.5 ) ; } auxNode . initMarginalList ( ) ; } catch ( Exception e ) { throw new ShanksException ( e ) ; } } ShanksAgentBayesianReasoningCapability . updateSoftEvidenceAuxiliaryNodeCPT ( bn , nodeName , softEvidence ) ; ShanksAgentBayesianReasoningCapability . addEvidence ( bn , softEvidenceNodePrefix + nodeName , triggerState ) ; |
public class StorageAccountsInner { /** * Gets the SAS token associated with the specified Data Lake Analytics and Azure Storage account and container combination .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ 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 PagedList & lt ; SasTokenInformationInner & gt ; object if successful . */
public PagedList < SasTokenInformationInner > listSasTokensNext ( final String nextPageLink ) { } } | ServiceResponse < Page < SasTokenInformationInner > > response = listSasTokensNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) ; return new PagedList < SasTokenInformationInner > ( response . body ( ) ) { @ Override public Page < SasTokenInformationInner > nextPage ( String nextPageLink ) { return listSasTokensNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ; |
public class MultiFormatReader { /** * Decode an image using the state set up by calling setHints ( ) previously . Continuous scan
* clients will get a < b > large < / b > speed increase by using this instead of decode ( ) .
* @ param image The pixel data to decode
* @ return The contents of the image
* @ throws NotFoundException Any errors which occurred */
public Result decodeWithState ( BinaryBitmap image ) throws NotFoundException { } } | // Make sure to set up the default state so we don ' t crash
if ( readers == null ) { setHints ( null ) ; } return decodeInternal ( image ) ; |
public class UtilValidate { /** * Returns true if string s is a valid contiguous U . S . Zip code . Must be 5 or 9 digits only . */
public static boolean isContiguousZipCode ( String s ) { } } | boolean retval = false ; if ( isZipCode ( s ) ) { if ( isEmpty ( s ) ) retval = defaultEmptyOK ; else { String normalizedZip = s . substring ( 0 , 5 ) ; int iZip = Integer . parseInt ( normalizedZip ) ; if ( ( iZip >= 96701 && iZip <= 96898 ) || ( iZip >= 99501 && iZip <= 99950 ) ) retval = false ; else retval = true ; } } return retval ; |
public class AbstractResourceRegistration { /** * Get all the handlers at a specific address .
* @ param address the address
* @ param inherited true to include the inherited operations
* @ return the handlers */
@ Override public final Map < String , OperationEntry > getOperationDescriptions ( final PathAddress address , boolean inherited ) { } } | if ( parent != null ) { RootInvocation ri = getRootInvocation ( ) ; return ri . root . getOperationDescriptions ( ri . pathAddress . append ( address ) , inherited ) ; } // else we are the root
Map < String , OperationEntry > providers = new TreeMap < String , OperationEntry > ( ) ; getOperationDescriptions ( address . iterator ( ) , providers , inherited ) ; return providers ; |
public class BeanContextServicesSupport { /** * Revokes a service in this bean context .
* The given service provider is unregistered and a < code > BeanContextServiceRevokedEvent < / code > is fired . All registered service listeners and current
* service users get notified .
* @ param serviceClass
* the service class
* @ param serviceProvider
* the service provider
* @ param revokeCurrentServicesNow
* true if service should be terminated immediantly
* @ see com . googlecode . openbeans . beancontext . BeanContextServices # revokeService ( java . lang . Class ,
* com . googlecode . openbeans . beancontext . BeanContextServiceProvider , boolean ) */
public void revokeService ( Class serviceClass , BeanContextServiceProvider serviceProvider , boolean revokeCurrentServicesNow ) { } } | if ( serviceClass == null || serviceProvider == null ) { throw new NullPointerException ( ) ; } synchronized ( globalHierarchyLock ) { synchronized ( services ) { BCSSServiceProvider bcssProvider = ( BCSSServiceProvider ) services . get ( serviceClass ) ; if ( bcssProvider == null ) { // non - exist service
return ; } if ( bcssProvider . getServiceProvider ( ) != serviceProvider ) { throw new IllegalArgumentException ( Messages . getString ( "beans.66" ) ) ; } services . remove ( serviceClass ) ; if ( serviceProvider instanceof Serializable ) { serializable -- ; } } } // notify listeners
fireServiceRevoked ( serviceClass , revokeCurrentServicesNow ) ; // notify service users
notifyServiceRevokedToServiceUsers ( serviceClass , serviceProvider , revokeCurrentServicesNow ) ; |
public class GSMTImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . GSMT__MCPT : setMCPT ( ( Integer ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class AnnotationValidatorCache { /** * 为某个类添加所有待验证属性的 < code > AnnotationValidator < / code > 到 < code > CLASS _ 2 _ ANNOTATION _ VALIDATOR _ MAP < / code > 中
* 流程如下 :
* < ul >
* < li > 1 . 如果 < code > CLASS _ 2 _ ANNOTATION _ VALIDATOR _ MAP < / code > 已缓存了类对应的验证器 , 则直接退出 < / li >
* < li > 2 . 寻找类中所有装饰有 { @ link FluentValidate } 注解的属性 , 遍历之 。 < / li >
* < li > 3 . 取出 { @ link FluentValidate } 注解中的值 , 包含所有验证器的类定义 。 < / li >
* < li > 4 . 遍历所有的验证器类定义 , 如果验证器类不是实现了 < code > Validator < / code > 接口跳过 。 < / li >
* < li > 5 . < code > VALIDATOR _ MAP < / code > 中如果已经存在了改验证器类对应的实例 , 则跳过 , 如果没有就尝试从 < code > Registry < / code
* > 中查询实例对象 , 一般情况下当前线程classLoader下只有一个实例 , 当使用Spring等IoC容器的时候会出现多个 , 则取第一个 , 放入 < code > validatorsMap < / code > 中 。
* < / li >
* < li > 6 . 组装 < code > AnnotationValidator < / code > , 放到 < code > CLASS _ 2 _ ANNOTATION _ VALIDATOR _ MAP < / code > 缓存住 。 < / li >
* < / ul >
* @ param registry 验证器对象寻找注册器
* @ param clazz 待验证类定义 */
private static void addByClass ( Registry registry , Class < ? > clazz ) { } } | try { if ( CLASS_2_ANNOTATION_VALIDATOR_MAP . contains ( clazz ) ) { return ; } List < AnnotationValidator > annotationValidators = getAllAnnotationValidators ( registry , clazz ) ; if ( CollectionUtil . isEmpty ( annotationValidators ) ) { LOGGER . debug ( String . format ( "Annotation-based validation enabled for %s, and to-do validators are empty" , clazz . getSimpleName ( ) ) ) ; } else { CLASS_2_ANNOTATION_VALIDATOR_MAP . putIfAbsent ( clazz , annotationValidators ) ; LOGGER . debug ( String . format ( "Annotation-based validation added for %s, and to-do validators are %s" , clazz . getSimpleName ( ) , annotationValidators ) ) ; } } catch ( Exception e ) { LOGGER . error ( "Failed to add annotation validators " + e . getMessage ( ) , e ) ; } |
public class FTPConnection { /** * Aborts all data transfers */
public void abortDataTransfers ( ) { } } | while ( ! dataConnections . isEmpty ( ) ) { Socket socket = dataConnections . poll ( ) ; if ( socket != null ) Utils . closeQuietly ( socket ) ; } |
public class HttpResponseException { /** * Returns an exception message string builder to use for the given HTTP response .
* @ since 1.7 */
public static StringBuilder computeMessageBuffer ( HttpResponse response ) { } } | StringBuilder builder = new StringBuilder ( ) ; int statusCode = response . getStatusCode ( ) ; if ( statusCode != 0 ) { builder . append ( statusCode ) ; } String statusMessage = response . getStatusMessage ( ) ; if ( statusMessage != null ) { if ( statusCode != 0 ) { builder . append ( ' ' ) ; } builder . append ( statusMessage ) ; } return builder ; |
public class MgcpCall { /** * Unregisters all connections that belong to an endpoint .
* @ param endpointId The identifier of the endpoint that owns the connections .
* @ return A set containing all unregistered connection identifiers . Returns an empty set if no connections exist . */
public Set < Integer > removeConnections ( String endpointId ) { } } | Set < Integer > removed = this . entries . removeAll ( endpointId ) ; if ( ! removed . isEmpty ( ) && log . isDebugEnabled ( ) ) { log . debug ( "Call " + getCallIdHex ( ) + " unregistered connections " + Arrays . toString ( convertToHex ( removed ) ) + " from endpoint " + endpointId ) ; } return removed ; |
public class LTieFunctionBuilder { /** * Adds full new case for the argument that are of specific classes ( matched by instanceOf , null is a wildcard ) . */
@ Nonnull public < V1 extends T1 , V2 extends T2 > LTieFunctionBuilder < T1 , T2 > aCase ( Class < V1 > argC1 , Class < V2 > argC3 , LTieFunction < V1 , V2 > function ) { } } | PartialCaseWithIntProduct . The pc = partialCaseFactoryMethod ( ( a1 , a2 , a3 ) -> ( argC1 == null || argC1 . isInstance ( a1 ) ) && ( argC3 == null || argC3 . isInstance ( a2 ) ) ) ; pc . evaluate ( function ) ; return self ( ) ; |
public class Interval { /** * Returns a new interval based on this interval but with a different start
* and end date .
* @ param startDateTime the new start date
* @ param endDateTime the new end date
* @ return a new interval */
public Interval withDates ( LocalDateTime startDateTime , LocalDateTime endDateTime ) { } } | requireNonNull ( startDateTime ) ; requireNonNull ( endDateTime ) ; return new Interval ( startDateTime , endDateTime , this . zoneId ) ; |
public class WidgetRoutingDispatcher { /** * We ' re sure the request parameter map is a Map < String , String [ ] > */
@ SuppressWarnings ( "unchecked" ) private Object fireEvent ( Request request , PageBook . Page page , Object instance ) throws IOException { } } | final String method = request . method ( ) ; final String pathInfo = request . path ( ) ; return page . doMethod ( method . toLowerCase ( ) , instance , pathInfo , request ) ; |
public class Array { /** * Removes an array entry at the specified position .
* @ param ar array to be resized
* @ param p position
* @ param < T > array type
* @ return array */
public static < T > T [ ] delete ( final T [ ] ar , final int p ) { } } | final int s = ar . length - 1 ; move ( ar , p + 1 , - 1 , s - p ) ; return Arrays . copyOf ( ar , s ) ; |
public class ParameterObjectMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ParameterObject parameterObject , ProtocolMarshaller protocolMarshaller ) { } } | if ( parameterObject == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( parameterObject . getId ( ) , ID_BINDING ) ; protocolMarshaller . marshall ( parameterObject . getAttributes ( ) , ATTRIBUTES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class SparseVector { /** * Setter method ( should it be renamed to set ? )
* @ param i set symbolTable [ i ]
* @ param value */
public void put ( int i , double value ) { } } | if ( i < 0 || i >= N ) throw new IllegalArgumentException ( "Illegal index " + i + " should be > 0 and < " + N ) ; if ( value == 0.0 ) symbolTable . delete ( i ) ; else symbolTable . put ( i , value ) ; |
public class ELHelper { /** * Remove the brackets from an EL expression .
* @ param expression The expression to remove the brackets from .
* @ param mask Set whether to mask the expression and result . Useful for when passwords might
* be contained in either the expression or the result .
* @ return The EL expression without the brackets . */
@ Trivial static String removeBrackets ( String expression , boolean mask ) { } } | final String methodName = "removeBrackets" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , methodName , new Object [ ] { ( expression == null ) ? null : mask ? OBFUSCATED_STRING : expression , mask } ) ; } expression = expression . trim ( ) ; if ( ( expression . startsWith ( "${" ) || expression . startsWith ( "#{" ) ) && expression . endsWith ( "}" ) ) { expression = expression . substring ( 2 , expression . length ( ) - 1 ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , methodName , ( expression == null ) ? null : mask ? OBFUSCATED_STRING : expression ) ; } return expression ; |
public class DescribeEndpointsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeEndpointsRequest describeEndpointsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeEndpointsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class AnnotationValue { /** * Get the value of the { @ code value } member of the annotation .
* @ param type The type
* @ param < T > The type
* @ return The result */
public final < T > Optional < T > getValue ( Class < T > type ) { } } | return getValue ( ConversionContext . of ( type ) ) ; |
public class CommerceDiscountPersistenceImpl { /** * Returns the first commerce discount in the ordered set where groupId = & # 63 ; and couponCode = & # 63 ; .
* @ param groupId the group ID
* @ param couponCode the coupon code
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce discount , or < code > null < / code > if a matching commerce discount could not be found */
@ Override public CommerceDiscount fetchByG_C_First ( long groupId , String couponCode , OrderByComparator < CommerceDiscount > orderByComparator ) { } } | List < CommerceDiscount > list = findByG_C ( groupId , couponCode , 0 , 1 , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ; |
public class RowKey { /** * Calculates and writes an array of one or more salt bytes at the front of
* the given row key .
* The salt is calculated by taking the Java hash code of the metric and
* tag UIDs and returning a modulo based on the number of salt buckets .
* The result will always be a positive integer from 0 to salt buckets .
* NOTE : The row key passed in MUST have allocated the { @ code width } number of
* bytes at the front of the row key or this call will overwrite data .
* WARNING : If the width is set to a positive value , then the bucket must be
* at least 1 or greater .
* @ param row _ key The pre - allocated row key to write the salt to
* @ since 2.2 */
public static void prefixKeyWithSalt ( final byte [ ] row_key ) { } } | if ( Const . SALT_WIDTH ( ) > 0 ) { if ( row_key . length < ( Const . SALT_WIDTH ( ) + TSDB . metrics_width ( ) ) || ( Bytes . memcmp ( row_key , new byte [ Const . SALT_WIDTH ( ) + TSDB . metrics_width ( ) ] , Const . SALT_WIDTH ( ) , TSDB . metrics_width ( ) ) == 0 ) ) { // ^ Don ' t salt the global annotation row , leave it at zero
return ; } final int tags_start = Const . SALT_WIDTH ( ) + TSDB . metrics_width ( ) + Const . TIMESTAMP_BYTES ; // we want the metric and tags , not the timestamp
final byte [ ] salt_base = new byte [ row_key . length - Const . SALT_WIDTH ( ) - Const . TIMESTAMP_BYTES ] ; System . arraycopy ( row_key , Const . SALT_WIDTH ( ) , salt_base , 0 , TSDB . metrics_width ( ) ) ; System . arraycopy ( row_key , tags_start , salt_base , TSDB . metrics_width ( ) , row_key . length - tags_start ) ; int modulo = Arrays . hashCode ( salt_base ) % Const . SALT_BUCKETS ( ) ; if ( modulo < 0 ) { // make sure we return a positive salt .
modulo = modulo * - 1 ; } final byte [ ] salt = getSaltBytes ( modulo ) ; System . arraycopy ( salt , 0 , row_key , 0 , Const . SALT_WIDTH ( ) ) ; } // else salting is disabled so it ' s a no - op |
public class DbSqlSession { /** * lock / / / / / */
public void lock ( String statement , Object parameter ) { } } | // do not perform locking if H2 database is used . H2 uses table level locks
// by default which may cause deadlocks if the deploy command needs to get a new
// Id using the DbIdGenerator while performing a deployment .
if ( ! DbSqlSessionFactory . H2 . equals ( dbSqlSessionFactory . getDatabaseType ( ) ) ) { String mappedStatement = dbSqlSessionFactory . mapStatement ( statement ) ; if ( ! Context . getProcessEngineConfiguration ( ) . isJdbcBatchProcessing ( ) ) { sqlSession . update ( mappedStatement , parameter ) ; } else { sqlSession . selectList ( mappedStatement , parameter ) ; } } |
public class ThreadBoundOutputStream { /** * Bind the System . err PrintStream to a ThreadBoundOutputStream and return it . If System . err is already bound ,
* returns the pre - bound ThreadBoundOutputStream . The binding can be removed with { @ link # unbindSystemErr ( ) } .
* @ return A ThreadBoundOutputStream bound to System . err */
public static synchronized ThreadBoundOutputStream bindSystemErr ( ) { } } | if ( null == boundErrPrint ) { origSystemErr = System . err ; final ThreadBoundOutputStream newErr = new ThreadBoundOutputStream ( origSystemErr ) ; boundErrPrint = new ThreadBoundPrintStream ( newErr ) ; System . setErr ( boundErrPrint ) ; return newErr ; } else { return boundErrPrint . getThreadBoundOutputStream ( ) ; } |
public class ScalableTargetMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ScalableTarget scalableTarget , ProtocolMarshaller protocolMarshaller ) { } } | if ( scalableTarget == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( scalableTarget . getServiceNamespace ( ) , SERVICENAMESPACE_BINDING ) ; protocolMarshaller . marshall ( scalableTarget . getResourceId ( ) , RESOURCEID_BINDING ) ; protocolMarshaller . marshall ( scalableTarget . getScalableDimension ( ) , SCALABLEDIMENSION_BINDING ) ; protocolMarshaller . marshall ( scalableTarget . getMinCapacity ( ) , MINCAPACITY_BINDING ) ; protocolMarshaller . marshall ( scalableTarget . getMaxCapacity ( ) , MAXCAPACITY_BINDING ) ; protocolMarshaller . marshall ( scalableTarget . getRoleARN ( ) , ROLEARN_BINDING ) ; protocolMarshaller . marshall ( scalableTarget . getCreationTime ( ) , CREATIONTIME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class HtmlDocletWriter { /** * Get link to the " package - summary . html " page for the package passed .
* @ param pkg Package to which link will be generated
* @ return a content tree for the link */
protected Content getNavLinkPackage ( PackageElement pkg ) { } } | Content linkContent = getPackageLink ( pkg , contents . packageLabel ) ; Content li = HtmlTree . LI ( linkContent ) ; return li ; |
public class AdjustedRangeInputStream { /** * / * ( non - Javadoc )
* @ see java . io . InputStream # close ( ) */
@ Override public void close ( ) throws IOException { } } | // If not already closed , then close the input stream .
if ( ! this . closed ) { this . closed = true ; // if the user read to the end of the virtual stream , then drain
// the wrapped stream so the HTTP client can keep this connection
// alive if possible .
// This should not have too much overhead since if we ' ve reached the
// end of the virtual stream , there should be at most 31 bytes left
// (2 * JceEncryptionConstants . SYMMETRIC _ CIPHER _ BLOCK _ SIZE - 1 ) in the
// stream .
// See : S3CryptoModuleBase # getCipherBlockUpperBound
if ( this . virtualAvailable == 0 ) { IOUtils . drainInputStream ( decryptedContents ) ; } this . decryptedContents . close ( ) ; } abortIfNeeded ( ) ; |
public class HikariPool { /** * { @ inheritDoc } */
@ Override public void addBagItem ( final int waiting ) { } } | final boolean shouldAdd = waiting - addConnectionQueue . size ( ) >= 0 ; // Yes , > = is intentional .
if ( shouldAdd ) { addConnectionExecutor . submit ( poolEntryCreator ) ; } |
public class MainActivity { /** * Request permissions . */
private void requestPermission ( String ... permissions ) { } } | AndPermission . with ( this ) . runtime ( ) . permission ( permissions ) . rationale ( new RuntimeRationale ( ) ) . onGranted ( new Action < List < String > > ( ) { @ Override public void onAction ( List < String > permissions ) { toast ( R . string . successfully ) ; } } ) . onDenied ( new Action < List < String > > ( ) { @ Override public void onAction ( @ NonNull List < String > permissions ) { toast ( R . string . failure ) ; if ( AndPermission . hasAlwaysDeniedPermission ( MainActivity . this , permissions ) ) { showSettingDialog ( MainActivity . this , permissions ) ; } } } ) . start ( ) ; |
public class FastTrackUtility { /** * Skip to the next matching short value .
* @ param buffer input data array
* @ param offset start offset into the input array
* @ param value value to match
* @ return offset of matching pattern */
public static int skipToNextMatchingShort ( byte [ ] buffer , int offset , int value ) { } } | int nextOffset = offset ; while ( getShort ( buffer , nextOffset ) != value ) { ++ nextOffset ; } nextOffset += 2 ; return nextOffset ; |
public class FJIterate { /** * Iterate over the collection specified in parallel batches . The
* ObjectIntProcedure used must be stateless , or use concurrent aware objects if they are to be shared . The
* specified minimum fork size and task count are used instead of the default values .
* @ param minForkSize Only run in parallel if input collection is longer than this .
* @ param taskCount The number of parallel tasks to submit to the executor .
* @ see # forEachWithIndex ( Iterable , ObjectIntProcedure ) */
public static < T , PT extends ObjectIntProcedure < ? super T > > void forEachWithIndex ( Iterable < T > iterable , PT procedure , int minForkSize , int taskCount ) { } } | PassThruObjectIntProcedureFactory < PT > procedureFactory = new PassThruObjectIntProcedureFactory < > ( procedure ) ; PassThruCombiner < PT > combiner = new PassThruCombiner < > ( ) ; FJIterate . forEachWithIndex ( iterable , procedureFactory , combiner , minForkSize , taskCount ) ; |
public class Routes { /** * finds target for a requested route
* @ param httpMethod the http method
* @ param path the path
* @ param acceptType the accept type
* @ return the target */
public RouteMatch find ( HttpMethod httpMethod , String path , String acceptType ) { } } | List < RouteEntry > routeEntries = this . findTargetsForRequestedRoute ( httpMethod , path ) ; RouteEntry entry = findTargetWithGivenAcceptType ( routeEntries , acceptType ) ; return entry != null ? new RouteMatch ( entry . target , entry . path , path , acceptType ) : null ; |
public class ListJobsRequest { /** * Specifies to return only these tagged resources .
* @ param tags
* Specifies to return only these tagged resources .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListJobsRequest withTags ( java . util . Map < String , String > tags ) { } } | setTags ( tags ) ; return this ; |
public class IntuitRetryPolicyHandler { /** * method to validate the retry policies
* @ return boolean */
public boolean retryRequest ( IOException exception , int executionCount , HttpContext context ) { } } | LOG . debug ( "In retry request" ) ; if ( exception == null ) { throw new IllegalArgumentException ( "Exception parameter may not be null" ) ; } else if ( context == null ) { throw new IllegalArgumentException ( "HTTP context may not be null" ) ; } if ( executionCount > this . retryCount ) { return checkPolicy ( executionCount ) ; } else if ( exception instanceof NoHttpResponseException ) { // Retry if the server dropped connection on us
return checkPolicy ( executionCount ) ; } else if ( exception instanceof InterruptedIOException ) { // Timeout
return false ; } else if ( exception instanceof UnknownHostException ) { // Unknown host
return false ; } else if ( exception instanceof ConnectException ) { // Connection refused
return false ; } else if ( exception instanceof SSLException ) { // SSL handshake exception
return false ; } else if ( exception instanceof ProtocolException ) { // protocol exception
return false ; } else if ( exception instanceof SaslException ) { // Sasl exception
return false ; } HttpRequest request = ( HttpRequest ) context . getAttribute ( HttpCoreContext . HTTP_REQUEST ) ; boolean idempotent = ! ( request instanceof HttpEntityEnclosingRequest ) ; if ( idempotent ) { // Retry if the request is considered idempotent
return checkPolicy ( executionCount ) ; } Boolean b = ( Boolean ) context . getAttribute ( HttpCoreContext . HTTP_REQ_SENT ) ; boolean sent = ( b != null && b . booleanValue ( ) ) ; // if ( ! sent | | this . requestSentRetryEnabled ) {
// Retry if the request has not been sent fully or
// if it ' s OK to retry methods that have been sent
if ( ! sent ) { return checkPolicy ( executionCount ) ; } // otherwise do not retry
return false ; |
public class AbstractManagerFactory { /** * Shutdown the manager factory and the related session and executor service ( if they are created by Achilles ) .
* If the Java driver Session object and / or the executor service were provided as bootstrap parameter , Achilles
* will < strong > NOT < / strong > shut them down . This should be handled externally */
@ PreDestroy public void shutDown ( ) { } } | LOGGER . info ( "Calling shutdown on ManagerFactory" ) ; if ( ! configContext . isProvidedSession ( ) ) { LOGGER . info ( format ( "Closing built Session object %s" , rte . session ) ) ; rte . session . close ( ) ; } if ( ! configContext . isProvidedExecutorService ( ) ) { LOGGER . info ( format ( "Closing built executor service (thread pool) %s" , configContext . getExecutorService ( ) ) ) ; configContext . getExecutorService ( ) . shutdown ( ) ; } |
public class ExpressionUtils { /** * Parses an ISO8601 formatted time instant from a string value */
public static Instant parseJsonDate ( String value ) { } } | if ( value == null ) { return null ; } return LocalDateTime . parse ( value , JSON_DATETIME_FORMAT ) . atOffset ( ZoneOffset . UTC ) . toInstant ( ) ; |
public class RestoresInner { /** * Restores the specified backup data . This is an asynchronous operation . To know the status of this API call , use GetProtectedItemOperationResult API .
* @ param vaultName The name of the Recovery Services vault .
* @ param resourceGroupName The name of the resource group associated with the Recovery Services vault .
* @ param fabricName The fabric name associated with the backup items .
* @ param containerName The container name associated with the backup items .
* @ param protectedItemName The backup item to be restored .
* @ param recoveryPointId The recovery point ID for the backup data to be restored .
* @ param resourceRestoreRequest The resource restore request .
* @ 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 */
public void trigger ( String vaultName , String resourceGroupName , String fabricName , String containerName , String protectedItemName , String recoveryPointId , RestoreRequestResource resourceRestoreRequest ) { } } | triggerWithServiceResponseAsync ( vaultName , resourceGroupName , fabricName , containerName , protectedItemName , recoveryPointId , resourceRestoreRequest ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class PendingCheckpointStats { /** * Reports a successfully completed pending checkpoint .
* @ param externalPointer Optional external storage path if checkpoint was externalized .
* @ return Callback for the { @ link CompletedCheckpoint } instance to notify about disposal . */
CompletedCheckpointStats . DiscardCallback reportCompletedCheckpoint ( String externalPointer ) { } } | CompletedCheckpointStats completed = new CompletedCheckpointStats ( checkpointId , triggerTimestamp , props , numberOfSubtasks , new HashMap < > ( taskStats ) , currentNumAcknowledgedSubtasks , currentStateSize , currentAlignmentBuffered , latestAcknowledgedSubtask , externalPointer ) ; trackerCallback . reportCompletedCheckpoint ( completed ) ; return completed . getDiscardCallback ( ) ; |
public class GaussWeight { /** * Get Gaussian weight . stddev is not used , scaled using max . */
@ Override public double getWeight ( double distance , double max , double stddev ) { } } | if ( max <= 0 ) { return 1.0 ; } double relativedistance = distance / max ; // -2.303 is log ( . 1 ) to suit the intended range of 1.0-0.1
return FastMath . exp ( - 2.3025850929940455 * relativedistance * relativedistance ) ; |
public class DescribeProductRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeProductRequest describeProductRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeProductRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeProductRequest . getAcceptLanguage ( ) , ACCEPTLANGUAGE_BINDING ) ; protocolMarshaller . marshall ( describeProductRequest . getId ( ) , ID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class LineManager { /** * Set the LineTranslate property
* The geometry ' s offset . Values are [ x , y ] where negatives indicate left and up , respectively .
* @ param value property wrapper value around Float [ ] */
public void setLineTranslate ( Float [ ] value ) { } } | PropertyValue propertyValue = lineTranslate ( value ) ; constantPropertyUsageMap . put ( PROPERTY_LINE_TRANSLATE , propertyValue ) ; layer . setProperties ( propertyValue ) ; |
public class SPX { /** * / * [ deutsch ]
* < p > Implementierungsmethode des Interface { @ link Externalizable } . < / p >
* < p > Das erste Byte enth & auml ; lt um 4 Bits nach links verschoben den
* Typ des zu serialisierenden Objekts . Danach folgen die Daten - Bits
* in einer bit - komprimierten Darstellung . < / p >
* @ serialData data layout see { @ code writeReplace ( ) } - method of object
* to be serialized
* @ param out output stream
* @ throws IOException in case of I / O - problems */
@ Override public void writeExternal ( ObjectOutput out ) throws IOException { } } | switch ( this . type ) { case FALLBACK_TIMEZONE_TYPE : this . writeFallback ( out ) ; break ; case TRANSITION_RESOLVER_TYPE : this . writeStrategy ( out ) ; break ; case HISTORIZED_TIMEZONE_TYPE : this . writeZone ( out ) ; break ; case ZONAL_OFFSET_TYPE : this . writeOffset ( out ) ; break ; default : throw new InvalidClassException ( "Unknown serialized type." ) ; } |
public class IfcRepresentationMapImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcShapeAspect > getHasShapeAspects ( ) { } } | return ( EList < IfcShapeAspect > ) eGet ( Ifc4Package . Literals . IFC_REPRESENTATION_MAP__HAS_SHAPE_ASPECTS , true ) ; |
public class StreamUtils { /** * Copy all the characters from a reader to a writer .
* @ param reader Input character stream
* @ param writer Output character stream
* @ param transferBufferSize Size of character buffer used to transfer characters from
* one stream to the other
* @ throws IOException */
static public void copyStream ( Reader reader , Writer writer , int transferBufferSize ) throws IOException { } } | if ( transferBufferSize < 1 ) { throw new IOException ( "Transfer buffer size can not be smaller than 1" ) ; } char [ ] buffer = new char [ transferBufferSize ] ; int bytesRead = reader . read ( buffer ) ; while ( bytesRead >= 0 ) { writer . write ( buffer , 0 , bytesRead ) ; bytesRead = reader . read ( buffer ) ; } |
public class CellStyleProxy { /** * 書式を設定する 。
* < p > 設定使用とする書式がない場合は 、 セルの書式を優先する 。
* < br > ただし 、 セルの書式も内場合は 、 デフォルトの書式を設定する 。
* @ param settingPattern 設定しようとする書式 ( 空の場合がある )
* @ param defaultPattern デフォルトの書式 */
public void setDataFormat ( final String settingPattern , final String defaultPattern , final CellFormatter cellFormatter ) { } } | String currentPattern = POIUtils . getCellFormatPattern ( cell , cellFormatter ) ; if ( Utils . isNotEmpty ( settingPattern ) ) { // アノテーションで書式が指定されている場合 、 更新する
setDataFormat ( settingPattern , cellFormatter ) ; } else if ( currentPattern . isEmpty ( ) || currentPattern . equalsIgnoreCase ( "general" ) ) { // セルの書式が設定されていない場合 、 デフォルトの値で更新する
setDataFormat ( defaultPattern , cellFormatter ) ; } |
public class ReflectionUtils { /** * Invoke the specified { @ link Method } against the supplied target object with the supplied arguments . The target object can
* be { @ code null } when invoking a static { @ link Method } .
* Thrown exceptions are handled via a call to { @ link # handleReflectionException } .
* @ param method the method to invoke
* @ param target the target object to invoke the method on
* @ param args the invocation arguments ( may be { @ code null } )
* @ return the invocation result , if any */
public static Object invokeMethod ( Method method , Object target , Object ... args ) { } } | try { return method . invoke ( target , args ) ; } catch ( Exception ex ) { handleReflectionException ( ex ) ; } throw new IllegalStateException ( "Should never get here" ) ; |
public class FileSystemContext { /** * Read the contents of the file at the given path and return the associated
* byte array .
* @ param filePath The path to the file to read
* @ return The contents of the file
* @ throws IOException if an error occurs reading the file */
public byte [ ] getFileBytes ( String filePath ) throws IOException { } } | byte [ ] out = null ; String path = ( String ) Utils . intern ( filePath ) ; RandomAccessFile raf = null ; synchronized ( path ) { File file = null ; try { file = new File ( path ) ; boolean exists = file . exists ( ) ; if ( exists ) { byte [ ] fileBytes = new byte [ ( int ) file . length ( ) ] ; raf = new RandomAccessFile ( file , "r" ) ; raf . readFully ( fileBytes ) ; out = fileBytes ; } else { String msg = "File does not exist. (" + filePath + ")" ; mLog . error ( msg ) ; throw new IOException ( msg ) ; } } catch ( IOException e ) { mLog . error ( "Error writing: " + filePath ) ; mLog . error ( e ) ; throw e ; } finally { if ( raf != null ) { raf . close ( ) ; } } } return out ; |
public class Geometry { /** * Returns cardinal points for a given bounding box
* @ param box the bounding box
* @ return [ C , N , NE , E , SE , S , SW , W , NW ] */
public static final Point2DArray getCardinals ( final BoundingBox box , final Direction [ ] requestedCardinals ) { } } | final Set < Direction > set = new HashSet < > ( Arrays . asList ( requestedCardinals ) ) ; final Point2DArray points = new Point2DArray ( ) ; final Point2D c = findCenter ( box ) ; final Point2D n = new Point2D ( c . getX ( ) , box . getY ( ) ) ; final Point2D e = new Point2D ( box . getX ( ) + box . getWidth ( ) , c . getY ( ) ) ; final Point2D s = new Point2D ( c . getX ( ) , box . getY ( ) + box . getHeight ( ) ) ; final Point2D w = new Point2D ( box . getX ( ) , c . getY ( ) ) ; final Point2D sw = new Point2D ( w . getX ( ) , s . getY ( ) ) ; final Point2D se = new Point2D ( e . getX ( ) , s . getY ( ) ) ; final Point2D ne = new Point2D ( e . getX ( ) , n . getY ( ) ) ; final Point2D nw = new Point2D ( w . getX ( ) , n . getY ( ) ) ; points . push ( c ) ; if ( set . contains ( Direction . NORTH ) ) { points . push ( n ) ; } if ( set . contains ( Direction . NORTH_EAST ) ) { points . push ( ne ) ; } if ( set . contains ( Direction . EAST ) ) { points . push ( e ) ; } if ( set . contains ( Direction . SOUTH_EAST ) ) { points . push ( se ) ; } if ( set . contains ( Direction . SOUTH ) ) { points . push ( s ) ; } if ( set . contains ( Direction . SOUTH_WEST ) ) { points . push ( sw ) ; } if ( set . contains ( Direction . WEST ) ) { points . push ( w ) ; } if ( set . contains ( Direction . NORTH_WEST ) ) { points . push ( nw ) ; } return points ; |
public class SparkJobContext { /** * Gets the path defined in the job properties file
* @ return */
public URI getResultPath ( ) { } } | final String str = _customProperties . get ( PROPERTY_RESULT_PATH ) ; if ( Strings . isNullOrEmpty ( str ) ) { return null ; } return URI . create ( str ) ; |
public class ElementParametersImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setElementRef ( String newElementRef ) { } } | String oldElementRef = elementRef ; elementRef = newElementRef ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , BpsimPackage . ELEMENT_PARAMETERS__ELEMENT_REF , oldElementRef , elementRef ) ) ; |
public class AbstractUserObject { /** * Method to set the status of a UserObject in the eFaps Database .
* @ param _ status status to set
* @ throws EFapsException on error */
protected void setStatusInDB ( final boolean _status ) throws EFapsException { } } | Connection con = null ; try { con = Context . getConnection ( ) ; PreparedStatement stmt = null ; final StringBuilder cmd = new StringBuilder ( ) ; try { cmd . append ( " update T_USERABSTRACT set STATUS=? where ID=" ) . append ( getId ( ) ) ; stmt = con . prepareStatement ( cmd . toString ( ) ) ; stmt . setBoolean ( 1 , _status ) ; final int rows = stmt . executeUpdate ( ) ; if ( rows == 0 ) { AbstractUserObject . LOG . error ( "could not execute '" + cmd . toString ( ) + "' to update status information for person '" + toString ( ) + "'" ) ; throw new EFapsException ( getClass ( ) , "setStatusInDB.NotUpdated" , cmd . toString ( ) , getName ( ) ) ; } } catch ( final SQLException e ) { AbstractUserObject . LOG . error ( "could not execute '" + cmd . toString ( ) + "' to update status information for person '" + toString ( ) + "'" , e ) ; throw new EFapsException ( getClass ( ) , "setStatusInDB.SQLException" , e , cmd . toString ( ) , getName ( ) ) ; } finally { try { if ( stmt != null ) { stmt . close ( ) ; } con . commit ( ) ; } catch ( final SQLException e ) { throw new EFapsException ( getClass ( ) , "setStatusInDB.SQLException" , e , cmd . toString ( ) , getName ( ) ) ; } } } finally { try { if ( con != null && ! con . isClosed ( ) ) { con . close ( ) ; } } catch ( final SQLException e ) { throw new CacheReloadException ( "Cannot read a type for an attribute." , e ) ; } } |
public class HadoopJob { /** * Returns a string representation of this job status
* @ return string representation of this job status */
public String getStatus ( ) { } } | StringBuffer s = new StringBuffer ( ) ; s . append ( "Maps : " + completedMaps + "/" + totalMaps ) ; s . append ( " (" + mapProgress + ")" ) ; s . append ( " Reduces : " + completedReduces + "/" + totalReduces ) ; s . append ( " (" + reduceProgress + ")" ) ; return s . toString ( ) ; |
public class ResourceQueryMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ResourceQuery resourceQuery , ProtocolMarshaller protocolMarshaller ) { } } | if ( resourceQuery == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( resourceQuery . getType ( ) , TYPE_BINDING ) ; protocolMarshaller . marshall ( resourceQuery . getQuery ( ) , QUERY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class PBaseCompareable { /** * Greater or equal to lower value and strictly less than upper value .
* This is generally preferable over Between for date and datetime types
* as SQL Between is inclusive on the upper bound ( < = ) and generally we
* need the upper bound to be exclusive ( < ) .
* @ param lower the lower bind value ( > = )
* @ param upper the upper bind value ( < )
* @ return the root query bean instance */
public final R inRange ( T lower , T upper ) { } } | expr ( ) . inRange ( _name , lower , upper ) ; return _root ; |
public class GuildManager { /** * Sets the name of this { @ link net . dv8tion . jda . core . entities . Guild Guild } .
* @ param name
* The new name for this { @ link net . dv8tion . jda . core . entities . Guild Guild }
* @ throws IllegalArgumentException
* If the provided name is { @ code null } or not between 2-100 characters long
* @ return GuildManager for chaining convenience */
@ CheckReturnValue public GuildManager setName ( String name ) { } } | Checks . notNull ( name , "Name" ) ; Checks . check ( name . length ( ) >= 2 && name . length ( ) <= 100 , "Name must be between 2-100 characters long" ) ; this . name = name ; set |= NAME ; return this ; |
public class AbstractVueComponentFactoryGenerator { /** * Generate our { @ link VueComponentFactory } class .
* @ param component The { @ link IsVueComponent } class to generate { @ link VueComponentOptions } from */
public void generate ( TypeElement component ) { } } | ClassName vueFactoryClassName = componentFactoryName ( component ) ; Builder vueFactoryBuilder = createFactoryBuilderClass ( component , vueFactoryClassName ) ; createGetName ( vueFactoryBuilder , component ) ; createProperties ( vueFactoryClassName , vueFactoryBuilder ) ; List < CodeBlock > staticInitParameters = createInitMethod ( component , vueFactoryBuilder ) ; createStaticGetMethod ( component , vueFactoryClassName , vueFactoryBuilder , staticInitParameters ) ; vueFactoryBuilder . addMethod ( MethodSpec . constructorBuilder ( ) . addModifiers ( Modifier . PROTECTED ) . addAnnotation ( Inject . class ) . build ( ) ) ; // Build the ComponentOptions class
GeneratorsUtil . toJavaFile ( filer , vueFactoryBuilder , vueFactoryClassName , component ) ; |
public class ExecutionEntity { /** * for setting the process definition , this setter must be used as subclasses
* can override */
protected void ensureProcessDefinitionInitialized ( ) { } } | if ( ( processDefinition == null ) && ( processDefinitionId != null ) ) { ProcessDefinitionEntity deployedProcessDefinition = Context . getProcessEngineConfiguration ( ) . getDeploymentCache ( ) . findDeployedProcessDefinitionById ( processDefinitionId ) ; setProcessDefinition ( deployedProcessDefinition ) ; } |
public class CharacterApi { /** * Get character corporation titles Returns a character & # 39 ; s titles - - -
* This route is cached for up to 3600 seconds SSO Scope :
* esi - characters . read _ titles . v1
* @ param characterId
* An EVE character ID ( required )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param ifNoneMatch
* ETag from a previous request . A 304 will be returned if this
* matches the current ETag ( optional )
* @ param token
* Access token to use if unable to set a header ( optional )
* @ return List & lt ; CharacterTitlesResponse & gt ;
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public List < CharacterTitlesResponse > getCharactersCharacterIdTitles ( Integer characterId , String datasource , String ifNoneMatch , String token ) throws ApiException { } } | ApiResponse < List < CharacterTitlesResponse > > resp = getCharactersCharacterIdTitlesWithHttpInfo ( characterId , datasource , ifNoneMatch , token ) ; return resp . getData ( ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.