signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class JSONAssetConverter { /** * Read a single assets from an input stream
* @ param inputStream
* The stream to read from
* @ return The list of assets
* @ throws IOException
* @ throws BadVersionException */
public static Asset readValue ( InputStream inputStream ) throws IOException , BadVersionException { } } | return DataModelSerializer . deserializeObject ( inputStream , Asset . class ) ; |
public class JmxWebServer { /** * Start the internal Jetty web server and configure the { @ link JmxWebHandler } to handle the requests . */
public void start ( ) throws Exception { } } | server = new Server ( ) ; ServerConnector connector = new ServerConnector ( server ) ; if ( serverAddress != null ) { connector . setHost ( serverAddress . getHostAddress ( ) ) ; } connector . setPort ( serverPort ) ; server . addConnector ( connector ) ; server . setHandler ( new JmxWebHandler ( ) ) ; server . start ( ) ; |
public class ResourceTracker { /** * Find what new requests need to be sent by finding out resources needed
* by tasks but not sent to Cluster Manager .
* @ return */
public List < ResourceRequest > getWantedResources ( ) { } } | List < ResourceRequest > wanted = new ArrayList < ResourceRequest > ( ) ; synchronized ( lockObject ) { for ( Integer requestId : setDifference ( requestMap . keySet ( ) , requestedResources . keySet ( ) ) ) { ResourceRequest req = requestMap . get ( requestId ) ; LOG . info ( "Filing request for resource " + requestId ) ; requestedResources . put ( requestId , req ) ; wanted . add ( req ) ; } } return wanted ; |
public class ArrayOutputStream { /** * Expand the underlying byte array to fit size bytes . */
private void expandIfNecessary ( int size ) { } } | if ( bytes . length >= size ) { // no need to expand
return ; } // either double , or expand to fit size
int newlength = Math . max ( 2 * bytes . length , size ) ; bytes = Arrays . copyOf ( bytes , newlength ) ; |
public class CssSkinGenerator { /** * ( non - Javadoc )
* @ see
* net . jawr . web . resource . handler . reader . ResourceBrowser # isDirectory ( java
* . lang . String ) */
@ Override public boolean isDirectory ( String path ) { } } | String resourcePath = getResolver ( ) . getResourcePath ( path ) ; return rsBrowser . isDirectory ( resourcePath ) ; |
public class SessionDataManager { /** * Returns saved only references ( allowed by specs ) .
* @ param identifier
* String
* @ return List of PropertyImpl
* @ throws RepositoryException
* if error
* @ see javax . jcr . Node # getReferences */
public List < PropertyImpl > getReferences ( String identifier ) throws RepositoryException { } } | List < PropertyData > refDatas = transactionableManager . getReferencesData ( identifier , true ) ; List < PropertyImpl > refs = new ArrayList < PropertyImpl > ( refDatas . size ( ) ) ; for ( int i = 0 , length = refDatas . size ( ) ; i < length ; i ++ ) { PropertyData data = refDatas . get ( i ) ; ItemState state = changesLog . getItemState ( data . getIdentifier ( ) ) ; if ( state != null ) { if ( state . isDeleted ( ) ) { // if the Property was deleted skip it for now
continue ; } // otherwise use transient data
data = ( PropertyData ) state . getData ( ) ; } NodeData parent = ( NodeData ) getItemData ( data . getParentIdentifier ( ) ) ; // if parent exists check for read permissions , otherwise the parent was deleted in another session .
if ( parent != null ) { // skip not permitted
if ( accessManager . hasPermission ( parent . getACL ( ) , new String [ ] { PermissionType . READ } , session . getUserState ( ) . getIdentity ( ) ) ) { PropertyImpl item = ( PropertyImpl ) readItem ( data , parent , true , false ) ; refs . add ( item ) ; session . getActionHandler ( ) . postRead ( item ) ; } } } return refs ; |
public class DynamoDBMapperTableModel { /** * Gets the range key field model for the specified type .
* @ param < R > The range key type .
* @ return The range key field model , or null if not present . */
@ SuppressWarnings ( "unchecked" ) public < R > DynamoDBMapperFieldModel < T , R > rangeKeyIfExists ( ) { } } | return ( DynamoDBMapperFieldModel < T , R > ) keys . get ( RANGE ) ; |
public class Reflect { /** * This method is used to get catual { @ link CommunicationMode } os service method .
* < p > The following modes are supported :
* < ul >
* < li > { @ link CommunicationMode # REQUEST _ CHANNEL } - service has at least one parameter , and the
* first parameter is either of type return type { @ link Flux } or { @ link Publisher } ;
* < li > { @ link CommunicationMode # REQUEST _ STREAM } - service ' s return type is { @ link Flux } , and
* parameter is not { @ link Flux } ;
* < li > { @ link CommunicationMode # REQUEST _ RESPONSE } - service ' s return type is Mono ;
* < li > { @ link CommunicationMode # FIRE _ AND _ FORGET } - service returns void ;
* < / ul >
* @ param method - Service method to be analyzed .
* @ return - { @ link CommunicationMode } of service method . If method does not correspond to any of
* supported modes , throws { @ link IllegalArgumentException } */
public static CommunicationMode communicationMode ( Method method ) { } } | Class < ? > returnType = method . getReturnType ( ) ; if ( isRequestChannel ( method ) ) { return REQUEST_CHANNEL ; } else if ( returnType . isAssignableFrom ( Flux . class ) ) { return REQUEST_STREAM ; } else if ( returnType . isAssignableFrom ( Mono . class ) ) { return REQUEST_RESPONSE ; } else if ( returnType . isAssignableFrom ( Void . TYPE ) ) { return FIRE_AND_FORGET ; } else { throw new IllegalArgumentException ( "Service method is not supported (check return type or parameter type): " + method ) ; } |
public class CmsLockReportDialog { /** * Returns the dialog message for the given lock . < p >
* @ param lockIcon the lock icon
* @ param hasLockedChildren < code > true < / code > if the given resource has locked children
* @ return the dialog message */
private String getMessageForLock ( LockIcon lockIcon , boolean hasLockedChildren ) { } } | String result = "" ; if ( ! hasLockedChildren && ( ( lockIcon == null ) || ( lockIcon == LockIcon . NONE ) ) ) { result = Messages . get ( ) . key ( Messages . GUI_LOCK_REPORT_NOTHING_LOCKED_0 ) ; } else if ( ( lockIcon == LockIcon . OPEN ) || ( lockIcon == LockIcon . SHARED_OPEN ) ) { if ( hasLockedChildren ) { result = Messages . get ( ) . key ( Messages . GUI_LOCK_REPORT_UNLOCK_ALL_MESSAGE_0 ) ; } else { result = Messages . get ( ) . key ( Messages . GUI_LOCK_REPORT_UNLOCK_MESSAGE_0 ) ; } } else { if ( hasLockedChildren ) { result = Messages . get ( ) . key ( Messages . GUI_LOCK_REPORT_STEAL_ALL_LOCKS_MESSAGE_0 ) ; } else { result = Messages . get ( ) . key ( Messages . GUI_LOCK_REPORT_STEAL_LOCK_MESSAGE_0 ) ; } } return result ; |
public class StringUtils { /** * Appends the suffix to the end of the string if the string does not
* already end , case insensitive , with any of the suffixes .
* < pre >
* StringUtils . appendIfMissingIgnoreCase ( null , null ) = null
* StringUtils . appendIfMissingIgnoreCase ( " abc " , null ) = " abc "
* StringUtils . appendIfMissingIgnoreCase ( " " , " xyz " ) = " xyz "
* StringUtils . appendIfMissingIgnoreCase ( " abc " , " xyz " ) = " abcxyz "
* StringUtils . appendIfMissingIgnoreCase ( " abcxyz " , " xyz " ) = " abcxyz "
* StringUtils . appendIfMissingIgnoreCase ( " abcXYZ " , " xyz " ) = " abcXYZ "
* < / pre >
* < p > With additional suffixes , < / p >
* < pre >
* StringUtils . appendIfMissingIgnoreCase ( null , null , null ) = null
* StringUtils . appendIfMissingIgnoreCase ( " abc " , null , null ) = " abc "
* StringUtils . appendIfMissingIgnoreCase ( " " , " xyz " , null ) = " xyz "
* StringUtils . appendIfMissingIgnoreCase ( " abc " , " xyz " , new CharSequence [ ] { null } ) = " abcxyz "
* StringUtils . appendIfMissingIgnoreCase ( " abc " , " xyz " , " " ) = " abc "
* StringUtils . appendIfMissingIgnoreCase ( " abc " , " xyz " , " mno " ) = " axyz "
* StringUtils . appendIfMissingIgnoreCase ( " abcxyz " , " xyz " , " mno " ) = " abcxyz "
* StringUtils . appendIfMissingIgnoreCase ( " abcmno " , " xyz " , " mno " ) = " abcmno "
* StringUtils . appendIfMissingIgnoreCase ( " abcXYZ " , " xyz " , " mno " ) = " abcXYZ "
* StringUtils . appendIfMissingIgnoreCase ( " abcMNO " , " xyz " , " mno " ) = " abcMNO "
* < / pre >
* @ param str The string .
* @ param suffix The suffix to append to the end of the string .
* @ param suffixes Additional suffixes that are valid terminators .
* @ return A new String if suffix was appended , the same string otherwise .
* @ since 3.2 */
public static String appendIfMissingIgnoreCase ( final String str , final CharSequence suffix , final CharSequence ... suffixes ) { } } | return appendIfMissing ( str , suffix , true , suffixes ) ; |
public class HostProfileManager { /** * SDK4.1 signature for back compatibility */
public ApplyProfile createDefaultProfile ( String profileType ) throws RuntimeFault , RemoteException { } } | return createDefaultProfile ( profileType , null , null ) ; |
public class WebUtils { /** * Gets http servlet request geo location .
* @ param servletRequest the servlet request
* @ return the http servlet request geo location */
public static GeoLocationRequest getHttpServletRequestGeoLocation ( final HttpServletRequest servletRequest ) { } } | if ( servletRequest != null ) { return HttpRequestUtils . getHttpServletRequestGeoLocation ( servletRequest ) ; } return null ; |
public class ToastBuilder { /** * Build a Toast using the options specified in the builder .
* @ return The constructed Toast . */
@ SuppressLint ( "ShowToast" ) public Toast build ( ) { } } | Toast toast = Toast . makeText ( context , message , duration ) ; TextView toastMessage = setupToastView ( toast ) ; setToastMessageTextColor ( toastMessage ) ; setToastGravity ( toast ) ; return toast ; |
public class JsoupCssInliner { /** * Transfers styles from the < code > data - cssstyle < / code > attribute to the
* < code > style < / code > attribute .
* @ param doc
* the html document */
private void applyStyles ( Document doc ) { } } | Elements allStyledElements = doc . getElementsByAttribute ( TEMP_STYLE_ATTR ) ; for ( Element e : allStyledElements ) { String newStyle = e . attr ( TEMP_STYLE_ATTR ) ; String oldStyle = e . attr ( STYLE_ATTR ) ; e . attr ( STYLE_ATTR , ( newStyle + "; " + oldStyle ) . replaceAll ( ";+" , ";" ) . trim ( ) ) ; e . removeAttr ( TEMP_STYLE_ATTR ) ; } |
public class PtoPMessageItemStream { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . impl . store . itemstreams . SIMPItemStream # getPersistentData ( java . io . ObjectOutputStream ) */
public void getPersistentData ( ObjectOutputStream oos ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getPersistentData" , oos ) ; try { HashMap < String , Object > hm = new HashMap < String , Object > ( ) ; addPersistentDestinationData ( hm ) ; oos . writeObject ( hm ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.store.itemstreams.PtoPMessageItemStream.getPersistentData" , "1:396:1.93.1.14" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0003" , new Object [ ] { "com.ibm.ws.sib.processor.impl.store.itemstreams.PtoPMessageItemStream" , "1:403:1.93.1.14" , e , getDestinationHandler ( ) . getName ( ) } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getPersistentData" , e ) ; throw new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0003" , new Object [ ] { "com.ibm.ws.sib.processor.impl.store.itemstreams.PtoPMessageItemStream" , "1:415:1.93.1.14" , e , getDestinationHandler ( ) . getName ( ) } , null ) , e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getPersistentData" ) ; |
public class CommandBuilder { /** * Finds option by setting
* @ param key setting name
* @ return found option or null if none found */
private CommandOption < ? > findBySetting ( String key ) { } } | Assert . notNullOrEmptyTrimmed ( key , "Missing setting key!" ) ; Optional < CommandOption > found = options . stream ( ) . filter ( o -> o . getSetting ( ) . equals ( key ) ) . findFirst ( ) ; return found . orElse ( null ) ; |
public class SimpleSipServlet { /** * { @ inheritDoc } */
protected void doInvite ( SipServletRequest request ) throws ServletException , IOException { } } | if ( logger . isInfoEnabled ( ) ) { logger . info ( "Simple Servlet: Got request:\n" + request . getMethod ( ) ) ; } SipServletResponse sipServletResponse = request . createResponse ( SipServletResponse . SC_RINGING ) ; sipServletResponse . send ( ) ; sipServletResponse = request . createResponse ( SipServletResponse . SC_OK ) ; sipServletResponse . send ( ) ; if ( CALLEE_SEND_BYE . equalsIgnoreCase ( ( ( SipURI ) request . getTo ( ) . getURI ( ) ) . getUser ( ) ) ) { TimerService timer = ( TimerService ) getServletContext ( ) . getAttribute ( TIMER_SERVICE ) ; timer . createTimer ( request . getApplicationSession ( ) , byeDelay , false , request . getSession ( ) . getId ( ) ) ; } |
public class BootstrapConfig { /** * If necessary , verify the existence of the server . If - - create was
* specified indicating a new server should be created , then verify that the
* server does not already exist . Otherwise , verify that the server already
* exists ; if the server is ' defaultServer ' and is being started , create it
* if it doesn ' t already exist .
* If the server is created , default bootstrap . properties and server . xml files will be
* created unless the files to use were specified explicitly on the command line .
* @ param verifyServerString
* A value from the { @ link BootstrapConstants . VerifyServer } enum : describes
* whether or not a server should be created if it does not exist .
* @ param createOptions
* Other launch arguments , namely template options for use with create
* @ throws LaunchException
* If server does not exist and - - create was not specified and
* it is not the defaultServer . */
void verifyProcess ( VerifyServer verifyServer , LaunchArguments createOptions ) throws LaunchException { } } | if ( verifyServer == null || verifyServer == VerifyServer . SKIP ) { return ; } boolean generatePassword = createOptions == null || createOptions . getOption ( "no-password" ) == null ; if ( ! configDir . exists ( ) ) { if ( verifyServer == VerifyServer . CREATE || ( verifyServer == VerifyServer . CREATE_DEFAULT && getDefaultProcessName ( ) . equals ( processName ) ) ) { // start creating server and copy boot / config files as needed
// first make sure we can find the source files we need . . .
// CREATE _ DEFAULT will only appear here if someone launches
// without the server script or uses a non - default
// WLP _ OUTPUT _ DIR ( otherwise , the server script will have
// already created the directory ) . In any case , we should only
// respect - - template for - - create .
File template = findProcessTemplate ( verifyServer == VerifyServer . CREATE ? createOptions : null ) ; // Assuming we can find the files we need to create the server , let ' s create the server directory
if ( configDir . mkdirs ( ) ) { try { createConfigDirectory ( template ) ; generateServerEnv ( generatePassword ) ; } catch ( IOException e ) { throw new LocationException ( "Error occurred while trying to create new process " + processName , MessageFormat . format ( BootstrapConstants . messages . getString ( getErrorCreatingNewProcessMessageKey ( ) ) , processName , configDir . getAbsolutePath ( ) , e . getMessage ( ) ) , e ) ; } } else { // if the location hasn ' t been created since our last exist check
if ( ! ! ! configDir . exists ( ) ) { throw new LocationException ( "Unable to create process config directory " + configDir . getAbsolutePath ( ) , MessageFormat . format ( BootstrapConstants . messages . getString ( getErrorCreatingNewProcessMkDirFailMessageKey ( ) ) , processName , configDir . getAbsolutePath ( ) ) , null ) ; } else { // something else created the server location AFTER we did the exists check at the start of this method
throw new LocationException ( "Something else has been detected creating the process config directory " + configDir . getAbsolutePath ( ) , MessageFormat . format ( BootstrapConstants . messages . getString ( getErrorCreatingNewProcessExistsMessageKey ( ) ) , processName , configDir . getAbsolutePath ( ) ) , null ) ; } } } else { // Throw exception for missing server config .
LaunchException le = new LaunchException ( "Process config directory does not exist, and --create option not specified for " + processName , MessageFormat . format ( BootstrapConstants . messages . getString ( getErrorNoExistingProcessMessageKey ( ) ) , processName , configDir . getAbsolutePath ( ) ) ) ; le . setReturnCode ( ReturnCode . SERVER_NOT_EXIST_STATUS ) ; throw le ; } } else { if ( verifyServer == BootstrapConstants . VerifyServer . CREATE ) { LaunchException le = new LaunchException ( "Unable to create the process " + processName + " because the process config directory already exists" , MessageFormat . format ( BootstrapConstants . messages . getString ( getErrorProcessDirExistsMessageKey ( ) ) , processName , configDir ) ) ; le . setReturnCode ( ReturnCode . REDUNDANT_ACTION_STATUS ) ; throw le ; } // make sure we have a server . xml file
File f = getConfigFile ( getProcessXMLFilename ( ) ) ; // The server directory already exists , but server . xml might not
// exist for defaultServer . This happens when the server script
// creates an empty output directory ( which is the same as the
// config directory by default ) so it can use the output directory
// as the current working directory .
if ( ! f . exists ( ) && ( verifyServer == VerifyServer . CREATE_DEFAULT && getDefaultProcessName ( ) . equals ( processName ) ) ) { try { createConfigDirectory ( findProcessTemplate ( null ) ) ; generateServerEnv ( generatePassword ) ; } catch ( IOException e ) { // We can ignore this because a message will be output in a moment .
} } if ( ! f . exists ( ) || ! f . canRead ( ) ) { throw new LocationException ( "Not Found " + f . getAbsolutePath ( ) , MessageFormat . format ( BootstrapConstants . messages . getString ( "error.badConfigRoot" ) , f . getAbsolutePath ( ) , "file not found" ) ) ; } } |
public class TopicAdminClient { /** * Lists matching topics .
* < p > Sample code :
* < pre > < code >
* try ( TopicAdminClient topicAdminClient = TopicAdminClient . create ( ) ) {
* ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ;
* for ( Topic element : topicAdminClient . listTopics ( project . toString ( ) ) . iterateAll ( ) ) {
* / / doThingsWith ( element ) ;
* < / code > < / pre >
* @ param project The name of the project in which to list topics . Format is
* ` projects / { project - id } ` .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final ListTopicsPagedResponse listTopics ( String project ) { } } | ListTopicsRequest request = ListTopicsRequest . newBuilder ( ) . setProject ( project ) . build ( ) ; return listTopics ( request ) ; |
public class ConstantsSummaryBuilder { /** * Return true if the given package has constant fields to document .
* @ param pkg the package being checked .
* @ return true if the given package has constant fields to document . */
private boolean hasConstantField ( PackageDoc pkg ) { } } | ClassDoc [ ] classes = ( pkg . name ( ) . length ( ) > 0 ) ? pkg . allClasses ( ) : configuration . classDocCatalog . allClasses ( DocletConstants . DEFAULT_PACKAGE_NAME ) ; boolean found = false ; for ( ClassDoc doc : classes ) { if ( doc . isIncluded ( ) && hasConstantField ( doc ) ) { found = true ; } } return found ; |
public class UserService { /** * Returns the set of users with the given query parameters .
* @ param queryParams The query parameters
* @ return The set of users */
public Collection < User > list ( List < String > queryParams ) { } } | return HTTP . GET ( "/v2/users.json" , null , queryParams , USERS ) . get ( ) ; |
public class DefaultEntityTagFunction { /** * Appends a byte if it ' s not a leading zero . */
private static int appendByte ( byte [ ] dst , int offset , long value ) { } } | if ( value == 0 ) { return offset ; } dst [ offset ] = ( byte ) value ; return offset + 1 ; |
public class MailPart { /** * wrap a single line
* @ param str
* @ return wraped Line */
private String wrapLine ( String str ) { } } | int wtl = wraptext ; if ( str . length ( ) <= wtl ) return str ; String sub = str . substring ( 0 , wtl ) ; String rest = str . substring ( wtl ) ; char firstR = rest . charAt ( 0 ) ; String ls = System . getProperty ( "line.separator" ) ; if ( firstR == ' ' || firstR == '\t' ) return sub + ls + wrapLine ( rest . length ( ) > 1 ? rest . substring ( 1 ) : "" ) ; int indexSpace = sub . lastIndexOf ( ' ' ) ; int indexTab = sub . lastIndexOf ( '\t' ) ; int index = indexSpace <= indexTab ? indexTab : indexSpace ; if ( index == - 1 ) return sub + ls + wrapLine ( rest ) ; return sub . substring ( 0 , index ) + ls + wrapLine ( sub . substring ( index + 1 ) + rest ) ; |
public class CharSlice { /** * Checks if the byte array is contained in the slice .
* @ param a The byte array to find .
* @ return True if the byte array was found . */
public final boolean contains ( char [ ] a ) { } } | final int last_pos = off + len - a . length ; outer : for ( int pos = off ; pos <= last_pos ; ++ pos ) { for ( int a_off = 0 ; a_off < a . length ; ++ a_off ) { if ( a [ a_off ] != fb [ pos + a_off ] ) { continue outer ; } } return true ; } return false ; |
public class BsonWriter { /** * Write to the supplied output the binary BSON representation of the supplied in - memory { @ link Document } .
* @ param object the BSON object or BSON value ; may not be null
* @ param output the output ; may not be null
* @ throws IOException if there was a problem writing to the ObjectOutput */
public void write ( Object object , DataOutput output ) throws IOException { } } | ByteArrayOutputStream stream = new ByteArrayOutputStream ( ) ; write ( object , stream ) ; stream . flush ( ) ; byte [ ] bytes = stream . toByteArray ( ) ; output . write ( bytes ) ; |
public class ChunkedWriteHandler { /** * Continues to fetch the chunks from the input . */
public void resumeTransfer ( ) { } } | final ChannelHandlerContext ctx = this . ctx ; if ( ctx == null ) { return ; } if ( ctx . executor ( ) . inEventLoop ( ) ) { resumeTransfer0 ( ctx ) ; } else { // let the transfer resume on the next event loop round
ctx . executor ( ) . execute ( new Runnable ( ) { @ Override public void run ( ) { resumeTransfer0 ( ctx ) ; } } ) ; } |
public class OffsetDateTimeField { /** * Set the specified amount of offset units to the specified time instant .
* @ param instant the time instant in millis to update .
* @ param value value of units to set .
* @ return the updated time instant .
* @ throws IllegalArgumentException if value is too large or too small . */
public long set ( long instant , int value ) { } } | FieldUtils . verifyValueBounds ( this , value , iMin , iMax ) ; return super . set ( instant , value - iOffset ) ; |
public class MatFileWriter { /** * Writes < code > MLArrays < / code > into < code > File < / code >
* @ param file
* the MAT - file to which data is written
* @ param data
* the collection of < code > { @ link MLArray } < / code > objects
* @ throws IOException
* if error occurred during MAT - file writing */
public synchronized void write ( File file , Collection < MLArray > data ) throws IOException { } } | FileOutputStream fos = new FileOutputStream ( file ) ; try { write ( fos . getChannel ( ) , data ) ; } catch ( IOException e ) { throw e ; } finally { fos . close ( ) ; } |
public class AppUtil { /** * Starts the settings app in order to show the information about a specific app .
* @ param context
* The context , the settings app should be started from , as an instance of the class
* { @ link Context } . The context may not be null
* @ param packageName
* The fully qualified package name of the app , whose information should be shown , as a
* { @ link String } . The package name may neither be null , nor empty */
public static void showAppInfo ( @ NonNull final Context context , @ NonNull final String packageName ) { } } | Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; Condition . INSTANCE . ensureNotNull ( packageName , "The package name may not be null" ) ; Condition . INSTANCE . ensureNotEmpty ( packageName , "The package name may not be empty" ) ; Intent intent = new Intent ( ) ; intent . setAction ( Settings . ACTION_APPLICATION_DETAILS_SETTINGS ) ; Uri uri = Uri . fromParts ( "package" , packageName , null ) ; intent . setData ( uri ) ; if ( intent . resolveActivity ( context . getPackageManager ( ) ) == null ) { throw new ActivityNotFoundException ( "App info for package " + packageName + " not available" ) ; } context . startActivity ( intent ) ; |
public class ParameterUtil { /** * Get values for a parameter from a database
* If a parameter is dependent of another parameter ( s ) his values will not be loaded
* @ param con connection to database
* @ param parameter parameter
* @ return a list of parameter values
* @ throws SQLException if an error to sql execution appears
* @ throws DialectException if dialect not found */
public static List < IdName > getParameterValues ( Connection con , QueryParameter parameter ) throws SQLException , DialectException { } } | List < IdName > values = new ArrayList < IdName > ( ) ; if ( parameter == null ) { return values ; } String source = parameter . getSource ( ) ; if ( parameter . isManualSource ( ) ) { if ( ! parameter . isDependent ( ) ) { values = getSelectValues ( con , source , true , parameter . getOrderBy ( ) ) ; } } else { int index = source . indexOf ( "." ) ; int index2 = source . lastIndexOf ( "." ) ; String tableName = source . substring ( 0 , index ) ; String columnName ; String shownColumnName = null ; if ( index == index2 ) { columnName = source . substring ( index + 1 ) ; } else { columnName = source . substring ( index + 1 , index2 ) ; shownColumnName = source . substring ( index2 + 1 ) ; } values = getColumnValues ( con , parameter . getSchema ( ) , tableName , columnName , shownColumnName , parameter . getOrderBy ( ) ) ; } return values ; |
public class TagMagix { /** * Alter the HTML document in page , updating URLs in the attrName attributes
* of all tagName tags such that :
* 1 ) absolute URLs are prefixed with : wmPrefix + pageTS 2 ) server - relative
* URLs are prefixed with : wmPrefix + pageTS + ( host of page ) 3)
* path - relative URLs are prefixed with : wmPrefix + pageTS + ( attribute URL
* resolved against pageUrl )
* @ param page
* @ param uriConverter
* @ param captureDate
* @ param baseUrl which must be absolute
* @ param tagName
* @ param attrName */
public static void markupTagREURIC ( StringBuilder page , ResultURIConverter uriConverter , String captureDate , String baseUrl , String tagName , String attrName ) { } } | Pattern tagPat = getPattern ( tagName , attrName ) ; markupTagREURIC ( page , uriConverter , captureDate , baseUrl , tagPat ) ; |
public class InternalCssScriptResourceRenderer { /** * This methods generates the HTML code of the current b : internalCssScriptResource .
* @ param context the FacesContext .
* @ param component the current b : internalCssScriptResource .
* @ throws IOException thrown if something goes wrong when writing the HTML code . */
@ Override public void encodeBegin ( FacesContext context , UIComponent component ) throws IOException { } } | if ( ! component . isRendered ( ) ) { return ; } InternalCssScriptResource internalCssScriptResource = ( InternalCssScriptResource ) component ; ResponseWriter rw = context . getResponseWriter ( ) ; rw . startElement ( "link" , internalCssScriptResource ) ; rw . writeAttribute ( "type" , "text/css" , null ) ; rw . writeAttribute ( "rel" , "stylesheet" , null ) ; rw . writeAttribute ( "href" , internalCssScriptResource . getUrl ( ) , null ) ; rw . endElement ( "link" ) ; |
public class DeleteResults { /** * Checks whether particular object was deleted
* @ param object object to check
* @ return true if object was deleted , false otherwise */
public boolean wasDeleted ( @ NonNull T object ) { } } | final DeleteResult result = results . get ( object ) ; return result != null && result . numberOfRowsDeleted ( ) > 0 ; |
public class StatementManager { /** * returns an Array with an Objects PK VALUES
* @ throws PersistenceBrokerException if there is an erros accessing o field values */
protected ValueContainer [ ] getKeyValues ( PersistenceBroker broker , ClassDescriptor cld , Object obj ) throws PersistenceBrokerException { } } | return broker . serviceBrokerHelper ( ) . getKeyValues ( cld , obj ) ; |
public class Jenkins { /** * Called by { @ link Job # renameTo ( String ) } to update relevant data structure .
* assumed to be synchronized on Jenkins by the caller . */
public void onRenamed ( TopLevelItem job , String oldName , String newName ) throws IOException { } } | items . remove ( oldName ) ; items . put ( newName , job ) ; // For compatibility with old views :
for ( View v : views ) v . onJobRenamed ( job , oldName , newName ) ; |
public class ClosableCharArrayWriter { /** * Writes the specified single character .
* @ param c the single character to be written .
* @ throws java . io . IOException if an I / O error occurs .
* In particular , an < tt > IOException < / tt > may be thrown
* if this writer has been { @ link # close ( ) closed } . */
public synchronized void write ( int c ) throws IOException { } } | checkClosed ( ) ; int newcount = count + 1 ; if ( newcount > buf . length ) { buf = copyOf ( buf , Math . max ( buf . length << 1 , newcount ) ) ; } buf [ count ] = ( char ) c ; count = newcount ; |
public class CompressUtil { /** * compress a source file / directory to a zip file
* @ param sources
* @ param target
* @ param filter
* @ throws IOException */
public static void compressZip ( Resource [ ] sources , Resource target , ResourceFilter filter ) throws IOException { } } | ZipOutputStream zos = null ; try { zos = new ZipOutputStream ( IOUtil . toBufferedOutputStream ( target . getOutputStream ( ) ) ) ; compressZip ( "" , sources , zos , filter ) ; } finally { IOUtil . closeEL ( zos ) ; } |
public class UpdateGatewayRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdateGatewayRequest updateGatewayRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updateGatewayRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateGatewayRequest . getGatewayArn ( ) , GATEWAYARN_BINDING ) ; protocolMarshaller . marshall ( updateGatewayRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( updateGatewayRequest . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( updateGatewayRequest . getSoftwareVersion ( ) , SOFTWAREVERSION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class HasInputStream { /** * Create a new object with a supplier that can be read only once .
* @ param aISP
* { @ link InputStream } provider . May not be < code > null < / code > .
* @ return Never < code > null < / code > . */
@ Nonnull @ ReturnsMutableCopy public static HasInputStream once ( @ Nonnull final ISupplier < ? extends InputStream > aISP ) { } } | return new HasInputStream ( aISP , false ) ; |
public class Strings { /** * Performs a null - safe { @ code toString ( ) } operation on each
* element of the set .
* @ param target the set of objects on which toString will be executed
* @ return for each element : the result of calling { @ code target . toString ( ) }
* if target is not null , { @ code null } if target is null .
* @ since 2.0.12 */
public Set < String > setToString ( final Set < ? > target ) { } } | if ( target == null ) { return null ; } final Set < String > result = new LinkedHashSet < String > ( target . size ( ) + 2 ) ; for ( final Object element : target ) { result . add ( toString ( element ) ) ; } return result ; |
public class ThreadCpuStats { /** * Convert time in nanoseconds to a duration string . This is used to provide a more human
* readable order of magnitude for the duration . We assume standard fixed size quantities for
* all units . */
public static String toDuration ( long inputTime ) { } } | final long second = 1000000000L ; final long minute = 60 * second ; final long hour = 60 * minute ; final long day = 24 * hour ; final long week = 7 * day ; long time = inputTime ; final StringBuilder buf = new StringBuilder ( ) ; buf . append ( 'P' ) ; time = append ( buf , 'W' , week , time ) ; time = append ( buf , 'D' , day , time ) ; buf . append ( 'T' ) ; time = append ( buf , 'H' , hour , time ) ; time = append ( buf , 'M' , minute , time ) ; append ( buf , 'S' , second , time ) ; return buf . toString ( ) ; |
public class ValidationConfigurator { /** * Load the class on the application class loader given the class name . More specifically ,
* the class will be loaded using which ever class loader already loaded the class , which
* is handled by { @ link # loadClass ( String ) } .
* @ param < T > the type of the class to be instantiated
* @ param clazz - class cannot be null . */
protected < T > T instantiateClass ( Class < T > clazz ) throws Throwable { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "instantiateClass" , clazz ) ; } T object = null ; try { object = clazz . newInstance ( ) ; } catch ( Throwable e ) { Tr . error ( tc , BVNLSConstants . BVKEY_CLASS_NOT_FOUND , new Object [ ] { ivBVContext . getPath ( ) , clazz , e } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Unable to create a ValidationFactory because of " , e ) ; } throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "instantiateClass" , object ) ; } return object ; |
public class AbstractDiskMap { /** * TODO : better with an Iterator */
public final Set < K > keySet ( ) { } } | try { Set < K > set = new HashSet < K > ( ) ; listFilesToSet ( getPath ( ) , set ) ; return set ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } |
public class SqlEntityQueryImpl { /** * { @ inheritDoc }
* s * @ see jp . co . future . uroborosql . fluent . SqlEntityQuery # desc ( java . lang . String , jp . co . future . uroborosql . fluent . SqlEntityQuery . Nulls ) */
@ Override public SqlEntityQuery < E > desc ( final String col , final Nulls nulls ) { } } | this . sortOrders . add ( new SortOrder ( col , Order . DESCENDING , nulls ) ) ; return this ; |
public class WonderPush { /** * Provides or withdraws user consent .
* < p > Call this method after { @ link # initialize ( Context ) } . < / p >
* @ param value Whether the user provided or withdrew consent .
* @ see # setRequiresUserConsent ( boolean ) */
public static void setUserConsent ( boolean value ) { } } | boolean hadUserConsent = hasUserConsent ( ) ; WonderPushConfiguration . setUserConsent ( value ) ; boolean nowHasUserConsent = hasUserConsent ( ) ; if ( sIsInitialized && hadUserConsent != nowHasUserConsent ) { hasUserConsentChanged ( nowHasUserConsent ) ; } |
public class LByteIntConsumerBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */
@ Nonnull public static LByteIntConsumer byteIntConsumerFrom ( Consumer < LByteIntConsumerBuilder > buildingFunction ) { } } | LByteIntConsumerBuilder builder = new LByteIntConsumerBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class TerminalConsoleAppender { /** * Closes the JLine { @ link Terminal } ( if available ) and restores the original
* terminal settings .
* @ throws IOException If an I / O error occurs */
public synchronized static void close ( ) throws IOException { } } | if ( initialized ) { initialized = false ; reader = null ; if ( terminal != null ) { try { terminal . close ( ) ; } finally { terminal = null ; } } } |
public class HamtPMap { /** * Internal recursive version of pivot . If parent is null then the result is used for the value in
* the returned map . The value , if found , is stored in the ' result ' array as a secondary return . */
private HamtPMap < K , V > pivot ( K key , int hash , HamtPMap < K , V > parent , V [ ] result ) { } } | int newMask = mask ; HamtPMap < K , V > [ ] newChildren = this . children ; if ( hash == this . hash && key . equals ( this . key ) ) { // Found the key : swap out this key / value with the parent and return the result in the holder .
result [ 0 ] = this . value ; } else { // Otherwise , see if the value might be present in a child .
int searchBucket = bucket ( hash ) ; int replacementBucket = bucket ( this . hash ) ; if ( searchBucket == replacementBucket ) { int bucketMask = 1 << searchBucket ; if ( ( mask & bucketMask ) != 0 ) { // Found a child , call pivot recursively .
int index = index ( bucketMask ) ; HamtPMap < K , V > child = newChildren [ index ] ; HamtPMap < K , V > newChild = child . pivot ( key , shift ( hash ) , this , result ) ; newChildren = replaceChild ( newChildren , index , newChild ) ; } } else { int searchMask = 1 << searchBucket ; if ( ( mask & searchMask ) != 0 ) { int index = index ( searchMask ) ; HamtPMap < K , V > child = newChildren [ index ] ; HamtPMap < K , V > newChild = child . minus ( key , shift ( hash ) , result ) ; if ( ! newChild . isEmpty ( ) ) { newChildren = replaceChild ( newChildren , index , newChild ) ; } else { newChildren = deleteChild ( newChildren , index ) ; newMask &= ~ searchMask ; } } int replacementMask = 1 << replacementBucket ; int index = Integer . bitCount ( newMask & ( replacementMask - 1 ) ) ; if ( ( mask & replacementMask ) != 0 ) { HamtPMap < K , V > child = newChildren [ index ] ; HamtPMap < K , V > newChild = child . plus ( this . key , shift ( this . hash ) , this . value ) ; newChildren = replaceChild ( newChildren , index , newChild ) ; } else { newChildren = insertChild ( newChildren , index , new HamtPMap < > ( this . key , shift ( this . hash ) , this . value , 0 , emptyChildren ( ) ) ) ; newMask |= replacementMask ; } } } return parent != null ? new HamtPMap < > ( parent . key , shift ( parent . hash ) , parent . value , newMask , newChildren ) : new HamtPMap < > ( key , hash , result [ 0 ] , newMask , newChildren ) ; |
public class Instant { /** * Returns a copy of this instant with the specified duration in nanoseconds subtracted .
* This instance is immutable and unaffected by this method call .
* @ param nanosToSubtract the nanoseconds to subtract , positive or negative
* @ return an { @ code Instant } based on this instant with the specified nanoseconds subtracted , not null
* @ throws DateTimeException if the result exceeds the maximum or minimum instant
* @ throws ArithmeticException if numeric overflow occurs */
public Instant minusNanos ( long nanosToSubtract ) { } } | if ( nanosToSubtract == Long . MIN_VALUE ) { return plusNanos ( Long . MAX_VALUE ) . plusNanos ( 1 ) ; } return plusNanos ( - nanosToSubtract ) ; |
public class TrileadVersionSupportManager { /** * Craetes an instance of TrileadVersionSupport that can provide functionality relevant to the version of Trilead
* available in the current executing instance of Jenkins .
* @ return an instance of TrileadVersionSupport that provides functionality relevant for the version of Trilead
* currently on the classpath */
static TrileadVersionSupport getTrileadSupport ( ) { } } | try { if ( isAfterTrilead8 ( ) ) { return createVersion9Instance ( ) ; } } catch ( Exception | LinkageError e ) { LOGGER . log ( Level . WARNING , "Could not create Trilead support class. Using legacy Trilead features" , e ) ; } // We ' re on an old version of Triilead or couldn ' t create a new handler , fall back to legacy trilead handler
return new LegacyTrileadVersionSupport ( ) ; |
public class SimpleParser { /** * { @ inheritDoc } */
@ Override public TemporalDataModelIF < Long , Long > parseTemporalData ( final File f ) throws IOException { } } | return parseData ( f , "\t" , true ) ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertPGDYpgBaseToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class SeekBarPreference { /** * Obtains the number of decimals of the floating point numbers , the preference allows to
* choose , from a specific typed array .
* @ param typedArray
* The typed array , the number of decimals should be obtained from , as an instance of
* the class { @ link TypedArray } . The typed array may not be null */
private void obtainDecimals ( @ NonNull final TypedArray typedArray ) { } } | int defaultValue = getContext ( ) . getResources ( ) . getInteger ( R . integer . seek_bar_preference_default_decimals ) ; setDecimals ( typedArray . getInteger ( R . styleable . SeekBarPreference_decimals , defaultValue ) ) ; |
public class JmsSysEventListener { /** * Close and release resources . */
public void close ( ) { } } | if ( consumer != null ) { try { consumer . close ( ) ; } catch ( Throwable t ) { warn ( t . getMessage ( ) ) ; } } conn . close ( ) ; |
public class AUUtils { /** * ABNF Definition
* PlayAnnParmList = PlayAnnParm * ( WSP PlayAnnParm ) ; PlayAnnParm = (
* AnnouncementParm / IterationsParm / IntervalParm / DurationParm /
* SpeedParm / VolumeParm ) ; AnnouncementParm = AnParmToken EQUALS
* Segmentlist ; Segmentlist = SegmentDescriptor * ( COMMA SegmentDescriptor ) ;
* SegmentDescriptor = ( ( SegmentId [ EmbedVarList ] [ SegSelectorList ] ) / (
* TextToSpeechSeg [ SegSelectorList ] ) / ( DisplayTextSeg [
* SegSelectorList ] ) / ( VariableSeg [ SegSelectorList ] ) / SilenceSeg ) ;
* IterationsParm = ItParmToken EQUALS ( NUMBER / " - 1 " ) ; IntervalParm =
* IvParmToken EQUALS NUMBER ; DurationParm = DuParmToken EQUALS NUMBER ;
* SpeedParm = SpParmToken EQUALS SIGNEDINT ; VolumeParm = VlParmToken EQUALS
* SIGNEDINT ; */
public Value decode_PlayAnnParmList ( ) throws ParserException { } } | boolean f = decode_PlayAnnParm ( ) ; if ( ! f ) { throw new ParserException ( "Parsing of AnnParm failed" ) ; } while ( f ) { f = decode_WSP ( ) ; if ( f ) { f = decode_PlayAnnParm ( ) ; } } return value ; |
public class SourceStream { /** * This method is called when the totalMessages on the stream
* falls and we have the possibility of sending a message
* because it is now inside the sendWindow */
private synchronized TickRange msgRemoved ( long tick , StateStream ststream , TransactionCommon tran ) throws SIResourceException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "msgRemoved" , new Object [ ] { Long . valueOf ( tick ) , ststream , tran } ) ; TickRange tr1 = null ; boolean sendMessage = false ; long stamp = tick ; // We know we have reduced the number of messages in the stream
totalMessages -- ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "totalMessages: " + totalMessages + ", sendWindow: " + sendWindow + ", definedSendWindow: " + definedSendWindow + ", firstMsgOutsideSendWindow: " + firstMsgOutsideWindow ) ; // We may not send any messages if our stream contains guesses
// or if we are supposed to be reducing the sendWindow
if ( ( ( containsGuesses ) || ( sendWindow > definedSendWindow ) ) && ( stamp < firstMsgOutsideWindow ) ) { // Just shrink the sendWindow
if ( sendWindow > 0 ) { sendWindow -- ; persistSendWindow ( sendWindow , tran ) ; } } else { // If the message we have just removed from the stream was
// inside the sendWindow then we can move up our
// firstMsgOutsideWindow and possibly send the message which
// moves inside the window
// If it actually was the first message outside the window
// the code below will also work
// If it was beyond the window we can afford to ignore it
if ( stamp <= firstMsgOutsideWindow ) { // send firstMsgOutsideWindow
// first need to get it and check that it is in Value state
ststream . setCursor ( firstMsgOutsideWindow ) ; // Get the first TickRange outside the inDoubt window
tr1 = ststream . getNext ( ) ; // This range must be either Uncommitted or Value as that is how
// we set the firstMsgOutsideWindow pointer
// Only want to send this message if it is
// committed . Otherwise do nothing as it will
// get sent when it commits
if ( tr1 . type == TickRange . Value ) { sendMessage = true ; } TickRange tr = null ; if ( totalMessages > sendWindow ) { // Get the next Value or Uncommitted tick from the stream
tr = ststream . getNext ( ) ; while ( tr . type == TickRange . Completed && tr . endstamp != RangeList . INFINITY ) { tr = ststream . getNext ( ) ; } firstMsgOutsideWindow = tr . valuestamp ; } // That was the last message outside the send window , so put us back into a state
// ignorant of guesses , otherwise we may not realise to re - calculate the firstMsgOutSideWindow
// the next time we get a guess .
else { firstMsgOutsideWindow = RangeList . INFINITY ; containsGuesses = false ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "firstMsgOutsideSendWindow: " + firstMsgOutsideWindow ) ; } } // Return a null if nothing to send
if ( ! sendMessage ) tr1 = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "msgRemoved" , tr1 ) ; return tr1 ; |
public class SubCountHandler { /** * Reset the field count .
* @ param bDisableListeners Disable the field listeners ( used for grid count verification )
* @ param iMoveMode Move mode . */
public int setCount ( double dFieldCount , boolean bDisableListeners , int iMoveMode ) { } } | int iErrorCode = DBConstants . NORMAL_RETURN ; if ( m_fldMain != null ) { boolean [ ] rgbEnabled = null ; if ( bDisableListeners ) rgbEnabled = m_fldMain . setEnableListeners ( false ) ; int iOriginalValue = ( int ) m_fldMain . getValue ( ) ; boolean bOriginalModified = m_fldMain . isModified ( ) ; int iOldOpenMode = m_fldMain . getRecord ( ) . setOpenMode ( m_fldMain . getRecord ( ) . getOpenMode ( ) & ~ DBConstants . OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY ) ; // don ' t trigger refresh and write
iErrorCode = m_fldMain . setValue ( dFieldCount , true , iMoveMode ) ; // Set in main file ' s field if the record is not current
m_fldMain . getRecord ( ) . setOpenMode ( iOldOpenMode ) ; if ( iOriginalValue == ( int ) m_fldMain . getValue ( ) ) if ( bOriginalModified == false ) m_fldMain . setModified ( bOriginalModified ) ; // Make sure this didn ' t change if change was just null to 0.
if ( rgbEnabled != null ) m_fldMain . setEnableListeners ( rgbEnabled ) ; } return iErrorCode ; |
public class AssociationRule { /** * Append to a string buffer .
* @ param buf Buffer
* @ param meta Relation metadata ( for labels )
* @ return String buffer for chaining . */
public StringBuilder appendTo ( StringBuilder buf , VectorFieldTypeInformation < BitVector > meta ) { } } | this . antecedent . appendTo ( buf , meta ) ; buf . append ( " --> " ) ; this . consequent . appendItemsTo ( buf , meta ) ; buf . append ( ": " ) ; buf . append ( union . getSupport ( ) ) ; buf . append ( " : " ) ; buf . append ( this . measure ) ; return buf ; |
public class ChessboardCornerGraph { /** * Convert into a generic graph . */
public void convert ( FeatureGraph2D graph ) { } } | graph . nodes . resize ( corners . size ) ; graph . reset ( ) ; for ( int i = 0 ; i < corners . size ; i ++ ) { Node c = corners . get ( i ) ; FeatureGraph2D . Node n = graph . nodes . grow ( ) ; n . reset ( ) ; n . set ( c . x , c . y ) ; n . index = c . index ; } for ( int i = 0 ; i < corners . size ; i ++ ) { Node c = corners . get ( i ) ; for ( int j = 0 ; j < 4 ; j ++ ) { if ( c . edges [ j ] == null ) continue ; graph . connect ( c . index , c . edges [ j ] . index ) ; } } |
public class FlatFileWriter { /** * Writes a flat file block to an output stream . Does not write
* anything if the line is empty . */
protected void writeBlock ( Writer writer , String header , String block ) throws IOException { } } | writeBlock ( writer , null , header , block ) ; |
public class DeleteLaunchTemplateVersionsResult { /** * Information about the launch template versions that were successfully deleted .
* @ return Information about the launch template versions that were successfully deleted . */
public java . util . List < DeleteLaunchTemplateVersionsResponseSuccessItem > getSuccessfullyDeletedLaunchTemplateVersions ( ) { } } | if ( successfullyDeletedLaunchTemplateVersions == null ) { successfullyDeletedLaunchTemplateVersions = new com . amazonaws . internal . SdkInternalList < DeleteLaunchTemplateVersionsResponseSuccessItem > ( ) ; } return successfullyDeletedLaunchTemplateVersions ; |
public class TCPReadRequestContextImpl { /** * @ see com . ibm . wsspi . tcpchannel . TCPReadRequestContext # read ( long , int ) */
@ Override public long read ( long numBytes , int time ) throws IOException { } } | int timeout = time ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "read(" + numBytes + "," + timeout + ")" ) ; } long bytesRead = 0L ; getTCPConnLink ( ) . incrementNumReads ( ) ; if ( getConfig ( ) . getDumpStatsInterval ( ) > 0 ) { getTCPConnLink ( ) . getTCPChannel ( ) . totalSyncReads . incrementAndGet ( ) ; } // always check external call parms
checkForErrors ( numBytes , false , timeout ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Socket socket = getTCPConnLink ( ) . getSocketIOChannel ( ) . getSocket ( ) ; Tr . event ( tc , "read (sync) requested for local: " + socket . getLocalSocketAddress ( ) + " remote: " + socket . getRemoteSocketAddress ( ) ) ; } if ( isAborted ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Previously aborted, unable to perform read" ) ; } throw new IOException ( "Connection aborted by program" ) ; } if ( timeout == IMMED_TIMEOUT ) { immediateTimeout ( ) ; } else if ( timeout == ABORT_TIMEOUT ) { abort ( ) ; immediateTimeout ( ) ; } else { // if using channel timeout , reset to that value
if ( timeout == TCPRequestContext . USE_CHANNEL_TIMEOUT ) { timeout = getConfig ( ) . getInactivityTimeout ( ) ; } bytesRead = processSyncReadRequest ( numBytes , timeout ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "read: " + bytesRead ) ; } return bytesRead ; |
public class IncrementalDomSrcMain { /** * Generates Incremental DOM JS source code given a Soy parse tree , an options object , and an
* optional bundle of translated messages .
* @ param soyTree The Soy parse tree to generate JS source code for .
* @ param registry The template registry that contains all the template information .
* @ param options The compilation options relevant to this backend .
* @ param errorReporter The Soy error reporter that collects errors during code generation .
* @ return A list of strings where each string represents the JS source code that belongs in one
* JS file . The generated JS files correspond one - to - one to the original Soy source files . */
public List < String > genJsSrc ( SoyFileSetNode soyTree , TemplateRegistry registry , SoyIncrementalDomSrcOptions options , ErrorReporter errorReporter ) { } } | SoyJsSrcOptions incrementalJSSrcOptions = options . toJsSrcOptions ( ) ; BidiGlobalDir bidiGlobalDir = SoyBidiUtils . decodeBidiGlobalDirFromJsOptions ( incrementalJSSrcOptions . getBidiGlobalDir ( ) , incrementalJSSrcOptions . getUseGoogIsRtlForBidiGlobalDir ( ) ) ; try ( SoyScopedData . InScope inScope = apiCallScope . enter ( /* msgBundle = */
null , bidiGlobalDir ) ) { // Do the code generation .
new HtmlContextVisitor ( ) . exec ( soyTree ) ; // If any errors are reported in { @ code HtmlContextVisitor } , we should not continue .
// Return an empty list here , { @ code SoyFileSet } will throw an exception .
if ( errorReporter . hasErrors ( ) ) { return Collections . emptyList ( ) ; } UnescapingVisitor . unescapeRawTextInHtml ( soyTree ) ; new RemoveUnnecessaryEscapingDirectives ( bidiGlobalDir ) . run ( soyTree ) ; // some of the above passes may slice up raw text nodes , recombine them .
new CombineConsecutiveRawTextNodesPass ( ) . run ( soyTree ) ; return createVisitor ( incrementalJSSrcOptions , registry , typeRegistry , inScope . getBidiGlobalDir ( ) , errorReporter ) . gen ( soyTree , registry , errorReporter ) ; } |
public class ToStringStyle { /** * < p > Sets the field separator text . < / p >
* < p > < code > null < / code > is accepted , but will be converted to
* an empty String . < / p >
* @ param fieldSeparator the new field separator text */
protected void setFieldSeparator ( String fieldSeparator ) { } } | if ( fieldSeparator == null ) { fieldSeparator = StringUtils . EMPTY ; } this . fieldSeparator = fieldSeparator ; |
public class Encoder { /** * Encodes a pseudo - Boolean constraint .
* @ param s the solver
* @ param lits the literals of the constraint
* @ param coeffs the coefficients of the constraints
* @ param rhs the right hand side of the constraint
* @ throws IllegalStateException if the pseudo - Boolean encoding is unknown */
public void encodePB ( final MiniSatStyleSolver s , final LNGIntVector lits , final LNGIntVector coeffs , int rhs ) { } } | switch ( this . pbEncoding ) { case SWC : this . swc . encode ( s , lits , coeffs , rhs ) ; break ; default : throw new IllegalStateException ( "Unknown pseudo-Boolean encoding: " + this . pbEncoding ) ; } |
public class NbboBenchmark { /** * Create a Timer task to display performance data on the Vote procedure
* It calls printStatistics ( ) every displayInterval seconds */
public void schedulePeriodicStats ( ) { } } | timer = new Timer ( ) ; TimerTask statsPrinting = new TimerTask ( ) { @ Override public void run ( ) { printStatistics ( ) ; } } ; timer . scheduleAtFixedRate ( statsPrinting , config . displayinterval * 1000 , config . displayinterval * 1000 ) ; |
public class BasicAuthHttpInvokerRequestExecutor { /** * Called every time a HTTP invocation is made .
* Simply allows the parent to setup the connection , and then adds an
* < code > Authorization < / code > HTTP header property that will be used for
* BASIC authentication . Following that a call to
* { @ link # doPrepareConnection } is made to allow subclasses to apply any
* additional configuration desired to the connection prior to invoking the
* request .
* The previously saved authentication token is used to obtain the principal
* and credentials . If the saved token is null , then the " Authorization "
* header will not be added to the request .
* @ param con
* the HTTP connection to prepare
* @ param contentLength
* the length of the content to send
* @ throws IOException
* if thrown by HttpURLConnection methods */
protected void prepareConnection ( HttpURLConnection con , int contentLength ) throws IOException { } } | super . prepareConnection ( con , contentLength ) ; Authentication auth = getAuthenticationToken ( ) ; if ( ( auth != null ) && ( auth . getName ( ) != null ) && ( auth . getCredentials ( ) != null ) ) { String base64 = auth . getName ( ) + ":" + auth . getCredentials ( ) . toString ( ) ; con . setRequestProperty ( "Authorization" , "Basic " + new String ( Base64 . encodeBase64 ( base64 . getBytes ( ) ) ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "HttpInvocation now presenting via BASIC authentication with token:: " + auth ) ; } } else { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Unable to set BASIC authentication header as Authentication token is invalid: " + auth ) ; } } doPrepareConnection ( con , contentLength ) ; |
public class lbvserver_dospolicy_binding { /** * Use this API to fetch lbvserver _ dospolicy _ binding resources of given name . */
public static lbvserver_dospolicy_binding [ ] get ( nitro_service service , String name ) throws Exception { } } | lbvserver_dospolicy_binding obj = new lbvserver_dospolicy_binding ( ) ; obj . set_name ( name ) ; lbvserver_dospolicy_binding response [ ] = ( lbvserver_dospolicy_binding [ ] ) obj . get_resources ( service ) ; return response ; |
public class AbstractExtraLanguageValidator { /** * Create the instance of the type converter .
* @ param initializer the converter initializer .
* @ param context the generation context .
* @ return the type converter . */
@ SuppressWarnings ( "static-method" ) protected ExtraLanguageTypeConverter createTypeConverterInstance ( IExtraLanguageConversionInitializer initializer , IExtraLanguageGeneratorContext context ) { } } | return new ExtraLanguageTypeConverter ( initializer , context ) ; |
public class ClassifierAdapter { /** * { @ inheritDoc } */
@ Override @ SuppressWarnings ( "unchecked" ) public T classify ( C classifiable ) { } } | if ( this . classifier != null ) { return this . classifier . classify ( classifiable ) ; } return ( T ) this . invoker . invokeMethod ( classifiable ) ; |
public class Postcard { /** * Inserts a short value into the mapping of this Bundle , replacing
* any existing value for the given key .
* @ param key a String , or null
* @ param value a short
* @ return current */
public Postcard withShort ( @ Nullable String key , short value ) { } } | mBundle . putShort ( key , value ) ; return this ; |
public class CausticUtil { /** * Converts the components of a color , as specified by the HSB model , to an equivalent set of values for the default RGB model . The < code > saturation < / code > and < code > brightness < / code > components
* should be floating - point values between zero and one ( numbers in the range [ 0 , 1 ] ) . The < code > hue < / code > component can be any floating - point number . Alpha will be 1.
* @ param hue The hue component of the color
* @ param saturation The saturation of the color
* @ param brightness The brightness of the color
* @ return The color as a 4 float vector */
public static Vector4f fromHSB ( float hue , float saturation , float brightness ) { } } | float r = 0 ; float g = 0 ; float b = 0 ; if ( saturation == 0 ) { r = g = b = brightness ; } else { final float h = ( hue - GenericMath . floor ( hue ) ) * 6 ; final float f = h - GenericMath . floor ( h ) ; final float p = brightness * ( 1 - saturation ) ; final float q = brightness * ( 1 - saturation * f ) ; final float t = brightness * ( 1 - saturation * ( 1 - f ) ) ; switch ( ( int ) h ) { case 0 : r = brightness ; g = t ; b = p ; break ; case 1 : r = q ; g = brightness ; b = p ; break ; case 2 : r = p ; g = brightness ; b = t ; break ; case 3 : r = p ; g = q ; b = brightness ; break ; case 4 : r = t ; g = p ; b = brightness ; break ; case 5 : r = brightness ; g = p ; b = q ; break ; } } return new Vector4f ( r , g , b , 1 ) ; |
public class BackedHashMap { /** * hasTimedOut - check if given session has timed out */
private boolean hasTimedOut ( BackedSession d , long now ) { } } | boolean timedOut = false ; int timeout = d . getMaxInactiveInterval ( ) ; // Zero means we just read the session from database
if ( timeout > 0 ) { long lastTouch = d . getCurrentAccessTime ( ) ; long invalidLastTouch = now - ( 1000 * ( long ) timeout ) ; // PK90548
if ( lastTouch <= invalidLastTouch ) { timedOut = true ; } } return timedOut ; |
public class AbstractSoapAttachmentValidator { /** * Validating SOAP attachment content id .
* @ param receivedAttachment
* @ param controlAttachment */
protected void validateAttachmentContentId ( SoapAttachment receivedAttachment , SoapAttachment controlAttachment ) { } } | // in case contentId was not set in test case , skip validation
if ( ! StringUtils . hasText ( controlAttachment . getContentId ( ) ) ) { return ; } if ( receivedAttachment . getContentId ( ) != null ) { Assert . isTrue ( controlAttachment . getContentId ( ) != null , buildValidationErrorMessage ( "Values not equal for attachment contentId" , null , receivedAttachment . getContentId ( ) ) ) ; Assert . isTrue ( receivedAttachment . getContentId ( ) . equals ( controlAttachment . getContentId ( ) ) , buildValidationErrorMessage ( "Values not equal for attachment contentId" , controlAttachment . getContentId ( ) , receivedAttachment . getContentId ( ) ) ) ; } else { Assert . isTrue ( controlAttachment . getContentId ( ) == null || controlAttachment . getContentId ( ) . length ( ) == 0 , buildValidationErrorMessage ( "Values not equal for attachment contentId" , controlAttachment . getContentId ( ) , null ) ) ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "Validating attachment contentId: " + receivedAttachment . getContentId ( ) + "='" + controlAttachment . getContentId ( ) + "': OK." ) ; } |
public class PluginWSCommons { /** * Write the update properties to the specified jsonwriter .
* < pre >
* " status " : " COMPATIBLE " ,
* " requires " : [
* " key " : " java " ,
* " name " : " Java " ,
* " description " : " SonarQube rule engine . "
* < / pre > */
public static void writeUpdateProperties ( JsonWriter jsonWriter , PluginUpdate pluginUpdate ) { } } | jsonWriter . prop ( PROPERTY_STATUS , toJSon ( pluginUpdate . getStatus ( ) ) ) ; jsonWriter . name ( ARRAY_REQUIRES ) . beginArray ( ) ; Release release = pluginUpdate . getRelease ( ) ; for ( Plugin child : filter ( transform ( release . getOutgoingDependencies ( ) , Release :: getArtifact ) , Plugin . class ) ) { jsonWriter . beginObject ( ) ; jsonWriter . prop ( PROPERTY_KEY , child . getKey ( ) ) ; jsonWriter . prop ( PROPERTY_NAME , child . getName ( ) ) ; jsonWriter . prop ( PROPERTY_DESCRIPTION , child . getDescription ( ) ) ; jsonWriter . endObject ( ) ; } jsonWriter . endArray ( ) ; |
public class AeshCommandResolver { /** * try to return the command in the given registry if the given registry do
* not find the command , check if we have a internal registry and if its
* there .
* @ param commandName command name
* @ param line command line
* @ return command
* @ throws CommandNotFoundException */
private CommandContainer < CI > getCommand ( String commandName , String line ) throws CommandNotFoundException { } } | try { return registry . getCommand ( commandName , line ) ; } catch ( CommandNotFoundException e ) { // Lookup in aliases
return registry . getCommandByAlias ( commandName ) ; } |
public class JsonModelGenerator { /** * Get JSON key string .
* @ param element
* @ return JSON key string
* @ author vvakame */
String getElementKeyString ( Element element ) { } } | JsonKey key = element . getAnnotation ( JsonKey . class ) ; JsonModel model = element . getEnclosingElement ( ) . getAnnotation ( JsonModel . class ) ; if ( ! "" . equals ( key . value ( ) ) ) { return key . value ( ) ; } else if ( "" . equals ( key . value ( ) ) && key . decamelize ( ) ) { return decamelize ( element . toString ( ) ) ; } else if ( "" . equals ( key . value ( ) ) && model . decamelize ( ) ) { return decamelize ( element . toString ( ) ) ; } else { return element . toString ( ) ; } |
public class ZonedDateTime { /** * Obtains an instance of { @ code ZonedDateTime } strictly validating the
* combination of local date - time , offset and zone ID .
* This creates a zoned date - time ensuring that the offset is valid for the
* local date - time according to the rules of the specified zone .
* If the offset is invalid , an exception is thrown .
* @ param localDateTime the local date - time , not null
* @ param offset the zone offset , not null
* @ param zone the time - zone , not null
* @ return the zoned date - time , not null */
public static ZonedDateTime ofStrict ( LocalDateTime localDateTime , ZoneOffset offset , ZoneId zone ) { } } | Jdk8Methods . requireNonNull ( localDateTime , "localDateTime" ) ; Jdk8Methods . requireNonNull ( offset , "offset" ) ; Jdk8Methods . requireNonNull ( zone , "zone" ) ; ZoneRules rules = zone . getRules ( ) ; if ( rules . isValidOffset ( localDateTime , offset ) == false ) { ZoneOffsetTransition trans = rules . getTransition ( localDateTime ) ; if ( trans != null && trans . isGap ( ) ) { // error message says daylight savings for simplicity
// even though there are other kinds of gaps
throw new DateTimeException ( "LocalDateTime '" + localDateTime + "' does not exist in zone '" + zone + "' due to a gap in the local time-line, typically caused by daylight savings" ) ; } throw new DateTimeException ( "ZoneOffset '" + offset + "' is not valid for LocalDateTime '" + localDateTime + "' in zone '" + zone + "'" ) ; } return new ZonedDateTime ( localDateTime , offset , zone ) ; |
public class UnionSet { /** * Triggers combining .
* @ see # addAll ( java . util . Set ) */
@ Override public boolean addAll ( Collection < ? extends E > c ) { } } | if ( c . isEmpty ( ) ) return false ; combine ( ) ; if ( combined == null ) { combined = new HashSet < > ( c ) ; return true ; } else { return combined . addAll ( c ) ; } |
public class XmlDescriptorHelper { /** * Create a description descriptor .
* @ param descriptionType
* The XML description type .
* @ param store
* The store .
* @ return The description descriptor . */
public static DescriptionDescriptor createDescription ( DescriptionType descriptionType , Store store ) { } } | DescriptionDescriptor descriptionDescriptor = store . create ( DescriptionDescriptor . class ) ; descriptionDescriptor . setLang ( descriptionType . getLang ( ) ) ; descriptionDescriptor . setValue ( descriptionType . getValue ( ) ) ; return descriptionDescriptor ; |
public class FullDemo { /** * addLocalizedPickerAndLabel , This creates a date picker whose locale is set to the specified
* language . This also sets the picker to today ' s date , creates a label for the date picker , and
* adds the components to the language panel . */
private static void addLocalizedPickerAndLabel ( int rowMarker , String labelText , String languageCode ) { } } | // Create the localized date picker and label .
Locale locale = new Locale ( languageCode ) ; DatePickerSettings settings = new DatePickerSettings ( locale ) ; // Set a minimum size for the localized date pickers , to improve the look of the demo .
settings . setSizeTextFieldMinimumWidth ( 125 ) ; settings . setSizeTextFieldMinimumWidthDefaultOverride ( true ) ; DatePicker localizedDatePicker = new DatePicker ( settings ) ; localizedDatePicker . setDateToToday ( ) ; panel . panel4 . add ( localizedDatePicker , getConstraints ( 1 , ( rowMarker * rowMultiplier ) , 1 ) ) ; panel . addLabel ( panel . panel4 , 1 , ( rowMarker * rowMultiplier ) , labelText ) ; |
public class KDTree { /** * Returns the value of the named measure .
* @ param additionalMeasureNamethe name of
* the measure to query for its value .
* @ return The value of the named measure
* @ throws IllegalArgumentExceptionIf the named measure
* is not supported . */
public double getMeasure ( String additionalMeasureName ) { } } | if ( additionalMeasureName . compareToIgnoreCase ( "measureMaxDepth" ) == 0 ) { return measureMaxDepth ( ) ; } else if ( additionalMeasureName . compareToIgnoreCase ( "measureTreeSize" ) == 0 ) { return measureTreeSize ( ) ; } else if ( additionalMeasureName . compareToIgnoreCase ( "measureNumLeaves" ) == 0 ) { return measureNumLeaves ( ) ; } else { throw new IllegalArgumentException ( additionalMeasureName + " not supported (KDTree)" ) ; } |
public class JdbcRepositories { /** * Gets the repository definitions , lazy load .
* @ return repository definitions */
public static List < RepositoryDefinition > getRepositoryDefinitions ( ) { } } | if ( null == repositoryDefinitions ) { try { initRepositoryDefinitions ( ) ; } catch ( final Exception e ) { LOGGER . log ( Level . ERROR , "Init repository definitions failed" , e ) ; } } return repositoryDefinitions ; |
public class syslog_server { /** * < pre >
* Use this operation to get all the syslog servers .
* < / pre > */
public static syslog_server [ ] get ( nitro_service client ) throws Exception { } } | syslog_server resource = new syslog_server ( ) ; resource . validate ( "get" ) ; return ( syslog_server [ ] ) resource . get_resources ( client ) ; |
public class AbstractPreferenceFragment { /** * Initializes the elevation of the button bar .
* @ param sharedPreferences
* The shared preferences , which should be used , as an instance of the type { @ link
* SharedPreferences } */
private void initializeButtonBarElevation ( final SharedPreferences sharedPreferences ) { } } | String key = getString ( R . string . preference_fragment_button_bar_elevation_preference_key ) ; String defaultValue = getString ( R . string . preference_fragment_button_bar_elevation_preference_default_value ) ; int elevation = Integer . valueOf ( sharedPreferences . getString ( key , defaultValue ) ) ; setButtonBarElevation ( elevation ) ; |
public class AwtPoiPersistenceManager { /** * { @ inheritDoc } */
@ Override public synchronized void close ( ) { } } | if ( isClosed ( ) ) { return ; } // Close statements
if ( this . findCatByIDStatement != null ) { try { this . findCatByIDStatement . close ( ) ; } catch ( SQLException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } if ( this . findDataByIDStatement != null ) { try { this . findDataByIDStatement . close ( ) ; } catch ( SQLException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } if ( this . findLocByIDStatement != null ) { try { this . findLocByIDStatement . close ( ) ; } catch ( SQLException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } if ( this . insertPoiCatStatement != null ) { try { this . insertPoiCatStatement . close ( ) ; } catch ( SQLException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } if ( this . insertPoiDataStatement != null ) { try { this . insertPoiDataStatement . close ( ) ; } catch ( SQLException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } if ( this . insertPoiLocStatement != null ) { try { this . insertPoiLocStatement . close ( ) ; } catch ( SQLException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } if ( this . deletePoiCatStatement != null ) { try { this . deletePoiCatStatement . close ( ) ; } catch ( SQLException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } if ( this . deletePoiDataStatement != null ) { try { this . deletePoiDataStatement . close ( ) ; } catch ( SQLException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } if ( this . deletePoiLocStatement != null ) { try { this . deletePoiLocStatement . close ( ) ; } catch ( SQLException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } if ( this . isValidDBStatement != null ) { try { this . isValidDBStatement . close ( ) ; } catch ( SQLException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } if ( this . metadataStatement != null ) { try { this . metadataStatement . close ( ) ; } catch ( SQLException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } // Close connection
if ( this . conn != null ) { try { this . conn . close ( ) ; } catch ( SQLException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } this . poiFile = null ; |
public class SortTileRecursiveBulkSplit { /** * Recursively partition .
* @ param objs Object list
* @ param start Subinterval start
* @ param end Subinterval end
* @ param depth Iteration depth ( must be less than dimensionality ! )
* @ param dims Total number of dimensions
* @ param maxEntries Maximum page size
* @ param c Comparison helper
* @ param ret Output list
* @ param < T > data type */
protected < T extends SpatialComparable > void strPartition ( List < T > objs , int start , int end , int depth , int dims , int maxEntries , SpatialSingleMeanComparator c , List < List < T > > ret ) { } } | final int p = ( int ) FastMath . ceil ( ( end - start ) / ( double ) maxEntries ) ; final int s = ( int ) FastMath . ceil ( FastMath . pow ( p , 1.0 / ( dims - depth ) ) ) ; final double len = end - start ; // double intentional !
for ( int i = 0 ; i < s ; i ++ ) { // We don ' t completely sort , but only ensure the quantile is invariant .
int s2 = start + ( int ) ( ( i * len ) / s ) ; int e2 = start + ( int ) ( ( ( i + 1 ) * len ) / s ) ; // LoggingUtil . warning ( " STR " + dim + " s2 : " + s2 + " e2 : " + e2 ) ;
if ( e2 < end ) { c . setDimension ( depth ) ; QuickSelect . quickSelect ( objs , c , s2 , end , e2 ) ; } if ( depth + 1 == dims ) { ret . add ( objs . subList ( s2 , e2 ) ) ; } else { // Descend
strPartition ( objs , s2 , e2 , depth + 1 , dims , maxEntries , c , ret ) ; } } |
public class DescribeConfigurationSettingsResult { /** * A list of < a > ConfigurationSettingsDescription < / a > .
* @ return A list of < a > ConfigurationSettingsDescription < / a > . */
public java . util . List < ConfigurationSettingsDescription > getConfigurationSettings ( ) { } } | if ( configurationSettings == null ) { configurationSettings = new com . amazonaws . internal . SdkInternalList < ConfigurationSettingsDescription > ( ) ; } return configurationSettings ; |
public class ProxyUtil { /** * Creates a composite service using all of the given
* services and implementing the given interfaces .
* @ param classLoader the { @ link ClassLoader }
* @ param services the service objects
* @ param serviceInterfaces the service interfaces
* @ param allowMultipleInheritance whether or not to allow multiple inheritance
* @ return the object */
public static Object createCompositeServiceProxy ( ClassLoader classLoader , Object [ ] services , Class < ? > [ ] serviceInterfaces , boolean allowMultipleInheritance ) { } } | Set < Class < ? > > interfaces = collectInterfaces ( services , serviceInterfaces ) ; final Map < Class < ? > , Object > serviceClassToInstanceMapping = buildServiceMap ( services , allowMultipleInheritance , interfaces ) ; // now create the proxy
return Proxy . newProxyInstance ( classLoader , interfaces . toArray ( new Class < ? > [ 0 ] ) , new InvocationHandler ( ) { @ Override public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { Class < ? > clazz = method . getDeclaringClass ( ) ; if ( clazz == Object . class ) { return proxyObjectMethods ( method , proxy , args ) ; } return method . invoke ( serviceClassToInstanceMapping . get ( clazz ) , args ) ; } } ) ; |
public class ChainedProperty { /** * Returns true if any property in the chain can be null .
* @ see com . amazon . carbonado . Nullable
* @ since 1.2 */
public boolean isNullable ( ) { } } | if ( mPrime . isNullable ( ) ) { return true ; } if ( mChain != null ) { for ( StorableProperty < ? > prop : mChain ) { if ( prop . isNullable ( ) ) { return true ; } } } return false ; |
public class GetLabelDetectionResult { /** * An array of labels detected in the video . Each element contains the detected label and the time , in milliseconds
* from the start of the video , that the label was detected .
* @ param labels
* An array of labels detected in the video . Each element contains the detected label and the time , in
* milliseconds from the start of the video , that the label was detected . */
public void setLabels ( java . util . Collection < LabelDetection > labels ) { } } | if ( labels == null ) { this . labels = null ; return ; } this . labels = new java . util . ArrayList < LabelDetection > ( labels ) ; |
public class XMemcachedClient { /** * ( non - Javadoc )
* @ see net . rubyeye . xmemcached . MemcachedClient # gets ( java . lang . String , long ,
* net . rubyeye . xmemcached . transcoders . Transcoder ) */
@ SuppressWarnings ( "unchecked" ) public final < T > GetsResponse < T > gets ( final String key , final long timeout , final Transcoder < T > transcoder ) throws TimeoutException , InterruptedException , MemcachedException { } } | return ( GetsResponse < T > ) this . get0 ( key , timeout , CommandType . GETS_ONE , transcoder ) ; |
public class DocTreeScanner { /** * { @ inheritDoc } This implementation scans the children in left to right order .
* @ param node { @ inheritDoc }
* @ param p { @ inheritDoc }
* @ return the result of scanning */
@ Override public R visitLink ( LinkTree node , P p ) { } } | R r = scan ( node . getReference ( ) , p ) ; r = scanAndReduce ( node . getLabel ( ) , p , r ) ; return r ; |
public class TimeSection { /** * Defines the time when the section ends
* @ param STOP */
public void setStop ( final LocalTime STOP ) { } } | if ( null == stop ) { _stop = STOP ; } else { stop . set ( STOP ) ; } |
public class NetworkAddressUtils { /** * Gets the local hostname to be used by the client . If this isn ' t configured , a
* non - loopback local hostname will be looked up .
* @ param conf Alluxio configuration
* @ return the local hostname for the client
* @ deprecated This should not be used anymore as the USER _ HOSTNAME key is deprecated */
@ Deprecated public static String getClientHostName ( AlluxioConfiguration conf ) { } } | if ( conf . isSet ( PropertyKey . USER_HOSTNAME ) ) { return conf . get ( PropertyKey . USER_HOSTNAME ) ; } return getLocalHostName ( ( int ) conf . getMs ( PropertyKey . NETWORK_HOST_RESOLUTION_TIMEOUT_MS ) ) ; |
public class PipelineDeclaration { /** * The stage in which to perform the action .
* @ param stages
* The stage in which to perform the action . */
public void setStages ( java . util . Collection < StageDeclaration > stages ) { } } | if ( stages == null ) { this . stages = null ; return ; } this . stages = new java . util . ArrayList < StageDeclaration > ( stages ) ; |
public class CreateAcceleratorRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateAcceleratorRequest createAcceleratorRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createAcceleratorRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createAcceleratorRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( createAcceleratorRequest . getIpAddressType ( ) , IPADDRESSTYPE_BINDING ) ; protocolMarshaller . marshall ( createAcceleratorRequest . getEnabled ( ) , ENABLED_BINDING ) ; protocolMarshaller . marshall ( createAcceleratorRequest . getIdempotencyToken ( ) , IDEMPOTENCYTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class XmlUtils { /** * Returns the given document as a XML string in a " pretty " format .
* @ param document
* @ return the document as an XML string */
public static String documentToPrettyString ( Document document ) { } } | StringWriter stringWriter = new StringWriter ( ) ; OutputFormat prettyPrintFormat = OutputFormat . createPrettyPrint ( ) ; XMLWriter xmlWriter = new XMLWriter ( stringWriter , prettyPrintFormat ) ; try { xmlWriter . write ( document ) ; } catch ( IOException e ) { // Ignore , shouldn ' t happen .
} return stringWriter . toString ( ) ; |
public class SessionManager { /** * Create and return a new ExtWebDriver instance . The instance is
* constructed with default options , with the provided Map of key / value
* pairs overriding the corresponding pairs in the options . This new
* ExtWebDriver instance will then become the current session .
* @ param override
* A Map of options to be overridden
* @ return A new ExtWebDriver instance which is now the current session
* @ throws Exception */
public ExtWebDriver getNewSession ( Map < String , String > override ) throws Exception { } } | return getNewSession ( override , true ) ; |
public class JavaLexer { /** * $ ANTLR start " T _ _ 93" */
public final void mT__93 ( ) throws RecognitionException { } } | try { int _type = T__93 ; int _channel = DEFAULT_TOKEN_CHANNEL ; // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 74:7 : ( ' interface ' )
// src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 74:9 : ' interface '
{ match ( "interface" ) ; } state . type = _type ; state . channel = _channel ; } finally { // do for sure before leaving
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.