signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class MariaDbResultSetMetaData { /** * Get the designated column ' s name .
* @ param column the first column is 1 , the second is 2 , . . .
* @ return column name
* @ throws SQLException if a database access error occurs */
public String getColumnName ( final int column ) throws SQLException { } } | String columnName = getColumnInformation ( column ) . getOriginalName ( ) ; if ( returnTableAlias ) { columnName = getColumnInformation ( column ) . getName ( ) ; // for old mysql compatibility
} if ( "" . equals ( columnName ) ) { // odd things that are no columns , e . g count ( * )
columnName = getColumnLabel ( column ) ; } return columnName ; |
public class CreateInterconnectRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateInterconnectRequest createInterconnectRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createInterconnectRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createInterconnectRequest . getInterconnectName ( ) , INTERCONNECTNAME_BINDING ) ; protocolMarshaller . marshall ( createInterconnectRequest . getBandwidth ( ) , BANDWIDTH_BINDING ) ; protocolMarshaller . marshall ( createInterconnectRequest . getLocation ( ) , LOCATION_BINDING ) ; protocolMarshaller . marshall ( createInterconnectRequest . getLagId ( ) , LAGID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class TypeQualifierApplications { /** * Get the effective TypeQualifierAnnotation on given method parameter .
* Takes into account inherited and default ( outer scope ) annotations . Also
* takes exclusive qualifiers into account .
* @ param xmethod
* a method
* @ param parameter
* a parameter ( 0 = = first parameter )
* @ param typeQualifierValue
* the kind of TypeQualifierValue we are looking for
* @ return effective TypeQualifierAnnotation on the parameter , or null if
* there is no effective TypeQualifierAnnotation */
public static @ CheckForNull TypeQualifierAnnotation getEffectiveTypeQualifierAnnotation ( final XMethod xmethod , final int parameter , TypeQualifierValue < ? > typeQualifierValue ) { } } | TypeQualifierAnnotation tqa = computeEffectiveTypeQualifierAnnotation ( typeQualifierValue , xmethod , parameter ) ; if ( CHECK_EXCLUSIVE && tqa == null && typeQualifierValue . isExclusiveQualifier ( ) ) { tqa = computeExclusiveQualifier ( typeQualifierValue , new ComputeEffectiveTypeQualifierAnnotation ( ) { @ Override public TypeQualifierAnnotation compute ( TypeQualifierValue < ? > tqv ) { return computeEffectiveTypeQualifierAnnotation ( tqv , xmethod , parameter ) ; } @ Override public String toString ( ) { return "parameter " + parameter + " of " + xmethod ; } } ) ; } return tqa ; |
public class DropinMonitor { /** * Takes a file and an optional file type , and updates the file . If no type is given it will use the
* extension of the file given .
* @ param ca the configuration admin service .
* @ param currentFile the file of the application to install . Can be a directory
* @ param type the type of the application . */
private void startApplication ( File currentFile , String type ) { } } | if ( _tc . isEventEnabled ( ) ) { Tr . event ( _tc , "Starting dropin application '" + currentFile . getName ( ) + "'" ) ; } String filePath = getAppLocation ( currentFile ) ; try { Configuration config = _configs . get ( filePath ) ; // This is a new application we don ' t know about so we need to create it .
if ( config == null ) { Hashtable < String , Object > appConfigSettings = new Hashtable < String , Object > ( ) ; appConfigSettings . put ( "location" , filePath ) ; if ( type != null ) { appConfigSettings . put ( "type" , type ) ; } // for application monitor to know if an application is installed by dropin monitor we need to add a unique variable
appConfigSettings . put ( AppManagerConstants . AUTO_INSTALL_PROP , true ) ; // get a handle on the configuration object
config = configAdmin . createFactoryConfiguration ( AppManagerConstants . APPLICATIONS_PID ) ; config . update ( appConfigSettings ) ; _configs . put ( filePath , config ) ; } } catch ( Exception e ) { getAppMessageHelper ( type , filePath ) . error ( "MONITOR_APP_START_FAIL" , filePath ) ; } |
public class XMLUtil { /** * Deserialize an object from the given XML string .
* @ param xmlSerializedObject is the string which is containing the serialized object .
* @ return the serialized object extracted from the XML string .
* @ throws IOException if something wrong append during deserialization .
* @ throws ClassNotFoundException is thrown when the class for the deserialized object is not found . */
@ Pure public static Object parseObject ( String xmlSerializedObject ) throws IOException , ClassNotFoundException { } } | assert xmlSerializedObject != null : AssertMessages . notNullParameter ( 0 ) ; try ( ByteArrayInputStream bais = new ByteArrayInputStream ( Base64 . getDecoder ( ) . decode ( xmlSerializedObject ) ) ) { final ObjectInputStream ois = new ObjectInputStream ( bais ) ; return ois . readObject ( ) ; } |
public class CommandGroup { /** * Create a button stack with buttons for all the commands .
* @ param columnSpec Custom columnSpec for the stack , can be
* < code > null < / code > .
* @ param rowSpec Custom rowspec for each row containing a button can be
* < code > null < / code > .
* @ return never null */
public JComponent createButtonStack ( final ColumnSpec columnSpec , final RowSpec rowSpec ) { } } | return createButtonStack ( columnSpec , rowSpec , null ) ; |
public class CharBufferWriter { /** * ( non - Javadoc )
* @ see java . io . Writer # write ( char [ ] , int , int ) */
@ Override public void write ( char [ ] data , int offset , int length ) throws IOException { } } | while ( true ) { ensureBufferAvailable ( ) ; if ( buffer . remaining ( ) > length ) { buffer . backingBuffer ( ) . put ( data , offset , length ) ; break ; } else if ( buffer . remaining ( ) == length ) { buffer . backingBuffer ( ) . put ( data , offset , length ) ; flush ( false ) ; break ; } else { int chunkSize = buffer . remaining ( ) ; buffer . backingBuffer ( ) . put ( data , offset , chunkSize ) ; flush ( false ) ; length -= chunkSize ; offset += chunkSize ; } } |
public class TurfMeta { /** * Unwrap a coordinate { @ link Point } from a { @ link Feature } with a { @ link Point } geometry .
* @ param obj any value
* @ return a coordinate
* @ see < a href = " http : / / turfjs . org / docs / # getcoord " > Turf getCoord documentation < / a >
* @ since 3.2.0 */
public static Point getCoord ( Feature obj ) { } } | if ( obj . geometry ( ) instanceof Point ) { return ( Point ) obj . geometry ( ) ; } throw new TurfException ( "A Feature with a Point geometry is required." ) ; |
public class SeacloudsRest { /** * Return base url of the metrics endpoint of the Monitoring Platform .
* If an url is supplied in the request , use that value . Else , use MODACLOUDS _ METRICS _ URL env var is set . */
private String getMetricsBaseUrl ( String suppliedBaseUrl , String envBaseUrl ) { } } | String result = ( "" . equals ( suppliedBaseUrl ) ) ? envBaseUrl : suppliedBaseUrl ; logger . debug ( "getMetricsBaseUrl(env={}, supplied={}) = {}" , envBaseUrl , suppliedBaseUrl , result ) ; return result ; |
public class DummyInvocationUtils { /** * Returns a proxy of the given type , backed by an { @ link EmptyTargetSource } to simply drop method invocations but
* equips it with an { @ link InvocationRecordingMethodInterceptor } . The interceptor records the last invocation and
* returns a proxy of the return type that also implements { @ link LastInvocationAware } so that the last method
* invocation can be inspected . Parameters passed to the subsequent method invocation are generally neglected except
* the ones that might be mapped into the URI translation eventually , e . g .
* { @ link org . springframework . web . bind . annotation . PathVariable } in the case of Spring MVC . Note , that the return types
* of the methods have to be capable to be proxied .
* @ param type must not be { @ literal null } .
* @ param parameters parameters to extend template variables in the type level mapping .
* @ return */
public static < T > T methodOn ( Class < T > type , Object ... parameters ) { } } | Assert . notNull ( type , "Given type must not be null!" ) ; InvocationRecordingMethodInterceptor interceptor = new InvocationRecordingMethodInterceptor ( type , parameters ) ; return getProxyWithInterceptor ( type , interceptor , type . getClassLoader ( ) ) ; |
public class Ensure { /** * Checks if the given argument is null and throws an exception with a
* message containing the argument name if that it true .
* @ param argument the argument to check for null
* @ param argumentName the name of the argument to check .
* This is used in the exception message .
* @ param < T > the type of the argument
* @ return the argument itself
* @ throws IllegalArgumentException in case argument is null */
public static < T > T notNull ( T argument , String argumentName ) { } } | if ( argument == null ) { throw new IllegalArgumentException ( "Argument " + argumentName + " must not be null." ) ; } return argument ; |
public class Stapler { /** * Performs stapler processing on the given root object and request URL . */
public void invoke ( HttpServletRequest req , HttpServletResponse rsp , Object root , String url ) throws IOException , ServletException { } } | RequestImpl sreq = new RequestImpl ( this , req , new ArrayList < AncestorImpl > ( ) , new TokenList ( url ) ) ; RequestImpl oreq = CURRENT_REQUEST . get ( ) ; CURRENT_REQUEST . set ( sreq ) ; ResponseImpl srsp = new ResponseImpl ( this , rsp ) ; ResponseImpl orsp = CURRENT_RESPONSE . get ( ) ; CURRENT_RESPONSE . set ( srsp ) ; try { invoke ( sreq , srsp , root ) ; } finally { CURRENT_REQUEST . set ( oreq ) ; CURRENT_RESPONSE . set ( orsp ) ; } |
public class ComputeNodesImpl { /** * Enables task scheduling on the specified compute node .
* You can enable task scheduling on a node only if its current scheduling state is disabled .
* @ param poolId The ID of the pool that contains the compute node .
* @ param nodeId The ID of the compute node on which you want to enable task scheduling .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponseWithHeaders } object if successful . */
public Observable < Void > enableSchedulingAsync ( String poolId , String nodeId ) { } } | return enableSchedulingWithServiceResponseAsync ( poolId , nodeId ) . map ( new Func1 < ServiceResponseWithHeaders < Void , ComputeNodeEnableSchedulingHeaders > , Void > ( ) { @ Override public Void call ( ServiceResponseWithHeaders < Void , ComputeNodeEnableSchedulingHeaders > response ) { return response . body ( ) ; } } ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcParameterValue ( ) { } } | if ( ifcParameterValueEClass == null ) { ifcParameterValueEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 721 ) ; } return ifcParameterValueEClass ; |
public class AddAll { /** * Fluent factory method .
* @ param targetPosition
* @ param sourcePosition
* @ return { @ link AddAll } */
public static < SOURCE , TARGET > AddAll < SOURCE , TARGET > to ( Position . Readable < TARGET > targetPosition , Position . Readable < SOURCE > sourcePosition ) { } } | return new AddAll < > ( sourcePosition , targetPosition ) ; |
public class PrcBankStatementLineSave { /** * < p > Makes document reversed . < / p >
* @ param pReqVars additional param
* @ param pReversing Reversing
* @ param pReversed Reversed
* @ param pLangDef language
* @ throws Exception - an exception */
public final void makeDocReversed ( final Map < String , Object > pReqVars , final ADoc pReversing , final ADoc pReversed , final String pLangDef ) throws Exception { } } | pReversing . setIdDatabaseBirth ( pReversed . getIdDatabaseBirth ( ) ) ; pReversing . setReversedId ( pReversed . getItsId ( ) ) ; pReversing . setReversedIdDatabaseBirth ( pReversed . getIdDatabaseBirth ( ) ) ; pReversing . setItsDate ( new Date ( pReversed . getItsDate ( ) . getTime ( ) + 1 ) ) ; pReversing . setItsTotal ( pReversed . getItsTotal ( ) . negate ( ) ) ; pReversing . setHasMadeAccEntries ( false ) ; getSrvOrm ( ) . insertEntity ( pReqVars , pReversing ) ; pReversing . setIsNew ( false ) ; String oldDesr = "" ; if ( pReversed . getDescription ( ) != null ) { oldDesr = pReversed . getDescription ( ) ; } pReversed . setDescription ( oldDesr + " " + getSrvI18n ( ) . getMsg ( "reversing_n" , pLangDef ) + pReversing . getIdDatabaseBirth ( ) + "-" + pReversing . getItsId ( ) ) ; pReversed . setReversedId ( pReversing . getItsId ( ) ) ; pReversed . setReversedIdDatabaseBirth ( pReversing . getIdDatabaseBirth ( ) ) ; getSrvOrm ( ) . updateEntity ( pReqVars , pReversed ) ; this . srvAccEntry . reverseEntries ( pReqVars , pReversing , pReversed ) ; |
public class dnszone { /** * Use this API to fetch all the dnszone resources that are configured on netscaler .
* This uses dnszone _ args which is a way to provide additional arguments while fetching the resources . */
public static dnszone [ ] get ( nitro_service service , dnszone_args args ) throws Exception { } } | dnszone obj = new dnszone ( ) ; options option = new options ( ) ; option . set_args ( nitro_util . object_to_string_withoutquotes ( args ) ) ; dnszone [ ] response = ( dnszone [ ] ) obj . get_resources ( service , option ) ; return response ; |
public class Search { /** * Validates this { @ link Search } against the specified { @ link Schema } .
* @ param schema A { @ link Schema } . */
public void validate ( Schema schema ) { } } | if ( queryCondition != null || filterCondition != null ) { query ( schema , null ) ; } if ( sort != null ) { sort . sort ( schema ) ; } |
public class CmsShellCommands { /** * Deletes a module . Will ignore any modules depending on the module to delete . < p >
* @ param moduleName the name of the module
* @ throws Exception if something goes wrong */
public void forceDeleteModule ( String moduleName ) throws Exception { } } | OpenCms . getModuleManager ( ) . deleteModule ( m_cms , moduleName , true , new CmsShellReport ( m_cms . getRequestContext ( ) . getLocale ( ) ) ) ; |
public class ConnectionBase { /** * Request to set this connection into a new connection state .
* @ param newState new state to set */
protected final void setState ( final int newState ) { } } | if ( closing < 2 ) { // detect and ignore order of arrival inversion for tunneling . ack / cEMI . con
if ( internalState == OK && newState == ClientConnection . CEMI_CON_PENDING ) return ; internalState = newState ; if ( updateState ) state = newState ; } else state = internalState = CLOSED ; |
public class SiteRegistrationScreen { /** * AddOtherSFields Method . */
public void addOtherSFields ( ) { } } | super . addOtherSFields ( ) ; // Subdomain field
UserInfo recUserInfo = ( UserInfo ) this . getRecord ( UserInfo . USER_INFO_FILE ) ; BaseField field = new StringField ( recUserInfo , "Sub-Domain" , 10 , null , null ) ; field . setVirtual ( true ) ; recUserInfo . addPropertiesFieldBehavior ( field , MenusMessageData . SITE_PREFIX ) ; field . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ; new SStaticString ( this . getNextLocation ( ScreenConstants . RIGHT_OF_LAST , ScreenConstants . DONT_SET_ANCHOR ) , this , "xxxxx.tourgeek.com" ) ; |
public class PlayCollectContext { /** * The minimum number of digits to collect .
* < b > Defaults to one . < / b > This parameter should not be specified if the Digit Pattern parameter is present .
* @ return */
public int getMinimumDigits ( ) { } } | String value = Optional . fromNullable ( getParameter ( SignalParameters . MINIMUM_NUM_DIGITS . symbol ( ) ) ) . or ( "1" ) ; return Integer . parseInt ( value ) ; |
public class VpcConfigRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( VpcConfigRequest vpcConfigRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( vpcConfigRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( vpcConfigRequest . getSubnetIds ( ) , SUBNETIDS_BINDING ) ; protocolMarshaller . marshall ( vpcConfigRequest . getSecurityGroupIds ( ) , SECURITYGROUPIDS_BINDING ) ; protocolMarshaller . marshall ( vpcConfigRequest . getEndpointPublicAccess ( ) , ENDPOINTPUBLICACCESS_BINDING ) ; protocolMarshaller . marshall ( vpcConfigRequest . getEndpointPrivateAccess ( ) , ENDPOINTPRIVATEACCESS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class DetectChessboardCornersPyramid { /** * Creates an image pyrmaid by 2x2 average down sampling the input image . The original input image is at layer
* 0 with each layer after that 1/2 the resolution of the previous . 2x2 down sampling is used because it doesn ' t
* add blur or aliasing . */
private void constructPyramid ( GrayF32 input ) { } } | if ( pyramid . size ( ) == 0 ) { pyramid . add ( input ) ; } else { pyramid . set ( 0 , input ) ; } // make sure the top most layer in the pyramid isn ' t too small
int pyramidTopSize = this . pyramidTopSize ; if ( pyramidTopSize != 0 && pyramidTopSize < ( 1 + 2 * detector . getKernelRadius ( ) ) * 5 ) { pyramidTopSize = ( 1 + 2 * detector . getKernelRadius ( ) ) * 5 ; } int levelIndex = 1 ; int divisor = 2 ; while ( true ) { int width = input . width / divisor ; int height = input . height / divisor ; if ( pyramidTopSize == 0 || width < pyramidTopSize || height < pyramidTopSize ) break ; GrayF32 level ; if ( pyramid . size ( ) <= levelIndex ) { level = new GrayF32 ( width , height ) ; pyramid . add ( level ) ; } else { level = pyramid . get ( levelIndex ) ; level . reshape ( width , height ) ; } AverageDownSampleOps . down ( pyramid . get ( levelIndex - 1 ) , 2 , level ) ; divisor *= 2 ; levelIndex += 1 ; } while ( pyramid . size ( ) > levelIndex ) { pyramid . remove ( pyramid . size ( ) - 1 ) ; } featureLevels . resize ( pyramid . size ( ) ) ; |
public class NotificationHubsInner { /** * test send a push notification .
* @ param resourceGroupName The name of the resource group .
* @ param namespaceName The namespace name .
* @ param notificationHubName The notification hub name .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the DebugSendResponseInner object if successful . */
public DebugSendResponseInner debugSend ( String resourceGroupName , String namespaceName , String notificationHubName ) { } } | return debugSendWithServiceResponseAsync ( resourceGroupName , namespaceName , notificationHubName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class HttpServerMBean { public synchronized void addComponent ( ComponentEvent event ) { } } | try { if ( log . isDebugEnabled ( ) ) log . debug ( "Component added " + event ) ; Object o = event . getComponent ( ) ; ModelMBean mbean = ModelMBeanImpl . mbeanFor ( o ) ; if ( mbean == null ) log . warn ( "No MBean for " + o ) ; else { ObjectName oName = null ; if ( mbean instanceof ModelMBeanImpl ) { ( ( ModelMBeanImpl ) mbean ) . setBaseObjectName ( getObjectName ( ) . toString ( ) ) ; oName = getMBeanServer ( ) . registerMBean ( mbean , null ) . getObjectName ( ) ; } else { oName = uniqueObjectName ( getMBeanServer ( ) , o , getObjectName ( ) . toString ( ) ) ; oName = getMBeanServer ( ) . registerMBean ( mbean , oName ) . getObjectName ( ) ; } Holder holder = new Holder ( oName , mbean ) ; _mbeanMap . put ( o , holder ) ; } } catch ( Exception e ) { log . warn ( LogSupport . EXCEPTION , e ) ; } |
public class HtmlInputFile { /** * < p > Set the value of the < code > onselect < / code > property . < / p > */
public void setOnselect ( java . lang . String onselect ) { } } | getStateHelper ( ) . put ( PropertyKeys . onselect , onselect ) ; handleAttribute ( "onselect" , onselect ) ; |
public class BasePeriod { /** * Adds the value of a field in this period .
* @ param values the array of values to update
* @ param field the field to set
* @ param value the value to set
* @ throws IllegalArgumentException if field is is null or not supported . */
protected void addFieldInto ( int [ ] values , DurationFieldType field , int value ) { } } | int index = indexOf ( field ) ; if ( index == - 1 ) { if ( value != 0 || field == null ) { throw new IllegalArgumentException ( "Period does not support field '" + field + "'" ) ; } } else { values [ index ] = FieldUtils . safeAdd ( values [ index ] , value ) ; } |
public class SerialNmeaGps { /** * Makes a blocking check to find out if the given port supplies GPS data .
* @ param port the port ti check .
* @ return < code > true < / code > if the port supplies NMEA GPS data .
* @ throws Exception */
public static boolean isThisAGpsPort ( String port ) throws Exception { } } | SerialPort comPort = SerialPort . getCommPort ( port ) ; comPort . openPort ( ) ; comPort . setComPortTimeouts ( SerialPort . TIMEOUT_READ_SEMI_BLOCKING , 100 , 0 ) ; int waitTries = 0 ; int parseTries = 0 ; while ( true && waitTries ++ < 10 && parseTries < 2 ) { while ( comPort . bytesAvailable ( ) == 0 ) Thread . sleep ( 500 ) ; byte [ ] readBuffer = new byte [ comPort . bytesAvailable ( ) ] ; int numRead = comPort . readBytes ( readBuffer , readBuffer . length ) ; if ( numRead > 0 ) { String data = new String ( readBuffer ) ; String [ ] split = data . split ( "\n" ) ; for ( String line : split ) { if ( SentenceValidator . isSentence ( line ) ) { return true ; } } parseTries ++ ; } } return false ; |
public class MemberVersion { /** * populate this Version ' s major , minor , patch from given String */
private void parse ( String version ) { } } | String [ ] tokens = StringUtil . tokenizeVersionString ( version ) ; this . major = Byte . valueOf ( tokens [ 0 ] ) ; this . minor = Byte . valueOf ( tokens [ 1 ] ) ; if ( tokens . length > 3 && tokens [ 3 ] != null ) { this . patch = Byte . valueOf ( tokens [ 3 ] ) ; } |
public class FilesImpl { /** * Lists all of the files in task directories on the specified compute node .
* @ param poolId The ID of the pool that contains the compute node .
* @ param nodeId The ID of the compute node whose files you want to list .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; NodeFile & gt ; object */
public Observable < ServiceResponseWithHeaders < Page < NodeFile > , FileListFromComputeNodeHeaders > > listFromComputeNodeWithServiceResponseAsync ( final String poolId , final String nodeId ) { } } | return listFromComputeNodeSinglePageAsync ( poolId , nodeId ) . concatMap ( new Func1 < ServiceResponseWithHeaders < Page < NodeFile > , FileListFromComputeNodeHeaders > , Observable < ServiceResponseWithHeaders < Page < NodeFile > , FileListFromComputeNodeHeaders > > > ( ) { @ Override public Observable < ServiceResponseWithHeaders < Page < NodeFile > , FileListFromComputeNodeHeaders > > call ( ServiceResponseWithHeaders < Page < NodeFile > , FileListFromComputeNodeHeaders > page ) { String nextPageLink = page . body ( ) . nextPageLink ( ) ; if ( nextPageLink == null ) { return Observable . just ( page ) ; } return Observable . just ( page ) . concatWith ( listFromComputeNodeNextWithServiceResponseAsync ( nextPageLink , null ) ) ; } } ) ; |
public class BeanPropertyName { /** * Return the specified Java Bean property name in dashed form .
* @ param name the source name
* @ param start the starting char
* @ return the dashed from */
public static String toDashedForm ( String name , int start ) { } } | StringBuilder result = new StringBuilder ( ) ; String replaced = name . replace ( '_' , '-' ) ; for ( int i = start ; i < replaced . length ( ) ; i ++ ) { char ch = replaced . charAt ( i ) ; if ( Character . isUpperCase ( ch ) && result . length ( ) > 0 && result . charAt ( result . length ( ) - 1 ) != '-' ) { result . append ( '-' ) ; } result . append ( Character . toLowerCase ( ch ) ) ; } return result . toString ( ) ; |
public class OrmLiteConfigUtil { /** * Write a configuration file with the configuration for classes .
* @ param sortClasses
* Set to true to sort the classes by name before the file is generated . */
public static void writeConfigFile ( File configFile , Class < ? > [ ] classes , boolean sortClasses ) throws SQLException , IOException { } } | System . out . println ( "Writing configurations to " + configFile . getAbsolutePath ( ) ) ; writeConfigFile ( new FileOutputStream ( configFile ) , classes , sortClasses ) ; |
public class UITextFormatter { /** * Try to separate the value created from regular < code > toString < / code >
* implementations back into fields : ) This is more of a heuristic .
* @ param aValue
* The source object which ' s < code > toString < / code > method is invoked .
* May be < code > null < / code > .
* @ return A slightly beautified version . */
@ Nonnull public static IHCNode getToStringContent ( final Object aValue ) { } } | final String sOrigValue = String . valueOf ( aValue ) ; if ( StringHelper . startsWith ( sOrigValue , '[' ) && StringHelper . endsWith ( sOrigValue , ']' ) ) { try { final ICommonsList < String > aParts = new CommonsArrayList < > ( ) ; String sValue = sOrigValue . substring ( 1 , sOrigValue . length ( ) - 1 ) ; final String [ ] aObjStart = RegExHelper . getAllMatchingGroupValues ( "([\\[]*)([A-Za-z0-9_$]+@0x[0-9a-fA-F]{8})(?:: (.+))?" , sValue ) ; aParts . add ( aObjStart [ 1 ] ) ; if ( aObjStart [ 2 ] != null ) { sValue = StringHelper . getConcatenatedOnDemand ( aObjStart [ 0 ] , aObjStart [ 2 ] ) . trim ( ) ; if ( sValue . length ( ) > 0 ) { sValue = StringHelper . replaceAll ( sValue , "; " , ";\n" ) ; aParts . addAll ( StringHelper . getExploded ( '\n' , sValue ) ) ; } } final HCNodeList ret = new HCNodeList ( ) ; for ( final String s : aParts ) ret . addChild ( new HCDiv ( ) . addChild ( s ) ) ; return ret ; } catch ( final Exception ex ) { LOGGER . error ( "Failed to format" , ex ) ; } } return new HCTextNode ( sOrigValue ) ; |
public class AbstractQueryProtocol { /** * Read ERR _ Packet .
* @ param buffer current buffer
* @ param results result object
* @ return SQLException if sub - result connection fail
* @ see < a href = " https : / / mariadb . com / kb / en / mariadb / err _ packet / " > ERR _ Packet < / a > */
private SQLException readErrorPacket ( Buffer buffer , Results results ) { } } | removeHasMoreResults ( ) ; this . hasWarnings = false ; buffer . skipByte ( ) ; final int errorNumber = buffer . readShort ( ) ; String message ; String sqlState ; if ( buffer . readByte ( ) == '#' ) { sqlState = new String ( buffer . readRawBytes ( 5 ) ) ; message = buffer . readStringNullEnd ( StandardCharsets . UTF_8 ) ; } else { // Pre - 4.1 message , still can be output in newer versions ( e . g with ' Too many connections ' )
buffer . position -= 1 ; message = new String ( buffer . buf , buffer . position , buffer . limit - buffer . position , StandardCharsets . UTF_8 ) ; sqlState = "HY000" ; } results . addStatsError ( false ) ; // force current status to in transaction to ensure rollback / commit , since command may have issue a transaction
serverStatus |= ServerStatus . IN_TRANSACTION ; removeActiveStreamingResult ( ) ; return new SQLException ( message , sqlState , errorNumber ) ; |
public class DynamicListener { /** * from interface SetListener */
public void entryAdded ( EntryAddedEvent < T > event ) { } } | dispatchMethod ( event . getName ( ) + "Added" , new Object [ ] { event . getEntry ( ) } ) ; |
public class NumericsUtilities { /** * Returns true if two floats are considered equal based on an supplied epsilon .
* < p > Note that two { @ link Float # NaN } are seen as equal and return true . < / p >
* @ param a float to compare .
* @ param b float to compare .
* @ return true if two float are considered equal . */
public static boolean fEq ( float a , float b , float epsilon ) { } } | if ( isNaN ( a ) && isNaN ( b ) ) { return true ; } float diffAbs = abs ( a - b ) ; return a == b ? true : diffAbs < epsilon ? true : diffAbs / Math . max ( abs ( a ) , abs ( b ) ) < epsilon ; |
public class CatchThrowableHamcrestMatchers { /** * EXAMPLES :
* < code > assertThat ( caughtThrowable ( ) , hasMessageThat ( is ( " Index : 9 , Size : 9 " ) ) ) ;
* assertThat ( caughtThrowable ( ) , hasMessageThat ( containsString ( " Index : 9 " ) ) ) ; / / using JUnitMatchers
* assertThat ( caughtThrowable ( ) , hasMessageThat ( containsPattern ( " Index : \ \ d + " ) ) ) ; / / using Mockito ' s Find < / code >
* @ param < T >
* the throwable subclass
* @ param stringMatcher
* a string matcher
* @ return Returns a matcher that matches an throwable if the given string matcher matches the throwable message . */
public static < T extends Throwable > org . hamcrest . Matcher < T > hasMessageThat ( Matcher < String > stringMatcher ) { } } | return new ThrowableMessageMatcher < > ( stringMatcher ) ; |
public class PointWriter { /** * Writes the object to the specified document , optionally creating a child
* element . The object in this case should be a point .
* @ param o the object ( of type Point ) .
* @ param document the document to write to .
* @ param asChild create child element if true .
* @ throws RenderException */
public void writeObject ( Object o , GraphicsDocument document , boolean asChild ) throws RenderException { } } | document . writeElement ( "vml:shape" , asChild ) ; Point p = ( Point ) o ; String adj = document . getFormatter ( ) . format ( p . getX ( ) ) + "," + document . getFormatter ( ) . format ( p . getY ( ) ) ; document . writeAttribute ( "adj" , adj ) ; |
public class ServiceConfigUtil { /** * Unwrap a LoadBalancingConfig JSON object into a { @ link LbConfig } . The input is a JSON object
* ( map ) with exactly one entry , where the key is the policy name and the value is a config object
* for that policy . */
@ SuppressWarnings ( "unchecked" ) public static LbConfig unwrapLoadBalancingConfig ( Map < String , ? > lbConfig ) { } } | if ( lbConfig . size ( ) != 1 ) { throw new RuntimeException ( "There are " + lbConfig . size ( ) + " fields in a LoadBalancingConfig object. Exactly one" + " is expected. Config=" + lbConfig ) ; } String key = lbConfig . entrySet ( ) . iterator ( ) . next ( ) . getKey ( ) ; return new LbConfig ( key , getObject ( lbConfig , key ) ) ; |
public class DirectoryLookupService { /** * Get the ModelService by service name .
* @ param serviceName the Service name .
* @ return the ModelService . */
public ModelService getModelService ( String serviceName ) { } } | ModelService service = null ; try { service = getDirectoryServiceClient ( ) . lookupService ( serviceName ) ; } catch ( ServiceException se ) { if ( se . getErrorCode ( ) == ErrorCode . SERVICE_DOES_NOT_EXIST ) { LOGGER . error ( se . getMessage ( ) ) ; } else { LOGGER . error ( "Error when getModelService" , se ) ; } throw se ; } return service ; |
public class ClusteringServiceConfigurationBuilder { /** * Adds a read operation timeout . Read operations which time out return a result comparable to
* a cache miss .
* @ param duration the amount of time permitted for read operations
* @ param unit the time units for { @ code duration }
* @ return a clustering service configuration builder
* @ throws NullPointerException if { @ code unit } is { @ code null }
* @ throws IllegalArgumentException if { @ code amount } is negative
* @ deprecated Use { @ link # timeouts ( Timeouts ) } . Note that calling this method will override any timeouts previously set
* by setting the read operation timeout to the specified value and everything else to its default . */
@ Deprecated public ClusteringServiceConfigurationBuilder readOperationTimeout ( long duration , TimeUnit unit ) { } } | Duration readTimeout = Duration . of ( duration , toChronoUnit ( unit ) ) ; return timeouts ( TimeoutsBuilder . timeouts ( ) . read ( readTimeout ) . build ( ) ) ; |
public class LoginUser { /** * Creates a new { @ link LoginContext } with the correct class loader .
* @ param authType the { @ link AuthType } to use
* @ param subject the { @ link Subject } to use
* @ param classLoader the { @ link ClassLoader } to use
* @ param configuration the { @ link javax . security . auth . login . Configuration } to use
* @ param alluxioConf Alluxio configuration
* @ return the new { @ link LoginContext } instance
* @ throws LoginException if LoginContext cannot be created */
private static LoginContext createLoginContext ( AuthType authType , Subject subject , ClassLoader classLoader , javax . security . auth . login . Configuration configuration , AlluxioConfiguration alluxioConf ) throws LoginException { } } | CallbackHandler callbackHandler = null ; if ( authType . equals ( AuthType . SIMPLE ) || authType . equals ( AuthType . CUSTOM ) ) { callbackHandler = new AppLoginModule . AppCallbackHandler ( alluxioConf ) ; } ClassLoader previousClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; Thread . currentThread ( ) . setContextClassLoader ( classLoader ) ; try { // Create LoginContext based on authType , corresponding LoginModule should be registered
// under the authType name in LoginModuleConfiguration .
return new LoginContext ( authType . getAuthName ( ) , subject , callbackHandler , configuration ) ; } finally { Thread . currentThread ( ) . setContextClassLoader ( previousClassLoader ) ; } |
public class JVMLauncher { /** * Get a process loader for a JVM .
* @ param mainClass Main class to run
* @ param classPath List of urls to use for the new JVM ' s
* class path .
* @ param args Additional command line parameters
* @ return ProcessBuilder that has not been started . */
public static ProcessBuilder getProcessBuilder ( String mainClass , List < URL > classPath , List < String > args ) throws LauncherException { } } | List < String > cmdList = new ArrayList < String > ( ) ; String [ ] cmdArray ; cmdList . add ( getJavaPath ( ) ) ; if ( classPath != null && classPath . size ( ) > 0 ) { cmdList . add ( "-cp" ) ; cmdList . add ( mkPath ( classPath ) ) ; } cmdList . add ( mainClass ) ; if ( args != null && args . size ( ) > 0 ) cmdList . addAll ( args ) ; cmdArray = cmdList . toArray ( new String [ cmdList . size ( ) ] ) ; if ( logger . isDebugEnabled ( ) ) logger . debug ( "cmdArray=" + Arrays . toString ( cmdArray ) ) ; return new ProcessBuilder ( cmdArray ) ; |
public class ApiApp { /** * Set the signer page header background color .
* @ param color String hex color code
* @ throws HelloSignException thrown if the color string is an invalid hex
* string */
public void setHeaderBackgroundColor ( String color ) throws HelloSignException { } } | if ( white_labeling_options == null ) { white_labeling_options = new WhiteLabelingOptions ( ) ; } white_labeling_options . setHeaderBackgroundColor ( color ) ; |
public class PersistentFieldIntrospectorImpl { /** * Get the PropertyDescriptor for aClass and aPropertyName */
protected static PropertyDescriptor findPropertyDescriptor ( Class aClass , String aPropertyName ) { } } | BeanInfo info ; PropertyDescriptor [ ] pd ; PropertyDescriptor descriptor = null ; try { info = Introspector . getBeanInfo ( aClass ) ; pd = info . getPropertyDescriptors ( ) ; for ( int i = 0 ; i < pd . length ; i ++ ) { if ( pd [ i ] . getName ( ) . equals ( aPropertyName ) ) { descriptor = pd [ i ] ; break ; } } if ( descriptor == null ) { /* * Daren Drummond : Throw here so we are consistent
* with PersistentFieldDefaultImpl . */
throw new MetadataException ( "Can't find property " + aPropertyName + " in " + aClass . getName ( ) ) ; } return descriptor ; } catch ( IntrospectionException ex ) { /* * Daren Drummond : Throw here so we are consistent
* with PersistentFieldDefaultImpl . */
throw new MetadataException ( "Can't find property " + aPropertyName + " in " + aClass . getName ( ) , ex ) ; } |
public class Http2Settings { /** * A helper method that returns { @ link Long # intValue ( ) } on the return of { @ link # get ( char ) } , if present . Note that
* if the range of the value exceeds { @ link Integer # MAX _ VALUE } , the { @ link # get ( char ) } method should
* be used instead to avoid truncation of the value . */
public Integer getIntValue ( char key ) { } } | Long value = get ( key ) ; if ( value == null ) { return null ; } return value . intValue ( ) ; |
public class ImageUtils { /** * Paint a check pattern , used for a background to indicate image transparency .
* @ param c the component to draw into
* @ param g the Graphics objects
* @ param x the x position
* @ param y the y position
* @ param width the width
* @ param height the height */
public static void paintCheckedBackground ( Component c , Graphics g , int x , int y , int width , int height ) { } } | if ( backgroundImage == null ) { backgroundImage = new BufferedImage ( 64 , 64 , BufferedImage . TYPE_INT_ARGB ) ; Graphics bg = backgroundImage . createGraphics ( ) ; for ( int by = 0 ; by < 64 ; by += 8 ) { for ( int bx = 0 ; bx < 64 ; bx += 8 ) { bg . setColor ( ( ( bx ^ by ) & 8 ) != 0 ? Color . lightGray : Color . white ) ; bg . fillRect ( bx , by , 8 , 8 ) ; } } bg . dispose ( ) ; } if ( backgroundImage != null ) { Shape saveClip = g . getClip ( ) ; Rectangle r = g . getClipBounds ( ) ; if ( r == null ) r = new Rectangle ( c . getSize ( ) ) ; r = r . intersection ( new Rectangle ( x , y , width , height ) ) ; g . setClip ( r ) ; int w = backgroundImage . getWidth ( ) ; int h = backgroundImage . getHeight ( ) ; if ( w != - 1 && h != - 1 ) { int x1 = ( r . x / w ) * w ; int y1 = ( r . y / h ) * h ; int x2 = ( ( r . x + r . width + w - 1 ) / w ) * w ; int y2 = ( ( r . y + r . height + h - 1 ) / h ) * h ; for ( y = y1 ; y < y2 ; y += h ) for ( x = x1 ; x < x2 ; x += w ) g . drawImage ( backgroundImage , x , y , c ) ; } g . setClip ( saveClip ) ; } |
public class ip6tunnelparam { /** * Use this API to update ip6tunnelparam . */
public static base_response update ( nitro_service client , ip6tunnelparam resource ) throws Exception { } } | ip6tunnelparam updateresource = new ip6tunnelparam ( ) ; updateresource . srcip = resource . srcip ; updateresource . dropfrag = resource . dropfrag ; updateresource . dropfragcputhreshold = resource . dropfragcputhreshold ; updateresource . srciproundrobin = resource . srciproundrobin ; return updateresource . update_resource ( client ) ; |
public class CombinationGeneratorFlexible { /** * Iterate all combination , no matter they are unique or not .
* @ param aElements
* List of elements .
* @ param aCallback
* Callback to invoke */
public void iterateAllCombinations ( @ Nonnull final ICommonsList < DATATYPE > aElements , @ Nonnull final Consumer < ? super ICommonsList < DATATYPE > > aCallback ) { } } | ValueEnforcer . notNull ( aElements , "Elements" ) ; ValueEnforcer . notNull ( aCallback , "Callback" ) ; for ( int nSlotCount = m_bAllowEmpty ? 0 : 1 ; nSlotCount <= m_nSlotCount ; nSlotCount ++ ) { if ( aElements . isEmpty ( ) ) { aCallback . accept ( new CommonsArrayList < > ( ) ) ; } else { // Add all permutations for the current slot count
for ( final ICommonsList < DATATYPE > aPermutation : new CombinationGenerator < > ( aElements , nSlotCount ) ) aCallback . accept ( aPermutation ) ; } } |
public class FileResponseExtractor { public File extractData ( final ClientHttpResponse response ) throws IOException { } } | IoUtil . copy ( response . getBody ( ) , _file ) ; return _file ; |
public class Closeables { /** * Creates a closeable spliterator from the given spliterator that does nothing when close is called .
* @ param spliterator The spliterator to wrap to allow it to become a closeable spliterator .
* @ param < T > The type of the spliterators
* @ return A spliterator that does nothing when closed */
public static < T > CloseableSpliterator < T > spliterator ( Spliterator < T > spliterator ) { } } | if ( spliterator instanceof CloseableSpliterator ) { return ( CloseableSpliterator < T > ) spliterator ; } return new SpliteratorAsCloseableSpliterator < > ( spliterator ) ; |
public class BeaconTransmitter { /** * Starts advertising with fields from the passed beacon
* @ param beacon */
public void startAdvertising ( Beacon beacon , AdvertiseCallback callback ) { } } | mBeacon = beacon ; mAdvertisingClientCallback = callback ; startAdvertising ( ) ; |
public class BoardsApi { /** * Get all issue boards for the specified project using the specified page and per page setting
* < pre > < code > GitLab Endpoint : GET / projects / : id / boards < / code > < / pre >
* @ param projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance
* @ param page the page to get
* @ param perPage the number of items per page
* @ return a list of project ' s Boards in the specified range
* @ throws GitLabApiException if any exception occurs */
public List < Board > getBoards ( Object projectIdOrPath , int page , int perPage ) throws GitLabApiException { } } | Response response = get ( javax . ws . rs . core . Response . Status . OK , getPageQueryParams ( page , perPage ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "boards" ) ; return ( response . readEntity ( new GenericType < List < Board > > ( ) { } ) ) ; |
public class Progress { /** * Computes progress in this node . */
private synchronized float getInternal ( ) { } } | int phaseCount = phases . size ( ) ; if ( phaseCount != 0 ) { float subProgress = currentPhase < phaseCount ? phase ( ) . getInternal ( ) : 0.0f ; return progressPerPhase * ( currentPhase + subProgress ) ; } else { return progress ; } |
public class FacesConfigApplicationTypeImpl { /** * If not already created , a new < code > default - validators < / code > element will be created and returned .
* Otherwise , the first existing < code > default - validators < / code > element will be returned .
* @ return the instance defined for the element < code > default - validators < / code > */
public FacesConfigDefaultValidatorsType < FacesConfigApplicationType < T > > getOrCreateDefaultValidators ( ) { } } | List < Node > nodeList = childNode . get ( "default-validators" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new FacesConfigDefaultValidatorsTypeImpl < FacesConfigApplicationType < T > > ( this , "default-validators" , childNode , nodeList . get ( 0 ) ) ; } return createDefaultValidators ( ) ; |
public class FileInputFormat { /** * Get the list of input { @ link Path } s for the map - reduce job .
* @ param conf The configuration of the job
* @ return the list of input { @ link Path } s for the map - reduce job . */
public static Path [ ] getInputPaths ( JobConf conf ) { } } | String dirs = conf . get ( "mapred.input.dir" , "" ) ; String [ ] list = StringUtils . split ( dirs ) ; Path [ ] result = new Path [ list . length ] ; for ( int i = 0 ; i < list . length ; i ++ ) { result [ i ] = new Path ( StringUtils . unEscapeString ( list [ i ] ) ) ; } return result ; |
public class NormalizerSerializer { /** * Restore a normalizer from the given file
* @ param file the file containing a serialized normalizer
* @ return the restored normalizer
* @ throws IOException */
public < T extends Normalizer > T restore ( @ NonNull File file ) throws Exception { } } | try ( InputStream in = new BufferedInputStream ( new FileInputStream ( file ) ) ) { return restore ( in ) ; } |
public class XmlFixture { /** * Register a prefix to use in XPath expressions .
* @ param prefix prefix to be used in xPath expressions .
* @ param namespace XML namespace the prefix should point to . */
public void registerPrefixForNamespace ( String prefix , String namespace ) { } } | getEnvironment ( ) . registerNamespace ( prefix , getUrl ( namespace ) ) ; |
public class DefaultDOManager { /** * Removes an object from the object registry . */
private void unregisterObject ( DigitalObject obj ) throws StorageDeviceException { } } | String pid = obj . getPid ( ) ; Connection conn = null ; PreparedStatement st = null ; try { conn = m_connectionPool . getReadWriteConnection ( ) ; String query = "DELETE FROM doRegistry WHERE doPID=?" ; st = conn . prepareStatement ( query ) ; st . setString ( 1 , pid ) ; st . executeUpdate ( ) ; // TODO hasModel
if ( obj . hasContentModel ( Models . SERVICE_DEPLOYMENT_3_0 ) ) { updateDeploymentMap ( obj , conn , true ) ; } } catch ( SQLException sqle ) { throw new StorageDeviceException ( "Unexpected error from SQL database while unregistering object: " + sqle . getMessage ( ) , sqle ) ; } finally { try { if ( st != null ) { st . close ( ) ; } if ( conn != null ) { m_connectionPool . free ( conn ) ; } } catch ( Exception sqle ) { throw new StorageDeviceException ( "Unexpected error from SQL database while unregistering object: " + sqle . getMessage ( ) , sqle ) ; } finally { st = null ; } } |
public class MapWithProtoValuesSubject { /** * Excludes all specific field paths under the argument { @ link FieldScope } from the comparison .
* < p > This method is additive and has well - defined ordering semantics . If the invoking { @ link
* ProtoFluentAssertion } is already scoped to a { @ link FieldScope } { @ code X } , and this method is
* invoked with { @ link FieldScope } { @ code Y } , the resultant { @ link ProtoFluentAssertion } is
* constrained to the subtraction of { @ code X - Y } .
* < p > By default , { @ link ProtoFluentAssertion } is constrained to { @ link FieldScopes # all ( ) } , that
* is , no fields are excluded from comparison . */
public MapWithProtoValuesFluentAssertion < M > ignoringFieldScopeForValues ( FieldScope fieldScope ) { } } | return usingConfig ( config . ignoringFieldScope ( checkNotNull ( fieldScope , "fieldScope" ) ) ) ; |
public class FlowHandler { /** * Fetch the netty channel . If { @ link Channel } is null then throw a ConnectionFailedException .
* @ return The current { @ link Channel }
* @ throws ConnectionFailedException Throw if connection is not established . */
Channel getChannel ( ) throws ConnectionFailedException { } } | Channel ch = channel . get ( ) ; if ( ch == null ) { throw new ConnectionFailedException ( "Connection to " + connectionName + " is not established." ) ; } return ch ; |
public class RendererContext { /** * Registers rendered resources / client libraries that have already been rendered for the current request , that is ,
* over all clientlib tag calls of a request
* @ param link the element to be registered
* @ param parent the element referencing it , for logging purposes */
public void registerClientlibLink ( ClientlibLink link , ClientlibResourceFolder parent ) { } } | if ( renderedClientlibs . contains ( link ) ) { LOG . error ( "Bug: duplicate clientlib link {} being included from {} " , link , parent ) ; } else { renderedClientlibs . add ( link ) ; LOG . debug ( "registered {} referenced from {}" , link , parent ) ; } |
public class GHEventsSubscriber { /** * Converts each subscriber to set of GHEvents
* @ return converter to use in iterable manipulations */
public static Function < GHEventsSubscriber , Set < GHEvent > > extractEvents ( ) { } } | return new NullSafeFunction < GHEventsSubscriber , Set < GHEvent > > ( ) { @ Override protected Set < GHEvent > applyNullSafe ( @ Nonnull GHEventsSubscriber subscriber ) { return defaultIfNull ( subscriber . events ( ) , Collections . < GHEvent > emptySet ( ) ) ; } } ; |
public class SipPhone { /** * This method is the same as the register ( String user , String password , String contact , int
* expiry , long timeout ) method except for the Request - URI used in the outgoing REGISTER method .
* If the requestUri parameter passed into this method is null , the Request - URI for the REGISTER
* is derived from this SipPhone ' s URI , or address of record ( for example , if this SipPhone ' s
* address of record is " sip : amit @ cafesip . org " , the REGISTER Request - URI will be sip : cafesip . org ) .
* Otherwise , the requestUri passed in is used for the REGISTER Request - URI . */
public boolean register ( SipURI requestUri , String user , String password , String contact , int expiry , long timeout ) { } } | initErrorInfo ( ) ; try { AddressFactory addr_factory = parent . getAddressFactory ( ) ; HeaderFactory hdr_factory = parent . getHeaderFactory ( ) ; if ( requestUri == null ) { requestUri = addr_factory . createSipURI ( null , ( ( SipURI ) ( myAddress . getURI ( ) ) ) . getHost ( ) ) ; requestUri . setPort ( ( ( SipURI ) ( myAddress . getURI ( ) ) ) . getPort ( ) ) ; if ( ( ( SipURI ) ( myAddress . getURI ( ) ) ) . getTransportParam ( ) != null ) { requestUri . setTransportParam ( ( ( SipURI ) ( myAddress . getURI ( ) ) ) . getTransportParam ( ) ) ; } } String method = Request . REGISTER ; ToHeader to_header = hdr_factory . createToHeader ( myAddress , null ) ; FromHeader from_header = hdr_factory . createFromHeader ( myAddress , generateNewTag ( ) ) ; CallIdHeader callid_header = hdr_factory . createCallIdHeader ( myRegistrationId ) ; cseq = hdr_factory . createCSeqHeader ( cseq == null ? 1 : ( cseq . getSeqNumber ( ) + 1 ) , method ) ; MaxForwardsHeader max_forwards = hdr_factory . createMaxForwardsHeader ( MAX_FORWARDS_DEFAULT ) ; if ( contact != null ) { URI uri = addr_factory . createURI ( contact ) ; if ( uri . isSipURI ( ) == false ) { setReturnCode ( INVALID_ARGUMENT ) ; setErrorMessage ( "URI " + contact + " is not a Sip URI" ) ; return false ; } Address contact_address = addr_factory . createAddress ( uri ) ; ContactHeader hdr = hdr_factory . createContactHeader ( contact_address ) ; hdr . setExpires ( expiry ) ; synchronized ( contactLock ) { contactInfo = new SipContact ( ) ; contactInfo . setContactHeader ( hdr ) ; } } List < ViaHeader > via_headers = getViaHeaders ( ) ; Request msg = parent . getMessageFactory ( ) . createRequest ( requestUri , method , callid_header , cseq , from_header , to_header , via_headers , max_forwards ) ; msg . addHeader ( contactInfo . getContactHeader ( ) ) ; // use
// setHeader ( ) ?
if ( expiry > 0 ) { ExpiresHeader expires = hdr_factory . createExpiresHeader ( expiry ) ; msg . setExpires ( expires ) ; } // include any auth information for this User Agent ' s registration
// if any exists
Map < String , AuthorizationHeader > auth_list = getAuthorizations ( ) . get ( myRegistrationId ) ; if ( auth_list != null ) { List < AuthorizationHeader > auth_headers = new ArrayList < > ( auth_list . values ( ) ) ; Iterator < AuthorizationHeader > i = auth_headers . iterator ( ) ; while ( i . hasNext ( ) ) { AuthorizationHeader auth = i . next ( ) ; msg . addHeader ( auth ) ; } } else { // create the auth list entry for this phone ' s registrations
enableAuthorization ( myRegistrationId ) ; } // send the REGISTRATION request and get the response
Response response = sendRegistrationMessage ( msg , user , password , timeout ) ; if ( response == null ) { return false ; } // update our contact info with that of the server response -
// server may have reset our contact expiry
ListIterator < ? > contacts = response . getHeaders ( ContactHeader . NAME ) ; if ( contacts != null ) { while ( contacts . hasNext ( ) ) { // TODO - at some point save ALL the contact headers and
// provide a getter for the list of SipContact objects
// ( gobalContactList ) .
// dispose ( ) and unregister ( ) can use the list of contact
// headers .
// for now just save this agent ' s info
ContactHeader hdr = ( ContactHeader ) contacts . next ( ) ; if ( hdr . getAddress ( ) . getURI ( ) . toString ( ) . equals ( contactInfo . getURI ( ) ) == true ) { contactInfo . setContactHeader ( hdr ) ; break ; } } } return true ; } catch ( Exception ex ) { setReturnCode ( EXCEPTION_ENCOUNTERED ) ; setException ( ex ) ; setErrorMessage ( "Exception: " + ex . getClass ( ) . getName ( ) + ": " + ex . getMessage ( ) ) ; return false ; } |
public class Choice6 { /** * { @ inheritDoc } */
@ Override public < G > Choice7 < A , B , C , D , E , F , G > diverge ( ) { } } | return match ( Choice7 :: a , Choice7 :: b , Choice7 :: c , Choice7 :: d , Choice7 :: e , Choice7 :: f ) ; |
public class ReadRequest { /** * check if the request contains a valid user identifier
* @ param request
* Tomcat servlet request
* @ param response
* response object
* @ return user node with the identifier passed < br >
* < b > null < / b > if the identifier is invalid */
private static Node checkUserIdentifier ( final HttpServletRequest request , final ReadResponse response ) { } } | final String userId = request . getParameter ( ProtocolConstants . Parameters . Read . USER_IDENTIFIER ) ; if ( userId != null ) { final Node user = NeoUtils . getUserByIdentifier ( userId ) ; if ( user != null ) { return user ; } response . userIdentifierInvalid ( userId ) ; } else { response . userIdentifierMissing ( ) ; } return null ; |
public class FileGetFromTaskHeaders { /** * Set the time at which the resource was last modified .
* @ param lastModified the lastModified value to set
* @ return the FileGetFromTaskHeaders object itself . */
public FileGetFromTaskHeaders withLastModified ( DateTime lastModified ) { } } | if ( lastModified == null ) { this . lastModified = null ; } else { this . lastModified = new DateTimeRfc1123 ( lastModified ) ; } return this ; |
public class IncomingDataPoints { /** * Updates the base time in the row key .
* @ param timestamp
* The timestamp from which to derive the new base time .
* @ return The updated base time . */
private long updateBaseTime ( final long timestamp ) { } } | // We force the starting timestamp to be on a MAX _ TIMESPAN boundary
// so that all TSDs create rows with the same base time . Otherwise
// we ' d need to coordinate TSDs to avoid creating rows that cover
// overlapping time periods .
final long base_time = timestamp - ( timestamp % Const . MAX_TIMESPAN ) ; // Clone the row key since we ' re going to change it . We must clone it
// because the HBase client may still hold a reference to it in its
// internal datastructures .
row = Arrays . copyOf ( row , row . length ) ; Bytes . setInt ( row , ( int ) base_time , Const . SALT_WIDTH ( ) + tsdb . metrics . width ( ) ) ; RowKey . prefixKeyWithSalt ( row ) ; // in case the timestamp will be involved in
// salting later
tsdb . scheduleForCompaction ( row , ( int ) base_time ) ; return base_time ; |
public class CmsDriverManager { /** * Creates a property definition . < p >
* Property definitions are valid for all resource types . < p >
* @ param dbc the current database context
* @ param name the name of the property definition to create
* @ return the created property definition
* @ throws CmsException if something goes wrong */
public CmsPropertyDefinition createPropertyDefinition ( CmsDbContext dbc , String name ) throws CmsException { } } | CmsPropertyDefinition propertyDefinition = null ; name = name . trim ( ) ; // validate the property name
CmsPropertyDefinition . checkPropertyName ( name ) ; // TODO : make the type a parameter
try { try { propertyDefinition = getVfsDriver ( dbc ) . readPropertyDefinition ( dbc , name , dbc . currentProject ( ) . getUuid ( ) ) ; } catch ( CmsException e ) { propertyDefinition = getVfsDriver ( dbc ) . createPropertyDefinition ( dbc , dbc . currentProject ( ) . getUuid ( ) , name , CmsPropertyDefinition . TYPE_NORMAL ) ; } try { getVfsDriver ( dbc ) . readPropertyDefinition ( dbc , name , CmsProject . ONLINE_PROJECT_ID ) ; } catch ( CmsException e ) { getVfsDriver ( dbc ) . createPropertyDefinition ( dbc , CmsProject . ONLINE_PROJECT_ID , name , CmsPropertyDefinition . TYPE_NORMAL ) ; } try { getHistoryDriver ( dbc ) . readPropertyDefinition ( dbc , name ) ; } catch ( CmsException e ) { getHistoryDriver ( dbc ) . createPropertyDefinition ( dbc , name , CmsPropertyDefinition . TYPE_NORMAL ) ; } } finally { // fire an event that a property of a resource has been deleted
OpenCms . fireCmsEvent ( new CmsEvent ( I_CmsEventListener . EVENT_PROPERTY_DEFINITION_CREATED , Collections . < String , Object > singletonMap ( "propertyDefinition" , propertyDefinition ) ) ) ; } return propertyDefinition ; |
public class AbstractDestinationHandler { /** * < p > Any aliases that inherit the receive allowed attribute from this
* destination must also be notified that it has changed . < / p >
* @ param receiveAllowedValue */
public void notifyTargettingAliasesReceiveAllowed ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "notifyTargettingAliasesReceiveAllowed" ) ; // Tell any destinations that target this destination to close their producers
if ( aliasesThatTargetThisDest != null ) { synchronized ( aliasesThatTargetThisDest ) { Iterator i = aliasesThatTargetThisDest . iterator ( ) ; while ( i . hasNext ( ) ) { AbstractAliasDestinationHandler abstractAliasDestinationHandler = ( AbstractAliasDestinationHandler ) i . next ( ) ; abstractAliasDestinationHandler . notifyReceiveAllowed ( abstractAliasDestinationHandler ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "notifyTargettingAliasesReceiveAllowed" ) ; return ; |
public class Ftp { /** * check if a directory exists or not
* @ return FTPCLient
* @ throws PageException
* @ throws IOException */
private AFTPClient actionExistsDir ( ) throws PageException , IOException { } } | required ( "directory" , directory ) ; AFTPClient client = getClient ( ) ; boolean res = existsDir ( client , directory ) ; Struct cfftp = writeCfftp ( client ) ; cfftp . setEL ( RETURN_VALUE , Caster . toBoolean ( res ) ) ; cfftp . setEL ( SUCCEEDED , Boolean . TRUE ) ; stoponerror = false ; return client ; |
public class ConcurrentLinkedHashMapPro { /** * Tests if the specified object is a key in this table .
* @ param key possible key
* @ return < tt > true < / tt > if and only if the specified object is a key in this table , as determined
* by the < tt > equals < / tt > method ; < tt > false < / tt > otherwise .
* @ throws NullPointerException if the specified key is null */
@ Override public boolean containsKey ( Object key ) { } } | int hash = hash ( key ) ; return segmentFor ( hash ) . containsKey ( key , hash ) ; |
public class BuilderFactory { /** * Return the builder for the annotation type .
* @ param annotationType the annotation type being documented .
* @ param prevType the previous type that was documented .
* @ param nextType the next type being documented .
* @ return the writer for the annotation type . Return null if this
* writer is not supported by the doclet . */
public AbstractBuilder getAnnotationTypeBuilder ( AnnotationTypeDoc annotationType , Type prevType , Type nextType ) throws Exception { } } | return AnnotationTypeBuilder . getInstance ( context , annotationType , writerFactory . getAnnotationTypeWriter ( annotationType , prevType , nextType ) ) ; |
public class COSBlockOutputStream { /** * Upload the current block as a single PUT request ; if the buffer is empty a
* 0 - byte PUT will be invoked , as it is needed to create an entry at the far
* end .
* @ throws IOException any problem */
private void putObject ( ) throws IOException { } } | LOG . debug ( "Executing regular upload for {}" , writeOperationHelper ) ; final COSDataBlocks . DataBlock block = getActiveBlock ( ) ; int size = block . dataSize ( ) ; final COSDataBlocks . BlockUploadData uploadData = block . startUpload ( ) ; final PutObjectRequest putObjectRequest = uploadData . hasFile ( ) ? writeOperationHelper . newPutRequest ( uploadData . getFile ( ) ) : writeOperationHelper . newPutRequest ( uploadData . getUploadStream ( ) , size ) ; final ObjectMetadata om = new ObjectMetadata ( ) ; om . setUserMetadata ( mMetadata ) ; if ( contentType != null && ! contentType . isEmpty ( ) ) { om . setContentType ( contentType ) ; } else { om . setContentType ( "application/octet-stream" ) ; } putObjectRequest . setMetadata ( om ) ; ListenableFuture < PutObjectResult > putObjectResult = executorService . submit ( new Callable < PutObjectResult > ( ) { @ Override public PutObjectResult call ( ) throws Exception { PutObjectResult result ; try { // the putObject call automatically closes the input
// stream afterwards .
result = writeOperationHelper . putObject ( putObjectRequest ) ; } finally { closeAll ( LOG , uploadData , block ) ; } return result ; } } ) ; clearActiveBlock ( ) ; // wait for completion
try { putObjectResult . get ( ) ; } catch ( InterruptedException ie ) { LOG . warn ( "Interrupted object upload" , ie ) ; Thread . currentThread ( ) . interrupt ( ) ; } catch ( ExecutionException ee ) { throw extractException ( "regular upload" , key , ee ) ; } |
public class CmsSetupBean { /** * Sets the start view for the given user . < p >
* @ param userName the name of the user
* @ param view the start view path
* @ throws CmsException if something goes wrong */
public void setStartView ( String userName , String view ) throws CmsException { } } | try { CmsUser user = m_cms . readUser ( userName ) ; user . getAdditionalInfo ( ) . put ( CmsUserSettings . PREFERENCES + CmsWorkplaceConfiguration . N_WORKPLACESTARTUPSETTINGS + CmsWorkplaceConfiguration . N_WORKPLACEVIEW , view ) ; m_cms . writeUser ( user ) ; } catch ( CmsException e ) { e . printStackTrace ( System . err ) ; throw e ; } |
public class ArrowSerde { /** * Convert an { @ link INDArray }
* to an arrow { @ link Tensor }
* @ param arr the array to convert
* @ return the equivalent { @ link Tensor } */
public static Tensor toTensor ( INDArray arr ) { } } | FlatBufferBuilder bufferBuilder = new FlatBufferBuilder ( 1024 ) ; long [ ] strides = getArrowStrides ( arr ) ; int shapeOffset = createDims ( bufferBuilder , arr ) ; int stridesOffset = Tensor . createStridesVector ( bufferBuilder , strides ) ; Tensor . startTensor ( bufferBuilder ) ; addTypeTypeRelativeToNDArray ( bufferBuilder , arr ) ; Tensor . addShape ( bufferBuilder , shapeOffset ) ; Tensor . addStrides ( bufferBuilder , stridesOffset ) ; Tensor . addData ( bufferBuilder , addDataForArr ( bufferBuilder , arr ) ) ; int endTensor = Tensor . endTensor ( bufferBuilder ) ; Tensor . finishTensorBuffer ( bufferBuilder , endTensor ) ; return Tensor . getRootAsTensor ( bufferBuilder . dataBuffer ( ) ) ; |
public class GPSdEndpoint { /** * Attempt to kick a failed device back into life on gpsd server .
* see : https : / / lists . gnu . org / archive / html / gpsd - dev / 2015-06 / msg00001 . html
* @ param path Path of device known to gpsd
* @ throws IOException
* @ throws JSONException */
public void kickDevice ( String path ) throws IOException , JSONException { } } | final JSONObject d = new JSONObject ( ) ; d . put ( "class" , "DEVICE" ) ; d . put ( "path" , path ) ; this . voidCommand ( "?DEVICE=" + d ) ; |
public class TimeUnit { /** * 时间表达式规范化的入口
* 时间表达式识别后 , 通过此入口进入规范化阶段 ,
* 具体识别每个字段的值 */
public void Time_Normalization ( ) { } } | norm_setyear ( ) ; norm_setmonth ( ) ; norm_setday ( ) ; norm_sethour ( ) ; norm_setminute ( ) ; norm_setsecond ( ) ; norm_setTotal ( ) ; norm_setBaseRelated ( ) ; norm_setCurRelated ( ) ; modifyTimeBase ( ) ; _tp_origin . tunit = _tp . tunit . clone ( ) ; String [ ] time_grid = new String [ 6 ] ; time_grid = normalizer . getTimeBase ( ) . split ( "-" ) ; int tunitpointer = 5 ; while ( tunitpointer >= 0 && _tp . tunit [ tunitpointer ] < 0 ) { tunitpointer -- ; } for ( int i = 0 ; i < tunitpointer ; i ++ ) { if ( _tp . tunit [ i ] < 0 ) _tp . tunit [ i ] = Integer . parseInt ( time_grid [ i ] ) ; } String [ ] _result_tmp = new String [ 6 ] ; _result_tmp [ 0 ] = String . valueOf ( _tp . tunit [ 0 ] ) ; if ( _tp . tunit [ 0 ] >= 10 && _tp . tunit [ 0 ] < 100 ) { _result_tmp [ 0 ] = "19" + String . valueOf ( _tp . tunit [ 0 ] ) ; } if ( _tp . tunit [ 0 ] > 0 && _tp . tunit [ 0 ] < 10 ) { _result_tmp [ 0 ] = "200" + String . valueOf ( _tp . tunit [ 0 ] ) ; } for ( int i = 1 ; i < 6 ; i ++ ) { _result_tmp [ i ] = String . valueOf ( _tp . tunit [ i ] ) ; } Calendar cale = Calendar . getInstance ( ) ; // leverage a calendar object to figure out the final time
cale . clear ( ) ; if ( Integer . parseInt ( _result_tmp [ 0 ] ) != - 1 ) { Time_Norm += _result_tmp [ 0 ] + "年" ; cale . set ( Calendar . YEAR , Integer . valueOf ( _result_tmp [ 0 ] ) ) ; if ( Integer . parseInt ( _result_tmp [ 1 ] ) != - 1 ) { Time_Norm += _result_tmp [ 1 ] + "月" ; cale . set ( Calendar . MONTH , Integer . valueOf ( _result_tmp [ 1 ] ) - 1 ) ; if ( Integer . parseInt ( _result_tmp [ 2 ] ) != - 1 ) { Time_Norm += _result_tmp [ 2 ] + "日" ; cale . set ( Calendar . DAY_OF_MONTH , Integer . valueOf ( _result_tmp [ 2 ] ) ) ; if ( Integer . parseInt ( _result_tmp [ 3 ] ) != - 1 ) { Time_Norm += _result_tmp [ 3 ] + "时" ; cale . set ( Calendar . HOUR_OF_DAY , Integer . valueOf ( _result_tmp [ 3 ] ) ) ; if ( Integer . parseInt ( _result_tmp [ 4 ] ) != - 1 ) { Time_Norm += _result_tmp [ 4 ] + "分" ; cale . set ( Calendar . MINUTE , Integer . valueOf ( _result_tmp [ 4 ] ) ) ; if ( Integer . parseInt ( _result_tmp [ 5 ] ) != - 1 ) { Time_Norm += _result_tmp [ 5 ] + "秒" ; cale . set ( Calendar . SECOND , Integer . valueOf ( _result_tmp [ 5 ] ) ) ; } } } } } } time = cale . getTime ( ) ; time_full = _tp . tunit . clone ( ) ; time_origin = _tp_origin . tunit . clone ( ) ; |
public class UReport { /** * Generate and print ( System . out ) the statistics report with the supplied
* title , and using the specified sort order .
* @ param writer
* the destination to report to
* @ param title
* the title to use ( e . g . " Warmup " , " Cached Files " , etc . )
* @ param comparator
* the Comparator to sort the UStats by ( see class constants for
* some useful suggestions )
* @ throws IOException
* if the writer destination fails */
public void report ( final Writer writer , final String title , final Comparator < UStats > comparator ) throws IOException { } } | title ( writer , title ) ; long mintime = stats . stream ( ) . mapToLong ( s -> s . getFastestNanos ( ) ) . min ( ) . getAsLong ( ) ; TimeUnit tUnit = UStats . findBestUnit ( mintime ) ; for ( UStats s : getStats ( comparator ) ) { writer . write ( s . formatResults ( tUnit ) ) ; writer . write ( "\n" ) ; } |
public class SSLLoader { /** * Gets an SSLContext configured and initialized .
* < p > If no keyStore is configured , a default keyStore will be generated .
* < b > The generated keyStore is not intended to be used in production ! < / b >
* It won ' t work on JRE which don ' t include sun . * packages like the IBM JRE .
* @ return SSLContext */
SSLContext getSSLContext ( String protocol , KeyManager [ ] keyManagers , TrustManager [ ] trustManagers ) { } } | try { SSLContext sslContext = SSLContext . getInstance ( protocol ) ; sslContext . init ( keyManagers , trustManagers , null ) ; return sslContext ; } catch ( NoSuchAlgorithmException e ) { throw SeedException . wrap ( e , CryptoErrorCode . ALGORITHM_CANNOT_BE_FOUND ) ; } catch ( Exception e ) { throw SeedException . wrap ( e , CryptoErrorCode . UNEXPECTED_EXCEPTION ) ; } |
public class StockholmFileParser { /** * # = GR & lt ; seqname & gt ; & lt ; feature & gt ; & lt ; Generic per - Residue annotation , exactly 1 char per residue & gt ;
* @ param line
* the line to be parsed */
private void handleResidueAnnotation ( String seqName , String featureName , String value ) { } } | if ( featureName . equals ( GR_SURFACE_ACCESSIBILITY ) ) { stockholmStructure . addSurfaceAccessibility ( seqName , value ) ; } else if ( featureName . equals ( GR_TRANS_MEMBRANE ) ) { stockholmStructure . addTransMembrane ( seqName , value ) ; } else if ( featureName . equals ( GR_POSTERIOR_PROBABILITY ) ) { stockholmStructure . addPosteriorProbability ( seqName , value ) ; } else if ( featureName . equals ( GR_LIGAND_BINDING ) ) { stockholmStructure . addLigandBinding ( seqName , value ) ; } else if ( featureName . equals ( GR_ACTIVE_SITE ) ) { stockholmStructure . addActiveSite ( seqName , value ) ; } else if ( featureName . equals ( GR_AS_PFAM_PREDICTED ) ) { stockholmStructure . addASPFamPredicted ( seqName , value ) ; } else if ( featureName . equals ( GR_AS_SWISSPROT ) ) { stockholmStructure . addASSwissProt ( seqName , value ) ; } else if ( featureName . equals ( GR_INTRON ) ) { stockholmStructure . addIntron ( seqName , value ) ; } else if ( featureName . equals ( GR_SECONDARY_STRUCTURE ) ) { stockholmStructure . addSecondaryStructure ( seqName , value ) ; } else { // unknown feature
logger . warn ( "Unknown Residue Feature [{}].\nPlease contact the Biojava team." , featureName ) ; } |
public class ItemImpl { /** * { @ inheritDoc } */
public void save ( ) throws ReferentialIntegrityException , AccessDeniedException , LockException , ConstraintViolationException , InvalidItemStateException , ReferentialIntegrityException , RepositoryException { } } | checkValid ( ) ; if ( isNew ( ) ) { throw new RepositoryException ( "It is impossible to call save() on the newly added item " + getPath ( ) ) ; } NodeTypeDataManager ntManager = session . getWorkspace ( ) . getNodeTypesHolder ( ) ; if ( isNode ( ) ) { // validate
// 1 . referenceable nodes - if a node is deleted and then added ,
// referential integrity is unchanged ( ' move ' usecase )
QPath path = getInternalPath ( ) ; List < ItemState > changes = dataManager . getChangesLog ( ) . getDescendantsChanges ( path ) ; List < NodeData > refNodes = new ArrayList < NodeData > ( ) ; for ( int i = 0 , length = changes . size ( ) ; i < length ; i ++ ) { ItemState changedItem = changes . get ( i ) ; if ( changedItem . isNode ( ) ) { NodeData refNode = ( NodeData ) changedItem . getData ( ) ; // Check referential integrity ( remove of mix : referenceable node )
if ( ntManager . isNodeType ( Constants . MIX_REFERENCEABLE , refNode . getPrimaryTypeName ( ) , refNode . getMixinTypeNames ( ) ) ) { // mix : referenceable
if ( changedItem . isDeleted ( ) ) { refNodes . add ( refNode ) ; // add to refs ( delete - alway is first )
} else if ( changedItem . isAdded ( ) || changedItem . isRenamed ( ) ) { refNodes . remove ( refNode ) ; // remove from refs ( add - always at the
// end )
} } } } // check ref changes
for ( int i = 0 , length = refNodes . size ( ) ; i < length ; i ++ ) { NodeData refNode = refNodes . get ( i ) ; List < PropertyData > nodeRefs = dataManager . getReferencesData ( refNode . getIdentifier ( ) , true ) ; for ( int j = 0 , length2 = nodeRefs . size ( ) ; j < length2 ; j ++ ) { PropertyData refProp = nodeRefs . get ( j ) ; // if ref property is deleted in this session
ItemState refState = dataManager . getChangesLog ( ) . getItemState ( refProp . getIdentifier ( ) ) ; if ( refState != null && refState . isDeleted ( ) ) { continue ; } NodeData refParent = ( NodeData ) dataManager . getItemData ( refProp . getParentIdentifier ( ) ) ; AccessControlList acl = refParent . getACL ( ) ; AccessManager am = session . getAccessManager ( ) ; if ( ! am . hasPermission ( acl , PermissionType . READ , session . getUserState ( ) . getIdentity ( ) ) ) { throw new AccessDeniedException ( "Can not delete node " + refNode . getQPath ( ) + " (" + refNode . getIdentifier ( ) + ")" + ". It is currently the target of a REFERENCE property and " + refProp . getQPath ( ) . getAsString ( ) ) ; } throw new ReferentialIntegrityException ( "Can not delete node " + refNode . getQPath ( ) + " (" + refNode . getIdentifier ( ) + ")" + ". It is currently the target of a REFERENCE property " + refProp . getQPath ( ) . getAsString ( ) ) ; } } } dataManager . commit ( getInternalPath ( ) ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < }
* { @ link CmisExtensionType } { @ code > } */
@ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "extension" , scope = CreatePolicy . class ) public JAXBElement < CmisExtensionType > createCreatePolicyExtension ( CmisExtensionType value ) { } } | return new JAXBElement < CmisExtensionType > ( _GetPropertiesExtension_QNAME , CmisExtensionType . class , CreatePolicy . class , value ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link Object } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link Object } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/citygml/appearance/1.0" , name = "_GenericApplicationPropertyOfX3DMaterial" ) public JAXBElement < Object > create_GenericApplicationPropertyOfX3DMaterial ( Object value ) { } } | return new JAXBElement < Object > ( __GenericApplicationPropertyOfX3DMaterial_QNAME , Object . class , null , value ) ; |
public class ABYSS { /** * Subset generation method
* @ return */
@ Override public List < List < DoubleSolution > > subsetGeneration ( ) { } } | List < List < DoubleSolution > > solutionGroupsList ; solutionGroupsList = generatePairsFromSolutionList ( referenceSet1 ) ; solutionGroupsList . addAll ( generatePairsFromSolutionList ( referenceSet2 ) ) ; return solutionGroupsList ; |
public class ChatServlet { /** * Processes requests for both HTTP < code > GET < / code > and < code > POST < / code >
* methods .
* @ param request servlet request
* @ param response servlet response
* @ throws ServletException if a servlet - specific error occurs
* @ throws IOException if an I / O error occurs */
protected void processRequest ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { } } | response . setContentType ( "text/html;charset=UTF-8" ) ; if ( ! request . getServletPath ( ) . endsWith ( "insecure" ) ) { response . addHeader ( "Content-Security-Policy" , buildCSPHeader ( ) ) ; } request . getRequestDispatcher ( "WEB-INF/chatq.jspx" ) . forward ( request , response ) ; |
public class NameUtils { /** * Test whether the give package name is a valid Java package .
* @ param packageName The name of the package
* @ return True if it is valid */
public static boolean isValidJavaPackage ( String packageName ) { } } | if ( isBlank ( packageName ) ) { return false ; } final String [ ] parts = packageName . split ( "\\." ) ; for ( String part : parts ) { if ( ! isValidJavaIdentifier ( part ) ) { return false ; } } return true ; |
public class GeneratorSingleCluster { /** * Compute density for cluster model at given double [ ] p -
* @ see GeneratorInterface # getDensity ( double [ ] ) */
@ Override public double getDensity ( double [ ] p ) { } } | if ( trans != null ) { p = trans . applyInverse ( p ) ; } double density = densitycorrection ; for ( int i = 0 ; i < dim ; i ++ ) { density *= axes . get ( i ) . pdf ( p [ i ] ) ; } return density ; |
public class ReferenceCompositeGroupService { /** * Assembles the group services composite . Once the leaf services have been retrieved , they are
* held in a ( one - dimensional ) Map . The composite identity of a service is preserved in its Map
* key , a javax . naming . Name . Each node of the Name is the name of a component service , starting
* with the service closest to the composite service and ending with the name of the leaf
* service . The key is built up layer by layer .
* @ exception GroupsException */
protected void initializeComponentServices ( ) throws GroupsException { } } | Name leafServiceName = null ; try { GroupServiceConfiguration cfg = GroupServiceConfiguration . getConfiguration ( ) ; List services = cfg . getServiceDescriptors ( ) ; for ( Iterator it = services . iterator ( ) ; it . hasNext ( ) ; ) { ComponentGroupServiceDescriptor descriptor = ( ComponentGroupServiceDescriptor ) it . next ( ) ; String factoryName = descriptor . getServiceFactoryName ( ) ; IComponentGroupServiceFactory factory = ( IComponentGroupServiceFactory ) Class . forName ( factoryName ) . newInstance ( ) ; IComponentGroupService service = factory . newGroupService ( descriptor ) ; // If it ' s a leaf service , add it to the Map .
if ( service . isLeafService ( ) ) { leafServiceName = GroupService . parseServiceName ( descriptor . getName ( ) ) ; service . setServiceName ( leafServiceName ) ; getComponentServices ( ) . put ( leafServiceName , service ) ; } // Otherwise , get its leaf services and for each , push our node onto the service
// Name
// and add the service to the Map .
else { Map componentMap = service . getComponentServices ( ) ; for ( Iterator components = componentMap . values ( ) . iterator ( ) ; components . hasNext ( ) ; ) { IIndividualGroupService leafService = ( IIndividualGroupService ) components . next ( ) ; leafServiceName = leafService . getServiceName ( ) ; leafServiceName . add ( 0 , descriptor . getName ( ) ) ; getComponentServices ( ) . put ( leafServiceName , leafService ) ; } } } Name defaultServiceName = GroupService . parseServiceName ( cfg . getDefaultService ( ) ) ; defaultService = ( IIndividualGroupService ) getComponentService ( defaultServiceName ) ; } catch ( Exception ex ) { throw new GroupsException ( "Problem initializing component services" , ex ) ; } |
public class ConsulRegistry { /** * if new service registered , start a new lookup thread
* each serviceName start a lookup thread to discover service
* @ param url */
private void startListenerThreadIfNewService ( URL url ) { } } | String serviceName = url . getPath ( ) ; if ( ! lookupServices . containsKey ( serviceName ) ) { Long value = lookupServices . putIfAbsent ( serviceName , 0L ) ; if ( value == null ) { ServiceLookupThread lookupThread = new ServiceLookupThread ( serviceName ) ; lookupThread . setDaemon ( true ) ; lookupThread . start ( ) ; } } |
public class CaduceusRelationPoint { /** * Gets annotations .
* @ param groups the groups
* @ return the annotations */
List < Annotation > getAnnotations ( Multimap < String , Annotation > groups , TokenMatcher matcher ) { } } | if ( relationType == null ) { return getAnnotationStream ( groups , matcher ) . filter ( constraint ) . collect ( Collectors . toList ( ) ) ; } return getAnnotationStream ( groups , matcher ) . flatMap ( a -> { if ( relationType . equals ( Types . DEPENDENCY ) ) { return a . children ( ) . stream ( ) . filter ( a2 -> a2 . dependencyRelation ( ) . v1 . equals ( relationValue ) ) ; } return a . sources ( relationType , relationValue ) . stream ( ) ; } ) . flatMap ( a -> { if ( annotationType == null ) { return Stream . of ( a ) ; } return a . get ( annotationType ) . stream ( ) ; } ) . filter ( constraint ) . collect ( Collectors . toList ( ) ) ; |
public class RemoteAsyncDnsClient { /** * endregion */
@ JmxAttribute @ Nullable public AsyncUdpSocketImpl . JmxInspector getSocketStats ( ) { } } | return BaseInspector . lookup ( socketInspector , AsyncUdpSocketImpl . JmxInspector . class ) ; |
public class CharOperation { /** * Answers true if the pattern matches the filepath using the pathSepatator , false otherwise . Path char [ ] pattern
* matching , accepting wild - cards ' * * ' , ' * ' and ' ? ' ( using Ant directory tasks conventions , also see
* " http : / / jakarta . apache . org / ant / manual / dirtasks . html # defaultexcludes " ) . Path pattern matching is enhancing regular
* pattern matching in supporting extra rule where ' * * ' represent any folder combination . Special rule : - foo \ is
* equivalent to foo \ * * When not case sensitive , the pattern is assumed to already be lowercased , the name will be
* lowercased character per character as comparing .
* @ param pattern
* the given pattern
* @ param filepath
* the given path
* @ param isCaseSensitive
* to find out whether or not the matching should be case sensitive
* @ param pathSeparator
* the given path separator
* @ return true if the pattern matches the filepath using the pathSepatator , false otherwise */
public static final boolean pathMatch ( char [ ] pattern , char [ ] filepath , boolean isCaseSensitive , char pathSeparator ) { } } | if ( filepath == null ) { return false ; // null name cannot match
} if ( pattern == null ) { return true ; // null pattern is equivalent to ' * '
} // offsets inside pattern
int pSegmentStart = pattern [ 0 ] == pathSeparator ? 1 : 0 ; int pLength = pattern . length ; int pSegmentEnd = CharOperation . indexOf ( pathSeparator , pattern , pSegmentStart + 1 ) ; if ( pSegmentEnd < 0 ) { pSegmentEnd = pLength ; } // special case : pattern foo \ is equivalent to foo \ * *
boolean freeTrailingDoubleStar = pattern [ pLength - 1 ] == pathSeparator ; // offsets inside filepath
int fSegmentStart , fLength = filepath . length ; if ( filepath [ 0 ] != pathSeparator ) { fSegmentStart = 0 ; } else { fSegmentStart = 1 ; } if ( fSegmentStart != pSegmentStart ) { return false ; // both must start with a separator or none .
} int fSegmentEnd = CharOperation . indexOf ( pathSeparator , filepath , fSegmentStart + 1 ) ; if ( fSegmentEnd < 0 ) { fSegmentEnd = fLength ; } // first segments
while ( pSegmentStart < pLength && ! ( pSegmentEnd == pLength && freeTrailingDoubleStar || pSegmentEnd == pSegmentStart + 2 && pattern [ pSegmentStart ] == '*' && pattern [ pSegmentStart + 1 ] == '*' ) ) { if ( fSegmentStart >= fLength ) { return false ; } if ( ! CharOperation . match ( pattern , pSegmentStart , pSegmentEnd , filepath , fSegmentStart , fSegmentEnd , isCaseSensitive ) ) { return false ; } // jump to next segment
pSegmentEnd = CharOperation . indexOf ( pathSeparator , pattern , pSegmentStart = pSegmentEnd + 1 ) ; // skip separator
if ( pSegmentEnd < 0 ) { pSegmentEnd = pLength ; } fSegmentEnd = CharOperation . indexOf ( pathSeparator , filepath , fSegmentStart = fSegmentEnd + 1 ) ; // skip separator
if ( fSegmentEnd < 0 ) { fSegmentEnd = fLength ; } } /* check sequence of doubleStar + segment */
int pSegmentRestart ; if ( pSegmentStart >= pLength && freeTrailingDoubleStar || pSegmentEnd == pSegmentStart + 2 && pattern [ pSegmentStart ] == '*' && pattern [ pSegmentStart + 1 ] == '*' ) { pSegmentEnd = CharOperation . indexOf ( pathSeparator , pattern , pSegmentStart = pSegmentEnd + 1 ) ; // skip separator
if ( pSegmentEnd < 0 ) { pSegmentEnd = pLength ; } pSegmentRestart = pSegmentStart ; } else { if ( pSegmentStart >= pLength ) { return fSegmentStart >= fLength ; // true if filepath is done
} // too .
pSegmentRestart = 0 ; // force fSegmentStart check
} int fSegmentRestart = fSegmentStart ; checkSegment : while ( fSegmentStart < fLength ) { if ( pSegmentStart >= pLength ) { if ( freeTrailingDoubleStar ) { return true ; } // mismatch - restart current path segment
pSegmentEnd = CharOperation . indexOf ( pathSeparator , pattern , pSegmentStart = pSegmentRestart ) ; if ( pSegmentEnd < 0 ) { pSegmentEnd = pLength ; } fSegmentRestart = CharOperation . indexOf ( pathSeparator , filepath , fSegmentRestart + 1 ) ; // skip separator
if ( fSegmentRestart < 0 ) { fSegmentRestart = fLength ; } else { fSegmentRestart ++ ; } fSegmentEnd = CharOperation . indexOf ( pathSeparator , filepath , fSegmentStart = fSegmentRestart ) ; if ( fSegmentEnd < 0 ) { fSegmentEnd = fLength ; } continue checkSegment ; } /* path segment is ending */
if ( pSegmentEnd == pSegmentStart + 2 && pattern [ pSegmentStart ] == '*' && pattern [ pSegmentStart + 1 ] == '*' ) { pSegmentEnd = CharOperation . indexOf ( pathSeparator , pattern , pSegmentStart = pSegmentEnd + 1 ) ; // skip separator
if ( pSegmentEnd < 0 ) { pSegmentEnd = pLength ; } pSegmentRestart = pSegmentStart ; fSegmentRestart = fSegmentStart ; if ( pSegmentStart >= pLength ) { return true ; } continue checkSegment ; } /* chech current path segment */
if ( ! CharOperation . match ( pattern , pSegmentStart , pSegmentEnd , filepath , fSegmentStart , fSegmentEnd , isCaseSensitive ) ) { // mismatch - restart current path segment
pSegmentEnd = CharOperation . indexOf ( pathSeparator , pattern , pSegmentStart = pSegmentRestart ) ; if ( pSegmentEnd < 0 ) { pSegmentEnd = pLength ; } fSegmentRestart = CharOperation . indexOf ( pathSeparator , filepath , fSegmentRestart + 1 ) ; // skip separator
if ( fSegmentRestart < 0 ) { fSegmentRestart = fLength ; } else { fSegmentRestart ++ ; } fSegmentEnd = CharOperation . indexOf ( pathSeparator , filepath , fSegmentStart = fSegmentRestart ) ; if ( fSegmentEnd < 0 ) { fSegmentEnd = fLength ; } continue checkSegment ; } // jump to next segment
pSegmentEnd = CharOperation . indexOf ( pathSeparator , pattern , pSegmentStart = pSegmentEnd + 1 ) ; // skip separator
if ( pSegmentEnd < 0 ) { pSegmentEnd = pLength ; } fSegmentEnd = CharOperation . indexOf ( pathSeparator , filepath , fSegmentStart = fSegmentEnd + 1 ) ; // skip separator
if ( fSegmentEnd < 0 ) { fSegmentEnd = fLength ; } } return pSegmentRestart >= pSegmentEnd || fSegmentStart >= fLength && pSegmentStart >= pLength || pSegmentStart == pLength - 2 && pattern [ pSegmentStart ] == '*' && pattern [ pSegmentStart + 1 ] == '*' || pSegmentStart == pLength && freeTrailingDoubleStar ; |
public class Middlewares { /** * see http : / / www . w3 . org / Protocols / rfc2616 / rfc2616 - sec4 . html # sec4.3 */
private static boolean setPayloadForStatus ( StatusType statusType ) { } } | return statusType . code ( ) != Status . NOT_MODIFIED . code ( ) && statusType . code ( ) != Status . NO_CONTENT . code ( ) && statusType . family ( ) != StatusType . Family . INFORMATIONAL ; |
public class StreamBuilderImpl { /** * filter ( ) sync */
@ Override public StreamBuilderImpl < T , U > filter ( PredicateSync < ? super T > test ) { } } | return new FilterSync < T , U > ( this , test ) ; |
public class SibRaDestinationSession { /** * Returns the destination address associated with this session . Delegates . */
public SIDestinationAddress getDestinationAddress ( ) { } } | final String methodName = "getDestinationAddress" ; if ( TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } final SIDestinationAddress address = _delegateSession . getDestinationAddress ( ) ; if ( TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName , _parentConnection ) ; } return address ; |
public class PID { /** * Construct a PID given a filename of the form produced by toFilename ( ) ,
* throwing a MalformedPIDException if it ' s not well - formed .
* @ param filenameString default translation of PID to filename
* @ return PID the PID producing the input filename
* @ throws MalformedPIDException */
public static PID fromFilename ( String filenameString ) throws MalformedPIDException { } } | String decoded = filenameString . replaceFirst ( "_" , ":" ) ; if ( decoded . endsWith ( "%" ) ) { decoded = decoded . substring ( 0 , decoded . length ( ) - 1 ) + "." ; } return new PID ( decoded ) ; |
public class DBManagerFactory { /** * 并发安全的 */
public static DBManager getInstance ( ) { } } | if ( dbManager == null ) { synchronized ( lock ) { if ( dbManager == null ) { dbManager = new RedisDBManager ( ) ; } } } return dbManager ; |
public class VirtualMachineScaleSetsInner { /** * Deallocates specific virtual machines in a VM scale set . Shuts down the virtual machines and releases the compute resources . You are not billed for the compute resources that this virtual machine scale set deallocates .
* @ param resourceGroupName The name of the resource group .
* @ param vmScaleSetName The name of the VM scale set .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the OperationStatusResponseInner object */
public Observable < OperationStatusResponseInner > beginDeallocateAsync ( String resourceGroupName , String vmScaleSetName ) { } } | return beginDeallocateWithServiceResponseAsync ( resourceGroupName , vmScaleSetName ) . map ( new Func1 < ServiceResponse < OperationStatusResponseInner > , OperationStatusResponseInner > ( ) { @ Override public OperationStatusResponseInner call ( ServiceResponse < OperationStatusResponseInner > response ) { return response . body ( ) ; } } ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.