signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
---|---|
public class TimeoutImpl { /** * Get the timeout from the policy and start the timer
* @ param timeoutTask */
private void start ( Runnable timeoutTask ) { } } | long timeout = timeoutPolicy . getTimeout ( ) . toNanos ( ) ; start ( timeoutTask , timeout ) ; |
public class druidGParser { /** * druidG . g : 433:1 : selectorFilter returns [ Filter filter ] : e = getEquals ; */
public final Filter selectorFilter ( ) throws RecognitionException { } } | Filter filter = null ; EqualsToHolder e = null ; filter = new Filter ( "selector" ) ; try { // druidG . g : 435:2 : ( e = getEquals )
// druidG . g : 435:4 : e = getEquals
{ pushFollow ( FOLLOW_getEquals_in_selectorFilter2973 ) ; e = getEquals ( ) ; state . _fsp -- ; filter . dimension = e . name ; filter . value = unquote ( e . value ) ; } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { // do for sure before leaving
} return filter ; |
public class MessageDrivenBeanTypeImpl { /** * Returns all < code > timer < / code > elements
* @ return list of < code > timer < / code > */
public List < TimerType < MessageDrivenBeanType < T > > > getAllTimer ( ) { } } | List < TimerType < MessageDrivenBeanType < T > > > list = new ArrayList < TimerType < MessageDrivenBeanType < T > > > ( ) ; List < Node > nodeList = childNode . get ( "timer" ) ; for ( Node node : nodeList ) { TimerType < MessageDrivenBeanType < T > > type = new TimerTypeImpl < MessageDrivenBeanType < T > > ( this , "timer" , childNode , node ) ; list . add ( type ) ; } return list ; |
public class JavaEscape { /** * Perform a Java < strong > unescape < / strong > operation on a < tt > String < / tt > input .
* No additional configuration arguments are required . Unescape operations
* will always perform < em > complete < / em > Java unescape of SECs , u - based and octal escapes .
* This method is < strong > thread - safe < / strong > .
* @ param text the < tt > String < / tt > to be unescaped .
* @ return The unescaped result < tt > String < / tt > . As a memory - performance improvement , will return the exact
* same object as the < tt > text < / tt > input argument if no unescaping modifications were required ( and
* no additional < tt > String < / tt > objects will be created during processing ) . Will
* return < tt > null < / tt > if input is < tt > null < / tt > . */
public static String unescapeJava ( final String text ) { } } | if ( text == null ) { return null ; } if ( text . indexOf ( '\\' ) < 0 ) { // Fail fast , avoid more complex ( and less JIT - table ) method to execute if not needed
return text ; } return JavaEscapeUtil . unescape ( text ) ; |
public class ColorFidelityImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setColSub ( Integer newColSub ) { } } | Integer oldColSub = colSub ; colSub = newColSub ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . COLOR_FIDELITY__COL_SUB , oldColSub , colSub ) ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcStructuralLoadSingleForceWarping ( ) { } } | if ( ifcStructuralLoadSingleForceWarpingEClass == null ) { ifcStructuralLoadSingleForceWarpingEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 650 ) ; } return ifcStructuralLoadSingleForceWarpingEClass ; |
public class ClassFinderActivator { /** * Get the package name of this class name .
* NOTE : This is exactly the same as Util . getPackageName , move this !
* @ param className
* @ return */
public static String getPackageName ( String className , boolean resource ) { } } | String packageName = null ; if ( className != null ) { if ( className . indexOf ( File . separator ) != - 1 ) { className = className . substring ( 0 , className . lastIndexOf ( File . separator ) ) ; packageName = className . replace ( File . separator . charAt ( 0 ) , '.' ) ; } else if ( className . indexOf ( '/' ) != - 1 ) { className = className . substring ( 0 , className . lastIndexOf ( '/' ) ) ; packageName = className . replace ( '/' , '.' ) ; } else { if ( resource ) if ( className . endsWith ( PROPERTIES ) ) className = className . substring ( 0 , className . length ( ) - PROPERTIES . length ( ) ) ; if ( className . lastIndexOf ( '.' ) != - 1 ) packageName = className . substring ( 0 , className . lastIndexOf ( '.' ) ) ; } } return packageName ; |
public class CmsTabDialog { /** * Returns the start html for the tab content area of the dialog window . < p >
* @ param title the title for the dialog
* @ param attributes additional attributes for the content & lt ; div & gt ; area of the tab dialog
* @ return the start html for the tab content area of the dialog window */
public String dialogTabContentStart ( String title , String attributes ) { } } | return dialogTabContent ( HTML_START , title , attributes ) ; |
public class Validate { /** * < p > Validate that the specified argument object fall between the two
* inclusive values specified ; otherwise , throws an exception . < / p >
* < pre > Validate . inclusiveBetween ( 0 , 2 , 1 ) ; < / pre >
* @ param < T > the type of the argument object
* @ param start the inclusive start value , not null
* @ param end the inclusive end value , not null
* @ param value the object to validate , not null
* @ throws IllegalArgumentException if the value falls outside the boundaries
* @ see # inclusiveBetween ( Object , Object , Comparable , String , Object . . . )
* @ since 3.0 */
public static < T > void inclusiveBetween ( final T start , final T end , final Comparable < T > value ) { } } | // TODO when breaking BC , consider returning value
if ( value . compareTo ( start ) < 0 || value . compareTo ( end ) > 0 ) { throw new IllegalArgumentException ( StringUtils . simpleFormat ( DEFAULT_INCLUSIVE_BETWEEN_EX_MESSAGE , value , start , end ) ) ; } |
public class ComponentsJmxRegistration { /** * Unregisters all the MBeans registered through { @ link # registerMBeans ( Collection ) } .
* @ param resourceDMBeans */
public void unregisterMBeans ( Collection < ResourceDMBean > resourceDMBeans ) throws CacheException { } } | log . trace ( "Unregistering jmx resources.." ) ; try { for ( ResourceDMBean resource : resourceDMBeans ) { JmxUtil . unregisterMBean ( getObjectName ( resource ) , mBeanServer ) ; } } catch ( Exception e ) { throw new CacheException ( "Failure while unregistering mbeans" , e ) ; } |
public class ListFuncSup { /** * define a function to deal with each element in the list with given
* start index
* @ param func
* a function takes in each element from list
* @ param index
* the index where to start iteration
* @ return return ' last loop value ' . < br >
* check
* < a href = " https : / / github . com / wkgcass / Style / " > tutorial < / a > for
* more info about ' last loop value ' */
@ SuppressWarnings ( "unchecked" ) public < R > R forEach ( VFunc1 < T > func , int index ) { } } | return ( R ) forEach ( $ ( func ) , index ) ; |
public class JNIWriter { /** * Emit a class file for a given class .
* @ param c The class from which a class file is generated . */
public FileObject write ( ClassSymbol c ) throws IOException { } } | String className = c . flatName ( ) . toString ( ) ; FileObject outFile = fileManager . getFileForOutput ( StandardLocation . NATIVE_HEADER_OUTPUT , "" , className . replaceAll ( "[.$]" , "_" ) + ".h" , null ) ; Writer out = outFile . openWriter ( ) ; try { write ( out , c ) ; if ( verbose ) log . printVerbose ( "wrote.file" , outFile ) ; out . close ( ) ; out = null ; } finally { if ( out != null ) { // if we are propogating an exception , delete the file
out . close ( ) ; outFile . delete ( ) ; outFile = null ; } } return outFile ; // may be null if write failed |
public class FastQueue { /** * Returns the first index which equals ( ) obj . - 1 is there is no match
* @ param obj The object being searched for
* @ return index or - 1 if not found */
public int indexOf ( T obj ) { } } | for ( int i = 0 ; i < size ; i ++ ) { if ( data [ i ] . equals ( obj ) ) { return i ; } } return - 1 ; |
public class TimeSeriesLookup { /** * Compiles a scanner with the given salt ID if salting is enabled AND we ' re
* not scanning the meta table .
* @ param salt An ID for the salt bucket
* @ return A scanner to send to HBase . */
private Scanner getScanner ( final int salt ) { } } | final Scanner scanner = tsdb . getClient ( ) . newScanner ( query . useMeta ( ) ? tsdb . metaTable ( ) : tsdb . dataTable ( ) ) ; scanner . setFamily ( query . useMeta ( ) ? TSMeta . FAMILY : TSDB . FAMILY ( ) ) ; if ( metric_uid != null ) { byte [ ] key ; if ( query . useMeta ( ) || Const . SALT_WIDTH ( ) < 1 ) { key = metric_uid ; } else { key = new byte [ Const . SALT_WIDTH ( ) + TSDB . metrics_width ( ) ] ; System . arraycopy ( RowKey . getSaltBytes ( salt ) , 0 , key , 0 , Const . SALT_WIDTH ( ) ) ; System . arraycopy ( metric_uid , 0 , key , Const . SALT_WIDTH ( ) , metric_uid . length ) ; } scanner . setStartKey ( key ) ; long uid = UniqueId . uidToLong ( metric_uid , TSDB . metrics_width ( ) ) ; uid ++ ; if ( uid < Internal . getMaxUnsignedValueOnBytes ( TSDB . metrics_width ( ) ) ) { // if random metrics are enabled we could see a metric with the max UID
// value . If so , we need to leave the stop key as null
if ( query . useMeta ( ) || Const . SALT_WIDTH ( ) < 1 ) { key = UniqueId . longToUID ( uid , TSDB . metrics_width ( ) ) ; } else { key = new byte [ Const . SALT_WIDTH ( ) + TSDB . metrics_width ( ) ] ; System . arraycopy ( RowKey . getSaltBytes ( salt ) , 0 , key , 0 , Const . SALT_WIDTH ( ) ) ; System . arraycopy ( UniqueId . longToUID ( uid , TSDB . metrics_width ( ) ) , 0 , key , Const . SALT_WIDTH ( ) , metric_uid . length ) ; } scanner . setStopKey ( key ) ; } } if ( rowkey_regex != null ) { scanner . setKeyRegexp ( rowkey_regex , CHARSET ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Scanner regex: " + QueryUtil . byteRegexToString ( rowkey_regex ) ) ; } } return scanner ; |
public class CurrencyToken { /** * This method tries to evaluate the localized display name for a
* { @ link CurrencyUnit } . It uses { @ link Currency # getDisplayName ( Locale ) } if
* the given currency code maps to a JDK { @ link Currency } instance .
* If not found { @ code currency . getCurrencyCode ( ) } is returned .
* @ param currency The currency , not { @ code null }
* @ return the formatted currency name . */
private String getCurrencyName ( CurrencyUnit currency ) { } } | Currency jdkCurrency = getCurrency ( currency . getCurrencyCode ( ) ) ; if ( jdkCurrency != null ) { return jdkCurrency . getDisplayName ( locale ) ; } return currency . getCurrencyCode ( ) ; |
public class DriverClientDispatcher { /** * We must implement this synchronously in order to catch exceptions and
* forward them back via the bridge before the server shuts down , after
* this method returns .
* @ param stopTime stop time */
@ SuppressWarnings ( "checkstyle:illegalCatch" ) public Throwable dispatch ( final StopTime stopTime ) { } } | try { for ( final EventHandler < StopTime > handler : stopHandlers ) { handler . onNext ( stopTime ) ; } return null ; } catch ( Throwable t ) { return t ; } |
public class ContainerAS { /** * Register the synchronization object with this activity session */
public void registerSynchronization ( Synchronization s ) throws CPIException { } } | try { ivContainer . uowCtrl . enlistWithSession ( s ) ; // enlistSession ( s )
} catch ( CSIException e ) { throw new CPIException ( e . toString ( ) ) ; } |
public class MySQLMultiDbJDBCConnection { /** * { @ inheritDoc } */
public void delete ( NodeData data ) throws RepositoryException , UnsupportedOperationException , InvalidItemStateException , IllegalStateException { } } | addedNodes . remove ( data . getIdentifier ( ) ) ; super . delete ( data ) ; |
public class LogRecordStack { /** * Returns thread id from the current stack . It is called by log handler
* to get thread id which is either passed for the record in a request or
* obtained from the thread directly .
* @ return thread id from the stack . */
public static int getThreadID ( ) { } } | StackInfo result = MDC . get ( ) ; return result == null ? HpelHelper . getIntThreadId ( ) : result . threadId ; |
public class GetObjectInformationRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetObjectInformationRequest getObjectInformationRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getObjectInformationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getObjectInformationRequest . getDirectoryArn ( ) , DIRECTORYARN_BINDING ) ; protocolMarshaller . marshall ( getObjectInformationRequest . getObjectReference ( ) , OBJECTREFERENCE_BINDING ) ; protocolMarshaller . marshall ( getObjectInformationRequest . getConsistencyLevel ( ) , CONSISTENCYLEVEL_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class LogManager { /** * Send a verbose log message to the logger .
* @ param tag Used to identify the source of a log message . It usually identifies
* the class or activity where the log call occurs .
* @ param message The message you would like logged . This message may contain string formatting
* which will be replaced with values from args .
* @ param t An exception to log .
* @ param args Arguments for string formatting . */
public static void v ( Throwable t , String tag , String message , Object ... args ) { } } | sLogger . v ( t , tag , message , args ) ; |
public class Server { /** * Return scope key . Scope key consists of host name concatenated with context path by slash symbol
* @ param hostName
* Host name
* @ param contextPath
* Context path
* @ return Scope key as string */
protected String getKey ( String hostName , String contextPath ) { } } | return String . format ( "%s/%s" , ( hostName == null ? EMPTY : hostName ) , ( contextPath == null ? EMPTY : contextPath ) ) ; |
public class ExperimentsInner { /** * Creates an Experiment .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param workspaceName The name of the workspace . Workspace names can only contain a combination of alphanumeric characters along with dash ( - ) and underscore ( _ ) . The name must be from 1 through 64 characters long .
* @ param experimentName The name of the experiment . Experiment names can only contain a combination of alphanumeric characters along with dash ( - ) and underscore ( _ ) . The name must be from 1 through 64 characters long .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the ExperimentInner object */
public Observable < ExperimentInner > beginCreateAsync ( String resourceGroupName , String workspaceName , String experimentName ) { } } | return beginCreateWithServiceResponseAsync ( resourceGroupName , workspaceName , experimentName ) . map ( new Func1 < ServiceResponse < ExperimentInner > , ExperimentInner > ( ) { @ Override public ExperimentInner call ( ServiceResponse < ExperimentInner > response ) { return response . body ( ) ; } } ) ; |
public class Lookup { /** * Gets the Cache that will be used as the default for the specified
* class by future Lookups .
* @ param dclass The class whose cache is being retrieved .
* @ return The default cache for the specified class . */
public static synchronized Cache getDefaultCache ( int dclass ) { } } | DClass . check ( dclass ) ; Cache c = ( Cache ) defaultCaches . get ( Mnemonic . toInteger ( dclass ) ) ; if ( c == null ) { c = new Cache ( dclass ) ; defaultCaches . put ( Mnemonic . toInteger ( dclass ) , c ) ; } return c ; |
public class QuotedStringTokenizer { /** * Unquote a string .
* @ param s The string to unquote .
* @ return quoted string */
public static String unquote ( String s ) { } } | if ( s == null ) return null ; if ( s . length ( ) < 2 ) return s ; char first = s . charAt ( 0 ) ; char last = s . charAt ( s . length ( ) - 1 ) ; if ( first != last || ( first != '"' && first != '\'' ) ) return s ; StringBuffer b = new StringBuffer ( s . length ( ) - 2 ) ; synchronized ( b ) { boolean quote = false ; for ( int i = 1 ; i < s . length ( ) - 1 ; i ++ ) { char c = s . charAt ( i ) ; if ( c == '\\' && ! quote ) { quote = true ; continue ; } quote = false ; b . append ( c ) ; } return b . toString ( ) ; } |
public class BatchGetDeploymentGroupsRequest { /** * The names of the deployment groups .
* @ return The names of the deployment groups . */
public java . util . List < String > getDeploymentGroupNames ( ) { } } | if ( deploymentGroupNames == null ) { deploymentGroupNames = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return deploymentGroupNames ; |
public class SimpleNaviRpcClient { /** * 调用通信
* @ param method
* 方法
* @ param args
* 参数
* @ param parameterTypes
* 参数类型
* @ param genericReturnType
* 泛型返回结果类型
* @ param attachment附加信息
* @ return 结果对象
* @ throws Throwable
* 异常信息 */
public Object transport ( String methodName , Object [ ] args , Class < ? > [ ] parameterTypes , Type genericReturnType , Attachment attachment ) throws Throwable { } } | ResponseDTO response ; long start = System . currentTimeMillis ( ) ; try { RequestDTO request = makeRequestDTO ( methodName , args , parameterTypes ) ; if ( attachment != null ) { attachmentHandler . handle ( request , attachment ) ; } byte [ ] reqBytes = serializeHandler . serialize ( request , RequestDTO . class ) ; preLog ( request , reqBytes ) ; HttpURLConnection connection = ( HttpURLConnection ) new URL ( url ) . openConnection ( ) ; sendRequest ( reqBytes , connection ) ; byte [ ] resBytes = readResponse ( connection ) ; response = serializeHandler . deserialize ( resBytes , ResponseDTO . class , null , genericReturnType ) ; postLog ( request , reqBytes , resBytes , start ) ; } catch ( IOException e ) { throw new RpcException ( "Rpc transport has IO problems - " + e . getMessage ( ) , e ) ; } catch ( CodecException e ) { throw new RpcException ( "Rpc transport has serialization problems - " + e . getMessage ( ) , e ) ; } catch ( RpcException e ) { throw e ; } checkResponse ( response ) ; return response . getResult ( ) ; |
public class EvolutionDurations { /** * Return an new { @ code EvolutionDurations } object with the given values .
* @ param offspringSelectionDuration the duration needed for selecting the
* offspring population
* @ param survivorsSelectionDuration the duration needed for selecting the
* survivors population
* @ param offspringAlterDuration the duration needed for altering the
* offspring population
* @ param offspringFilterDuration the duration needed for removing and
* replacing invalid offspring individuals
* @ param survivorFilterDuration the duration needed for removing and
* replacing old and invalid survivor individuals
* @ param evaluationDuration the duration needed for evaluating the fitness
* function of the new individuals
* @ param evolveDuration the duration needed for the whole evolve step
* @ return an new durations object
* @ throws NullPointerException if one of the arguments is
* { @ code null } */
public static EvolutionDurations of ( final Duration offspringSelectionDuration , final Duration survivorsSelectionDuration , final Duration offspringAlterDuration , final Duration offspringFilterDuration , final Duration survivorFilterDuration , final Duration evaluationDuration , final Duration evolveDuration ) { } } | return new EvolutionDurations ( offspringSelectionDuration , survivorsSelectionDuration , offspringAlterDuration , offspringFilterDuration , survivorFilterDuration , evaluationDuration , evolveDuration ) ; |
public class CmsCommandInitGenerator { /** * This method generates the source code for the class initializer class . < p >
* @ param logger the logger to be used
* @ param context the generator context
* @ param subclasses the classes for which the generated code should the initClass ( ) method */
public void generateClass ( TreeLogger logger , GeneratorContext context , List < JClassType > subclasses ) { } } | PrintWriter printWriter = context . tryCreate ( logger , PACKAGE_NAME , CLASS_NAME ) ; if ( printWriter == null ) { return ; } ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory ( PACKAGE_NAME , CLASS_NAME ) ; composer . addImplementedInterface ( INIT_INTERFACE_NAME ) ; SourceWriter sourceWriter = composer . createSourceWriter ( context , printWriter ) ; sourceWriter . println ( "public java.util.Map<String, " + COMMAND_INTERFACE + "> initCommands() {" ) ; sourceWriter . indent ( ) ; sourceWriter . println ( "java.util.Map<String, " + COMMAND_INTERFACE + "> result=new java.util.HashMap<String, " + COMMAND_INTERFACE + ">();" ) ; for ( JClassType type : subclasses ) { sourceWriter . println ( "result.put(\"" + type . getQualifiedSourceName ( ) + "\"," + type . getQualifiedSourceName ( ) + "." + GET_COMMAND_METHOD + "());" ) ; } sourceWriter . println ( "return result;" ) ; sourceWriter . outdent ( ) ; sourceWriter . println ( "}" ) ; sourceWriter . outdent ( ) ; sourceWriter . println ( "}" ) ; context . commit ( logger , printWriter ) ; |
public class QualifiedName { /** * For an identifier of the form " a . b . c . d " , returns " a . b . c "
* For an identifier of the form " a " , returns absent */
public Optional < QualifiedName > getPrefix ( ) { } } | if ( parts . size ( ) == 1 ) { return Optional . empty ( ) ; } List < String > subList = parts . subList ( 0 , parts . size ( ) - 1 ) ; return Optional . of ( new QualifiedName ( subList , subList ) ) ; |
public class ForSignatureVisitor { /** * Visits a type which might define an owner type .
* @ param ownableType The visited generic type . */
private void onOwnableType ( Generic ownableType ) { } } | Generic ownerType = ownableType . getOwnerType ( ) ; if ( ownerType != null && ownerType . getSort ( ) . isParameterized ( ) ) { onOwnableType ( ownerType ) ; signatureVisitor . visitInnerClassType ( ownableType . asErasure ( ) . getSimpleName ( ) ) ; } else { signatureVisitor . visitClassType ( ownableType . asErasure ( ) . getInternalName ( ) ) ; } for ( Generic typeArgument : ownableType . getTypeArguments ( ) ) { typeArgument . accept ( new OfTypeArgument ( signatureVisitor ) ) ; } |
public class Replication { /** * Restarts the replication . This blocks until the replication successfully stops .
* Alternatively , you can stop ( ) the replication and create a brand new one and start ( ) it . */
@ InterfaceAudience . Public public void restart ( ) { } } | // stop replicator if necessary
if ( this . isRunning ( ) ) { final CountDownLatch stopped = new CountDownLatch ( 1 ) ; ChangeListener listener = new ChangeListener ( ) { @ Override public void changed ( ChangeEvent event ) { if ( event . getTransition ( ) != null && event . getTransition ( ) . getDestination ( ) == ReplicationState . STOPPED ) { stopped . countDown ( ) ; } } } ; addChangeListener ( listener ) ; // tries to stop replicator
stop ( ) ; try { // If need to wait more than 60 sec to stop , throws Exception
boolean ret = stopped . await ( 60 , TimeUnit . SECONDS ) ; if ( ret == false ) { throw new RuntimeException ( "Replicator is unable to stop." ) ; } } catch ( InterruptedException e ) { throw new RuntimeException ( e ) ; } finally { removeChangeListener ( listener ) ; } } // start replicator
start ( ) ; |
public class LoadBalancersInner { /** * Gets the specified load balancer .
* @ param resourceGroupName The name of the resource group .
* @ param loadBalancerName The name of the load balancer .
* @ 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 LoadBalancerInner object if successful . */
public LoadBalancerInner getByResourceGroup ( String resourceGroupName , String loadBalancerName ) { } } | return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , loadBalancerName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class AnnotationStringConverterFactory { /** * Finds the conversion method .
* @ param cls the class to find a method for , not null
* @ param toString the toString method , not null
* @ param searchSuperclasses whether to search superclasses
* @ return the method to call , null means not found
* @ throws RuntimeException if invalid */
private < T > MethodsStringConverter < T > findFromStringMethod ( Class < T > cls , Method toString , boolean searchSuperclasses ) { } } | // find in superclass hierarchy
Class < ? > loopCls = cls ; while ( loopCls != null ) { Method fromString = findFromString ( loopCls ) ; if ( fromString != null ) { return new MethodsStringConverter < T > ( cls , toString , fromString , loopCls ) ; } if ( searchSuperclasses == false ) { break ; } loopCls = loopCls . getSuperclass ( ) ; } // find in immediate parent interfaces
MethodsStringConverter < T > matched = null ; if ( searchSuperclasses ) { for ( Class < ? > loopIfc : eliminateEnumSubclass ( cls ) . getInterfaces ( ) ) { Method fromString = findFromString ( loopIfc ) ; if ( fromString != null ) { if ( matched != null ) { throw new IllegalStateException ( "Two different interfaces are annotated with " + "@FromString or @FromStringFactory: " + cls . getName ( ) ) ; } matched = new MethodsStringConverter < T > ( cls , toString , fromString , loopIfc ) ; } } } return matched ; |
public class SearchModule { /** * Scans the classpath for Search implementations , through the
* { @ link ServiceLoader } mechanism and returns one .
* @ param classSimpleName the name of the class name to look for and load
* @ return a Search instance if found , or null */
final Search loadExternalSearch ( String classSimpleName ) { } } | ServiceLoader < Search > searchLoader = ServiceLoader . load ( Search . class , Para . getParaClassLoader ( ) ) ; for ( Search search : searchLoader ) { if ( search != null && classSimpleName . equalsIgnoreCase ( search . getClass ( ) . getSimpleName ( ) ) ) { return search ; } } return null ; |
public class NetFlowV9Parser { /** * like above , but contains all records for the template id as raw bytes */
public static Integer parseRecordShallow ( ByteBuf bb ) { } } | final int start = bb . readerIndex ( ) ; int usedTemplateId = bb . readUnsignedShort ( ) ; int length = bb . readUnsignedShort ( ) ; int end = bb . readerIndex ( ) - 4 + length ; bb . readerIndex ( end ) ; return usedTemplateId ; |
public class QueryBuilder { /** * Constructs a query from the current configuration of this Builder .
* @ return a { @ link GazetteerQuery } configuration object */
public GazetteerQuery build ( ) { } } | return new GazetteerQuery ( location , maxResults , fuzzyMode , ancestryMode , includeHistorical , filterDupes , parentIds , featureCodes ) ; |
public class Stream { /** * Sets a timeout by supplying the absolute milliseconds timestamp when the { @ code Stream }
* will be forcedly closed . If the supplied value is null , any previously set timeout is
* removed . In case the { @ code Stream has already been closed } , or has just timed out due to a
* previously set timeout , calling this method has no effect .
* @ param timestamp
* the milliseconds timestamp when the { @ code Stream } will be closed
* @ return this { @ code Stream } , for call chaining */
public final Stream < T > setTimeout ( @ Nullable final Long timestamp ) { } } | Preconditions . checkArgument ( timestamp == null || timestamp > System . currentTimeMillis ( ) ) ; synchronized ( this . state ) { if ( this . state . closed ) { return this ; // NOP , already closed
} if ( this . state . timeoutFuture != null ) { if ( ! this . state . timeoutFuture . cancel ( false ) ) { return this ; // NOP , timeout already occurred
} } if ( timestamp != null ) { this . state . timeoutFuture = Data . getExecutor ( ) . schedule ( new Runnable ( ) { @ Override public void run ( ) { close ( ) ; } } , Math . max ( 0 , timestamp - System . currentTimeMillis ( ) ) , TimeUnit . MILLISECONDS ) ; } return this ; } |
public class MultiQueueExecutor { /** * Calls flushTermination ( ) , flushUpdate ( ) , flushInsert ( ) and shutdown ( ) and waits for all pending tasks
* to finish .
* To ensure proper error handling , this method must be called . */
public void waitUntilFinished ( ) { } } | flushTermination ( ) ; flushUpdate ( ) ; flushInsert ( ) ; shutdown ( ) ; for ( int i = 0 ; i < numberOfQueues ; i ++ ) { while ( ! executors [ i ] . isTerminated ( ) ) { try { executors [ i ] . awaitTermination ( 10000000 , TimeUnit . SECONDS ) ; } catch ( InterruptedException e ) { // ignore
} } } if ( useBulkInsert ) { bulkInsert ( ) ; } logFinalResults ( ) ; if ( this . error != null ) { if ( error instanceof RuntimeException ) { throw ( RuntimeException ) error ; } else { throw new RuntimeException ( "One or more parallel tasks failed" , this . error ) ; } } |
public class SlingI18nMap { /** * Build i18n resource XML in Sling i18n Message format .
* @ return XML */
public String getI18nXmlString ( ) { } } | Format format = Format . getPrettyFormat ( ) ; XMLOutputter outputter = new XMLOutputter ( format ) ; return outputter . outputString ( buildI18nXml ( ) ) ; |
public class Nucleotide { /** * This method returns the HELM notation for nucleotide linker
* @ return linker notation */
public String getLinkerNotation ( ) { } } | String pSymbol = getPhosphateSymbol ( ) ; String result = null ; if ( null == pSymbol || pSymbol . length ( ) == 0 ) { result = "" ; } else { if ( pSymbol . length ( ) > 1 ) result = "[" + pSymbol + "]" ; else result = pSymbol ; } return result ; |
public class GalleriesApi { /** * Return the list of galleries to which a photo has been added . Galleries are returned sorted by date which the photo was added to the gallery .
* < br >
* This method does not require authentication .
* @ param photoId Required . The ID of the photo to fetch a list of galleries for .
* @ param perPage Optional . Number of galleries to return per page . If this argument is & le ; = 0 , it defaults to 100 . The maximum allowed value is 500.
* @ param page Optional . The page of results to return . If this argument is & le ; = 0 , it defaults to 1.
* @ return list of galleries to which a photo has been added .
* @ throws JinxException if required parameters are null or empty , or if there are any errors .
* @ see < a href = " https : / / www . flickr . com / services / api / flickr . galleries . getListForPhoto . html " > flickr . galleries . getListForPhoto < / a > */
public GalleryList getListForPhoto ( String photoId , int perPage , int page ) throws JinxException { } } | JinxUtils . validateParams ( photoId ) ; Map < String , String > params = new TreeMap < > ( ) ; params . put ( "method" , "flickr.galleries.getListForPhoto" ) ; params . put ( "photo_id" , photoId ) ; if ( perPage > 0 ) { params . put ( "per_page" , Integer . toString ( perPage ) ) ; } if ( page > 0 ) { params . put ( "page" , Integer . toString ( page ) ) ; } return jinx . flickrGet ( params , GalleryList . class ) ; |
public class PhynixxManagedConnectionFactory { /** * the connection is released to the pool */
@ Override public void connectionReleased ( IManagedConnectionEvent < C > event ) { } } | IPhynixxManagedConnection < C > proxy = event . getManagedConnection ( ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Proxy " + proxy + " released" ) ; } |
public class AbstractRestController { /** * Create / save an entity . */
@ RequestMapping ( method = RequestMethod . POST ) public ResponseEntity < E > save ( HttpServletRequest request ) { } } | final String simpleClassName = getEntityClass ( ) . getSimpleName ( ) ; final String errorMessagePrefix = "Error when saving entity of type " + simpleClassName + ": " ; BufferedReader reader = null ; // read and parse the json request body
try { reader = request . getReader ( ) ; E entity = objectMapper . readValue ( reader , getEntityClass ( ) ) ; // ID value MUST be null to assure that
// saveOrUpdate will save and not update
final Integer id = entity . getId ( ) ; if ( id != null ) { LOG . error ( errorMessagePrefix + "ID value is set to " + id + ", but MUST be null" ) ; return new ResponseEntity < E > ( HttpStatus . BAD_REQUEST ) ; } this . service . saveOrUpdate ( entity ) ; LOG . trace ( "Created " + simpleClassName + " with ID " + entity . getId ( ) ) ; return new ResponseEntity < E > ( entity , HttpStatus . CREATED ) ; } catch ( Exception e ) { LOG . error ( errorMessagePrefix + e . getMessage ( ) ) ; return new ResponseEntity < E > ( HttpStatus . BAD_REQUEST ) ; } finally { IOUtils . closeQuietly ( reader ) ; } |
public class VariableNumMap { /** * Gets the index of the variable named { @ code variableName } . Returns
* { @ code - 1 } if no such variable exists .
* @ param variableName
* @ return */
public final int getVariableByName ( String variableName ) { } } | int index = getVariableIndex ( variableName ) ; if ( index == - 1 ) { return index ; } else { return nums [ index ] ; } |
public class CalendarConverter { /** * Gets the millis , which is the Calendar millis value .
* @ param object the Calendar to convert , must not be null
* @ param chrono the chronology result from getChronology , non - null
* @ return the millisecond value
* @ throws NullPointerException if the object is null
* @ throws ClassCastException if the object is an invalid type */
public long getInstantMillis ( Object object , Chronology chrono ) { } } | Calendar calendar = ( Calendar ) object ; return calendar . getTime ( ) . getTime ( ) ; |
public class StringUtils { /** * URL - Decodes a given string using ISO - 8859-1 . No UnsupportedEncodingException to handle as it is dealt with in
* this method . */
public static String decodeUrlIso ( String stringToDecode ) { } } | try { return URLDecoder . decode ( stringToDecode , "ISO-8859-1" ) ; } catch ( UnsupportedEncodingException e1 ) { throw new RuntimeException ( e1 ) ; } |
public class ConsoleMenu { /** * Gets a String from the System . in .
* @ param msg
* for the command line
* @ return String as entered by the user of the console app */
public static String getString ( final String msg ) { } } | ConsoleMenu . print ( msg ) ; BufferedReader bufReader = null ; String opt = null ; try { bufReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; opt = bufReader . readLine ( ) ; } catch ( final IOException ex ) { log ( ex ) ; System . exit ( 1 ) ; } return opt ; |
public class InjectionUtils { /** * Liberty Change for CXF Begain */
private static boolean isAsyncMethod ( Method method ) { } } | Class < ? > [ ] parameterTypes = method . getParameterTypes ( ) ; for ( Class < ? > c : parameterTypes ) { if ( c . isAssignableFrom ( javax . ws . rs . container . AsyncResponse . class ) ) return true ; } return false ; |
public class EmailCommandInstruction { /** * ( non - Javadoc )
* @ see net . roboconf . core . commands . AbstractCommandInstruction # doValidate ( ) */
@ Override public List < ParsingError > doValidate ( ) { } } | List < ParsingError > result = new ArrayList < > ( ) ; if ( Utils . isEmptyOrWhitespaces ( this . msg ) ) result . add ( error ( ErrorCode . CMD_EMAIL_NO_MESSAGE ) ) ; return result ; |
public class Battery { /** * Calculates the rectangle that specifies the area that is available
* for painting the gauge . This means that if the component has insets
* that are larger than 0 , these will be taken into account . */
private void calcInnerBounds ( ) { } } | final java . awt . Insets INSETS = getInsets ( ) ; INNER_BOUNDS . setBounds ( INSETS . left , INSETS . top , ( getWidth ( ) - INSETS . left - INSETS . right ) , ( getHeight ( ) - INSETS . top - INSETS . bottom ) ) ; |
public class GetLoggerDefinitionVersionRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetLoggerDefinitionVersionRequest getLoggerDefinitionVersionRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getLoggerDefinitionVersionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getLoggerDefinitionVersionRequest . getLoggerDefinitionId ( ) , LOGGERDEFINITIONID_BINDING ) ; protocolMarshaller . marshall ( getLoggerDefinitionVersionRequest . getLoggerDefinitionVersionId ( ) , LOGGERDEFINITIONVERSIONID_BINDING ) ; protocolMarshaller . marshall ( getLoggerDefinitionVersionRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class AWSGreengrassClient { /** * Creates a version of a resource definition that has already been defined .
* @ param createResourceDefinitionVersionRequest
* @ return Result of the CreateResourceDefinitionVersion operation returned by the service .
* @ throws BadRequestException
* invalid request
* @ sample AWSGreengrass . CreateResourceDefinitionVersion
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / greengrass - 2017-06-07 / CreateResourceDefinitionVersion "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public CreateResourceDefinitionVersionResult createResourceDefinitionVersion ( CreateResourceDefinitionVersionRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeCreateResourceDefinitionVersion ( request ) ; |
public class FileUtil { /** * 按照给定的readerHandler读取文件中的数据
* @ param < T > 集合类型
* @ param readerHandler Reader处理类
* @ param path 文件的绝对路径
* @ param charset 字符集
* @ return 从文件中load出的数据
* @ throws IORuntimeException IO异常
* @ deprecated 使用FileUtil # load ( String , String , ReaderHandler ) 代替 */
@ Deprecated public static < T > T load ( ReaderHandler < T > readerHandler , String path , String charset ) throws IORuntimeException { } } | return FileReader . create ( file ( path ) , CharsetUtil . charset ( charset ) ) . read ( readerHandler ) ; |
public class NodeWriteTrx { /** * Building name consisting out of prefix and name . NamespaceUri is not used
* over here .
* @ param pQName
* the { @ link QName } of an element
* @ return a string with [ prefix : ] localname */
public static String buildName ( final QName pQName ) { } } | if ( pQName == null ) { throw new NullPointerException ( "mQName must not be null!" ) ; } String name ; if ( pQName . getPrefix ( ) . isEmpty ( ) ) { name = pQName . getLocalPart ( ) ; } else { name = new StringBuilder ( pQName . getPrefix ( ) ) . append ( ":" ) . append ( pQName . getLocalPart ( ) ) . toString ( ) ; } return name ; |
public class Isomorphism { /** * { @ inheritDoc }
* @ param reactant
* @ param product */
@ Override public void init ( IAtomContainer reactant , IAtomContainer product , boolean removeHydrogen , boolean cleanAndConfigureMolecule ) throws CDKException { } } | this . removeHydrogen = removeHydrogen ; init ( new MolHandler ( reactant , removeHydrogen , cleanAndConfigureMolecule ) , new MolHandler ( product , removeHydrogen , cleanAndConfigureMolecule ) ) ; |
public class ClassGraph { /** * Scan one or more specific packages and their sub - packages .
* N . B . Automatically calls { @ link # enableClassInfo ( ) } - - call { @ link # whitelistPaths ( String . . . ) } instead if you
* only need to scan resources .
* @ param packageNames
* The fully - qualified names of packages to scan ( using ' . ' as a separator ) . May include a glob
* wildcard ( { @ code ' * ' } ) .
* @ return this ( for method chaining ) . */
public ClassGraph whitelistPackages ( final String ... packageNames ) { } } | enableClassInfo ( ) ; for ( final String packageName : packageNames ) { final String packageNameNormalized = WhiteBlackList . normalizePackageOrClassName ( packageName ) ; if ( packageNameNormalized . startsWith ( "!" ) || packageNameNormalized . startsWith ( "-" ) ) { throw new IllegalArgumentException ( "This style of whitelisting/blacklisting is no longer supported: " + packageNameNormalized ) ; } // Whitelist package
scanSpec . packageWhiteBlackList . addToWhitelist ( packageNameNormalized ) ; final String path = WhiteBlackList . packageNameToPath ( packageNameNormalized ) ; scanSpec . pathWhiteBlackList . addToWhitelist ( path + "/" ) ; if ( packageNameNormalized . isEmpty ( ) ) { scanSpec . pathWhiteBlackList . addToWhitelist ( "" ) ; } if ( ! packageNameNormalized . contains ( "*" ) ) { // Whitelist sub - packages
if ( packageNameNormalized . isEmpty ( ) ) { scanSpec . packagePrefixWhiteBlackList . addToWhitelist ( "" ) ; scanSpec . pathPrefixWhiteBlackList . addToWhitelist ( "" ) ; } else { scanSpec . packagePrefixWhiteBlackList . addToWhitelist ( packageNameNormalized + "." ) ; scanSpec . pathPrefixWhiteBlackList . addToWhitelist ( path + "/" ) ; } } } return this ; |
public class VirtualMachineScaleSetsInner { /** * Update a VM scale set .
* @ param resourceGroupName The name of the resource group .
* @ param vmScaleSetName The name of the VM scale set to create or update .
* @ param parameters The scale set object .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < VirtualMachineScaleSetInner > updateAsync ( String resourceGroupName , String vmScaleSetName , VirtualMachineScaleSetUpdate parameters , final ServiceCallback < VirtualMachineScaleSetInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( updateWithServiceResponseAsync ( resourceGroupName , vmScaleSetName , parameters ) , serviceCallback ) ; |
public class AbstractExecutableMemberWriter { /** * Get the type parameters for the executable member .
* @ param member the member for which to get the type parameters .
* @ return the type parameters . */
protected Content getTypeParameters ( ExecutableMemberDoc member ) { } } | LinkInfoImpl linkInfo = new LinkInfoImpl ( configuration , LinkInfoImpl . Kind . MEMBER_TYPE_PARAMS , member ) ; return writer . getTypeParameterLinks ( linkInfo ) ; |
public class SqlModifyBuilder { /** * Generate .
* @ param classBuilder
* the class builder
* @ param method
* the method */
public static void generate ( TypeSpec . Builder classBuilder , SQLiteModelMethod method ) { } } | ModifyType updateResultType = detectModifyType ( method , method . jql . operationType ) ; // if true , field must be associate to ben attributes
TypeName returnType = method . getReturnClass ( ) ; if ( updateResultType == null ) { throw ( new InvalidMethodSignException ( method ) ) ; } // generate method code
MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( method . getName ( ) ) . addAnnotation ( Override . class ) . addModifiers ( Modifier . PUBLIC ) ; ParameterSpec parameterSpec ; for ( Pair < String , TypeName > item : method . getParameters ( ) ) { parameterSpec = ParameterSpec . builder ( item . value1 , item . value0 ) . build ( ) ; methodBuilder . addParameter ( parameterSpec ) ; } methodBuilder . returns ( returnType ) ; // generate inner code
updateResultType . generate ( classBuilder , methodBuilder , method , returnType ) ; MethodSpec methodSpec = methodBuilder . build ( ) ; classBuilder . addMethod ( methodSpec ) ; if ( method . contentProviderEntryPathEnabled ) { // delete - select , update - select can be used with content provider
// insert - select no
// if ( method . jql . containsSelectOperation & & updateResultType = = ) {
// AssertKripton . failWithInvalidMethodSignException ( true , method , "
// SQL with inner SELECT can not be used in content provider " ) ;
generateModifierForContentProvider ( BaseProcessor . elementUtils , classBuilder , method , updateResultType ) ; } |
public class SIAImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . SIA__ADJSTMNT : return getADJSTMNT ( ) ; case AfplibPackage . SIA__DIRCTION : return getDIRCTION ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class MaterialComboBox { /** * Add Value directly to combobox component
* @ param text - The text you want to labeled on the option item
* @ param value - The value you want to pass through in this option */
public Option addItem ( String text , T value ) { } } | if ( ! values . contains ( value ) ) { Option option = buildOption ( text , value ) ; values . add ( value ) ; listbox . add ( option ) ; return option ; } return null ; |
public class HylaFaxClientSpi { /** * This function will submit a new fax job . < br >
* The fax job ID may be populated by this method in the provided
* fax job object .
* @ param client
* The client instance
* @ param faxJob
* The fax job object containing the needed information
* @ throws Exception
* Any exception */
protected void submitFaxJob ( HylaFaxJob faxJob , HylaFAXClient client ) throws Exception { } } | // get job
Job job = faxJob . getHylaFaxJob ( ) ; // add document to fax
String filePath = faxJob . getFilePath ( ) ; job . addDocument ( filePath ) ; // submit job
client . submit ( job ) ; |
public class WsByteBufferUtils { /** * Convert an array of buffers to a byte array . The buffers will remain
* unchanged
* by this conversion . This will stop on the first null buffer . A null or
* empty
* list will return a null byte [ ] .
* @ param list
* @ return byte [ ] */
public static final byte [ ] asByteArray ( WsByteBuffer [ ] list ) { } } | if ( null == list ) return null ; int size = 0 ; for ( int i = 0 ; i < list . length && null != list [ i ] ; i ++ ) { size += list [ i ] . limit ( ) ; } if ( 0 == size ) return null ; byte [ ] output = new byte [ size ] ; int offset = 0 ; int position = 0 ; for ( int i = 0 ; i < list . length && null != list [ i ] ; i ++ ) { position = list [ i ] . position ( ) ; list [ i ] . position ( 0 ) ; list [ i ] . get ( output , offset , list [ i ] . limit ( ) ) ; offset += list [ i ] . limit ( ) ; list [ i ] . position ( position ) ; } return output ; |
public class CreateTriggerRequest { /** * The tags to use with this trigger . You may use tags to limit access to the trigger . For more information about
* tags in AWS Glue , see < a href = " http : / / docs . aws . amazon . com / glue / latest / dg / monitor - tags . html " > AWS Tags in AWS
* Glue < / a > in the developer guide .
* @ param tags
* The tags to use with this trigger . You may use tags to limit access to the trigger . For more information
* about tags in AWS Glue , see < a href = " http : / / docs . aws . amazon . com / glue / latest / dg / monitor - tags . html " > AWS Tags
* in AWS Glue < / a > in the developer guide .
* @ return Returns a reference to this object so that method calls can be chained together . */
public CreateTriggerRequest withTags ( java . util . Map < String , String > tags ) { } } | setTags ( tags ) ; return this ; |
public class CPRuleAssetCategoryRelPersistenceImpl { /** * Returns all the cp rule asset category rels .
* @ return the cp rule asset category rels */
@ Override public List < CPRuleAssetCategoryRel > findAll ( ) { } } | return findAll ( QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; |
public class AuthFilterJAAS { /** * ( non - Javadoc )
* @ see javax . servlet . Filter # doFilter ( javax . servlet . ServletRequest ,
* javax . servlet . ServletResponse , javax . servlet . FilterChain ) */
@ Override public void doFilter ( ServletRequest request , ServletResponse response , FilterChain chain ) throws IOException , ServletException { } } | HttpServletRequest req = ( HttpServletRequest ) request ; HttpServletResponse res = ( HttpServletResponse ) response ; // This is a hack to skip challenge authentication of API - A methods via the
// REST API if API - A AuthN is off ( as indicated by the " authnAPIA "
// filter init - param ) .
// If API - A AuthN is off , for all GET requests via the REST API ,
// except those which are known to be part of API - M , don ' t challenge for authentication
// ( but do pick up any preemptive credentials that are supplied )
// FIXME : As other servlets that require authn also go through this filter ,
// there ' s probably a neater way to ensure we are only catching API - A methods
// currently we are explicitly testing for other management URLs / paths
// ( probably should test fullPath for { appcontext } / objects ( REST API ) and then
// test path for API - A methods , maybe regex to make it explicit )
boolean doChallenge = true ; if ( ! authnAPIA ) { if ( req . getMethod ( ) . equals ( "GET" ) || req . getMethod ( ) . equals ( "HEAD" ) ) { String requestPath = req . getPathInfo ( ) ; if ( requestPath == null ) requestPath = "" ; // null is returned eg for / fedora / objects ? - API - A , so we still want to do the below . . .
String fullPath = req . getRequestURI ( ) ; // API - M methods
// potentially extra String evals , but aiming for clarity
boolean isExport = requestPath . endsWith ( "/export" ) ; boolean isObjectXML = requestPath . endsWith ( "/objectXML" ) ; boolean isGetDatastream = requestPath . contains ( "/datastreams/" ) && ! requestPath . endsWith ( "/content" ) ; isGetDatastream = isGetDatastream || ( requestPath . endsWith ( "/datastreams" ) && Boolean . valueOf ( request . getParameter ( "profiles" ) ) ) ; boolean isGetRelationships = requestPath . endsWith ( "/relationships" ) ; boolean isValidate = requestPath . endsWith ( "/validate" ) ; // management get methods ( LITE API , control )
boolean isManagement = fullPath . endsWith ( "/management/control" ) || fullPath . endsWith ( "/management/getNextPID" ) ; // user servlet
boolean isUserServlet = fullPath . endsWith ( "/user" ) ; // challenge if API - M or one of the above other services ( otherwise we assume it is API - A )
doChallenge = isExport || isObjectXML || isGetDatastream || isGetRelationships || isValidate || isManagement || isUserServlet ; } } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "incoming filter: {}" , this . getClass ( ) . getName ( ) ) ; logger . debug ( "session-id: {}" , req . getSession ( ) . getId ( ) ) ; } Subject subject = authenticate ( req ) ; if ( subject == null ) { if ( doChallenge ) { loginForm ( res ) ; return ; } else { // no auth required , and none supplied , do rest of chain
chain . doFilter ( request , response ) ; return ; } } // obtain the user principal from the subject and add to servlet .
Principal userPrincipal = getUserPrincipal ( subject ) ; // obtain the user roles from the subject and add to servlet .
Set < String > userRoles = getUserRoles ( subject ) ; // wrap the request in one that has the ability to store role
// and principal information and store this information .
AuthHttpServletRequestWrapper authRequest = new AuthHttpServletRequestWrapper ( req ) ; authRequest . setUserPrincipal ( userPrincipal ) ; authRequest . setUserRoles ( userRoles ) ; // add the roles that were obtained to the Subject .
addRolesToSubject ( subject , userRoles ) ; // populate FEDORA _ AUX _ SUBJECT _ ATTRIBUTES with fedoraRole
// and any additional Subject attributes
populateFedoraAttributes ( subject , userRoles , authRequest ) ; chain . doFilter ( authRequest , response ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "outgoing filter: " + this . getClass ( ) . getName ( ) ) ; } |
public class Matrix4x3d { /** * Store the values of the given matrix < code > m < / code > into < code > this < / code > matrix .
* @ param m
* the matrix to copy the values from
* @ return this */
public Matrix4x3d set ( Matrix4x3dc m ) { } } | m00 = m . m00 ( ) ; m01 = m . m01 ( ) ; m02 = m . m02 ( ) ; m10 = m . m10 ( ) ; m11 = m . m11 ( ) ; m12 = m . m12 ( ) ; m20 = m . m20 ( ) ; m21 = m . m21 ( ) ; m22 = m . m22 ( ) ; m30 = m . m30 ( ) ; m31 = m . m31 ( ) ; m32 = m . m32 ( ) ; properties = m . properties ( ) ; return this ; |
public class PTSaxton2006 { /** * For calculating SKSAT
* @ param soilParas should include 1 . Sand weight percentage by layer
* ( [ 0,100 ] % ) , 2 . Clay weight percentage by layer ( [ 0,100 ] % ) , 3 . Organic
* matter weight percentage by layer ( [ 0,100 ] % ) , ( = SLOC * 1.72 ) , 4 . Grave
* weight percentage by layer ( [ 0,100 ] % )
* @ return Saturated hydraulic conductivity , cm / h */
public static String getSKSAT ( String [ ] soilParas ) { } } | if ( soilParas != null && soilParas . length >= 3 ) { if ( soilParas . length >= 4 ) { return divide ( calcSatBulk ( soilParas [ 0 ] , soilParas [ 1 ] , soilParas [ 2 ] , divide ( soilParas [ 3 ] , "100" ) ) , "10" , 3 ) ; } else { return divide ( calcSatMatric ( soilParas [ 0 ] , soilParas [ 1 ] , soilParas [ 2 ] ) , "10" , 3 ) ; } } else { return null ; } |
public class Exp { /** * Backward pass :
* dG / dx _ i + = dG / dy _ i dy _ i / dx _ i = dG / dy _ i exp ( x _ i ) */
@ Override public void backward ( ) { } } | Tensor tmp = new Tensor ( yAdj ) ; // copy
tmp . elemMultiply ( y ) ; modInX . getOutputAdj ( ) . elemAdd ( tmp ) ; |
public class nitro_service { /** * Use this API to enable the feature on Netscaler .
* @ param feature feature to be enabled .
* @ return status of the operation performed .
* @ throws Exception Nitro exception . */
public base_response enable_features ( String [ ] features ) throws Exception { } } | base_response result = null ; nsfeature resource = new nsfeature ( ) ; resource . set_feature ( features ) ; options option = new options ( ) ; option . set_action ( "enable" ) ; result = resource . perform_operation ( this , option ) ; return result ; |
public class Client { /** * Get a batch of users assigned to privilege .
* @ param id Id of the privilege
* @ param batchSize Size of the Batch
* @ param afterCursor Reference to continue collecting items of next page
* @ return OneLoginResponse of User ( Batch )
* @ throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
* @ throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
* @ throws URISyntaxException - if there is an error when generating the target URL at the getResource call
* @ see < a target = " _ blank " href = " https : / / developers . onelogin . com / api - docs / 1 / privileges / get - users " > Get Assigned Users documentation < / a > */
public OneLoginResponse < Long > getUsersAssignedToPrivilegesBatch ( String id , int batchSize , String afterCursor ) throws OAuthSystemException , OAuthProblemException , URISyntaxException { } } | ExtractionContext context = extractResourceBatch ( ( Object ) id , batchSize , afterCursor , Constants . GET_USERS_ASSIGNED_TO_PRIVILEGE_URL ) ; List < Long > userIds = new ArrayList < Long > ( batchSize ) ; afterCursor = getUsersAssignedToPrivilegesBatch ( userIds , context . url , context . bearerRequest , context . oAuth2Response ) ; return new OneLoginResponse < Long > ( userIds , afterCursor ) ; |
public class RuntimeDataServiceImpl { /** * start
* task methods */
@ Override public UserTaskInstanceDesc getTaskByWorkItemId ( Long workItemId ) { } } | Map < String , Object > params = new HashMap < String , Object > ( ) ; params . put ( "workItemId" , workItemId ) ; params . put ( "maxResults" , 1 ) ; List < UserTaskInstanceDesc > tasks = commandService . execute ( new QueryNameCommand < List < UserTaskInstanceDesc > > ( "getTaskInstanceByWorkItemId" , params ) ) ; if ( ! tasks . isEmpty ( ) ) { return tasks . iterator ( ) . next ( ) ; } return null ; |
public class ContextClassLoaderUtils { /** * Executes a piece of code ( callable . call ) using a specific class loader set as context class loader .
* If the curent thread context clas loader is already set , it will be restored after execution .
* @ param classLoader clas loader to be used as context clas loader during call .
* @ param callable piece of code to be executed using the clas loader
* @ return return from callable
* @ throws Exception re - thrown from callable */
public static < V > V doWithClassLoader ( final ClassLoader classLoader , final Callable < V > callable ) throws Exception { } } | Thread currentThread = null ; ClassLoader backupClassLoader = null ; try { if ( classLoader != null ) { currentThread = Thread . currentThread ( ) ; backupClassLoader = currentThread . getContextClassLoader ( ) ; currentThread . setContextClassLoader ( classLoader ) ; } return callable . call ( ) ; } finally { if ( classLoader != null ) { currentThread . setContextClassLoader ( backupClassLoader ) ; } } |
public class UploadServletUnjar { /** * The file was uploaded successfully , return an HTML string to display .
* NOTE : This is supplied to provide a convenient place to override this servlet and
* do some processing or supply a different ( or no ) return string . */
public String successfulFileUpload ( File file , Properties properties ) { } } | String strHTML = super . successfulFileUpload ( file , properties ) ; strHTML = "<a href=\"/\">Home</a>" + RETURN + strHTML ; // Create a properties object to describe where to move these files
String strPath = file . getPath ( ) ; // May as well use the passed - in properties object ( No properties are usable )
properties . setProperty ( SOURCE_PARAM , "Zip" ) ; properties . setProperty ( ZIPIN_FILENAME_PARAM , strPath ) ; // Source jar / zip
properties . setProperty ( DESTINATION , "Filesystem" ) ; String strDest = properties . getProperty ( DESTINATION , "C:\\TEMP\\" ) ; properties . setProperty ( DEST_ROOT_PATHNAME_PARAM , strDest ) ; // Destination jar / zip
// Queue up the task to move them !
org . jbundle . jbackup . Scanner scanner = new org . jbundle . jbackup . Scanner ( properties ) ; new Thread ( scanner ) . start ( ) ; strHTML += "<p>Unjar thread successfully started</p>" ; return strHTML ; |
public class DefaultResourceDataBroker { /** * See : { @ link ResourceDataBroker # ruleFileExists ( String ) }
* Checks if a resource in the grammar checker ' s { @ code / rules } exists .
* @ param path Path to an item from the { @ code / rules } directory .
* @ return { @ code true } if the resource file exists . */
@ Override public boolean ruleFileExists ( String path ) { } } | String completePath = getCompleteRulesUrl ( path ) ; return ResourceDataBroker . class . getResource ( completePath ) != null ; |
public class AbstractUdfStreamOperator { @ Override public void setup ( StreamTask < ? , ? > containingTask , StreamConfig config , Output < StreamRecord < OUT > > output ) { } } | super . setup ( containingTask , config , output ) ; FunctionUtils . setFunctionRuntimeContext ( userFunction , getRuntimeContext ( ) ) ; |
public class Reflection { /** * make a forced class casting .
* @ param obj the object you want to cast from .
* @ param clazz the class your want to cast to .
* @ return The casted object . */
@ SuppressWarnings ( "unchecked" ) private static < T > T cast ( Object obj , Class < T > clazz ) { } } | if ( obj == null ) { return null ; } if ( clazz == null ) { throw new IllegalArgumentException ( "parameter 'Class<T> clazz' is not allowed to be null." ) ; } if ( clazz . isEnum ( ) && obj instanceof String ) { Class < Enum > enumClazz = ( Class < Enum > ) clazz ; return ( T ) Enum . valueOf ( enumClazz , obj . toString ( ) ) ; } if ( clazz . isPrimitive ( ) ) { if ( clazz == Integer . TYPE ) { clazz = ( Class < T > ) Integer . class ; } else if ( clazz == Long . TYPE ) { clazz = ( Class < T > ) Long . class ; } else if ( clazz == Short . TYPE ) { clazz = ( Class < T > ) Short . class ; } else if ( clazz == Double . TYPE ) { clazz = ( Class < T > ) Double . class ; } else if ( clazz == Float . TYPE ) { clazz = ( Class < T > ) Float . class ; } else if ( clazz == Character . TYPE ) { clazz = ( Class < T > ) Character . class ; } else if ( clazz == Byte . TYPE ) { clazz = ( Class < T > ) Byte . class ; } else if ( clazz == Boolean . TYPE ) { clazz = ( Class < T > ) Boolean . class ; } } return clazz . cast ( obj ) ; |
public class LazySocket { /** * Returns the internal wrapped socket or null if not connected . After
* calling recycle , this LazySocket instance is closed . */
CheckedSocket recycle ( ) { } } | CheckedSocket s ; if ( mClosed ) { s = null ; } else { s = mSocket ; mSocket = null ; mClosed = true ; } return s ; |
public class Validator { /** * Validates field to be a valid URL
* @ param name The field to check
* @ param message A custom error message instead of the default one */
public void expectUrl ( String name , String message ) { } } | String value = Optional . ofNullable ( get ( name ) ) . orElse ( "" ) ; if ( ! UrlValidator . getInstance ( ) . isValid ( value ) ) { addError ( name , Optional . ofNullable ( message ) . orElse ( messages . get ( Validation . URL_KEY . name ( ) , name ) ) ) ; } |
public class MultimediaListItemRenderer { /** * { @ inheritDoc } */
@ Override public StringBuilder renderAsListItem ( final StringBuilder builder , final boolean newLine , final int pad ) { } } | builder . append ( "<li>" ) ; renderListItemContents ( builder ) ; builder . append ( "</li>\n" ) ; return builder ; |
public class AmazonSimpleEmailServiceClient { /** * Composes an email message using an email template and immediately queues it for sending .
* In order to send email using the < code > SendTemplatedEmail < / code > operation , your call to the API must meet the
* following requirements :
* < ul >
* < li >
* The call must refer to an existing email template . You can create email templates using the < a > CreateTemplate < / a >
* operation .
* < / li >
* < li >
* The message must be sent from a verified email address or domain .
* < / li >
* < li >
* If your account is still in the Amazon SES sandbox , you may only send to verified addresses or domains , or to
* email addresses associated with the Amazon SES Mailbox Simulator . For more information , see < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / verify - addresses - and - domains . html " > Verifying Email
* Addresses and Domains < / a > in the < i > Amazon SES Developer Guide . < / i >
* < / li >
* < li >
* The maximum message size is 10 MB .
* < / li >
* < li >
* Calls to the < code > SendTemplatedEmail < / code > operation may only include one < code > Destination < / code > parameter . A
* destination is a set of recipients who will receive the same version of the email . The < code > Destination < / code >
* parameter can include up to 50 recipients , across the To : , CC : and BCC : fields .
* < / li >
* < li >
* The < code > Destination < / code > parameter must include at least one recipient email address . The recipient address
* can be a To : address , a CC : address , or a BCC : address . If a recipient email address is invalid ( that is , it is
* not in the format < i > UserName @ [ SubDomain . ] Domain . TopLevelDomain < / i > ) , the entire message will be rejected , even
* if the message contains other recipients that are valid .
* < / li >
* < / ul >
* < important >
* If your call to the < code > SendTemplatedEmail < / code > operation includes all of the required parameters , Amazon SES
* accepts it and returns a Message ID . However , if Amazon SES can ' t render the email because the template contains
* errors , it doesn ' t send the email . Additionally , because it already accepted the message , Amazon SES doesn ' t
* return a message stating that it was unable to send the email .
* For these reasons , we highly recommend that you set up Amazon SES to send you notifications when Rendering
* Failure events occur . For more information , see < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / send - personalized - email - api . html " > Sending Personalized
* Email Using the Amazon SES API < / a > in the < i > Amazon Simple Email Service Developer Guide < / i > .
* < / important >
* @ param sendTemplatedEmailRequest
* Represents a request to send a templated email using Amazon SES . For more information , see the < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / send - personalized - email - api . html " > Amazon SES
* Developer Guide < / a > .
* @ return Result of the SendTemplatedEmail operation returned by the service .
* @ throws MessageRejectedException
* Indicates that the action failed , and the message could not be sent . Check the error stack for more
* information about what caused the error .
* @ throws MailFromDomainNotVerifiedException
* Indicates that the message could not be sent because Amazon SES could not read the MX record required to
* use the specified MAIL FROM domain . For information about editing the custom MAIL FROM domain settings
* for an identity , see the < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / mail - from - edit . html " > Amazon SES Developer
* Guide < / a > .
* @ throws ConfigurationSetDoesNotExistException
* Indicates that the configuration set does not exist .
* @ throws TemplateDoesNotExistException
* Indicates that the Template object you specified does not exist in your Amazon SES account .
* @ throws ConfigurationSetSendingPausedException
* Indicates that email sending is disabled for the configuration set . < / p >
* You can enable or disable email sending for a configuration set using
* < a > UpdateConfigurationSetSendingEnabled < / a > .
* @ throws AccountSendingPausedException
* Indicates that email sending is disabled for your entire Amazon SES account .
* You can enable or disable email sending for your Amazon SES account using
* < a > UpdateAccountSendingEnabled < / a > .
* @ sample AmazonSimpleEmailService . SendTemplatedEmail
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / email - 2010-12-01 / SendTemplatedEmail " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public SendTemplatedEmailResult sendTemplatedEmail ( SendTemplatedEmailRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeSendTemplatedEmail ( request ) ; |
public class Phrase { /** * Entry point into this API .
* @ throws IllegalArgumentException if pattern contains any syntax errors . */
public static Phrase from ( Fragment f , @ StringRes int patternResourceId ) { } } | return from ( f . getResources ( ) , patternResourceId ) ; |
public class ClusteringKeyMapper { /** * Adds to the specified document the clustering key contained in the specified cell name .
* @ param document The document where the clustering key is going to be added .
* @ param cellName A cell name containing the clustering key to be added . */
public final void addFields ( Document document , CellName cellName ) { } } | String serializedKey = ByteBufferUtils . toString ( cellName . toByteBuffer ( ) ) ; Field field = new StringField ( FIELD_NAME , serializedKey , Field . Store . YES ) ; document . add ( field ) ; |
public class IdentityPatchContext { /** * Create a patch representing what we actually processed . This may contain some fixed content hashes for removed
* modules .
* @ param original the original
* @ return the processed patch */
protected Patch createProcessedPatch ( final Patch original ) { } } | // Process elements
final List < PatchElement > elements = new ArrayList < PatchElement > ( ) ; // Process layers
for ( final PatchEntry entry : getLayers ( ) ) { final PatchElement element = createPatchElement ( entry , entry . element . getId ( ) , entry . modifications ) ; elements . add ( element ) ; } // Process add - ons
for ( final PatchEntry entry : getAddOns ( ) ) { final PatchElement element = createPatchElement ( entry , entry . element . getId ( ) , entry . modifications ) ; elements . add ( element ) ; } // Swap the patch element modifications , keep the identity ones since we don ' t need to fix the misc modifications
return new PatchImpl ( original . getPatchId ( ) , original . getDescription ( ) , original . getLink ( ) , original . getIdentity ( ) , elements , identityEntry . modifications ) ; |
public class PredefinedTokenTokenizer { /** * Will only return either tokens with type PREDEFINED or UNDEFINED */
@ Override public List < Token > tokenize ( String s ) { } } | List < Token > result = new ArrayList < Token > ( ) ; result . add ( new UndefinedToken ( s ) ) ; for ( PredefinedTokenDefinition predefinedTokenDefinition : _predefinedTokenDefitions ) { Set < Pattern > patterns = predefinedTokenDefinition . getTokenRegexPatterns ( ) ; for ( Pattern pattern : patterns ) { for ( ListIterator < Token > it = result . listIterator ( ) ; it . hasNext ( ) ; ) { Token token = it . next ( ) ; if ( token instanceof UndefinedToken ) { List < Token > replacementTokens = tokenizeInternal ( token . getString ( ) , predefinedTokenDefinition , pattern ) ; if ( replacementTokens . size ( ) > 1 ) { it . remove ( ) ; for ( Token newToken : replacementTokens ) { it . add ( newToken ) ; } } } } } } return result ; |
public class StringUtil { /** * Converts the specified byte array into a hexadecimal value and appends it to the specified buffer . */
public static < T extends Appendable > T toHexStringPadded ( T dst , byte [ ] src , int offset , int length ) { } } | final int end = offset + length ; for ( int i = offset ; i < end ; i ++ ) { byteToHexStringPadded ( dst , src [ i ] ) ; } return dst ; |
public class AbstractVisitor { /** * read commands */
@ Override public Object visitSizeCommand ( InvocationContext ctx , SizeCommand command ) throws Throwable { } } | return handleDefault ( ctx , command ) ; |
public class StandardSubstructureSets { /** * Load a list of SMARTS patterns from the specified file .
* Each line in the file corresponds to a pattern with the following structure :
* PATTERN _ DESCRIPTION : SMARTS _ PATTERN , < i > e . g . , Thioketone : [ # 6 ] [ CX3 ] ( = [ SX1 ] ) [ # 6 ] < / i >
* Empty lines and lines starting with a " # " are skipped .
* @ param filename list of the SMARTS pattern to be loaded
* @ return list of strings containing the loaded SMARTS pattern
* @ throws Exception if there is an error parsing SMILES patterns */
private static String [ ] readSMARTSPattern ( String filename ) throws Exception { } } | InputStream ins = StandardSubstructureSets . class . getClassLoader ( ) . getResourceAsStream ( filename ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( ins ) ) ; List < String > tmp = new ArrayList < String > ( ) ; String line ; while ( ( line = reader . readLine ( ) ) != null ) { if ( line . startsWith ( "#" ) || line . trim ( ) . length ( ) == 0 ) continue ; String [ ] toks = line . split ( ":" ) ; StringBuffer s = new StringBuffer ( ) ; for ( int i = 1 ; i < toks . length - 1 ; i ++ ) s . append ( toks [ i ] + ":" ) ; s . append ( toks [ toks . length - 1 ] ) ; tmp . add ( s . toString ( ) . trim ( ) ) ; } return tmp . toArray ( new String [ ] { } ) ; |
public class BiomorphApplet { /** * Initialise and layout the GUI .
* @ param container The Swing component that will contain the GUI controls . */
@ Override protected void prepareGUI ( Container container ) { } } | renderer = new SwingBiomorphRenderer ( ) ; console = new SwingConsole ( 5 ) ; selectionDialog = new JDialog ( ( JFrame ) null , "Biomorph Selection" , true ) ; biomorphHolder = new JPanel ( new GridLayout ( 1 , 1 ) ) ; container . add ( new ControlPanel ( ) , BorderLayout . WEST ) ; container . add ( biomorphHolder , BorderLayout . CENTER ) ; biomorphHolder . setBorder ( BorderFactory . createTitledBorder ( "Last Evolved Biomorph" ) ) ; biomorphHolder . add ( new JLabel ( "Nothing generated yet." , JLabel . CENTER ) ) ; selectionDialog . add ( console , BorderLayout . CENTER ) ; selectionDialog . setSize ( 800 , 600 ) ; selectionDialog . validate ( ) ; |
public class JsMessageVisitor { /** * Visit a call to goog . getMsgWithFallback . */
private void visitFallbackFunctionCall ( NodeTraversal t , Node call ) { } } | // Check to make sure the function call looks like :
// goog . getMsgWithFallback ( MSG _ 1 , MSG _ 2 ) ;
if ( call . getChildCount ( ) != 3 || ! call . getSecondChild ( ) . isName ( ) || ! call . getLastChild ( ) . isName ( ) ) { compiler . report ( JSError . make ( call , BAD_FALLBACK_SYNTAX ) ) ; return ; } Node firstArg = call . getSecondChild ( ) ; String name = firstArg . getOriginalName ( ) ; if ( name == null ) { name = firstArg . getString ( ) ; } JsMessage firstMessage = getTrackedMessage ( t , name ) ; if ( firstMessage == null ) { compiler . report ( JSError . make ( firstArg , FALLBACK_ARG_ERROR , name ) ) ; return ; } Node secondArg = firstArg . getNext ( ) ; name = secondArg . getOriginalName ( ) ; if ( name == null ) { name = secondArg . getString ( ) ; } JsMessage secondMessage = getTrackedMessage ( t , name ) ; if ( secondMessage == null ) { compiler . report ( JSError . make ( secondArg , FALLBACK_ARG_ERROR , name ) ) ; return ; } processMessageFallback ( call , firstMessage , secondMessage ) ; |
public class SchemaImpl { /** * Installs the schema handler on the reader .
* @ param in The reader .
* @ param sr The schema receiver .
* @ return The installed handler that implements also SchemaFuture . */
SchemaFuture installHandlers ( XMLReader in , SchemaReceiverImpl sr ) { } } | Handler h = new Handler ( sr ) ; in . setContentHandler ( h ) ; return h ; |
public class ControlledBounceProxyModule { /** * ( non - Javadoc )
* @ see com . google . inject . AbstractModule # configure ( ) */
@ Override protected void configure ( ) { } } | bind ( MessagingService . class ) . to ( MessagingServiceImpl . class ) ; bind ( BounceProxyLifecycleMonitor . class ) . to ( MonitoringServiceClient . class ) ; bind ( BounceProxyInformation . class ) . toProvider ( BounceProxyInformationProvider . class ) ; |
public class CPSpecificationOptionPersistenceImpl { /** * Caches the cp specification options in the entity cache if it is enabled .
* @ param cpSpecificationOptions the cp specification options */
@ Override public void cacheResult ( List < CPSpecificationOption > cpSpecificationOptions ) { } } | for ( CPSpecificationOption cpSpecificationOption : cpSpecificationOptions ) { if ( entityCache . getResult ( CPSpecificationOptionModelImpl . ENTITY_CACHE_ENABLED , CPSpecificationOptionImpl . class , cpSpecificationOption . getPrimaryKey ( ) ) == null ) { cacheResult ( cpSpecificationOption ) ; } else { cpSpecificationOption . resetOriginalValues ( ) ; } } |
public class CmsPermissionDialog { /** * Displays the user permissions . < p >
* @ param user the selected user */
void displayUserPermissions ( CmsUser user ) { } } | CmsPermissionView view = buildPermissionEntryForm ( user . getId ( ) , buildPermissionsForCurrentUser ( ) , false , false ) ; view . hideDeniedColumn ( ) ; m_userPermissions . addComponent ( view ) ; |
public class Version { /** * Returns the " version " entry from a jar file ' s manifest , if available .
* If the class isn ' t in a jar file , or that jar file doesn ' t define a
* " version " entry , then a " not available " string is returned .
* @ param jarClass any class from the target jar */
public static String jarVersion ( Class < ? > jarClass ) { } } | String j2objcVersion = null ; String path = jarClass . getProtectionDomain ( ) . getCodeSource ( ) . getLocation ( ) . getPath ( ) ; try ( JarFile jar = new JarFile ( URLDecoder . decode ( path , "UTF-8" ) ) ) { Manifest manifest = jar . getManifest ( ) ; j2objcVersion = manifest . getMainAttributes ( ) . getValue ( "version" ) ; } catch ( IOException e ) { // fall - through
} if ( j2objcVersion == null ) { j2objcVersion = "(j2objc version not available)" ; } String javacVersion = Parser . newParser ( null ) . version ( ) ; return String . format ( "%s (javac %s)" , j2objcVersion , javacVersion ) ; |
public class StunAttributeFactory { /** * Create a DataAtttribute .
* @ param data
* the data
* @ return newly created DataAttribute */
public static DataAttribute createDataAttributeWithoutPadding ( byte data [ ] ) { } } | DataAttribute attribute = new DataAttribute ( false ) ; attribute . setData ( data ) ; return attribute ; |
public class LPSolver { /** * Solves the LP problem and returns the result .
* @ param linearObjectiveFunction
* @ param linearConstraintsList
* @ param nonNegative
* @ param maximize
* @ return */
public static LPResult solve ( double [ ] linearObjectiveFunction , List < LPSolver . LPConstraint > linearConstraintsList , boolean nonNegative , boolean maximize ) { } } | int m = linearConstraintsList . size ( ) ; List < LinearConstraint > constraints = new ArrayList < > ( m ) ; for ( LPSolver . LPConstraint constraint : linearConstraintsList ) { String sign = constraint . getSign ( ) ; Relationship relationship = null ; if ( LPSolver . GEQ . equals ( sign ) ) { relationship = Relationship . GEQ ; } else if ( LPSolver . LEQ . equals ( sign ) ) { relationship = Relationship . LEQ ; } else if ( LPSolver . EQ . equals ( sign ) ) { relationship = Relationship . EQ ; } constraints . add ( new LinearConstraint ( constraint . getContraintBody ( ) , relationship , constraint . getValue ( ) ) ) ; } SimplexSolver solver = new SimplexSolver ( ) ; PointValuePair solution = solver . optimize ( new LinearObjectiveFunction ( linearObjectiveFunction , 0.0 ) , new LinearConstraintSet ( constraints ) , maximize ? GoalType . MAXIMIZE : GoalType . MINIMIZE , new NonNegativeConstraint ( nonNegative ) , PivotSelectionRule . BLAND ) ; LPResult result = new LPResult ( ) ; result . setObjectiveValue ( solution . getValue ( ) ) ; result . setVariableValues ( solution . getPoint ( ) ) ; return result ; |
public class MockFileItem { /** * { @ inheritDoc } */
@ Override public byte [ ] get ( ) { } } | if ( deleted ) { throw new IllegalStateException ( "delete() called" ) ; } if ( contents != null ) { byte [ ] data = new byte [ contents . length ] ; System . arraycopy ( contents , 0 , data , 0 , contents . length ) ; return data ; } return null ; |
public class LocalCall { /** * Calls this salt call via the async client and returns the results
* as they come in via the event stream .
* @ param client SaltClient instance
* @ param target the target for the function
* @ param events the event stream to use
* @ param cancel future to cancel the action
* @ param auth authentication credentials to use
* @ param batch parameter for enabling and configuring batching
* @ return a map from minion id to future of the result . */
public CompletionStage < Optional < Map < String , CompletionStage < Result < R > > > > > callAsync ( SaltClient client , Target < ? > target , AuthMethod auth , EventStream events , CompletionStage < GenericError > cancel , Batch batch ) { } } | return callAsync ( client , target , auth , events , cancel , Optional . of ( batch ) ) ; |