signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Algorithm { /** * Creates a new Algorithm instance using SHA512withECDSA . Tokens specify this as " ES512 " .
* @ param publicKey the key to use in the verify instance .
* @ param privateKey the key to use in the signing instance .
* @ return a valid ECDSA512 Algorithm .
* @ throws IllegalArgumentException if the provided Key is null . */
public static Algorithm ECDSA512 ( ECPublicKey publicKey , ECPrivateKey privateKey ) throws IllegalArgumentException { } } | return ECDSA512 ( ECDSAAlgorithm . providerForKeys ( publicKey , privateKey ) ) ; |
public class MainRepository { /** * Tests if the repository description properties file exists as defined by the
* location override system property or at the default location
* @ return true if the properties file exists , otherwise false */
public static boolean repositoryDescriptionFileExists ( RestRepositoryConnectionProxy proxy ) { } } | boolean exists = false ; try { URL propertiesFileURL = getPropertiesFileLocation ( ) ; // Are we accessing the properties file ( from DHE ) using a proxy ?
if ( proxy != null ) { if ( proxy . isHTTPorHTTPS ( ) ) { Proxy javaNetProxy = new Proxy ( Proxy . Type . HTTP , new InetSocketAddress ( proxy . getProxyURL ( ) . getHost ( ) , proxy . getProxyURL ( ) . getPort ( ) ) ) ; URLConnection connection = propertiesFileURL . openConnection ( javaNetProxy ) ; InputStream is = connection . getInputStream ( ) ; exists = true ; is . close ( ) ; if ( connection instanceof HttpURLConnection ) { ( ( HttpURLConnection ) connection ) . disconnect ( ) ; } } else { // The proxy is not an HTTP or HTTPS proxy we do not support this
UnsupportedOperationException ue = new UnsupportedOperationException ( "Non-HTTP proxy not supported" ) ; throw new IOException ( ue ) ; } } else { // not using a proxy
InputStream is = propertiesFileURL . openStream ( ) ; exists = true ; is . close ( ) ; } } catch ( MalformedURLException e ) { // ignore
} catch ( IOException e ) { // ignore
} return exists ; |
public class FogbugzManager { /** * Creates new Milestone in Fogbugz . Please leave id of milestone object empty .
* Only creates global milestones .
* @ param milestone to edit / create */
public boolean createMilestone ( FogbugzMilestone milestone ) { } } | try { HashMap < String , String > params = new HashMap < String , String > ( ) ; // If id = 0 , create new case .
if ( milestone . getId ( ) != 0 ) { throw new Exception ( "Editing existing milestones is not supported, please set the id to 0." ) ; } params . put ( "cmd" , "newFixFor" ) ; params . put ( "ixProject" , "-1" ) ; params . put ( "fAssignable" , "1" ) ; // 1 means true somehow . . .
params . put ( "sFixFor" , milestone . getName ( ) ) ; Document doc = this . getFogbugzDocument ( params ) ; FogbugzManager . log . info ( "Fogbugz response got when saving milestone: " + doc . toString ( ) ) ; // If we got this far , all is probably well .
// TODO : parse XML that gets returned to check status furreal .
return true ; } catch ( Exception e ) { FogbugzManager . log . log ( Level . SEVERE , "Exception while creating milestone " + milestone . getName ( ) , e ) ; } return false ; |
public class FriendGroup { /** * Checks if a given Friend is part of this group .
* @ param friend
* The friend
* @ return True if this group contains the friend , false otherwise . */
public boolean contains ( Friend friend ) { } } | for ( final Friend f : getFriends ( ) ) { if ( StringUtils . parseName ( f . getUserId ( ) ) . equals ( StringUtils . parseName ( friend . getUserId ( ) ) ) ) { return true ; } } return false ; |
public class Tuple5 { /** * Split this tuple into two tuples of degree 5 and 0. */
public final Tuple2 < Tuple5 < T1 , T2 , T3 , T4 , T5 > , Tuple0 > split5 ( ) { } } | return new Tuple2 < > ( limit5 ( ) , skip5 ( ) ) ; |
public class AnnotationTypeWriterImpl { /** * Get summary links for navigation bar .
* @ return the content tree for the navigation summary links */
protected Content getNavSummaryLinks ( ) { } } | Content li = HtmlTree . LI ( contents . summaryLabel ) ; li . addContent ( Contents . SPACE ) ; Content ulNav = HtmlTree . UL ( HtmlStyle . subNavList , li ) ; MemberSummaryBuilder memberSummaryBuilder = ( MemberSummaryBuilder ) configuration . getBuilderFactory ( ) . getMemberSummaryBuilder ( this ) ; Content liNavField = new HtmlTree ( HtmlTag . LI ) ; addNavSummaryLink ( memberSummaryBuilder , "doclet.navField" , VisibleMemberMap . Kind . ANNOTATION_TYPE_FIELDS , liNavField ) ; addNavGap ( liNavField ) ; ulNav . addContent ( liNavField ) ; Content liNavReq = new HtmlTree ( HtmlTag . LI ) ; addNavSummaryLink ( memberSummaryBuilder , "doclet.navAnnotationTypeRequiredMember" , VisibleMemberMap . Kind . ANNOTATION_TYPE_MEMBER_REQUIRED , liNavReq ) ; addNavGap ( liNavReq ) ; ulNav . addContent ( liNavReq ) ; Content liNavOpt = new HtmlTree ( HtmlTag . LI ) ; addNavSummaryLink ( memberSummaryBuilder , "doclet.navAnnotationTypeOptionalMember" , VisibleMemberMap . Kind . ANNOTATION_TYPE_MEMBER_OPTIONAL , liNavOpt ) ; ulNav . addContent ( liNavOpt ) ; return ulNav ; |
public class ExtensionLoader { /** * Run bootstrap all BootstrapHandler # runBeforeApplicationCreate classes provided in order . */
public void runBeforeApplicationCreateBootstrap ( Instrumentation instrumentation , String [ ] bootstrapClasses ) { } } | if ( ! isWithExtension ) { SelendroidLogger . error ( "Cannot run bootstrap. Must load an extension first." ) ; return ; } for ( String bootstrapClassName : bootstrapClasses ) { try { SelendroidLogger . info ( "Running beforeApplicationCreate bootstrap: " + bootstrapClassName ) ; loadBootstrap ( bootstrapClassName ) . runBeforeApplicationCreate ( instrumentation ) ; SelendroidLogger . info ( "\"Running beforeApplicationCreate bootstrap: " + bootstrapClassName ) ; } catch ( Exception e ) { throw new SelendroidException ( "Cannot run bootstrap " + bootstrapClassName , e ) ; } } |
public class SecretsManagerSecretResourceDataMarshaller { /** * Marshall the given parameter object . */
public void marshall ( SecretsManagerSecretResourceData secretsManagerSecretResourceData , ProtocolMarshaller protocolMarshaller ) { } } | if ( secretsManagerSecretResourceData == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( secretsManagerSecretResourceData . getARN ( ) , ARN_BINDING ) ; protocolMarshaller . marshall ( secretsManagerSecretResourceData . getAdditionalStagingLabelsToDownload ( ) , ADDITIONALSTAGINGLABELSTODOWNLOAD_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ComputeNodesImpl { /** * Updates the password and expiration time of a user account on the specified compute node .
* This operation replaces of all the updatable properties of the account . For example , if the expiryTime element is not specified , the current value is replaced with the default value , not left unmodified . You can update a user account on a node only when it is in the idle or running state .
* @ param poolId The ID of the pool that contains the compute node .
* @ param nodeId The ID of the machine on which you want to update a user account .
* @ param userName The name of the user account to update .
* @ param nodeUpdateUserParameter The parameters for the request .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws BatchErrorException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */
public void updateUser ( String poolId , String nodeId , String userName , NodeUpdateUserParameter nodeUpdateUserParameter ) { } } | updateUserWithServiceResponseAsync ( poolId , nodeId , userName , nodeUpdateUserParameter ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class GeoPackageOverlay { /** * { @ inheritDoc } */
@ Override public boolean hasTileToRetrieve ( int x , int y , int zoom ) { } } | return retriever . hasTile ( x , y , zoom ) ; |
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIfcStateEnumToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class PartitionKeyGenerators { /** * Produces a partition key from the user ID contained in an incoming request .
* @ return partition key derived from user ID
* @ throws PersistenceException if user ID cannot be retrieved */
public static Function < RequestEnvelope , String > userId ( ) { } } | return r -> Optional . ofNullable ( r ) . map ( RequestEnvelope :: getContext ) . map ( Context :: getSystem ) . map ( SystemState :: getUser ) . map ( User :: getUserId ) . orElseThrow ( ( ) -> new PersistenceException ( "Could not retrieve user ID from request envelope to generate persistence ID" ) ) ; |
public class AsciiTable { /** * Adds a content row to the table .
* For the first content row added , the number of objects given here determines the number of columns in the table .
* For every subsequent content row , the array must have an entry for each column ,
* i . e . the size of the array must be the same as the result of { @ link # getColNumber ( ) } .
* @ param columns content of the columns for the row , must not be null
* @ return the created row for further customization
* @ throws { @ link NullPointerException } if columns was null
* @ throws { @ link AsciiTableException } if columns does not have the correct size ( more or less entries than columns defined for the table ) */
public final AT_Row addRow ( Object ... columns ) throws NullPointerException , AsciiTableException { } } | AT_Row ret = AT_Row . createContentRow ( columns , TableRowStyle . NORMAL ) ; if ( this . colNumber == 0 ) { this . colNumber = columns . length ; } else { if ( columns . length != this . colNumber ) { throw new AsciiTableException ( "wrong columns argument" , "wrong number of columns, expected " + this . colNumber + " received " + columns . length ) ; } } this . rows . add ( ret ) ; return ret ; |
public class Response { /** * Get the { @ link Set } of { @ link XmlElementDescriptor } s of all properties in this response .
* @ return An unmodifiable { @ link Set } of { @ link XmlElementDescriptor } s , may be < code > null < / code > or empty if there are no properties in this response . */
public Set < ElementDescriptor < ? > > getProperties ( ) { } } | if ( mPropStatByProperty == null ) { return null ; } return Collections . unmodifiableSet ( mPropStatByProperty . keySet ( ) ) ; |
public class AmazonMTurkClient { /** * The < code > GetQualificationScore < / code > operation returns the value of a Worker ' s Qualification for a given
* Qualification type .
* To get a Worker ' s Qualification , you must know the Worker ' s ID . The Worker ' s ID is included in the assignment
* data returned by the < code > ListAssignmentsForHIT < / code > operation .
* Only the owner of a Qualification type can query the value of a Worker ' s Qualification of that type .
* @ param getQualificationScoreRequest
* @ return Result of the GetQualificationScore operation returned by the service .
* @ throws ServiceException
* Amazon Mechanical Turk is temporarily unable to process your request . Try your call again .
* @ throws RequestErrorException
* Your request is invalid .
* @ sample AmazonMTurk . GetQualificationScore
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / mturk - requester - 2017-01-17 / GetQualificationScore "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public GetQualificationScoreResult getQualificationScore ( GetQualificationScoreRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetQualificationScore ( request ) ; |
public class InternalErrorBuilder { /** * Set the duplicate elimination counter .
* @ param nDuplicateEliminiationCounter
* The value to set . Must be & ge ; 0 . Pass 0 to disable any duplicate
* elimination and send all errors by email .
* @ return this for chaining
* @ since 7.0.6 */
@ Nonnull public final InternalErrorBuilder setDuplicateEliminiationCounter ( @ Nonnegative final int nDuplicateEliminiationCounter ) { } } | ValueEnforcer . isGE0 ( nDuplicateEliminiationCounter , "DuplicateEliminiationCounter" ) ; m_nDuplicateEliminiationCounter = nDuplicateEliminiationCounter ; return this ; |
public class InjectionTargetFactoryImpl { /** * Just a shortcut for calling validate , initialize and postProcess */
private BasicInjectionTarget < T > prepareInjectionTarget ( BasicInjectionTarget < T > injectionTarget ) { } } | try { postProcess ( initialize ( validate ( injectionTarget ) ) ) ; return injectionTarget ; } catch ( Throwable e ) { throw new IllegalArgumentException ( e ) ; } |
public class FastDateParser { private static StringBuilder escapeRegex ( final StringBuilder regex , final String value , final boolean unquote ) { } } | regex . append ( "\\Q" ) ; for ( int i = 0 ; i < value . length ( ) ; ++ i ) { char c = value . charAt ( i ) ; switch ( c ) { case '\'' : if ( unquote ) { if ( ++ i == value . length ( ) ) { return regex ; } c = value . charAt ( i ) ; } break ; case '\\' : if ( ++ i == value . length ( ) ) { break ; } regex . append ( c ) ; // we always want the original \
c = value . charAt ( i ) ; // Is it followed by E ?
if ( c == 'E' ) { // \ E detected
regex . append ( "E\\\\E\\" ) ; // see comment above
c = 'Q' ; // appended below
} break ; default : break ; } regex . append ( c ) ; } regex . append ( "\\E" ) ; return regex ; |
public class StopThreadsCleanUp { /** * The bug detailed at https : / / issues . apache . org / ooo / show _ bug . cgi ? id = 122517 is quite tricky . This is a try to
* avoid the issues by force starting the threads and it ' s job queue . */
protected void forceStartOpenOfficeJurtCleanup ( ClassLoaderLeakPreventor preventor ) { } } | if ( stopThreads ) { if ( preventor . isLoadedByClassLoader ( preventor . findClass ( JURT_ASYNCHRONOUS_FINALIZER ) ) ) { /* The com . sun . star . lib . util . AsynchronousFinalizer class was found and loaded , which means that in case the
static block that starts the daemon thread had not been started yet , it has been started now .
Now let ' s force Garbage Collection , with the hopes of having the finalize ( ) ers that put Jobs on the
AsynchronousFinalizer queue be executed . Then just leave it , and handle the rest in { @ link # stopThreads } . */
preventor . info ( "OpenOffice JURT AsynchronousFinalizer thread started - forcing garbage collection to invoke finalizers" ) ; ClassLoaderLeakPreventor . gc ( ) ; } } else { // Check for class existence without loading class and thus executing static block
if ( preventor . getClassLoader ( ) . getResource ( "com/sun/star/lib/util/AsynchronousFinalizer.class" ) != null ) { preventor . warn ( "OpenOffice JURT AsynchronousFinalizer thread will not be stopped if started, as stopThreads is false" ) ; /* By forcing Garbage Collection , we ' ll hopefully start the thread now , in case it would have been started by
GC later , so that at least it will appear in the logs . */
ClassLoaderLeakPreventor . gc ( ) ; } } |
public class ArrayUtil { /** * 取最小值
* @ param numberArray 数字数组
* @ return 最小值
* @ since 3.0.9 */
public static long min ( long ... numberArray ) { } } | if ( isEmpty ( numberArray ) ) { throw new IllegalArgumentException ( "Number array must not empty !" ) ; } long min = numberArray [ 0 ] ; for ( int i = 0 ; i < numberArray . length ; i ++ ) { if ( min > numberArray [ i ] ) { min = numberArray [ i ] ; } } return min ; |
public class Execution { /** * < p > isSimilar . < / p >
* @ param execution a { @ link com . greenpepper . server . domain . Execution } object .
* @ return a boolean . */
public boolean isSimilar ( Execution execution ) { } } | return execution != null && errors == execution . getErrors ( ) && failures == execution . getFailures ( ) && success == execution . getSuccess ( ) && ignored == execution . getIgnored ( ) && StringUtil . isEquals ( executionErrorId , execution . getExecutionErrorId ( ) ) && StringUtil . isEquals ( results , execution . getResults ( ) ) ; |
public class ResourceAssignment { /** * { @ inheritDoc } */
@ Override public Object getCurrentValue ( FieldType field ) { } } | Object result = null ; if ( field != null ) { int fieldValue = field . getValue ( ) ; result = m_array [ fieldValue ] ; } return ( result ) ; |
public class ChaincodeCollectionConfiguration { /** * Loads a ChaincodeCollectionConfiguration object from a Json or Yaml file */
private static ChaincodeCollectionConfiguration fromFile ( File configFile , boolean isJson ) throws InvalidArgumentException , IOException , ChaincodeCollectionConfigurationException { } } | // Sanity check
if ( configFile == null ) { throw new InvalidArgumentException ( "configFile must be specified" ) ; } if ( logger . isTraceEnabled ( ) ) { logger . trace ( format ( "ChaincodeCollectionConfiguration.fromFile: %s isJson = %b" , configFile . getAbsolutePath ( ) , isJson ) ) ; } // Json file
try ( InputStream stream = new FileInputStream ( configFile ) ) { return isJson ? fromJsonStream ( stream ) : fromYamlStream ( stream ) ; } |
public class LinearAlgebra { /** * Find a solution of the linear equation A x = b where
* < ul >
* < li > A is an n x m - matrix given as double [ n ] [ m ] < / li >
* < li > b is an m - vector given as double [ m ] , < / li >
* < li > x is an n - vector given as double [ n ] , < / li >
* < / ul >
* @ param matrixA The matrix A ( left hand side of the linear equation ) .
* @ param b The vector ( right hand of the linear equation ) .
* @ return A solution x to A x = b . */
public static double [ ] solveLinearEquation ( double [ ] [ ] matrixA , double [ ] b ) { } } | if ( isSolverUseApacheCommonsMath ) { Array2DRowRealMatrix matrix = new Array2DRowRealMatrix ( matrixA ) ; DecompositionSolver solver ; if ( matrix . getColumnDimension ( ) == matrix . getRowDimension ( ) ) { solver = new LUDecomposition ( matrix ) . getSolver ( ) ; } else { solver = new QRDecomposition ( new Array2DRowRealMatrix ( matrixA ) ) . getSolver ( ) ; } // Using SVD - very slow
// solver = new SingularValueDecomposition ( new Array2DRowRealMatrix ( A ) ) . getSolver ( ) ;
return solver . solve ( new Array2DRowRealMatrix ( b ) ) . getColumn ( 0 ) ; } else { return org . jblas . Solve . solve ( new org . jblas . DoubleMatrix ( matrixA ) , new org . jblas . DoubleMatrix ( b ) ) . data ; // For use of colt :
// cern . colt . matrix . linalg . Algebra linearAlgebra = new cern . colt . matrix . linalg . Algebra ( ) ;
// return linearAlgebra . solve ( new DenseDoubleMatrix2D ( A ) , linearAlgebra . transpose ( new DenseDoubleMatrix2D ( new double [ ] [ ] { b } ) ) ) . viewColumn ( 0 ) . toArray ( ) ;
// For use of parallel colt :
// return new cern . colt . matrix . tdouble . algo . decomposition . DenseDoubleLUDecomposition ( new cern . colt . matrix . tdouble . impl . DenseDoubleMatrix2D ( A ) ) . solve ( new cern . colt . matrix . tdouble . impl . DenseDoubleMatrix1D ( b ) ) . toArray ( ) ;
} |
public class LongObjectHashMap { /** * Return all of the Objects currently stored in the map
* as an Object [ ] - the ordering of the Objects in the
* array is undetermined .
* Note that this method is not thread safe . Another thread
* making changes to the map while this method is being invoked
* will cause unpredictable results .
* @ return An array of the Objects currently in the map */
public Object [ ] values ( ) { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "values" , this ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Current load = " + _currentLoad ) ; Object [ ] values = new Object [ _currentLoad ] ; int objCount = 0 ; // Iterate through the map pulling out each
// live entry into the values array .
for ( int i = 0 ; i < _mapSize ; i ++ ) { Object value = _values [ i ] ; if ( value != null && value != DELETED ) { values [ objCount ++ ] = value ; } } return values ; |
public class TypedIsomorphicGraphCounter { /** * Counts the isomorphic version of this graph , increasing its total count
* by the specified positive amount .
* @ param count a positive value for the number of times the object occurred
* @ throws IllegalArgumentException if { @ code count } is not a positive value . */
public int count ( G g , int count ) { } } | if ( count < 1 ) throw new IllegalArgumentException ( "Count must be positive" ) ; // We could potentially be comparing the graph to many , many other
// graphs , where each step requires that the graph be converted to a
// canonical , packed form . Therefore , do this once ahead of time so
// that we don ' t do it for each graph it is compared with
// NOTE : This awkward casting code is a work - around for a type - erasure
// issue . I don ' t see the compilation issue on OS X , but the linux Java
// implementations seem to have it . - jurgens
Multigraph < T , ? extends TypedEdge < T > > g2 = ( Multigraph < T , ? extends TypedEdge < T > > ) g ; g2 = ( Multigraph < T , ? extends TypedEdge < T > > ) ( Graphs . pack ( g2 ) ) ; g = ( G ) g2 ; // Use the flat type distribution as a rough filter for avoiding
// unnecessary isomorphic tests
Set < T > typeCounts = g . edgeTypes ( ) ; LinkedList < Map . Entry < G , Integer > > graphs = typesToGraphs . get ( typeCounts ) ; if ( graphs == null ) { // If there wasn ' t a mapping for this graph ' s configuration and
// we ' re not allowing new motif instances , return 0.
if ( ! allowNewMotifs ) return 0 ; sum += count ; graphs = new LinkedList < Map . Entry < G , Integer > > ( ) ; typesToGraphs . put ( new HashSet < T > ( typeCounts ) , graphs ) ; graphs . add ( new SimpleEntry < G , Integer > ( g , count ) ) ; return count ; } else { Iterator < Map . Entry < G , Integer > > iter = graphs . iterator ( ) ; while ( iter . hasNext ( ) ) { Map . Entry < G , Integer > e = iter . next ( ) ; if ( isoTest . areIsomorphic ( g , e . getKey ( ) ) ) { int newCount = e . getValue ( ) + count ; e . setValue ( newCount ) ; // Move this graph from its current position to the front of
// the list by in hopes it will be accessed more frequently
iter . remove ( ) ; graphs . addFirst ( e ) ; sum += count ; return newCount ; } } // If the graph was not found and we can add new motifs , then do so .
if ( allowNewMotifs ) { sum += count ; graphs . addFirst ( new SimpleEntry < G , Integer > ( g , count ) ) ; return count ; } else return 0 ; } |
public class ClientNotificationArea { /** * Remove the given NotificationListener */
public void removeClientNotificationListener ( RESTRequest request , ObjectName name ) { } } | NotificationTargetInformation nti = toNotificationTargetInformation ( request , name . getCanonicalName ( ) ) ; // Remove locally
ClientNotificationListener listener = listeners . remove ( nti ) ; // Check whether the producer of the notification is local or remote .
if ( nti . getRoutingInformation ( ) == null ) { // Remove the notification from the MBeanServer
MBeanServerHelper . removeClientNotification ( name , listener ) ; } else { // Remove the notification listener from the Target - Client Manager through EventAdmin
MBeanRoutedNotificationHelper helper = MBeanRoutedNotificationHelper . getMBeanRoutedNotificationHelper ( ) ; helper . removeRoutedNotificationListener ( nti , listener ) ; } |
public class JawrRequestHandler { /** * Returns the names of the dirty bundles
* @ return the names of the dirty bundles */
public List < String > getDirtyBundleNames ( ) { } } | List < String > bundleNames = new ArrayList < > ( ) ; if ( bundlesHandler != null ) { bundleNames = bundlesHandler . getDirtyBundleNames ( ) ; } return bundleNames ; |
public class AttrMaxPause { /** * Creates a new attribute instance from the provided String .
* @ param str string representation of the attribute
* @ return attribute instance or { @ code null } if provided string is
* { @ code null }
* @ throws BOSHException on parse or validation failure */
static AttrMaxPause createFromString ( final String str ) throws BOSHException { } } | if ( str == null ) { return null ; } else { return new AttrMaxPause ( str ) ; } |
public class Query { /** * This method was created in VisualAge .
* @ param args java . lang . String [ ] */
public static void main2 ( String args [ ] ) { } } | String dbDriver = "COM.ibm.db2.jdbc.app.DB2Driver" ; String url = "jdbc:db2:sample" ; String user = "batra" ; String pass = "varunbatra" ; String querystring = "Select * from batra.employee" ; String fn ; String ln ; String bd ; String sal ; try { ConnectionProperties cp = new ConnectionProperties ( dbDriver , url , user , pass ) ; Query query = new Query ( cp , querystring ) ; QueryResults qs = query . execute ( ) ; System . out . println ( "Number of rows = " + qs . size ( ) ) ; while ( qs . next ( ) ) { fn = qs . getValue ( "FIRSTNME" ) ; ln = qs . getValue ( "LASTNAME" ) ; bd = qs . getValue ( "BIRTHDATE" ) ; sal = qs . getValue ( "SALARY" ) ; System . out . println ( fn + " " + ln + " birthdate " + bd + " salary " + sal ) ; } } catch ( Exception e ) { // com . ibm . ws . ffdc . FFDCFilter . processException ( e , " com . ibm . ws . webcontainer . jsp . tsx . db . Query . main2 " , " 348 " ) ;
System . out . println ( "Exception: " + e . getMessage ( ) ) ; } System . out . println ( "All is Fine!" ) ; |
public class GraphPanelChart { /** * compute minY and step value to have better readable charts */
private void computeChartSteps ( ) { } } | // if special type
if ( chartType == GraphPanelChart . CHART_PERCENTAGE ) { minYVal = 0 ; maxYVal = 100 ; return ; } // try to find the best range . . .
// first , avoid special cases where maxY equal or close to minY
if ( maxYVal - minYVal < 0.1 ) { maxYVal = minYVal + 1 ; } // real step
double step = ( maxYVal - minYVal ) / gridLinesCount ; int pow = - 1 ; double factor = - 1 ; boolean found = false ; double testStep ; // find a step close to the real one
while ( ! found ) { pow ++ ; for ( double f = 0 ; f < 10 ; f ++ ) { testStep = Math . pow ( 10 , pow ) * f ; if ( testStep >= step ) { factor = f ; found = true ; break ; } } } // first proposal
double foundStep = Math . pow ( 10 , pow ) * factor ; // we shift to the closest lower minval to align with the step
minYVal = minYVal - minYVal % foundStep ; // check if step is still good with minY trimmed . If not , use next factor .
if ( minYVal + foundStep * gridLinesCount < maxYVal ) { foundStep = Math . pow ( 10 , pow ) * ( factor + ( pow > 0 ? 0.5 : 1 ) ) ; } // last visual optimization : find the optimal minYVal
double trim = 10 ; while ( ( minYVal - minYVal % trim ) + foundStep * gridLinesCount >= maxYVal && minYVal > 0 ) { minYVal = minYVal - minYVal % trim ; trim = trim * 10 ; } // final calculation
maxYVal = minYVal + foundStep * gridLinesCount ; |
public class Flowable { /** * Returns a Flowable that emits the items emitted by the source Publisher shifted forward in time by a
* specified delay . If { @ code delayError } is true , error notifications will also be delayed .
* < img width = " 640 " height = " 310 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / delay . s . png " alt = " " >
* < dl >
* < dt > < b > Backpressure : < / b > < / dt >
* < dd > The operator doesn ' t interfere with the backpressure behavior which is determined by the source { @ code Publisher } . < / dd >
* < dt > < b > Scheduler : < / b > < / dt >
* < dd > You specify which { @ link Scheduler } this operator will use . < / dd >
* < / dl >
* @ param delay
* the delay to shift the source by
* @ param unit
* the time unit of { @ code delay }
* @ param scheduler
* the { @ link Scheduler } to use for delaying
* @ param delayError
* if true , the upstream exception is signaled with the given delay , after all preceding normal elements ,
* if false , the upstream exception is signaled immediately
* @ return the source Publisher shifted in time by the specified delay
* @ see < a href = " http : / / reactivex . io / documentation / operators / delay . html " > ReactiveX operators documentation : Delay < / a > */
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Flowable < T > delay ( long delay , TimeUnit unit , Scheduler scheduler , boolean delayError ) { } } | ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableDelay < T > ( this , Math . max ( 0L , delay ) , unit , scheduler , delayError ) ) ; |
public class Transporter { /** * - - - PING PACKET - - - */
public Tree createPingPacket ( String id ) { } } | FastBuildTree msg = new FastBuildTree ( 4 ) ; msg . putUnsafe ( "ver" , PROTOCOL_VERSION ) ; msg . putUnsafe ( "sender" , nodeID ) ; msg . putUnsafe ( "id" , id ) ; msg . putUnsafe ( "time" , System . currentTimeMillis ( ) ) ; return msg ; |
public class BufferFieldTable { /** * Move the output buffer to this field ( Override this to use non - standard buffers ) .
* Warning : Check to make sure the field . isSelected ( ) before moving data !
* @ param field The field to move the current data to .
* @ return The error code ( From field . setData ( ) ) . */
public int dataToField ( Field field ) throws DBException { } } | return ( ( BaseBuffer ) this . getDataSource ( ) ) . getNextField ( ( FieldInfo ) field , Constants . DISPLAY , Constants . READ_MOVE ) ; |
public class BasePanel { /** * Display the correct security warning ( access denied on the login screen ) .
* @ param iErrorCode */
public void displaySecurityWarning ( int iErrorCode ) { } } | String strDisplay = this . getTask ( ) . getApplication ( ) . getSecurityErrorText ( iErrorCode ) ; if ( iErrorCode == Constants . ACCESS_DENIED ) { m_iDisplayFieldDesc = ScreenConstants . SECURITY_MODE ; // Make sure this screen is not cached in TopScreen
this . getScreenFieldView ( ) . addScreenLayout ( ) ; // Set up the screen layout
App application = this . getTask ( ) . getApplication ( ) ; String strMessage = application . getResources ( ResourceConstants . ERROR_RESOURCE , true ) . getString ( strDisplay ) ; new SStaticString ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . SET_ANCHOR ) , this , strMessage ) ; new SCannedBox ( this . getNextLocation ( ScreenConstants . NEXT_INPUT_LOCATION , ScreenConstants . SET_ANCHOR ) , this , null , ScreenConstants . DEFAULT_DISPLAY , MenuConstants . BACK ) ; new MenuToolbar ( null , this , null , ScreenConstants . DONT_DISPLAY_FIELD_DESC , null ) ; this . resizeToContent ( strDisplay ) ; } if ( ( iErrorCode == Constants . LOGIN_REQUIRED ) || ( iErrorCode == Constants . AUTHENTICATION_REQUIRED ) ) { m_iDisplayFieldDesc = ScreenConstants . SECURITY_MODE ; // Make sure this screen is not cached in TopScreen
this . getScreenFieldView ( ) . addScreenLayout ( ) ; // Set up the screen layout
App application = this . getTask ( ) . getApplication ( ) ; String strMessage = application . getResources ( ResourceConstants . ERROR_RESOURCE , true ) . getString ( strDisplay ) ; new SStaticString ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . SET_ANCHOR ) , this , strMessage ) ; Record record = null ; String strName = Params . USER_NAME ; int iDataLength = Constant . DEFAULT_FIELD_LENGTH ; String strDesc = application . getResources ( ResourceConstants . MAIN_RESOURCE , true ) . getString ( Params . USER_NAME ) ; Object strDefault = ( ( BaseApplication ) application ) . getUserName ( ) ; Converter converter = new StringField ( record , strName , iDataLength , strDesc , strDefault ) ; converter . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_INPUT_LOCATION , ScreenConstants . SET_ANCHOR ) , this , ScreenConstants . DISPLAY_DESC ) ; strName = Params . PASSWORD ; iDataLength = Constant . DEFAULT_FIELD_LENGTH ; strDesc = application . getResources ( ResourceConstants . MAIN_RESOURCE , true ) . getString ( Params . PASSWORD ) ; strDefault = null ; iDataLength = 80 ; converter = new PasswordField ( record , strName , iDataLength , strDesc , strDefault ) ; converter = new HashSHAConverter ( converter ) ; converter = new FieldLengthConverter ( converter , 20 ) ; converter . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_INPUT_LOCATION , ScreenConstants . SET_ANCHOR ) , this , ScreenConstants . DISPLAY_DESC ) ; SCannedBox loginBox = new SCannedBox ( this . getNextLocation ( ScreenConstants . NEXT_INPUT_LOCATION , ScreenConstants . SET_ANCHOR ) , this , null , ScreenConstants . DEFAULT_DISPLAY , MenuConstants . LOGIN ) ; loginBox . setRequestFocusEnabled ( true ) ; strDesc = application . getResources ( ResourceConstants . MAIN_RESOURCE , true ) . getString ( "Create new account" ) ; String strCommand = Utility . addURLParam ( null , Params . SCREEN , UserInfoModel . USER_INFO_SCREEN_CLASS ) ; new SCannedBox ( this . getNextLocation ( ScreenConstants . RIGHT_OF_LAST_BUTTON_WITH_GAP , ScreenConstants . DONT_SET_ANCHOR ) , this , null , ScreenConstants . DEFAULT_DISPLAY , null , strDesc , MenuConstants . FORM , strCommand , MenuConstants . FORM + DBConstants . TIP ) ; this . setDefaultButton ( loginBox ) ; ( ( BaseField ) converter . getField ( ) ) . addListener ( new FieldListener ( null ) { public void setOwner ( ListenerOwner owner ) { if ( owner == null ) setDefaultButton ( null ) ; super . setOwner ( owner ) ; } } ) ; for ( int i = this . getSFieldCount ( ) ; i >= 0 ; i -- ) { if ( this . getSField ( i ) instanceof ToolScreen ) this . getSField ( i ) . free ( ) ; } new MenuToolbar ( null , this , null , ScreenConstants . DONT_DISPLAY_FIELD_DESC , null ) ; this . resizeToContent ( strDisplay ) ; } |
public class ProposalLineItem { /** * Gets the netCost value for this ProposalLineItem .
* @ return netCost * The cost of the { @ code ProposalLineItem } in proposal currency .
* It supports precision of 2
* decimal places in terms of the fundamental currency
* unit , so the
* { @ link Money # getAmountInMicros } must be multiples
* of 10000 . It doesn ' t include agency
* commission .
* < p > For example , if { @ link Proposal # currencyCode } is
* ' USD ' , then $ 123.45 could be
* represented as 123450000 , but further precision is
* not supported .
* < p > When using sales management , at least one of the
* four fields
* { @ link ProposalLineItem # netRate } , { @ link ProposalLineItem # grossRate } ,
* { @ link ProposalLineItem # netCost } and { @ link ProposalLineItem # grossCost }
* is required .
* < p > When not using sales management , at least one of
* the two fields
* { @ link ProposalLineItem # netRate } and { @ link ProposalLineItem # netCost }
* is required . */
public com . google . api . ads . admanager . axis . v201811 . Money getNetCost ( ) { } } | return netCost ; |
public class SqlLine { /** * Issue the specified error message
* @ param msg the message to issue
* @ return false always */
public boolean error ( String msg ) { } } | output ( getColorBuffer ( ) . red ( msg ) , true , errorStream ) ; return false ; |
public class ApiOvhEmailexchange { /** * Alter this object properties
* REST : PUT / email / exchange / { organizationName } / service / { exchangeService } / publicFolder / { path }
* @ param body [ required ] New object properties
* @ param organizationName [ required ] The internal name of your exchange organization
* @ param exchangeService [ required ] The internal name of your exchange service
* @ param path [ required ] Path for public folder */
public void organizationName_service_exchangeService_publicFolder_path_PUT ( String organizationName , String exchangeService , String path , OvhPublicFolder body ) throws IOException { } } | String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path}" ; StringBuilder sb = path ( qPath , organizationName , exchangeService , path ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ; |
public class NFA { /** * Matches the
* @ param input the input
* @ param startIndex the start index
* @ return the int */
public Match matches ( HString input , int startIndex ) { } } | // The set of states that the NFA is in
Set < State > states = new HashSet < > ( ) ; // Add the start state
states . add ( new State ( startIndex , start ) ) ; // All the accept states that it enters
NavigableSet < State > accepts = new TreeSet < > ( ) ; List < Annotation > tokens = input . tokens ( ) ; while ( ! states . isEmpty ( ) ) { Set < State > newStates = new HashSet < > ( ) ; // states after the next consumption
for ( State s : states ) { if ( s . node . accepts ( ) ) { if ( s . stack . isEmpty ( ) || ( s . stack . size ( ) == 1 && s . node . consumes && s . node . name . equals ( s . stack . peek ( ) ) ) ) { accepts . add ( s ) ; } } Deque < Tuple2 < String , Integer > > currentStack = s . stack ; if ( s . node . emits ) { currentStack . push ( Tuples . $ ( s . node . name , s . inputPosition ) ) ; } for ( Node n : s . node . epsilons ) { if ( s . node . consumes ) { State next = new State ( s . inputPosition , n , currentStack , s . namedGroups ) ; Tuple2 < String , Integer > ng = next . stack . pop ( ) ; next . namedGroups . put ( ng . getKey ( ) , HString . union ( tokens . subList ( ng . v2 , s . inputPosition ) ) ) ; newStates . add ( next ) ; } State next = new State ( s . inputPosition , n , currentStack , s . namedGroups ) ; newStates . add ( next ) ; } if ( s . inputPosition >= input . tokenLength ( ) ) { continue ; } for ( Transition t : s . node . transitions ) { int len = t . transitionFunction . matches ( tokens . get ( s . inputPosition ) ) ; if ( len > 0 ) { State next = new State ( s . inputPosition + len , t . destination , currentStack , s . namedGroups ) ; newStates . add ( next ) ; } } } states . clear ( ) ; states = newStates ; } if ( accepts . isEmpty ( ) ) { return new Match ( - 1 , null ) ; } State last = accepts . last ( ) ; int max = last . inputPosition ; State temp = accepts . last ( ) ; while ( temp != null && temp . inputPosition >= max ) { temp = accepts . lower ( temp ) ; } if ( max == startIndex ) { max ++ ; } return new Match ( max , last . namedGroups ) ; |
public class DraweeView { /** * Sets the controller . */
public void setController ( @ Nullable DraweeController draweeController ) { } } | mDraweeHolder . setController ( draweeController ) ; super . setImageDrawable ( mDraweeHolder . getTopLevelDrawable ( ) ) ; |
public class ScenarioImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public NotificationChain eInverseRemove ( InternalEObject otherEnd , int featureID , NotificationChain msgs ) { } } | switch ( featureID ) { case BpsimPackage . SCENARIO__SCENARIO_PARAMETERS : return basicSetScenarioParameters ( null , msgs ) ; case BpsimPackage . SCENARIO__ELEMENT_PARAMETERS : return ( ( InternalEList < ? > ) getElementParameters ( ) ) . basicRemove ( otherEnd , msgs ) ; case BpsimPackage . SCENARIO__CALENDAR : return ( ( InternalEList < ? > ) getCalendar ( ) ) . basicRemove ( otherEnd , msgs ) ; case BpsimPackage . SCENARIO__VENDOR_EXTENSION : return ( ( InternalEList < ? > ) getVendorExtension ( ) ) . basicRemove ( otherEnd , msgs ) ; } return super . eInverseRemove ( otherEnd , featureID , msgs ) ; |
public class JpaRepository { /** * Adds an entity to the repository , or updates it if it already exists .
* Note that both the { @ code add } and the { @ link # update ( PersistenceEntity )
* update } methods work the same . If the entity does not exist it will be
* added , but if it already exists then it will be updated .
* If the entity is to be updated , then the update query received on the
* constructor will be used .
* If it is inserted , a query generated from the data received by the
* constructor will be used .
* @ param entity
* the entity to add */
@ Override public final void add ( final V entity ) { } } | checkNotNull ( entity , "Received a null pointer as the entity" ) ; if ( ( entity . getId ( ) == null ) || ( entity . getId ( ) < 0 ) ) { // No ID has been assigned
// It is a new entity
getEntityManager ( ) . persist ( entity ) ; } else { // ID already assigned
// It is an existing entity
getEntityManager ( ) . merge ( entity ) ; } |
public class StrSubstitutor { /** * Internal method that substitutes the variables .
* Most users of this class do not need to call this method . This method will
* be called automatically by another ( public ) method .
* Writers of subclasses can override this method if they need access to
* the substitution process at the start or end .
* @ param buf the string builder to substitute into , not null
* @ param offset the start offset within the builder , must be valid
* @ param length the length within the builder to be processed , must be valid
* @ return true if altered */
protected boolean substitute ( final StrBuilder buf , final int offset , final int length ) { } } | return substitute ( buf , offset , length , null ) > 0 ; |
public class InjectionProcessor { /** * F50309.5 */
protected final String getJavaBeansPropertyName ( Member fieldOrMethod ) { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getJavaBeansPropertyName : " + fieldOrMethod ) ; String propertyName ; if ( fieldOrMethod instanceof Field ) { Field field = ( Field ) fieldOrMethod ; propertyName = field . getName ( ) ; } else { Method method = ( Method ) fieldOrMethod ; String name = method . getName ( ) ; if ( name . startsWith ( "set" ) && name . length ( ) > 3 && Character . isUpperCase ( name . charAt ( 3 ) ) ) { propertyName = Character . toLowerCase ( name . charAt ( 3 ) ) + ( name . length ( ) > 4 ? name . substring ( 4 ) : "" ) ; } else { propertyName = null ; } } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getJavaBeansPropertyName : " + propertyName ) ; return propertyName ; |
public class ResourceHandler { /** * Sends a Not Modified response to the client */
private void sendNotModified ( ChannelHandlerContext ctx ) { } } | HttpResponse response = new DefaultHttpResponse ( HttpVersion . HTTP_1_1 , HttpResponseStatus . NOT_MODIFIED ) ; setDateHeader ( response ) ; // Close the connection as soon as the error message is sent .
ctx . writeAndFlush ( response ) . addListener ( ChannelFutureListener . CLOSE ) ; |
public class EuclideanDistance { /** * Calculates Euclidean distance between two multi - dimensional time - series of equal length .
* @ param series1 The first series .
* @ param series2 The second series .
* @ return The eclidean distance .
* @ throws Exception if error occures . */
public double seriesDistance ( double [ ] [ ] series1 , double [ ] [ ] series2 ) throws Exception { } } | if ( series1 . length == series2 . length ) { Double res = 0D ; for ( int i = 0 ; i < series1 . length ; i ++ ) { res = res + distance2 ( series1 [ i ] , series2 [ i ] ) ; } return Math . sqrt ( res ) ; } else { throw new Exception ( "Exception in Euclidean distance: array lengths are not equal" ) ; } |
public class MD5Digest { /** * Static method to get an MD5Digest from a binary byte representation .
* @ param md5Bytes
* @ param offset in the byte array to start reading from
* @ return a filled out MD5Digest */
public static MD5Digest fromBytes ( byte [ ] md5Bytes , int offset ) { } } | byte [ ] md5BytesCopy = Arrays . copyOfRange ( md5Bytes , offset , offset + MD5_BYTES_LENGTH ) ; // TODO : Replace this with a version that encodes without needing a copy .
String md5String = Hex . encodeHexString ( md5BytesCopy ) ; return new MD5Digest ( md5String , md5BytesCopy ) ; |
public class GImageStatistics { /** * Computes the mean of the difference squared between the two images .
* @ param inputA Input image . Not modified .
* @ param inputB Input image . Not modified .
* @ return Mean difference squared */
public static < T extends ImageBase < T > > double meanDiffSq ( T inputA , T inputB ) { } } | if ( inputA instanceof ImageGray ) { if ( GrayU8 . class == inputA . getClass ( ) ) { return ImageStatistics . meanDiffSq ( ( GrayU8 ) inputA , ( GrayU8 ) inputB ) ; } else if ( GrayS8 . class == inputA . getClass ( ) ) { return ImageStatistics . meanDiffSq ( ( GrayS8 ) inputA , ( GrayS8 ) inputB ) ; } else if ( GrayU16 . class == inputA . getClass ( ) ) { return ImageStatistics . meanDiffSq ( ( GrayU16 ) inputA , ( GrayU16 ) inputB ) ; } else if ( GrayS16 . class == inputA . getClass ( ) ) { return ImageStatistics . meanDiffSq ( ( GrayS16 ) inputA , ( GrayS16 ) inputB ) ; } else if ( GrayS32 . class == inputA . getClass ( ) ) { return ImageStatistics . meanDiffSq ( ( GrayS32 ) inputA , ( GrayS32 ) inputB ) ; } else if ( GrayS64 . class == inputA . getClass ( ) ) { return ImageStatistics . meanDiffSq ( ( GrayS64 ) inputA , ( GrayS64 ) inputB ) ; } else if ( GrayF32 . class == inputA . getClass ( ) ) { return ImageStatistics . meanDiffSq ( ( GrayF32 ) inputA , ( GrayF32 ) inputB ) ; } else if ( GrayF64 . class == inputA . getClass ( ) ) { return ImageStatistics . meanDiffSq ( ( GrayF64 ) inputA , ( GrayF64 ) inputB ) ; } else { throw new IllegalArgumentException ( "Unknown image Type" ) ; } } else if ( inputA instanceof ImageInterleaved ) { if ( InterleavedU8 . class == inputA . getClass ( ) ) { return ImageStatistics . meanDiffSq ( ( InterleavedU8 ) inputA , ( InterleavedU8 ) inputB ) ; } else if ( InterleavedS8 . class == inputA . getClass ( ) ) { return ImageStatistics . meanDiffSq ( ( InterleavedS8 ) inputA , ( InterleavedS8 ) inputB ) ; } else if ( InterleavedU16 . class == inputA . getClass ( ) ) { return ImageStatistics . meanDiffSq ( ( InterleavedU16 ) inputA , ( InterleavedU16 ) inputB ) ; } else if ( InterleavedS16 . class == inputA . getClass ( ) ) { return ImageStatistics . meanDiffSq ( ( InterleavedS16 ) inputA , ( InterleavedS16 ) inputB ) ; } else if ( InterleavedS32 . class == inputA . getClass ( ) ) { return ImageStatistics . meanDiffSq ( ( InterleavedS32 ) inputA , ( InterleavedS32 ) inputB ) ; } else if ( InterleavedS64 . class == inputA . getClass ( ) ) { return ImageStatistics . meanDiffSq ( ( InterleavedS64 ) inputA , ( InterleavedS64 ) inputB ) ; } else if ( InterleavedF32 . class == inputA . getClass ( ) ) { return ImageStatistics . meanDiffSq ( ( InterleavedF32 ) inputA , ( InterleavedF32 ) inputB ) ; } else if ( InterleavedF64 . class == inputA . getClass ( ) ) { return ImageStatistics . meanDiffSq ( ( InterleavedF64 ) inputA , ( InterleavedF64 ) inputB ) ; } else { throw new IllegalArgumentException ( "Unknown image Type" ) ; } } else if ( inputA instanceof Planar ) { double mean = 0 ; Planar inA = ( Planar ) inputA ; Planar inB = ( Planar ) inputB ; for ( int i = 0 ; i < inA . getNumBands ( ) ; i ++ ) { mean += meanDiffSq ( inA . getBand ( i ) , inB . getBand ( i ) ) ; } return mean / inA . getNumBands ( ) ; } else { throw new IllegalArgumentException ( "Image type not yet supported " + inputA . getClass ( ) . getSimpleName ( ) ) ; } |
public class RPMBuilder { /** * Add directory to package .
* @ param target Target path like / opt / application / bin / foo
* @ return
* @ throws IOException */
@ Override public FileBuilder addDirectory ( Path target ) throws IOException { } } | checkTarget ( target ) ; FileBuilder fb = new FileBuilder ( ) ; fb . target = target ; fb . content = ByteBuffer . allocate ( 0 ) ; fb . size = fb . content . limit ( ) ; fb . mode = 040000 ; fb . compressFilename ( ) ; fileBuilders . add ( fb ) ; return fb ; |
public class Arguments { /** * the following helper methods assume that 0 < index < args . length */
private void putIntoActivation ( int index , Object value ) { } } | String argName = activation . function . getParamOrVarName ( index ) ; activation . put ( argName , activation , value ) ; |
public class DependencyContainer { /** * Returns true if the underlying dependencies have changed . */
public boolean isModified ( boolean isAsync ) { } } | long now = CurrentTime . currentTime ( ) ; if ( now < _checkExpiresTime ) return _isModified ; if ( _isChecking . getAndSet ( true ) ) return _isModified ; _checkExpiresTime = now + _checkInterval ; if ( isAsync ) { getWorker ( ) . wake ( ) ; } else { try { checkImpl ( ) ; } finally { _isChecking . set ( false ) ; } } return _isModified ; |
public class DateFormat { /** * Returns the date / time formatter with the given date and time
* formatting styles for the default < code > FORMAT < / code > locale .
* @ param dateStyle the given date formatting style . For example ,
* SHORT for " M / d / yy " in the US locale . As currently implemented , relative date
* formatting only affects a limited range of calendar days before or after the
* current date , based on the CLDR & lt ; field type = " day " & gt ; / & lt ; relative & gt ; data : For example ,
* in English , " Yesterday " , " Today " , and " Tomorrow " . Outside of this range , relative
* dates are formatted using the corresponding non - relative style .
* @ param timeStyle the given time formatting style . For example ,
* SHORT for " h : mm a " in the US locale . Relative time styles are not currently
* supported , and behave just like the corresponding non - relative style .
* @ return a date / time formatter .
* @ see Category # FORMAT */
public final static DateFormat getDateTimeInstance ( int dateStyle , int timeStyle ) { } } | return get ( dateStyle , timeStyle , ULocale . getDefault ( Category . FORMAT ) , null ) ; |
public class SimpleDataSource { /** * 初始化
* @ param url jdbc url
* @ param user 用户名
* @ param pass 密码 */
public void init ( String url , String user , String pass ) { } } | init ( url , user , pass , null ) ; |
public class ConstraintViolationImpl { /** * create hash code .
* @ see # equals ( Object ) on which fields are taken into account . */
private int createHashCode ( ) { } } | return Objects . hash ( this . interpolatedMessage , this . propertyPath , this . rootBean , this . leafBeanInstance , this . value , this . constraintDescriptor , this . messageTemplate , this . elementType ) ; |
public class UASparser { /** * loads the data file and creates all internal data structs
* @ param is
* @ throws IOException */
protected void loadDataFromFile ( InputStream is ) throws IOException { } } | PHPFileParser fp = new PHPFileParser ( is ) ; createInternalDataStructre ( fp . getSections ( ) ) ; |
public class DefaultErrorHandler { /** * Receive notification of a recoverable error .
* < p > This corresponds to the definition of " error " in section 1.2
* of the W3C XML 1.0 Recommendation . For example , a validating
* parser would use this callback to report the violation of a
* validity constraint . The default behaviour is to take no
* action . < / p >
* < p > The SAX parser must continue to provide normal parsing events
* after invoking this method : it should still be possible for the
* application to process the document through to the end . If the
* application cannot do so , then the parser should report a fatal
* error even if the XML 1.0 recommendation does not require it to
* do so . < / p >
* @ param exception The error information encapsulated in a
* SAX parse exception .
* @ throws javax . xml . transform . TransformerException Any SAX exception , possibly
* wrapping another exception .
* @ see javax . xml . transform . TransformerException */
public void error ( TransformerException exception ) throws TransformerException { } } | // If the m _ throwExceptionOnError flag is true , rethrow the exception .
// Otherwise report the error to System . err .
if ( m_throwExceptionOnError ) throw exception ; else { PrintWriter pw = getErrorWriter ( ) ; printLocation ( pw , exception ) ; pw . println ( exception . getMessage ( ) ) ; } |
public class MapWithProtoValuesSubject { /** * Specifies that the ' has ' bit of these explicitly specified field descriptors should be ignored
* when comparing for equality . Sub - fields must be specified explicitly if they are to be ignored
* as well .
* < p > Use { @ link # ignoringFieldAbsenceForValues ( ) } instead to ignore the ' has ' bit for all fields .
* @ see # ignoringFieldAbsenceForValues ( ) for details */
public MapWithProtoValuesFluentAssertion < M > ignoringFieldAbsenceOfFieldDescriptorsForValues ( FieldDescriptor firstFieldDescriptor , FieldDescriptor ... rest ) { } } | return usingConfig ( config . ignoringFieldAbsenceOfFieldDescriptors ( asList ( firstFieldDescriptor , rest ) ) ) ; |
public class AmazonEC2Client { /** * Disables ClassicLink DNS support for a VPC . If disabled , DNS hostnames resolve to public IP addresses when
* addressed between a linked EC2 - Classic instance and instances in the VPC to which it ' s linked . For more
* information , see < a
* href = " https : / / docs . aws . amazon . com / AWSEC2 / latest / UserGuide / vpc - classiclink . html " > ClassicLink < / a > in the < i > Amazon
* Elastic Compute Cloud User Guide < / i > .
* @ param disableVpcClassicLinkDnsSupportRequest
* @ return Result of the DisableVpcClassicLinkDnsSupport operation returned by the service .
* @ sample AmazonEC2 . DisableVpcClassicLinkDnsSupport
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / DisableVpcClassicLinkDnsSupport "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DisableVpcClassicLinkDnsSupportResult disableVpcClassicLinkDnsSupport ( DisableVpcClassicLinkDnsSupportRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDisableVpcClassicLinkDnsSupport ( request ) ; |
public class JMXAgent { /** * Register the JMX agent
* @ throws java . lang . Exception */
public synchronized void register ( ) throws Exception { } } | if ( mbeanName != null ) { throw new Exception ( "Agent already registered" ) ; } mbeanName = new ObjectName ( getClass ( ) . getPackage ( ) . getName ( ) + ":type=" + getClass ( ) . getSimpleName ( ) ) ; logger . info ( "Registering JMX agent " + mbeanName ) ; ManagementFactory . getPlatformMBeanServer ( ) . registerMBean ( this , mbeanName ) ; logger . info ( "JMX agent " + mbeanName + " registered" ) ; |
public class HexString { /** * Converts a binary value held in a byte array into a hex string , in the
* given StringBuffer , using exactly two characters per byte of input .
* @ param bin The byte array containing the binary value .
* @ param start The offset into the byte array for conversion to start . .
* @ param length The number of bytes to convert .
* @ param hex The StringBuffer to contain the hex string . */
public static void binToHex ( byte [ ] bin , int start , int length , StringBuffer hex ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "binToHex" , new Object [ ] { bin , Integer . valueOf ( start ) , Integer . valueOf ( length ) , hex } ) ; /* Constant for binary to Hex conversion */
final char BIN2HEX [ ] = { '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , 'a' , 'b' , 'c' , 'd' , 'e' , 'f' } ; int binByte ; for ( int i = start ; i < start + length ; i ++ ) { binByte = bin [ i ] ; /* SibTreat the byte as unsigned */
if ( binByte < 0 ) binByte += 256 ; /* Convert and append each digit */
hex . append ( BIN2HEX [ binByte / 16 ] ) ; hex . append ( BIN2HEX [ binByte % 16 ] ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "binToHex" , hex ) ; |
public class ServerTransportAcceptListener { /** * This method removes a conversation from the list of active conversations . This would be called
* if the connection is closed or if a failure is deteceted .
* @ param conv */
public void removeConversation ( Conversation conv ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "removeConversation" , conv ) ; synchronized ( activeConversations ) { Object connectionReference = conv . getConnectionReference ( ) ; ArrayList list = ( ArrayList ) activeConversations . get ( connectionReference ) ; if ( list != null ) { list . remove ( conv ) ; if ( list . size ( ) == 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "List is now empty, removing connection object" ) ; activeConversations . remove ( connectionReference ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "removeConversation" ) ; |
public class ParamTag { public int doEndTag ( ) throws JspException { } } | /* 63 */
Tag t = findAncestorWithClass ( this , HumanizeMessageSupport . class ) ; /* 64 */
if ( t == null ) { /* 65 */
throw new JspTagException ( Resources . getMessage ( "PARAM_OUTSIDE_MESSAGE" ) ) ; } /* 68 */
HumanizeMessageSupport parent = ( HumanizeMessageSupport ) t ; /* 75 */
Object input = null ; /* 77 */
if ( this . valueSpecified ) { /* 79 */
input = this . value ; } else { /* 83 */
input = this . bodyContent . getString ( ) . trim ( ) ; } /* 85 */
parent . addParam ( input ) ; /* 87 */
return EVAL_PAGE ; |
public class DocumentRootImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setParameterValue ( ParameterValue newParameterValue ) { } } | ( ( FeatureMap . Internal ) getMixed ( ) ) . set ( BpsimPackage . Literals . DOCUMENT_ROOT__PARAMETER_VALUE , newParameterValue ) ; |
public class ColumnPrefixDistributedRowLock { /** * Try to take the lock . The caller must call . release ( ) to properly clean up
* the lock columns from cassandra
* @ throws Exception */
@ Override public void acquire ( ) throws Exception { } } | Preconditions . checkArgument ( ttl == null || TimeUnit . SECONDS . convert ( timeout , timeoutUnits ) < ttl , "Timeout " + timeout + " must be less than TTL " + ttl ) ; RetryPolicy retry = backoffPolicy . duplicate ( ) ; retryCount = 0 ; while ( true ) { try { long curTimeMicros = getCurrentTimeMicros ( ) ; MutationBatch m = keyspace . prepareMutationBatch ( ) . setConsistencyLevel ( consistencyLevel ) ; fillLockMutation ( m , curTimeMicros , ttl ) ; m . execute ( ) ; verifyLock ( curTimeMicros ) ; acquireTime = System . nanoTime ( ) ; return ; } catch ( BusyLockException e ) { release ( ) ; if ( ! retry . allowRetry ( ) ) throw e ; retryCount ++ ; } } |
public class PlayRecordContext { /** * The initial announcement prompting the user to either enter DTMF digits or to speak .
* Consists of one or more audio segments . < br >
* If not specified ( the default ) , the event immediately begins digit collection or recording .
* @ return The array of audio prompts . Array will be empty if none is specified . */
private String [ ] getInitialPromptSegments ( ) { } } | String value = Optional . fromNullable ( getParameter ( SignalParameters . INITIAL_PROMPT . symbol ( ) ) ) . or ( "" ) ; return value . isEmpty ( ) ? new String [ 0 ] : value . split ( "," ) ; |
public class AbstractAction { /** * The method gets all events for the given EventType and executes them in
* the given order . If no events are defined , nothing is done . The method
* return < i > true < / i > if a event was found , otherwise < i > false < / i > .
* @ param _ eventtype trigger events to execute
* @ return < i > true < / i > if a trigger was found and executed , otherwise
* < i > false < / i >
* @ throws EFapsException on error */
protected boolean executeEvents ( final EventType _eventtype ) throws EFapsException { } } | final boolean ret ; final List < EventDefinition > triggers = this . instance . getType ( ) . getEvents ( _eventtype ) ; if ( triggers != null ) { final Parameter parameter = new Parameter ( ) ; parameter . put ( ParameterValues . INSTANCE , getInstance ( ) ) ; for ( final EventDefinition evenDef : triggers ) { evenDef . execute ( parameter ) ; } ret = true ; } else { ret = false ; } return ret ; |
public class TrafficForecastAdjustmentSegment { /** * Gets the adjustmentTimeSeries value for this TrafficForecastAdjustmentSegment .
* @ return adjustmentTimeSeries * The traffic volume of the adjustment . This field should be
* set if { @ code basisType } is { @ link
* BasisType . ABSOLUTE } and null if { @ link BasisType . HISTORICAL } . */
public com . google . api . ads . admanager . axis . v201902 . TimeSeries getAdjustmentTimeSeries ( ) { } } | return adjustmentTimeSeries ; |
public class Locale { /** * Decode the specified array of bytes according to
* a charset selection . This function tries
* to decode a string from the given byte array
* with the following charsets ( in preferred order ) :
* < ul >
* < li > the current charset returned by { @ link Charset # defaultCharset ( ) } , < / li >
* < li > OEM United States : IBM437 , < / li >
* < li > West European : ISO - 8859-1 , < / li >
* < li > one of the chars returned by { @ link Charset # availableCharsets ( ) } . < / li >
* < / ul >
* < p > The IBM437 charset was added to support several specific files ( Dbase files )
* generated from a GIS .
* @ param bytes is the array of bytes to decode .
* @ return the decoded string with the appropriate charset set . */
@ Pure public static String decodeString ( byte [ ] bytes ) { } } | final Charset [ ] prior = getPriorizedDecodingCharsets ( ) ; final String refBuffer = new String ( bytes ) ; CharBuffer buffer = null ; for ( final Charset charset : prior ) { buffer = decodeString ( bytes , charset , refBuffer . length ( ) ) ; if ( buffer != null ) { break ; } } if ( buffer == null ) { // Decode until one of the available charset replied a value
for ( final Charset charset : Charset . availableCharsets ( ) . values ( ) ) { buffer = decodeString ( bytes , charset , refBuffer . length ( ) ) ; if ( buffer != null ) { break ; } } } // Use the default encoding
if ( buffer == null ) { return refBuffer . trim ( ) ; } return buffer . toString ( ) . trim ( ) ; |
public class FilesystemPath { /** * Normalizes a filesystemPath path .
* < ul >
* < li > foo / / bar - > foo / bar
* < li > foo / . / bar - > foo / bar
* < li > foo / . . / bar - > bar
* < li > / . . / bar - > / bar
* < / ul >
* @ param cb charBuffer holding the normalized result
* @ param oldPath the parent path
* @ param newPath the relative path
* @ param offset where in the child path to start */
static protected void normalizePath ( CharBuffer cb , String oldPath , String newPath , int offset , char separatorChar ) { } } | cb . clear ( ) ; cb . append ( oldPath ) ; if ( cb . length ( ) == 0 || cb . lastChar ( ) != '/' ) cb . append ( '/' ) ; int length = newPath . length ( ) ; int i = offset ; while ( i < length ) { char ch = newPath . charAt ( i ) ; char ch2 ; switch ( ch ) { default : if ( ch != separatorChar ) { cb . append ( ch ) ; i ++ ; break ; } // the separator character falls through to be treated as ' / '
case '/' : if ( cb . lastChar ( ) != '/' ) cb . append ( '/' ) ; i ++ ; break ; case '.' : if ( cb . lastChar ( ) != '/' ) { cb . append ( '.' ) ; i ++ ; break ; } if ( i + 1 >= length ) { i += 2 ; break ; } switch ( newPath . charAt ( i + 1 ) ) { default : if ( newPath . charAt ( i + 1 ) != separatorChar ) { cb . append ( '.' ) ; i ++ ; break ; } // the separator falls through to be treated as ' / '
case '/' : i += 2 ; break ; // " foo / . . " - > " "
case '.' : if ( ( i + 2 >= length || ( ch2 = newPath . charAt ( i + 2 ) ) == '/' || ch2 == separatorChar ) && cb . lastChar ( ) == '/' ) { int segment = cb . lastIndexOf ( '/' , cb . length ( ) - 2 ) ; if ( segment == - 1 ) { cb . clear ( ) ; cb . append ( '/' ) ; } else cb . length ( segment + 1 ) ; i += 3 ; } else { cb . append ( '.' ) ; i ++ ; } break ; } } } // strip trailing " / "
/* if ( cb . length ( ) > 1 & & cb . getLastChar ( ) = = ' / ' )
cb . setLength ( cb . length ( ) - 1 ) ; */ |
public class StructureDiagramGenerator { /** * Returns an AtomContainer with all unplaced atoms connected to a given
* atom
* @ param atom The Atom whose unplaced bonding partners are to be returned
* @ return an AtomContainer with all unplaced atoms connected to a
* given atom */
private IAtomContainer getUnplacedAtoms ( IAtom atom ) { } } | IAtomContainer unplacedAtoms = atom . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; List bonds = molecule . getConnectedBondsList ( atom ) ; IAtom connectedAtom ; for ( int f = 0 ; f < bonds . size ( ) ; f ++ ) { connectedAtom = ( ( IBond ) bonds . get ( f ) ) . getOther ( atom ) ; if ( ! connectedAtom . getFlag ( CDKConstants . ISPLACED ) ) { unplacedAtoms . addAtom ( connectedAtom ) ; } } return unplacedAtoms ; |
public class PhysicalDatabase { /** * Make a table for this database .
* @ param record The record to make a table for .
* @ return BaseTable The new table . */
public BaseTable doMakeTable ( Record record ) { } } | BaseTable table = null ; boolean bIsQueryRecord = record . isQueryRecord ( ) ; if ( m_pDatabase == null ) { try { this . open ( ) ; } catch ( DBException ex ) { return null ; // No database
} } if ( bIsQueryRecord ) { // Physical Tables cannot process SQL queries , so use QueryTable !
PassThruTable passThruTable = new QueryTable ( this , record ) ; passThruTable . addTable ( record . getRecordlistAt ( 0 ) . getTable ( ) ) ; return passThruTable ; } table = this . makePhysicalTable ( record ) ; return table ; |
public class VisOdomMonoPlaneInfinity { /** * Estimates the full ( x , y , yaw ) 2D motion estimate from ground points .
* @ return true if successful or false if not */
private boolean estimateClose ( ) { } } | // estimate 2D motion
if ( ! planeMotion . process ( planeSamples . toList ( ) ) ) return false ; // save solutions
closeMotionKeyToCurr = planeMotion . getModelParameters ( ) ; closeInlierCount = planeMotion . getMatchSet ( ) . size ( ) ; // mark inliers as used
for ( int i = 0 ; i < closeInlierCount ; i ++ ) { int index = planeMotion . getInputIndex ( i ) ; VoTrack p = tracksOnPlane . get ( index ) . getCookie ( ) ; p . lastInlier = tick ; } return true ; |
public class ConcurrentLinkedDeque { /** * Guarantees that any node which was unlinked before a call to
* this method will be unreachable from head after it returns .
* Does not guarantee to eliminate slack , only that head will
* point to a node that was active while this method was running . */
private final void updateHead ( ) { } } | // Either head already points to an active node , or we keep
// trying to cas it to the first node until it does .
Node < E > h , p , q ; restartFromHead : while ( ( h = head ) . item == null && ( p = h . prev ) != null ) { for ( ; ; ) { if ( ( q = p . prev ) == null || ( q = ( p = q ) . prev ) == null ) { // It is possible that p is PREV _ TERMINATOR ,
// but if so , the CAS is guaranteed to fail .
if ( casHead ( h , p ) ) return ; else continue restartFromHead ; } else if ( h != head ) continue restartFromHead ; else p = q ; } } |
public class Matrix4f { /** * / * ( non - Javadoc )
* @ see org . joml . Matrix4fc # scale ( float , org . joml . Matrix4f ) */
public Matrix4f scale ( float xyz , Matrix4f dest ) { } } | return scale ( xyz , xyz , xyz , dest ) ; |
public class CmsContentService { /** * Validates the given XML content . < p >
* @ param cms the cms context
* @ param structureId the structure id
* @ param content the XML content
* @ param fieldNames if not null , only validation errors in paths from this set will be added to the validation result
* @ return the validation result */
private CmsValidationResult validateContent ( CmsObject cms , CmsUUID structureId , CmsXmlContent content , Set < String > fieldNames ) { } } | CmsXmlContentErrorHandler errorHandler = content . validate ( cms ) ; Map < String , Map < String [ ] , String > > errorsByEntity = new HashMap < String , Map < String [ ] , String > > ( ) ; if ( errorHandler . hasErrors ( ) ) { boolean reallyHasErrors = false ; for ( Entry < Locale , Map < String , String > > localeEntry : errorHandler . getErrors ( ) . entrySet ( ) ) { Map < String [ ] , String > errors = new HashMap < String [ ] , String > ( ) ; for ( Entry < String , String > error : localeEntry . getValue ( ) . entrySet ( ) ) { I_CmsXmlContentValue value = content . getValue ( error . getKey ( ) , localeEntry . getKey ( ) ) ; if ( ( fieldNames == null ) || fieldNames . contains ( value . getPath ( ) ) ) { errors . put ( getPathElements ( content , value ) , error . getValue ( ) ) ; reallyHasErrors = true ; } } if ( reallyHasErrors ) { errorsByEntity . put ( CmsContentDefinition . uuidToEntityId ( structureId , localeEntry . getKey ( ) . toString ( ) ) , errors ) ; } } } Map < String , Map < String [ ] , String > > warningsByEntity = new HashMap < String , Map < String [ ] , String > > ( ) ; if ( errorHandler . hasWarnings ( ) ) { boolean reallyHasErrors = false ; for ( Entry < Locale , Map < String , String > > localeEntry : errorHandler . getWarnings ( ) . entrySet ( ) ) { Map < String [ ] , String > warnings = new HashMap < String [ ] , String > ( ) ; for ( Entry < String , String > warning : localeEntry . getValue ( ) . entrySet ( ) ) { I_CmsXmlContentValue value = content . getValue ( warning . getKey ( ) , localeEntry . getKey ( ) ) ; if ( ( fieldNames == null ) || fieldNames . contains ( value . getPath ( ) ) ) { warnings . put ( getPathElements ( content , value ) , warning . getValue ( ) ) ; reallyHasErrors = true ; } } if ( reallyHasErrors ) { warningsByEntity . put ( CmsContentDefinition . uuidToEntityId ( structureId , localeEntry . getKey ( ) . toString ( ) ) , warnings ) ; } } } return new CmsValidationResult ( errorsByEntity , warningsByEntity ) ; |
public class GetLifecyclePolicyRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetLifecyclePolicyRequest getLifecyclePolicyRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getLifecyclePolicyRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getLifecyclePolicyRequest . getContainerName ( ) , CONTAINERNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ProtectedResourceClientFactory { /** * Constructs a RestTemplate that adds the OAuth1 Authorization header to each request before it is executed . */
public static RestTemplate create ( OAuth1Credentials credentials ) { } } | RestTemplate client = new RestTemplate ( ClientHttpRequestFactorySelector . getRequestFactory ( ) ) ; OAuth1RequestInterceptor interceptor = new OAuth1RequestInterceptor ( credentials ) ; List < ClientHttpRequestInterceptor > interceptors = new LinkedList < ClientHttpRequestInterceptor > ( ) ; interceptors . add ( interceptor ) ; client . setInterceptors ( interceptors ) ; return client ; |
public class SqlRunner { /** * 创建SqlRunner
* @ param ds 数据源
* @ param driverClassName 数据库连接驱动类名
* @ return SqlRunner */
public static SqlRunner create ( DataSource ds , String driverClassName ) { } } | return new SqlRunner ( ds , DialectFactory . newDialect ( driverClassName ) ) ; |
public class ChannelHelper { /** * Writes bytes to channel
* @ param ch
* @ param bytes
* @ throws IOException */
public static final void write ( WritableByteChannel ch , byte [ ] bytes ) throws IOException { } } | write ( ch , bytes , 0 , bytes . length ) ; |
public class ServerControllerImpl { /** * Configuration using < code > undertow . xml < / code > conforming to Undertow / Wildfly XML Schemas
* @ param configuration
* @ param builder
* @ param rootHandler current root handler
* @ param undertowResource URI for XML configuration
* @ return */
private HttpHandler configureUndertow ( Configuration configuration , Undertow . Builder builder , HttpHandler rootHandler , URL undertowResource ) { } } | try { if ( jaxb == null ) { // we don ' t want static references here
jaxb = JAXBContext . newInstance ( "org.ops4j.pax.web.service.undertow.internal.configuration.model" , UndertowConfiguration . class . getClassLoader ( ) ) ; } Unmarshaller unmarshaller = jaxb . createUnmarshaller ( ) ; UnmarshallerHandler unmarshallerHandler = unmarshaller . getUnmarshallerHandler ( ) ; Dictionary < String , Object > properties = new Hashtable < > ( ) ; if ( configuration instanceof ConfigurationSource ) { Dictionary < String , Object > externalConfig = ( ( ConfigurationSource ) configuration ) . getConfiguration ( ) ; if ( externalConfig != null ) { for ( Enumeration < String > e = externalConfig . keys ( ) ; e . hasMoreElements ( ) ; ) { String key = e . nextElement ( ) ; properties . put ( key , externalConfig . get ( key ) ) ; } } } if ( properties . get ( WebContainerConstants . PROPERTY_HTTP_PORT ) == null && configuration . getHttpPort ( ) != null ) { properties . put ( WebContainerConstants . PROPERTY_HTTP_PORT , Integer . toString ( configuration . getHttpPort ( ) ) ) ; } if ( properties . get ( WebContainerConstants . PROPERTY_HTTP_SECURE_PORT ) == null && configuration . getHttpSecurePort ( ) != null ) { properties . put ( WebContainerConstants . PROPERTY_HTTP_SECURE_PORT , Integer . toString ( configuration . getHttpSecurePort ( ) ) ) ; } // BundleContextPropertyResolver gives access to e . g . , $ { karaf . base }
final PropertyResolver resolver = new DictionaryPropertyResolver ( properties , new BundleContextPropertyResolver ( bundleContext ) ) ; // indirect unmarslaling with property resolution * inside XML attribute values *
SAXParserFactory spf = SAXParserFactory . newInstance ( ) ; spf . setNamespaceAware ( true ) ; XMLReader xmlReader = spf . newSAXParser ( ) . getXMLReader ( ) ; // tricky PropertyResolver - > Properties bridge
xmlReader . setContentHandler ( new ResolvingContentHandler ( new Properties ( ) { @ Override public String getProperty ( String key ) { return resolver . get ( key ) ; } @ Override public String getProperty ( String key , String defaultValue ) { String value = resolver . get ( key ) ; return value == null ? defaultValue : value ; } } , unmarshallerHandler ) ) ; try ( InputStream stream = undertowResource . openStream ( ) ) { xmlReader . parse ( new InputSource ( stream ) ) ; } UndertowConfiguration cfg = ( UndertowConfiguration ) unmarshallerHandler . getResult ( ) ; if ( cfg == null || cfg . getSocketBindings ( ) . size ( ) == 0 || cfg . getInterfaces ( ) . size ( ) == 0 || cfg . getSubsystem ( ) == null || cfg . getSubsystem ( ) . getServer ( ) == null ) { throw new IllegalArgumentException ( "Problem configuring Undertow server using \"" + undertowResource + "\": invalid XML" ) ; } cfg . init ( ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Undertow XML configuration: {}" , cfg ) ; } // ok , we have everything unmarshalled from XML to config object
// we can configure all / some aspects of Undertow now
Server . HttpListener http = cfg . getSubsystem ( ) . getServer ( ) . getHttpListener ( ) ; Server . HttpsListener https = cfg . getSubsystem ( ) . getServer ( ) . getHttpsListener ( ) ; if ( http == null && https == null ) { throw new IllegalArgumentException ( "No listener configuration available in \"" + undertowResource + "\". Please configure http and/or https listeners." ) ; } // http listener
if ( http != null ) { UndertowConfiguration . BindingInfo binding = cfg . bindingInfo ( http . getSocketBindingName ( ) ) ; for ( String address : binding . getAddresses ( ) ) { LOG . info ( "Starting undertow http listener on " + address + ":" + binding . getPort ( ) ) ; builder . addHttpListener ( binding . getPort ( ) , address ) ; } } // https listener
if ( https != null ) { UndertowConfiguration . BindingInfo binding = cfg . bindingInfo ( https . getSocketBindingName ( ) ) ; SecurityRealm realm = cfg . securityRealm ( https . getSecurityRealm ( ) ) ; if ( realm == null ) { throw new IllegalArgumentException ( "No security realm with name \"" + https . getSecurityRealm ( ) + "\" available for \"" + https . getName ( ) + "\" https listener." ) ; } for ( String address : binding . getAddresses ( ) ) { LOG . info ( "Starting undertow https listener on " + address + ":" + binding . getPort ( ) ) ; // TODO : could this be shared across interface : port bindings ?
SSLContext sslContext = buildSSLContext ( realm ) ; builder . addHttpsListener ( binding . getPort ( ) , address , sslContext ) ; // options - see io . undertow . protocols . ssl . UndertowAcceptingSslChannel ( )
// one of NOT _ REQUESTED , REQUESTED , REQUIRED
builder . setSocketOption ( Options . SSL_CLIENT_AUTH_MODE , SslClientAuthMode . valueOf ( https . getVerifyClient ( ) ) ) ; SecurityRealm . Engine engine = realm . getIdentities ( ) . getSsl ( ) . getEngine ( ) ; if ( engine != null ) { // could be taken from these as well :
// - https . getEnabledProtocols ( ) ;
// - https . getEnabledCipherSuites ( ) ;
if ( engine . getEnabledProtocols ( ) . size ( ) > 0 ) { builder . setSocketOption ( Options . SSL_ENABLED_PROTOCOLS , Sequence . of ( engine . getEnabledProtocols ( ) ) ) ; } if ( engine . getEnabledCipherSuites ( ) . size ( ) > 0 ) { builder . setSocketOption ( Options . SSL_ENABLED_CIPHER_SUITES , Sequence . of ( engine . getEnabledCipherSuites ( ) ) ) ; } } } } // identity manager - looked up in " default " security realm
SecurityRealm defaultRealm = cfg . securityRealm ( "default" ) ; if ( defaultRealm != null ) { SecurityRealm . JaasAuth jaasAuth = defaultRealm . getAuthentication ( ) . getJaas ( ) ; SecurityRealm . PropertiesAuth propertiesAuth = defaultRealm . getAuthentication ( ) . getProperties ( ) ; if ( jaasAuth != null ) { String userPrincipalClassName = defaultRealm . getUserPrincipalClassName ( ) ; if ( userPrincipalClassName == null || "" . equals ( userPrincipalClassName . trim ( ) ) ) { userPrincipalClassName = "java.security.Principal" ; } Set < String > rolePrincipalClassNames = new LinkedHashSet < > ( defaultRealm . getRolePrincipalClassNames ( ) ) ; identityManager = new JaasIdentityManager ( jaasAuth . getName ( ) , userPrincipalClassName , rolePrincipalClassNames ) ; } else if ( propertiesAuth != null ) { File userBase = new File ( propertiesAuth . getPath ( ) ) ; if ( ! userBase . isFile ( ) ) { throw new IllegalArgumentException ( userBase . getCanonicalPath ( ) + " is not accessible. Can't load users/groups information." ) ; } Properties userProperties = new Properties ( ) ; Map < String , String > map = new HashMap < > ( ) ; try ( FileInputStream stream = new FileInputStream ( userBase ) ) { userProperties . load ( stream ) ; for ( String user : userProperties . stringPropertyNames ( ) ) { map . put ( user , userProperties . getProperty ( user ) ) ; } } identityManager = new PropertiesIdentityManager ( map ) ; } } // / undertow / subsystem / server / host / location - file handlers for static context paths .
if ( cfg . getSubsystem ( ) . getServer ( ) . getHost ( ) != null ) { for ( Server . Host . Location location : cfg . getSubsystem ( ) . getServer ( ) . getHost ( ) . getLocation ( ) ) { String context = location . getName ( ) ; String handlerRef = location . getHandler ( ) ; UndertowSubsystem . FileHandler fileHandler = cfg . handler ( handlerRef ) ; if ( fileHandler == null ) { throw new IllegalArgumentException ( "No handler with name \"" + location . getHandler ( ) + "\" available for " + location . getName ( ) + " location." ) ; } File base = new File ( fileHandler . getPath ( ) ) ; if ( ! base . isDirectory ( ) ) { throw new IllegalArgumentException ( base . getCanonicalPath ( ) + " is not accessible. Can't configure handler for " + location . getName ( ) + " location." ) ; } // fileHandler . path is simply filesystem directory
ResourceHandler rh = new ResourceHandler ( new FileResourceManager ( base , 4096 ) ) ; if ( cfg . getSubsystem ( ) . getServletContainer ( ) != null ) { rh . setWelcomeFiles ( ) ; for ( org . ops4j . pax . web . service . undertow . internal . configuration . model . ServletContainer . WelcomeFile wf : cfg . getSubsystem ( ) . getServletContainer ( ) . getWelcomeFiles ( ) ) { rh . addWelcomeFiles ( wf . getName ( ) ) ; } } if ( rootHandler instanceof PathHandler ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Adding resource handler for location \"" + context + "\" and base path \"" + base . getCanonicalPath ( ) + "\"." ) ; } ( ( PathHandler ) rootHandler ) . addPrefixPath ( context , rh ) ; } } } // global filters ( subsystem / filters / response - header and subsystem / filters / filter )
if ( cfg . getSubsystem ( ) . getServer ( ) . getHost ( ) != null ) { for ( Server . Host . FilterRef fr : cfg . getSubsystem ( ) . getServer ( ) . getHost ( ) . getFilterRef ( ) ) { UndertowSubsystem . AbstractFilter filter = cfg . filter ( fr . getName ( ) ) ; if ( filter == null ) { throw new IllegalArgumentException ( "No filter with name \"" + fr . getName ( ) + "\" available." ) ; } rootHandler = filter . configure ( rootHandler ) ; } } // access log
if ( cfg . getSubsystem ( ) . getServer ( ) . getHost ( ) != null && cfg . getSubsystem ( ) . getServer ( ) . getHost ( ) . getAccessLog ( ) != null ) { Server . Host . AccessLog accessLog = cfg . getSubsystem ( ) . getServer ( ) . getHost ( ) . getAccessLog ( ) ; Bundle bundle = FrameworkUtil . getBundle ( ServerControllerImpl . class ) ; ClassLoader loader = bundle . adapt ( BundleWiring . class ) . getClassLoader ( ) ; xnioWorker = UndertowUtil . createWorker ( loader ) ; AccessLogReceiver logReceiver = DefaultAccessLogReceiver . builder ( ) . setLogWriteExecutor ( xnioWorker ) . setOutputDirectory ( new File ( accessLog . getDirectory ( ) ) . toPath ( ) ) . setLogBaseName ( accessLog . getPrefix ( ) ) . setLogNameSuffix ( accessLog . getSuffix ( ) ) . setRotate ( Boolean . parseBoolean ( accessLog . getRotate ( ) ) ) . build ( ) ; rootHandler = new AccessLogHandler ( rootHandler , logReceiver , accessLog . getPattern ( ) , AccessLogHandler . class . getClassLoader ( ) ) ; } // session configuration and persistence
this . defaultSessionTimeoutInMinutes = 30 ; try { if ( cfg . getSubsystem ( ) . getServletContainer ( ) != null ) { String defaultSessionTimeout = cfg . getSubsystem ( ) . getServletContainer ( ) . getDefaultSessionTimeout ( ) ; if ( defaultSessionTimeout != null && ! "" . equals ( defaultSessionTimeout ) ) { this . defaultSessionTimeoutInMinutes = Integer . parseInt ( defaultSessionTimeout ) ; } } } catch ( NumberFormatException ignored ) { } PersistentSessionsConfig persistentSessions = cfg . getSubsystem ( ) . getServletContainer ( ) == null ? null : cfg . getSubsystem ( ) . getServletContainer ( ) . getPersistentSessions ( ) ; if ( persistentSessions == null ) { // no sessions , but let ' s use InMemorySessionPersistence
LOG . info ( "Using in-memory session persistence" ) ; sessionPersistenceManager = new InMemorySessionPersistence ( ) ; } else { if ( persistentSessions . getPath ( ) != null && ! "" . equals ( persistentSessions . getPath ( ) . trim ( ) ) ) { // file persistence manager
File sessionsDir = new File ( persistentSessions . getPath ( ) ) ; sessionsDir . mkdirs ( ) ; LOG . info ( "Using file session persistence. Location: " + sessionsDir . getCanonicalPath ( ) ) ; sessionPersistenceManager = new FileSessionPersistence ( sessionsDir ) ; } else { // in memory persistence manager
LOG . info ( "No path configured for persistent-sessions. Using in-memory session persistence." ) ; sessionPersistenceManager = new InMemorySessionPersistence ( ) ; } } } catch ( Exception e ) { throw new IllegalArgumentException ( "Problem configuring Undertow server using \"" + undertowResource + "\": " + e . getMessage ( ) , e ) ; } return rootHandler ; |
public class CustomTagLibrary { /** * Obtains the script for the given tag name . Loads if necessary .
* Synchronizing this method would have a potential race condition
* if two threads try to load two tags that are referencing each other .
* So we synchronize { @ link # scripts } , even though this means
* we may end up compiling the same script twice . */
private Script load ( String name ) throws JellyException { } } | Script script = scripts . get ( name ) ; if ( script != null && ! MetaClass . NO_CACHE ) return script ; script = null ; if ( MetaClassLoader . debugLoader != null ) script = load ( name , MetaClassLoader . debugLoader . loader ) ; if ( script == null ) script = load ( name , classLoader ) ; return script ; |
public class VirtualServiceSpecMarshaller { /** * Marshall the given parameter object . */
public void marshall ( VirtualServiceSpec virtualServiceSpec , ProtocolMarshaller protocolMarshaller ) { } } | if ( virtualServiceSpec == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( virtualServiceSpec . getProvider ( ) , PROVIDER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class TaskHolder { /** * Get the servlet ' s property .
* For Ajax proxies , the top level proxy is shared among sessions . since it is not unique , don ' t return property . */
public String getProperty ( String strKey , Map < String , Object > properties ) { } } | String strProperty = super . getProperty ( strKey , properties ) ; if ( strProperty == null ) if ( ! m_proxyTask . isShared ( ) ) strProperty = m_proxyTask . getProperty ( strKey ) ; return strProperty ; |
public class GammaCorrection { /** * Create the gamma correction lookup table */
private static int [ ] gammaLUT ( double gammaValue ) { } } | int [ ] gammaLUT = new int [ 256 ] ; for ( int i = 0 ; i < gammaLUT . length ; i ++ ) { gammaLUT [ i ] = ( int ) ( 255 * ( Math . pow ( ( double ) i / ( double ) 255 , gammaValue ) ) ) ; } return gammaLUT ; |
public class CreatePolicyVersionRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreatePolicyVersionRequest createPolicyVersionRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createPolicyVersionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createPolicyVersionRequest . getPolicyName ( ) , POLICYNAME_BINDING ) ; protocolMarshaller . marshall ( createPolicyVersionRequest . getPolicyDocument ( ) , POLICYDOCUMENT_BINDING ) ; protocolMarshaller . marshall ( createPolicyVersionRequest . getSetAsDefault ( ) , SETASDEFAULT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class JaxRsEJBModuleInfoBuilder { /** * getApplicationSubclasses
* @ param classes
* @ param ejb
* @ param appClassloader */
private void getEJBApplicationSubclasses ( Set < Class < ? > > classes , EJBEndpoint ejb , ClassLoader appClassloader ) { } } | final String methodName = "getEJBApplicationSubclasses" ; if ( tc . isEntryEnabled ( ) ) { Tr . entry ( tc , methodName ) ; } if ( classes == null ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , methodName , Collections . emptySet ( ) ) ; return ; } Class < Application > appClass = Application . class ; final String ejbClassName = ejb . getClassName ( ) ; Class < ? > c = null ; try { c = appClassloader . loadClass ( ejbClassName ) ; } catch ( ClassNotFoundException e ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName + " exit - due to Class Not Found for " + ejbClassName + ": " + e ) ; } } if ( c != null && appClass . isAssignableFrom ( c ) ) { classes . add ( c ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , methodName , classes ) ; |
public class RelativeTimeFormatter { /** * Return the relative time from the calendar datetime against the SMSC datetime .
* @ param calendar the date .
* @ param smscCalendar the SMSC date .
* @ return The relative time between the calendar date and the SMSC calendar date . */
public String format ( Calendar calendar , Calendar smscCalendar ) { } } | if ( calendar == null || smscCalendar == null ) { return null ; } long diffTimeInMillis = calendar . getTimeInMillis ( ) - smscCalendar . getTimeInMillis ( ) ; if ( diffTimeInMillis < 0 ) { throw new IllegalArgumentException ( "The requested relative time has already past." ) ; } // calculate period from epoch , this is not as accurate as Joda - Time Period class or Java 8 Period
Calendar offsetEpoch = Calendar . getInstance ( utcTimeZone ) ; offsetEpoch . setTimeInMillis ( diffTimeInMillis ) ; int years = offsetEpoch . get ( Calendar . YEAR ) - 1970 ; int months = offsetEpoch . get ( Calendar . MONTH ) ; int days = offsetEpoch . get ( Calendar . DAY_OF_MONTH ) - 1 ; int hours = offsetEpoch . get ( Calendar . HOUR_OF_DAY ) ; int minutes = offsetEpoch . get ( Calendar . MINUTE ) ; int seconds = offsetEpoch . get ( Calendar . SECOND ) ; if ( years >= 100 ) { throw new IllegalArgumentException ( "The requested relative time is more then a century (" + years + " years)." ) ; } return format ( years , months , days , hours , minutes , seconds ) ; |
public class IfThenElse { /** * { @ inheritDoc } */
public Node replaceNode ( int index , Node newNode ) { } } | if ( index == 0 ) { return newNode ; } int conditionNodes = condition . countNodes ( ) ; if ( index <= conditionNodes ) { return new IfThenElse ( condition . replaceNode ( index - 1 , newNode ) , then , otherwise ) ; } else { int thenNodes = then . countNodes ( ) ; if ( index <= conditionNodes + thenNodes ) { return new IfThenElse ( condition , then . replaceNode ( index - conditionNodes - 1 , newNode ) , otherwise ) ; } else { return new IfThenElse ( condition , then , otherwise . replaceNode ( index - conditionNodes - thenNodes - 1 , newNode ) ) ; } } |
public class DeactivateUserRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeactivateUserRequest deactivateUserRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deactivateUserRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deactivateUserRequest . getUserId ( ) , USERID_BINDING ) ; protocolMarshaller . marshall ( deactivateUserRequest . getAuthenticationToken ( ) , AUTHENTICATIONTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class JsonReader { /** * Returns the next token , a { @ link com . google . gson . stream . JsonToken # NAME property name } , and
* consumes it .
* @ throws java . io . IOException if the next token in the stream is not a property
* name . */
public String nextName ( ) throws IOException { } } | int p = peeked ; if ( p == PEEKED_NONE ) { p = doPeek ( ) ; } String result ; if ( p == PEEKED_UNQUOTED_NAME ) { result = nextUnquotedValue ( ) ; } else if ( p == PEEKED_SINGLE_QUOTED_NAME ) { result = nextQuotedValue ( '\'' ) ; } else if ( p == PEEKED_DOUBLE_QUOTED_NAME ) { result = nextQuotedValue ( '"' ) ; } else { throw new IllegalStateException ( "Expected a name but was " + peek ( ) + locationString ( ) ) ; } peeked = PEEKED_NONE ; pathNames [ stackSize - 1 ] = result ; return result ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcZone ( ) { } } | if ( ifcZoneEClass == null ) { ifcZoneEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 776 ) ; } return ifcZoneEClass ; |
public class DigestUtil { /** * 计算SHA - 1摘要值 , 并转为16进制字符串
* @ param data 被摘要数据
* @ param charset 编码
* @ return SHA - 1摘要的16进制表示 */
public static String sha1Hex ( String data , String charset ) { } } | return new Digester ( DigestAlgorithm . SHA1 ) . digestHex ( data , charset ) ; |
public class Equivalencer { /** * Loads the { @ link ParameterEquivalencer } if it has not already been
* loaded .
* @ throws EquivalencerException Thrown if an error occurred loading the
* equivalencing engine . */
private void loadEquivalencingEngine ( ) throws EquivalencerException { } } | if ( paramEquivalencer == null ) { try { paramEquivalencer = DefaultParameterEquivalencer . getInstance ( ) ; } catch ( Exception e ) { throw new EquivalencerException ( "Unable to load equivalencing engine." , e ) ; } } |
public class AmazonAlexaForBusinessClient { /** * Retrieves a list of gateway summaries . Use GetGateway to retrieve details of a specific gateway . An optional
* gateway group ARN can be provided to only retrieve gateway summaries of gateways that are associated with that
* gateway group ARN .
* @ param listGatewaysRequest
* @ return Result of the ListGateways operation returned by the service .
* @ sample AmazonAlexaForBusiness . ListGateways
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / alexaforbusiness - 2017-11-09 / ListGateways " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public ListGatewaysResult listGateways ( ListGatewaysRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListGateways ( request ) ; |
public class RetryPolicy { /** * Sets the { @ code delay } between retries , exponentially backing off to the { @ code maxDelay } and multiplying
* successive delays by a factor of 2.
* @ throws NullPointerException if { @ code chronoUnit } is null
* @ throws IllegalArgumentException if { @ code delay } is < = 0 or { @ code delay } is > = { @ code maxDelay }
* @ throws IllegalStateException if { @ code delay } is > = the { @ link RetryPolicy # withMaxDuration ( Duration )
* maxDuration } , if delays have already been set , or if random delays have already been set */
public RetryPolicy < R > withBackoff ( long delay , long maxDelay , ChronoUnit chronoUnit ) { } } | return withBackoff ( delay , maxDelay , chronoUnit , 2 ) ; |
public class IonException { /** * Finds the first exception in the { @ link # getCause ( ) } chain that is
* an instance of the given type .
* @ return null if there ' s no cause of the given type . */
@ SuppressWarnings ( "unchecked" ) public < T extends Throwable > T causeOfType ( Class < T > type ) { } } | IdentityHashMap < Throwable , Throwable > seen = new IdentityHashMap < Throwable , Throwable > ( ) ; Throwable cause = getCause ( ) ; while ( cause != null && ! type . isInstance ( cause ) ) { if ( seen . put ( cause , cause ) != null ) // cycle check
{ return null ; } cause = cause . getCause ( ) ; } return ( T ) cause ; |
public class Solo { /** * Types text in the specified WebElement .
* @ param webElement the WebElement to type text in
* @ param text the text to enter in the { @ link WebElement } field */
public void typeTextInWebElement ( WebElement webElement , String text ) { } } | if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "typeTextInWebElement(" + webElement + ", \"" + text + "\")" ) ; } clickOnWebElement ( webElement ) ; dialogUtils . hideSoftKeyboard ( null , true , true ) ; instrumentation . sendStringSync ( text ) ; |
public class DialogPreference { /** * Obtains the padding of the preference ' s dialog from a specific typed array .
* @ param typedArray
* The typed array , the padding should be obtained from , as an instance of the class
* { @ link TypedArray } . The typed array may not be null */
private void obtainDialogPadding ( @ NonNull final TypedArray typedArray ) { } } | int defaultLeftPadding = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . dialog_left_padding ) ; int defaultTopPadding = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . dialog_top_padding ) ; int defaultRightPadding = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . dialog_right_padding ) ; int defaultBottomPadding = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . dialog_bottom_padding ) ; int left = typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogPaddingLeft , defaultLeftPadding ) ; int top = typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogPaddingTop , defaultTopPadding ) ; int right = typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogPaddingRight , defaultRightPadding ) ; int bottom = typedArray . getDimensionPixelSize ( R . styleable . DialogPreference_dialogPaddingBottom , defaultBottomPadding ) ; setDialogPadding ( left , top , right , bottom ) ; |
public class LinuxTaskController { /** * Sets up the permissions of the following directories :
* Job cache directory
* Archive directory
* Hadoop log directories */
@ Override void setup ( ) { } } | super . setup ( ) ; // set up job cache directory and associated permissions
String localDirs [ ] = this . mapredLocalDirs ; for ( String localDir : localDirs ) { // Cache root
File cacheDirectory = new File ( localDir , TaskTracker . getCacheSubdir ( ) ) ; File jobCacheDirectory = new File ( localDir , TaskTracker . getJobCacheSubdir ( ) ) ; if ( ! cacheDirectory . exists ( ) ) { if ( ! cacheDirectory . mkdirs ( ) ) { LOG . warn ( "Unable to create cache directory : " + cacheDirectory . getPath ( ) ) ; } } if ( ! jobCacheDirectory . exists ( ) ) { if ( ! jobCacheDirectory . mkdirs ( ) ) { LOG . warn ( "Unable to create job cache directory : " + jobCacheDirectory . getPath ( ) ) ; } } // Give world writable permission for every directory under
// mapred - local - dir .
// Child tries to write files under it when executing .
changeDirectoryPermissions ( localDir , FILE_PERMISSIONS , true ) ; } // end of local directory manipulations
// setting up perms for user logs
File taskLog = TaskLog . getUserLogDir ( ) ; changeDirectoryPermissions ( taskLog . getPath ( ) , FILE_PERMISSIONS , false ) ; |
public class WonderPushUriHelper { /** * Returns the non secure absolute url for the given resource
* @ param resource
* The resource path , which may or may not start with
* " / " + WonderPush . API _ VERSION */
protected static String getNonSecureAbsoluteUrl ( String resource ) { } } | if ( resource . startsWith ( "/" + WonderPush . API_VERSION ) ) { resource = resource . substring ( 1 + WonderPush . API_VERSION . length ( ) ) ; } return WonderPush . getNonSecureBaseURL ( ) + resource ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.