signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class SpringIntegration { /** * Binds all Spring beans from the given factory by name . For a Spring bean named " foo " , this * method creates a binding to the bean ' s type and { @ code @ Named ( " foo " ) } . * @ see com . google . inject . name . Named * @ see com . google . inject . name . Names # named ( String ) */ public static void bindAll ( Binder binder , ListableBeanFactory beanFactory ) { } }
binder = binder . skipSources ( SpringIntegration . class ) ; for ( String name : beanFactory . getBeanDefinitionNames ( ) ) { Class < ? > type = beanFactory . getType ( name ) ; bindBean ( binder , beanFactory , name , type ) ; }
public class CloudWatchDestinationMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CloudWatchDestination cloudWatchDestination , ProtocolMarshaller protocolMarshaller ) { } }
if ( cloudWatchDestination == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( cloudWatchDestination . getDimensionConfigurations ( ) , DIMENSIONCONFIGURATIONS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ExtendedFile { /** * Zips all included objects into the specified file . * @ param zipFile * the zip file to be created */ public void zip ( final File zipFile ) throws IOException { } }
File [ ] files = listFiles ( ) ; if ( files . length == 0 ) { return ; } LOG . info ( "Creating zip file " + zipFile + " from directory " + this ) ; ZipOutputStream zipOut = null ; try { zipOut = new ZipOutputStream ( new FileOutputStream ( zipFile ) ) ; for ( File file : files ) { zip ( "" , file , zipOut ) ; } } finally { IOUtils . closeQuietly ( zipOut ) ; }
public class UniverseApi { /** * Bulk names to IDs ( asynchronously ) Resolve a set of names to IDs in the * following categories : agents , alliances , characters , constellations , * corporations factions , inventory _ types , regions , stations , and systems . * Only exact matches will be returned . All names searched for are cached * for 12 hours - - - * @ param requestBody * The names to resolve ( required ) * @ param acceptLanguage * Language to use in the response ( optional , default to en - us ) * @ param datasource * The server name you would like data from ( optional , default to * tranquility ) * @ param language * Language to use in the response , takes precedence over * Accept - Language ( optional , default to en - us ) * @ param callback * The callback to be executed when the API call finishes * @ return The request call * @ throws ApiException * If fail to process the API call , e . g . serializing the request * body object */ public com . squareup . okhttp . Call postUniverseIdsAsync ( List < String > requestBody , String acceptLanguage , String datasource , String language , final ApiCallback < UniverseIdsResponse > callback ) throws ApiException { } }
com . squareup . okhttp . Call call = postUniverseIdsValidateBeforeCall ( requestBody , acceptLanguage , datasource , language , callback ) ; Type localVarReturnType = new TypeToken < UniverseIdsResponse > ( ) { } . getType ( ) ; apiClient . executeAsync ( call , localVarReturnType , callback ) ; return call ;
public class ObservableReader { /** * Adds a reader listener to this reader that will be notified when * new strings are read . * @ param readerListener a reader listener . */ public void addReaderListener ( ReaderListener readerListener ) { } }
if ( readerListener == null ) { return ; } synchronized ( listeners ) { if ( ! listeners . contains ( readerListener ) ) { listeners . add ( readerListener ) ; } }
public class ConditionalClause { /** * The test in this conditional clause are implicitly ANDed together , so return false if any of them is false , and continue the loop for each test that is true ; * @ return */ @ Override public boolean evaluate ( FieldManager fieldManager , IndentPrinter printer ) { } }
Comparable fieldValue = fieldManager . getValue ( fieldName ) ; for ( ConditionalTest test : conditionalTests ) { boolean result = test . operator . apply ( fieldValue , test . parameter ) ; printer . print ( "- %s => %b" , test . operator . description ( fieldManager . getDescription ( fieldName ) , fieldValue , test . parameter ) , result ) ; if ( ! result ) { return false ; } } return true ;
public class IfcElementImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) public EList < IfcRelConnectsStructuralElement > getHasStructuralMember ( ) { } }
return ( EList < IfcRelConnectsStructuralElement > ) eGet ( Ifc2x3tc1Package . Literals . IFC_ELEMENT__HAS_STRUCTURAL_MEMBER , true ) ;
public class Captions { /** * The array of file formats for the output captions . If you leave this value blank , Elastic Transcoder returns an * error . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setCaptionFormats ( java . util . Collection ) } or { @ link # withCaptionFormats ( java . util . Collection ) } if you want * to override the existing values . * @ param captionFormats * The array of file formats for the output captions . If you leave this value blank , Elastic Transcoder * returns an error . * @ return Returns a reference to this object so that method calls can be chained together . */ public Captions withCaptionFormats ( CaptionFormat ... captionFormats ) { } }
if ( this . captionFormats == null ) { setCaptionFormats ( new com . amazonaws . internal . SdkInternalList < CaptionFormat > ( captionFormats . length ) ) ; } for ( CaptionFormat ele : captionFormats ) { this . captionFormats . add ( ele ) ; } return this ;
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EEnum getGSCRPREC ( ) { } }
if ( gscrprecEEnum == null ) { gscrprecEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 143 ) ; } return gscrprecEEnum ;
public class AS2ClientBuilder { /** * Certain values can by convention be derived from other values . This happens * inside this method . There is no need to call this method manually , it is * called automatically before { @ link # verifyContent ( ) } is called . */ @ OverridingMethodsMustInvokeSuper protected void setDefaultDerivedValues ( ) { } }
if ( m_sReceiverAS2KeyAlias == null ) { // No key alias is specified , so use the same as the receiver ID ( which // may be null ) m_sReceiverAS2KeyAlias = m_sReceiverAS2ID ; if ( LOGGER . isDebugEnabled ( ) ) LOGGER . debug ( "The receiver AS2 key alias was defaulted to the AS2 receiver ID ('" + m_sReceiverAS2ID + "')" ) ; }
public class Connection { /** * { @ inheritDoc } */ public void setTypeMap ( final Map < String , Class < ? > > typemap ) throws SQLException { } }
checkClosed ( ) ; if ( typemap == null ) { throw new SQLException ( "Invalid type-map" ) ; } // end of if this . typemap = typemap ;
public class AtlasClient { /** * Get the latest numResults entity audit events in decreasing order of timestamp for the given entity id * @ param entityId entity id * @ param numResults number of results to be returned * @ return list of audit events for the entity id * @ throws AtlasServiceException */ public List < EntityAuditEvent > getEntityAuditEvents ( String entityId , short numResults ) throws AtlasServiceException { } }
return getEntityAuditEvents ( entityId , null , numResults ) ;
public class Distance { /** * Gets the Chessboard distance between two points . * @ param x1 X1 axis coordinate . * @ param y1 Y1 axis coordinate . * @ param x2 X2 axis coordinate . * @ param y2 Y2 axis coordinate . * @ return The Chessboard distance between x and y . */ public static double Chessboard ( double x1 , double y1 , double x2 , double y2 ) { } }
double dx = Math . abs ( x1 - x2 ) ; double dy = Math . abs ( y1 - y2 ) ; return Math . max ( dx , dy ) ;
public class SimHashPlusHammingDistanceTextSimilarity { /** * 计算相似度分值 * @ param words1 词列表1 * @ param words2 词列表2 * @ return 相似度分值 */ @ Override protected double scoreImpl ( List < Word > words1 , List < Word > words2 ) { } }
// 用词频来标注词的权重 taggingWeightWithWordFrequency ( words1 , words2 ) ; // 计算SimHash String simHash1 = simHash ( words1 ) ; String simHash2 = simHash ( words2 ) ; // 计算SimHash值之间的汉明距离 int hammingDistance = hammingDistance ( simHash1 , simHash2 ) ; if ( hammingDistance == - 1 ) { LOGGER . error ( "文本1:" + words1 . toString ( ) ) ; LOGGER . error ( "文本2:" + words2 . toString ( ) ) ; LOGGER . error ( "文本1SimHash值:" + simHash1 ) ; LOGGER . error ( "文本2SimHash值:" + simHash2 ) ; LOGGER . error ( "文本1和文本2的SimHash值长度不相等,不能计算汉明距离" ) ; return 0.0 ; } int maxDistance = simHash1 . length ( ) ; double score = ( 1 - hammingDistance / ( double ) maxDistance ) ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "文本1:" + words1 . toString ( ) ) ; LOGGER . debug ( "文本2:" + words2 . toString ( ) ) ; LOGGER . debug ( "文本1SimHash值:" + simHash1 ) ; LOGGER . debug ( "文本2SimHash值:" + simHash2 ) ; LOGGER . debug ( "hashBitCount:" + hashBitCount ) ; LOGGER . debug ( "SimHash值之间的汉明距离:" + hammingDistance ) ; LOGGER . debug ( "文本1和文本2的相似度分值:1 - " + hammingDistance + " / (double)" + maxDistance + "=" + score ) ; } return score ;
public class LifeCycleManager { /** * Add a shutdown hook that calls { @ link destroy } method */ public void destroyOnShutdownHook ( ) { } }
Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ) { @ Override public void run ( ) { try { LifeCycleManager . this . destroy ( ) ; } catch ( Exception e ) { System . err . print ( "Exception in life cycle shutdown handler " ) ; e . printStackTrace ( System . err ) ; } } } ) ;
public class MultiUserChatLightManager { /** * Unblock a room . * @ param mucLightService * @ param roomJid * @ throws NoResponseException * @ throws XMPPErrorException * @ throws NotConnectedException * @ throws InterruptedException */ public void unblockRoom ( DomainBareJid mucLightService , Jid roomJid ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } }
HashMap < Jid , Boolean > rooms = new HashMap < > ( ) ; rooms . put ( roomJid , true ) ; sendUnblockRooms ( mucLightService , rooms ) ;
public class ImageIOUtil { /** * Writes a buffered image to a file using the given image format . * See { @ link # writeImage ( BufferedImage image , String formatName , * OutputStream output , int dpi , float quality ) } for more details . * @ param image the image to be written * @ param filename used to construct the filename for the individual image . Its suffix will be * used as the image format . * @ param dpi the resolution in dpi ( dots per inch ) to be used in metadata * @ param quality quality to be used when compressing the image ( 0 & lt ; quality & lt ; 1.0f ) * @ return true if the image file was produced , false if there was an error . * @ throws IOException if an I / O error occurs */ public static boolean writeImage ( BufferedImage image , String filename , int dpi , float quality ) throws IOException { } }
File file = new File ( filename ) ; FileOutputStream output = new FileOutputStream ( file ) ; try { String formatName = filename . substring ( filename . lastIndexOf ( '.' ) + 1 ) ; return writeImage ( image , formatName , output , dpi , quality ) ; } finally { output . close ( ) ; }
public class ComponentPropertyResolver { /** * Get property . * @ param name Property name * @ param defaultValue Default value * @ param < T > Parameter type * @ return Property value or default value if not set */ public @ NotNull < T > T get ( @ NotNull String name , @ NotNull T defaultValue ) { } }
@ Nullable @ SuppressWarnings ( "unchecked" ) T value = get ( name , ( Class < T > ) defaultValue . getClass ( ) ) ; if ( value != null ) { return value ; } else { return defaultValue ; }
public class JSONClient { /** * Invoke the Login stored procedure to add a login record to the database . * If the login is called multiple times for the same username , the last accessed * time for the login is updated . Thus this sample client can be run repeatedly without * having to cycle the database . */ private void doLogin ( LoginGenerator . LoginRecord login ) { } }
// Synchronously call the " Login " procedure passing in a json string containing // login - specific structure / data . try { ClientResponse response = client . callProcedure ( "Login" , login . username , login . password , login . json ) ; long resultCode = response . getResults ( ) [ 0 ] . asScalarLong ( ) ; if ( resultCode == LOGIN_SUCCESSFUL ) acceptedLogins . incrementAndGet ( ) ; else badLogins . incrementAndGet ( ) ; } catch ( Exception e ) { badLogins . incrementAndGet ( ) ; e . printStackTrace ( ) ; }
public class FileSystem { /** * The src file is on the local disk . Add it to FS at * the given dst name , removing the source afterwards . */ public void moveFromLocalFile ( Path src , Path dst ) throws IOException { } }
copyFromLocalFile ( true , true , false , src , dst ) ;
public class AmazonConfigClient { /** * Accepts a structured query language ( SQL ) < code > SELECT < / code > command , performs the corresponding search , and * returns resource configurations matching the properties . * For more information about query components , see the < a * href = " https : / / docs . aws . amazon . com / config / latest / developerguide / query - components . html " > < b > Query Components < / b > * < / a > section in the AWS Config Developer Guide . * @ param selectResourceConfigRequest * @ return Result of the SelectResourceConfig operation returned by the service . * @ throws InvalidExpressionException * The syntax of the query is incorrect . * @ throws InvalidLimitException * The specified limit is outside the allowable range . * @ throws InvalidNextTokenException * The specified next token is invalid . Specify the < code > nextToken < / code > string that was returned in the * previous response to get the next page of results . * @ sample AmazonConfig . SelectResourceConfig * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / config - 2014-11-12 / SelectResourceConfig " target = " _ top " > AWS * API Documentation < / a > */ @ Override public SelectResourceConfigResult selectResourceConfig ( SelectResourceConfigRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeSelectResourceConfig ( request ) ;
public class AmazonEC2Client { /** * Associates a subnet with a route table . The subnet and route table must be in the same VPC . This association * causes traffic originating from the subnet to be routed according to the routes in the route table . The action * returns an association ID , which you need in order to disassociate the route table from the subnet later . A route * table can be associated with multiple subnets . * For more information , see < a * href = " https : / / docs . aws . amazon . com / AmazonVPC / latest / UserGuide / VPC _ Route _ Tables . html " > Route Tables < / a > in the * < i > Amazon Virtual Private Cloud User Guide < / i > . * @ param associateRouteTableRequest * @ return Result of the AssociateRouteTable operation returned by the service . * @ sample AmazonEC2 . AssociateRouteTable * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / AssociateRouteTable " target = " _ top " > AWS API * Documentation < / a > */ @ Override public AssociateRouteTableResult associateRouteTable ( AssociateRouteTableRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeAssociateRouteTable ( request ) ;
public class FileSelectPart { /** * { @ inheritDoc } */ @ Override public int join ( final OneSelect _oneSelect , final SQLSelect _select , final int _relIndex ) { } }
final int relIndex = super . join ( _oneSelect , _select , _relIndex ) ; Integer ret ; ret = _oneSelect . getTableIndex ( AbstractStoreResource . TABLENAME_STORE , "ID" , relIndex , null ) ; if ( ret == null ) { ret = _oneSelect . getNewTableIndex ( AbstractStoreResource . TABLENAME_STORE , "ID" , relIndex , null ) ; _select . leftJoin ( AbstractStoreResource . TABLENAME_STORE , ret , "ID" , relIndex , "ID" ) ; } _select . column ( ret , "ID" ) ; return ret ;
public class PathFinder { /** * Gets the file or directory from the given parent File object and the relative path given over * the list as String objects . * @ param parent * The parent directory . * @ param folders * The list with the directories and optional a filename . * @ return the resulted file or directory from the given arguments . */ public static File getRelativePathTo ( File parent , final List < String > folders ) { } }
for ( final String string : folders ) { final File nextFolder = new File ( parent , string ) ; parent = nextFolder ; } return parent ;
public class StringValue { /** * ( non - Javadoc ) * @ see java . lang . Appendable # append ( java . lang . CharSequence , int , int ) */ @ Override public Appendable append ( CharSequence csq , int start , int end ) { } }
final int otherLen = end - start ; grow ( this . len + otherLen ) ; for ( int pos = start ; pos < end ; pos ++ ) { this . value [ this . len + pos ] = csq . charAt ( pos ) ; } this . len += otherLen ; return this ;
public class Application { /** * Add new target application to your robot . * Sample if you add google : - f 1 - a google - u http : / / www . google . com - - verbose * @ param applicationName * name of application added . * @ param url * @ param robotContext * Context class from robot . * @ param verbose * boolean to activate verbose mode ( show more traces ) . */ public void add ( String applicationName , String url , Class < ? > robotContext , boolean verbose ) { } }
logger . info ( "Add a new application named [{}] with this url: [{}]" , applicationName , url ) ; addApplicationPages ( applicationName , robotContext . getSimpleName ( ) . replaceAll ( "Context" , "" ) , robotContext , verbose ) ; addApplicationSteps ( applicationName , robotContext . getSimpleName ( ) . replaceAll ( "Context" , "" ) , robotContext , verbose ) ; addApplicationContext ( applicationName , robotContext , verbose ) ; addApplicationSelector ( applicationName , verbose ) ; addApplicationInPropertiesFile ( applicationName , robotContext . getSimpleName ( ) . replaceAll ( "Context" , "" ) , verbose ) ; addApplicationInEnvPropertiesFile ( applicationName , url , "ci" , verbose ) ; addApplicationInEnvPropertiesFile ( applicationName , url , "dev" , verbose ) ; addApplicationInEnvPropertiesFile ( applicationName , url , "prod" , verbose ) ;
public class PersistHdfs { @ Override public ArrayList < String > calcTypeaheadMatches ( String filter , int limit ) { } }
// Get HDFS configuration Configuration conf = PersistHdfs . CONF ; // Hack around s3 : / / // filter = convertS3toS3N ( filter ) ; // Handle S3N bare buckets - s3n : / / bucketname should be suffixed by ' / ' // or underlying Jets3n will throw NPE . filter name should be s3n : / / bucketname / if ( isBareS3NBucketWithoutTrailingSlash ( filter ) ) { filter += "/" ; } // Output matches ArrayList < String > array = new ArrayList < String > ( ) ; { // Filter out partials which are known to print out useless stack traces . String s = filter . toLowerCase ( ) ; if ( "hdfs:" . equals ( s ) ) return array ; if ( "maprfs:" . equals ( s ) ) return array ; } try { Path p = new Path ( filter ) ; Path expand = p ; if ( ! filter . endsWith ( "/" ) ) expand = p . getParent ( ) ; FileSystem fs = FileSystem . get ( p . toUri ( ) , conf ) ; for ( FileStatus file : fs . listStatus ( expand ) ) { Path fp = file . getPath ( ) ; if ( fp . toString ( ) . startsWith ( p . toString ( ) ) ) { array . add ( fp . toString ( ) ) ; } if ( array . size ( ) == limit ) break ; } } catch ( Exception e ) { Log . trace ( e ) ; } catch ( Throwable t ) { Log . warn ( t ) ; } return array ;
public class UIData { /** * < p > Set the zero - relative row number of the first row to be * displayed . < / p > * @ param first New first row number * @ throws IllegalArgumentException if < code > first < / code > is negative */ public void setFirst ( int first ) { } }
if ( first < 0 ) { throw new IllegalArgumentException ( String . valueOf ( first ) ) ; } getStateHelper ( ) . put ( PropertyKeys . first , first ) ;
public class GeneratedMessageLite { /** * For use by generated code only . */ public static < ContainingType extends MessageLite , Type > GeneratedExtension < ContainingType , Type > newSingularGeneratedExtension ( final ContainingType containingTypeDefaultInstance , final Type defaultValue , final MessageLite messageDefaultInstance , final Internal . EnumLiteMap < ? > enumTypeMap , final int number , final WireFormat . FieldType type ) { } }
return new GeneratedExtension < ContainingType , Type > ( containingTypeDefaultInstance , defaultValue , messageDefaultInstance , new ExtensionDescriptor ( enumTypeMap , number , type , false /* isRepeated */ , false /* isPacked */ ) ) ;
public class ColumnExtractor { /** * Fills a { @ link ColumnModel } with information from a { @ link Column } . * @ param column The column * @ return The filled model */ public ColumnModel extractColumnModel ( Column column ) { } }
LOG . debug ( "Extracting model for column {}" , column . getName ( ) ) ; ColumnModel model = new ColumnModel ( ) ; model . setName ( this . nameProvider . getMethodNameForColumn ( column ) ) ; model . setDbName ( column . getName ( ) ) ; model . setDbTableName ( column . getParent ( ) . getName ( ) ) ; model . setDbFullTableName ( column . getParent ( ) . getFullName ( ) ) ; model . setSqlType ( column . getColumnDataType ( ) . getName ( ) ) ; model . setSqlTypeInt ( column . getColumnDataType ( ) . getJavaSqlType ( ) . getVendorTypeNumber ( ) ) ; String javaDataTypeName = dataTypeProvider . getCanonicalDataTypeName ( column ) ; model . setJavaTypeName ( javaDataTypeName ) ; model . setNotNull ( ! column . isNullable ( ) ) ; model . setPartOfPrimaryKey ( column . isPartOfPrimaryKey ( ) ) ; model . setPartOfForeignKey ( column . isPartOfForeignKey ( ) ) ; model . setExplicitAttribute ( explicitAttributeDecider . isExplicitAttribute ( column ) ) ; model . setUnique ( column . isPartOfUniqueIndex ( ) || column . isPartOfPrimaryKey ( ) ) ; model . setConvenienceSetters ( convenienceSetterProvider . getConvenienceSetters ( column , javaDataTypeName ) ) ; return model ;
public class FieldAccessorGenerator { /** * Generates a setter that set the value by directly accessing the class field . * @ param field The reflection field object . */ private void directSetter ( Field field ) { } }
GeneratorAdapter mg = new GeneratorAdapter ( Opcodes . ACC_PUBLIC , getMethod ( void . class , "set" , Object . class , Object . class ) , setterSignature ( ) , new Type [ 0 ] , classWriter ) ; // Simply access by field // ( ( classType ) object ) . fieldName = ( valueType ) value ; mg . loadArg ( 0 ) ; mg . checkCast ( Type . getType ( field . getDeclaringClass ( ) ) ) ; mg . loadArg ( 1 ) ; if ( field . getType ( ) . isPrimitive ( ) ) { mg . unbox ( Type . getType ( field . getType ( ) ) ) ; } else { mg . checkCast ( Type . getType ( field . getType ( ) ) ) ; } mg . putField ( Type . getType ( field . getDeclaringClass ( ) ) , field . getName ( ) , Type . getType ( field . getType ( ) ) ) ; mg . returnValue ( ) ; mg . endMethod ( ) ;
public class TypeDeclarationsIR { /** * Represents a structural type . * Closure calls this a Record Type and accepts the syntax * { @ code { myNum : number , myObject } } * < p > Example : * < pre > * RECORD _ TYPE * STRING _ KEY myNum * NUMBER _ TYPE * STRING _ KEY myObject * < / pre > * @ param properties a map from property name to property type * @ return a new node representing the record type */ public static TypeDeclarationNode recordType ( LinkedHashMap < String , TypeDeclarationNode > properties ) { } }
TypeDeclarationNode node = new TypeDeclarationNode ( Token . RECORD_TYPE ) ; for ( Map . Entry < String , TypeDeclarationNode > prop : properties . entrySet ( ) ) { Node stringKey = IR . stringKey ( prop . getKey ( ) ) ; node . addChildToBack ( stringKey ) ; if ( prop . getValue ( ) != null ) { stringKey . addChildToFront ( prop . getValue ( ) ) ; } } return node ;
public class Utils { /** * Splits a string and formats the result . * @ param toSplit the string to split ( can be null ) * @ param separator the separator ( cannot be null or the empty string ) * @ return a list of items ( never null ) , with every item being trimmed */ public static List < String > splitNicely ( String toSplit , String separator ) { } }
if ( separator == null || separator . isEmpty ( ) ) throw new IllegalArgumentException ( "The separator cannot be null or the empty string." ) ; return splitNicelyWithPattern ( toSplit , Pattern . quote ( separator ) ) ;
public class MaterialTree { /** * Deselect selected tree item */ public void deselectSelectedItem ( ) { } }
// Check whether tree has selected item if ( selectedItem != null ) { clearSelectedStyles ( selectedItem ) ; setSelectedItem ( null ) ; SelectionEvent . fire ( this , null ) ; }
public class S { /** * check the given char to be a digit or alphabetic * @ param c * @ return true if this is a digit an upper case char or a lowercase char */ public static boolean isDigitsOrAlphabetic ( char c ) { } }
int i = ( int ) c ; return digits . include ( i ) || uppers . include ( i ) || lowers . include ( i ) ;
public class CreateCdnConfigurations { /** * Runs the example . * @ param adManagerServices the services factory . * @ param session the session . * @ throws ApiException if the API request failed with one or more service errors . * @ throws RemoteException if the API request failed due to other errors . */ public static void runExample ( AdManagerServices adManagerServices , AdManagerSession session ) throws RemoteException { } }
// Get the CdnConfigurationService . CdnConfigurationServiceInterface cdnConfigurationService = adManagerServices . get ( session , CdnConfigurationServiceInterface . class ) ; // Make CDN configuration objects . // Only LIVE _ STREAM _ SOURCE _ CONTENT is currently supported by the API . // Basic example with no security policies . CdnConfiguration cdnConfigurationWithoutSecurityPolicy = new CdnConfiguration ( ) ; SecurityPolicySettings noSecurityPolicy = new SecurityPolicySettings ( ) ; noSecurityPolicy . setSecurityPolicyType ( SecurityPolicyType . NONE ) ; MediaLocationSettings mediaLocationSettings = new MediaLocationSettings ( ) ; mediaLocationSettings . setUrlPrefix ( "example.google.com" ) ; mediaLocationSettings . setSecurityPolicy ( noSecurityPolicy ) ; SourceContentConfiguration sourceContentConfigWithNoSecurityPolicy = new SourceContentConfiguration ( ) ; sourceContentConfigWithNoSecurityPolicy . setIngestSettings ( mediaLocationSettings ) ; sourceContentConfigWithNoSecurityPolicy . setDefaultDeliverySettings ( mediaLocationSettings ) ; cdnConfigurationWithoutSecurityPolicy . setName ( "ApiConfig1" ) ; cdnConfigurationWithoutSecurityPolicy . setCdnConfigurationType ( CdnConfigurationType . LIVE_STREAM_SOURCE_CONTENT ) ; cdnConfigurationWithoutSecurityPolicy . setSourceContentConfiguration ( sourceContentConfigWithNoSecurityPolicy ) ; // Complex example with security policies . CdnConfiguration cdnConfigurationWithSecurityPolicy = new CdnConfiguration ( ) ; SecurityPolicySettings ingestSecurityPolicySettings = new SecurityPolicySettings ( ) ; ingestSecurityPolicySettings . setSecurityPolicyType ( SecurityPolicyType . AKAMAI ) ; ingestSecurityPolicySettings . setDisableServerSideUrlSigning ( false ) ; ingestSecurityPolicySettings . setTokenAuthenticationKey ( "abc123" ) ; MediaLocationSettings ingestSettings = new MediaLocationSettings ( ) ; ingestSettings . setUrlPrefix ( "example.google.com" ) ; ingestSettings . setSecurityPolicy ( ingestSecurityPolicySettings ) ; SecurityPolicySettings deliverySecurityPolicySettings = new SecurityPolicySettings ( ) ; deliverySecurityPolicySettings . setSecurityPolicyType ( SecurityPolicyType . AKAMAI ) ; deliverySecurityPolicySettings . setDisableServerSideUrlSigning ( false ) ; deliverySecurityPolicySettings . setOriginForwardingType ( OriginForwardingType . CONVENTIONAL ) ; deliverySecurityPolicySettings . setOriginPathPrefix ( "/path/to/my/origin" ) ; MediaLocationSettings deliverySettings = new MediaLocationSettings ( ) ; deliverySettings . setUrlPrefix ( "example.google.com" ) ; deliverySettings . setSecurityPolicy ( deliverySecurityPolicySettings ) ; SourceContentConfiguration sourceContentConfigurationWithSecurityPolicy = new SourceContentConfiguration ( ) ; sourceContentConfigurationWithSecurityPolicy . setIngestSettings ( ingestSettings ) ; sourceContentConfigurationWithSecurityPolicy . setDefaultDeliverySettings ( deliverySettings ) ; cdnConfigurationWithSecurityPolicy . setName ( "ApiConfig2" ) ; cdnConfigurationWithSecurityPolicy . setCdnConfigurationType ( CdnConfigurationType . LIVE_STREAM_SOURCE_CONTENT ) ; cdnConfigurationWithSecurityPolicy . setSourceContentConfiguration ( sourceContentConfigurationWithSecurityPolicy ) ; // Create the cdnConfigurations on the server . CdnConfiguration [ ] cdnConfigurations = cdnConfigurationService . createCdnConfigurations ( new CdnConfiguration [ ] { cdnConfigurationWithoutSecurityPolicy , cdnConfigurationWithSecurityPolicy } ) ; for ( CdnConfiguration createdCdnConfiguration : cdnConfigurations ) { System . out . printf ( "A CDN configuration with ID %d and name '%s' was created.%n" , createdCdnConfiguration . getId ( ) , createdCdnConfiguration . getName ( ) ) ; }
public class ServletSetDateHeaderTask { /** * { @ inheritDoc } */ public Formula getFormula ( ) { } }
Reagent [ ] reagents = new Reagent [ ] { HEADER_NAME , HEADER_VALUE , SOURCE } ; final Formula rslt = new SimpleFormula ( ServletSetDateHeaderTask . class , reagents ) ; return rslt ;
public class Interval { /** * Find the coalesced result of two overlapping intervals . * @ param that interval * @ return coalesced interval or # NULL if none exists * @ see Range # span ( com . google . common . collect . Range ) */ public Interval < C > coalesce ( final Interval < C > that ) { } }
if ( this . overlaps ( that ) ) { return new Interval ( this . dimension , this . range . span ( that . range ) ) ; } return NULL ;
public class NumberUtil { /** * 判断字符串是否是浮点数 * @ param s String * @ return 是否为 { @ link Double } 类型 */ public static boolean isDouble ( String s ) { } }
try { Double . parseDouble ( s ) ; if ( s . contains ( "." ) ) { return true ; } return false ; } catch ( NumberFormatException e ) { return false ; }
public class Environment { /** * Gets the shell used by the Windows user . * @ return the shell : cmd . exe or command . com . */ private static String getWindowsUserShell ( ) { } }
if ( null != m_SHELL ) { return m_SHELL ; } if ( - 1 != OSNAME . indexOf ( "98" ) || - 1 != OSNAME . indexOf ( "95" ) || - 1 != OSNAME . indexOf ( "Me" ) ) { m_SHELL = "command.com" ; return m_SHELL ; } m_SHELL = "cmd.exe" ; return m_SHELL ;
public class CmsPropertyAdvanced { /** * Performs the editing of the resources properties . < p > * @ param request the HttpServletRequest * @ return true , if the properties were successfully changed , otherwise false * @ throws CmsException if editing is not successful */ private boolean performDialogOperation ( HttpServletRequest request ) throws CmsException { } }
List < CmsPropertyDefinition > propertyDef = getCms ( ) . readAllPropertyDefinitions ( ) ; boolean useTempfileProject = Boolean . valueOf ( getParamUsetempfileproject ( ) ) . booleanValue ( ) ; try { if ( useTempfileProject ) { switchToTempProject ( ) ; } Map < String , CmsProperty > activeProperties = getActiveProperties ( ) ; String activeTab = getActiveTabName ( ) ; List < CmsProperty > propertiesToWrite = new ArrayList < CmsProperty > ( ) ; // check all property definitions of the resource for new values Iterator < CmsPropertyDefinition > i = propertyDef . iterator ( ) ; while ( i . hasNext ( ) ) { CmsPropertyDefinition curPropDef = i . next ( ) ; String propName = CmsEncoder . escapeXml ( curPropDef . getName ( ) ) ; String valueStructure = null ; String valueResource = null ; if ( key ( Messages . GUI_PROPERTIES_INDIVIDUAL_0 ) . equals ( activeTab ) ) { // get parameters from the structure tab valueStructure = request . getParameter ( PREFIX_VALUE + propName ) ; valueResource = request . getParameter ( PREFIX_RESOURCE + propName ) ; if ( ( valueStructure != null ) && ! "" . equals ( valueStructure . trim ( ) ) && valueStructure . equals ( valueResource ) ) { // the resource value was shown / entered in input field , set structure value to empty String valueStructure = "" ; } } else { // get parameters from the resource tab valueStructure = request . getParameter ( PREFIX_STRUCTURE + propName ) ; valueResource = request . getParameter ( PREFIX_VALUE + propName ) ; } // check values for blanks and null if ( valueStructure != null ) { valueStructure = valueStructure . trim ( ) ; } if ( valueResource != null ) { valueResource = valueResource . trim ( ) ; } // create new CmsProperty object to store CmsProperty newProperty = new CmsProperty ( ) ; newProperty . setName ( curPropDef . getName ( ) ) ; newProperty . setStructureValue ( valueStructure ) ; newProperty . setResourceValue ( valueResource ) ; // get the old property values CmsProperty oldProperty = activeProperties . get ( curPropDef . getName ( ) ) ; if ( oldProperty == null ) { // property was not set , create new empty property object oldProperty = new CmsProperty ( ) ; oldProperty . setName ( curPropDef . getName ( ) ) ; } boolean writeStructureValue = false ; boolean writeResourceValue = false ; String oldValue = oldProperty . getStructureValue ( ) ; String newValue = newProperty . getStructureValue ( ) ; // write the structure value if the existing structure value is not null and we want to delete the structure value writeStructureValue = ( ( oldValue != null ) && newProperty . isDeleteStructureValue ( ) ) ; // or if we want to write a value which is neither the delete value or an empty value writeStructureValue |= ! newValue . equals ( oldValue ) && ! "" . equalsIgnoreCase ( newValue ) && ! CmsProperty . DELETE_VALUE . equalsIgnoreCase ( newValue ) ; // set the structure value explicitly to null to leave it as is in the database if ( ! writeStructureValue ) { newProperty . setStructureValue ( null ) ; } oldValue = oldProperty . getResourceValue ( ) ; newValue = newProperty . getResourceValue ( ) ; // write the resource value if the existing resource value is not null and we want to delete the resource value writeResourceValue = ( ( oldValue != null ) && newProperty . isDeleteResourceValue ( ) ) ; // or if we want to write a value which is neither the delete value or an empty value writeResourceValue |= ! newValue . equals ( oldValue ) && ! "" . equalsIgnoreCase ( newValue ) && ! CmsProperty . DELETE_VALUE . equalsIgnoreCase ( newValue ) ; // set the resource value explicitly to null to leave it as is in the database if ( ! writeResourceValue ) { newProperty . setResourceValue ( null ) ; } if ( writeStructureValue || writeResourceValue ) { // add property to list only if property values have changed propertiesToWrite . add ( newProperty ) ; } } if ( propertiesToWrite . size ( ) > 0 ) { // lock resource if autolock is enabled checkLock ( getParamResource ( ) ) ; // write the new property values getCms ( ) . writePropertyObjects ( getParamResource ( ) , propertiesToWrite ) ; } } finally { if ( useTempfileProject ) { switchToCurrentProject ( ) ; } } return true ;
public class MavenJDOMWriter { /** * Method findAndReplaceSimpleLists . * @ param counter * @ param childName * @ param parentName * @ param list * @ param parent */ protected Element findAndReplaceSimpleLists ( Counter counter , Element parent , java . util . Collection list , String parentName , String childName ) { } }
boolean shouldExist = ( list != null ) && ( list . size ( ) > 0 ) ; Element element = updateElement ( counter , parent , parentName , shouldExist ) ; if ( shouldExist ) { Iterator it = list . iterator ( ) ; Iterator elIt = element . getChildren ( childName , element . getNamespace ( ) ) . iterator ( ) ; if ( ! elIt . hasNext ( ) ) { elIt = null ; } Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; while ( it . hasNext ( ) ) { String value = ( String ) it . next ( ) ; Element el ; if ( ( elIt != null ) && elIt . hasNext ( ) ) { el = ( Element ) elIt . next ( ) ; if ( ! elIt . hasNext ( ) ) { elIt = null ; } } else { el = factory . element ( childName , element . getNamespace ( ) ) ; insertAtPreferredLocation ( element , el , innerCount ) ; } el . setText ( value ) ; innerCount . increaseCount ( ) ; } if ( elIt != null ) { while ( elIt . hasNext ( ) ) { elIt . next ( ) ; elIt . remove ( ) ; } } } return element ;
public class CommandLineLinker { /** * This method is exposed so test classes can overload * and test the arguments without actually spawning the * compiler */ protected int runCommand ( final CCTask task , final File workingDir , final String [ ] cmdline ) throws BuildException { } }
return CUtil . runCommand ( task , workingDir , cmdline , this . newEnvironment , this . env ) ;
public class PersonDocumentRepositoryMongoImpl { /** * { @ inheritDoc } */ @ Override public String newId ( final RootDocument rootDocument ) { } }
return newId ( mongoTemplate , PersonDocumentMongo . class , rootDocument . getFilename ( ) , "I" ) ;
public class SessionBuilder { /** * This < b > must < / b > return an instance of { @ code InternalDriverContext } ( it ' s not expressed * directly in the signature to avoid leaking that type through the protected API ) . */ protected DriverContext buildContext ( DriverConfigLoader configLoader , List < TypeCodec < ? > > typeCodecs , NodeStateListener nodeStateListener , SchemaChangeListener schemaChangeListener , RequestTracker requestTracker , Map < String , String > localDatacenters , Map < String , Predicate < Node > > nodeFilters , ClassLoader classLoader ) { } }
return new DefaultDriverContext ( configLoader , typeCodecs , nodeStateListener , schemaChangeListener , requestTracker , localDatacenters , nodeFilters , classLoader ) ;
public class BPGImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . BPG__PAGE_NAME : return PAGE_NAME_EDEFAULT == null ? pageName != null : ! PAGE_NAME_EDEFAULT . equals ( pageName ) ; case AfplibPackage . BPG__TRIPLETS : return triplets != null && ! triplets . isEmpty ( ) ; } return super . eIsSet ( featureID ) ;
public class GBSTree { /** * Pessimistic find in a GBS Tree */ private void pessimisticFind ( SearchComparator comp , Object searchKey , SearchNode point ) { } }
point . reset ( ) ; synchronized ( this ) { internalFind ( comp , searchKey , point ) ; _pessimisticFinds ++ ; }
public class PIXConsumerAuditor { /** * Audits an ITI - 10 PIX Update Notification event for * Patient Identifier Cross - reference ( PIX ) Consumer actors . * @ param eventOutcome The event outcome indicator * @ param pixMgrIpAddress The IP Address of the PIX Manager that sent the event * @ param receivingFacility The HL7 receiving facility * @ param receivingApp The HL7 receiving application * @ param sendingFacility The HL7 sending facility * @ param sendingApp The HL7 sending application * @ param hl7MessageControlId The HL7 message control id from the MSH segment * @ param patientIds List of patient IDs that were seen in this transaction */ public void auditUpdateNotificationEvent ( RFC3881EventOutcomeCodes eventOutcome , String pixMgrIpAddress , String sendingFacility , String sendingApp , String receivingFacility , String receivingApp , String hl7MessageControlId , String [ ] patientIds ) { } }
if ( ! isAuditorEnabled ( ) ) { return ; } auditPatientRecordEvent ( false , new IHETransactionEventTypeCodes . PIXUpdateNotification ( ) , eventOutcome , RFC3881EventCodes . RFC3881EventActionCodes . UPDATE , sendingFacility , sendingApp , null , pixMgrIpAddress , receivingFacility , receivingApp , getSystemAltUserId ( ) , getSystemNetworkId ( ) , null , hl7MessageControlId , patientIds , null , null ) ;
public class Profiler { /** * Gets the time elapsed , from calling { @ link Profiler # startSection ( String ) startSection ( section ) } * to calling { @ link Profiler # endSection ( String ) endSection ( section ) } in milliseconds . < br > * If the elapsed section time was not profiled , returns - 1. * @ param section The name of the section of which the elapsed time to request * @ return The elapsed section time if the section was profiled , or { @ code - 1 } otherwise */ public synchronized long getSectionTime ( String section ) { } }
section = section . toLowerCase ( ) ; if ( ! this . elapsedTime . containsKey ( section ) ) return - 1 ; return this . elapsedTime . get ( section ) ;
public class SampleMachineTransformer { /** * Replace known tags in the current data values with actual values as appropriate * @ param cr a reference to DataPipe from which to read the current map */ public void transform ( DataPipe cr ) { } }
Map < String , String > map = cr . getDataMap ( ) ; for ( String key : map . keySet ( ) ) { String value = map . get ( key ) ; if ( value . equals ( "#{customplaceholder}" ) ) { // Generate a random number int ran = rand . nextInt ( ) ; map . put ( key , String . valueOf ( ran ) ) ; } else if ( value . equals ( "#{divideBy2}" ) ) { String i = map . get ( "var_out_V3" ) ; String result = String . valueOf ( Integer . valueOf ( i ) / 2 ) ; map . put ( key , result ) ; } }
public class DefaultErrorHandler { /** * Default implementation . May be overridden in subclasses < br > * Throws * { @ link com . github . avarabyeu . restendpoint . http . exception . RestEndpointException } * if Response status code starts from 4xx or 5xx * Throwed exceptions may be overridden in handle * methods */ @ Override public void handle ( Response < ByteSource > rs ) throws RestEndpointIOException { } }
if ( ! hasError ( rs ) ) { return ; } handleError ( rs . getUri ( ) , rs . getHttpMethod ( ) , rs . getStatus ( ) , rs . getReason ( ) , rs . getBody ( ) ) ;
public class RequestBuilders { /** * Builds the HTML for the given response . * This is the root of the HTML . Should display all what is needed , including * the status , timing , etc . Then call the recursive builders for the * response ' s JSON . */ protected String build ( Response response ) { } }
StringBuilder sb = new StringBuilder ( ) ; sb . append ( "<div class='container'>" ) ; sb . append ( "<div class='row-fluid'>" ) ; sb . append ( "<div class='span12'>" ) ; sb . append ( buildJSONResponseBox ( response ) ) ; if ( response . _status == Response . Status . done ) response . toJava ( sb ) ; sb . append ( buildResponseHeader ( response ) ) ; Builder builder = response . getBuilderFor ( ROOT_OBJECT ) ; if ( builder == null ) { sb . append ( "<h3>" + name ( ) + "</h3>" ) ; builder = OBJECT_BUILDER ; } for ( String h : response . getHeaders ( ) ) sb . append ( h ) ; if ( response . _response == null ) { boolean done = response . _req . toHTML ( sb ) ; if ( ! done ) { JsonParser parser = new JsonParser ( ) ; String json = new String ( response . _req . writeJSON ( new AutoBuffer ( ) ) . buf ( ) ) ; JsonObject o = ( JsonObject ) parser . parse ( json ) ; sb . append ( builder . build ( response , o , "" ) ) ; } } else sb . append ( builder . build ( response , response . _response , "" ) ) ; sb . append ( "</div></div></div>" ) ; return sb . toString ( ) ;
public class TaskNotifier { /** * Default implementation : If outcome is " Assigned " , send only to assignee ' s email . * Otherwise , if Notice Groups attribute is present , the groups so specified * are unioned with any recipients resulting from evaluation of the Recipients Expression attribute . * If no Notice Groups are specified , any workgroups associated with the task are added to the * Recipients Expression outcome . */ protected List < String > getRecipients ( String outcome ) throws ObserverException { } }
if ( "Assigned" . equals ( outcome ) ) { // send e - mail only to assignee return Arrays . asList ( new String [ ] { context . getAssignee ( ) . getEmail ( ) } ) ; } else { try { ContextEmailRecipients contextRecipients = new ContextEmailRecipients ( context ) ; String groups = context . getAttribute ( TaskAttributeConstant . NOTICE_GROUPS ) ; if ( groups != null && ! groups . isEmpty ( ) && ! groups . equals ( "[]" ) ) { return contextRecipients . getRecipients ( TaskAttributeConstant . NOTICE_GROUPS , TaskAttributeConstant . RECIPIENT_EMAILS ) ; } else { List < String > emails = contextRecipients . getGroupEmails ( context . getTaskInstance ( ) . getWorkgroups ( ) ) ; for ( String email : contextRecipients . getRecipients ( null , TaskAttributeConstant . RECIPIENT_EMAILS ) ) { if ( ! emails . contains ( email ) ) emails . add ( email ) ; } return emails ; } } catch ( DataAccessException | ParseException ex ) { throw new ObserverException ( ex . getMessage ( ) , ex ) ; } }
public class DocumentUtils { /** * Returns a String representation for the XML Document . * @ param xmlDocument the XML Document * @ return String representation for the XML Document * @ throws IOException */ public static String documentToString ( Document xmlDocument ) throws IOException { } }
String encoding = ( xmlDocument . getXmlEncoding ( ) == null ) ? "UTF-8" : xmlDocument . getXmlEncoding ( ) ; OutputFormat format = new OutputFormat ( xmlDocument ) ; format . setLineWidth ( 65 ) ; format . setIndenting ( true ) ; format . setIndent ( 2 ) ; format . setEncoding ( encoding ) ; try ( Writer out = new StringWriter ( ) ) { XMLSerializer serializer = new XMLSerializer ( out , format ) ; serializer . serialize ( xmlDocument ) ; return out . toString ( ) ; }
public class OrderItem { /** * Get qualified name . * @ return qualified name */ public Optional < String > getQualifiedName ( ) { } }
if ( null == name ) { return Optional . absent ( ) ; } return null == owner ? Optional . of ( name ) : Optional . of ( owner + "." + name ) ;
public class Requests { /** * Create a new { @ link PublishNotify } instance that is used to publish * a list of metadata on a link between two { @ link Identifier } instances . * The { @ link MetadataLifetime } of the new metadata is set to * { @ link MetadataLifetime # session } . * @ param i1 the first { @ link Identifier } of the link * @ param i2 the second { @ link Identifier } of the link * @ param mdlist a list of metadata objects * @ return the new { @ link PublishNotify } instance */ public static PublishNotify createPublishNotify ( Identifier i1 , Identifier i2 , Collection < Document > mdlist ) { } }
if ( mdlist == null ) { throw new NullPointerException ( "mdlist is null" ) ; } PublishNotify pn = createPublishNotify ( ) ; fillMetadataHolder ( pn , i1 , i2 , mdlist ) ; return pn ;
public class NodeImpl { /** * { @ inheritDoc } */ public NodeDefinition getDefinition ( ) throws RepositoryException { } }
checkValid ( ) ; if ( nodeDefinition == null ) { NodeTypeDataManager nodeTypesHolder = session . getWorkspace ( ) . getNodeTypesHolder ( ) ; ExtendedNodeTypeManager nodeTypeManager = ( ExtendedNodeTypeManager ) session . getWorkspace ( ) . getNodeTypeManager ( ) ; if ( this . isRoot ( ) ) { // root - no parent if ( nodeDefinition == null ) { NodeType required = nodeTypeManager . getNodeType ( locationFactory . createJCRName ( Constants . NT_BASE ) . getAsString ( ) ) ; InternalQName requiredName = sysLocFactory . parseJCRName ( required . getName ( ) ) . getInternalName ( ) ; NodeDefinitionData ntData = new NodeDefinitionData ( null , null , true , true , OnParentVersionAction . ABORT , false , new InternalQName [ ] { requiredName } , null , true ) ; this . nodeDefinition = new NodeDefinitionImpl ( ntData , nodeTypesHolder , nodeTypeManager , sysLocFactory , session . getValueFactory ( ) , session . getTransientNodesManager ( ) ) ; } } else { NodeData parent = ( NodeData ) dataManager . getItemData ( getParentIdentifier ( ) ) ; this . definition = nodeTypesHolder . getChildNodeDefinition ( getInternalName ( ) , nodeData ( ) . getPrimaryTypeName ( ) , parent . getPrimaryTypeName ( ) , parent . getMixinTypeNames ( ) ) ; if ( definition == null ) { throw new ConstraintViolationException ( "Node definition not found for " + getPath ( ) ) ; } InternalQName [ ] rnames = definition . getRequiredPrimaryTypes ( ) ; NodeType [ ] rnts = new NodeType [ rnames . length ] ; for ( int j = 0 ; j < rnames . length ; j ++ ) { rnts [ j ] = nodeTypeManager . findNodeType ( rnames [ j ] ) ; } nodeDefinition = new NodeDefinitionImpl ( definition , nodeTypesHolder , nodeTypeManager , sysLocFactory , session . getValueFactory ( ) , session . getTransientNodesManager ( ) ) ; } } return nodeDefinition ;
public class CmsVaadinUtils { /** * Gets the window which contains a given component . < p > * @ param component the component * @ return the window containing the component , or null if no component is found */ public static Window getWindow ( Component component ) { } }
if ( component == null ) { return null ; } else if ( component instanceof Window ) { return ( Window ) component ; } else { return getWindow ( component . getParent ( ) ) ; }
public class TagChecker { /** * Add general sibling elements . * @ see < a href = " http : / / www . w3 . org / TR / css3 - selectors / # general - sibling - combinators " > General sibling combinator < / a > */ private void addGeneralSiblingElements ( ) { } }
for ( Node node : nodes ) { Node n = helper . getNextSibling ( node ) ; while ( n != null ) { String tag = selector . getTagName ( ) ; if ( helper . nameMatches ( n , tag ) ) result . add ( n ) ; n = helper . getNextSibling ( n ) ; } }
public class LDPathResult { /** * Add a single result * @ param field * @ param result * @ return */ public boolean add ( String field , RDFNode result ) { } }
if ( ! this . result . containsKey ( field ) ) { this . result . put ( field , new ArrayList < RDFNode > ( ) ) ; } this . result . get ( field ) . add ( result ) ; return true ;
public class Zhang99CalibrationMatrixFromHomographies { /** * This computes the v _ ij vector found in the paper . */ private void computeV ( DMatrixRMaj h1 , DMatrixRMaj h2 , DMatrixRMaj v ) { } }
double h1x = h1 . get ( 0 , 0 ) ; double h1y = h1 . get ( 1 , 0 ) ; double h1z = h1 . get ( 2 , 0 ) ; double h2x = h2 . get ( 0 , 0 ) ; double h2y = h2 . get ( 1 , 0 ) ; double h2z = h2 . get ( 2 , 0 ) ; v . set ( 0 , 0 , h1x * h2x ) ; v . set ( 0 , 1 , h1x * h2y + h1y * h2x ) ; v . set ( 0 , 2 , h1y * h2y ) ; v . set ( 0 , 3 , h1z * h2x + h1x * h2z ) ; v . set ( 0 , 4 , h1z * h2y + h1y * h2z ) ; v . set ( 0 , 5 , h1z * h2z ) ;
public class KeyVaultClientBaseImpl { /** * Retrieves a list of individual key versions with the same key name . * The full key identifier , attributes , and tags are provided in the response . This operation requires the keys / list permission . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ param serviceFuture the ServiceFuture object tracking the Retrofit calls * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < List < KeyItem > > getKeyVersionsNextAsync ( final String nextPageLink , final ServiceFuture < List < KeyItem > > serviceFuture , final ListOperationCallback < KeyItem > serviceCallback ) { } }
return AzureServiceFuture . fromPageResponse ( getKeyVersionsNextSinglePageAsync ( nextPageLink ) , new Func1 < String , Observable < ServiceResponse < Page < KeyItem > > > > ( ) { @ Override public Observable < ServiceResponse < Page < KeyItem > > > call ( String nextPageLink ) { return getKeyVersionsNextSinglePageAsync ( nextPageLink ) ; } } , serviceCallback ) ;
public class GrailsDomainBinder { /** * Calculates the mapping table for a many - to - many . One side of * the relationship has to " own " the relationship so that there is not a situation * where you have two mapping tables for left _ right and right _ left */ protected String calculateTableForMany ( ToMany property , String sessionFactoryBeanName ) { } }
NamingStrategy namingStrategy = getNamingStrategy ( sessionFactoryBeanName ) ; String propertyColumnName = namingStrategy . propertyToColumnName ( property . getName ( ) ) ; // fix for GRAILS - 5895 PropertyConfig config = getPropertyConfig ( property ) ; JoinTable jt = config != null ? config . getJoinTable ( ) : null ; boolean hasJoinTableMapping = jt != null && jt . getName ( ) != null ; String left = getTableName ( property . getOwner ( ) , sessionFactoryBeanName ) ; if ( Map . class . isAssignableFrom ( property . getType ( ) ) ) { if ( hasJoinTableMapping ) { return jt . getName ( ) ; } return addUnderscore ( left , propertyColumnName ) ; } if ( property instanceof Basic ) { if ( hasJoinTableMapping ) { return jt . getName ( ) ; } return addUnderscore ( left , propertyColumnName ) ; } if ( property . getAssociatedEntity ( ) == null ) { throw new MappingException ( "Expected an entity to be associated with the association (" + property + ") and none was found. " ) ; } String right = getTableName ( property . getAssociatedEntity ( ) , sessionFactoryBeanName ) ; if ( property instanceof ManyToMany ) { if ( hasJoinTableMapping ) { return jt . getName ( ) ; } if ( property . isOwningSide ( ) ) { return addUnderscore ( left , propertyColumnName ) ; } return addUnderscore ( right , namingStrategy . propertyToColumnName ( ( ( ManyToMany ) property ) . getInversePropertyName ( ) ) ) ; } if ( shouldCollectionBindWithJoinColumn ( property ) ) { if ( hasJoinTableMapping ) { return jt . getName ( ) ; } left = trimBackTigs ( left ) ; right = trimBackTigs ( right ) ; return addUnderscore ( left , right ) ; } if ( property . isOwningSide ( ) ) { return addUnderscore ( left , right ) ; } return addUnderscore ( right , left ) ;
public class CreateVatIdMapConstantsClass { /** * Instantiates a class via deferred binding . * @ return the new instance , which must be cast to the requested class */ public static VatIdMapSharedConstants create ( ) { } }
if ( vatIdMapConstants == null ) { // NOPMD it ' s thread save ! synchronized ( VatIdMapConstants . class ) { if ( vatIdMapConstants == null ) { vatIdMapConstants = GWT . create ( VatIdMapConstants . class ) ; } } } return vatIdMapConstants ;
public class Messages { /** * Converts a JSON object to a protobuf message * @ param builder the proto message type builder * @ param input the JSON object to convert */ public static Message fromJson ( Message . Builder builder , JsonObject input ) throws Exception { } }
Descriptors . Descriptor descriptor = builder . getDescriptorForType ( ) ; for ( Map . Entry < String , JsonElement > entry : input . entrySet ( ) ) { String protoName = CaseFormat . LOWER_CAMEL . to ( CaseFormat . LOWER_UNDERSCORE , entry . getKey ( ) ) ; Descriptors . FieldDescriptor field = descriptor . findFieldByName ( protoName ) ; if ( field == null ) { throw new Exception ( "Can't find descriptor for field " + protoName ) ; } if ( field . isRepeated ( ) ) { if ( ! entry . getValue ( ) . isJsonArray ( ) ) { // fail } JsonArray array = entry . getValue ( ) . getAsJsonArray ( ) ; for ( JsonElement item : array ) { builder . addRepeatedField ( field , parseField ( field , item , builder ) ) ; } } else { builder . setField ( field , parseField ( field , entry . getValue ( ) , builder ) ) ; } } return builder . build ( ) ;
public class CmsUserDriver { /** * Creates a folder with the given path an properties , offline AND online . < p > * @ param dbc the current database context * @ param path the path to create the folder * @ param flags the resource flags * @ return the new created offline folder * @ throws CmsException if something goes wrong */ protected CmsResource internalCreateResourceForOrgUnit ( CmsDbContext dbc , String path , int flags ) throws CmsException { } }
// create the offline folder CmsResource resource = new CmsFolder ( new CmsUUID ( ) , new CmsUUID ( ) , path , CmsResourceTypeFolder . RESOURCE_TYPE_ID , ( CmsResource . FLAG_INTERNAL | flags ) , dbc . currentProject ( ) . getUuid ( ) , CmsResource . STATE_NEW , 0 , dbc . currentUser ( ) . getId ( ) , 0 , dbc . currentUser ( ) . getId ( ) , CmsResource . DATE_RELEASED_DEFAULT , CmsResource . DATE_EXPIRED_DEFAULT , 0 ) ; CmsUUID projectId = ( ( dbc . getProjectId ( ) == null ) || dbc . getProjectId ( ) . isNullUUID ( ) ) ? dbc . currentProject ( ) . getUuid ( ) : dbc . getProjectId ( ) ; m_driverManager . getVfsDriver ( dbc ) . createResource ( dbc , projectId , resource , null ) ; resource . setState ( CmsResource . STATE_UNCHANGED ) ; m_driverManager . getVfsDriver ( dbc ) . writeResource ( dbc , projectId , resource , CmsDriverManager . NOTHING_CHANGED ) ; if ( ! dbc . currentProject ( ) . isOnlineProject ( ) && dbc . getProjectId ( ) . isNullUUID ( ) ) { // online persistence CmsProject onlineProject = m_driverManager . readProject ( dbc , CmsProject . ONLINE_PROJECT_ID ) ; m_driverManager . getVfsDriver ( dbc ) . createResource ( dbc , onlineProject . getUuid ( ) , resource , null ) ; } // clear the internal caches OpenCms . getMemoryMonitor ( ) . clearAccessControlListCache ( ) ; OpenCms . getMemoryMonitor ( ) . flushCache ( CmsMemoryMonitor . CacheType . PROPERTY ) ; OpenCms . getMemoryMonitor ( ) . flushCache ( CmsMemoryMonitor . CacheType . PROPERTY_LIST ) ; // fire an event that a new resource has been created OpenCms . fireCmsEvent ( new CmsEvent ( I_CmsEventListener . EVENT_RESOURCE_CREATED , Collections . < String , Object > singletonMap ( I_CmsEventListener . KEY_RESOURCE , resource ) ) ) ; return resource ;
public class CloudSpannerXAConnection { /** * Preconditions : 1 . flags must be one of TMNOFLAGS , TMRESUME or TMJOIN 2 . xid ! = null 3. * connection must not be associated with a transaction 4 . the TM hasn ' t seen the xid before * Implementation deficiency preconditions : 1 . TMRESUME not supported . 2 . if flags is TMJOIN , we * must be in ended state , and xid must be the current transaction 3 . unless flags is TMJOIN , * previous transaction using the connection must be committed or prepared or rolled back * Postconditions : 1 . Connection is associated with the transaction * @ see XAResource # start ( Xid , int ) */ @ Override public void start ( Xid xid , int flags ) throws XAException { } }
if ( logger . logDebug ( ) ) { debug ( "starting transaction xid = " + xid ) ; } // Check preconditions if ( flags != XAResource . TMNOFLAGS && flags != XAResource . TMRESUME && flags != XAResource . TMJOIN ) { throw new CloudSpannerXAException ( CloudSpannerXAException . INVALID_FLAGS , Code . INVALID_ARGUMENT , XAException . XAER_INVAL ) ; } if ( xid == null ) { throw new CloudSpannerXAException ( CloudSpannerXAException . XID_NOT_NULL , Code . INVALID_ARGUMENT , XAException . XAER_INVAL ) ; } if ( state == STATE_ACTIVE ) { throw new CloudSpannerXAException ( CloudSpannerXAException . CONNECTION_BUSY , Code . FAILED_PRECONDITION , XAException . XAER_PROTO ) ; } // We can ' t check precondition 4 easily , so we don ' t . Duplicate xid will // be catched in prepare // phase . // Check implementation deficiency preconditions if ( flags == TMRESUME ) { throw new CloudSpannerXAException ( CloudSpannerXAException . SUSPEND_NOT_IMPLEMENTED , Code . UNIMPLEMENTED , XAException . XAER_RMERR ) ; } // It ' s ok to join an ended transaction . WebLogic does that . if ( flags == TMJOIN ) { if ( state != STATE_ENDED ) { throw new CloudSpannerXAException ( CloudSpannerXAException . INTERLEAVING_NOT_IMPLEMENTED , Code . UNIMPLEMENTED , XAException . XAER_RMERR ) ; } if ( ! xid . equals ( currentXid ) ) { throw new CloudSpannerXAException ( CloudSpannerXAException . INTERLEAVING_NOT_IMPLEMENTED , Code . UNIMPLEMENTED , XAException . XAER_RMERR ) ; } } else if ( state == STATE_ENDED ) { throw new CloudSpannerXAException ( CloudSpannerXAException . INTERLEAVING_NOT_IMPLEMENTED , Code . UNIMPLEMENTED , XAException . XAER_RMERR ) ; } // Only need save localAutoCommitMode for NOFLAGS , TMRESUME and TMJOIN // already saved old // localAutoCommitMode . if ( flags == TMNOFLAGS ) { try { localAutoCommitMode = conn . getAutoCommit ( ) ; conn . setAutoCommit ( false ) ; } catch ( CloudSpannerSQLException ex ) { throw new CloudSpannerXAException ( CloudSpannerXAException . ERROR_DISABLING_AUTOCOMMIT , ex , XAException . XAER_RMERR ) ; } catch ( SQLException ex ) { throw new CloudSpannerXAException ( CloudSpannerXAException . ERROR_DISABLING_AUTOCOMMIT , ex , Code . UNKNOWN , XAException . XAER_RMERR ) ; } } // Preconditions are met , Associate connection with the transaction state = STATE_ACTIVE ; currentXid = xid ;
public class ValidationData { /** * Update field . * @ param field the field */ public void updateField ( Field field ) { } }
this . name = field . getName ( ) ; this . obj = TypeCheckUtil . isObjClass ( field ) ; this . list = TypeCheckUtil . isListClass ( field ) ; this . number = TypeCheckUtil . isNumberClass ( field ) ; this . enumType = field . getType ( ) . isEnum ( ) ; this . typeClass = field . getType ( ) ; this . type = field . getType ( ) . getSimpleName ( ) ; if ( this . list ) { this . innerClass = ValidationObjUtil . getListInnerClassFromGenericType ( field . getGenericType ( ) ) ; this . type += "<" + this . innerClass . getSimpleName ( ) + ">" ; }
public class DateUtil { /** * 创建相应的ChronoUnit * @ param dateUnit 单位 * @ return ChronoUnit */ private static ChronoUnit create ( DateUnit dateUnit ) { } }
switch ( dateUnit ) { case YEAR : return ChronoUnit . YEARS ; case MONTH : return ChronoUnit . MONTHS ; case DAY : return ChronoUnit . DAYS ; case HOUR : return ChronoUnit . HOURS ; case MINUTE : return ChronoUnit . MINUTES ; case SECOND : return ChronoUnit . SECONDS ; default : throw new DateUtilException ( "没有单位:" + dateUnit ) ; }
public class Config { /** * 配置属性 * @ param properties */ public void setProperties ( Properties properties ) { } }
if ( properties == null ) { // 默认驼峰 this . style = Style . camelhump ; return ; } String IDENTITY = properties . getProperty ( "IDENTITY" ) ; if ( StringUtil . isNotEmpty ( IDENTITY ) ) { setIDENTITY ( IDENTITY ) ; } String seqFormat = properties . getProperty ( "seqFormat" ) ; if ( StringUtil . isNotEmpty ( seqFormat ) ) { setSeqFormat ( seqFormat ) ; } String catalog = properties . getProperty ( "catalog" ) ; if ( StringUtil . isNotEmpty ( catalog ) ) { setCatalog ( catalog ) ; } String schema = properties . getProperty ( "schema" ) ; if ( StringUtil . isNotEmpty ( schema ) ) { setSchema ( schema ) ; } // ORDER 有三个属性名可以进行配置 String ORDER = properties . getProperty ( "ORDER" ) ; if ( StringUtil . isNotEmpty ( ORDER ) ) { setOrder ( ORDER ) ; } ORDER = properties . getProperty ( "order" ) ; if ( StringUtil . isNotEmpty ( ORDER ) ) { setOrder ( ORDER ) ; } ORDER = properties . getProperty ( "before" ) ; if ( StringUtil . isNotEmpty ( ORDER ) ) { setBefore ( Boolean . valueOf ( ORDER ) ) ; } this . notEmpty = Boolean . valueOf ( properties . getProperty ( "notEmpty" ) ) ; this . enableMethodAnnotation = Boolean . valueOf ( properties . getProperty ( "enableMethodAnnotation" ) ) ; this . checkExampleEntityClass = Boolean . valueOf ( properties . getProperty ( "checkExampleEntityClass" ) ) ; // 默认值 true , 所以要特殊判断 String useSimpleTypeStr = properties . getProperty ( "useSimpleType" ) ; if ( StringUtil . isNotEmpty ( useSimpleTypeStr ) ) { this . useSimpleType = Boolean . valueOf ( useSimpleTypeStr ) ; } this . enumAsSimpleType = Boolean . valueOf ( properties . getProperty ( "enumAsSimpleType" ) ) ; // 注册新的基本类型 , 以逗号隔开 , 使用全限定类名 String simpleTypes = properties . getProperty ( "simpleTypes" ) ; if ( StringUtil . isNotEmpty ( simpleTypes ) ) { SimpleTypeUtil . registerSimpleType ( simpleTypes ) ; } // 使用 8 种基本类型 if ( Boolean . valueOf ( properties . getProperty ( "usePrimitiveType" ) ) ) { SimpleTypeUtil . registerPrimitiveTypes ( ) ; } String styleStr = properties . getProperty ( "style" ) ; if ( StringUtil . isNotEmpty ( styleStr ) ) { try { this . style = Style . valueOf ( styleStr ) ; } catch ( IllegalArgumentException e ) { throw new MapperException ( styleStr + "不是合法的Style值!" ) ; } } else { // 默认驼峰 this . style = Style . camelhump ; } // 处理关键字 String wrapKeyword = properties . getProperty ( "wrapKeyword" ) ; if ( StringUtil . isNotEmpty ( wrapKeyword ) ) { this . wrapKeyword = wrapKeyword ; } // 安全删除 this . safeDelete = Boolean . valueOf ( properties . getProperty ( "safeDelete" ) ) ; // 安全更新 this . safeUpdate = Boolean . valueOf ( properties . getProperty ( "safeUpdate" ) ) ; // 是否设置 javaType , true 时如 { id , javaType = java . lang . Long } this . useJavaType = Boolean . valueOf ( properties . getProperty ( "useJavaType" ) ) ;
public class BeanPath { /** * Create a new DateTime path * @ param < A > * @ param property property name * @ param type property type * @ return property path */ @ SuppressWarnings ( "unchecked" ) protected < A extends Comparable > DateTimePath < A > createDateTime ( String property , Class < ? super A > type ) { } }
return add ( new DateTimePath < A > ( ( Class ) type , forProperty ( property ) ) ) ;
public class ObjectAccessor { /** * Creates a copy of the wrapped object , where the copy type is an * anonymous subclass of the wrapped object ' s class . * Note : it does a " shallow " copy . Reference fields are not copied * recursively . * @ return A shallow copy . */ public T copyIntoAnonymousSubclass ( ) { } }
T copy = Instantiator . of ( type ) . instantiateAnonymousSubclass ( ) ; return copyInto ( copy ) ;
public class ToStringUtils { /** * Transforms a list into a string of the from : * " V1 , V2 , V3" * Where the string versions of the key and value are derived from their toString ( ) function . * @ param < V > The type of the values of the list . * @ param list The list to be serialized to a string * @ return A string representation of the list . */ public static < V > String listToString ( List < V > list ) { } }
List < String > asStrings = list . stream ( ) . map ( Object :: toString ) . collect ( Collectors . toList ( ) ) ; asStrings . forEach ( v -> { Preconditions . checkArgument ( v == null || ! v . contains ( "," ) , "Invalid value: %s" , v ) ; } ) ; return Joiner . on ( "," ) . join ( asStrings ) ;
public class ManifestIterator { /** * Adds the manifest referenced by the specified resource to the list . * @ param resource Resource that references a manifest file . * @ return The manifest that was added , or null if not found or an error occurred . */ private Manifest addToList ( Resource resource ) { } }
try { if ( resource != null && resource . exists ( ) ) { Manifest manifest = new ManifestEx ( resource ) ; manifests . add ( manifest ) ; return manifest ; } } catch ( Exception e ) { log . debug ( "Exception occurred reading manifest: " + resource ) ; } return null ;
public class HandlerManager { /** * Gets the handler at the given index . * @ param < H > the event handler type * @ param index the index * @ param type the handler ' s event type * @ return the given handler */ public < H extends EventHandler > H getHandler ( GwtEvent . Type < H > type , int index ) { } }
return this . eventBus . superGetHandler ( type , index ) ;
public class RepositoryQueryManager { /** * Clean all indexes and reindex all content . * @ param async true if the reindexing should be done in the background , or false if it should be done using this thread */ protected void cleanAndReindex ( boolean async ) { } }
final IndexWriter writer = getIndexWriter ( ) ; scan ( async , getIndexWriter ( ) , new Callable < Void > ( ) { @ SuppressWarnings ( "synthetic-access" ) @ Override public Void call ( ) throws Exception { writer . clearAllIndexes ( ) ; reindexContent ( true , writer ) ; return null ; } } ) ;
public class KafkaMsgConsumer { /** * Seeks to a specified offset . * @ param tpo * @ return { @ code true } if the consumer has subscribed to the specified * topic / partition , { @ code false } otherwise . * @ since 1.3.2 */ public boolean seek ( KafkaTopicPartitionOffset tpo ) { } }
KafkaConsumer < String , byte [ ] > consumer = _getConsumer ( tpo . topic ) ; return KafkaHelper . seek ( consumer , tpo ) ;
public class ZookeeperServiceRegistry { /** * private void configureServiceDiscovery ( ) { * this . zookeeperServiceDiscovery . configureServiceDiscovery ( this . * zookeeperServiceDiscovery . getServiceDiscoveryRef ( ) , this . curator , this . properties , * this . instanceSerializer , this . zookeeperServiceDiscovery . getServiceInstanceRef ( ) ) ; } */ @ Override public void register ( ZookeeperRegistration registration ) { } }
try { getServiceDiscovery ( ) . registerService ( registration . getServiceInstance ( ) ) ; } catch ( Exception e ) { rethrowRuntimeException ( e ) ; }
public class P3DatabaseReader { /** * Retrieve a list of the available P3 project names from a directory . * @ param directory directory containing P3 files * @ return list of project names */ public static final List < String > listProjectNames ( File directory ) { } }
List < String > result = new ArrayList < String > ( ) ; File [ ] files = directory . listFiles ( new FilenameFilter ( ) { @ Override public boolean accept ( File dir , String name ) { return name . toUpperCase ( ) . endsWith ( "STR.P3" ) ; } } ) ; if ( files != null ) { for ( File file : files ) { String fileName = file . getName ( ) ; String prefix = fileName . substring ( 0 , fileName . length ( ) - 6 ) ; result . add ( prefix ) ; } } Collections . sort ( result ) ; return result ;
public class ComputationGraph { /** * Get a given layer by name . */ public Layer getLayer ( String name ) { } }
Preconditions . checkState ( verticesMap . containsKey ( name ) , "Layer with name %s does not exist in the network" , name ) ; return verticesMap . get ( name ) . getLayer ( ) ;
public class MkCoPTreeNode { /** * Determines and returns the progressive approximation for the knn distances * of this node as the maximum of the progressive approximations of all * entries . * @ param k _ max the maximum k parameter * @ return the conservative approximation for the knn distances */ protected ApproximationLine progressiveKnnDistanceApproximation ( int k_max ) { } }
if ( ! isLeaf ( ) ) { throw new UnsupportedOperationException ( "Progressive KNN-distance approximation " + "is only vailable in leaf nodes!" ) ; } // determine k _ 0 , y _ 1 , y _ kmax int k_0 = 0 ; double y_1 = Double . POSITIVE_INFINITY ; double y_kmax = Double . POSITIVE_INFINITY ; for ( int i = 0 ; i < getNumEntries ( ) ; i ++ ) { MkCoPLeafEntry entry = ( MkCoPLeafEntry ) getEntry ( i ) ; ApproximationLine approx = entry . getProgressiveKnnDistanceApproximation ( ) ; k_0 = Math . max ( approx . getK_0 ( ) , k_0 ) ; } for ( int i = 0 ; i < getNumEntries ( ) ; i ++ ) { MkCoPLeafEntry entry = ( MkCoPLeafEntry ) getEntry ( i ) ; ApproximationLine approx = entry . getProgressiveKnnDistanceApproximation ( ) ; y_1 = Math . min ( approx . getValueAt ( k_0 ) , y_1 ) ; y_kmax = Math . min ( approx . getValueAt ( k_max ) , y_kmax ) ; } // determine m and t double m = ( y_kmax - y_1 ) / ( FastMath . log ( k_max ) - FastMath . log ( k_0 ) ) ; double t = y_1 - m * FastMath . log ( k_0 ) ; return new ApproximationLine ( k_0 , m , t ) ;
public class Layers { /** * Adds multiple new layers on top . * @ param layers The new layers to add * @ param redraw Whether the map should be redrawn after adding the layers * @ see List # addAll ( Collection ) */ public synchronized void addAll ( Collection < Layer > layers , boolean redraw ) { } }
checkIsNull ( layers ) ; for ( Layer layer : layers ) { layer . setDisplayModel ( this . displayModel ) ; } this . layersList . addAll ( layers ) ; for ( Layer layer : layers ) { layer . assign ( this . redrawer ) ; } if ( redraw ) { this . redrawer . redrawLayers ( ) ; }
public class TimedMap { /** * This method removes any expired data from the map . */ private void purge ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && _tc . isEntryEnabled ( ) ) SibTr . entry ( this , _tc , "purge" ) ; Iterator < Map . Entry < K , TimedValue < V > > > it = _realMap . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Map . Entry < K , TimedValue < V > > entry = it . next ( ) ; TimedValue < V > value = entry . getValue ( ) ; if ( value . hasExipred ( ) ) { it . remove ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && _tc . isDebugEnabled ( ) ) { SibTr . debug ( _tc , "The value with the key " + entry . getKey ( ) + " has expired" ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && _tc . isEntryEnabled ( ) ) SibTr . exit ( this , _tc , "purge" ) ;
public class FrameOutputWriter { /** * Get the frame sizes and their contents . * @ return a content tree for the frame details */ protected Content getFrameDetails ( ) { } }
HtmlTree frameset = HtmlTree . FRAMESET ( "20%,80%" , null , "Documentation frame" , "top.loadFrames()" ) ; if ( noOfPackages <= 1 ) { addAllClassesFrameTag ( frameset ) ; } else if ( noOfPackages > 1 ) { HtmlTree leftFrameset = HtmlTree . FRAMESET ( null , "30%,70%" , "Left frames" , "top.loadFrames()" ) ; addAllPackagesFrameTag ( leftFrameset ) ; addAllClassesFrameTag ( leftFrameset ) ; frameset . addContent ( leftFrameset ) ; } addClassFrameTag ( frameset ) ; addFrameWarning ( frameset ) ; return frameset ;
public class DataSink { protected GenericDataSinkBase < T > translateToDataFlow ( Operator < T > input ) { } }
// select the name ( or create a default one ) String name = this . name != null ? this . name : this . format . toString ( ) ; GenericDataSinkBase < T > sink = new GenericDataSinkBase < > ( this . format , new UnaryOperatorInformation < > ( this . type , new NothingTypeInfo ( ) ) , name ) ; // set input sink . setInput ( input ) ; // set parameters if ( this . parameters != null ) { sink . getParameters ( ) . addAll ( this . parameters ) ; } // set parallelism if ( this . parallelism > 0 ) { // use specified parallelism sink . setParallelism ( this . parallelism ) ; } else { // if no parallelism has been specified , use parallelism of input operator to enable chaining sink . setParallelism ( input . getParallelism ( ) ) ; } if ( this . sortKeyPositions != null ) { // configure output sorting Ordering ordering = new Ordering ( ) ; for ( int i = 0 ; i < this . sortKeyPositions . length ; i ++ ) { ordering . appendOrdering ( this . sortKeyPositions [ i ] , null , this . sortOrders [ i ] ) ; } sink . setLocalOrder ( ordering ) ; } return sink ;
public class OpenInventoryMessage { /** * Handles the received { @ link Packet } on the client . < br > * Opens the GUI for the { @ link MalisisInventory } * @ param message the message * @ param ctx the ctx */ @ Override public void process ( Packet message , MessageContext ctx ) { } }
EntityPlayerSP player = ( EntityPlayerSP ) Utils . getClientPlayer ( ) ; if ( message . type == ContainerType . TYPE_TILEENTITY ) { IDirectInventoryProvider inventoryProvider = TileEntityUtils . getTileEntity ( IDirectInventoryProvider . class , Utils . getClientWorld ( ) , message . pos ) ; if ( inventoryProvider != null ) MalisisInventory . open ( player , inventoryProvider , message . windowId ) ; } else if ( message . type == ContainerType . TYPE_ITEM ) { // TODO : send and use slot number instead of limited to equipped ItemStack itemStack = player . getHeldItemMainhand ( ) ; if ( itemStack == null || ! ( itemStack . getItem ( ) instanceof IDeferredInventoryProvider < ? > ) ) return ; @ SuppressWarnings ( "unchecked" ) IDeferredInventoryProvider < ItemStack > inventoryProvider = ( IDeferredInventoryProvider < ItemStack > ) itemStack . getItem ( ) ; MalisisInventory . open ( player , inventoryProvider , itemStack , message . windowId ) ; }
public class Matrices { /** * Defines a viewing transformation . This method is analogous to the now * deprecated { @ code gluLookAt } method . * @ param eye position of the eye point * @ param center position of the reference point * @ param up direction of the up vector * @ return */ public static final Mat4 lookAt ( final Vec3 eye , final Vec3 center , final Vec3 up ) { } }
final Vec3 f = center . subtract ( eye ) . getUnitVector ( ) ; Vec3 u = up . getUnitVector ( ) ; final Vec3 s = f . cross ( u ) . getUnitVector ( ) ; u = s . cross ( f ) ; return new Mat4 ( s . x , u . x , - f . x , 0f , s . y , u . y , - f . y , 0f , s . z , u . z , - f . z , 0f , - s . dot ( eye ) , - u . dot ( eye ) , f . dot ( eye ) , 1f ) ;
public class PowerMockRunner { /** * Clean up some state to avoid OOM issues */ @ Override public void run ( RunNotifier notifier ) { } }
Description description = getDescription ( ) ; try { super . run ( notifier ) ; } finally { try { Whitebox . setInternalState ( description , "fAnnotations" , new Annotation [ ] { } ) ; } catch ( RuntimeException err ) { if ( err . getCause ( ) instanceof java . lang . NoSuchFieldException && err . getCause ( ) . getMessage ( ) . equals ( "modifiers" ) ) { // on JDK12 you cannot change ' modifiers ' } else { throw err ; } } }
public class ChatApi { /** * Send a system command * Send a system command to the specified chat . * @ param id The ID of the chat interaction . ( required ) * @ param systemCommandData Request parameters . ( optional ) * @ return ApiResponse & lt ; ApiSuccessResponse & gt ; * @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */ public ApiResponse < ApiSuccessResponse > sendSystemCommandWithHttpInfo ( String id , SystemCommandData systemCommandData ) throws ApiException { } }
com . squareup . okhttp . Call call = sendSystemCommandValidateBeforeCall ( id , systemCommandData , null , null ) ; Type localVarReturnType = new TypeToken < ApiSuccessResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ;
public class PipelineBuilder { /** * Adds an operator expression to the pipeline . * @ param mTransaction * Transaction to operate with . * @ param mOperator * Operator type . */ public void addOperatorExpression ( final INodeReadTrx mTransaction , final String mOperator ) { } }
assert getPipeStack ( ) . size ( ) >= 1 ; final INodeReadTrx rtx = mTransaction ; final AbsAxis mOperand2 = getPipeStack ( ) . pop ( ) . getExpr ( ) ; // the unary operation only has one operator final AbsAxis mOperand1 = getPipeStack ( ) . pop ( ) . getExpr ( ) ; if ( getPipeStack ( ) . empty ( ) || getExpression ( ) . getSize ( ) != 0 ) { addExpressionSingle ( ) ; } final AbsAxis axis ; // TODO : use typeswitch of JAVA 7 if ( mOperator . equals ( "+" ) ) { axis = new AddOpAxis ( rtx , mOperand1 , mOperand2 ) ; } else if ( mOperator . equals ( "-" ) ) { axis = new SubOpAxis ( rtx , mOperand1 , mOperand2 ) ; } else if ( mOperator . equals ( "*" ) ) { axis = new MulOpAxis ( rtx , mOperand1 , mOperand2 ) ; } else if ( mOperator . equals ( "div" ) ) { axis = new DivOpAxis ( rtx , mOperand1 , mOperand2 ) ; } else if ( mOperator . equals ( "idiv" ) ) { axis = new IDivOpAxis ( rtx , mOperand1 , mOperand2 ) ; } else if ( mOperator . equals ( "mod" ) ) { axis = new ModOpAxis ( rtx , mOperand1 , mOperand2 ) ; } else { // TODO : unary operator throw new IllegalStateException ( mOperator + " is not a valid operator." ) ; } getExpression ( ) . add ( axis ) ;
public class DetailedStatistics { /** * Return the standard deviation . The standard deviation is a measure of the variation in a series of values . Values with a * lower standard deviation has less variance in the values than a series of values with a higher standard deviation . * @ return the standard deviation , or 0.0 if the { @ link # getCount ( ) count } is 0 or if all of the values are the same . */ public double getStandardDeviation ( ) { } }
Lock lock = this . getLock ( ) . readLock ( ) ; lock . lock ( ) ; try { return this . sigma ; } finally { lock . unlock ( ) ; }
public class JsonErrorResponseWriter { /** * Gets the json error output according to ODataException . * @ param exception ODataException * @ return errorJsonResponse * @ throws ODataRenderException If unable to render the json error message */ public String getJsonError ( ODataException exception ) throws ODataRenderException { } }
checkNotNull ( exception ) ; LOG . debug ( "Start building Json error document" ) ; ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( ) ; try { JsonGenerator jsonGenerator = JSON_FACTORY . createGenerator ( outputStream , JsonEncoding . UTF8 ) ; jsonGenerator . writeStartObject ( ) ; jsonGenerator . writeObjectFieldStart ( ERROR ) ; jsonGenerator . writeStringField ( CODE , String . valueOf ( exception . getCode ( ) . getCode ( ) ) ) ; jsonGenerator . writeStringField ( MESSAGE , String . valueOf ( exception . getMessage ( ) ) ) ; // optional if ( exception . getTarget ( ) != null ) { jsonGenerator . writeStringField ( TARGET , String . valueOf ( exception . getTarget ( ) ) . replace ( "\"" , "'" ) ) ; } jsonGenerator . writeEndObject ( ) ; jsonGenerator . close ( ) ; return outputStream . toString ( ) ; } catch ( IOException e ) { LOG . error ( "Not possible to write error JSON." ) ; throw new ODataRenderException ( "Not possible to write error JSON: " , e ) ; }
public class ConfigurationReader { /** * Parses the output parameter section . * @ param node * Reference to the current used xml node * @ param config * Reference to the ConfigSettings */ private void parseOutputConfig ( final Node node , final ConfigSettings config ) { } }
String name ; Long lValue ; Boolean bValue ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ) ; if ( name . equals ( KEY_OUTPUT_MODE ) ) { OutputType oValue = OutputType . parse ( nnode . getChildNodes ( ) . item ( 0 ) . getNodeValue ( ) ) ; config . setConfigParameter ( ConfigurationKeys . MODE_OUTPUT , oValue ) ; } else if ( name . equals ( KEY_PATH ) ) { String path = nnode . getChildNodes ( ) . item ( 0 ) . getNodeValue ( ) ; path = path . substring ( 1 , path . length ( ) - 1 ) ; config . setConfigParameter ( ConfigurationKeys . PATH_OUTPUT_SQL_FILES , path ) ; } else if ( name . equals ( KEY_OUTPUT_DATAFILE ) ) { bValue = Boolean . parseBoolean ( nnode . getChildNodes ( ) . item ( 0 ) . getNodeValue ( ) ) ; config . setConfigParameter ( ConfigurationKeys . MODE_DATAFILE_OUTPUT , bValue ) ; } else if ( name . equals ( KEY_LIMIT_SQL_FILE_SIZE ) ) { lValue = Long . parseLong ( nnode . getChildNodes ( ) . item ( 0 ) . getNodeValue ( ) ) ; config . setConfigParameter ( ConfigurationKeys . LIMIT_SQL_FILE_SIZE , lValue ) ; } else if ( name . equals ( KEY_LIMIT_SQL_ARCHIVE_SIZE ) ) { lValue = Long . parseLong ( nnode . getChildNodes ( ) . item ( 0 ) . getNodeValue ( ) ) ; config . setConfigParameter ( ConfigurationKeys . LIMIT_SQL_ARCHIVE_SIZE , lValue ) ; } else if ( name . equals ( KEY_MODE_ZIP_COMPRESSION_ENABLED ) ) { bValue = Boolean . parseBoolean ( nnode . getChildNodes ( ) . item ( 0 ) . getNodeValue ( ) ) ; config . setConfigParameter ( ConfigurationKeys . MODE_ZIP_COMPRESSION_ENABLED , bValue ) ; } else if ( name . equals ( KEY_MODE_BINARY_OUTPUT_ENABLED ) ) { bValue = Boolean . parseBoolean ( nnode . getChildNodes ( ) . item ( 0 ) . getNodeValue ( ) ) ; config . setConfigParameter ( ConfigurationKeys . MODE_BINARY_OUTPUT_ENABLED , bValue ) ; } else if ( name . equals ( SUBSECTION_SQL ) ) { parseSQLConfig ( nnode , config ) ; } }
public class BaseKvDao { /** * { @ inheritDoc } */ @ Override public boolean keyExists ( String spaceId , String key ) throws IOException { } }
/* * Call get ( spaceId , key ) ! = null or delegate to kvStorage . keyExists ( spaceId , key ) ? * Since DELETE and PUT operations can be async , delegating to kvStorage . keyExists ( spaceId , * key ) would be preferred to avoid out - of - date data . */ return kvStorage . keyExists ( spaceId , key ) ;
public class AmazonS3Client { /** * Used for performance testing purposes only . */ private void putLocalObject ( final UploadObjectRequest reqIn , OutputStream os ) throws IOException { } }
UploadObjectRequest req = reqIn . clone ( ) ; final File fileOrig = req . getFile ( ) ; final InputStream isOrig = req . getInputStream ( ) ; if ( isOrig == null ) { if ( fileOrig == null ) throw new IllegalArgumentException ( "Either a file lor input stream must be specified" ) ; req . setInputStream ( new FileInputStream ( fileOrig ) ) ; req . setFile ( null ) ; } try { IOUtils . copy ( req . getInputStream ( ) , os ) ; } finally { cleanupDataSource ( req , fileOrig , isOrig , req . getInputStream ( ) , log ) ; IOUtils . closeQuietly ( os , log ) ; } return ;
public class AmazonS3Client { /** * Returns a " complete " S3 specific signer , taking into the S3 bucket , key , * and the current S3 client configuration into account . */ protected Signer createSigner ( final Request < ? > request , final String bucketName , final String key ) { } }
return createSigner ( request , bucketName , key , false ) ;
public class FilterMatcher { /** * Compare two vectors as sets , e . g . " WHERE a in ( 1 , 2 , 3 ) " vs . " WHERE a in ( 2 , 1 , 3 ) " , to check whether two VVEs match . * \ pre all contents of VVE are either CVE or PVE . * @ param e1 first expression * @ param e2 second expression * @ return whether they are equivalent as collection of sets . */ private static boolean vectorsMatch ( VectorValueExpression e1 , VectorValueExpression e2 ) { } }
final Set < ConstantValueExpression > c1 = new HashSet < > ( ) , c2 = new HashSet < > ( ) ; final Set < Integer > tveIndices1 = new HashSet < > ( ) , tveIndices2 = new HashSet < > ( ) ; e1 . getArgs ( ) . forEach ( e -> { if ( e instanceof ConstantValueExpression || e instanceof ParameterValueExpression ) { c1 . add ( asCVE ( e ) ) ; } else { assert ( e instanceof TupleValueExpression ) ; tveIndices1 . add ( ( ( TupleValueExpression ) e ) . getColumnIndex ( ) ) ; } } ) ; e2 . getArgs ( ) . forEach ( e -> { if ( e instanceof ConstantValueExpression || e instanceof ParameterValueExpression ) { c2 . add ( asCVE ( e ) ) ; } else { assert ( e instanceof TupleValueExpression ) ; tveIndices2 . add ( ( ( TupleValueExpression ) e ) . getColumnIndex ( ) ) ; } } ) ; return c1 . equals ( c2 ) && tveIndices1 . equals ( tveIndices2 ) ;
public class MessageRetriever { /** * Print warning message , increment warning count . * @ param pos the position of the source * @ param msg message to print */ private void printWarning ( SourcePosition pos , String msg ) { } }
configuration . root . printWarning ( pos , msg ) ;
public class JavaParser { /** * src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1255:1 : innerCreator : Identifier classCreatorRest ; */ public final void innerCreator ( ) throws RecognitionException { } }
int innerCreator_StartIndex = input . index ( ) ; try { if ( state . backtracking > 0 && alreadyParsedRule ( input , 132 ) ) { return ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1256:5 : ( Identifier classCreatorRest ) // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1256:7 : Identifier classCreatorRest { match ( input , Identifier , FOLLOW_Identifier_in_innerCreator6078 ) ; if ( state . failed ) return ; pushFollow ( FOLLOW_classCreatorRest_in_innerCreator6080 ) ; classCreatorRest ( ) ; state . _fsp -- ; if ( state . failed ) return ; } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { // do for sure before leaving if ( state . backtracking > 0 ) { memoize ( input , 132 , innerCreator_StartIndex ) ; } }
public class CmsErrorDialog { /** * Shows the error dialog . < p > * @ param message the error message * @ param t the error to be displayed * @ param onClose executed on close */ public static void showErrorDialog ( String message , Throwable t , Runnable onClose ) { } }
Window window = prepareWindow ( DialogWidth . wide ) ; window . setCaption ( Messages . get ( ) . getBundle ( A_CmsUI . get ( ) . getLocale ( ) ) . key ( Messages . GUI_ERROR_0 ) ) ; window . setContent ( new CmsErrorDialog ( message , t , onClose , window ) ) ; A_CmsUI . get ( ) . addWindow ( window ) ;