signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class RTMPHandshake { /** * Prepare the ciphers . * @ param sharedSecret shared secret byte sequence */ protected void initRC4Encryption ( byte [ ] sharedSecret ) { } }
log . debug ( "Shared secret: {}" , Hex . encodeHexString ( sharedSecret ) ) ; // create output cipher log . debug ( "Outgoing public key [{}]: {}" , outgoingPublicKey . length , Hex . encodeHexString ( outgoingPublicKey ) ) ; byte [ ] rc4keyOut = new byte [ 32 ] ; // digest is 32 bytes , but our key is 16 calculateHMAC_SHA256 ( outgoingPublicKey , 0 , outgoingPublicKey . length , sharedSecret , KEY_LENGTH , rc4keyOut , 0 ) ; log . debug ( "RC4 Out Key: {}" , Hex . encodeHexString ( Arrays . copyOfRange ( rc4keyOut , 0 , 16 ) ) ) ; try { cipherOut = Cipher . getInstance ( "RC4" ) ; cipherOut . init ( Cipher . ENCRYPT_MODE , new SecretKeySpec ( rc4keyOut , 0 , 16 , "RC4" ) ) ; } catch ( Exception e ) { log . warn ( "Encryption cipher creation failed" , e ) ; } // create input cipher log . debug ( "Incoming public key [{}]: {}" , incomingPublicKey . length , Hex . encodeHexString ( incomingPublicKey ) ) ; // digest is 32 bytes , but our key is 16 byte [ ] rc4keyIn = new byte [ 32 ] ; calculateHMAC_SHA256 ( incomingPublicKey , 0 , incomingPublicKey . length , sharedSecret , KEY_LENGTH , rc4keyIn , 0 ) ; log . debug ( "RC4 In Key: {}" , Hex . encodeHexString ( Arrays . copyOfRange ( rc4keyIn , 0 , 16 ) ) ) ; try { cipherIn = Cipher . getInstance ( "RC4" ) ; cipherIn . init ( Cipher . DECRYPT_MODE , new SecretKeySpec ( rc4keyIn , 0 , 16 , "RC4" ) ) ; } catch ( Exception e ) { log . warn ( "Decryption cipher creation failed" , e ) ; }
public class CXDChunk { /** * extract fp value from an ( byte ) offset */ protected final double getFValue ( int off ) { } }
if ( _valsz == 8 ) return UDP . get8d ( _mem , off + _ridsz ) ; throw H2O . unimpl ( ) ;
public class DefaultLoginWebflowConfigurer { /** * Create gateway request check decision state . * @ param flow the flow */ protected void createGatewayRequestCheckDecisionState ( final Flow flow ) { } }
createDecisionState ( flow , CasWebflowConstants . STATE_ID_GATEWAY_REQUEST_CHECK , "requestParameters.gateway != '' and requestParameters.gateway != null and flowScope.service != null" , CasWebflowConstants . STATE_ID_GATEWAY_SERVICES_MGMT_CHECK , CasWebflowConstants . STATE_ID_SERVICE_AUTHZ_CHECK ) ;
public class Context { /** * Remove an object from the list of objects registered to receive * notification of changes to a bounded property * @ see java . beans . PropertyChangeEvent * @ see # addPropertyChangeListener ( java . beans . PropertyChangeListener ) * @ param l the listener */ public final void removePropertyChangeListener ( PropertyChangeListener l ) { } }
if ( sealed ) onSealedMutation ( ) ; propertyListeners = Kit . removeListener ( propertyListeners , l ) ;
public class DescribeElasticGpusRequest { /** * The Elastic Graphics accelerator IDs . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setElasticGpuIds ( java . util . Collection ) } or { @ link # withElasticGpuIds ( java . util . Collection ) } if you want * to override the existing values . * @ param elasticGpuIds * The Elastic Graphics accelerator IDs . * @ return Returns a reference to this object so that method calls can be chained together . */ public DescribeElasticGpusRequest withElasticGpuIds ( String ... elasticGpuIds ) { } }
if ( this . elasticGpuIds == null ) { setElasticGpuIds ( new com . amazonaws . internal . SdkInternalList < String > ( elasticGpuIds . length ) ) ; } for ( String ele : elasticGpuIds ) { this . elasticGpuIds . add ( ele ) ; } return this ;
public class Ifc4FactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public IfcMedicalDeviceTypeEnum createIfcMedicalDeviceTypeEnumFromString ( EDataType eDataType , String initialValue ) { } }
IfcMedicalDeviceTypeEnum result = IfcMedicalDeviceTypeEnum . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ;
public class LegacyBehavior { /** * When executing an async job for an activity wrapped in an miBody , set the execution to the * miBody except the wrapped activity is marked as async . * Background : in < = 7.2 async jobs were created for the inner activity , although the * semantics are that they are executed before the miBody is entered */ public static void repairMultiInstanceAsyncJob ( ExecutionEntity execution ) { } }
ActivityImpl activity = execution . getActivity ( ) ; if ( ! isAsync ( activity ) && isActivityWrappedInMultiInstanceBody ( activity ) ) { execution . setActivity ( ( ActivityImpl ) activity . getFlowScope ( ) ) ; }
public class V1InstanceCreator { /** * Create a new note with a name , asset , content , and ' personal ' flag . * @ param name The initial name of the note . * @ param asset The asset this note belongs to . * @ param content The content of the note . * @ param personal True if this note is only visible to . * @ param attributes additional attributes for the Note . * @ return A newly minted Note that exists in the VersionOne system . */ public Note note ( String name , BaseAsset asset , String content , boolean personal , Map < String , Object > attributes ) { } }
Note note = new Note ( instance ) ; note . setAsset ( asset ) ; note . setName ( name ) ; note . setContent ( content ) ; note . setPersonal ( personal ) ; addAttributes ( note , attributes ) ; note . save ( ) ; return note ;
public class TregexParser { /** * pertains to this node gets passed all the way down to the Description node */ final public TregexPattern Node ( Relation r ) throws ParseException { } }
TregexPattern node ; switch ( ( jj_ntk == - 1 ) ? jj_ntk ( ) : jj_ntk ) { case 12 : jj_consume_token ( 12 ) ; node = SubNode ( r ) ; jj_consume_token ( 13 ) ; break ; case IDENTIFIER : case BLANK : case REGEX : case 14 : case 15 : case 18 : case 19 : node = ModDescription ( r ) ; break ; default : jj_la1 [ 0 ] = jj_gen ; jj_consume_token ( - 1 ) ; throw new ParseException ( ) ; } { if ( true ) return node ; } throw new Error ( "Missing return statement in function" ) ;
public class COSAPIClient { /** * Copy a single object in the bucket via a COPY operation . * @ param srcKey source object path * @ param dstKey destination object path * @ param size object size * @ throws AmazonClientException on failures inside the AWS SDK * @ throws InterruptedIOException the operation was interrupted * @ throws IOException Other IO problems */ private void copyFile ( String srcKey , String dstKey , long size ) throws IOException , InterruptedIOException , AmazonClientException { } }
LOG . debug ( "copyFile {} -> {} " , srcKey , dstKey ) ; CopyObjectRequest copyObjectRequest = new CopyObjectRequest ( mBucket , srcKey , mBucket , dstKey ) ; try { ObjectMetadata srcmd = getObjectMetadata ( srcKey ) ; if ( srcmd != null ) { copyObjectRequest . setNewObjectMetadata ( srcmd ) ; } ProgressListener progressListener = new ProgressListener ( ) { public void progressChanged ( ProgressEvent progressEvent ) { switch ( progressEvent . getEventType ( ) ) { case TRANSFER_PART_COMPLETED_EVENT : break ; default : break ; } } } ; Copy copy = transfers . copy ( copyObjectRequest ) ; copy . addProgressListener ( progressListener ) ; try { copy . waitForCopyResult ( ) ; } catch ( InterruptedException e ) { throw new InterruptedIOException ( "Interrupted copying " + srcKey + " to " + dstKey + ", cancelling" ) ; } } catch ( AmazonClientException e ) { throw translateException ( "copyFile(" + srcKey + ", " + dstKey + ")" , srcKey , e ) ; }
public class DefaultWebElementsFactory { /** * ( non - Javadoc ) * @ see * minium . web . internal . InternalWebElementsFactory # createMixin ( minium . webElements */ @ Override public T createMixin ( final Elements elems ) { } }
AbstractMixinInitializer initializer = new AbstractMixinInitializer ( ) { @ Override protected void initialize ( ) { implement ( Object . class ) . with ( elems ) ; implement ( InternalWebElements . class ) . with ( elems ) ; implement ( FreezableElements . class ) . with ( elems ) ; implement ( ExpressionWebElements . class ) . with ( elems ) ; // this way , we can use an optimized implementation for frozen // and native WebElements if ( elems instanceof BasicElements ) { implement ( BasicElements . class ) . with ( elems ) ; } } } ; return rootClass . newInstance ( MixinInitializers . combine ( initializer , baseInitializer ) ) ;
public class InitialValueFinder { /** * Gets all possible values the given variable may have after initialisation * of its class . { @ link # run ( ) } has to be invoked beforehand ! * @ return all possible values the given variable may have after * initialisation of its class . This is never { @ code null } . * @ throws IllegalStateException * if { @ code run } was not invoked before this method . */ @ Override public Set < UnknownTypeValue > find ( ) { } }
if ( ! arePossibleInitialValuesAlreadyFound ) { findPossibleInitialValues ( ) ; arePossibleInitialValuesAlreadyFound = true ; } return Collections . unmodifiableSet ( possibleInitialValues ) ;
public class tunneltrafficpolicy { /** * Use this API to fetch all the tunneltrafficpolicy resources that are configured on netscaler . */ public static tunneltrafficpolicy [ ] get ( nitro_service service , options option ) throws Exception { } }
tunneltrafficpolicy obj = new tunneltrafficpolicy ( ) ; tunneltrafficpolicy [ ] response = ( tunneltrafficpolicy [ ] ) obj . get_resources ( service , option ) ; return response ;
public class DemoShowLargeAssembly { /** * Load a specific biological assembly for a PDB entry * @ param pdbId . . the PDB ID * @ param bioAssemblyId . . the first assembly has the bioAssemblyId 1 * @ return a Structure object or null if something went wrong . */ public static Structure readStructure ( String pdbId , int bioAssemblyId ) { } }
// pre - computed files use lower case PDB IDs pdbId = pdbId . toLowerCase ( ) ; // we just need this to track where to store PDB files // this checks the PDB _ DIR property ( and uses a tmp location if not set ) AtomCache cache = new AtomCache ( ) ; cache . setUseMmCif ( true ) ; FileParsingParameters p = cache . getFileParsingParams ( ) ; // some bio assemblies are large , we want an all atom representation and avoid // switching to a Calpha - only representation for large molecules // note , this requires several GB of memory for some of the largest assemblies , such a 1MX4 p . setAtomCaThreshold ( Integer . MAX_VALUE ) ; // parse remark 350 p . setParseBioAssembly ( true ) ; // download missing files Structure structure = null ; try { structure = StructureIO . getBiologicalAssembly ( pdbId , bioAssemblyId ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return null ; } return structure ;
public class NodeBuilder { /** * copies children from copyf to the builder , up to the provided index in copyf ( exclusive ) */ private void copyChildren ( int upToChildPosition ) { } }
// ( ensureRoom isn ' t called here , as we should always be at / behind key additions ) if ( copyFromChildPosition >= upToChildPosition ) return ; int len = upToChildPosition - copyFromChildPosition ; if ( len > 0 ) { System . arraycopy ( copyFrom , getKeyEnd ( copyFrom ) + copyFromChildPosition , buildChildren , buildChildPosition , len ) ; copyFromChildPosition = upToChildPosition ; buildChildPosition += len ; }
public class LeaderBoard { /** * Create a map of information that describes how to write pipeline output to BigQuery . This map * is used to write user score sums . */ protected static Map < String , WriteToBigQuery . FieldInfo < KV < String , Integer > > > configureGlobalWindowBigQueryWrite ( ) { } }
Map < String , WriteToBigQuery . FieldInfo < KV < String , Integer > > > tableConfigure = configureBigQueryWrite ( ) ; tableConfigure . put ( "processing_time" , new WriteToBigQuery . FieldInfo < > ( "STRING" , ( c , w ) -> GameConstants . DATE_TIME_FORMATTER . print ( Instant . now ( ) ) ) ) ; return tableConfigure ;
public class RecommendationsInner { /** * Disable all recommendations for an app . * Disable all recommendations for an app . * @ param resourceGroupName Name of the resource group to which the resource belongs . * @ param siteName Name of the app . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceResponse } object if successful . */ public Observable < Void > disableAllForWebAppAsync ( String resourceGroupName , String siteName ) { } }
return disableAllForWebAppWithServiceResponseAsync ( resourceGroupName , siteName ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ;
public class GeomUtil { /** * Computes and returns the dot product of the two vectors . See { @ link * # dot ( Point , Point , Point , Point ) } for an explanation of the arguments */ public static int dot ( int v1sx , int v1sy , int v1ex , int v1ey , int v2sx , int v2sy , int v2ex , int v2ey ) { } }
return ( ( v1ex - v1sx ) * ( v2ex - v2sx ) + ( v1ey - v1sy ) * ( v2ey - v2sy ) ) ;
public class PartitionRequestQueue { /** * Adds unannounced credits from the consumer and enqueues the corresponding reader for this * consumer ( if not enqueued yet ) . * @ param receiverId The input channel id to identify the consumer . * @ param credit The unannounced credits of the consumer . */ void addCredit ( InputChannelID receiverId , int credit ) throws Exception { } }
if ( fatalError ) { return ; } NetworkSequenceViewReader reader = allReaders . get ( receiverId ) ; if ( reader != null ) { reader . addCredit ( credit ) ; enqueueAvailableReader ( reader ) ; } else { throw new IllegalStateException ( "No reader for receiverId = " + receiverId + " exists." ) ; }
public class RegisterTaskWithMaintenanceWindowRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( RegisterTaskWithMaintenanceWindowRequest registerTaskWithMaintenanceWindowRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( registerTaskWithMaintenanceWindowRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( registerTaskWithMaintenanceWindowRequest . getWindowId ( ) , WINDOWID_BINDING ) ; protocolMarshaller . marshall ( registerTaskWithMaintenanceWindowRequest . getTargets ( ) , TARGETS_BINDING ) ; protocolMarshaller . marshall ( registerTaskWithMaintenanceWindowRequest . getTaskArn ( ) , TASKARN_BINDING ) ; protocolMarshaller . marshall ( registerTaskWithMaintenanceWindowRequest . getServiceRoleArn ( ) , SERVICEROLEARN_BINDING ) ; protocolMarshaller . marshall ( registerTaskWithMaintenanceWindowRequest . getTaskType ( ) , TASKTYPE_BINDING ) ; protocolMarshaller . marshall ( registerTaskWithMaintenanceWindowRequest . getTaskParameters ( ) , TASKPARAMETERS_BINDING ) ; protocolMarshaller . marshall ( registerTaskWithMaintenanceWindowRequest . getTaskInvocationParameters ( ) , TASKINVOCATIONPARAMETERS_BINDING ) ; protocolMarshaller . marshall ( registerTaskWithMaintenanceWindowRequest . getPriority ( ) , PRIORITY_BINDING ) ; protocolMarshaller . marshall ( registerTaskWithMaintenanceWindowRequest . getMaxConcurrency ( ) , MAXCONCURRENCY_BINDING ) ; protocolMarshaller . marshall ( registerTaskWithMaintenanceWindowRequest . getMaxErrors ( ) , MAXERRORS_BINDING ) ; protocolMarshaller . marshall ( registerTaskWithMaintenanceWindowRequest . getLoggingInfo ( ) , LOGGINGINFO_BINDING ) ; protocolMarshaller . marshall ( registerTaskWithMaintenanceWindowRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( registerTaskWithMaintenanceWindowRequest . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( registerTaskWithMaintenanceWindowRequest . getClientToken ( ) , CLIENTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CProductPersistenceImpl { /** * Clears the cache for all c products . * The { @ link EntityCache } and { @ link FinderCache } are both cleared by this method . */ @ Override public void clearCache ( ) { } }
entityCache . clearCache ( CProductImpl . class ) ; finderCache . clearCache ( FINDER_CLASS_NAME_ENTITY ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ;
public class BRSImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . BRS__RS_NAME : setRSName ( RS_NAME_EDEFAULT ) ; return ; case AfplibPackage . BRS__TRIPLETS : getTriplets ( ) . clear ( ) ; return ; } super . eUnset ( featureID ) ;
public class CrawljaxRunner { /** * Reads input data from a JSON file in the output directory . */ private void readFormDataFromFile ( ) { } }
List < FormInput > formInputList = FormInputValueHelper . deserializeFormInputs ( config . getSiteDir ( ) ) ; if ( formInputList != null ) { InputSpecification inputSpecs = config . getCrawlRules ( ) . getInputSpecification ( ) ; for ( FormInput input : formInputList ) { inputSpecs . inputField ( input ) ; } }
public class TouchAction { /** * Tap on an element . * @ param tapOptions see { @ link TapOptions } . * @ return this TouchAction , for chaining . */ public T tap ( TapOptions tapOptions ) { } }
ActionParameter action = new ActionParameter ( "tap" , tapOptions ) ; parameterBuilder . add ( action ) ; return ( T ) this ;
public class DB { /** * Selects the term ids for all with the specified name . * @ param name The term name . * @ return The list of ids . * @ throws SQLException on database error . */ public Set < Long > selectTermIds ( final String name ) throws SQLException { } }
Connection conn = null ; PreparedStatement stmt = null ; ResultSet rs = null ; Set < Long > ids = Sets . newHashSetWithExpectedSize ( 4 ) ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( selectTermIdsSQL ) ; stmt . setString ( 1 , name ) ; rs = stmt . executeQuery ( ) ; while ( rs . next ( ) ) { ids . add ( rs . getLong ( 1 ) ) ; } return ids ; } finally { SQLUtil . closeQuietly ( conn , stmt , rs ) ; }
public class CompositeELResolver { /** * For a given base and property , attempts to determine whether a call to * { @ link # setValue ( ELContext , Object , Object , Object ) } will always fail . The result is obtained * by querying all component resolvers . If this resolver handles the given ( base , property ) * pair , the propertyResolved property of the ELContext object must be set to true by the * resolver , before returning . If this property is not true after this method is called , the * caller should ignore the return value . First , propertyResolved is set to false on the * provided ELContext . Next , for each component resolver in this composite : * < ol > * < li > The isReadOnly ( ) method is called , passing in the provided context , base and property . < / li > * < li > If the ELContext ' s propertyResolved flag is false then iteration continues . < / li > * < li > Otherwise , iteration stops and no more component resolvers are considered . The value * returned by isReadOnly ( ) is returned by this method . < / li > * < / ol > * If none of the component resolvers were able to perform this operation , the value false is * returned and the propertyResolved flag remains set to false . Any exception thrown by * component resolvers during the iteration is propagated to the caller of this method . * @ param context * The context of this evaluation . * @ param base * The base object to return the most general property type for , or null to enumerate * the set of top - level variables that this resolver can evaluate . * @ param property * The property or variable to return the acceptable type for . * @ return If the propertyResolved property of ELContext was set to true , then true if the * property is read - only or false if not ; otherwise undefined . * @ throws NullPointerException * if context is null * @ throws PropertyNotFoundException * if base is not null and the specified property does not exist or is not readable . * @ throws ELException * if an exception was thrown while performing the property or variable resolution . * The thrown exception must be included as the cause property of this exception , if * available . */ @ Override public boolean isReadOnly ( ELContext context , Object base , Object property ) { } }
context . setPropertyResolved ( false ) ; for ( int i = 0 , l = resolvers . size ( ) ; i < l ; i ++ ) { boolean readOnly = resolvers . get ( i ) . isReadOnly ( context , base , property ) ; if ( context . isPropertyResolved ( ) ) { return readOnly ; } } return false ;
public class FastCloner { /** * deep clones " o " . * @ param < T > * the type of " o " * @ param o * the object to be deep - cloned * @ return a deep - clone of " o " . */ public < T > T deepClone ( final T o ) { } }
if ( o == null ) { return null ; } if ( ! this . cloningEnabled ) { return o ; } if ( this . dumpClonedClasses ) { System . out . println ( "start>" + o . getClass ( ) ) ; } final Map < Object , Object > clones = new IdentityHashMap < Object , Object > ( 16 ) ; try { return cloneInternal ( o , clones ) ; } catch ( final IllegalAccessException e ) { throw new RuntimeException ( "error during cloning of " + o , e ) ; }
public class Eval { /** * Evaluates a snippet of source . * @ param userSource the source of the snippet * @ return the list of primary and update events * @ throws IllegalStateException */ List < SnippetEvent > eval ( String userSource ) throws IllegalStateException { } }
List < SnippetEvent > allEvents = new ArrayList < > ( ) ; for ( Snippet snip : sourceToSnippets ( userSource ) ) { if ( snip . kind ( ) == Kind . ERRONEOUS ) { state . maps . installSnippet ( snip ) ; allEvents . add ( new SnippetEvent ( snip , Status . NONEXISTENT , Status . REJECTED , false , null , null , null ) ) ; } else { allEvents . addAll ( declare ( snip , snip . syntheticDiags ( ) ) ) ; } } return allEvents ;
public class IntObjectHashMap { /** * Check if the tables contain an element associated with specified key * at specified index . * @ param key key to check * @ param index index to check * @ return true if an element is associated with key at index */ private boolean containsKey ( final int key , final int index ) { } }
return ( key != 0 || states [ index ] == FULL ) && keys [ index ] == key ;
public class RingBuffer { /** * Create a new single producer RingBuffer using the default wait strategy { @ link BlockingWaitStrategy } . * @ param < E > Class of the event stored in the ring buffer . * @ param factory used to create the events within the ring buffer . * @ param bufferSize number of elements to create within the ring buffer . * @ return a constructed ring buffer . * @ throws IllegalArgumentException if < code > bufferSize < / code > is less than 1 or not a power of 2 * @ see MultiProducerSequencer */ public static < E > RingBuffer < E > createSingleProducer ( EventFactory < E > factory , int bufferSize ) { } }
return createSingleProducer ( factory , bufferSize , new BlockingWaitStrategy ( ) ) ;
public class VirtualHostKeySelector { /** * Read the CN out of the cert */ private String getCertCN ( X509Certificate x509 ) throws CertificateParsingException { } }
X500Principal principal = x509 . getSubjectX500Principal ( ) ; String subjectName = principal . getName ( ) ; String [ ] fields = subjectName . split ( "," ) ; for ( String field : fields ) { if ( field . startsWith ( "CN=" ) ) { String serverName = field . substring ( 3 ) ; return serverName . toLowerCase ( ) ; } } throw new CertificateParsingException ( "Certificate CN not found" ) ;
public class ModCluster { /** * Start advertising a mcmp handler . * @ param config the mcmp handler config * @ throws IOException */ public synchronized void advertise ( MCMPConfig config ) throws IOException { } }
final MCMPConfig . AdvertiseConfig advertiseConfig = config . getAdvertiseConfig ( ) ; if ( advertiseConfig == null ) { throw new IllegalArgumentException ( "advertise not enabled" ) ; } MCMPAdvertiseTask . advertise ( container , advertiseConfig , xnioWorker ) ;
public class SwingApplication { /** * Mouse pressed mouse adapter . * @ param consumer the consumer * @ return the mouse adapter */ public static MouseAdapter mousePressed ( @ NonNull Consumer < MouseEvent > consumer ) { } }
return new MouseAdapter ( ) { @ Override public void mousePressed ( MouseEvent e ) { consumer . accept ( e ) ; super . mousePressed ( e ) ; } } ;
public class CommPortIdentifier { /** * Gets communication port identifier * @ param p - port for which identifier object is returned * @ return - port identifier object * @ throws NoSuchPortException - in case the non existing serial port found */ static public CommPortIdentifier getPortIdentifier ( CommPort p ) throws NoSuchPortException { } }
LOGGER . fine ( "CommPortIdentifier:getPortIdentifier(CommPort)" ) ; CommPortIdentifier c ; synchronized ( Sync ) { c = CommPortIndex ; while ( c != null && c . commPort != p ) { c = c . next ; } } if ( c != null ) { return ( c ) ; } LOGGER . fine ( "not found!" + p . getName ( ) ) ; throw new NoSuchPortException ( ) ;
public class TypeConverter { /** * Convert the passed source value to int * @ param aSrcValue * The source value . May be < code > null < / code > . * @ param nDefault * The default value to be returned if an error occurs during type * conversion . * @ return The converted value . * @ throws RuntimeException * If the converter itself throws an exception * @ see TypeConverterProviderBestMatch */ public static int convertToInt ( @ Nullable final Object aSrcValue , final int nDefault ) { } }
final Integer aValue = convert ( aSrcValue , Integer . class , null ) ; return aValue == null ? nDefault : aValue . intValue ( ) ;
public class Source { /** * Delves through the parboiled node tree to find comments . */ private boolean gatherComments ( org . parboiled . Node < Node > parsed ) { } }
boolean foundComments = false ; for ( org . parboiled . Node < Node > child : parsed . getChildren ( ) ) { foundComments |= gatherComments ( child ) ; } List < Comment > cmts = registeredComments . get ( parsed ) ; if ( cmts != null ) for ( Comment c : cmts ) { comments . add ( c ) ; return true ; } return foundComments ;
public class SchemaManager { /** * After addition or removal of columns and indexes all views that * reference the table should be recompiled . */ void recompileDependentObjects ( Table table ) { } }
OrderedHashSet set = getReferencingObjects ( table . getName ( ) ) ; Session session = database . sessionManager . getSysSession ( ) ; for ( int i = 0 ; i < set . size ( ) ; i ++ ) { HsqlName name = ( HsqlName ) set . get ( i ) ; switch ( name . type ) { case SchemaObject . VIEW : case SchemaObject . CONSTRAINT : case SchemaObject . ASSERTION : SchemaObject object = getSchemaObject ( name ) ; object . compile ( session ) ; break ; } } HsqlArrayList list = getAllTables ( ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { Table t = ( Table ) list . get ( i ) ; t . updateConstraintPath ( ) ; }
public class VectorPackingHeapDecorator { /** * check each rule 1.1 ( lower or upper bound ) against the bin with the maximum loadSlack * possibly filter the bound of the binLoad variable , update the heap * and continue until the rule does not apply * @ param d the dimension * @ param delta the global slack to subtract from the bound * @ param isSup is the bound the upper bound ? * @ return the number of bound updates * @ throws ContradictionException if a contradiction ( rule 1.1 ) is raised */ @ SuppressWarnings ( "squid:S3346" ) private int filterLoads ( int d , int delta , boolean isSup ) throws ContradictionException { } }
assert maxSlackBinHeap != null ; int nChanges = 0 ; if ( loadSlack ( d , maxSlackBinHeap . get ( d ) . peek ( ) ) > delta ) { do { int b = maxSlackBinHeap . get ( d ) . poll ( ) ; if ( isSup ) { p . filterLoadSup ( d , b , delta + p . loads [ d ] [ b ] . getLB ( ) ) ; } else { p . filterLoadInf ( d , b , p . loads [ d ] [ b ] . getUB ( ) - delta ) ; } assert loadSlack ( d , b ) == delta ; maxSlackBinHeap . get ( d ) . offer ( b ) ; nChanges ++ ; } while ( ! maxSlackBinHeap . get ( d ) . isEmpty ( ) && loadSlack ( d , maxSlackBinHeap . get ( d ) . peek ( ) ) > delta ) ; } return nChanges ;
public class Dag { /** * Concatenate two dags together . Join the " other " dag to " this " dag and return " this " dag . * The concatenate method ensures that all the jobs of " this " dag ( which may have multiple end nodes ) * are completed before starting any job of the " other " dag . This is done by adding each endNode of this dag , which is * not a fork node , as a parent of every startNode of the other dag . * @ param other dag to concatenate to this dag * @ param forkNodes a set of nodes from this dag which are marked as forkable nodes . Each of these nodes will be added * to the list of end nodes of the concatenated dag . Essentially , a forkable node has no dependents * in the concatenated dag . * @ return the concatenated dag */ public Dag < T > concatenate ( Dag < T > other , Set < DagNode < T > > forkNodes ) { } }
if ( other == null || other . isEmpty ( ) ) { return this ; } if ( this . isEmpty ( ) ) { return other ; } for ( DagNode node : getDependencyNodes ( forkNodes ) ) { if ( ! this . parentChildMap . containsKey ( node ) ) { this . parentChildMap . put ( node , Lists . newArrayList ( ) ) ; } for ( DagNode otherNode : other . startNodes ) { this . parentChildMap . get ( node ) . add ( otherNode ) ; otherNode . addParentNode ( node ) ; } } // Each node which is a forkable node is added to list of end nodes of the concatenated dag other . endNodes . addAll ( forkNodes ) ; this . endNodes = other . endNodes ; // Append all the entries from the other dag ' s parentChildMap to this dag ' s parentChildMap this . parentChildMap . putAll ( other . parentChildMap ) ; // If there exists a node in the other dag with no parent nodes , add it to the list of start nodes of the // concatenated dag . other . startNodes . stream ( ) . filter ( node -> other . getParents ( node ) . isEmpty ( ) ) . forEach ( node -> this . startNodes . add ( node ) ) ; this . nodes . addAll ( other . nodes ) ; return this ;
public class UserEventMessenger { /** * Send an EventMessage directly to the client specified with the user parameter . If * there is no entry in the { @ link SimpUserRegistry } for this user nothing happens . * In contrast to { @ link # sendToUser ( String , Object , String ) } this method does not * check if the receiver is subscribed to the destination . The * { @ link SimpleBrokerMessageHandler } is not involved in sending this message . * @ param topicURI the name of the topic * @ param event the payload of the { @ link EventMessage } * @ param user receiver of the EVENT message */ public void sendToUserDirect ( String topicURI , Object event , String user ) { } }
sendToUsersDirect ( topicURI , event , Collections . singleton ( user ) ) ;
public class MtasSolrComponentCollection { /** * ( non - Javadoc ) * @ see * mtas . solr . handler . component . util . MtasSolrComponent # distributedProcess ( org . * apache . solr . handler . component . ResponseBuilder , * mtas . codec . util . CodecComponent . ComponentFields ) */ @ SuppressWarnings ( "unchecked" ) public void distributedProcess ( ResponseBuilder rb , ComponentFields mtasFields ) throws IOException { } }
// System . out . println ( " collection : " + System . nanoTime ( ) + " - " // + Thread . currentThread ( ) . getId ( ) + " - " // + rb . req . getParams ( ) . getBool ( " isShard " , false ) + " DISTRIBUTEDPROCESS " // + rb . stage + " " + rb . req . getParamString ( ) ) ; NamedList < Object > mtasResponse = null ; try { mtasResponse = ( NamedList < Object > ) rb . rsp . getValues ( ) . get ( MtasSolrSearchComponent . NAME ) ; } catch ( ClassCastException e ) { log . debug ( e ) ; mtasResponse = null ; } if ( mtasResponse != null ) { if ( rb . stage == MtasSolrSearchComponent . STAGE_COLLECTION_INIT ) { // build index Map < String , MtasSolrCollectionResult > index = new HashMap < > ( ) ; ArrayList < Object > mtasResponseCollection ; try { mtasResponseCollection = ( ArrayList < Object > ) mtasResponse . get ( NAME ) ; for ( Object item : mtasResponseCollection ) { if ( item instanceof SimpleOrderedMap ) { SimpleOrderedMap < Object > itemMap = ( SimpleOrderedMap < Object > ) item ; if ( itemMap . get ( "data" ) != null && itemMap . get ( "data" ) instanceof MtasSolrCollectionResult ) { MtasSolrCollectionResult collectionItem = ( MtasSolrCollectionResult ) itemMap . get ( "data" ) ; index . put ( collectionItem . id ( ) , collectionItem ) ; } } } } catch ( ClassCastException e ) { log . debug ( e ) ; mtasResponse . remove ( NAME ) ; } // check and remove previous responses Map < String , Set < String > > createPostAfterMissingCheckResult = new HashMap < > ( ) ; for ( ShardRequest sreq : rb . finished ) { if ( sreq . params . getBool ( MtasSolrSearchComponent . PARAM_MTAS , false ) && sreq . params . getBool ( PARAM_MTAS_COLLECTION , false ) ) { for ( ShardResponse shardResponse : sreq . responses ) { NamedList < Object > solrShardResponse = shardResponse . getSolrResponse ( ) . getResponse ( ) ; try { ArrayList < SimpleOrderedMap < Object > > data = ( ArrayList < SimpleOrderedMap < Object > > ) solrShardResponse . findRecursive ( MtasSolrSearchComponent . NAME , NAME ) ; if ( data != null ) { for ( SimpleOrderedMap < Object > dataItem : data ) { if ( dataItem . get ( "data" ) != null && dataItem . get ( "data" ) instanceof MtasSolrCollectionResult ) { MtasSolrCollectionResult dataItemResult = ( MtasSolrCollectionResult ) dataItem . get ( "data" ) ; if ( index . containsKey ( dataItemResult . id ( ) ) && index . get ( dataItemResult . id ( ) ) . action ( ) . equals ( ComponentCollection . ACTION_CHECK ) ) { if ( dataItemResult . status == null ) { if ( ! createPostAfterMissingCheckResult . containsKey ( shardResponse . getShard ( ) ) ) { createPostAfterMissingCheckResult . put ( shardResponse . getShard ( ) , new HashSet < > ( ) ) ; } createPostAfterMissingCheckResult . get ( shardResponse . getShard ( ) ) . add ( dataItemResult . id ( ) ) ; } } } } data . clear ( ) ; } } catch ( ClassCastException e ) { log . debug ( e ) ; // shouldn ' t happen } } } } // construct new requests HashMap < String , ModifiableSolrParams > requestParamList = new HashMap < > ( ) ; int id = 0 ; for ( ComponentCollection componentCollection : mtasFields . collection ) { if ( componentCollection . action ( ) . equals ( ComponentCollection . ACTION_CHECK ) ) { for ( String shardAddress : rb . shards ) { if ( createPostAfterMissingCheckResult . containsKey ( shardAddress ) ) { if ( createPostAfterMissingCheckResult . get ( shardAddress ) . contains ( componentCollection . id ) ) { HashSet < String > values = searchComponent . getCollectionCache ( ) . getDataById ( componentCollection . id ) ; if ( values != null ) { ModifiableSolrParams paramsNewRequest ; if ( ! requestParamList . containsKey ( shardAddress ) ) { paramsNewRequest = new ModifiableSolrParams ( ) ; requestParamList . put ( shardAddress , paramsNewRequest ) ; } else { paramsNewRequest = requestParamList . get ( shardAddress ) ; } paramsNewRequest . add ( PARAM_MTAS_COLLECTION + "." + id + "." + NAME_MTAS_COLLECTION_KEY , componentCollection . key ) ; paramsNewRequest . add ( PARAM_MTAS_COLLECTION + "." + id + "." + NAME_MTAS_COLLECTION_ID , componentCollection . id ) ; paramsNewRequest . add ( PARAM_MTAS_COLLECTION + "." + id + "." + NAME_MTAS_COLLECTION_ACTION , ComponentCollection . ACTION_POST ) ; paramsNewRequest . add ( PARAM_MTAS_COLLECTION + "." + id + "." + NAME_MTAS_COLLECTION_POST , stringValuesToString ( values ) ) ; id ++ ; } } } } } else if ( componentCollection . action ( ) . equals ( ComponentCollection . ACTION_CREATE ) ) { if ( componentCollection . version == null ) { componentCollection . version = searchComponent . getCollectionCache ( ) . create ( componentCollection . id , componentCollection . values ( ) . size ( ) , componentCollection . values ( ) , null ) ; } if ( index . containsKey ( componentCollection . id ) ) { index . get ( componentCollection . id ) . setCreate ( searchComponent . getCollectionCache ( ) . now ( ) , searchComponent . getCollectionCache ( ) . check ( componentCollection . id ) ) ; } for ( String shardAddress : rb . shards ) { ModifiableSolrParams paramsNewRequest ; if ( ! requestParamList . containsKey ( shardAddress ) ) { paramsNewRequest = new ModifiableSolrParams ( ) ; requestParamList . put ( shardAddress , paramsNewRequest ) ; } else { paramsNewRequest = requestParamList . get ( shardAddress ) ; } paramsNewRequest . add ( PARAM_MTAS_COLLECTION + "." + id + "." + NAME_MTAS_COLLECTION_KEY , componentCollection . key ) ; paramsNewRequest . add ( PARAM_MTAS_COLLECTION + "." + id + "." + NAME_MTAS_COLLECTION_ID , componentCollection . id ) ; paramsNewRequest . add ( PARAM_MTAS_COLLECTION + "." + id + "." + NAME_MTAS_COLLECTION_ACTION , ComponentCollection . ACTION_POST ) ; paramsNewRequest . add ( PARAM_MTAS_COLLECTION + "." + id + "." + NAME_MTAS_COLLECTION_VERSION , componentCollection . version ) ; paramsNewRequest . add ( PARAM_MTAS_COLLECTION + "." + id + "." + NAME_MTAS_COLLECTION_POST , stringValuesToString ( componentCollection . values ( ) ) ) ; } } id ++ ; } // add new requests for ( Entry < String , ModifiableSolrParams > entry : requestParamList . entrySet ( ) ) { ShardRequest newSreq = new ShardRequest ( ) ; newSreq . shards = new String [ ] { entry . getKey ( ) } ; newSreq . purpose = ShardRequest . PURPOSE_PRIVATE ; newSreq . params = entry . getValue ( ) ; newSreq . params . add ( CommonParams . Q , "*" ) ; newSreq . params . add ( CommonParams . ROWS , "0" ) ; newSreq . params . add ( MtasSolrSearchComponent . PARAM_MTAS , rb . req . getOriginalParams ( ) . getParams ( MtasSolrSearchComponent . PARAM_MTAS ) ) ; newSreq . params . add ( PARAM_MTAS_COLLECTION , rb . req . getOriginalParams ( ) . getParams ( PARAM_MTAS_COLLECTION ) ) ; rb . addRequest ( searchComponent , newSreq ) ; } } else if ( rb . stage == MtasSolrSearchComponent . STAGE_COLLECTION_FINISH ) { // just rewrite ArrayList < Object > mtasResponseCollection ; try { mtasResponseCollection = ( ArrayList < Object > ) mtasResponse . get ( NAME ) ; if ( mtasResponseCollection != null ) { MtasSolrResultUtil . rewrite ( mtasResponseCollection , searchComponent ) ; } } catch ( ClassCastException e ) { log . debug ( e ) ; mtasResponse . remove ( NAME ) ; } } }
public class JCRStoreResource { /** * Gets the folder node . * @ return the folder node * @ throws EFapsException on error * @ throws RepositoryException the repository exception */ protected Node getFolderNode ( ) throws EFapsException , RepositoryException { } }
Node ret = getSession ( ) . getRootNode ( ) ; if ( getProperties ( ) . containsKey ( JCRStoreResource . PROPERTY_BASEFOLDER ) ) { if ( ret . hasNode ( getProperties ( ) . get ( JCRStoreResource . PROPERTY_BASEFOLDER ) ) ) { ret = ret . getNode ( getProperties ( ) . get ( JCRStoreResource . PROPERTY_BASEFOLDER ) ) ; } else { ret = ret . addNode ( getProperties ( ) . get ( JCRStoreResource . PROPERTY_BASEFOLDER ) , NodeType . NT_FOLDER ) ; } } final String subFolder = new DateTime ( ) . toString ( "yyyy-MM" ) ; if ( ret . hasNode ( subFolder ) ) { ret = ret . getNode ( subFolder ) ; } else { ret = ret . addNode ( subFolder , NodeType . NT_FOLDER ) ; } return ret ;
public class SoftHashSet { /** * Adds the specified element to this set if it is not already * present . * @ param obj element to be added to this set . * @ return < tt > true < / tt > if the set did not already contain the specified * element . */ public boolean add ( Object obj ) { } }
if ( obj == null ) { obj = NULL ; } Entry tab [ ] = mTable ; int hash = hashCode ( obj ) ; int index = ( hash & 0x7FFFFFFF ) % tab . length ; for ( Entry e = tab [ index ] , prev = null ; e != null ; e = e . mNext ) { Object iobj = e . get ( ) ; if ( iobj == null ) { // Clean up after a cleared Reference . if ( prev != null ) { prev . mNext = e . mNext ; } else { tab [ index ] = e . mNext ; } mCount -- ; } else if ( e . mHash == hash && obj . getClass ( ) == iobj . getClass ( ) && equals ( obj , iobj ) ) { // Already in set . return false ; } else { prev = e ; } } if ( mCount >= mThreshold ) { // Cleanup the table if the threshold is exceeded . cleanup ( ) ; } if ( mCount >= mThreshold ) { // Rehash the table if the threshold is still exceeded . rehash ( ) ; tab = mTable ; index = ( hash & 0x7FFFFFFF ) % tab . length ; } // Create a new entry . tab [ index ] = new Entry ( ( obj == NULL ? new Null ( ) : obj ) , hash , tab [ index ] ) ; mCount ++ ; return true ;
public class fis { /** * Use this API to fetch all the fis resources that are configured on netscaler . */ public static fis [ ] get ( nitro_service service ) throws Exception { } }
fis obj = new fis ( ) ; fis [ ] response = ( fis [ ] ) obj . get_resources ( service ) ; return response ;
public class VirtualNetworkLinksInner { /** * Updates a virtual network link to the specified Private DNS zone . * @ param resourceGroupName The name of the resource group . * @ param privateZoneName The name of the Private DNS zone ( without a terminating dot ) . * @ param virtualNetworkLinkName The name of the virtual network link . * @ param parameters Parameters supplied to the Update operation . * @ param ifMatch The ETag of the virtual network link to the Private DNS zone . Omit this value to always overwrite the current virtual network link . Specify the last - seen ETag value to prevent accidentally overwriting any concurrent changes . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable for the request */ public Observable < VirtualNetworkLinkInner > updateAsync ( String resourceGroupName , String privateZoneName , String virtualNetworkLinkName , VirtualNetworkLinkInner parameters , String ifMatch ) { } }
return updateWithServiceResponseAsync ( resourceGroupName , privateZoneName , virtualNetworkLinkName , parameters , ifMatch ) . map ( new Func1 < ServiceResponse < VirtualNetworkLinkInner > , VirtualNetworkLinkInner > ( ) { @ Override public VirtualNetworkLinkInner call ( ServiceResponse < VirtualNetworkLinkInner > response ) { return response . body ( ) ; } } ) ;
public class SubscriptionDefinitionImpl { /** * Returns the selector . * @ return String */ public String getSelector ( ) { } }
if ( tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getSelector" ) ; SibTr . exit ( tc , "getSelector" , selector ) ; } return selector ;
public class AWSCognitoIdentityProviderClient { /** * Set the user pool MFA configuration . * @ param setUserPoolMfaConfigRequest * @ return Result of the SetUserPoolMfaConfig operation returned by the service . * @ throws InvalidParameterException * This exception is thrown when the Amazon Cognito service encounters an invalid parameter . * @ throws TooManyRequestsException * This exception is thrown when the user has made too many requests for a given operation . * @ throws ResourceNotFoundException * This exception is thrown when the Amazon Cognito service cannot find the requested resource . * @ throws InvalidSmsRoleAccessPolicyException * This exception is returned when the role provided for SMS configuration does not have permission to * publish using Amazon SNS . * @ throws InvalidSmsRoleTrustRelationshipException * This exception is thrown when the trust relationship is invalid for the role provided for SMS * configuration . This can happen if you do not trust < b > cognito - idp . amazonaws . com < / b > or the external ID * provided in the role does not match what is provided in the SMS configuration for the user pool . * @ throws NotAuthorizedException * This exception is thrown when a user is not authorized . * @ throws InternalErrorException * This exception is thrown when Amazon Cognito encounters an internal error . * @ sample AWSCognitoIdentityProvider . SetUserPoolMfaConfig * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / cognito - idp - 2016-04-18 / SetUserPoolMfaConfig " * target = " _ top " > AWS API Documentation < / a > */ @ Override public SetUserPoolMfaConfigResult setUserPoolMfaConfig ( SetUserPoolMfaConfigRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeSetUserPoolMfaConfig ( request ) ;
public class Util { /** * Read all bytes from an InputStream into a byte array . Can be replaced with < code > Files . readAllBytes ( ) < / code > once * the code is migrated to Java 7. * @ param pInputStream the input stream * @ return the complete contents read from the input stream * @ throws IOException I / O error */ public static byte [ ] readBytes ( @ Nonnull final InputStream pInputStream ) throws IOException { } }
ByteArrayOutputStream baos = null ; BufferedInputStream bis = null ; try { baos = new ByteArrayOutputStream ( IO_BUFFER_SIZE_BYTES ) ; bis = new BufferedInputStream ( pInputStream , IO_BUFFER_SIZE_BYTES ) ; byte [ ] buffer = new byte [ IO_BUFFER_SIZE_BYTES ] ; for ( int bytesRead = bis . read ( buffer ) ; bytesRead > 0 ; bytesRead = bis . read ( buffer ) ) { baos . write ( buffer , 0 , bytesRead ) ; } } finally { closeQuietly ( bis ) ; closeQuietly ( baos ) ; } return baos . toByteArray ( ) ;
public class br_configurebandwidth5x { /** * < pre > * Use this operation to configure Repeater bandwidth of devices of version 5 . x or earlier . * < / pre > */ public static br_configurebandwidth5x configurebandwidth5x ( nitro_service client , br_configurebandwidth5x resource ) throws Exception { } }
return ( ( br_configurebandwidth5x [ ] ) resource . perform_operation ( client , "configurebandwidth5x" ) ) [ 0 ] ;
public class AbstractAuditEventMessageImpl { /** * Create and set an Event Identification block for this audit event message * @ param outcome The Event Outcome Indicator * @ param action The Event Action Code * @ param id The Event ID * @ param type The Event Type Code * @ return The Event Identification block created */ protected EventIdentificationType setEventIdentification ( RFC3881EventOutcomeCodes outcome , RFC3881EventActionCodes action , CodedValueType id , CodedValueType [ ] type , List < CodedValueType > purposesOfUse ) { } }
EventIdentificationType eventBlock = new EventIdentificationType ( ) ; eventBlock . setEventID ( id ) ; eventBlock . setEventDateTime ( TimestampUtils . getRFC3881Timestamp ( eventDateTime ) ) ; if ( ! EventUtils . isEmptyOrNull ( action ) ) { eventBlock . setEventActionCode ( action . getCode ( ) ) ; } if ( ! EventUtils . isEmptyOrNull ( outcome ) ) { eventBlock . setEventOutcomeIndicator ( outcome . getCode ( ) ) ; } if ( ! EventUtils . isEmptyOrNull ( type , true ) ) { eventBlock . getEventTypeCode ( ) . addAll ( Arrays . asList ( type ) ) ; } eventBlock . setPurposesOfUse ( purposesOfUse ) ; getAuditMessage ( ) . setEventIdentification ( eventBlock ) ; return eventBlock ;
public class AbstractCloseableConnectorResponse { /** * Implements the default close behavior */ public void close ( ) { } }
Closeable closable = getClosable ( ) ; try { LOG . closingResponse ( this ) ; closable . close ( ) ; LOG . successfullyClosedResponse ( this ) ; } catch ( IOException e ) { throw LOG . exceptionWhileClosingResponse ( e ) ; }
public class LayerManagerPanel { /** * Loops through this layer panel ' s layer / checkbox list and updates the checkbox font to indicate whether the * corresponding layer was just rendered . This method is called by a rendering listener - - see comment below . * @ param wwd the world window . */ protected void updateLayerActivity ( WorldWindow wwd ) { } }
for ( GeneralLayerPanel layerPanel : this . layerPanels ) { // The frame timestamp from the layer indicates the last frame in which it rendered something . If that // timestamp matches the current timestamp of the scene controller , then the layer rendered something // during the most recent frame . Note that this frame timestamp protocol is only in place by default // for TiledImageLayer and its subclasses . Applications could , however , implement it for the layers // they design . Long layerTimeStamp = ( Long ) layerPanel . getLayer ( ) . getValue ( AVKey . FRAME_TIMESTAMP ) ; Long frameTimeStamp = ( Long ) wwd . getSceneController ( ) . getValue ( AVKey . FRAME_TIMESTAMP ) ; if ( layerTimeStamp != null && frameTimeStamp != null && layerTimeStamp . longValue ( ) == frameTimeStamp . longValue ( ) ) { // Set the font to bold if the layer was just rendered . layerPanel . setLayerNameFont ( this . boldFont ) ; } else if ( layerPanel . getLayer ( ) instanceof TiledImageLayer ) { // Set the font to plain if the layer was not just rendered . layerPanel . setLayerNameFont ( this . plainFont ) ; } else if ( layerPanel . getLayer ( ) . isEnabled ( ) ) { // Set enabled layer types other than TiledImageLayer to bold . layerPanel . setLayerNameFont ( this . boldFont ) ; } else if ( ! layerPanel . getLayer ( ) . isEnabled ( ) ) { // Set disabled layer types other than TiledImageLayer to plain . layerPanel . setLayerNameFont ( this . plainFont ) ; } }
public class TIFFImageWriter { /** * Metadata */ @ Override public TIFFImageMetadata getDefaultImageMetadata ( final ImageTypeSpecifier imageType , final ImageWriteParam param ) { } }
return initMeta ( null , imageType , param ) ;
public class DataAdapter { /** * Transforms given binned index ( short ) from class column into a value from interval [ 0 . . N - 1] * corresponding to a particular predictor class */ public int unmapClass ( int clazz ) { } }
Col c = _c [ _c . length - 1 ] ; if ( c . _isByte ) return clazz ; else { // OK , this is not fully correct bad handle corner - cases like for example dataset uses classes only // with 0 and 3 . Our API reports that there are 4 classes but in fact there are only 2 classes . if ( clazz >= c . _binned2raw . length ) clazz = c . _binned2raw . length - 1 ; return ( int ) ( c . raw ( clazz ) - c . _min ) ; }
public class SolarEventCalculator { /** * Computes the sunset time for the given zenith at the given date . * @ param solarZenith * < code > Zenith < / code > enum corresponding to the type of sunset to compute . * @ param date * < code > Calendar < / code > object representing the date to compute the sunset for . * @ return the sunset time as a Calendar or null for no sunset . */ public Calendar computeSunsetCalendar ( Zenith solarZenith , Calendar date ) { } }
return getLocalTimeAsCalendar ( computeSolarEventTime ( solarZenith , date , false ) , date ) ;
public class KModuleDeploymentService { /** * This method is used to filter classes that are added to the { @ link DeployedUnit } . * When this method is used , only classes that are meant to be used with serialization are * added to the deployment . This feature can be used to , for example , make sure that non - serialization - compatible * classes ( such as interfaces ) , do not complicate the use of a deployment with the remote services ( REST / JMS / WS ) . * Note to other developers , it ' s possible that classpath problems may arise , because * of either classloader or lazy class resolution problems : I simply don ' t know enough about the * inner workings of the JAXB implementations ( plural ! ) to figure this out . * @ param deployedUnit The { @ link DeployedUnit } to which the classes are added . The { @ link DeployedUnit } to which the classes are added . The { @ link DeployedUnit } to which the classes are added . * @ param classToAdd The class to add to the { @ link DeployedUnit } . */ private static void filterClassesAddedToDeployedUnit ( DeployedUnit deployedUnit , Class classToAdd ) { } }
if ( classToAdd . isInterface ( ) || classToAdd . isAnnotation ( ) || classToAdd . isLocalClass ( ) || classToAdd . isMemberClass ( ) ) { return ; } boolean jaxbClass = false ; boolean remoteableClass = false ; // @ XmlRootElement and @ XmlType may be used with inheritance for ( Annotation anno : classToAdd . getAnnotations ( ) ) { if ( XmlRootElement . class . equals ( anno . annotationType ( ) ) ) { jaxbClass = true ; break ; } if ( XmlType . class . equals ( anno . annotationType ( ) ) ) { jaxbClass = true ; break ; } } // @ Remotable is not inheritable , and may not be used as such for ( Annotation anno : classToAdd . getDeclaredAnnotations ( ) ) { if ( Remotable . class . equals ( anno . annotationType ( ) ) ) { remoteableClass = true ; break ; } } if ( jaxbClass || remoteableClass ) { DeployedUnitImpl deployedUnitImpl = ( DeployedUnitImpl ) deployedUnit ; deployedUnitImpl . addClass ( classToAdd ) ; }
public class RowMarshaller { /** * Marshall the given parameter object . */ public void marshall ( Row row , ProtocolMarshaller protocolMarshaller ) { } }
if ( row == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( row . getData ( ) , DATA_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class SnorocketOWLReasoner { /** * Determines if a specific set of inferences have been precomputed . * @ param inferenceType The type of inference to check for . * @ return < code > true < / code > if the specified type of inferences have been * precomputed , otherwise < code > false < / code > . */ @ Override public boolean isPrecomputed ( InferenceType inferenceType ) { } }
if ( inferenceType . equals ( InferenceType . CLASS_HIERARCHY ) ) { return reasoner . isClassified ( ) ; } else { return false ; }
public class MQMessageUtils { /** * 将Message转换为FlatMessage * @ param message 原生message * @ return FlatMessage列表 */ public static List < FlatMessage > messageConverter ( Message message ) { } }
try { if ( message == null ) { return null ; } List < FlatMessage > flatMessages = new ArrayList < > ( ) ; List < CanalEntry . Entry > entrys = null ; if ( message . isRaw ( ) ) { List < ByteString > rawEntries = message . getRawEntries ( ) ; entrys = new ArrayList < CanalEntry . Entry > ( rawEntries . size ( ) ) ; for ( ByteString byteString : rawEntries ) { CanalEntry . Entry entry = CanalEntry . Entry . parseFrom ( byteString ) ; entrys . add ( entry ) ; } } else { entrys = message . getEntries ( ) ; } for ( CanalEntry . Entry entry : entrys ) { if ( entry . getEntryType ( ) == CanalEntry . EntryType . TRANSACTIONBEGIN || entry . getEntryType ( ) == CanalEntry . EntryType . TRANSACTIONEND ) { continue ; } CanalEntry . RowChange rowChange ; try { rowChange = CanalEntry . RowChange . parseFrom ( entry . getStoreValue ( ) ) ; } catch ( Exception e ) { throw new RuntimeException ( "ERROR ## parser of eromanga-event has an error , data:" + entry . toString ( ) , e ) ; } CanalEntry . EventType eventType = rowChange . getEventType ( ) ; FlatMessage flatMessage = new FlatMessage ( message . getId ( ) ) ; flatMessages . add ( flatMessage ) ; flatMessage . setDatabase ( entry . getHeader ( ) . getSchemaName ( ) ) ; flatMessage . setTable ( entry . getHeader ( ) . getTableName ( ) ) ; flatMessage . setIsDdl ( rowChange . getIsDdl ( ) ) ; flatMessage . setType ( eventType . toString ( ) ) ; flatMessage . setEs ( entry . getHeader ( ) . getExecuteTime ( ) ) ; flatMessage . setTs ( System . currentTimeMillis ( ) ) ; flatMessage . setSql ( rowChange . getSql ( ) ) ; if ( ! rowChange . getIsDdl ( ) ) { Map < String , Integer > sqlType = new LinkedHashMap < > ( ) ; Map < String , String > mysqlType = new LinkedHashMap < > ( ) ; List < Map < String , String > > data = new ArrayList < > ( ) ; List < Map < String , String > > old = new ArrayList < > ( ) ; Set < String > updateSet = new HashSet < > ( ) ; boolean hasInitPkNames = false ; for ( CanalEntry . RowData rowData : rowChange . getRowDatasList ( ) ) { if ( eventType != CanalEntry . EventType . INSERT && eventType != CanalEntry . EventType . UPDATE && eventType != CanalEntry . EventType . DELETE ) { continue ; } Map < String , String > row = new LinkedHashMap < > ( ) ; List < CanalEntry . Column > columns ; if ( eventType == CanalEntry . EventType . DELETE ) { columns = rowData . getBeforeColumnsList ( ) ; } else { columns = rowData . getAfterColumnsList ( ) ; } for ( CanalEntry . Column column : columns ) { if ( ! hasInitPkNames && column . getIsKey ( ) ) { flatMessage . addPkName ( column . getName ( ) ) ; } sqlType . put ( column . getName ( ) , column . getSqlType ( ) ) ; mysqlType . put ( column . getName ( ) , column . getMysqlType ( ) ) ; if ( column . getIsNull ( ) ) { row . put ( column . getName ( ) , null ) ; } else { row . put ( column . getName ( ) , column . getValue ( ) ) ; } // 获取update为true的字段 if ( column . getUpdated ( ) ) { updateSet . add ( column . getName ( ) ) ; } } hasInitPkNames = true ; if ( ! row . isEmpty ( ) ) { data . add ( row ) ; } if ( eventType == CanalEntry . EventType . UPDATE ) { Map < String , String > rowOld = new LinkedHashMap < > ( ) ; for ( CanalEntry . Column column : rowData . getBeforeColumnsList ( ) ) { if ( updateSet . contains ( column . getName ( ) ) ) { if ( column . getIsNull ( ) ) { rowOld . put ( column . getName ( ) , null ) ; } else { rowOld . put ( column . getName ( ) , column . getValue ( ) ) ; } } } // update操作将记录修改前的值 if ( ! rowOld . isEmpty ( ) ) { old . add ( rowOld ) ; } } } if ( ! sqlType . isEmpty ( ) ) { flatMessage . setSqlType ( sqlType ) ; } if ( ! mysqlType . isEmpty ( ) ) { flatMessage . setMysqlType ( mysqlType ) ; } if ( ! data . isEmpty ( ) ) { flatMessage . setData ( data ) ; } if ( ! old . isEmpty ( ) ) { flatMessage . setOld ( old ) ; } } } return flatMessages ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; }
public class UnPack200Task { /** * { @ inheritDoc } */ public void check ( JnlpDependencyConfig config ) { } }
if ( config == null ) { throw new NullPointerException ( "config can't be null" ) ; } if ( config . getArtifact ( ) == null ) { throw new NullPointerException ( "config.artifact can't be null" ) ; } if ( config . getArtifact ( ) . getFile ( ) == null ) { throw new NullPointerException ( "config.artifact.file can't be null" ) ; } if ( ! config . isPack200 ( ) ) { throw new IllegalStateException ( "Can't pack200 if config.isPack200 is false" ) ; }
public class Function { /** * Use the given arguments as the first N arguments , * then figure out the rest of the arguments by looking at parameter annotations , * then finally call { @ link # invoke } . */ Object bindAndInvoke ( Object o , StaplerRequest req , StaplerResponse rsp , Object ... headArgs ) throws IllegalAccessException , InvocationTargetException , ServletException { } }
Class [ ] types = getParameterTypes ( ) ; Annotation [ ] [ ] annotations = getParameterAnnotations ( ) ; String [ ] parameterNames = getParameterNames ( ) ; Object [ ] arguments = new Object [ types . length ] ; // fill in the first N arguments System . arraycopy ( headArgs , 0 , arguments , 0 , headArgs . length ) ; try { // find the rest of the arguments . either known types , or with annotations for ( int i = headArgs . length ; i < types . length ; i ++ ) { Class t = types [ i ] ; if ( t == StaplerRequest . class || t == HttpServletRequest . class ) { arguments [ i ] = req ; continue ; } if ( t == StaplerResponse . class || t == HttpServletResponse . class ) { arguments [ i ] = rsp ; continue ; } // if the databinding method is provided , call that Function binder = PARSE_METHODS . getUnchecked ( t ) ; if ( binder != RETURN_NULL ) { arguments [ i ] = binder . bindAndInvoke ( null , req , rsp ) ; continue ; } arguments [ i ] = AnnotationHandler . handle ( req , annotations [ i ] , i < parameterNames . length ? parameterNames [ i ] : null , t ) ; } } catch ( IllegalArgumentException e ) { throw new IllegalArgumentException ( "Failed to invoke " + getDisplayName ( ) , e ) ; } return invoke ( req , rsp , o , arguments ) ;
public class MultiMEProxyHandler { /** * Returns the neighbour for the given UUID * @ param neighbourUUID The uuid to find * @ param includeRecovered Also look for the neighbour in the recovered list * @ return The neighbour object */ public final Neighbour getNeighbour ( SIBUuid8 neighbourUUID , boolean includeRecovered ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getNeighbour" , new Object [ ] { neighbourUUID , Boolean . valueOf ( includeRecovered ) } ) ; Neighbour neighbour = _neighbours . getNeighbour ( neighbourUUID ) ; if ( ( neighbour == null ) && includeRecovered ) neighbour = _neighbours . getRecoveredNeighbour ( neighbourUUID ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getNeighbour" , neighbour ) ; return neighbour ;
public class CmsMacroResolver { /** * Returns a function which applies the macro substitution of this resolver to its argument . < p > * @ return a function performing string substitution with this resolver */ public Function < String , String > toFunction ( ) { } }
return new Function < String , String > ( ) { public String apply ( String input ) { return resolveMacros ( input ) ; } } ;
public class DBSecurityGroup { /** * Contains a list of < a > IPRange < / a > elements . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setIPRanges ( java . util . Collection ) } or { @ link # withIPRanges ( java . util . Collection ) } if you want to override * the existing values . * @ param iPRanges * Contains a list of < a > IPRange < / a > elements . * @ return Returns a reference to this object so that method calls can be chained together . */ public DBSecurityGroup withIPRanges ( IPRange ... iPRanges ) { } }
if ( this . iPRanges == null ) { setIPRanges ( new com . amazonaws . internal . SdkInternalList < IPRange > ( iPRanges . length ) ) ; } for ( IPRange ele : iPRanges ) { this . iPRanges . add ( ele ) ; } return this ;
public class StringUtils { /** * Convert a string into the set of its characters . * @ param src Source string * @ return Set of characters within the source string */ public static HashSet < Character > toCharacterSet ( String src ) { } }
int n = src . length ( ) ; HashSet < Character > res = new HashSet < > ( n ) ; for ( int i = 0 ; i < n ; i ++ ) res . add ( src . charAt ( i ) ) ; return res ; } public static Character [ ] toCharacterArray ( String src ) { return ArrayUtils . box ( src . toCharArray ( ) ) ; } public static int unhex ( String str ) { int res = 0 ; for ( char c : str . toCharArray ( ) ) { if ( ! hexCode . containsKey ( c ) ) throw new NumberFormatException ( "Not a hexademical character " + c ) ; res = ( res << 4 ) + hexCode . get ( c ) ; } return res ; } public static byte [ ] bytesOf ( CharSequence str ) { return str . toString ( ) . getBytes ( Charset . forName ( "UTF-8" ) ) ; } public static byte [ ] toBytes ( Object value ) { return bytesOf ( String . valueOf ( value ) ) ; } public static String toString ( byte [ ] bytes , int from , int length ) { return new String ( bytes , from , length , Charset . forName ( "UTF-8" ) ) ; }
public class AreaSizesBD { /** * Construct an area at the origin that has the same size as { @ code size } . * @ param size The area size * @ return An area at the origin */ public static AreaBD area ( final AreaSizeBD size ) { } }
Objects . requireNonNull ( size , "Size" ) ; return AreaBD . of ( BigDecimal . ZERO , size . sizeX ( ) , BigDecimal . ZERO , size . sizeY ( ) ) ;
public class ConfigFileReader { /** * Loads name value pairs directly from given file . . . adding them as settings * @ param file to get settings from * @ return list of settings */ public Settings load ( String file , CommandBuilder builder ) throws CommandLineException { } }
Scanner scanner = null ; try { File config = new File ( file ) ; Assert . isTrue ( config . exists ( ) , "File '" + file + "' does not exist" ) ; Assert . isFalse ( config . isDirectory ( ) , "File '" + file + "' is a directory" ) ; Assert . isTrue ( config . canRead ( ) , "File '" + file + "' cannot be read" ) ; scanner = new Scanner ( config ) ; ArrayList < String > list = new ArrayList < > ( ) ; while ( scanner . hasNextLine ( ) ) { list . add ( scanner . nextLine ( ) ) ; } return parse ( list , builder ) ; } catch ( FileNotFoundException e ) { log . error ( "File not found: " + e . getMessage ( ) ) ; throw new CommandLineException ( "File: '" + file + "', not found!" ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } }
public class ProgressWheel { /** * Parse the attributes passed to the view from the XML * @ param a the attributes to parse */ private void parseAttributes ( TypedArray a ) { } }
// We transform the default values from DIP to pixels DisplayMetrics metrics = getContext ( ) . getResources ( ) . getDisplayMetrics ( ) ; barWidth = ( int ) TypedValue . applyDimension ( TypedValue . COMPLEX_UNIT_DIP , barWidth , metrics ) ; rimWidth = ( int ) TypedValue . applyDimension ( TypedValue . COMPLEX_UNIT_DIP , rimWidth , metrics ) ; circleRadius = ( int ) TypedValue . applyDimension ( TypedValue . COMPLEX_UNIT_DIP , circleRadius , metrics ) ; circleRadius = ( int ) a . getDimension ( R . styleable . ProgressWheel_matProg_circleRadius , circleRadius ) ; fillRadius = a . getBoolean ( R . styleable . ProgressWheel_matProg_fillRadius , false ) ; barWidth = ( int ) a . getDimension ( R . styleable . ProgressWheel_matProg_barWidth , barWidth ) ; rimWidth = ( int ) a . getDimension ( R . styleable . ProgressWheel_matProg_rimWidth , rimWidth ) ; float baseSpinSpeed = a . getFloat ( R . styleable . ProgressWheel_matProg_spinSpeed , spinSpeed / 360.0f ) ; spinSpeed = baseSpinSpeed * 360 ; barSpinCycleTime = a . getInt ( R . styleable . ProgressWheel_matProg_barSpinCycleTime , ( int ) barSpinCycleTime ) ; barColor = a . getColor ( R . styleable . ProgressWheel_matProg_barColor , barColor ) ; rimColor = a . getColor ( R . styleable . ProgressWheel_matProg_rimColor , rimColor ) ; linearProgress = a . getBoolean ( R . styleable . ProgressWheel_matProg_linearProgress , false ) ; if ( a . getBoolean ( R . styleable . ProgressWheel_matProg_progressIndeterminate , false ) ) { spin ( ) ; } // Recycle a . recycle ( ) ;
public class HtmlTableRendererBase { /** * Renders the footer facet for the given < code > UIColumn < / code > . * @ param facesContext the < code > FacesContext < / code > . * @ param writer the < code > ResponseWriter < / code > . * @ param uiComponent the < code > UIComponent < / code > to render the facet for . * @ param facet the < code > UIComponent < / code > to render as facet . * @ param footerStyleClass the styleClass of the footer facet . * @ param colspan the colspan for the tableData element in which the footer facet * will be wrapped . * @ throws IOException */ protected void renderColumnFooterCell ( FacesContext facesContext , ResponseWriter writer , UIComponent uiComponent , UIComponent facet , String footerStyleClass , int colspan ) throws IOException { } }
writer . startElement ( HTML . TD_ELEM , null ) ; // uiComponent ) ; if ( colspan > 1 ) { writer . writeAttribute ( HTML . COLSPAN_ATTR , Integer . valueOf ( colspan ) , null ) ; } if ( footerStyleClass != null ) { writer . writeAttribute ( HTML . CLASS_ATTR , footerStyleClass , null ) ; } if ( facet != null ) { // RendererUtils . renderChild ( facesContext , facet ) ; facet . encodeAll ( facesContext ) ; } writer . endElement ( HTML . TD_ELEM ) ;
public class Math { /** * The Kendall Tau Rank Correlation Coefficient is used to measure the * degree of correspondence between sets of rankings where the measures * are not equidistant . It is used with non - parametric data . */ public static double kendall ( int [ ] x , int [ ] y ) { } }
if ( x . length != y . length ) { throw new IllegalArgumentException ( "Input vector sizes are different." ) ; } int is = 0 , n2 = 0 , n1 = 0 , n = x . length ; double aa , a2 , a1 ; for ( int j = 0 ; j < n - 1 ; j ++ ) { for ( int k = j + 1 ; k < n ; k ++ ) { a1 = x [ j ] - x [ k ] ; a2 = y [ j ] - y [ k ] ; aa = a1 * a2 ; if ( aa != 0.0 ) { ++ n1 ; ++ n2 ; if ( aa > 0 ) { ++ is ; } else { -- is ; } } else { if ( a1 != 0.0 ) { ++ n1 ; } if ( a2 != 0.0 ) { ++ n2 ; } } } } double tau = is / ( Math . sqrt ( n1 ) * Math . sqrt ( n2 ) ) ; return tau ;
public class BoundedInputStreamBuffer { /** * { @ inheritDoc } */ @ Override public byte peekByte ( ) throws IndexOutOfBoundsException , IOException { } }
final int read = internalReadBytes ( 1 ) ; if ( read == - 1 ) { // not sure this is really the right thing to do throw new IndexOutOfBoundsException ( ) ; } return getByte ( this . readerIndex ) ;
public class Assert { /** * Assert a boolean expression , throwing an { @ code IllegalArgumentException } if the expression * evaluates to { @ code false } . * < pre class = " code " > * Assert . isTrue ( i & gt ; 0 , ( ) - & gt ; " The value ' " + i + " ' must be greater than zero " ) ; * < / pre > * @ param expression a boolean expression * @ param messageSupplier a supplier for the exception message to use if the assertion fails * @ throws IllegalArgumentException if { @ code expression } is { @ code false } * @ since 5.0 */ public static void isTrue ( final boolean expression , final Supplier < String > messageSupplier ) { } }
if ( ! expression ) { throw new IllegalArgumentException ( Assert . nullSafeGet ( messageSupplier ) ) ; }
public class Album { /** * Preview Album . */ public static BasicGalleryWrapper < GalleryAlbumWrapper , AlbumFile , String , AlbumFile > galleryAlbum ( android . support . v4 . app . Fragment fragment ) { } }
return new GalleryAlbumWrapper ( fragment . getContext ( ) ) ;
public class ScheduledDailyScanUpload { /** * Gets the first execution time for the given scan and upload which is at or after " now " . */ public Instant getNextExecutionTimeAfter ( Instant now ) { } }
OffsetTime timeOfDay = OffsetTime . from ( TIME_OF_DAY_FORMAT . parse ( getTimeOfDay ( ) ) ) ; // The time of the next run is based on the time past midnight UTC relative to the current time Instant nextExecTime = now . atOffset ( ZoneOffset . UTC ) . with ( timeOfDay ) . toInstant ( ) ; // If the first execution would have been for earlier today move to the next execution . while ( nextExecTime . isBefore ( now ) ) { nextExecTime = nextExecTime . plus ( Duration . ofDays ( 1 ) ) ; } return nextExecTime ;
public class GosuStringUtil { /** * < p > Joins the elements of the provided < code > Collection < / code > into * a single String containing the provided elements . < / p > * < p > No delimiter is added before or after the list . * A < code > null < / code > separator is the same as an empty String ( " " ) . < / p > * < p > See the examples here : { @ link # join ( Object [ ] , String ) } . < / p > * @ param collection the < code > Collection < / code > of values to join together , may be null * @ param separator the separator character to use , null treated as " " * @ return the joined String , < code > null < / code > if null iterator input * @ since 2.3 */ public static String join ( Collection collection , String separator ) { } }
if ( collection == null ) { return null ; } return join ( collection . iterator ( ) , separator ) ;
public class Verb { /** * getter for isModal - gets whether this verb has the POS MD ( modal ) , e . g . should , . . . * @ generated * @ return value of the feature */ public boolean getIsModal ( ) { } }
if ( Verb_Type . featOkTst && ( ( Verb_Type ) jcasType ) . casFeat_isModal == null ) jcasType . jcas . throwFeatMissing ( "isModal" , "ch.epfl.bbp.uima.types.Verb" ) ; return jcasType . ll_cas . ll_getBooleanValue ( addr , ( ( Verb_Type ) jcasType ) . casFeatCode_isModal ) ;
public class EMail { /** * Attempts to send the message ( asynchronously ) . * @ return * @ throws Throwable */ public Object execute ( ) throws Throwable { } }
try { URL u = new URL ( "mailto:" + mailto ) ; URLConnection c = u . openConnection ( ) ; c . setDoInput ( false ) ; c . setDoOutput ( true ) ; c . connect ( ) ; outMail = new PrintWriter ( c . getOutputStream ( ) , true ) ; outMail . println ( "From: " + mailfrom ) ; outMail . println ( "To: " + mailto ) ; outMail . println ( "Subject: " + subject ) ; if ( attachments == null ) { outMail . println ( "Content-Type: text/plain;" ) ; outMail . println ( " charset=\"UTF-8\"" ) ; outMail . println ( ) ; if ( message != null ) { outMail . println ( message ) ; } } else { String boundary = "----=" + KeyGenerator . generateKey ( ) ; outMail . println ( "MIME-Version: 1.0\n" + "Content-Type: multipart/mixed; " + "boundary=\"" + boundary + '\"' ) ; outMail . println ( ) ; if ( message != null ) { outMail . println ( "--" + boundary ) ; outMail . println ( "Content-Type: text/plain;" ) ; outMail . println ( " charset=\"UTF-8\"" ) ; // outMail . println ( " Content - Transfer - Encoding : quoted - printable " ) ; outMail . println ( ) ; outMail . println ( message ) ; } for ( int i = 0 ; i < attachments . length ; i ++ ) { outMail . println ( ) ; outMail . println ( "--" + boundary ) ; outMail . println ( "Content-Type: " + attachments [ i ] . getMimeType ( ) + ';' ) ; outMail . println ( " name=\"" + attachments [ i ] . getFileName ( ) + '\"' ) ; outMail . println ( "Content-Transfer-Encoding: base64" ) ; outMail . println ( "Content-Disposition: attachment;" ) ; outMail . println ( " filename=\"" + attachments [ i ] . getFileName ( ) + '\"' ) ; outMail . println ( ) ; outMail . println ( attachments [ i ] . getRawDataBase64Encoded ( ) ) ; outMail . println ( ) ; } outMail . println ( "--" + boundary + "--" ) ; } } catch ( Throwable t ) { // failure of async action must be logged somewhere t . printStackTrace ( ) ; throw new java . lang . RuntimeException ( "mailing " + mailto + " via " + mailserver + " failed" , t ) ; } finally { if ( outMail != null ) { outMail . close ( ) ; } } return null ;
public class Fn { /** * Creates a < i > function expression < / i > for building a function operating on * a target object of type Set & lt ; T & gt ; , being < tt > Type & lt ; T & gt ; < / tt > a type specified * as a parameter . * This is equivalent to < tt > Fn . on ( Types . setOf ( type ) ) < / tt > * @ param type the type to be used * @ return an operator , ready for chaining */ public static < T > Level0SetOperator < Set < T > , T > onSetOf ( final Type < T > type ) { } }
return new Level0SetOperator < Set < T > , T > ( ExecutionTarget . forFn ( Normalisation . SET ) ) ;
public class ExplicitDenyMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ExplicitDeny explicitDeny , ProtocolMarshaller protocolMarshaller ) { } }
if ( explicitDeny == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( explicitDeny . getPolicies ( ) , POLICIES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Singleton { /** * Retrieves the singleton object , creating it by calling a provider if it is not created yet . This method uses * double - checked locking to ensure that only one instance will ever be created , while keeping retrieval cost at * minimum . * @ see < a href = " http : / / en . wikipedia . org / wiki / Double - checked _ locking " > Double - checked locking < / a > * @ param < V > the argument type to the functor * @ param functor a { @ link org . xillium . base . Functor Functor } that can be called to create a new value with 1 argument * @ param argument the argument to pass to the functor * @ return the singleton object * @ throws Exception if the functor fails to create a new value */ public < V > T get ( Functor < T , V > functor , V argument ) throws Exception { } }
T result = _value ; if ( isMissing ( result ) ) synchronized ( this ) { result = _value ; if ( isMissing ( result ) ) { _value = result = functor . invoke ( argument ) ; } } return result ;
public class CmsGalleryController { /** * Removes a selected gallery from the search object . < p > * @ param key the gallery key */ public void removeGalleryParam ( String key ) { } }
if ( m_searchObject . getGalleries ( ) . contains ( key ) ) { m_galleriesChanged = true ; m_handler . onClearGalleries ( Collections . singletonList ( key ) ) ; m_searchObject . removeGallery ( key ) ; updateResultsTab ( false ) ; ValueChangeEvent . fire ( this , m_searchObject ) ; }
public class DecodeWorker { /** * Writes out a single PNG which is three times the width of the input image , containing from left * to right : the original image , the row sampling monochrome version , and the 2D sampling * monochrome version . */ private static void dumpBlackPoint ( URI uri , BufferedImage image , BinaryBitmap bitmap ) throws IOException { } }
int width = bitmap . getWidth ( ) ; int height = bitmap . getHeight ( ) ; int stride = width * 3 ; int [ ] pixels = new int [ stride * height ] ; // The original image int [ ] argb = new int [ width ] ; for ( int y = 0 ; y < height ; y ++ ) { image . getRGB ( 0 , y , width , 1 , argb , 0 , width ) ; System . arraycopy ( argb , 0 , pixels , y * stride , width ) ; } // Row sampling BitArray row = new BitArray ( width ) ; for ( int y = 0 ; y < height ; y ++ ) { try { row = bitmap . getBlackRow ( y , row ) ; } catch ( NotFoundException nfe ) { // If fetching the row failed , draw a red line and keep going . int offset = y * stride + width ; Arrays . fill ( pixels , offset , offset + width , RED ) ; continue ; } int offset = y * stride + width ; for ( int x = 0 ; x < width ; x ++ ) { pixels [ offset + x ] = row . get ( x ) ? BLACK : WHITE ; } } // 2D sampling try { for ( int y = 0 ; y < height ; y ++ ) { BitMatrix matrix = bitmap . getBlackMatrix ( ) ; int offset = y * stride + width * 2 ; for ( int x = 0 ; x < width ; x ++ ) { pixels [ offset + x ] = matrix . get ( x , y ) ? BLACK : WHITE ; } } } catch ( NotFoundException ignored ) { // continue } writeResultImage ( stride , height , pixels , uri , ".mono.png" ) ;
public class AnnotationSagaAnalyzer { /** * { @ inheritDoc } */ @ Override public Map < Class < ? extends Saga > , SagaHandlersMap > scanHandledMessageTypes ( ) { } }
if ( scanResult == null ) { populateSagaHandlers ( ) ; } return scanResult ;
public class WriteMethodUtil { /** * Validates the target type . * @ param entity an entity * @ throws com . sdl . odata . api . processor . ODataProcessorException * @ throws com . sdl . odata . api . processor . datasource . ODataTargetTypeException */ public static void validateTargetType ( Object entity , ODataRequest request , EntityDataModel entityDataModel , ODataUri oDataUri ) throws ODataProcessorException , ODataTargetTypeException { } }
if ( ! entityDataModel . getType ( entity . getClass ( ) ) . getFullyQualifiedName ( ) . equals ( getTargetType ( request , entityDataModel , oDataUri ) . typeName ( ) ) ) { throw new ODataProcessorException ( PROCESSOR_ERROR , "Entity to persist does not match specified Resource name" ) ; }
public class CmsAdminMenuGroup { /** * Returns the necessary html code . < p > * @ param wp the jsp page to write the code to * @ return html code */ public String groupHtml ( CmsWorkplace wp ) { } }
StringBuffer html = new StringBuffer ( 512 ) ; html . append ( htmlStart ( wp ) ) ; Iterator < CmsAdminMenuItem > itItem = m_container . elementList ( ) . iterator ( ) ; while ( itItem . hasNext ( ) ) { CmsAdminMenuItem item = itItem . next ( ) ; html . append ( item . itemHtml ( wp ) ) ; html . append ( "\n" ) ; } html . append ( htmlEnd ( ) ) ; return html . toString ( ) ;
public class Vector4f { /** * Read this vector from the supplied { @ link FloatBuffer } starting at the specified * absolute buffer position / index . * This method will not increment the position of the given FloatBuffer . * @ param index * the absolute position into the FloatBuffer * @ param buffer * values will be read in < code > x , y , z , w < / code > order * @ return this */ public Vector4f set ( int index , FloatBuffer buffer ) { } }
MemUtil . INSTANCE . get ( this , index , buffer ) ; return this ;
public class AbstractMemberWriter { /** * Add the modifier and type for the member in the member summary . * @ param member the member to add the type for * @ param type the type to add * @ param tdSummaryType the content tree to which the modified and type will be added */ protected void addModifierAndType ( Element member , TypeMirror type , Content tdSummaryType ) { } }
HtmlTree code = new HtmlTree ( HtmlTag . CODE ) ; addModifier ( member , code ) ; if ( type == null ) { code . addContent ( utils . isClass ( member ) ? "class" : "interface" ) ; code . addContent ( Contents . SPACE ) ; } else { List < ? extends TypeParameterElement > list = utils . isExecutableElement ( member ) ? ( ( ExecutableElement ) member ) . getTypeParameters ( ) : null ; if ( list != null && ! list . isEmpty ( ) ) { Content typeParameters = ( ( AbstractExecutableMemberWriter ) this ) . getTypeParameters ( ( ExecutableElement ) member ) ; code . addContent ( typeParameters ) ; // Code to avoid ugly wrapping in member summary table . if ( typeParameters . charCount ( ) > 10 ) { code . addContent ( new HtmlTree ( HtmlTag . BR ) ) ; } else { code . addContent ( Contents . SPACE ) ; } code . addContent ( writer . getLink ( new LinkInfoImpl ( configuration , LinkInfoImpl . Kind . SUMMARY_RETURN_TYPE , type ) ) ) ; } else { code . addContent ( writer . getLink ( new LinkInfoImpl ( configuration , LinkInfoImpl . Kind . SUMMARY_RETURN_TYPE , type ) ) ) ; } } tdSummaryType . addContent ( code ) ;
public class ConfigurableImpl { /** * internal helper function to recursively collect Interfaces . * This is needed since { @ link Class # getInterfaces ( ) } does only return directly implemented Interfaces , * But not the ones derived from those classes . */ private static void collectInterfaces ( Set < Class < ? > > interfaces , Class < ? > anInterface ) { } }
interfaces . add ( anInterface ) ; for ( Class < ? > superInterface : anInterface . getInterfaces ( ) ) { collectInterfaces ( interfaces , superInterface ) ; }
public class ListUtil { /** * Replies an iterator that goes from end to start of the given list . * < p > The replied iterator dos not support removals . * @ param < T > the type of the list elements . * @ param list the list . * @ return the reverse iterator . * @ since 14.0 */ public static < T > Iterator < T > reverseIterator ( final List < T > list ) { } }
return new Iterator < T > ( ) { private int next = list . size ( ) - 1 ; @ Override @ Pure public boolean hasNext ( ) { return this . next >= 0 ; } @ Override public T next ( ) { final int n = this . next ; -- this . next ; try { return list . get ( n ) ; } catch ( IndexOutOfBoundsException exception ) { throw new NoSuchElementException ( ) ; } } } ;
public class CmsContentService { /** * Creates a new resource to edit , delegating to an edit handler if edit handler data is passed in . < p > * @ param cms The CmsObject of the current request context . * @ param newLink A string , specifying where which new content should be created . * @ param locale The locale for which the * @ param referenceSitePath site path of the currently edited content . * @ param modelFileSitePath site path of the model file * @ param mode optional creation mode * @ param postCreateHandler optional class name of an { @ link I _ CmsCollectorPostCreateHandler } which is invoked after the content has been created . * @ return The site - path of the newly created resource . * @ throws CmsException if something goes wrong */ public static String defaultCreateResourceToEdit ( CmsObject cms , String newLink , Locale locale , String referenceSitePath , String modelFileSitePath , String mode , String postCreateHandler ) throws CmsException { } }
String newFileName ; if ( newLink . startsWith ( CmsJspTagEdit . NEW_LINK_IDENTIFIER ) ) { newFileName = CmsJspTagEdit . createResource ( cms , newLink , locale , referenceSitePath , modelFileSitePath , mode , postCreateHandler ) ; } else { newFileName = A_CmsResourceCollector . createResourceForCollector ( cms , newLink , locale , referenceSitePath , modelFileSitePath , mode , postCreateHandler ) ; } return newFileName ;
public class TypeAnnotationPosition { /** * Create a { @ code TypeAnnotationPosition } for a constructor reference * type argument . * @ param location The type path . * @ param type _ index The index of the type argument . */ public static TypeAnnotationPosition constructorRefTypeArg ( final List < TypePathEntry > location , final int type_index ) { } }
return constructorRefTypeArg ( location , null , type_index , - 1 ) ;
public class FastMathCalc { /** * Compute the reciprocal of in . Use the following algorithm . * in = c + d . * want to find x + y such that x + y = 1 / ( c + d ) and x is much * larger than y and x has several zero bits on the right . * Set b = 1 / ( 2 ^ 22 ) , a = 1 - b . Thus ( a + b ) = 1. * Use following identity to compute ( a + b ) / ( c + d ) * ( a + b ) / ( c + d ) = a / c + ( bc - ad ) / ( c ^ 2 + cd ) * set x = a / c and y = ( bc - ad ) / ( c ^ 2 + cd ) * This will be close to the right answer , but there will be * some rounding in the calculation of X . So by carefully * computing 1 - ( c + d ) ( x + y ) we can compute an error and * add that back in . This is done carefully so that terms * of similar size are subtracted first . * @ param in initial number , in split form * @ param result placeholder where to put the result */ static void splitReciprocal ( final double in [ ] , final double result [ ] ) { } }
final double b = 1.0 / 4194304.0 ; final double a = 1.0 - b ; if ( in [ 0 ] == 0.0 ) { in [ 0 ] = in [ 1 ] ; in [ 1 ] = 0.0 ; } result [ 0 ] = a / in [ 0 ] ; result [ 1 ] = ( b * in [ 0 ] - a * in [ 1 ] ) / ( in [ 0 ] * in [ 0 ] + in [ 0 ] * in [ 1 ] ) ; if ( result [ 1 ] != result [ 1 ] ) { // can happen if result [ 1 ] is NAN result [ 1 ] = 0.0 ; } /* Resplit */ resplit ( result ) ; for ( int i = 0 ; i < 2 ; i ++ ) { /* this may be overkill , probably once is enough */ double err = 1.0 - result [ 0 ] * in [ 0 ] - result [ 0 ] * in [ 1 ] - result [ 1 ] * in [ 0 ] - result [ 1 ] * in [ 1 ] ; /* err = 1.0 - err ; */ err = err * ( result [ 0 ] + result [ 1 ] ) ; /* printf ( " err = % 16e \ n " , err ) ; */ result [ 1 ] += err ; }
public class MessageSetImpl { /** * Gets messages in the given channel before a given message in any channel until one that meets the given * condition is found . * If no message matches the condition , an empty set is returned . * @ param channel The channel of the messages . * @ param condition The abort condition for when to stop retrieving messages . * @ param before Get messages before the message with this id . * @ return The messages . * @ see # getMessagesBeforeAsStream ( TextChannel , long ) */ public static CompletableFuture < MessageSet > getMessagesBeforeUntil ( TextChannel channel , Predicate < Message > condition , long before ) { } }
return getMessagesUntil ( channel , condition , before , - 1 ) ;
public class StringUtils { /** * Trims a string of unicode whitespace and invisible characters * @ param input Input string * @ return Trimmed string or null if input was null */ public static String trim ( CharSequence input ) { } }
if ( input == null ) { return null ; } return StringFunctions . TRIM . apply ( input . toString ( ) ) ;
public class LdifRecord { /** * - - - - - private methods - - - - - */ private void throwmsg ( String m ) throws NamingException { } }
String msg = m + " at line " + in . pos + " record=" + crec ; in . skip ( ) ; throw new NamingException ( msg ) ;
public class TracerFactory { /** * Tries to open all enqueued QueueTracer . * @ return true if all configured tracers has been opened , false otherwise */ public boolean openQueueTracer ( ) { } }
final int TRIALS = 5 ; int tracerCounter = 0 , trialCounter = 0 ; boolean success = false ; do { this . queueWriteLock . lock ( ) ; try { if ( this . queueConfig . enabled ) { for ( QueueTracer < ? > queueTracer : this . queueConfig . blockingTracerDeque ) { if ( ! queueTracer . isOpened ( ) ) { queueTracer . open ( ) ; tracerCounter ++ ; if ( tracerCounter == this . queueConfig . size ) success = true ; } } } } finally { this . queueWriteLock . unlock ( ) ; } trialCounter ++ ; } while ( tracerCounter < this . queueConfig . size && trialCounter < TRIALS ) ; return success ;
public class MenuScreen { /** * Code to display a Menu . */ public void postSetupGrid ( ) { } }
Record menu = this . getMainRecord ( ) ; BaseListener behMenu = menu . getListener ( StringSubFileFilter . class . getName ( ) ) ; menu . removeListener ( behMenu , true ) ;
public class StreamSegmentReadIndex { /** * Reads a range of bytes from the StreamSegment . * @ param startOffset The offset in the StreamSegment where to start reading . * @ param maxLength The maximum number of bytes to read . * @ param timeout Timeout for the operation . * @ return A ReadResult containing methods for retrieving the result . * @ throws IllegalStateException If the read index is in recovery mode . * @ throws IllegalArgumentException If the parameters are invalid . * @ throws IllegalArgumentException If the StreamSegment is sealed and startOffset is beyond its length . */ ReadResult read ( long startOffset , int maxLength , Duration timeout ) { } }
Exceptions . checkNotClosed ( this . closed , this ) ; Preconditions . checkState ( ! this . recoveryMode , "StreamSegmentReadIndex is in Recovery Mode." ) ; Exceptions . checkArgument ( startOffset >= 0 , "startOffset" , "startOffset must be a non-negative number." ) ; Exceptions . checkArgument ( maxLength >= 0 , "maxLength" , "maxLength must be a non-negative number." ) ; // We only check if we exceeded the last offset of a Sealed Segment . If we attempted to read from a truncated offset // that will be handled by returning a Truncated ReadResultEntryType . Exceptions . checkArgument ( checkReadAvailability ( startOffset , true ) != ReadAvailability . BeyondLastOffset , "startOffset" , "StreamSegment is sealed and startOffset is beyond the last offset of the StreamSegment." ) ; log . debug ( "{}: Read (Offset = {}, MaxLength = {})." , this . traceObjectId , startOffset , maxLength ) ; return new StreamSegmentReadResult ( startOffset , maxLength , this :: getMultiReadResultEntry , this . traceObjectId ) ;
public class KafkaMsgConsumer { /** * Destroying method . */ @ SuppressWarnings ( "unused" ) public void destroy ( ) { } }
// stop all workers for ( KafkaMsgConsumerWorker worker : topicWorkers . values ( ) ) { try { worker . stopWorker ( ) ; } catch ( Exception e ) { LOGGER . warn ( e . getMessage ( ) , e ) ; } } topicWorkers . clear ( ) ; // clear all message listeners synchronized ( topicMsgListeners ) { topicMsgListeners . clear ( ) ; } // close all KafkaConsumer for ( KafkaConsumer < String , byte [ ] > consumer : topicConsumers . values ( ) ) { synchronized ( consumer ) { try { consumer . close ( ) ; } catch ( WakeupException e ) { } catch ( Exception e ) { LOGGER . warn ( e . getMessage ( ) , e ) ; } } } topicConsumers . clear ( ) ; if ( executorService != null && myOwnExecutorService ) { try { List < Runnable > tasks = executorService . shutdownNow ( ) ; } catch ( Exception e ) { LOGGER . warn ( e . getMessage ( ) , e ) ; } finally { executorService = null ; } }
import java . util . * ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; public class FrequentWords { /** * This function finds out the top - n most frequent words in the provided text . * Examples : * > > > findFrequentWords ( " python is a programming language " , 1) * [ ( " python " , 1 ) ] * > > > findFrequentWords ( " python is a programming language " , 1) * [ ( " python " , 1 ) ] * > > > findFrequentWords ( " python is a programming language " , 5) * [ ( " python " , 1 ) , ( " is " , 1 ) , ( " a " , 1 ) , ( " programming " , 1 ) , ( " language " , 1 ) ] * Args : * text _ string : A string as a text . * top _ n : An integer to specify the top - n frequent words you want to find out . * Returns : * This will return a list of tuples containing the top - n most frequent words along with their frequencies . */ public static List < Map . Entry < String , Integer > > findFrequentWords ( String textString , int topN ) { } }
Pattern pattern = Pattern . compile ( "\\w+" ) ; HashMap < String , Integer > wordCount = new HashMap < > ( ) ; Matcher matcher = pattern . matcher ( textString ) ; while ( matcher . find ( ) ) { String word = matcher . group ( ) ; wordCount . put ( word , wordCount . getOrDefault ( word , 0 ) + 1 ) ; } List < Map . Entry < String , Integer > > entries = new ArrayList < > ( wordCount . entrySet ( ) ) ; entries . sort ( ( a , b ) -> b . getValue ( ) . compareTo ( a . getValue ( ) ) ) ; return entries . subList ( 0 , Math . min ( topN , entries . size ( ) ) ) ;