signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class DiffTool { /** * Starts the DiffTool application .
* @ param args
* program arguments args [ 0 ] has to be the path to the
* configuration file */
public static void main ( final String [ ] args ) { } } | if ( args . length != 1 ) { throw new IllegalArgumentException ( "Configuration File ist missing." ) ; } try { // Reads the configuration
ConfigSettings config = readConfiguration ( args [ 0 ] ) ; new DiffToolThread ( config ) . run ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } |
public class Event { /** * indexed setter for causes _ event - sets an indexed value -
* @ generated
* @ param i index in the array to set
* @ param v value to set into the array */
public void setCauses_event ( int i , Event v ) { } } | if ( Event_Type . featOkTst && ( ( Event_Type ) jcasType ) . casFeat_causes_event == null ) jcasType . jcas . throwFeatMissing ( "causes_event" , "ch.epfl.bbp.uima.genia.Event" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Event_Type ) jcasType ) . casFeatCode_causes_event ) ,... |
public class EntryInformationImpl { /** * Defined by the ROME module API
* @ param obj Object to copy from */
@ Override public void copyFrom ( final CopyFrom obj ) { } } | final EntryInformationImpl info = ( EntryInformationImpl ) obj ; setAuthor ( info . getAuthor ( ) ) ; setBlock ( info . getBlock ( ) ) ; if ( info . getDuration ( ) != null ) { setDuration ( new Duration ( info . getDuration ( ) . getMilliseconds ( ) ) ) ; } setExplicit ( info . getExplicit ( ) ) ; try { if ( info . ge... |
public class BatchDeleteBuildsResult { /** * The IDs of the builds that were successfully deleted .
* @ param buildsDeleted
* The IDs of the builds that were successfully deleted . */
public void setBuildsDeleted ( java . util . Collection < String > buildsDeleted ) { } } | if ( buildsDeleted == null ) { this . buildsDeleted = null ; return ; } this . buildsDeleted = new java . util . ArrayList < String > ( buildsDeleted ) ; |
public class UISlot { /** * Updates the { @ link UITooltip } of this { @ link UISlot } based on the contained ItemStack . < br >
* If no ItemStack is present in slot , revert the tooltip back to default one . */
protected void updateTooltip ( ) { } } | if ( slot . getItemStack ( ) . isEmpty ( ) ) { tooltip = defaultTooltip ; return ; } List < String > lines = slot . getItemStack ( ) . getTooltip ( Utils . getClientPlayer ( ) , Minecraft . getMinecraft ( ) . gameSettings . advancedItemTooltips ? ITooltipFlag . TooltipFlags . ADVANCED : ITooltipFlag . TooltipFlags . NO... |
public class RepositoryDataTask { /** * Reads a single schema file .
* @ param reader The schema reader
* @ param schemaFile The schema file
* @ return The model */
private Database readSingleSchemaFile ( DatabaseIO reader , File schemaFile ) { } } | Database model = null ; if ( ! schemaFile . isFile ( ) ) { log ( "Path " + schemaFile . getAbsolutePath ( ) + " does not denote a schema file" , Project . MSG_ERR ) ; } else if ( ! schemaFile . canRead ( ) ) { log ( "Could not read schema file " + schemaFile . getAbsolutePath ( ) , Project . MSG_ERR ) ; } else { try { ... |
public class ImageProxy { /** * Returns an ImageData object that can be used for further image processing
* e . g . by image filters .
* @ return ImageData */
public ImageData getImageData ( ) { } } | if ( false == isLoaded ( ) ) { return null ; } if ( m_fastout ) { final ScratchPad temp = new ScratchPad ( m_dest_wide , m_dest_high ) ; temp . getContext ( ) . drawImage ( m_jsimg , m_clip_xpos , m_clip_ypos , m_clip_wide , m_clip_high , 0 , 0 , m_dest_wide , m_dest_high ) ; return temp . getContext ( ) . getImageData... |
public class RegistriesInner { /** * Creates a new build based on the request parameters and add it to the build queue .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ param buildRequest The param... | return beginQueueBuildWithServiceResponseAsync ( resourceGroupName , registryName , buildRequest ) . map ( new Func1 < ServiceResponse < BuildInner > , BuildInner > ( ) { @ Override public BuildInner call ( ServiceResponse < BuildInner > response ) { return response . body ( ) ; } } ) ; |
public class SpiServiceLoader { /** * Create a new instance of the found Service . < br / >
* Verifies that the found ServiceImpl implements Service .
* @ param < T >
* @ param serviceType The Service interface
* @ param className The name of the implementation class
* @ param loader The ClassLoader to load t... | { // Get the constructor to use in making the new instance
final Constructor < ? extends T > ctor ; try { ctor = SecurityActions . getConstructor ( implClass , new Class < ? > [ ] { } ) ; } catch ( final NoSuchMethodException nsme ) { throw new RuntimeException ( implClass + " must contain a public no args contructor" ... |
public class ExcelDateUtil { /** * Given an Excel date with either 1900 or 1904 date windowing , converts it
* to a java . util . Date .
* @ param excelDate
* The Excel date .
* @ param use1904windowing
* true if date uses 1904 windowing , or false if using 1900 date
* windowing .
* @ return Java represen... | if ( isValidExcelDate ( excelDate ) ) { int startYear = EXCEL_BASE_YEAR ; int dayAdjust = - 1 ; // Excel thinks 2/29/1900 is a valid date , which
// it isn ' t
final int wholeDays = ( int ) Math . floor ( excelDate ) ; if ( use1904windowing ) { startYear = EXCEL_WINDOWING_1904 ; dayAdjust = 1 ; // 1904 date windowing u... |
public class GeneratedDi18nDaoImpl { /** * query - by method for field updatedDate
* @ param updatedDate the specified attribute
* @ return an Iterable of Di18ns for the specified updatedDate */
public Iterable < Di18n > queryByUpdatedDate ( java . util . Date updatedDate ) { } } | return queryByField ( null , Di18nMapper . Field . UPDATEDDATE . getFieldName ( ) , updatedDate ) ; |
public class BeatFinder { /** * Send a sync command to all registered listeners .
* @ param command the byte which identifies the type of sync command we received */
private void deliverSyncCommand ( byte command ) { } } | for ( final SyncListener listener : getSyncListeners ( ) ) { try { switch ( command ) { case 0x01 : listener . becomeMaster ( ) ; case 0x10 : listener . setSyncMode ( true ) ; break ; case 0x20 : listener . setSyncMode ( false ) ; break ; } } catch ( Throwable t ) { logger . warn ( "Problem delivering sync command to l... |
public class MobicentsSipServletsEmbeddedImpl { /** * / * ( non - Javadoc )
* @ see org . jboss . arquillian . container . mobicents . servlet . sip . embedded _ 1 . MobicentsSipServletsEmbedded # addConnector ( org . apache . catalina . connector . Connector ) */
@ Override public synchronized void addConnector ( Co... | if ( log . isDebugEnabled ( ) ) { log . debug ( "Adding connector (" + connector . getInfo ( ) + ")" ) ; } // Make sure we have a Container to send requests to
if ( engines . length < 1 ) throw new IllegalStateException ( sm . getString ( "embedded.noEngines" ) ) ; /* * Add the connector . This will set the connector '... |
public class PGtokenizer { /** * This removes the lead / trailing strings from all tokens .
* @ param l Leading string to remove
* @ param t Trailing string to remove */
public void remove ( String l , String t ) { } } | for ( int i = 0 ; i < tokens . size ( ) ; i ++ ) { tokens . set ( i , remove ( tokens . get ( i ) , l , t ) ) ; } |
public class NFGraph { /** * Retrieve a single connected ordinal in a given connection model , given the type and ordinal of the originating node , and the property by which this node is connected .
* @ return the connected ordinal , or - 1 if there is no such ordinal */
public int getConnection ( String connectionMo... | int connectionModelIndex = modelHolder . getModelIndex ( connectionModel ) ; return getConnection ( connectionModelIndex , nodeType , ordinal , propertyName ) ; |
public class DatabaseService { /** * Defines parameter mappings . One parameter can be mapped to multiple new names , so a list is used instead of a map as the input to this method . */
public void setMappings ( List < String > mappings ) { } } | if ( mappings . size ( ) > 0 ) { @ SuppressWarnings ( "unchecked" ) Pair < String , String > [ ] renames = ( Pair < String , String > [ ] ) Array . newInstance ( Pair . class , mappings . size ( ) ) ; for ( int i = 0 ; i < _renames . length ; ++ i ) { String [ ] names = mappings . get ( i ) . split ( "[ ,]+" ) ; rename... |
public class Command { /** * Extract a DevULong data from a CORBA Any object .
* Remenber that the TANGO DevULong type is mapped to the java int type
* @ param in The CORBA Any object
* @ return The extracted boolean data
* @ exception DevFailed If the Any object does not contains a data of the
* waited type ... | int data = 0 ; try { data = in . extract_ulong ( ) ; } catch ( BAD_OPERATION ex ) { throw_bad_type ( "DevULong" ) ; } return data ; |
public class CommerceAddressPersistenceImpl { /** * Clears the cache for the commerce address .
* The { @ link EntityCache } and { @ link FinderCache } are both cleared by this method . */
@ Override public void clearCache ( CommerceAddress commerceAddress ) { } } | entityCache . removeResult ( CommerceAddressModelImpl . ENTITY_CACHE_ENABLED , CommerceAddressImpl . class , commerceAddress . getPrimaryKey ( ) ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; |
public class MemorizeTransactionProxy { /** * Wrap Statement with a proxy .
* @ param target statement handle
* @ param connectionHandle originating bonecp connection
* @ return Proxy to a statement . */
protected static Statement memorize ( final Statement target , final ConnectionHandle connectionHandle ) { } } | return ( Statement ) Proxy . newProxyInstance ( StatementProxy . class . getClassLoader ( ) , new Class [ ] { StatementProxy . class } , new MemorizeTransactionProxy ( target , connectionHandle ) ) ; |
public class StateSaverImpl { /** * Save the state of the given view and the other state inside of the returned { @ link Parcelable } .
* @ param target The view containing fields annotated with { @ link State } .
* @ param state The super state of the parent class of the view . Usually it isn ' t { @ code null } .... | Injector . View < T > injector = safeGet ( target , Injector . View . DEFAULT ) ; return injector . save ( target , state ) ; |
public class GPX { /** * Create a new GPX builder with the given GPX version and creator string .
* @ param version the GPX version string
* @ param creator the GPX creator
* @ return new GPX builder
* @ throws NullPointerException if one of the arguments is { @ code null }
* @ deprecated Use { @ link # build... | return new Builder ( Version . of ( version ) , creator ) ; |
public class LeshanDeviceMetricsPollService { /** * Overridden */
@ Override public Object read ( String deviceId , String metric ) { } } | String translatedMetric = metricResolver . resolveMetric ( metric ) ; Client client = leshanServer . getClientRegistry ( ) . get ( deviceId ) ; ValueResponse leshanResponse = leshanServer . send ( client , new ReadRequest ( translatedMetric ) , 5000 ) ; if ( leshanResponse == null ) { return null ; } return ( ( LwM2mRe... |
public class AndPermission { /** * Has always been denied permission . */
private static boolean hasAlwaysDeniedPermission ( Source source , String ... deniedPermissions ) { } } | for ( String permission : deniedPermissions ) { if ( ! source . isShowRationalePermission ( permission ) ) { return true ; } } return false ; |
public class InstanceClient { /** * Sets metadata for the specified instance to the data included in the request .
* < p > Sample code :
* < pre > < code >
* try ( InstanceClient instanceClient = InstanceClient . create ( ) ) {
* ProjectZoneInstanceName instance = ProjectZoneInstanceName . of ( " [ PROJECT ] " ... | SetMetadataInstanceHttpRequest request = SetMetadataInstanceHttpRequest . newBuilder ( ) . setInstance ( instance ) . setMetadataResource ( metadataResource ) . build ( ) ; return setMetadataInstance ( request ) ; |
public class JFeature { /** * Compares the name and type of the 2 features
* @ param f the feature to compare
* @ return true if name and type are the same , omits id */
public boolean sameFeature ( JFeature f ) { } } | return this . name . equals ( f . name ) && this . type . equals ( f . type ) ; |
public class BDS { /** * Writes the BDS to the given file .
* @ param f The file to write the BDS to .
* @ see BDS # loadFromFile ( File ) */
public void writeToFile ( File f ) { } } | try ( FileOutputStream fos = new FileOutputStream ( f ) ) { fos . write ( write ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } |
public class RamlCompilerMojo { /** * { @ inheritDoc } */
@ Override public boolean fileDeleted ( File file ) throws WatchingException { } } | File theFile = getRamlOutputFile ( file ) ; FileUtils . deleteQuietly ( theFile ) ; return true ; |
public class CounterShardData { /** * Create a { @ link Key Key < CounterShardData > } . Keys for this entity are not " parented " so that they can be added
* under high volume load in a given application . Note that CounterData will be in a namespace specific .
* @ param counterDataKey
* @ param shardNumber
* ... | // Preconditions checked by # constructCounterShardIdentifier
return Key . create ( CounterShardData . class , constructCounterShardIdentifier ( counterDataKey . getName ( ) , shardNumber ) ) ; |
public class CmsDefaultXmlContentHandler { /** * Adds all needed default check rules recursively for the given schema type . < p >
* @ param rootContentDefinition the root content definition
* @ param schemaType the schema type to check
* @ param elementPath the current element path
* @ throws CmsXmlException i... | if ( ( schemaType != null ) && schemaType . isSimpleType ( ) ) { if ( ( schemaType . getMinOccurs ( ) == 0 ) && ( CmsXmlVfsFileValue . TYPE_NAME . equals ( schemaType . getTypeName ( ) ) || CmsXmlVarLinkValue . TYPE_NAME . equals ( schemaType . getTypeName ( ) ) ) && ! m_relationChecks . containsKey ( elementPath ) && ... |
public class JSONs { /** * Read an expected double .
* @ param o the object to parse
* @ param id the key in the map that points to the double
* @ return the double
* @ throws JSONConverterException if the key does not point to a double */
public static double requiredDouble ( JSONObject o , String id ) throws ... | checkKeys ( o , id ) ; Object x = o . get ( id ) ; if ( ! ( x instanceof Number ) ) { throw new JSONConverterException ( "Number expected at key '" + id + "' but was '" + x . getClass ( ) + "'." ) ; } return ( ( Number ) x ) . doubleValue ( ) ; |
public class DescribeTransformJobResult { /** * The environment variables to set in the Docker container . We support up to 16 key and values entries in the map .
* @ param environment
* The environment variables to set in the Docker container . We support up to 16 key and values entries in
* the map .
* @ retu... | setEnvironment ( environment ) ; return this ; |
public class BugInstance { /** * Add a method annotation for the method which the given visitor is
* currently visiting . If the method has source line information , then a
* SourceLineAnnotation is added to the method .
* @ param visitor
* the BetterVisitor
* @ return this object */
@ Nonnull public BugInsta... | MethodAnnotation methodAnnotation = MethodAnnotation . fromVisitedMethod ( visitor ) ; addMethod ( methodAnnotation ) ; addSourceLinesForMethod ( methodAnnotation , SourceLineAnnotation . fromVisitedMethod ( visitor ) ) ; return this ; |
public class HttpBuilder { /** * Executes asynchronous PATCH request on the configured URI ( alias for the ` patch ( Class , Closure ) ` method ) , with additional configuration provided by
* the configuration closure . The result will be cast to the specified ` type ` .
* [ source , groovy ]
* def http = HttpBui... | return CompletableFuture . supplyAsync ( ( ) -> patch ( type , closure ) , getExecutor ( ) ) ; |
public class DataReader { /** * Recursively resolve a series of keys against a JSON object . This is used to
* drill down into a JSON object tree . */
private JsonObject resolve ( JsonObject node , String ... keys ) { } } | for ( String key : keys ) { JsonElement n = node . get ( key ) ; if ( n == null ) { return null ; } node = n . getAsJsonObject ( ) ; } return node ; |
public class ID3v24Tag { /** * ' recording time ' ( TDRC ) replaces the deprecated frames ' TDAT - Date ' , ' TIME - Time ' ,
* ' TRDA - Recording dates ' and ' TYER - Year ' in 4.0 */
public String getRecordingTime ( ) { } } | ID3v2TextFrameData frameData = extractTextFrameData ( ID_RECTIME ) ; if ( frameData != null && frameData . getText ( ) != null ) return frameData . getText ( ) . toString ( ) ; return null ; |
public class SrvWarehouseEntry { /** * < p > Reverse a withdrawal warehouse . < / p >
* @ param pAddParam additional param
* @ param pEntity movement
* @ throws Exception - an exception */
@ Override public final void reverseDraw ( final Map < String , Object > pAddParam , final IMakingWarehouseEntry pEntity ) th... | if ( ! pEntity . getIdDatabaseBirth ( ) . equals ( getSrvOrm ( ) . getIdDatabase ( ) ) ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "can_not_make_ws_entry_for_foreign_src" ) ; } if ( pEntity . getItsQuantity ( ) . doubleValue ( ) > 0 ) { throw new ExceptionWithCode ( ExceptionWithCode . SOMET... |
public class DocBookUtilities { /** * Get the Translatable Strings from an XML Document . This method will return of Translation strings to XML DOM nodes within
* the XML Document . < br / >
* < br / >
* Note : This function has a flaw when breaking up strings if the Child Nodes contain translatable elements .
... | if ( xml == null ) return null ; final List < StringToNodeCollection > retValue = new ArrayList < StringToNodeCollection > ( ) ; final NodeList nodes = xml . getDocumentElement ( ) . getChildNodes ( ) ; for ( int i = 0 ; i < nodes . getLength ( ) ; ++ i ) { final Node node = nodes . item ( i ) ; getTranslatableStringsF... |
public class BinaryHeapPriorityQueue { /** * Remove the last element of the heap ( last in the index array ) . */
private void removeLastEntry ( ) { } } | Entry < E > entry = indexToEntry . remove ( size ( ) - 1 ) ; keyToEntry . remove ( entry . key ) ; |
public class JavaSPIExtensionLoader { public < T > Collection < T > all ( ClassLoader classLoader , Class < T > serviceClass ) { } } | Validate . notNull ( classLoader , "ClassLoader must be provided" ) ; Validate . notNull ( serviceClass , "ServiceClass must be provided" ) ; return createInstances ( serviceClass , load ( serviceClass , classLoader ) ) ; |
public class CSSClassManager { /** * Update the text contents of an existing style element .
* @ param document Document element ( factory )
* @ param style Style element */
public void updateStyleElement ( Document document , Element style ) { } } | StringBuilder buf = new StringBuilder ( ) ; serialize ( buf ) ; Text cont = document . createTextNode ( buf . toString ( ) ) ; while ( style . hasChildNodes ( ) ) { style . removeChild ( style . getFirstChild ( ) ) ; } style . appendChild ( cont ) ; |
public class AbstractQueuedSynchronizer { /** * Acquires in shared mode , aborting if interrupted . Implemented
* by first checking interrupt status , then invoking at least once
* { @ link # tryAcquireShared } , returning on success . Otherwise the
* thread is queued , possibly repeatedly blocking and unblocking... | if ( Thread . interrupted ( ) ) throw new InterruptedException ( ) ; if ( tryAcquireShared ( arg ) < 0 ) doAcquireSharedInterruptibly ( arg ) ; |
public class GetProtectionStatusRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetProtectionStatusRequest getProtectionStatusRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getProtectionStatusRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getProtectionStatusRequest . getPolicyId ( ) , POLICYID_BINDING ) ; protocolMarshaller . marshall ( getProtectionStatusRequest . getMemberAccountId ( ) , MEMB... |
public class PreconditionUtil { /** * Asserts that two objects are equal . If they are not , an
* { @ link AssertionError } is thrown with the given message . If
* < code > expected < / code > and < code > actual < / code > are < code > null < / code > , they
* are considered equal .
* @ param message the ident... | verifyEquals ( expected , actual , message ) ; |
public class IntegrationAccountsInner { /** * Gets the integration account callback URL .
* @ param resourceGroupName The resource group name .
* @ param integrationAccountName The integration account name .
* @ param parameters The callback URL parameters .
* @ param serviceCallback the async ServiceCallback t... | return ServiceFuture . fromResponse ( getCallbackUrlWithServiceResponseAsync ( resourceGroupName , integrationAccountName , parameters ) , serviceCallback ) ; |
public class Perfidix { /** * Setting up an existing benchmark with the given number of class - files
* @ param classes to be benched
* @ param benchmark to be set up
* @ return the same { @ link Benchmark } object with the classes
* @ throws ClassNotFoundException thrown if class was not found . */
public stat... | for ( final String each : classes ) { benchmark . add ( Class . forName ( each ) ) ; } return benchmark ; |
public class FeatureOverlayQuery { /** * Perform a query based upon the map click location and build feature table data
* @ param latLng location
* @ param zoom current zoom level
* @ param mapBounds map view bounds
* @ param tolerance distance tolerance
* @ return table data on what was clicked , or null
*... | return buildMapClickTableDataWithMapBounds ( latLng , zoom , mapBounds , tolerance , null ) ; |
public class ClassLoaderUtils { /** * Load a given resources . < p / > This method will try to load the resources
* using the following methods ( in order ) :
* < ul >
* < li > From Thread . currentThread ( ) . getContextClassLoader ( )
* < li > From ClassLoaderUtil . class . getClassLoader ( )
* < li > calli... | IOException . class , IOException . class , IOException . class , IOException . class , IOException . class } ) public static List < URL > getResources ( String resourceName , Class < ? > callingClass ) { List < URL > ret = new ArrayList < > ( ) ; Enumeration < URL > urls = new Enumeration < URL > ( ) { public boolean ... |
public class Authentication { /** * Exception */
protected static boolean saveAuthentication ( URL url , String authenticationToken , boolean authenticationTokenIsPrivate , String applicationKey , int timeToLive , String privateKey , Map < String , LinkedList < ChannelPermissions > > permissions ) throws IOException { ... | String postBody = String . format ( "AT=%s&AK=%s&PK=%s&TTL=%s&TP=%s&PVT=%s" , authenticationToken , applicationKey , privateKey , timeToLive , permissions . size ( ) , ( authenticationTokenIsPrivate ? "1" : "0" ) ) ; // CAUSE : Inefficient use of keySet iterator instead of entrySet
// iterator
for ( Map . Entry < Strin... |
public class Client { /** * Returns a cursor of single value for a set of series
* < p > The returned values ( datapoints ) can be null if there are no
* datapoints in the series or in the specified direction .
* @ param filter The filter of series to read from
* @ param timestamp The timestamp to read a value ... | URI uri = null ; try { URIBuilder builder = new URIBuilder ( String . format ( "/%s/single/" , API_VERSION ) ) ; addFilterToURI ( builder , filter ) ; addTimestampToURI ( builder , timestamp ) ; addTimeZoneToURI ( builder , timezone ) ; addDirectionToURI ( builder , direction ) ; uri = builder . build ( ) ; } catch ( U... |
public class AbstractAmazonElasticTranscoderAsync { /** * Simplified method form for invoking the ListPipelines operation with an AsyncHandler .
* @ see # listPipelinesAsync ( ListPipelinesRequest , com . amazonaws . handlers . AsyncHandler ) */
@ Override public java . util . concurrent . Future < ListPipelinesResul... | return listPipelinesAsync ( new ListPipelinesRequest ( ) , asyncHandler ) ; |
public class AbstractMarkerLanguageParser { /** * Extract the validation components from the given file .
* @ param inputFile the input file .
* @ return the validation components . */
public Iterable < ValidationComponent > getStandardValidationComponents ( File inputFile ) { } } | final ValidationHandler handler = new ValidationHandler ( ) ; getDocumentParser ( ) . extractValidationComponents ( inputFile , handler ) ; return handler . getComponents ( ) ; |
public class TwitterTokenServices { /** * Attemps to obtain a request token from the oauth / request _ token Twitter API . This request token can later be used to
* obtain an access token . If a request token is successfully obtained , the request is redirected to the oauth / authorize
* Twitter API to have Twitter... | TwitterEndpointServices twitter = getTwitterEndpointServices ( ) ; twitter . setConsumerKey ( config . getClientId ( ) ) ; twitter . setConsumerSecret ( config . getClientSecret ( ) ) ; Map < String , Object > result = twitter . obtainRequestToken ( config , callbackUrl ) ; if ( result == null || result . isEmpty ( ) )... |
public class RepositoryResourceImpl { /** * Find an AttachmentResource in a given set which either has the desired Locale
* or failing that , the same language as the desired locale . */
public static AttachmentSummary matchByLocale ( Collection < ? extends AttachmentSummary > attachments , AttachmentType desiredType... | Collection < AttachmentSummary > possibleMatches = new ArrayList < AttachmentSummary > ( ) ; for ( AttachmentSummary s : attachments ) { AttachmentType attType = s . getAttachment ( ) . getType ( ) ; if ( attType . equals ( desiredType ) ) { // This is either an exact match , or a candidate for a match - by - language
... |
public class ForEachTEI { /** * Currently implements the following rules :
* - If ' items ' is not specified , ' begin ' and ' end ' must be */
@ Override public boolean isValid ( TagData us ) { } } | if ( ! Util . isSpecified ( us , ITEMS ) ) { if ( ! Util . isSpecified ( us , BEGIN ) || ! ( Util . isSpecified ( us , END ) ) ) { return false ; } } return true ; |
public class DaylightModel { /** * The element has normal valence for the specified charge .
* @ param element atomic number
* @ param charge formal charge
* @ param valence bonded electrons
* @ return acceptable for this model */
private static boolean normal ( int element , int charge , int valence ) { } } | switch ( element ) { case CARBON : if ( charge == - 1 || charge == + 1 ) return valence == 3 ; return charge == 0 && valence == 4 ; case NITROGEN : case PHOSPHORUS : case ARSENIC : if ( charge == - 1 ) return valence == 2 ; if ( charge == + 1 ) return valence == 4 ; return charge == 0 && ( valence == 3 || ( valence == ... |
public class AppEngineDatastoreSession { /** * Returns { @ code Delete } command based on App Engine Low - level Datastore
* API for the specified entity metamodel .
* This method is the entry point for deleting Command Builder API .
* @ param < E > The type of entity deleted by this { @ code Delete } .
* @ par... | if ( metamodel == null ) { throw new IllegalArgumentException ( "'metamodel' must not be [" + metamodel + "]" ) ; } return new AppEngineDelete < E > ( metamodel , this ) ; |
public class ActivemqFinder { /** * - - - - - provider methods */
public void launchNewProviderWizard ( ) { } } | SecurityContext securityContext = securityFramework . getSecurityContext ( getProxy ( ) . getNameToken ( ) ) ; ResourceDescription resourceDescription = descriptionRegistry . lookup ( PROVIDER_TEMPLATE ) ; final DefaultWindow dialog = new DefaultWindow ( Console . MESSAGES . newMessagingProvider ( ) ) ; AddResourceDial... |
public class Printer { /** * Print methods */
public void print ( IonValue value , Appendable out ) throws IOException { } } | // Copy the options so visitor won ' t see changes made while printing .
Options options ; synchronized ( this ) // So we don ' t clone in the midst of changes
{ options = myOptions . clone ( ) ; } if ( true ) { _print ( value , makeVisitor ( options , out ) ) ; } else { // Bridge to the configurable text writer . This... |
public class GroupZipper { /** * Navigates down the tree to the first child node of the current node .
* If the current node has no childs an exception will be thrown .
* @ return a new groupzipper which points to the first child node of the
* current node
* @ throws NoSuchElementException
* if the current no... | if ( ! canDown ( ) ) { throw new NoSuchElementException ( "Could not move down because this group does not have any children" ) ; } parent = new GroupZipper ( parent , node , index ) ; index = 0 ; node = node . getGroups ( ) . get ( 0 ) ; return this ; |
public class QvmUploadDemo { /** * 获取凭证 */
public static void main ( String [ ] args ) { } } | // 设置账号的AK , SK
String ACCESS_KEY = "Access_Key" ; String SECRET_KEY = "Secret_Key" ; // 要上传的空间
String bucketname = "Bucket_Name" ; // 上传到七牛后保存的文件名
String key = "my-java.png" ; // 上传文件的路径
String FilePath = "/.../..." ; // 构造一个带指定的zone对象的配置类 , 华东1区域的云主机可以选择Zone . qvmZone0 ( ) , 华北2区域 ( 北京 ) 的云主机可以选择Zone . qvmZone1 ( ) ,... |
public class BriefLogFormatter { /** * A Custom format implementation that is designed for brevity . */
@ Override public String format ( LogRecord record ) { } } | /* String loggerName = record . getLoggerName ( ) ;
if ( loggerName = = null ) {
loggerName = " root " ; */
// . append ( loggerName )
return "[" + StringUtils . repeat ( " " , 8 - record . getLevel ( ) . toString ( ) . length ( ) ) + record . getLevel ( ) + '|' + StringUtils . repeat ( " " , 12 - Thread . currentT... |
public class SearchIndex { /** * SDK2.5 signature for back compatibility */
public ManagedEntity findByUuid ( Datacenter datacenter , String uuid , boolean vmOnly ) throws RuntimeFault , RemoteException { } } | return findByUuid ( datacenter , uuid , vmOnly , null ) ; |
public class AWSOrganizationsClient { /** * Retrieves information about the organization that the user ' s account belongs to .
* This operation can be called from any account in the organization .
* < note >
* Even if a policy type is shown as available in the organization , it can be disabled separately at the ... | request = beforeClientExecution ( request ) ; return executeDescribeOrganization ( request ) ; |
public class Timer { /** * Schedules the specified task for repeated < i > fixed - rate execution < / i > ,
* beginning after the specified delay . Subsequent executions take place
* at approximately regular intervals , separated by the specified period .
* < p > In fixed - rate execution , each execution is sche... | if ( delay < 0 ) throw new IllegalArgumentException ( "Negative delay." ) ; if ( period <= 0 ) throw new IllegalArgumentException ( "Non-positive period." ) ; sched ( task , System . currentTimeMillis ( ) + delay , period ) ; |
public class QueryInterceptor { /** * Remove entries from all indexes by key . */
void removeFromIndexes ( TransactionContext transactionContext , Object key ) { } } | Stream < IndexedTypeIdentifier > typeIdentifiers = getKnownClasses ( ) . stream ( ) . filter ( searchFactoryHandler :: hasIndex ) . map ( PojoIndexedTypeIdentifier :: new ) ; Set < Work > deleteWorks = typeIdentifiers . map ( e -> searchWorkCreator . createEntityWork ( keyToString ( key ) , e , WorkType . DELETE ) ) . ... |
public class CommonDialogWindow { /** * Adds the component manually to the allComponents - List and adds a
* ValueChangeListener to it . Necessary in Update Distribution Type as the
* CheckBox concerned is an ItemProperty . . .
* @ param component
* AbstractField */
public void updateAllComponents ( final Abstr... | allComponents . add ( component ) ; component . addValueChangeListener ( new ChangeListener ( component ) ) ; |
public class InfraAlertConditionService { /** * Returns the infrastructure alert condition with the given id .
* @ param conditionId The id of the alert condition to return
* @ return The alert condition */
public Optional < InfraAlertCondition > show ( long conditionId ) { } } | return HTTP . GET ( String . format ( "/v2/alerts/conditions/%d" , conditionId ) , null , null , INFRA_ALERT_CONDITION ) ; |
public class Utils { /** * Obtains a parameter with specified name from from query string . The query should be in format
* param = value & param = value . . .
* @ param query Queery in " url " format .
* @ param paramName Parameter name .
* @ return Parameter value , or null . */
public static String getParame... | String [ ] components = query . split ( "&" ) ; for ( String keyValuePair : components ) { String [ ] pairComponents = keyValuePair . split ( "=" ) ; if ( pairComponents . length == 2 ) { try { String key = URLDecoder . decode ( pairComponents [ 0 ] , "utf-8" ) ; if ( key . compareTo ( paramName ) == 0 ) { return URLDe... |
public class ConfigurationTypeConverter { /** * A helper converting method .
* Converts string to a class of given type
* @ param value
* String value to be converted
* @ param to
* Type of desired value
* @ param < T >
* Type of returned value
* @ return Value converted to the appropriate type */
publi... | if ( Strings . isEmpty ( value ) && ! ( String . class . equals ( to ) || String [ ] . class . equals ( to ) ) ) { return null ; } if ( String . class . equals ( to ) ) { return to . cast ( value ) ; } else if ( Integer . class . equals ( to ) ) { return to . cast ( Integer . valueOf ( value ) ) ; } else if ( Double . ... |
public class Http { /** * Sends a POST request with a file and returns the response .
* @ param endpoint The endpoint to send the request to .
* @ param input The file data to upload
* @ param responseClass The class to deserialise the Json response to . Can be null if no response message is expected .
* @ para... | // Create the request
HttpPost post = new HttpPost ( endpoint . url ( ) ) ; post . setHeaders ( combineHeaders ( ) ) ; // Add fields as text pairs
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder . create ( ) ; for ( NameValuePair field : fields ) { multipartEntityBuilder . addTextBody ( field . g... |
public class Json { /** * Convert a JsonNode to a Java value
* @ param json Json value to convert .
* @ param clazz Expected Java value type .
* @ param < T > type of return object
* @ return casted value of given json object */
public static < T > T fromJson ( final String json , final Class < T > clazz ) { } ... | return fromJson ( parse ( json ) , clazz ) ; |
public class DtlsSrtpServer { /** * Gets the fingerprint of the Certificate associated to the server .
* @ return The fingerprint of the server certificate . Returns an empty
* String if the server does not contain a certificate . */
public String generateFingerprint ( String hashFunction ) { } } | try { this . hashFunction = hashFunction ; org . bouncycastle . crypto . tls . Certificate chain = TlsUtils . loadCertificateChain ( certificateResources ) ; Certificate certificate = chain . getCertificateAt ( 0 ) ; return TlsUtils . fingerprint ( this . hashFunction , certificate ) ; } catch ( IOException e ) { LOGGE... |
public class TransactionImpl { /** * Enlist the resouce with the transaction associated with the target
* TransactionImpl object .
* This is the implementation version of the method and does take in the
* XA resource class name and info objects required during recovery . If
* these fields are provided ( ie are ... | return enlistResource ( xaRes , recoveryIndex , XAResource . TMNOFLAGS ) ; |
public class GinjectorFragmentOutputter { /** * Writes a method describing the getter for the given key , along with any
* other code necessary to support it . Produces a list of helper methods that
* still need to be written . */
void writeBindingGetter ( Key < ? > key , Binding binding , GinScope scope , List < I... | Context bindingContext = binding . getContext ( ) ; SourceSnippetBuilder getterBuilder = new SourceSnippetBuilder ( ) ; SourceSnippet creationStatements ; String getter = nameGenerator . getGetterMethodName ( key ) ; String typeName ; try { typeName = ReflectUtil . getSourceName ( key . getTypeLiteral ( ) ) ; creationS... |
public class lbmonitor { /** * Use this API to disable lbmonitor resources of given names . */
public static base_responses disable ( nitro_service client , String monitorname [ ] ) throws Exception { } } | base_responses result = null ; if ( monitorname != null && monitorname . length > 0 ) { lbmonitor disableresources [ ] = new lbmonitor [ monitorname . length ] ; for ( int i = 0 ; i < monitorname . length ; i ++ ) { disableresources [ i ] = new lbmonitor ( ) ; disableresources [ i ] . monitorname = monitorname [ i ] ; ... |
public class Wxs { /** * 根据提交参数 , 生成签名
* @ param map
* 要签名的集合
* @ param key
* 商户秘钥
* @ return 签名
* @ see < a href =
* " https : / / pay . weixin . qq . com / wiki / doc / api / jsapi . php ? chapter = 4_3 " >
* 微信商户平台签名算法 < / a > */
public static String genPaySign ( Map < String , Object > map , String ... | String [ ] nms = map . keySet ( ) . toArray ( new String [ map . size ( ) ] ) ; Arrays . sort ( nms ) ; StringBuilder sb = new StringBuilder ( ) ; signType = signType == null ? "MD5" : signType . toUpperCase ( ) ; boolean isMD5 = "MD5" . equals ( signType ) ; for ( String nm : nms ) { Object v = map . get ( nm ) ; if (... |
public class EventImpl { /** * Remove any existing value for the provided EventLocal .
* @ param < T >
* @ param key
* @ return T , existing object being removed , null if none present */
@ SuppressWarnings ( "unchecked" ) public < T > T remove ( EventLocal < T > key ) { } } | EventLocalMap < EventLocal < ? > , Object > map = getMap ( key ) ; if ( null != map ) { return ( T ) map . remove ( key ) ; } return null ; |
public class JedisClientPool { /** * { @ inheritDoc } */
@ Override public JedisRedisClient borrowObject ( ) throws Exception { } } | JedisRedisClient redisClient = ( JedisRedisClient ) super . borrowObject ( ) ; if ( redisClient != null ) { redisClient . setRedisClientPool ( this ) ; } return redisClient ; |
public class TextObject { /** * Append the target text for language detection .
* This method read the text from specified input reader .
* If the total size of target text exceeds the limit size ,
* the rest is ignored .
* @ param reader the input reader ( BufferedReader as usual )
* @ throws java . io . IOE... | char [ ] buf = new char [ 1024 ] ; while ( reader . ready ( ) && ( maxTextLength == 0 || stringBuilder . length ( ) < maxTextLength ) ) { int length = reader . read ( buf ) ; append ( String . valueOf ( buf , 0 , length ) ) ; } return this ; |
public class DefaultSentryClientFactory { /** * HTTP proxy port for Sentry connections .
* @ param dsn Sentry server DSN which may contain options .
* @ return HTTP proxy port for Sentry connections . */
protected int getProxyPort ( Dsn dsn ) { } } | return Util . parseInteger ( Lookup . lookup ( HTTP_PROXY_PORT_OPTION , dsn ) , HTTP_PROXY_PORT_DEFAULT ) ; |
public class Modules { /** * Return the names of all classes in the given module . */
public static Class < ? > [ ] getClasses ( Class < ? > module ) { } } | HashSet < Class < ? > > result = new HashSet < > ( ) ; ClassLoader classLoader = Modules . class . getClassLoader ( ) ; for ( ClassModel info : Modules . getModuleModel ( module ) . getAllClassDependencies ( ) ) { try { result . add ( classLoader . loadClass ( info . getQualifiedName ( ) ) ) ; } catch ( ClassNotFoundEx... |
public class InputMapTemplate { /** * Instantiates the input map and installs it into the node via { @ link Nodes # addInputMap ( Node , InputMap ) } */
public static < S extends Node , E extends Event > void installOverride ( InputMapTemplate < S , E > imt , S node ) { } } | Nodes . addInputMap ( node , imt . instantiate ( node ) ) ; |
public class Protempa { /** * Executes a query .
* Protempa determines which propositions to retrieve from the underlying
* data sources and compute as the union of the proposition ids specified in
* the supplied { @ link Query } and the proposition ids returned from the
* results handler ' s { @ link QueryResu... | if ( query == null ) { throw new IllegalArgumentException ( "query cannot be null" ) ; } if ( destination == null ) { throw new IllegalArgumentException ( "resultsHandler cannot be null" ) ; } LOGGER . log ( Level . INFO , "Executing query {0}" , query . getName ( ) ) ; this . abstractionFinder . doFind ( query , desti... |
public class CmsVfsSitemapService { /** * Creates new content elements if required by the model page . < p >
* @ param cms the cms context
* @ param page the page
* @ param sitePath the resource site path
* @ throws CmsException when unable to create the content elements */
private void createNewContainerElemen... | CmsADEConfigData configData = OpenCms . getADEManager ( ) . lookupConfiguration ( cms , cms . addSiteRoot ( sitePath ) ) ; Locale contentLocale = OpenCms . getLocaleManager ( ) . getDefaultLocale ( cms , CmsResource . getFolderPath ( sitePath ) ) ; CmsObject cloneCms = OpenCms . initCmsObject ( cms ) ; cloneCms . getRe... |
public class DescribeNatGatewaysRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < DescribeNatGatewaysRequest > getDryRunRequest ( ) { } } | Request < DescribeNatGatewaysRequest > request = new DescribeNatGatewaysRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class DefaultMonetaryAmountsSingletonSpi { /** * ( non - Javadoc )
* @ see javax . money . spi . MonetaryAmountsSpi # getDefaultAmountType ( ) */
@ Override public Class < ? extends MonetaryAmount > getDefaultAmountType ( ) { } } | if ( Objects . isNull ( configuredDefaultAmountType ) ) { for ( MonetaryAmountFactoryProviderSpi < ? > f : Bootstrap . getServices ( MonetaryAmountFactoryProviderSpi . class ) ) { if ( f . getQueryInclusionPolicy ( ) == MonetaryAmountFactoryProviderSpi . QueryInclusionPolicy . ALWAYS ) { configuredDefaultAmountType = f... |
public class MultiPolygon { /** * Return the sum of all the points of all the polygons in this MultiPolygon . */
public int getNumPoints ( ) { } } | if ( isEmpty ( ) ) { return 0 ; } int total = 0 ; for ( Polygon polygon : polygons ) { total += polygon . getNumPoints ( ) ; } return total ; |
public class SegmentManager { /** * Returns the last segment in the log .
* @ throws IllegalStateException if the segment manager is not open */
public synchronized Segment lastSegment ( ) { } } | assertOpen ( ) ; Map . Entry < Long , Segment > segment = segments . lastEntry ( ) ; return segment != null ? segment . getValue ( ) : null ; |
public class CmsAreaSelectPanel { /** * Setting a new top / height value for the selection . < p >
* @ param secondY the cursor Y offset to the selection area */
private void positionY ( int secondY ) { } } | if ( secondY < m_firstY ) { setSelectPositionY ( secondY , m_firstY - secondY ) ; } else { setSelectHeight ( secondY - m_firstY ) ; } |
public class ResourceIndexImpl { /** * { @ inheritDoc } */
public TripleIterator findTriples ( String queryLang , String tupleQuery , String tripleTemplate , int limit , boolean distinct ) throws TrippiException { } } | return _writer . findTriples ( queryLang , tupleQuery , tripleTemplate , limit , distinct ) ; |
public class ComparatorCompat { /** * Returns a comparator that uses a function that extracts
* a { @ code long } sort key to be compared .
* @ param < T > the type of the objects compared by the comparator
* @ param keyExtractor the function that extracts the sort key
* @ return a comparator
* @ throws NullP... | Objects . requireNonNull ( keyExtractor ) ; return new ComparatorCompat < T > ( new Comparator < T > ( ) { @ Override public int compare ( T t1 , T t2 ) { final long l1 = keyExtractor . applyAsLong ( t1 ) ; final long l2 = keyExtractor . applyAsLong ( t2 ) ; return Objects . compareLong ( l1 , l2 ) ; } } ) ; |
public class JPEGImageReader { /** * Metadata */
@ Override public IIOMetadata getImageMetadata ( int imageIndex ) throws IOException { } } | // checkBounds needed , as we catch the IndexOutOfBoundsException below .
checkBounds ( imageIndex ) ; initHeader ( imageIndex ) ; IIOMetadata imageMetadata ; if ( isLossless ( ) ) { return new JPEGImage10Metadata ( segments ) ; } else { try { imageMetadata = delegate . getImageMetadata ( 0 ) ; } catch ( IndexOutOfBoun... |
public class ConfigHelper { /** * 解析DataMedia中的namespace和name , 支持offer [ 1-128 ] 分库的定义 */
public static ModeValue parseMode ( String value ) { } } | PatternMatcher matcher = new Perl5Matcher ( ) ; if ( matcher . matches ( value , patterns . get ( MODE_PATTERN ) ) ) { MatchResult matchResult = matcher . getMatch ( ) ; String prefix = matchResult . group ( 1 ) ; String startStr = matchResult . group ( 3 ) ; String ednStr = matchResult . group ( 4 ) ; int start = Inte... |
public class StandardDdlParser { /** * { @ inheritDoc }
* @ see org . modeshape . sequencer . ddl . DdlParser # score ( java . lang . String , java . lang . String ,
* org . modeshape . sequencer . ddl . DdlParserScorer ) */
@ Override public Object score ( String ddl , String fileName , DdlParserScorer scorer ) th... | CheckArg . isNotNull ( ddl , "ddl" ) ; CheckArg . isNotNull ( scorer , "scorer" ) ; if ( fileName != null ) { // Score the filename using the identifier only . . .
scorer . scoreText ( fileName , 2 , getIdentifyingKeywords ( ) ) ; } // Create the state of this parser . . .
problems . clear ( ) ; boolean includeComments... |
public class LineDataObjectPositionMigrationImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . LINE_DATA_OBJECT_POSITION_MIGRATION__TEMP_ORIENT : return TEMP_ORIENT_EDEFAULT == null ? tempOrient != null : ! TEMP_ORIENT_EDEFAULT . equals ( tempOrient ) ; } return super . eIsSet ( featureID ) ; |
public class Token { /** * This method is deprecated . Please use { @ link # isTokenValid ( byte [ ] , String , String ) } instead
* Check if a string is a valid token
* @ param secret the secret to decrypt the string
* @ param oid the ID supposed to be encapsulated in the token
* @ param token the token string... | return isTokenValid ( secret . getBytes ( Charsets . UTF_8 ) , oid , token ) ; |
public class Gauge { /** * * * * * * Misc * * * * * */
private synchronized void createBlinkTask ( ) { } } | blinkTask = new Callable < Void > ( ) { @ Override public Void call ( ) throws Exception { try { Platform . runLater ( ( ) -> setLedOn ( ! isLedOn ( ) ) ) ; } finally { if ( ! Thread . currentThread ( ) . isInterrupted ( ) ) { // Schedule the same Callable with the current updateInterval
blinkFuture = blinkService . sc... |
public class Branch { /** * < p > Retrieves rewards for the current session , with a callback to perform a predefined
* action following successful report of state change . You ' ll then need to call getCredits
* in the callback to update the credit totals in your UX . < / p >
* @ param callback A { @ link Branch... | ServerRequest req = new ServerRequestGetRewards ( context_ , callback ) ; if ( ! req . constructError_ && ! req . handleErrors ( context_ ) ) { handleNewRequest ( req ) ; } |
public class AnnotationUtil { /** * * * Note * * this method is deprecated . Please use { @ link Annotation # annotationType } instead
* Returns the class of an annotation instance
* @ param annotation the annotation instance
* @ param < T > the generic type of the annotation
* @ return the real annotation clas... | return ( Class < T > ) annotation . annotationType ( ) ; |
public class SimpleExpression { /** * Create a { @ code this is null } expression
* @ return this is null */
public BooleanExpression isNull ( ) { } } | if ( isnull == null ) { isnull = Expressions . booleanOperation ( Ops . IS_NULL , mixin ) ; } return isnull ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.