signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ImageHelper { /** * Clones an image .
* http : / / stackoverflow . com / questions / 3514158 / how - do - you - clone - a - bufferedimage
* @ param bi
* @ return */
public static BufferedImage cloneImage ( BufferedImage bi ) { } } | ColorModel cm = bi . getColorModel ( ) ; boolean isAlphaPremultiplied = cm . isAlphaPremultiplied ( ) ; WritableRaster raster = bi . copyData ( null ) ; return new BufferedImage ( cm , raster , isAlphaPremultiplied , null ) ; |
public class PubSub { /** * Delay for 5 seconds the executionof { @ link Broadcaster # broadcast ( java . lang . Object ) } operation
* @ param message A String from an HTML form
* @ return A { @ link Broadcastable } used to broadcast events . */
@ Broadcast ( delay = 5 ) @ POST @ Path ( "delay" ) public Broadcastable delayPublish ( @ FormParam ( "message" ) String message ) { } } | return broadcast ( message ) ; |
public class Property { /** * Converts a string to a boolean .
* < p > Note that { @ link Boolean # parseBoolean ( String ) } is similar , but only
* exists from JDK 1.5 onwards , and only accepts ' true ' . < / p >
* @ return true if the string is " 1 " or " true " or " yes " , ignoring case and
* any leading or trailing spaces */
public static boolean toBoolean ( final String value ) { } } | String trimmedLowerValue = value . toLowerCase ( ) . trim ( ) ; return trimmedLowerValue . equals ( "1" ) || trimmedLowerValue . equals ( "true" ) || trimmedLowerValue . equals ( "yes" ) ; |
public class BasePosixProcess { /** * { @ inheritDoc } */
@ Override public void destroy ( boolean force ) { } } | if ( isRunning ) { checkReturnCode ( LibC . kill ( pid , force ? LibC . SIGKILL : LibC . SIGTERM ) , "Sending signal failed" ) ; } |
public class JsIterables { /** * Returns an ` Iterable ` type templated on { @ code elementType } .
* < p > Example : ` number ' = > ` Iterable < number > ` . */
static final JSType createIterableTypeOf ( JSType elementType , JSTypeRegistry typeRegistry ) { } } | return typeRegistry . createTemplatizedType ( typeRegistry . getNativeObjectType ( ITERABLE_TYPE ) , elementType ) ; |
public class HttpUrl { /** * Returns the distinct query parameter names in this URL , like { @ code [ " a " , " b " ] } for { @ code
* http : / / host / ? a = apple & b = banana } . If this URL has no query this returns the empty set .
* < p > < table summary = " " >
* < tr > < th > URL < / th > < th > { @ code queryParameterNames ( ) } < / th > < / tr >
* < tr > < td > { @ code http : / / host / } < / td > < td > { @ code [ ] } < / td > < / tr >
* < tr > < td > { @ code http : / / host / ? } < / td > < td > { @ code [ " " ] } < / td > < / tr >
* < tr > < td > { @ code http : / / host / ? a = apple & k = key + lime } < / td > < td > { @ code [ " a " , " k " ] } < / td > < / tr >
* < tr > < td > { @ code http : / / host / ? a = apple & a = apricot } < / td > < td > { @ code [ " a " ] } < / td > < / tr >
* < tr > < td > { @ code http : / / host / ? a = apple & b } < / td > < td > { @ code [ " a " , " b " ] } < / td > < / tr >
* < / table > */
public Set < String > queryParameterNames ( ) { } } | if ( queryNamesAndValues == null ) return Collections . emptySet ( ) ; Set < String > result = new LinkedHashSet < > ( ) ; for ( int i = 0 , size = queryNamesAndValues . size ( ) ; i < size ; i += 2 ) { result . add ( queryNamesAndValues . get ( i ) ) ; } return Collections . unmodifiableSet ( result ) ; |
public class HtmlTool { /** * Creates a slug ( latin text with no whitespace or other symbols ) for a longer text ( i . e . to
* use in URLs ) .
* @ param input
* text to generate the slug from
* @ param separator
* separator for whitespace replacement
* @ return the slug of the given text that contains alphanumeric symbols and separator only
* @ since 1.0
* @ see < a href = " http : / / www . codecodex . com / wiki / Generate _ a _ url _ slug " > http : / / www . codecodex . com / wiki / Generate _ a _ url _ slug < / a > */
public static String slug ( String input , String separator ) { } } | String slug = adaptSlug ( input , separator ) ; return slug . toLowerCase ( Locale . ENGLISH ) ; |
public class BoundedBuffer { /** * Removes an object from the buffer . Note that
* since there is no synchronization , it is assumed
* that this is done outside the scope of this call . */
private final Object extract ( ) { } } | Object old = buffer [ takeIndex ] ; buffer [ takeIndex ] = null ; if ( ++ takeIndex >= buffer . length ) takeIndex = 0 ; return old ; |
public class UnprocessableEntityException { /** * A collection of validation error responses .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setValidationErrors ( java . util . Collection ) } or { @ link # withValidationErrors ( java . util . Collection ) } if you
* want to override the existing values .
* @ param validationErrors
* A collection of validation error responses .
* @ return Returns a reference to this object so that method calls can be chained together . */
public UnprocessableEntityException withValidationErrors ( ValidationError ... validationErrors ) { } } | if ( this . validationErrors == null ) { setValidationErrors ( new java . util . ArrayList < ValidationError > ( validationErrors . length ) ) ; } for ( ValidationError ele : validationErrors ) { this . validationErrors . add ( ele ) ; } return this ; |
public class AbstractWithUoM { /** * Converts the { @ link # value } in a standardized value depended on defined
* { @ link UoM # getNumerator ( ) numerator } and { @ link UoM # getDenominator ( ) denominator } .
* @ return standardized value
* @ see # value
* @ see UoM # getBaseDouble ( Double ) */
public Double getBaseDouble ( ) { } } | return ( this . value == null ) || ( this . uom == null ) ? null : this . uom . getBaseDouble ( ( ( Number ) this . value ) . doubleValue ( ) ) ; |
public class TableProgressInformationPanel { /** * Sets the progress of the processing of the table .
* @ param currentRow
* @ return */
public boolean setProgress ( final int currentRow ) { } } | final boolean result = _progressBar . setValueIfGreater ( currentRow ) ; if ( result ) { _progressCountLabel . setText ( formatNumber ( currentRow ) ) ; } return result ; |
public class ExportRow { /** * Read a timestamp according to the Export encoding specification .
* @ param bb
* @ throws IOException */
static public TimestampType decodeTimestamp ( final ByteBuffer bb ) { } } | final Long val = bb . getLong ( ) ; return new TimestampType ( val ) ; |
public class SFTrustManager { /** * Creates a OCSP Request
* @ param pairIssuerSubject a pair of issuer and subject certificates
* @ return OCSPReq object */
private OCSPReq createRequest ( SFPair < Certificate , Certificate > pairIssuerSubject ) { } } | Certificate issuer = pairIssuerSubject . left ; Certificate subject = pairIssuerSubject . right ; OCSPReqBuilder gen = new OCSPReqBuilder ( ) ; try { DigestCalculator digest = new SHA1DigestCalculator ( ) ; X509CertificateHolder certHolder = new X509CertificateHolder ( issuer . getEncoded ( ) ) ; CertificateID certId = new CertificateID ( digest , certHolder , subject . getSerialNumber ( ) . getValue ( ) ) ; gen . addRequest ( certId ) ; return gen . build ( ) ; } catch ( OCSPException | IOException ex ) { throw new RuntimeException ( "Failed to build a OCSPReq." ) ; } |
public class BGRImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . BGR__GDO_NAME : return getGdoName ( ) ; case AfplibPackage . BGR__TRIPLETS : return getTriplets ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class StereoDisparityWtoNaiveFive { /** * Computes the disparity for two stereo images along the image ' s right axis . Both
* image must be rectified .
* @ param left Left camera image .
* @ param right Right camera image . */
public void process ( I left , I right , GrayF32 imageDisparity ) { } } | // check inputs and initialize data structures
InputSanityCheck . checkSameShape ( left , right , imageDisparity ) ; this . imageLeft = left ; this . imageRight = right ; w = left . width ; h = left . height ; // Compute disparity for each pixel
for ( int y = radiusY * 2 ; y < h - radiusY * 2 ; y ++ ) { for ( int x = radiusX * 2 + minDisparity ; x < w - radiusX * 2 ; x ++ ) { // take in account image border when computing max disparity
int max = x - Math . max ( radiusX * 2 - 1 , x - score . length ) ; // compute match score across all candidates
processPixel ( x , y , max ) ; // select the best disparity
imageDisparity . set ( x , y , ( float ) selectBest ( max ) ) ; } } |
public class ApplicationDefinition { /** * Get this application ' s definition including tables , schedules , etc . as a
* { @ link UNode } tree .
* @ return The root of a { @ link UNode } tree . */
public UNode toDoc ( ) { } } | // The root node is always a MAP whose name is the application ' s name . In case it
// is serialized to XML , we set this node ' s tag name to " application " .
UNode appNode = UNode . createMapNode ( m_appName , "application" ) ; // Add the application ' s key .
if ( ! Utils . isEmpty ( m_key ) ) { appNode . addValueNode ( "key" , m_key ) ; } // Add options , if any , in a MAP node .
if ( m_optionMap . size ( ) > 0 ) { UNode optsNode = appNode . addMapNode ( "options" ) ; for ( String optName : m_optionMap . keySet ( ) ) { // Set each option ' s tag name to " option " for XML ' s sake .
optsNode . addValueNode ( optName , m_optionMap . get ( optName ) , "option" ) ; } } // Add tables , if any , in a MAP node .
if ( m_tableMap . size ( ) > 0 ) { UNode tablesNode = appNode . addMapNode ( "tables" ) ; for ( TableDefinition tableDef : m_tableMap . values ( ) ) { tablesNode . addChildNode ( tableDef . toDoc ( ) ) ; } } return appNode ; |
public class DiskClient { /** * Creates a snapshot of a specified persistent disk .
* < p > Sample code :
* < pre > < code >
* try ( DiskClient diskClient = DiskClient . create ( ) ) {
* ProjectZoneDiskName disk = ProjectZoneDiskName . of ( " [ PROJECT ] " , " [ ZONE ] " , " [ DISK ] " ) ;
* Boolean guestFlush = false ;
* Snapshot snapshotResource = Snapshot . newBuilder ( ) . build ( ) ;
* Operation response = diskClient . createSnapshotDisk ( disk . toString ( ) , guestFlush , snapshotResource ) ;
* < / code > < / pre >
* @ param disk Name of the persistent disk to snapshot .
* @ param guestFlush
* @ param snapshotResource A persistent disk snapshot resource . ( = = resource _ for beta . snapshots
* = = ) ( = = resource _ for v1 . snapshots = = )
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Operation createSnapshotDisk ( String disk , Boolean guestFlush , Snapshot snapshotResource ) { } } | CreateSnapshotDiskHttpRequest request = CreateSnapshotDiskHttpRequest . newBuilder ( ) . setDisk ( disk ) . setGuestFlush ( guestFlush ) . setSnapshotResource ( snapshotResource ) . build ( ) ; return createSnapshotDisk ( request ) ; |
public class EJBApplicationMetaData { /** * Adds a singleton bean belonging to this application .
* @ param bmd
* the bean metadata
* @ param startup
* true if this is a startup singleton bean
* @ param dependsOnLinks
* list of dependency EJB links */
public void addSingleton ( BeanMetaData bmd , boolean startup , Set < String > dependsOnLinks ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "addSingleton: " + bmd . j2eeName + " (startup=" + startup + ", dependsOn=" + ( dependsOnLinks != null ) + ")" ) ; if ( startup ) { if ( ivStartupSingletonList == null ) { ivStartupSingletonList = new ArrayList < J2EEName > ( ) ; } ivStartupSingletonList . add ( bmd . j2eeName ) ; } if ( dependsOnLinks != null ) { if ( ivSingletonDependencies == null ) { ivSingletonDependencies = new LinkedHashMap < BeanMetaData , Set < String > > ( ) ; } ivSingletonDependencies . put ( bmd , dependsOnLinks ) ; } |
public class RevocationVerificationManager { /** * Convert certificates and create a certificate chain .
* @ param certs array of javax . security . cert . X509Certificate [ ] s .
* @ return the converted array of java . security . cert . X509Certificate [ ] s .
* @ throws CertificateVerificationException If an error occurs while converting certificates
* from java to javax */
private X509Certificate [ ] convert ( javax . security . cert . X509Certificate [ ] certs ) throws CertificateVerificationException { } } | X509Certificate [ ] certChain = new X509Certificate [ certs . length ] ; Throwable exceptionThrown ; for ( int i = 0 ; i < certs . length ; i ++ ) { try { byte [ ] encoded = certs [ i ] . getEncoded ( ) ; ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream ( encoded ) ; CertificateFactory certificateFactory = CertificateFactory . getInstance ( Constants . X_509 ) ; certChain [ i ] = ( ( X509Certificate ) certificateFactory . generateCertificate ( byteArrayInputStream ) ) ; continue ; } catch ( CertificateEncodingException | CertificateException e ) { exceptionThrown = e ; } throw new CertificateVerificationException ( "Cant Convert certificates from javax to java" , exceptionThrown ) ; } return certChain ; |
public class JRebirth { /** * Return true if we are into a slot of the thread pool ( JTP ) .
* @ return true if currentThread = = one of JTP slot */
public static boolean isJTPSlot ( ) { } } | return Thread . currentThread ( ) . getName ( ) . startsWith ( GlobalFacadeBase . JTP_BASE_NAME ) || Thread . currentThread ( ) . getName ( ) . startsWith ( GlobalFacadeBase . HPTP_BASE_NAME ) ; |
public class OptionalDoubleParameterMapper { /** * { @ inheritDoc }
* @ see jp . co . future . uroborosql . parameter . mapper . BindParameterMapper # toJdbc ( java . lang . Object , java . sql . Connection , jp . co . future . uroborosql . parameter . mapper . BindParameterMapperManager ) */
@ Override public Object toJdbc ( final OptionalDouble original , final Connection connection , final BindParameterMapperManager parameterMapperManager ) { } } | return original . isPresent ( ) ? original . getAsDouble ( ) : null ; |
public class IO { /** * Writes a long value to a series of bytes . The values are written using
* < a href = " http : / / lucene . apache . org / core / 3_5_0 / fileformats . html # VInt " > variable - length < / a >
* < a href = " https : / / developers . google . com / protocol - buffers / docs / encoding ? csw = 1 # types " > zig - zag < / a >
* coding . Each { @ code long } value is written in 1 to 10 bytes .
* @ see # readLong ( DataInput )
* @ param value the long value to write
* @ param out the data output the integer value is written to
* @ throws NullPointerException if the given data output is { @ code null }
* @ throws IOException if an I / O error occurs */
static void writeLong ( final long value , final DataOutput out ) throws IOException { } } | // Zig - zag encoding .
long n = ( value << 1 ) ^ ( value >> 63 ) ; if ( ( n & ~ 0x7FL ) != 0 ) { out . write ( ( byte ) ( ( n | 0x80 ) & 0xFF ) ) ; n >>>= 7 ; if ( n > 0x7F ) { out . write ( ( byte ) ( ( n | 0x80 ) & 0xFF ) ) ; n >>>= 7 ; if ( n > 0x7F ) { out . write ( ( byte ) ( ( n | 0x80 ) & 0xFF ) ) ; n >>>= 7 ; if ( n > 0x7F ) { out . write ( ( byte ) ( ( n | 0x80 ) & 0xFF ) ) ; n >>>= 7 ; if ( n > 0x7F ) { out . write ( ( byte ) ( ( n | 0x80 ) & 0xFF ) ) ; n >>>= 7 ; if ( n > 0x7F ) { out . write ( ( byte ) ( ( n | 0x80 ) & 0xFF ) ) ; n >>>= 7 ; if ( n > 0x7F ) { out . write ( ( byte ) ( ( n | 0x80 ) & 0xFF ) ) ; n >>>= 7 ; if ( n > 0x7F ) { out . write ( ( byte ) ( ( n | 0x80 ) & 0xFF ) ) ; n >>>= 7 ; if ( n > 0x7F ) { out . write ( ( byte ) ( ( n | 0x80 ) & 0xFF ) ) ; n >>>= 7 ; } } } } } } } } } out . write ( ( byte ) n ) ; |
public class PolyBind { /** * Sets up a " choice " for the injector to resolve at injection time .
* @ param binder the binder for the injector that is being configured
* @ param property the property that will be checked to determine the implementation choice
* @ param interfaceKey the interface that will be injected using this choice
* @ param defaultKey the default instance to be injected if the property doesn ' t match a choice . Can be null
* @ param < T > interface type
* @ return A ScopedBindingBuilder so that scopes can be added to the binding , if required . */
public static < T > ScopedBindingBuilder createChoice ( Binder binder , String property , Key < T > interfaceKey , @ Nullable Key < ? extends T > defaultKey ) { } } | ConfiggedProvider < T > provider = new ConfiggedProvider < > ( interfaceKey , property , defaultKey , null ) ; return binder . bind ( interfaceKey ) . toProvider ( provider ) ; |
public class Parser { /** * 12.11 The switch Statement */
private ParseTree parseSwitchStatement ( ) { } } | SourcePosition start = getTreeStartLocation ( ) ; eat ( TokenType . SWITCH ) ; eat ( TokenType . OPEN_PAREN ) ; ParseTree expression = parseExpression ( ) ; eat ( TokenType . CLOSE_PAREN ) ; eat ( TokenType . OPEN_CURLY ) ; ImmutableList < ParseTree > caseClauses = parseCaseClauses ( ) ; eat ( TokenType . CLOSE_CURLY ) ; return new SwitchStatementTree ( getTreeLocation ( start ) , expression , caseClauses ) ; |
public class PlaceConfig { /** * Create the controller that should be used for this place . */
public PlaceController createController ( ) { } } | Class < ? > cclass = getControllerClass ( ) ; if ( cclass == null ) { throw new RuntimeException ( "PlaceConfig.createController() must be overridden." ) ; } log . warning ( "Providing backwards compatibility. PlaceConfig." + "createController() should be overridden directly." ) ; try { return ( PlaceController ) cclass . newInstance ( ) ; } catch ( Exception e ) { log . warning ( "Failed to instantiate controller class '" + cclass + "'." , e ) ; return null ; } |
public class AbstractAuditEventMessageImpl { /** * Create and add an Audit Source Identification block to this audit event message
* @ param sourceID The Audit Source ID
* @ param enterpriseSiteID The Audit Enterprise Site ID
* @ param typeCodes The Audit Source Type Codes
* @ return The Audit Source Identification block created
* @ deprecated use { @ link # addAuditSourceIdentification ( String , String , RFC3881AuditSourceTypes . . . ) } */
protected AuditSourceIdentificationType addAuditSourceIdentification ( String sourceID , String enterpriseSiteID , RFC3881AuditSourceTypeCodes ... typeCodes ) { } } | AuditSourceIdentificationType sourceBlock = new AuditSourceIdentificationType ( ) ; if ( ! EventUtils . isEmptyOrNull ( typeCodes , true ) ) { sourceBlock . setAuditSourceTypeCode ( typeCodes [ 0 ] ) ; } sourceBlock . setAuditSourceID ( sourceID ) ; sourceBlock . setAuditEnterpriseSiteID ( enterpriseSiteID ) ; getAuditMessage ( ) . getAuditSourceIdentification ( ) . add ( sourceBlock ) ; return sourceBlock ; |
public class BigDecimal { /** * Returns a { @ code BigDecimal } whose value is the integer part
* of { @ code ( this / divisor ) } . Since the integer part of the
* exact quotient does not depend on the rounding mode , the
* rounding mode does not affect the values returned by this
* method . The preferred scale of the result is
* { @ code ( this . scale ( ) - divisor . scale ( ) ) } . An
* { @ code ArithmeticException } is thrown if the integer part of
* the exact quotient needs more than { @ code mc . precision }
* digits .
* @ param divisor value by which this { @ code BigDecimal } is to be divided .
* @ param mc the context to use .
* @ return The integer part of { @ code this / divisor } .
* @ throws ArithmeticException if { @ code divisor = = 0}
* @ throws ArithmeticException if { @ code mc . precision } { @ literal > } 0 and the result
* requires a precision of more than { @ code mc . precision } digits .
* @ since 1.5
* @ author Joseph D . Darcy */
public BigDecimal divideToIntegralValue ( BigDecimal divisor , MathContext mc ) { } } | if ( mc . precision == 0 || // exact result
( this . compareMagnitude ( divisor ) < 0 ) ) // zero result
return divideToIntegralValue ( divisor ) ; // Calculate preferred scale
int preferredScale = saturateLong ( ( long ) this . scale - divisor . scale ) ; /* * Perform a normal divide to mc . precision digits . If the
* remainder has absolute value less than the divisor , the
* integer portion of the quotient fits into mc . precision
* digits . Next , remove any fractional digits from the
* quotient and adjust the scale to the preferred value . */
BigDecimal result = this . divide ( divisor , new MathContext ( mc . precision , RoundingMode . DOWN ) ) ; if ( result . scale ( ) < 0 ) { /* * Result is an integer . See if quotient represents the
* full integer portion of the exact quotient ; if it does ,
* the computed remainder will be less than the divisor . */
BigDecimal product = result . multiply ( divisor ) ; // If the quotient is the full integer value ,
// | dividend - product | < | divisor | .
if ( this . subtract ( product ) . compareMagnitude ( divisor ) >= 0 ) { throw new ArithmeticException ( "Division impossible" ) ; } } else if ( result . scale ( ) > 0 ) { /* * Integer portion of quotient will fit into precision
* digits ; recompute quotient to scale 0 to avoid double
* rounding and then try to adjust , if necessary . */
result = result . setScale ( 0 , RoundingMode . DOWN ) ; } // else result . scale ( ) = = 0;
int precisionDiff ; if ( ( preferredScale > result . scale ( ) ) && ( precisionDiff = mc . precision - result . precision ( ) ) > 0 ) { return result . setScale ( result . scale ( ) + Math . min ( precisionDiff , preferredScale - result . scale ) ) ; } else { return stripZerosToMatchScale ( result . intVal , result . intCompact , result . scale , preferredScale ) ; } |
public class FacesConfigFlowDefinitionTypeImpl { /** * Returns all < code > method - call < / code > elements
* @ return list of < code > method - call < / code > */
public List < FacesConfigFlowDefinitionFacesMethodCallType < FacesConfigFlowDefinitionType < T > > > getAllMethodCall ( ) { } } | List < FacesConfigFlowDefinitionFacesMethodCallType < FacesConfigFlowDefinitionType < T > > > list = new ArrayList < FacesConfigFlowDefinitionFacesMethodCallType < FacesConfigFlowDefinitionType < T > > > ( ) ; List < Node > nodeList = childNode . get ( "method-call" ) ; for ( Node node : nodeList ) { FacesConfigFlowDefinitionFacesMethodCallType < FacesConfigFlowDefinitionType < T > > type = new FacesConfigFlowDefinitionFacesMethodCallTypeImpl < FacesConfigFlowDefinitionType < T > > ( this , "method-call" , childNode , node ) ; list . add ( type ) ; } return list ; |
public class ParameterizedTypeName { /** * Returns a parameterized type , applying { @ code typeArguments } to { @ code rawType } . */
public static ParameterizedTypeName get ( Class < ? > rawType , Type ... typeArguments ) { } } | return new ParameterizedTypeName ( null , ClassName . get ( rawType ) , list ( typeArguments ) ) ; |
public class OtpErlangList { /** * Convert a list of integers into a Unicode string , interpreting each
* integer as a Unicode code point value .
* @ return A java . lang . String object created through its constructor
* String ( int [ ] , int , int ) .
* @ exception OtpErlangException
* for non - proper and non - integer lists .
* @ exception OtpErlangRangeException
* if any integer does not fit into a Java int .
* @ exception java . security . InvalidParameterException
* if any integer is not within the Unicode range .
* @ see String # String ( int [ ] , int , int ) */
public String stringValue ( ) throws OtpErlangException { } } | if ( ! isProper ( ) ) { throw new OtpErlangException ( "Non-proper list: " + this ) ; } final int [ ] values = new int [ arity ( ) ] ; for ( int i = 0 ; i < values . length ; ++ i ) { final OtpErlangObject o = elementAt ( i ) ; if ( ! ( o instanceof OtpErlangLong ) ) { throw new OtpErlangException ( "Non-integer term: " + o ) ; } final OtpErlangLong l = ( OtpErlangLong ) o ; values [ i ] = l . intValue ( ) ; } return new String ( values , 0 , values . length ) ; |
public class DefaultHistoryManager { /** * ( non - Javadoc )
* @ see org . activiti . engine . impl . history . HistoryManagerInterface # deleteHistoricIdentityLink ( java . lang . String ) */
@ Override public void deleteHistoricIdentityLink ( String id ) { } } | if ( isHistoryLevelAtLeast ( HistoryLevel . AUDIT ) ) { getHistoricIdentityLinkEntityManager ( ) . delete ( id ) ; } |
public class QSufSort { /** * Makes suffix array { @ link # I } of { @ link # V } . < code > V < / code > becomes inverse of
* < code > I < / code > .
* Contents of < code > V [ 0 . . . n - 1 ] < / code > are integers in the range < code > l . . . k - 1 < / code > .
* Original contents of < code > x [ n ] < / code > is disregarded , the < code > n < / code > - th
* symbol being regarded as end - of - string smaller than all other symbols . */
private void suffixsort ( int n , int k , int l ) { } } | int pi , pk ; // I pointers
int i , j , s , sl ; if ( n >= k - l ) { /* if bucketing possible , */
j = transform ( n , k , l , n ) ; bucketsort ( n , j ) ; /* bucketsort on first r positions . */
} else { transform ( n , k , l , Integer . MAX_VALUE ) ; for ( i = 0 ; i <= n ; ++ i ) I [ i ] = i ; /* initialize I with suffix numbers . */
h = 0 ; sort_split ( 0 , n + 1 ) ; /* quicksort on first r positions . */
} h = r ; /* number of symbols aggregated by transform . */
while ( I [ 0 ] >= - n ) { pi = 0 ; /* pi is first position of group . */
sl = 0 ; /* sl is negated length of sorted groups . */
do { if ( ( s = I [ pi ] ) < 0 ) { pi -= s ; /* skip over sorted group . */
sl += s ; /* add negated length to sl . */
} else { if ( sl != 0 ) { I [ pi + sl ] = sl ; /* combine sorted groups before pi . */
sl = 0 ; } pk = V [ start + s ] + 1 ; /* pk - 1 is last position of unsorted group . */
sort_split ( pi , pk - pi ) ; pi = pk ; /* next group . */
} } while ( pi <= n ) ; if ( sl != 0 ) /* if the array ends with a sorted group . */
I [ pi + sl ] = sl ; /* combine sorted groups at end of I . */
h = 2 * h ; /* double sorted - depth . */
} for ( i = 0 ; i <= n ; ++ i ) { /* reconstruct suffix array from inverse . */
if ( V [ start + i ] > 0 ) { I [ V [ start + i ] - 1 ] = i ; } } |
public class AmazonSimpleEmailServiceClient { /** * Sets the position of the specified receipt rule in the receipt rule set .
* For information about managing receipt rules , see the < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / receiving - email - managing - receipt - rules . html " > Amazon
* SES Developer Guide < / a > .
* You can execute this operation no more than once per second .
* @ param setReceiptRulePositionRequest
* Represents a request to set the position of a receipt rule in a receipt rule set . You use receipt rule
* sets to receive email with Amazon SES . For more information , see the < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / receiving - email - concepts . html " > Amazon SES
* Developer Guide < / a > .
* @ return Result of the SetReceiptRulePosition operation returned by the service .
* @ throws RuleSetDoesNotExistException
* Indicates that the provided receipt rule set does not exist .
* @ throws RuleDoesNotExistException
* Indicates that the provided receipt rule does not exist .
* @ sample AmazonSimpleEmailService . SetReceiptRulePosition
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / email - 2010-12-01 / SetReceiptRulePosition " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public SetReceiptRulePositionResult setReceiptRulePosition ( SetReceiptRulePositionRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeSetReceiptRulePosition ( request ) ; |
public class HttpServer { /** * Get a named UserRealm .
* @ param realmName The name of the realm or null .
* @ return The named realm . If the name is null and only a single realm
* is known , that is returned . */
public UserRealm getRealm ( String realmName ) { } } | if ( realmName == null ) { if ( _realmMap . size ( ) == 1 ) return ( UserRealm ) _realmMap . values ( ) . iterator ( ) . next ( ) ; log . warn ( "Null realmName with multiple known realms" ) ; } return ( UserRealm ) _realmMap . get ( realmName ) ; |
public class UICommands { /** * " Shellifies " a name ( that is , makes the name shell - friendly ) by replacing spaces with " - " and removing colons */
public static String shellifyName ( String name ) { } } | return COLONS . matcher ( WHITESPACES . matcher ( name . trim ( ) ) . replaceAll ( "-" ) ) . replaceAll ( "" ) . toLowerCase ( ) ; |
public class GrailsServletContextResourceReader { /** * ( non - Javadoc )
* @ see
* net . jawr . web . resource . handler . reader . BaseServletContextResourceReader #
* getResource ( net . jawr . web . resource . bundle . JoinableResourceBundle ,
* java . lang . String , boolean ) */
@ Override public Reader getResource ( JoinableResourceBundle bundle , String resourceName , boolean processingBundle ) { } } | Reader rd = null ; String realPath = getRealResourcePath ( resourceName ) ; if ( isFileSystemPath ( resourceName , realPath ) ) { // The resource has been
// remapped
try { rd = new FileReader ( realPath ) ; } catch ( FileNotFoundException e ) { LOGGER . debug ( "The resource " + realPath + " has not been found" ) ; } } if ( rd == null ) { rd = super . getResource ( bundle , realPath , processingBundle ) ; } return rd ; |
public class ActionDeclaration { /** * The name or ID of the artifact consumed by the action , such as a test or build artifact .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setInputArtifacts ( java . util . Collection ) } or { @ link # withInputArtifacts ( java . util . Collection ) } if you want
* to override the existing values .
* @ param inputArtifacts
* The name or ID of the artifact consumed by the action , such as a test or build artifact .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ActionDeclaration withInputArtifacts ( InputArtifact ... inputArtifacts ) { } } | if ( this . inputArtifacts == null ) { setInputArtifacts ( new java . util . ArrayList < InputArtifact > ( inputArtifacts . length ) ) ; } for ( InputArtifact ele : inputArtifacts ) { this . inputArtifacts . add ( ele ) ; } return this ; |
public class Value { /** * Return true if blocking is unnecessary .
* Alas , used in TWO places and the blocking API forces them to share here . */
@ Override public boolean isReleasable ( ) { } } | int r = _rwlock . get ( ) ; if ( _key . home ( ) ) { // Called from lock _ and _ invalidate
// Home - key blocking : wait for active - GET count to fall to zero , or blocking on deleted object
return r <= 0 ; } else { // Called from start _ put
// Remote - key blocking : wait for active - PUT lock to hit - 1
assert r == 2 || r == - 1 ; // Either waiting ( 2 ) or done ( - 1 ) but not started ( 1)
return r == - 1 ; // done !
} |
public class DisableTransitGatewayRouteTablePropagationRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < DisableTransitGatewayRouteTablePropagationRequest > getDryRunRequest ( ) { } } | Request < DisableTransitGatewayRouteTablePropagationRequest > request = new DisableTransitGatewayRouteTablePropagationRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class ApiOvhDedicatedCloud { /** * Configure vpn between your OVH Private Cloud and your onsite infrastructure
* REST : POST / dedicatedCloud / { serviceName } / datacenter / { datacenterId } / disasterRecovery / zertoSingle / configureVpn
* @ param remoteEndpointPublicIp [ required ] Your onsite endpoint public IP for the secured replication data tunnel
* @ param remoteVraNetwork [ required ] Internal zerto subnet of your onsite infrastructure ( ip / cidr )
* @ param remoteZvmInternalIp [ required ] Internal ZVM ip of your onsite infrastructure
* @ param remoteEndpointInternalIp [ required ] Your onsite endpoint internal IP for the secured replication data tunnel
* @ param preSharedKey [ required ] Pre - Shared Key to secure data transfer between both sites
* @ param serviceName [ required ] Domain of the service
* @ param datacenterId [ required ]
* API beta */
public OvhTask serviceName_datacenter_datacenterId_disasterRecovery_zertoSingle_configureVpn_POST ( String serviceName , Long datacenterId , String preSharedKey , String remoteEndpointInternalIp , String remoteEndpointPublicIp , String remoteVraNetwork , String remoteZvmInternalIp ) throws IOException { } } | String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/disasterRecovery/zertoSingle/configureVpn" ; StringBuilder sb = path ( qPath , serviceName , datacenterId ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "preSharedKey" , preSharedKey ) ; addBody ( o , "remoteEndpointInternalIp" , remoteEndpointInternalIp ) ; addBody ( o , "remoteEndpointPublicIp" , remoteEndpointPublicIp ) ; addBody ( o , "remoteVraNetwork" , remoteVraNetwork ) ; addBody ( o , "remoteZvmInternalIp" , remoteZvmInternalIp ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhTask . class ) ; |
public class TranslatableComponent { /** * Creates a translatable component with a translation key and arguments .
* @ param key the translation key
* @ param color the color
* @ param decorations the decorations
* @ param args the translation arguments
* @ return the translatable component */
public static TranslatableComponent of ( final @ NonNull String key , final @ Nullable TextColor color , final @ NonNull Set < TextDecoration > decorations , final @ NonNull Component ... args ) { } } | return of ( key , color , decorations , Arrays . asList ( args ) ) ; |
public class ProjectSummaryMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ProjectSummary projectSummary , ProtocolMarshaller protocolMarshaller ) { } } | if ( projectSummary == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( projectSummary . getArn ( ) , ARN_BINDING ) ; protocolMarshaller . marshall ( projectSummary . getProjectName ( ) , PROJECTNAME_BINDING ) ; protocolMarshaller . marshall ( projectSummary . getCreatedDate ( ) , CREATEDDATE_BINDING ) ; protocolMarshaller . marshall ( projectSummary . getUpdatedDate ( ) , UPDATEDDATE_BINDING ) ; protocolMarshaller . marshall ( projectSummary . getTags ( ) , TAGS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class JobState { /** * Create a new { @ link JobState . DatasetState } based on this { @ link JobState } instance .
* @ param fullCopy whether to do a full copy of this { @ link JobState } instance
* @ return a new { @ link JobState . DatasetState } object */
public DatasetState newDatasetState ( boolean fullCopy ) { } } | DatasetState datasetState = new DatasetState ( this . jobName , this . jobId ) ; datasetState . setStartTime ( this . startTime ) ; datasetState . setEndTime ( this . endTime ) ; datasetState . setDuration ( this . duration ) ; if ( fullCopy ) { datasetState . setState ( this . state ) ; datasetState . setTaskCount ( this . taskCount ) ; datasetState . addTaskStates ( this . taskStates . values ( ) ) ; datasetState . addSkippedTaskStates ( this . skippedTaskStates . values ( ) ) ; } return datasetState ; |
public class AmazonElasticFileSystemClient { /** * Updates the throughput mode or the amount of provisioned throughput of an existing file system .
* @ param updateFileSystemRequest
* @ return Result of the UpdateFileSystem operation returned by the service .
* @ throws BadRequestException
* Returned if the request is malformed or contains an error such as an invalid parameter value or a missing
* required parameter .
* @ throws FileSystemNotFoundException
* Returned if the specified < code > FileSystemId < / code > value doesn ' t exist in the requester ' s AWS account .
* @ throws IncorrectFileSystemLifeCycleStateException
* Returned if the file system ' s lifecycle state is not " available " .
* @ throws InsufficientThroughputCapacityException
* Returned if there ' s not enough capacity to provision additional throughput . This value might be returned
* when you try to create a file system in provisioned throughput mode , when you attempt to increase the
* provisioned throughput of an existing file system , or when you attempt to change an existing file system
* from bursting to provisioned throughput mode .
* @ throws InternalServerErrorException
* Returned if an error occurred on the server side .
* @ throws ThroughputLimitExceededException
* Returned if the throughput mode or amount of provisioned throughput can ' t be changed because the
* throughput limit of 1024 MiB / s has been reached .
* @ throws TooManyRequestsException
* Returned if you don ’ t wait at least 24 hours before changing the throughput mode , or decreasing the
* Provisioned Throughput value .
* @ sample AmazonElasticFileSystem . UpdateFileSystem
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / elasticfilesystem - 2015-02-01 / UpdateFileSystem "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public UpdateFileSystemResult updateFileSystem ( UpdateFileSystemRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateFileSystem ( request ) ; |
public class BatchJob { /** * Gets the progressStats value for this BatchJob .
* @ return progressStats * Statistics related to the progress of this job .
* < span class = " constraint Selectable " > This field can
* be selected using the value " ProgressStats " . < / span >
* < span class = " constraint ReadOnly " > This field is read
* only and will be ignored when sent to the API . < / span > */
public com . google . api . ads . adwords . axis . v201809 . cm . ProgressStats getProgressStats ( ) { } } | return progressStats ; |
public class Transition { /** * Offers a way to instantiate a transition without specifying an action but
* only the origin and destination states .
* @ param fromState state origin of the transition
* @ param toState state destination of the transition
* @ param < S > type of the state
* @ return instance of a transition with an origin and destination , but without an action */
public static < S > Transition < Void , S > create ( S fromState , S toState ) { } } | return new Transition < Void , S > ( fromState , null , toState ) ; |
public class MtasSpanUniquePositionSpans { /** * Reset queue . */
void resetQueue ( ) { } } | queueSpans . clear ( ) ; queueMatches . clear ( ) ; lastStartPosition = 0 ; lastSpan = false ; currentMatch = null ; |
public class A_CmsCmisRepository { /** * Copies a range of bytes from an array into a new array . < p >
* @ param content the content array
* @ param offset the start offset in the array
* @ param length the length of the range
* @ return the bytes from the given range of the content */
protected byte [ ] extractRange ( byte [ ] content , BigInteger offset , BigInteger length ) { } } | if ( ( offset == null ) && ( length == null ) ) { return content ; } if ( offset == null ) { offset = BigInteger . ZERO ; } long offsetLong = offset . longValue ( ) ; if ( length == null ) { length = BigInteger . valueOf ( content . length - offsetLong ) ; } long lengthLong = length . longValue ( ) ; return Arrays . copyOfRange ( content , ( int ) offsetLong , Math . min ( content . length , ( int ) ( offsetLong + lengthLong ) ) ) ; |
public class Interval { /** * Returns a new interval based on this interval but with a different end
* time .
* @ param time the new end time
* @ return a new interval */
public Interval withEndTime ( LocalTime time ) { } } | requireNonNull ( time ) ; return new Interval ( startDate , startTime , endDate , time , zoneId ) ; |
public class ZipFileContainer { /** * Tell if an entry is modified relative to a file . That is if
* the last modified times are different .
* File last update times are accurate to about a second . Allow
* the last modified times to match if they are that close .
* @ param entry The entry to test .
* @ param file The file to test .
* @ return True or false telling if the last modified times of the
* file and entry are different . */
private boolean isModified ( ArtifactEntry entry , File file ) { } } | long fileLastModified = FileUtils . fileLastModified ( file ) ; long entryLastModified = entry . getLastModified ( ) ; // File 100K entry 10K delta 90k true ( entry is much older than the file )
// File 10k entry 100k delta 90k true ( file is much older than the entry )
// File 10k entry 9k delta 1k false ( entry is slightly older than the file )
// File 9k entry 10k delta 1k false ( file is slightly older than the entry )
// File 9k entry 9k delta 0k false ( file and entry are exactly the same age )
return ( Math . abs ( fileLastModified - entryLastModified ) >= 1010L ) ; |
public class OtpInputStream { /** * Read an Erlang PID from the stream .
* @ return the value of the PID .
* @ exception OtpErlangDecodeException
* if the next term in the stream is not an Erlang PID . */
public OtpErlangPid read_pid ( ) throws OtpErlangDecodeException { } } | String node ; int id ; int serial ; int creation ; int tag ; tag = read1skip_version ( ) ; if ( tag != OtpExternal . pidTag && tag != OtpExternal . newPidTag ) { throw new OtpErlangDecodeException ( "Wrong tag encountered, expected " + OtpExternal . pidTag + " or " + OtpExternal . newPidTag + ", got " + tag ) ; } node = read_atom ( ) ; id = read4BE ( ) ; serial = read4BE ( ) ; if ( tag == OtpExternal . pidTag ) creation = read1 ( ) ; else creation = read4BE ( ) ; return new OtpErlangPid ( tag , node , id , serial , creation ) ; |
public class APNSMessage { /** * The data payload used for a silent push . This payload is added to the notifications ' data . pinpoint . jsonBody '
* object
* @ param data
* The data payload used for a silent push . This payload is added to the notifications '
* data . pinpoint . jsonBody ' object
* @ return Returns a reference to this object so that method calls can be chained together . */
public APNSMessage withData ( java . util . Map < String , String > data ) { } } | setData ( data ) ; return this ; |
public class WsLogger { /** * @ see java . util . logging . Logger # entering ( java . lang . String ,
* java . lang . String , java . lang . Object [ ] ) */
@ Override public void entering ( String sourceClass , String sourceMethod , Object params [ ] ) { } } | if ( isLoggable ( Level . FINER ) ) { String msg = "ENTRY" ; if ( params != null ) { StringBuilder sb = new StringBuilder ( msg ) ; for ( int i = 0 ; i < params . length ; i ++ ) { sb . append ( " {" ) . append ( i ) . append ( "}" ) ; } msg = sb . toString ( ) ; } logp ( Level . FINER , sourceClass , sourceMethod , msg , params ) ; } |
public class SQLiteConnectionPool { /** * Reconfigures the database configuration of the connection pool and all of its
* connections .
* Configuration changes are propagated down to connections immediately if
* they are available or as soon as they are released . This includes changes
* that affect the size of the pool .
* @ param configuration The new configuration .
* @ throws IllegalStateException if the pool has been closed . */
public void reconfigure ( SQLiteDatabaseConfiguration configuration ) { } } | if ( configuration == null ) { throw new IllegalArgumentException ( "configuration must not be null." ) ; } synchronized ( mLock ) { throwIfClosedLocked ( ) ; boolean walModeChanged = ( ( configuration . openFlags ^ mConfiguration . openFlags ) & SQLiteDatabase . ENABLE_WRITE_AHEAD_LOGGING ) != 0 ; if ( walModeChanged ) { // WAL mode can only be changed if there are no acquired connections
// because we need to close all but the primary connection first .
if ( ! mAcquiredConnections . isEmpty ( ) ) { throw new IllegalStateException ( "Write Ahead Logging (WAL) mode cannot " + "be enabled or disabled while there are transactions in " + "progress. Finish all transactions and release all active " + "database connections first." ) ; } // Close all non - primary connections . This should happen immediately
// because none of them are in use .
closeAvailableNonPrimaryConnectionsAndLogExceptionsLocked ( ) ; assert mAvailableNonPrimaryConnections . isEmpty ( ) ; } boolean foreignKeyModeChanged = configuration . foreignKeyConstraintsEnabled != mConfiguration . foreignKeyConstraintsEnabled ; if ( foreignKeyModeChanged ) { // Foreign key constraints can only be changed if there are no transactions
// in progress . To make this clear , we throw an exception if there are
// any acquired connections .
if ( ! mAcquiredConnections . isEmpty ( ) ) { throw new IllegalStateException ( "Foreign Key Constraints cannot " + "be enabled or disabled while there are transactions in " + "progress. Finish all transactions and release all active " + "database connections first." ) ; } } if ( mConfiguration . openFlags != configuration . openFlags ) { // If we are changing open flags and WAL mode at the same time , then
// we have no choice but to close the primary connection beforehand
// because there can only be one connection open when we change WAL mode .
if ( walModeChanged ) { closeAvailableConnectionsAndLogExceptionsLocked ( ) ; } // Try to reopen the primary connection using the new open flags then
// close and discard all existing connections .
// This might throw if the database is corrupt or cannot be opened in
// the new mode in which case existing connections will remain untouched .
SQLiteConnection newPrimaryConnection = openConnectionLocked ( configuration , true /* primaryConnection */
) ; // might throw
closeAvailableConnectionsAndLogExceptionsLocked ( ) ; discardAcquiredConnectionsLocked ( ) ; mAvailablePrimaryConnection = newPrimaryConnection ; mConfiguration . updateParametersFrom ( configuration ) ; setMaxConnectionPoolSizeLocked ( ) ; } else { // Reconfigure the database connections in place .
mConfiguration . updateParametersFrom ( configuration ) ; setMaxConnectionPoolSizeLocked ( ) ; closeExcessConnectionsAndLogExceptionsLocked ( ) ; reconfigureAllConnectionsLocked ( ) ; } wakeConnectionWaitersLocked ( ) ; } |
public class ServerService { /** * Remove public IP from server
* @ param serverRef server reference
* @ param ipAddress existing public IP address
* @ return OperationFuture wrapper for ServerRef */
public OperationFuture < Server > removePublicIp ( Server serverRef , String ipAddress ) { } } | checkNotNull ( ipAddress , "ipAddress must be not null" ) ; Link response = client . removePublicIp ( idByRef ( serverRef ) , ipAddress ) ; return new OperationFuture < > ( serverRef , response . getId ( ) , queueClient ) ; |
public class Rows { /** * Load and cache a set of primary key column names given a table key
* ( i . e . catalog , schema and table name ) . The result cannot be considered
* authoritative as since it depends on whether the JDBC driver property
* implements { @ link java . sql . ResultSetMetaData # getTableName } and many
* drivers / databases do not .
* @ param tableKey A key ( containing catalog , schema and table names ) into
* the table primary key cache . Must not be null .
* @ return A set of primary key column names . May be empty but will
* never be null . */
private Set < String > loadAndCachePrimaryKeysForTable ( TableKey tableKey ) { } } | Set < String > primaryKeys = new HashSet < > ( ) ; try { ResultSet pks = sqlLine . getDatabaseConnection ( ) . meta . getPrimaryKeys ( tableKey . catalog , tableKey . schema , tableKey . table ) ; try { while ( pks . next ( ) ) { primaryKeys . add ( pks . getString ( "COLUMN_NAME" ) ) ; } } finally { pks . close ( ) ; } } catch ( SQLException e ) { // Ignore exception and proceed with the current state ( possibly empty )
// of the primaryKey set .
} tablePrimaryKeysCache . put ( tableKey , primaryKeys ) ; return primaryKeys ; |
public class ServletRequestHeaderPhrase { /** * { @ inheritDoc } */
public Object evaluate ( TaskRequest req , TaskResponse res ) { } } | HttpServletRequest hreq = ( HttpServletRequest ) source . evaluate ( req , res ) ; String headerName = ( String ) header_name . evaluate ( req , res ) ; return hreq . getHeader ( headerName ) ; |
public class GaussianGmm_F64 { /** * Helper function for computing Gaussian parameters . Adds the difference between point and mean to covariance ,
* adjusted by the weight . */
public void addCovariance ( double [ ] difference , double responsibility ) { } } | int N = mean . numRows ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i ; j < N ; j ++ ) { covariance . data [ i * N + j ] += responsibility * difference [ i ] * difference [ j ] ; } } for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < i ; j ++ ) { covariance . data [ i * N + j ] = covariance . data [ j * N + i ] ; } } |
public class BaseConfigFileService { /** * Returns the Config in a format suitable for revealing to users .
* @ return A ConfigResponse of the current config . Passwords will be encrypted and the default login wil be removed . */
@ Override public ConfigResponse < T > getConfigResponse ( ) { } } | T config = this . config . get ( ) ; config = withoutDefaultLogin ( config ) ; if ( config instanceof PasswordsConfig < ? > ) { config = ( ( PasswordsConfig < T > ) config ) . withoutPasswords ( ) ; } return new ConfigResponse < > ( config , getConfigFileLocation ( ) , configFileLocation ) ; |
public class AbstractTTTLearner { /** * Finalize a discriminator . Given a block root and a { @ link Splitter } , replace the discriminator at the block root
* by the one derived from the splitter , and update the discrimination tree accordingly .
* @ param blockRoot
* the block root whose discriminator to finalize
* @ param splitter
* the splitter to use for finalization */
private void finalizeDiscriminator ( AbstractBaseDTNode < I , D > blockRoot , Splitter < I , D > splitter ) { } } | assert blockRoot . isBlockRoot ( ) ; notifyPreFinalizeDiscriminator ( blockRoot , splitter ) ; Word < I > succDiscr = splitter . getDiscriminator ( ) . prepend ( alphabet . getSymbol ( splitter . symbolIdx ) ) ; if ( ! blockRoot . getDiscriminator ( ) . equals ( succDiscr ) ) { Word < I > finalDiscriminator = prepareSplit ( blockRoot , splitter ) ; Map < D , AbstractBaseDTNode < I , D > > repChildren = createMap ( ) ; for ( D label : blockRoot . getSplitData ( ) . getLabels ( ) ) { repChildren . put ( label , extractSubtree ( blockRoot , label ) ) ; } blockRoot . replaceChildren ( repChildren ) ; blockRoot . setDiscriminator ( finalDiscriminator ) ; } declareFinal ( blockRoot ) ; notifyPostFinalizeDiscriminator ( blockRoot , splitter ) ; |
public class QueueListener { /** * { @ inheritDoc }
* @ since 2.5RC1 */
@ Override public void beginLink ( ResourceReference reference , boolean freestanding , Map < String , String > parameters ) { } } | saveEvent ( EventType . BEGIN_LINK , reference , freestanding , parameters ) ; |
public class JDlgDBConnection { /** * Performs a show ( ) , blocks until the
* dialog is disposed and returns the connection . If no valid connection is
* established , null is returned . */
public java . sql . Connection showAndReturnConnection ( ) { } } | show ( ) ; while ( ! this . isDisposed ) { try { synchronized ( this ) { wait ( ) ; } } catch ( Throwable t ) { } } return theConnection ; |
public class Results { /** * Indicate if result contain result - set that is still streaming from server .
* @ param protocol current protocol
* @ return true if streaming is finished */
public boolean isFullyLoaded ( Protocol protocol ) { } } | if ( fetchSize == 0 || resultSet == null ) { return true ; } return resultSet . isFullyLoaded ( ) && executionResults . isEmpty ( ) && ! protocol . hasMoreResults ( ) ; |
public class CmsFadeAnimation { /** * Fades the given element into view executing the callback afterwards . < p >
* @ param element the element to fade in
* @ param callback the callback
* @ param duration the animation duration
* @ return the running animation object */
public static CmsFadeAnimation fadeIn ( Element element , Command callback , int duration ) { } } | CmsFadeAnimation animation = new CmsFadeAnimation ( element , true , callback ) ; animation . run ( duration ) ; return animation ; |
public class ReadResultEntryBase { /** * Fails the Future of this ReadResultEntry with the given exception .
* @ param exception The exception to set . */
protected void fail ( Throwable exception ) { } } | Preconditions . checkState ( ! this . contents . isDone ( ) , "ReadResultEntry has already had its result set." ) ; this . contents . completeExceptionally ( exception ) ; |
public class YearMonth { /** * Returns a copy of this year - month with the specified chronology .
* This instance is immutable and unaffected by this method call .
* This method retains the values of the fields , thus the result will
* typically refer to a different instant .
* The time zone of the specified chronology is ignored , as YearMonth
* operates without a time zone .
* @ param newChronology the new chronology , null means ISO
* @ return a copy of this year - month with a different chronology , never null
* @ throws IllegalArgumentException if the values are invalid for the new chronology */
public YearMonth withChronologyRetainFields ( Chronology newChronology ) { } } | newChronology = DateTimeUtils . getChronology ( newChronology ) ; newChronology = newChronology . withUTC ( ) ; if ( newChronology == getChronology ( ) ) { return this ; } else { YearMonth newYearMonth = new YearMonth ( this , newChronology ) ; newChronology . validate ( newYearMonth , getValues ( ) ) ; return newYearMonth ; } |
public class XMLRoadUtil { /** * Read a road from the XML description .
* @ param element is the XML node to read .
* @ param pathBuilder is the tool to make paths absolute .
* @ param resources is the tool that permits to gather the resources .
* @ return the road .
* @ throws IOException in case of error . */
public static RoadPolyline readRoadPolyline ( Element element , PathBuilder pathBuilder , XMLResources resources ) throws IOException { } } | return readMapElement ( element , NODE_POLYLINE , RoadPolyline . class , pathBuilder , resources ) ; |
public class MethodExpressionValidator { /** * - - - - - StateHolder Methods */
public Object saveState ( FacesContext context ) { } } | if ( context == null ) { throw new NullPointerException ( ) ; } Object values [ ] = new Object [ 1 ] ; values [ 0 ] = methodExpression ; return ( values ) ; |
public class MemoryMapArchiveBase { /** * { @ inheritDoc }
* @ see org . jboss . shrinkwrap . api . Archive # get ( org . jboss . shrinkwrap . api . ArchivePath ) */
@ Override public Node get ( ArchivePath path ) { } } | Validate . notNull ( path , "No path was specified" ) ; Node node = content . get ( path ) ; if ( node == null && contains ( path ) ) { node = getNestedNode ( path ) ; } return node ; |
public class CmsXmlContainerPage { /** * Saves a container page bean to the in - memory XML structure and returns the changed content . < p >
* @ param cms the current CMS context
* @ param cntPage the container page bean
* @ return the new content for the container page
* @ throws CmsException if something goes wrong */
public byte [ ] createContainerPageXml ( CmsObject cms , CmsContainerPageBean cntPage ) throws CmsException { } } | // make sure all links are validated
writeContainerPage ( cms , cntPage ) ; checkLinkConcistency ( cms ) ; return marshal ( ) ; |
public class HessianProxy { /** * Sends the HTTP request to the Hessian connection . */
protected HessianConnection sendRequest ( String methodName , Object [ ] args ) throws IOException { } } | HessianConnection conn = null ; conn = _factory . getConnectionFactory ( ) . open ( _url ) ; boolean isValid = false ; try { addRequestHeaders ( conn ) ; OutputStream os = null ; try { os = conn . getOutputStream ( ) ; } catch ( Exception e ) { throw new HessianRuntimeException ( e ) ; } if ( log . isLoggable ( Level . FINEST ) ) { PrintWriter dbg = new PrintWriter ( new LogWriter ( log ) ) ; HessianDebugOutputStream dOs = new HessianDebugOutputStream ( os , dbg ) ; dOs . startTop2 ( ) ; os = dOs ; } AbstractHessianOutput out = _factory . getHessianOutput ( os ) ; out . call ( methodName , args ) ; out . flush ( ) ; conn . sendRequest ( ) ; isValid = true ; return conn ; } finally { if ( ! isValid && conn != null ) conn . destroy ( ) ; } |
public class DateUtils { /** * Creates a string value to be entered into an expiration date text field
* without a divider . For instance , ( 1 , 2020 ) = > " 0120 " . It doesn ' t matter if
* the year is two - digit or four . ( 1 , 20 ) = > " 0120 " .
* Note : A four - digit year will be truncated , so ( 1 , 2720 ) = > " 0120 " . If the year
* date is 3 digits , the data will be considered invalid and the empty string will be returned .
* A one - digit date is valid ( represents 2001 , for instance ) .
* @ param month a month of the year , represented as a number between 1 and 12
* @ param year a year number , either in two - digit form or four - digit form
* @ return a length - four string representing the date , or an empty string if input is invalid */
static String createDateStringFromIntegerInput ( @ IntRange ( from = 1 , to = 12 ) int month , @ IntRange ( from = 0 , to = 9999 ) int year ) { } } | String monthString = String . valueOf ( month ) ; if ( monthString . length ( ) == 1 ) { monthString = "0" + monthString ; } String yearString = String . valueOf ( year ) ; // Three - digit years are invalid .
if ( yearString . length ( ) == 3 ) { return "" ; } if ( yearString . length ( ) > 2 ) { yearString = yearString . substring ( yearString . length ( ) - 2 ) ; } else if ( yearString . length ( ) == 1 ) { yearString = "0" + yearString ; } return monthString + yearString ; |
public class PropertiesUtil { /** * Get boolean from properties .
* This method returns { @ code true } iff the parsed value is " true " .
* @ param config Properties
* @ param key key in Properties
* @ param defaultValue default value if value is not set
* @ return default or value of key */
public static boolean getBoolean ( Properties config , String key , boolean defaultValue ) { } } | String val = config . getProperty ( key ) ; if ( val == null ) { return defaultValue ; } else { return Boolean . parseBoolean ( val ) ; } |
public class AbstractMoskitoAspect { /** * Create method / class level accumulators from { @ link Accumulate } annotations .
* @ param producer
* { @ link OnDemandStatsProducer }
* @ param method
* annotated method for method level accumulators or null for class level
* @ param annotations
* { @ link Accumulate } annotations to process */
private void createAccumulators ( final OnDemandStatsProducer < S > producer , final Method method , Accumulate ... annotations ) { } } | for ( final Accumulate annotation : annotations ) if ( annotation != null ) AccumulatorUtil . getInstance ( ) . createAccumulator ( producer , annotation , method ) ; |
public class Alignments { /** * Return true if the specified symbol is a gap symbol .
* @ param symbol symbol
* @ return true if the specified symbol is a gap symbol */
static boolean isGapSymbol ( final Symbol symbol ) { } } | return AlphabetManager . getGapSymbol ( ) . equals ( symbol ) || DNATools . getDNA ( ) . getGapSymbol ( ) . equals ( symbol ) ; |
public class MainFieldHandler { /** * Constructor .
* @ param field The basefield owner of this listener ( usually null and set on setOwner ( ) ) .
* @ param iKeySeq The key area this field accesses . */
public void init ( BaseField field , String keyName ) { } } | super . init ( field ) ; this . keyName = keyName ; m_bInitMove = false ; // DONT respond to these moves !
m_bReadMove = false ; m_bReadOnly = false ; |
public class RealConnection { /** * Does all the work necessary to build a full HTTP or HTTPS connection on a raw socket . */
private void connectSocket ( int connectTimeout , int readTimeout , Call call , EventListener eventListener ) throws IOException { } } | Proxy proxy = route . proxy ( ) ; Address address = route . address ( ) ; rawSocket = proxy . type ( ) == Proxy . Type . DIRECT || proxy . type ( ) == Proxy . Type . HTTP ? address . socketFactory ( ) . createSocket ( ) : new Socket ( proxy ) ; eventListener . connectStart ( call , route . socketAddress ( ) , proxy ) ; rawSocket . setSoTimeout ( readTimeout ) ; try { Platform . get ( ) . connectSocket ( rawSocket , route . socketAddress ( ) , connectTimeout ) ; } catch ( ConnectException e ) { ConnectException ce = new ConnectException ( "Failed to connect to " + route . socketAddress ( ) ) ; ce . initCause ( e ) ; throw ce ; } // The following try / catch block is a pseudo hacky way to get around a crash on Android 7.0
// More details :
// https : / / github . com / square / okhttp / issues / 3245
// https : / / android - review . googlesource . com / # / c / 271775/
try { source = Okio . buffer ( Okio . source ( rawSocket ) ) ; sink = Okio . buffer ( Okio . sink ( rawSocket ) ) ; } catch ( NullPointerException npe ) { if ( NPE_THROW_WITH_NULL . equals ( npe . getMessage ( ) ) ) { throw new IOException ( npe ) ; } } |
public class IsCharSequenceWithSize { /** * Creates a matcher for { @ link java . lang . CharSequence } that matches when the < code > length ( ) < / code > method returns
* a value that satisfies the specified matcher .
* For example :
* < pre > assertThat ( " foo " , hasSize ( equalTo ( 3 ) ) ) < / pre >
* @ param sizeMatcher a matcher for the size of an examined { @ link java . lang . CharSequence }
* @ param < E > the cher sequence type
* @ return the matcher */
@ Factory public static < E extends CharSequence > Matcher < E > hasSize ( Matcher < ? super Integer > sizeMatcher ) { } } | return new IsCharSequenceWithSize < E > ( sizeMatcher ) ; |
public class CookieHelper { /** * Create a cookie that is bound on a certain path within the local web
* server .
* @ param sName
* The cookie name .
* @ param sValue
* The cookie value .
* @ param sPath
* The path the cookie is valid for .
* @ param bExpireWhenBrowserIsClosed
* < code > true < / code > if this is a browser session cookie
* @ return The created cookie object . */
@ Nonnull public static Cookie createCookie ( @ Nonnull final String sName , @ Nullable final String sValue , final String sPath , final boolean bExpireWhenBrowserIsClosed ) { } } | final Cookie aCookie = new Cookie ( sName , sValue ) ; aCookie . setPath ( sPath ) ; if ( bExpireWhenBrowserIsClosed ) aCookie . setMaxAge ( - 1 ) ; else aCookie . setMaxAge ( DEFAULT_MAX_AGE_SECONDS ) ; return aCookie ; |
public class DefaultResponse { /** * Gets header response .
* @ param url the url
* @ param attributes the attributes
* @ return the header response */
public static Response getHeaderResponse ( final String url , final Map < String , String > attributes ) { } } | return new DefaultResponse ( ResponseType . HEADER , url , attributes ) ; |
public class Rank { /** * Set this Entity after the passed in Entity in rank order .
* @ param assetToRankAfter The Entity that will come just before this Entity
* in rank order . */
public void setBelow ( T assetToRankAfter ) { } } | instance . rankBelow ( asset , assetToRankAfter , rankAttribute ) ; asset . save ( ) ; |
public class CmsObject { /** * Notify all event listeners that a particular event has occurred . < p >
* The event will be given to all registered < code > { @ link I _ CmsEventListener } < / code > s . < p >
* @ param type the type of the event
* @ param data a data object that contains data used by the event listeners
* @ see OpenCms # addCmsEventListener ( I _ CmsEventListener )
* @ see OpenCms # addCmsEventListener ( I _ CmsEventListener , int [ ] ) */
private void fireEvent ( int type , Object data ) { } } | OpenCms . fireCmsEvent ( type , Collections . singletonMap ( "data" , data ) ) ; |
public class JacksonConverter { /** * Returns the default mapping for all the possible TupleN
* @ return */
public static SimpleModule getTupleMapperModule ( ) { } } | SimpleModule module = new SimpleModule ( "1" , Version . unknownVersion ( ) ) ; SimpleAbstractTypeResolver resolver = getTupleTypeResolver ( ) ; module . setAbstractTypes ( resolver ) ; module . setKeyDeserializers ( new SimpleKeyDeserializers ( ) ) ; return module ; |
public class StackingComponentEventManager { /** * Send the event .
* @ param event the event to send
* @ param descriptor the event related component descriptor .
* @ param componentManager the event related component manager instance . */
private void sendEvent ( Event event , ComponentDescriptor < ? > descriptor , ComponentManager componentManager ) { } } | if ( this . observationManager != null ) { this . observationManager . notify ( event , componentManager , descriptor ) ; } |
public class CmsLocaleManager { /** * Returns a List of locales from an array of locale names . < p >
* @ param localeNames array of locale names
* @ return a List of locales derived from the given locale names */
public static List < Locale > getLocales ( List < String > localeNames ) { } } | List < Locale > result = new ArrayList < Locale > ( localeNames . size ( ) ) ; for ( int i = 0 ; i < localeNames . size ( ) ; i ++ ) { result . add ( getLocale ( localeNames . get ( i ) . toString ( ) . trim ( ) ) ) ; } return result ; |
public class AbstractDependencyFilenameStrategy { /** * { @ inheritDoc } */
public String getDependencyFileExtension ( Artifact artifact ) { } } | String extension = artifact . getArtifactHandler ( ) . getExtension ( ) ; return extension ; |
public class JsonReader { /** * Parses a JSON document into the supplied builder .
* @ param builderInfo The configuration builder to use when reading .
* @ param json the JSON document . */
public void readJson ( ConfigurationBuilderInfo builderInfo , String json ) { } } | readJson ( builderInfo , "" , Json . read ( json ) ) ; |
public class HashUtils { /** * Hash long .
* @ param digest the digest
* @ param index the number
* @ return the long */
public static long hash ( byte [ ] digest , int index ) { } } | long f = ( ( long ) ( digest [ 3 + index * 4 ] & 0xFF ) << 24 ) | ( ( long ) ( digest [ 2 + index * 4 ] & 0xFF ) << 16 ) | ( ( long ) ( digest [ 1 + index * 4 ] & 0xFF ) << 8 ) | ( digest [ index * 4 ] & 0xFF ) ; return f & 0xFFFFFFFFL ; |
public class JSON { /** * Deserializes a JSON formatted string to a specific class type
* < b > Note : < / b > If you get mapping exceptions you may need to provide a
* TypeReference
* @ param json The string to deserialize
* @ param pojo The class type of the object used for deserialization
* @ return An object of the { @ code pojo } type
* @ throws IllegalArgumentException if the data or class was null or parsing
* failed
* @ throws JSONException if the data could not be parsed */
public static final < T > T parseToObject ( final String json , final Class < T > pojo ) { } } | if ( json == null || json . isEmpty ( ) ) throw new IllegalArgumentException ( "Incoming data was null or empty" ) ; if ( pojo == null ) throw new IllegalArgumentException ( "Missing class type" ) ; try { return jsonMapper . readValue ( json , pojo ) ; } catch ( JsonParseException e ) { throw new IllegalArgumentException ( e ) ; } catch ( JsonMappingException e ) { throw new IllegalArgumentException ( e ) ; } catch ( IOException e ) { throw new JSONException ( e ) ; } |
public class Chat { /** * Sends a message to the other chat participant . The thread ID , recipient ,
* and message type of the message will automatically set to those of this chat .
* @ param message the message to send .
* @ throws NotConnectedException
* @ throws InterruptedException */
public void sendMessage ( Message message ) throws NotConnectedException , InterruptedException { } } | // Force the recipient , message type , and thread ID since the user elected
// to send the message through this chat object .
message . setTo ( participant ) ; message . setType ( Message . Type . chat ) ; message . setThread ( threadID ) ; chatManager . sendMessage ( this , message ) ; |
public class CoverageDataPng { /** * Set the unsigned 16 bit integer pixel value into the image raster
* @ param raster
* image raster
* @ param x
* x coordinate
* @ param y
* y coordinate
* @ param unsignedPixelValue
* unsigned 16 bit integer pixel value */
public void setPixelValue ( WritableRaster raster , int x , int y , int unsignedPixelValue ) { } } | short pixelValue = getPixelValue ( unsignedPixelValue ) ; setPixelValue ( raster , x , y , pixelValue ) ; |
public class DefaultTaskSystem { /** * Gets the shortest path that matches the specification ( breadth - first search )
* @ param input the input format
* @ param output the output format
* @ param locale the locale
* @ param inputs a list of specifications ordered by input format
* @ return returns the shortest path */
static List < TaskGroupInformation > getPathSpecifications ( String input , String output , Map < String , List < TaskGroupInformation > > _inputs ) throws TaskSystemException { } } | // Changed this to an unmodifiable map , just to make sure that it is not modified .
Map < String , List < TaskGroupInformation > > inputs = Collections . unmodifiableMap ( _inputs ) ; // queue roots
List < PathInfo > queue = new ArrayList < > ( ) ; PathInfo . makePaths ( inputs . get ( input ) , Collections . emptyList ( ) , Collections . emptyList ( ) ) . forEachOrdered ( v -> queue . add ( v ) ) ; while ( ! queue . isEmpty ( ) ) { PathInfo current = queue . remove ( 0 ) ; TaskGroupInformation candidate = current . getConvert ( ) ; logger . fine ( "Evaluating " + candidate . getInputType ( ) + " -> " + candidate . getOutputType ( ) ) ; if ( candidate . getOutputType ( ) . getIdentifier ( ) . equals ( output ) ) { List < TaskGroupInformation > ret = new ArrayList < > ( current . getPath ( ) ) ; ret . addAll ( current . getEnhance ( ) ) ; ret . add ( candidate ) ; List < TaskGroupInformation > enhancers = inputs . get ( candidate . getOutputType ( ) . getIdentifier ( ) ) ; if ( enhancers != null ) { ret . addAll ( PathInfo . getEnhancers ( enhancers ) ) ; } return ret ; } else { // add for later evaluation
List < TaskGroupInformation > excl = new ArrayList < > ( current . getExclude ( ) ) ; excl . add ( candidate ) ; List < TaskGroupInformation > x = inputs . get ( candidate . getOutputType ( ) . getIdentifier ( ) ) ; if ( x != null ) { List < TaskGroupInformation > info = new ArrayList < > ( current . getPath ( ) ) ; info . addAll ( current . getEnhance ( ) ) ; info . add ( candidate ) ; PathInfo . makePaths ( x , info , excl ) . forEachOrdered ( v -> queue . add ( v ) ) ; } } } throw new TaskSystemException ( "Cannot find path " + input + "->" + output ) ; |
public class ContentSceneController { /** * Go back to the previous stacked content scene .
* The currently active content scene is popped from the stack and moved to invisible state .
* ( see { @ link ContentScene # hide ( ) } ) . The next content scene in the stack is moved to visible
* state ( see { @ link ContentScene # show ( ) } ) .
* if you continue to run { @ link # goBack } , then each content scene in the stack is popped off to
* reveal the previous one , until the last one is left in the stack . */
public void goBack ( ) { } } | if ( mContentSceneViewStack . size ( ) < 2 ) { return ; } mContentSceneViewStack . pop ( ) ; Log . d ( TAG , "Go back to %s" , mContentSceneViewStack . peek ( ) . getName ( ) ) ; executeHideShowCycle ( mContentSceneViewStack . peek ( ) ) ; |
public class PrintBufferUtil { /** * Appends the prettified multi - line hexadecimal dump of the specified { @ link DirectBuffer } to the specified
* { @ link StringBuilder } that is easy to read by humans , starting at the given { @ code offset } using
* the given { @ code length } .
* @ param dump where should we append string representation of the buffer
* @ param buffer dumped buffer
* @ param offset where should we start to print
* @ param length how much should we print */
public static void appendPrettyHexDump ( final StringBuilder dump , final DirectBuffer buffer , final int offset , final int length ) { } } | HexUtil . appendPrettyHexDump ( dump , buffer , offset , length ) ; |
public class InlineRendition { /** * Builds " native " URL that returns the binary data directly from the repository .
* @ return Media URL */
private String buildNativeMediaUrl ( ) { } } | String path = null ; Resource parentResource = this . resource . getParent ( ) ; if ( JcrBinary . isNtFile ( parentResource ) ) { // if parent resource is nt : file and its node name equals the detected filename , directly use the nt : file node path
if ( StringUtils . equals ( parentResource . getName ( ) , getFileName ( ) ) ) { path = parentResource . getPath ( ) ; } // otherwise use nt : file node path with custom filename
else { path = parentResource . getPath ( ) + "./" + getFileName ( ) ; } } else { // nt : resource node does not have a nt : file parent , use its path directly
path = this . resource . getPath ( ) + "./" + getFileName ( ) ; } // build externalized URL
UrlHandler urlHandler = AdaptTo . notNull ( this . adaptable , UrlHandler . class ) ; return urlHandler . get ( path ) . urlMode ( this . mediaArgs . getUrlMode ( ) ) . buildExternalResourceUrl ( this . resource ) ; |
public class LIBORMarketModelStandard { /** * / * ( non - Javadoc )
* @ see net . finmath . montecarlo . interestrate . LIBORMarketModelInterface # getLiborPeriod ( int ) */
@ Override public double getLiborPeriod ( int timeIndex ) { } } | if ( timeIndex >= liborPeriodDiscretization . getNumberOfTimes ( ) ) { throw new ArrayIndexOutOfBoundsException ( "Index for LIBOR period discretization out of bounds." ) ; } return liborPeriodDiscretization . getTime ( timeIndex ) ; |
public class Strings { /** * Gets the substring before the first occurrence of a separator . The separator is not returned .
* A { @ code null } string input will return { @ code null } . An empty ( " " ) string input will return
* the empty string . A { @ code null } separator will return the input string .
* If nothing is found , the string input is returned .
* < pre >
* substringBefore ( null , * ) = null
* substringBefore ( " " , * ) = " "
* substringBefore ( " abc " , " a " ) = " "
* substringBefore ( " abcba " , " b " ) = " a "
* substringBefore ( " abc " , " c " ) = " ab "
* substringBefore ( " abc " , " d " ) = " abc "
* substringBefore ( " abc " , " " ) = " "
* substringBefore ( " abc " , null ) = " abc "
* < / pre >
* @ param str the String to get a substring from , may be null
* @ param separator the String to search for , may be null
* @ return the substring before the first occurrence of the separator , { @ code null } if null String
* input
* @ since 2.0 */
public static String substringBefore ( String str , String separator ) { } } | if ( isEmpty ( str ) || separator == null ) { return str ; } if ( separator . length ( ) == 0 ) { return Empty ; } int pos = str . indexOf ( separator ) ; if ( pos == Index_not_found ) { return str ; } return str . substring ( 0 , pos ) ; |
public class SortpomPiScanner { /** * Scan and verifies the pom file for processing instructions */
public void scan ( String originalXml ) { } } | Matcher matcher = INSTRUCTION_PATTERN . matcher ( originalXml ) ; while ( matcher . find ( ) ) { scanOneInstruction ( matcher . group ( 1 ) ) ; containsIgnoredSections = true ; } if ( expectedNextInstruction != IGNORE ) { addError ( String . format ( "Xml processing instructions for sortpom was not properly terminated. Every <?sortpom %s?> must be followed with <?sortpom %s?>" , IGNORE , RESUME ) ) ; } |
public class Clock { /** * Defines if the areas should be drawn in the clock .
* @ param VISIBLE */
public void setAreasVisible ( final boolean VISIBLE ) { } } | if ( null == areasVisible ) { _areasVisible = VISIBLE ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { areasVisible . set ( VISIBLE ) ; } |
public class PEP { /** * Function to try and obtain a handler using the name of the current SOAP
* service and operation .
* @ param opName
* the name of the operation
* @ return OperationHandler to handle the operation */
private OperationHandler getHandler ( String serviceName , String operationName ) { } } | if ( serviceName == null ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Service Name was null!" ) ; } return null ; } if ( operationName == null ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Operation Name was null!" ) ; } return null ; } Map < String , OperationHandler > handlers = m_serviceHandlers . get ( serviceName ) ; if ( handlers == null ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "No Service Handlers found for: " + serviceName ) ; } return null ; } OperationHandler handler = handlers . get ( operationName ) ; if ( handler == null ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Handler not found for: " + serviceName + "/" + operationName ) ; } } return handler ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.