signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class RottenTomatoesApi { /** * Retrieves current release DVDs
* @ param country Provides localized data for the selected country
* @ param page The selected page of in theaters movies
* @ param pageLimit The amount of movies in theaters to show per page
* @ return
* @ throws RottenTomatoesException */... | properties . clear ( ) ; properties . put ( ApiBuilder . PROPERTY_URL , URL_CURRENT_RELEASE_DVDS ) ; properties . put ( ApiBuilder . PROPERTY_COUNTRY , ApiBuilder . validateCountry ( country ) ) ; properties . put ( ApiBuilder . PROPERTY_PAGE , ApiBuilder . validatePage ( page ) ) ; properties . put ( ApiBuilder . PROP... |
public class ZooKeeperUtilityFactory { /** * Creates a { @ link ZooKeeperStateHandleStore } instance with the provided arguments .
* @ param zkStateHandleStorePath specifying the path in ZooKeeper to store the state handles to
* @ param stateStorageHelper storing the actual state data
* @ param < T > Type of the ... | return ZooKeeperUtils . createZooKeeperStateHandleStore ( facade , zkStateHandleStorePath , stateStorageHelper ) ; |
public class ProxySettings { /** * Set credentials for authentication at the proxy server .
* This method is an alias of { @ link # setId ( String ) setId } { @ code
* ( id ) . } { @ link # setPassword ( String ) setPassword } { @ code
* ( password ) } .
* @ param id
* The ID .
* @ param password
* The pa... | return setId ( id ) . setPassword ( password ) ; |
public class SeleniumComponent { /** * Verify if the element loaded is a valid element for the class that is
* representing it . */
public void validateElementTag ( ) { } } | String errorMsg = String . format ( ErrorMessages . ERROR_INVALID_TAG_TO_CLASS , getElement ( ) . getTagName ( ) ) ; if ( ! isValidElementTag ( ) ) { throw new IllegalArgumentException ( errorMsg ) ; } |
public class Validate { /** * Checks if the given integer is NOT positive .
* @ param value The integer value to validate .
* @ throws ParameterException if the given integer value is < code > null < / code > or bigger than 0. */
public static void notPositive ( Integer value ) { } } | if ( ! validation ) return ; notNull ( value ) ; if ( value > 0 ) throw new ParameterException ( ErrorCode . POSITIVE ) ; |
public class CallableStatementProxy { /** * used only with java 7 , do not set @ Override */
public < T > T getObject ( int parameterIndex , Class < T > type ) throws SQLException { } } | // used reflection to make sure this work with Java 5 and 6
try { return ( T ) stat . getClass ( ) . getMethod ( "getObject" , new Class [ ] { int . class , Class . class } ) . invoke ( stat , new Object [ ] { parameterIndex , type } ) ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; if ( t instan... |
public class Examples { /** * Get instruments for the desired exchange . */
public void getInstrumentsForExchange ( KiteConnect kiteConnect ) throws KiteException , IOException { } } | // Get instruments for an exchange .
List < Instrument > nseInstruments = kiteConnect . getInstruments ( "CDS" ) ; System . out . println ( nseInstruments . size ( ) ) ; |
public class JobMetrics { /** * Get a new { @ link GobblinMetrics } instance for a given job .
* @ param jobState the given { @ link JobState } instance
* @ param parentContext is the parent { @ link MetricContext }
* @ return a { @ link JobMetrics } instance */
public static JobMetrics get ( final JobState jobSt... | return ( JobMetrics ) GOBBLIN_METRICS_REGISTRY . getOrDefault ( name ( jobState ) , new Callable < GobblinMetrics > ( ) { @ Override public GobblinMetrics call ( ) throws Exception { return new JobMetrics ( jobState , parentContext ) ; } } ) ; |
public class PowerMock { /** * Convenience method for createMock followed by expectNew .
* @ param type The class that should be mocked .
* @ param arguments The constructor arguments .
* @ return A mock object of the same type as the mock .
* @ throws Exception */
public static synchronized < T > T createMockA... | T mock = createMock ( type ) ; expectNew ( type , arguments ) . andReturn ( mock ) ; return mock ; |
public class LongestAliphaticChainDescriptor { /** * Calculate the count of atoms of the longest aliphatic chain in the supplied { @ link IAtomContainer } .
* The method require one parameter :
* if checkRingSyste is true the CDKConstant . ISINRING will be set
* @ param mol The { @ link IAtomContainer } for which... | if ( checkRingSystem ) Cycles . markRingAtomsAndBonds ( mol ) ; IAtomContainer aliphaticParts = mol . getBuilder ( ) . newAtomContainer ( ) ; for ( IAtom atom : mol . atoms ( ) ) { if ( isAcyclicCarbon ( atom ) ) aliphaticParts . addAtom ( atom ) ; } for ( IBond bond : mol . bonds ( ) ) { if ( isAcyclicCarbon ( bond . ... |
public class DatabaseMetaData { /** * { @ inheritDoc } */
public ResultSet getColumns ( final String catalog , final String schemaPattern , final String tableNamePattern , final String columnNamePattern ) throws SQLException { } } | return RowLists . rowList21 ( String . class , String . class , String . class , String . class , Integer . class , String . class , Integer . class , Integer . class , Integer . class , Integer . class , String . class , String . class , Integer . class , Integer . class , Integer . class , Integer . class , String . ... |
public class BaseMessageEndpointFactory { /** * LI2110.56 - rewrote method to use new reuse parameter . */
public void returnInvocationHandler ( MessageEndpointBase endpoint , boolean reuse ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "MEF.returnInvocationHandler" ) ; // Use pool only if one was created .
if ( ivInvocationHandlerPool != null ) // d423445.1
{ if ( reuse ) { MessageEndpointBase . reset ( endpoint ) ; // F73236 PooledObject removed , call reset... |
public class CommerceNotificationTemplateUtil { /** * Returns all the commerce notification templates that the user has permission to view where groupId = & # 63 ; and type = & # 63 ; and enabled = & # 63 ; .
* @ param groupId the group ID
* @ param type the type
* @ param enabled the enabled
* @ return the mat... | return getPersistence ( ) . filterFindByG_T_E ( groupId , type , enabled ) ; |
public class EnforcerRuleUtils { /** * Gets the pom model for this file .
* @ param pom the pom
* @ return the model
* @ throws IOException Signals that an I / O exception has occurred .
* @ throws XmlPullParserException the xml pull parser exception */
private Model readModel ( File pom ) throws IOException , ... | Reader reader = ReaderFactory . newXmlReader ( pom ) ; MavenXpp3Reader xpp3 = new MavenXpp3Reader ( ) ; Model model = null ; try { model = xpp3 . read ( reader ) ; } finally { reader . close ( ) ; reader = null ; } return model ; |
public class TypefaceHelper { /** * Set the typeface to the all text views belong to the view group .
* @ param context the context .
* @ param layoutRes the layout resource id .
* @ param typefaceName typeface name .
* @ param style the typeface style .
* @ return the view . */
public View setTypeface ( Cont... | return setTypeface ( context , layoutRes , null , typefaceName , 0 ) ; |
public class PrefMapFill { /** * Preference */
@ Override public void apply ( MapTile map ) { } } | final double tw = map . getTileWidth ( ) ; final double th = map . getTileHeight ( ) ; for ( int tx = 0 ; tx < map . getInTileWidth ( ) ; tx ++ ) { final double x = tx * tw ; for ( int ty = 0 ; ty < map . getInTileHeight ( ) ; ty ++ ) { final double y = ty * th ; final Tile tile = map . createTile ( sheet , number , x ... |
public class ExternalChildResourcesCachedImpl { /** * Prepare for inline definition of a new external child resource ( along with the definition or update of parent resource ) .
* @ param name the name of the new external child resource
* @ param key the key
* @ return the child resource */
protected final Fluent... | if ( find ( key ) != null ) { throw new IllegalArgumentException ( "A child resource ('" + childResourceName + "') with name (key) '" + name + " (" + key + ")' already exists" ) ; } FluentModelTImpl childResource = newChildResource ( name ) ; childResource . setPendingOperation ( ExternalChildResourceImpl . PendingOper... |
public class StringDictionaryEncoder { /** * Returns the size of the int arrays used by this class , it ' s 4 times the length of the arrays */
private int getSizeOfIntArrays ( ) { } } | return ( offsets . length + hashcodes . length + nexts . length + counts . length + indexStrides . length ) * 4 ; |
public class AbstractSendCommandJob { /** * Sends a command to the Gerrit server , returning the output from the command .
* @ param command the command .
* @ return the output from the command . */
@ Override public String sendCommandStr ( String command ) { } } | String str = null ; try { str = sendCommand2 ( command ) ; } catch ( Exception ex ) { logger . error ( "Could not run command " + command , ex ) ; } return str ; |
public class LottieCompositionFactory { /** * Return a LottieComposition for the specified json . */
@ WorkerThread public static LottieResult < LottieComposition > fromJsonReaderSync ( JsonReader reader , @ Nullable String cacheKey ) { } } | return fromJsonReaderSyncInternal ( reader , cacheKey , true ) ; |
public class NioUtils { /** * 将byte [ ] 数据写入到流中 */
public static void write ( byte [ ] data , OutputStream output ) throws IOException { } } | ByteArrayInputStream input = null ; try { input = new ByteArrayInputStream ( data ) ; copy ( input , output ) ; output . flush ( ) ; } finally { IOUtils . closeQuietly ( output ) ; } |
public class RedisGetSetClient { /** * Gets a content by a key .
* @ param key
* cache key
* @ return Promise with cached value ( or null , the returned Promise also can
* be null ) */
public final Promise get ( String key ) { } } | byte [ ] binaryKey = key . getBytes ( StandardCharsets . UTF_8 ) ; if ( client != null ) { return new Promise ( client . get ( binaryKey ) ) ; } if ( clusteredClient != null ) { return new Promise ( clusteredClient . get ( binaryKey ) ) ; } return Promise . resolve ( ) ; |
public class hqlLexer { /** * $ ANTLR start " ELSE " */
public final void mELSE ( ) throws RecognitionException { } } | try { int _type = ELSE ; int _channel = DEFAULT_TOKEN_CHANNEL ; // hql . g : 22:6 : ( ' else ' )
// hql . g : 22:8 : ' else '
{ match ( "else" ) ; if ( state . failed ) return ; } state . type = _type ; state . channel = _channel ; } finally { // do for sure before leaving
} |
public class GetDevicesInPlacementRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetDevicesInPlacementRequest getDevicesInPlacementRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getDevicesInPlacementRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getDevicesInPlacementRequest . getProjectName ( ) , PROJECTNAME_BINDING ) ; protocolMarshaller . marshall ( getDevicesInPlacementRequest . getPlacementName ... |
public class AsmCounter { /** * flush temp counter data to all windows & assoc metrics . */
protected void doFlush ( ) { } } | long v ; synchronized ( unFlushed ) { v = unFlushed . getCount ( ) ; } for ( Counter counter : counterMap . values ( ) ) { counter . inc ( v ) ; } if ( MetricUtils . metricAccurateCal ) { for ( AsmMetric assocMetric : assocMetrics ) { assocMetric . updateDirectly ( v ) ; } } this . unFlushed . dec ( v ) ; |
public class NodeBuilder { /** * Inserts or replaces the provided key , copying all not - yet - visited keys prior to it into our buffer .
* @ param key key we are inserting / replacing
* @ return the NodeBuilder to retry the update against ( a child if we own the range being updated ,
* a parent if we do not - -... | assert copyFrom != null ; int copyFromKeyEnd = getKeyEnd ( copyFrom ) ; int i = copyFromKeyPosition ; boolean found ; // exact key match ?
boolean owns = true ; // true iff this node ( or a child ) should contain the key
if ( i == copyFromKeyEnd ) { found = false ; } else { // this optimisation is for the common scenar... |
public class MetaLocale { /** * Constructs a MetaLocale from a Java Locale object . */
public static MetaLocale fromJavaLocale ( java . util . Locale java ) { } } | // Some confusing cases can arise here based on the getLanguage ( ) method
// returning the deprecated language codes in a handful of cases . See
// MetaLocaleTest for test cases for these examples .
String language = java . getLanguage ( ) ; switch ( language ) { case "iw" : language = "he" ; break ; case "in" : langu... |
public class JMXSecurityMBeanServer { /** * { @ inheritDoc } */
@ Override public AttributeList getAttributes ( ObjectName name , String [ ] attributes ) throws InstanceNotFoundException , ReflectionException { } } | if ( ! isAuthorized ( ) ) { throwAuthzException ( ) ; } return super . getAttributes ( name , attributes ) ; |
public class LasWriterEachPoint { private byte [ ] getDouble ( double num ) { } } | doubleBb . clear ( ) ; doubleBb . putDouble ( num ) ; byte [ ] array = doubleBb . array ( ) ; return array ; |
public class ProxyIdpAuthnContextServiceImpl { /** * A Proxy - IdP may communicate with an IdP that uses different URI declarations for the same type of authentication
* methods , e . g . , the Swedish eID framework and eIDAS has different URI : s for the same type of authentication . This
* method will enable tran... | return assuranceURIs . contains ( uri ) ; |
public class ResponseMessage { /** * @ see javax . servlet . http . HttpServletResponse # setIntHeader ( java . lang . String , int ) */
@ Override public void setIntHeader ( String hdr , int value ) { } } | if ( - 1 == value ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "setIntHeader(" + hdr + ", -1), removing header" ) ; } this . response . removeHeader ( hdr ) ; } else { this . response . setHeader ( hdr , Integer . toString ( value ) ) ; } |
public class ResourceUtils { /** * Finds the resource directory for an instance .
* @ param applicationFilesDirectory the application ' s directory
* @ param instance an instance
* @ return a non - null file ( that may not exist ) */
public static File findInstanceResourcesDirectory ( File applicationFilesDirecto... | return findInstanceResourcesDirectory ( applicationFilesDirectory , instance . getComponent ( ) ) ; |
public class ContentSpec { /** * Sets the path of the Brand Logo for the Content Specification .
* @ param brandLogo The path to the Brand Logo . */
public void setBrandLogo ( final String brandLogo ) { } } | if ( brandLogo == null && this . brandLogo == null ) { return ; } else if ( brandLogo == null ) { removeChild ( this . brandLogo ) ; this . brandLogo = null ; } else if ( this . brandLogo == null ) { this . brandLogo = new KeyValueNode < String > ( CommonConstants . CS_BRAND_LOGO_TITLE , brandLogo ) ; appendChild ( thi... |
public class AbstractThreadPoolService { /** * Set configurations . This methods sets / overrides both the default configurations and the per - pool configurations .
* @ param commonPrefixthe common prefix in the keys , for example , " threadPools . "
* @ param resolverthe configuration properties resolver */
prote... | setConfigurationsCommonPrefix ( commonPrefix ) ; setConfigurations ( resolver ) ; setDefaultCoreSize ( resolver . getProperty ( commonPrefix + "defaultCoreSize" , Integer . class , defaultCoreSize ) ) ; setDefaultMaxSize ( resolver . getProperty ( commonPrefix + "defaultMaxSize" , Integer . class , defaultMaxSize ) ) ;... |
public class LensDistortionOps_F64 { /** * Creates a { @ link Point2Transform2 _ F32 } for converting pixels from original camera model into a new synthetic
* model . The scaling of the image can be adjusted to ensure certain visibility requirements .
* @ param type The type of adjustment it will apply to the trans... | LensDistortionNarrowFOV original = LensDistortionFactory . narrow ( paramOriginal ) ; LensDistortionNarrowFOV desired = LensDistortionFactory . narrow ( paramDesired ) ; Point2Transform2_F64 ori_p_to_n = original . undistort_F64 ( true , false ) ; Point2Transform2_F64 des_n_to_p = desired . distort_F64 ( false , true )... |
public class MongoDBUtils { /** * Calculate m d5.
* @ param val
* the val
* @ return the string */
public static String calculateMD5 ( Object val ) { } } | MessageDigest md = null ; try { md = MessageDigest . getInstance ( "MD5" ) ; } catch ( NoSuchAlgorithmException e ) { logger . error ( "Unable to calculate MD5 for file, Caused By: " , e ) ; } md . update ( ( byte [ ] ) val ) ; byte [ ] digest = md . digest ( ) ; return DatatypeConverter . printHexBinary ( digest ) . t... |
public class PackageCache { /** * Method that gets invoked from load ( ) . It checks if the
* framework asset packages and current MDW build versions are the same .
* Otherwise logs a warning message . */
private static void validatePackageVersion ( List < Package > packages ) { } } | final String exceptions = ".*\\b(oracle|tibco|demo|hub)\\b.*" ; String version = ApplicationContext . getMdwVersion ( ) ; String mdwVersion = version . split ( "\\-" ) [ 0 ] ; List < Package > filteredPackages = packages . stream ( ) . filter ( e -> ! mdwVersion . equals ( e . getVersionString ( ) ) && e . getName ( ) ... |
public class GenReaderThread { /** * Create a number of threads to generate read traffics
* @ param conf
* @ param key directory of files to read
* @ param value checksum file locaiton
* @ return
* @ throws IOException */
@ Override public GenThread [ ] prepare ( JobConf conf , Text key , Text value ) throws ... | this . rtc = new RunTimeConstants ( ) ; super . prepare ( conf , key , value , rtc ) ; Path basePath = new Path ( key . toString ( ) ) ; LOG . info ( "base path is " + basePath ) ; Path checksumPath = null ; FileSystem fs = FileSystem . newInstance ( conf ) ; if ( value . toString ( ) . length ( ) != 0 ) { checksumPath... |
public class VertxGenerator { /** * Overwrite this method to handle your custom type . This is needed especially when you have custom converters .
* @ param column the column definition
* @ param getter the getter name
* @ param columnType the type of the column
* @ param javaMemberName the java member name
*... | return false ; |
public class vrid { /** * Use this API to fetch filtered set of vrid resources .
* filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */
public static vrid [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | vrid obj = new vrid ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; vrid [ ] response = ( vrid [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class LinearSolver_DDRB_to_DDRM { /** * Converts B and X into block matrices and calls the block matrix solve routine .
* @ param B A matrix & real ; < sup > m & times ; p < / sup > . Not modified .
* @ param X A matrix & real ; < sup > n & times ; p < / sup > , where the solution is written to . Modified . ... | X . reshape ( blockA . numCols , B . numCols ) ; blockB . reshape ( B . numRows , B . numCols , false ) ; blockX . reshape ( X . numRows , X . numCols , false ) ; MatrixOps_DDRB . convert ( B , blockB ) ; alg . solve ( blockB , blockX ) ; MatrixOps_DDRB . convert ( blockX , X ) ; |
public class DirectionUtil { /** * Get the direction closest to the specified direction , out of the directions in the possible
* list .
* @ param preferCW whether to prefer a clockwise match or a counter - clockwise match . */
public static int getClosest ( int direction , int [ ] possible , boolean preferCW ) { }... | // rotate a tick at a time , looking for matches
int first = direction ; int second = direction ; for ( int ii = 0 ; ii <= FINE_DIRECTION_COUNT / 2 ; ii ++ ) { if ( IntListUtil . contains ( possible , first ) ) { return first ; } if ( ii != 0 && IntListUtil . contains ( possible , second ) ) { return second ; } first =... |
public class AmazonPinpointClient { /** * Delete an ADM channel .
* @ param deleteAdmChannelRequest
* @ return Result of the DeleteAdmChannel operation returned by the service .
* @ throws BadRequestException
* 400 response
* @ throws InternalServerErrorException
* 500 response
* @ throws ForbiddenExcepti... | request = beforeClientExecution ( request ) ; return executeDeleteAdmChannel ( request ) ; |
public class RecurlyClient { /** * Get a particular { @ link Subscription } by it ' s UUID
* Returns information about a single subscription .
* @ param uuid UUID of the subscription to lookup
* @ return Subscription */
public Subscription getSubscription ( final String uuid ) { } } | if ( uuid == null || uuid . isEmpty ( ) ) throw new RuntimeException ( "uuid cannot be empty!" ) ; return doGET ( Subscriptions . SUBSCRIPTIONS_RESOURCE + "/" + uuid , Subscription . class ) ; |
public class RecordSetsInner { /** * Lists the record sets of a specified type in a DNS zone .
* @ param resourceGroupName The name of the resource group .
* @ param zoneName The name of the DNS zone ( without a terminating dot ) .
* @ param recordType The type of record sets to enumerate . Possible values includ... | ServiceResponse < Page < RecordSetInner > > response = listByTypeSinglePageAsync ( resourceGroupName , zoneName , recordType ) . toBlocking ( ) . single ( ) ; return new PagedList < RecordSetInner > ( response . body ( ) ) { @ Override public Page < RecordSetInner > nextPage ( String nextPageLink ) { return listByTypeN... |
public class EditableTextArea { /** * Factory method for create a new { @ link EditableTextArea } object .
* @ param < T >
* the generic type of model object
* @ param id
* the id
* @ param model
* the model
* @ param labelModel
* the label model
* @ param modeContext
* the editable flag
* @ retur... | final EditableTextArea < T > editableTextArea = new EditableTextArea < > ( id , model , labelModel , modeContext ) ; return editableTextArea ; |
public class ResourceProvider { /** * Checks if file exists in the default location .
* If that ' s not the case , file is looked up starting from the root .
* @ return determined file location */
protected String determineLocation ( String location ) { } } | if ( existsInDefaultLocation ( location ) ) { return defaultFolder ( ) + location ; } if ( ! existsInGivenLocation ( location ) ) { throw new InvalidResourceLocation ( "Unable to locate " + location + ". " + "File does not exist also in default location " + defaultLocation ( ) ) ; } return location ; |
public class InteractionCoordinator { /** * Find the corresponding procedures and execute it .
* @ param event */
@ Override public void onInteractionEvent ( final InteractionEvent event ) { } } | QName id = event . getId ( ) ; QName source = ( QName ) event . getSource ( ) ; final Set < Procedure > collection = procedures . get ( id ) ; Procedure execution = null ; if ( collection != null ) { for ( Procedure consumer : collection ) { // TODO : This isn ' t optimal ( creation of new resource with every compariso... |
public class AgentRoster { /** * Returns the key to use in the presenceMap for a fully qualified xmpp ID . The roster
* can contain any valid address format such us " domain / resource " , " user @ domain " or
* " user @ domain / resource " . If the roster contains an entry associated with the fully qualified
* x... | Jid key = user ; if ( ! contains ( user ) ) { key = user . asEntityBareJidIfPossible ( ) ; } return key ; |
public class Setting { /** * Constructs a setting of { @ link Boolean } type , which is represented by a { @ link ToggleControl } .
* @ param description the title of this setting
* @ param property to be bound , saved / loaded and used for undo / redo
* @ return the constructed setting */
public static Setting o... | return new Setting < > ( description , Field . ofBooleanType ( property ) . label ( description ) . render ( new ToggleControl ( ) ) , property ) ; |
public class Stream { /** * Zip together the " a " and " b " iterators until one of them runs out of values .
* Each pair of values is combined into a single value using the supplied zipFunction function .
* @ param a
* @ param b
* @ return */
public static < R > Stream < R > zip ( final ShortIterator a , final... | return new IteratorStream < > ( new ObjIteratorEx < R > ( ) { @ Override public boolean hasNext ( ) { return a . hasNext ( ) && b . hasNext ( ) ; } @ Override public R next ( ) { return zipFunction . apply ( a . nextShort ( ) , b . nextShort ( ) ) ; } } ) ; |
public class HttpSerializer { /** * Formats the results of an HTTP data point storage request
* @ param results A map of results . The map will consist of :
* < ul > < li > success - ( long ) the number of successfully parsed datapoints < / li >
* < li > failed - ( long ) the number of datapoint parsing failures ... | throw new BadRequestException ( HttpResponseStatus . NOT_IMPLEMENTED , "The requested API endpoint has not been implemented" , this . getClass ( ) . getCanonicalName ( ) + " has not implemented formatPutV1" ) ; |
public class BreakIterator { /** * Sets the iterator ' s current iteration position to be the last
* boundary position preceding the specified position . ( Whether the
* specified position is itself a boundary position or not doesn ' t
* matter - - this function always moves the iteration position to the
* last... | // NOTE : This implementation is here solely because we can ' t add new
// abstract methods to an existing class . There is almost ALWAYS a
// better , faster way to do this .
int pos = following ( offset ) ; while ( pos >= offset && pos != DONE ) pos = previous ( ) ; return pos ; |
public class DelaunayTriangle { /** * The point counter - clockwise to given point */
public TriangulationPoint pointCCW ( TriangulationPoint point ) { } } | if ( point == points [ 0 ] ) { return points [ 1 ] ; } else if ( point == points [ 1 ] ) { return points [ 2 ] ; } else if ( point == points [ 2 ] ) { return points [ 0 ] ; } logger . error ( "point location error" ) ; throw new RuntimeException ( "[FIXME] point location error" ) ; |
public class CmsMessageBundleEditorModel { /** * Initializes the editor states for the different modes , depending on the type of the opened file . */
private void initEditorStates ( ) { } } | m_editorState = new HashMap < CmsMessageBundleEditorTypes . EditMode , EditorState > ( ) ; List < TableProperty > cols = null ; switch ( m_bundleType ) { case PROPERTY : case XML : if ( hasDescriptor ( ) ) { // bundle descriptor is present , keys are not editable in default mode , maybe master mode is available
m_edito... |
public class CharOperation { /** * Answers the first index in the array for which the toBeFound array is a matching subarray following the case rule
* starting at the index start . Answers - 1 if no match is found . < br >
* < br >
* For example :
* < ol >
* < li >
* < pre >
* toBeFound = { ' c ' }
* ar... | final int arrayLength = end ; final int toBeFoundLength = toBeFound . length ; if ( toBeFoundLength > arrayLength ) { return - 1 ; } if ( toBeFoundLength == 0 ) { return 0 ; } if ( toBeFoundLength == arrayLength ) { if ( isCaseSensitive ) { for ( int i = start ; i < arrayLength ; i ++ ) { if ( array [ i ] != toBeFound ... |
public class BatchGetPartitionResult { /** * A list of the requested partitions .
* @ param partitions
* A list of the requested partitions . */
public void setPartitions ( java . util . Collection < Partition > partitions ) { } } | if ( partitions == null ) { this . partitions = null ; return ; } this . partitions = new java . util . ArrayList < Partition > ( partitions ) ; |
public class InputRenderer { /** * Adds ARIA attributes if the component is " role = combobox " .
* @ param context the { @ link FacesContext }
* @ param component the { @ link UIInput } component to add attributes for
* @ throws IOException if any error occurs writing the response
* @ see https : / / www . w3 ... | ResponseWriter writer = context . getResponseWriter ( ) ; writer . writeAttribute ( "role" , "combobox" , null ) ; writer . writeAttribute ( HTML . ARIA_HASPOPUP , "true" , null ) ; writer . writeAttribute ( HTML . ARIA_EXPANDED , "false" , null ) ; |
public class CmsSubscriptionCollector { /** * Returns the collector parameters . < p >
* @ param param the collector parameter
* @ return the collector parameters */
private Map < String , String > getParameters ( String param ) { } } | if ( CmsStringUtil . isNotEmpty ( param ) ) { return CmsStringUtil . splitAsMap ( param , "|" , "=" ) ; } return Collections . emptyMap ( ) ; |
public class MOEADD { /** * calculate the sum of fitnesses of solutions in the location subregion */
public double sumFitness ( int location ) { } } | double sum = 0 ; for ( int i = 0 ; i < populationSize ; i ++ ) { if ( subregionIdx [ location ] [ i ] == 1 ) { sum = sum + fitnessFunction ( population . get ( i ) , lambda [ location ] ) ; } } return sum ; |
public class IllegalPatternArgumentException { /** * Returns the formatted string { @ link IllegalPatternArgumentException # MESSAGE _ WITH _ NAME } with the given
* { @ code argumentName } and pattern which the argument must match .
* @ param argumentName
* the name of the passed argument
* @ param pattern
*... | final String p = patternToString ( pattern ) ; return String . format ( MESSAGE_WITH_NAME , argumentName , p ) ; |
public class ChunkingOutputStream { protected void bypassWrite ( byte [ ] b , int offset , int length ) throws IOException { } } | int i = 9 ; int chunk = length ; _buf [ 10 ] = ( byte ) '\012' ; _buf [ 9 ] = ( byte ) '\015' ; while ( chunk > 0 ) { int d = chunk % 16 ; if ( d <= 9 ) _buf [ -- i ] = ( byte ) ( '0' + d ) ; else _buf [ -- i ] = ( byte ) ( 'a' - 10 + d ) ; chunk = chunk / 16 ; } if ( _chunking ) _out . write ( _buf , i , 10 - i + 1 ) ... |
public class MutableBigInteger { /** * Adds the contents of two MutableBigInteger objects . The result
* is placed within this MutableBigInteger .
* The contents of the addend are not changed . */
void add ( MutableBigInteger addend ) { } } | int x = intLen ; int y = addend . intLen ; int resultLen = ( intLen > addend . intLen ? intLen : addend . intLen ) ; int [ ] result = ( value . length < resultLen ? new int [ resultLen ] : value ) ; int rstart = result . length - 1 ; long sum ; long carry = 0 ; // Add common parts of both numbers
while ( x > 0 && y > 0... |
public class GVRCollider { /** * Lookup a native pointer to a collider and return its Java object .
* @ param nativePointer native pointer to C + + Collider
* @ return Java GVRCollider object */
static GVRCollider lookup ( long nativePointer ) { } } | synchronized ( sColliders ) { WeakReference < GVRCollider > weakReference = sColliders . get ( nativePointer ) ; return weakReference == null ? null : weakReference . get ( ) ; } |
public class TraceSummary { /** * A list of availability zones for any zone corresponding to the trace segments .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setAvailabilityZones ( java . util . Collection ) } or { @ link # withAvailabilityZones ( java . ... | if ( this . availabilityZones == null ) { setAvailabilityZones ( new java . util . ArrayList < AvailabilityZoneDetail > ( availabilityZones . length ) ) ; } for ( AvailabilityZoneDetail ele : availabilityZones ) { this . availabilityZones . add ( ele ) ; } return this ; |
public class Context { /** * Value Compaction Algorithm
* http : / / json - ld . org / spec / latest / json - ld - api / # value - compaction
* @ param activeProperty
* The Active Property
* @ param value
* The value to compact
* @ return The compacted value */
public Object compactValue ( String activeProp... | int numberMembers = value . size ( ) ; if ( value . containsKey ( JsonLdConsts . INDEX ) && JsonLdConsts . INDEX . equals ( this . getContainer ( activeProperty ) ) ) { numberMembers -- ; } if ( numberMembers > 2 ) { return value ; } final String typeMapping = getTypeMapping ( activeProperty ) ; final String languageMa... |
public class AWSSimpleSystemsManagementClient { /** * Get detailed information about a particular Automation execution .
* @ param getAutomationExecutionRequest
* @ return Result of the GetAutomationExecution operation returned by the service .
* @ throws AutomationExecutionNotFoundException
* There is no autom... | request = beforeClientExecution ( request ) ; return executeGetAutomationExecution ( request ) ; |
public class CPInstancePersistenceImpl { /** * Returns the last cp instance in the ordered set where groupId = & # 63 ; and status = & # 63 ; .
* @ param groupId the group ID
* @ param status the status
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ re... | CPInstance cpInstance = fetchByG_ST_Last ( groupId , status , orderByComparator ) ; if ( cpInstance != null ) { return cpInstance ; } StringBundler msg = new StringBundler ( 6 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "groupId=" ) ; msg . append ( groupId ) ; msg . append ( ", status=" ) ; msg . ap... |
public class CmsRectangle { /** * Constrains a point to this rectangle . < p >
* If any of the coordinates of the point lie in the projection of this rectangle on the corresponding axis , that coordinate
* in the result will be unchanged , otherwise it will be either the maximum or the minimum depending on on which... | return new CmsPoint ( constrainNum ( m_left , m_width , point . getX ( ) ) , constrainNum ( m_top , m_height , point . getY ( ) ) ) ; |
public class tmtrafficpolicy_binding { /** * Use this API to fetch tmtrafficpolicy _ binding resource of given name . */
public static tmtrafficpolicy_binding get ( nitro_service service , String name ) throws Exception { } } | tmtrafficpolicy_binding obj = new tmtrafficpolicy_binding ( ) ; obj . set_name ( name ) ; tmtrafficpolicy_binding response = ( tmtrafficpolicy_binding ) obj . get_resource ( service ) ; return response ; |
public class RowHasher { /** * This method can be called to register table optimizations before initializing Fluo . This will
* register { @ link Optimizer } with
* { @ link TableOptimizations # registerOptimization ( SimpleConfiguration , String , Class ) } . See the
* project level documentation for an example ... | fluoConfig . getAppConfiguration ( ) . setProperty ( PREFIX + prefix + ".numTablets" , numTablets ) ; TableOptimizations . registerOptimization ( fluoConfig . getAppConfiguration ( ) , prefix , Optimizer . class ) ; |
public class NERServer { /** * Starts this server on the specified port . The classifier used can be
* either a default one stored in the jar file from which this code is
* invoked or you can specify it as a filename or as another classifier
* resource name , which must correspond to the name of a resource in the... | "StringEqualsEmptyString" } ) public static void main ( String [ ] args ) throws Exception { Properties props = StringUtils . argsToProperties ( args ) ; String loadFile = props . getProperty ( "loadClassifier" ) ; String loadJarFile = props . getProperty ( "loadJarClassifier" ) ; String client = props . getProperty ( ... |
public class CommercePriceListUserSegmentEntryRelUtil { /** * Returns the commerce price list user segment entry rel where commercePriceListId = & # 63 ; and commerceUserSegmentEntryId = & # 63 ; or returns < code > null < / code > if it could not be found , optionally using the finder cache .
* @ param commercePrice... | return getPersistence ( ) . fetchByC_C ( commercePriceListId , commerceUserSegmentEntryId , retrieveFromCache ) ; |
public class ModularParser { /** * Building a ContentElement , this funciton is calles by all the other
* parseContentElement ( . . ) functions */
private ContentElement parseContentElement ( SpanManager sm , ContentElementParsingParameters cepp , LinkedList < Span > lineSpans , ContentElement result ) { } } | List < Link > localLinks = new ArrayList < Link > ( ) ; List < Template > localTemplates = new ArrayList < Template > ( ) ; List < Span > boldSpans = new ArrayList < Span > ( ) ; List < Span > italicSpans = new ArrayList < Span > ( ) ; sm . manageList ( boldSpans ) ; sm . manageList ( italicSpans ) ; List < Span > mana... |
public class BitfinexApiCallbackListeners { /** * registers listener for candlesticks info updates
* @ param listener of event
* @ return hook of this listener */
public Closeable onCandlesticksEvent ( final BiConsumer < BitfinexCandlestickSymbol , Collection < BitfinexCandle > > listener ) { } } | candlesConsumers . offer ( listener ) ; return ( ) -> candlesConsumers . remove ( listener ) ; |
public class SerializerBase { /** * Report the CDATA trace event
* @ param chars content of CDATA
* @ param start starting index of characters to output
* @ param length number of characters to output */
protected void fireCDATAEvent ( char [ ] chars , int start , int length ) throws org . xml . sax . SAXExceptio... | if ( m_tracer != null ) { flushMyWriter ( ) ; m_tracer . fireGenerateEvent ( SerializerTrace . EVENTTYPE_CDATA , chars , start , length ) ; } |
public class JavaParser { /** * src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 429:1 : interfaceMethodDeclaratorRest : formalParameters ( ' [ ' ' ] ' ) * ( ' throws ' qualifiedNameList ) ? ' ; ' ; */
public final void interfaceMethodDeclaratorRest ( ) throws RecognitionExcepti... | int interfaceMethodDeclaratorRest_StartIndex = input . index ( ) ; try { if ( state . backtracking > 0 && alreadyParsedRule ( input , 33 ) ) { return ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 430:5 : ( formalParameters ( ' [ ' ' ] ' ) * ( ' throws ' qualifiedNameLi... |
public class JDefaultBase { /** * Fetches a value
* @ param key of the value to find
* @ return the value converted to type String */
protected static String fetchString ( String key ) { } } | List < String > stringList = ( List < String > ) fetchObject ( key ) ; return stringList . get ( RandomUtils . nextInt ( stringList . size ( ) ) ) ; |
public class MatrixIO { /** * Reads a matrix in which has been encoded using a Column Space Value ( CSV )
* file format . For a description of the format see { @ link MatrixIO # loadCSV ( String , boolean ) } .
* @ param fileName The file being loaded .
* @ param numRows number of rows in the matrix .
* @ param... | FileInputStream fileStream = new FileInputStream ( fileName ) ; ReadMatrixCsv csv = new ReadMatrixCsv ( fileStream ) ; DMatrixRMaj ret = csv . readDDRM ( numRows , numCols ) ; fileStream . close ( ) ; return ret ; |
public class CPDisplayLayoutUtil { /** * Returns the last cp display layout in the ordered set where uuid = & # 63 ; and companyId = & # 63 ; .
* @ param uuid the uuid
* @ param companyId the company ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ re... | return getPersistence ( ) . fetchByUuid_C_Last ( uuid , companyId , orderByComparator ) ; |
public class JmsSessionImpl { /** * This method is called by a JmsMsgConsumer in order to remove itself from
* the list of consumers held by the Session .
* @ param JmsMsgConsumer The Consumer which is calling the method . */
void removeConsumer ( JmsMsgConsumerImpl consumer ) throws JMSException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "removeConsumer" , consumer ) ; // if DUPS _ OK _ ACKNOWLEDGE is in use , commit any messages delivered in the
// last incomplete batch ( if the session is closing it will already have
// done this and the count of un... |
public class WSRdbManagedConnectionImpl { /** * Updates the value of the readOnly property .
* @ param readOnly the new isReadOnly value . */
public final void setReadOnly ( boolean isReadOnly ) throws SQLException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Set readOnly to " + isReadOnly ) ; sqlConn . setReadOnly ( isReadOnly ) ; connectionPropertyChanged = true ; |
public class DefaultDataEditorWidget { /** * Returns only the detail form widget */
@ Override public Widget createDetailWidget ( ) { } } | return new AbstractWidget ( ) { @ Override public void onAboutToShow ( ) { DefaultDataEditorWidget . this . onAboutToShow ( ) ; } @ Override public void onAboutToHide ( ) { DefaultDataEditorWidget . this . onAboutToHide ( ) ; } public JComponent getComponent ( ) { return getDetailForm ( ) . getControl ( ) ; } @ Overrid... |
public class GVRLight { /** * Bind a { @ code float } to the shader uniform { @ code key } .
* Throws an exception of the key is not found .
* @ param key Name of the shader uniform
* @ param value New data */
public void setFloat ( String key , float value ) { } } | checkKeyIsUniform ( key ) ; checkFloatNotNaNOrInfinity ( "value" , value ) ; NativeLight . setFloat ( getNative ( ) , key , value ) ; |
public class GuardRail { /** * Release acquired permits with known result . Since there is a known result the result
* count object and latency will be updated .
* @ param number of permits to release
* @ param result of the execution
* @ param startNanos of the execution */
public void releasePermits ( long nu... | releasePermits ( number , result , startNanos , clock . nanoTime ( ) ) ; |
public class SpringExceptionHandler { /** * Checks the interface of SQLException and tries to determine / convert JDBC4 exceptions into
* Spring SQL Exceptions
* @ param reason a description of the exception
* @ param SQLState an XOPEN or SQL : 2003 code identifying the exception
* @ param vendorCode a database... | MjdbcSQLException result = null ; if ( MappingUtils . objectAssignableTo ( cause , "java.sql.SQLTransientException" ) == true ) { if ( MappingUtils . objectAssignableTo ( cause , "java.sql.SQLTransactionRollbackException" ) == true ) { result = new ConcurrencyFailureException ( reason , SQLState , vendorCode ) ; } else... |
public class XMemcachedClient { /** * ( non - Javadoc )
* @ see net . rubyeye . xmemcached . MemcachedClient # add ( java . lang . String , int , java . lang . Object ) */
public final boolean add ( final String key , final int exp , final Object value ) throws TimeoutException , InterruptedException , MemcachedExcep... | return this . add ( key , exp , value , this . opTimeout ) ; |
public class DeleteItemRequest { /** * One or more substitution tokens for attribute names in an expression . The following are some use cases for using
* < code > ExpressionAttributeNames < / code > :
* < ul >
* < li >
* To access an attribute whose name conflicts with a DynamoDB reserved word .
* < / li >
... | setExpressionAttributeNames ( expressionAttributeNames ) ; return this ; |
public class CollectSerIteratorFactory { /** * Creates an iterator wrapper for a meta - property value .
* @ param value the possible collection - like object , not null
* @ param prop the meta - property defining the value , not null
* @ param beanClass the class of the bean , not the meta - property , for bette... | Class < ? > declaredType = prop . propertyType ( ) ; if ( value instanceof Grid ) { Class < ? > valueType = defaultToObjectClass ( JodaBeanUtils . collectionType ( prop , beanClass ) ) ; List < Class < ? > > valueTypeTypes = JodaBeanUtils . collectionTypeTypes ( prop , beanClass ) ; return grid ( ( Grid < ? > ) value ,... |
public class ArrayListJsonDeserializer { /** * < p > newInstance < / p >
* @ param deserializer { @ link JsonDeserializer } used to deserialize the objects inside the { @ link ArrayList } .
* @ param < T > Type of the elements inside the { @ link ArrayList }
* @ return a new instance of { @ link ArrayListJsonDese... | return new ArrayListJsonDeserializer < T > ( deserializer ) ; |
public class XMLConfigWebFactory { /** * creates a File and his content froma a resurce
* @ param resource
* @ param file
* @ throws IOException */
static void createFileFromResourceCheckSizeDiff ( String resource , Resource file ) throws IOException { } } | ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; IOUtil . copy ( InfoImpl . class . getResourceAsStream ( resource ) , baos , true , false ) ; byte [ ] barr = baos . toByteArray ( ) ; if ( file . exists ( ) ) { long trgSize = file . length ( ) ; long srcSize = barr . length ; if ( srcSize == trgSize ) retur... |
public class AbstractJoiner { /** * Sends a split brain join request to the target address and returns the response . */
private SplitBrainJoinMessage sendSplitBrainJoinMessage ( Address target , SplitBrainJoinMessage request ) { } } | if ( logger . isFineEnabled ( ) ) { logger . fine ( "Sending SplitBrainJoinMessage to " + target ) ; } Connection conn = node . getEndpointManager ( MEMBER ) . getOrConnect ( target , true ) ; long timeout = SPLIT_BRAIN_CONN_TIMEOUT_MILLIS ; while ( conn == null ) { timeout -= SPLIT_BRAIN_SLEEP_TIME_MILLIS ; if ( timeo... |
public class ExprParser { /** * staticMember
* : ID _ list ' : : ' ID
* | ID _ list ' : : ' ID ' ( ' exprList ? ' ) ' */
Expr staticMember ( ) { } } | if ( peek ( ) . sym != Sym . ID ) { return sharedMethod ( ) ; } int begin = forward ; while ( move ( ) . sym == Sym . DOT && move ( ) . sym == Sym . ID ) { ; } // ID . ID . ID : :
if ( peek ( ) . sym != Sym . STATIC || tokenList . get ( forward - 1 ) . sym != Sym . ID ) { resetForward ( begin ) ; return sharedMethod ( ... |
public class AsyncFile { /** * Creates new file and writes a sequence of bytes to this file from
* the given buffer , starting at the given file position .
* If file already exists , promise fails with exception .
* @ param path the path of the file to create and write
* @ param buf the buffer from which bytes ... | return openAsync ( executor , path , set ( WRITE , CREATE_NEW ) ) . then ( file -> file . write ( buf ) . then ( $ -> file . close ( ) ) ) . whenException ( $ -> buf . recycle ( ) ) ; |
public class Packer { /** * Add gridWidth = REMAINDER to the constraints for the current component if
* how = = true 1 it if false . */
public Packer setRemainY ( final boolean how ) { } } | if ( how == true ) { gc . gridheight = GridBagConstraints . REMAINDER ; } else { gc . gridheight = 1 ; } setConstraints ( comp , gc ) ; return this ; |
public class ExampleUtils { /** * Deletes the Google Cloud Pub / Sub topic .
* @ throws IOException if there is a problem deleting the Pub / Sub topic */
private void deletePubsubTopic ( String topic ) throws IOException { } } | if ( pubsubClient == null ) { pubsubClient = newPubsubClient ( options . as ( PubsubOptions . class ) ) . build ( ) ; } if ( executeNullIfNotFound ( pubsubClient . projects ( ) . topics ( ) . get ( topic ) ) != null ) { pubsubClient . projects ( ) . topics ( ) . delete ( topic ) . execute ( ) ; } |
public class RtfByteArrayBuffer { /** * Copies the given array to the internal buffer .
* @ param src */
public void write ( final byte [ ] src ) { } } | if ( src == null ) throw new NullPointerException ( ) ; if ( src . length < buffer . length - pos ) { System . arraycopy ( src , 0 , buffer , pos , src . length ) ; pos += src . length ; size += src . length ; return ; } writeLoop ( src , 0 , src . length ) ; |
public class QueryParametersLazyList { /** * Inserts new row into returned ResultSet
* @ param params values which would be used to fill newly inserted row
* @ throws SQLException */
public void insert ( QueryParameters params ) throws SQLException { } } | getCurrentResultSet ( ) . moveToInsertRow ( ) ; updateResultSetCurrentLine ( getCurrentResultSet ( ) , params ) ; getCurrentResultSet ( ) . insertRow ( ) ; getCurrentResultSet ( ) . moveToCurrentRow ( ) ; |
public class Sign1Message { /** * Create a signature for the message if one does not exist .
* @ param key key to use to sign the message
* @ exception CoseException Errors generated by the COSE module */
public void sign ( OneKey key ) throws CoseException { } } | if ( rgbContent == null ) throw new CoseException ( "No Content Specified" ) ; if ( rgbSignature != null ) return ; if ( rgbProtected == null ) { if ( objProtected . size ( ) > 0 ) rgbProtected = objProtected . EncodeToBytes ( ) ; else rgbProtected = new byte [ 0 ] ; } CBORObject obj = CBORObject . NewArray ( ) ; obj .... |
public class TaskManagerService { /** * Execute the given task and return the task execution status . If the task is already
* running by this or another task manager , this method blocks until the task has
* finished . ( TODO : should we put a timeout on this ? ) Once the task is not running , it
* then executed... | checkServiceState ( ) ; Tenant tenant = Tenant . getTenant ( appDef ) ; m_logger . debug ( "Checking that task {} in tenant {} is not running" , task . getTaskID ( ) , tenant ) ; TaskRecord taskRecord = null ; synchronized ( m_executeLock ) { taskRecord = waitForTaskStatus ( tenant , task , s -> s != TaskStatus . IN_PR... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.