signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class RandomOrthogonalVectorGenerator { /** * Compute the dot product between two vectors . */
private static double dotProduct ( DoubleVector u , DoubleVector v ) { } }
|
double dot = 0 ; for ( int i = 0 ; i < u . length ( ) ; ++ i ) { double a = u . get ( i ) ; double b = v . get ( i ) ; dot += u . get ( i ) * v . get ( i ) ; } return dot ;
|
public class FMDate { /** * Sets a calendar component based on the input value . Meant to be called successively , with the
* return value used as the input value for the next call , to extract lower digits from the
* input value to be set into the calendar component .
* @ param cal Calendar component .
* @ param part Calendar component to be set .
* @ param value Current value .
* @ param div Modulus for value to be extracted .
* @ return Original value divided by modulus . */
private long setCalendar ( Calendar cal , int part , long value , long div ) { } }
|
cal . set ( part , ( int ) ( value % div ) ) ; return value / div ;
|
public class CmsSearchWidgetDialog { /** * Returns the JavaScript for submitting the search form . < p >
* @ return the JavaScript for submitting the search form */
private String submitJS ( ) { } }
|
StringBuffer result = new StringBuffer ( ) ; result . append ( " function validateQuery() {\n" ) ; result . append ( " var searchform = document.getElementById(\"EDITOR\");\n" ) ; result . append ( " var query = searchform.elements['query.0'].value;\n" ) ; result . append ( " searchform.elements['query.0'].value = query;\n" ) ; result . append ( " return true;\n" ) ; result . append ( " }\n" ) ; return result . toString ( ) ;
|
public class Output { /** * Write a Vector & lt ; int & gt ; .
* @ param vector
* vector */
@ Override public void writeVectorInt ( Vector < Integer > vector ) { } }
|
log . debug ( "writeVectorInt: {}" , vector ) ; writeAMF3 ( ) ; buf . put ( AMF3 . TYPE_VECTOR_INT ) ; if ( hasReference ( vector ) ) { putInteger ( getReferenceId ( vector ) << 1 ) ; return ; } storeReference ( vector ) ; putInteger ( vector . size ( ) << 1 | 1 ) ; buf . put ( ( byte ) 0x00 ) ; for ( Integer v : vector ) { buf . putInt ( v ) ; } // debug
if ( log . isDebugEnabled ( ) ) { int pos = buf . position ( ) ; buf . position ( 0 ) ; StringBuilder sb = new StringBuilder ( ) ; HexDump . dumpHex ( sb , buf . array ( ) ) ; log . debug ( "\n{}" , sb ) ; buf . position ( pos ) ; }
|
public class NodeSchema { /** * Returns a copy of this NodeSchema but with all non - TVE expressions
* replaced with an appropriate TVE . This is used primarily when generating
* a node ' s output schema based on its childrens ' schema ; we want to
* carry the columns across but leave any non - TVE expressions behind . */
NodeSchema copyAndReplaceWithTVE ( ) { } }
|
NodeSchema copy = new NodeSchema ( ) ; int colIndex = 0 ; for ( SchemaColumn column : m_columns ) { copy . addColumn ( column . copyAndReplaceWithTVE ( colIndex ) ) ; ++ colIndex ; } return copy ;
|
public class Aliases { /** * Get the { @ link Alias } instance for the given
* alias name .
* @ param aliasName The name of the alias for which will be
* searched .
* @ return The instance of the Alias or null if not found . */
public Alias getAlias ( String aliasName ) { } }
|
Alias result = null ; for ( Alias item : getAliasesList ( ) ) { if ( item . getName ( ) . equals ( aliasName ) ) { result = item ; } } return result ;
|
public class InMemoryJarfile { /** * Remove the provided classname and all inner classes from the jarfile and the classloader */
public void removeClassFromJar ( String classname ) { } }
|
for ( String innerclass : getLoader ( ) . getInnerClassesForClass ( classname ) ) { remove ( classToFileName ( innerclass ) ) ; } remove ( classToFileName ( classname ) ) ;
|
public class CmsContextMenuHandler { /** * Creates a single context menu entry from a context menu entry bean . < p >
* @ param bean the menu entry bean
* @ param structureId the structure id
* @ return the context menu for the given entry */
protected I_CmsContextMenuEntry transformSingleEntry ( CmsContextMenuEntryBean bean , CmsUUID structureId ) { } }
|
String name = bean . getName ( ) ; I_CmsContextMenuCommand command = null ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( name ) ) { command = getContextMenuCommands ( ) . get ( name ) ; } if ( command instanceof I_CmsValidatingContextMenuCommand ) { boolean ok = ( ( I_CmsValidatingContextMenuCommand ) command ) . validate ( bean ) ; if ( ! ok ) { return null ; } } CmsContextMenuEntry entry = new CmsContextMenuEntry ( this , structureId , command ) ; entry . setBean ( bean ) ; if ( bean . hasSubMenu ( ) ) { entry . setSubMenu ( transformEntries ( bean . getSubMenu ( ) , structureId ) ) ; } return entry ;
|
public class RSAUtils { /** * Sign a message with RSA private key , using { @ link # DEFAULT _ SIGNATURE _ ALGORITHM } .
* @ param key
* @ param message
* @ return the signature
* @ throws InvalidKeyException
* @ throws NoSuchAlgorithmException
* @ throws SignatureException */
public static byte [ ] signMessage ( RSAPrivateKey key , byte [ ] message ) throws InvalidKeyException , NoSuchAlgorithmException , SignatureException { } }
|
return signMessage ( key , message , DEFAULT_SIGNATURE_ALGORITHM ) ;
|
public class MethodUtils { /** * Invokes method which name equals given method name and parameter types
* equals given parameter types on the given source with the given
* parameters .
* @ param source
* the object which you want to handle .
* @ param methodName
* the name of the method which you want to call .
* @ param parameterTypes
* the parameter types of the method which you want to call .
* @ param parameterValues
* the parameter values of the method which you want to call .
* @ return an object which is invoked method returns .
* @ throws MethodException */
public static Object invoke ( Object source , String methodName , Class < ? > [ ] parameterTypes , Object [ ] parameterValues ) throws MethodException { } }
|
Class < ? extends Object > clazz = source . getClass ( ) ; Method method ; if ( ArrayUtils . isEmpty ( parameterTypes ) ) { method = findMethod ( clazz , methodName , EMPTY_PARAMETER_CLASSTYPES ) ; return invoke ( source , method , EMPTY_PARAMETER_VALUES ) ; } method = findMethod ( clazz , methodName , parameterTypes ) ; return invoke ( source , method , parameterValues ) ;
|
public class JMFiles { /** * Append line writer .
* @ param writer the writer
* @ param line the line
* @ return the writer */
public static Writer appendLine ( Writer writer , String line ) { } }
|
return append ( writer , line + JMString . LINE_SEPARATOR ) ;
|
public class URITemplate { /** * Returns an immutable set of variable names contained in the expressions
* of this URI Template .
* @ return the set of variables names in this template */
public Set < String > getVariableNames ( ) { } }
|
final ImmutableSet . Builder < String > sb = ImmutableSet . builder ( ) ; for ( final Expression expr : expressions ) for ( final Variable var : expr . getVariables ( ) ) sb . add ( var . getName ( ) ) ; return sb . build ( ) ;
|
public class Entry { /** * Returns a newly - created { @ link Entry } .
* @ param revision the revision of the { @ link Entry }
* @ param path the path of the { @ link Entry }
* @ param content the content of the { @ link Entry }
* @ param type the type of the { @ link Entry }
* @ param < T > the content type . { @ link JsonNode } if JSON . { @ link String } if text . */
public static < T > Entry < T > of ( Revision revision , String path , EntryType type , @ Nullable T content ) { } }
|
return new Entry < > ( revision , path , type , content ) ;
|
public class HessenbergSimilarDecomposition_ZDRM { /** * Internal function for computing the decomposition . */
private boolean _decompose ( ) { } }
|
double h [ ] = QH . data ; for ( int k = 0 ; k < N - 2 ; k ++ ) { // k = column
u [ k * 2 ] = 0 ; u [ k * 2 + 1 ] = 0 ; double max = QrHelperFunctions_ZDRM . extractColumnAndMax ( QH , k + 1 , N , k , u , 0 ) ; if ( max > 0 ) { // - - - - - set up the reflector Q _ k
double gamma = QrHelperFunctions_ZDRM . computeTauGammaAndDivide ( k + 1 , N , u , max , tau ) ; gammas [ k ] = gamma ; // divide u by u _ 0
double real_u_0 = u [ ( k + 1 ) * 2 ] + tau . real ; double imag_u_0 = u [ ( k + 1 ) * 2 + 1 ] + tau . imaginary ; QrHelperFunctions_ZDRM . divideElements ( k + 2 , N , u , 0 , real_u_0 , imag_u_0 ) ; // write the reflector into the lower left column of the matrix
for ( int i = k + 2 ; i < N ; i ++ ) { h [ ( i * N + k ) * 2 ] = u [ i * 2 ] ; h [ ( i * N + k ) * 2 + 1 ] = u [ i * 2 + 1 ] ; } u [ ( k + 1 ) * 2 ] = 1 ; u [ ( k + 1 ) * 2 + 1 ] = 0 ; // - - - - - multiply on the left by Q _ k
QrHelperFunctions_ZDRM . rank1UpdateMultR ( QH , u , 0 , gamma , k + 1 , k + 1 , N , b ) ; // - - - - - multiply on the right by Q _ k
QrHelperFunctions_ZDRM . rank1UpdateMultL ( QH , u , 0 , gamma , 0 , k + 1 , N ) ; // since the first element in the householder vector is known to be 1
// store the full upper hessenberg
h [ ( ( k + 1 ) * N + k ) * 2 ] = - tau . real * max ; h [ ( ( k + 1 ) * N + k ) * 2 + 1 ] = - tau . imaginary * max ; } else { gammas [ k ] = 0 ; } } return true ;
|
public class ProjectionJavaScriptBuilder { /** * Adds another type to select .
* @ param eventType
* Unique event type to select from the category of streams .
* @ return this . */
public final ProjectionJavaScriptBuilder type ( final String eventType ) { } }
|
if ( count > 0 ) { sb . append ( "," ) ; } sb . append ( "'" + eventType + "': function(state, ev) { linkTo('" + projection + "', ev); }" ) ; count ++ ; return this ;
|
public class PhoneNumberUtil { /** * get suggestions .
* @ param psearch search string
* @ param plimit limit entries
* @ return list of phone number data */
public final List < PhoneNumberData > getSuggstions ( final String psearch , final int plimit ) { } }
|
return this . getSuggstions ( psearch , plimit , Locale . ROOT ) ;
|
public class BeanMappingConfigRespository { /** * 直接注册一个解析号的 { @ linkplain BeanMappingObject } */
public void register ( BeanMappingObject object ) { } }
|
BeanMappingObject old = null ; String name = null ; if ( object != null ) { if ( StringUtils . isEmpty ( object . getName ( ) ) ) { name = mapperObjectName ( object . getSrcClass ( ) , object . getTargetClass ( ) ) ; } else { name = object . getName ( ) ; } old = mappings . put ( name , object ) ; } if ( old != null ) { logger . warn ( "{} has been replaced by : {}" , name , object . toString ( ) ) ; }
|
public class IntStream { /** * Returns an { @ code IntStream } with elements that satisfy the given { @ code IndexedIntPredicate } .
* < p > This is an intermediate operation .
* < p > Example :
* < pre >
* from : 4
* step : 3
* predicate : ( index , value ) - & gt ; ( index + value ) & gt ; 15
* stream : [ 1 , 2 , 3 , 4 , 0 , 11]
* index : [ 4 , 7 , 10 , 13 , 16 , 19]
* sum : [ 5 , 9 , 13 , 17 , 16 , 30]
* filter : [ 17 , 16 , 30]
* result : [ 4 , 0 , 11]
* < / pre >
* @ param from the initial value of the index ( inclusive )
* @ param step the step of the index
* @ param predicate the { @ code IndexedIntPredicate } used to filter elements
* @ return the new stream
* @ since 1.2.1 */
@ NotNull public IntStream filterIndexed ( int from , int step , @ NotNull IndexedIntPredicate predicate ) { } }
|
return new IntStream ( params , new IntFilterIndexed ( new PrimitiveIndexedIterator . OfInt ( from , step , iterator ) , predicate ) ) ;
|
public class Path3d { /** * Replies if the given points exists in the coordinates of this path .
* @ param p
* @ return < code > true < / code > if the point is a control point of the path . */
@ Pure boolean containsControlPoint ( Point3D p ) { } }
|
double x , y , z ; for ( int i = 0 ; i < this . numCoordsProperty . get ( ) ; ) { x = this . coordsProperty [ i ++ ] . get ( ) ; y = this . coordsProperty [ i ++ ] . get ( ) ; z = this . coordsProperty [ i ++ ] . get ( ) ; if ( x == p . getX ( ) && y == p . getY ( ) && z == p . getZ ( ) ) { return true ; } } return false ;
|
public class ConfigBootstrapper { /** * Helper method for mappers and connectors classes instantiation
* @ param className name of class to create instance
* @ return given class by name instance
* @ throws ClassNotFoundException on given class not found
* @ throws NoSuchMethodException if default constructor not found in given class
* @ throws IllegalAccessException if default constructor in given class has non - public access
* @ throws InvocationTargetException if given class constructor throws an exception
* @ throws InstantiationException on given class instantiation fail */
private static Object createInstance ( String className ) throws ClassNotFoundException , NoSuchMethodException , IllegalAccessException , InvocationTargetException , InstantiationException { } }
|
Class < ? > clazz = Class . forName ( className ) ; Constructor < ? > constructor = clazz . getConstructor ( ) ; return constructor . newInstance ( ) ;
|
public class AbstractXARMojo { /** * This method resolves all transitive dependencies of an artifact .
* @ param artifact the artifact used to retrieve dependencies
* @ return resolved set of dependencies
* @ throws ArtifactResolutionException error
* @ throws ArtifactNotFoundException error
* @ throws ProjectBuildingException error
* @ throws InvalidDependencyVersionException error */
protected Set < Artifact > resolveArtifactDependencies ( Artifact artifact ) throws ArtifactResolutionException , ArtifactNotFoundException , ProjectBuildingException { } }
|
Artifact pomArtifact = this . factory . createArtifact ( artifact . getGroupId ( ) , artifact . getArtifactId ( ) , artifact . getVersion ( ) , "" , "pom" ) ; MavenProject pomProject = this . mavenProjectBuilder . buildFromRepository ( pomArtifact , this . remoteRepos , this . local ) ; return resolveDependencyArtifacts ( pomProject ) ;
|
public class IdempotentPostRequest { /** * Executes this request .
* Returns the response entity .
* @ throws com . gocardless . GoCardlessException */
@ Override public T execute ( ) { } }
|
try { return getHttpClient ( ) . executeWithRetries ( this ) ; } catch ( InvalidStateException e ) { Optional < ApiError > conflictError = Iterables . tryFind ( e . getErrors ( ) , CONFLICT_ERROR ) ; if ( conflictError . isPresent ( ) ) { String id = conflictError . get ( ) . getLinks ( ) . get ( "conflicting_resource_id" ) ; return handleConflict ( getHttpClient ( ) , id ) . execute ( ) ; } else { throw Throwables . propagate ( e ) ; } }
|
public class NormalizationTransform { /** * { @ inheritDoc } */
@ Override public void update ( List < Metric > metrics ) { } }
|
Preconditions . checkNotNull ( metrics , "metrics" ) ; final List < Metric > newMetrics = new ArrayList < > ( metrics . size ( ) ) ; for ( Metric m : metrics ) { long offset = m . getTimestamp ( ) % stepMillis ; long stepBoundary = m . getTimestamp ( ) - offset ; String dsType = getDataSourceType ( m ) ; if ( isGauge ( dsType ) || isNormalized ( dsType ) ) { Metric atStepBoundary = new Metric ( m . getConfig ( ) , stepBoundary , m . getValue ( ) ) ; newMetrics . add ( atStepBoundary ) ; // gauges are not normalized
} else if ( isRate ( dsType ) ) { Metric normalized = normalize ( m , stepBoundary ) ; if ( normalized != null ) { newMetrics . add ( normalized ) ; } } else if ( ! isInformational ( dsType ) ) { // unknown type - use a safe fallback
newMetrics . add ( m ) ; // we cannot normalize this
} } observer . update ( newMetrics ) ;
|
public class ContentSpecProcessor { /** * Checks to see if a node is a node that can be transformed and saved ,
* @ param childNode The node to be checked .
* @ return True if the node can be transformed , otherwise false . */
protected boolean isTransformableNode ( final Node childNode ) { } }
|
if ( childNode instanceof KeyValueNode ) { return ! IGNORE_META_DATA . contains ( ( ( KeyValueNode ) childNode ) . getKey ( ) ) ; } else { return childNode instanceof SpecNode || childNode instanceof Comment || childNode instanceof Level || childNode instanceof File ; }
|
public class ExampleUtils { /** * Sets up the Google Cloud Pub / Sub topic .
* < p > If the topic doesn ' t exist , a new topic with the given name will be created .
* @ throws IOException if there is a problem setting up the Pub / Sub topic */
public void setupPubsub ( ) throws IOException { } }
|
ExamplePubsubTopicAndSubscriptionOptions pubsubOptions = options . as ( ExamplePubsubTopicAndSubscriptionOptions . class ) ; if ( ! pubsubOptions . getPubsubTopic ( ) . isEmpty ( ) ) { pendingMessages . add ( "**********************Set Up Pubsub************************" ) ; setupPubsubTopic ( pubsubOptions . getPubsubTopic ( ) ) ; pendingMessages . add ( "The Pub/Sub topic has been set up for this example: " + pubsubOptions . getPubsubTopic ( ) ) ; if ( ! pubsubOptions . getPubsubSubscription ( ) . isEmpty ( ) ) { setupPubsubSubscription ( pubsubOptions . getPubsubTopic ( ) , pubsubOptions . getPubsubSubscription ( ) ) ; pendingMessages . add ( "The Pub/Sub subscription has been set up for this example: " + pubsubOptions . getPubsubSubscription ( ) ) ; } }
|
public class URLCanonicalizer { /** * Takes a query string , separates the constituent name - value pairs , and
* stores them in a LinkedHashMap ordered by their original order .
* @ return Null if there is no query string . */
private static Map < String , String > createParameterMap ( String queryString ) { } }
|
if ( ( queryString == null ) || queryString . isEmpty ( ) ) { return null ; } final String [ ] pairs = queryString . split ( "&" ) ; final Map < String , String > params = new LinkedHashMap < > ( pairs . length ) ; for ( final String pair : pairs ) { if ( pair . isEmpty ( ) ) { continue ; } String [ ] tokens = pair . split ( "=" , 2 ) ; switch ( tokens . length ) { case 1 : if ( pair . charAt ( 0 ) == '=' ) { params . put ( "" , tokens [ 0 ] ) ; } else { params . put ( tokens [ 0 ] , "" ) ; } break ; case 2 : params . put ( tokens [ 0 ] , tokens [ 1 ] ) ; break ; } } return new LinkedHashMap < > ( params ) ;
|
public class AppServiceCertificateOrdersInner { /** * List all certificates associated with a certificate order .
* List all certificates associated with a certificate order .
* ServiceResponse < PageImpl < AppServiceCertificateResourceInner > > * @ param resourceGroupName Name of the resource group to which the resource belongs .
* ServiceResponse < PageImpl < AppServiceCertificateResourceInner > > * @ param certificateOrderName Name of the certificate order .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the PagedList & lt ; AppServiceCertificateResourceInner & gt ; object wrapped in { @ link ServiceResponse } if successful . */
public Observable < ServiceResponse < Page < AppServiceCertificateResourceInner > > > listCertificatesSinglePageAsync ( final String resourceGroupName , final String certificateOrderName ) { } }
|
if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( certificateOrderName == null ) { throw new IllegalArgumentException ( "Parameter certificateOrderName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } return service . listCertificates ( resourceGroupName , certificateOrderName , this . client . subscriptionId ( ) , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Page < AppServiceCertificateResourceInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < AppServiceCertificateResourceInner > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < PageImpl < AppServiceCertificateResourceInner > > result = listCertificatesDelegate ( response ) ; return Observable . just ( new ServiceResponse < Page < AppServiceCertificateResourceInner > > ( result . body ( ) , result . response ( ) ) ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
|
public class RepeaterExampleWithEditableRows { /** * Write the list of contacts into the textarea console . Any modified phone numbers should be printed out . */
private void printEditedDetails ( ) { } }
|
StringBuilder buf = new StringBuilder ( ) ; for ( Object contact : repeater . getBeanList ( ) ) { buf . append ( contact ) . append ( '\n' ) ; } console . setText ( buf . toString ( ) ) ;
|
public class DeviceManager { /** * Immediately cancel any pending Bluetooth operations .
* The BluetoothSocket . connect ( ) function blocks while waiting for a
* connection , but it ' s thread safe and we can cancel that by calling
* close ( ) on it at any time .
* Importantly we don ' t want to close the socket any other time , because we
* want to leave that up to the user of the socket - if you call close ( )
* twice , or close Input / Output streams associated with the socket
* simultaneously , it can cause a segfault due to a bug in some Android
* Bluetooth stacks . Awesome ! */
public void stop ( ) { } }
|
if ( mSocketConnecting . get ( ) && mSocket != null ) { try { mSocket . close ( ) ; } catch ( IOException e ) { } } if ( mSocketConnecting . get ( ) && mBluetoothGatt != null ) { mBluetoothGatt . close ( ) ; } if ( getDefaultAdapter ( ) != null ) { getDefaultAdapter ( ) . cancelDiscovery ( ) ; }
|
public class PresentationManager { /** * Return the session for the given id
* @ param sessionId The id of the wanted session
* @ return The session */
public PMSession getSession ( String sessionId ) { } }
|
final PMSession s = sessions . get ( sessionId ) ; if ( s != null ) { s . setLastAccess ( new Date ( ) ) ; } return s ;
|
public class ObjectPlusFilesOutputStream { /** * Create a backup of this given file , first by trying a " hard
* link " , then by using a copy if hard linking is unavailable
* ( either because it is unsupported or the origin and checkpoint
* directories are on different volumes ) .
* @ param file
* @ param destination
* @ throws IOException */
private void hardlinkOrCopy ( File file , File destination ) throws IOException { } }
|
// For Linux / UNIX , try a hard link first .
Process link = Runtime . getRuntime ( ) . exec ( "ln " + file . getAbsolutePath ( ) + " " + destination . getAbsolutePath ( ) ) ; // TODO NTFS also supports hard links ; add appropriate try
try { link . waitFor ( ) ; } catch ( InterruptedException e ) { // TODO Auto - generated catch block
e . printStackTrace ( ) ; } if ( link . exitValue ( ) != 0 ) { // hard link failed
FileUtils . copyFile ( file , destination ) ; }
|
public class FileSender { /** * Sends a file on the output port .
* @ param file The file to send .
* @ param doneHandler An asynchronous handler to be called once the file has been sent .
* @ return The file sender . */
public FileSender sendFile ( final AsyncFile file , final Handler < AsyncResult < Void > > doneHandler ) { } }
|
output . group ( "file" , "file" , new Handler < OutputGroup > ( ) { @ Override public void handle ( OutputGroup group ) { doSendFile ( file , group , doneHandler ) ; } } ) ; return this ;
|
public class SimpleCheckBoxControl { /** * This method creates node and adds them to checkboxes and is
* used when the itemsProperty on the field changes . */
private void createCheckboxes ( ) { } }
|
node . getChildren ( ) . clear ( ) ; checkboxes . clear ( ) ; for ( int i = 0 ; i < field . getItems ( ) . size ( ) ; i ++ ) { CheckBox cb = new CheckBox ( ) ; cb . setText ( field . getItems ( ) . get ( i ) . toString ( ) ) ; cb . setSelected ( field . getSelection ( ) . contains ( field . getItems ( ) . get ( i ) ) ) ; checkboxes . add ( cb ) ; } node . getChildren ( ) . addAll ( checkboxes ) ;
|
public class ParameterSerializer { /** * Serialize collection of array to a SFSArray
* @ param method structure of getter method
* @ param collection collection of objects
* @ return the SFSArray */
@ SuppressWarnings ( "rawtypes" ) protected ISFSArray parseArrayCollection ( GetterMethodCover method , Collection collection ) { } }
|
ISFSArray result = new SFSArray ( ) ; SFSDataType dataType = ParamTypeParser . getParamType ( method . getGenericType ( ) ) ; Class < ? > type = method . getGenericType ( ) . getComponentType ( ) ; for ( Object obj : collection ) { Object value = obj ; if ( isPrimitiveChar ( type ) ) { value = charArrayToByteArray ( ( char [ ] ) value ) ; } else if ( isWrapperByte ( type ) ) { value = toPrimitiveByteArray ( ( Byte [ ] ) value ) ; } else if ( isWrapperChar ( type ) ) { value = charWrapperArrayToPrimitiveByteArray ( ( Character [ ] ) value ) ; } else { value = arrayToList ( value ) ; } result . add ( new SFSDataWrapper ( dataType , value ) ) ; } return result ;
|
public class BaseRemoteProxy { /** * Takes a registration request and return the RemoteProxy associated to it . It can be any class
* extending RemoteProxy .
* @ param request The request
* @ param registry The registry to use
* @ param < T > RemoteProxy subclass
* @ return a new instance built from the request . */
@ SuppressWarnings ( "unchecked" ) public static < T extends RemoteProxy > T getNewInstance ( RegistrationRequest request , GridRegistry registry ) { } }
|
try { String proxyClass = request . getConfiguration ( ) . proxy ; if ( proxyClass == null ) { log . fine ( "No proxy class. Using default" ) ; proxyClass = BaseRemoteProxy . class . getCanonicalName ( ) ; } Class < ? > clazz = Class . forName ( proxyClass ) ; log . fine ( "Using class " + clazz . getName ( ) ) ; Object [ ] args = new Object [ ] { request , registry } ; Class < ? > [ ] argsClass = new Class [ ] { RegistrationRequest . class , GridRegistry . class } ; Constructor < ? > c = clazz . getConstructor ( argsClass ) ; Object proxy = c . newInstance ( args ) ; if ( proxy instanceof RemoteProxy ) { ( ( RemoteProxy ) proxy ) . setupTimeoutListener ( ) ; return ( T ) proxy ; } throw new InvalidParameterException ( "Error: " + proxy . getClass ( ) + " isn't a remote proxy" ) ; } catch ( InvocationTargetException e ) { throw new InvalidParameterException ( "Error: " + e . getTargetException ( ) . getMessage ( ) ) ; } catch ( Exception e ) { throw new InvalidParameterException ( "Error: " + e . getMessage ( ) ) ; }
|
public class Aws4HashCalculator { /** * Computes the authentication hash as specified by the AWS SDK for verification purposes .
* @ param ctx the current request to fetch parameters from
* @ param pathPrefix the path prefix to preped to the { @ link S3Dispatcher # getEffectiveURI ( WebContext ) effective URI }
* of the request
* @ return the computes hash value
* @ throws Exception when hashing fails */
public String computeHash ( WebContext ctx , String pathPrefix ) throws Exception { } }
|
Matcher matcher = AWS_AUTH4_PATTERN . matcher ( ctx . getHeaderValue ( "Authorization" ) . asString ( "" ) ) ; if ( ! matcher . matches ( ) ) { // If the header doesn ' t match , let ' s try an URL parameter as we might be processing a presigned URL
matcher = X_AMZ_CREDENTIAL_PATTERN . matcher ( ctx . get ( "X-Amz-Credential" ) . asString ( "" ) ) ; if ( ! matcher . matches ( ) ) { throw new IllegalArgumentException ( "Unknown AWS4 auth pattern" ) ; } } String date = matcher . group ( 2 ) ; String region = matcher . group ( 3 ) ; String service = matcher . group ( 4 ) ; String serviceType = matcher . group ( 5 ) ; // For header based requests , the signed headers are in the " Credentials " header , for presigned URLs
// an extra parameter is given . . .
String signedHeaders = matcher . groupCount ( ) == 7 ? matcher . group ( 6 ) : ctx . get ( "X-Amz-SignedHeaders" ) . asString ( ) ; byte [ ] dateKey = hmacSHA256 ( ( "AWS4" + storage . getAwsSecretKey ( ) ) . getBytes ( Charsets . UTF_8 ) , date ) ; byte [ ] dateRegionKey = hmacSHA256 ( dateKey , region ) ; byte [ ] dateRegionServiceKey = hmacSHA256 ( dateRegionKey , service ) ; byte [ ] signingKey = hmacSHA256 ( dateRegionServiceKey , serviceType ) ; byte [ ] signedData = hmacSHA256 ( signingKey , buildStringToSign ( ctx , signedHeaders , region , service , serviceType ) ) ; return BaseEncoding . base16 ( ) . lowerCase ( ) . encode ( signedData ) ;
|
public class InventoryDeletionSummary { /** * A list of counts and versions for deleted items .
* @ param summaryItems
* A list of counts and versions for deleted items . */
public void setSummaryItems ( java . util . Collection < InventoryDeletionSummaryItem > summaryItems ) { } }
|
if ( summaryItems == null ) { this . summaryItems = null ; return ; } this . summaryItems = new com . amazonaws . internal . SdkInternalList < InventoryDeletionSummaryItem > ( summaryItems ) ;
|
public class AddOnLoader { /** * Check local jar ( zap . jar ) or related package if any target file is found .
* @ param packageName the package name that the class must belong too
* @ return a { @ code List } with all the classes belonging to the given package */
private List < ClassNameWrapper > getLocalClassNames ( String packageName ) { } }
|
if ( packageName == null || packageName . equals ( "" ) ) { return Collections . emptyList ( ) ; } String folder = packageName . replace ( '.' , '/' ) ; URL local = AddOnLoader . class . getClassLoader ( ) . getResource ( folder ) ; if ( local == null ) { return Collections . emptyList ( ) ; } String jarFile = null ; if ( local . getProtocol ( ) . equals ( "jar" ) ) { jarFile = local . toString ( ) . substring ( "jar:" . length ( ) ) ; int pos = jarFile . indexOf ( "!" ) ; jarFile = jarFile . substring ( 0 , pos ) ; try { // ZAP : Changed to take into account the package name
return getJarClassNames ( this . getClass ( ) . getClassLoader ( ) , new File ( new URI ( jarFile ) ) , packageName ) ; } catch ( URISyntaxException e ) { logger . error ( e . getMessage ( ) , e ) ; } } else { try { // ZAP : Changed to pass a FileFilter ( ClassRecurseDirFileFilter )
// and to pass the " packageName " with the dots already replaced .
return parseClassDir ( this . getClass ( ) . getClassLoader ( ) , new File ( new URI ( local . toString ( ) ) ) , packageName . replace ( '.' , File . separatorChar ) , new ClassRecurseDirFileFilter ( true ) ) ; } catch ( URISyntaxException e ) { logger . error ( e . getMessage ( ) , e ) ; } } return Collections . emptyList ( ) ;
|
public class Timex2Time { /** * Returns a copy of this Timex which is the same except with the anchor attributes set as
* specified .
* @ deprecated Use { @ link # copyBuilder ( ) } and { @ link Builder # withAnchorValue ( Symbol ) } and { @ link
* Builder # withAnchorDirection ( Symbol ) } instead */
@ Deprecated public Timex2Time anchoredCopy ( final Symbol anchorVal , final Symbol anchorDir ) { } }
|
checkNotNull ( anchorDir ) ; AnchorDirection anchorDirEnum = AnchorDirection . valueOf ( anchorDir . asString ( ) ) ; return new Timex2Time ( val , mod , set , granularity , periodicity , checkNotNull ( anchorVal ) , anchorDirEnum , nonSpecific ) ;
|
public class FunctionEnvironmentReloadRequestHandler { /** * This is a helper utility specifically to reload environment variables if java
* language worker is started in standby mode by the functions runtime and
* should not be used for other purposes */
public void setEnv ( Map < String , String > newSettings ) throws Exception { } }
|
if ( newSettings == null || newSettings . isEmpty ( ) ) { return ; } // Update Environment variables in the JVM
try { Class < ? > processEnvironmentClass = Class . forName ( "java.lang.ProcessEnvironment" ) ; Field theEnvironmentField = processEnvironmentClass . getDeclaredField ( "theEnvironment" ) ; theEnvironmentField . setAccessible ( true ) ; Map < String , String > env = ( Map < String , String > ) theEnvironmentField . get ( null ) ; env . clear ( ) ; env . putAll ( newSettings ) ; Field theCaseInsensitiveEnvironmentField = processEnvironmentClass . getDeclaredField ( "theCaseInsensitiveEnvironment" ) ; theCaseInsensitiveEnvironmentField . setAccessible ( true ) ; Map < String , String > cienv = ( Map < String , String > ) theCaseInsensitiveEnvironmentField . get ( null ) ; cienv . clear ( ) ; cienv . putAll ( newSettings ) ; WorkerLogManager . getSystemLogger ( ) . log ( Level . INFO , "Finished resetting environment variables in the JVM" ) ; } catch ( NoSuchFieldException e ) { Class [ ] classes = Collections . class . getDeclaredClasses ( ) ; Map < String , String > env = System . getenv ( ) ; for ( Class cl : classes ) { if ( "java.util.Collections$UnmodifiableMap" . equals ( cl . getName ( ) ) ) { Field field = cl . getDeclaredField ( "m" ) ; field . setAccessible ( true ) ; Object obj = field . get ( env ) ; Map < String , String > map = ( Map < String , String > ) obj ; map . clear ( ) ; map . putAll ( newSettings ) ; } } }
|
public class JSONSerializer { /** * Translate the ResponseWrapper into the wireline string . See { @ link ResponseWrapper }
* @ param response the instance of the ResponseWrapper
* @ return the wireline string */
public String marshal ( ResponseWrapper response ) { } }
|
Gson gson = new Gson ( ) ; Response jsonResponse = composeResponseFromResponseWrapper ( response ) ; String jsonString = gson . toJson ( jsonResponse ) ; return jsonString ;
|
public class Resolve { /** * Resolve ` c . this ' for an enclosing class c that contains the
* named member .
* @ param pos The position to use for error reporting .
* @ param env The environment current at the expression .
* @ param member The member that must be contained in the result . */
Symbol resolveSelfContaining ( DiagnosticPosition pos , Env < AttrContext > env , Symbol member , boolean isSuperCall ) { } }
|
Symbol sym = resolveSelfContainingInternal ( env , member , isSuperCall ) ; if ( sym == null ) { log . error ( pos , "encl.class.required" , member ) ; return syms . errSymbol ; } else { return accessBase ( sym , pos , env . enclClass . sym . type , sym . name , true ) ; }
|
public class App { /** * Adds a new setting to the map .
* @ param name a key
* @ param value a value
* @ return this */
public App addSetting ( String name , Object value ) { } }
|
if ( ! StringUtils . isBlank ( name ) && value != null ) { getSettings ( ) . put ( name , value ) ; for ( AppSettingAddedListener listener : ADD_SETTING_LISTENERS ) { listener . onSettingAdded ( this , name , value ) ; logger . debug ( "Executed {}.onSettingAdded()." , listener . getClass ( ) . getName ( ) ) ; } } return this ;
|
public class Chord { /** * Draws this chord .
* @ param context */
@ Override protected boolean prepare ( final Context2D context , final Attributes attr , final double alpha ) { } }
|
final double r = attr . getRadius ( ) ; final double beg = attr . getStartAngle ( ) ; final double end = attr . getEndAngle ( ) ; if ( r > 0 ) { context . beginPath ( ) ; if ( beg == end ) { context . arc ( 0 , 0 , r , 0 , Math . PI * 2 , true ) ; } else { context . arc ( 0 , 0 , r , beg , end , attr . isCounterClockwise ( ) ) ; } context . closePath ( ) ; return true ; } return false ;
|
public class DrawSymbol { /** * { @ inheritDoc } */
@ Override public Dimension getPreferredSize ( ) { } }
|
int w = OkapiUI . symbol . getWidth ( ) * OkapiUI . factor ; int h = OkapiUI . symbol . getHeight ( ) * OkapiUI . factor ; return new Dimension ( w , h ) ;
|
public class AipImageSearch { /** * 商品检索 — 删除接口
* * * 删除图库中的图片 , 支持批量删除 , 批量删除时请传cont _ sign参数 , 勿传image , 最多支持1000个cont _ sign * *
* @ param url - 图片完整URL , URL长度不超过1024字节 , URL对应的图片base64编码后大小不超过4M , 最短边至少15px , 最长边最大4096px , 支持jpg / png / bmp格式 , 当image字段存在时url字段失效
* @ param options - 可选参数对象 , key : value都为string类型
* options - options列表 :
* @ return JSONObject */
public JSONObject productDeleteByUrl ( String url , HashMap < String , String > options ) { } }
|
AipRequest request = new AipRequest ( ) ; preOperation ( request ) ; request . addBody ( "url" , url ) ; if ( options != null ) { request . addBody ( options ) ; } request . setUri ( ImageSearchConsts . PRODUCT_DELETE ) ; postOperation ( request ) ; return requestServer ( request ) ;
|
public class AbstractHCScriptInline { /** * Set the masking mode .
* @ param eMode
* The mode to use . MAy not be < code > null < / code > .
* @ return this */
@ Nonnull public final IMPLTYPE setMode ( @ Nonnull final EHCScriptInlineMode eMode ) { } }
|
m_eScriptMode = ValueEnforcer . notNull ( eMode , "Mode" ) ; return thisAsT ( ) ;
|
public class ContextChecker { /** * Checks whether the node is correctly connected to its input . */
@ Override public boolean preVisit ( Operator < ? > node ) { } }
|
// check if node was already visited
if ( ! this . visitedNodes . add ( node ) ) { return false ; } // apply the appropriate check method
if ( node instanceof FileDataSinkBase ) { checkFileDataSink ( ( FileDataSinkBase < ? > ) node ) ; } else if ( node instanceof FileDataSourceBase ) { checkFileDataSource ( ( FileDataSourceBase < ? > ) node ) ; } else if ( node instanceof GenericDataSinkBase ) { checkDataSink ( ( GenericDataSinkBase < ? > ) node ) ; } else if ( node instanceof BulkIterationBase ) { checkBulkIteration ( ( BulkIterationBase < ? > ) node ) ; } else if ( node instanceof SingleInputOperator ) { checkSingleInputContract ( ( SingleInputOperator < ? , ? , ? > ) node ) ; } else if ( node instanceof DualInputOperator < ? , ? , ? , ? > ) { checkDualInputContract ( ( DualInputOperator < ? , ? , ? , ? > ) node ) ; } if ( node instanceof Validatable ) { ( ( Validatable ) node ) . check ( ) ; } return true ;
|
public class AbstractFunctionalTermImpl { /** * Check whether the function contains a particular term argument or not .
* @ param t the term in question .
* @ return true if the function contains the term , or false otherwise . */
@ Override public boolean containsTerm ( Term t ) { } }
|
List < Term > terms = getTerms ( ) ; for ( int i = 0 ; i < terms . size ( ) ; i ++ ) { Term t2 = terms . get ( i ) ; if ( t2 . equals ( t ) ) return true ; } return false ;
|
public class CmsPublishService { /** * Retrieves the publish options . < p >
* @ return the publish options last used
* @ throws CmsRpcException if something goes wrong */
public CmsPublishOptions getResourceOptions ( ) throws CmsRpcException { } }
|
CmsPublishOptions result = null ; try { result = getCachedOptions ( ) ; } catch ( Throwable e ) { error ( e ) ; } return result ;
|
public class CheckArg { /** * Check that the argument is less than or equal to the supplied value
* @ param argument The argument
* @ param lessThanOrEqualToValue the value that is to be used to check the value
* @ param name The name of the argument
* @ throws IllegalArgumentException If argument is not less than or equal to the supplied value */
public static void isLessThanOrEqualTo ( int argument , int lessThanOrEqualToValue , String name ) { } }
|
if ( argument > lessThanOrEqualToValue ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBeLessThanOrEqualTo . text ( name , argument , lessThanOrEqualToValue ) ) ; }
|
public class Norm2AllModes { /** * For use in properties APIs . */
public static Normalizer2WithImpl getN2WithImpl ( int index ) { } }
|
switch ( index ) { case 0 : return getNFCInstance ( ) . decomp ; // NFD
case 1 : return getNFKCInstance ( ) . decomp ; // NFKD
case 2 : return getNFCInstance ( ) . comp ; // NFC
case 3 : return getNFKCInstance ( ) . comp ; // NFKC
default : return null ; }
|
public class PaymentSettingsUrl { /** * Get Resource Url for DeleteThirdPartyPaymentWorkflow
* @ param fullyQualifiedName Fully qualified name of the attribute for the third - party payment workflow .
* @ return String Resource Url */
public static MozuUrl deleteThirdPartyPaymentWorkflowUrl ( String fullyQualifiedName ) { } }
|
UrlFormatter formatter = new UrlFormatter ( "/api/commerce/settings/checkout/paymentsettings/thirdpartyworkflows/{fullyQualifiedName}" ) ; formatter . formatUrl ( "fullyQualifiedName" , fullyQualifiedName ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ;
|
public class DefaultEntryEventFilteringStrategy { /** * Evaluate if the filter matches the map event . In case of a remove , evict or expire event
* the old value will be used for evaluation , otherwise we use the new value .
* The filter must be of { @ link QueryEventFilter } type .
* @ param filter a { @ link QueryEventFilter } filter
* @ param eventType the event type
* @ param dataKey the entry key
* @ param oldValue the entry value before the event
* @ param dataValue the entry value after the event
* @ param mapNameOrNull the map name . May be null if this is not a map event ( e . g . cache event )
* @ return { @ code true } if the entry matches the query event filter */
private boolean processQueryEventFilter ( EventFilter filter , EntryEventType eventType , Data dataKey , Object oldValue , Object dataValue , String mapNameOrNull ) { } }
|
Object testValue ; if ( eventType == REMOVED || eventType == EVICTED || eventType == EXPIRED ) { testValue = oldValue ; } else { testValue = dataValue ; } return evaluateQueryEventFilter ( filter , dataKey , testValue , mapNameOrNull ) ;
|
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcRelConnectsStructuralActivity ( ) { } }
|
if ( ifcRelConnectsStructuralActivityEClass == null ) { ifcRelConnectsStructuralActivityEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 461 ) ; } return ifcRelConnectsStructuralActivityEClass ;
|
public class GpsTimeConverter { /** * Convert GPS Time to ISO8601 time string .
* @ param gpsWeekTime the gps time .
* @ return the ISO8601 string of the gps time . */
public static String gpsWeekTime2ISO8601 ( double gpsWeekTime ) { } }
|
DateTime gps2unix = gpsWeekTime2DateTime ( gpsWeekTime ) ; return gps2unix . toString ( ISO8601Formatter ) ;
|
public class GeneratorUtils { /** * / * Defect 213290 */
public static String toJavaSourceType ( String type ) { } }
|
if ( type . charAt ( 0 ) != '[' ) { return type ; } int dims = 1 ; String t = null ; for ( int i = 1 ; i < type . length ( ) ; i ++ ) { if ( type . charAt ( i ) == '[' ) { dims ++ ; } else { switch ( type . charAt ( i ) ) { case 'Z' : t = "boolean" ; break ; case 'B' : t = "byte" ; break ; case 'C' : t = "char" ; break ; case 'D' : t = "double" ; break ; case 'F' : t = "float" ; break ; case 'I' : t = "int" ; break ; case 'J' : t = "long" ; break ; case 'S' : t = "short" ; break ; case 'L' : t = type . substring ( i + 1 , type . indexOf ( ';' ) ) ; break ; default : break ; } break ; } } StringBuffer resultType = new StringBuffer ( t ) ; for ( ; dims > 0 ; dims -- ) { resultType . append ( "[]" ) ; } return resultType . toString ( ) ;
|
public class MultitonKey { /** * Generate unique key by using the method - level annotations .
* @ param object the source object
* @ return the unique key or null if an error occurred or no method annotation was found */
private String generateAggregatedKey ( final Object object ) { } }
|
// Store the aggregated key
final StringBuilder sb = new StringBuilder ( ) ; KeyGenerator methodGenerator ; // Search for method annotation
for ( final Method m : object . getClass ( ) . getMethods ( ) ) { methodGenerator = m . getAnnotation ( KeyGenerator . class ) ; if ( methodGenerator != null ) { Object returnedValue = null ; try { returnedValue = m . invoke ( object ) ; } catch ( IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { LOGGER . log ( METHOD_KEY_GENERATOR_FAILURE , m . getName ( ) , object . getClass ( ) . getSimpleName ( ) , e ) ; } if ( returnedValue == null ) { // returned value is null
LOGGER . log ( NULL_METHOD_KEY , m . getName ( ) , object . getClass ( ) . getSimpleName ( ) ) ; } else { sb . append ( convertMethodKeyObject ( methodGenerator , returnedValue ) ) ; } } } return sb . toString ( ) . isEmpty ( ) ? null : sb . toString ( ) ;
|
public class Database { /** * Executes a block of code with given propagation and isolation . */
public < T > T withTransaction ( @ NotNull Propagation propagation , @ NotNull Isolation isolation , @ NotNull TransactionCallback < T > callback ) { } }
|
TransactionSettings settings = new TransactionSettings ( ) ; settings . setPropagation ( propagation ) ; settings . setIsolation ( isolation ) ; return withTransaction ( settings , callback ) ;
|
public class StandardizeNormalizer { /** * Transform an object
* in to another object
* @ param input the record to transform
* @ return the transformed writable */
@ Override public Object map ( Object input ) { } }
|
Number n = ( Number ) input ; double val = n . doubleValue ( ) ; return new DoubleWritable ( ( val - mean ) / stdev ) ;
|
public class CmsLock { /** * Returns all the locked Resources . < p >
* @ return all the locked Resources */
public List < String > getLockedResources ( ) { } }
|
if ( m_lockedResources == null ) { // collect my locked resources
Set < String > lockedResources = new HashSet < String > ( ) ; Iterator < String > i = getResourceList ( ) . iterator ( ) ; while ( i . hasNext ( ) ) { String resName = i . next ( ) ; try { lockedResources . addAll ( getCms ( ) . getLockedResources ( resName , getNonBlockingFilter ( ) ) ) ; } catch ( CmsException e ) { // error reading a resource , should usually never happen
if ( LOG . isErrorEnabled ( ) ) { LOG . error ( e . getLocalizedMessage ( getLocale ( ) ) , e ) ; } } if ( Boolean . valueOf ( getParamIncluderelated ( ) ) . booleanValue ( ) ) { addLockedRelatedResources ( resName , getNonBlockingFilter ( ) , lockedResources ) ; } } // get blocking resources needs the locked resources
m_lockedResources = new ArrayList < String > ( lockedResources ) ; lockedResources . addAll ( getBlockingLockedResources ( ) ) ; // create the locked resources list again , with the blocking locked resources
m_lockedResources = new ArrayList < String > ( lockedResources ) ; Collections . sort ( m_lockedResources ) ; } return m_lockedResources ;
|
public class MDAG { /** * Adds a String to the MDAG ( called by addString to do actual MDAG manipulation ) .
* @ param str the String to be added to the MDAG */
private void addStringInternal ( String str ) { } }
|
String prefixString = determineLongestPrefixInMDAG ( str ) ; String suffixString = str . substring ( prefixString . length ( ) ) ; // Retrive the data related to the first confluence node ( a node with two or more incoming transitions )
// in the _ transition path from sourceNode corresponding to prefixString .
HashMap < String , Object > firstConfluenceNodeDataHashMap = getTransitionPathFirstConfluenceNodeData ( sourceNode , prefixString ) ; MDAGNode firstConfluenceNodeInPrefix = ( MDAGNode ) firstConfluenceNodeDataHashMap . get ( "confluenceNode" ) ; Integer toFirstConfluenceNodeTransitionCharIndex = ( Integer ) firstConfluenceNodeDataHashMap . get ( "toConfluenceNodeTransitionCharIndex" ) ; // Remove the register entries of all the nodes in the prefixString _ transition path up to the first confluence node
// ( those past the confluence node will not need to be removed since they will be cloned and unaffected by the
// addition of suffixString ) . If there is no confluence node in prefixString , then remove the register entries in prefixString ' s entire _ transition path
removeTransitionPathRegisterEntries ( ( toFirstConfluenceNodeTransitionCharIndex == null ? prefixString : prefixString . substring ( 0 , toFirstConfluenceNodeTransitionCharIndex ) ) ) ; // If there is a confluence node in the prefix , we must duplicate the _ transition path
// of the prefix starting from that node , before we add suffixString ( to the duplicate path ) .
// This ensures that we do not disturb the other _ transition paths containing this node .
if ( firstConfluenceNodeInPrefix != null ) { String transitionStringOfPathToFirstConfluenceNode = prefixString . substring ( 0 , toFirstConfluenceNodeTransitionCharIndex + 1 ) ; String transitionStringOfToBeDuplicatedPath = prefixString . substring ( toFirstConfluenceNodeTransitionCharIndex + 1 ) ; cloneTransitionPath ( firstConfluenceNodeInPrefix , transitionStringOfPathToFirstConfluenceNode , transitionStringOfToBeDuplicatedPath ) ; } // Add the _ transition based on suffixString to the end of the ( possibly duplicated ) _ transition path corresponding to prefixString
addTransitionPath ( sourceNode . transition ( prefixString ) , suffixString ) ;
|
public class AbstractJawrImageReference { /** * Returns the HttpServletResponse which will be used to encode the URL
* @ param response
* the response
* @ return the HttpServletResponse which will be used to encode the URL */
private HttpServletResponse getHttpServletResponseUrlEncoder ( final Response response ) { } }
|
return new HttpServletResponse ( ) { public void setLocale ( Locale loc ) { } public void setContentType ( String type ) { } public void setContentLength ( int len ) { } public void setBufferSize ( int size ) { } public void resetBuffer ( ) { } public void reset ( ) { } public boolean isCommitted ( ) { return false ; } public PrintWriter getWriter ( ) throws IOException { return new PrintWriter ( new RedirectWriter ( getResponse ( ) ) ) ; } public ServletOutputStream getOutputStream ( ) throws IOException { return null ; } public Locale getLocale ( ) { return null ; } public int getBufferSize ( ) { return 0 ; } public void flushBuffer ( ) throws IOException { } public void setStatus ( int sc , String sm ) { } public void setStatus ( int sc ) { } public void setIntHeader ( String name , int value ) { } public void setHeader ( String name , String value ) { } public void setDateHeader ( String name , long date ) { } public void sendRedirect ( String location ) throws IOException { } public void sendError ( int sc , String msg ) throws IOException { } public void sendError ( int sc ) throws IOException { } public String encodeUrl ( String url ) { return response . encodeURL ( url ) . toString ( ) ; } public String encodeURL ( String url ) { return response . encodeURL ( url ) . toString ( ) ; } public String encodeRedirectUrl ( String url ) { return null ; } public String encodeRedirectURL ( String url ) { return null ; } public boolean containsHeader ( String name ) { return false ; } public void addIntHeader ( String name , int value ) { } public void addHeader ( String name , String value ) { } public void addDateHeader ( String name , long date ) { } public void addCookie ( Cookie cookie ) { } public String getContentType ( ) { return null ; } public void setCharacterEncoding ( String charset ) { } @ Override public String getCharacterEncoding ( ) { return "UTF-8" ; } } ;
|
public class GeneralFactory { /** * 获取客户端Service对象 */
@ Override public Service getService ( ThriftClient thriftClient , String serviceName ) throws IkasoaException { } }
|
if ( thriftClient == null ) throw new IllegalArgumentException ( "'thriftClient' is null !" ) ; return StringUtil . isEmpty ( serviceName ) ? new ServiceClientImpl ( thriftClient . getProtocol ( thriftClient . getTransport ( ) ) ) : new ServiceClientImpl ( thriftClient . getProtocol ( thriftClient . getTransport ( ) , serviceName ) ) ;
|
public class ListSubscribedWorkteamsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListSubscribedWorkteamsRequest listSubscribedWorkteamsRequest , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( listSubscribedWorkteamsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listSubscribedWorkteamsRequest . getNameContains ( ) , NAMECONTAINS_BINDING ) ; protocolMarshaller . marshall ( listSubscribedWorkteamsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listSubscribedWorkteamsRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class JAASSystem { /** * Returns for given parameter < i > _ id < / i > the instance of class
* { @ link JAASSystem } .
* @ param _ id id to search in the cache
* @ return instance of class { @ link JAASSystem }
* @ throws CacheReloadException on error */
public static JAASSystem getJAASSystem ( final long _id ) throws CacheReloadException { } }
|
final Cache < Long , JAASSystem > cache = InfinispanCache . get ( ) . < Long , JAASSystem > getCache ( JAASSystem . IDCACHE ) ; if ( ! cache . containsKey ( _id ) ) { JAASSystem . getJAASSystemFromDB ( JAASSystem . SQL_ID , _id ) ; } return cache . get ( _id ) ;
|
public class DscConfigurationsInner { /** * Create the configuration identified by configuration name .
* @ param resourceGroupName Name of an Azure Resource group .
* @ param automationAccountName The name of the automation account .
* @ param configurationName The create or update parameters for configuration .
* @ param parameters The create or update parameters for configuration .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the DscConfigurationInner object */
public Observable < DscConfigurationInner > updateAsync ( String resourceGroupName , String automationAccountName , String configurationName , DscConfigurationUpdateParameters parameters ) { } }
|
return updateWithServiceResponseAsync ( resourceGroupName , automationAccountName , configurationName , parameters ) . map ( new Func1 < ServiceResponse < DscConfigurationInner > , DscConfigurationInner > ( ) { @ Override public DscConfigurationInner call ( ServiceResponse < DscConfigurationInner > response ) { return response . body ( ) ; } } ) ;
|
public class Sort { /** * Reverses part of an array . See { @ link # reverse ( int [ ] ) }
* @ param order The array containing the data to reverse .
* @ param offset Where to start reversing .
* @ param length How many elements to reverse */
@ SuppressWarnings ( "WeakerAccess" ) public static void reverse ( int [ ] order , int offset , int length ) { } }
|
for ( int i = 0 ; i < length / 2 ; i ++ ) { int t = order [ offset + i ] ; order [ offset + i ] = order [ offset + length - i - 1 ] ; order [ offset + length - i - 1 ] = t ; }
|
public class ExecutionStage { /** * Returns the input execution vertex with the given index or < code > null < / code > if no such vertex exists .
* @ param index
* the index of the vertex to be selected .
* @ return the input execution vertex with the given index or < code > null < / code > if no such vertex exists */
public ExecutionVertex getOutputExecutionVertex ( int index ) { } }
|
final Iterator < ExecutionGroupVertex > it = this . stageMembers . iterator ( ) ; while ( it . hasNext ( ) ) { final ExecutionGroupVertex groupVertex = it . next ( ) ; if ( groupVertex . isOutputVertex ( ) ) { final int numberOfMembers = groupVertex . getCurrentNumberOfGroupMembers ( ) ; if ( index >= numberOfMembers ) { index -= numberOfMembers ; } else { return groupVertex . getGroupMember ( index ) ; } } } return null ;
|
public class BeanDefinitionParser { /** * Parse a constructor - arg element .
* @ param ele a { @ link org . w3c . dom . Element } object .
* @ param bd a { @ link org . springframework . beans . factory . config . BeanDefinition } object . */
public void parseConstructorArgElement ( Element ele , BeanDefinition bd ) { } }
|
String indexAttr = ele . getAttribute ( INDEX_ATTRIBUTE ) ; String typeAttr = ele . getAttribute ( TYPE_ATTRIBUTE ) ; String nameAttr = ele . getAttribute ( NAME_ATTRIBUTE ) ; if ( StringUtils . hasLength ( indexAttr ) ) { try { int index = Integer . parseInt ( indexAttr ) ; if ( index < 0 ) { error ( "'index' cannot be lower than 0" , ele ) ; } else { try { this . parseState . push ( new ConstructorArgumentEntry ( index ) ) ; Object value = parsePropertyValue ( ele , bd , null ) ; ConstructorArgumentValues . ValueHolder valueHolder = new ConstructorArgumentValues . ValueHolder ( value ) ; if ( StringUtils . hasLength ( typeAttr ) ) valueHolder . setType ( typeAttr ) ; if ( StringUtils . hasLength ( nameAttr ) ) valueHolder . setName ( nameAttr ) ; valueHolder . setSource ( extractSource ( ele ) ) ; if ( bd . getConstructorArgumentValues ( ) . hasIndexedArgumentValue ( index ) ) { error ( "Ambiguous constructor-arg entries for index " + index , ele ) ; } else { bd . getConstructorArgumentValues ( ) . addIndexedArgumentValue ( index , valueHolder ) ; } } finally { this . parseState . pop ( ) ; } } } catch ( NumberFormatException ex ) { error ( "Attribute 'index' of tag 'constructor-arg' must be an integer" , ele ) ; } } else { try { this . parseState . push ( new ConstructorArgumentEntry ( ) ) ; Object value = parsePropertyValue ( ele , bd , null ) ; ConstructorArgumentValues . ValueHolder valueHolder = new ConstructorArgumentValues . ValueHolder ( value ) ; if ( StringUtils . hasLength ( typeAttr ) ) valueHolder . setType ( typeAttr ) ; if ( StringUtils . hasLength ( nameAttr ) ) valueHolder . setName ( nameAttr ) ; valueHolder . setSource ( extractSource ( ele ) ) ; bd . getConstructorArgumentValues ( ) . addGenericArgumentValue ( valueHolder ) ; } finally { this . parseState . pop ( ) ; } }
|
public class BodyContentImpl { /** * Print a boolean value . The string produced by < code > { @ link
* java . lang . String # valueOf ( boolean ) } < / code > is translated into bytes
* according to the platform ' s default character encoding , and these bytes
* are written in exactly the manner of the < code > { @ link
* # write ( int ) } < / code > method .
* @ param b The < code > boolean < / code > to be printed
* @ throws IOException */
public void print ( boolean b ) throws IOException { } }
|
if ( writer != null ) { writer . write ( b ? "true" : "false" ) ; } else { write ( b ? "true" : "false" ) ; }
|
public class TorqueDBHandling { /** * Reads the text files in the given directory and puts their content
* in the given map after compressing it . Note that this method does not
* traverse recursivly into sub - directories .
* @ param dir The directory to process
* @ param results Map that will receive the contents ( indexed by the relative filenames )
* @ throws IOException If an error ocurred */
private void readTextsCompressed ( File dir , HashMap results ) throws IOException { } }
|
if ( dir . exists ( ) && dir . isDirectory ( ) ) { File [ ] files = dir . listFiles ( ) ; for ( int idx = 0 ; idx < files . length ; idx ++ ) { if ( files [ idx ] . isDirectory ( ) ) { continue ; } results . put ( files [ idx ] . getName ( ) , readTextCompressed ( files [ idx ] ) ) ; } }
|
public class MapProxySupport { /** * Maps keys to corresponding partitions and sends operations to them . */
protected void loadInternal ( Set < K > keys , Iterable < Data > dataKeys , boolean replaceExistingValues ) { } }
|
if ( dataKeys == null ) { dataKeys = convertToData ( keys ) ; } Map < Integer , List < Data > > partitionIdToKeys = getPartitionIdToKeysMap ( dataKeys ) ; Iterable < Entry < Integer , List < Data > > > entries = partitionIdToKeys . entrySet ( ) ; for ( Entry < Integer , List < Data > > entry : entries ) { Integer partitionId = entry . getKey ( ) ; List < Data > correspondingKeys = entry . getValue ( ) ; Operation operation = createLoadAllOperation ( correspondingKeys , replaceExistingValues ) ; operationService . invokeOnPartition ( SERVICE_NAME , operation , partitionId ) ; } waitUntilLoaded ( ) ;
|
public class GuiceInjectorProvider { /** * Creates an injector using modules obtained from the following sources : ( 1 ) the hard coded list of modules
* specified in the { @ link GuiceInjectorProvider # getModulesList ( ) } method of this class , ( 2 ) the ' modules '
* list passed as the first and only argument to this method
* @ param modules - any additional Guice binding modules which will supplement the list of those added by default */
public Injector getInjector ( AbstractModule ... modules ) { } }
|
List < Module > moduleList = getModuleList ( modules ) ; Injector injector = Guice . createInjector ( moduleList ) ; injector . getInstance ( IConfiguration . class ) . initialize ( ) ; return injector ;
|
public class FixedRedirectCookieAuthenticator { /** * Sets or update the credentials cookie . */
@ Override protected int authenticated ( final Request request , final Response response ) { } }
|
try { final CookieSetting credentialsCookie = this . getCredentialsCookie ( request , response ) ; credentialsCookie . setValue ( this . formatCredentials ( request . getChallengeResponse ( ) ) ) ; credentialsCookie . setMaxAge ( this . getMaxCookieAge ( ) ) ; } catch ( final GeneralSecurityException e ) { this . log . error ( "Could not format credentials cookie" , e ) ; } // log . info ( " calling super . authenticated " ) ;
// return super . authenticated ( request , response ) ;
// Modified copy of Authenticator . authenticated
if ( this . log . isDebugEnabled ( ) ) { this . log . debug ( "The authentication succeeded for the identifer \"{}\" using the {} scheme." , request . getChallengeResponse ( ) . getIdentifier ( ) , request . getChallengeResponse ( ) . getScheme ( ) ) ; } // Update the client info accordingly
if ( request . getClientInfo ( ) != null ) { request . getClientInfo ( ) . setAuthenticated ( true ) ; } // Clear previous challenge requests
response . getChallengeRequests ( ) . clear ( ) ; // Add the roles for the authenticated subject
if ( this . getEnroler ( ) != null ) { this . getEnroler ( ) . enrole ( request . getClientInfo ( ) ) ; } // Return STOP here works for login but not for subsequent requests that expect a response
// return STOP ;
return Filter . CONTINUE ;
|
public class DefaultArtifactUtil { /** * { @ inheritDoc } */
public MavenProject resolveFromReactor ( Artifact artifact , MavenProject mp , List < MavenProject > reactorProjects ) throws MojoExecutionException { } }
|
MavenProject result = null ; String artifactId = artifact . getArtifactId ( ) ; String groupId = artifact . getGroupId ( ) ; if ( CollectionUtils . isNotEmpty ( reactorProjects ) ) { for ( MavenProject reactorProject : reactorProjects ) { if ( reactorProject . getArtifactId ( ) . equals ( artifactId ) && reactorProject . getGroupId ( ) . equals ( groupId ) ) { result = reactorProject ; break ; } } } return result ;
|
public class EmbeddedServerImpl { /** * The EmbeddedLibertyServer is not a daemon thread : if the server
* or framework is running , we want this process to stay awake . There
* are a lot of ways to get it unstuck . . . ( or diagnose a hung
* server or whatever ) . But as soon as the framework does stop , then
* this thread will go away .
* @ param r
* @ return */
private Thread createServerThread ( ServerTask r ) { } }
|
Thread t = new Thread ( r ) ; t . setName ( "EmbeddedLibertyServer-" + t . getName ( ) ) ; return t ;
|
public class Main { /** * Main entry point for the launcher .
* Note : This method calls System . exit .
* @ param args command line arguments */
public static void main ( String [ ] args ) { } }
|
JavapTask t = new JavapTask ( ) ; int rc = t . run ( args ) ; System . exit ( rc ) ;
|
public class Grammar { /** * expansion is not performed recurively */
public void expandSymbol ( int symbol ) { } }
|
int prod , maxProd ; int ofs , maxOfs ; int ofs2 , maxOfs2 ; int i , j ; boolean found ; int count , nextCount ; IntArrayList next ; int [ ] [ ] expand ; List < int [ ] > expandLst ; int right ; maxProd = getProductionCount ( ) ; // make an array of the expand prods to easily index them ;
// storing the indexes instead is difficult because the indexes
// max change
expandLst = new ArrayList < int [ ] > ( ) ; for ( prod = 0 ; prod < maxProd ; prod ++ ) { if ( getLeft ( prod ) == symbol ) { expandLst . add ( getProduction ( prod ) ) ; } } expand = new int [ expandLst . size ( ) ] [ ] ; expandLst . toArray ( expand ) ; for ( prod = maxProd - 1 ; prod >= 0 ; prod -- ) { maxOfs = getLength ( prod ) ; found = false ; nextCount = 1 ; for ( ofs = 0 ; ofs < maxOfs ; ofs ++ ) { if ( getRight ( prod , ofs ) == symbol ) { found = true ; nextCount *= expand . length ; } } if ( found ) { // testing found is an optimization
for ( i = 0 ; i < nextCount ; i ++ ) { count = i ; next = new IntArrayList ( ) ; next . add ( getLeft ( prod ) ) ; for ( ofs = 0 ; ofs < maxOfs ; ofs ++ ) { right = getRight ( prod , ofs ) ; if ( right == symbol ) { j = count % expand . length ; maxOfs2 = expand [ j ] . length ; for ( ofs2 = 1 ; ofs2 < maxOfs2 ; ofs2 ++ ) { next . add ( expand [ j ] [ ofs2 ] ) ; } count /= expand . length ; } else { next . add ( right ) ; } } if ( count != 0 ) { throw new RuntimeException ( ) ; } addProduction ( prod + 1 , next . toArray ( ) ) ; } removeProduction ( prod ) ; } }
|
public class IOHelper { /** * Simple http post implementation . Supports HTTP Basic authentication via request properties .
* You may want to use { @ link # createBasicAuthenticationProperty } to add authentication .
* @ param httpurl
* target url
* @ param data
* String with content to post
* @ param requestProperties
* optional http header fields ( key - & gt ; value )
* @ return input stream of response
* @ throws IOException */
@ SuppressWarnings ( "resource" ) public static InputStream httpPost ( final String httpurl , final String data , final Map < String , String > ... requestProperties ) throws IOException { } }
|
byte [ ] bytes = data . getBytes ( "utf-8" ) ; java . net . URL url = new java . net . URL ( httpurl ) ; HttpURLConnection connection = ( HttpURLConnection ) url . openConnection ( ) ; connection . setDoInput ( true ) ; connection . setDoOutput ( true ) ; connection . setRequestMethod ( "POST" ) ; connection . setRequestProperty ( "charset" , "utf-8" ) ; connection . setRequestProperty ( "Content-Length" , Integer . toString ( bytes . length ) ) ; for ( Map < String , String > props : requestProperties ) { addRequestProperties ( props , connection ) ; } OutputStream outputStream = connection . getOutputStream ( ) ; outputStream . write ( bytes ) ; outputStream . flush ( ) ; return connection . getInputStream ( ) ;
|
public class CachingScriptLoader { /** * Locates the view script of the given name .
* @ param name
* if this is a relative path , such as " foo . jelly " or " foo / bar . groovy " ,
* then it is assumed to be relative to this class , so
* " org / acme / MyClass / foo . jelly " or " org / acme / MyClass / foo / bar . groovy "
* will be searched .
* If the extension is omitted , the default extension will be appended .
* This is useful for some loaders that support loading multiple file extension types
* ( such as Jelly support . )
* If this starts with " / " , then it is assumed to be absolute ,
* and that name is searched from the classloader . This is useful
* to do mix - in .
* @ return null if none was found . */
public S findScript ( String name ) throws E { } }
|
if ( MetaClass . NO_CACHE ) return loadScript ( name ) ; else return scripts . getUnchecked ( name ) . get ( ) ;
|
public class ClientInterface { /** * When partition mastership for a partition changes , check all outstanding
* requests for that partition and if they aren ' t for the current partition master ,
* drop them and send an error response . */
private void failOverConnection ( Integer partitionId , Long initiatorHSId , Connection c ) { } }
|
ClientInterfaceHandleManager cihm = m_cihm . get ( c . connectionId ( ) ) ; if ( cihm == null ) { return ; } List < Iv2InFlight > transactions = cihm . removeHandlesForPartitionAndInitiator ( partitionId , initiatorHSId ) ; if ( ! transactions . isEmpty ( ) ) { Iv2Trace . logFailoverTransaction ( partitionId , initiatorHSId , transactions . size ( ) ) ; } for ( Iv2InFlight inFlight : transactions ) { ClientResponseImpl response = new ClientResponseImpl ( ClientResponseImpl . RESPONSE_UNKNOWN , ClientResponse . UNINITIALIZED_APP_STATUS_CODE , null , new VoltTable [ 0 ] , DROP_TXN_MASTERSHIP ) ; response . setClientHandle ( inFlight . m_clientHandle ) ; ByteBuffer buf = ByteBuffer . allocate ( response . getSerializedSize ( ) + 4 ) ; buf . putInt ( buf . capacity ( ) - 4 ) ; response . flattenToBuffer ( buf ) ; buf . flip ( ) ; c . writeStream ( ) . enqueue ( buf ) ; } if ( cihm . repairCallback != null ) { cihm . repairCallback . repairCompleted ( partitionId , initiatorHSId ) ; }
|
public class TransferServlet { /** * Returns a { @ link AbstractUploadResponder } depending on the Accept header received in { @ link HttpServletRequest } .
* If there is no matching { @ link AbstractUploadResponder } then return { @ link JsonUploadResponder } as the default
* implementation .
* @ param transferContext
* Instance of { @ link TransferContext }
* @ return Instance of { @ link AbstractUploadResponder } . */
private UploadResponder getUploadResponder ( TransferContext transferContext ) { } }
|
LOGGER . entering ( transferContext ) ; UploadResponder uploadResponder ; Class < ? extends UploadResponder > uploadResponderClass = getResponderClass ( transferContext . getHttpServletRequest ( ) . getHeader ( "accept" ) ) ; try { uploadResponder = ( UploadResponder ) uploadResponderClass . getConstructor ( new Class [ ] { TransferContext . class } ) . newInstance ( new Object [ ] { transferContext } ) ; LOGGER . exiting ( uploadResponder ) ; return uploadResponder ; } catch ( Exception e ) { // We cannot do any meaningful operation to handle this ; catching exception and returning
// default responder
uploadResponder = new JsonUploadResponder ( transferContext ) ; LOGGER . exiting ( uploadResponder ) ; return uploadResponder ; }
|
public class BatchedJmsTemplate { /** * Receive a batch of up to batchSize for given Destination and convert each message in the batch . Other than batching this method is the same as { @ link JmsTemplate # receiveAndConvert ( Destination ) }
* @ return A list of { @ link Message }
* @ param destination The Destination
* @ param batchSize The batch size
* @ throws JmsException The { @ link JmsException } */
public List < Object > receiveAndConvertBatch ( Destination destination , int batchSize ) throws JmsException { } }
|
List < Message > messages = receiveBatch ( destination , batchSize ) ; List < Object > result = new ArrayList < Object > ( messages . size ( ) ) ; for ( Message next : messages ) { result . add ( doConvertFromMessage ( next ) ) ; } return result ;
|
public class PMContext { /** * Obtain parameters based on paramid as an array .
* @ param paramid Parameter id
* @ return Array list */
public Object [ ] getParameters ( String paramid ) { } }
|
final Object parameter = getParameter ( paramid ) ; if ( parameter == null ) { return null ; } if ( parameter instanceof Object [ ] ) { return ( Object [ ] ) parameter ; } else { final Object [ ] result = { parameter } ; return result ; }
|
public class SwimMembershipProtocol { /** * Handles a node leave event . */
private void handleLeaveEvent ( Node node ) { } }
|
SwimMember member = members . get ( MemberId . from ( node . id ( ) . id ( ) ) ) ; if ( member != null && ! member . isActive ( ) ) { members . remove ( member . id ( ) ) ; }
|
public class TtlScheduler { /** * Add a service to the checks loop .
* @ param instanceId instance id */
public void add ( String instanceId ) { } }
|
ScheduledFuture task = this . scheduler . scheduleAtFixedRate ( new ConsulHeartbeatTask ( instanceId ) , this . configuration . computeHearbeatInterval ( ) . toStandardDuration ( ) . getMillis ( ) ) ; ScheduledFuture previousTask = this . serviceHeartbeats . put ( instanceId , task ) ; if ( previousTask != null ) { previousTask . cancel ( true ) ; }
|
public class ErrorGovernor { /** * Determines if the error should be sent based on our throttling criteria
* @ param error The error
* @ return True if this error should be sent to Stackify , false otherwise */
public boolean errorShouldBeSent ( final StackifyError error ) { } }
|
if ( error == null ) { throw new NullPointerException ( "StackifyError is null" ) ; } boolean shouldBeProcessed = false ; long epochMinute = getUnixEpochMinutes ( ) ; synchronized ( errorCounter ) { // increment the counter for this error
int errorCount = errorCounter . incrementCounter ( error , epochMinute ) ; // check our throttling criteria
if ( errorCount <= MAX_DUP_ERROR_PER_MINUTE ) { shouldBeProcessed = true ; } // see if we need to purge our counters of expired entries
if ( nextErrorToCounterCleanUp < epochMinute ) { errorCounter . purgeCounters ( epochMinute ) ; nextErrorToCounterCleanUp = epochMinute + CLEAN_UP_MINUTES ; } } return shouldBeProcessed ;
|
public class RESTArtifactLoaderService { /** * Return Response with Maven artifact if it is file or HTML page for browsing if requested URL is
* folder .
* @ param mavenPath
* the relative part of requested URL .
* @ param uriInfo
* @ param view
* @ param gadget
* @ return { @ link Response } . */
@ GET @ Path ( "/{path:.*}/" ) public Response getResource ( @ PathParam ( "path" ) String mavenPath , final @ Context UriInfo uriInfo , final @ QueryParam ( "view" ) String view , final @ QueryParam ( "gadget" ) String gadget ) { } }
|
String resourcePath = mavenRoot + mavenPath ; // JCR resource
String shaResourcePath = mavenPath . endsWith ( ".sha1" ) ? mavenRoot + mavenPath : mavenRoot + mavenPath + ".sha1" ; mavenPath = uriInfo . getBaseUriBuilder ( ) . path ( getClass ( ) ) . path ( mavenPath ) . build ( ) . toString ( ) ; Session ses = null ; try { // JCR resource
SessionProvider sp = sessionProviderService . getSessionProvider ( null ) ; if ( sp == null ) throw new RepositoryException ( "Access to JCR Repository denied. SessionProvider is null." ) ; ses = sp . getSession ( workspace , repositoryService . getRepository ( repository ) ) ; ExtendedNode node = ( ExtendedNode ) ses . getRootNode ( ) . getNode ( resourcePath ) ; if ( isFile ( node ) ) { if ( view != null && view . equalsIgnoreCase ( "true" ) ) { ExtendedNode shaNode = null ; try { shaNode = ( ExtendedNode ) ses . getRootNode ( ) . getNode ( shaResourcePath ) ; } catch ( RepositoryException e ) { // no . sh1 file found
if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "An exception occurred: " + e . getMessage ( ) ) ; } } return getArtifactInfo ( node , mavenPath , gadget , shaNode ) ; } else { return downloadArtifact ( node ) ; } } else { return browseRepository ( node , mavenPath , gadget ) ; } } catch ( PathNotFoundException e ) { if ( LOG . isDebugEnabled ( ) ) LOG . debug ( e . getLocalizedMessage ( ) , e ) ; return Response . status ( Response . Status . NOT_FOUND ) . build ( ) ; } catch ( AccessDeniedException e ) { if ( LOG . isDebugEnabled ( ) ) LOG . debug ( e . getLocalizedMessage ( ) , e ) ; if ( ses == null || ses . getUserID ( ) . equals ( IdentityConstants . ANONIM ) ) return Response . status ( Response . Status . UNAUTHORIZED ) . header ( ExtHttpHeaders . WWW_AUTHENTICATE , "Basic realm=\"" + realmName + "\"" ) . build ( ) ; else return Response . status ( Response . Status . FORBIDDEN ) . build ( ) ; } catch ( Exception e ) { LOG . error ( "Failed get maven artifact" , e ) ; throw new WebApplicationException ( e ) ; } finally { if ( ses != null ) ses . logout ( ) ; }
|
public class FastaWriterHelper { /** * Write a collection of GeneSequences to a file where if the gene is negative strand it will flip and complement the sequence
* @ param outputStream
* @ param dnaSequences
* @ throws Exception */
public static void writeGeneSequence ( OutputStream outputStream , Collection < GeneSequence > geneSequences , boolean showExonUppercase ) throws Exception { } }
|
FastaGeneWriter fastaWriter = new FastaGeneWriter ( outputStream , geneSequences , new GenericFastaHeaderFormat < GeneSequence , NucleotideCompound > ( ) , showExonUppercase ) ; fastaWriter . process ( ) ;
|
public class MeanPreviewCollection { /** * Add measurements from the given Preview to the overall sum .
* @ param measurementsSum
* @ param preview
* @ param numEntriesPerPreview */
private void addPreviewMeasurementsToSum ( List < double [ ] > measurementsSum , Preview preview , int numEntriesPerPreview ) { } }
|
List < double [ ] > previewMeasurements = preview . getData ( ) ; // add values for each measurement in each entry
for ( int entryIdx = 0 ; entryIdx < numEntriesPerPreview ; entryIdx ++ ) { double [ ] previewEntry = previewMeasurements . get ( entryIdx ) ; double [ ] sumEntry ; if ( measurementsSum . size ( ) > entryIdx ) { sumEntry = measurementsSum . get ( entryIdx ) ; } else { // initialize sum entry
sumEntry = new double [ previewEntry . length ] ; measurementsSum . add ( sumEntry ) ; } // first measurement is used for indexing
// - > simply copy from first preview
if ( sumEntry [ 0 ] == 0.0 ) { sumEntry [ 0 ] = previewEntry [ 0 ] ; } // add measurements of current entry
for ( int measure = 1 ; measure < sumEntry . length ; measure ++ ) { sumEntry [ measure ] += previewEntry [ measure ] ; } }
|
public class UserPasswordChange { /** * Add all the screen listeners . */
public void addListeners ( ) { } }
|
this . getRecord ( UserInfo . USER_INFO_FILE ) . getField ( UserInfo . USER_NAME ) . setEnabled ( false ) ; this . readCurrentUser ( ) ; super . addListeners ( ) ; this . getMainRecord ( ) . addListener ( new UserPasswordHandler ( true ) ) ;
|
public class DescribeReservedInstancesOfferingsResult { /** * A list of Reserved Instances offerings .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setReservedInstancesOfferings ( java . util . Collection ) } or
* { @ link # withReservedInstancesOfferings ( java . util . Collection ) } if you want to override the existing values .
* @ param reservedInstancesOfferings
* A list of Reserved Instances offerings .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeReservedInstancesOfferingsResult withReservedInstancesOfferings ( ReservedInstancesOffering ... reservedInstancesOfferings ) { } }
|
if ( this . reservedInstancesOfferings == null ) { setReservedInstancesOfferings ( new com . amazonaws . internal . SdkInternalList < ReservedInstancesOffering > ( reservedInstancesOfferings . length ) ) ; } for ( ReservedInstancesOffering ele : reservedInstancesOfferings ) { this . reservedInstancesOfferings . add ( ele ) ; } return this ;
|
public class VirtualNetworkGatewaysInner { /** * Gets pre - generated VPN profile for P2S client of the virtual network gateway in the specified resource group . The profile needs to be generated first using generateVpnProfile .
* @ param resourceGroupName The name of the resource group .
* @ param virtualNetworkGatewayName The name of the virtual network gateway .
* @ 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 String object if successful . */
public String beginGetVpnProfilePackageUrl ( String resourceGroupName , String virtualNetworkGatewayName ) { } }
|
return beginGetVpnProfilePackageUrlWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayName ) . toBlocking ( ) . single ( ) . body ( ) ;
|
public class FlexiantComputeClient { /** * Retrieves the location identified by the given uuid .
* @ param locationUUID the id of the location .
* @ return an object representing the location if any , otherwise null .
* @ throws FlexiantException */
@ Nullable public Location getLocation ( final String locationUUID ) throws FlexiantException { } }
|
final Cluster cluster = this . getCluster ( locationUUID ) ; if ( cluster != null ) { return Location . from ( cluster ) ; } final Vdc vdc = this . getVdc ( locationUUID ) ; if ( vdc != null ) { final Cluster clusterofVDC = this . getCluster ( vdc . getClusterUUID ( ) ) ; checkState ( clusterofVDC != null , String . format ( "Error while retrieving cluster of vdc %s. VDC is in cluster %s, but this cluster " + "does not exist. Looks like the vdc is corrupted." , vdc , vdc . getClusterUUID ( ) ) ) ; return Location . from ( vdc , clusterofVDC ) ; } return null ;
|
public class ExpVisitorIR { /** * Unary */
@ Override public SExpIR caseAUnaryPlusUnaryExp ( AUnaryPlusUnaryExp node , IRInfo question ) throws AnalysisException { } }
|
return question . getExpAssistant ( ) . handleUnaryExp ( node , new APlusUnaryExpIR ( ) , question ) ;
|
public class StringUtils { /** * Determines if a String represents a single word . A single word is defined
* as a non - null string containing no word boundaries after trimming .
* @ param value
* @ return */
public static boolean isSingleWord ( String value ) { } }
|
if ( value == null ) { return false ; } value = value . trim ( ) ; if ( value . isEmpty ( ) ) { return false ; } return ! SINGLE_WORD_PATTERN . matcher ( value ) . matches ( ) ;
|
public class Para { /** * Creates a new application and returns the credentials for it .
* @ param appid the app identifier
* @ param name the full name of the app
* @ param sharedTable false if the app should have its own table
* @ param sharedIndex false if the app should have its own index
* @ return credentials for the root app */
public static Map < String , String > newApp ( String appid , String name , boolean sharedTable , boolean sharedIndex ) { } }
|
Map < String , String > creds = new TreeMap < > ( ) ; creds . put ( "message" , "All set!" ) ; if ( StringUtils . isBlank ( appid ) ) { return creds ; } App app = new App ( appid ) ; if ( ! app . exists ( ) ) { app . setName ( name ) ; app . setSharingTable ( sharedTable ) ; app . setSharingIndex ( sharedIndex ) ; app . setActive ( true ) ; String id = app . create ( ) ; if ( id != null ) { logger . info ( "Created {} app '{}', sharingTable = {}, sharingIndex = {}." , app . isRootApp ( ) ? "root" : "new" , app . getAppIdentifier ( ) , sharedTable , sharedIndex ) ; creds . putAll ( app . getCredentials ( ) ) ; creds . put ( "message" , "Save the secret key - it is shown only once!" ) ; } else { logger . error ( "Failed to create app '{}'!" , appid ) ; creds . put ( "message" , "Error - app was not created." ) ; } } return creds ;
|
public class FacesConfigConverterTypeImpl { /** * Returns all < code > property < / code > elements
* @ return list of < code > property < / code > */
public List < FacesConfigPropertyType < FacesConfigConverterType < T > > > getAllProperty ( ) { } }
|
List < FacesConfigPropertyType < FacesConfigConverterType < T > > > list = new ArrayList < FacesConfigPropertyType < FacesConfigConverterType < T > > > ( ) ; List < Node > nodeList = childNode . get ( "property" ) ; for ( Node node : nodeList ) { FacesConfigPropertyType < FacesConfigConverterType < T > > type = new FacesConfigPropertyTypeImpl < FacesConfigConverterType < T > > ( this , "property" , childNode , node ) ; list . add ( type ) ; } return list ;
|
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link String } { @ code > } } */
@ XmlElementDecl ( namespace = "http://www.ibm.com/websphere/wim" , name = "telephoneNumber" ) public JAXBElement < String > createTelephoneNumber ( String value ) { } }
|
return new JAXBElement < String > ( _TelephoneNumber_QNAME , String . class , null , value ) ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.