signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class ReflectionInstantiatorDefinitionFactory { /** * IFJAVA8 _ END */ private static Parameter [ ] getParameters ( Constructor < ? > constructor , Type target ) { } }
return buildParameters ( target , constructor . getParameterTypes ( ) , constructor . getGenericParameterTypes ( ) , TypeHelper . toClass ( target ) . getTypeParameters ( ) ) ;
public class Similarity { /** * Computes the lin similarity measure , which is motivated by information * theory priniciples . This works best if both vectors have already been * weighted using point - wise mutual information . This similarity measure is * described in more detail in the following paper : * < li style = " font - family : Garamond , Georgia , serif " > D . Lin , " Automatic * Retrieval and Clustering of Similar Words " < i > Proceedings of the 36th * Annual Meeting of the Association for Computational Linguistics and * 17th International Conference on Computational Linguistics , Volume 2 * < / i > , Montreal , Quebec , Canada , 1998. * < / li > * @ throws IllegalArgumentException when the length of the two vectors are * not the same . */ public static double linSimilarity ( int [ ] a , int [ ] b ) { } }
check ( a , b ) ; // The total amount of information contained in a . double aInformation = 0 ; // The total amount of information contained in b . double bInformation = 0 ; // The total amount of information contained in both vectors . double combinedInformation = 0 ; // Compute the information between the two vectors by iterating over // all known values . for ( int i = 0 ; i < a . length ; ++ i ) { aInformation += a [ i ] ; bInformation += b [ i ] ; if ( a [ i ] != 0d && b [ i ] != 0d ) combinedInformation += a [ i ] + b [ i ] ; } return combinedInformation / ( aInformation + bInformation ) ;
public class App { /** * Select the main window . Used for returning to the main content after * selecting a frame . If there are nested frames , the main content will be * selected , not the next frame in the parent child relationship */ public void selectMainWindow ( ) { } }
String action = "Switching to main window" ; String expected = "Main window is selected" ; try { driver . switchTo ( ) . defaultContent ( ) ; } catch ( Exception e ) { reporter . fail ( action , expected , "Main window was not selected. " + e . getMessage ( ) ) ; log . warn ( e ) ; return ; } reporter . pass ( action , expected , expected ) ;
public class CliPrinter { /** * Print a command ( it ' s name , description and parameters ) . * @ param command Command to describe . */ public void printCommand ( CliCommand command ) { } }
final PrintContext context = new PrintContext ( ) ; // Print command name : description printIdentifiable ( context , command ) ; // Print each param name : description printIdentifiables ( context , command . getParams ( ) ) ;
public class WebAppHttpContext { /** * Find the mime type in the mime mappings . If not found delegate to wrapped * http context . * @ see org . osgi . service . http . HttpContext # getMimeType ( String ) */ public String getMimeType ( final String name ) { } }
String mimeType = null ; if ( name != null && name . length ( ) > 0 && name . contains ( "." ) ) { final String [ ] segments = name . split ( "\\." ) ; mimeType = mimeMappings . get ( segments [ segments . length - 1 ] ) ; } if ( mimeType == null ) { mimeType = httpContext . getMimeType ( name ) ; } return mimeType ;
public class FctBnAccEntitiesProcessors { /** * < p > Get PrcInvoiceGfe ( create and put into map ) . < / p > * @ param pAddParam additional param * @ return requested PrcInvoiceGfe * @ throws Exception - an exception */ protected final PrcInvoiceGfe < IInvoice > lazyGetPrcInvoiceGfe ( final Map < String , Object > pAddParam ) throws Exception { } }
@ SuppressWarnings ( "unchecked" ) PrcInvoiceGfe < IInvoice > proc = ( PrcInvoiceGfe < IInvoice > ) this . processorsMap . get ( PrcInvoiceGfe . class . getSimpleName ( ) ) ; if ( proc == null ) { proc = new PrcInvoiceGfe < IInvoice > ( ) ; @ SuppressWarnings ( "unchecked" ) PrcEntityPbEditDelete < RS , IInvoice > procDlg = ( PrcEntityPbEditDelete < RS , IInvoice > ) this . fctBnEntitiesProcessors . lazyGet ( pAddParam , PrcEntityPbEditDelete . class . getSimpleName ( ) ) ; proc . setPrcEntityPbEditDelete ( procDlg ) ; // assigning fully initialized object : this . processorsMap . put ( PrcInvoiceGfe . class . getSimpleName ( ) , proc ) ; } return proc ;
public class RelationalOperationsMatrix { /** * Line / Point , and Point / Point relations */ private void computeMatrixTopoGraphClusters_ ( int geometry_a , int geometry_b ) { } }
boolean bRelationKnown = false ; int id_a = m_topo_graph . getGeometryID ( geometry_a ) ; int id_b = m_topo_graph . getGeometryID ( geometry_b ) ; for ( int cluster = m_topo_graph . getFirstCluster ( ) ; cluster != - 1 ; cluster = m_topo_graph . getNextCluster ( cluster ) ) { // Invoke relational predicates switch ( m_predicates_cluster ) { case Predicates . AreaPointPredicates : bRelationKnown = areaPointPredicates_ ( cluster , id_a , id_b ) ; break ; case Predicates . LinePointPredicates : bRelationKnown = linePointPredicates_ ( cluster , id_a , id_b ) ; break ; case Predicates . PointPointPredicates : bRelationKnown = pointPointPredicates_ ( cluster , id_a , id_b ) ; break ; default : throw GeometryException . GeometryInternalError ( ) ; } if ( bRelationKnown ) break ; } if ( ! bRelationKnown ) setRemainingPredicatesToFalse_ ( ) ;
public class TeamController { /** * REST endpoint for retrieving all features for a given sprint and team * ( the sprint is derived ) * @ return A data response list of type Feature containing all features for * the given team and current sprint */ @ RequestMapping ( value = "/team" , method = GET , produces = APPLICATION_JSON_VALUE ) public List < Team > allTeams ( ) { } }
return Lists . newArrayList ( this . teamService . getAllTeams ( ) ) ;
public class AWSIotClient { /** * Describes a registered CA certificate . * @ param describeCACertificateRequest * The input for the DescribeCACertificate operation . * @ return Result of the DescribeCACertificate operation returned by the service . * @ throws InvalidRequestException * The request is not valid . * @ throws ThrottlingException * The rate exceeds the limit . * @ throws UnauthorizedException * You are not authorized to perform this operation . * @ throws ServiceUnavailableException * The service is temporarily unavailable . * @ throws InternalFailureException * An unexpected error has occurred . * @ throws ResourceNotFoundException * The specified resource does not exist . * @ sample AWSIot . DescribeCACertificate */ @ Override public DescribeCACertificateResult describeCACertificate ( DescribeCACertificateRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDescribeCACertificate ( request ) ;
public class GanttBarStyleFactory14 { /** * { @ inheritDoc } */ @ Override public GanttBarStyle [ ] processDefaultStyles ( Props props ) { } }
GanttBarStyle [ ] barStyles = null ; byte [ ] barStyleData = props . getByteArray ( DEFAULT_PROPERTIES ) ; if ( barStyleData != null && barStyleData . length > 2240 ) { int barStyleCount = MPPUtility . getByte ( barStyleData , 2243 ) ; if ( barStyleCount > 0 && barStyleCount < 65535 ) { barStyles = new GanttBarStyle [ barStyleCount ] ; int styleOffset = 2255 ; for ( int loop = 0 ; loop < barStyleCount ; loop ++ ) { GanttBarStyle style = new GanttBarStyle ( ) ; barStyles [ loop ] = style ; style . setName ( MPPUtility . getUnicodeString ( barStyleData , styleOffset + 91 ) ) ; style . setLeftText ( getTaskField ( MPPUtility . getShort ( barStyleData , styleOffset + 67 ) ) ) ; style . setRightText ( getTaskField ( MPPUtility . getShort ( barStyleData , styleOffset + 71 ) ) ) ; style . setTopText ( getTaskField ( MPPUtility . getShort ( barStyleData , styleOffset + 75 ) ) ) ; style . setBottomText ( getTaskField ( MPPUtility . getShort ( barStyleData , styleOffset + 79 ) ) ) ; style . setInsideText ( getTaskField ( MPPUtility . getShort ( barStyleData , styleOffset + 83 ) ) ) ; style . setStartShape ( GanttBarStartEndShape . getInstance ( barStyleData [ styleOffset + 15 ] % 25 ) ) ; style . setStartType ( GanttBarStartEndType . getInstance ( barStyleData [ styleOffset + 15 ] / 25 ) ) ; style . setStartColor ( MPPUtility . getColor ( barStyleData , styleOffset + 16 ) ) ; style . setMiddleShape ( GanttBarMiddleShape . getInstance ( barStyleData [ styleOffset ] ) ) ; style . setMiddlePattern ( ChartPattern . getInstance ( barStyleData [ styleOffset + 1 ] ) ) ; style . setMiddleColor ( MPPUtility . getColor ( barStyleData , styleOffset + 2 ) ) ; style . setEndShape ( GanttBarStartEndShape . getInstance ( barStyleData [ styleOffset + 28 ] % 25 ) ) ; style . setEndType ( GanttBarStartEndType . getInstance ( barStyleData [ styleOffset + 28 ] / 25 ) ) ; style . setEndColor ( MPPUtility . getColor ( barStyleData , styleOffset + 29 ) ) ; style . setFromField ( getTaskField ( MPPUtility . getShort ( barStyleData , styleOffset + 41 ) ) ) ; style . setToField ( getTaskField ( MPPUtility . getShort ( barStyleData , styleOffset + 45 ) ) ) ; extractFlags ( style , GanttBarShowForTasks . NORMAL , MPPUtility . getLong ( barStyleData , styleOffset + 49 ) ) ; extractFlags ( style , GanttBarShowForTasks . NOT_NORMAL , MPPUtility . getLong ( barStyleData , styleOffset + 57 ) ) ; style . setRow ( ( MPPUtility . getShort ( barStyleData , styleOffset + 65 ) + 1 ) ) ; styleOffset += 195 ; } } } return barStyles ;
public class DoubleStream { /** * Lazy evaluation . * @ param supplier * @ return */ public static DoubleStream of ( final Supplier < DoubleList > supplier ) { } }
final DoubleIterator iter = new DoubleIteratorEx ( ) { private DoubleIterator iterator = null ; @ Override public boolean hasNext ( ) { if ( iterator == null ) { init ( ) ; } return iterator . hasNext ( ) ; } @ Override public double nextDouble ( ) { if ( iterator == null ) { init ( ) ; } return iterator . nextDouble ( ) ; } private void init ( ) { final DoubleList c = supplier . get ( ) ; if ( N . isNullOrEmpty ( c ) ) { iterator = DoubleIterator . empty ( ) ; } else { iterator = c . iterator ( ) ; } } } ; return of ( iter ) ;
public class HttpChannelConfig { /** * Check the input configuration for the timeout to use in between * persistent requests . * @ param props */ private void parsePersistTimeout ( Map < Object , Object > props ) { } }
Object value = props . get ( HttpConfigConstants . PROPNAME_PERSIST_TIMEOUT ) ; if ( null != value ) { try { this . persistTimeout = TIMEOUT_MODIFIER * minLimit ( convertInteger ( value ) , HttpConfigConstants . MIN_TIMEOUT ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Config: Persist timeout is " + getPersistTimeout ( ) ) ; } } catch ( NumberFormatException nfe ) { FFDCFilter . processException ( nfe , getClass ( ) . getName ( ) + ".parsePersistTimeout" , "1" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Config: Invalid persist timeout; " + value ) ; } } }
public class StringGroovyMethods { /** * Returns a ( possibly empty ) list of all occurrences of a regular expression ( in Pattern format ) found within a CharSequence . * For example , if the pattern doesn ' t match , it returns an empty list : * < pre > * assert [ ] = = " foo " . findAll ( ~ / ( \ w * ) Fish / ) * < / pre > * Any regular expression matches are returned in a list , and all regex capture groupings are ignored , only the full match is returned : * < pre > * def expected = [ " One Fish " , " Two Fish " , " Red Fish " , " Blue Fish " ] * assert expected = = " One Fish , Two Fish , Red Fish , Blue Fish " . findAll ( ~ / ( \ w * ) Fish / ) * < / pre > * @ param self a CharSequence * @ param pattern the compiled regex Pattern * @ return a List containing all full matches of the Pattern within the CharSequence , an empty list will be returned if there are no matches * @ see # findAll ( String , java . util . regex . Pattern ) * @ since 1.8.2 */ public static List < String > findAll ( CharSequence self , Pattern pattern ) { } }
Matcher matcher = pattern . matcher ( self . toString ( ) ) ; boolean hasGroup = hasGroup ( matcher ) ; List < String > list = new ArrayList < String > ( ) ; for ( Iterator iter = iterator ( matcher ) ; iter . hasNext ( ) ; ) { if ( hasGroup ) { list . add ( ( String ) ( ( List ) iter . next ( ) ) . get ( 0 ) ) ; } else { list . add ( ( String ) iter . next ( ) ) ; } } return new ArrayList < String > ( list ) ;
public class StorageDir { /** * Removes a temp block from this storage dir . * @ param tempBlockMeta the metadata of the temp block to remove * @ throws BlockDoesNotExistException if no temp block is found */ public void removeTempBlockMeta ( TempBlockMeta tempBlockMeta ) throws BlockDoesNotExistException { } }
Preconditions . checkNotNull ( tempBlockMeta , "tempBlockMeta" ) ; final long blockId = tempBlockMeta . getBlockId ( ) ; final long sessionId = tempBlockMeta . getSessionId ( ) ; TempBlockMeta deletedTempBlockMeta = mBlockIdToTempBlockMap . remove ( blockId ) ; if ( deletedTempBlockMeta == null ) { throw new BlockDoesNotExistException ( ExceptionMessage . BLOCK_META_NOT_FOUND , blockId ) ; } Set < Long > sessionBlocks = mSessionIdToTempBlockIdsMap . get ( sessionId ) ; if ( sessionBlocks == null || ! sessionBlocks . contains ( blockId ) ) { throw new BlockDoesNotExistException ( ExceptionMessage . BLOCK_NOT_FOUND_FOR_SESSION , blockId , mTier . getTierAlias ( ) , sessionId ) ; } Preconditions . checkState ( sessionBlocks . remove ( blockId ) ) ; if ( sessionBlocks . isEmpty ( ) ) { mSessionIdToTempBlockIdsMap . remove ( sessionId ) ; } reclaimSpace ( tempBlockMeta . getBlockSize ( ) , false ) ;
public class Invoker { /** * compare parameter with whished parameter class and convert parameter to whished type * @ param parameter parameter to compare * @ param trgClass whished type of the parameter * @ return converted parameter ( to whished type ) or null */ private static Object compareClasses ( Object parameter , Class trgClass ) { } }
Class srcClass = parameter . getClass ( ) ; trgClass = primitiveToWrapperType ( trgClass ) ; try { if ( parameter instanceof ObjectWrap ) parameter = ( ( ObjectWrap ) parameter ) . getEmbededObject ( ) ; // parameter is already ok if ( srcClass == trgClass ) return parameter ; else if ( instaceOf ( srcClass , trgClass ) ) { return parameter ; } else if ( trgClass . getName ( ) . equals ( "java.lang.String" ) ) { return Caster . toString ( parameter ) ; } else if ( trgClass . getName ( ) . equals ( "java.lang.Boolean" ) ) { return Caster . toBoolean ( parameter ) ; } else if ( trgClass . getName ( ) . equals ( "java.lang.Byte" ) ) { return new Byte ( Caster . toString ( parameter ) ) ; } else if ( trgClass . getName ( ) . equals ( "java.lang.Character" ) ) { String str = Caster . toString ( parameter ) ; if ( str . length ( ) == 1 ) return new Character ( str . toCharArray ( ) [ 0 ] ) ; return null ; } else if ( trgClass . getName ( ) . equals ( "java.lang.Short" ) ) { return Short . valueOf ( ( short ) Caster . toIntValue ( parameter ) ) ; } else if ( trgClass . getName ( ) . equals ( "java.lang.Integer" ) ) { return Integer . valueOf ( Caster . toIntValue ( parameter ) ) ; } else if ( trgClass . getName ( ) . equals ( "java.lang.Long" ) ) { return Long . valueOf ( ( long ) Caster . toDoubleValue ( parameter ) ) ; } else if ( trgClass . getName ( ) . equals ( "java.lang.Float" ) ) { return Float . valueOf ( ( float ) Caster . toDoubleValue ( parameter ) ) ; } else if ( trgClass . getName ( ) . equals ( "java.lang.Double" ) ) { return Caster . toDouble ( parameter ) ; } } catch ( PageException e ) { return null ; } return null ;
public class UsableURI { /** * In the case of a puny encoded IDN , this method returns the decoded Unicode version . * Most of this implementation is copied from { @ link org . apache . commons . httpclient . URI # setURI ( ) } . * @ return decoded IDN version of URI */ public String toUnicodeHostString ( ) { } }
if ( ! _is_hostname ) { return toString ( ) ; } try { StringBuilder buf = new StringBuilder ( ) ; if ( _scheme != null ) { buf . append ( _scheme ) ; buf . append ( ':' ) ; } if ( _is_net_path ) { buf . append ( "//" ) ; if ( _authority != null ) { // has _ authority if ( _userinfo != null ) { buf . append ( _userinfo ) . append ( '@' ) ; } buf . append ( IDNA . toUnicode ( getHost ( ) ) ) ; if ( _port >= 0 ) { buf . append ( ':' ) . append ( _port ) ; } } } if ( _opaque != null && _is_opaque_part ) { buf . append ( _opaque ) ; } else if ( _path != null ) { // _ is _ hier _ part or _ is _ relativeURI if ( _path . length != 0 ) { buf . append ( _path ) ; } } if ( _query != null ) { // has _ query buf . append ( '?' ) ; buf . append ( _query ) ; } return buf . toString ( ) ; } catch ( URIException ex ) { throw new RuntimeException ( ex ) ; }
public class SymmetricDifferenceMatcher { /** * Remove mapping : item to target * @ param item * @ param target */ public void unmap ( I item , T target ) { } }
mapSet . removeItem ( item , target ) ; reverseMap . removeItem ( target , item ) ;
public class BackgroundCache { /** * Gets a cached result for the given key , null if not cached . * Extends the expiration of the cache entry . */ public Result < V , E > get ( K key ) { } }
CacheEntry entry = map . get ( key ) ; if ( entry == null ) { return null ; } else { return entry . getResult ( ) ; }
public class JobManagerRunner { @ Override public void grantLeadership ( final UUID leaderSessionID ) { } }
synchronized ( lock ) { if ( shutdown ) { log . info ( "JobManagerRunner already shutdown." ) ; return ; } leadershipOperation = leadershipOperation . thenCompose ( ( ignored ) -> { synchronized ( lock ) { return verifyJobSchedulingStatusAndStartJobManager ( leaderSessionID ) ; }
public class KieRuntimeFactory { /** * Returns a singleton instance of the given class ( if any ) * @ throws NoSuchElementException if it is not possible to find a service for the given class */ @ SuppressWarnings ( "unchecked" ) public < T > T get ( Class < T > cls ) { } }
T runtimeInstance = ( T ) runtimeServices . computeIfAbsent ( cls , this :: createRuntimeInstance ) ; if ( runtimeInstance == null ) { throw new NoSuchElementException ( cls . getName ( ) ) ; } else { return runtimeInstance ; }
public class MathObservable { /** * Returns an Observable that emits the single numerically minimum item emitted by the source Observable . * If there is more than one such item , it returns the last - emitted one . * < img width = " 640 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / min . png " alt = " " > * @ param source * an Observable to determine the minimum item of * @ return an Observable that emits the minimum item emitted by the source Observable * @ throws IllegalArgumentException * if the source is empty * @ see < a href = " http : / / msdn . microsoft . com / en - us / library / hh229715 . aspx " > MSDN : Observable . Min < / a > */ public final static < T extends Comparable < ? super T > > Observable < T > min ( Observable < T > source ) { } }
return OperatorMinMax . min ( source ) ;
public class AbstractWSingleSelectList { /** * { @ inheritDoc } */ @ Override public Object getRequestValue ( final Request request ) { } }
if ( isPresent ( request ) ) { return getNewSelection ( request ) ; } else { return getValue ( ) ; }
public class SegmentedJournal { /** * Resets journal readers to the given head . * @ param index The index at which to reset readers . */ void resetHead ( long index ) { } }
for ( SegmentedJournalReader reader : readers ) { if ( reader . getNextIndex ( ) < index ) { reader . reset ( index ) ; } }
public class SourceFile { /** * Gets the source line for the indicated line number . * @ param lineNumber the line number , 1 being the first line of the file . * @ return The line indicated . Does not include the newline at the end * of the file . Returns { @ code null } if it does not exist , * or if there was an IO exception . */ public String getLine ( int lineNumber ) { } }
findLineOffsets ( ) ; if ( lineNumber > lineOffsets . length ) { return null ; } if ( lineNumber < 1 ) { lineNumber = 1 ; } int pos = lineOffsets [ lineNumber - 1 ] ; String js = "" ; try { // NOTE ( nicksantos ) : Right now , this is optimized for few warnings . // This is probably the right trade - off , but will be slow if there // are lots of warnings in one file . js = getCode ( ) ; } catch ( IOException e ) { return null ; } if ( js . indexOf ( '\n' , pos ) == - 1 ) { // If next new line cannot be found , there are two cases // 1 . pos already reaches the end of file , then null should be returned // 2 . otherwise , return the contents between pos and the end of file . if ( pos >= js . length ( ) ) { return null ; } else { return js . substring ( pos ) ; } } else { return js . substring ( pos , js . indexOf ( '\n' , pos ) ) ; }
public class DropWizardMetrics { /** * Returns a { @ code Metric } collected from { @ link Counter } . * @ param dropwizardMetric the metric name . * @ param counter the counter object to collect . * @ return a { @ code Metric } . */ private Metric collectCounter ( MetricName dropwizardMetric , Counter counter ) { } }
String metricName = DropWizardUtils . generateFullMetricName ( dropwizardMetric . getKey ( ) , "counter" ) ; String metricDescription = DropWizardUtils . generateFullMetricDescription ( dropwizardMetric . getKey ( ) , counter ) ; AbstractMap . SimpleImmutableEntry < List < LabelKey > , List < LabelValue > > labels = DropWizardUtils . generateLabels ( dropwizardMetric ) ; MetricDescriptor metricDescriptor = MetricDescriptor . create ( metricName , metricDescription , DEFAULT_UNIT , Type . GAUGE_INT64 , labels . getKey ( ) ) ; TimeSeries timeSeries = TimeSeries . createWithOnePoint ( labels . getValue ( ) , Point . create ( Value . longValue ( counter . getCount ( ) ) , clock . now ( ) ) , null ) ; return Metric . createWithOneTimeSeries ( metricDescriptor , timeSeries ) ;
public class WebUtils { /** * Removes any GrailsWebRequest instance from the current request . */ public static void clearGrailsWebRequest ( ) { } }
RequestAttributes reqAttrs = RequestContextHolder . getRequestAttributes ( ) ; if ( reqAttrs != null ) { // First remove the web request from the HTTP request attributes . GrailsWebRequest webRequest = ( GrailsWebRequest ) reqAttrs ; webRequest . getRequest ( ) . removeAttribute ( GrailsApplicationAttributes . WEB_REQUEST ) ; // Now remove it from RequestContextHolder . RequestContextHolder . resetRequestAttributes ( ) ; }
public class MinioClient { /** * Lists object information as { @ code Iterable < Result > < Item > } in given bucket , prefix , recursive flag and S3 API * version to use . * < / p > < b > Example : < / b > < br > * < pre > { @ code Iterable < Result < Item > > myObjects = minioClient . listObjects ( " my - bucketname " , " my - object - prefix " , true , * false ) ; * for ( Result < Item > result : myObjects ) { * Item item = result . get ( ) ; * System . out . println ( item . lastModified ( ) + " , " + item . size ( ) + " , " + item . objectName ( ) ) ; * } } < / pre > * @ param bucketName Bucket name . * @ param prefix Prefix string . List objects whose name starts with ` prefix ` . * @ param recursive when false , emulates a directory structure where each listing returned is either a full object * or part of the object ' s key up to the first ' / ' . All objects wit the same prefix up to the first * ' / ' will be merged into one entry . * @ param useVersion1 If set , Amazon AWS S3 List Object V1 is used , else List Object V2 is used as default . * @ return an iterator of Result Items . * @ see # listObjects ( String bucketName ) * @ see # listObjects ( String bucketName , String prefix ) * @ see # listObjects ( String bucketName , String prefix , boolean recursive ) */ public Iterable < Result < Item > > listObjects ( final String bucketName , final String prefix , final boolean recursive , final boolean useVersion1 ) { } }
if ( useVersion1 ) { return listObjectsV1 ( bucketName , prefix , recursive ) ; } return listObjectsV2 ( bucketName , prefix , recursive ) ;
public class Repository { public References resolve ( Request request ) throws IOException , CyclicDependency { } }
List < Module > includes ; List < Module > excludes ; References references ; List < Module > moduleList ; Node resolved ; boolean minimize ; boolean declarationOnly ; includes = new ArrayList < > ( ) ; excludes = new ArrayList < > ( ) ; for ( String name : Module . SEP . split ( request . modules ) ) { if ( name . length ( ) == 0 ) { throw new IllegalStateException ( ) ; } if ( name . charAt ( 0 ) == Module . NOT ) { excludes . add ( get ( name . substring ( 1 ) ) ) ; } else { includes . add ( get ( name ) ) ; } } moduleList = sequence ( includes ) ; excludes = sequence ( excludes ) ; references = new References ( request . type , request . minimize ) ; for ( Module module : moduleList ) { if ( excludes . contains ( module ) ) { if ( request . type == MimeType . JS ) { continue ; } declarationOnly = true ; } else { declarationOnly = false ; } for ( File file : module . resolve ( request ) ) { resolved = file . get ( request . minimize ) ; minimize = request . minimize && file . getMinimized ( ) == null ; references . add ( minimize , declarationOnly , resolved ) ; } } return references ;
public class MobileCommand { /** * This method forms a { @ link java . util . Map } of parameters for the * long key event invocation . * @ param key code for the long key pressed on the Android device . * @ param metastate metastate for the long key press . * @ return a key - value pair . The key is the command name . The value is a * { @ link java . util . Map } command arguments . */ public static Map . Entry < String , Map < String , ? > > longPressKeyCodeCommand ( int key , Integer metastate ) { } }
String [ ] parameters = new String [ ] { "keycode" , "metastate" } ; Object [ ] values = new Object [ ] { key , metastate } ; return new AbstractMap . SimpleEntry < > ( LONG_PRESS_KEY_CODE , prepareArguments ( parameters , values ) ) ;
public class TSDB { /** * Adds a double precision floating - point value data point in the TSDB . * WARNING : The tags map may be modified by this method without a lock . Give * the method a copy if you plan to use it elsewhere . * @ param metric A non - empty string . * @ param timestamp The timestamp associated with the value . * @ param value The value of the data point . * @ param tags The tags on this series . This map must be non - empty . * @ return A deferred object that indicates the completion of the request . * The { @ link Object } has not special meaning and can be { @ code null } ( think * of it as { @ code Deferred < Void > } ) . But you probably want to attach at * least an errback to this { @ code Deferred } to handle failures . * @ throws IllegalArgumentException if the timestamp is less than or equal * to the previous timestamp added or 0 for the first timestamp , or if the * difference with the previous timestamp is too large . * @ throws IllegalArgumentException if the metric name is empty or contains * illegal characters . * @ throws IllegalArgumentException if the value is NaN or infinite . * @ throws IllegalArgumentException if the tags list is empty or one of the * elements contains illegal characters . * @ throws HBaseException ( deferred ) if there was a problem while persisting * data . * @ since 1.2 */ public Deferred < Object > addPoint ( final String metric , final long timestamp , final double value , final Map < String , String > tags ) { } }
if ( Double . isNaN ( value ) || Double . isInfinite ( value ) ) { throw new IllegalArgumentException ( "value is NaN or Infinite: " + value + " for metric=" + metric + " timestamp=" + timestamp ) ; } final short flags = Const . FLAG_FLOAT | 0x7 ; // A float stored on 8 bytes . return addPointInternal ( metric , timestamp , Bytes . fromLong ( Double . doubleToRawLongBits ( value ) ) , tags , flags ) ;
public class CClassLoader { /** * get the resource with the given name * @ param name * name of the resource to get * @ return the resource with the given name */ private final List getPrivateResource ( final String name ) { } }
try { final Object to = this . resourcesMap . get ( name ) ; final List list = new ArrayList ( ) ; if ( to instanceof URL ) { list . add ( ( URL ) to ) ; return list ; } else if ( to instanceof List ) { final List l = ( List ) to ; for ( int i = 0 ; i < l . size ( ) ; i ++ ) { list . add ( ( URL ) l . get ( i ) ) ; } return list ; } else { return null ; } } finally { try { } catch ( final Exception ignore ) { } }
public class CmsAreaSelectPanel { /** * Setting a new left / top value for the selection . < p > * @ param secondX the cursor X offset to the selection area */ private void positionX ( int secondX ) { } }
if ( secondX < m_firstX ) { setSelectPositionX ( secondX , m_firstX - secondX ) ; } else { setSelectWidth ( secondX - m_firstX ) ; }
public class UpdateUserPoolRequest { /** * The attributes that are automatically verified when the Amazon Cognito service makes a request to update user * pools . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setAutoVerifiedAttributes ( java . util . Collection ) } or * { @ link # withAutoVerifiedAttributes ( java . util . Collection ) } if you want to override the existing values . * @ param autoVerifiedAttributes * The attributes that are automatically verified when the Amazon Cognito service makes a request to update * user pools . * @ return Returns a reference to this object so that method calls can be chained together . * @ see VerifiedAttributeType */ public UpdateUserPoolRequest withAutoVerifiedAttributes ( String ... autoVerifiedAttributes ) { } }
if ( this . autoVerifiedAttributes == null ) { setAutoVerifiedAttributes ( new java . util . ArrayList < String > ( autoVerifiedAttributes . length ) ) ; } for ( String ele : autoVerifiedAttributes ) { this . autoVerifiedAttributes . add ( ele ) ; } return this ;
public class AndroidStubServer { /** * Starts local HTTP server . * @ param configReader reader that provides access to responses configuration , responses and static files * @ param networkType network type to be simulated by adding extra delays . */ public static HttpMockServer start ( ConfigReader configReader , NetworkType networkType ) { } }
return HttpMockServer . startMockApiServer ( configReader , networkType ) ;
public class PaymentChannelClient { /** * < p > Called to indicate the connection has been opened and messages can now be generated for the server . < / p > * < p > Attempts to find a channel to resume and generates a CLIENT _ VERSION message for the server based on the * result . < / p > */ @ Override public void connectionOpen ( ) { } }
lock . lock ( ) ; try { connectionOpen = true ; StoredPaymentChannelClientStates channels = ( StoredPaymentChannelClientStates ) wallet . getExtensions ( ) . get ( StoredPaymentChannelClientStates . EXTENSION_ID ) ; if ( channels != null ) storedChannel = channels . getUsableChannelForServerID ( serverId ) ; step = InitStep . WAITING_FOR_VERSION_NEGOTIATION ; Protos . ClientVersion . Builder versionNegotiationBuilder = Protos . ClientVersion . newBuilder ( ) . setMajor ( versionSelector . getRequestedMajorVersion ( ) ) . setMinor ( versionSelector . getRequestedMinorVersion ( ) ) . setTimeWindowSecs ( timeWindow ) ; if ( storedChannel != null ) { versionNegotiationBuilder . setPreviousChannelContractHash ( ByteString . copyFrom ( storedChannel . contract . getTxId ( ) . getBytes ( ) ) ) ; log . info ( "Begun version handshake, attempting to reopen channel with contract hash {}" , storedChannel . contract . getTxId ( ) ) ; } else log . info ( "Begun version handshake creating new channel" ) ; conn . sendToServer ( Protos . TwoWayChannelMessage . newBuilder ( ) . setType ( Protos . TwoWayChannelMessage . MessageType . CLIENT_VERSION ) . setClientVersion ( versionNegotiationBuilder ) . build ( ) ) ; } finally { lock . unlock ( ) ; }
public class AmazonAppStreamClient { /** * Deletes the specified image builder and releases the capacity . * @ param deleteImageBuilderRequest * @ return Result of the DeleteImageBuilder operation returned by the service . * @ throws ResourceNotFoundException * The specified resource was not found . * @ throws OperationNotPermittedException * The attempted operation is not permitted . * @ throws ConcurrentModificationException * An API error occurred . Wait a few minutes and try again . * @ sample AmazonAppStream . DeleteImageBuilder * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / appstream - 2016-12-01 / DeleteImageBuilder " target = " _ top " > AWS * API Documentation < / a > */ @ Override public DeleteImageBuilderResult deleteImageBuilder ( DeleteImageBuilderRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDeleteImageBuilder ( request ) ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcDuctSilencerType ( ) { } }
if ( ifcDuctSilencerTypeEClass == null ) { ifcDuctSilencerTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 205 ) ; } return ifcDuctSilencerTypeEClass ;
public class SecureCredentialsManager { /** * Saves the given credentials in the Storage . * @ param credentials the credentials to save . * @ throws CredentialsManagerException if the credentials couldn ' t be encrypted . Some devices are not compatible at all with the cryptographic * implementation and will have { @ link CredentialsManagerException # isDeviceIncompatible ( ) } return true . */ public void saveCredentials ( @ NonNull Credentials credentials ) throws CredentialsManagerException { } }
if ( ( isEmpty ( credentials . getAccessToken ( ) ) && isEmpty ( credentials . getIdToken ( ) ) ) || credentials . getExpiresAt ( ) == null ) { throw new CredentialsManagerException ( "Credentials must have a valid date of expiration and a valid access_token or id_token value." ) ; } String json = gson . toJson ( credentials ) ; long expiresAt = credentials . getExpiresAt ( ) . getTime ( ) ; boolean canRefresh = ! isEmpty ( credentials . getRefreshToken ( ) ) ; Log . d ( TAG , "Trying to encrypt the given data using the private key." ) ; try { byte [ ] encrypted = crypto . encrypt ( json . getBytes ( ) ) ; String encryptedEncoded = Base64 . encodeToString ( encrypted , Base64 . DEFAULT ) ; storage . store ( KEY_CREDENTIALS , encryptedEncoded ) ; storage . store ( KEY_EXPIRES_AT , expiresAt ) ; storage . store ( KEY_CAN_REFRESH , canRefresh ) ; } catch ( IncompatibleDeviceException e ) { throw new CredentialsManagerException ( String . format ( "This device is not compatible with the %s class." , SecureCredentialsManager . class . getSimpleName ( ) ) , e ) ; } catch ( CryptoException e ) { /* * If the keys were invalidated in the call above a good new pair is going to be available * to use on the next call . We clear any existing credentials so # hasValidCredentials returns * a true value . Retrying this operation will succeed . */ clearCredentials ( ) ; throw new CredentialsManagerException ( "A change on the Lock Screen security settings have deemed the encryption keys invalid and have been recreated. Please, try saving the credentials again." , e ) ; }
public class MLLibUtil { /** * Convert an rdd of data set in to labeled point * @ param sc the spark context to use * @ param data the dataset to convert * @ return an rdd of labeled point * @ deprecated Use { @ link # fromDataSet ( JavaRDD ) } */ @ Deprecated public static JavaRDD < LabeledPoint > fromDataSet ( JavaSparkContext sc , JavaRDD < DataSet > data ) { } }
return data . map ( new Function < DataSet , LabeledPoint > ( ) { @ Override public LabeledPoint call ( DataSet pt ) { return toLabeledPoint ( pt ) ; } } ) ;
public class ShakeAroundAPI { /** * 设备管理 - 申请设备ID * @ param accessToken accessToken * @ param deviceApplyId deviceApplyId * @ return result */ public static DeviceApplyIdResult deviceApplyId ( String accessToken , DeviceApplyId deviceApplyId ) { } }
return deviceApplyId ( accessToken , JsonUtil . toJSONString ( deviceApplyId ) ) ;
public class TransactionalRuleVisitor { /** * Executes a { @ link TransactionalSupplier } within a transaction . * @ param txSupplier * The { @ link TransactionalSupplier } . * @ param < T > * The return type of the { @ link TransactionalSupplier } . * @ return The value provided by the { @ link TransactionalSupplier } . * @ throws RuleException * If the transaction failed due to an underlying * { @ link XOException } . */ private < T > T doInXOTransaction ( TransactionalSupplier < T > txSupplier ) throws RuleException { } }
try { store . beginTransaction ( ) ; T result = txSupplier . execute ( ) ; store . commitTransaction ( ) ; return result ; } catch ( RuleException e ) { throw e ; } catch ( RuntimeException e ) { throw new RuleException ( "Caught unexpected exception from store." , e ) ; } finally { if ( store . hasActiveTransaction ( ) ) { store . rollbackTransaction ( ) ; } }
public class Workspace { /** * Deserialize a Atom workspace XML element into an object */ protected void parseWorkspaceElement ( final Element element ) throws ProponoException { } }
final Element titleElem = element . getChild ( "title" , AtomService . ATOM_FORMAT ) ; setTitle ( titleElem . getText ( ) ) ; if ( titleElem . getAttribute ( "type" , AtomService . ATOM_FORMAT ) != null ) { setTitleType ( titleElem . getAttribute ( "type" , AtomService . ATOM_FORMAT ) . getValue ( ) ) ; } final List < Element > collections = element . getChildren ( "collection" , AtomService . ATOM_PROTOCOL ) ; for ( final Element e : collections ) { addCollection ( new Collection ( e ) ) ; }
public class ConsonantUtil { /** * * * * * * BEGINNING OF FUNCTION * * * * * */ / * / public static boolean is_Tavargadi ( String str ) { } }
String s1 = VarnaUtil . getAdiVarna ( str ) ; if ( is_Tavarga ( s1 ) ) return true ; return false ;
public class LibLoader { /** * Loads a native library . Uses { @ link LoadPolicy # PREFER _ SHIPPED } as the default loading policy . * @ param clazz * The class whose classloader should be used to resolve shipped libraries * @ param name * The name of the class . */ public void loadLibrary ( Class < ? > clazz , String name ) { } }
loadLibrary ( clazz , name , LoadPolicy . PREFER_SHIPPED ) ;
public class MercatorProjection { /** * Calculates the distance on the ground that is represented by a single pixel on the map . * @ param latitude the latitude coordinate at which the resolution should be calculated . * @ param scaleFactor the scale at which the resolution should be calculated . * @ return the ground resolution at the given latitude and scale . */ public static double calculateGroundResolutionWithScaleFactor ( double latitude , double scaleFactor , int tileSize ) { } }
long mapSize = getMapSizeWithScaleFactor ( scaleFactor , tileSize ) ; return Math . cos ( latitude * ( Math . PI / 180 ) ) * EARTH_CIRCUMFERENCE / mapSize ;
public class NoxItemCatalog { /** * Starts the resource download given a NoxItem instance and a given position . */ private void loadNoxItem ( final int position , NoxItem noxItem , boolean useCircularTransformation ) { } }
imageLoader . load ( noxItem . getUrl ( ) ) . load ( noxItem . getResourceId ( ) ) . withPlaceholder ( noxItem . getPlaceholderId ( ) ) . size ( noxItemSize ) . useCircularTransformation ( useCircularTransformation ) . notify ( getImageLoaderListener ( position ) ) ;
public class WeldStartup { /** * Right now , only session and conversation scoped beans ( except for built - in beans ) are taken into account . * @ return the set of beans the index should be built from */ private Set < Bean < ? > > getBeansForBeanIdentifierIndex ( ) { } }
Set < Bean < ? > > beans = new HashSet < Bean < ? > > ( ) ; for ( BeanDeployment beanDeployment : getBeanDeployments ( ) ) { for ( Bean < ? > bean : beanDeployment . getBeanManager ( ) . getBeans ( ) ) { if ( ! ( bean instanceof AbstractBuiltInBean < ? > ) && ( bean . getScope ( ) . equals ( SessionScoped . class ) || bean . getScope ( ) . equals ( ConversationScoped . class ) ) ) { beans . add ( bean ) ; } } } return beans ;
public class ModelResourceStructure { /** * find history as of timestamp * @ param id model id * @ param asOf Timestamp * @ return history model * @ throws java . lang . Exception any error */ public Response fetchHistoryAsOf ( @ PathParam ( "id" ) URI_ID id , @ PathParam ( "asof" ) final Timestamp asOf ) throws Exception { } }
final MODEL_ID mId = tryConvertId ( id ) ; matchedFetchHistoryAsOf ( mId , asOf ) ; final Query < MODEL > query = server . find ( modelType ) ; defaultFindOrderBy ( query ) ; Object entity = executeTx ( t -> { configDefaultQuery ( query ) ; configFetchHistoryAsOfQuery ( query , mId , asOf ) ; applyUriQuery ( query , false ) ; MODEL model = query . asOf ( asOf ) . setId ( mId ) . findOne ( ) ; return processFetchedHistoryAsOfModel ( mId , model , asOf ) ; } ) ; if ( isEmptyEntity ( entity ) ) { return Response . noContent ( ) . build ( ) ; } return Response . ok ( entity ) . build ( ) ;
public class Gen { /** * Convert string buffer on tos to string . */ void bufferToString ( DiagnosticPosition pos ) { } }
callMethod ( pos , stringBufferType , names . toString , List . < Type > nil ( ) , false ) ;
public class CmsUgcSession { /** * Creates a new resource from upload data . < p > * @ param fieldName the name of the form field for the upload * @ param rawFileName the file name * @ param content the file content * @ return the newly created resource * @ throws CmsUgcException if creating the resource fails */ public CmsResource createUploadResource ( String fieldName , String rawFileName , byte [ ] content ) throws CmsUgcException { } }
CmsResource result = null ; CmsUgcSessionSecurityUtil . checkCreateUpload ( m_cms , m_configuration , rawFileName , content . length ) ; String baseName = rawFileName ; // if the given name is a path , make sure we only get the last segment int lastSlashPos = Math . max ( baseName . lastIndexOf ( '/' ) , baseName . lastIndexOf ( '\\' ) ) ; if ( lastSlashPos != - 1 ) { baseName = baseName . substring ( 1 + lastSlashPos ) ; } // translate it so it doesn ' t contain illegal characters baseName = OpenCms . getResourceManager ( ) . getFileTranslator ( ) . translateResource ( baseName ) ; // add a macro before the file extension ( if there is a file extension , otherwise just append it ) int dotPos = baseName . lastIndexOf ( '.' ) ; if ( dotPos == - 1 ) { baseName = baseName + "_%(random)" ; } else { baseName = baseName . substring ( 0 , dotPos ) + "_%(random)" + baseName . substring ( dotPos ) ; } // now prepend the upload folder ' s path String uploadRootPath = m_configuration . getUploadParentFolder ( ) . get ( ) . getRootPath ( ) ; String sitePath = CmsStringUtil . joinPaths ( m_cms . getRequestContext ( ) . removeSiteRoot ( uploadRootPath ) , baseName ) ; // . . . and replace the macro with random strings until we find a path that isn ' t already used String realSitePath ; do { CmsMacroResolver resolver = new CmsMacroResolver ( ) ; resolver . addMacro ( "random" , RandomStringUtils . random ( 8 , "0123456789abcdefghijklmnopqrstuvwxyz" ) ) ; realSitePath = resolver . resolveMacros ( sitePath ) ; } while ( m_cms . existsResource ( realSitePath ) ) ; try { I_CmsResourceType resType = OpenCms . getResourceManager ( ) . getDefaultTypeForName ( realSitePath ) ; result = m_cms . createResource ( realSitePath , resType , content , null ) ; updateUploadResource ( fieldName , result ) ; return result ; } catch ( CmsException e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; throw new CmsUgcException ( e , CmsUgcConstants . ErrorCode . errMisc , e . getLocalizedMessage ( ) ) ; }
public class GPixelMath { /** * Bounds image pixels to be between these two values . * @ param input Input image . * @ param min minimum value . Inclusive . * @ param max maximum value . Inclusive . */ public static < T extends ImageBase < T > > void boundImage ( T input , double min , double max ) { } }
if ( input instanceof ImageGray ) { if ( GrayU8 . class == input . getClass ( ) ) { PixelMath . boundImage ( ( GrayU8 ) input , ( int ) min , ( int ) max ) ; } else if ( GrayS8 . class == input . getClass ( ) ) { PixelMath . boundImage ( ( GrayS8 ) input , ( int ) min , ( int ) max ) ; } else if ( GrayU16 . class == input . getClass ( ) ) { PixelMath . boundImage ( ( GrayU16 ) input , ( int ) min , ( int ) max ) ; } else if ( GrayS16 . class == input . getClass ( ) ) { PixelMath . boundImage ( ( GrayS16 ) input , ( int ) min , ( int ) max ) ; } else if ( GrayS32 . class == input . getClass ( ) ) { PixelMath . boundImage ( ( GrayS32 ) input , ( int ) min , ( int ) max ) ; } else if ( GrayS64 . class == input . getClass ( ) ) { PixelMath . boundImage ( ( GrayS64 ) input , ( long ) min , ( long ) max ) ; } else if ( GrayF32 . class == input . getClass ( ) ) { PixelMath . boundImage ( ( GrayF32 ) input , ( float ) min , ( float ) max ) ; } else if ( GrayF64 . class == input . getClass ( ) ) { PixelMath . boundImage ( ( GrayF64 ) input , min , max ) ; } else { throw new IllegalArgumentException ( "Unknown image Type: " + input . getClass ( ) . getSimpleName ( ) ) ; } } else if ( input instanceof Planar ) { Planar in = ( Planar ) input ; for ( int i = 0 ; i < in . getNumBands ( ) ; i ++ ) { boundImage ( in . getBand ( i ) , min , max ) ; } }
public class FlashMessagesMethodArgumentResolver { /** * ( non - Javadoc ) * @ see * org . springframework . web . method . support . HandlerMethodArgumentResolver # resolveArgument ( org . springframework . core * . MethodParameter , org . springframework . web . method . support . ModelAndViewContainer , * org . springframework . web . context . request . NativeWebRequest , * org . springframework . web . bind . support . WebDataBinderFactory ) */ @ Override public Object resolveArgument ( // NO _ UCD ( test only ) MethodParameter parameter , ModelAndViewContainer mavContainer , NativeWebRequest webRequest , WebDataBinderFactory binderFactory ) { } }
LOGGER . trace ( "Accesing to the messages publisher from the request: {}" , webRequest ) ; return this . context . publisher ( nativeRequest ( webRequest ) ) ;
public class MoreCollectors { /** * A Collector into an { @ link ImmutableSet } . */ public static < T > Collector < T , Set < T > , Set < T > > toSet ( ) { } }
return Collector . of ( HashSet :: new , Set :: add , ( left , right ) -> { left . addAll ( right ) ; return left ; } , ImmutableSet :: copyOf ) ;
public class QueryHandler { /** * Parses the query raw results from the content stream as long as there is data to be found . */ private void parseQueryRowsRaw ( boolean lastChunk ) { } }
while ( responseContent . isReadable ( ) ) { int splitPos = findSplitPosition ( responseContent , ',' ) ; int arrayEndPos = findSplitPosition ( responseContent , ']' ) ; boolean doSectionDone = false ; if ( splitPos == - 1 && arrayEndPos == - 1 ) { // need more data break ; } else if ( arrayEndPos > 0 && ( arrayEndPos < splitPos || splitPos == - 1 ) ) { splitPos = arrayEndPos ; doSectionDone = true ; } int length = splitPos - responseContent . readerIndex ( ) ; ByteBuf resultSlice = responseContent . readSlice ( length ) ; queryRowObservable . onNext ( resultSlice . copy ( ) ) ; responseContent . skipBytes ( 1 ) ; responseContent . discardReadBytes ( ) ; if ( doSectionDone ) { sectionDone ( ) ; queryParsingState = transitionToNextToken ( lastChunk ) ; break ; } }
public class Json { /** * Converts MPS resources to Json string . * @ param resources nitro resources . * @ param option options class object . * @ return returns a String */ public String resource_to_string ( base_resource resources [ ] , options option , String onerror ) { } }
String objecttype = resources [ 0 ] . get_object_type ( ) ; String request = "{" ; if ( ( option != null && option . get_action ( ) != null ) || ( ! onerror . equals ( "" ) ) ) { request = request + "\"params\":{" ; if ( option != null ) { if ( option . get_action ( ) != null ) { request = request + "\"action\":\"" + option . get_action ( ) + "\"," ; } } if ( ( ! onerror . equals ( "" ) ) ) { request = request + "\"onerror\":\"" + onerror + "\"" ; } request = request + "}," ; } request = request + "\"" + objecttype + "\":[" ; for ( int i = 0 ; i < resources . length ; i ++ ) { String str = this . resource_to_string ( resources [ i ] ) ; request = request + str + "," ; } request = request + "]}" ; return request ;
public class HashSparseVector { /** * v + sv * @ param sv */ public void plus ( ISparseVector sv ) { } }
if ( sv instanceof HashSparseVector ) { TIntFloatIterator it = ( ( HashSparseVector ) sv ) . data . iterator ( ) ; while ( it . hasNext ( ) ) { it . advance ( ) ; data . adjustOrPutValue ( it . key ( ) , it . value ( ) , it . value ( ) ) ; } } else if ( sv instanceof BinarySparseVector ) { TIntIterator it = ( ( BinarySparseVector ) sv ) . data . iterator ( ) ; while ( it . hasNext ( ) ) { int i = it . next ( ) ; data . adjustOrPutValue ( i , DefaultValue , DefaultValue ) ; } }
public class ScanningQueryEngine { /** * Create a node sequence for the given index * @ param originalQuery the original query command ; may not be null * @ param context the context in which the query is to be executed ; may not be null * @ param sourceNode the { @ link Type # SOURCE } plan node for one part of a query ; may not be null * @ param index the { @ link IndexPlan } specification ; may not be null * @ param columns the result column definition ; may not be null * @ param sources the query sources for the repository ; may not be null * @ return the sequence of results ; null only if the type of index is not understood */ protected NodeSequence createNodeSequenceForSource ( QueryCommand originalQuery , QueryContext context , PlanNode sourceNode , IndexPlan index , Columns columns , QuerySources sources ) { } }
if ( index . getProviderName ( ) == null ) { String name = index . getName ( ) ; String pathStr = ( String ) index . getParameters ( ) . get ( IndexPlanners . PATH_PARAMETER ) ; if ( pathStr != null ) { if ( IndexPlanners . NODE_BY_PATH_INDEX_NAME . equals ( name ) ) { PathFactory paths = context . getExecutionContext ( ) . getValueFactories ( ) . getPathFactory ( ) ; Path path = paths . create ( pathStr ) ; return sources . singleNode ( path , 1.0f ) ; } if ( IndexPlanners . CHILDREN_BY_PATH_INDEX_NAME . equals ( name ) ) { PathFactory paths = context . getExecutionContext ( ) . getValueFactories ( ) . getPathFactory ( ) ; Path path = paths . create ( pathStr ) ; return sources . childNodes ( path , 1.0f ) ; } if ( IndexPlanners . DESCENDANTS_BY_PATH_INDEX_NAME . equals ( name ) ) { PathFactory paths = context . getExecutionContext ( ) . getValueFactories ( ) . getPathFactory ( ) ; Path path = paths . create ( pathStr ) ; return sources . descendantNodes ( path , 1.0f ) ; } } String idStr = ( String ) index . getParameters ( ) . get ( IndexPlanners . ID_PARAMETER ) ; if ( idStr != null ) { if ( IndexPlanners . NODE_BY_ID_INDEX_NAME . equals ( name ) ) { StringFactory string = context . getExecutionContext ( ) . getValueFactories ( ) . getStringFactory ( ) ; String id = string . create ( idStr ) ; final String workspaceName = context . getWorkspaceNames ( ) . iterator ( ) . next ( ) ; return sources . singleNode ( workspaceName , id , 1.0f ) ; } } } return null ;
public class AnnotationUtility { /** * Extract string . * @ param elementUtils the element utils * @ param item the item * @ param annotationClass the annotation class * @ param attribute the attribute * @ param listener the listener */ static void extractString ( Elements elementUtils , Element item , Class < ? extends Annotation > annotationClass , AnnotationAttributeType attribute , OnAttributeFoundListener listener ) { } }
extractAttributeValue ( elementUtils , item , annotationClass . getCanonicalName ( ) , attribute , listener ) ;
public class StringUtils { /** * Pad the specified < tt > String < / tt > with spaces on the right - hand side . * @ param s String to add spaces * @ param length Desired length of string after padding * @ return padded string . */ public static String pad ( String s , int length ) { } }
// Trim if longer . . . if ( s . length ( ) > length ) { return s . substring ( 0 , length ) ; } StringBuffer buffer = new StringBuffer ( s ) ; int spaces = length - s . length ( ) ; while ( spaces -- > 0 ) { buffer . append ( ' ' ) ; } return buffer . toString ( ) ;
public class JmxMessage { /** * Adds operation parameter with custom parameter type . * @ param arg * @ param argType * @ return */ public JmxMessage parameter ( Object arg , Class < ? > argType ) { } }
if ( mbeanInvocation == null ) { throw new CitrusRuntimeException ( "Invalid access to operation parameter for JMX message" ) ; } if ( mbeanInvocation . getOperation ( ) == null ) { throw new CitrusRuntimeException ( "Invalid access to operation parameter before operation was set for JMX message" ) ; } if ( mbeanInvocation . getOperation ( ) . getParameter ( ) == null ) { mbeanInvocation . getOperation ( ) . setParameter ( new ManagedBeanInvocation . Parameter ( ) ) ; } OperationParam operationParam = new OperationParam ( ) ; operationParam . setValueObject ( arg ) ; operationParam . setType ( argType . getName ( ) ) ; mbeanInvocation . getOperation ( ) . getParameter ( ) . getParameter ( ) . add ( operationParam ) ; return this ;
public class PTBTokenizer { /** * Constructs a new PTBTokenizer that optionally returns newlines * as their own token . NLs come back as Words whose text is * the value of < code > PTBLexer . NEWLINE _ TOKEN < / code > . * @ param r The Reader to read tokens from * @ param tokenizeNLs Whether to return newlines as separate tokens * ( otherwise they normally disappear as whitespace ) * @ return A PTBTokenizer which returns Word tokens */ public static PTBTokenizer < Word > newPTBTokenizer ( Reader r , boolean tokenizeNLs ) { } }
return new PTBTokenizer < Word > ( r , tokenizeNLs , false , false , new WordTokenFactory ( ) ) ;
public class DescribeClientVpnEndpointsRequest { /** * The ID of the Client VPN endpoint . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setClientVpnEndpointIds ( java . util . Collection ) } or { @ link # withClientVpnEndpointIds ( java . util . Collection ) } * if you want to override the existing values . * @ param clientVpnEndpointIds * The ID of the Client VPN endpoint . * @ return Returns a reference to this object so that method calls can be chained together . */ public DescribeClientVpnEndpointsRequest withClientVpnEndpointIds ( String ... clientVpnEndpointIds ) { } }
if ( this . clientVpnEndpointIds == null ) { setClientVpnEndpointIds ( new com . amazonaws . internal . SdkInternalList < String > ( clientVpnEndpointIds . length ) ) ; } for ( String ele : clientVpnEndpointIds ) { this . clientVpnEndpointIds . add ( ele ) ; } return this ;
public class PartitionLevelWatermarker { /** * Initializes the expected high watermarks for a { @ link Table } * { @ inheritDoc } * @ see org . apache . gobblin . data . management . conversion . hive . watermarker . HiveSourceWatermarker # onTableProcessBegin ( org . apache . hadoop . hive . ql . metadata . Table , long ) */ @ Override public void onTableProcessBegin ( Table table , long tableProcessTime ) { } }
Preconditions . checkNotNull ( table ) ; if ( ! this . expectedHighWatermarks . hasPartitionWatermarks ( tableKey ( table ) ) ) { this . expectedHighWatermarks . setPartitionWatermarks ( tableKey ( table ) , Maps . < String , Long > newHashMap ( ) ) ; }
public class HashIntSet { /** * { @ inheritDoc } */ @ Override public int first ( ) { } }
if ( isEmpty ( ) ) { throw new NoSuchElementException ( ) ; } int min = Integer . MAX_VALUE ; for ( int element : cells ) { if ( element >= 0 && min > element ) { min = element ; } } return min ;
public class Metric { /** * Calculates the squared Euclidean length of a point divided by a scalar . * @ param pointA * point * @ param dA * scalar * @ return the squared Euclidean length */ public static double distanceWithDivisionSquared ( double [ ] pointA , double dA ) { } }
double distance = 0.0 ; for ( int i = 0 ; i < pointA . length ; i ++ ) { double d = pointA [ i ] / dA ; distance += d * d ; } return distance ;
public class XButtonBox { /** * Display this field in html input format . */ public boolean printData ( PrintWriter out , int iPrintOptions ) { } }
String strFieldName = this . getScreenField ( ) . getSFieldParam ( ) ; String strButtonDesc = ( ( SButtonBox ) this . getScreenField ( ) ) . getButtonDesc ( ) ; if ( ( strButtonDesc == null ) && ( ( ( SButtonBox ) this . getScreenField ( ) ) . getImageButtonName ( ) != null ) ) { if ( this . getScreenField ( ) . getParentScreen ( ) instanceof GridScreen ) { // These are command buttons such as " Form " or " Detail " GridScreen gridScreen = ( GridScreen ) this . getScreenField ( ) . getParentScreen ( ) ; Record record = gridScreen . getMainRecord ( ) ; String strBookmark = DBConstants . BLANK ; try { strBookmark = record . getHandle ( DBConstants . OBJECT_ID_HANDLE ) . toString ( ) ; } catch ( DBException ex ) { ex . printStackTrace ( ) ; } if ( this . isSingleDataImage ( ) ) strBookmark = this . getScreenField ( ) . getConverter ( ) . toString ( ) ; out . println ( " " + Utility . startTag ( strFieldName ) + strBookmark + Utility . endTag ( strFieldName ) ) ; return true ; } else return super . printData ( out , iPrintOptions ) ; } else return super . printData ( out , iPrintOptions ) ;
public class EntityPropertyClassNameResolver { /** * エンティティプロパティのクラス名を解決します 。 * @ param entityDesc エンティティ記述 * @ param propertyName エンティティプロパティ名 * @ param defaultPropertyClassName エンティティプロパティのデフォルトのクラス名 * @ return エンティティプロパティのクラス名 */ public String resolve ( EntityDesc entityDesc , String propertyName , String defaultPropertyClassName ) { } }
String qualifiedPropertyName = entityDesc . getQualifiedName ( ) + "@" + propertyName ; for ( Map . Entry < Pattern , String > entry : patternMap . entrySet ( ) ) { Pattern pattern = entry . getKey ( ) ; String input = pattern . pattern ( ) . contains ( "@" ) ? qualifiedPropertyName : propertyName ; Matcher matcher = pattern . matcher ( input ) ; if ( ! matcher . matches ( ) ) { continue ; } matcher . reset ( ) ; StringBuffer buf = new StringBuffer ( ) ; String replacement = entry . getValue ( ) ; for ( ; matcher . find ( ) ; ) { matcher . appendReplacement ( buf , replacement ) ; if ( matcher . hitEnd ( ) ) { break ; } } matcher . appendTail ( buf ) ; return buf . toString ( ) ; } return defaultPropertyClassName ;
public class AWSDatabaseMigrationServiceClient { /** * Deletes a subnet group . * @ param deleteReplicationSubnetGroupRequest * @ return Result of the DeleteReplicationSubnetGroup operation returned by the service . * @ throws InvalidResourceStateException * The resource is in a state that prevents it from being used for database migration . * @ throws ResourceNotFoundException * The resource could not be found . * @ sample AWSDatabaseMigrationService . DeleteReplicationSubnetGroup * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / dms - 2016-01-01 / DeleteReplicationSubnetGroup " * target = " _ top " > AWS API Documentation < / a > */ @ Override public DeleteReplicationSubnetGroupResult deleteReplicationSubnetGroup ( DeleteReplicationSubnetGroupRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDeleteReplicationSubnetGroup ( request ) ;
public class ToTextStream { /** * Normalize the characters , but don ' t escape . Different from * SerializerToXML # writeNormalizedChars because it does not attempt to do * XML escaping at all . * @ param ch The characters from the XML document . * @ param start The start position in the array . * @ param length The number of characters to read from the array . * @ param useLineSep true if the operating systems * end - of - line separator should be output rather than a new - line character . * @ throws IOException * @ throws org . xml . sax . SAXException */ void writeNormalizedChars ( final char ch [ ] , final int start , final int length , final boolean useLineSep ) throws IOException , org . xml . sax . SAXException { } }
final String encoding = getEncoding ( ) ; final java . io . Writer writer = m_writer ; final int end = start + length ; /* copy a few " constants " before the loop for performance */ final char S_LINEFEED = CharInfo . S_LINEFEED ; // This for ( ) loop always increments i by one at the end // of the loop . Additional increments of i adjust for when // two input characters ( a high / low UTF16 surrogate pair ) // are processed . for ( int i = start ; i < end ; i ++ ) { final char c = ch [ i ] ; if ( S_LINEFEED == c && useLineSep ) { writer . write ( m_lineSep , 0 , m_lineSepLen ) ; // one input char processed } else if ( m_encodingInfo . isInEncoding ( c ) ) { writer . write ( c ) ; // one input char processed } else if ( Encodings . isHighUTF16Surrogate ( c ) ) { final int codePoint = writeUTF16Surrogate ( c , ch , i , end ) ; if ( codePoint != 0 ) { // I think we can just emit the message , // not crash and burn . final String integralValue = Integer . toString ( codePoint ) ; final String msg = Utils . messages . createMessage ( MsgKey . ER_ILLEGAL_CHARACTER , new Object [ ] { integralValue , encoding } ) ; // Older behavior was to throw the message , // but newer gentler behavior is to write a message to System . err // throw new SAXException ( msg ) ; System . err . println ( msg ) ; } i ++ ; // two input chars processed } else { // Don ' t know what to do with this char , it is // not in the encoding and not a high char in // a surrogate pair , so write out as an entity ref if ( encoding != null ) { /* The output encoding is known , * so somthing is wrong . */ // not in the encoding , so write out a character reference writer . write ( '&' ) ; writer . write ( '#' ) ; writer . write ( Integer . toString ( c ) ) ; writer . write ( ';' ) ; // I think we can just emit the message , // not crash and burn . final String integralValue = Integer . toString ( c ) ; final String msg = Utils . messages . createMessage ( MsgKey . ER_ILLEGAL_CHARACTER , new Object [ ] { integralValue , encoding } ) ; // Older behavior was to throw the message , // but newer gentler behavior is to write a message to System . err // throw new SAXException ( msg ) ; System . err . println ( msg ) ; } else { /* The output encoding is not known , * so just write it out as - is . */ writer . write ( c ) ; } // one input char was processed } }
public class AbstractConverter { /** * Learn whether a { @ link Convert } operation ' s source value is ( already ) an instance of its target type , * @ param convert * @ return boolean */ protected final boolean isNoop ( Convert < ? , ? > convert ) { } }
Type sourceType = convert . getSourcePosition ( ) . getType ( ) ; if ( ParameterizedType . class . isInstance ( sourceType ) && convert . getSourcePosition ( ) . getValue ( ) != null ) { sourceType = Types . narrowestParameterizedType ( convert . getSourcePosition ( ) . getValue ( ) . getClass ( ) , ( ParameterizedType ) sourceType ) ; } if ( TypeUtils . isAssignable ( sourceType , convert . getTargetPosition ( ) . getType ( ) ) ) { if ( ParameterizedType . class . isInstance ( convert . getTargetPosition ( ) . getType ( ) ) ) { // make sure all type params of target position are accounted for by source before declaring it a noop : final Class < ? > rawTargetType = TypeUtils . getRawType ( convert . getTargetPosition ( ) . getType ( ) , null ) ; final Map < TypeVariable < ? > , Type > typeMappings = TypeUtils . getTypeArguments ( sourceType , rawTargetType ) ; for ( TypeVariable < ? > v : rawTargetType . getTypeParameters ( ) ) { if ( typeMappings . get ( v ) == null ) { return false ; } if ( typeMappings . get ( v ) instanceof TypeVariable < ? > ) { return false ; } } } return true ; } return false ;
public class GsonFactory { /** * Registers type adapters by implicit type . Adds one to read numbers in a { @ code Map < String , * Object > } as Integers . */ static Gson create ( Iterable < TypeAdapter < ? > > adapters ) { } }
GsonBuilder builder = new GsonBuilder ( ) . setPrettyPrinting ( ) ; builder . registerTypeAdapter ( new TypeToken < Map < String , Object > > ( ) { } . getType ( ) , new DoubleToIntMapTypeAdapter ( ) ) ; for ( TypeAdapter < ? > adapter : adapters ) { Type type = resolveLastTypeParameter ( adapter . getClass ( ) , TypeAdapter . class ) ; builder . registerTypeAdapter ( type , adapter ) ; } return builder . create ( ) ;
public class SimpleViewGenerator { /** * Generates views based on annotations found in a persistent class . * Typically @ DocumentReferences annotations . * @ param persistentType * @ return a Map with generated views . */ public Map < String , DesignDocument . View > generateViewsFromPersistentType ( final Class < ? > persistentType ) { } }
Assert . notNull ( persistentType , "persistentType may not be null" ) ; final Map < String , DesignDocument . View > views = new HashMap < String , DesignDocument . View > ( ) ; createDeclaredViews ( views , persistentType ) ; eachField ( persistentType , new Predicate < Field > ( ) { public boolean apply ( Field input ) { if ( hasAnnotation ( input , DocumentReferences . class ) ) { generateView ( views , input ) ; } return false ; } } ) ; return views ;
public class SubscriptionIndex { /** * Get number of non - durable subscriptions . * @ return number of non - durable subscriptions . */ public synchronized int getNonDurableSubscriptions ( ) { } }
if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getNonDurableSubscriptions" ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getNonDurableSubscriptions" , new Integer ( nonDurableSubscriptions ) ) ; return nonDurableSubscriptions ;
public class BpmnParse { /** * Adds the new message job declaration to existing declarations . * There will be executed an existing check before the adding is executed . * @ param messageJobDeclaration the new message job declaration * @ param activity the corresponding activity * @ param exclusive the flag which indicates if the async should be exclusive */ protected void addMessageJobDeclaration ( MessageJobDeclaration messageJobDeclaration , ActivityImpl activity , boolean exclusive ) { } }
ProcessDefinition procDef = ( ProcessDefinition ) activity . getProcessDefinition ( ) ; if ( ! exists ( messageJobDeclaration , procDef . getKey ( ) , activity . getActivityId ( ) ) ) { messageJobDeclaration . setExclusive ( exclusive ) ; messageJobDeclaration . setActivity ( activity ) ; messageJobDeclaration . setJobPriorityProvider ( ( ParameterValueProvider ) activity . getProperty ( PROPERTYNAME_JOB_PRIORITY ) ) ; addMessageJobDeclarationToActivity ( messageJobDeclaration , activity ) ; addJobDeclarationToProcessDefinition ( messageJobDeclaration , procDef ) ; }
public class BytecodeUtils { /** * Returns an { @ link Expression } that evaluates to the given Dir , or null . */ public static Expression constant ( @ Nullable Dir dir ) { } }
return ( dir == null ) ? BytecodeUtils . constantNull ( DIR_TYPE ) : FieldRef . enumReference ( dir ) . accessor ( ) ;
public class PackageIndexWriter { /** * Generate the package index page for the right - hand frame . * @ param configuration the current configuration of the doclet . */ public static void generate ( ConfigurationImpl configuration ) { } }
PackageIndexWriter packgen ; DocPath filename = DocPaths . OVERVIEW_SUMMARY ; try { packgen = new PackageIndexWriter ( configuration , filename ) ; packgen . buildPackageIndexFile ( "doclet.Window_Overview_Summary" , true ) ; packgen . close ( ) ; } catch ( IOException exc ) { configuration . standardmessage . error ( "doclet.exception_encountered" , exc . toString ( ) , filename ) ; throw new DocletAbortException ( exc ) ; }
public class LastaAction { /** * Do redirect the action with the more URL parts and the the parameters on GET . < br > * This method is to other redirect methods so normally you don ' t use directly from your action . * @ param actionType The class type of action that it redirects to . ( NotNull ) * @ param chain The chain of URL to build additional info on URL . ( NotNull ) * @ return The HTML response for redirect containing GET parameters . ( NotNull ) */ protected HtmlResponse doRedirect ( Class < ? > actionType , UrlChain chain ) { } }
assertArgumentNotNull ( "actionType" , actionType ) ; assertArgumentNotNull ( "chain" , chain ) ; return newHtmlResponseAsRedirect ( toActionUrl ( actionType , chain ) ) ;
public class Indentation { /** * Returns an indentation of < code > level < / code > tabs , increasing or decreasing * by one tab at a time . * @ param level The number of tabs for this indentation . * @ return The indentation of < code > level < / code > tabs . */ public static Indentation tabs ( final int level ) { } }
return level < TABS . length ? TABS [ level > 0 ? level : 0 ] : new Indentation ( 1 , '\t' , level ) ;
public class UpdateManager { /** * Remove a repository by id . * @ param id of repository to remove */ public void removeRepository ( String id ) { } }
for ( UpdateRepository repo : getRepositories ( ) ) { if ( id . equals ( repo . getId ( ) ) ) { repositories . remove ( repo ) ; break ; } } log . warn ( "Repository with id " + id + " not found, doing nothing" ) ;
public class ChatLinearLayoutManager { /** * Sets the orientation of the layout . { @ link ChatLinearLayoutManager } * will do its best to keep scroll position . * @ param orientation { @ link # HORIZONTAL } or { @ link # VERTICAL } */ public void setOrientation ( int orientation ) { } }
if ( orientation != HORIZONTAL && orientation != VERTICAL ) { throw new IllegalArgumentException ( "invalid orientation:" + orientation ) ; } assertNotInLayoutOrScroll ( null ) ; if ( orientation == mOrientation ) { return ; } mOrientation = orientation ; mOrientationHelper = null ; requestLayout ( ) ;
public class DateConverter { /** * Converts the string to a date , using the given format for parsing . * @ param pString the string to convert . * @ param pType the type to convert to . { @ code java . util . Date } and * subclasses allowed . * @ param pFormat the format used for parsing . Must be a legal * { @ code SimpleDateFormat } format , or { @ code null } which will use the * default format . * @ return the object created from the given string . May safely be typecast * to { @ code java . util . Date } * @ see Date * @ see java . text . DateFormat * @ throws ConversionException */ public Object toObject ( String pString , Class pType , String pFormat ) throws ConversionException { } }
if ( StringUtil . isEmpty ( pString ) ) return null ; try { DateFormat format ; if ( pFormat == null ) { // Use system default format , using default locale format = DateFormat . getDateTimeInstance ( ) ; } else { // Get format from cache format = getDateFormat ( pFormat ) ; } Date date = StringUtil . toDate ( pString , format ) ; // Allow for conversion to Date subclasses ( ie . java . sql . * ) if ( pType != Date . class ) { try { date = ( Date ) BeanUtil . createInstance ( pType , new Long ( date . getTime ( ) ) ) ; } catch ( ClassCastException e ) { throw new TypeMismathException ( pType ) ; } catch ( InvocationTargetException e ) { throw new ConversionException ( e ) ; } } return date ; } catch ( RuntimeException rte ) { throw new ConversionException ( rte ) ; }
public class SubstructureIdentifier { /** * Get the String form of this identifier . * This provides the canonical form for a StructureIdentifier and has * all the information needed to recreate a particular substructure . * Example : 3iek . A _ 17-28 , A _ 56-294 * @ return The String form of this identifier */ @ Override public String getIdentifier ( ) { } }
if ( ranges . isEmpty ( ) ) return pdbId ; return pdbId + "." + ResidueRange . toString ( ranges ) ;
public class SequenceAlgorithms { /** * Returns the longest common subsequence between the two list of nodes . This version use * type and label to ensure equality . * @ see ITree # hasSameTypeAndLabel ( ITree ) * @ return a list of size 2 int arrays that corresponds * to match of index in sequence 1 to index in sequence 2. */ public static List < int [ ] > longestCommonSubsequenceWithTypeAndLabel ( List < ITree > s0 , List < ITree > s1 ) { } }
int [ ] [ ] lengths = new int [ s0 . size ( ) + 1 ] [ s1 . size ( ) + 1 ] ; for ( int i = 0 ; i < s0 . size ( ) ; i ++ ) for ( int j = 0 ; j < s1 . size ( ) ; j ++ ) if ( s0 . get ( i ) . hasSameTypeAndLabel ( s1 . get ( j ) ) ) lengths [ i + 1 ] [ j + 1 ] = lengths [ i ] [ j ] + 1 ; else lengths [ i + 1 ] [ j + 1 ] = Math . max ( lengths [ i + 1 ] [ j ] , lengths [ i ] [ j + 1 ] ) ; return extractIndexes ( lengths , s0 . size ( ) , s1 . size ( ) ) ;
public class EventloopStats { /** * region updating */ @ Override public void onUpdateBusinessLogicTime ( boolean taskOrKeyPresent , boolean externalTaskPresent , long businessLogicTime ) { } }
loops . recordEvent ( ) ; if ( taskOrKeyPresent ) { this . businessLogicTime . recordValue ( ( int ) businessLogicTime ) ; } else { if ( ! externalTaskPresent ) { idleLoops . recordEvent ( ) ; } else { idleLoopsWaitingExternalTask . recordEvent ( ) ; } } if ( next != null ) { next . onUpdateBusinessLogicTime ( taskOrKeyPresent , externalTaskPresent , businessLogicTime ) ; }
public class br_broker_snmpmanager { /** * < pre > * Performs generic data validation for the operation to be performed * < / pre > */ protected void validate ( String operationType ) throws Exception { } }
super . validate ( operationType ) ; MPSString manager_ip_validator = new MPSString ( ) ; manager_ip_validator . setConstraintIsReq ( MPSConstants . GENERIC_CONSTRAINT , true ) ; manager_ip_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; manager_ip_validator . setConstraintMinStrLen ( MPSConstants . GENERIC_CONSTRAINT , 1 ) ; manager_ip_validator . validate ( operationType , manager_ip , "\"manager_ip\"" ) ; MPSString community_validator = new MPSString ( ) ; community_validator . setConstraintIsReq ( MPSConstants . GENERIC_CONSTRAINT , true ) ; community_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; community_validator . setConstraintMinStrLen ( MPSConstants . GENERIC_CONSTRAINT , 1 ) ; community_validator . validate ( operationType , community , "\"community\"" ) ; MPSString netmask_validator = new MPSString ( ) ; netmask_validator . setConstraintIsReq ( MPSConstants . GENERIC_CONSTRAINT , true ) ; netmask_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 50 ) ; netmask_validator . setConstraintMinStrLen ( MPSConstants . GENERIC_CONSTRAINT , 1 ) ; netmask_validator . validate ( operationType , netmask , "\"netmask\"" ) ; MPSIPAddress br_broker_ip_address_arr_validator = new MPSIPAddress ( ) ; br_broker_ip_address_arr_validator . setConstraintIsReq ( MPSConstants . GENERIC_CONSTRAINT , true ) ; if ( br_broker_ip_address_arr != null ) { for ( int i = 0 ; i < br_broker_ip_address_arr . length ; i ++ ) { br_broker_ip_address_arr_validator . validate ( operationType , br_broker_ip_address_arr [ i ] , "br_broker_ip_address_arr[" + i + "]" ) ; } }
public class SystemPropertiesUtil { /** * Properties 本质上是一个HashTable , 每次读写都会加锁 , 所以不支持频繁的System . getProperty ( name ) 来检查系统内容变化 因此扩展了一个ListenableProperties , * 在其所关心的属性变化时进行通知 . * @ see ListenableProperties */ public static synchronized void registerSystemPropertiesListener ( PropertiesListener listener ) { } }
Properties currentProperties = System . getProperties ( ) ; // 将System的properties实现替换为ListenableProperties if ( ! ( currentProperties instanceof ListenableProperties ) ) { ListenableProperties newProperties = new ListenableProperties ( currentProperties ) ; System . setProperties ( newProperties ) ; currentProperties = newProperties ; } ( ( ListenableProperties ) currentProperties ) . register ( listener ) ;
public class LocalizationPlugin { /** * If you ' d like to manually set the camera position to a specific map region or country , pass in * the locale ( which must have a paired } { @ link MapLocale } ) to work properly * @ param locale a { @ link Locale } which has a complementary { @ link MapLocale } for it * @ param padding camera padding * @ since 0.1.0 */ public void setCameraToLocaleCountry ( Locale locale , int padding ) { } }
MapLocale mapLocale = MapLocale . getMapLocale ( locale , false ) ; if ( mapLocale != null ) { setCameraToLocaleCountry ( mapLocale , padding ) ; } else { Timber . e ( "Couldn't match Locale %s to a MapLocale" , locale . getDisplayName ( ) ) ; }
public class BatchEventProcessor { /** * Notifies the EventHandler immediately prior to this processor shutting down */ private void notifyShutdown ( ) { } }
if ( eventHandler instanceof LifecycleAware ) { try { ( ( LifecycleAware ) eventHandler ) . onShutdown ( ) ; } catch ( final Throwable ex ) { exceptionHandler . handleOnShutdownException ( ex ) ; } }
public class DatePanel { /** * Add month count to month field * @ param i month to add */ private void addMonth ( int i ) { } }
Calendar cal = Calendar . getInstance ( ) ; cal . set ( getDisplayYear ( ) , getDisplayMonth ( ) - 1 , 1 ) ; int month = cal . get ( Calendar . MONTH ) + 1 ; if ( i > 0 && month == 12 ) { addYear ( 1 ) ; } if ( i < 0 && month == 1 ) { addYear ( - 1 ) ; } cal . add ( Calendar . MONTH , i ) ; monthTextField . setText ( String . valueOf ( cal . get ( Calendar . MONTH ) + 1 ) ) ;
public class ConsumerDispatcherState { /** * Remove a topic from the array of topics * @ param topic The topic to remove */ public void removeTopic ( String topic ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "removeTopic" , topic ) ; SelectionCriteria [ ] tmp = selectionCriteriaList ; // Loop through the selectionCriteriaList for ( int i = 0 ; i < selectionCriteriaList . length ; ++ i ) { if ( ( selectionCriteriaList [ i ] . getDiscriminator ( ) == null && topic == null ) || ( topic != null && selectionCriteriaList [ i ] . getDiscriminator ( ) . equals ( topic ) ) ) { // If there was only one criteria and we have removed it then // nullify lists if ( selectionCriteriaList . length == 1 ) { selectionCriteriaList = null ; topics = null ; } else { // The criteria match , so resize the array without this // criteria in it . tmp = new SelectionCriteria [ selectionCriteriaList . length - 1 ] ; System . arraycopy ( selectionCriteriaList , 0 , tmp , 0 , i ) ; System . arraycopy ( selectionCriteriaList , i + 1 , tmp , i , selectionCriteriaList . length - i - 1 ) ; selectionCriteriaList = tmp ; // And copy into the topics array so that they always match this . topics = new String [ selectionCriteriaList . length ] ; for ( int t = 0 ; t < selectionCriteriaList . length ; t ++ ) { topics [ t ] = ( selectionCriteriaList [ t ] == null ) ? null : selectionCriteriaList [ t ] . getDiscriminator ( ) ; } } break ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "removeTopic" ) ;
public class AbstractLRParser { /** * This method does the actual parsing . * @ return The result AST is returned . * @ throws ParserException */ private final ParseTreeNode parse ( ) throws ParserException { } }
try { createActionStack ( ) ; return LRTokenStreamConverter . convert ( getTokenStream ( ) , getGrammar ( ) , actionStack ) ; } catch ( GrammarException e ) { logger . error ( e . getMessage ( ) , e ) ; throw new ParserException ( e . getMessage ( ) ) ; }
public class Curve25519 { /** * / * Copy a number */ private static final void cpy ( long10 out , long10 in ) { } }
out . _0 = in . _0 ; out . _1 = in . _1 ; out . _2 = in . _2 ; out . _3 = in . _3 ; out . _4 = in . _4 ; out . _5 = in . _5 ; out . _6 = in . _6 ; out . _7 = in . _7 ; out . _8 = in . _8 ; out . _9 = in . _9 ;
public class HtmlTree { /** * Generates a SECTION tag with role attribute and some content . * @ param body content of the section tag * @ return an HtmlTree object for the SECTION tag */ public static HtmlTree SECTION ( Content body ) { } }
HtmlTree htmltree = new HtmlTree ( HtmlTag . SECTION , nullCheck ( body ) ) ; htmltree . setRole ( Role . REGION ) ; return htmltree ;
public class HiveConverterUtils { /** * Fills data from input table into output table . * @ param inputTblName input hive table name * @ param outputTblName output hive table name * @ param inputDbName input hive database name * @ param outputDbName output hive database name * @ param optionalPartitionDMLInfo input hive table ' s partition ' s name and value * @ return Hive query string */ public static String generateTableCopy ( String inputTblName , String outputTblName , String inputDbName , String outputDbName , Optional < Map < String , String > > optionalPartitionDMLInfo ) { } }
Preconditions . checkArgument ( StringUtils . isNotBlank ( inputTblName ) ) ; Preconditions . checkArgument ( StringUtils . isNotBlank ( outputTblName ) ) ; Preconditions . checkArgument ( StringUtils . isNotBlank ( inputDbName ) ) ; Preconditions . checkArgument ( StringUtils . isNotBlank ( outputDbName ) ) ; StringBuilder dmlQuery = new StringBuilder ( ) ; // Insert query dmlQuery . append ( String . format ( "INSERT OVERWRITE TABLE `%s`.`%s` %n" , outputDbName , outputTblName ) ) ; if ( optionalPartitionDMLInfo . isPresent ( ) && optionalPartitionDMLInfo . get ( ) . size ( ) > 0 ) { // Partition details dmlQuery . append ( partitionKeyValues ( optionalPartitionDMLInfo ) ) ; } dmlQuery . append ( String . format ( "SELECT * FROM `%s`.`%s`" , inputDbName , inputTblName ) ) ; if ( optionalPartitionDMLInfo . isPresent ( ) ) { if ( optionalPartitionDMLInfo . get ( ) . size ( ) > 0 ) { dmlQuery . append ( " WHERE " ) ; String partitionsAndValues = optionalPartitionDMLInfo . get ( ) . entrySet ( ) . stream ( ) . map ( e -> "`" + e . getKey ( ) + "`='" + e . getValue ( ) + "'" ) . collect ( joining ( " AND " ) ) ; dmlQuery . append ( partitionsAndValues ) ; } } return dmlQuery . toString ( ) ;
public class ClassDescriptor { /** * Returns array of read / write FieldDescriptors . */ public FieldDescriptor [ ] getAllRwFields ( ) { } }
if ( m_RwFieldDescriptors == null ) { FieldDescriptor [ ] fields = getFieldDescriptions ( ) ; Collection rwFields = new ArrayList ( ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { FieldDescriptor fd = fields [ i ] ; /* arminw : if locking is enabled and the increment of locking values is done by the database , the field is read - only */ if ( fd . isAccessReadOnly ( ) || ( fd . isLocking ( ) && ! fd . isUpdateLock ( ) ) ) { continue ; } rwFields . add ( fd ) ; } m_RwFieldDescriptors = ( FieldDescriptor [ ] ) rwFields . toArray ( new FieldDescriptor [ rwFields . size ( ) ] ) ; } return m_RwFieldDescriptors ;
public class ColorSpecificationImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . COLOR_SPECIFICATION__COL_SPCE : return COL_SPCE_EDEFAULT == null ? colSpce != null : ! COL_SPCE_EDEFAULT . equals ( colSpce ) ; case AfplibPackage . COLOR_SPECIFICATION__COL_SIZE1 : return COL_SIZE1_EDEFAULT == null ? colSize1 != null : ! COL_SIZE1_EDEFAULT . equals ( colSize1 ) ; case AfplibPackage . COLOR_SPECIFICATION__COL_SIZE2 : return COL_SIZE2_EDEFAULT == null ? colSize2 != null : ! COL_SIZE2_EDEFAULT . equals ( colSize2 ) ; case AfplibPackage . COLOR_SPECIFICATION__COL_SIZE3 : return COL_SIZE3_EDEFAULT == null ? colSize3 != null : ! COL_SIZE3_EDEFAULT . equals ( colSize3 ) ; case AfplibPackage . COLOR_SPECIFICATION__COL_SIZE4 : return COL_SIZE4_EDEFAULT == null ? colSize4 != null : ! COL_SIZE4_EDEFAULT . equals ( colSize4 ) ; case AfplibPackage . COLOR_SPECIFICATION__COLOR : return COLOR_EDEFAULT == null ? color != null : ! COLOR_EDEFAULT . equals ( color ) ; } return super . eIsSet ( featureID ) ;
public class Inspector { /** * Get info about usual Java instance and class Methods as well as Constructors . * @ return Array of StringArrays that can be indexed with the MEMBER _ xxx _ IDX constants */ public Object [ ] getMethods ( ) { } }
Method [ ] methods = getClassUnderInspection ( ) . getMethods ( ) ; Constructor [ ] ctors = getClassUnderInspection ( ) . getConstructors ( ) ; Object [ ] result = new Object [ methods . length + ctors . length ] ; int resultIndex = 0 ; for ( ; resultIndex < methods . length ; resultIndex ++ ) { Method method = methods [ resultIndex ] ; result [ resultIndex ] = methodInfo ( method ) ; } for ( int i = 0 ; i < ctors . length ; i ++ , resultIndex ++ ) { Constructor ctor = ctors [ i ] ; result [ resultIndex ] = methodInfo ( ctor ) ; } return result ;
public class NineRectangleGridImageView { /** * 设置图片数据 * @ param data 图片数据集合 */ public void setImagesData ( List data ) { } }
if ( data == null || data . isEmpty ( ) ) { this . setVisibility ( GONE ) ; return ; } else { this . setVisibility ( VISIBLE ) ; } if ( mMaxSize > 0 && data . size ( ) > mMaxSize ) { data = data . subList ( 0 , mMaxSize ) ; } int [ ] gridParam = calculateGridParam ( data . size ( ) ) ; mRowCount = gridParam [ 0 ] ; mColumnCount = gridParam [ 1 ] ; if ( mImgDataList == null ) { int i = 0 ; while ( i < data . size ( ) ) { ImageView iv = getImageView ( i ) ; if ( iv == null ) return ; addView ( iv , generateDefaultLayoutParams ( ) ) ; i ++ ; } } else { int oldViewCount = mImgDataList . size ( ) ; int newViewCount = data . size ( ) ; if ( oldViewCount > newViewCount ) { removeViews ( newViewCount , oldViewCount - newViewCount ) ; } else if ( oldViewCount < newViewCount ) { for ( int i = oldViewCount ; i < newViewCount ; i ++ ) { ImageView iv = getImageView ( i ) ; if ( iv == null ) { return ; } addView ( iv , generateDefaultLayoutParams ( ) ) ; } } } mImgDataList = data ; requestLayout ( ) ;
public class JAXRSClientConfigImpl { /** * find the uri parameter which we will key off of * @ param props * @ return value of uri param within props , or null if no uri param */ private String getURI ( Map < String , Object > props ) { } }
if ( props == null ) return null ; if ( props . keySet ( ) . contains ( URI ) ) { return ( props . get ( URI ) . toString ( ) ) ; } else { return null ; }
public class AuthManager { /** * Login using user authentication token * @ param authToken authentication user for user . * @ return Logged in user . */ public Observable < BackendUser > getUserFromAuthToken ( final String authToken ) { } }
return Observable . create ( new Observable . OnSubscribe < BackendUser > ( ) { @ Override public void call ( Subscriber < ? super BackendUser > subscriber ) { try { setLoginState ( LOGGING_IN ) ; logger . debug ( "getWebService(): " + getWebService ( ) ) ; logger . debug ( "getuserFromAuthToken: " + authToken ) ; ValidCredentials validCredentials = getWebService ( ) . getUserFromAuthToken ( authToken ) . toBlocking ( ) . first ( ) ; if ( validCredentials == null ) throw new Exception ( "Null User Returned" ) ; subscriber . onNext ( setUser ( validCredentials ) ) ; } catch ( Exception e ) { setLoginState ( LOGGED_OUT ) ; subscriber . onError ( e ) ; } } } ) ;