signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Version { /** * obtains the MQ Light version information from the manifest .
* @ return The MQ Light version . */
public static String getVersion ( ) { } } | String version = "unknown" ; final URLClassLoader cl = ( URLClassLoader ) cclass . getClassLoader ( ) ; try { final URL url = cl . findResource ( "META-INF/MANIFEST.MF" ) ; final Manifest manifest = new Manifest ( url . openStream ( ) ) ; for ( Entry < Object , Object > entry : manifest . getMainAttributes ( ) . entryS... |
public class ApiOvhMe { /** * Create a new sub - account
* REST : POST / me / subAccount
* @ param description [ required ] Description of the new sub - account */
public Long subAccount_POST ( String description ) throws IOException { } } | String qPath = "/me/subAccount" ; StringBuilder sb = path ( qPath ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "description" , description ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , Long . class ) ; |
public class KbTypeException { /** * Converts a Throwable to a KbTypeException . If the Throwable is a
* KbTypeException , it will be passed through unmodified ; otherwise , it will be wrapped
* in a new KbTypeException .
* @ param cause the Throwable to convert
* @ return a KbTypeException */
public static KbT... | return ( cause instanceof KbTypeException ) ? ( KbTypeException ) cause : new KbTypeException ( cause ) ; |
public class ReaderInputStream { /** * Reads up to len bytes of data from the input stream into an array of bytes . Returns the number of bytes read or - 1
* if end of stream was reached .
* This method simple copy { @ link # bytesBuffer } into given bytes buffer . If stream buffer is empty delegates
* { @ link #... | Params . notNull ( bytes , "Bytes" ) ; if ( len < 0 || off < 0 || ( off + len ) > bytes . length ) { throw new IndexOutOfBoundsException ( Strings . concat ( "Array Size=" , bytes . length , ", offset=" , off , ", length=" , len ) ) ; } if ( len == 0 ) { return 0 ; // Always return 0 if len = = 0
} int bytesRead = 0 ; ... |
public class HibernateProjectDao { /** * { @ inheritDoc } */
public Project update ( String oldProjectName , Project project ) throws GreenPepperServerException { } } | if ( ! oldProjectName . equals ( project . getName ( ) ) && getByName ( project . getName ( ) ) != null ) throw new GreenPepperServerException ( GreenPepperServerErrorKey . PROJECT_ALREADY_EXISTS , "Project already exists" ) ; Project projectToUpdate = getByName ( oldProjectName ) ; if ( projectToUpdate == null ) throw... |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcSweptSurface ( ) { } } | if ( ifcSweptSurfaceEClass == null ) { ifcSweptSurfaceEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 587 ) ; } return ifcSweptSurfaceEClass ; |
public class Subcursor { /** * Advances the cursor to the next physical link . The method name is specifically not next ( )
* because that method name has already been used extensively in this class and it was getting
* confusing . This would be a private method if it were not used by unit tests .
* @ return the ... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "advance" ) ; Link replyLink = null ; Link newLastLink = null ; synchronized ( _parent ) { // We start our search from either the lastLink we found , or the dummyHead .
Link lookAt = _lastLink ; if ( null == lookAt ) ... |
public class ServerBuilder { /** * Adds the < a href = " https : / / en . wikipedia . org / wiki / Virtual _ hosting # Name - based " > name - based virtual host < / a >
* specified by { @ link VirtualHost } .
* @ param hostnamePattern virtual host name regular expression
* @ return { @ link VirtualHostBuilder } ... | final ChainedVirtualHostBuilder virtualHostBuilder = new ChainedVirtualHostBuilder ( hostnamePattern , this ) ; virtualHostBuilders . add ( virtualHostBuilder ) ; return virtualHostBuilder ; |
public class SyncGroupsInner { /** * Gets a collection of sync group logs .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; SyncGroupLogPropertie... | return listLogsNextSinglePageAsync ( nextPageLink ) . concatMap ( new Func1 < ServiceResponse < Page < SyncGroupLogPropertiesInner > > , Observable < ServiceResponse < Page < SyncGroupLogPropertiesInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < SyncGroupLogPropertiesInner > > > call ( Servic... |
public class Matrix { /** * Multiply a row vector by this matrix : rv * this
* @ param rv the row vector
* @ return the product row vector
* @ throws numbercruncher . MatrixException for invalid size */
public RowVector multiply ( RowVector rv ) throws MatrixException { } } | // Validate rv ' s size .
if ( nCols != rv . nCols ) { throw new MatrixException ( MatrixException . INVALID_DIMENSIONS ) ; } double pv [ ] = new double [ nRows ] ; // product values
// Compute the values of the product .
for ( int c = 0 ; c < nCols ; ++ c ) { double dot = 0 ; for ( int r = 0 ; r < nRows ; ++ r ) { dot... |
public class WordDataReader { /** * / * ( non - Javadoc )
* @ see jvntextpro . data . DataReader # readString ( java . lang . String ) */
public List < Sentence > readString ( String dataStr ) { } } | String [ ] lines = dataStr . split ( "\n" ) ; List < Sentence > data = new ArrayList < Sentence > ( ) ; for ( String line : lines ) { Sentence sentence = new Sentence ( ) ; if ( line . startsWith ( "#" ) ) continue ; StringTokenizer tk = new StringTokenizer ( line , " " ) ; while ( tk . hasMoreTokens ( ) ) { String wor... |
public class CacheHashMap { /** * Copied from DatabaseHashMap .
* Attempts to get the requested attr from the cache
* Returns null if attr doesn ' t exist
* We consider populatedAppData as well
* populatedAppData is true when session is new or when the entire session is read into memory
* in those cases , we ... | @ SuppressWarnings ( "static-access" ) final boolean hideValues = _smc . isHideSessionValues ( ) ; final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "loadOneValue" , attrName , sess ) ; Object value = null ; try { if ( ! ( ( CacheSession ) ... |
public class ConstantPool { /** * Adds a float constant . */
public FloatConstant addFloat ( float value ) { } } | FloatConstant entry = getFloatByValue ( value ) ; if ( entry != null ) return entry ; entry = new FloatConstant ( this , _entries . size ( ) , value ) ; addConstant ( entry ) ; return entry ; |
public class AppLogger { /** * Building Message
* @ param msg The message you would like logged .
* @ return Message String */
protected static String buildMessage ( String msg ) { } } | StackTraceElement caller = new Throwable ( ) . fillInStackTrace ( ) . getStackTrace ( ) [ 2 ] ; return caller . getClassName ( ) + "." + caller . getMethodName ( ) + "(): \n" + msg ; |
public class FindByIndexOptions { /** * Specify a specific index to run the query against
* @ param designDocument set the design document to use
* @ param indexName set the index name to use
* @ return this to set additional options */
public FindByIndexOptions useIndex ( String designDocument , String indexName... | assertNotNull ( designDocument , "designDocument" ) ; assertNotNull ( indexName , "indexName" ) ; JsonArray index = new JsonArray ( ) ; index . add ( new JsonPrimitive ( designDocument ) ) ; index . add ( new JsonPrimitive ( indexName ) ) ; this . useIndex = index ; return this ; |
public class AmazonMQClient { /** * Returns information about the specified configuration .
* @ param describeConfigurationRequest
* @ return Result of the DescribeConfiguration operation returned by the service .
* @ throws NotFoundException
* HTTP Status Code 404 : Resource not found due to incorrect input . ... | request = beforeClientExecution ( request ) ; return executeDescribeConfiguration ( request ) ; |
public class ImmutableRoaringBitmap { /** * Bitwise ANDNOT ( difference ) operation for the given range , rangeStart ( inclusive ) and rangeEnd
* ( exclusive ) . The provided bitmaps are * not * modified . This operation is thread - safe as long as
* the provided bitmaps remain unchanged .
* @ param x1 first bitm... | return andNot ( x1 , x2 , ( long ) rangeStart , ( long ) rangeEnd ) ; |
public class StringUtil { /** * Converts the first character to lower case .
* Empty strings are ignored .
* @ param s the given string
* @ return the converted string . */
public static String lowerCaseFirstChar ( String s ) { } } | if ( s . isEmpty ( ) ) { return s ; } char first = s . charAt ( 0 ) ; if ( isLowerCase ( first ) ) { return s ; } return toLowerCase ( first ) + s . substring ( 1 ) ; |
public class GenericEditableStyledDocumentBase { /** * Copy of org . reactfx . util . Lists . commonPrefixSuffixLengths ( )
* that uses reference comparison instead of equals ( ) . */
private static Tuple2 < Integer , Integer > commonPrefixSuffixLengths ( List < ? > l1 , List < ? > l2 ) { } } | int n1 = l1 . size ( ) ; int n2 = l2 . size ( ) ; if ( n1 == 0 || n2 == 0 ) { return Tuples . t ( 0 , 0 ) ; } int pref = commonPrefixLength ( l1 , l2 ) ; if ( pref == n1 || pref == n2 ) { return Tuples . t ( pref , 0 ) ; } int suff = commonSuffixLength ( l1 , l2 ) ; return Tuples . t ( pref , suff ) ; |
public class LiveData { /** * Adds the given observer to the observers list within the lifespan of the given
* owner . The events are dispatched on the main thread . If LiveData already has data
* set , it will be delivered to the observer .
* The observer will only receive events if the owner is in { @ link Life... | assertMainThread ( "observe" ) ; if ( owner . getLifecycle ( ) . getCurrentState ( ) == DESTROYED ) { // ignore
return ; } LifecycleBoundObserver wrapper = new LifecycleBoundObserver ( owner , observer ) ; ObserverWrapper existing = mObservers . putIfAbsent ( observer , wrapper ) ; if ( existing != null && ! existing .... |
public class WhileyFileParser { /** * Parse an additive expression .
* @ param scope
* The enclosing scope for this statement , which determines the
* set of visible ( i . e . declared ) variables and also the current
* indentation level .
* @ param terminated
* This indicates that the expression is known t... | int start = index ; Expr lhs = parseMultiplicativeExpression ( scope , terminated ) ; Token lookahead ; while ( ( lookahead = tryAndMatch ( terminated , Plus , Minus ) ) != null ) { Expr rhs = parseMultiplicativeExpression ( scope , terminated ) ; switch ( lookahead . kind ) { case Plus : lhs = new Expr . IntegerAdditi... |
public class Boxing { /** * Transforms any array into a primitive array .
* @ param < T >
* @ param src source array
* @ param type target type
* @ return primitive array */
public static < T > T unboxAllAs ( Object src , Class < T > type ) { } } | return ( T ) unboxAll ( type , src , 0 , - 1 ) ; |
public class XmlRepositoryFactory { /** * Reads XML document and returns it content as list of queries ( as { @ link Element } )
* @ param document document which would be read
* @ return list of queries ( as { @ link Element } ) */
private static List < Element > getElements ( Document document ) { } } | List < Element > result = new ArrayList < Element > ( ) ; Element root = document . getDocumentElement ( ) ; NodeList nodeList = root . getChildNodes ( ) ; Node node = null ; Element nodeElement = null ; for ( int i = 0 ; i < nodeList . getLength ( ) ; i ++ ) { node = nodeList . item ( i ) ; if ( node instanceof Elemen... |
public class Efficiencies { /** * Runoff coefficient error ROCE
* @ param obs
* @ param sim
* @ param precip
* @ return */
public static double runoffCoefficientError ( double [ ] obs , double [ ] sim , double [ ] precip ) { } } | sameArrayLen ( sim , obs , precip ) ; double mean_pred = Stats . mean ( sim ) ; double mean_val = Stats . mean ( obs ) ; double mean_ppt = Stats . mean ( precip ) ; double error = Math . abs ( ( mean_pred / mean_ppt ) - ( mean_val / mean_ppt ) ) ; return Math . sqrt ( error ) ; |
public class ChatApplet { /** * Add any applet sub - panel ( s ) now . */
public boolean addSubPanels ( Container parent , int options ) { } } | FieldList record = null ; JBasePanel baseScreen = new ChatScreen ( this , record ) ; super . addSubPanels ( parent , options ) ; return this . changeSubScreen ( parent , baseScreen , null , options ) ; |
public class PKIXCertPathValidator { /** * Validates a certification path consisting exclusively of
* < code > X509Certificate < / code > s using the PKIX validation algorithm ,
* which uses the specified input parameter set .
* The input parameter set must be a < code > PKIXParameters < / code > object .
* @ p... | ValidatorParams valParams = PKIX . checkParams ( cp , params ) ; return validate ( valParams ) ; |
public class EC2MetadataUtils { /** * Returns the host address of the Amazon EC2 Instance Metadata Service . */
public static String getHostAddressForEC2MetadataService ( ) { } } | String host = System . getProperty ( EC2_METADATA_SERVICE_OVERRIDE_SYSTEM_PROPERTY ) ; return host != null ? host : EC2_METADATA_SERVICE_URL ; |
public class HsqlProperties { /** * Saves the properties . */
public void save ( ) throws Exception { } } | if ( fileName == null || fileName . length ( ) == 0 ) { throw new java . io . FileNotFoundException ( Error . getMessage ( ErrorCode . M_HsqlProperties_load ) ) ; } String filestring = fileName + ".properties" ; save ( filestring ) ; |
public class FastStr { /** * Wrapper of { @ link String # equalsIgnoreCase ( String ) }
* @ param x the char sequence to be compared
* @ return { @ code true } if the argument is not { @ code null } and it
* represents an equivalent { @ code String } ignoring case ; { @ code
* false } otherwise */
public boolea... | if ( x == this ) return true ; if ( null == x || size ( ) != x . length ( ) ) return false ; if ( isEmpty ( ) && x . length ( ) == 0 ) return true ; return regionMatches ( true , 0 , x , 0 , size ( ) ) ; |
public class ComputationGraph { /** * Feed - forward through the network - returning all array activations detached from any workspace .
* Note that no workspace should be active externally when calling this method ( an exception will be thrown
* if a workspace is open externally )
* @ param train Training mode (... | if ( layerIndex < 0 || layerIndex >= topologicalOrder . length ) { throw new IllegalArgumentException ( "Invalid layer index - index must be >= 0 and < " + topologicalOrder . length + ", got index " + layerIndex ) ; } setInputs ( features ) ; setLayerMaskArrays ( fMask , lMask ) ; // Verify that no workspace is open ex... |
public class PortletWindowData { /** * / * ( non - Javadoc )
* @ see org . apereo . portal . portlet . om . IPortletWindowData # setPublicRenderParameters ( java . util . Map ) */
public void setPublicRenderParameters ( Map < String , String [ ] > publicRenderParameters ) { } } | Validate . notNull ( publicRenderParameters , "publicRenderParameters can not be null" ) ; this . publicRenderParameters = publicRenderParameters ; |
public class RepeatedFieldBuilder { /** * Gets a view of the builder as a list of builders . This returned list is live and will reflect
* any changes to the underlying builder .
* @ return the builders in the list */
public List < BType > getBuilderList ( ) { } } | if ( externalBuilderList == null ) { externalBuilderList = new BuilderExternalList < MType , BType , IType > ( this ) ; } return externalBuilderList ; |
public class AbstractGraph { /** * { @ inheritDoc }
* < p > This method is sensitive to the vertex ordering ; a call will check
* whether the edge set for { @ code e . from ( ) } contains { @ code e } . Subclasses
* should override this method if their { @ link EdgeSet } implementations are
* sensitive to the o... | EdgeSet < T > e1 = getEdgeSet ( e . from ( ) ) ; return e1 != null && e1 . contains ( e ) ; |
public class PaxWicketBundleListener { /** * { @ inheritDoc } */
@ Override public ExtendedBundle addingBundle ( Bundle bundle , BundleEvent event ) { } } | ExtendedBundle extendedBundle = new ExtendedBundle ( extendedBundleContext , bundle ) ; if ( extendedBundle . isImportingPAXWicketAPI ( ) || extendedBundle . isImportingWicket ( ) ) { addRelevantBundle ( extendedBundle ) ; LOGGER . info ( "{} is added as a relevant bundle for pax wicket" , bundle . getSymbolicName ( ) ... |
public class AbstractIteratingActionContainer { /** * Check aborting condition .
* @ return */
protected boolean checkCondition ( TestContext context ) { } } | if ( conditionExpression != null ) { return conditionExpression . evaluate ( index , context ) ; } // replace dynamic content with each iteration
String conditionString = condition ; if ( conditionString . indexOf ( Citrus . VARIABLE_PREFIX + indexName + Citrus . VARIABLE_SUFFIX ) != - 1 ) { Properties props = new Prop... |
public class ExecutorFilter { /** * < pre >
* function to register the static remaining flow size filter .
* NOTE : this is a static filter which means the filter will be filtering based on the system
* standard which is not
* Coming for the passed flow .
* Ideally this filter will make sure only the executor... | return FactorFilter . create ( STATICREMAININGFLOWSIZE_FILTER_NAME , ( filteringTarget , referencingObject ) -> { if ( null == filteringTarget ) { logger . debug ( String . format ( "%s : filtering out the target as it is null." , STATICREMAININGFLOWSIZE_FILTER_NAME ) ) ; return false ; } final ExecutorInfo stats = fil... |
public class MisoScenePanel { /** * Returns the base tile for the specified tile coordinate . */
protected BaseTile getBaseTile ( int tx , int ty ) { } } | SceneBlock block = getBlock ( tx , ty ) ; return ( block == null ) ? null : block . getBaseTile ( tx , ty ) ; |
public class InputStreamReader { /** * Indicates whether this reader is ready to be read without blocking . If
* the result is { @ code true } , the next { @ code read ( ) } will not block . If
* the result is { @ code false } then this reader may or may not block when
* { @ code read ( ) } is called . This imple... | synchronized ( lock ) { if ( in == null ) { throw new IOException ( "InputStreamReader is closed." ) ; } try { return bytes . hasRemaining ( ) || in . available ( ) > 0 ; } catch ( IOException e ) { return false ; } } |
public class LocaleSelectorImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . LOCALE_SELECTOR__LOC_FLGS : return getLocFlgs ( ) ; case AfplibPackage . LOCALE_SELECTOR__LANG_CODE : return getLangCode ( ) ; case AfplibPackage . LOCALE_SELECTOR__SCRPT_CDE : return getScrptCde ( ) ; case AfplibPackage . LOCALE_SELECTOR__REG_CDE : return getRegCde ( ) ; cas... |
public class SseBuilder { /** * Get credentials by the credentials id . Then set the user name and password into the SsePoxySetting . */
private void setProxyCredentials ( Run < ? , ? > run ) { } } | if ( proxySettings != null && proxySettings . getFsProxyCredentialsId ( ) != null ) { UsernamePasswordCredentials up = CredentialsProvider . findCredentialById ( proxySettings . getFsProxyCredentialsId ( ) , StandardUsernamePasswordCredentials . class , run , URIRequirementBuilder . create ( ) . build ( ) ) ; if ( up !... |
public class PlacesLocationFeedData { /** * Gets the oAuthInfo value for this PlacesLocationFeedData .
* @ return oAuthInfo * Required authentication token ( from OAuth API ) for the email . < / br >
* Use the following values when populating the oAuthInfo :
* < ul >
* < li > httpMethod : { @ code GET } < / li ... | return oAuthInfo ; |
public class CommerceOrderPersistenceImpl { /** * Removes all the commerce orders where groupId = & # 63 ; and commerceAccountId = & # 63 ; from the database .
* @ param groupId the group ID
* @ param commerceAccountId the commerce account ID */
@ Override public void removeByG_C ( long groupId , long commerceAccou... | for ( CommerceOrder commerceOrder : findByG_C ( groupId , commerceAccountId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( commerceOrder ) ; } |
public class JSONUtils { /** * Escape a string to be surrounded in double quotes in JSON .
* @ param unsafeStr
* The string to escape .
* @ return The escaped string . */
public static String escapeJSONString ( final String unsafeStr ) { } } | final StringBuilder buf = new StringBuilder ( unsafeStr . length ( ) * 2 ) ; escapeJSONString ( unsafeStr , buf ) ; return buf . toString ( ) ; |
public class DefaultOperationCandidatesProvider { /** * / * ( non - Javadoc )
* @ see org . jboss . as . cli . CandidatesProvider # getNodeNames ( org . jboss . as . cli . Prefix ) */
@ Override public List < String > getNodeNames ( CommandContext ctx , OperationRequestAddress prefix ) { } } | ModelControllerClient client = ctx . getModelControllerClient ( ) ; if ( client == null ) { return Collections . emptyList ( ) ; } if ( prefix . isEmpty ( ) ) { throw new IllegalArgumentException ( "The prefix must end on a type but it's empty." ) ; } if ( ! prefix . endsOnType ( ) ) { throw new IllegalArgumentExceptio... |
public class Formatter { /** * Writes a formatted string to this object ' s destination using the
* specified format string and arguments .
* @ param conf
* The formatter configuration , provides additional formats and
* the default locale . If { @ code null } , the configuration specified
* at the constructi... | try { if ( conf == null ) conf = this . conf ; if ( locale == null ) locale = conf . locale ( ) ; if ( locale == null ) locale = Locale . ROOT ; String fString = toFormatString ( format , locale ) ; if ( end < 0 ) end = fString . length ( ) - end - 1 ; new Parser ( conf , locale , args ) . parse ( fString , start , end... |
public class Toml { /** * Populates the current Toml instance with values from tomlString .
* @ param tomlString String to be read .
* @ return this instance
* @ throws IllegalStateException If tomlString is not valid TOML */
public Toml read ( String tomlString ) throws IllegalStateException { } } | Results results = TomlParser . run ( tomlString ) ; if ( results . errors . hasErrors ( ) ) { throw new IllegalStateException ( results . errors . toString ( ) ) ; } this . values = results . consume ( ) ; return this ; |
public class PoolOperations { /** * Lists pool usage metrics .
* @ param startTime
* The start time of the aggregation interval covered by this entry .
* @ param endTime
* The end time of the aggregation interval for this entry .
* @ return A list of { @ link PoolUsageMetrics } objects .
* @ throws BatchErr... | return listPoolUsageMetrics ( startTime , endTime , null , null ) ; |
public class HttpServerUpgradeHandler { /** * Creates the 101 Switching Protocols response message . */
private static FullHttpResponse createUpgradeResponse ( CharSequence upgradeProtocol ) { } } | DefaultFullHttpResponse res = new DefaultFullHttpResponse ( HTTP_1_1 , SWITCHING_PROTOCOLS , Unpooled . EMPTY_BUFFER , false ) ; res . headers ( ) . add ( HttpHeaderNames . CONNECTION , HttpHeaderValues . UPGRADE ) ; res . headers ( ) . add ( HttpHeaderNames . UPGRADE , upgradeProtocol ) ; return res ; |
public class ADStarNodeExpander { /** * Updates a node in inconsistent state ( V < = G ) , evaluating all the predecessors of the current node
* and updating the parent to the node which combination of cost and transition is minimal .
* @ param node inconsistent { @ link es . usc . citius . hipster . algorithm . AD... | C minValue = add . getIdentityElem ( ) ; N minParent = null ; Transition < A , S > minTransition = null ; for ( Map . Entry < Transition < A , S > , N > current : predecessorMap . entrySet ( ) ) { C value = add . apply ( current . getValue ( ) . getV ( ) , costFunction . evaluate ( current . getKey ( ) ) ) ; // T value... |
public class SpdyCodecUtil { /** * Validate a SPDY header value . Does not validate max length . */
static void validateHeaderValue ( CharSequence value ) { } } | if ( value == null ) { throw new NullPointerException ( "value" ) ; } for ( int i = 0 ; i < value . length ( ) ; i ++ ) { char c = value . charAt ( i ) ; if ( c == 0 ) { throw new IllegalArgumentException ( "value contains null character: " + value ) ; } } |
public class SpatialReferenceSystemDao { /** * Creates the required Undefined Cartesian Spatial Reference System ( spec
* Requirement 11)
* @ return spatial reference system
* @ throws SQLException
* upon creation failure */
public SpatialReferenceSystem createUndefinedCartesian ( ) throws SQLException { } } | SpatialReferenceSystem srs = new SpatialReferenceSystem ( ) ; srs . setSrsName ( GeoPackageProperties . getProperty ( PropertyConstants . UNDEFINED_CARTESIAN , PropertyConstants . SRS_NAME ) ) ; srs . setSrsId ( GeoPackageProperties . getIntegerProperty ( PropertyConstants . UNDEFINED_CARTESIAN , PropertyConstants . SR... |
public class LinearGradientColorPalette { /** * Creates a linear Gradient between two colors
* @ param color1
* start color
* @ param color2
* end color
* @ param gradientSteps
* specifies the amount of colors in this gradient between color1
* and color2 , this includes both color1 and color2
* @ return... | final List < Color > colors = new ArrayList < > ( gradientSteps + 1 ) ; // add beginning color to the gradient
colors . add ( color1 ) ; for ( int i = 1 ; i < gradientSteps ; i ++ ) { float ratio = ( float ) i / ( float ) gradientSteps ; final float red = color2 . getRed ( ) * ratio + color1 . getRed ( ) * ( 1 - ratio ... |
public class CloneStackRequest { /** * A list of stack attributes and values as key / value pairs to be added to the cloned stack .
* @ param attributes
* A list of stack attributes and values as key / value pairs to be added to the cloned stack .
* @ return Returns a reference to this object so that method calls... | setAttributes ( attributes ) ; return this ; |
public class MatlabSparseMatrixBuilder { /** * { @ inheritDoc } Once this method has been called , any subsequent calls will
* have no effect and will not throw an exception . */
public synchronized void finish ( ) { } } | if ( ! isFinished ) { if ( LOGGER . isLoggable ( Level . FINE ) ) { LOGGER . fine ( "Finished writing matrix in MATLAB_SPARSE format " + "with " + curColumn + " columns" ) ; } isFinished = true ; matrixWriter . close ( ) ; } |
public class RESTDocBuilder { /** * Whether the method is annotated with @ ResponseBody . */
private boolean isAnnotatedResponseBody ( MethodDoc method ) { } } | AnnotationDesc [ ] annotations = method . annotations ( ) ; for ( int i = 0 ; i < annotations . length ; i ++ ) { if ( annotations [ i ] . annotationType ( ) . name ( ) . equals ( "ResponseBody" ) ) { return true ; } } return false ; |
public class SanitizedContents { /** * Loads assumed - safe content from a Java resource .
* < p > This performs ZERO VALIDATION of the data , and takes you on your word that the input is
* valid . We assume that resources should be safe because they are part of the binary , and
* therefore not attacker controlle... | pretendValidateResource ( resourceName , kind ) ; return SanitizedContent . create ( Resources . toString ( Resources . getResource ( contextClass , resourceName ) , charset ) , kind , // Text resources are usually localized , so one might think that the locale direction should
// be assumed for them . We do not do tha... |
public class BaseApplet { /** * Get the display preference for the help window .
* @ return */
public int getHelpPageOptions ( int iOptions ) { } } | String strPreference = this . getProperty ( ThinMenuConstants . USER_HELP_DISPLAY ) ; if ( ( strPreference == null ) || ( strPreference . length ( ) == 0 ) ) strPreference = this . getProperty ( ThinMenuConstants . HELP_DISPLAY ) ; if ( this . getHelpView ( ) == null ) if ( ThinMenuConstants . HELP_PANE . equalsIgnoreC... |
public class ExcelTransformer { /** * When set , only columns contained in the String [ ] will
* be exported out to Excel .
* @ param exportOnlyColumns the exportOnlyColumns to set */
public void setExportOnlyColumns ( final String [ ] exportOnlyColumns ) { } } | if ( exportOnlyColumns != null ) { this . exportOnlyColumns = exportOnlyColumns . clone ( ) ; } else { this . exportOnlyColumns = null ; } |
public class ViewData { /** * Constructs a new { @ link ViewData } .
* @ param view the { @ link View } associated with this { @ link ViewData } .
* @ param map the mapping from { @ link TagValue } list to { @ link AggregationData } .
* @ param start the start { @ link Timestamp } for this { @ link ViewData } .
... | Map < List < /* @ Nullable */
TagValue > , AggregationData > deepCopy = new HashMap < List < /* @ Nullable */
TagValue > , AggregationData > ( ) ; for ( Entry < ? extends List < /* @ Nullable */
TagValue > , ? extends AggregationData > entry : map . entrySet ( ) ) { checkAggregation ( view . getAggregation ( ) , entry ... |
public class GregorianCalendar { /** * Returns the Julian calendar system instance ( singleton ) . ' jcal '
* and ' jeras ' are set upon the return . */
private static synchronized BaseCalendar getJulianCalendarSystem ( ) { } } | if ( jcal == null ) { jcal = ( JulianCalendar ) CalendarSystem . forName ( "julian" ) ; jeras = jcal . getEras ( ) ; } return jcal ; |
public class AbstractFixture { /** * < p > getGetter . < / p >
* @ param type a { @ link java . lang . Class } object .
* @ param name a { @ link java . lang . String } object .
* @ return a { @ link java . lang . reflect . Method } object . */
protected Method getGetter ( Class type , String name ) { } } | return introspector ( type ) . getGetter ( toJavaIdentifierForm ( name ) ) ; |
public class TermsByQueryResponse { /** * Deserialize
* @ param in the input
* @ throws IOException */
@ Override public void readFrom ( StreamInput in ) throws IOException { } } | super . readFrom ( in ) ; isPruned = in . readBoolean ( ) ; size = in . readVInt ( ) ; termsEncoding = TermsByQueryRequest . TermsEncoding . values ( ) [ in . readVInt ( ) ] ; encodedTerms = in . readBytesRef ( ) ; |
public class ExampleUtils { /** * Converts { @ code data } into a list of { @ code Example } s . Each element of
* { @ code data } should be an array of length 2 , where the first value is the
* inputVar and the second value is the outputVar of the corresponding example .
* @ param data
* @ return */
public sta... | List < Example < String , String > > pairs = Lists . newArrayList ( ) ; for ( int i = 0 ; i < data . length ; i ++ ) { pairs . add ( new Example < String , String > ( data [ i ] [ 0 ] , data [ i ] [ 1 ] ) ) ; } return pairs ; |
public class VirtualRangeModel { /** * Informs the virtual range model the extent of the area over which
* we can scroll . */
public void setScrollableArea ( int x , int y , int width , int height ) { } } | Rectangle vb = _panel . getViewBounds ( ) ; int hmax = x + width , vmax = y + height , value ; if ( width > vb . width ) { value = MathUtil . bound ( x , _hrange . getValue ( ) , hmax - vb . width ) ; _hrange . setRangeProperties ( value , vb . width , x , hmax , false ) ; } else { // Let ' s center it and lock it down... |
public class CssSmartSpritesResourceReader { /** * ( non - Javadoc )
* @ see net . jawr . web . resource . handler . reader . StreamResourceReader #
* getResourceAsStream ( net . jawr . web . resource . bundle . JoinableResourceBundle ,
* java . lang . String , boolean ) */
@ Override public InputStream getResour... | String path = resourceName ; GeneratorRegistry generatorRegistry = jawrConfig . getGeneratorRegistry ( ) ; if ( generatorRegistry . isGeneratedBinaryResource ( path ) ) { path = path . replace ( ':' , '/' ) ; path = JawrConstant . SPRITE_GENERATED_IMG_DIR + path ; } return ( ( StreamResourceReader ) resourceReader ) . ... |
public class AmazonEC2Client { /** * When you no longer want to use an On - Demand Dedicated Host it can be released . On - Demand billing is stopped and
* the host goes into < code > released < / code > state . The host ID of Dedicated Hosts that have been released can no
* longer be specified in another request ,... | request = beforeClientExecution ( request ) ; return executeReleaseHosts ( request ) ; |
public class WMessagesProxy { /** * Utility method that searches for the WMessages instance for the given component . If not found , a warning will be
* logged and null returned .
* @ return the WMessages instance for the given component , or null if not found . */
private WMessages getWMessageInstance ( ) { } } | MessageContainer container = getMessageContainer ( component ) ; WMessages result = null ; if ( container == null ) { LOG . warn ( "No MessageContainer as ancestor of " + component + ". Messages will not be added" ) ; } else { result = container . getMessages ( ) ; if ( result == null ) { LOG . warn ( "No messages in c... |
public class NumberExpression { /** * Create a { @ code min ( this ) } expression
* < p > Get the minimum value of this expression ( aggregation ) < / p >
* @ return min ( this ) */
@ SuppressWarnings ( "unchecked" ) public NumberExpression < T > min ( ) { } } | if ( min == null ) { min = Expressions . numberOperation ( getType ( ) , Ops . AggOps . MIN_AGG , mixin ) ; } return min ; |
public class TcasesMojo { /** * If the given path is not absolute , returns it as an absolute path relative to the
* project base directory . Otherwise , returns the given absolute path . */
private File getBaseDir ( File path ) { } } | return path == null ? baseDir_ : path . isAbsolute ( ) ? path : new File ( baseDir_ , path . getPath ( ) ) ; |
public class EndpointUtils { /** * Get the list of all eureka service urls from properties file for the eureka client to talk to .
* @ param clientConfig the clientConfig to use
* @ param instanceZone The zone in which the client resides
* @ param preferSameZone true if we have to prefer the same zone as the clie... | List < String > orderedUrls = new ArrayList < String > ( ) ; String region = getRegion ( clientConfig ) ; String [ ] availZones = clientConfig . getAvailabilityZones ( clientConfig . getRegion ( ) ) ; if ( availZones == null || availZones . length == 0 ) { availZones = new String [ 1 ] ; availZones [ 0 ] = DEFAULT_ZONE... |
public class ST_Reverse3DLine { /** * Reverses a multilinestring according to z value . If asc : the z first
* point must be lower than the z end point if desc : the z first point must
* be greater than the z end point
* @ param multiLineString
* @ return */
public static MultiLineString reverse3D ( MultiLineSt... | int num = multiLineString . getNumGeometries ( ) ; LineString [ ] lineStrings = new LineString [ num ] ; for ( int i = 0 ; i < multiLineString . getNumGeometries ( ) ; i ++ ) { lineStrings [ i ] = reverse3D ( ( LineString ) multiLineString . getGeometryN ( i ) , order ) ; } return FACTORY . createMultiLineString ( line... |
public class GroovyInternalPosixParser { /** * Add the special token " < b > - - < / b > " and the current < code > value < / code >
* to the processed tokens list . Then add all the remaining
* < code > argument < / code > values to the processed tokens list .
* @ param value The current token */
private void pr... | if ( stopAtNonOption && ( currentOption == null || ! currentOption . hasArg ( ) ) ) { eatTheRest = true ; tokens . add ( "--" ) ; } tokens . add ( value ) ; currentOption = null ; |
public class AbstractMemberWriter { /** * Return true if the given < code > ProgramElement < / code > is inherited
* by the class that is being documented .
* @ param ped The < code > ProgramElement < / code > being checked .
* return true if the < code > ProgramElement < / code > is being inherited and
* false... | if ( ped . isPrivate ( ) || ( ped . isPackagePrivate ( ) && ! ped . containingPackage ( ) . equals ( classdoc . containingPackage ( ) ) ) ) { return false ; } return true ; |
public class SingleOutputStreamOperator { /** * Sets the parallelism and maximum parallelism of this operator to one .
* And mark this operator cannot set a non - 1 degree of parallelism .
* @ return The operator with only one parallelism . */
@ PublicEvolving public SingleOutputStreamOperator < T > forceNonParalle... | transformation . setParallelism ( 1 ) ; transformation . setMaxParallelism ( 1 ) ; nonParallel = true ; return this ; |
public class ContentSpec { /** * Sets the DTD for a Content Specification .
* @ param format The DTD of the Content Specification . */
public void setFormat ( final String format ) { } } | if ( format == null && this . format == null ) { return ; } else if ( format == null ) { removeChild ( this . format ) ; this . format = null ; } else if ( this . format == null ) { this . format = new KeyValueNode < String > ( CommonConstants . CS_FORMAT_TITLE , format ) ; appendChild ( this . format , false ) ; } els... |
public class EntityAssociationUpdater { /** * Returns the object referenced by the specified property ( which represents an association ) . */
private Object getReferencedEntity ( int propertyIndex ) { } } | Object referencedEntity = null ; GridType propertyType = persister . getGridPropertyTypes ( ) [ propertyIndex ] ; Serializable id = ( Serializable ) propertyType . hydrate ( resultset , persister . getPropertyColumnNames ( propertyIndex ) , session , null ) ; if ( id != null ) { EntityPersister hostingEntityPersister =... |
public class MapBuilder { /** * Adds the number value to the provided map under the provided field name ,
* if it should be included . The supplier is only invoked if the field is to be included . */
public MapBuilder addNumber ( String fieldName , boolean include , Supplier < Number > supplier ) { } } | if ( include ) { Number value = supplier . get ( ) ; if ( value != null ) { map . put ( getFieldName ( fieldName ) , value ) ; } } return this ; |
public class AbstractPositioning { /** * Calls { @ link # draw ( com . itextpdf . text . pdf . PdfContentByte , float , float , float , float , String ) } with rect . getLeft ( )
* + getShiftx ( ) , rect . getTop ( ) + getShifty ( ) , rect . getWidth ( ) , rect . getHeight ( ) , genericTag . When { @ link # isShadow ... | if ( getValue ( SHADOW , Boolean . class ) ) { drawShadow ( rect . getLeft ( ) + getShiftx ( ) , rect . getTop ( ) + getShifty ( ) , rect . getWidth ( ) , rect . getHeight ( ) , genericTag ) ; } PdfContentByte canvas = getPreparedCanvas ( ) ; draw ( canvas , rect . getLeft ( ) + getShiftx ( ) , rect . getTop ( ) + getS... |
public class Math { /** * L2 vector norm . */
public static double norm2 ( double [ ] x ) { } } | double norm = 0.0 ; for ( double n : x ) { norm += n * n ; } norm = Math . sqrt ( norm ) ; return norm ; |
public class JsonIOUtil { /** * Creates a { @ link UTF8JsonGenerator } for the outputstream with the supplied buf { @ code outBuffer } to use . */
public static UTF8JsonGenerator newJsonGenerator ( OutputStream out , byte [ ] buf ) { } } | return newJsonGenerator ( out , buf , 0 , false , new IOContext ( DEFAULT_JSON_FACTORY . _getBufferRecycler ( ) , out , false ) ) ; |
public class CmsObject { /** * Replaces the content , type and properties of a resource . < p >
* @ param resourcename the name of the resource to replace ( full current site relative path )
* @ param type the new type of the resource
* @ param content the new content of the resource
* @ param properties the ne... | replaceResource ( resourcename , getResourceType ( type ) , content , properties ) ; |
public class StateController { /** * Restricts state ' s translation and zoom bounds .
* @ param state State to be restricted
* @ param prevState Previous state to calculate overscroll and overzoom ( optional )
* @ param pivotX Pivot ' s X coordinate
* @ param pivotY Pivot ' s Y coordinate
* @ param allowOver... | tmpState . set ( state ) ; boolean changed = restrictStateBounds ( tmpState , prevState , pivotX , pivotY , allowOverscroll , allowOverzoom , restrictRotation ) ; return changed ? tmpState . copy ( ) : null ; |
public class RetryHandlingMetaMasterMasterClient { /** * Registers with the leader master .
* @ param masterId the master id of the standby master registering
* @ param configList the configuration of this master */
public void register ( final long masterId , final List < ConfigProperty > configList ) throws IOExc... | retryRPC ( ( ) -> { mClient . registerMaster ( RegisterMasterPRequest . newBuilder ( ) . setMasterId ( masterId ) . setOptions ( RegisterMasterPOptions . newBuilder ( ) . addAllConfigs ( configList ) . build ( ) ) . build ( ) ) ; return null ; } ) ; |
public class BoxFile { /** * Checks if the file can be successfully uploaded by using the preflight check .
* @ param name the name to give the uploaded file or null to use existing name .
* @ param fileSize the size of the file used for account capacity calculations .
* @ param parentID the ID of the parent fold... | URL url = CONTENT_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( this . getAPI ( ) , url , "OPTIONS" ) ; JsonObject parent = new JsonObject ( ) ; parent . add ( "id" , parentID ) ; JsonObject preflightInfo = new JsonObject ( ) ; preflightIn... |
public class ManagerConnectionImpl { /** * This method is called by the reader whenever a { @ link ManagerResponse } is
* received . The response is dispatched to the associated
* { @ link SendActionCallback } .
* @ param response the response received by the reader
* @ see ManagerReader */
public void dispatch... | final String actionId ; String internalActionId ; SendActionCallback listener ; // shouldn ' t happen
if ( response == null ) { logger . error ( "Unable to dispatch null response. This should never happen. Please file a bug." ) ; return ; } actionId = response . getActionId ( ) ; internalActionId = null ; listener = nu... |
public class FilteredAggregatorFactory { /** * See https : / / github . com / apache / incubator - druid / pull / 6219 # pullrequestreview - 148919845 */
@ JsonProperty @ Override public String getName ( ) { } } | String name = this . name ; if ( Strings . isNullOrEmpty ( name ) ) { name = delegate . getName ( ) ; } return name ; |
public class AndroidCryptoUtils { /** * / * ( non - Javadoc )
* @ see zorg . platform . CryptoUtils # createHMACSHA1 ( byte [ ] ) */
@ Override public HMAC createHMACSHA1 ( byte [ ] hmacKey ) throws CryptoException { } } | try { return new BCHmacAdapter ( hmacKey , "SHA1" ) ; } catch ( Exception e ) { AndroidPlatform . getInstance ( ) . getLogger ( ) . logException ( e . getMessage ( ) ) ; return null ; } |
public class Parser { /** * A { @ link Parser } that undoes any partial match if { @ code this } fails . In other words , the
* parser either fully matches , or matches none . */
public final Parser < T > atomic ( ) { } } | return new Parser < T > ( ) { @ Override public Parser < T > label ( String name ) { return Parser . this . label ( name ) . atomic ( ) ; } @ Override boolean apply ( ParseContext ctxt ) { int at = ctxt . at ; int step = ctxt . step ; boolean r = Parser . this . apply ( ctxt ) ; if ( r ) ctxt . step = step + 1 ; else c... |
public class WebSocketExtension { /** * Compose a String from a list of extensions to be used in the response of a protocol negotiation .
* @ see io . undertow . util . Headers
* @ param extensions list of { @ link WebSocketExtension }
* @ return a string representation of the extensions */
public static String t... | StringBuilder extensionsHeader = new StringBuilder ( ) ; if ( extensions != null && extensions . size ( ) > 0 ) { Iterator < WebSocketExtension > it = extensions . iterator ( ) ; while ( it . hasNext ( ) ) { WebSocketExtension extension = it . next ( ) ; extensionsHeader . append ( extension . getName ( ) ) ; for ( Par... |
public class JmsTransporter { /** * - - - PUBLISH - - - */
@ Override public void publish ( String channel , Tree message ) { } } | if ( client != null ) { try { if ( debug && ( debugHeartbeats || ! channel . endsWith ( heartbeatChannel ) ) ) { logger . info ( "Submitting message to channel \"" + channel + "\":\r\n" + message . toString ( ) ) ; } TopicPublisher publisher = createOrGetPublisher ( channel ) ; BytesMessage msg = session . createBytesM... |
public class ModelsImpl { /** * Gets information about the application version models .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param listModelsOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentExce... | return listModelsWithServiceResponseAsync ( appId , versionId , listModelsOptionalParameter ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class Quaterniond { /** * / * ( non - Javadoc )
* @ see org . joml . Quaterniondc # rotateAxis ( double , org . joml . Vector3dc , org . joml . Quaterniond ) */
public Quaterniond rotateAxis ( double angle , Vector3dc axis , Quaterniond dest ) { } } | return rotateAxis ( angle , axis . x ( ) , axis . y ( ) , axis . z ( ) , dest ) ; |
public class ServerSessionManager { /** * Unregisters a session . */
ServerSessionContext unregisterSession ( long sessionId ) { } } | ServerSessionContext session = sessions . remove ( sessionId ) ; if ( session != null ) { clients . remove ( session . client ( ) , session ) ; connections . remove ( session . client ( ) , session . getConnection ( ) ) ; } return session ; |
public class MariaDbStatement { /** * Executes the given SQL statement and signals the driver with the given flag about whether the
* auto - generated keys produced by this < code > Statement < / code > object should be made available for
* retrieval . The driver will ignore the flag if the SQL statement is not an ... | if ( executeInternal ( sql , fetchSize , autoGeneratedKeys ) ) { return 0 ; } return getUpdateCount ( ) ; |
public class Defaultr { /** * Top level standalone Defaultr method .
* @ param input JSON object to have defaults applied to . This will be modified .
* @ return the modified input */
@ Override public Object transform ( Object input ) { } } | if ( input == null ) { // if null , assume HashMap
input = new HashMap ( ) ; } // TODO : Make copy of the defaultee or like shiftr create a new output object
if ( input instanceof List ) { if ( arrayRoot == null ) { throw new TransformException ( "The Spec provided can not handle input that is a top level Json Array." ... |
public class TopicAclTraversalResults { /** * Method checkPermission
* Used to determine whether a user is allowed to perform a particular
* operation .
* @ param user The user
* @ param operation The subscribe or publish operation
* @ return boolean The result of the permission check . */
public boolean chec... | if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "checkPermission" , new Object [ ] { user , new Integer ( operation ) } ) ; boolean allowed = false ; if ( operation == 1 ) // a publish operation
{ // check whether permission has been granted to special group Everyone .
// We can do this before we check whether the ... |
public class GreenPepperXmlRpcClient { /** * { @ inheritDoc } */
@ SuppressWarnings ( "unchecked" ) public RequirementSummary getSummary ( Requirement requirement , String identifier ) throws GreenPepperServerException { } } | Vector params = CollectionUtil . toVector ( requirement . marshallize ( ) ) ; Vector < Object > compilParams = ( Vector < Object > ) execute ( XmlRpcMethodName . getRequirementSummary , params , identifier ) ; log . debug ( "Getting Requirement " + requirement . getName ( ) + " summary" ) ; return XmlRpcDataMarshaller ... |
public class GSAConfiguration { /** * Adds a data set as a broadcast set to the apply function .
* @ param name The name under which the broadcast data is available in the apply function .
* @ param data The data set to be broadcast . */
public void addBroadcastSetForApplyFunction ( String name , DataSet < ? > data... | this . bcVarsApply . add ( new Tuple2 < > ( name , data ) ) ; |
public class DataUnitBuilder { /** * Returns the transport layer service of a given protocol data unit .
* @ param tpdu transport layer protocol data unit
* @ return TPDU service code */
public static int getTPDUService ( final byte [ ] tpdu ) { } } | final int ctrl = tpdu [ 0 ] & 0xff ; if ( ( ctrl & 0xFC ) == 0 ) return 0 ; // 0x04 is tag _ group service code , not used by us
if ( ( ctrl & 0xFC ) == 0x04 ) return 0x04 ; if ( ( ctrl & 0xC0 ) == 0x40 ) return T_DATA_CONNECTED ; if ( ctrl == T_CONNECT ) return T_CONNECT ; if ( ctrl == T_DISCONNECT ) return T_DISCONNE... |
public class AsyncTwitterImpl { /** * / * Favorites Resources */
@ Override public void getFavorites ( ) { } } | getDispatcher ( ) . invokeLater ( new AsyncTask ( FAVORITES , listeners ) { @ Override public void invoke ( List < TwitterListener > listeners ) throws TwitterException { ResponseList < Status > statuses = twitter . getFavorites ( ) ; for ( TwitterListener listener : listeners ) { try { listener . gotFavorites ( status... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.