signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class JsonNodeELResolver { /** * If the base object is a map , attempts to set the value associated with
* the given key , as specified by the property argument . If the base is a
* Map , the propertyResolved property of the ELContext object must be set to
* true by this resolver , before returning . If th... | if ( context == null ) { throw new NullPointerException ( "context is null" ) ; } if ( base instanceof ObjectNode ) { if ( readOnly ) { throw new PropertyNotWritableException ( "resolver is read-only" ) ; } ObjectNode node = ( ObjectNode ) base ; if ( value instanceof BigDecimal ) { node . put ( property . toString ( )... |
public class Matrix4d { /** * / * ( non - Javadoc )
* @ see org . joml . Matrix4dc # lerp ( org . joml . Matrix4dc , double , org . joml . Matrix4d ) */
public Matrix4d lerp ( Matrix4dc other , double t , Matrix4d dest ) { } } | dest . m00 = m00 + ( other . m00 ( ) - m00 ) * t ; dest . m01 = m01 + ( other . m01 ( ) - m01 ) * t ; dest . m02 = m02 + ( other . m02 ( ) - m02 ) * t ; dest . m03 = m03 + ( other . m03 ( ) - m03 ) * t ; dest . m10 = m10 + ( other . m10 ( ) - m10 ) * t ; dest . m11 = m11 + ( other . m11 ( ) - m11 ) * t ; dest . m12 = m... |
public class ArrayUtil { /** * 获取子数组
* @ param array 数组
* @ param start 开始位置 ( 包括 )
* @ param end 结束位置 ( 不包括 )
* @ return 新的数组
* @ since 4.5.2
* @ see Arrays # copyOfRange ( Object [ ] , int , int ) */
public static byte [ ] sub ( byte [ ] array , int start , int end ) { } } | int length = length ( array ) ; if ( start < 0 ) { start += length ; } if ( end < 0 ) { end += length ; } if ( start == length ) { return new byte [ 0 ] ; } if ( start > end ) { int tmp = start ; start = end ; end = tmp ; } if ( end > length ) { if ( start >= length ) { return new byte [ 0 ] ; } end = length ; } return... |
public class Http2ConnectionManager { /** * Return the http / 2 client channel to per route pool .
* @ param httpRoute the http route
* @ param http2ClientChannel represents the http / 2 client channel */
void returnClientChannel ( HttpRoute httpRoute , Http2ClientChannel http2ClientChannel ) { } } | EventLoopPool . PerRouteConnectionPool perRouteConnectionPool = fetchPerRoutePool ( httpRoute , http2ClientChannel . getChannel ( ) . eventLoop ( ) ) ; if ( perRouteConnectionPool != null ) { perRouteConnectionPool . addChannel ( http2ClientChannel ) ; } |
public class KNXAddress { /** * Creates a KNX address from xml input .
* The KNX address element is expected to be the current or next element from the
* parser .
* @ param r a XML reader
* @ return the created KNXAddress , either of subtype { @ link GroupAddress } or
* { @ link IndividualAddress }
* @ thro... | if ( r . getPosition ( ) != XMLReader . START_TAG ) r . read ( ) ; if ( r . getPosition ( ) == XMLReader . START_TAG ) { final String type = r . getCurrent ( ) . getAttribute ( ATTR_TYPE ) ; if ( GroupAddress . ATTR_GROUP . equals ( type ) ) return new GroupAddress ( r ) ; else if ( IndividualAddress . ATTR_IND . equal... |
public class Execution { /** * Update the partition infos on the assigned resource .
* @ param partitionInfos for the remote task */
private void sendUpdatePartitionInfoRpcCall ( final Iterable < PartitionInfo > partitionInfos ) { } } | final LogicalSlot slot = assignedResource ; if ( slot != null ) { final TaskManagerGateway taskManagerGateway = slot . getTaskManagerGateway ( ) ; final TaskManagerLocation taskManagerLocation = slot . getTaskManagerLocation ( ) ; CompletableFuture < Acknowledge > updatePartitionsResultFuture = taskManagerGateway . upd... |
public class ImageMiscOps { /** * Inserts a single band into a multi - band image overwriting the original band
* @ param input Single band image
* @ param band Which band the image is to be inserted into
* @ param output The multi - band image which the input image is to be inserted into */
public static void in... | final int numBands = output . numBands ; for ( int y = 0 ; y < input . height ; y ++ ) { int indexIn = input . getStartIndex ( ) + y * input . getStride ( ) ; int indexOut = output . getStartIndex ( ) + y * output . getStride ( ) + band ; int end = indexOut + output . width * numBands - band ; for ( ; indexOut < end ; ... |
public class Benchmark { /** * Scaffer ' s F6 function */
static public double ScafferF6 ( double x , double y ) { } } | double temp1 = x * x + y * y ; double temp2 = Math . sin ( Math . sqrt ( temp1 ) ) ; double temp3 = 1.0 + 0.001 * temp1 ; return ( 0.5 + ( ( temp2 * temp2 - 0.5 ) / ( temp3 * temp3 ) ) ) ; |
public class NormalDistributionTypeImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void unsetMean ( ) { } } | double oldMean = mean ; boolean oldMeanESet = meanESet ; mean = MEAN_EDEFAULT ; meanESet = false ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . UNSET , BpsimPackage . NORMAL_DISTRIBUTION_TYPE__MEAN , oldMean , MEAN_EDEFAULT , oldMeanESet ) ) ; |
public class QualifiedElementModel { /** * Removes a modifier from this element . This method ensures that
* exactly one visibility modifier is set . It defaults to
* package - private if no other visibility is set . */
@ Requires ( "modifier != null" ) @ Ensures ( "!getModifiers().contains(modifier)" ) public void... | modifiers . remove ( modifier ) ; switch ( modifier ) { case PRIVATE : case PACKAGE_PRIVATE : case PROTECTED : case PUBLIC : modifiers . add ( ElementModifier . PACKAGE_PRIVATE ) ; } |
public class Types { /** * Adds a description to the set . */
private static void addDescription ( int type , String description ) { } } | if ( description . startsWith ( "<" ) && description . endsWith ( ">" ) ) { DESCRIPTIONS . put ( type , description ) ; } else { DESCRIPTIONS . put ( type , '"' + description + '"' ) ; } |
public class AWSSecurityTokenServiceAsyncClient { /** * Simplified method form for invoking the GetSessionToken operation with an AsyncHandler .
* @ see # getSessionTokenAsync ( GetSessionTokenRequest , com . amazonaws . handlers . AsyncHandler ) */
@ Override public java . util . concurrent . Future < GetSessionToke... | return getSessionTokenAsync ( new GetSessionTokenRequest ( ) , asyncHandler ) ; |
public class GeoPackageImpl { /** * { @ inheritDoc } */
@ Override public TileDao getTileDao ( TileMatrixSet tileMatrixSet ) { } } | if ( tileMatrixSet == null ) { throw new GeoPackageException ( "Non null " + TileMatrixSet . class . getSimpleName ( ) + " is required to create " + TileDao . class . getSimpleName ( ) ) ; } // Get the Tile Matrix collection , order by zoom level ascending & pixel
// size descending per requirement 51
List < TileMatrix... |
public class DataMediaPairAction { /** * 选择视图同步
* @ param channelInfo
* @ param channelParameterInfo
* @ throws Exception */
public void doNextToView ( @ FormGroup ( "dataMediaPairInfo" ) Group dataMediaPairInfo , @ FormField ( name = "formDataMediaPairError" , group = "dataMediaPairInfo" ) CustomErrors err , Nav... | DataMediaPair dataMediaPair = new DataMediaPair ( ) ; DataMedia sourceDataMedia = new DataMedia ( ) ; DataMedia targetDataMedia = new DataMedia ( ) ; dataMediaPairInfo . setProperties ( dataMediaPair ) ; sourceDataMedia . setId ( dataMediaPairInfo . getField ( "sourceDataMediaId" ) . getLongValue ( ) ) ; dataMediaPair ... |
public class QueryService { /** * Helper function to return a specification for filtering on a { @ link String } field , where equality , containment ,
* and null / non - null conditions are supported .
* @ param filter the individual attribute filter coming from the frontend .
* @ param metaclassFunction lambda ... | if ( filter . getEquals ( ) != null ) { return equalsSpecification ( metaclassFunction , filter . getEquals ( ) ) ; } else if ( filter . getIn ( ) != null ) { return valueIn ( metaclassFunction , filter . getIn ( ) ) ; } else if ( filter . getContains ( ) != null ) { return likeUpperSpecification ( metaclassFunction , ... |
public class DefaultBrokerCache { /** * Invalidate all objects at scopes which are descendant of the input scope . Any such invalidated object that is a
* { @ link Closeable } will be closed , and any such object which is a { @ link Service } will be shutdown .
* @ throws IOException */
public void close ( ScopeWra... | List < Throwable > exceptionsList = Lists . newArrayList ( ) ; List < Service > awaitShutdown = Lists . newArrayList ( ) ; for ( Map . Entry < RawJobBrokerKey , Object > entry : Maps . filterKeys ( this . sharedResourceCache . asMap ( ) , new ScopeIsAncestorFilter ( scope ) ) . entrySet ( ) ) { this . sharedResourceCac... |
public class SDVariable { /** * See { @ link # rsub ( String , SDVariable ) } */
public SDVariable rsub ( SDVariable x ) { } } | return rsub ( sameDiff . generateNewVarName ( RSubOp . OP_NAME , 0 ) , x ) ; |
public class SeaGlassGraphicsUtils { /** * Draw text with an emphasized background .
* @ param g
* the Graphics context to draw with .
* @ param foreground
* the foreground color .
* @ param emphasis
* the emphasis color .
* @ param s
* the text to draw .
* @ param x
* the x coordinate to draw at . ... | drawEmphasizedText ( g , foreground , emphasis , s , - 1 , x , y ) ; |
public class AbstractVdmBreakpoint { /** * @ see IScriptBreakpoint # getId ( IDbgpSession ) */
public String getId ( IDbgpSession session ) { } } | final PerSessionInfo info ; synchronized ( sessions ) { info = ( PerSessionInfo ) sessions . get ( session ) ; } return info != null ? info . identifier : null ; |
public class CssEscape { /** * Perform a ( configurable ) CSS Identifier < strong > escape < / strong > operation on a < tt > char [ ] < / tt > input .
* This method will perform an escape operation according to the specified
* { @ link CssIdentifierEscapeType } and
* { @ link CssIdentifierEscapeLevel } argument ... | if ( writer == null ) { throw new IllegalArgumentException ( "Argument 'writer' cannot be null" ) ; } if ( type == null ) { throw new IllegalArgumentException ( "The 'type' argument cannot be null" ) ; } if ( level == null ) { throw new IllegalArgumentException ( "The 'level' argument cannot be null" ) ; } final int te... |
public class JSMarshaller { /** * Turn special regular expression characters into escaped characters
* conforming to JavaScript . < br >
* Reference : < a href =
* " https : / / developer . mozilla . org / en - US / docs / Web / JavaScript / Guide / Regular _ Expressions "
* > MDN Regular Expressions < / a >
... | if ( StringHelper . hasNoText ( sInput ) ) return sInput ; final char [ ] aInput = sInput . toCharArray ( ) ; if ( ! StringHelper . containsAny ( aInput , CHARS_TO_MASK_REGEX ) ) return sInput ; // At last each character has one masking character
final char [ ] ret = new char [ aInput . length * 2 ] ; int nIndex = 0 ; ... |
public class RmpAppirater { /** * Modify internal value .
* If you use this method , you might need to have a good understanding of this class code .
* @ param context Context
* @ param appThisVersionCodeLaunchCount Launch count of This application current version . */
public static void setAppThisVersionCodeLaun... | SharedPreferences prefs = getSharedPreferences ( context ) ; SharedPreferences . Editor prefsEditor = prefs . edit ( ) ; prefsEditor . putLong ( PREF_KEY_APP_LAUNCH_COUNT , appThisVersionCodeLaunchCount ) ; prefsEditor . commit ( ) ; |
public class ReplicatedRepository { /** * public boolean isClosed ( ) {
* return mReplicaRepository . isClosed ( ) | | mMasterRepository . isClosed ( ) ; */
public String [ ] getUserStorableTypeNames ( ) throws RepositoryException { } } | StorableInfoCapability replicaCap = mReplicaRepository . getCapability ( StorableInfoCapability . class ) ; StorableInfoCapability masterCap = mMasterRepository . getCapability ( StorableInfoCapability . class ) ; if ( replicaCap == null ) { if ( masterCap == null ) { return new String [ 0 ] ; } return masterCap . getU... |
public class Circle { /** * Set circle position in world space .
* @ param position circle center */
public void setPosition ( Coordinate position ) { } } | if ( getOriginalLocation ( ) != null ) { Bbox oldBounds = ( Bbox ) getOriginalLocation ( ) ; Bbox newBounds = ( Bbox ) oldBounds . clone ( ) ; newBounds . setCenterPoint ( position ) ; setOriginalLocation ( newBounds ) ; } else { setOriginalLocation ( new Bbox ( position . getX ( ) , position . getY ( ) , 0 , 0 ) ) ; } |
public class SlingApi { /** * ( asynchronously )
* @ param ignoredeactivated ( required )
* @ param onlymodified ( required )
* @ param path ( required )
* @ param callback The callback to be executed when the API call finishes
* @ return The request call
* @ throws ApiException If fail to process the API c... | ProgressResponseBody . ProgressListener progressListener = null ; ProgressRequestBody . ProgressRequestListener progressRequestListener = null ; if ( callback != null ) { progressListener = new ProgressResponseBody . ProgressListener ( ) { @ Override public void update ( long bytesRead , long contentLength , boolean do... |
public class InternalCallContextFactory { /** * Used by the payment retry service */
public InternalCallContext createInternalCallContext ( final UUID objectId , final ObjectType objectType , final String userName , final CallOrigin callOrigin , final UserType userType , @ Nullable final UUID userToken , final Long ten... | final Long accountRecordId = getAccountRecordIdSafe ( objectId , objectType , tenantRecordId ) ; return createInternalCallContext ( tenantRecordId , accountRecordId , userName , callOrigin , userType , userToken , null , null , null , null ) ; |
public class TextIntWritable { /** * Deserializes the internal data from the provided stream . */
public void readFields ( DataInput in ) throws IOException { } } | t . readFields ( in ) ; position = in . readInt ( ) ; |
public class XImportSectionImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case XtypePackage . XIMPORT_SECTION__IMPORT_DECLARATIONS : getImportDeclarations ( ) . clear ( ) ; getImportDeclarations ( ) . addAll ( ( Collection < ? extends XImportDeclaration > ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class CopyEventSubmitterHelper { /** * Submit an sla event when a { @ link org . apache . gobblin . data . management . copy . CopyableFile } is published . The < code > workUnitState < / code > passed should have the
* required { @ link SlaEventKeys } set .
* @ see SlaEventSubmitter # submit ( )
* @ param... | String datasetUrn = workUnitState . getProp ( SlaEventKeys . DATASET_URN_KEY ) ; String partition = workUnitState . getProp ( SlaEventKeys . PARTITION_KEY ) ; String completenessPercentage = workUnitState . getProp ( SlaEventKeys . COMPLETENESS_PERCENTAGE_KEY ) ; String recordCount = workUnitState . getProp ( SlaEventK... |
public class JSONProtocol { /** * Used by server . Server adds session ID transparently . */
public static Map < String , Object > cmd ( String c ) { } } | HashMap < String , Object > r = new HashMap < > ( ) ; r . put ( "cmd" , c . toUpperCase ( ) ) ; return r ; |
import java . util . List ; public class TupleCount { /** * The function finds and returns the count of the elements occurring before the first tuple in the given input .
* Examples :
* > > > TupleCount . findInitialCount ( Arrays . asList ( 1 , 5 , 7 , new int [ ] { 4 , 6 } , 10 ) ) ;
* > > > TupleCount . findIn... | // Counting elements before the first array
for ( int index = 0 ; index < data_list . size ( ) ; index ++ ) { if ( data_list . get ( index ) instanceof int [ ] ) { return index ; } } return - 1 ; // No array found in the list , returning - 1 or whichever default value you want to |
public class HtmlOutputLink { /** * < p > Return the value of the < code > fragment < / code > property . < / p >
* < p > Contents : The identifier of the page fragment which should
* be brought into focus when the target page is
* rendered . The value of this attribute is appended
* to the end of target URL fo... | return ( java . lang . String ) getStateHelper ( ) . eval ( PropertyKeys . fragment ) ; |
public class TransactionEdit { /** * Creates a new instance in the { @ link State # TRUNCATE _ INVALID _ TX } state . */
public static TransactionEdit createTruncateInvalidTxBefore ( long truncateInvalidTxTime ) { } } | return new TransactionEdit ( 0L , 0L , State . TRUNCATE_INVALID_TX , 0L , null , 0L , false , null , null , truncateInvalidTxTime , 0L , null ) ; |
public class DateMidnight { /** * Returns a copy of this date minus the specified number of months .
* This datetime instance is immutable and unaffected by this method call .
* The following three lines are identical in effect :
* < pre >
* DateMidnight subtracted = dt . minusMonths ( 6 ) ;
* DateMidnight su... | if ( months == 0 ) { return this ; } long instant = getChronology ( ) . months ( ) . subtract ( getMillis ( ) , months ) ; return withMillis ( instant ) ; |
public class CampaignExtensionSetting { /** * Gets the extensionSetting value for this CampaignExtensionSetting .
* @ return extensionSetting * The extension setting specifying which extensions to serve
* for the specified campaign . If
* extensionSetting is empty ( i . e . has an empty list
* of feed items and... | return extensionSetting ; |
public class ESAAdaptor { /** * Determine there is another feature requires this resource */
private static boolean requiredByOtherFeature ( ContentBasedLocalBundleRepository br , Map < String , ProvisioningFeatureDefinition > features , File b ) { } } | for ( ProvisioningFeatureDefinition fd : features . values ( ) ) { if ( requiredByJar ( br , fd , b ) ) return true ; } return false ; |
public class SettingsPack { /** * defaults to false . When set to true , the client tries to hide its
* identity to a certain degree . The peer - ID will no longer include the
* client ' s fingerprint . The user - agent will be reset to an empty string .
* It will also try to not leak other identifying informatio... | sp . set_bool ( settings_pack . bool_types . anonymous_mode . swigValue ( ) , value ) ; return this ; |
public class Stream { /** * Put the stream in try - catch to stop the back - end reading thread if error happens
* < br / >
* < code >
* try ( Stream < Integer > stream = Stream . parallelConcat ( a , b , . . . ) ) {
* stream . forEach ( N : : println ) ;
* < / code >
* @ param c
* @ return */
public stat... | return parallelConcatt ( c , DEFAULT_READING_THREAD_NUM ) ; |
public class ZipArchiveMagicNumber { /** * Replies if the given ZIP stream contains data of the expected type .
* @ throws IOException if the stream cannot be read . */
private boolean isContentTypeIn ( ZipInputStream stream ) throws IOException { } } | boolean isContentType = false ; if ( this . innerFile != null ) { final String strInner = this . innerFile . toString ( ) ; InputStream dataStream = null ; ZipEntry zipEntry = stream . getNextEntry ( ) ; while ( zipEntry != null && dataStream == null ) { if ( strInner . equals ( zipEntry . getName ( ) ) ) { dataStream ... |
public class LocalPortletRequestContextServiceImpl { /** * / * ( non - Javadoc )
* @ see org . apache . pluto . container . PortletRequestContextService # getPortletResourceResponseContext ( org . apache . pluto . container . PortletContainer , javax . servlet . http . HttpServletRequest , javax . servlet . http . Ht... | final IPortletWindow portletWindow = this . portletWindowRegistry . convertPortletWindow ( containerRequest , window ) ; return new PortletResourceResponseContextImpl ( container , portletWindow , containerRequest , containerResponse , this . requestPropertiesManager , this . portalUrlProvider , this . portletCookieSer... |
public class AbstractReplaceMojo { /** * Utility function that replace the macros by the replacement text in the given text .
* @ param macroName
* is the name of the macro to replace .
* @ param text
* is the text in which the replacement should occur
* @ param replacement
* is the replacement text .
* @... | if ( replacement != null && ! EMPTY_STRING . equals ( replacement ) ) { final Pattern p = buildMacroPattern ( macroName ) ; final Matcher m = p . matcher ( text ) ; return m . replaceAll ( Matcher . quoteReplacement ( replacement ) ) ; } if ( enableWarning ) { getBuildContext ( ) . addMessage ( sourceFile , sourceLine ... |
public class MSExcelWriter { /** * Returns the HashAlgorithm object matching the String .
* @ param hashAlgorithm hash algorithm
* @ return HashAlgorithm object corresponding to hash algorithm . Null if does not correspond to any algorithm . */
public static HashAlgorithm getHashAlgorithm ( String hashAlgorithm ) {... | if ( hashAlgorithm == null ) { return null ; } switch ( hashAlgorithm ) { case "md2" : return HashAlgorithm . md2 ; case "md4" : return HashAlgorithm . md4 ; case "md5" : return HashAlgorithm . md5 ; case "none" : return HashAlgorithm . none ; case "ripemd128" : return HashAlgorithm . ripemd128 ; case "ripemd160" : ret... |
public class SipRequest { /** * Indicates if the request method is INVITE or not .
* @ return true if the method is INVITE , false otherwise . */
public boolean isInvite ( ) { } } | if ( message == null ) { return false ; } return ( ( ( Request ) message ) . getMethod ( ) . equals ( Request . INVITE ) ) ; |
public class PropertyColumnTableDescription { /** * WARNING : propertyType is discarded , it should be fetched from the entityType through introspection .
* @ deprecated
* @ see # addPropertyColumn ( String )
* @ see PropertyColumn # withMinWidth ( int )
* @ see PropertyColumn # withMaxWidth ( int ) */
public v... | addPropertyColumn ( propertyName ) . withMinWidth ( minWidth ) . withMaxWidth ( maxWidth ) ; |
public class ExtensionHook { /** * Adds the given { @ link ConnectRequestProxyListener } to the extension hook , to be later notified of CONNECT requests
* received by the local proxy .
* By default , the { @ code ConnectRequestProxyListener } s added are removed from the local proxy when the extension is
* unloa... | if ( listener == null ) { throw new IllegalArgumentException ( "Parameter listener must not be null." ) ; } if ( connectRequestProxyListeners == null ) { connectRequestProxyListeners = new ArrayList < > ( ) ; } connectRequestProxyListeners . add ( listener ) ; |
public class BaseResource { /** * Create output stream output stream .
* @ return the output stream
* @ throws IOException the io exception */
protected OutputStream createOutputStream ( ) throws IOException { } } | if ( asFile ( ) . isPresent ( ) ) { return new FileOutputStream ( asFile ( ) . orElse ( null ) ) ; } return null ; |
public class Chorus { /** * Run interpreter using just the base configuration and the listeners provided
* @ return true , if all tests passed or were marked pending */
public boolean run ( ) { } } | boolean passed ; ExecutionToken t = createExecutionToken ( ) ; List < FeatureToken > features = getFeatureList ( t ) ; startTests ( t , features ) ; initializeInterpreter ( ) ; processFeatures ( t , features ) ; endTests ( t , features ) ; passed = t . getEndState ( ) == EndState . PASSED || t . getEndState ( ) == EndS... |
public class MpxjQuery { /** * Internal utility to dump relationship lists in a structured format
* that can easily be compared with the tabular data in MS Project .
* @ param relations relation list */
private static void dumpRelationList ( List < Relation > relations ) { } } | if ( relations != null && relations . isEmpty ( ) == false ) { if ( relations . size ( ) > 1 ) { System . out . print ( '"' ) ; } boolean first = true ; for ( Relation relation : relations ) { if ( ! first ) { System . out . print ( ',' ) ; } first = false ; System . out . print ( relation . getTargetTask ( ) . getID (... |
public class AnnotationProcessorUtilis { /** * Info on generated file .
* @ param annotation the annotation
* @ param schemaCreateFile the schema create file */
public static void infoOnGeneratedFile ( Class < BindDataSource > annotation , File schemaCreateFile ) { } } | String msg = String . format ( "file '%s' in directory '%s' is generated by '@%s' annotation processor" , schemaCreateFile . getName ( ) , schemaCreateFile . getParentFile ( ) , annotation . getSimpleName ( ) ) ; printMessage ( msg ) ; |
public class MediaType { /** * Sorts the given list of { @ code MediaType } objects by quality value .
* < p > Given two media types :
* < ol >
* < li > if the two media types have different { @ linkplain # getQualityValue ( ) quality value } , then the media type
* with the highest quality value is ordered bef... | checkNotNull ( mediaTypes , "'mediaTypes' must not be null" ) ; if ( mediaTypes . size ( ) > 1 ) { Collections . sort ( mediaTypes , QUALITY_VALUE_COMPARATOR ) ; } |
public class FnFunc { /** * Executes the specified < tt > function < / tt > iteratively ( first on the target , then
* on the result of the previous iteration ) while the result of executing the
* < tt > condition < / tt > function on the target object ( or the result of the previous
* < tt > function < / tt > it... | return new WhileDo < T > ( true , condition , function ) ; |
public class CrosstabBuilder { /** * { @ linkplain CrosstabBuilder # addRow ( DJCrosstabRow ) }
* @ param title
* @ param property
* @ param className
* @ param showTotal
* @ param headerStyle
* @ param totalStyle
* @ param totalHeaderStyle
* @ return */
public CrosstabBuilder addRow ( String title , St... | DJCrosstabRow row = new CrosstabRowBuilder ( ) . setProperty ( property , className ) . setShowTotals ( showTotal ) . setTitle ( title ) . setHeaderStyle ( headerStyle ) . setTotalHeaderStyle ( totalHeaderStyle ) . setTotalStyle ( totalStyle ) . build ( ) ; addRow ( row ) ; return this ; |
public class GenericGenerators { /** * Generates instructions to throw the exception type at top of stack . You may run in to problems if the item on top of the stack isn ' t
* a { @ link Throwable } type .
* @ return instructions to throw an exception
* @ throws NullPointerException if any argument is { @ code n... | InsnList ret = new InsnList ( ) ; // ret . add ( new TypeInsnNode ( Opcodes . CHECKCAST , " java / lang / Throwable " ) ) ; / / If required , do it outside this method
ret . add ( new InsnNode ( Opcodes . ATHROW ) ) ; return ret ; |
public class VaultJBossASClient { /** * Checks to see if there is already a vault configured .
* @ return true if the vault is already configured
* @ throws Exception any error */
public boolean isVault ( ) throws Exception { } } | Address addr = Address . root ( ) . add ( CORE_SERVICE , VAULT ) ; final ModelNode queryNode = createRequest ( READ_RESOURCE , addr ) ; final ModelNode results = execute ( queryNode ) ; if ( isSuccess ( results ) ) { return true ; } return false ; |
public class GlobusGSSManagerImpl { /** * Currently not implemented . */
public GSSName createName ( String nameStr , Oid nameType , Oid mech ) throws GSSException { } } | throw new GSSException ( GSSException . UNAVAILABLE ) ; |
public class BoxRequestCommentAdd { /** * Returns the type of item used in the request to add a comment to .
* @ return type of item to add a comment to . */
public String getItemType ( ) { } } | return mBodyMap . containsKey ( BoxComment . FIELD_ITEM ) ? ( String ) mBodyMap . get ( BoxItem . FIELD_TYPE ) : null ; |
public class LogView { /** * Adds a new filter to the view .
* @ param filter */
public void addFilter ( AbstractLogFilter < E > filter ) { } } | Validate . notNull ( filter ) ; filters . add ( filter ) ; uptodate = false ; filter . addObserver ( this ) ; |
public class Tuple2 { /** * Static factory method for creating < code > Tuple2 < / code > s from { @ link java . util . Map . Entry } s .
* @ param entry the map entry
* @ param < K > the key parameter type , and first ( head ) element type
* @ param < V > the value parameter type , and second element type
* @ ... | return new Tuple2 < > ( entry . getKey ( ) , singletonHList ( entry . getValue ( ) ) ) ; |
public class MatchAllWeight { /** * { @ inheritDoc } */
@ Override public float sumOfSquaredWeights ( ) throws IOException { } } | idf = searcher . getSimilarity ( ) . idf ( searcher . maxDoc ( ) , searcher . maxDoc ( ) ) ; // compute idf
queryWeight = idf * 1.0f ; // boost / / compute query weight
return queryWeight * queryWeight ; // square it |
public class SimpleVersionedSerialization { /** * Serializes the version and datum into a stream .
* < p > Data serialized via this method can be deserialized via
* { @ link # readVersionAndDeSerialize ( SimpleVersionedSerializer , DataInputView ) } .
* < p > The first four bytes will be occupied by the version ,... | checkNotNull ( serializer , "serializer" ) ; checkNotNull ( datum , "datum" ) ; checkNotNull ( out , "out" ) ; final byte [ ] data = serializer . serialize ( datum ) ; out . writeInt ( serializer . getVersion ( ) ) ; out . writeInt ( data . length ) ; out . write ( data ) ; |
public class ColorYuv { /** * Conversion from YUV to RGB using same equations as Intel IPP . */
public static void yuvToRgb ( double y , double u , double v , double rgb [ ] ) { } } | rgb [ 0 ] = y + 1.13983 * v ; rgb [ 1 ] = y - 0.39465 * u - 0.58060 * v ; rgb [ 2 ] = y + 2.032 * u ; |
public class GeoWithinOperationValidator { /** * this could be a lot more rigorous */
private static boolean isValueAValidGeoQuery ( final Object value ) { } } | if ( value instanceof DBObject ) { String key = ( ( DBObject ) value ) . keySet ( ) . iterator ( ) . next ( ) ; return key . equals ( "$box" ) || key . equals ( "$center" ) || key . equals ( "$centerSphere" ) || key . equals ( "$polygon" ) ; } return false ; |
public class ProductCodeMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ProductCode productCode , ProtocolMarshaller protocolMarshaller ) { } } | if ( productCode == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( productCode . getCode ( ) , CODE_BINDING ) ; protocolMarshaller . marshall ( productCode . getProductType ( ) , PRODUCTTYPE_BINDING ) ; } catch ( Exception e ) { throw new S... |
public class ExpressionsRetinaApiImpl { /** * { @ inheritDoc } */
@ Override public List < List < Context > > getContextsBulk ( Pagination pagination , Boolean includeFingerprint , Double sparsity , Model ... models ) throws JsonProcessingException , ApiException { } } | validateRequiredModels ( models ) ; return getContextsBulk ( pagination , includeFingerprint , sparsity , toJson ( models ) ) ; |
public class ModelViewsConverter { /** * Register a converter for a specific view .
* @ param c the converter to register */
public void register ( ModelViewConverter < ? extends ModelView > c ) { } } | java2json . put ( c . getSupportedView ( ) , c ) ; json2java . put ( c . getJSONId ( ) , c ) ; |
public class Token { /** * Recover the token described by a dataInputStream and resolve it ot the definitive token .
* @ param dataInputStream containing the serialized Token .
* @ param objectManagerState of the objectManager reconstructing the Token .
* @ return Token matching the next bytes in the dataInputStr... | if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( cclass , "restore" , new Object [ ] { dataInputStream , objectManagerState } ) ; int objectStoreIdentifier ; long storedObjectIdentifier ; try { byte version = dataInputStream . readByte ( ) ; if ( Tracing . isAnyTracingEnabled ( ) &... |
public class CollectionUtils { /** * Wrap set .
* @ param < T > the type parameter
* @ param source the source
* @ return the set */
public static < T > Set < T > wrapSet ( final T ... source ) { } } | val list = new LinkedHashSet < T > ( ) ; addToCollection ( list , source ) ; return list ; |
public class DynaFormModel { /** * Creates a new extended row .
* @ return { @ link DynaFormRow } */
public DynaFormRow createExtendedRow ( ) { } } | if ( extendedRows == null ) { extendedRows = new ArrayList < DynaFormRow > ( ) ; } final DynaFormRow dynaFormRow = new DynaFormRow ( extendedRows . size ( ) + 1 , true , this ) ; extendedRows . add ( dynaFormRow ) ; return dynaFormRow ; |
public class DeleteSecurityConfigurationRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteSecurityConfigurationRequest deleteSecurityConfigurationRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteSecurityConfigurationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteSecurityConfigurationRequest . getName ( ) , NAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall reque... |
public class HlFlCnNm { /** * < p > Set thing for given class and field name . < / p >
* @ param pThing Thing
* @ param pCls Class
* @ param pFldNm Field Name */
@ Override public final void setFor ( final String pThing , final Class < ? > pCls , final String pFldNm ) { } } | try { this . mngSettings . lazFldSts ( pCls , pFldNm ) . put ( this . settingName , pThing ) ; } catch ( Exception e ) { throw new RuntimeException ( "Can't set class/field/setting: " + pCls + "/" + pFldNm + "/" + pThing , e ) ; } |
public class StubAmpLazyProxy { /** * @ Override
* public boolean isClosed ( )
* StubAmp delegate = delegate ( ) ;
* return delegate = = null | | delegate . isClosed ( ) ; */
@ Override public MethodAmp methodByName ( String methodName ) { } } | StubAmp delegate = delegate ( ) ; if ( delegate != null ) { return delegate . methodByName ( methodName ) ; } else { System . out . println ( "EEP:" ) ; return null ; } |
public class AccuracyUpdatedEnsemble { /** * Processes a chunk of instances .
* This method is called after collecting a chunk of examples . */
protected void processChunk ( ) { } } | Classifier addedClassifier = null ; double mse_r = this . computeMseR ( ) ; // Compute weights
double candidateClassifierWeight = 1.0 / ( mse_r + Double . MIN_VALUE ) ; for ( int i = 0 ; i < this . learners . length ; i ++ ) { this . weights [ i ] [ 0 ] = 1.0 / ( mse_r + this . computeMse ( this . learners [ ( int ) th... |
public class LabeledDiGraph { /** * Returns a bi - directional labeled navigator through
* < code > LabeledDiGraph < / code > . The default implementation uses the
* forward navigator returned by < code > LabeledForwardNavigator < / code >
* to traverse the entire graph and construct the list of
* backward arcs... | if ( CACHING && lnav == null ) { return lnav ; } LabeledBiDiNavigator < Vertex , Label > lnav = _getLabeledBiDiNavigator ( ) ; if ( CACHING ) { this . lnav = lnav ; } return lnav ; |
public class CmsHtmlWidget { /** * Removes all keys from the given JSON object which do not directly result from the embedded gallery configuration strings . < p >
* @ param json the JSON object to modify */
private void filterEmbeddedGalleryOptions ( JSONObject json ) { } } | Set < String > validKeys = Sets . newHashSet ( Arrays . asList ( I_CmsGalleryProviderConstants . CONFIG_GALLERY_TYPES , I_CmsGalleryProviderConstants . CONFIG_GALLERY_PATH , I_CmsGalleryProviderConstants . CONFIG_USE_FORMATS , I_CmsGalleryProviderConstants . CONFIG_IMAGE_FORMAT_NAMES , I_CmsGalleryProviderConstants . C... |
public class SVGIcon { /** * Allows to set a new color to the foregroundIcon icon and setAnimation its change ( by a FadeTransition ) .
* @ param color the color for the foregroundIcon icon to be set
* @ param cycleCount the number of times the animation should be played ( use Animation . INDEFINITE for endless ) *... | assert color != null ; stopForegroundIconColorFadeAnimation ( ) ; foregroundFadeIcon . setFill ( color ) ; foregroundColorFadeAnimation = Animations . createFadeTransition ( foregroundFadeIcon , JFXConstants . TRANSPARENCY_FULLY , JFXConstants . TRANSPARENCY_NONE , Animation . INDEFINITE , JFXConstants . ANIMATION_DURA... |
public class AbstractRLEDecoder { /** * Decodes as much data as possible , from the stream into the buffer .
* @ param stream the input stream containing RLE data
* @ param buffer the buffer to decode the data to
* @ return the number of bytes decoded from the stream , to the buffer
* @ throws IOException if an... | // TODO : Allow decoding < row . length at a time and get rid of this assertion . . .
if ( buffer . capacity ( ) < row . length ) { throw new AssertionError ( "This decoder needs a buffer.capacity() of at least one row" ) ; } while ( buffer . remaining ( ) >= row . length && srcY >= 0 ) { // NOTE : Decode only full row... |
public class NodeInfo { /** * Compare { @ link NodeInfo } by lexicographical order of their associated host .
* @ param o the comparison term
* @ return a positive value if { @ code this . getHost } is lexicographically " bigger " than
* { @ code o . getHost } , 0 if the hosts are equal , a negative value otherwi... | if ( o == null ) { return 1 ; } else { return this . getHost ( ) . compareTo ( o . getHost ( ) ) ; } |
public class Form { /** * Set the request method used ( " get " or " post " ) when submitting this form .
* @ param method the request method
* @ jsptagref . attributedescription The request method used when submitting this form .
* @ jsptagref . databindable false
* @ jsptagref . attributesyntaxvalue < i > str... | if ( FORM_POST . equals ( method ) || FORM_GET . equals ( method ) ) { _state . method = method ; return ; } String s = Bundle . getString ( "Tags_FormMethodError" , new Object [ ] { method } ) ; registerTagError ( s , null ) ; |
public class RequestSpotInstancesRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < RequestSpotInstancesRequest > getDryRunRequest ( ) { } } | Request < RequestSpotInstancesRequest > request = new RequestSpotInstancesRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class AmazonCloudWatchEventsClient { /** * Creates or updates the specified rule . Rules are enabled by default , or based on value of the state . You can
* disable a rule using < a > DisableRule < / a > .
* If you are updating an existing rule , the rule is replaced with what you specify in this < code > Pu... | request = beforeClientExecution ( request ) ; return executePutRule ( request ) ; |
public class Utilities { /** * Affiche un texte scrollable non éditable dans une popup .
* @ param component Parent
* @ param title Titre de la popup
* @ param text Texte */
public static void showTextInPopup ( Component component , String title , String text ) { } } | final JTextArea textArea = new JTextArea ( ) ; textArea . setText ( text ) ; textArea . setEditable ( false ) ; textArea . setCaretPosition ( 0 ) ; // background nécessaire avec la plupart des look and feels dont Nimbus ,
// sinon il reste blanc malgré editable false
textArea . setBackground ( Color . decode ( "#E6E6... |
public class PerspectiveOps { /** * Convenient function for converting from normalized image coordinates to the original image pixel coordinate .
* If speed is a concern then { @ link PinholeNtoP _ F64 } should be used instead .
* NOTE : norm and pixel can be the same instance .
* @ param K Intrinsic camera calib... | return ImplPerspectiveOps_F64 . convertNormToPixel ( K , norm , pixel ) ; |
public class LauncherServer { /** * Removes the client handle from the pending list ( in case it ' s still there ) , and unrefs
* the server . */
void unregister ( AbstractAppHandle handle ) { } } | for ( Map . Entry < String , AbstractAppHandle > e : secretToPendingApps . entrySet ( ) ) { if ( e . getValue ( ) . equals ( handle ) ) { String secret = e . getKey ( ) ; secretToPendingApps . remove ( secret ) ; break ; } } unref ( ) ; |
public class PolicyLoader { /** * the passed parser must be safe to use in this thread */
protected AbstractPolicy loadObjectPolicy ( PolicyParser policyParser , String pid , boolean validate ) throws ServerException { } } | try { DOReader reader = m_repoReader . getReader ( Server . USE_DEFINITIVE_STORE , ReadOnlyContext . EMPTY , pid ) ; Datastream ds = reader . GetDatastream ( "POLICY" , null ) ; if ( ds != null ) { logger . debug ( "Using POLICY for {}" , pid ) ; return policyParser . parse ( ds . getContentStream ( ) , validate ) ; } ... |
public class RestRepository { /** * used to initialize a scroll ( based on a query ) */
Scroll scroll ( String query , BytesArray body , ScrollReader reader ) throws IOException { } } | InputStream scroll = client . execute ( POST , query , body ) . body ( ) ; try { return reader . read ( scroll ) ; } finally { if ( scroll instanceof StatsAware ) { stats . aggregate ( ( ( StatsAware ) scroll ) . stats ( ) ) ; } } |
public class RocksDbUtils { /** * Builds a list of { @ link ColumnFamilyDescriptor } s , specifying options .
* @ param cfOptions
* @ param cfNames
* @ return */
public static List < ColumnFamilyDescriptor > buildColumnFamilyDescriptors ( ColumnFamilyOptions cfOptions , String ... cfNames ) { } } | List < ColumnFamilyDescriptor > result = new ArrayList < > ( ) ; if ( cfNames != null ) { for ( String cfName : cfNames ) { result . add ( buildColumnFamilyDescriptor ( cfOptions , cfName ) ) ; } } return result ; |
public class AllCategoryTableModel { /** * Gets the appropriate { @ code AlertThreshold } for the state of the given plugin .
* If the plugin is disabled it returns { @ link AlertThreshold # OFF } , otherwise it returns its { @ code AlertThreshold } .
* @ param plugin the plugin for which a { @ code AlertThreshold ... | if ( ! plugin . isEnabled ( ) ) { return AlertThreshold . OFF ; } return plugin . getAlertThreshold ( true ) ; |
public class RotationSolver { /** * Checks if a particular permutation is allowed and superimposes well .
* Caches results .
* @ param permutation
* @ return null if invalid , or a rotation if valid */
private Rotation isValidPermutation ( List < Integer > permutation ) { } } | if ( permutation . size ( ) == 0 ) { return null ; } // cached value
if ( evaluatedPermutations . containsKey ( permutation ) ) { return evaluatedPermutations . get ( permutation ) ; } // check if permutation is allowed
if ( ! isAllowedPermutation ( permutation ) ) { evaluatedPermutations . put ( permutation , null ) ;... |
public class GoroService { /** * Bind to Goro service . This method will start the service and then bind to it .
* @ param context context that is binding to the service
* @ param connection service connection callbacks
* @ throws GoroException when service is not declared in the application manifest */
public st... | Intent serviceIntent = new Intent ( context , GoroService . class ) ; if ( context . startService ( serviceIntent ) == null ) { throw new GoroException ( "Service " + GoroService . class + " does not seem to be included to your manifest file" ) ; } boolean bound = context . bindService ( serviceIntent , connection , 0 ... |
public class HeapDump { /** * Creates / returns the HeapDump instance . Will throw an IllegalStateException
* if Resin Professional is not available . */
public static HeapDump create ( ) { } } | try { ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; Class < ? > heapDumpClass = Class . forName ( "com.caucho.v5.profile.ProHeapDump" , false , loader ) ; _heapDump = ( HeapDump ) heapDumpClass . newInstance ( ) ; return _heapDump ; } catch ( ClassNotFoundException e ) { log . log ( Leve... |
public class HardLink { /** * Implements { @ link createHardLinkMult } with added variable " maxLength " ,
* to ease unit testing of the auto - splitting feature for long lists .
* Likewise why it returns " callCount " , the number of sub - arrays that
* the file list had to be split into .
* Non - test clients... | if ( parentDir == null ) { throw new IOException ( "invalid arguments to createHardLinkMult: parent directory is null" ) ; } if ( linkDir == null ) { throw new IOException ( "invalid arguments to createHardLinkMult: link directory is null" ) ; } if ( fileBaseNames == null ) { throw new IOException ( "invalid arguments ... |
public class sent_mails { /** * < pre >
* Converts API response of bulk operation into object and returns the object array in case of get request .
* < / pre > */
protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } } | sent_mails_responses result = ( sent_mails_responses ) service . get_payload_formatter ( ) . string_to_resource ( sent_mails_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro_exception ( result . message , resu... |
public class CpuAcct { /** * Private because it requires a specific format and cant ' take a generic list of strings */
private static CpuAcctMetric parse ( final List < String > lines ) { } } | // File has a header . We skip it
// See src / test / resources / cpuacct . usage _ all for an example
final int ncpus = lines . size ( ) - 1 ; final long [ ] usrTime = new long [ ncpus ] ; final long [ ] sysTime = new long [ ncpus ] ; for ( int i = 1 ; i < lines . size ( ) ; i ++ ) { final String [ ] splits = lines . ... |
public class DefaultGroovyMethods { /** * Returns the items from the SortedSet excluding the last item . Leaves the original SortedSet unchanged .
* < pre class = " groovyTestCase " >
* def sortedSet = [ 3 , 4 , 2 ] as SortedSet
* assert sortedSet . init ( ) = = [ 2 , 3 ] as SortedSet
* assert sortedSet = = [ 3... | return ( SortedSet < T > ) init ( ( Iterable < T > ) self ) ; |
public class FeatureUtils { /** * Used to get correct object type even if it ' s guice proxy .
* @ param object object to get class of
* @ param < T > object type
* @ return object class */
@ SuppressWarnings ( "unchecked" ) public static < T > Class < T > getInstanceClass ( final T object ) { } } | final Class cls = object . getClass ( ) ; return cls . getName ( ) . contains ( "$$EnhancerByGuice" ) ? ( Class < T > ) cls . getSuperclass ( ) : cls ; |
public class PartnerUserService { /** * Updates the given user .
* @ param partnerId The id of the partner the user belongs to
* @ param accountId The id of the account for the user
* @ param user The user to update
* @ return The user that was updated */
public Optional < PartnerUser > update ( long partnerId ... | return Optional . of ( HTTP . PUT ( String . format ( "/v2/partners/%d/accounts/%d/users" , partnerId , accountId ) , user , PARTNER_USERS ) . get ( ) . iterator ( ) . next ( ) ) ; |
public class TimerNpImpl { /** * Registers the timer with the TimerService ( so that it will be found by
* getTimers ) and either schedules the timer for execution or places it
* on a queue to be scheduled once the application has started . < p >
* There are multiple callers for start ( ) :
* - Called by the EJ... | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "start: " + this ) ; EJBModuleMetaDataImpl ejbModuleMetaData = ivBMD . _moduleMetaData ; EJBApplicationMetaData ejbAmd = ejbModuleMetaData . getEJBApplicationMetaData ( ) ; // Synchronizati... |
public class Response { /** * Adds an additional content map to the content rendered in the template .
* Already existing values with the same key are overwritten .
* @ param content The content map to add
* @ return A response object { @ link io . mangoo . routing . Response } */
public Response andContent ( Map... | Objects . requireNonNull ( content , Required . CONTENT . toString ( ) ) ; this . content . putAll ( content ) ; return this ; |
public class XlsxWorkbook { /** * Returns the worksheet at the given index in the workbook .
* @ param i The index of the worksheet
* @ return The worksheet at the given index in the workbook */
@ Override public XlsxWorksheet getSheet ( int i ) { } } | XlsxWorksheet ret = null ; if ( sheets != null ) { Sheet sheet = ( Sheet ) sheets . get ( i ) ; if ( sheet != null ) ret = getSheet ( sheet . getName ( ) ) ; } return ret ; |
public class CommerceSubscriptionEntryPersistenceImpl { /** * Returns an ordered range of all the commerce subscription entries where subscriptionStatus = & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code ... | return findBySubscriptionStatus ( subscriptionStatus , start , end , orderByComparator , true ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.