signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class UpgradableLock { /** * Attempt to acquire an upgrade lock , waiting a maximum amount of time .
* @ param locker object trying to become lock owner
* @ return true if acquired */
public final boolean tryLockForUpgrade ( L locker , long timeout , TimeUnit unit ) throws InterruptedException { } } | return tryLockForUpgrade_ ( locker , timeout , unit ) != Result . FAILED ; |
public class ByteCodeMachine { /** * USE _ INFINITE _ REPEAT _ MONOMANIAC _ MEM _ STATUS _ CHECK */
private void opNullCheckEndMemST ( ) { } } | int mem = code [ ip ++ ] ; /* mem : null check id */
int isNull = nullCheckMemSt ( mem , s ) ; if ( isNull != 0 ) { if ( Config . DEBUG_MATCH ) { Config . log . println ( "NULL_CHECK_END_MEMST: skip id:" + mem + ", s:" + s ) ; } if ( isNull == - 1 ) { opFail ( ) ; return ; } nullCheckFound ( ) ; } |
public class ProposalLineItem { /** * Gets the rateCardPricingModel value for this ProposalLineItem .
* @ return rateCardPricingModel * { @ link RateCard } pricing model for the { @ link ProposalLineItem } .
* When the pricing model is
* { @ link PricingModel # NET } refer to the { @ link netCost }
* and { @ link netRate } fields . When the
* pricing model is { @ link PricingModel # GROSS } refer
* to the { @ link grossCost } and
* { @ link grossRate } fields .
* < span class = " constraint Applicable " > This attribute
* is applicable when : < ul > < li > using programmatic guaranteed , using sales
* management . < / li > < li > not using programmatic , using sales management . < / li > < / ul > < / span >
* < span class = " constraint ReadOnly " > This attribute is read - only when : < ul > < li > using
* programmatic guaranteed , using sales management . < / li > < li > not using
* programmatic , using sales management . < / li > < / ul > < / span > */
public com . google . api . ads . admanager . axis . v201808 . PricingModel getRateCardPricingModel ( ) { } } | return rateCardPricingModel ; |
public class VirtualMachinesInner { /** * Retrieves information about the run - time state of a virtual machine .
* @ param resourceGroupName The name of the resource group .
* @ param vmName The name of the virtual machine .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the VirtualMachineInstanceViewInner object */
public Observable < VirtualMachineInstanceViewInner > instanceViewAsync ( String resourceGroupName , String vmName ) { } } | return instanceViewWithServiceResponseAsync ( resourceGroupName , vmName ) . map ( new Func1 < ServiceResponse < VirtualMachineInstanceViewInner > , VirtualMachineInstanceViewInner > ( ) { @ Override public VirtualMachineInstanceViewInner call ( ServiceResponse < VirtualMachineInstanceViewInner > response ) { return response . body ( ) ; } } ) ; |
public class ClasspathPath { /** * Returns a read stream for a GET request . */
@ Override public StreamImpl openReadImpl ( ) throws IOException { } } | ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( loader == null ) { loader = ClassLoader . getSystemClassLoader ( ) ; } InputStream is = loader . getResourceAsStream ( getTrimPath ( ) ) ; if ( is == null ) { throw new FileNotFoundException ( getURL ( ) ) ; } return new VfsStreamOld ( is , null ) ; |
public class FileAwareInputStreamDataWriter { /** * The method makes sure it always grants execute permissions for an owner if the < code > file < / code > passed is a
* directory . The publisher needs it to publish it to the final directory and list files under this directory . */
private static OwnerAndPermission addExecutePermissionsIfRequired ( FileStatus file , OwnerAndPermission ownerAndPermission ) { } } | if ( ownerAndPermission . getFsPermission ( ) == null ) { return ownerAndPermission ; } if ( ! file . isDir ( ) ) { return ownerAndPermission ; } return new OwnerAndPermission ( ownerAndPermission . getOwner ( ) , ownerAndPermission . getGroup ( ) , addExecutePermissionToOwner ( ownerAndPermission . getFsPermission ( ) ) ) ; |
public class ELSupport { /** * Convert an object to Boolean .
* Null and empty string are false .
* @ param ctx the context in which this conversion is taking place
* @ param obj the object to convert
* @ return the Boolean value of the object
* @ throws ELException if object is not Boolean or String */
public static final Boolean coerceToBoolean ( final ELContext ctx , final Object obj ) { } } | // previous el 2.2 implementation returned false if obj is null
// so pass in true for primitive to force the same behavior
return coerceToBoolean ( ctx , obj , true ) ; |
public class AutoTieWrapper { /** * Called whenever the appropriate interval has passed and the stats should be updated . */
public void update ( ) { } } | if ( tieable . isActivated ( ) ) { return ; } for ( IStats s : producer . getStats ( ) ) { if ( s . getName ( ) . equals ( tieable . getTargetStatName ( ) ) ) { tieable . tieToStats ( s ) ; tieable . update ( ) ; return ; } } |
public class CassandraDaemon { /** * Stop the daemon , ideally in an idempotent manner .
* Hook for JSVC / Procrun */
public void stop ( ) { } } | // On linux , this doesn ' t entirely shut down Cassandra , just the RPC server .
// jsvc takes care of taking the rest down
logger . info ( "Cassandra shutting down..." ) ; thriftServer . stop ( ) ; nativeServer . stop ( ) ; // On windows , we need to stop the entire system as prunsrv doesn ' t have the jsvc hooks
// We rely on the shutdown hook to drain the node
if ( FBUtilities . isWindows ( ) ) System . exit ( 0 ) ; if ( jmxServer != null ) { try { jmxServer . stop ( ) ; } catch ( IOException e ) { logger . error ( "Error shutting down local JMX server: " , e ) ; } } |
public class SendMailAction { /** * The operation sends a smtp email .
* @ param hostname The hostname or ip address of the smtp server .
* @ param port The port of the smtp service .
* @ param htmlEmail The value should be true if the email is in rich text / html format .
* The value should be false if the email is in plain text format .
* Valid values : true , false . Default value : true .
* @ param from From email address .
* @ param to A delimiter separated list of email address ( es ) or recipients where the email will be sent .
* @ param cc A delimiter separated list of email address ( es ) or recipients , to be placed in the CC .
* @ param bcc A delimiter separated list of email address ( es ) or recipients , to be placed in the BCC .
* @ param subject The email subject . If a subject spans on multiple lines , it is formatted to a single one .
* @ param body The body of the email .
* @ param readReceipt The value should be true if read receipt is required , else false .
* Valid values : true , false .
* Default value : false .
* @ param attachments A delimited separated list of files to attach ( must be full path ) .
* @ param user If SMTP authentication is needed , the username to use .
* @ param password If SMTP authentication is needed , the password to use .
* @ param delimiter A delimiter to separate the email recipients and the attachments . Default value : ' , ' .
* @ param characterSet The character set encoding for the entire email which includes subject , body ,
* attached file name and the attached file .
* < br > Valid values : UTF - 8 , UTF - 16 , UTF - 32 , EUC - JP , ISO - 2022 - JP , Shift _ JIS , Windows - 31J .
* Default value : UTF - 8.
* @ param contentTransferEncoding The content transfer encoding scheme ( such as 7bit , 8bit , base64 , quoted - printable
* etc ) for the entire email which includes subject , body , attached file name and the
* attached file .
* Valid values : quoted - printable , base64 , 7bit , 8bit , binary , x - token .
* Default value : quoted - printable ( or Q Encoding ) .
* @ param encryptionKeystore The path to the pks12 format keystore to use to encrypt the mail .
* @ param encryptionKeyAlias The alias of the key from the encryptionKeystore to use to encrypt the mail .
* @ param encryptionKeystorePassword The password for the encryptionKeystore .
* @ param timeout The timeout ( seconds ) for sending the mail messages .
* @ return a map containing the output of the operation . The keys present in the map are
* < br > < b > returnResult < / b > - that will contain the SentMailSuccessfully if the mail was sent successfully .
* < br > < b > returnCode < / b > - the return code of the operation . 0 if the operation goes to success , - 1 if the
* operation goes to failure .
* < br > < b > exception < / b > - the exception message if the operation goes to failure .
* @ throws Exception */
@ Action ( name = "Send Mail" , outputs = { } } | @ Output ( RETURN_RESULT ) , @ Output ( RETURN_CODE ) , @ Output ( EXCEPTION ) } , responses = { @ Response ( text = SUCCESS , field = RETURN_CODE , value = SUCCESS_RETURN_CODE , matchType = MatchType . COMPARE_EQUAL , responseType = ResponseType . RESOLVED ) , @ Response ( text = FAILURE , field = RETURN_CODE , value = FAILURE_RETURN_CODE , matchType = MatchType . COMPARE_EQUAL , responseType = ResponseType . ERROR ) } ) public Map < String , String > execute ( @ Param ( value = HOSTNAME , required = true ) String hostname , @ Param ( value = PORT , required = true ) String port , @ Param ( value = HTML_EMAIL ) String htmlEmail , @ Param ( value = FROM , required = true ) String from , @ Param ( value = TO , required = true ) String to , @ Param ( CC ) String cc , @ Param ( BCC ) String bcc , @ Param ( value = SUBJECT , required = true ) String subject , @ Param ( value = BODY , required = true ) String body , @ Param ( READ_RECEIPT ) String readReceipt , @ Param ( ATTACHMENTS ) String attachments , @ Param ( HEADERS ) String headers , @ Param ( HEADERS_ROW_DELIMITER ) String rowDelimiter , @ Param ( HEADERS_COLUMN_DELIMITER ) String columnDelimiter , @ Param ( USER ) String user , @ Param ( PASSWORD ) String password , @ Param ( DELIMITER ) String delimiter , @ Param ( CHARACTERSET ) String characterSet , @ Param ( CONTENT_TRANSFER_ENCODING ) String contentTransferEncoding , @ Param ( ENCRYPTION_KEYSTORE ) String encryptionKeystore , @ Param ( ENCRYPTION_KEY_ALIAS ) String encryptionKeyAlias , @ Param ( ENCRYPTION_KEYSTORE_PASSWORD ) String encryptionKeystorePassword , @ Param ( ENABLE_TLS ) String enableTLS , @ Param ( TIMEOUT ) String timeout , @ Param ( ENCRYPTION_ALGORITHM ) String encryptionAlgorithm ) throws Exception { SendMailInputs sendMailInputs = new SendMailInputs ( ) ; sendMailInputs . setSmtpHostname ( hostname ) ; sendMailInputs . setPort ( port ) ; sendMailInputs . setHtmlEmail ( htmlEmail ) ; sendMailInputs . setFrom ( from ) ; sendMailInputs . setTo ( to ) ; sendMailInputs . setCc ( cc ) ; sendMailInputs . setBcc ( bcc ) ; sendMailInputs . setSubject ( subject ) ; sendMailInputs . setBody ( body ) ; sendMailInputs . setReadReceipt ( readReceipt ) ; sendMailInputs . setAttachments ( attachments ) ; sendMailInputs . setHeaders ( headers ) ; sendMailInputs . setRowDelimiter ( rowDelimiter ) ; sendMailInputs . setColumnDelimiter ( columnDelimiter ) ; sendMailInputs . setUser ( user ) ; sendMailInputs . setPassword ( password ) ; sendMailInputs . setDelimiter ( delimiter ) ; sendMailInputs . setCharacterset ( characterSet ) ; sendMailInputs . setContentTransferEncoding ( contentTransferEncoding ) ; sendMailInputs . setEncryptionKeystore ( encryptionKeystore ) ; sendMailInputs . setEncryptionKeyAlias ( encryptionKeyAlias ) ; sendMailInputs . setEncryptionKeystorePassword ( encryptionKeystorePassword ) ; sendMailInputs . setEnableTLS ( enableTLS ) ; sendMailInputs . setTimeout ( timeout ) ; sendMailInputs . setEncryptionAlgorithm ( encryptionAlgorithm ) ; try { return new SendMail ( ) . execute ( sendMailInputs ) ; } catch ( Exception e ) { return exceptionResult ( e . getMessage ( ) , e ) ; } |
public class SimonDataGenerator { /** * Generate a Simon of type " Stopwatch " and fill it with some Splits .
* @ param splitWidth Max number of splits per Stopwatch */
private void addStopwatchSplits ( Stopwatch stopwatch , int splitWidth ) { } } | final int splits = randomInt ( splitWidth / 2 , splitWidth ) ; try { lock . lock ( ) ; System . out . print ( stopwatch . getName ( ) + " " + splits + ": " ) ; for ( int i = 0 ; i < splits ; i ++ ) { System . out . print ( addStopwatchSplit ( stopwatch ) + "," ) ; } System . out . println ( ) ; } finally { lock . unlock ( ) ; } |
public class DataTypes { /** * Returns a deep copy of an object . */
public static < T > T copy ( final T object , final DataTypeDescriptor < T > descriptor ) { } } | if ( descriptor == null ) { throw new NullPointerException ( "descriptor" ) ; } return copy ( object , descriptor . getType ( ) ) ; |
public class DefaultListableProviderFactory { /** * / * ( non - Javadoc )
* @ see com . yiqiniu . easytrans . register . ServiceRegister # getServiceTransactionTypeSet ( java . lang . Class ) */
@ Override public Set < Class < ? > > getServiceTransactionTypeSet ( Class < ? > rootType ) { } } | Map < Class < ? > , List < Object > > map = mapBusinessProvider . get ( rootType ) ; if ( map != null ) { return Collections . unmodifiableSet ( map . keySet ( ) ) ; } else { return null ; } |
public class QueryRendererDelegateImpl { /** * Add ' group by ' criteria .
* @ param collateName optional collation name */
@ Override public void groupingValue ( String collateName ) { } } | // collationName is ignored for now
if ( groupBy == null ) { groupBy = new ArrayList < > ( ARRAY_INITIAL_LENGTH ) ; } groupBy . add ( resolveAlias ( propertyPath ) ) ; |
public class JSONTokener { /** * Reads a null , boolean , numeric or unquoted string literal value . Numeric
* values will be returned as an Integer , Long , or Double , in that order of
* preference . */
private Object readLiteral ( ) throws JSONException { } } | String literal = nextToInternal ( "{}[]/\\:,=;# \t\f" ) ; if ( literal . length ( ) == 0 ) { throw syntaxError ( "Expected literal value" ) ; } else if ( "null" . equalsIgnoreCase ( literal ) ) { return JSONObject . NULL ; } else if ( "true" . equalsIgnoreCase ( literal ) ) { return Boolean . TRUE ; } else if ( "false" . equalsIgnoreCase ( literal ) ) { return Boolean . FALSE ; } /* try to parse as an integral type . . . */
if ( literal . indexOf ( '.' ) == - 1 ) { int base = 10 ; String number = literal ; if ( number . startsWith ( "0x" ) || number . startsWith ( "0X" ) ) { number = number . substring ( 2 ) ; base = 16 ; } else if ( number . startsWith ( "0" ) && number . length ( ) > 1 ) { number = number . substring ( 1 ) ; base = 8 ; } try { long longValue = Long . parseLong ( number , base ) ; if ( longValue <= Integer . MAX_VALUE && longValue >= Integer . MIN_VALUE ) { return ( int ) longValue ; } else { return longValue ; } } catch ( NumberFormatException e ) { /* * This only happens for integral numbers greater than
* Long . MAX _ VALUE , numbers in exponential form ( 5e - 10 ) and
* unquoted strings . Fall through to try floating point . */
} } /* . . . next try to parse as a floating point . . . */
try { return Double . valueOf ( literal ) ; } catch ( NumberFormatException ignored ) { } /* . . . finally give up . We have an unquoted string */
return new String ( literal ) ; // a new string avoids leaking memory |
public class Label { /** * Computes the lines of text for this label given the specified target width . The overall size
* of the computed lines is stored into the < code > size < / code > parameter .
* @ return an { @ link List } or null if < code > keepWordsWhole < / code > was true and the lines could
* not be layed out in the target width . */
protected List < Tuple < TextLayout , Rectangle2D > > computeLines ( LineBreakMeasurer measurer , int targetWidth , Dimension size , boolean keepWordsWhole ) { } } | // start with a size of zero
double width = 0 , height = 0 ; List < Tuple < TextLayout , Rectangle2D > > layouts = new ArrayList < Tuple < TextLayout , Rectangle2D > > ( ) ; try { // obtain our new dimensions by using a line break iterator to lay out our text one
// line at a time
TextLayout layout ; int lastposition = _text . length ( ) ; while ( true ) { int nextret = _text . indexOf ( '\n' , measurer . getPosition ( ) + 1 ) ; if ( nextret == - 1 ) { nextret = lastposition ; } layout = measurer . nextLayout ( targetWidth , nextret , keepWordsWhole ) ; if ( layout == null ) { break ; } Rectangle2D bounds = getBounds ( layout ) ; width = Math . max ( width , getWidth ( bounds ) ) ; height += getHeight ( layout ) ; layouts . add ( new Tuple < TextLayout , Rectangle2D > ( layout , bounds ) ) ; } // fill in the computed size ; for some reason JDK1.3 on Linux chokes on
// setSize ( double , double )
size . setSize ( Math . ceil ( width ) , Math . ceil ( height ) ) ; // this can only happen if keepWordsWhole is true
if ( measurer . getPosition ( ) < lastposition ) { return null ; } } catch ( Throwable t ) { log . warning ( "Label layout failed" , "text" , _text , t ) ; } return layouts ; |
public class SagaEnvironment { /** * Creates a new SagaEnvironment instance . */
public static SagaEnvironment create ( final TimeoutManager timeoutManager , final StateStorage storage , final Provider < CurrentExecutionContext > contextProvider , final Set < SagaModule > modules , final Set < SagaLifetimeInterceptor > interceptors , final InstanceResolver sagaInstanceResolver , final ModuleCoordinatorFactory coordinatorFactory ) { } } | return new SagaEnvironment ( timeoutManager , storage , contextProvider , modules , interceptors , sagaInstanceResolver , coordinatorFactory ) ; |
public class SipServletMessageImpl { /** * ( non - Javadoc )
* @ see javax . servlet . sip . SipServletMessage # getAcceptLanguages ( ) */
public Iterator < Locale > getAcceptLanguages ( ) { } } | LinkedList < Locale > ll = new LinkedList < Locale > ( ) ; Iterator < Header > it = ( Iterator < Header > ) this . message . getHeaders ( AcceptLanguageHeader . NAME ) ; while ( it . hasNext ( ) ) { AcceptLanguageHeader alh = ( AcceptLanguageHeader ) it . next ( ) ; ll . add ( alh . getAcceptLanguage ( ) ) ; } return ll . iterator ( ) ; |
public class AbstractLRParser { /** * This method is called just before running the parser to reset all internal
* values and to clean all stacks . */
private final void reset ( ) { } } | backtrackStack . clear ( ) ; actionStack . clear ( ) ; stateStack . clear ( ) ; parserErrors . clear ( ) ; streamPosition = 0 ; stepCounter = 0 ; stateStack . push ( 0 ) ; maxPosition = 0 ; shiftIgnoredTokens ( ) ; |
public class AnalyticFormulas { /** * Calculated the approximation to the lognormal Black volatility using the
* standard SABR model and the standard Hagan approximation .
* @ param alpha initial value of the stochastic volatility process of the SABR model .
* @ param beta CEV parameter of the SABR model .
* @ param rho Correlation ( leverages ) of the stochastic volatility .
* @ param nu Volatility of the stochastic volatility ( vol - of - vol ) .
* @ param underlying Underlying ( spot ) value .
* @ param strike Strike .
* @ param maturity Maturity .
* @ return Implied lognormal Black volatility . */
public static double sabrHaganLognormalBlackVolatilityApproximation ( double alpha , double beta , double rho , double nu , double underlying , double strike , double maturity ) { } } | return sabrHaganLognormalBlackVolatilityApproximation ( alpha , beta , rho , nu , 0.0 , underlying , strike , maturity ) ; |
public class FlashPublisher { /** * ( non - Javadoc )
* @ see es . sandbox . ui . messages . Flash # warning ( java . lang . String , java . lang . Object [ ] ) */
@ Override public void warning ( String code , Object ... arguments ) throws NullPointerException , IllegalArgumentException { } } | this . store . add ( Level . WARNING , resolveMessage ( code , arguments ) ) ; |
public class GuildManager { /** * Sets the system { @ link net . dv8tion . jda . core . entities . TextChannel TextChannel } of this { @ link net . dv8tion . jda . core . entities . Guild Guild } .
* @ param systemChannel
* The new system channel for this { @ link net . dv8tion . jda . core . entities . Guild Guild }
* or { @ code null } to reset
* @ throws IllegalArgumentException
* If the provided channel is not from this guild
* @ return GuildManager for chaining convenience */
@ CheckReturnValue public GuildManager setSystemChannel ( TextChannel systemChannel ) { } } | Checks . check ( systemChannel == null || systemChannel . getGuild ( ) . equals ( getGuild ( ) ) , "Channel must be from the same guild" ) ; this . systemChannel = systemChannel == null ? null : systemChannel . getId ( ) ; set |= SYSTEM_CHANNEL ; return this ; |
public class TypedDataSet { /** * Add rows in a collection to the data set .
* @ param rows Collection of row objects .
* @ return The data set instance ( for possible chaining ) . */
public TypedDataSet < T > rows ( Collection < ? extends T > rows ) { } } | for ( T rowObj : rows ) { super . row ( conv . convert ( rowObj ) ) ; } return this ; |
public class StorageStatistics { /** * Returns the amount of free memory remaining .
* @ return the amount of free memory remaining if successful , - 1 return indicates failure . */
public long getFreeMemory ( ) { } } | try { return ( long ) mBeanServer . getAttribute ( new ObjectName ( "java.lang" , "type" , "OperatingSystem" ) , "FreePhysicalMemorySize" ) ; } catch ( Exception e ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "An exception occurred during memory check" , e ) ; } } return - 1 ; |
public class StoreFactory { /** * Execute store transaction based on provided { @ link ChatStore } implementation . Every transaction should begin with { @ link ChatStore # beginTransaction ( ) } and end with { @ link ChatStore # endTransaction ( ) }
* @ param transaction Store transaction based on provided { @ link ChatStore } implementation . */
public final void execute ( @ NonNull StoreTransaction < T > transaction ) { } } | try { build ( transaction :: execute ) ; } catch ( Exception e ) { if ( log != null ) { log . f ( "Error executing external store transaction : " + e . getLocalizedMessage ( ) , e ) ; } } |
public class ArrayHelper { /** * Get a new array that combines the passed two arrays , maintaining the order .
* @ param aHeadArray
* The first array . May be < code > null < / code > .
* @ param aTailArray
* The second array . May be < code > null < / code > .
* @ return < code > null < / code > if both array parameters are < code > null < / code > -
* a non - < code > null < / code > array with all elements in the correct
* order otherwise . */
@ Nonnull @ ReturnsMutableCopy public static int [ ] getConcatenated ( @ Nullable final int [ ] aHeadArray , @ Nullable final int ... aTailArray ) { } } | // If first array is invalid , simply
if ( isEmpty ( aHeadArray ) ) return getCopy ( aTailArray ) ; if ( isEmpty ( aTailArray ) ) return getCopy ( aHeadArray ) ; // Start concatenating
final int [ ] ret = new int [ aHeadArray . length + aTailArray . length ] ; System . arraycopy ( aHeadArray , 0 , ret , 0 , aHeadArray . length ) ; System . arraycopy ( aTailArray , 0 , ret , aHeadArray . length , aTailArray . length ) ; return ret ; |
public class TeXHyphenator { /** * Loads custom hyphenation rules . You probably want to use
* loadDefault ( ) instead . */
public void load ( BufferedReader input ) throws IOException { } } | String line ; while ( ( line = input . readLine ( ) ) != null ) { if ( StringUtils . matches ( line , "\\s*(%.*)?" ) ) { // comment or blank line
System . err . println ( "Skipping: " + line ) ; continue ; } char [ ] linechars = line . toCharArray ( ) ; int [ ] pattern = new int [ linechars . length ] ; char [ ] chars = new char [ linechars . length ] ; int c = 0 ; for ( int i = 0 ; i < linechars . length ; ++ i ) { if ( Character . isDigit ( linechars [ i ] ) ) { pattern [ c ] = Character . digit ( linechars [ i ] , 10 ) ; } else { chars [ c ++ ] = linechars [ i ] ; } } char [ ] shortchars = new char [ c ] ; int [ ] shortpattern = new int [ c + 1 ] ; System . arraycopy ( chars , 0 , shortchars , 0 , c ) ; System . arraycopy ( pattern , 0 , shortpattern , 0 , c + 1 ) ; insertHyphPattern ( shortchars , shortpattern ) ; } |
public class HString { /** * Gets head .
* @ return the head */
public HString head ( ) { } } | return tokens ( ) . stream ( ) . filter ( t -> t . parent ( ) . isEmpty ( ) ) . map ( Cast :: < HString > as ) . findFirst ( ) . orElseGet ( ( ) -> tokens ( ) . stream ( ) . filter ( t -> ! this . overlaps ( t . parent ( ) ) ) . map ( Cast :: < HString > as ) . findFirst ( ) . orElse ( this ) ) ; |
public class ActivityTaskFailedEventAttributesMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes , ProtocolMarshaller protocolMarshaller ) { } } | if ( activityTaskFailedEventAttributes == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( activityTaskFailedEventAttributes . getReason ( ) , REASON_BINDING ) ; protocolMarshaller . marshall ( activityTaskFailedEventAttributes . getDetails ( ) , DETAILS_BINDING ) ; protocolMarshaller . marshall ( activityTaskFailedEventAttributes . getScheduledEventId ( ) , SCHEDULEDEVENTID_BINDING ) ; protocolMarshaller . marshall ( activityTaskFailedEventAttributes . getStartedEventId ( ) , STARTEDEVENTID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ConfigurationPropertySources { /** * Attach a { @ link ConfigurationPropertySource } support to the specified
* { @ link Environment } . Adapts each { @ link PropertySource } managed by the environment
* to a { @ link ConfigurationPropertySource } and allows classic
* { @ link PropertySourcesPropertyResolver } calls to resolve using
* { @ link ConfigurationPropertyName configuration property names } .
* The attached resolver will dynamically track any additions or removals from the
* underlying { @ link Environment } property sources .
* @ param environment the source environment ( must be an instance of
* { @ link ConfigurableEnvironment } )
* @ see # get ( Environment ) */
public static void attach ( Environment environment ) { } } | Assert . isInstanceOf ( ConfigurableEnvironment . class , environment ) ; MutablePropertySources sources = ( ( ConfigurableEnvironment ) environment ) . getPropertySources ( ) ; PropertySource < ? > attached = sources . get ( ATTACHED_PROPERTY_SOURCE_NAME ) ; if ( attached != null && attached . getSource ( ) != sources ) { sources . remove ( ATTACHED_PROPERTY_SOURCE_NAME ) ; attached = null ; } if ( attached == null ) { sources . addFirst ( new ConfigurationPropertySourcesPropertySource ( ATTACHED_PROPERTY_SOURCE_NAME , new SpringConfigurationPropertySources ( sources ) ) ) ; } |
public class SynchroReader { /** * Map Synchro constraints to MPXJ constraints .
* @ param task task
* @ param row Synchro constraint data */
private void setConstraints ( Task task , MapRow row ) { } } | ConstraintType constraintType = null ; Date constraintDate = null ; Date lateDate = row . getDate ( "CONSTRAINT_LATE_DATE" ) ; Date earlyDate = row . getDate ( "CONSTRAINT_EARLY_DATE" ) ; switch ( row . getInteger ( "CONSTRAINT_TYPE" ) . intValue ( ) ) { case 2 : // Cannot Reschedule
{ constraintType = ConstraintType . MUST_START_ON ; constraintDate = task . getStart ( ) ; break ; } case 12 : // Finish Between
{ constraintType = ConstraintType . MUST_FINISH_ON ; constraintDate = lateDate ; break ; } case 10 : // Finish On or After
{ constraintType = ConstraintType . FINISH_NO_EARLIER_THAN ; constraintDate = earlyDate ; break ; } case 11 : // Finish On or Before
{ constraintType = ConstraintType . FINISH_NO_LATER_THAN ; constraintDate = lateDate ; break ; } case 13 : // Mandatory Start
case 5 : // Start On
case 9 : // Finish On
{ constraintType = ConstraintType . MUST_START_ON ; constraintDate = earlyDate ; break ; } case 14 : // Mandatory Finish
{ constraintType = ConstraintType . MUST_FINISH_ON ; constraintDate = earlyDate ; break ; } case 4 : // Start As Late As Possible
{ constraintType = ConstraintType . AS_LATE_AS_POSSIBLE ; break ; } case 3 : // Start As Soon As Possible
{ constraintType = ConstraintType . AS_SOON_AS_POSSIBLE ; break ; } case 8 : // Start Between
{ constraintType = ConstraintType . AS_SOON_AS_POSSIBLE ; constraintDate = earlyDate ; break ; } case 6 : // Start On or Before
{ constraintType = ConstraintType . START_NO_LATER_THAN ; constraintDate = earlyDate ; break ; } case 15 : // Work Between
{ constraintType = ConstraintType . START_NO_EARLIER_THAN ; constraintDate = earlyDate ; break ; } } task . setConstraintType ( constraintType ) ; task . setConstraintDate ( constraintDate ) ; |
public class SvdImplicitQrAlgorithm_DDRM { /** * Performs a similar transform on B < sup > T < / sup > B - pI */
protected void createBulge ( int x1 , double p , double scale , boolean byAngle ) { } } | double b11 = diag [ x1 ] ; double b12 = off [ x1 ] ; double b22 = diag [ x1 + 1 ] ; if ( byAngle ) { c = Math . cos ( p ) ; s = Math . sin ( p ) ; } else { // normalize to improve resistance to overflow / underflow
double u1 = ( b11 / scale ) * ( b11 / scale ) - p ; double u2 = ( b12 / scale ) * ( b11 / scale ) ; double gamma = Math . sqrt ( u1 * u1 + u2 * u2 ) ; c = u1 / gamma ; s = u2 / gamma ; } // multiply the rotator on the top left .
diag [ x1 ] = b11 * c + b12 * s ; off [ x1 ] = b12 * c - b11 * s ; diag [ x1 + 1 ] = b22 * c ; bulge = b22 * s ; // SimpleMatrix Q = createQ ( x1 , c , s , false ) ;
// B = B . mult ( Q ) ;
// B . print ( ) ;
// printMatrix ( ) ;
// System . out . println ( " bulge = " + bulge ) ;
if ( Vt != null ) { updateRotator ( Vt , x1 , x1 + 1 , c , s ) ; // SimpleMatrix . wrap ( Ut ) . mult ( B ) . mult ( SimpleMatrix . wrap ( Vt ) . transpose ( ) ) . print ( ) ;
// printMatrix ( ) ;
// System . out . println ( " bulge = " + bulge ) ;
// System . out . println ( ) ;
} |
public class Misc { /** * Convert a UTF - 8 byte array into a string . */
public static String toStringUTF8 ( byte [ ] bytes ) { } } | if ( bytes == null ) { return null ; } return toStringUTF8 ( bytes , 0 , bytes . length ) ; |
public class LoadBalancedRSocketMono { /** * Update the aperture value and ensure its value stays in the right range .
* @ param newValue new aperture value
* @ param now time of the change ( for rate limiting purposes ) */
private void updateAperture ( int newValue , long now ) { } } | int previous = targetAperture ; targetAperture = newValue ; targetAperture = Math . max ( minAperture , targetAperture ) ; int maxAperture = Math . min ( this . maxAperture , activeSockets . size ( ) + pool . poolSize ( ) ) ; targetAperture = Math . min ( maxAperture , targetAperture ) ; lastApertureRefresh = now ; pendings . reset ( ( minPendings + maxPendings ) / 2 ) ; if ( targetAperture != previous ) { logger . debug ( "Current pending={}, new target={}, previous target={}" , pendings . value ( ) , targetAperture , previous ) ; } |
public class AbstractListCommandWithoutFurnace { /** * Print the given values after displaying the provided message . */
protected static void printValuesSorted ( String message , Set < String > values ) { } } | System . out . println ( ) ; System . out . println ( message + ":" ) ; List < String > sorted = new ArrayList < > ( values ) ; Collections . sort ( sorted ) ; for ( String value : sorted ) { System . out . println ( "\t" + value ) ; } |
public class WSRdbManagedConnectionImpl { /** * Copy from replaceCRI : Replace the CRI of this ManagedConnection with the new CRI for
* CCI interface
* @ param newCRI the new CRI .
* @ throws ResourceException if handles already exist on the ManagedConnection or if the
* requested CRI contains a different user or password than the existing CRI . */
private void replaceCRIForCCI ( WSConnectionRequestInfoImpl newCRI ) throws ResourceException { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "replaceCRIForCCI" , "Current:" , cri , "New:" , newCRI ) ; if ( numHandlesInUse > 0 ) { if ( ! supportIsolvlSwitching ) { ResourceException resX = new DataStoreAdapterException ( "WS_INTERNAL_ERROR" , null , getClass ( ) , "ConnectionRequestInfo cannot be changed on a ManagedConnection with active handles." , AdapterUtil . EOLN + "Existing CRI: " + cri , AdapterUtil . EOLN + "Requested CRI: " + newCRI ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "replaceCRIForCCI" , resX ) ; throw resX ; } } // The ManagedConnection should use the new CRI value in place of its current CRI .
if ( ! newCRI . isCRIChangable ( ) ) newCRI = WSConnectionRequestInfoImpl . createChangableCRIFromNon ( newCRI ) ; newCRI . setDefaultValues ( defaultCatalog , defaultHoldability , defaultReadOnly , defaultTypeMap , defaultSchema , defaultNetworkTimeout ) ; cri = newCRI ; // - - don ' t intialize the properties , deplay to synchronizePropertiesWithCRI ( ) .
if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "replaceCRIForCCI" ) ; |
public class CustomerFeedOperation { /** * Gets the operand value for this CustomerFeedOperation .
* @ return operand * < span class = " constraint Required " > This field is required and
* should not be { @ code null } . < / span > */
public com . google . api . ads . adwords . axis . v201809 . cm . CustomerFeed getOperand ( ) { } } | return operand ; |
public class MongoDBClient { /** * Find GFS entity .
* @ param entityMetadata
* the entity metadata
* @ param entityClass
* the entity class
* @ param key
* the key
* @ return the object */
private Object findGFSEntity ( EntityMetadata entityMetadata , Class entityClass , Object key ) { } } | GridFSDBFile outputFile = findGridFSDBFile ( entityMetadata , key ) ; return outputFile != null ? handler . getEntityFromGFSDBFile ( entityMetadata . getEntityClazz ( ) , instantiateEntity ( entityClass , null ) , entityMetadata , outputFile , kunderaMetadata ) : null ; |
public class Setting { /** * set the value requesttimeout
* @ param requesttimeout value to set */
public void setRequesttimeout ( double requesttimeout ) { } } | long rt ; if ( requesttimeout <= 0 ) rt = Long . MAX_VALUE ; else rt = ( long ) ( requesttimeout * 1000 ) ; pageContext . setRequestTimeout ( rt ) ; |
public class Stylesheet { /** * Get the stylesheet at the given in index in " include " list
* @ see < a href = " http : / / www . w3 . org / TR / xslt # include " > include in XSLT Specification < / a >
* @ param i Index of stylesheet to get
* @ return Stylesheet at the given index
* @ throws ArrayIndexOutOfBoundsException */
public Stylesheet getInclude ( int i ) throws ArrayIndexOutOfBoundsException { } } | if ( null == m_includes ) throw new ArrayIndexOutOfBoundsException ( ) ; return ( Stylesheet ) m_includes . elementAt ( i ) ; |
public class SpatialKeyAlgo { /** * Take latitude and longitude as input .
* @ return the spatial key */
@ Override public final long encode ( double lat , double lon ) { } } | // PERFORMANCE : int operations would be faster than double ( for further comparison etc )
// but we would need ' long ' because ' int factorForPrecision ' is not enough ( problem : coord ! = decode ( encode ( coord ) ) see testBijection )
// and ' long ' - ops are more expensive than double ( at least on 32bit systems )
long hash = 0 ; double minLatTmp = bbox . minLat ; double maxLatTmp = bbox . maxLat ; double minLonTmp = bbox . minLon ; double maxLonTmp = bbox . maxLon ; int i = 0 ; while ( true ) { if ( minLatTmp < maxLatTmp ) { double midLat = ( minLatTmp + maxLatTmp ) / 2 ; if ( lat < midLat ) { maxLatTmp = midLat ; } else { hash |= 1 ; minLatTmp = midLat ; } } i ++ ; if ( i < allBits ) hash <<= 1 ; else // if allBits is an odd number
break ; if ( minLonTmp < maxLonTmp ) { double midLon = ( minLonTmp + maxLonTmp ) / 2 ; if ( lon < midLon ) { maxLonTmp = midLon ; } else { hash |= 1 ; minLonTmp = midLon ; } } i ++ ; if ( i < allBits ) hash <<= 1 ; else break ; } return hash ; |
public class JsDocInfoParser { /** * Looks for a type expression at the current token and if found ,
* returns it . Note that this method consumes input .
* @ param token The current token .
* @ param lineno The line of the type expression .
* @ param startCharno The starting character position of the type expression .
* @ param matchingLC Whether the type expression starts with a " { " .
* @ return The type expression found or null if none . */
private Node parseAndRecordTypeNameNode ( JsDocToken token , int lineno , int startCharno , boolean matchingLC ) { } } | return parseAndRecordTypeNode ( token , lineno , startCharno , matchingLC , true ) ; |
public class SwingBrowser { /** * This method initializes jButton
* @ return javax . swing . JButton */
private JButton getOkButton ( ) { } } | if ( okButton == null ) { okButton = new JButton ( ) ; okButton . setText ( "Go!" ) ; okButton . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent e ) { displayURL ( urlText . getText ( ) ) ; } } ) ; } return okButton ; |
public class GeneralValidator { /** * Removes the specified result collector from the triggers and data providers .
* @ param resultCollector Result collector to be removed . */
public void removeResultCollector ( ResultCollector < ? , DPO > resultCollector ) { } } | if ( resultCollector != null ) { removeTrigger ( resultCollector ) ; removeDataProvider ( resultCollector ) ; } |
public class GenerateEntityFileNameTask { /** * / * ( non - Javadoc )
* @ see org . danann . cernunnos . Bootstrappable # init ( org . danann . cernunnos . EntityConfig ) */
@ Override public void init ( EntityConfig config ) { } } | // Lock & load reagents
this . entityElement = ( Phrase ) config . getValue ( ENTITY_ELEMENT ) ; this . layoutStore = ( Phrase ) config . getValue ( LAYOUT_STORE ) ; |
public class PolymorphicDispatcher { /** * returns & gt ; 0 when o1 is more specific than o2,
* returns = = 0 when o1 and o2 are equal or unrelated ,
* returns & lt ; 0 when o2 is more specific than o1, */
protected int compare ( MethodDesc o1 , MethodDesc o2 ) { } } | final Class < ? > [ ] paramTypes1 = o1 . getParameterTypes ( ) ; final Class < ? > [ ] paramTypes2 = o2 . getParameterTypes ( ) ; // sort by parameter types from left to right
for ( int i = 0 ; i < paramTypes1 . length ; i ++ ) { final Class < ? > class1 = paramTypes1 [ i ] ; final Class < ? > class2 = paramTypes2 [ i ] ; if ( class1 . equals ( class2 ) ) continue ; if ( class1 . isAssignableFrom ( class2 ) || Void . class . equals ( class2 ) ) return - 1 ; if ( class2 . isAssignableFrom ( class1 ) || Void . class . equals ( class1 ) ) return 1 ; } // sort by declaring class ( more specific comes first ) .
if ( ! o1 . getDeclaringClass ( ) . equals ( o2 . getDeclaringClass ( ) ) ) { if ( o1 . getDeclaringClass ( ) . isAssignableFrom ( o2 . getDeclaringClass ( ) ) ) return 1 ; if ( o2 . getDeclaringClass ( ) . isAssignableFrom ( o1 . getDeclaringClass ( ) ) ) return - 1 ; } // sort by target
final int compareTo = ( ( Integer ) targets . indexOf ( o2 . target ) ) . compareTo ( targets . indexOf ( o1 . target ) ) ; return compareTo ; |
public class BytecodeUtils { /** * Returns an expression that returns a new { @ code ImmutableList } containing the given items .
* < p > NOTE : { @ code ImmutableList } rejects null elements . */
public static Expression asImmutableList ( Iterable < ? extends Expression > items ) { } } | ImmutableList < Expression > copy = ImmutableList . copyOf ( items ) ; if ( copy . size ( ) < MethodRef . IMMUTABLE_LIST_OF . size ( ) ) { return MethodRef . IMMUTABLE_LIST_OF . get ( copy . size ( ) ) . invoke ( copy ) ; } ImmutableList < Expression > explicit = copy . subList ( 0 , MethodRef . IMMUTABLE_LIST_OF . size ( ) ) ; Expression remainder = asArray ( OBJECT_ARRAY_TYPE , copy . subList ( MethodRef . IMMUTABLE_LIST_OF . size ( ) , copy . size ( ) ) ) ; return MethodRef . IMMUTABLE_LIST_OF_ARRAY . invoke ( Iterables . concat ( explicit , ImmutableList . of ( remainder ) ) ) ; |
public class Options { /** * Loads the options from the command line .
* @ param options The command line options .
* @ param errorReporter The error reporter for printing messages .
* @ return The options to be forwarded to the standard doclet . */
public String [ ] [ ] load ( String [ ] [ ] options , DocErrorReporter errorReporter ) { } } | LinkedList < String [ ] > optionsList = new LinkedList < > ( Arrays . asList ( options ) ) ; Iterator < String [ ] > optionsIter = optionsList . iterator ( ) ; while ( optionsIter . hasNext ( ) ) { String [ ] opt = optionsIter . next ( ) ; if ( ! handleOption ( optionsIter , opt , errorReporter ) ) { return null ; } } if ( pegdownExtensions == null ) { setPegdownExtensions ( DEFAULT_PEGDOWN_EXTENSIONS ) ; } return optionsList . toArray ( new String [ optionsList . size ( ) ] [ ] ) ; |
public class PrimitivePropertyEditor { /** * - - - - - OTHER METHODS - - - - - */
@ Override protected R parseValueFromString ( String s ) { } } | Class < R > range = this . getRange ( ) ; R value = null ; try { if ( range . equals ( double . class ) ) { value = ( R ) Double . valueOf ( s ) ; } else if ( range . equals ( float . class ) ) { value = ( R ) Float . valueOf ( s ) ; } else if ( range . equals ( int . class ) ) { value = ( R ) Integer . valueOf ( s ) ; } else if ( range . equals ( Boolean . class ) ) { value = ( R ) Boolean . valueOf ( s ) ; } } catch ( NumberFormatException e ) { throw new IllegalBioPAXArgumentException ( "Failed to convert literal " + s + " to " + range . getSimpleName ( ) + " for " + property , e ) ; } return value ; |
public class TranManagerImpl { /** * that this class is managing . */
public boolean enlist ( XAResource xaRes , int recoveryId ) throws RollbackException , IllegalStateException , SystemException { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "enlist" , new Object [ ] { xaRes , recoveryId } ) ; if ( tx == null ) { final String msg = "No transaction associated with this thread" ; final IllegalStateException ise = new IllegalStateException ( msg ) ; FFDCFilter . processException ( ise , "com.ibm.tx.jta.impl.TranManagerImpl.enlist" , "470" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "enlist" , ise ) ; throw ise ; } boolean ret = false ; try { ret = tx . enlistResource ( xaRes , recoveryId ) ; } finally { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "enlist" , ret ) ; } return ret ; |
public class ProvidenceJdbi { /** * With column mapped to field .
* @ param name Name of column .
* @ param field Field it is mapped to .
* @ param < F > The message field type .
* @ return The mapped field . */
public static < F extends PField > MappedField < F > withColumn ( String name , F field ) { } } | return new MappedField < > ( name , field ) ; |
public class DoubleTuples { /** * Returns whether the given tuple contains an element that
* is Not A Number
* @ param tuple The tuple
* @ return Whether the tuple contains a NaN element */
public static boolean containsNaN ( DoubleTuple tuple ) { } } | for ( int i = 0 ; i < tuple . getSize ( ) ; i ++ ) { if ( Double . isNaN ( tuple . get ( i ) ) ) { return true ; } } return false ; |
public class StringTextStream { /** * ( non - Javadoc )
* @ see com . github . maven _ nar . TextStream # println ( java . lang . String ) */
@ Override public final void println ( final String text ) { } } | this . sb . append ( text ) ; this . sb . append ( this . lineSeparator ) ; |
public class ProcessManagerImpl { /** * If we already have an instance of a process with this name , auto increment ports to avoid a conflict */
private void incrementPortsIfDuplicateName ( String configName , ProcessConfigBean config ) { } } | int startedCount = getNumberOfInstancesStarted ( configName ) ; int debugPort = config . getDebugPort ( ) ; if ( debugPort != - 1 ) { config . setDebugPort ( debugPort + startedCount ) ; } int remotingPort = config . getRemotingPort ( ) ; if ( remotingPort != - 1 ) { config . setRemotingPort ( remotingPort + startedCount ) ; } |
public class LdapConnection { /** * Returns a hash key for the name | filterExpr | filterArgs | cons tuple used in the search
* query - results cache .
* @ param name The name of the context or object to search
* @ param filterExpr the filter expression used in the search .
* @ param filterArgs the filter arguments used in the search .
* @ param cons The search controls used in the search .
* @ throws NamingException If a naming exception is encountered . */
@ Trivial private static String toKey ( String name , String filterExpr , Object [ ] filterArgs , SearchControls cons ) { } } | int length = name . length ( ) + filterExpr . length ( ) + filterArgs . length + 200 ; StringBuffer key = new StringBuffer ( length ) ; key . append ( name ) ; key . append ( "|" ) ; key . append ( filterExpr ) ; String [ ] attrIds = cons . getReturningAttributes ( ) ; for ( int i = 0 ; i < filterArgs . length ; i ++ ) { key . append ( "|" ) ; key . append ( filterArgs [ i ] ) ; } if ( attrIds != null ) { for ( int i = 0 ; i < attrIds . length ; i ++ ) { key . append ( "|" ) ; key . append ( attrIds [ i ] ) ; } } return key . toString ( ) ; |
public class AWSDatabaseMigrationServiceWaiters { /** * Builds a ReplicationTaskDeleted waiter by using custom parameters waiterParameters and other parameters defined
* in the waiters specification , and then polls until it determines whether the resource entered the desired state
* or not , where polling criteria is bound by either default polling strategy or custom polling strategy . */
public Waiter < DescribeReplicationTasksRequest > replicationTaskDeleted ( ) { } } | return new WaiterBuilder < DescribeReplicationTasksRequest , DescribeReplicationTasksResult > ( ) . withSdkFunction ( new DescribeReplicationTasksFunction ( client ) ) . withAcceptors ( new ReplicationTaskDeleted . IsReadyMatcher ( ) , new ReplicationTaskDeleted . IsCreatingMatcher ( ) , new ReplicationTaskDeleted . IsStoppedMatcher ( ) , new ReplicationTaskDeleted . IsRunningMatcher ( ) , new ReplicationTaskDeleted . IsFailedMatcher ( ) , new ReplicationTaskDeleted . IsResourceNotFoundFaultMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 60 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; |
public class ChunkedInputStream { /** * Expects the stream to start with a chunksize in hex with optional
* comments after a semicolon . The line must end with a CRLF : " a3 ; some
* comment \ r \ n " Positions the stream at the start of the next line .
* @ param stream The new input stream .
* @ return The chunk size as integer
* @ throws IOException when the chunk size could not be parsed */
private static int chunkSize ( final InputStream stream ) throws IOException { } } | final ByteArrayOutputStream baos = ChunkedInputStream . sizeLine ( stream ) ; final int result ; final String data = baos . toString ( Charset . defaultCharset ( ) . name ( ) ) ; final int separator = data . indexOf ( ';' ) ; try { // @ checkstyle MagicNumberCheck ( 10 lines )
if ( separator > 0 ) { result = Integer . parseInt ( data . substring ( 0 , separator ) . trim ( ) , 16 ) ; } else { result = Integer . parseInt ( data . trim ( ) , 16 ) ; } return result ; } catch ( final NumberFormatException ex ) { throw new IOException ( String . format ( "Bad chunk size: %s" , baos . toString ( Charset . defaultCharset ( ) . name ( ) ) ) , ex ) ; } |
public class Binder { /** * Drop from the given index a number of arguments .
* @ param index the index at which to start dropping
* @ param count the number of arguments to drop
* @ return a new Binder */
public Binder drop ( int index , int count ) { } } | return new Binder ( this , new Drop ( index , Arrays . copyOfRange ( type ( ) . parameterArray ( ) , index , index + count ) ) ) ; |
public class SSLUtils { /** * Helper method to create an { @ link SSLSocketFactory } which trusts only given certificate
* @ return created specific factory */
public static SSLSocketFactory getPinnedCertSslSocketFactory ( Context context , int keyStoreRawResId , String keyStorePassword ) { } } | InputStream in = null ; try { // Get an instance of the Bouncy Castle KeyStore format
KeyStore trusted = KeyStore . getInstance ( "BKS" ) ; // Get the keystore from raw resource
in = context . getResources ( ) . openRawResource ( keyStoreRawResId ) ; // Initialize the keystore with the provided trusted certificates
// Also provide the password of the keystore
trusted . load ( in , keyStorePassword . toCharArray ( ) ) ; // Create a TrustManager that trusts the CAs in our KeyStore
String tmfAlgorithm = TrustManagerFactory . getDefaultAlgorithm ( ) ; TrustManagerFactory tmf = TrustManagerFactory . getInstance ( tmfAlgorithm ) ; tmf . init ( trusted ) ; // Create an SSLContext that uses our TrustManager
SSLContext sslContext = SSLContext . getInstance ( "TLS" ) ; sslContext . init ( null , tmf . getTrustManagers ( ) , null ) ; return sslContext . getSocketFactory ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } finally { try { if ( in != null ) { in . close ( ) ; } } catch ( IOException e ) { Logger . e ( e . getMessage ( ) ) ; } } |
public class CliTablePrinter { /** * Generates a simple row format string given a set of widths
* @ param widths A list of widths for each column in the table
* @ return A row format for each row in the table */
private String getRowFormat ( List < Integer > widths ) { } } | StringBuilder rowFormat = new StringBuilder ( spaces ( this . indentation ) ) ; for ( int i = 0 ; i < widths . size ( ) ; i ++ ) { rowFormat . append ( "%" ) ; rowFormat . append ( this . flags != null ? this . flags . get ( i ) : "" ) ; rowFormat . append ( widths . get ( i ) . toString ( ) ) ; rowFormat . append ( "s" ) ; rowFormat . append ( spaces ( this . delimiterWidth ) ) ; } rowFormat . append ( "\n" ) ; return rowFormat . toString ( ) ; |
public class CmsCmisTypeManager { /** * Adds CMIS property definitions for documents . < p >
* @ param type the document type */
private static void addDocumentPropertyDefinitions ( DocumentTypeDefinitionImpl type ) { } } | type . addPropertyDefinition ( createPropDef ( PropertyIds . IS_IMMUTABLE , "Is Immutable" , "Is Immutable" , PropertyType . BOOLEAN , Cardinality . SINGLE , Updatability . READONLY , false , false ) ) ; type . addPropertyDefinition ( createPropDef ( PropertyIds . IS_LATEST_VERSION , "Is Latest Version" , "Is Latest Version" , PropertyType . BOOLEAN , Cardinality . SINGLE , Updatability . READONLY , false , false ) ) ; type . addPropertyDefinition ( createPropDef ( PropertyIds . IS_MAJOR_VERSION , "Is Major Version" , "Is Major Version" , PropertyType . BOOLEAN , Cardinality . SINGLE , Updatability . READONLY , false , false ) ) ; type . addPropertyDefinition ( createPropDef ( PropertyIds . IS_LATEST_MAJOR_VERSION , "Is Latest Major Version" , "Is Latest Major Version" , PropertyType . BOOLEAN , Cardinality . SINGLE , Updatability . READONLY , false , false ) ) ; type . addPropertyDefinition ( createPropDef ( PropertyIds . VERSION_LABEL , "Version Label" , "Version Label" , PropertyType . STRING , Cardinality . SINGLE , Updatability . READONLY , false , false ) ) ; type . addPropertyDefinition ( createPropDef ( PropertyIds . VERSION_SERIES_ID , "Version Series Id" , "Version Series Id" , PropertyType . ID , Cardinality . SINGLE , Updatability . READONLY , false , false ) ) ; type . addPropertyDefinition ( createPropDef ( PropertyIds . IS_VERSION_SERIES_CHECKED_OUT , "Is Verison Series Checked Out" , "Is Verison Series Checked Out" , PropertyType . BOOLEAN , Cardinality . SINGLE , Updatability . READONLY , false , false ) ) ; type . addPropertyDefinition ( createPropDef ( PropertyIds . VERSION_SERIES_CHECKED_OUT_ID , "Version Series Checked Out Id" , "Version Series Checked Out Id" , PropertyType . ID , Cardinality . SINGLE , Updatability . READONLY , false , false ) ) ; type . addPropertyDefinition ( createPropDef ( PropertyIds . VERSION_SERIES_CHECKED_OUT_BY , "Version Series Checked Out By" , "Version Series Checked Out By" , PropertyType . STRING , Cardinality . SINGLE , Updatability . READONLY , false , false ) ) ; type . addPropertyDefinition ( createPropDef ( PropertyIds . CHECKIN_COMMENT , "Checkin Comment" , "Checkin Comment" , PropertyType . STRING , Cardinality . SINGLE , Updatability . READONLY , false , false ) ) ; type . addPropertyDefinition ( createPropDef ( PropertyIds . CONTENT_STREAM_LENGTH , "Content Stream Length" , "Content Stream Length" , PropertyType . INTEGER , Cardinality . SINGLE , Updatability . READONLY , false , false ) ) ; type . addPropertyDefinition ( createPropDef ( PropertyIds . CONTENT_STREAM_MIME_TYPE , "MIME Type" , "MIME Type" , PropertyType . STRING , Cardinality . SINGLE , Updatability . READONLY , false , false ) ) ; type . addPropertyDefinition ( createPropDef ( PropertyIds . CONTENT_STREAM_FILE_NAME , "Filename" , "Filename" , PropertyType . STRING , Cardinality . SINGLE , Updatability . READONLY , false , false ) ) ; type . addPropertyDefinition ( createPropDef ( PropertyIds . CONTENT_STREAM_ID , "Content Stream Id" , "Content Stream Id" , PropertyType . ID , Cardinality . SINGLE , Updatability . READONLY , false , false ) ) ; |
public class MultipleAddresses { /** * Returns the list of addresses that matches the specified type . Examples of address
* type are : TO , CC , BCC , etc . .
* @ param type Examples of address type are : TO , CC , BCC , etc .
* @ return the list of addresses that matches the specified type . */
public List < Address > getAddressesOfType ( Type type ) { } } | List < Address > answer = new ArrayList < > ( addresses . size ( ) ) ; for ( Address address : addresses ) { if ( address . getType ( ) . equals ( type ) ) { answer . add ( address ) ; } } return answer ; |
public class GenJsCodeVisitor { /** * Generate code to verify the runtime types of the input params . Also typecasts the input
* parameters and assigns them to local variables for use in the template .
* @ param node the template node . */
@ CheckReturnValue protected Statement genParamTypeChecks ( TemplateNode node , String alias ) { } } | ImmutableList . Builder < Statement > declarations = ImmutableList . builder ( ) ; for ( TemplateParam param : node . getAllParams ( ) ) { String paramName = param . name ( ) ; SoyType paramType = param . type ( ) ; CodeChunk . Generator generator = templateTranslationContext . codeGenerator ( ) ; Expression paramChunk = genCodeForParamAccess ( paramName , param ) ; JsType jsType = getJsTypeForParamTypeCheck ( paramType ) ; // The opt _ param . name value that will be type - tested .
String paramAlias = genParamAlias ( paramName ) ; Expression coerced = jsType . getValueCoercion ( paramChunk , generator ) ; if ( coerced != null ) { // since we have coercion logic , dump into a temporary
paramChunk = generator . declarationBuilder ( ) . setRhs ( coerced ) . build ( ) . ref ( ) ; } if ( param . hasDefault ( ) ) { if ( coerced == null ) { paramChunk = generator . declarationBuilder ( ) . setRhs ( paramChunk ) . build ( ) . ref ( ) ; } declarations . add ( genParamDefault ( param , paramChunk , alias , jsType , /* declareStatic = */
true ) ) ; } // The param value to assign
Expression value ; Optional < Expression > soyTypeAssertion = jsType . getSoyTypeAssertion ( paramChunk , paramName , generator ) ; // The type - cast expression .
if ( soyTypeAssertion . isPresent ( ) ) { value = soyTypeAssertion . get ( ) ; } else { value = paramChunk ; } VariableDeclaration . Builder declarationBuilder = VariableDeclaration . builder ( paramAlias ) . setRhs ( value ) . setGoogRequires ( jsType . getGoogRequires ( ) ) ; declarationBuilder . setJsDoc ( JsDoc . builder ( ) . addParameterizedAnnotation ( "type" , getJsTypeForParamForDeclaration ( paramType ) . typeExpr ( ) ) . build ( ) ) ; VariableDeclaration declaration = declarationBuilder . build ( ) ; declarations . add ( declaration ) ; templateTranslationContext . soyToJsVariableMappings ( ) // TODO ( lukes ) : this should really be declartion . ref ( ) but we cannot do that until
// everything is on the code chunk api .
. put ( paramName , id ( paramAlias ) ) ; } return Statement . of ( declarations . build ( ) ) ; |
public class JsHdrsImpl { /** * Set the value of the ExceptionTimestamp in the message header .
* Javadoc description supplied by JsMessage interface . */
public final void setExceptionTimestamp ( long value ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setExceptionTimestamp" , Long . valueOf ( value ) ) ; boolean wasEmpty = ( getHdr2 ( ) . getChoiceField ( JsHdr2Access . EXCEPTION ) == JsHdr2Access . IS_EXCEPTION_EMPTY ) ; getHdr2 ( ) . setLongField ( JsHdr2Access . EXCEPTION_DETAIL_TIMESTAMP , value ) ; if ( wasEmpty ) { // Need to mark the optional exception fields as empty
getHdr2 ( ) . setChoiceField ( JsHdr2Access . EXCEPTION_DETAIL_PROBLEMDESTINATION , JsHdr2Access . IS_EXCEPTION_DETAIL_PROBLEMDESTINATION_EMPTY ) ; getHdr2 ( ) . setChoiceField ( JsHdr2Access . EXCEPTION_DETAIL_PROBLEMSUBSCRIPTION , JsHdr2Access . IS_EXCEPTION_DETAIL_PROBLEMSUBSCRIPTION_EMPTY ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setExceptionTimestamp" ) ; |
public class Vector2i { /** * / * ( non - Javadoc )
* @ see org . joml . Vector2ic # mul ( int , int , org . joml . Vector2i ) */
public Vector2i mul ( int x , int y , Vector2i dest ) { } } | dest . x = this . x * x ; dest . y = this . y * y ; return dest ; |
public class JSTypeRegistry { /** * Registers template types on the given scope root . This takes a Node rather than a
* StaticScope because at the time it is called , the scope has not yet been created . */
public void registerTemplateTypeNamesInScope ( Iterable < TemplateType > keys , Node scopeRoot ) { } } | for ( TemplateType key : keys ) { scopedNameTable . put ( scopeRoot , key . getReferenceName ( ) , key ) ; } |
public class PresentationManager { /** * Returns the internacionalized string for the given key */
public String message ( String key , Object ... params ) { } } | if ( key == null ) { return null ; } try { String string = ( getResourceBundle ( ) . containsKey ( key ) ) ? getResourceBundle ( ) . getString ( key ) : key ; if ( params != null ) { for ( int i = 0 ; i < params . length ; i ++ ) { String param = ( params [ i ] == null ) ? "" : params [ i ] . toString ( ) ; string = string . replaceAll ( "\\{" + i + "\\}" , param ) ; } } return string ; } catch ( Exception e ) { return key ; } |
public class Condition { /** * One or more values to evaluate against the supplied attribute . The number of values in the list depends on the
* < code > ComparisonOperator < / code > being used .
* For type Number , value comparisons are numeric .
* String value comparisons for greater than , equals , or less than are based on ASCII character code values . For
* example , < code > a < / code > is greater than < code > A < / code > , and < code > a < / code > is greater than < code > B < / code > . For a
* list of code values , see < a
* href = " http : / / en . wikipedia . org / wiki / ASCII # ASCII _ printable _ characters " > http : / / en . wikipedia
* . org / wiki / ASCII # ASCII _ printable _ characters < / a > .
* For Binary , DynamoDB treats each byte of the binary data as unsigned when it compares binary values .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setAttributeValueList ( java . util . Collection ) } or { @ link # withAttributeValueList ( java . util . Collection ) } if
* you want to override the existing values .
* @ param attributeValueList
* One or more values to evaluate against the supplied attribute . The number of values in the list depends on
* the < code > ComparisonOperator < / code > being used . < / p >
* For type Number , value comparisons are numeric .
* String value comparisons for greater than , equals , or less than are based on ASCII character code values .
* For example , < code > a < / code > is greater than < code > A < / code > , and < code > a < / code > is greater than
* < code > B < / code > . For a list of code values , see < a
* href = " http : / / en . wikipedia . org / wiki / ASCII # ASCII _ printable _ characters "
* > http : / / en . wikipedia . org / wiki / ASCII # ASCII _ printable _ characters < / a > .
* For Binary , DynamoDB treats each byte of the binary data as unsigned when it compares binary values .
* @ return Returns a reference to this object so that method calls can be chained together . */
public Condition withAttributeValueList ( AttributeValue ... attributeValueList ) { } } | if ( this . attributeValueList == null ) { setAttributeValueList ( new java . util . ArrayList < AttributeValue > ( attributeValueList . length ) ) ; } for ( AttributeValue ele : attributeValueList ) { this . attributeValueList . add ( ele ) ; } return this ; |
public class DateTimeParserBucket { /** * Restores the state of this bucket from a previously saved state . The
* state object passed into this method is not consumed , and it can be used
* later to restore to that state again .
* @ param savedState opaque saved state , returned from saveState
* @ return true state object is valid and state restored */
public boolean restoreState ( Object savedState ) { } } | if ( savedState instanceof SavedState ) { if ( ( ( SavedState ) savedState ) . restoreState ( this ) ) { iSavedState = savedState ; return true ; } } return false ; |
public class ApiOvhDbaaslogs { /** * Display specified offer
* REST : GET / dbaas / logs / offer / { reference }
* @ param reference [ required ] Reference */
public OvhPublicOffer offer_reference_GET ( String reference ) throws IOException { } } | String qPath = "/dbaas/logs/offer/{reference}" ; StringBuilder sb = path ( qPath , reference ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhPublicOffer . class ) ; |
public class ContainerRegistry { /** * Looks up a Collection of Containers by their identifiers .
* The returned Collection preserves the iteration order of the passed - in Collection .
* @ return Collection of Containers . */
public Collection < C > getAll ( Collection < String > ids ) { } } | Set < C > list = new LinkedHashSet < C > ( ) ; for ( String id : ids ) { C container = get ( id ) ; if ( container != null ) { list . add ( container ) ; } } return list ; |
public class HelpView { /** * Initialize the topic tree . Converts the Oracle help TopicTreeNode - based tree to a
* HelpTopicNode - based tree .
* @ param htnParent Current help topic node .
* @ param children List of child nodes . */
private void initTopicTree ( HelpTopicNode htnParent , List < ? > children ) { } } | if ( children != null ) { for ( Object node : children ) { TopicTreeNode ttnChild = ( TopicTreeNode ) node ; Topic topic = ttnChild . getTopic ( ) ; Target target = topic . getTarget ( ) ; String source = view . getBook ( ) . getBookTitle ( ) ; URL url = null ; try { url = target == null ? null : target . getURL ( ) ; } catch ( MalformedURLException e ) { } HelpTopic ht = new HelpTopic ( url , topic . getLabel ( ) , source ) ; HelpTopicNode htnChild = new HelpTopicNode ( ht ) ; htnParent . addChild ( htnChild ) ; initTopicTree ( htnChild , ttnChild ) ; } } |
public class DeviceProxyDAODefaultImpl { public DeviceDataHistory [ ] command_history ( final DeviceProxy deviceProxy , final String cmdname , final int nb ) throws DevFailed { } } | checkIfTango ( deviceProxy , "command_history" ) ; build_connection ( deviceProxy ) ; if ( DeviceProxy . isCheck_idl ( ) && get_idl_version ( deviceProxy ) < 2 ) { Except . throw_non_supported_exception ( "TangoApi_IDL_NOT_SUPPORTED" , "Not supported by the IDL version used by device" , deviceProxy . getFull_class_name ( ) + ".command_history()" ) ; } DeviceDataHistory [ ] histories = new DeviceDataHistory [ 0 ] ; try { // Check IDL revision to know kind of history .
if ( deviceProxy . device_5 != null ) { final DevCmdHistory_4 cmdHistory = deviceProxy . device_5 . command_inout_history_4 ( cmdname , nb ) ; histories = ConversionUtil . commandHistoryToDeviceDataHistoryArray ( cmdname , cmdHistory ) ; } else if ( deviceProxy . device_4 != null ) { final DevCmdHistory_4 cmdHistory = deviceProxy . device_4 . command_inout_history_4 ( cmdname , nb ) ; histories = ConversionUtil . commandHistoryToDeviceDataHistoryArray ( cmdname , cmdHistory ) ; } else { final DevCmdHistory [ ] cmdHistory = deviceProxy . device_2 . command_inout_history_2 ( cmdname , nb ) ; histories = new DeviceDataHistory [ cmdHistory . length ] ; for ( int i = 0 ; i < cmdHistory . length ; i ++ ) { histories [ i ] = new DeviceDataHistory ( cmdname , cmdHistory [ i ] ) ; } } } catch ( final DevFailed e ) { throw e ; } catch ( final Exception e ) { throw_dev_failed ( deviceProxy , e , "command_inout_history()" , false ) ; } return histories ; |
public class ApacheUtils { /** * Returns a new instance of NTCredentials used for proxy authentication . */
private static Credentials newNTCredentials ( HttpClientSettings settings ) { } } | return new NTCredentials ( settings . getProxyUsername ( ) , settings . getProxyPassword ( ) , settings . getProxyWorkstation ( ) , settings . getProxyDomain ( ) ) ; |
public class KnowledgePackageImpl { /** * Add a rule flow to this package . */
public void addProcess ( Process process ) { } } | ResourceTypePackageRegistry rtps = getResourceTypePackages ( ) ; ProcessPackage rtp = ProcessPackage . getOrCreate ( rtps ) ; rtp . add ( process ) ; |
public class PrivilegeImpl { /** * Tests given privilege .
* @ param p the given privilege .
* @ return true if this privilege equals or aggregates given privilege . */
public boolean contains ( Privilege p ) { } } | if ( p . getName ( ) . equalsIgnoreCase ( this . getName ( ) ) ) { return true ; } Privilege [ ] list = getAggregatePrivileges ( ) ; for ( Privilege privilege : list ) { if ( privilege . getName ( ) . equalsIgnoreCase ( p . getName ( ) ) ) { return true ; } } return false ; |
public class SecureUtil { /** * 加密除pin之外的其他信息
* @ param publicKey
* @ param plainData
* @ return
* @ throws Exception */
private static byte [ ] encryptData ( PublicKey publicKey , byte [ ] plainData ) throws Exception { } } | try { Cipher cipher = Cipher . getInstance ( "RSA/ECB/PKCS1Padding" , "BC" ) ; cipher . init ( Cipher . ENCRYPT_MODE , publicKey ) ; return cipher . doFinal ( plainData ) ; } catch ( Exception e ) { throw new Exception ( e . getMessage ( ) ) ; } |
public class AWSAppSyncClient { /** * Get a < code > Function < / code > .
* @ param getFunctionRequest
* @ return Result of the GetFunction operation returned by the service .
* @ throws ConcurrentModificationException
* Another modification is in progress at this time and it must complete before you can make your change .
* @ throws NotFoundException
* The resource specified in the request was not found . Check the resource , and then try again .
* @ throws UnauthorizedException
* You are not authorized to perform this operation .
* @ sample AWSAppSync . GetFunction
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / appsync - 2017-07-25 / GetFunction " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public GetFunctionResult getFunction ( GetFunctionRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetFunction ( request ) ; |
public class ShareableResource { /** * Set the resource consumption of a VM .
* @ param vm the VM
* @ param val the value to set
* @ return the current resource */
public ShareableResource setConsumption ( VM vm , int val ) { } } | if ( val < 0 ) { throw new IllegalArgumentException ( String . format ( "The '%s' consumption of VM '%s' must be >= 0" , rcId , vm ) ) ; } vmsConsumption . put ( vm , val ) ; return this ; |
public class Element { /** * Add element Attributes .
* The attributes are added to the Element attributes ( separated with
* a space ) . The attributes are available to the derived class in the
* protected member String < I > attributes < / I >
* @ deprecated Use attribute ( String ) .
* @ param attributes String of HTML attributes to add to the element .
* @ return This Element so calls can be chained . */
public Element attributes ( String attributes ) { } } | if ( log . isDebugEnabled ( ) && attributes != null && attributes . indexOf ( '=' ) >= 0 ) log . debug ( "Set attribute with old method: " + attributes + " on " + getClass ( ) . getName ( ) ) ; if ( attributes == null ) { this . attributes = null ; return this ; } if ( attributes == noAttributes ) return this ; if ( this . attributes == null ) this . attributes = attributes ; else this . attributes += ' ' + attributes ; return this ; |
public class GradientDef { /** * < pre >
* The gradient function ' s name .
* < / pre >
* < code > optional string gradient _ func = 2 ; < / code > */
public com . google . protobuf . ByteString getGradientFuncBytes ( ) { } } | java . lang . Object ref = gradientFunc_ ; if ( ref instanceof java . lang . String ) { com . google . protobuf . ByteString b = com . google . protobuf . ByteString . copyFromUtf8 ( ( java . lang . String ) ref ) ; gradientFunc_ = b ; return b ; } else { return ( com . google . protobuf . ByteString ) ref ; } |
public class URI { /** * Resolve the base and relative path .
* @ param basePath a character array of the basePath
* @ param relPath a character array of the relPath
* @ return the resolved path
* @ throws URIException no more higher path level to be resolved */
protected char [ ] resolvePath ( char [ ] basePath , char [ ] relPath ) throws URIException { } } | // REMINDME : paths are never null
String base = ( basePath == null ) ? "" : new String ( basePath ) ; // _ path could be empty
if ( relPath == null || relPath . length == 0 ) { return normalize ( basePath ) ; } else if ( relPath [ 0 ] == '/' ) { return normalize ( relPath ) ; } else { int at = base . lastIndexOf ( '/' ) ; if ( at != - 1 ) { basePath = base . substring ( 0 , at + 1 ) . toCharArray ( ) ; } StringBuffer buff = new StringBuffer ( base . length ( ) + relPath . length ) ; buff . append ( ( at != - 1 ) ? base . substring ( 0 , at + 1 ) : "/" ) ; buff . append ( relPath ) ; return normalize ( buff . toString ( ) . toCharArray ( ) ) ; } |
public class Strings { /** * Utility to figure out if a character is printable to the console as
* a character . Returns false if one of :
* < ul >
* < li > The character is a control character .
* < li > The character is not defined .
* < li > The character does not have a known representation .
* < / ul >
* @ param cp The character unicode code point .
* @ return If it is printable . */
public static boolean isConsolePrintable ( int cp ) { } } | return ( cp >= 0x20 && cp < 0x7F ) || // main printable ascii
Character . isDefined ( cp ) && ! ( ( cp < 0x0020 && cp != '\n' ) || ( 0x007F <= cp && cp < 0x00A0 ) || Character . isIdentifierIgnorable ( cp ) || ( 0x07e8 <= cp && cp <= 0x07f3 ) || ( 0x07f6 <= cp && cp <= 0x0900 ) || cp == 0x0ac6 || ( 0x0bfc <= cp && cp <= 0x0d01 ) || cp == 0x0f8c || cp == 0x10cd || cp == 0x10fd || cp == 0x10fe || cp == 0x10ff || ( 0x1a20 <= cp && cp <= 0x1cff ) || cp == 0x1680 || ( 0x1701 <= cp && cp <= 0x1711 ) || ( 0x1740 <= cp && cp <= 0x1770 ) || cp == 0x1772 || cp == 0x1773 || ( 0x1800 <= cp && cp <= 0x18af ) || ( 0x1900 <= cp && cp <= 0x194f ) || ( 0x1980 <= cp && cp <= 0x19df ) || cp == 0x1dcd || cp == 0x1dce || cp == 0x1dd0 || cp == 0x2028 || cp == 0x2c22 || cp == 0x2c2b || cp == 0x2c2c || cp == 0x2c2d || cp == 0x2c52 || cp == 0x2c5b || cp == 0x2c5c || cp == 0x2c5d || ( 0x2cb2 <= cp && cp <= 0x2cbf ) || ( 0x2cc2 <= cp && cp <= 0x2cc7 ) || ( 0x2ccc <= cp && cp <= 0x2ce3 ) || ( 0x2ceb <= cp && cp <= 0x2cee ) || ( 0x2cf0 <= cp && cp <= 0x2cfc ) || cp == 0x2d70 || ( 0xa000 <= cp && cp <= 0xa4cf ) || ( 0xa674 <= cp && cp <= 0xa67b ) || ( 0xa698 <= cp && cp <= 0xa6ff ) || cp == 0xa754 || cp == 0xa755 || cp == 0xa758 || cp == 0xa759 || ( 0xa75c <= cp && cp <= 0xa763 ) || ( 0xa76a <= cp && cp <= 0xa76d ) || ( 0xa771 <= cp && cp <= 0xa778 ) || ( 0xa800 <= cp && cp <= 0xa8df ) || ( 0xa930 <= cp && cp <= 0xa95f ) || ( 0xa97d <= cp && cp <= 0xaa5e ) || ( 0xaa7c <= cp && cp <= 0xaaff ) || ( 0xab30 <= cp && cp <= 0xabff ) || ( 0xd7fc <= cp && cp <= 0xdfff ) || ( 0xe47f <= cp && cp <= 0xe48a ) || ( 0xe4c5 <= cp && cp <= 0xe4ff ) || cp == 0xe506 || ( 0xe50b <= cp && cp <= 0xe50e ) || cp == 0xe52d || ( 0xe534 <= cp && cp <= 0xe547 ) || cp == 0xe55d || ( 0xe560 <= cp && cp <= 0xe56f ) || cp == 0xe576 || cp == 0xe577 || ( 0xe57d <= cp && cp <= 0xe583 ) || ( 0xe588 <= cp && cp <= 0xe58c ) || cp == 0xe591 || cp == 0xe592 || ( 0xe598 <= cp && cp <= 0xe67f ) || ( 0xe6a4 <= cp && cp <= 0xee68 && cp != 0xec0b && cp != 0xec96 && cp != 0xec97 && cp != 0xec99 && cp != 0xec9d ) || ( 0xee94 <= cp && cp <= 0xeeff ) || ( 0xef1a <= cp && cp <= 0xefec ) || ( 0xfd40 <= cp && cp <= 0xfdff ) ) ; |
public class ForkedJvm { /** * Gets the JAR file or directory that contains the specified resource .
* @ param resource
* The absolute name of the resource to find , may be < code > null < / code > .
* @ param loader
* The class loader to use for searching the resource , may be
* < code > null < / code > .
* @ return The absolute path to the resource location or < code > null < / code > if
* unknown . */
@ Nullable private static File _getResourceSource ( final String resource , final ClassLoader loader ) { } } | if ( resource != null ) { URL url ; if ( loader != null ) { url = loader . getResource ( resource ) ; } else { url = ClassLoader . getSystemResource ( resource ) ; } return UrlUtils . getResourceRoot ( url , resource ) ; } return null ; |
public class Files { /** * Appends a character sequence ( such as a string ) to a file using the given character set .
* @ param from the character sequence to append
* @ param to the destination file
* @ param charset the charset used to encode the output stream ; see { @ link StandardCharsets } for
* helpful predefined constants
* @ throws IOException if an I / O error occurs */
public static void append ( CharSequence from , File to , Charset charset ) throws IOException { } } | write ( from , to , charset , true ) ; |
public class PingManager { /** * Cancels any existing periodic ping task if there is one and schedules a new ping task if
* pingInterval is greater then zero .
* @ param delta the delta to the last received stanza in seconds */
private synchronized void maybeSchedulePingServerTask ( int delta ) { } } | maybeStopPingServerTask ( ) ; if ( pingInterval > 0 ) { int nextPingIn = pingInterval - delta ; LOGGER . fine ( "Scheduling ServerPingTask in " + nextPingIn + " seconds (pingInterval=" + pingInterval + ", delta=" + delta + ")" ) ; nextAutomaticPing = schedule ( pingServerRunnable , nextPingIn , TimeUnit . SECONDS ) ; } |
public class IndexBuilder { /** * Put all the members ( fields , methods and constructors ) in the te
* to the indexmap .
* @ param te TypeElement whose members will be added to the indexmap . */
protected void putMembersInIndexMap ( TypeElement te ) { } } | adjustIndexMap ( utils . getAnnotationFields ( te ) ) ; adjustIndexMap ( utils . getFields ( te ) ) ; adjustIndexMap ( utils . getMethods ( te ) ) ; adjustIndexMap ( utils . getConstructors ( te ) ) ; adjustIndexMap ( utils . getEnumConstants ( te ) ) ; |
public class PopupCallback { /** * from AsyncCallback < T > */
public void onFailure ( Throwable cause ) { } } | if ( _errorNear == null ) { Popups . error ( formatError ( cause ) ) ; } else { Popups . errorBelow ( formatError ( cause ) , _errorNear ) ; } Console . log ( "Service request failed" , cause ) ; |
public class RemoteServiceChannel { /** * Configures the RemoteServiceChannel with given properties . */
protected void configure ( Properties p ) { } } | _properties = p ; _host = ( String ) p . remove ( HOST ) ; if ( _host == null ) throw new NoSuchElementException ( HOST ) ; _path = ( String ) p . remove ( PATH ) ; if ( _path == null ) throw new NoSuchElementException ( PATH ) ; |
public class CMStatefulBeanO { /** * Inform this < code > SessionBeanO < / code > that the transaction
* it was enlisted with has rolled back . < p > */
@ Override public final synchronized void rollback ( ContainerTx tx ) throws RemoteException { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "rollback: " + StateStrs [ state ] , tx ) ; if ( removed ) { if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "rollback: removed" ) ; return ; } switch ( state ) { // These are the " normal " rollback points
case COMMITTING_OUTSIDE_METHOD : case TX_METHOD_READY : case AFTER_BEGIN : // d159152
setState ( METHOD_READY ) ; break ; // We also could be rolledback " unexpectedly " at these points
case TX_IN_METHOD : case REMOVING : // d159152
setState ( IN_METHOD ) ; break ; // Rollback in the DESTROYED state can / should only occur if there
// was an exception from the customer beforeCompletion method .
// Otherwise , the bean should have been delisted . d160910
case DESTROYED : if ( ivBeforeCompletion != null || sessionSync != null ) { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "SessionSynchronization.beforeCompletion exception?" ) ; } else { if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "rollback: InvalidBeanOStateException: " + StateStrs [ state ] ) ; throw new InvalidBeanOStateException ( StateStrs [ state ] , "COMMITTING_OUTSIDE_METHOD | " + "TX_METHOD_READY | TX_IN_METHOD" ) ; } break ; default : if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "rollback: InvalidBeanOStateException: " + StateStrs [ state ] ) ; throw new InvalidBeanOStateException ( StateStrs [ state ] , "COMMITTING_OUTSIDE_METHOD | " + "TX_METHOD_READY | TX_IN_METHOD" ) ; } if ( tx . ivRemoveBeanO == this ) { completeRemoveMethod ( tx ) ; // d647928
} else { // Perform normal afterCompletion processing . . . . calling
// afterCompletion if present .
// Save the above determined state and set to AFTER _ COMPLETION for
// the duration of the afterCompletion callback . d159152
int savedState = state ; setState ( AFTER_COMPLETION ) ; // Session Synchronization AfterCompletion needs to be called if either
// the annotation ( or XML ) was specified or the bean implemented
// the interface and a global transaction is active . F743-25855
if ( ( ivAfterCompletion != null || sessionSync != null ) && tx . isTransactionGlobal ( ) ) { EJBThreadData threadData = EJSContainer . getThreadData ( ) ; threadData . pushContexts ( this ) ; try { if ( ivAfterCompletion != null ) { invokeSessionSynchMethod ( ivAfterCompletion , new Object [ ] { false } ) ; } else { sessionSync . afterCompletion ( false ) ; } } finally { threadData . popContexts ( ) ; } } setState ( savedState ) ; // d159152
} // currentTx is now reset in atCommit / atRollback AFTER the final pin
// is undone . d258770
// currentTx = null ; / / PQ99986
if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "rollback: " + StateStrs [ state ] ) ; |
public class CPMeasurementUnitPersistenceImpl { /** * Returns the first cp measurement unit in the ordered set where groupId = & # 63 ; and primary = & # 63 ; and type = & # 63 ; .
* @ param groupId the group ID
* @ param primary the primary
* @ param type the type
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching cp measurement unit , or < code > null < / code > if a matching cp measurement unit could not be found */
@ Override public CPMeasurementUnit fetchByG_P_T_First ( long groupId , boolean primary , int type , OrderByComparator < CPMeasurementUnit > orderByComparator ) { } } | List < CPMeasurementUnit > list = findByG_P_T ( groupId , primary , type , 0 , 1 , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ; |
public class ConsumerMonitorRegistrar { /** * Method retrieveCallbackFromConnectionIndex
* Retrieves an existing callback from the callback index .
* @ param topicExpression
* @ param isWildcarded
* @ param callback
* @ return */
public TopicRecord retrieveCallbackFromConnectionIndex ( ConnectionImpl connection , ConsumerSetChangeCallback callback ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "retrieveCallbackFromConnectionIndex" , new Object [ ] { connection , callback } ) ; TopicRecord tRecord = null ; if ( _callbackIndex . containsKey ( connection ) ) { // Have found registered callbacks for this connection
Map connMap = ( HashMap ) _callbackIndex . get ( connection ) ; // Locate the specific callback
tRecord = ( TopicRecord ) connMap . get ( callback ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "retrieveCallbackFromConnectionIndex" , tRecord ) ; return tRecord ; |
public class Iterables { /** * Returns an iterable that provides an iterator that only returns the
* elements provided by the iterator of the given iterable to which
* the given predicate applies .
* @ param < T > The element type
* @ param iterable The delegate iterable
* @ param predicate The predicate
* @ return The iterator */
public static < T > Iterable < T > filteringIterable ( final Iterable < ? extends T > iterable , final Predicate < ? super T > predicate ) { } } | Objects . requireNonNull ( iterable , "The iterable is null" ) ; Objects . requireNonNull ( predicate , "The predicate is null" ) ; return new Iterable < T > ( ) { @ Override public Iterator < T > iterator ( ) { return new FilteringIterator < T > ( iterable . iterator ( ) , predicate ) ; } } ; |
public class DBQuery { /** * The field is equal to the given value
* @ param field The field to compare
* @ param value The value to compare to
* @ return the query */
public static Query is ( String field , Object value ) { } } | return new Query ( ) . is ( field , value ) ; |
public class CommerceAddressUtil { /** * Returns the first commerce address in the ordered set where commerceCountryId = & # 63 ; .
* @ param commerceCountryId the commerce country ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce address , or < code > null < / code > if a matching commerce address could not be found */
public static CommerceAddress fetchByCommerceCountryId_First ( long commerceCountryId , OrderByComparator < CommerceAddress > orderByComparator ) { } } | return getPersistence ( ) . fetchByCommerceCountryId_First ( commerceCountryId , orderByComparator ) ; |
public class EsMarshalling { /** * Marshals the given bean into the given map .
* @ param bean the bean
* @ return the content builder
* @ throws StorageException when a storage problem occurs while storing a bean */
public static XContentBuilder marshall ( RoleMembershipBean bean ) throws StorageException { } } | try ( XContentBuilder builder = XContentFactory . jsonBuilder ( ) ) { preMarshall ( bean ) ; builder . startObject ( ) . field ( "id" , bean . getId ( ) ) . field ( "organizationId" , bean . getOrganizationId ( ) ) . field ( "roleId" , bean . getRoleId ( ) ) . field ( "userId" , bean . getUserId ( ) ) . field ( "createdOn" , bean . getCreatedOn ( ) . getTime ( ) ) . endObject ( ) ; postMarshall ( bean ) ; return builder ; } catch ( IOException e ) { throw new StorageException ( e ) ; } |
public class MethodInfo { /** * JAXB用のアノテーション情報を設定するメソッド 。
* < p > XMLの読み込み時に呼ばれます 。
* < br > ただし 、 Java8からはこのメソッドは呼ばれず 、 { @ link # getAnnotationInfos ( ) } で取得したインスタンスに対して要素が追加されます 。
* < p > 既存の情報はクリアされます 。 < / p >
* @ since 1.1
* @ param annotationInfos アノテーション情報 。 */
@ XmlElement ( name = "annotation" ) public void setAnnotationInfos ( final List < AnnotationInfo > annotationInfos ) { } } | if ( annotationInfos == this . annotationInfos ) { // Java7の場合 、 getterで取得したインスタンスをそのまま設定するため 、 スキップする 。
return ; } this . annotationInfos . clear ( ) ; for ( AnnotationInfo item : annotationInfos ) { addAnnotationInfo ( item ) ; } |
public class Mapper { /** * Create a new Map by mapping all keys from the original map and maintaining the original value .
* @ param mapper a Mapper to map the keys
* @ param map a Map
* @ return a new Map with keys mapped */
public static Map mapKeys ( Mapper mapper , Map map ) { } } | return mapKeys ( mapper , map , false ) ; |
public class CPInstanceLocalServiceBaseImpl { /** * Returns the cp instance matching the UUID and group .
* @ param uuid the cp instance ' s UUID
* @ param groupId the primary key of the group
* @ return the matching cp instance , or < code > null < / code > if a matching cp instance could not be found */
@ Override public CPInstance fetchCPInstanceByUuidAndGroupId ( String uuid , long groupId ) { } } | return cpInstancePersistence . fetchByUUID_G ( uuid , groupId ) ; |
public class WhileyFileParser { /** * Attempt to match a given sequence of tokens in the given order , whilst
* ignoring any whitespace in between . Note that , in any case , the index
* will be unchanged !
* @ param terminated
* Indicates whether or not this function should be concerned
* with new lines . The terminated flag indicates whether or not
* the current construct being parsed is known to be terminated .
* If so , then we don ' t need to worry about newlines and can
* greedily consume them ( i . e . since we ' ll eventually run into
* the terminating symbol ) .
* @ param kinds
* @ return whether the sequence matches */
private boolean lookaheadSequence ( boolean terminated , Token . Kind ... kinds ) { } } | int next = index ; for ( Token . Kind k : kinds ) { next = terminated ? skipWhiteSpace ( next ) : skipLineSpace ( next ) ; if ( next >= tokens . size ( ) || tokens . get ( next ++ ) . kind != k ) { return false ; } } return true ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.