signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CPDefinitionOptionRelLocalServiceBaseImpl { /** * Returns a range of cp definition option rels matching the UUID and company .
* @ param uuid the UUID of the cp definition option rels
* @ param companyId the primary key of the company
* @ param start the lower bound of the range of cp definition opti... | return cpDefinitionOptionRelPersistence . findByUuid_C ( uuid , companyId , start , end , orderByComparator ) ; |
public class Record { /** * Sets the number of fields in the record . If the new number of fields is longer than the current number of
* fields , then null fields are appended . If the new number of fields is smaller than the current number of
* fields , then the last fields are truncated .
* @ param numFields Th... | final int oldNumFields = this . numFields ; // check whether we increase or decrease the fields
if ( numFields > oldNumFields ) { makeSpace ( numFields ) ; for ( int i = oldNumFields ; i < numFields ; i ++ ) { this . offsets [ i ] = NULL_INDICATOR_OFFSET ; } markModified ( oldNumFields ) ; } else { // decrease the numb... |
public class CmsSecurityManager { /** * Imports a rewrite alias . < p >
* @ param requestContext the current request context
* @ param siteRoot the site root
* @ param source the rewrite alias source
* @ param target the rewrite alias target
* @ param mode the alias mode
* @ return the import result
* @ t... | CmsDbContext dbc = m_dbContextFactory . getDbContext ( requestContext ) ; try { return m_driverManager . importRewriteAlias ( dbc , siteRoot , source , target , mode ) ; } catch ( Exception e ) { dbc . report ( null , Messages . get ( ) . container ( Messages . ERR_DB_OPERATION_0 ) , e ) ; return null ; } finally { dbc... |
public class ExecuteArgAnalyzer { public void analyzeExecuteArg ( Method executeMethod , ExecuteArgBox box ) { } } | List < Class < ? > > pathParamTypeList = null ; // lazy loaded
Parameter formParam = null ; final Parameter [ ] parameters = executeMethod . getParameters ( ) ; if ( parameters . length > 0 ) { boolean formEnd = false ; for ( Parameter parameter : parameters ) { if ( formEnd ) { throwActionFormNotLastParameterException... |
public class ReframingResponseObserver { /** * Checks if the awaited upstream response is available . If it is , then feed it to the { @ link
* Reframer } and update the { @ link # awaitingInner } flag . Upon exit , if awaitingInner is not set ,
* then done is guaranteed to reflect the current status of the upstrea... | if ( ! awaitingInner ) { return ; } boolean localDone = this . done ; // Try to move the new item into the reframer
InnerT newUpstreamItem = newItem . getAndSet ( null ) ; if ( newUpstreamItem != null ) { reframer . push ( newUpstreamItem ) ; // and reset the awaiting flag , if the item arrived or upstream closed
await... |
public class NetworkMessage { /** * First 4 bytes of sha512 ( payload ) */
private byte [ ] getChecksum ( byte [ ] bytes ) throws NoSuchProviderException , NoSuchAlgorithmException { } } | byte [ ] d = cryptography ( ) . sha512 ( bytes ) ; return new byte [ ] { d [ 0 ] , d [ 1 ] , d [ 2 ] , d [ 3 ] } ; |
public class FSImage { /** * Load the image namespace from the given image file , verifying it against
* the MD5 sum stored in its associated . md5 file . */
protected void loadFSImage ( ImageInputStream iis , File imageFile ) throws IOException { } } | MD5Hash expectedMD5 = MD5FileUtils . readStoredMd5ForFile ( imageFile ) ; if ( expectedMD5 == null ) { throw new IOException ( "No MD5 file found corresponding to image file " + imageFile ) ; } iis . setImageDigest ( expectedMD5 ) ; loadFSImage ( iis ) ; |
public class JmxMBeans { /** * region jmx operations fetching */
private static Map < OperationKey , Method > fetchOpkeyToMethod ( Class < ? > mbeanClass ) { } } | Map < OperationKey , Method > opkeyToMethod = new HashMap < > ( ) ; Method [ ] methods = mbeanClass . getMethods ( ) ; for ( Method method : methods ) { if ( method . isAnnotationPresent ( JmxOperation . class ) ) { JmxOperation annotation = method . getAnnotation ( JmxOperation . class ) ; String opName = annotation .... |
public class ResourceGroovyMethods { /** * Create a new PrintWriter for this file , using specified
* charset . If the given charset is " UTF - 16BE " or " UTF - 16LE " ( or an
* equivalent alias ) , the requisite byte order mark is written to the
* stream before the writer is returned .
* @ param file a File
... | return new GroovyPrintWriter ( newWriter ( file , charset ) ) ; |
public class PrimaveraReader { /** * Code common to both XER and database readers to extract
* currency format data .
* @ param row row containing currency data */
public void processDefaultCurrency ( Row row ) { } } | ProjectProperties properties = m_project . getProjectProperties ( ) ; properties . setCurrencySymbol ( row . getString ( "curr_symbol" ) ) ; properties . setSymbolPosition ( CURRENCY_SYMBOL_POSITION_MAP . get ( row . getString ( "pos_curr_fmt_type" ) ) ) ; properties . setCurrencyDigits ( row . getInteger ( "decimal_di... |
public class RepositoryUtils { /** * Matches a set of elements in a case insensitive way .
* @ param patternMatcher the pattern to match
* @ param elements the elements to match
* @ return true if one of the element is matched */
public static boolean matches ( Pattern patternMatcher , Object ... elements ) { } } | if ( patternMatcher == null ) { return true ; } for ( Object element : elements ) { if ( matches ( patternMatcher , element ) ) { return true ; } } return false ; |
public class GrassRasterReader { /** * read a row of data from a compressed floating point map
* @ param rn
* @ param adrows
* @ param outFile
* @ param typeBytes
* @ return the ByteBuffer containing the data
* @ throws IOException
* @ throws DataFormatException */
private void readCompressedFPRowByNumber... | int offset = ( int ) ( adrows [ rn + 1 ] - adrows [ rn ] ) ; /* * The fact that the file is compressed does not mean that the row is compressed . If the
* first byte is 0 ( 49 ) , then the row is compressed , otherwise ( first byte = 48 ) the row has
* to be read in simple XDR uncompressed format . */
byte [ ] tmp ... |
public class VdmThreadManager { /** * IDbgpThreadAcceptor */
public void acceptDbgpThread ( IDbgpSession session , IProgressMonitor monitor ) { } } | SubMonitor sub = SubMonitor . convert ( monitor , 100 ) ; try { DbgpException error = session . getInfo ( ) . getError ( ) ; if ( error != null ) { throw error ; } session . configure ( target . getOptions ( ) ) ; session . getStreamManager ( ) . addListener ( this ) ; final boolean breakOnFirstLine = // target . break... |
public class Pinyins { /** * 获取字符串首字母大写 , 指定分隔符
* @ param text
* @ param separator
* @ return
* @ throws Exception */
public static String getFirstUpperLetter ( String text , String separator ) throws Exception { } } | PinyinFormat format = new PinyinFormat ( ) ; format . setUpperFormat ( PinyinUpperFormat . UPPER_FIRST_LETTER ) ; format . setToneFormat ( PinyinTONEFormat . TONE_NONE ) ; if ( $ . notNull ( separator ) ) { format . setSeparator ( separator ) ; } return getPinyin ( text , format ) ; |
public class Rule { /** * Covers URLs such as :
* { { http : / / blog . bjhargrave . com / 2007/09 / classforname - caches - defined - class - in . html } } < - - - direct link
* { { { http : / / en . wikipedia . org / wiki / Double - checked _ locking } } } < - - - direct link
* { { { http : / / jira . codehaus ... | String result = description ; String [ ] urls = extractUrls ( description ) ; if ( urls . length > 0 ) { for ( String url : urls ) { String copy = url ; boolean trailingAcc = false ; if ( ! copy . startsWith ( "{" ) ) { copy = "<a>" + copy + "</a>" ; } else if ( copy . startsWith ( "{http" ) ) { if ( '}' == result . ch... |
public class UpdateIdentityProviderConfigurationRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdateIdentityProviderConfigurationRequest updateIdentityProviderConfigurationRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updateIdentityProviderConfigurationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateIdentityProviderConfigurationRequest . getFleetArn ( ) , FLEETARN_BINDING ) ; protocolMarshaller . marshall ( updateIdentityProviderConf... |
public class FnInteger { /** * Determines whether the target object is null or not .
* @ return false if the target object is null , true if not . */
public static final Function < Integer , Boolean > isNotNull ( ) { } } | return ( Function < Integer , Boolean > ) ( ( Function ) FnObject . isNotNull ( ) ) ; |
public class Converters { /** * Registers the { @ link Period } converter .
* @ param builder The GSON builder to register the converter with .
* @ return A reference to { @ code builder } . */
public static GsonBuilder registerPeriod ( GsonBuilder builder ) { } } | if ( builder == null ) { throw new NullPointerException ( "builder cannot be null" ) ; } builder . registerTypeAdapter ( PERIOD_TYPE , new PeriodConverter ( ) ) ; return builder ; |
public class PollStrategy { /** * Update the delay in milliseconds from the provided HTTP poll response .
* @ param httpPollResponse The HTTP poll response to update the delay in milliseconds from . */
final void updateDelayInMillisecondsFrom ( HttpResponse httpPollResponse ) { } } | final Long parsedDelayInMilliseconds = delayInMillisecondsFrom ( httpPollResponse ) ; if ( parsedDelayInMilliseconds != null ) { delayInMilliseconds = parsedDelayInMilliseconds ; } |
public class PrintConfigCommand { /** * Generate the Yaml representation of the given map .
* @ param map the map to print out .
* @ return the Yaml representation .
* @ throws JsonProcessingException when the Json cannot be processed . */
@ SuppressWarnings ( "static-method" ) protected String generateYaml ( Map... | final YAMLFactory yamlFactory = new YAMLFactory ( ) ; yamlFactory . configure ( Feature . WRITE_DOC_START_MARKER , false ) ; final ObjectMapper mapper = new ObjectMapper ( yamlFactory ) ; return mapper . writerWithDefaultPrettyPrinter ( ) . writeValueAsString ( map ) ; |
public class DirectorySelectionPanel { /** * Set the " Include subdirectories " checkbox visible . If called outside the
* EDT this method will switch to the UI thread using
* < code > SwingUtilities . invokeAndWait ( Runnable ) < / code > .
* @ param b
* If visible < code > true < / code > else < code > false ... | if ( SwingUtilities . isEventDispatchThread ( ) ) { setIncludeSubdirsVisibleIntern ( b ) ; } else { try { SwingUtilities . invokeAndWait ( new Runnable ( ) { public void run ( ) { setIncludeSubdirsVisibleIntern ( b ) ; } } ) ; } catch ( final Exception ex ) { ignore ( ) ; } } |
public class DefaultOverlayService { /** * { @ inheritDoc } */
@ Override public Boolean uninstallOverlay ( JComponent targetComponent , JComponent overlay , Insets insets ) { } } | overlay . setVisible ( Boolean . FALSE ) ; return Boolean . TRUE ; |
public class StringSubject { /** * Fails if the string does not have the given length . */
public void hasLength ( int expectedLength ) { } } | checkArgument ( expectedLength >= 0 , "expectedLength(%s) must be >= 0" , expectedLength ) ; check ( "length()" ) . that ( actual ( ) . length ( ) ) . isEqualTo ( expectedLength ) ; |
public class svm_train { /** * read in a problem ( in svmlight format ) */
private void read_problem ( ) throws IOException { } } | BufferedReader fp = new BufferedReader ( new FileReader ( input_file_name ) ) ; java . util . Vector vy = new java . util . Vector ( ) ; java . util . Vector vx = new java . util . Vector ( ) ; int max_index = 0 ; while ( true ) { String line = fp . readLine ( ) ; if ( line == null ) break ; StringTokenizer st = new St... |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertGCBIMGRESToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class PrivateKeyExtensions { /** * Gets the key length of the given { @ link PrivateKey } .
* @ param privateKey
* the private key
* @ return the key length */
public static int getKeyLength ( final PrivateKey privateKey ) { } } | int length = - 1 ; if ( privateKey == null ) { return length ; } if ( privateKey instanceof RSAPrivateKey ) { length = ( ( RSAPrivateKey ) privateKey ) . getModulus ( ) . bitLength ( ) ; } if ( privateKey instanceof DSAPrivateKey ) { length = ( ( DSAPrivateKey ) privateKey ) . getParams ( ) . getQ ( ) . bitLength ( ) ;... |
public class appfwglobal_binding { /** * Use this API to fetch a appfwglobal _ binding resource . */
public static appfwglobal_binding get ( nitro_service service ) throws Exception { } } | appfwglobal_binding obj = new appfwglobal_binding ( ) ; appfwglobal_binding response = ( appfwglobal_binding ) obj . get_resource ( service ) ; return response ; |
public class Object2IntHashMap { /** * Overloaded version of { @ link Map # get ( Object ) } that takes a primitive int key .
* Due to type erasure have to rename the method
* @ param key for indexing the { @ link Map }
* @ return the value if found otherwise missingValue */
public int getValue ( final K key ) { ... | @ DoNotSub final int mask = values . length - 1 ; @ DoNotSub int index = Hashing . hash ( key , mask ) ; int value ; while ( missingValue != ( value = values [ index ] ) ) { if ( key . equals ( keys [ index ] ) ) { break ; } index = ++ index & mask ; } return value ; |
public class D6CrudDeleteHelper { /** * Generate INSERT preparedSQL statement
* @ param policy
* RAW _ SQL or PREPARED _ STATEMENT
* @ return */
String createDeletePreparedSQLStatement ( ) { } } | final Set < String > primaryKeyColumnNameSet = getPrimaryColumnNames ( ) ; final StringGrabber sgSQL = new StringGrabber ( ) ; // Get the table name
final DBTable table = mModelClazz . getAnnotation ( DBTable . class ) ; final String tableName = table . tableName ( ) ; sgSQL . append ( "DELETE FROM " + tableName + " WH... |
public class AbstractValidateableDialogPreference { /** * Obtains the color , which is used to indicate validation errors , from a specific typed array .
* @ param typedArray
* The typed array , the error color should be obtained from , as an instance of the class
* { @ link TypedArray } . The typed array may not... | setErrorColor ( typedArray . getColor ( R . styleable . AbstractValidateableView_errorColor , ContextCompat . getColor ( getContext ( ) , R . color . default_error_color ) ) ) ; |
public class XMLUtil { /** * Replies the URL that corresponds to the specified attribute ' s path .
* < p > The path is an ordered list of tag ' s names and ended by the name of
* the attribute .
* @ param document is the XML document to explore .
* @ param caseSensitive indicates of the { @ code path } ' s com... | assert document != null : AssertMessages . notNullParameter ( 0 ) ; return getAttributeURLWithDefault ( document , caseSensitive , null , path ) ; |
public class RunbookDraftsInner { /** * Publish runbook draft .
* @ param resourceGroupName Name of an Azure Resource group .
* @ param automationAccountName The name of the automation account .
* @ param runbookName The parameters supplied to the publish runbook operation .
* @ param serviceCallback the async ... | return ServiceFuture . fromHeaderResponse ( beginPublishWithServiceResponseAsync ( resourceGroupName , automationAccountName , runbookName ) , serviceCallback ) ; |
public class JQMRadioset { /** * Removes the given { @ link JQMRadio } from this radioset
* @ param radio - the radio to remove */
public void removeRadio ( JQMRadio radio ) { } } | if ( radio == null ) return ; TextBox inp = radio . getInput ( ) ; if ( inp != null ) { radios . remove ( radio ) ; fieldset . remove ( inp ) ; } if ( radio . getLabel ( ) != null ) fieldset . remove ( radio . getLabel ( ) ) ; |
public class TypedAttributeValueMarshaller { /** * Marshall the given parameter object . */
public void marshall ( TypedAttributeValue typedAttributeValue , ProtocolMarshaller protocolMarshaller ) { } } | if ( typedAttributeValue == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( typedAttributeValue . getStringValue ( ) , STRINGVALUE_BINDING ) ; protocolMarshaller . marshall ( typedAttributeValue . getBinaryValue ( ) , BINARYVALUE_BINDING ) ;... |
public class RtfHeaderFooterGroup { /** * Set a RtfHeaderFooter to be displayed at a certain position
* @ param headerFooter The RtfHeaderFooter to display
* @ param displayAt The display location to use */
public void setHeaderFooter ( RtfHeaderFooter headerFooter , int displayAt ) { } } | this . mode = MODE_MULTIPLE ; headerFooter . setRtfDocument ( this . document ) ; headerFooter . setType ( this . type ) ; headerFooter . setDisplayAt ( displayAt ) ; switch ( displayAt ) { case RtfHeaderFooter . DISPLAY_ALL_PAGES : headerAll = headerFooter ; break ; case RtfHeaderFooter . DISPLAY_FIRST_PAGE : headerFi... |
public class MIMETypedStream { /** * Closes the underlying stream if it ' s not already closed .
* In the event of an error , a warning will be logged . */
public void close ( ) { } } | if ( this . m_stream != null ) { try { this . m_stream . close ( ) ; this . m_stream = null ; } catch ( IOException e ) { logger . warn ( "Error closing stream" , e ) ; } } |
public class Indicator { /** * < editor - fold defaultstate = " collapsed " desc = " Visualization " > */
@ Override protected void paintComponent ( Graphics g ) { } } | final Graphics2D G2 = ( Graphics2D ) g . create ( ) ; G2 . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ; G2 . setRenderingHint ( RenderingHints . KEY_RENDERING , RenderingHints . VALUE_RENDER_QUALITY ) ; G2 . setRenderingHint ( RenderingHints . KEY_STROKE_CONTROL , Rende... |
public class CompilerOptions { /** * Resolve a list of object template names and template Files to a set of
* files based on this instance ' s include directories .
* @ param objectNames
* object template names to lookup
* @ param tplFiles
* template Files to process
* @ return unmodifiable set of the resol... | // First just copy the named templates .
Set < File > filesToProcess = new TreeSet < File > ( ) ; if ( tplFiles != null ) { filesToProcess . addAll ( tplFiles ) ; } // Now loop over all of the object template names , lookup the files , and
// add them to the set of files to process .
if ( objectNames != null ) { for ( ... |
public class TrainingsImpl { /** * Associate a set of images with a set of tags .
* @ param projectId The project id
* @ param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the valida... | return createImageTagsWithServiceResponseAsync ( projectId , createImageTagsOptionalParameter ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class LongObjectHashMap { /** * Store the given value in the map , associating it with the given key . If the
* map already contains an entry associated with the given key that entry will
* be replaced .
* @ param key The key to associate with the entry
* @ param value The entry to be associated with the... | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "put" , new Object [ ] { new Long ( key ) , value , this } ) ; if ( value == null ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "put" , "IllegalArgumentException" ) ; throw new IllegalArgumentException ( "Null is not a permitted value." ) ; } // Find an empty bucke... |
public class ExploitAssigns { /** * Checks name referenced in node to determine if it might have
* changed .
* @ return Whether the replacement can be made . */
private boolean isSafeReplacement ( Node node , Node replacement ) { } } | // No checks are needed for simple names .
if ( node . isName ( ) ) { return true ; } checkArgument ( node . isGetProp ( ) ) ; while ( node . isGetProp ( ) ) { node = node . getFirstChild ( ) ; } return ! ( node . isName ( ) && isNameAssignedTo ( node . getString ( ) , replacement ) ) ; |
public class RaXmlMetadataDeployer { /** * { @ inheritDoc } */
public Deployment deploy ( URL url , Context context , ClassLoader parent ) throws DeployException { } } | File archive = ( File ) context . get ( Constants . ATTACHMENT_ARCHIVE ) ; if ( archive == null ) throw new DeployException ( "Deployment " + url . toExternalForm ( ) + " not found" ) ; FileInputStream fis = null ; try { File raXml = new File ( archive , "META-INF/ra.xml" ) ; if ( raXml . exists ( ) ) { RaParser parser... |
public class Predict { /** * 返回插入的位置
* @ param score 得分
* @ param label 标签
* @ return 插入位置 */
public int add ( int label , float score ) { } } | int i = 0 ; int max ; if ( n == - 1 ) max = scores . size ( ) ; else max = n > scores . size ( ) ? scores . size ( ) : n ; for ( i = 0 ; i < max ; i ++ ) { if ( score > scores . get ( i ) ) break ; } // TODO : 没有删除多余的信息
if ( n != - 1 && i >= n ) return - 1 ; if ( i < scores . size ( ) ) { scores . insert ( i , score ) ... |
public class HtmlTool { /** * Retrieves text content of the selected elements in HTML . Renders the element ' s text as it
* would be displayed on the web page ( including its children ) .
* @ param content
* HTML content with the elements
* @ param selector
* CSS selector for elements to extract contents
*... | Element body = parseContent ( content ) ; List < Element > elements = body . select ( selector ) ; List < String > texts = new ArrayList < String > ( ) ; for ( Element element : elements ) { texts . add ( element . text ( ) ) ; } return texts ; |
public class DevicesStatusApi { /** * Update Device Status
* Update Device Status
* @ param deviceId Device ID . ( required )
* @ param body Body ( optional )
* @ return ApiResponse & lt ; DeviceStatus & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the resp... | com . squareup . okhttp . Call call = putDeviceStatusValidateBeforeCall ( deviceId , body , null , null ) ; Type localVarReturnType = new TypeToken < DeviceStatus > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class MiniDrawer { /** * returns always the original drawerItems and not the switched content
* @ return */
private List < IDrawerItem > getDrawerItems ( ) { } } | return mDrawer . getOriginalDrawerItems ( ) != null ? mDrawer . getOriginalDrawerItems ( ) : mDrawer . getDrawerItems ( ) ; |
public class JsiiClient { /** * Gets a value of a static property .
* @ param fqn The FQN of the class
* @ param property The name of the static property
* @ return The value of the static property */
public JsonNode getStaticPropertyValue ( final String fqn , final String property ) { } } | ObjectNode req = makeRequest ( "sget" ) ; req . put ( "fqn" , fqn ) ; req . put ( "property" , property ) ; return this . runtime . requestResponse ( req ) . get ( "value" ) ; |
public class HashCodeBuilder { /** * Uses reflection to build a valid hash code from the fields of { @ code object } .
* This constructor uses two hard coded choices for the constants needed to build a hash code .
* It uses < code > AccessibleObject . setAccessible < / code > to gain access to private fields . This... | return reflectionHashCode ( object , ArrayUtil . toArray ( excludeFields , String . class ) ) ; |
public class LogManager { /** * Adds a log writer , either global or to a particular log service .
* Note that the writer is added to the log service ( s ) regardless if it was already
* added before . < br >
* If the writer is added global , it will receive logging information from all log
* services that are ... | if ( logService != null && logService . length ( ) > 0 ) { final LogService l = ( LogService ) loggers . get ( logService ) ; if ( l != null ) l . addWriter ( writer ) ; return l != null ; } synchronized ( loggers ) { writers . add ( writer ) ; for ( final Iterator i = loggers . values ( ) . iterator ( ) ; i . hasNext ... |
public class GrailsClassUtils { /** * < p > Tests whether or not the left hand type is compatible with the right hand type in Groovy
* terms , i . e . can the left type be assigned a value of the right hand type in Groovy . < / p >
* < p > This handles Java primitive type equivalence and uses isAssignableFrom for a... | if ( leftType == null ) { throw new NullPointerException ( "Left type is null!" ) ; } if ( rightType == null ) { throw new NullPointerException ( "Right type is null!" ) ; } if ( leftType == Object . class ) { return true ; } if ( leftType == rightType ) { return true ; } // check for primitive type equivalence
Class <... |
public class SwingUtil { /** * Centers component < code > b < / code > within component < code > a < / code > . */
public static void centerComponent ( Component a , Component b ) { } } | Dimension asize = a . getSize ( ) , bsize = b . getSize ( ) ; b . setLocation ( ( asize . width - bsize . width ) / 2 , ( asize . height - bsize . height ) / 2 ) ; |
public class InputBootstrapper { /** * Other private methods : */
private final void reportPseudoAttrProblem ( String attrName , String got , String expVal1 , String expVal2 ) throws WstxException { } } | String expStr = ( expVal1 == null ) ? "" : ( "; expected \"" + expVal1 + "\" or \"" + expVal2 + "\"" ) ; if ( got == null || got . length ( ) == 0 ) { throw new WstxParsingException ( "Missing XML pseudo-attribute '" + attrName + "' value" + expStr , getLocation ( ) ) ; } throw new WstxParsingException ( "Invalid XML p... |
public class Gen { /** * Including super classes ' fields . */
List < VariableElement > getAllFields ( TypeElement subclazz ) { } } | List < VariableElement > fields = new ArrayList < > ( ) ; TypeElement cd = null ; Stack < TypeElement > s = new Stack < > ( ) ; cd = subclazz ; while ( true ) { s . push ( cd ) ; TypeElement c = ( TypeElement ) ( types . asElement ( cd . getSuperclass ( ) ) ) ; if ( c == null ) break ; cd = c ; } while ( ! s . empty ( ... |
public class R { /** * Renders the Childrens of a Component
* @ param fc
* @ param component
* @ throws IOException */
public static void renderChildren ( FacesContext fc , UIComponent component ) throws IOException { } } | for ( Iterator < UIComponent > iterator = component . getChildren ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { UIComponent child = ( UIComponent ) iterator . next ( ) ; renderChild ( fc , child ) ; } |
public class xen_brvpx_image { /** * < pre >
* Converts API response of bulk operation into object and returns the object array in case of get request .
* < / pre > */
protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } } | xen_brvpx_image_responses result = ( xen_brvpx_image_responses ) service . get_payload_formatter ( ) . string_to_resource ( xen_brvpx_image_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro_exception ( result .... |
public class DefaultFaceletContext { /** * @ Override
* public TemplateManager popCompositeComponentClient ( boolean cleanClientStack )
* if ( ! this . _ compositeComponentClients . isEmpty ( ) )
* if ( cleanClientStack )
* _ clientsStack . get ( _ currentClientStack ) . clear ( ) ;
* _ currentClientStack - -... | TemplateContext itc = new TemplateContextImpl ( ) ; itc . setCompositeComponentClient ( new CompositeComponentTemplateManager ( this . _facelet , client , getPageContext ( ) ) ) ; _isolatedTemplateContext . add ( itc ) ; _currentTemplateContext ++ ; _defaultVarMapper . setTemplateContext ( itc ) ; |
public class FileReceiver { /** * Handles a group input file . */
private void handleFile ( final String filePath , final AsyncFile file , final InputGroup group ) { } } | final AtomicLong position = new AtomicLong ( ) ; final AtomicBoolean complete = new AtomicBoolean ( ) ; final AtomicInteger handlerCount = new AtomicInteger ( ) ; group . messageHandler ( new Handler < Buffer > ( ) { @ Override public synchronized void handle ( Buffer buffer ) { file . write ( buffer , position . get (... |
public class SharedUtils { /** * Determine whether String is a value binding expression or not . */
static boolean isExpression ( String expression ) { } } | if ( null == expression ) { return false ; } // check to see if attribute has an expression
int start = expression . indexOf ( "#{" ) ; return start != - 1 && expression . indexOf ( '}' , start + 2 ) != - 1 ; |
public class SailthruClient { /** * Get template information
* @ param template template name
* @ throws IOException */
public JsonResponse getTemplate ( String template ) throws IOException { } } | Map < String , Object > data = new HashMap < String , Object > ( ) ; data . put ( Template . PARAM_TEMPLATE , template ) ; return apiGet ( ApiAction . template , data ) ; |
public class ModelPackageStatusItemMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ModelPackageStatusItem modelPackageStatusItem , ProtocolMarshaller protocolMarshaller ) { } } | if ( modelPackageStatusItem == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( modelPackageStatusItem . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( modelPackageStatusItem . getStatus ( ) , STATUS_BINDING ) ; protocolMarsha... |
public class CmsCheckableDatePanel { /** * Returns all dates with the specified check state , if the check state is < code > null < / code > , all dates are returned .
* @ param checkState the check state , the returned dates should have .
* @ return all dates with the specified check state , if the check state is ... | TreeSet < Date > result = new TreeSet < Date > ( ) ; for ( CmsCheckBox cb : m_checkBoxes ) { if ( ( checkState == null ) || ( cb . isChecked ( ) == checkState . booleanValue ( ) ) ) { Date date = ( Date ) cb . getElement ( ) . getPropertyObject ( "date" ) ; result . add ( date ) ; } } return result ; |
public class PiwikRequest { /** * We recommend to set the
* search count to the number of search results displayed on the results page .
* When keywords are tracked with { @ code Search Results Count = 0 } they will appear in
* the " No Result Search Keyword " report . SearchQuery must first be set .
* @ param ... | if ( searchResultsCount != null && getSearchQuery ( ) == null ) { throw new IllegalStateException ( "SearchQuery must be set before SearchResultsCount can be set." ) ; } setParameter ( SEARCH_RESULTS_COUNT , searchResultsCount ) ; |
public class RelationalOperations { /** * Returns true if pt _ a equals pt _ b . */
private static boolean pointEqualsPoint_ ( Point2D pt_a , Point2D pt_b , double tolerance , ProgressTracker progress_tracker ) { } } | if ( Point2D . sqrDistance ( pt_a , pt_b ) <= tolerance * tolerance ) return true ; return false ; |
public class WebSocketHandler { /** * Sends a text message using this object ' s websocket session .
* @ param message json binary message */
public void sendMessage ( final String message ) { } } | try { session . sendMessage ( new TextMessage ( message ) ) ; } catch ( IOException e ) { logger . error ( "[sendTextMessage]" , e ) ; } |
public class DescribeBuildRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeBuildRequest describeBuildRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeBuildRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeBuildRequest . getBuildId ( ) , BUILDID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . ge... |
public class MetadataUtil { /** * Logs out metadata information .
* @ param metadata */
public void log ( final Metadata metadata ) { } } | final StringBuilder sb = new StringBuilder ( ) ; for ( final MetadataItem item : metadata . getGroupList ( ) ) { sb . append ( LINE ) ; sb . append ( NEWLINE ) ; sb . append ( LINE ) ; sb . append ( "Group: " + item . getName ( ) ) ; sb . append ( NEWLINE ) ; for ( MetadataElement element : item . getElements ( ) ) { s... |
public class CrystClustWriter { /** * Private procedures */
private void writeChemSequence ( IChemSequence cs ) throws UnsupportedChemObjectException { } } | int count = cs . getChemModelCount ( ) ; for ( int i = 0 ; i < count ; i ++ ) { writeln ( "frame: " + ( i + 1 ) ) ; writeCrystal ( cs . getChemModel ( i ) . getCrystal ( ) ) ; } |
public class NameUtil { /** * d179573 Begins */
private static boolean allHexDigits ( String str , int start , int end ) { } } | boolean rtn = true ; for ( int i = start ; i < end ; ++ i ) { if ( "0123456789abcdefABCDEF" . indexOf ( str . charAt ( i ) ) == - 1 ) { rtn = false ; break ; } } return rtn ; |
public class IfcCurveStyleFontImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) public EList < IfcCurveStyleFontPattern > getPatternList ( ) { } } | return ( EList < IfcCurveStyleFontPattern > ) eGet ( Ifc2x3tc1Package . Literals . IFC_CURVE_STYLE_FONT__PATTERN_LIST , true ) ; |
public class FileManagerImpl { /** * Debugging and testing interface */
public static void main ( String args [ ] ) throws FileManagerException , IOException { } } | HTODDynacache hdc = new HTODDynacache ( ) ; FileManagerImpl mem_manager = new FileManagerImpl ( "foo1" , // filename
false , // coalsece
"rw" , // mode
MULTIVOLUME , // type
hdc ) ; mem_manager . run_tests ( ) ; OutputStreamWriter out = new OutputStreamWriter ( System . out ) ; mem_manager . dump_disk_memory ( out ) ; ... |
public class AbstractFunction { /** * Creates a trivial factory that always return the provided function . */
public static Function . Factory factory ( final Function fun ) { } } | return new Function . Factory ( ) { public Function create ( String ksName , String cfName ) { return fun ; } } ; |
public class MonitorService { /** * Adds the given label to the monitor with the given id .
* @ param monitorId The id of the monitor to update
* @ param label The label to add
* @ return The label that was added */
public Optional < Label > createLabel ( String monitorId , Label label ) { } } | HTTP . POST ( String . format ( "/v1/monitors/%s/labels" , monitorId ) , label . getKey ( ) ) ; return Optional . of ( label ) ; |
public class CommerceAddressRestrictionLocalServiceUtil { /** * Returns a range of all the commerce address restrictions .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes i... | return getService ( ) . getCommerceAddressRestrictions ( start , end ) ; |
public class ByteIterator { /** * Returns an infinite { @ code ByteIterator } .
* @ param supplier
* @ return */
public static ByteIterator generate ( final ByteSupplier supplier ) { } } | N . checkArgNotNull ( supplier ) ; return new ByteIterator ( ) { @ Override public boolean hasNext ( ) { return true ; } @ Override public byte nextByte ( ) { return supplier . getAsByte ( ) ; } } ; |
public class Curve { /** * Get the point at a particular location on the curve
* @ param t A value between 0 and 1 defining the location of the curve the point is at
* @ return The point on the curve */
public Vector2f pointAt ( float t ) { } } | float a = 1 - t ; float b = t ; float f1 = a * a * a ; float f2 = 3 * a * a * b ; float f3 = 3 * a * b * b ; float f4 = b * b * b ; float nx = ( p1 . x * f1 ) + ( c1 . x * f2 ) + ( c2 . x * f3 ) + ( p2 . x * f4 ) ; float ny = ( p1 . y * f1 ) + ( c1 . y * f2 ) + ( c2 . y * f3 ) + ( p2 . y * f4 ) ; return new Vector2f ( ... |
public class AmqpMessageHandlerService { /** * Method to update the action status of an action through the event .
* @ param actionUpdateStatus
* the object form the ampq message */
private void updateActionStatus ( final Message message ) { } } | final DmfActionUpdateStatus actionUpdateStatus = convertMessage ( message , DmfActionUpdateStatus . class ) ; final Action action = checkActionExist ( message , actionUpdateStatus ) ; final List < String > messages = actionUpdateStatus . getMessage ( ) ; if ( isCorrelationIdNotEmpty ( message ) ) { messages . add ( Rep... |
public class DatabasesInner { /** * Gets a list of databases in an elastic pool .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; DatabaseInner &... | return listByElasticPoolNextSinglePageAsync ( nextPageLink ) . concatMap ( new Func1 < ServiceResponse < Page < DatabaseInner > > , Observable < ServiceResponse < Page < DatabaseInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < DatabaseInner > > > call ( ServiceResponse < Page < DatabaseInner ... |
public class ApiOvhPackxdsl { /** * Alter this object properties
* REST : PUT / pack / xdsl / { packName }
* @ param body [ required ] New object properties
* @ param packName [ required ] The internal name of your pack */
public void packName_PUT ( String packName , OvhPackAdsl body ) throws IOException { } } | String qPath = "/pack/xdsl/{packName}" ; StringBuilder sb = path ( qPath , packName ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ; |
public class NWiseExtension { /** * Finds all nWise combinations of a set of variables , each with a given domain of values
* @ param nWise the number of variables in each combination
* @ param coVariables the varisbles
* @ param variableDomains the domains
* @ return all nWise combinations of the set of variab... | List < Set < String > > tuples = makeNWiseTuples ( coVariables , nWise ) ; List < Map < String , String > > testCases = new ArrayList < > ( ) ; for ( Set < String > tuple : tuples ) { testCases . addAll ( expandTupleIntoTestCases ( tuple , variableDomains ) ) ; } return testCases ; |
public class UploadOfflineData { /** * Returns a new user identifier with the specified type and value . */
private static UserIdentifier createUserIdentifier ( OfflineDataUploadUserIdentifierType identifierType , String value ) throws UnsupportedEncodingException { } } | // If the user identifier type is a hashed type , also call hash function
// on the value .
if ( HASHED_IDENTIFIER_TYPES . contains ( identifierType ) ) { value = toSHA256String ( value ) ; } UserIdentifier userIdentifier = new UserIdentifier ( ) ; userIdentifier . setUserIdentifierType ( identifierType ) ; userIdentif... |
public class ServletUtil { /** * Handles a request for static resources .
* @ param request the http request .
* @ param response the http response . */
public static void handleStaticResourceRequest ( final HttpServletRequest request , final HttpServletResponse response ) { } } | String staticRequest = request . getParameter ( WServlet . STATIC_RESOURCE_PARAM_NAME ) ; try { InternalResource staticResource = InternalResourceMap . getResource ( staticRequest ) ; boolean headersOnly = "HEAD" . equals ( request . getMethod ( ) ) ; if ( staticResource == null ) { LOG . warn ( "Static resource [" + s... |
public class UtcProperty { /** * { @ inheritDoc } */
public void validate ( ) throws ValidationException { } } | super . validate ( ) ; if ( getDate ( ) != null && ! ( getDate ( ) instanceof DateTime ) ) { throw new ValidationException ( "Property must have a DATE-TIME value" ) ; } final DateTime dateTime = ( DateTime ) getDate ( ) ; if ( dateTime != null && ! dateTime . isUtc ( ) ) { throw new ValidationException ( getName ( ) +... |
public class ActivitysInner { /** * Retrieve a list of activities in the module identified by module name .
* ServiceResponse < PageImpl < ActivityInner > > * @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the val... | if ( nextPageLink == null ) { throw new IllegalArgumentException ( "Parameter nextPageLink is required and cannot be null." ) ; } String nextUrl = String . format ( "%s" , nextPageLink ) ; return service . listByModuleNext ( nextUrl , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new ... |
public class FileUtil { /** * Deletes a directory recursively .
* @ param pFile the file to delete
* @ return { @ code true } if the file was deleted sucessfully
* @ throws IOException if an i / o error occurs during delete . */
private static boolean deleteDir ( final File pFile ) throws IOException { } } | // Recusively delete all files / subfolders
// Deletes the files using visitor pattern , to avoid allocating
// a file array , which may throw OutOfMemoryExceptions for
// large directories / in low memory situations
class DeleteFilesVisitor implements Visitor < File > { private int failedCount = 0 ; private IOExceptio... |
public class SlideStackModel { /** * Got to next slide . */
public void next ( final boolean skipSlideStep ) { } } | synchronized ( this ) { // Try to display the next slide step first
// If no slide step is remaining , display the next slide
if ( skipSlideStep || this . selectedSlideModel . nextStep ( ) && this . slidePosition < getPresentationService ( ) . getPresentation ( ) . getSlides ( ) . getSlide ( ) . size ( ) - 1 ) { this .... |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcFillAreaStyleTiles ( ) { } } | if ( ifcFillAreaStyleTilesEClass == null ) { ifcFillAreaStyleTilesEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 270 ) ; } return ifcFillAreaStyleTilesEClass ; |
public class DoubleBond2DParity { /** * Calculate the configuration of the double bond as a parity .
* @ return opposite ( + 1 ) , together ( - 1 ) or unspecified ( 0) */
@ Override public int parity ( ) { } } | return parity ( l1 , l2 , r ) * parity ( r1 , r2 , l ) ; |
public class DnsBatch { /** * Adds a request representing the " create zone " operation to this batch . The { @ code options } can
* be used to restrict the fields returned in the same way as for { @ link Dns # create ( ZoneInfo ,
* Dns . ZoneOption . . . ) } . Calling { @ link DnsBatchResult # get ( ) } on the ret... | DnsBatchResult < Zone > result = new DnsBatchResult < > ( ) ; // todo this can cause misleading report of a failure , intended to be fixed within # 924
RpcBatch . Callback < ManagedZone > callback = createZoneCallback ( this . options , result , false , true ) ; Map < DnsRpc . Option , ? > optionMap = DnsImpl . optionM... |
public class IO { /** * Write the given elements to the data output .
* @ param elements the elements to write
* @ param writer the element writer
* @ param out the data output
* @ param < T > the element type
* @ throws NullPointerException if one of the given arguments is { @ code null }
* @ throws IOExce... | writeInt ( elements . size ( ) , out ) ; for ( T element : elements ) { writer . write ( element , out ) ; } |
public class TcpConnecter { /** * Close the connecting socket . */
protected void close ( ) { } } | assert ( fd != null ) ; try { fd . close ( ) ; socket . eventClosed ( addr . toString ( ) , fd ) ; } catch ( IOException e ) { socket . eventCloseFailed ( addr . toString ( ) , ZError . exccode ( e ) ) ; } fd = null ; |
public class RemoteConsumerDispatcher { /** * / * Called by our overridden unlock method in SIMPItem */
protected void eventPreUnlocked ( SIMPMessage msg , TransactionCommon tran ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "eventPreUnlocked" , new Object [ ] { msg , tran } ) ; if ( ( msg . guessRedeliveredCount ( ) + 1 ) >= _baseDestHandler . getMaxFailedDeliveries ( ) ) { // Override the check of the threshold from the local case because we o... |
public class HttpSubjectSecurityFilter { /** * Security code for subject - security LEGACY */
@ Override public void doMessageReceived ( NextFilter nextFilter , IoSession session , Object message ) throws Exception { } } | // GL . debug ( " http " , getClass ( ) . getSimpleName ( ) + " request received . " ) ;
if ( ! httpRequestMessageReceived ( nextFilter , session , message ) ) return ; HttpRequestMessage httpRequest = ( HttpRequestMessage ) message ; // Make sure we start with the subject from the underlying transport session in case ... |
public class ScoreUtil { /** * Get a { @ link DataSetIterator }
* from the given object whether it ' s a { @ link DataSetIterator }
* or { @ link DataSetIteratorFactory } , any other type will throw
* an { @ link IllegalArgumentException }
* @ param o the object to get the iterator from
* @ return the dataset... | if ( o instanceof DataSetIterator ) return ( DataSetIterator ) o ; else if ( o instanceof DataSetIteratorFactory ) { DataSetIteratorFactory factory = ( DataSetIteratorFactory ) o ; return factory . create ( ) ; } throw new IllegalArgumentException ( "Type must either be DataSetIterator or DataSetIteratorFactory" ) ; |
public class DubiousListCollection { /** * builds a field annotation by finding the field in the classes ' field list
* @ param fieldName the field for which to built the field annotation
* @ return the field annotation of the specified field */
@ Nullable private FieldAnnotation getFieldAnnotation ( final String f... | JavaClass cls = getClassContext ( ) . getJavaClass ( ) ; Field [ ] fields = cls . getFields ( ) ; for ( Field f : fields ) { if ( f . getName ( ) . equals ( fieldName ) ) { return new FieldAnnotation ( cls . getClassName ( ) , fieldName , f . getSignature ( ) , f . isStatic ( ) ) ; } } return null ; // shouldn ' t happ... |
public class KNXnetIPTunnel { /** * Sends a cEMI frame to the remote server communicating with this endpoint .
* Sending in busmonitor mode is not permitted . < br >
* @ param frame cEMI message to send , the expected cEMI type is according to the used
* tunneling layer */
public void send ( CEMI frame , Blocking... | if ( layer == BUSMONITOR_LAYER ) throw new KNXIllegalStateException ( "send not permitted in busmonitor mode" ) ; if ( ! ( frame instanceof CEMILData ) ) throw new KNXIllegalArgumentException ( "unsupported cEMI type" ) ; super . send ( frame , mode ) ; |
public class CustomRequestHeaderPlugin { /** * Update header value
* @ param headerValue new value of the header */
public void setHeaderValue ( @ NotNull String headerValue ) { } } | if ( StringUtils . isBlank ( headerValue ) ) { throw new IllegalArgumentException ( "Parameter 'headerValue' cannot be blank." + " If you want to disable this header invoke disable() method." ) ; } this . headerValue = headerValue ; |
public class AmazonElasticFileSystemClient { /** * Creates a mount target for a file system . You can then mount the file system on EC2 instances by using the mount
* target .
* You can create one mount target in each Availability Zone in your VPC . All EC2 instances in a VPC within a given
* Availability Zone sh... | request = beforeClientExecution ( request ) ; return executeCreateMountTarget ( request ) ; |
public class BigQueryUtils { /** * Parses the given JSON string and returns the extracted schema .
* @ param fields a string to read the TableSchema from .
* @ return the List of TableFieldSchema described by the string fields . */
public static List < TableFieldSchema > getSchemaFromString ( String fields ) { } } | logger . atFine ( ) . log ( "getSchemaFromString('%s')" , fields ) ; // Parse the output schema for Json from fields .
JsonParser jsonParser = new JsonParser ( ) ; JsonArray json = jsonParser . parse ( fields ) . getAsJsonArray ( ) ; List < TableFieldSchema > fieldsList = new ArrayList < > ( ) ; // For each item in the... |
public class NewJFrame { /** * GEN - LAST : event _ datePopupChanged */
private void timePopupChanged ( java . beans . PropertyChangeEvent evt ) { } } | // GEN - FIRST : event _ timePopupChanged
if ( evt . getNewValue ( ) instanceof Date ) setDateTime ( ( Date ) evt . getNewValue ( ) ) ; |
public class SessionDataManager { /** * Return item by absolute path in this transient storage then in workspace container .
* @ param path
* - absolute path to the searched item
* @ param pool
* - indicates does the item fall in pool
* @ return existed item or null if not found
* @ throws RepositoryExcepti... | long start = 0 ; if ( LOG . isDebugEnabled ( ) ) { start = System . currentTimeMillis ( ) ; LOG . debug ( "getItem(" + path . getAsString ( ) + " ) >>>>>" ) ; } ItemImpl item = null ; try { return item = readItem ( getItemData ( path ) , pool ) ; } finally { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "getItem(" + ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.