signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class ScatterChartPanel { /** * Determines the required space ( in points ) for painting ticks for the coordinate axis of the given dimension . * The basic assumption here is , that the first dimension ( X ) is drawed horizontally and the second dimension ( Y ) is drawed vertically . * @ param dim Reference dimension for space calculation * @ return Required points for painting tick information */ protected int getRequiredPoints ( ValueDimension dim ) { } }
int requiredPointsPerTick = getGraphics ( ) . getFontMetrics ( ) . getHeight ( ) ; if ( dim == ValueDimension . X ) { int first = getGraphics ( ) . getFontMetrics ( ) . stringWidth ( String . format ( getTickInfo ( dim ) . getFormat ( ) , getTickInfo ( dim ) . getFirstTick ( ) ) ) ; int last = getGraphics ( ) . getFontMetrics ( ) . stringWidth ( String . format ( getTickInfo ( dim ) . getFormat ( ) , getTickInfo ( dim ) . getLastTick ( ) ) ) ; requiredPointsPerTick = Math . max ( first , last ) + 2 ; } return requiredPointsPerTick * getTickInfo ( dim ) . getTickNumber ( ) ;
public class LastfmCelma1KParser { /** * { @ inheritDoc } */ @ Override public DataModelIF < Long , Long > parseData ( final File f , final String mapIdsPrefix ) throws IOException { } }
return parseTemporalData ( f , mapIdsPrefix ) ;
public class VFS { /** * Find a virtual file . * @ param uri the URI whose path component is the child path * @ return the child * @ throws IllegalArgumentException if the path is null */ public static VirtualFile getChild ( URI uri ) { } }
String path = uri . getPath ( ) ; if ( path == null ) { path = uri . getSchemeSpecificPart ( ) ; } return getChild ( path ) ;
public class CookieDateUtil { /** * Parses the date value using the given date formats . * @ param dateValue the date value to parse * @ param dateFormats the date formats to use * @ return the parsed date */ @ Nullable public static Date parseDate ( String dateValue , Collection < String > dateFormats ) { } }
return parseDate ( dateValue , dateFormats , DEFAULT_TWO_DIGIT_YEAR_START ) ;
public class BasicBinder { /** * Register a Marshaller with the given source and target class . * The marshaller is used as follows : Instances of the source can be marshalled into the target class . * @ param source The source ( input ) class * @ param target The target ( output ) class * @ param converter The ToMarshaller to be registered */ public final < S , T > void registerMarshaller ( Class < S > source , Class < T > target , ToMarshaller < S , T > converter ) { } }
Class < ? extends Annotation > scope = matchImplementationToScope ( converter . getClass ( ) ) ; registerMarshaller ( new ConverterKey < S , T > ( source , target , scope == null ? DefaultBinding . class : scope ) , converter ) ;
public class SimpleSeekableFormatOutputStream { /** * Take the current data segment , optionally compress it , * calculate the crc32 , and then write it out . * The method sets the lastOffsets to the end of the file before it starts * writing . That means the offsets in the MetaDataBlock will be after the * end of the current data block . */ @ Override public void flush ( ) throws IOException { } }
// Do not do anything if no data has been written if ( currentDataSegmentBuffer . size ( ) == 0 ) { return ; } // Create the current DataSegment DataSegmentWriter currentDataSegment = new DataSegmentWriter ( currentDataSegmentBuffer , codec , codecCompressor ) ; // Update the metadata updateMetadata ( currentDataSegmentBuffer . size ( ) , currentDataSegment . size ( ) ) ; // Write out the DataSegment currentDataSegment . writeTo ( dataSegmentDataOut ) ; // Clear out the current buffer . Note that this has to be done after // currentDataSegment . writeTo ( . . . ) , because currentDataSegment can // keep a reference to the currentDataSegmentBuffer . currentDataSegmentBuffer . reset ( ) ; // Flush out the underlying stream dataSegmentDataOut . flush ( ) ;
public class OtpErlangRef { /** * Compute the hashCode value for a given ref . This function is compatible * with equal . * @ return the hashCode of the node . */ @ Override protected int doHashCode ( ) { } }
final OtpErlangObject . Hash hash = new OtpErlangObject . Hash ( 7 ) ; hash . combine ( creation , ids [ 0 ] ) ; if ( isNewRef ( ) ) { hash . combine ( ids [ 1 ] , ids [ 2 ] ) ; } return hash . valueOf ( ) ;
public class ListColumnReader { /** * Each collection ( Array or Map ) has four variants of presence : * 1 ) Collection is not defined , because one of it ' s optional parent fields is null * 2 ) Collection is null * 3 ) Collection is defined but empty * 4 ) Collection is defined and not empty . In this case offset value is increased by the number of elements in that collection */ public static void calculateCollectionOffsets ( Field field , IntList offsets , BooleanList collectionIsNull , int [ ] definitionLevels , int [ ] repetitionLevels ) { } }
int maxDefinitionLevel = field . getDefinitionLevel ( ) ; int maxElementRepetitionLevel = field . getRepetitionLevel ( ) + 1 ; boolean required = field . isRequired ( ) ; int offset = 0 ; offsets . add ( offset ) ; for ( int i = 0 ; i < definitionLevels . length ; i = getNextCollectionStartIndex ( repetitionLevels , maxElementRepetitionLevel , i ) ) { if ( ParquetTypeUtils . isValueNull ( required , definitionLevels [ i ] , maxDefinitionLevel ) ) { // Collection is null collectionIsNull . add ( true ) ; offsets . add ( offset ) ; } else if ( definitionLevels [ i ] == maxDefinitionLevel ) { // Collection is defined but empty collectionIsNull . add ( false ) ; offsets . add ( offset ) ; } else if ( definitionLevels [ i ] > maxDefinitionLevel ) { // Collection is defined and not empty collectionIsNull . add ( false ) ; offset += getCollectionSize ( repetitionLevels , maxElementRepetitionLevel , i + 1 ) ; offsets . add ( offset ) ; } }
public class SerializedFormBuilder { /** * Build the serial UID information for the given class . * @ param node the XML element that specifies which components to document * @ param classTree content tree to which the serial UID information will be added */ public void buildSerialUIDInfo ( XMLNode node , Content classTree ) { } }
Content serialUidTree = writer . getSerialUIDInfoHeader ( ) ; for ( Element e : utils . getFieldsUnfiltered ( currentTypeElement ) ) { VariableElement field = ( VariableElement ) e ; if ( field . getSimpleName ( ) . toString ( ) . compareTo ( SERIAL_VERSION_UID ) == 0 && field . getConstantValue ( ) != null ) { writer . addSerialUIDInfo ( SERIAL_VERSION_UID_HEADER , utils . constantValueExpresion ( field ) , serialUidTree ) ; break ; } } classTree . addContent ( serialUidTree ) ;
public class FileUtils { /** * Sorts file list , using this rules : directories first , sorted using provided comparator , then files sorted using provided comparator . * @ param files list to sort * @ param comparator comparator used to sort files list * @ param descending if true then sorted list will be in reversed order * @ return sorted file list */ public static Array < FileHandle > sortFiles ( FileHandle [ ] files , Comparator < FileHandle > comparator , boolean descending ) { } }
Array < FileHandle > directoriesList = new Array < FileHandle > ( ) ; Array < FileHandle > filesList = new Array < FileHandle > ( ) ; for ( FileHandle f : files ) { if ( f . isDirectory ( ) ) { directoriesList . add ( f ) ; } else { filesList . add ( f ) ; } } Sort sorter = new Sort ( ) ; sorter . sort ( directoriesList , comparator ) ; sorter . sort ( filesList , comparator ) ; if ( descending ) { directoriesList . reverse ( ) ; filesList . reverse ( ) ; } directoriesList . addAll ( filesList ) ; // combine lists return directoriesList ;
public class PrefsInterface { /** * Returns the default safety level preference for the user . * @ see com . flickr4java . flickr . Flickr # SAFETYLEVEL _ MODERATE * @ see com . flickr4java . flickr . Flickr # SAFETYLEVEL _ RESTRICTED * @ see com . flickr4java . flickr . Flickr # SAFETYLEVEL _ SAFE * @ return The current users safety - level * @ throws FlickrException */ public String getSafetyLevel ( ) throws FlickrException { } }
Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_SAFETY_LEVEL ) ; Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element personElement = response . getPayload ( ) ; return personElement . getAttribute ( "safety_level" ) ;
public class AOValue { /** * / * ( non - Javadoc ) * @ see com . ibm . ws . sib . processor . impl . store . items . SIMPItem # getPersistentData ( java . io . ObjectOutputStream ) */ public void getPersistentData ( ObjectOutputStream dout ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getPersistentData" , dout ) ; try { dout . writeLong ( tick ) ; dout . writeLong ( msgId ) ; dout . writeInt ( storagePolicy ) ; dout . writeLong ( plockId ) ; dout . writeLong ( prevTick ) ; dout . writeLong ( waitTime ) ; dout . writeInt ( priority ) ; dout . writeInt ( reliability ) ; dout . writeLong ( aiRequestTick ) ; dout . writeUTF ( sourceMEUuid . toString ( ) ) ; } catch ( IOException e ) { // No FFDC code needed SIErrorException e2 = new SIErrorException ( e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getPersistentData" , e2 ) ; throw e2 ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getPersistentData" ) ;
public class CmsCategoryField { /** * Builds a tree item for the given category . < p > * @ param category the category * @ param selectedCategories the selected categories * @ param inactive true if the value should be displayed inactive * @ return the tree item widget */ private CmsTreeItem buildTreeItem ( CmsCategoryTreeEntry category , Collection < String > selectedCategories , boolean inactive ) { } }
CmsDataValue categoryTreeItem = new CmsDataValue ( 500 , 4 , CmsCategoryBean . SMALL_ICON_CLASSES , category . getTitle ( ) , category . getPath ( ) ) ; if ( inactive ) { categoryTreeItem . setInactive ( ) ; } categoryTreeItem . setTitle ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( category . getDescription ( ) ) ? category . getDescription ( ) : category . getPath ( ) ) ; CmsTreeItem treeItem = new CmsTreeItem ( false , categoryTreeItem ) ; treeItem . setId ( category . getPath ( ) ) ; boolean isPartofPath = false ; Iterator < String > it = selectedCategories . iterator ( ) ; while ( it . hasNext ( ) ) { String path = it . next ( ) ; if ( path . startsWith ( category . getPath ( ) ) || path . contains ( "/" + category . getPath ( ) ) ) { isPartofPath = true ; } } if ( isPartofPath ) { m_categories . add ( treeItem ) ; treeItem . setOpen ( true ) ; } return treeItem ;
public class ButtonBarDialogDecorator { /** * Inflates the layout , which is used to show the dialog ' s buttons . * @ return The view , which has been inflated , as an instance of the class { @ link View } or null , * if no view has been inflated */ private View inflateButtonBar ( ) { } }
if ( getRootView ( ) != null ) { if ( buttonBarContainer == null ) { LayoutInflater layoutInflater = LayoutInflater . from ( getContext ( ) ) ; buttonBarContainer = ( ViewGroup ) layoutInflater . inflate ( R . layout . button_bar_container , getRootView ( ) , false ) ; buttonBarDivider = buttonBarContainer . findViewById ( R . id . button_bar_divider ) ; } if ( buttonBarContainer . getChildCount ( ) > 1 ) { buttonBarContainer . removeViewAt ( 1 ) ; } if ( customButtonBarView != null ) { buttonBarContainer . addView ( customButtonBarView ) ; } else if ( customButtonBarViewId != - 1 ) { LayoutInflater layoutInflater = LayoutInflater . from ( getContext ( ) ) ; View view = layoutInflater . inflate ( customButtonBarViewId , buttonBarContainer , false ) ; buttonBarContainer . addView ( view ) ; } else { LayoutInflater layoutInflater = LayoutInflater . from ( getContext ( ) ) ; View view = layoutInflater . inflate ( stackButtons ? R . layout . stacked_button_bar : R . layout . horizontal_button_bar , buttonBarContainer , false ) ; buttonBarContainer . addView ( view ) ; } View positiveButtonView = buttonBarContainer . findViewById ( android . R . id . button1 ) ; View negativeButtonView = buttonBarContainer . findViewById ( android . R . id . button2 ) ; View neutralButtonView = buttonBarContainer . findViewById ( android . R . id . button3 ) ; positiveButton = positiveButtonView instanceof Button ? ( Button ) positiveButtonView : null ; negativeButton = negativeButtonView instanceof Button ? ( Button ) negativeButtonView : null ; neutralButton = neutralButtonView instanceof Button ? ( Button ) neutralButtonView : null ; return buttonBarContainer ; } return null ;
public class Bytes { /** * Put a long value out to the specified byte array position . * @ param bytes the byte array * @ param offset position in the array * @ param val long to write out * @ return incremented offset * @ throws IllegalArgumentException if the byte array given doesn ' t have * enough room at the offset specified . */ public static int putLong ( byte [ ] bytes , int offset , long val ) { } }
if ( bytes . length - offset < SIZEOF_LONG ) { throw new IllegalArgumentException ( "Not enough room to put a long at" + " offset " + offset + " in a " + bytes . length + " byte array" ) ; } for ( int i = offset + 7 ; i > offset ; i -- ) { bytes [ i ] = ( byte ) val ; val >>>= 8 ; } bytes [ offset ] = ( byte ) val ; return offset + SIZEOF_LONG ;
public class LObjIntCharFunctionBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */ @ Nonnull public static < T , R > LObjIntCharFunction < T , R > objIntCharFunctionFrom ( Consumer < LObjIntCharFunctionBuilder < T , R > > buildingFunction ) { } }
LObjIntCharFunctionBuilder builder = new LObjIntCharFunctionBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ;
public class DefaultCasWebflowExecutionPlan { /** * Execute the plan . */ public void execute ( ) { } }
OrderComparator . sortIfNecessary ( webflowConfigurers ) ; webflowConfigurers . forEach ( c -> { LOGGER . trace ( "Registering webflow configurer [{}]" , c . getName ( ) ) ; c . initialize ( ) ; } ) ;
public class L2Cache { /** * Retrieves a list of entities from the cache . If the cache doesn ' t yet exist , will create the * cache . * @ param repository the underlying repository , used to create the cache loader or to retrieve the * existing cache * @ param ids { @ link Iterable } of the ids of the entities to retrieve * @ return List containing the retrieved entities , missing values are excluded * @ throws RuntimeException if the cache failed to load the entities */ public List < Entity > getBatch ( Repository < Entity > repository , Iterable < Object > ids ) { } }
try { return getEntityCache ( repository ) . getAll ( ids ) . values ( ) . stream ( ) . filter ( Optional :: isPresent ) . map ( Optional :: get ) . map ( e -> entityHydration . hydrate ( e , repository . getEntityType ( ) ) ) . collect ( Collectors . toList ( ) ) ; } catch ( ExecutionException exception ) { // rethrow unchecked if ( exception . getCause ( ) instanceof RuntimeException ) { throw ( RuntimeException ) exception . getCause ( ) ; } throw new MolgenisDataException ( exception ) ; }
public class Contexts { /** * Serializes an instance context to JSON . * @ param context The context to serialize . * @ return The serialized context . */ public static JsonObject serialize ( InstanceContext context ) { } }
return serialize ( context . uri ( ) , context . component ( ) . network ( ) ) ;
public class JulianDay { /** * obtains the JD - value for given moment and scale */ static double getValue ( Moment moment , TimeScale scale ) { } }
long elapsedTime = moment . getElapsedTime ( scale ) + jdOffset ( scale ) ; int nano = moment . getNanosecond ( scale ) ; double secs = elapsedTime + nano / ( MRD * 1.0 ) ; return secs / DAY_IN_SECONDS ;
public class PolicyAssignmentsInner { /** * Gets policy assignments for the resource group . * @ param resourceGroupName The name of the resource group that contains policy assignments . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; PolicyAssignmentInner & gt ; object */ public Observable < Page < PolicyAssignmentInner > > listByResourceGroupAsync ( final String resourceGroupName ) { } }
return listByResourceGroupWithServiceResponseAsync ( resourceGroupName ) . map ( new Func1 < ServiceResponse < Page < PolicyAssignmentInner > > , Page < PolicyAssignmentInner > > ( ) { @ Override public Page < PolicyAssignmentInner > call ( ServiceResponse < Page < PolicyAssignmentInner > > response ) { return response . body ( ) ; } } ) ;
public class AbstractRoxConfigurableClientMojo { /** * Clean the ROX configuration files * @ throws MojoExecutionException Throws when error occurred in the clean plugin */ @ Override protected void cleanup ( ) throws MojoExecutionException { } }
if ( verbose ) { getLog ( ) . info ( "Clean the rox configuration files" ) ; } if ( roxActive ) { // Cleanup the rox configuration files useCleanPlugin ( element ( "filesets" , element ( "fileset" , element ( "directory" , getWorkingDirectory ( ) . getAbsolutePath ( ) ) , element ( "followSymlinks" , "false" ) , element ( "includes" , element ( "include" , ROX_PROPERTIES_FILENAME ) // Clean ROX configuration file ) ) ) ) ; }
public class GroupTypeMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GroupType groupType , ProtocolMarshaller protocolMarshaller ) { } }
if ( groupType == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( groupType . getGroupName ( ) , GROUPNAME_BINDING ) ; protocolMarshaller . marshall ( groupType . getUserPoolId ( ) , USERPOOLID_BINDING ) ; protocolMarshaller . marshall ( groupType . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( groupType . getRoleArn ( ) , ROLEARN_BINDING ) ; protocolMarshaller . marshall ( groupType . getPrecedence ( ) , PRECEDENCE_BINDING ) ; protocolMarshaller . marshall ( groupType . getLastModifiedDate ( ) , LASTMODIFIEDDATE_BINDING ) ; protocolMarshaller . marshall ( groupType . getCreationDate ( ) , CREATIONDATE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class SeleniumSelectField { /** * { @ inheritDoc } If the option text passed contains " submit : : " in the string , * the submit value is searched , not the text inside of the option . */ @ Override public final void select ( final String optionText ) { } }
if ( optionText . contains ( "submit::" ) ) { String value = optionText . split ( "::" ) [ 1 ] ; select ( Type . VALUE , value ) ; } else { select ( Type . TEXT , optionText ) ; }
public class DataModelSerializer { /** * A little utility to convert from Type to Class . < br > * The method is only complete enough for the usage within this class , it won ' t handle [ ] arrays , or primitive types , etc . * @ param t the Type to return a Class for , if the Type is parameterized , the actual type is returned ( eg , List < String > returns String ) * @ return */ private static Class < ? > getClassForType ( Type t ) { } }
if ( t instanceof Class ) { return ( Class < ? > ) t ; } else if ( t instanceof ParameterizedType ) { ParameterizedType pt = ( ParameterizedType ) t ; return getClassForType ( pt . getActualTypeArguments ( ) [ 0 ] ) ; } else if ( t instanceof GenericArrayType ) { throw new IllegalStateException ( "Data Model Error: Simple deserializer does not handle arrays, please use Collection instead." ) ; } throw new IllegalStateException ( "Data Model Error: Unknown type " + t . toString ( ) + "." ) ;
public class JSDocInfoBuilder { /** * Records a type transformation expression together with its template * type name . */ public boolean recordTypeTransformation ( String name , Node expr ) { } }
if ( currentInfo . declareTypeTransformation ( name , expr ) ) { populated = true ; return true ; } else { return false ; }
public class HttpSupport { /** * Convenience method for downloading files . This method will force the browser to find a handler ( external program ) * for this file ( content type ) and will provide a name of file to the browser . This method sets an HTTP header * " Content - Disposition " based on a file name . * @ param file file to download . * @ param delete true to delete the file after processing * @ return builder instance . * @ throws FileNotFoundException thrown if file not found . */ protected HttpBuilder sendFile ( File file , boolean delete ) throws FileNotFoundException { } }
try { FileResponse resp = new FileResponse ( file , delete ) ; RequestContext . setControllerResponse ( resp ) ; HttpBuilder builder = new HttpBuilder ( resp ) ; builder . header ( "Content-Disposition" , "attachment; filename=" + file . getName ( ) ) ; return builder ; } catch ( Exception e ) { throw new ControllerException ( e ) ; }
public class SpecParser { /** * to add special logic to detect this case . */ private boolean constructorMayHaveBeenAddedByCompiler ( ConstructorNode constructor ) { } }
Parameter [ ] params = constructor . getParameters ( ) ; Statement firstStat = constructor . getFirstStatement ( ) ; return AstUtil . isJointCompiled ( spec . getAst ( ) ) && constructor . isPublic ( ) && params != null && params . length == 0 && firstStat == null ;
public class VertxActivation { /** * Start the activation * @ throws ResourceException * Thrown if an error occurs */ public void start ( ) throws ResourceException { } }
if ( ! deliveryActive . get ( ) ) { VertxPlatformFactory . instance ( ) . getOrCreateVertx ( config , this ) ; VertxPlatformFactory . instance ( ) . addVertxHolder ( this ) ; } setup ( ) ;
public class TakeScreenshotOnFailureRule { /** * Saves the actual screenshot without interrupting the running of the * tests . It will log an error if unable to store take the screenshot . * @ param file * the file that will store the screenshot */ private void silentlySaveScreenshotTo ( final File file ) { } }
try { saveScreenshotTo ( file ) ; LOG . info ( "Screenshot saved: " + file . getAbsolutePath ( ) ) ; } catch ( Exception e ) { LOG . warn ( "Error while taking screenshot " + file . getName ( ) + ": " + e ) ; }
public class SolutionListUtils { /** * Finds the index of the best solution in the list according to a comparator * @ param solutionList * @ param comparator * @ return The index of the best solution */ public static < S > int findIndexOfBestSolution ( List < S > solutionList , Comparator < S > comparator ) { } }
if ( solutionList == null ) { throw new NullSolutionListException ( ) ; } else if ( solutionList . isEmpty ( ) ) { throw new EmptySolutionListException ( ) ; } else if ( comparator == null ) { throw new JMetalException ( "The comparator is null" ) ; } int index = 0 ; S bestKnown = solutionList . get ( 0 ) ; S candidateSolution ; int flag ; for ( int i = 1 ; i < solutionList . size ( ) ; i ++ ) { candidateSolution = solutionList . get ( i ) ; flag = comparator . compare ( bestKnown , candidateSolution ) ; if ( flag == 1 ) { index = i ; bestKnown = candidateSolution ; } } return index ;
public class CClassNode { /** * onig _ is _ code _ in _ cc */ public boolean isCodeInCC ( Encoding enc , int code ) { } }
int len ; if ( enc . minLength ( ) > 1 ) { len = 2 ; } else { len = enc . codeToMbcLength ( code ) ; } return isCodeInCCLength ( len , code ) ;
public class AWSOpsWorksClient { /** * Deletes a user profile . * < b > Required Permissions < / b > : To use this action , an IAM user must have an attached policy that explicitly grants * permissions . For more information about user permissions , see < a * href = " http : / / docs . aws . amazon . com / opsworks / latest / userguide / opsworks - security - users . html " > Managing User * Permissions < / a > . * @ param deleteUserProfileRequest * @ return Result of the DeleteUserProfile operation returned by the service . * @ throws ValidationException * Indicates that a request was not valid . * @ throws ResourceNotFoundException * Indicates that a resource was not found . * @ sample AWSOpsWorks . DeleteUserProfile * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / opsworks - 2013-02-18 / DeleteUserProfile " target = " _ top " > AWS API * Documentation < / a > */ @ Override public DeleteUserProfileResult deleteUserProfile ( DeleteUserProfileRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDeleteUserProfile ( request ) ;
public class BugInstance { /** * Add a method annotation . If this is the first method annotation added , it * becomes the primary method annotation . * @ param className * name of the class containing the method * @ param methodName * name of the method * @ param methodSig * type signature of the method * @ param accessFlags * accessFlags for the method * @ return this object */ @ Nonnull public BugInstance addMethod ( @ SlashedClassName String className , String methodName , String methodSig , int accessFlags ) { } }
addMethod ( MethodAnnotation . fromForeignMethod ( className , methodName , methodSig , accessFlags ) ) ; return this ;
public class SequenceRenderer { /** * Get the transform associated to the filter keeping screen scale independent . * @ return The associated transform instance . */ private Transform getTransform ( ) { } }
final Resolution output = config . getOutput ( ) ; final double scaleX = output . getWidth ( ) / ( double ) source . getWidth ( ) ; final double scaleY = output . getHeight ( ) / ( double ) source . getHeight ( ) ; return filter . getTransform ( scaleX , scaleY ) ;
public class ECKey { /** * < p > Verifies the given ECDSA signature against the message bytes using the public key bytes . < / p > * < p > When using native ECDSA verification , data must be 32 bytes , and no element may be * larger than 520 bytes . < / p > * @ param data Hash of the data to verify . * @ param signature ASN . 1 encoded signature . * @ param pub The public key bytes to use . */ public static boolean verify ( byte [ ] data , ECDSASignature signature , byte [ ] pub ) { } }
if ( FAKE_SIGNATURES ) return true ; if ( Secp256k1Context . isEnabled ( ) ) { try { return NativeSecp256k1 . verify ( data , signature . encodeToDER ( ) , pub ) ; } catch ( NativeSecp256k1Util . AssertFailException e ) { log . error ( "Caught AssertFailException inside secp256k1" , e ) ; return false ; } } ECDSASigner signer = new ECDSASigner ( ) ; ECPublicKeyParameters params = new ECPublicKeyParameters ( CURVE . getCurve ( ) . decodePoint ( pub ) , CURVE ) ; signer . init ( false , params ) ; try { return signer . verifySignature ( data , signature . r , signature . s ) ; } catch ( NullPointerException e ) { // Bouncy Castle contains a bug that can cause NPEs given specially crafted signatures . Those signatures // are inherently invalid / attack sigs so we just fail them here rather than crash the thread . log . error ( "Caught NPE inside bouncy castle" , e ) ; return false ; }
public class HttpSender { /** * Helper method that sends the request of the given HTTP { @ code message } with the given configurations . * No redirections are followed ( see { @ link # followRedirections ( HttpMessage , HttpRequestConfig ) } ) . * @ param message the message that will be sent . * @ param requestConfig the request configurations . * @ throws IOException if an error occurred while sending the message or following the redirections . */ private void sendAndReceiveImpl ( HttpMessage message , HttpRequestConfig requestConfig ) throws IOException { } }
if ( log . isDebugEnabled ( ) ) { log . debug ( "Sending " + message . getRequestHeader ( ) . getMethod ( ) + " " + message . getRequestHeader ( ) . getURI ( ) ) ; } message . setTimeSentMillis ( System . currentTimeMillis ( ) ) ; try { if ( requestConfig . isNotifyListeners ( ) ) { notifyRequestListeners ( message ) ; } HttpMethodParams params = null ; if ( requestConfig . getSoTimeout ( ) != HttpRequestConfig . NO_VALUE_SET ) { params = new HttpMethodParams ( ) ; params . setSoTimeout ( requestConfig . getSoTimeout ( ) ) ; } sendAuthenticated ( message , false , params ) ; } finally { message . setTimeElapsedMillis ( ( int ) ( System . currentTimeMillis ( ) - message . getTimeSentMillis ( ) ) ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Received response after " + message . getTimeElapsedMillis ( ) + "ms for " + message . getRequestHeader ( ) . getMethod ( ) + " " + message . getRequestHeader ( ) . getURI ( ) ) ; } if ( requestConfig . isNotifyListeners ( ) ) { notifyResponseListeners ( message ) ; } }
public class Navigator { /** * Navigates to the screen on top of the back stack after the HistoryRewriter has rewritten the back stack history . * Animates the navigation according to the NavigationType parameter . * @ param historyRewriter manipulates the back stack during navigation * @ param navType controls how the new screen is displayed to the user */ public void navigate ( final HistoryRewriter historyRewriter , NavigationType navType ) { } }
navigate ( FORWARD , navType , new Runnable ( ) { @ Override public void run ( ) { historyRewriter . rewriteHistory ( backStack ) ; } } ) ;
public class ReservoirItemsUnion { /** * Union the given sketch . This method can be repeatedly called . If the given sketch is null it is * interpreted as an empty sketch . * @ param sketchIn The incoming sketch . */ public void update ( final ReservoirItemsSketch < T > sketchIn ) { } }
if ( sketchIn == null ) { return ; } final ReservoirItemsSketch < T > ris = ( sketchIn . getK ( ) <= maxK_ ? sketchIn : sketchIn . downsampledCopy ( maxK_ ) ) ; // can modify the sketch if we downsampled , otherwise may need to copy it final boolean isModifiable = ( sketchIn != ris ) ; if ( gadget_ == null ) { createNewGadget ( ris , isModifiable ) ; } else { twoWayMergeInternal ( ris , isModifiable ) ; }
public class ConnectedStreams { /** * KeyBy operation for connected data stream . Assigns keys to the elements of * input1 and input2 using keySelector1 and keySelector2. * @ param keySelector1 * The { @ link KeySelector } used for grouping the first input * @ param keySelector2 * The { @ link KeySelector } used for grouping the second input * @ return The partitioned { @ link ConnectedStreams } */ public ConnectedStreams < IN1 , IN2 > keyBy ( KeySelector < IN1 , ? > keySelector1 , KeySelector < IN2 , ? > keySelector2 ) { } }
return new ConnectedStreams < > ( environment , inputStream1 . keyBy ( keySelector1 ) , inputStream2 . keyBy ( keySelector2 ) ) ;
public class JettyHandler { /** * handle http request . * @ param target * @ param request * @ param response * @ param i * @ throws IOException * @ throws ServletException */ @ Override public void handle ( final String target , final HttpServletRequest request , final HttpServletResponse response , final int i ) throws IOException , ServletException { } }
LOG . log ( Level . INFO , "JettyHandler handle is entered with target: {0} " , target ) ; final Request baseRequest = ( request instanceof Request ) ? ( Request ) request : HttpConnection . getCurrentConnection ( ) . getRequest ( ) ; response . setContentType ( "text/html;charset=utf-8" ) ; final ParsedHttpRequest parsedHttpRequest = new ParsedHttpRequest ( request ) ; final HttpHandler handler = validate ( request , response , parsedHttpRequest ) ; if ( handler != null ) { LOG . log ( Level . INFO , "calling HttpHandler.onHttpRequest from JettyHandler.handle() for {0}." , handler . getUriSpecification ( ) ) ; handler . onHttpRequest ( parsedHttpRequest , response ) ; response . setStatus ( HttpServletResponse . SC_OK ) ; } baseRequest . setHandled ( true ) ; LOG . log ( Level . INFO , "JettyHandler handle exists" ) ;
public class AbstractStreamEx { /** * Returns a stream consisting of all elements from this stream starting * from the first element which does not match the given predicate . If the * predicate is true for all stream elements , an empty stream is returned . * This is a stateful operation . It can be either < a * href = " package - summary . html # StreamOps " > intermediate or * quasi - intermediate < / a > . When using with JDK 1.9 or higher it calls the * corresponding JDK 1.9 implementation . When using with JDK 1.8 it uses own * implementation . * While this operation is quite cheap for sequential stream , it can be * quite expensive on parallel pipelines . Using unordered source or making it * explicitly unordered with { @ link # unordered ( ) } call may improve the parallel * processing performance if semantics permit . * @ param predicate a non - interfering , stateless predicate to apply to * elements . * @ return the new stream . * @ since 0.3.6 */ public S dropWhile ( Predicate < ? super T > predicate ) { } }
Objects . requireNonNull ( predicate ) ; return VER_SPEC . callWhile ( this , predicate , true ) ;
public class CFTree { /** * Rebuild the CFTree to condense it to approximately half the size . */ protected void rebuildTree ( ) { } }
final int dim = root . getDimensionality ( ) ; double t = estimateThreshold ( root ) / leaves ; t *= t ; // Never decrease the threshold . thresholdsq = t > thresholdsq ? t : thresholdsq ; LOG . debug ( "New squared threshold: " + thresholdsq ) ; LeafIterator iter = new LeafIterator ( root ) ; // Will keep the old root . assert ( iter . valid ( ) ) ; ClusteringFeature first = iter . get ( ) ; leaves = 0 ; // Make a new root node : root = new TreeNode ( dim , capacity ) ; root . children [ 0 ] = first ; root . addToStatistics ( first ) ; ++ leaves ; for ( iter . advance ( ) ; iter . valid ( ) ; iter . advance ( ) ) { TreeNode other = insert ( root , iter . get ( ) ) ; // Handle root overflow : if ( other != null ) { TreeNode newnode = new TreeNode ( dim , capacity ) ; newnode . addToStatistics ( newnode . children [ 0 ] = root ) ; newnode . addToStatistics ( newnode . children [ 1 ] = other ) ; root = newnode ; } }
public class ControlFactory { /** * Returns a new { @ link FieldControl } instance . The element passed either has to be of type * { @ link XMLTags # FIELD } or { @ link XMLTags # FIELD _ REF } or at least contain one of these tags . */ public FieldControl getControl ( final MathRandom random , Element element , final Range range ) { } }
if ( finder == null ) { finder = new XmlElementFinder ( element . getDocument ( ) ) ; } Element fieldElement = element . getChild ( XMLTags . FIELD ) ; if ( fieldElement != null ) { element = fieldElement ; } else { fieldElement = element . getChild ( XMLTags . FIELD_REF ) ; if ( fieldElement != null ) { element = finder . findElementById ( fieldElement ) ; } else if ( XMLTags . FIELD_REF . equals ( element . getName ( ) ) ) { // search for original field element element = finder . findElementById ( element ) ; } } element = element . getChild ( XMLTags . CONTROL_REF ) ; element = finder . findElementById ( element ) ; if ( element == null ) { throw new IllegalStateException ( "Could not find control object" ) ; } String className = null ; Class < ? extends FieldControl > classObject = null ; try { className = element . getAttributeValue ( XMLTags . CLASS ) ; className = className . indexOf ( '.' ) > 0 ? className : getClass ( ) . getPackage ( ) . getName ( ) + '.' + className ; classObject = Class . forName ( className ) . asSubclass ( FieldControl . class ) ; } catch ( ClassNotFoundException e ) { throw new IllegalStateException ( "Could not load class " + className , e ) ; } Constructor < ? extends FieldControl > constructor = null ; try { constructor = classObject . getConstructor ( new Class [ ] { MathRandom . class , Element . class , Range . class } ) ; } catch ( NoSuchMethodException e ) { throw new IllegalStateException ( "Could not find constructor for class " + className , e ) ; } try { return constructor . newInstance ( new Object [ ] { random , element , range } ) ; } catch ( Exception e ) { throw new IllegalStateException ( "Could not call constructor for class " + className , e ) ; }
public class EventConsumer { /** * Gets the type parameter of the expected generic interface which is * actually used by the class of the given object . The generic * interface can be implemented by an class or interface in the object ' s * class hierarchy , * @ param object The object * @ param expectedType The expected generic interface * @ return The actually used parameter of the expected generic interface */ @ SuppressWarnings ( "unchecked" ) static Class < ? > getParameterType ( Object object , Class < ? > expectedType ) { } }
Collection < Class < ? > > extendedAndImplementedTypes = getExtendedAndImplementedTypes ( object . getClass ( ) , new LinkedList < Class < ? > > ( ) ) ; for ( Class < ? > type : extendedAndImplementedTypes ) { Type [ ] implementedInterfaces = type . getGenericInterfaces ( ) ; for ( Type implementedInterface : implementedInterfaces ) { if ( implementedInterface instanceof ParameterizedType ) { ParameterizedType parameterizedCandidateType = ( ParameterizedType ) implementedInterface ; if ( parameterizedCandidateType . getRawType ( ) . equals ( expectedType ) ) { Type [ ] typeArguments = parameterizedCandidateType . getActualTypeArguments ( ) ; Type typeArgument ; if ( typeArguments . length == 0 ) { typeArgument = Object . class ; } else { typeArgument = parameterizedCandidateType . getActualTypeArguments ( ) [ 0 ] ; } return ( Class < ? > ) typeArgument ; } } } } // This may never happen in case the caller checked if object instanceof expectedType throw new RuntimeException ( "Expected type " + expectedType + " is not in class hierarchy of " + object . getClass ( ) ) ;
public class JdbcDatabase { /** * Check out this error , see if it matches . * Note : This is not very efficient code , but error should not happen that often . * @ param ex exception thrown . * @ param iErrorType see if error matches . * @ param strErrorText String to match in the error string ( must be lower case ) . * @ return true if file was not found and was successfully created . */ public boolean checkForError ( Exception ex , int iErrorType , String strErrorText , String strErrorCode ) { } }
boolean bFound = false ; String strError = ex . getMessage ( ) ; if ( strError != null ) strError = strError . toLowerCase ( ) ; if ( iErrorType == DBConstants . FILE_NOT_FOUND ) { if ( strError != null ) if ( strError . indexOf ( "table" ) != - 1 ) if ( strError . indexOf ( "not" ) != - 1 ) if ( ( strError . indexOf ( "found" ) != - 1 ) || ( strError . indexOf ( "find" ) != - 1 ) ) bFound = true ; } if ( iErrorType == DBConstants . DUPLICATE_KEY ) { if ( strError != null ) if ( ( strError . indexOf ( "duplicate" ) != - 1 ) || ( strError . indexOf ( "already exists" ) != - 1 ) ) bFound = true ; } if ( iErrorType == DBConstants . DUPLICATE_COUNTER ) { if ( strError != null ) if ( ( strError . indexOf ( "duplicate" ) != - 1 ) || ( strError . indexOf ( "already exists" ) != - 1 ) ) if ( ( strError . indexOf ( "key 1" ) != - 1 ) || ( strError . indexOf ( "primary" ) != - 1 ) || ( strError . indexOf ( "id" ) != - 1 ) ) bFound = true ; } if ( iErrorType == DBConstants . BROKEN_PIPE ) { if ( strError != null ) if ( ( strError . indexOf ( "timeout" ) != - 1 ) || ( strError . indexOf ( "time-out" ) != - 1 ) || ( strError . indexOf ( "time out" ) != - 1 ) || ( ( strError . indexOf ( "communication" ) != - 1 ) || ( strError . indexOf ( "link" ) != - 1 ) || ( strError . indexOf ( "connection" ) != - 1 ) && ( ( strError . indexOf ( "failure" ) != - 1 ) || ( strError . indexOf ( "lost" ) != - 1 ) ) ) || ( strError . indexOf ( "broken" ) != - 1 ) ) bFound = true ; } if ( ! bFound ) if ( ( strErrorText != null ) && ( strErrorText . length ( ) > 0 ) ) if ( strError != null ) if ( strError . indexOf ( strErrorText ) != - 1 ) bFound = true ; if ( ! bFound ) if ( ( strErrorCode != null ) && ( strErrorCode . length ( ) > 0 ) ) { int iErrorCode = Integer . parseInt ( strErrorCode ) ; if ( ex instanceof SQLException ) if ( ( ( SQLException ) ex ) . getErrorCode ( ) == iErrorCode ) bFound = true ; } return bFound ;
public class MACPacketImpl { /** * Creates a new { @ link MACPacketImpl } and it assumes ethernet II and it * does not check whether or not the ethertype is a known type . This method * should only be used by the internal packet creating functions such as the * { @ link TransportPacketFactoryImpl } or the framers . * @ param parent * @ param headers * @ return */ public static MACPacketImpl create ( final PCapPacket parent , final Buffer headers ) { } }
if ( headers . capacity ( ) < 14 ) { throw new IllegalArgumentException ( "Not enough bytes to create this header" ) ; } if ( parent == null ) { throw new IllegalArgumentException ( "The parent packet cannot be null" ) ; } return new MACPacketImpl ( Protocol . ETHERNET_II , parent , headers , null ) ;
public class TransformedCallback { /** * Create a new Callback which transforms its items according to a { @ link Function } * and then invokes the original callback . * @ param callback the callback that processes items of type B * @ param transformer the transformer that converts the item from type A to type B * @ param < A > the type of item that will be provided as input * @ param < B > the type of item processed by the provided callback */ public static < A , B > Callback < A > transform ( Callback < ? super B > callback , Function < ? super A , ? extends B > transformer ) { } }
return new TransformedCallback < A , B > ( callback , transformer ) ;
public class ChannelHelper { /** * Read length bytes from channel . * Throws EOFException if couldn ' t read length bytes because of eof . * @ param ch * @ param length * @ return * @ throws IOException */ public static final byte [ ] read ( ReadableByteChannel ch , int length ) throws IOException { } }
ByteBuffer bb = ByteBuffer . allocate ( length ) ; readAll ( ch , bb ) ; if ( bb . hasRemaining ( ) ) { throw new EOFException ( "couldn't read " + length + " bytes" ) ; } return bb . array ( ) ;
public class NotificationChannelMarshaller { /** * Marshall the given parameter object . */ public void marshall ( NotificationChannel notificationChannel , ProtocolMarshaller protocolMarshaller ) { } }
if ( notificationChannel == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( notificationChannel . getSNSTopicArn ( ) , SNSTOPICARN_BINDING ) ; protocolMarshaller . marshall ( notificationChannel . getRoleArn ( ) , ROLEARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CmsUserTable { /** * Adds given user to given IndexedContainer . < p > * @ param container to add the user to * @ param user to add */ protected void addUserToContainer ( IndexedContainer container , CmsUser user ) { } }
if ( m_blackList . contains ( user ) ) { return ; } Item item = container . addItem ( user ) ; fillItem ( item , user ) ;
public class IotHubResourcesInner { /** * Import , update , or delete device identities in the IoT hub identity registry from a blob . For more information , see : https : / / docs . microsoft . com / azure / iot - hub / iot - hub - devguide - identity - registry # import - and - export - device - identities . * Import , update , or delete device identities in the IoT hub identity registry from a blob . For more information , see : https : / / docs . microsoft . com / azure / iot - hub / iot - hub - devguide - identity - registry # import - and - export - device - identities . * @ param resourceGroupName The name of the resource group that contains the IoT hub . * @ param resourceName The name of the IoT hub . * @ param importDevicesParameters The parameters that specify the import devices operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the JobResponseInner object */ public Observable < ServiceResponse < JobResponseInner > > importDevicesWithServiceResponseAsync ( String resourceGroupName , String resourceName , ImportDevicesRequest importDevicesParameters ) { } }
if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( resourceName == null ) { throw new IllegalArgumentException ( "Parameter resourceName is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } if ( importDevicesParameters == null ) { throw new IllegalArgumentException ( "Parameter importDevicesParameters is required and cannot be null." ) ; } Validator . validate ( importDevicesParameters ) ; return service . importDevices ( this . client . subscriptionId ( ) , resourceGroupName , resourceName , this . client . apiVersion ( ) , importDevicesParameters , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < JobResponseInner > > > ( ) { @ Override public Observable < ServiceResponse < JobResponseInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < JobResponseInner > clientResponse = importDevicesDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class ClusterManager { /** * add items that were not clustered in last isClustering . */ private void addLeftItems ( ) { } }
// Log . w ( TAG , " addLeftItems ( ) { . . . . ( 0 ) " ) ; if ( leftItems . size ( ) == 0 ) { return ; } // Log . w ( TAG , " addLeftItems ( ) { . . . . ( 1 ) " ) ; ArrayList < T > currentLeftItems = new ArrayList < T > ( ) ; currentLeftItems . addAll ( leftItems ) ; // Log . w ( TAG , " addLeftItems ( ) { . . . . ( 2 ) " ) ; synchronized ( leftItems ) { // Log . w ( TAG , " addLeftItems ( ) { . . . . ( 3.1 ) " ) ; leftItems . clear ( ) ; // Log . w ( TAG , " addLeftItems ( ) { . . . . ( 3.1 ) " ) ; } // Log . w ( TAG , " addLeftItems ( ) { . . . . ( 4 ) " ) ; for ( T currentLeftItem : currentLeftItems ) { // Log . w ( TAG , " addLeftItems ( ) { . . . . ( 5.1 ) " ) ; addItem ( currentLeftItem ) ; // Log . w ( TAG , " addLeftItems ( ) { . . . . ( 5.2 ) " ) ; }
public class WebcamUpdater { /** * Start updater . */ public void start ( ) { } }
if ( running . compareAndSet ( false , true ) ) { image . set ( new WebcamGetImageTask ( Webcam . getDriver ( ) , webcam . getDevice ( ) ) . getImage ( ) ) ; executor = Executors . newSingleThreadScheduledExecutor ( THREAD_FACTORY ) ; executor . execute ( this ) ; LOG . debug ( "Webcam updater has been started" ) ; } else { LOG . debug ( "Webcam updater is already started" ) ; }
public class GrailsClassUtils { /** * Returns whether the specified class is either within one of the specified packages or * within a subpackage of one of the packages * @ param theClass The class * @ param packageList The list of packages * @ return true if it is within the list of specified packages */ public static boolean isClassBelowPackage ( Class < ? > theClass , List < ? > packageList ) { } }
String classPackage = theClass . getPackage ( ) . getName ( ) ; for ( Object packageName : packageList ) { if ( packageName != null ) { if ( classPackage . startsWith ( packageName . toString ( ) ) ) { return true ; } } } return false ;
public class JsonRuleParser { /** * 解析 * @ param jsonRule * @ return */ public Object parse ( JsonRule jsonRule ) { } }
// filter for ( IRuleFilter ruleFilter : ruleFilters ) { ruleFilter . doFilter ( jsonRule , builderType ) ; } // parse if ( jsonRule . isGroup ( ) ) { return groupParser . parse ( jsonRule , this ) ; } else { for ( IRuleParser ruleParser : ruleParsers ) { if ( ruleParser . canParse ( jsonRule ) ) { return ruleParser . parse ( jsonRule , this ) ; } } throw new ParserNotFoundException ( "Can't found rule parser for:" + jsonRule ) ; }
public class RealVoltDB { /** * Thread safe */ @ Override public void setReplicationActive ( boolean active ) { } }
if ( m_replicationActive . compareAndSet ( ! active , active ) ) { try { JSONStringer js = new JSONStringer ( ) ; js . object ( ) ; js . keySymbolValuePair ( "active" , m_replicationActive . get ( ) ) ; js . endObject ( ) ; getHostMessenger ( ) . getZK ( ) . setData ( VoltZK . replicationconfig , js . toString ( ) . getBytes ( "UTF-8" ) , - 1 ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; hostLog . error ( "Failed to write replication active state to ZK: " + e . getMessage ( ) ) ; } if ( m_producerDRGateway != null ) { m_producerDRGateway . setActive ( active ) ; } }
public class TieredBlockStore { /** * Removes a block . * @ param sessionId session id * @ param blockId block id * @ param location the source location of the block * @ throws InvalidWorkerStateException if the block to remove is a temp block * @ throws BlockDoesNotExistException if this block can not be found */ private void removeBlockInternal ( long sessionId , long blockId , BlockStoreLocation location ) throws InvalidWorkerStateException , BlockDoesNotExistException , IOException { } }
long lockId = mLockManager . lockBlock ( sessionId , blockId , BlockLockType . WRITE ) ; try { String filePath ; BlockMeta blockMeta ; try ( LockResource r = new LockResource ( mMetadataReadLock ) ) { if ( mMetaManager . hasTempBlockMeta ( blockId ) ) { throw new InvalidWorkerStateException ( ExceptionMessage . REMOVE_UNCOMMITTED_BLOCK , blockId ) ; } blockMeta = mMetaManager . getBlockMeta ( blockId ) ; filePath = blockMeta . getPath ( ) ; } if ( ! blockMeta . getBlockLocation ( ) . belongsTo ( location ) ) { throw new BlockDoesNotExistException ( ExceptionMessage . BLOCK_NOT_FOUND_AT_LOCATION , blockId , location ) ; } // Heavy IO is guarded by block lock but not metadata lock . This may throw IOException . Files . delete ( Paths . get ( filePath ) ) ; try ( LockResource r = new LockResource ( mMetadataWriteLock ) ) { mMetaManager . removeBlockMeta ( blockMeta ) ; } catch ( BlockDoesNotExistException e ) { throw Throwables . propagate ( e ) ; // we shall never reach here } } finally { mLockManager . unlockBlock ( lockId ) ; }
public class BoxApiFolder { /** * Gets a request that deletes a folder * @ param id id of folder to delete * @ return request to delete a folder */ public BoxRequestsFolder . DeleteFolder getDeleteRequest ( String id ) { } }
BoxRequestsFolder . DeleteFolder request = new BoxRequestsFolder . DeleteFolder ( id , getFolderInfoUrl ( id ) , mSession ) ; return request ;
public class DataIO { /** * Writes UTF - 8 encoded characters to the given stream , but does not write * the length . * @ param workspace temporary buffer to store characters in */ public static final void writeUTF ( DataOutput out , String str , char [ ] workspace ) throws IOException { } }
writeUTF ( out , str , 0 , str . length ( ) , workspace ) ;
public class HotdeployHttpSession { public Object getAttribute ( final String name ) { } }
assertActive ( ) ; if ( attributes . containsKey ( name ) ) { return attributes . get ( name ) ; } Object value = originalSession . getAttribute ( name ) ; if ( value instanceof SerializedObjectHolder ) { value = ( ( SerializedObjectHolder ) value ) . getDeserializedObject ( ) ; if ( value != null ) { attributes . put ( name , value ) ; } else { originalSession . removeAttribute ( name ) ; } } return value ;
public class ServerImpl { /** * Sets the nickname of the user . * @ param user The user . * @ param nickname The nickname to set . */ public void setNickname ( User user , String nickname ) { } }
nicknames . compute ( user . getId ( ) , ( key , value ) -> nickname ) ;
public class ByteArrayInput { /** * Resets the offset and the limit of the internal buffer . */ public ByteArrayInput reset ( int offset , int len ) { } }
if ( len < 0 ) throw new IllegalArgumentException ( "length cannot be negative." ) ; this . offset = offset ; this . limit = offset + len ; return this ;
public class CmsStringUtil { /** * Splits a String into substrings along the provided char delimiter and returns * the result as an Array of Substrings . < p > * @ param source the String to split * @ param delimiter the delimiter to split at * @ return the Array of splitted Substrings */ public static String [ ] splitAsArray ( String source , char delimiter ) { } }
List < String > result = splitAsList ( source , delimiter ) ; return result . toArray ( new String [ result . size ( ) ] ) ;
public class JCalValue { /** * Parses this jCal value as an object property value . * @ return the object or an empty map if not found */ public ListMultimap < String , String > asObject ( ) { } }
if ( values . isEmpty ( ) ) { return new ListMultimap < String , String > ( 0 ) ; } Map < String , JsonValue > map = values . get ( 0 ) . getObject ( ) ; if ( map == null ) { return new ListMultimap < String , String > ( 0 ) ; } ListMultimap < String , String > values = new ListMultimap < String , String > ( ) ; for ( Map . Entry < String , JsonValue > entry : map . entrySet ( ) ) { String key = entry . getKey ( ) ; JsonValue value = entry . getValue ( ) ; if ( value . isNull ( ) ) { values . put ( key , "" ) ; continue ; } Object obj = value . getValue ( ) ; if ( obj != null ) { values . put ( key , obj . toString ( ) ) ; continue ; } List < JsonValue > array = value . getArray ( ) ; if ( array != null ) { for ( JsonValue element : array ) { if ( element . isNull ( ) ) { values . put ( key , "" ) ; continue ; } obj = element . getValue ( ) ; if ( obj != null ) { values . put ( key , obj . toString ( ) ) ; } } } } return values ;
public class DTDNmTokenAttr { /** * Method called by the validator * to ask attribute to verify that the default it has ( if any ) is * valid for such type . */ @ Override public void validateDefault ( InputProblemReporter rep , boolean normalize ) throws XMLStreamException { } }
String def = validateDefaultNmToken ( rep , normalize ) ; if ( normalize ) { mDefValue . setValue ( def ) ; }
public class ExcelReader { /** * 转换标题别名 , 如果没有别名则使用原标题 , 当标题为空时 , 列号对应的字母便是header * @ param headerList 原标题列表 * @ return 转换别名列表 */ private List < String > aliasHeader ( List < Object > headerList ) { } }
final int size = headerList . size ( ) ; final ArrayList < String > result = new ArrayList < > ( size ) ; if ( CollUtil . isEmpty ( headerList ) ) { return result ; } for ( int i = 0 ; i < size ; i ++ ) { result . add ( aliasHeader ( headerList . get ( i ) , i ) ) ; } return result ;
public class GrailsASTUtils { /** * Adds the given expression as a member of the given annotation * @ param annotationNode The annotation node * @ param memberName The name of the member * @ param expression The expression */ public static void addExpressionToAnnotationMember ( AnnotationNode annotationNode , String memberName , Expression expression ) { } }
Expression exclude = annotationNode . getMember ( memberName ) ; if ( exclude instanceof ListExpression ) { ( ( ListExpression ) exclude ) . addExpression ( expression ) ; } else if ( exclude != null ) { ListExpression list = new ListExpression ( ) ; list . addExpression ( exclude ) ; list . addExpression ( expression ) ; annotationNode . setMember ( memberName , list ) ; } else { annotationNode . setMember ( memberName , expression ) ; }
public class DscConfigurationsInner { /** * Retrieve the configuration script identified by configuration name . * @ param resourceGroupName Name of an Azure Resource group . * @ param automationAccountName The name of the automation account . * @ param configurationName The configuration name . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws ErrorResponseException 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 getContent ( String resourceGroupName , String automationAccountName , String configurationName ) { } }
return getContentWithServiceResponseAsync ( resourceGroupName , automationAccountName , configurationName ) . toBlocking ( ) . single ( ) . body ( ) ;
public class AuthyUtil { /** * Validates the request information to * @ param parameters The request parameters ( all of them ) * @ param headers The headers of the request * @ param url The url of the request . * @ param apiKey the security token from the authy library * @ return true if the signature ios valid , false otherwise * @ throws UnsupportedEncodingException if the string parameters have problems with UTF - 8 encoding . */ private static boolean validateSignature ( Map < String , String > parameters , Map < String , String > headers , String method , String url , String apiKey ) throws OneTouchException , UnsupportedEncodingException { } }
if ( headers == null ) throw new OneTouchException ( "No headers sent" ) ; if ( ! headers . containsKey ( HEADER_AUTHY_SIGNATURE ) ) throw new OneTouchException ( "'SIGNATURE' is missing." ) ; if ( ! headers . containsKey ( HEADER_AUTHY_SIGNATURE_NONCE ) ) throw new OneTouchException ( "'NONCE' is missing." ) ; if ( parameters == null || parameters . isEmpty ( ) ) throw new OneTouchException ( "'PARAMS' are missing." ) ; StringBuilder sb = new StringBuilder ( headers . get ( HEADER_AUTHY_SIGNATURE_NONCE ) ) . append ( "|" ) . append ( method ) . append ( "|" ) . append ( url ) . append ( "|" ) . append ( mapToQuery ( parameters ) ) ; String signature = hmacSha ( apiKey , sb . toString ( ) ) ; // let ' s check that the Authy signature is valid return signature . equals ( headers . get ( HEADER_AUTHY_SIGNATURE ) ) ;
public class Math { /** * Returns the index of maximum value of an array . */ public static int whichMax ( float [ ] x ) { } }
float m = Float . NEGATIVE_INFINITY ; int which = 0 ; for ( int i = 0 ; i < x . length ; i ++ ) { if ( x [ i ] > m ) { m = x [ i ] ; which = i ; } } return which ;
public class NoteEditor { /** * This method is called from within the constructor to initialize the form . WARNING : Do NOT modify this code . The content of this method is always regenerated by the Form * Editor . */ @ SuppressWarnings ( "unchecked" ) // < editor - fold defaultstate = " collapsed " desc = " Generated Code " > / / GEN - BEGIN : initComponents private void initComponents ( ) { } }
jToolBar1 = new javax . swing . JToolBar ( ) ; buttonUndo = new javax . swing . JButton ( ) ; buttonRedo = new javax . swing . JButton ( ) ; buttonImport = new javax . swing . JButton ( ) ; buttonExport = new javax . swing . JButton ( ) ; buttonCopy = new javax . swing . JButton ( ) ; buttonPaste = new javax . swing . JButton ( ) ; buttonBrowse = new javax . swing . JButton ( ) ; buttonClear = new javax . swing . JButton ( ) ; jPanel1 = new javax . swing . JPanel ( ) ; labelCursorPos = new javax . swing . JLabel ( ) ; jSeparator1 = new javax . swing . JSeparator ( ) ; labelWrapMode = new javax . swing . JLabel ( ) ; filler1 = new javax . swing . Box . Filler ( new java . awt . Dimension ( 16 , 0 ) , new java . awt . Dimension ( 16 , 0 ) , new java . awt . Dimension ( 16 , 32767 ) ) ; jScrollPane2 = new javax . swing . JScrollPane ( ) ; editorPane = new javax . swing . JTextArea ( ) ; setLayout ( new java . awt . BorderLayout ( ) ) ; jToolBar1 . setFloatable ( false ) ; jToolBar1 . setRollover ( true ) ; buttonUndo . setIcon ( new javax . swing . ImageIcon ( getClass ( ) . getResource ( "/icons/undo.png" ) ) ) ; // NOI18N buttonUndo . setMnemonic ( 'u' ) ; buttonUndo . setText ( "Undo" ) ; buttonUndo . setFocusable ( false ) ; buttonUndo . setHorizontalTextPosition ( javax . swing . SwingConstants . CENTER ) ; buttonUndo . setNextFocusableComponent ( buttonRedo ) ; buttonUndo . setVerticalTextPosition ( javax . swing . SwingConstants . BOTTOM ) ; buttonUndo . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent evt ) { buttonUndoActionPerformed ( evt ) ; } } ) ; jToolBar1 . add ( buttonUndo ) ; buttonRedo . setIcon ( new javax . swing . ImageIcon ( getClass ( ) . getResource ( "/icons/redo.png" ) ) ) ; // NOI18N buttonRedo . setMnemonic ( 'r' ) ; buttonRedo . setText ( "Redo" ) ; buttonRedo . setFocusable ( false ) ; buttonRedo . setHorizontalTextPosition ( javax . swing . SwingConstants . CENTER ) ; buttonRedo . setNextFocusableComponent ( buttonImport ) ; buttonRedo . setVerticalTextPosition ( javax . swing . SwingConstants . BOTTOM ) ; buttonRedo . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent evt ) { buttonRedoActionPerformed ( evt ) ; } } ) ; jToolBar1 . add ( buttonRedo ) ; buttonImport . setIcon ( new javax . swing . ImageIcon ( getClass ( ) . getResource ( "/icons/disk16.png" ) ) ) ; // NOI18N buttonImport . setMnemonic ( 'i' ) ; buttonImport . setText ( "Import" ) ; buttonImport . setToolTipText ( "Import text content from UTF8 encoded text file" ) ; buttonImport . setFocusable ( false ) ; buttonImport . setHorizontalTextPosition ( javax . swing . SwingConstants . CENTER ) ; buttonImport . setNextFocusableComponent ( buttonExport ) ; buttonImport . setVerticalTextPosition ( javax . swing . SwingConstants . BOTTOM ) ; buttonImport . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent evt ) { buttonImportActionPerformed ( evt ) ; } } ) ; jToolBar1 . add ( buttonImport ) ; buttonExport . setIcon ( new javax . swing . ImageIcon ( getClass ( ) . getResource ( "/icons/file_save16.png" ) ) ) ; // NOI18N buttonExport . setMnemonic ( 'e' ) ; buttonExport . setText ( "Export" ) ; buttonExport . setToolTipText ( "Export text content into UTF8 encoded file" ) ; buttonExport . setFocusable ( false ) ; buttonExport . setHorizontalTextPosition ( javax . swing . SwingConstants . CENTER ) ; buttonExport . setNextFocusableComponent ( buttonCopy ) ; buttonExport . setVerticalTextPosition ( javax . swing . SwingConstants . BOTTOM ) ; buttonExport . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent evt ) { buttonExportActionPerformed ( evt ) ; } } ) ; jToolBar1 . add ( buttonExport ) ; buttonCopy . setIcon ( new javax . swing . ImageIcon ( getClass ( ) . getResource ( "/icons/page_copy16.png" ) ) ) ; // NOI18N buttonCopy . setMnemonic ( 'c' ) ; buttonCopy . setText ( "Copy" ) ; buttonCopy . setToolTipText ( "Copy selected text content into clipboard" ) ; buttonCopy . setFocusable ( false ) ; buttonCopy . setHorizontalTextPosition ( javax . swing . SwingConstants . CENTER ) ; buttonCopy . setNextFocusableComponent ( buttonPaste ) ; buttonCopy . setVerticalTextPosition ( javax . swing . SwingConstants . BOTTOM ) ; buttonCopy . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent evt ) { buttonCopyActionPerformed ( evt ) ; } } ) ; jToolBar1 . add ( buttonCopy ) ; buttonPaste . setIcon ( new javax . swing . ImageIcon ( getClass ( ) . getResource ( "/icons/paste_plain16.png" ) ) ) ; // NOI18N buttonPaste . setMnemonic ( 'p' ) ; buttonPaste . setText ( "Paste" ) ; buttonPaste . setToolTipText ( "Paste text content from clipboard into current position" ) ; buttonPaste . setFocusable ( false ) ; buttonPaste . setHorizontalTextPosition ( javax . swing . SwingConstants . CENTER ) ; buttonPaste . setNextFocusableComponent ( buttonBrowse ) ; buttonPaste . setVerticalTextPosition ( javax . swing . SwingConstants . BOTTOM ) ; buttonPaste . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent evt ) { buttonPasteActionPerformed ( evt ) ; } } ) ; jToolBar1 . add ( buttonPaste ) ; buttonBrowse . setIcon ( new javax . swing . ImageIcon ( getClass ( ) . getResource ( "/icons/link16.png" ) ) ) ; // NOI18N buttonBrowse . setMnemonic ( 'b' ) ; buttonBrowse . setText ( "Browse" ) ; buttonBrowse . setToolTipText ( "Open selected link in browser" ) ; buttonBrowse . setFocusable ( false ) ; buttonBrowse . setHorizontalTextPosition ( javax . swing . SwingConstants . CENTER ) ; buttonBrowse . setNextFocusableComponent ( buttonClear ) ; buttonBrowse . setVerticalTextPosition ( javax . swing . SwingConstants . BOTTOM ) ; buttonBrowse . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent evt ) { buttonBrowseActionPerformed ( evt ) ; } } ) ; jToolBar1 . add ( buttonBrowse ) ; buttonClear . setIcon ( new javax . swing . ImageIcon ( getClass ( ) . getResource ( "/icons/cross16.png" ) ) ) ; // NOI18N buttonClear . setMnemonic ( 'a' ) ; buttonClear . setText ( "Clear All" ) ; buttonClear . setToolTipText ( "Clear all text content" ) ; buttonClear . setFocusable ( false ) ; buttonClear . setHorizontalTextPosition ( javax . swing . SwingConstants . CENTER ) ; buttonClear . setNextFocusableComponent ( editorPane ) ; buttonClear . setVerticalTextPosition ( javax . swing . SwingConstants . BOTTOM ) ; buttonClear . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent evt ) { buttonClearActionPerformed ( evt ) ; } } ) ; jToolBar1 . add ( buttonClear ) ; add ( jToolBar1 , java . awt . BorderLayout . NORTH ) ; jPanel1 . setLayout ( new java . awt . FlowLayout ( java . awt . FlowLayout . RIGHT ) ) ; labelCursorPos . setText ( "...:..." ) ; labelCursorPos . addMouseListener ( new java . awt . event . MouseAdapter ( ) { public void mouseClicked ( java . awt . event . MouseEvent evt ) { labelCursorPosMouseClicked ( evt ) ; } } ) ; jPanel1 . add ( labelCursorPos ) ; jSeparator1 . setOrientation ( javax . swing . SwingConstants . VERTICAL ) ; jSeparator1 . setPreferredSize ( new java . awt . Dimension ( 8 , 16 ) ) ; jPanel1 . add ( jSeparator1 ) ; labelWrapMode . setText ( "..." ) ; labelWrapMode . setCursor ( new java . awt . Cursor ( java . awt . Cursor . HAND_CURSOR ) ) ; labelWrapMode . addMouseListener ( new java . awt . event . MouseAdapter ( ) { public void mouseClicked ( java . awt . event . MouseEvent evt ) { labelWrapModeMouseClicked ( evt ) ; } } ) ; jPanel1 . add ( labelWrapMode ) ; jPanel1 . add ( filler1 ) ; add ( jPanel1 , java . awt . BorderLayout . PAGE_END ) ; editorPane . setColumns ( 20 ) ; editorPane . setRows ( 5 ) ; editorPane . setNextFocusableComponent ( buttonUndo ) ; jScrollPane2 . setViewportView ( editorPane ) ; add ( jScrollPane2 , java . awt . BorderLayout . CENTER ) ;
public class GitlabAPI { /** * Updates a Project * @ param projectId The id of the project to update * @ param name The name of the project * @ param description A description for the project , null otherwise * @ param defaultBranch The branch displayed in the Gitlab UI when a user navigates to the project * @ param issuesEnabled Whether Issues should be enabled , otherwise null indicates to use GitLab default * @ param wallEnabled Whether The Wall should be enabled , otherwise null indicates to use GitLab default * @ param mergeRequestsEnabled Whether Merge Requests should be enabled , otherwise null indicates to use GitLab default * @ param wikiEnabled Whether a Wiki should be enabled , otherwise null indicates to use GitLab default * @ param snippetsEnabled Whether Snippets should be enabled , otherwise null indicates to use GitLab default * @ param visibility The visibility level of the project , otherwise null indicates to use GitLab default * @ return the Gitlab Project * @ throws IOException on gitlab api call error */ @ Deprecated public GitlabProject updateProject ( Integer projectId , String name , String description , String defaultBranch , Boolean issuesEnabled , Boolean wallEnabled , Boolean mergeRequestsEnabled , Boolean wikiEnabled , Boolean snippetsEnabled , String visibility ) throws IOException { } }
Query query = new Query ( ) . appendIf ( "name" , name ) . appendIf ( "description" , description ) . appendIf ( "default_branch" , defaultBranch ) . appendIf ( "issues_enabled" , issuesEnabled ) . appendIf ( "wall_enabled" , wallEnabled ) . appendIf ( "merge_requests_enabled" , mergeRequestsEnabled ) . appendIf ( "wiki_enabled" , wikiEnabled ) . appendIf ( "snippets_enabled" , snippetsEnabled ) . appendIf ( "visibility" , visibility ) ; String tailUrl = GitlabProject . URL + "/" + projectId + query . toString ( ) ; return retrieve ( ) . method ( PUT ) . to ( tailUrl , GitlabProject . class ) ;
public class CmsLinkManager { /** * Returns the link for the given workplace resource . * This should only be used for resources under / system or / shared . < p < * @ param cms the current OpenCms user context * @ param resourceName the resource to generate the online link for * @ param forceSecure forces the secure server prefix * @ return the link for the given resource */ public String getWorkplaceLink ( CmsObject cms , String resourceName , boolean forceSecure ) { } }
String result = substituteLinkForUnknownTarget ( cms , resourceName , forceSecure ) ; return appendServerPrefix ( cms , result , resourceName , true ) ;
public class HttpResponseHeaderDecoder { /** * Deserialize the provided headers returned from a REST API to an entity instance declared as * the model to hold ' Matching ' headers . * ' Matching ' headers are the REST API returned headers those with : * 1 . header names same as name of a properties in the entity . * 2 . header names start with value of { @ link HeaderCollection } annotation applied to the properties in the entity . * When needed , the ' header entity ' types must be declared as first generic argument of { @ link ResponseBase } returned * by java proxy method corresponding to the REST API . * e . g . * { @ code Mono < RestResponseBase < FooMetadataHeaders , Void > > getMetadata ( args ) ; } * { @ code * class FooMetadataHeaders { * String name ; * @ HeaderCollection ( " header - collection - prefix - " ) * Map < String , String > headerCollection ; * in the case of above example , this method produces an instance of FooMetadataHeaders from provided { @ headers } . * @ param headers the REST API returned headers * @ return instance of header entity type created based on provided { @ headers } , if header entity model does * not exists then return null * @ throws IOException */ private static Object deserializeHeaders ( HttpHeaders headers , SerializerAdapter serializer , HttpResponseDecodeData decodeData ) throws IOException { } }
final Type deserializedHeadersType = decodeData . headersType ( ) ; if ( deserializedHeadersType == null ) { return null ; } else { final String headersJsonString = serializer . serialize ( headers , SerializerEncoding . JSON ) ; Object deserializedHeaders = serializer . deserialize ( headersJsonString , deserializedHeadersType , SerializerEncoding . JSON ) ; final Class < ? > deserializedHeadersClass = TypeUtil . getRawClass ( deserializedHeadersType ) ; final Field [ ] declaredFields = deserializedHeadersClass . getDeclaredFields ( ) ; for ( final Field declaredField : declaredFields ) { if ( declaredField . isAnnotationPresent ( HeaderCollection . class ) ) { final Type declaredFieldType = declaredField . getGenericType ( ) ; if ( TypeUtil . isTypeOrSubTypeOf ( declaredField . getType ( ) , Map . class ) ) { final Type [ ] mapTypeArguments = TypeUtil . getTypeArguments ( declaredFieldType ) ; if ( mapTypeArguments . length == 2 && mapTypeArguments [ 0 ] == String . class && mapTypeArguments [ 1 ] == String . class ) { final HeaderCollection headerCollectionAnnotation = declaredField . getAnnotation ( HeaderCollection . class ) ; final String headerCollectionPrefix = headerCollectionAnnotation . value ( ) . toLowerCase ( Locale . ROOT ) ; final int headerCollectionPrefixLength = headerCollectionPrefix . length ( ) ; if ( headerCollectionPrefixLength > 0 ) { final Map < String , String > headerCollection = new HashMap < > ( ) ; for ( final HttpHeader header : headers ) { final String headerName = header . name ( ) ; if ( headerName . toLowerCase ( Locale . ROOT ) . startsWith ( headerCollectionPrefix ) ) { headerCollection . put ( headerName . substring ( headerCollectionPrefixLength ) , header . value ( ) ) ; } } final boolean declaredFieldAccessibleBackup = declaredField . isAccessible ( ) ; try { if ( ! declaredFieldAccessibleBackup ) { declaredField . setAccessible ( true ) ; } declaredField . set ( deserializedHeaders , headerCollection ) ; } catch ( IllegalAccessException ignored ) { } finally { if ( ! declaredFieldAccessibleBackup ) { declaredField . setAccessible ( declaredFieldAccessibleBackup ) ; } } } } } } } return deserializedHeaders ; }
public class BundlePathMappingBuilder { /** * Normalizes two paths and joins them as a single path . * @ param prefix * the path prefix * @ param path * the path * @ param generatedResource * the flag indicating if the resource has been generated * @ return the normalized path */ private String joinPaths ( String dirName , String folderName , boolean generatedResource ) { } }
return PathNormalizer . joinPaths ( dirName , folderName , generatedResource ) ;
public class HttpPredicate { /** * An alias for { @ link HttpPredicate # get } prefix ( / * * ) , useful for file system mapping . * Creates a { @ link Predicate } based on a URI template filtering . * This will listen for WebSocket Method . * @ return The new { @ link Predicate } . * @ see Predicate */ public static Predicate < HttpServerRequest > prefix ( String prefix , HttpMethod method ) { } }
Objects . requireNonNull ( prefix , "Prefix must be provided" ) ; String target = prefix . startsWith ( "/" ) ? prefix : "/" . concat ( prefix ) ; // target = target . endsWith ( " / " ) ? target : prefix . concat ( " / " ) ; return new HttpPrefixPredicate ( target , method ) ;
public class HadoopConfigLoader { /** * get the loaded Hadoop config ( or fall back to one loaded from the classpath ) . */ public org . apache . hadoop . conf . Configuration getOrLoadHadoopConfig ( ) { } }
org . apache . hadoop . conf . Configuration hadoopConfig = this . hadoopConfig ; if ( hadoopConfig == null ) { if ( flinkConfig != null ) { hadoopConfig = mirrorCertainHadoopConfig ( loadHadoopConfigFromFlink ( ) ) ; } else { LOG . warn ( "Flink configuration is not set prior to loading this configuration." + " Cannot forward configuration keys from Flink configuration." ) ; hadoopConfig = new org . apache . hadoop . conf . Configuration ( ) ; } } this . hadoopConfig = hadoopConfig ; return hadoopConfig ;
public class SqlBuilder { /** * 添加分页语句 * @ param pageRow * @ return */ public static String appendPageParams ( String sql , PageRow pageRow ) { } }
if ( null == pageRow ) { return sql ; } return Base . dialect . getPagingSql ( sql , pageRow ) ;
public class RandomIndexingContextGenerator { /** * Adds the index vector for each co - occurring word in the context . Index * vectors are permuted if { @ code permFunc } is not { @ code null } . When in read * only mode , only existing index vector are used . */ protected void addContextTerms ( SparseDoubleVector meaning , Queue < String > words , int distance ) { } }
// Iterate through the words in the context . for ( String term : words ) { if ( ! term . equals ( IteratorFactory . EMPTY_TOKEN ) ) { // If in read only mode , ignore any terms that are not already in the // index map . if ( readOnly && ! indexMap . containsKey ( term ) ) continue ; // Get the index vector for the word . TernaryVector termVector = indexMap . get ( term ) ; if ( termVector == null ) continue ; // Permute the index vector if a permutation function is provided . if ( permFunc != null ) termVector = permFunc . permute ( termVector , distance ) ; // Add the index vector and update the distance . add ( meaning , termVector ) ; ++ distance ; } }
import java . util . * ; class Main { /** * Calculates the derivative of a given polynomial . The coefficients of the polynomial are provided in an input list . * The polynomial is represented as follows - coefficients [ 0 ] + coefficients [ 1 ] * x + coefficients [ 2 ] * x ^ 2 + . . . . * Args : * coefficients ( list ) : A list of coefficients which define the polynomial . * Returns : * list : A list representing the coefficients of the derivative of the input polynomial . * Example : * > > > compute _ derivative ( [ 3 , 1 , 2 , 4 , 5 ] ) * [ 1 , 4 , 12 , 20] * > > > compute _ derivative ( [ 1 , 2 , 3 ] ) * [ 2 , 6] */ public static List < Integer > compute_derivative ( List < Integer > coefficients ) { } }
List < Integer > result = new ArrayList < > ( ) ; for ( int i = 1 ; i < coefficients . size ( ) ; i ++ ) { result . add ( i * coefficients . get ( i ) ) ; } return result ;
public class ConstantsSummaryBuilder { /** * { @ inheritDoc } * @ throws DocletException if there is a problem while building the documentation */ @ Override public void build ( ) throws DocletException { } }
if ( writer == null ) { // Doclet does not support this output . return ; } build ( layoutParser . parseXML ( ROOT ) , contentTree ) ;
public class ReplicaSettingsDescription { /** * Replica global secondary index settings for the global table . * @ param replicaGlobalSecondaryIndexSettings * Replica global secondary index settings for the global table . */ public void setReplicaGlobalSecondaryIndexSettings ( java . util . Collection < ReplicaGlobalSecondaryIndexSettingsDescription > replicaGlobalSecondaryIndexSettings ) { } }
if ( replicaGlobalSecondaryIndexSettings == null ) { this . replicaGlobalSecondaryIndexSettings = null ; return ; } this . replicaGlobalSecondaryIndexSettings = new java . util . ArrayList < ReplicaGlobalSecondaryIndexSettingsDescription > ( replicaGlobalSecondaryIndexSettings ) ;
public class StringList { /** * adds a element to the list * @ param str String Element to add */ public void add ( String str ) { } }
curr . next = new Entry ( str , Entry . NUL ) ; curr = curr . next ; count ++ ;
public class JawrWatchEventProcessor { /** * ( non - Javadoc ) * @ see java . lang . Thread # run ( ) */ @ Override public void run ( ) { } }
while ( ! stopProcessing . get ( ) ) { try { JawrWatchEvent evt = watchEvents . take ( ) ; AtomicBoolean processingBundle = bundlesHandler . isProcessingBundle ( ) ; synchronized ( processingBundle ) { // Wait until processing ends while ( processingBundle . get ( ) && ! stopProcessing . get ( ) ) { try { processingBundle . wait ( ) ; } catch ( InterruptedException e ) { LOGGER . debug ( "Thread interrupted" ) ; } } } if ( evt != null && ! stopProcessing . get ( ) ) { process ( evt ) ; } } catch ( InterruptedException e ) { LOGGER . debug ( "Thread interrupted" ) ; } } this . bundlesHandler = null ; this . watcher = null ;
public class IotHubResourcesInner { /** * Get the security metadata for an IoT hub . For more information , see : https : / / docs . microsoft . com / azure / iot - hub / iot - hub - devguide - security . * Get the security metadata for an IoT hub . For more information , see : https : / / docs . microsoft . com / azure / iot - hub / iot - hub - devguide - security . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws ErrorDetailsException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the PagedList & lt ; SharedAccessSignatureAuthorizationRuleInner & gt ; object if successful . */ public PagedList < SharedAccessSignatureAuthorizationRuleInner > listKeysNext ( final String nextPageLink ) { } }
ServiceResponse < Page < SharedAccessSignatureAuthorizationRuleInner > > response = listKeysNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) ; return new PagedList < SharedAccessSignatureAuthorizationRuleInner > ( response . body ( ) ) { @ Override public Page < SharedAccessSignatureAuthorizationRuleInner > nextPage ( String nextPageLink ) { return listKeysNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ;
public class RadarChart { /** * * * * * * Private Methods * * * * * */ private void resize ( ) { } }
double width = getWidth ( ) - getInsets ( ) . getLeft ( ) - getInsets ( ) . getRight ( ) ; double height = getHeight ( ) - getInsets ( ) . getTop ( ) - getInsets ( ) . getBottom ( ) ; size = width < height ? width : height ; if ( size > 0 ) { pane . setMaxSize ( size , size ) ; pane . relocate ( ( getWidth ( ) - size ) * 0.5 , ( getHeight ( ) - size ) * 0.5 ) ; pane . setBackground ( new Background ( new BackgroundFill ( getChartBackgroundColor ( ) , new CornerRadii ( 1024 ) , Insets . EMPTY ) ) ) ; chartCanvas . setWidth ( size ) ; chartCanvas . setHeight ( size ) ; overlayCanvas . setWidth ( size ) ; overlayCanvas . setHeight ( size ) ; redraw ( ) ; }
public class CronDescriptor { /** * Provide description for month . * @ param fields - fields to describe ; * @ return description - String */ public String describeMonth ( final Map < CronFieldName , CronField > fields ) { } }
final String description = DescriptionStrategyFactory . monthsInstance ( resourceBundle , fields . containsKey ( CronFieldName . MONTH ) ? fields . get ( CronFieldName . MONTH ) . getExpression ( ) : null ) . describe ( ) ; return addTimeExpressions ( description , resourceBundle . getString ( "month" ) , resourceBundle . getString ( "months" ) ) ;
public class CommerceRegionUtil { /** * Returns the last commerce region in the ordered set where uuid = & # 63 ; . * @ param uuid the uuid * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the last matching commerce region , or < code > null < / code > if a matching commerce region could not be found */ public static CommerceRegion fetchByUuid_Last ( String uuid , OrderByComparator < CommerceRegion > orderByComparator ) { } }
return getPersistence ( ) . fetchByUuid_Last ( uuid , orderByComparator ) ;
public class DecoratorUtils { /** * Resolves the truly underlying object in a possible chain of { @ link org . apache . gobblin . util . Decorator } . * @ param obj object to resolve . * @ return the true non - decorator underlying object . */ public static Object resolveUnderlyingObject ( Object obj ) { } }
while ( obj instanceof Decorator ) { obj = ( ( Decorator ) obj ) . getDecoratedObject ( ) ; } return obj ;
public class PrepareRoutingSubnetworks { /** * Deletes all but the largest subnetworks . */ int keepLargeNetworks ( PrepEdgeFilter filter , List < IntArrayList > components ) { } }
if ( components . size ( ) <= 1 ) return 0 ; int maxCount = - 1 ; IntIndexedContainer oldComponent = null ; int allRemoved = 0 ; BooleanEncodedValue accessEnc = filter . getAccessEnc ( ) ; EdgeExplorer explorer = ghStorage . createEdgeExplorer ( filter ) ; for ( IntArrayList component : components ) { if ( maxCount < 0 ) { maxCount = component . size ( ) ; oldComponent = component ; continue ; } int removedEdges ; if ( maxCount < component . size ( ) ) { // new biggest area found . remove old removedEdges = removeEdges ( explorer , accessEnc , oldComponent , minNetworkSize ) ; maxCount = component . size ( ) ; oldComponent = component ; } else { removedEdges = removeEdges ( explorer , accessEnc , component , minNetworkSize ) ; } allRemoved += removedEdges ; } if ( allRemoved > ghStorage . getAllEdges ( ) . length ( ) / 2 ) throw new IllegalStateException ( "Too many total edges were removed: " + allRemoved + ", all edges:" + ghStorage . getAllEdges ( ) . length ( ) ) ; return allRemoved ;
public class Ed25519FieldElement { /** * Constant - time conditional move . Well , actually it is a conditional copy . Logic is inspired by * the SUPERCOP implementation at : https : / / github . com / floodyberry / supercop / blob / master / crypto _ sign / ed25519 / ref10 / fe _ cmov . c * @ param val the other field element . * @ param b must be 0 or 1 , otherwise results are undefined . * @ return a copy of this if $ b = = 0 $ , or a copy of val if $ b = = 1 $ . */ @ Override public FieldElement cmov ( FieldElement val , int b ) { } }
org . mariadb . jdbc . internal . com . send . authentication . ed25519 . math . ed25519 . Ed25519FieldElement that = ( org . mariadb . jdbc . internal . com . send . authentication . ed25519 . math . ed25519 . Ed25519FieldElement ) val ; b = - b ; int [ ] result = new int [ 10 ] ; for ( int i = 0 ; i < 10 ; i ++ ) { result [ i ] = this . t [ i ] ; int x = this . t [ i ] ^ that . t [ i ] ; x &= b ; result [ i ] ^= x ; } return new org . mariadb . jdbc . internal . com . send . authentication . ed25519 . math . ed25519 . Ed25519FieldElement ( this . f , result ) ;
public class MwsAQCall { /** * Perform a synchronous call with error handling and back - off / retry . * @ return A MwsReader to read the response from . */ @ Override public MwsReader invoke ( ) { } }
HttpPost request = createRequest ( ) ; for ( int retryCount = 0 ; ; retryCount ++ ) { try { HttpResponse response = executeRequest ( request ) ; StatusLine statusLine = response . getStatusLine ( ) ; int status = statusLine . getStatusCode ( ) ; String message = statusLine . getReasonPhrase ( ) ; rhmd = getResponseHeaderMetadata ( response ) ; String body = getResponseBody ( response ) ; if ( status == HttpStatus . SC_OK ) { return new MwsXmlReader ( body ) ; } if ( status == HttpStatus . SC_INTERNAL_SERVER_ERROR ) { if ( pauseIfRetryNeeded ( retryCount ) ) { continue ; } } throw new MwsException ( status , message , null , null , body , rhmd ) ; } catch ( Exception e ) { throw MwsUtl . wrap ( e ) ; } finally { request . releaseConnection ( ) ; } }
public class DaylightModel { /** * Get the atomic number as an non - null integer value . Although pseudo atoms * are not considered by this model the pseudo atoms are intercepted to have * non - null atomic number ( defaults to 0 ) . * @ param atom atom to get the element from * @ return the formal charge */ private int element ( IAtom atom ) { } }
Integer element = atom . getAtomicNumber ( ) ; if ( element != null ) return element ; if ( atom instanceof IPseudoAtom ) return 0 ; throw new IllegalArgumentException ( "Aromaiticty model requires atomic numbers to be set" ) ;
public class EntryViewBase { /** * The time where the entry view starts ( not the start time of the calendar * entry ) . * @ return the start time of the view ( not of the calendar entry ) */ public final ReadOnlyObjectProperty < LocalTime > startTimeProperty ( ) { } }
if ( startTime == null ) { startTime = new ReadOnlyObjectWrapper < > ( this , "startTime" , _startTime ) ; // $ NON - NLS - 1 $ } return startTime . getReadOnlyProperty ( ) ;
public class ViewPosition { /** * Computes view position and stores it in given { @ code pos } . Note , that view should be already * attached and laid out before calling this method . * @ param pos Output position * @ param view View for which we want to get on - screen location * @ return true if view position is changed , false otherwise */ public static boolean apply ( @ NonNull ViewPosition pos , @ NonNull View view ) { } }
return pos . init ( view ) ;
public class ChartBehavior { /** * Includes the javascript that calls the Highcharts library to visualize the * chart . * @ param response the Wicket HeaderResponse * @ param options the options containing the data to display * @ param renderer the JsonRenderer responsible for rendering the options * @ param markupId the DOM ID of the chart component . */ protected void includeChartJavascript ( final IHeaderResponse response , final ChartConfiguration options , final JsonRenderer renderer , final String markupId ) { } }
String chartVarname = this . chart . getJavaScriptVarName ( ) ; String optionsVarname = markupId + "Options" ; String contextVarname = markupId + "ctx" ; String jsonOptions = renderer . toJson ( options ) ; if ( options . getOptionalJavascript ( ) == null ) { response . render ( OnDomReadyHeaderItem . forScript ( MessageFormat . format ( "var {0} = {1};" + "var {3} = document.getElementById(\"{4}\").getContext(\"2d\");" + " window.{2} = new Chart({3},{0});" , optionsVarname , jsonOptions , chartVarname , contextVarname , markupId ) ) ) ; } else { String optionalJavascript = options . getOptionalJavascript ( ) ; String replacedVariablesInOptionalJavascript = optionalJavascript . replace ( "{0}" , contextVarname ) ; response . render ( OnDomReadyHeaderItem . forScript ( MessageFormat . format ( "{5} var {0} = {1};" + "var {3} = document.getElementById(\"{4}\").getContext(\"2d\");" + " window.{2} = new Chart({3},{0});" , optionsVarname , jsonOptions , chartVarname , contextVarname , markupId , replacedVariablesInOptionalJavascript ) ) ) ; }
public class TargetHistoryTable { /** * FREEHEP added synchronized */ private synchronized void update ( final String configId , final String outputName , final String [ ] sources ) { } }
final File outputFile = new File ( this . outputDir , outputName ) ; // if output file doesn ' t exist or predates the start of the // compile step ( most likely a compilation error ) then // do not write add a history entry if ( outputFile . exists ( ) && ! CUtil . isSignificantlyBefore ( outputFile . lastModified ( ) , this . historyFile . lastModified ( ) ) ) { this . dirty = true ; this . history . remove ( outputName ) ; final SourceHistory [ ] sourceHistories = new SourceHistory [ sources . length ] ; for ( int i = 0 ; i < sources . length ; i ++ ) { final File sourceFile = new File ( sources [ i ] ) ; final long lastModified = sourceFile . lastModified ( ) ; final String relativePath = CUtil . getRelativePath ( this . outputDirPath , sourceFile ) ; sourceHistories [ i ] = new SourceHistory ( relativePath , lastModified ) ; } final TargetHistory newHistory = new TargetHistory ( configId , outputName , outputFile . lastModified ( ) , sourceHistories ) ; this . history . put ( outputName , newHistory ) ; }
public class JdbcControlImpl { /** * Set any custom type mappers specifed in the annotation for the connection . Used for mapping SQL UDTs to * java classes . * @ param typeMappers An array of TypeMapper . */ private void setTypeMappers ( TypeMapper [ ] typeMappers ) throws SQLException { } }
if ( typeMappers . length > 0 ) { Map < String , Class < ? > > mappers = _connection . getTypeMap ( ) ; for ( TypeMapper t : typeMappers ) { mappers . put ( t . UDTName ( ) , t . mapperClass ( ) ) ; } _connection . setTypeMap ( mappers ) ; }
public class MultiUserChat { /** * Bans a user from the room . An admin or owner of the room can ban users from a room . This * means that the banned user will no longer be able to join the room unless the ban has been * removed . If the banned user was present in the room then he / she will be removed from the * room and notified that he / she was banned along with the reason ( if provided ) and the bare * XMPP user ID of the user who initiated the ban . * @ param jid the bare XMPP user ID of the user to ban ( e . g . " user @ host . org " ) . * @ param reason the optional reason why the user was banned . * @ throws XMPPErrorException if an error occurs banning a user . In particular , a * 405 error can occur if a moderator or a user with an affiliation of " owner " or " admin " * was tried to be banned ( i . e . Not Allowed error ) . * @ throws NoResponseException if there was no response from the server . * @ throws NotConnectedException * @ throws InterruptedException */ public void banUser ( Jid jid , String reason ) throws XMPPErrorException , NoResponseException , NotConnectedException , InterruptedException { } }
changeAffiliationByAdmin ( jid , MUCAffiliation . outcast , reason ) ;