signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class StateParser { /** * Returns the string which was actually parsed with all the substitutions * performed . NB : No CommandContext being provided , variables can ' t be * resolved . variables should be already resolved when calling this parse * method . */ public static SubstitutedLine parseLine ( String str , ParsingStateCallbackHandler callbackHandler , ParsingState initialState ) throws CommandFormatException { } }
return parseLine ( str , callbackHandler , initialState , true ) ;
public class MathUtil { /** * Replies the min value . * @ param values are the values to scan . * @ return the min value . */ @ Pure public static int min ( int ... values ) { } }
if ( values == null || values . length == 0 ) { return 0 ; } int min = values [ 0 ] ; for ( final int v : values ) { if ( v < min ) { min = v ; } } return min ;
public class DirRecord { /** * getAttrVal - return first ( or only ) value for given attribute * " dn " is treated as an attribute name . * @ param attr String attribute name * @ return Object attribute value * @ throws NamingException */ public Object getAttrVal ( String attr ) throws NamingException { } }
if ( attr . equalsIgnoreCase ( "dn" ) ) { return getDn ( ) ; } Attribute a = findAttr ( attr ) ; if ( a == null ) { return null ; } return a . get ( ) ;
public class CustomHeaderClient { /** * Main start the client from the command line . */ public static void main ( String [ ] args ) throws Exception { } }
CustomHeaderClient client = new CustomHeaderClient ( "localhost" , 50051 ) ; try { /* Access a service running on the local machine on port 50051 */ String user = "world" ; if ( args . length > 0 ) { user = args [ 0 ] ; /* Use the arg as the name to greet if provided */ } client . greet ( user ) ; } finally { client . shutdown ( ) ; }
public class NetWorkUtils { /** * Check whether the port is available to bind * @ param port port * @ return - 1 means unavailable , otherwise available * @ throws IOException */ public static int tryPort ( int port ) throws IOException { } }
ServerSocket socket = new ServerSocket ( port ) ; int rtn = socket . getLocalPort ( ) ; socket . close ( ) ; return rtn ;
public class WithKmeans { /** * ( The Actual Algorithm ) k - means of ( micro ) clusters , with specified initialization points . * @ param k * @ param centers - initial centers * @ param data * @ return ( macro ) clustering - SphereClusters */ protected static Clustering kMeans ( int k , Cluster [ ] centers , List < ? extends Cluster > data ) { } }
assert ( centers . length == k ) ; assert ( k > 0 ) ; int dimensions = centers [ 0 ] . getCenter ( ) . length ; ArrayList < ArrayList < Cluster > > clustering = new ArrayList < ArrayList < Cluster > > ( ) ; for ( int i = 0 ; i < k ; i ++ ) { clustering . add ( new ArrayList < Cluster > ( ) ) ; } while ( true ) { // Assign points to clusters for ( Cluster point : data ) { double minDistance = distance ( point . getCenter ( ) , centers [ 0 ] . getCenter ( ) ) ; int closestCluster = 0 ; for ( int i = 1 ; i < k ; i ++ ) { double distance = distance ( point . getCenter ( ) , centers [ i ] . getCenter ( ) ) ; if ( distance < minDistance ) { closestCluster = i ; minDistance = distance ; } } clustering . get ( closestCluster ) . add ( point ) ; } // Calculate new centers and clear clustering lists SphereCluster [ ] newCenters = new SphereCluster [ centers . length ] ; for ( int i = 0 ; i < k ; i ++ ) { newCenters [ i ] = calculateCenter ( clustering . get ( i ) , dimensions ) ; clustering . get ( i ) . clear ( ) ; } // Convergence check boolean converged = true ; for ( int i = 0 ; i < k ; i ++ ) { if ( ! Arrays . equals ( centers [ i ] . getCenter ( ) , newCenters [ i ] . getCenter ( ) ) ) { converged = false ; break ; } } if ( converged ) { break ; } else { centers = newCenters ; } } return new Clustering ( centers ) ;
public class CASableSimpleFileIOChannel { /** * Delete given property value . < br > * Special logic implemented for Values CAS . As the storage may have one file ( same hash ) for * multiple properties / values . < br > * The implementation assumes that delete operations based on { @ link # getFiles ( String ) } method result . * @ see # getFiles ( String ) * @ param propertyId * - property id to be deleted */ @ Override public void delete ( String propertyId ) throws IOException { } }
File [ ] files ; try { files = getFiles ( propertyId ) ; } catch ( RecordNotFoundException e ) { // This is workaround for CAS VS . No records found for this value at the moment . // CASableDeleteValues saves VCAS record on commit , but it ' s possible the Property just // added in this transaction and not commited . files = new File [ 0 ] ; } CASableDeleteValues o = new CASableDeleteValues ( files , resources , cleaner , tempDir , propertyId , vcas ) ; o . execute ( ) ; changes . add ( o ) ;
public class SVGAndroidRenderer { private void render ( SVG . Image obj ) { } }
debug ( "Image render" ) ; if ( obj . width == null || obj . width . isZero ( ) || obj . height == null || obj . height . isZero ( ) ) return ; if ( obj . href == null ) return ; // " If attribute ' preserveAspectRatio ' is not specified , then the effect is as if a value of xMidYMid meet were specified . " PreserveAspectRatio positioning = ( obj . preserveAspectRatio != null ) ? obj . preserveAspectRatio : PreserveAspectRatio . LETTERBOX ; // Locate the referenced image Bitmap image = checkForImageDataURL ( obj . href ) ; if ( image == null ) { SVGExternalFileResolver fileResolver = SVG . getFileResolver ( ) ; if ( fileResolver == null ) return ; image = fileResolver . resolveImage ( obj . href ) ; } if ( image == null ) { error ( "Could not locate image '%s'" , obj . href ) ; return ; } SVG . Box imageNaturalSize = new SVG . Box ( 0 , 0 , image . getWidth ( ) , image . getHeight ( ) ) ; updateStyleForElement ( state , obj ) ; if ( ! display ( ) ) return ; if ( ! visible ( ) ) return ; if ( obj . transform != null ) { canvas . concat ( obj . transform ) ; } float _x = ( obj . x != null ) ? obj . x . floatValueX ( this ) : 0f ; float _y = ( obj . y != null ) ? obj . y . floatValueY ( this ) : 0f ; float _w = obj . width . floatValueX ( this ) ; float _h = obj . height . floatValueX ( this ) ; state . viewPort = new SVG . Box ( _x , _y , _w , _h ) ; if ( ! state . style . overflow ) { setClipRect ( state . viewPort . minX , state . viewPort . minY , state . viewPort . width , state . viewPort . height ) ; } obj . boundingBox = state . viewPort ; updateParentBoundingBox ( obj ) ; checkForClipPath ( obj ) ; boolean compositing = pushLayer ( ) ; viewportFill ( ) ; canvas . save ( ) ; // Local transform from image ' s natural dimensions to the specified SVG dimensions canvas . concat ( calculateViewBoxTransform ( state . viewPort , imageNaturalSize , positioning ) ) ; Paint bmPaint = new Paint ( ( state . style . imageRendering == RenderQuality . optimizeSpeed ) ? 0 : Paint . FILTER_BITMAP_FLAG ) ; canvas . drawBitmap ( image , 0 , 0 , bmPaint ) ; canvas . restore ( ) ; if ( compositing ) popLayer ( obj ) ;
public class AbstractPlainSocketImpl { /** * Shutdown read - half of the socket connection ; */ protected void shutdownInput ( ) throws IOException { } }
if ( fd != null && fd . valid ( ) ) { socketShutdown ( SHUT_RD ) ; if ( socketInputStream != null ) { socketInputStream . setEOF ( true ) ; } shut_rd = true ; }
public class NetworkUtils { /** * 是否有网络连接 * @ param context Context * @ return 是否连接 */ public static boolean isConnected ( Context context ) { } }
if ( context == null ) { return true ; } ConnectivityManager cm = ( ConnectivityManager ) context . getSystemService ( Context . CONNECTIVITY_SERVICE ) ; NetworkInfo info = cm . getActiveNetworkInfo ( ) ; return info != null && info . isConnectedOrConnecting ( ) ;
public class HamcrestMatchers { /** * Creates a matcher for { @ link Iterable } s matching when the examined { @ linkplain Iterable } has all * the elements in the comparison { @ linkplain Iterable } , without repetitions . * For instance : * { @ code * List < String > comparison = Arrays . asList ( " bar " , " foo " ) ; * List < String > given = Arrays . asList ( " bar " , " bar " ) ; * assertThat ( given , sameSizeOf ( comparison ) ) ; * returns { @ code true } while * { @ code * List < String > comparison = Arrays . asList ( " bar " , " foo " ) ; * List < String > given = Arrays . asList ( " bar " ) ; * assertThat ( given , sameSizeOf ( comparison ) ) ; * returns { @ code false } . */ public static < T > Matcher < Iterable < T > > sameSizeOf ( final Iterable < ? super T > comparison ) { } }
return IsIterableWithSameSize . sameSizeOf ( comparison ) ;
public class EchoServer { /** * Sends the { @ link String message } received from the Echo Client back to the Echo Client on the given { @ link Socket } . * @ param socket { @ link Socket } used to send the Echo Client ' s { @ link String message } back to the Echo Client . * @ param message { @ link String } containing the message to send the Echo Client . This is the same message * sent by the Echo Client and received by the Echo Server . * @ see AbstractClientServerSupport # sendMessage ( Socket , String ) */ protected void sendResponse ( Socket socket , String message ) { } }
try { getLogger ( ) . info ( ( ) -> String . format ( "Sending response [%1$s] to EchoClient [%2$s]" , message , socket . getRemoteSocketAddress ( ) ) ) ; sendMessage ( socket , message ) ; } catch ( IOException cause ) { getLogger ( ) . warning ( ( ) -> String . format ( "Failed to send response [%1$s] to EchoClient [%2$s]" , message , socket . getRemoteSocketAddress ( ) ) ) ; getLogger ( ) . fine ( ( ) -> ThrowableUtils . getStackTrace ( cause ) ) ; }
public class PolicyFactoryImpl { /** * Loads a policy from a plugin . * @ param policyImpl * @ param handler */ private void doLoadFromPlugin ( final String policyImpl , final IAsyncResultHandler < IPolicy > handler ) { } }
PluginCoordinates coordinates = PluginCoordinates . fromPolicySpec ( policyImpl ) ; if ( coordinates == null ) { handler . handle ( AsyncResultImpl . < IPolicy > create ( new PolicyNotFoundException ( policyImpl ) ) ) ; return ; } int ssidx = policyImpl . indexOf ( '/' ) ; if ( ssidx == - 1 ) { handler . handle ( AsyncResultImpl . < IPolicy > create ( new PolicyNotFoundException ( policyImpl ) ) ) ; return ; } final String classname = policyImpl . substring ( ssidx + 1 ) ; this . pluginRegistry . loadPlugin ( coordinates , new IAsyncResultHandler < Plugin > ( ) { @ Override public void handle ( IAsyncResult < Plugin > result ) { if ( result . isSuccess ( ) ) { IPolicy rval ; Plugin plugin = result . getResult ( ) ; PluginClassLoader pluginClassLoader = plugin . getLoader ( ) ; ClassLoader oldCtxLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; try { Thread . currentThread ( ) . setContextClassLoader ( pluginClassLoader ) ; Class < ? > c = pluginClassLoader . loadClass ( classname ) ; rval = ( IPolicy ) c . newInstance ( ) ; } catch ( Exception e ) { handler . handle ( AsyncResultImpl . < IPolicy > create ( new PolicyNotFoundException ( policyImpl , e ) ) ) ; return ; } finally { Thread . currentThread ( ) . setContextClassLoader ( oldCtxLoader ) ; } policyCache . put ( policyImpl , rval ) ; handler . handle ( AsyncResultImpl . create ( rval ) ) ; } else { handler . handle ( AsyncResultImpl . < IPolicy > create ( new PolicyNotFoundException ( policyImpl , result . getError ( ) ) ) ) ; } } } ) ;
public class PreferredValueMakersRegistry { /** * Add a maker with custom matcher . * @ param settableMatcher * a matcher to match on com . github . huangp . entityunit . util . Settable # fullyQualifiedName ( ) * @ param maker * custom maker * @ return this */ public PreferredValueMakersRegistry add ( Matcher < ? > settableMatcher , Maker < ? > maker ) { } }
Preconditions . checkNotNull ( settableMatcher ) ; Preconditions . checkNotNull ( maker ) ; makers . put ( settableMatcher , maker ) ; return this ;
public class SoitoolkitLoggerModule { /** * Log processor for level TRACE * { @ sample . xml . . / . . / . . / doc / SoitoolkitLogger - connector . xml . sample soitoolkitlogger : log } * @ param message Log - message to be processed * @ param integrationScenario Optional name of the integration scenario or business process * @ param contractId Optional name of the contract in use * @ param correlationId Optional correlation identity of the message * @ param extra Optional extra info * @ return The incoming payload */ @ Processor public Object logTrace ( String message , @ Optional String integrationScenario , @ Optional String contractId , @ Optional String correlationId , @ Optional Map < String , String > extra ) { } }
return doLog ( LogLevelType . TRACE , message , integrationScenario , contractId , correlationId , extra ) ;
public class GSCDImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eSet ( int featureID , Object newValue ) { } }
switch ( featureID ) { case AfplibPackage . GSCD__DIRECTION : setDIRECTION ( ( Integer ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ;
public class GBSTree { /** * Set the depth of a T0 sub - tree . */ private int calcTZeroDepth ( int proposedK ) { } }
int d = - 1 ; if ( ( proposedK >= 0 ) && ( proposedK < _t0_d . length ) ) d = _t0_d [ proposedK ] ; if ( d < 0 ) { String x = "K Factor (" + proposedK + ") is invalid.\n" + "Valid K factors are: " + kFactorString ( ) + "." ; throw new IllegalArgumentException ( x ) ; } return d ;
public class CmsImageCacheHelper { /** * Returns the length of the given image . < p > * @ param imgName the image name * @ return the length of the given image */ public String getLength ( String imgName ) { } }
String ret = ( String ) m_lengths . get ( imgName ) ; if ( ret == null ) { return "" ; } return ret ;
public class InfoValidator { /** * { @ inheritDoc } */ @ Override public void validate ( ValidationHelper helper , Context context , String key , Info t ) { } }
if ( t != null ) { ValidatorUtils . validateRequiredField ( t . getVersion ( ) , context , "version" ) . ifPresent ( helper :: addValidationEvent ) ; ValidatorUtils . validateRequiredField ( t . getTitle ( ) , context , "title" ) . ifPresent ( helper :: addValidationEvent ) ; if ( t . getTermsOfService ( ) != null ) { if ( ! ValidatorUtils . isValidURI ( t . getTermsOfService ( ) ) ) { final String message = Tr . formatMessage ( tc , "infoTermsOfServiceInvalidURL" , t . getTermsOfService ( ) ) ; helper . addValidationEvent ( new ValidationEvent ( ValidationEvent . Severity . ERROR , context . getLocation ( "termsOfService" ) , message ) ) ; } } }
public class DoubleAccessor { /** * ( non - Javadoc ) * @ see * com . impetus . kundera . property . PropertyAccessor # toBytes ( java . lang . Object ) */ @ Override public byte [ ] toBytes ( Object object ) throws PropertyAccessException { } }
return object != null ? fromLong ( Double . doubleToRawLongBits ( ( Double ) object ) ) : null ;
public class TransactionFlow { /** * Execute the transactional flow - catch only specified exceptions * @ param input Initial data input * @ param classes Exception types to catch * @ return Try that represents either success ( with result ) or failure ( with errors ) */ public < Ex extends Throwable > Try < R , Ex > execute ( T input , Class < Ex > classes ) { } }
return Try . withCatch ( ( ) -> transactionTemplate . execute ( status -> transaction . apply ( input ) ) , classes ) ;
public class CompoundReentrantTypeResolver { /** * / * @ Nullable */ @ Override public IFeatureLinkingCandidate getLinkingCandidate ( /* @ Nullable */ XAbstractFeatureCall featureCall ) { } }
if ( featureCall == null ) return null ; IResolvedTypes delegate = getDelegate ( featureCall ) ; return delegate . getLinkingCandidate ( featureCall ) ;
public class Partition { /** * Create a range partition on an { @ link AbstractLabel } that will itself be sub - partitioned * @ param sqlgGraph * @ param abstractLabel * @ param name * @ param from * @ param to * @ param partitionType * @ param partitionExpression * @ return */ static Partition createRangePartitionWithSubPartition ( SqlgGraph sqlgGraph , AbstractLabel abstractLabel , String name , String from , String to , PartitionType partitionType , String partitionExpression ) { } }
Preconditions . checkArgument ( ! abstractLabel . getSchema ( ) . isSqlgSchema ( ) , "createRangePartitionWithSubPartition may not be called for \"%s\"" , Topology . SQLG_SCHEMA ) ; Preconditions . checkState ( abstractLabel . isRangePartition ( ) ) ; Partition partition = new Partition ( sqlgGraph , abstractLabel , name , from , to , partitionType , partitionExpression ) ; partition . createRangePartitionOnDb ( ) ; if ( abstractLabel instanceof VertexLabel ) { TopologyManager . addVertexLabelPartition ( sqlgGraph , abstractLabel . getSchema ( ) . getName ( ) , abstractLabel . getName ( ) , name , from , to , partitionType , partitionExpression ) ; } else { TopologyManager . addEdgeLabelPartition ( sqlgGraph , abstractLabel , name , from , to , partitionType , partitionExpression ) ; } partition . committed = false ; return partition ;
public class QueryStringSigner { /** * Calculate string to sign for signature version 2. * @ param request * The request being signed . * @ return String to sign * @ throws SdkClientException * If the string to sign cannot be calculated . */ private String calculateStringToSignV2 ( SignableRequest < ? > request ) throws SdkClientException { } }
URI endpoint = request . getEndpoint ( ) ; StringBuilder data = new StringBuilder ( ) ; data . append ( "POST" ) . append ( "\n" ) . append ( getCanonicalizedEndpoint ( endpoint ) ) . append ( "\n" ) . append ( getCanonicalizedResourcePath ( request ) ) . append ( "\n" ) . append ( getCanonicalizedQueryString ( request . getParameters ( ) ) ) ; return data . toString ( ) ;
public class Sql2o { /** * Creates a { @ link Query } * @ param query the sql query string * @ return the { @ link Query } instance * @ deprecated create queries with { @ link org . sql2o . Connection } class instead , using try - with - resource blocks * < code > * try ( Connection con = sql2o . open ( ) ) { * return sql2o . createQuery ( query , name ) . executeAndFetch ( Pojo . class ) ; * < / code > */ @ Deprecated public Query createQuery ( String query ) { } }
Connection connection = new Connection ( this , true ) ; return connection . createQuery ( query ) ;
public class ImageLoader { /** * Tries to load Image from file and converts it to the * desired image type if needed . < br > * See { @ link BufferedImage # BufferedImage ( int , int , int ) } for details on * the available image types . * The InputStream is not closed , this is the responsibility of the caller . * @ param is { @ link InputStream } of the image file * @ param imageType of the resulting BufferedImage * @ return loaded Image . * @ throws ImageLoaderException if no image could be loaded from the * InputStream . * @ since 1.1 */ public static BufferedImage loadImage ( InputStream is , int imageType ) { } }
BufferedImage img = loadImage ( is ) ; if ( img . getType ( ) != imageType ) { img = BufferedImageFactory . get ( img , imageType ) ; } return img ;
public class StringLiteral { /** * Converts the specified value to a String token , using " as the * enclosing quotes and escaping any characters that need escaping . */ public static String toStringToken ( String pValue ) { } }
// See if any escaping is needed if ( pValue . indexOf ( '\"' ) < 0 && pValue . indexOf ( '\\' ) < 0 ) { return "\"" + pValue + "\"" ; } // Escaping is needed else { StringBuffer buf = new StringBuffer ( ) ; buf . append ( '\"' ) ; int len = pValue . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char ch = pValue . charAt ( i ) ; if ( ch == '\\' ) { buf . append ( '\\' ) ; buf . append ( '\\' ) ; } else if ( ch == '\"' ) { buf . append ( '\\' ) ; buf . append ( '\"' ) ; } else { buf . append ( ch ) ; } } buf . append ( '\"' ) ; return buf . toString ( ) ; }
public class ParserDDL { /** * / This adapts XreadExpressions / getSimpleColumnNames output to the format originally produced by readColumnList . */ private int [ ] getColumnList ( OrderedHashSet set , Table table ) { } }
if ( set == null ) { return null ; } return table . getColumnIndexes ( set ) ;
public class Body { /** * Process the start of the Button . * @ throws javax . servlet . jsp . JspException if a JSP exception has occurred */ public int doStartTag ( ) throws JspException { } }
// we assume that tagId will over have override id if both are defined . if ( _state . id != null ) { _idScript = renderNameAndId ( ( HttpServletRequest ) pageContext . getRequest ( ) , _state , null ) ; } // render the header . . . _writer = new WriteRenderAppender ( pageContext ) ; _br = TagRenderingBase . Factory . getRendering ( TagRenderingBase . BODY_TAG , pageContext . getRequest ( ) ) ; _br . doStartTag ( _writer , _state ) ; return EVAL_BODY_INCLUDE ;
public class RESTProxyServlet { /** * < p > Set into the response the container version and a list of registered roots . < / p > * < p > Our return JSON structure is : * < pre > * " version " : int , * " roots " : [ String * ] * < / pre > * @ param response * @ throws IOException If the JSON serialization fails */ private void listRegisteredHandlers ( final HttpServletResponse response ) throws IOException { } }
// Build the array of registered roots JSONArray keyArray = new JSONArray ( ) ; Iterator < String > keys = REST_HANDLER_CONTAINER . registeredKeys ( ) ; if ( keys != null ) { while ( keys . hasNext ( ) ) { keyArray . add ( keys . next ( ) ) ; } } // Add the version . JSONObject jsonObject = new OrderedJSONObject ( ) ; jsonObject . put ( "version" , RESTHandlerContainer . REST_HANDLER_CONTAINER_VERSION ) ; jsonObject . put ( "roots" , keyArray ) ; // The JSON library escapes forward slashes , but there ' s no need to in this case , so we unescape them . String serialized = jsonObject . serialize ( ) ; response . setContentType ( "application/json" ) ; response . setCharacterEncoding ( "UTF-8" ) ; response . getWriter ( ) . write ( serialized . replace ( "\\/" , "/" ) ) ;
public class CategoryWordTagFactory { /** * Make a new label with this < code > String < / code > as the " name " . * @ param labelStr The string to use as a label * @ return The newly created Label */ public Label newLabelFromString ( String labelStr ) { } }
CategoryWordTag cwt = new CategoryWordTag ( ) ; cwt . setFromString ( labelStr ) ; return cwt ;
public class IOGroovyMethods { /** * Overloads the leftShift operator to provide an append mechanism to add values to a stream . * @ param self an OutputStream * @ param value a value to append * @ return a Writer * @ throws java . io . IOException if an I / O error occurs . * @ since 1.0 */ public static Writer leftShift ( OutputStream self , Object value ) throws IOException { } }
OutputStreamWriter writer = new FlushingStreamWriter ( self ) ; leftShift ( writer , value ) ; return writer ;
public class MediaClient { /** * Creates a pipeline which enable you to perform multiple transcodes in parallel . * @ param pipelineName The name of the new pipeline . * @ param sourceBucket The name of source bucket in Bos . * @ param targetBucket The name of target bucket in Bos . * @ param capacity The concurrent capability of the new pipeline . */ public CreatePipelineResponse createPipeline ( String pipelineName , String sourceBucket , String targetBucket , int capacity ) { } }
return createPipeline ( pipelineName , null , sourceBucket , targetBucket , capacity ) ;
public class ChildrenOrderAnalyzer { /** * { @ inheritDoc } */ @ Override public OrderAnalyzerResult analyze ( ) { } }
final PersonNavigator navigator = new PersonNavigator ( person ) ; final List < Family > families = navigator . getFamilies ( ) ; for ( final Family family : families ) { analyzeFamily ( family ) ; } return result ;
public class PolicyDefinitionsInner { /** * Creates or updates a policy definition at management group level . * @ param policyDefinitionName The name of the policy definition to create . * @ param managementGroupId The ID of the management group . * @ param parameters The policy definition properties . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PolicyDefinitionInner object */ public Observable < PolicyDefinitionInner > createOrUpdateAtManagementGroupAsync ( String policyDefinitionName , String managementGroupId , PolicyDefinitionInner parameters ) { } }
return createOrUpdateAtManagementGroupWithServiceResponseAsync ( policyDefinitionName , managementGroupId , parameters ) . map ( new Func1 < ServiceResponse < PolicyDefinitionInner > , PolicyDefinitionInner > ( ) { @ Override public PolicyDefinitionInner call ( ServiceResponse < PolicyDefinitionInner > response ) { return response . body ( ) ; } } ) ;
public class MergeMetadataMarshaller { /** * Marshall the given parameter object . */ public void marshall ( MergeMetadata mergeMetadata , ProtocolMarshaller protocolMarshaller ) { } }
if ( mergeMetadata == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( mergeMetadata . getIsMerged ( ) , ISMERGED_BINDING ) ; protocolMarshaller . marshall ( mergeMetadata . getMergedBy ( ) , MERGEDBY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class AbstractRStarTreeNode { /** * Tests , if the parameters of the entry representing this node , are correctly * set . Subclasses may need to overwrite this method . * @ param parent the parent holding the entry representing this node * @ param index the index of the entry in the parents child array */ protected void integrityCheckParameters ( N parent , int index ) { } }
// test if mbr is correctly set E entry = parent . getEntry ( index ) ; HyperBoundingBox mbr = computeMBR ( ) ; if ( /* entry . getMBR ( ) = = null & & */ mbr == null ) { return ; } if ( ! SpatialUtil . equals ( entry , mbr ) ) { String soll = mbr . toString ( ) ; String ist = new HyperBoundingBox ( entry ) . toString ( ) ; throw new RuntimeException ( "Wrong MBR in node " + parent . getPageID ( ) + " at index " + index + " (child " + entry + ")" + "\nsoll: " + soll + ",\n ist: " + ist ) ; }
public class ClassWriterImpl { /** * { @ inheritDoc } */ public Content getHeader ( String header ) { } }
String pkgname = ( classDoc . containingPackage ( ) != null ) ? classDoc . containingPackage ( ) . name ( ) : "" ; String clname = classDoc . name ( ) ; Content bodyTree = getBody ( true , getWindowTitle ( clname ) ) ; addTop ( bodyTree ) ; addNavLinks ( true , bodyTree ) ; bodyTree . addContent ( HtmlConstants . START_OF_CLASS_DATA ) ; HtmlTree div = new HtmlTree ( HtmlTag . DIV ) ; div . addStyle ( HtmlStyle . header ) ; if ( configuration . showProfiles ) { String sep = "" ; int profile = configuration . profiles . getProfile ( getTypeNameForProfile ( classDoc ) ) ; if ( profile > 0 ) { Content profNameContent = new StringContent ( ) ; for ( int i = profile ; i < configuration . profiles . getProfileCount ( ) ; i ++ ) { profNameContent . addContent ( sep ) ; profNameContent . addContent ( Profile . lookup ( i ) . name ) ; sep = ", " ; } Content profileNameDiv = HtmlTree . DIV ( HtmlStyle . subTitle , profNameContent ) ; div . addContent ( profileNameDiv ) ; } } if ( pkgname . length ( ) > 0 ) { Content pkgNameContent = new StringContent ( pkgname ) ; Content pkgNameDiv = HtmlTree . DIV ( HtmlStyle . subTitle , pkgNameContent ) ; div . addContent ( pkgNameDiv ) ; } LinkInfoImpl linkInfo = new LinkInfoImpl ( configuration , LinkInfoImpl . Kind . CLASS_HEADER , classDoc ) ; // Let ' s not link to ourselves in the header . linkInfo . linkToSelf = false ; Content headerContent = new StringContent ( header ) ; Content heading = HtmlTree . HEADING ( HtmlConstants . CLASS_PAGE_HEADING , true , HtmlStyle . title , headerContent ) ; heading . addContent ( getTypeParameterLinks ( linkInfo ) ) ; div . addContent ( heading ) ; bodyTree . addContent ( div ) ; return bodyTree ;
public class ProjectCacheCleaner { /** * Delete all the files in parallel * @ param projectDirsToDelete a set of project dirs to delete */ @ SuppressWarnings ( "FutureReturnValueIgnored" ) private void deleteProjectDirsInParallel ( final ImmutableSet < File > projectDirsToDelete ) { } }
final int CLEANING_SERVICE_THREAD_NUM = 8 ; final ExecutorService deletionService = Executors . newFixedThreadPool ( CLEANING_SERVICE_THREAD_NUM ) ; for ( final File toDelete : projectDirsToDelete ) { deletionService . submit ( ( ) -> { log . info ( "Deleting project dir {} from project cache to free up space" , toDelete ) ; FileIOUtils . deleteDirectorySilently ( toDelete ) ; } ) ; } try { new ExecutorServiceUtils ( ) . gracefulShutdown ( deletionService , Duration . ofDays ( 1 ) ) ; } catch ( final InterruptedException e ) { log . warn ( "Error when deleting files" , e ) ; }
public class StaticAnalysis { /** * Gets all free variables in { @ code expression } , i . e . , * variables whose values are determined by the environment * in which the expression is evaluated . * @ param expression * @ return */ public static Set < String > getFreeVariables ( Expression2 expression ) { } }
Set < String > freeVariables = Sets . newHashSet ( ) ; ScopeSet scopes = getScopes ( expression ) ; for ( int i = 0 ; i < expression . size ( ) ; i ++ ) { Scope scope = scopes . getScope ( i ) ; String varName = getFreeVariable ( expression , i , scope ) ; if ( varName != null ) { freeVariables . add ( varName ) ; } } return freeVariables ;
public class App { /** * Determines if a confirmation is present or not , and can be interacted * with . If it ' s not present , an indication that the confirmation can ' t be * clicked on is written to the log file * @ param action - the action occurring * @ param expected - the expected result * @ return Boolean : is a confirmation actually present or not . */ private boolean isNotConfirmation ( String action , String expected ) { } }
// wait for element to be present if ( ! is . confirmationPresent ( ) ) { waitFor . confirmationPresent ( ) ; } if ( ! is . confirmationPresent ( ) ) { reporter . fail ( action , expected , "Unable to click confirmation as it is not present" ) ; return true ; // indicates element not present } return false ;
public class Blob { /** * { @ inheritDoc } */ public byte [ ] getBytes ( final long pos , final int length ) throws SQLException { } }
synchronized ( this ) { if ( this . underlying == null ) { if ( pos > 1 ) { throw new SQLException ( "Invalid position: " + pos ) ; } // end of if return NO_BYTE ; } // end of if return this . underlying . getBytes ( pos , length ) ; } // end of sync
public class BufferUtils { /** * Flip the buffer to Flush mode . * The limit is set to the first unused byte ( the old position ) and * the position is set to the passed position . * This method is used as a replacement of { @ link Buffer # flip ( ) } . * @ param buffer the buffer to be flipped * @ param position The position of valid data to flip to . This should * be the return value of the previous call to { @ link # flipToFill ( ByteBuffer ) } */ public static void flipToFlush ( ByteBuffer buffer , int position ) { } }
buffer . limit ( buffer . position ( ) ) ; buffer . position ( position ) ;
public class DeployerResolverOverriderConverter { /** * Convert the Boolean skipInjectInitScript parameter to Boolean useArtifactoryGradlePlugin * This convertion comes after a name change ( skipInjectInitScript - > useArtifactoryGradlePlugin ) */ private void overrideUseArtifactoryGradlePlugin ( T overrider , Class overriderClass ) { } }
if ( overriderClass . getSimpleName ( ) . equals ( ArtifactoryGradleConfigurator . class . getSimpleName ( ) ) ) { try { Field useArtifactoryGradlePluginField = overriderClass . getDeclaredField ( "useArtifactoryGradlePlugin" ) ; useArtifactoryGradlePluginField . setAccessible ( true ) ; Object useArtifactoryGradlePlugin = useArtifactoryGradlePluginField . get ( overrider ) ; if ( useArtifactoryGradlePlugin == null ) { Field skipInjectInitScriptField = overriderClass . getDeclaredField ( "skipInjectInitScript" ) ; skipInjectInitScriptField . setAccessible ( true ) ; Object skipInjectInitScript = skipInjectInitScriptField . get ( overrider ) ; if ( skipInjectInitScript instanceof Boolean && skipInjectInitScript != null ) { useArtifactoryGradlePluginField . set ( overrider , skipInjectInitScript ) ; } } } catch ( NoSuchFieldException | IllegalAccessException e ) { converterErrors . add ( getConversionErrorMessage ( overrider , e ) ) ; } }
public class Duration { /** * Returns a copy of this duration multiplied by the scalar . * This instance is immutable and unaffected by this method call . * @ param multiplicand the value to multiply the duration by , positive or negative * @ return a { @ code Duration } based on this duration multiplied by the specified scalar , not null * @ throws ArithmeticException if numeric overflow occurs */ public Duration multipliedBy ( long multiplicand ) { } }
if ( multiplicand == 0 ) { return ZERO ; } if ( multiplicand == 1 ) { return this ; } return create ( toSeconds ( ) . multiply ( BigDecimal . valueOf ( multiplicand ) ) ) ;
public class SpanningTree { /** * Returns an IAtomContainer which contains all the atoms and bonds which * are involved in ring systems . * @ see # getAllRings ( ) * @ see # getBasicRings ( ) * @ return the IAtomContainer as described above */ public IAtomContainer getCyclicFragmentsContainer ( ) { } }
IAtomContainer fragContainer = this . molecule . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; IAtomContainer spt = getSpanningTree ( ) ; for ( int i = 0 ; i < totalEdgeCount ; i ++ ) if ( ! bondsInTree [ i ] ) { IRing ring = getRing ( spt , molecule . getBond ( i ) ) ; for ( int b = 0 ; b < ring . getBondCount ( ) ; b ++ ) { IBond ringBond = ring . getBond ( b ) ; if ( ! fragContainer . contains ( ringBond ) ) { for ( int atomCount = 0 ; atomCount < ringBond . getAtomCount ( ) ; atomCount ++ ) { IAtom atom = ringBond . getAtom ( atomCount ) ; if ( ! fragContainer . contains ( atom ) ) { atom . setFlag ( CDKConstants . ISINRING , true ) ; fragContainer . addAtom ( atom ) ; } } fragContainer . addBond ( ringBond ) ; } } } return fragContainer ;
public class OperaDesktopDriver { /** * Waits until new page is shown in the window is shown , and then returns the window id of the * window * @ param windowName - window to wait for shown event on * @ return id of window */ public int waitForWindowPageChanged ( String windowName ) { } }
if ( getScopeServices ( ) . getConnection ( ) == null ) { throw new CommunicationException ( "waiting for a window failed because Opera is not connected." ) ; } return getScopeServices ( ) . waitForDesktopWindowPageChanged ( windowName , OperaIntervals . WINDOW_EVENT_TIMEOUT . getMs ( ) ) ;
public class PacketHandlerPipeline { /** * Gets the protocol handler capable of processing the packet . * @ param packet The packet to be processed * @ return The protocol handler capable of processing the packet . < br > * Returns null in case no capable handler exists . */ public PacketHandler getHandler ( byte [ ] packet ) { } }
synchronized ( this . handlers ) { // Search for the first handler capable of processing the packet for ( PacketHandler protocolHandler : this . handlers ) { if ( protocolHandler . canHandle ( packet ) ) { return protocolHandler ; } } // Return null in case no handler is capable of decoding the packet return null ; }
public class AbstractParamContainerPanel { /** * Validates all panels , throwing an exception if there ' s any validation error . * The message of the exception can be shown in GUI components ( for example , an error dialogue ) callers can expect an * internationalised message . * @ throws Exception if there ' s any validation error . * @ see # initParam ( Object ) * @ see # saveParam ( ) */ public void validateParam ( ) throws Exception { } }
Enumeration < AbstractParamPanel > en = tablePanel . elements ( ) ; AbstractParamPanel panel = null ; while ( en . hasMoreElements ( ) ) { panel = en . nextElement ( ) ; try { panel . validateParam ( paramObject ) ; } catch ( Exception e ) { showParamPanel ( panel , panel . getName ( ) ) ; throw e ; } }
public class TextAdapterActivity { /** * The method overrides the one from the super class and perform the followings : * < ul > * < li > It gets the value of the variable with the name specified in the attribute * REQUEST _ VARIABLE . The value is typically an XML document or a string < / li > * < li > It invokes the variable translator to convert the value into a string * and then return the string value . < / li > * < / ul > * The method will through exception if the variable is not bound , * or the value is not bound to a DocumentReference or String . */ protected String getRequestData ( ) throws ActivityException { } }
String varname = getAttributeValue ( REQUEST_VARIABLE ) ; Object request = varname == null ? null : getParameterValue ( varname ) ; if ( hasPreScript ( ) ) { Object ret = executePreScript ( request ) ; if ( ret == null ) { // nothing returned ; requestVar may have been assigned by script request = getParameterValue ( varname ) ; } else { request = ret ; } } if ( request == null ) throw new ActivityException ( "Request data is null" ) ; if ( request instanceof DocumentReference ) request = getDocumentContent ( ( DocumentReference ) request ) ; if ( request instanceof String ) return ( String ) request ; else { VariableInstance varInst = getVariableInstance ( varname ) ; com . centurylink . mdw . variable . VariableTranslator translator = VariableTranslator . getTranslator ( getPackage ( ) , varInst . getType ( ) ) ; if ( translator != null ) { if ( translator instanceof JavaObjectTranslator ) return request . toString ( ) ; if ( translator instanceof DocumentReferenceTranslator ) return ( ( DocumentReferenceTranslator ) translator ) . realToString ( request ) ; else return translator . toString ( request ) ; } } throw new ActivityException ( "Cannot handle request of type " + request . getClass ( ) . getName ( ) ) ;
public class Sql { /** * Performs a stored procedure call with the given parameters , * calling the closure once with all result objects . * See { @ link # call ( String , List , Closure ) } for more details about * creating a < code > Hemisphere ( IN first , IN last , OUT dwells ) < / code > stored procedure . * Once created , it can be called like this : * < pre > * def first = ' Scott ' * def last = ' Davis ' * sql . call " { call Hemisphere ( $ first , $ last , $ { Sql . VARCHAR } ) } " , { dwells { @ code - > } * println dwells * < / pre > * As another example , see { @ link # call ( String , List , Closure ) } for more details about * creating a < code > FullName ( IN first ) < / code > stored function . * Once created , it can be called like this : * < pre > * def first = ' Sam ' * sql . call ( " { $ Sql . VARCHAR = call FullName ( $ first ) } " ) { name { @ code - > } * assert name = = ' Sam Pullara ' * < / pre > * Resource handling is performed automatically where appropriate . * @ param gstring a GString containing the SQL query with embedded params * @ param closure called for each row with a GroovyResultSet * @ throws SQLException if a database access error occurs * @ see # call ( String , List , Closure ) * @ see # expand ( Object ) */ public void call ( GString gstring , Closure closure ) throws Exception { } }
List < Object > params = getParameters ( gstring ) ; String sql = asSql ( gstring , params ) ; call ( sql , params , closure ) ;
public class CDKToBeam { /** * Add extended tetrahedral stereo configuration to the Beam GraphBuilder . * @ param et stereo element specifying tetrahedral configuration * @ param gb the current graph builder * @ param indices atom indices */ private static void addExtendedTetrahedralConfiguration ( ExtendedTetrahedral et , GraphBuilder gb , Map < IAtom , Integer > indices ) { } }
IAtom [ ] ligands = et . peripherals ( ) ; int u = indices . get ( et . focus ( ) ) ; int vs [ ] = new int [ ] { indices . get ( ligands [ 0 ] ) , indices . get ( ligands [ 1 ] ) , indices . get ( ligands [ 2 ] ) , indices . get ( ligands [ 3 ] ) } ; gb . extendedTetrahedral ( u ) . lookingFrom ( vs [ 0 ] ) . neighbors ( vs [ 1 ] , vs [ 2 ] , vs [ 3 ] ) . winding ( et . winding ( ) == CLOCKWISE ? Configuration . CLOCKWISE : Configuration . ANTI_CLOCKWISE ) . build ( ) ;
public class AsciiSet { /** * Converts the members array to a pattern string . Used to provide a user friendly toString * implementation for the set . */ private static String toPattern ( boolean [ ] members ) { } }
StringBuilder buf = new StringBuilder ( ) ; if ( members [ '-' ] ) { buf . append ( '-' ) ; } boolean previous = false ; char s = 0 ; for ( int i = 0 ; i < members . length ; ++ i ) { if ( members [ i ] && ! previous ) { s = ( char ) i ; } else if ( ! members [ i ] && previous ) { final char e = ( char ) ( i - 1 ) ; append ( buf , s , e ) ; } previous = members [ i ] ; } if ( previous ) { final char e = ( char ) ( members . length - 1 ) ; append ( buf , s , e ) ; } return buf . toString ( ) ;
public class AbstractExcelWriter { /** * 初始化新的一页 */ protected void initSheet ( ) throws WriteExcelException { } }
this . currentSheet = this . workbook . createSheet ( ) ; for ( int i = 0 ; i < this . properties . size ( ) ; i ++ ) { if ( MapUtils . isNotEmpty ( this . columnWidthMapping ) && null != this . columnWidthMapping . get ( this . properties . get ( i ) ) && 0 > Integer . valueOf ( 0 ) . compareTo ( this . columnWidthMapping . get ( this . properties . get ( i ) ) ) ) { // 若此属性存在列宽的映射则采用此映射 this . currentSheet . setColumnWidth ( i , this . columnWidthMapping . get ( this . properties . get ( i ) ) * 256 ) ; } else { // 若此属性不存在列宽的映射则采用默认值 this . currentSheet . setColumnWidth ( i , this . defaultColumnWidth * 256 ) ; } } this . allSheetInExcel ++ ; this . currentRowInSheet = this . startRowIndex - 1 ; // 预留行回调 if ( null != this . handleRowReserved ) { this . handleRowReserved . callback ( this . currentSheet , this ) ; } this . writeTitle ( ) ;
public class CommerceDiscountRelPersistenceImpl { /** * Removes all the commerce discount rels where commerceDiscountId = & # 63 ; from the database . * @ param commerceDiscountId the commerce discount ID */ @ Override public void removeByCommerceDiscountId ( long commerceDiscountId ) { } }
for ( CommerceDiscountRel commerceDiscountRel : findByCommerceDiscountId ( commerceDiscountId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( commerceDiscountRel ) ; }
public class ResourceConfigurationMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ResourceConfiguration resourceConfiguration , ProtocolMarshaller protocolMarshaller ) { } }
if ( resourceConfiguration == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( resourceConfiguration . getComputeType ( ) , COMPUTETYPE_BINDING ) ; protocolMarshaller . marshall ( resourceConfiguration . getVolumeSizeInGB ( ) , VOLUMESIZEINGB_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Breadcrumbs { /** * { @ inheritDoc } */ @ Override public void add ( final Widget w ) { } }
w . addStyleName ( Styles . ACTIVE ) ; super . add ( w ) ;
public class CommerceCurrencyPersistenceImpl { /** * Returns the commerce currency where groupId = & # 63 ; and code = & # 63 ; or throws a { @ link NoSuchCurrencyException } if it could not be found . * @ param groupId the group ID * @ param code the code * @ return the matching commerce currency * @ throws NoSuchCurrencyException if a matching commerce currency could not be found */ @ Override public CommerceCurrency findByG_C ( long groupId , String code ) throws NoSuchCurrencyException { } }
CommerceCurrency commerceCurrency = fetchByG_C ( groupId , code ) ; if ( commerceCurrency == null ) { StringBundler msg = new StringBundler ( 6 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "groupId=" ) ; msg . append ( groupId ) ; msg . append ( ", code=" ) ; msg . append ( code ) ; msg . append ( "}" ) ; if ( _log . isDebugEnabled ( ) ) { _log . debug ( msg . toString ( ) ) ; } throw new NoSuchCurrencyException ( msg . toString ( ) ) ; } return commerceCurrency ;
public class IPAddressSection { /** * Returns a prefix length for which the range of this address section matches the the block of addresses for that prefix . * If no such prefix exists , returns null * If this address section represents a single value , returns the bit length * @ return the prefix length or null */ @ Override public Integer getPrefixLengthForSingleBlock ( ) { } }
if ( ! hasNoPrefixCache ( ) ) { Integer result = prefixCache . cachedEquivalentPrefix ; if ( result != null ) { if ( result < 0 ) { return null ; } return result ; } } Integer res = super . getPrefixLengthForSingleBlock ( ) ; if ( res == null ) { prefixCache . cachedEquivalentPrefix = NO_PREFIX_LENGTH ; return null ; } return prefixCache . cachedEquivalentPrefix = res ;
public class CmsObject { /** * Checks if the current user has required permissions to access a given resource . < p > * @ param resource the resource to check the permissions for * @ param requiredPermissions the set of permissions to check for * @ param checkLock if < code > true < / code > the lock status of the resource is checked for write operations * and the resource needs be locked by the current user so that the test is passed , * if < code > false < / code > the lock is not checked at all * @ param filter the resource filter to use * @ return < code > true < / code > if the required permissions are satisfied * @ throws CmsException if something goes wrong */ public boolean hasPermissions ( CmsResource resource , CmsPermissionSet requiredPermissions , boolean checkLock , CmsResourceFilter filter ) throws CmsException { } }
return I_CmsPermissionHandler . PERM_ALLOWED == m_securityManager . hasPermissions ( m_context , resource , requiredPermissions , checkLock , filter ) ;
public class TypeUtil { /** * TODO ( user ) : See jls - 5.6.2 and jls - 15.25. * @ param trueType the type of the true expression * @ param falseType the type of the false expression * @ return the inferred type of the conditional expression */ public TypeMirror inferConditionalExpressionType ( TypeMirror trueType , TypeMirror falseType ) { } }
return isAssignable ( trueType , falseType ) ? falseType : trueType ;
public class NullAway { /** * computes those fields always initialized by callee safe init methods before a read operation * ( pathToRead ) is invoked . See < a * href = " https : / / github . com / uber / NullAway / wiki / Error - Messages # initializer - method - does - not - guarantee - nonnull - field - is - initialized - - nonnull - field - - not - initialized " > the * docs < / a > for what is considered a safe initializer method . */ private ImmutableSet < Element > safeInitByCalleeBefore ( TreePath pathToRead , VisitorState state , TreePath enclosingBlockPath ) { } }
Set < Element > safeInitMethods = new LinkedHashSet < > ( ) ; Tree enclosingBlockOrMethod = enclosingBlockPath . getLeaf ( ) ; if ( enclosingBlockOrMethod instanceof VariableTree ) { return ImmutableSet . of ( ) ; } ImmutableSet . Builder < Element > resultBuilder = ImmutableSet . builder ( ) ; BlockTree blockTree = enclosingBlockOrMethod instanceof BlockTree ? ( BlockTree ) enclosingBlockOrMethod : ( ( MethodTree ) enclosingBlockOrMethod ) . getBody ( ) ; List < ? extends StatementTree > statements = blockTree . getStatements ( ) ; Tree readExprTree = pathToRead . getLeaf ( ) ; int readStartPos = getStartPos ( ( JCTree ) readExprTree ) ; TreePath classTreePath = enclosingBlockPath ; // look for the parent ClassTree node , which represents the enclosing class / enum / interface while ( ! ( classTreePath . getLeaf ( ) instanceof ClassTree ) ) { classTreePath = classTreePath . getParentPath ( ) ; if ( classTreePath == null ) { throw new IllegalStateException ( "could not find enclosing class / enum / interface for " + state . getSourceForNode ( enclosingBlockPath . getLeaf ( ) ) ) ; } } Symbol . ClassSymbol classSymbol = ASTHelpers . getSymbol ( ( ClassTree ) classTreePath . getLeaf ( ) ) ; for ( int i = 0 ; i < statements . size ( ) ; i ++ ) { StatementTree curStmt = statements . get ( i ) ; if ( getStartPos ( ( JCTree ) curStmt ) <= readStartPos ) { Element privMethodElem = getInvokeOfSafeInitMethod ( curStmt , classSymbol , state ) ; if ( privMethodElem != null ) { safeInitMethods . add ( privMethodElem ) ; } // Hack : Handling try { . . . } finally { . . . } statement , see getSafeInitMethods if ( curStmt . getKind ( ) . equals ( Tree . Kind . TRY ) ) { TryTree tryTree = ( TryTree ) curStmt ; // ToDo : Should we check initialization inside tryTree . getResources ? What is the scope of // that initialization ? if ( tryTree . getCatches ( ) . size ( ) == 0 ) { if ( tryTree . getBlock ( ) != null ) { resultBuilder . addAll ( safeInitByCalleeBefore ( pathToRead , state , new TreePath ( enclosingBlockPath , tryTree . getBlock ( ) ) ) ) ; } if ( tryTree . getFinallyBlock ( ) != null ) { resultBuilder . addAll ( safeInitByCalleeBefore ( pathToRead , state , new TreePath ( enclosingBlockPath , tryTree . getFinallyBlock ( ) ) ) ) ; } } } } } addGuaranteedNonNullFromInvokes ( state , getTreesInstance ( state ) , safeInitMethods , getNullnessAnalysis ( state ) , resultBuilder ) ; return resultBuilder . build ( ) ;
public class FormTool { /** * Constructs a hidden element with the specified parameter name where * the value is extracted from the appropriate request parameter * unless there is no value in which case the supplied default value * is used . */ public String hidden ( String name , Object defaultValue ) { } }
return fixedHidden ( name , getValue ( name , defaultValue ) ) ;
public class BindDaoFactoryBuilder { /** * Build dao factory interface . * @ param elementUtils the element utils * @ param filer the filer * @ param schema the schema * @ return schema typeName * @ throws Exception the exception */ public TypeSpec . Builder buildDaoFactoryInterfaceInternal ( Elements elementUtils , Filer filer , SQLiteDatabaseSchema schema ) throws Exception { } }
String schemaName = buildDaoFactoryName ( schema ) ; classBuilder = TypeSpec . interfaceBuilder ( schemaName ) . addModifiers ( Modifier . PUBLIC ) . addSuperinterface ( BindDaoFactory . class ) ; classBuilder . addJavadoc ( "<p>\n" ) ; classBuilder . addJavadoc ( "Represents dao factory interface for $L.\n" , schema . getName ( ) ) ; classBuilder . addJavadoc ( "This class expose database interface through Dao attribute.\n" , schema . getName ( ) ) ; classBuilder . addJavadoc ( "</p>\n\n" ) ; JavadocUtility . generateJavadocGeneratedBy ( classBuilder ) ; classBuilder . addJavadoc ( "@see $T\n" , TypeUtility . typeName ( schema . getElement ( ) ) ) ; for ( SQLiteDaoDefinition dao : schema . getCollection ( ) ) { TypeName daoName = BindDaoBuilder . daoInterfaceTypeName ( dao ) ; TypeName daoImplName = BindDaoBuilder . daoTypeName ( dao ) ; classBuilder . addJavadoc ( "@see $T\n" , daoName ) ; classBuilder . addJavadoc ( "@see $T\n" , daoImplName ) ; String entity = BindDataSourceSubProcessor . generateEntityName ( dao , dao . getEntity ( ) ) ; classBuilder . addJavadoc ( "@see $T\n" , TypeUtility . typeName ( entity ) ) ; } for ( SQLiteDaoDefinition dao : schema . getCollection ( ) ) { TypeName daoImplName = BindDaoBuilder . daoTypeName ( dao ) ; // dao with external connections { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "get" + dao . getName ( ) ) . addModifiers ( Modifier . PUBLIC , Modifier . ABSTRACT ) . addJavadoc ( "Retrieve dao $L.\n\n@return dao implementation\n" , dao . getName ( ) ) . returns ( daoImplName ) ; classBuilder . addMethod ( methodBuilder . build ( ) ) ; } } SchemaUtility . generateTransaction ( classBuilder , schema , true ) ; return classBuilder ;
public class FileKeyValStore { /** * Set the value associated with name . * @ param name * @ param value */ public void setValue ( String name , String value ) { } }
Properties properties = loadProperties ( ) ; try ( OutputStream output = new FileOutputStream ( file ) ; ) { properties . setProperty ( name , value ) ; properties . store ( output , "" ) ; output . close ( ) ; } catch ( IOException e ) { logger . warn ( String . format ( "Could not save the keyvalue store, reason:%s" , e . getMessage ( ) ) ) ; }
public class LogUtils { /** * Allows both parameter substitution and a typed Throwable to be logged . * @ param logger the Logger the log to * @ param level the severity level * @ param message the log message * @ param throwable the Throwable to log * @ param parameter the parameter to substitute into message */ public static void log ( Logger logger , Level level , String message , Throwable throwable , Object parameter ) { } }
if ( logger . isLoggable ( level ) ) { final String formattedMessage = MessageFormat . format ( localize ( logger , message ) , parameter ) ; doLog ( logger , level , formattedMessage , throwable ) ; }
public class CmsCopyMoveDialog { /** * Performs the single resource operation . < p > * @ param source the source * @ param target the target * @ param action the action * @ param overwrite if existing resources should be overwritten * @ param makroMap map of key - value pairs to be resolved as macro . if null or empty , then ignored * @ throws CmsException in case the operation fails */ protected void performSingleOperation ( CmsResource source , CmsResource target , Action action , boolean overwrite , Map < String , String > makroMap ) throws CmsException { } }
performSingleOperation ( source , target , getTargetName ( source , target ) , action , overwrite , makroMap ) ;
public class Unchecked { /** * Wrap a { @ link CheckedToIntBiFunction } in a { @ link ToIntBiFunction } . */ public static < T , U > ToIntBiFunction < T , U > toIntBiFunction ( CheckedToIntBiFunction < T , U > function ) { } }
return toIntBiFunction ( function , THROWABLE_TO_RUNTIME_EXCEPTION ) ;
public class NumberCodeGenerator { /** * Create class to hold global currency information . */ public TypeSpec createCurrencyUtil ( String className , Map < String , CurrencyData > currencies ) { } }
TypeSpec . Builder type = TypeSpec . classBuilder ( className ) . addModifiers ( Modifier . PUBLIC ) ; CurrencyData defaultData = currencies . get ( "DEFAULT" ) ; currencies . remove ( "DEFAULT" ) ; MethodSpec . Builder code = MethodSpec . methodBuilder ( "getCurrencyDigits" ) . addModifiers ( PUBLIC , STATIC ) . addParameter ( Types . CLDR_CURRENCY_ENUM , "code" ) . returns ( int . class ) ; code . beginControlFlow ( "switch (code)" ) ; for ( Map . Entry < String , CurrencyData > entry : currencies . entrySet ( ) ) { CurrencyData data = entry . getValue ( ) ; code . addStatement ( "case $L: return $L" , entry . getKey ( ) , data . digits ) ; } code . addStatement ( "default: return $L" , defaultData . digits ) ; code . endControlFlow ( ) ; type . addMethod ( code . build ( ) ) ; return type . build ( ) ;
public class CoronaJobHistory { /** * Log start time of this map task attempt . * @ param taskAttemptId task attempt id * @ param startTime start time of task attempt as reported by task tracker . * @ param trackerName name of the tracker executing the task attempt . * @ param httpPort http port of the task tracker executing the task attempt * @ param taskType Whether the attempt is cleanup or setup or map */ public void logMapTaskStarted ( TaskAttemptID taskAttemptId , long startTime , String trackerName , int httpPort , String taskType ) { } }
if ( disableHistory ) { return ; } JobID id = taskAttemptId . getJobID ( ) ; if ( ! this . jobId . equals ( id ) ) { throw new RuntimeException ( "JobId from task: " + id + " does not match expected: " + jobId ) ; } if ( null != writers ) { log ( writers , RecordTypes . MapAttempt , new Keys [ ] { Keys . TASK_TYPE , Keys . TASKID , Keys . TASK_ATTEMPT_ID , Keys . START_TIME , Keys . TRACKER_NAME , Keys . HTTP_PORT } , new String [ ] { taskType , taskAttemptId . getTaskID ( ) . toString ( ) , taskAttemptId . toString ( ) , String . valueOf ( startTime ) , trackerName , httpPort == - 1 ? "" : String . valueOf ( httpPort ) } ) ; }
public class Validate { /** * Checks if the given double is NOT negative . * @ param value The double value to validate . * @ param message The error message to include in the exception in case the validation fails . * @ throws ParameterException if the given double value is < code > null < / code > or smaller than 0. */ public static void notNegative ( Double value , String message ) { } }
if ( ! validation ) return ; notNull ( value ) ; notNull ( message ) ; if ( value < 0 ) throw new ParameterException ( ErrorCode . NEGATIVE , message ) ;
public class StringHelper { /** * Return a representation of the given name ensuring quoting ( wrapped with ' ` ' characters ) . If already wrapped * return name . * @ param name The name to quote . * @ return The quoted version . */ public static String quote ( String name ) { } }
if ( isEmpty ( name ) || isQuoted ( name ) ) { return name ; } // Convert the JPA2 specific quoting character ( double quote ) to Hibernate ' s ( back tick ) else if ( name . startsWith ( "\"" ) && name . endsWith ( "\"" ) ) { name = name . substring ( 1 , name . length ( ) - 1 ) ; } return new StringBuilder ( name . length ( ) + 2 ) . append ( '`' ) . append ( name ) . append ( '`' ) . toString ( ) ;
public class OverviewMap { /** * Set a new style for the rectangle that show the target map ' s maximum extent . This style will be applied * immediately . * @ param targetMaxExtentRectangleStyle * max extent marker rectangle style * @ since 1.8.0 */ @ Api public void setTargetMaxExtentRectangleStyle ( ShapeStyle targetMaxExtentRectangleStyle ) { } }
this . targetMaxExtentRectangleStyle = targetMaxExtentRectangleStyle ; if ( targetMaxExtentRectangle != null ) { targetMaxExtentRectangle . setStyle ( targetMaxExtentRectangleStyle ) ; if ( drawTargetMaxExtent ) { render ( targetMaxExtentRectangle , RenderGroup . SCREEN , RenderStatus . UPDATE ) ; } }
public class SamlDecorator { /** * Returns an { @ link HttpResponse } for SAML authentication failure . */ private static HttpResponse fail ( ServiceRequestContext ctx , Throwable cause ) { } }
logger . trace ( "{} Cannot initiate SAML authentication" , ctx , cause ) ; return HttpResponse . of ( HttpStatus . UNAUTHORIZED ) ;
public class WktService { /** * Format a given geometry to EWKT . EWKT is an extension of WKT that adds the SRID into the returned string . The * result is something like : " SRID = 4326 ; POINT ( - 44.3 60.1 ) " * @ param geometry * The geometry to format . * @ return Returns the EWKT string . * @ throws WktException * In case something went wrong while formatting . * @ since 1.1.0 */ public static String toEwkt ( Geometry geometry ) throws WktException { } }
return "SRID=" + geometry . getSrid ( ) + ";" + WktService . toWkt ( geometry ) ;
public class JspWriterImpl { /** * Flush the output buffer to the underlying character stream , without * flushing the stream itself . This method is non - private only so that it * may be invoked by PrintStream . */ protected final void flushBuffer ( ) throws IOException { } }
if ( bufferSize == 0 ) return ; flushed = true ; // defect 312981 begin // ensureOpen ( ) ; if ( closed ) { throw new IOException ( "Stream closed" ) ; } // defect 312981 end if ( nextChar == 0 ) { // PK90190 - start // add check for property to create the writer even when the buffer is empty if ( WCCustomProperties . GET_WRITER_ON_EMPTY_BUFFER ) { initOut ( ) ; } // PK90190 - end return ; } initOut ( ) ; out . write ( cb , 0 , nextChar ) ; nextChar = 0 ;
public class TimeAxis { /** * / * [ deutsch ] * < p > Sind die angegebenen Zeiteinheiten ineinander konvertierbar ? < / p > * < p > Konvertierbarkeit bedeutet , da & szlig ; immer ein konstanter * ganzzahliger Faktor zur Umrechnung zwischen den Zeiteinheiten * angewandt werden kann . Beispiele f & uuml ; r konvertierbare Einheiten * sind in ISO - basierten Kalendersystemen die Paare Wochen / Tage * ( Faktor 7 ) oder Jahre / Monate ( Faktor 12 ) . Andererseits sind Minuten * und Sekunden zueinander nur dann konvertierbar mit dem Faktor * { @ code 60 } , wenn kein UTC - Kontext mit m & ouml ; glichen Schaltsekunden * vorliegt . < / p > * < p > Ist die Konvertierbarkeit gegeben , darf die L & auml ; nge einer * Zeiteinheit mittels der Methode { @ code getLength ( ) } herangezogen * werden , um Zeiteinheiten umzurechnen , indem als Faktor der gerundete * Quotient der L & auml ; ngen der Zeiteinheiten bestimmt wird . < / p > * @ param unit1 first time unit * @ param unit2 second time unit * @ return { @ code true } if convertible else { @ code false } * @ see # getLength ( Object ) getLength ( U ) */ public boolean isConvertible ( U unit1 , U unit2 ) { } }
Set < U > set = this . convertibleUnits . get ( unit1 ) ; return ( ( set != null ) && set . contains ( unit2 ) ) ;
public class GCFARCImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case AfplibPackage . GCFARC__MH : return getMH ( ) ; case AfplibPackage . GCFARC__MFR : return getMFR ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
public class JsonWriter { /** * Writes a { @ code Boolean } object to a character stream . * @ param value a { @ code Boolean } object to write to a character - output stream * @ return this JsonWriter * @ throws IOException if an I / O error has occurred */ public JsonWriter writeValue ( Boolean value ) throws IOException { } }
if ( ! willWriteValue ) { indent ( ) ; } writer . write ( value . toString ( ) ) ; willWriteValue = false ; return this ;
public class JsonParser { /** * Skips the values of all keys in the current object until it finds one of the given keys . * < p > Before this method is called , the parser must either point to the start or end of a JSON * object or to a field name . After this method ends , the current token will either be the { @ link * JsonToken # END _ OBJECT } of the current object if no matching key is found , or the value of the * key that was found . * @ param keysToFind set of keys to look for * @ return name of the first matching key found or { @ code null } if no match was found * @ since 1.10 */ public final String skipToKey ( Set < String > keysToFind ) throws IOException { } }
JsonToken curToken = startParsingObjectOrArray ( ) ; while ( curToken == JsonToken . FIELD_NAME ) { String key = getText ( ) ; nextToken ( ) ; if ( keysToFind . contains ( key ) ) { return key ; } skipChildren ( ) ; curToken = nextToken ( ) ; } return null ;
public class MapParser { /** * helper to convert to integer */ private static int convertAttributeToInt ( final String attribute ) { } }
if ( attribute == null ) { return 0 ; } try { return Integer . parseInt ( attribute ) ; } catch ( final Exception ignore ) { return 0 ; }
public class BufferedByteOutputStream { /** * Waits until the buffer has been written to underlying stream . * Flushes the underlying stream . */ public void flush ( ) throws IOException { } }
// check if the stream has been closed checkError ( ) ; // how many bytes were written to the buffer long totalBytesWritten = buffer . totalWritten ( ) ; // unblock reads from the buffer buffer . unblockReads ( ) ; // wait until the write thread transfers everything from the // buffer to the stream while ( writeThread . totalBytesTransferred < totalBytesWritten ) { BufferedByteInputOutput . sleep ( 1 ) ; } InjectionHandler . processEvent ( InjectionEventCore . BUFFEREDBYTEOUTPUTSTREAM_FLUSH , writeThread . totalBytesTransferred ) ; // check error checkError ( ) ; // block reads buffer . blockReads ( ) ; // flush the underlying buffer underlyingOutputStream . flush ( ) ;
public class Statistics { /** * Sets the number of distinct values statistic for the given column . */ public Statistics columnDistinctCount ( String columnName , Long ndv ) { } }
this . columnStats . computeIfAbsent ( columnName , column -> new HashMap < > ( ) ) . put ( DISTINCT_COUNT , String . valueOf ( ndv ) ) ; return this ;
public class Server { /** * Add Web Applications . * Add auto webapplications to the server . The name of the * webapp directory or war is used as the context name . If a * webapp is called " root " it is added at " / " . * @ param webapps Directory file name or URL to look for auto webapplication . * @ exception IOException */ public WebApplicationContext [ ] addWebApplications ( String webapps ) throws IOException { } }
return addWebApplications ( null , webapps , null , false ) ;
public class ServicePool { /** * Execute a callback on a specific end point . * NOTE : This method is package private specifically so that { @ link AsyncServicePool } can call it . */ < R > R executeOnEndPoint ( ServiceEndPoint endPoint , ServiceCallback < S , R > callback ) throws Exception { } }
ServiceHandle < S > handle = null ; try { handle = _serviceCache . checkOut ( endPoint ) ; Timer . Context timer = _callbackExecutionTime . time ( ) ; try { return callback . call ( handle . getService ( ) ) ; } finally { timer . stop ( ) ; } } catch ( NoCachedInstancesAvailableException e ) { LOG . info ( "Service cache exhausted. End point: {}" , endPoint , e ) ; // Don ' t mark an end point as bad just because there are no cached end points for it . throw e ; } catch ( Exception e ) { if ( _serviceFactory . isRetriableException ( e ) ) { // This is a known and supported exception indicating that something went wrong somewhere in the service // layer while trying to communicate with the end point . These errors are often transient , so we // enqueue a health check for the end point and mark it as unavailable for the time being . markEndPointAsBad ( endPoint ) ; LOG . info ( "Bad end point discovered. End point: {}" , endPoint , e ) ; } throw e ; } finally { if ( handle != null ) { try { _serviceCache . checkIn ( handle ) ; } catch ( Exception e ) { // This should never happen , but log just in case . LOG . warn ( "Error returning end point to cache. End point: {}, {}" , endPoint , e . toString ( ) ) ; LOG . debug ( "Exception" , e ) ; } } }
public class SmbResourceLocatorImpl { /** * { @ inheritDoc } * @ see jcifs . SmbResourceLocator # getCanonicalURL ( ) */ @ Override public String getCanonicalURL ( ) { } }
String str = this . url . getAuthority ( ) ; if ( str != null && ! str . isEmpty ( ) ) { return "smb://" + this . url . getAuthority ( ) + this . getURLPath ( ) ; } return "smb://" ;
public class PackageUseWriter { /** * Add a row for the class that uses the given package . * @ param usedClass the class that uses the given package * @ param pkg the package to which the class belongs * @ param contentTree the content tree to which the row will be added */ protected void addClassRow ( TypeElement usedClass , PackageElement pkg , Content contentTree ) { } }
DocPath dp = pathString ( usedClass , DocPaths . CLASS_USE . resolve ( DocPath . forName ( utils , usedClass ) ) ) ; StringContent stringContent = new StringContent ( utils . getSimpleName ( usedClass ) ) ; Content thType = HtmlTree . TH_ROW_SCOPE ( HtmlStyle . colFirst , getHyperLink ( dp . fragment ( getPackageAnchorName ( pkg ) ) , stringContent ) ) ; contentTree . addContent ( thType ) ; HtmlTree tdDesc = new HtmlTree ( HtmlTag . TD ) ; tdDesc . addStyle ( HtmlStyle . colLast ) ; addIndexComment ( usedClass , tdDesc ) ; contentTree . addContent ( tdDesc ) ;
public class ScopeServices { /** * Connects and resets any settings and services that the client used earlier . */ private void connect ( ) { } }
ClientInfo . Builder info = ClientInfo . newBuilder ( ) . setFormat ( "protobuf" ) ; executeMessage ( ScopeMessage . CONNECT , info ) ;
public class JCudnn { /** * < pre > * DEPRECATED routines to be removed next release : * User should use the non - suffixed version ( which has the API and functionality of _ v6 version ) * Routines with _ v5 suffix has the functionality of the non - suffixed routines in the CUDNN V6 * < / pre > */ public static int cudnnSetRNNDescriptor_v6 ( cudnnHandle handle , cudnnRNNDescriptor rnnDesc , int hiddenSize , int numLayers , cudnnDropoutDescriptor dropoutDesc , int inputMode , int direction , int mode , int algo , int dataType ) { } }
return checkResult ( cudnnSetRNNDescriptor_v6Native ( handle , rnnDesc , hiddenSize , numLayers , dropoutDesc , inputMode , direction , mode , algo , dataType ) ) ;
public class MobileCommand { /** * This method forms a { @ link java . util . Map } of parameters for the * keyboard hiding . * @ param keyName The button pressed by the mobile driver to attempt hiding the * keyboard . * @ return a key - value pair . The key is the command name . The value is a * { @ link java . util . Map } command arguments . */ public static Map . Entry < String , Map < String , ? > > hideKeyboardCommand ( String keyName ) { } }
return new AbstractMap . SimpleEntry < > ( HIDE_KEYBOARD , prepareArguments ( "keyName" , keyName ) ) ;
public class Minimizer { /** * Adds a block to the partition . */ private void addToPartition ( Block < S , L > block ) { } }
ElementReference ref = partition . referencedAdd ( block ) ; block . setPartitionReference ( ref ) ;
public class FileUtil { /** * splits given fileName into name and extension . * @ param fileName fileName * @ return string array is of length 2 , where 1st item is name and 2nd item is extension ( null if no extension ) */ public static String [ ] split ( String fileName ) { } }
int dot = fileName . lastIndexOf ( '.' ) ; if ( dot == - 1 ) return new String [ ] { fileName , null } ; else return new String [ ] { fileName . substring ( 0 , dot ) , fileName . substring ( dot + 1 ) } ;
import java . io . * ; import java . lang . * ; import java . util . * ; import java . math . * ; class CountUniquePairs { /** * The function calculates the number of unique pairs in a given list . * Args : * elements : The list of elements . * elements _ count : The count of elements in the list . * Returns : * The number of unique pairs in the list . * Examples : * > > > count _ unique _ pairs ( [ 1 , 2 , 1 ] , 3) * > > > count _ unique _ pairs ( [ 1 , 1 , 1 , 1 ] , 4) * > > > count _ unique _ pairs ( [ 1 , 2 , 3 , 4 , 5 ] , 5) * 10 */ public static int countUniquePairs ( List < Integer > elements , int elementsCount ) { } }
int uniquePairsCount = 0 ; for ( int index = 0 ; index < elementsCount ; index ++ ) { for ( int nextIndex = index + 1 ; nextIndex < elementsCount ; nextIndex ++ ) { if ( ! elements . get ( index ) . equals ( elements . get ( nextIndex ) ) ) { uniquePairsCount += 1 ; } } } return uniquePairsCount ;
public class SimpleMDAGNode { /** * 二分搜索 * @ param mdagDataArray * @ param node * @ return */ private int binarySearch ( SimpleMDAGNode [ ] mdagDataArray , char node ) { } }
if ( transitionSetSize < 1 ) { return - 1 ; } int high = transitionSetBeginIndex + transitionSetSize - 1 ; int low = transitionSetBeginIndex ; while ( low <= high ) { int mid = ( ( low + high ) >>> 1 ) ; int cmp = mdagDataArray [ mid ] . getLetter ( ) - node ; if ( cmp < 0 ) low = mid + 1 ; else if ( cmp > 0 ) high = mid - 1 ; else return mid ; } return - 1 ;
public class BusNetwork { /** * Add a bus stop inside the bus network . * @ param busStop is the bus stop to insert . * @ return < code > true < / code > if the bus stop was added , otherwise < code > false < / code > */ public boolean addBusStop ( BusStop busStop ) { } }
if ( busStop == null ) { return false ; } if ( this . validBusStops . contains ( busStop ) ) { return false ; } if ( ListUtil . contains ( this . invalidBusStops , INVALID_STOP_COMPARATOR , busStop ) ) { return false ; } final boolean isValidPrimitive = busStop . isValidPrimitive ( ) ; if ( isValidPrimitive ) { if ( ! this . validBusStops . add ( busStop ) ) { return false ; } } else if ( ListUtil . addIfAbsent ( this . invalidBusStops , INVALID_STOP_COMPARATOR , busStop ) < 0 ) { return false ; } busStop . setEventFirable ( isEventFirable ( ) ) ; busStop . setContainer ( this ) ; if ( isEventFirable ( ) ) { fireShapeChanged ( new BusChangeEvent ( this , BusChangeEventType . STOP_ADDED , busStop , - 1 , "shape" , // $ NON - NLS - 1 $ null , null ) ) ; busStop . checkPrimitiveValidity ( ) ; checkPrimitiveValidity ( ) ; } return true ;
public class RelatedTablesCoreExtension { /** * Adds a relationship between the base and user related table . Creates a * default user mapping table and the related table if needed . * @ param baseTableName * base table name * @ param relatedTable * user related table * @ param relationName * relation name * @ param mappingTableName * user mapping table name * @ return The relationship that was added * @ since 3.2.0 */ public ExtendedRelation addRelationship ( String baseTableName , UserTable < ? extends UserColumn > relatedTable , String relationName , String mappingTableName ) { } }
UserMappingTable userMappingTable = UserMappingTable . create ( mappingTableName ) ; return addRelationship ( baseTableName , relatedTable , relationName , userMappingTable ) ;
public class DrizzleStatement { /** * Retrieves the first warning reported by calls on this < code > Statement < / code > object . Subsequent * < code > Statement < / code > object warnings will be chained to this < code > SQLWarning < / code > object . * < p > The warning chain is automatically cleared each time a statement is ( re ) executed . This method may not be * called on a closed < code > Statement < / code > object ; doing so will cause an < code > SQLException < / code > to be thrown . * < P > < B > Note : < / B > If you are processing a < code > ResultSet < / code > object , any warnings associated with reads on that * < code > ResultSet < / code > object will be chained on it rather than on the < code > Statement < / code > object that * produced it . * @ return the first < code > SQLWarning < / code > object or < code > null < / code > if there are no warnings * @ throws java . sql . SQLException if a database access error occurs or this method is called on a closed * < code > Statement < / code > */ public SQLWarning getWarnings ( ) throws SQLException { } }
if ( ! warningsCleared && queryResult != null && queryResult . getWarnings ( ) > 0 ) { return new SQLWarning ( queryResult . getMessage ( ) ) ; } return null ;
public class ObjectUnderFileSystem { /** * Gets a ( partial ) object listing for the given path . * @ param path of pseudo - directory * @ param recursive whether to request immediate children only , or all descendants * @ return chunked object listing , or null if the path does not exist as a pseudo - directory */ @ Nullable protected ObjectListingChunk getObjectListingChunkForPath ( String path , boolean recursive ) throws IOException { } }
// Check if anything begins with < folder _ path > / String dir = stripPrefixIfPresent ( path ) ; ObjectListingChunk objs = getObjectListingChunk ( dir , recursive ) ; // If there are , this is a folder and we can create the necessary metadata if ( objs != null && ( ( objs . getObjectStatuses ( ) != null && objs . getObjectStatuses ( ) . length > 0 ) || ( objs . getCommonPrefixes ( ) != null && objs . getCommonPrefixes ( ) . length > 0 ) ) ) { // If the breadcrumb exists , this is a no - op if ( ! mUfsConf . isReadOnly ( ) ) { mkdirsInternal ( dir ) ; } return objs ; } return null ;
public class SoapUIExtensionMockAsWarGenerator { /** * we should provide a PR to let us inject implementation of the MockAsWar */ @ Override protected boolean runRunner ( ) throws Exception { } }
WsdlProject project = ( WsdlProject ) ProjectFactoryRegistry . getProjectFactory ( "wsdl" ) . createNew ( getProjectFile ( ) , getProjectPassword ( ) ) ; String pFile = getProjectFile ( ) ; project . getSettings ( ) . setString ( ProjectSettings . SHADOW_PASSWORD , null ) ; File tmpProjectFile = new File ( System . getProperty ( "java.io.tmpdir" ) ) ; tmpProjectFile = new File ( tmpProjectFile , project . getName ( ) + "-project.xml" ) ; project . beforeSave ( ) ; project . saveIn ( tmpProjectFile ) ; pFile = tmpProjectFile . getAbsolutePath ( ) ; String endpoint = ( StringUtils . hasContent ( this . getLocalEndpoint ( ) ) ) ? this . getLocalEndpoint ( ) : project . getName ( ) ; this . log . info ( "Creating WAR file with endpoint [" + endpoint + "]" ) ; // TODO the temporary file should be removed at the end of the process MockAsWarExtension mockAsWar = new MockAsWarExtension ( pFile , getSettingsFile ( ) , getOutputFolder ( ) , this . getWarFile ( ) , this . isIncludeLibraries ( ) , this . isIncludeActions ( ) , this . isIncludeListeners ( ) , endpoint , this . isEnableWebUI ( ) ) ; mockAsWar . createMockAsWarArchive ( ) ; this . log . info ( "WAR Generation complete" ) ; return true ;
public class PropertyNameResolver { /** * Indicates whether or not the expression contains nested property expressions or not . * @ param expression The property expression * @ return The next property expression */ public boolean hasNested ( String expression ) { } }
if ( expression == null || expression . length ( ) == 0 ) return false ; else return remove ( expression ) != null ;