signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class SetOperationBuilder { /** * Sets the Nominal Entries for this set operation . The minimum value is 16 and the maximum value * is 67,108,864 , which is 2 ^ 26 . Be aware that Unions as large as this maximum value have not * been thoroughly tested or characterized for performance . * @ param nomEntries < a href = " { @ docRoot } / resources / dictionary . html # nomEntries " > Nominal Entres < / a > * This will become the ceiling power of 2 if it is not . * @ return this SetOperationBuilder */ public SetOperationBuilder setNominalEntries ( final int nomEntries ) { } }
bLgNomLongs = Integer . numberOfTrailingZeros ( ceilingPowerOf2 ( nomEntries ) ) ; if ( ( bLgNomLongs > MAX_LG_NOM_LONGS ) || ( bLgNomLongs < MIN_LG_NOM_LONGS ) ) { throw new SketchesArgumentException ( "Nominal Entries must be >= 16 and <= 67108864: " + nomEntries ) ; } return this ;
public class SibRaCommonEndpointActivation { /** * The messaging engine is stopping , drop the connection and , if necessary , * try to create a new connection */ @ Override void messagingEngineQuiescing ( SibRaMessagingEngineConnection connection ) { } }
final String methodName = "messagingEngineQuiescing" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , connection ) ; } SibTr . info ( TRACE , "ME_QUIESCING_CWSIV0785" , new Object [ ] { connection . getConnection ( ) . getMeName ( ) , _endpointConfiguration . getBusName ( ) } ) ; // Change the last parameters to true to stop the connection trying to stop the // consumer . This is because the event is now processed async and the connection may get // closed before our thread tries to stop the consumer session . dropConnection ( connection , false , true , true ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; }
public class AnnoConstruct { /** * This method is part of the javax . lang . model API , do not use this in javac code . */ @ DefinedBy ( Api . LANGUAGE_MODEL ) public < A extends Annotation > A [ ] getAnnotationsByType ( Class < A > annoType ) { } }
if ( ! annoType . isAnnotation ( ) ) throw new IllegalArgumentException ( "Not an annotation type: " + annoType ) ; // If annoType does not declare a container this is equivalent to wrapping // getAnnotation ( . . . ) in an array . Class < ? extends Annotation > containerType = getContainer ( annoType ) ; if ( containerType == null ) { A res = getAnnotation ( annoType ) ; int size = res == null ? 0 : 1 ; @ SuppressWarnings ( "unchecked" ) // annoType is the Class for A A [ ] arr = ( A [ ] ) java . lang . reflect . Array . newInstance ( annoType , size ) ; if ( res != null ) arr [ 0 ] = res ; return arr ; } // So we have a containing type String annoTypeName = annoType . getName ( ) ; String containerTypeName = containerType . getName ( ) ; int directIndex = - 1 , containerIndex = - 1 ; Attribute . Compound direct = null , container = null ; // Find directly ( explicit or implicit ) present annotations int index = - 1 ; for ( Attribute . Compound attribute : getAnnotationMirrors ( ) ) { index ++ ; if ( attribute . type . tsym . flatName ( ) . contentEquals ( annoTypeName ) ) { directIndex = index ; direct = attribute ; } else if ( containerTypeName != null && attribute . type . tsym . flatName ( ) . contentEquals ( containerTypeName ) ) { containerIndex = index ; container = attribute ; } } // Deal with inherited annotations if ( direct == null && container == null && annoType . isAnnotationPresent ( Inherited . class ) ) return getInheritedAnnotations ( annoType ) ; Attribute . Compound [ ] contained = unpackContained ( container ) ; // In case of an empty legacy container we might need to look for // inherited annos as well if ( direct == null && contained . length == 0 && annoType . isAnnotationPresent ( Inherited . class ) ) return getInheritedAnnotations ( annoType ) ; int size = ( direct == null ? 0 : 1 ) + contained . length ; @ SuppressWarnings ( "unchecked" ) // annoType is the Class for A A [ ] arr = ( A [ ] ) java . lang . reflect . Array . newInstance ( annoType , size ) ; // if direct & & container , which is first ? int insert = - 1 ; int length = arr . length ; if ( directIndex >= 0 && containerIndex >= 0 ) { if ( directIndex < containerIndex ) { arr [ 0 ] = AnnotationProxyMaker . generateAnnotation ( direct , annoType ) ; insert = 1 ; } else { arr [ arr . length - 1 ] = AnnotationProxyMaker . generateAnnotation ( direct , annoType ) ; insert = 0 ; length -- ; } } else if ( directIndex >= 0 ) { arr [ 0 ] = AnnotationProxyMaker . generateAnnotation ( direct , annoType ) ; return arr ; } else { // Only container insert = 0 ; } for ( int i = 0 ; i + insert < length ; i ++ ) arr [ insert + i ] = AnnotationProxyMaker . generateAnnotation ( contained [ i ] , annoType ) ; return arr ;
public class WebservicesMetaData { /** * Serialize as a String */ public String serialize ( ) { } }
// Construct the webservices . xml definitions StringBuilder buffer = new StringBuilder ( ) ; // header : opening webservices tag createHeader ( buffer ) ; // webservice - description subelements for ( WebserviceDescriptionMetaData wm : webserviceDescriptions ) buffer . append ( wm . serialize ( ) ) ; // closing webservices tag buffer . append ( "</webservices>" ) ; return buffer . toString ( ) ;
public class GrafeasV1Beta1Client { /** * Gets the specified note . * < p > Sample code : * < pre > < code > * try ( GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client . create ( ) ) { * NoteName name = NoteName . of ( " [ PROJECT ] " , " [ NOTE ] " ) ; * Note response = grafeasV1Beta1Client . getNote ( name . toString ( ) ) ; * < / code > < / pre > * @ param name The name of the note in the form of ` projects / [ PROVIDER _ ID ] / notes / [ NOTE _ ID ] ` . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ public final Note getNote ( String name ) { } }
GetNoteRequest request = GetNoteRequest . newBuilder ( ) . setName ( name ) . build ( ) ; return getNote ( request ) ;
public class KafkaMsgConsumer { /** * Initializing method . */ public void init ( ) { } }
if ( executorService == null ) { int numThreads = Math . min ( Math . max ( Runtime . getRuntime ( ) . availableProcessors ( ) , 1 ) , 4 ) ; executorService = Executors . newFixedThreadPool ( numThreads ) ; myOwnExecutorService = true ; } else { myOwnExecutorService = false ; }
public class SelectedValuesChoiceRenderer { /** * { @ inheritDoc } */ @ Override public Object getDisplayValue ( final String object ) { } }
final String splitString = "=>" ; final String [ ] splittedValue = object . split ( splitString ) ; final StringBuilder sb = new StringBuilder ( ) ; if ( splittedValue . length == 1 ) { final IModel < String > resourceModel = ResourceModelFactory . newResourceModel ( ResourceBundleKey . builder ( ) . key ( splittedValue [ 0 ] ) . defaultValue ( "" ) . build ( ) , component ) ; sb . append ( resourceModel . getObject ( ) ) ; } else { IModel < String > resourceModel = ResourceModelFactory . newResourceModel ( ResourceBundleKey . builder ( ) . key ( splittedValue [ 0 ] ) . defaultValue ( "" ) . build ( ) , component ) ; sb . append ( resourceModel . getObject ( ) ) ; sb . append ( splitString ) ; resourceModel = ResourceModelFactory . newResourceModel ( ResourceBundleKey . builder ( ) . key ( splittedValue [ 1 ] ) . defaultValue ( "" ) . build ( ) , component ) ; sb . append ( resourceModel . getObject ( ) ) ; } return sb . toString ( ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < byte [ ] > } */ @ XmlElementDecl ( namespace = "http://www.ibm.com/websphere/wim" , name = "certificate" ) public JAXBElement < byte [ ] > createCertificate ( byte [ ] value ) { } }
return new JAXBElement < byte [ ] > ( _Certificate_QNAME , byte [ ] . class , null , ( value ) ) ;
public class AddDynamicSearchAdsCampaign { /** * Creates the budget . */ private static Budget createBudget ( AdWordsServicesInterface adWordsServices , AdWordsSession session ) throws RemoteException , ApiException { } }
// Get the BudgetService . BudgetServiceInterface budgetService = adWordsServices . get ( session , BudgetServiceInterface . class ) ; // Create a budget , which can be shared by multiple campaigns . Budget sharedBudget = new Budget ( ) ; sharedBudget . setName ( "Interplanetary Cruise #" + System . currentTimeMillis ( ) ) ; Money budgetAmount = new Money ( ) ; budgetAmount . setMicroAmount ( 50000000L ) ; sharedBudget . setAmount ( budgetAmount ) ; sharedBudget . setDeliveryMethod ( BudgetBudgetDeliveryMethod . STANDARD ) ; BudgetOperation budgetOperation = new BudgetOperation ( ) ; budgetOperation . setOperand ( sharedBudget ) ; budgetOperation . setOperator ( Operator . ADD ) ; // Add the budget Budget budget = budgetService . mutate ( new BudgetOperation [ ] { budgetOperation } ) . getValue ( 0 ) ; return budget ;
public class SparseMatrixT { /** * long型索引转换为int [ ] 索引 * @ param idx * @ return 索引 */ public int [ ] getIndices ( long idx ) { } }
int xIndices = ( int ) idx % this . size ( ) [ 0 ] ; int yIndices = ( int ) ( idx - xIndices ) / this . size ( ) [ 0 ] ; int [ ] Indices = { xIndices , yIndices } ; return Indices ;
public class AsteriskQueueImpl { /** * Add a new member to this queue . * @ param member to add */ void addMember ( AsteriskQueueMemberImpl member ) { } }
synchronized ( members ) { // Check if member already exists if ( members . containsValue ( member ) ) { return ; } // If not , add the new member . logger . info ( "Adding new member to the queue " + getName ( ) + ": " + member . toString ( ) ) ; members . put ( member . getLocation ( ) , member ) ; } fireMemberAdded ( member ) ;
public class ExpressionDecomposer { /** * Determines if there is any subexpression below { @ code tree } that would make it incorrect for * some expression that follows { @ code tree } , { @ code E } , to be executed before { @ code tree } . * @ param followingSideEffectsExist whether { @ code E } causes side - effects . * @ return { @ code true } if { @ code tree } contains any subexpressions that would make movement * incorrect . */ private boolean isExpressionTreeUnsafe ( Node tree , boolean followingSideEffectsExist ) { } }
if ( tree . isSpread ( ) ) { // Spread expressions would cause recursive rewriting if not special cased here . switch ( tree . getParent ( ) . getToken ( ) ) { case OBJECTLIT : // Spreading an object , rather than an iterable , is assumed to be pure . That assesment is // based on the compiler assumption that getters are pure . This check say nothing of the // expression being spread . break ; case ARRAYLIT : case CALL : case NEW : // When extracted , spreads can ' t be assigned to a single variable and instead are put into // an array - literal . However , that literal must be spread again at the original site . This // check is what prevents the original spread from triggering recursion . if ( isTempConstantValueName ( tree . getOnlyChild ( ) ) ) { return false ; } break ; default : throw new IllegalStateException ( "Unexpected parent of SPREAD: " + tree . getParent ( ) . toStringTree ( ) ) ; } } if ( followingSideEffectsExist ) { // If the call to be inlined has side - effects , check to see if this // expression tree can be affected by any side - effects . // Assume that " tmp1 . call ( . . . ) " is safe ( where tmp1 is a const temp variable created by // ExpressionDecomposer ) otherwise we end up trying to decompose the same tree // an infinite number of times . Node parent = tree . getParent ( ) ; if ( NodeUtil . isObjectCallMethod ( parent , "call" ) && tree . isFirstChildOf ( parent ) && isTempConstantValueName ( tree . getFirstChild ( ) ) ) { return false ; } // This is a superset of " NodeUtil . mayHaveSideEffects " . return NodeUtil . canBeSideEffected ( tree , this . knownConstants , scope ) ; } else { // The function called doesn ' t have side - effects but check to see if there // are side - effects that that may affect it . return NodeUtil . mayHaveSideEffects ( tree , compiler ) ; }
public class PrioritizedSplitRunner { /** * Updates the ( potentially stale ) priority value cached in this object . * This should be called when this object is outside the queue . * @ return true if the level changed . */ public boolean updateLevelPriority ( ) { } }
Priority newPriority = taskHandle . getPriority ( ) ; Priority oldPriority = priority . getAndSet ( newPriority ) ; return newPriority . getLevel ( ) != oldPriority . getLevel ( ) ;
public class ResourceInstanceHelper { /** * Returns the number of active instances of the given template name * @ param service * @ param templateName * @ return */ public List < ResourceInstanceDTO > activeInstances ( ServiceManagerResourceRestService service , String templateName ) { } }
WebQuery wq = new WebQuery ( ) ; wq . eq ( "template.id" , templateName ) ; wq . eq ( "state" , ResourceInstanceState . TO_PROVISION , ResourceInstanceState . PROVISIONING , ResourceInstanceState . NOT_IN_SERVICE , ResourceInstanceState . IN_SERVICE ) ; List < ResourceInstanceDTO > instances = service . searchInstances ( wq ) ; return instances ;
public class Version { /** * Compares two Versions with additionally considering the build meta data field if * all other parts are equal . Note : This is < em > not < / em > part of the semantic version * specification . * Comparison of the build meta data parts happens exactly as for pre release * identifiers . Considering of build meta data first kicks in if both versions are * equal when using their natural order . * This method fulfills the general contract for Java ' s { @ link Comparator Comparators } * and { @ link Comparable Comparables } . * @ param v1 The first version for comparison . * @ param v2 The second version for comparison . * @ return A value below 0 iff { @ code v1 & lt ; v2 } , a value above 0 iff * { @ code v1 & gt ; v2 < / tt > and 0 iff < tt > v1 = v2 } . * @ throws NullPointerException If either parameter is null . * @ since 0.3.0 */ public static int compareWithBuildMetaData ( Version v1 , Version v2 ) { } }
// throw NPE to comply with Comparable specification if ( v1 == null ) { throw new NullPointerException ( "v1 is null" ) ; } else if ( v2 == null ) { throw new NullPointerException ( "v2 is null" ) ; } return compare ( v1 , v2 , true ) ;
public class SchemaHelper { /** * Builds a JCodeModel for classes that will be used as Request or Response * bodies * @ param basePackage * The package we will be using for the domain objects * @ param schemaLocation * The location of this schema , will be used to create absolute * URIs for $ ref tags eg " classpath : / " * @ param name * The class name * @ param schema * The JSON Schema representing this class * @ param annotator * JsonSchema2Pojo annotator . if null a default annotator will be * used * @ return built JCodeModel */ public static JCodeModel buildBodyJCodeModel ( String basePackage , String schemaLocation , String name , String schema , Annotator annotator ) { } }
JCodeModel codeModel = new JCodeModel ( ) ; SchemaStore schemaStore = new SchemaStore ( ) ; GenerationConfig config = Config . getPojoConfig ( ) ; if ( config == null ) { config = getDefaultGenerationConfig ( ) ; } if ( annotator == null ) { annotator = new Jackson2Annotator ( config ) ; } RuleFactory ruleFactory = new RuleFactory ( config , annotator , schemaStore ) ; SchemaMapper mapper = new SchemaMapper ( ruleFactory , new SchemaGenerator ( ) ) ; boolean useParent = StringUtils . hasText ( schemaLocation ) ; try { if ( useParent ) { mapper . generate ( codeModel , name , basePackage , schema , new URI ( schemaLocation ) ) ; } else { mapper . generate ( codeModel , name , basePackage , schema ) ; } } catch ( Exception e ) { // TODO make this smarter by checking refs if ( useParent && e . getMessage ( ) . contains ( "classpath" ) ) { logger . debug ( "Referenced Schema contains self $refs or not found in classpath. Regenerating model withouth classpath: for " + name ) ; codeModel = new JCodeModel ( ) ; try { mapper . generate ( codeModel , name , basePackage , schema ) ; return codeModel ; } catch ( IOException e1 ) { // do nothing } } logger . error ( "Error generating pojo from schema" + name , e ) ; return null ; } return codeModel ;
public class DefaultVOMSProxyInfoBehaviour { /** * Proxy basic options */ private void checkProxyBasicOptions ( ProxyInfoParams params , List < VOMSAttribute > listVOMSAttributes , File proxyFilePath , X509Certificate [ ] proxyChain ) { } }
if ( params . containsOption ( PrintOption . TYPE ) && ! params . containsOption ( PrintOption . ALL_OPTIONS ) ) { logger . printMessage ( proxyTypeAsString ( proxyChain [ 0 ] ) ) ; } if ( params . containsOption ( PrintOption . SUBJECT ) && ! params . containsOption ( PrintOption . ALL_OPTIONS ) ) { logger . printMessage ( OpensslNameUtilities . getOpensslSubjectString ( proxyChain [ 0 ] . getSubjectX500Principal ( ) ) ) ; } if ( params . containsOption ( PrintOption . ISSUER ) || params . containsOption ( PrintOption . IDENTITY ) && ! params . containsOption ( PrintOption . ALL_OPTIONS ) ) { logger . printMessage ( OpensslNameUtilities . getOpensslSubjectString ( proxyChain [ 0 ] . getIssuerX500Principal ( ) ) ) ; } if ( params . containsOption ( PrintOption . PROXY_PATH ) && ! params . containsOption ( PrintOption . ALL_OPTIONS ) ) { logger . printMessage ( proxyFilePath . getAbsolutePath ( ) ) ; } if ( params . containsOption ( PrintOption . CHAIN ) ) { printProxyChain ( proxyChain ) ; logger . printMessage ( "=== Proxy Information ===" ) ; printProxyStandardInfo ( proxyFilePath ) ; if ( params . containsOption ( PrintOption . ALL_OPTIONS ) ) { printAC ( listVOMSAttributes ) ; } logger . printMessage ( "" ) ; } if ( params . containsOption ( PrintOption . TEXT ) ) { if ( ! params . containsOption ( PrintOption . ALL_OPTIONS ) && ! params . containsOption ( PrintOption . CHAIN ) ) { printProxyStandardInfo ( proxyFilePath ) ; logger . printMessage ( "" ) ; } int chainLength = 1 ; if ( params . containsOption ( PrintOption . CHAIN ) ) chainLength = proxyChain . length ; for ( int i = chainLength - 1 ; i >= 0 ; i -- ) { logger . printMessage ( "Certificate:" ) ; logger . printMessage ( CertificateUtils . format ( proxyChain [ i ] , FormatMode . FULL ) ) ; logger . printMessage ( "" ) ; } } if ( params . containsOption ( PrintOption . KEYSIZE ) && ! params . containsOption ( PrintOption . ALL_OPTIONS ) ) { logger . printMessage ( getKeySize ( proxyChain [ 0 ] ) ) ; } if ( params . containsOption ( PrintOption . KEYUSAGE ) && ! params . containsOption ( PrintOption . ALL_OPTIONS ) ) { tabularFormatted ( "key usage" , getProxyKeyUsages ( ) ) ; } if ( params . containsOption ( PrintOption . TIMELEFT ) && ! params . containsOption ( PrintOption . ALL_OPTIONS ) ) { Date notAfter = proxyCredential . getCertificate ( ) . getNotAfter ( ) ; long notAfterinMSec = TimeUtils . getTimeLeft ( notAfter ) ; long notAfterInSec = TimeUnit . MILLISECONDS . toSeconds ( notAfterinMSec ) ; logger . printMessage ( String . valueOf ( notAfterInSec ) ) ; }
public class SyncManager { /** * This method manages the synchronizing - process between { @ link BucketContainer } and HDD . It is repeatedly called by * < code > run ( ) < / code > , till shutdown is initiated . */ private void synchronizeBucketsWithHDD ( ) { } }
int synchronizedBuckets = 0 ; // run over all buckets for ( int i = 0 ; i < numberOfBuckets ; i ++ ) { Bucket < Data > oldBucket = bucketContainer . getBucket ( i ) ; // if the bucket is empty , then do nothing if ( oldBucket . elementsInBucket == 0 ) { synchronizedBuckets ++ ; continue ; } /* * * * * * TESTING PURPOSE * * * * * */ if ( DynamicMemoryAllocater . INSTANCES [ gp . instanceID ] . getFreeMemory ( ) == 0 ) { log . info ( "No memory free, theoretically I must force synchronization" ) ; } long elapsedTime = System . currentTimeMillis ( ) - oldBucket . getCreationTime ( ) ; // if the bucket is full , or the bucket is longer then max bucket storage time within the BucketContainer , // or the shutdown was initiated , then try to synchronize the buckets // At this point we prevent starvation of one bucket if it not filled for a long period of time . if ( oldBucket . elementsInBucket >= gp . MIN_ELEMENT_IN_BUCKET_BEFORE_SYNC || // TODO What do we do if more than one DynamicMemoryAllocator exist ? ? ? DynamicMemoryAllocater . INSTANCES [ gp . instanceID ] . getFreeMemory ( ) == 0 || // DynamicMemoryAllocater . INSTANCE . getFreeMemory ( ) = = 0 | | elapsedTime > maxBucketStorageTime || shutDownInitiated || forceInitiated ) { if ( ! startNewThread ( i ) ) { sleep ( ) ; } } } if ( shutDownInitiated ) { log . info ( "{} of {} buckets were synchronized." , synchronizedBuckets , bucketContainer . getNumberOfBuckets ( ) ) ; } // if the queue is not full try to fill it if ( bufferThreads . getQueue ( ) . size ( ) < bufferThreads . getMaximumPoolSize ( ) ) { int bucketId = getLargestBucketId ( ) ; if ( bucketId != - 1 ) { Bucket < Data > pointer = bucketContainer . getBucket ( bucketId ) ; boolean threadStarted = false ; if ( DynamicMemoryAllocater . INSTANCES [ gp . instanceID ] . getFreeMemory ( ) == 0 || pointer . elementsInBucket >= gp . MIN_ELEMENT_IN_BUCKET_BEFORE_SYNC || forceInitiated ) { threadStarted = startNewThread ( bucketId ) ; } if ( ! threadStarted ) { sleep ( ) ; } } }
public class ConjunctionImpl { /** * if not matched . */ private static Selector substitute ( Identifier id , List [ ] equatedIds ) { } }
for ( int i = 0 ; i < equatedIds [ 0 ] . size ( ) ; i ++ ) if ( id . getName ( ) . equals ( equatedIds [ 0 ] . get ( i ) ) ) return new LiteralImpl ( equatedIds [ 1 ] . get ( i ) ) ; return id ;
public class YoutubeSampleActivity { /** * Initialize and configure the DraggablePanel widget with two fragments and some attributes . */ private void initializeDraggablePanel ( ) { } }
draggablePanel . setFragmentManager ( getSupportFragmentManager ( ) ) ; draggablePanel . setTopFragment ( youtubeFragment ) ; MoviePosterFragment moviePosterFragment = new MoviePosterFragment ( ) ; moviePosterFragment . setPoster ( VIDEO_POSTER_THUMBNAIL ) ; moviePosterFragment . setPosterTitle ( VIDEO_POSTER_TITLE ) ; draggablePanel . setBottomFragment ( moviePosterFragment ) ; draggablePanel . initializeView ( ) ; Picasso . with ( this ) . load ( SECOND_VIDEO_POSTER_THUMBNAIL ) . placeholder ( R . drawable . xmen_placeholder ) . into ( thumbnailImageView ) ;
public class responderpolicylabel { /** * Use this API to fetch all the responderpolicylabel resources that are configured on netscaler . */ public static responderpolicylabel [ ] get ( nitro_service service , options option ) throws Exception { } }
responderpolicylabel obj = new responderpolicylabel ( ) ; responderpolicylabel [ ] response = ( responderpolicylabel [ ] ) obj . get_resources ( service , option ) ; return response ;
public class SelectorUtils { /** * " Flattens " a string by removing all whitespace ( space , tab , linefeed , * carriage return , and formfeed ) . This uses StringTokenizer and the * default set of tokens as documented in the single arguement constructor . * @ param input a String to remove all whitespace . * @ return a String that has had all whitespace removed . */ public static String removeWhitespace ( String input ) { } }
StringBuilder result = new StringBuilder ( ) ; if ( input != null ) { StringTokenizer st = new StringTokenizer ( input ) ; while ( st . hasMoreTokens ( ) ) { result . append ( st . nextToken ( ) ) ; } } return result . toString ( ) ;
public class RemoteNeo4jSequenceGenerator { /** * Generate the next value in a sequence for a given { @ link IdSourceKey } . * @ return the next value in a sequence */ @ Override public Long nextValue ( NextValueRequest request ) { } }
String sequenceName = sequenceName ( request . getKey ( ) ) ; // This method return 2 statements : the first one to acquire a lock and the second one to update the sequence node RemoteStatements remoteStatements = updateNextValueQuery ( request ) ; Number nextValue = nextValue ( remoteStatements ) ; // sequence nodes are expected to have been created up - front if ( request . getKey ( ) . getMetadata ( ) . getType ( ) == IdSourceType . SEQUENCE ) { if ( nextValue == null ) { throw logger . sequenceNotFound ( sequenceName ) ; } } // The only way I found to make it work in a multi - threaded environment is to first increment the value and then read it . // Our API allows for an initial value and to make sure that I ' m actually reading the correct one , // the first time I need to decrement the value I obtain from the db . return nextValue . longValue ( ) - request . getIncrement ( ) ;
public class ParseDateTimeZone { /** * { @ inheritDoc } * @ throws SuperCsvCellProcessorException * if value is null or is not a String */ public Object execute ( final Object value , final CsvContext context ) { } }
validateInputNotNull ( value , context ) ; if ( ! ( value instanceof String ) ) { throw new SuperCsvCellProcessorException ( String . class , value , context , this ) ; } final DateTimeZone result ; try { result = DateTimeZone . forID ( ( String ) value ) ; } catch ( IllegalArgumentException e ) { throw new SuperCsvCellProcessorException ( "Failed to parse value as a DateTimeZone" , context , this , e ) ; } return next . execute ( result , context ) ;
public class ByteBufJsonHelper { /** * Finds the position of the correct closing character , taking into account the fact that before the correct one , * other sub section with same opening and closing characters can be encountered . * This implementation starts for the current { @ link ByteBuf # readerIndex ( ) readerIndex } . * @ param buf the { @ link ByteBuf } where to search for the end of a section enclosed in openingChar and closingChar . * @ param openingChar the section opening char , used to detect a sub - section . * @ param closingChar the section closing char , used to detect the end of a sub - section / this section . * @ return the section closing position or - 1 if not found . */ public static int findSectionClosingPosition ( ByteBuf buf , char openingChar , char closingChar ) { } }
return buf . forEachByte ( new ClosingPositionBufProcessor ( openingChar , closingChar , true ) ) ;
public class SqlUtils { /** * Converts string array to greenplum friendly string . From new * String [ ] { " foo " , " jee " } we get " ' foo ' , jee ' " . * @ param strings * String array to explode * @ return Comma delimited string with values encapsulated with * apostropheres . ‘ ' */ public static String createLocationString ( String [ ] strings ) { } }
StringBuilder locString = new StringBuilder ( ) ; for ( int i = 0 ; i < strings . length ; i ++ ) { String string = strings [ i ] ; locString . append ( "'" ) ; locString . append ( string ) ; locString . append ( "'" ) ; if ( i < strings . length - 1 ) { locString . append ( "," ) ; } } return locString . toString ( ) ;
public class TarOutputStream { /** * Closes the current tar entry * @ throws IOException */ protected void closeCurrentEntry ( ) throws IOException { } }
if ( currentEntry != null ) { if ( currentEntry . getSize ( ) > currentFileSize ) { throw new IOException ( "The current entry[" + currentEntry . getName ( ) + "] of size[" + currentEntry . getSize ( ) + "] has not been fully written." ) ; } currentEntry = null ; currentFileSize = 0 ; pad ( ) ; }
public class RestUtils { /** * Batch read response as JSON . * @ param app the current App object * @ param ids list of ids * @ return status code 200 or 400 */ public static Response getBatchReadResponse ( App app , List < String > ids ) { } }
try ( final Metrics . Context context = Metrics . time ( app == null ? null : app . getAppid ( ) , RestUtils . class , "batch" , "read" ) ) { if ( app != null && ids != null && ! ids . isEmpty ( ) ) { ArrayList < ParaObject > results = new ArrayList < > ( ids . size ( ) ) ; for ( ParaObject result : Para . getDAO ( ) . readAll ( app . getAppIdentifier ( ) , ids , true ) . values ( ) ) { if ( checkImplicitAppPermissions ( app , result ) && checkIfUserCanModifyObject ( app , result ) ) { results . add ( result ) ; } } return Response . ok ( results ) . build ( ) ; } else { return getStatusResponse ( Response . Status . BAD_REQUEST , "Missing ids." ) ; } }
public class SetVaultNotificationsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( SetVaultNotificationsRequest setVaultNotificationsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( setVaultNotificationsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( setVaultNotificationsRequest . getAccountId ( ) , ACCOUNTID_BINDING ) ; protocolMarshaller . marshall ( setVaultNotificationsRequest . getVaultName ( ) , VAULTNAME_BINDING ) ; protocolMarshaller . marshall ( setVaultNotificationsRequest . getVaultNotificationConfig ( ) , VAULTNOTIFICATIONCONFIG_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class JpaRepository { /** * Finds an entity by a given attribute . Returns null if none was found . * @ param attribute the attribute to search for * @ param value the value * @ return the entity or null if none was found */ public T findOneByAttribute ( String attribute , Object value ) { } }
CriteriaBuilder cb = getEntityManager ( ) . getCriteriaBuilder ( ) ; CriteriaQuery < T > query = cb . createQuery ( getEntityClass ( ) ) ; Root < T > from = query . from ( getEntityClass ( ) ) ; query . where ( cb . equal ( from . get ( attribute ) , value ) ) ; try { return getEntityManager ( ) . createQuery ( query ) . getSingleResult ( ) ; } catch ( NoResultException e ) { return null ; }
public class StatisticsJDBCStorageConnection { /** * { @ inheritDoc } */ public boolean getChildNodesDataByPage ( NodeData parent , int fromOrderNum , int offset , int pageSize , List < NodeData > childs ) throws RepositoryException { } }
Statistics s = ALL_STATISTICS . get ( GET_CHILD_NODES_DATA_BY_PAGE_DESCR ) ; try { s . begin ( ) ; return wcs . getChildNodesDataByPage ( parent , fromOrderNum , offset , pageSize , childs ) ; } finally { s . end ( ) ; }
public class SimpleText { /** * to check for exact match use method value . equals ( text ) instead . */ public boolean match ( List < String > valueTokens , List < String > queryTokens ) { } }
if ( valueTokens . size ( ) != queryTokens . size ( ) ) return false ; for ( int i = 0 ; i < valueTokens . size ( ) ; i ++ ) { if ( ! valueTokens . get ( i ) . equals ( queryTokens . get ( i ) ) ) return false ; } return true ;
public class RPC { /** * Install it as The Answer packet and wake up anybody waiting on an answer . */ protected int response ( AutoBuffer ab ) { } }
assert _tasknum == ab . getTask ( ) ; if ( _done ) return ab . close ( ) ; // Ignore duplicate response packet int flag = ab . getFlag ( ) ; // Must read flag also , to advance ab if ( flag == SERVER_TCP_SEND ) return ab . close ( ) ; // Ignore UDP packet for a TCP reply assert flag == SERVER_UDP_SEND ; synchronized ( this ) { // Install the answer under lock if ( _done ) return ab . close ( ) ; // Ignore duplicate response packet UDPTimeOutThread . PENDING . remove ( this ) ; _dt . read ( ab ) ; // Read the answer ( under lock ? ) _size_rez = ab . size ( ) ; // Record received size ab . close ( ) ; // Also finish the read ( under lock ? ) _dt . onAck ( ) ; // One time only execute ( before sending ACKACK ) _done = true ; // Only read one ( of many ) response packets ab . _h2o . taskRemove ( _tasknum ) ; // Flag as task - completed , even if the result is null notifyAll ( ) ; // And notify in any case } doAllCompletions ( ) ; // Send all tasks needing completion to the work queues return 0 ;
public class HttpUtils { /** * Check for a conditional operation . * @ param method the HTTP method * @ param ifModifiedSince the If - Modified - Since header * @ param modified the resource modification date */ public static void checkIfModifiedSince ( final String method , final String ifModifiedSince , final Instant modified ) { } }
if ( isGetOrHead ( method ) ) { final Instant time = parseDate ( ifModifiedSince ) ; if ( time != null && time . isAfter ( modified . truncatedTo ( SECONDS ) ) ) { throw new RedirectionException ( notModified ( ) . build ( ) ) ; } }
public class PrimitiveArrays { /** * Returns the value of the element with the maximum value */ public static long max ( long [ ] array , int offset , int length ) { } }
long max = - Long . MAX_VALUE ; for ( int i = 0 ; i < length ; i ++ ) { long tmp = array [ offset + i ] ; if ( tmp > max ) { max = tmp ; } } return max ;
public class TrustAllTrustManager { /** * Creates a new SSL socket factory that generates SSL sockets that trust all certificates unconditionally . * @ return A new SSL socket factory that generates SSL sockets that trust all certificates unconditionally . */ public SSLSocketFactory createSslSocketFactory ( ) { } }
try { SSLContext sslContext = SSLContext . getInstance ( "TLS" ) ; sslContext . init ( null , new TrustManager [ ] { this } , null ) ; return sslContext . getSocketFactory ( ) ; } catch ( NoSuchAlgorithmException | KeyManagementException e ) { throw new AssertionError ( e ) ; }
public class CmsCategoryTree { /** * Goes up the tree and opens the parents of the item . < p > * @ param item the child item to start from */ public void openWithParents ( CmsTreeItem item ) { } }
if ( item != null ) { item . setOpen ( true ) ; openWithParents ( item . getParentItem ( ) ) ; }
public class Internal { /** * Decode the histogram point from the given key value * @ param kv the key value that contains a histogram * @ return the decoded { @ code HistogramDataPoint } */ public static HistogramDataPoint decodeHistogramDataPoint ( final TSDB tsdb , final KeyValue kv ) { } }
long timestamp = Internal . baseTime ( kv . key ( ) ) ; return decodeHistogramDataPoint ( tsdb , timestamp , kv . qualifier ( ) , kv . value ( ) ) ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EEnum getIfcCooledBeamTypeEnum ( ) { } }
if ( ifcCooledBeamTypeEnumEEnum == null ) { ifcCooledBeamTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 801 ) ; } return ifcCooledBeamTypeEnumEEnum ;
public class Anniversary { /** * Add this field in the Record ' s field sequence . */ public BaseField setupField ( int iFieldSeq ) { } }
BaseField field = null ; // if ( iFieldSeq = = 0) // field = new CounterField ( this , ID , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ; // field . setHidden ( true ) ; // if ( iFieldSeq = = 1) // field = new RecordChangedField ( this , LAST _ CHANGED , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ; // field . setHidden ( true ) ; // if ( iFieldSeq = = 2) // field = new BooleanField ( this , DELETED , Constants . DEFAULT _ FIELD _ LENGTH , null , new Boolean ( false ) ) ; // field . setHidden ( true ) ; // if ( iFieldSeq = = 3) // field = new CalendarEntryTypeField ( this , CALENDAR _ ENTRY _ TYPE _ ID , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ; // field . setHidden ( true ) ; // if ( iFieldSeq = = 4) // field = new DateTimeField ( this , START _ DATE _ TIME , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ; // if ( iFieldSeq = = 5) // field = new DateTimeField ( this , END _ DATE _ TIME , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ; // if ( iFieldSeq = = 6) // field = new StringField ( this , DESCRIPTION , 60 , null , null ) ; // if ( iFieldSeq = = 7) // field = new CalendarCategoryField ( this , CALENDAR _ CATEGORY _ ID , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ; // field . addListener ( new InitOnceFieldHandler ( null ) ) ; // if ( iFieldSeq = = 8) // field = new BooleanField ( this , HIDDEN , Constants . DEFAULT _ FIELD _ LENGTH , null , new Boolean ( false ) ) ; // if ( iFieldSeq = = 9) // field = new PropertiesField ( this , PROPERTIES , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ; if ( iFieldSeq == 10 ) field = new AnnivMasterField ( this , ANNIV_MASTER_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( field == null ) field = super . setupField ( iFieldSeq ) ; return field ;
public class LauncherDelegateImpl { /** * { @ inheritDoc } * @ throws InterruptedException */ @ Override public boolean shutdown ( ) throws InterruptedException { } }
// Prevent shutdown before the server has properly started managerLatch . await ( ) ; if ( manager == null ) return false ; manager . shutdownFramework ( ) ; manager . waitForShutdown ( ) ; return true ;
public class AmazonEC2Client { /** * Preview a reservation purchase with configurations that match those of your Dedicated Host . You must have active * Dedicated Hosts in your account before you purchase a reservation . * This is a preview of the < a > PurchaseHostReservation < / a > action and does not result in the offering being * purchased . * @ param getHostReservationPurchasePreviewRequest * @ return Result of the GetHostReservationPurchasePreview operation returned by the service . * @ sample AmazonEC2 . GetHostReservationPurchasePreview * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / GetHostReservationPurchasePreview " * target = " _ top " > AWS API Documentation < / a > */ @ Override public GetHostReservationPurchasePreviewResult getHostReservationPurchasePreview ( GetHostReservationPurchasePreviewRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeGetHostReservationPurchasePreview ( request ) ;
public class JvmTypesBuilder { /** * / * @ Nullable */ public JvmFormalParameter toParameter ( /* @ Nullable */ EObject sourceElement , /* @ Nullable */ String name , /* @ Nullable */ JvmTypeReference typeRef ) { } }
if ( sourceElement == null || name == null ) return null ; JvmFormalParameter result = typesFactory . createJvmFormalParameter ( ) ; result . setName ( name ) ; result . setParameterType ( cloneWithProxies ( typeRef ) ) ; return associate ( sourceElement , result ) ;
public class ExpressionFactory { /** * Discover the name of class that implements ExpressionFactory . * @ param tccl * { @ code ClassLoader } * @ return Class name . There is default , so it is never { @ code null } . */ private static String discoverClassName ( ClassLoader tccl ) { } }
String className = null ; // First services API className = getClassNameServices ( tccl ) ; if ( className == null ) { if ( IS_SECURITY_ENABLED ) { className = AccessController . doPrivileged ( new PrivilegedAction < String > ( ) { @ Override public String run ( ) { return getClassNameJreDir ( ) ; } } ) ; } else { // Second el . properties file className = getClassNameJreDir ( ) ; } } if ( className == null ) { if ( IS_SECURITY_ENABLED ) { className = AccessController . doPrivileged ( new PrivilegedAction < String > ( ) { @ Override public String run ( ) { return getClassNameSysProp ( ) ; } } ) ; } else { // Third system property className = getClassNameSysProp ( ) ; } } if ( className == null ) { // Fourth - default className = "org.apache.el.ExpressionFactoryImpl" ; } return className ;
public class NamespaceSupport { /** * Process a raw XML qualified name , after all declarations in the * current context have been handled by { @ link # declarePrefix * declarePrefix ( ) } . * < p > This method processes a raw XML qualified name in the * current context by removing the prefix and looking it up among * the prefixes currently declared . The return value will be the * array supplied by the caller , filled in as follows : < / p > * < dl > * < dt > parts [ 0 ] < / dt > * < dd > The Namespace URI , or an empty string if none is * in use . < / dd > * < dt > parts [ 1 ] < / dt > * < dd > The local name ( without prefix ) . < / dd > * < dt > parts [ 2 ] < / dt > * < dd > The original raw name . < / dd > * < / dl > * < p > All of the strings in the array will be internalized . If * the raw name has a prefix that has not been declared , then * the return value will be null . < / p > * < p > Note that attribute names are processed differently than * element names : an unprefixed element name will receive the * default Namespace ( if any ) , while an unprefixed attribute name * will not . < / p > * @ param qName The XML qualified name to be processed . * @ param parts An array supplied by the caller , capable of * holding at least three members . * @ param isAttribute A flag indicating whether this is an * attribute name ( true ) or an element name ( false ) . * @ return The supplied array holding three internalized strings * representing the Namespace URI ( or empty string ) , the * local name , and the XML qualified name ; or null if there * is an undeclared prefix . * @ see # declarePrefix * @ see java . lang . String # intern */ public String [ ] processName ( String qName , String parts [ ] , boolean isAttribute ) { } }
String myParts [ ] = currentContext . processName ( qName , isAttribute ) ; if ( myParts == null ) { return null ; } else { parts [ 0 ] = myParts [ 0 ] ; parts [ 1 ] = myParts [ 1 ] ; parts [ 2 ] = myParts [ 2 ] ; return parts ; }
public class DataStore { /** * Convert this batch into a JSON representation . * @ return JSONObject representing this batch . */ public JSONObject toJson ( ) { } }
JSONObject ret = new JSONObject ( ) ; JSONArray columns = new JSONArray ( Arrays . asList ( new String [ ] { "time" } ) ) ; for ( String f : this . columns ) { columns . put ( f ) ; } ret . put ( KEY_COLUMNS , columns ) ; JSONArray data = new JSONArray ( ) ; ret . put ( KEY_ROWS , data ) ; for ( Long ts : rows . keySet ( ) ) { JSONArray row = new JSONArray ( ) ; row . put ( ts ) ; Map < String , Object > temp = rows . get ( ts ) ; for ( String f : this . columns ) { Object val = temp . get ( f ) ; row . put ( val != null ? val : JSONObject . NULL ) ; } data . put ( row ) ; } return ret ;
public class AddStepsRequest { /** * Configure the step to be added . * @ param step a StepConfig object to be added . * @ return AddStepsRequest */ public AddStepsRequest withStep ( StepConfig step ) { } }
if ( this . steps == null ) { this . steps = new ArrayList < StepConfig > ( ) ; } this . steps . add ( step ) ; return this ;
public class MysqlValidator { /** * Checks a set of characters , throws IOException if invalid */ public static void checkCharacters ( CharSequence str , int off , int end ) throws IOException { } }
while ( off < end ) checkCharacter ( str . charAt ( off ++ ) ) ;
public class PropertyBuilder { /** * Return a new PropertyBuilder of type { @ link Property . Type # Select } * @ param name name * @ return this builder */ public PropertyBuilder select ( final String name ) { } }
name ( name ) ; type ( Property . Type . Select ) ; return this ;
public class Consumers { /** * Yields the last element if present , nothing otherwise . * @ param < E > the iterator element type * @ param iterator the iterator that will be consumed * @ return the last element or nothing */ public static < E > Optional < E > maybeLast ( Iterator < E > iterator ) { } }
return new MaybeLastElement < E > ( ) . apply ( iterator ) ;
public class Entry { /** * A property used to store a time zone for the entry . The time zone is * needed for properly interpreting the dates and times of the entry . * @ return the time zone property */ public final ReadOnlyObjectProperty < ZoneId > zoneIdProperty ( ) { } }
if ( zoneId == null ) { zoneId = new ReadOnlyObjectWrapper < > ( this , "zoneId" , getInterval ( ) . getZoneId ( ) ) ; // $ NON - NLS - 1 $ } return zoneId . getReadOnlyProperty ( ) ;
public class ByteBufferUtil { /** * changes bb position */ public static ByteBuffer readBytes ( ByteBuffer bb , int length ) { } }
ByteBuffer copy = bb . duplicate ( ) ; copy . limit ( copy . position ( ) + length ) ; bb . position ( bb . position ( ) + length ) ; return copy ;
public class NettyMessagingTransport { /** * Registers the exception event handler . * @ param handler the exception event handler */ @ Override public void registerErrorHandler ( final EventHandler < Exception > handler ) { } }
this . clientEventListener . registerErrorHandler ( handler ) ; this . serverEventListener . registerErrorHandler ( handler ) ;
public class BlockingCommandManager { /** * Unblock all . * @ throws NoResponseException * @ throws XMPPErrorException * @ throws NotConnectedException * @ throws InterruptedException */ public void unblockAll ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } }
UnblockContactsIQ unblockContactIQ = new UnblockContactsIQ ( ) ; connection ( ) . createStanzaCollectorAndSend ( unblockContactIQ ) . nextResultOrThrow ( ) ;
public class DoubleParser { /** * Static utility to parse a field of type double from a byte sequence that represents text characters * ( such as when read from a file stream ) . * @ param bytes The bytes containing the text data that should be parsed . * @ param startPos The offset to start the parsing . * @ param length The length of the byte sequence ( counting from the offset ) . * @ param delimiter The delimiter that terminates the field . * @ return The parsed value . * @ throws NumberFormatException Thrown when the value cannot be parsed because the text represents not a correct number . */ public static final double parseField ( byte [ ] bytes , int startPos , int length , char delimiter ) { } }
if ( length <= 0 ) { throw new NumberFormatException ( "Invalid input: Empty string" ) ; } int i = 0 ; final byte delByte = ( byte ) delimiter ; while ( i < length && bytes [ i ] != delByte ) { i ++ ; } String str = new String ( bytes , startPos , i ) ; return Double . parseDouble ( str ) ;
public class ServersInner { /** * Creates a new server or updates an existing server . The update action will overwrite the existing server . * @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal . * @ param serverName The name of the server . * @ param parameters The required parameters for creating or updating a server . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < ServerInner > beginCreateAsync ( String resourceGroupName , String serverName , ServerForCreate parameters , final ServiceCallback < ServerInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( beginCreateWithServiceResponseAsync ( resourceGroupName , serverName , parameters ) , serviceCallback ) ;
public class GlobalLibraryV2_0Generator { /** * Create a HumanNameDataType from Rolodex object * @ param rolodex * Rolodex object * @ return HumanNameDataType corresponding to the rolodex object . */ public HumanNameDataType getHumanNameDataType ( RolodexContract rolodex ) { } }
HumanNameDataType humanName = HumanNameDataType . Factory . newInstance ( ) ; if ( rolodex != null ) { humanName . setFirstName ( rolodex . getFirstName ( ) ) ; humanName . setLastName ( rolodex . getLastName ( ) ) ; String middleName = rolodex . getMiddleName ( ) ; if ( middleName != null && ! middleName . equals ( "" ) ) { humanName . setMiddleName ( middleName ) ; } } return humanName ;
public class DSLMapParser { /** * src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 130:1 : scope _ section : LEFT _ SQUARE ( value1 = condition _ key | value2 = consequence _ key | value3 = keyword _ key | value4 = any _ key ) RIGHT _ SQUARE - > ^ ( VT _ SCOPE [ $ LEFT _ SQUARE , \ " SCOPE SECTION \ " ] ( $ value1 ) ? ( $ value2 ) ? ( $ value3 ) ? ( $ value4 ) ? ) ; */ public final DSLMapParser . scope_section_return scope_section ( ) throws RecognitionException { } }
DSLMapParser . scope_section_return retval = new DSLMapParser . scope_section_return ( ) ; retval . start = input . LT ( 1 ) ; Object root_0 = null ; Token LEFT_SQUARE11 = null ; Token RIGHT_SQUARE12 = null ; ParserRuleReturnScope value1 = null ; ParserRuleReturnScope value2 = null ; ParserRuleReturnScope value3 = null ; ParserRuleReturnScope value4 = null ; Object LEFT_SQUARE11_tree = null ; Object RIGHT_SQUARE12_tree = null ; RewriteRuleTokenStream stream_RIGHT_SQUARE = new RewriteRuleTokenStream ( adaptor , "token RIGHT_SQUARE" ) ; RewriteRuleTokenStream stream_LEFT_SQUARE = new RewriteRuleTokenStream ( adaptor , "token LEFT_SQUARE" ) ; RewriteRuleSubtreeStream stream_any_key = new RewriteRuleSubtreeStream ( adaptor , "rule any_key" ) ; RewriteRuleSubtreeStream stream_condition_key = new RewriteRuleSubtreeStream ( adaptor , "rule condition_key" ) ; RewriteRuleSubtreeStream stream_keyword_key = new RewriteRuleSubtreeStream ( adaptor , "rule keyword_key" ) ; RewriteRuleSubtreeStream stream_consequence_key = new RewriteRuleSubtreeStream ( adaptor , "rule consequence_key" ) ; try { // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 131:5 : ( LEFT _ SQUARE ( value1 = condition _ key | value2 = consequence _ key | value3 = keyword _ key | value4 = any _ key ) RIGHT _ SQUARE - > ^ ( VT _ SCOPE [ $ LEFT _ SQUARE , \ " SCOPE SECTION \ " ] ( $ value1 ) ? ( $ value2 ) ? ( $ value3 ) ? ( $ value4 ) ? ) ) // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 131:7 : LEFT _ SQUARE ( value1 = condition _ key | value2 = consequence _ key | value3 = keyword _ key | value4 = any _ key ) RIGHT _ SQUARE { LEFT_SQUARE11 = ( Token ) match ( input , LEFT_SQUARE , FOLLOW_LEFT_SQUARE_in_scope_section412 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) stream_LEFT_SQUARE . add ( LEFT_SQUARE11 ) ; // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 132:9 : ( value1 = condition _ key | value2 = consequence _ key | value3 = keyword _ key | value4 = any _ key ) int alt6 = 4 ; int LA6_0 = input . LA ( 1 ) ; if ( ( LA6_0 == LITERAL ) ) { int LA6_1 = input . LA ( 2 ) ; if ( ( ( ( validateIdentifierKey ( "condition" ) || validateIdentifierKey ( "when" ) ) && synpred6_DSLMap ( ) ) ) ) { alt6 = 1 ; } else if ( ( ( synpred7_DSLMap ( ) && ( validateIdentifierKey ( "consequence" ) || validateIdentifierKey ( "then" ) ) ) ) ) { alt6 = 2 ; } else if ( ( ( synpred8_DSLMap ( ) && ( validateIdentifierKey ( "keyword" ) ) ) ) ) { alt6 = 3 ; } else if ( ( ( validateIdentifierKey ( "*" ) ) ) ) { alt6 = 4 ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return retval ; } int nvaeMark = input . mark ( ) ; try { input . consume ( ) ; NoViableAltException nvae = new NoViableAltException ( "" , 6 , 1 , input ) ; throw nvae ; } finally { input . rewind ( nvaeMark ) ; } } } else { if ( state . backtracking > 0 ) { state . failed = true ; return retval ; } NoViableAltException nvae = new NoViableAltException ( "" , 6 , 0 , input ) ; throw nvae ; } switch ( alt6 ) { case 1 : // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 132:10 : value1 = condition _ key { pushFollow ( FOLLOW_condition_key_in_scope_section425 ) ; value1 = condition_key ( ) ; state . _fsp -- ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) stream_condition_key . add ( value1 . getTree ( ) ) ; } break ; case 2 : // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 133:11 : value2 = consequence _ key { pushFollow ( FOLLOW_consequence_key_in_scope_section439 ) ; value2 = consequence_key ( ) ; state . _fsp -- ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) stream_consequence_key . add ( value2 . getTree ( ) ) ; } break ; case 3 : // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 134:11 : value3 = keyword _ key { pushFollow ( FOLLOW_keyword_key_in_scope_section453 ) ; value3 = keyword_key ( ) ; state . _fsp -- ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) stream_keyword_key . add ( value3 . getTree ( ) ) ; } break ; case 4 : // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 135:11 : value4 = any _ key { pushFollow ( FOLLOW_any_key_in_scope_section467 ) ; value4 = any_key ( ) ; state . _fsp -- ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) stream_any_key . add ( value4 . getTree ( ) ) ; } break ; } RIGHT_SQUARE12 = ( Token ) match ( input , RIGHT_SQUARE , FOLLOW_RIGHT_SQUARE_in_scope_section483 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) stream_RIGHT_SQUARE . add ( RIGHT_SQUARE12 ) ; // AST REWRITE // elements : value2 , value3 , value1 , value4 // token labels : // rule labels : retval , value3 , value4 , value1 , value2 // token list labels : // rule list labels : // wildcard labels : if ( state . backtracking == 0 ) { retval . tree = root_0 ; RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream ( adaptor , "rule retval" , retval != null ? retval . getTree ( ) : null ) ; RewriteRuleSubtreeStream stream_value3 = new RewriteRuleSubtreeStream ( adaptor , "rule value3" , value3 != null ? value3 . getTree ( ) : null ) ; RewriteRuleSubtreeStream stream_value4 = new RewriteRuleSubtreeStream ( adaptor , "rule value4" , value4 != null ? value4 . getTree ( ) : null ) ; RewriteRuleSubtreeStream stream_value1 = new RewriteRuleSubtreeStream ( adaptor , "rule value1" , value1 != null ? value1 . getTree ( ) : null ) ; RewriteRuleSubtreeStream stream_value2 = new RewriteRuleSubtreeStream ( adaptor , "rule value2" , value2 != null ? value2 . getTree ( ) : null ) ; root_0 = ( Object ) adaptor . nil ( ) ; // 138:5 : - > ^ ( VT _ SCOPE [ $ LEFT _ SQUARE , \ " SCOPE SECTION \ " ] ( $ value1 ) ? ( $ value2 ) ? ( $ value3 ) ? ( $ value4 ) ? ) { // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 138:8 : ^ ( VT _ SCOPE [ $ LEFT _ SQUARE , \ " SCOPE SECTION \ " ] ( $ value1 ) ? ( $ value2 ) ? ( $ value3 ) ? ( $ value4 ) ? ) { Object root_1 = ( Object ) adaptor . nil ( ) ; root_1 = ( Object ) adaptor . becomeRoot ( ( Object ) adaptor . create ( VT_SCOPE , LEFT_SQUARE11 , "SCOPE SECTION" ) , root_1 ) ; // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 138:51 : ( $ value1 ) ? if ( stream_value1 . hasNext ( ) ) { adaptor . addChild ( root_1 , stream_value1 . nextTree ( ) ) ; } stream_value1 . reset ( ) ; // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 138:60 : ( $ value2 ) ? if ( stream_value2 . hasNext ( ) ) { adaptor . addChild ( root_1 , stream_value2 . nextTree ( ) ) ; } stream_value2 . reset ( ) ; // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 138:69 : ( $ value3 ) ? if ( stream_value3 . hasNext ( ) ) { adaptor . addChild ( root_1 , stream_value3 . nextTree ( ) ) ; } stream_value3 . reset ( ) ; // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 138:78 : ( $ value4 ) ? if ( stream_value4 . hasNext ( ) ) { adaptor . addChild ( root_1 , stream_value4 . nextTree ( ) ) ; } stream_value4 . reset ( ) ; adaptor . addChild ( root_0 , root_1 ) ; } } retval . tree = root_0 ; } } retval . stop = input . LT ( - 1 ) ; if ( state . backtracking == 0 ) { retval . tree = ( Object ) adaptor . rulePostProcessing ( root_0 ) ; adaptor . setTokenBoundaries ( retval . tree , retval . start , retval . stop ) ; } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; retval . tree = ( Object ) adaptor . errorNode ( input , retval . start , input . LT ( - 1 ) , re ) ; } finally { // do for sure before leaving } return retval ;
public class ClassReader { /** * Enter type variables of this classtype and all enclosing ones in * ` typevars ' . */ protected void enterTypevars ( Type t ) { } }
if ( t . getEnclosingType ( ) != null && t . getEnclosingType ( ) . hasTag ( CLASS ) ) enterTypevars ( t . getEnclosingType ( ) ) ; for ( List < Type > xs = t . getTypeArguments ( ) ; xs . nonEmpty ( ) ; xs = xs . tail ) typevars . enter ( xs . head . tsym ) ;
public class MDBRuntimeImpl { /** * Method to get the XAResource corresponding to an ActivationSpec from the RRSXAResourceFactory * @ param activationSpecId The id of the ActivationSpec * @ param xid Transaction branch qualifier * @ return the XAResource */ @ Override public XAResource getRRSXAResource ( String activationSpecId , Xid xid ) throws XAResourceNotAvailableException { } }
RRSXAResourceFactory factory = rrsXAResFactorySvcRef . getService ( ) ; if ( factory == null ) { return null ; } else { return factory . getTwoPhaseXAResource ( xid ) ; }
public class HttpContext { /** * Execute a PATCH call against the partial URL . * @ param partialUrl The partial URL to build * @ param payload The object to use for the PATCH */ public void PATCH ( String partialUrl , Object payload ) { } }
URI uri = buildUri ( partialUrl ) ; executePatchRequest ( uri , payload ) ;
public class Analyser { /** * / * setup _ tree does the following work . * 1 . check empty loop . ( set qn - > target _ empty _ info ) * 2 . expand ignore - case in char class . * 3 . set memory status bit flags . ( reg - > mem _ stats ) * 4 . set qn - > head _ exact for [ push , exact ] - > [ push _ or _ jump _ exact1 , exact ] . * 5 . find invalid patterns in look - behind . * 6 . expand repeated string . */ protected final Node setupTree ( Node node , int state ) { } }
restart : while ( true ) { switch ( node . getType ( ) ) { case NodeType . LIST : ListNode lin = ( ListNode ) node ; Node prev = null ; do { setupTree ( lin . value , state ) ; if ( prev != null ) { nextSetup ( prev , lin . value ) ; } prev = lin . value ; } while ( ( lin = lin . tail ) != null ) ; break ; case NodeType . ALT : ListNode aln = ( ListNode ) node ; do { setupTree ( aln . value , ( state | IN_ALT ) ) ; } while ( ( aln = aln . tail ) != null ) ; break ; case NodeType . CCLASS : break ; case NodeType . STR : if ( isIgnoreCase ( regex . options ) && ! ( ( StringNode ) node ) . isRaw ( ) ) { node = expandCaseFoldString ( node ) ; } break ; case NodeType . CTYPE : case NodeType . CANY : break ; case NodeType . CALL : // if ( Config . USE _ SUBEXP _ CALL ) ? break ; case NodeType . BREF : BackRefNode br = ( BackRefNode ) node ; for ( int i = 0 ; i < br . backNum ; i ++ ) { if ( br . back [ i ] > env . numMem ) { if ( ! syntax . op3OptionECMAScript ( ) ) newValueException ( INVALID_BACKREF ) ; } else { env . backrefedMem = bsOnAt ( env . backrefedMem , br . back [ i ] ) ; env . btMemStart = bsOnAt ( env . btMemStart , br . back [ i ] ) ; if ( Config . USE_BACKREF_WITH_LEVEL ) { if ( br . isNestLevel ( ) ) { env . btMemEnd = bsOnAt ( env . btMemEnd , br . back [ i ] ) ; } } // USE _ BACKREF _ AT _ LEVEL env . memNodes [ br . back [ i ] ] . setMemBackrefed ( ) ; } } break ; case NodeType . QTFR : QuantifierNode qn = ( QuantifierNode ) node ; Node target = qn . target ; if ( ( state & IN_REPEAT ) != 0 ) qn . setInRepeat ( ) ; if ( isRepeatInfinite ( qn . upper ) || qn . lower >= 1 ) { int d = getMinMatchLength ( target ) ; if ( d == 0 ) { qn . targetEmptyInfo = TargetInfo . IS_EMPTY ; if ( Config . USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT ) { int info = quantifiersMemoryInfo ( target ) ; if ( info > 0 ) qn . targetEmptyInfo = info ; } // USE _ INFINITE _ REPEAT _ MONOMANIAC _ MEM _ STATUS _ CHECK // strange stuff here ( turned off ) } } state |= IN_REPEAT ; if ( qn . lower != qn . upper ) state |= IN_VAR_REPEAT ; target = setupTree ( target , state ) ; /* expand string */ if ( target . getType ( ) == NodeType . STR ) { StringNode sn = ( StringNode ) target ; if ( qn . lower > 1 ) { StringNode str = new StringNode ( sn . bytes , sn . p , sn . end ) ; str . flag = sn . flag ; int i ; int n = qn . lower ; int len = sn . length ( ) ; for ( i = 1 ; i < n && ( i + 1 ) * len <= EXPAND_STRING_MAX_LENGTH ; i ++ ) { str . catBytes ( sn . bytes , sn . p , sn . end ) ; } if ( i < qn . upper || isRepeatInfinite ( qn . upper ) ) { qn . lower -= i ; if ( ! isRepeatInfinite ( qn . upper ) ) qn . upper -= i ; ListNode list = ListNode . newList ( str , null ) ; qn . replaceWith ( list ) ; ListNode . listAdd ( list , qn ) ; } else { qn . replaceWith ( str ) ; } break ; } } if ( Config . USE_OP_PUSH_OR_JUMP_EXACT ) { if ( qn . greedy && qn . targetEmptyInfo != 0 ) { if ( target . getType ( ) == NodeType . QTFR ) { QuantifierNode tqn = ( QuantifierNode ) target ; if ( tqn . headExact != null ) { qn . headExact = tqn . headExact ; tqn . headExact = null ; } } else { qn . headExact = getHeadValueNode ( qn . target , true ) ; } } } // USE _ OP _ PUSH _ OR _ JUMP _ EXACT break ; case NodeType . ENCLOSE : EncloseNode en = ( EncloseNode ) node ; switch ( en . type ) { case EncloseType . OPTION : int options = regex . options ; regex . options = en . option ; setupTree ( en . target , state ) ; regex . options = options ; break ; case EncloseType . MEMORY : if ( ( state & ( IN_ALT | IN_NOT | IN_VAR_REPEAT | IN_CALL ) ) != 0 ) { env . btMemStart = bsOnAt ( env . btMemStart , en . regNum ) ; /* SET _ ENCLOSE _ STATUS ( node , NST _ MEM _ IN _ ALT _ NOT ) ; */ } if ( en . isCalled ( ) ) state |= IN_CALL ; if ( en . isRecursion ( ) ) { state |= IN_RECCALL ; } else if ( ( state & IN_RECCALL ) != 0 ) { en . setRecursion ( ) ; } setupTree ( en . target , state ) ; break ; case EncloseType . STOP_BACKTRACK : setupTree ( en . target , state ) ; if ( en . target . getType ( ) == NodeType . QTFR ) { QuantifierNode tqn = ( QuantifierNode ) en . target ; if ( isRepeatInfinite ( tqn . upper ) && tqn . lower <= 1 && tqn . greedy ) { /* ( ? > a * ) , a * + etc . . . */ if ( tqn . target . isSimple ( ) ) en . setStopBtSimpleRepeat ( ) ; } } break ; case EncloseNode . CONDITION : if ( Config . USE_NAMED_GROUP ) { if ( ! en . isNameRef ( ) && env . numNamed > 0 && syntax . captureOnlyNamedGroup ( ) && ! isCaptureGroup ( env . option ) ) { newValueException ( NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED ) ; } } if ( en . regNum > env . numMem ) newValueException ( INVALID_BACKREF ) ; setupTree ( en . target , state ) ; break ; case EncloseType . ABSENT : setupTree ( en . target , state ) ; break ; } // inner switch break ; case NodeType . ANCHOR : AnchorNode an = ( AnchorNode ) node ; switch ( an . type ) { case AnchorType . PREC_READ : setupTree ( an . target , state ) ; break ; case AnchorType . PREC_READ_NOT : setupTree ( an . target , ( state | IN_NOT ) ) ; break ; case AnchorType . LOOK_BEHIND : if ( checkTypeTree ( an . target , NodeType . ALLOWED_IN_LB , EncloseType . ALLOWED_IN_LB , AnchorType . ALLOWED_IN_LB ) ) newSyntaxException ( INVALID_LOOK_BEHIND_PATTERN ) ; node = setupLookBehind ( an ) ; if ( node . getType ( ) != NodeType . ANCHOR ) continue restart ; setupTree ( ( ( AnchorNode ) node ) . target , state ) ; node = setupLookBehind ( an ) ; break ; case AnchorType . LOOK_BEHIND_NOT : if ( checkTypeTree ( an . target , NodeType . ALLOWED_IN_LB , EncloseType . ALLOWED_IN_LB_NOT , AnchorType . ALLOWED_IN_LB_NOT ) ) newSyntaxException ( INVALID_LOOK_BEHIND_PATTERN ) ; node = setupLookBehind ( an ) ; if ( node . getType ( ) != NodeType . ANCHOR ) continue restart ; setupTree ( ( ( AnchorNode ) node ) . target , ( state | IN_NOT ) ) ; node = setupLookBehind ( an ) ; break ; } // inner switch break ; } // switch return node ; } // restart : while
public class BodyDumper { /** * impl of dumping response body to result * @ param result A map you want to put dump information to */ @ Override public void dumpResponse ( Map < String , Object > result ) { } }
byte [ ] responseBodyAttachment = exchange . getAttachment ( StoreResponseStreamSinkConduit . RESPONSE ) ; if ( responseBodyAttachment != null ) { this . bodyContent = config . isMaskEnabled ( ) ? Mask . maskJson ( new ByteArrayInputStream ( responseBodyAttachment ) , "responseBody" ) : new String ( responseBodyAttachment , UTF_8 ) ; } this . putDumpInfoTo ( result ) ;
public class PodsManagerConfigImpl { /** * Updates the deployed list for bfs configuration of the pods . * Any file in / config / pods named * . cf is a pod config file . */ private void updateBfsPath ( String [ ] list ) { } }
if ( list == null ) { list = new String [ 0 ] ; } PodsConfig podsConfig = parseConfig ( list ) ; if ( podsConfig != null ) { updatePodConfig ( podsConfig ) ; } updatePods ( ) ; if ( podsConfig != null && podsConfig . isBaseModified ( ) ) { _podsServiceImpl . updateConfig ( ) ; }
public class Slices { /** * Creates a slice over the specified array range . * @ param offset the array position at which the slice begins * @ param length the number of array positions to include in the slice */ public static Slice wrappedBooleanArray ( boolean [ ] array , int offset , int length ) { } }
if ( length == 0 ) { return EMPTY_SLICE ; } return new Slice ( array , offset , length ) ;
public class Iterables2 { /** * If we can assume the iterable is sorted , return the distinct elements . This only works * if the data provided is sorted . */ public static < T > Iterable < T > distinct ( final Iterable < T > iterable ) { } }
requireNonNull ( iterable ) ; return ( ) -> Iterators2 . distinct ( iterable . iterator ( ) ) ;
public class FineUploaderBasic { /** * Maximum allowable size , in bytes , for a file . * @ param nSizeLimit * Size limit . 0 = = unlimited * @ return this */ @ Nonnull public FineUploaderBasic setSizeLimit ( @ Nonnegative final int nSizeLimit ) { } }
ValueEnforcer . isGE0 ( nSizeLimit , "SizeLimit" ) ; m_nValidationSizeLimit = nSizeLimit ; return this ;
public class BatchUnit { /** * 执行shutdownHook */ public boolean shutdown ( ) { } }
LOG . debug ( "shutdownHook列表与unit列表是分开维护的,当前shutdownHook对象与目标unit对象不是同一个对象!" ) ; Unit batchUnitProxy = LocalUnitsManager . getLocalUnit ( getGroup ( ) . getName ( ) , getName ( ) ) ; BatchUnit batchUnit ; // in case the unit is proxied , which means if you want to flush the non - flushed cache list , you must get the most original object . if ( Proxy . isProxyClass ( batchUnitProxy . getClass ( ) ) ) { batchUnit = ( BatchUnit ) ProxyBuilder . getProxyBuilder ( batchUnitProxy . hashCode ( ) ) . getMostOriginalObject ( ) ; } else { batchUnit = ( BatchUnit ) batchUnitProxy ; } if ( ! batchUnit . recordCacheList . isEmpty ( ) ) { final Map < String , Object > recordCache = new HashMap < > ( ) ; synchronized ( batchUnit . recordCacheList ) { recordCache . put ( VALUES , new ArrayList < > ( batchUnit . recordCacheList ) ) ; recordCacheList . clear ( ) ; } SingleRxXian . call ( getBatchGroupName ( ) , getBatchUnitName ( ) , recordCache ) . blockingGet ( ) ; } return true ;
public class TranspositionDetector { /** * in case of an a , b / b , a transposition we have to determine whether a or b * stays put . the phrase with the most character stays still if the tokens are * not simple tokens the phrase with the most tokens stays put */ private int determineSize ( List < Match > t ) { } }
Match firstMatch = t . get ( 0 ) ; if ( ! ( firstMatch . token instanceof SimpleToken ) ) { return t . size ( ) ; } int charLength = 0 ; for ( Match m : t ) { SimpleToken token = ( SimpleToken ) m . token ; charLength += token . getNormalized ( ) . length ( ) ; } return charLength ;
public class DefaultJerseyOptions { /** * List of components to be registered ( features etc . ) * @ return */ @ Override public Set < Class < ? > > getComponents ( ) { } }
Set < Class < ? > > set = new HashSet < > ( ) ; ClassLoader cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; Consumer < JsonArray > reader = array -> { if ( array != null && array . size ( ) > 0 ) { for ( int i = 0 ; i < array . size ( ) ; i ++ ) { try { set . add ( cl . loadClass ( array . getString ( i ) ) ) ; } catch ( ClassNotFoundException e ) { throw new RuntimeException ( e ) ; } } } } ; JsonArray features = config . getJsonArray ( CONFIG_FEATURES , null ) ; JsonArray components = config . getJsonArray ( CONFIG_COMPONENTS , null ) ; reader . accept ( features ) ; reader . accept ( components ) ; return set ;
public class CreateApplicationBundleMojo { /** * Bundle project as a Mac OS X application bundle . * @ throws MojoExecutionException If an unexpected error occurs during * packaging of the bundle . */ public void execute ( ) throws MojoExecutionException { } }
// 1 . Create and set up directories getLog ( ) . info ( "Creating and setting up the bundle directories" ) ; buildDirectory . mkdirs ( ) ; File bundleDir = new File ( buildDirectory , bundleName + ".app" ) ; bundleDir . mkdirs ( ) ; File contentsDir = new File ( bundleDir , "Contents" ) ; contentsDir . mkdirs ( ) ; File resourcesDir = new File ( contentsDir , "Resources" ) ; resourcesDir . mkdirs ( ) ; File javaDirectory = new File ( contentsDir , "Java" ) ; javaDirectory . mkdirs ( ) ; File macOSDirectory = new File ( contentsDir , "MacOS" ) ; macOSDirectory . mkdirs ( ) ; // 2 . Copy in the native java application stub getLog ( ) . info ( "Copying the native Java Application Stub" ) ; File launcher = new File ( macOSDirectory , javaLauncherName ) ; launcher . setExecutable ( true ) ; FileOutputStream launcherStream = null ; try { launcherStream = new FileOutputStream ( launcher ) ; } catch ( FileNotFoundException ex ) { throw new MojoExecutionException ( "Could not copy file to directory " + launcher , ex ) ; } InputStream launcherResourceStream = this . getClass ( ) . getResourceAsStream ( javaLauncherName ) ; try { IOUtil . copy ( launcherResourceStream , launcherStream ) ; } catch ( IOException ex ) { throw new MojoExecutionException ( "Could not copy file " + javaLauncherName + " to directory " + macOSDirectory , ex ) ; } // 3 . Copy icon file to the bundle if specified if ( iconFile != null ) { File f = searchFile ( iconFile , project . getBasedir ( ) ) ; if ( f != null && f . exists ( ) && f . isFile ( ) ) { getLog ( ) . info ( "Copying the Icon File" ) ; try { FileUtils . copyFileToDirectory ( f , resourcesDir ) ; } catch ( IOException ex ) { throw new MojoExecutionException ( "Error copying file " + iconFile + " to " + resourcesDir , ex ) ; } } else { throw new MojoExecutionException ( String . format ( "Could not locate iconFile '%s'" , iconFile ) ) ; } } // 4 . Resolve and copy in all dependencies from the pom getLog ( ) . info ( "Copying dependencies" ) ; List < String > files = copyDependencies ( javaDirectory ) ; if ( additionalBundledClasspathResources != null && ! additionalBundledClasspathResources . isEmpty ( ) ) { files . addAll ( copyAdditionalBundledClasspathResources ( javaDirectory , "lib" , additionalBundledClasspathResources ) ) ; } // 5 . Check if JRE should be embedded . Check JRE path . Copy JRE if ( jrePath != null ) { File f = new File ( jrePath ) ; if ( f . exists ( ) && f . isDirectory ( ) ) { // Check if the source folder is a jdk - home File pluginsDirectory = new File ( contentsDir , "PlugIns/JRE/Contents/Home/jre" ) ; pluginsDirectory . mkdirs ( ) ; File sourceFolder = new File ( jrePath , "Contents/Home" ) ; if ( new File ( jrePath , "Contents/Home/jre" ) . exists ( ) ) { sourceFolder = new File ( jrePath , "Contents/Home/jre" ) ; } try { getLog ( ) . info ( "Copying the JRE Folder from : [" + sourceFolder + "] to PlugIn folder: [" + pluginsDirectory + "]" ) ; FileUtils . copyDirectoryStructure ( sourceFolder , pluginsDirectory ) ; File binFolder = new File ( pluginsDirectory , "bin" ) ; // Setting execute permissions on executables in JRE for ( String filename : binFolder . list ( ) ) { new File ( binFolder , filename ) . setExecutable ( true , false ) ; } new File ( pluginsDirectory , "lib/jspawnhelper" ) . setExecutable ( true , false ) ; embeddJre = true ; } catch ( IOException ex ) { throw new MojoExecutionException ( "Error copying folder " + f + " to " + pluginsDirectory , ex ) ; } } else { getLog ( ) . warn ( "JRE not found check jrePath setting in pom.xml" ) ; } } else if ( jreFullPath != null ) { getLog ( ) . info ( "JRE Full path is used [" + jreFullPath + "]" ) ; embeddJre = true ; } // 6 . Create and write the Info . plist file getLog ( ) . info ( "Writing the Info.plist file" ) ; File infoPlist = new File ( bundleDir , "Contents" + File . separator + "Info.plist" ) ; this . writeInfoPlist ( infoPlist , files ) ; // 7 . Copy specified additional resources into the top level directory getLog ( ) . info ( "Copying additional resources" ) ; if ( additionalResources != null && ! additionalResources . isEmpty ( ) ) { this . copyResources ( buildDirectory , additionalResources ) ; } // 7 . Make the stub executable if ( ! SystemUtils . IS_OS_WINDOWS ) { getLog ( ) . info ( "Making stub executable" ) ; Commandline chmod = new Commandline ( ) ; try { chmod . setExecutable ( "chmod" ) ; chmod . createArgument ( ) . setValue ( "755" ) ; chmod . createArgument ( ) . setValue ( launcher . getAbsolutePath ( ) ) ; chmod . execute ( ) ; } catch ( CommandLineException e ) { throw new MojoExecutionException ( "Error executing " + chmod + " " , e ) ; } } else { getLog ( ) . warn ( "The stub was created without executable file permissions for UNIX systems" ) ; } // 8 . Create the DMG file if ( generateDiskImageFile ) { if ( SystemUtils . IS_OS_MAC_OSX || SystemUtils . IS_OS_MAC ) { getLog ( ) . info ( "Generating the Disk Image file" ) ; Commandline dmg = new Commandline ( ) ; try { // user wants / Applications symlink in the resulting disk image if ( includeApplicationsSymlink ) { createApplicationsSymlink ( ) ; } dmg . setExecutable ( "hdiutil" ) ; dmg . createArgument ( ) . setValue ( "create" ) ; dmg . createArgument ( ) . setValue ( "-srcfolder" ) ; dmg . createArgument ( ) . setValue ( buildDirectory . getAbsolutePath ( ) ) ; dmg . createArgument ( ) . setValue ( diskImageFile . getAbsolutePath ( ) ) ; try { dmg . execute ( ) . waitFor ( ) ; } catch ( InterruptedException ex ) { throw new MojoExecutionException ( "Thread was interrupted while creating DMG " + diskImageFile , ex ) ; } finally { if ( includeApplicationsSymlink ) { removeApplicationsSymlink ( ) ; } } } catch ( CommandLineException ex ) { throw new MojoExecutionException ( "Error creating disk image " + diskImageFile , ex ) ; } if ( diskImageInternetEnable ) { getLog ( ) . info ( "Enabling the Disk Image file for internet" ) ; try { Commandline internetEnableCommand = new Commandline ( ) ; internetEnableCommand . setExecutable ( "hdiutil" ) ; internetEnableCommand . createArgument ( ) . setValue ( "internet-enable" ) ; internetEnableCommand . createArgument ( ) . setValue ( "-yes" ) ; internetEnableCommand . createArgument ( ) . setValue ( diskImageFile . getAbsolutePath ( ) ) ; internetEnableCommand . execute ( ) ; } catch ( CommandLineException ex ) { throw new MojoExecutionException ( "Error internet enabling disk image: " + diskImageFile , ex ) ; } } projectHelper . attachArtifact ( project , "dmg" , null , diskImageFile ) ; } if ( SystemUtils . IS_OS_LINUX ) { getLog ( ) . info ( "Generating the Disk Image file" ) ; Commandline linux_dmg = new Commandline ( ) ; try { linux_dmg . setExecutable ( "genisoimage" ) ; linux_dmg . createArgument ( ) . setValue ( "-V" ) ; linux_dmg . createArgument ( ) . setValue ( bundleName ) ; linux_dmg . createArgument ( ) . setValue ( "-D" ) ; linux_dmg . createArgument ( ) . setValue ( "-R" ) ; linux_dmg . createArgument ( ) . setValue ( "-apple" ) ; linux_dmg . createArgument ( ) . setValue ( "-no-pad" ) ; linux_dmg . createArgument ( ) . setValue ( "-o" ) ; linux_dmg . createArgument ( ) . setValue ( diskImageFile . getAbsolutePath ( ) ) ; linux_dmg . createArgument ( ) . setValue ( buildDirectory . getAbsolutePath ( ) ) ; try { linux_dmg . execute ( ) . waitFor ( ) ; } catch ( InterruptedException ex ) { throw new MojoExecutionException ( "Thread was interrupted while creating DMG " + diskImageFile , ex ) ; } } catch ( CommandLineException ex ) { throw new MojoExecutionException ( "Error creating disk image " + diskImageFile + " genisoimage probably missing" , ex ) ; } projectHelper . attachArtifact ( project , "dmg" , null , diskImageFile ) ; } else { getLog ( ) . warn ( "Disk Image file cannot be generated in non Mac OS X and Linux environments" ) ; } } getLog ( ) . info ( "App Bundle generation finished" ) ;
public class Log { public void debug ( final Throwable t , final String message , final Object ... args ) { } }
if ( wrappedLogger . isDebugEnabled ( ) ) { wrappedLogger . debug ( String . format ( message , args ) , t ) ; }
public class JournalNodeHttpServer { /** * Send string output when serving http request . * @ param output data to be sent * @ param response http response * @ throws IOException */ static void sendResponse ( String output , HttpServletResponse response ) throws IOException { } }
PrintWriter out = null ; try { out = response . getWriter ( ) ; out . write ( output ) ; } finally { if ( out != null ) { out . close ( ) ; } }
public class CachingBpSchedule { /** * Filters edges from a leaf node . */ @ SuppressWarnings ( "unchecked" ) private static List < Object > filterConstantMsgs ( List < Object > order , FactorGraph fg ) { } }
ArrayList < Object > filt = new ArrayList < Object > ( ) ; for ( Object item : order ) { if ( item instanceof List ) { List < Object > items = filterConstantMsgs ( ( List < Object > ) item , fg ) ; if ( items . size ( ) > 0 ) { filt . add ( items ) ; } } else if ( item instanceof Integer ) { // If the parent node is not a leaf . if ( ! isConstantMsg ( ( Integer ) item , fg ) ) { filt . add ( item ) ; } } else if ( item instanceof GlobalFactor ) { filt . add ( item ) ; } else { throw new RuntimeException ( "Invalid type in order: " + item . getClass ( ) ) ; } } return filt ;
public class AmazonWorkLinkClient { /** * Retrieves a list of certificate authorities added for the current account and Region . * @ param listWebsiteCertificateAuthoritiesRequest * @ return Result of the ListWebsiteCertificateAuthorities operation returned by the service . * @ throws UnauthorizedException * You are not authorized to perform this action . * @ throws InternalServerErrorException * The service is temporarily unavailable . * @ throws InvalidRequestException * The request is not valid . * @ throws TooManyRequestsException * The number of requests exceeds the limit . * @ sample AmazonWorkLink . ListWebsiteCertificateAuthorities * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / worklink - 2018-09-25 / ListWebsiteCertificateAuthorities " * target = " _ top " > AWS API Documentation < / a > */ @ Override public ListWebsiteCertificateAuthoritiesResult listWebsiteCertificateAuthorities ( ListWebsiteCertificateAuthoritiesRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeListWebsiteCertificateAuthorities ( request ) ;
public class MiniTemplator { /** * Sets an optional template variable to an integer value . * Convenience method for : < code > setVariableOpt ( variableName , Integer . toString ( variableValue ) ) < / code > * @ param variableName the name of the variable to be set . Case - insensitive . * @ param variableValue the new value of the variable . */ public void setVariableOpt ( String variableName , int variableValue ) { } }
// We want to avoid the integer to string conversion if the template variable does not exist . int varNo = mtp . lookupVariableName ( variableName ) ; if ( varNo == - 1 ) { return ; } varValuesTab [ varNo ] = Integer . toString ( variableValue ) ;
public class DefaultRewriteContentHandler { /** * Extracts media metadata from the DOM element attributes and resolves them to a { @ link Media } object . * @ param element DOM element * @ return Media metadata */ private Media getImageMedia ( Element element ) { } }
String ref = element . getAttributeValue ( "src" ) ; if ( StringUtils . isNotEmpty ( ref ) ) { ref = unexternalizeImageRef ( ref ) ; } return mediaHandler . get ( ref ) . build ( ) ;
public class CmsContainerConfigurationGroup { /** * Gets the configuration for a given name and locale . < p > * @ param name the configuration name * @ return the configuration for the name and locale */ public CmsContainerConfiguration getConfiguration ( String name ) { } }
Map < String , CmsContainerConfiguration > configurationsForLocale = null ; if ( m_configurations . containsKey ( CmsLocaleManager . MASTER_LOCALE ) ) { configurationsForLocale = m_configurations . get ( CmsLocaleManager . MASTER_LOCALE ) ; } else if ( ! m_configurations . isEmpty ( ) ) { configurationsForLocale = m_configurations . values ( ) . iterator ( ) . next ( ) ; } else { return null ; } return configurationsForLocale . get ( name ) ;
public class AbstractBaseLocalServerComponent { /** * Checks component has come up every 3 seconds . Waits for the component for a maximum of 60 seconds . Throws an * { @ link IllegalStateException } if the component can not be contacted */ private void waitForComponentToComeUp ( ) { } }
LOGGER . entering ( ) ; for ( int i = 0 ; i < 60 ; i ++ ) { try { // Sleep for 3 seconds . Thread . sleep ( 1000 ) ; } catch ( InterruptedException e ) { throw new IllegalStateException ( e . getMessage ( ) , e ) ; } if ( getLauncher ( ) . isRunning ( ) ) { LOGGER . exiting ( ) ; return ; } } throw new IllegalStateException ( String . format ( "%s can not be contacted." , getLocalServerComponent ( ) . getClass ( ) . getSimpleName ( ) ) ) ;
public class SanitizePackage { /** * The NPM Audit API only accepts a modified version of package - lock . json . * This method will make the necessary modifications in - memory , sanitizing * non - public dependencies by omitting them , and returns a new ' sanitized ' * version . * @ param packageJson a raw package - lock . json file * @ return a modified / sanitized version of the package - lock . json file */ public static JsonObject sanitize ( JsonObject packageJson ) { } }
final JsonObjectBuilder payloadBuilder = Json . createObjectBuilder ( ) ; final String projectName = packageJson . getString ( "name" , "" ) ; final String projectVersion = packageJson . getString ( "version" , "" ) ; if ( ! projectName . isEmpty ( ) ) { payloadBuilder . add ( "name" , projectName ) ; } if ( ! projectVersion . isEmpty ( ) ) { payloadBuilder . add ( "version" , projectVersion ) ; } // In most package - lock . json files , ' requires ' is a boolean , however , NPM Audit expects // ' requires ' to be an object containing key / value pairs corresponding to the module // name ( key ) and version ( value ) . final JsonValue jsonValue = packageJson . get ( "requires" ) ; if ( jsonValue . getValueType ( ) != JsonValue . ValueType . OBJECT ) { final JsonObjectBuilder requiresBuilder = Json . createObjectBuilder ( ) ; final JsonObject dependencies = packageJson . getJsonObject ( "dependencies" ) ; for ( String moduleName : dependencies . keySet ( ) ) { final JsonObject module = dependencies . getJsonObject ( moduleName ) ; final String version = module . getString ( "version" ) ; requiresBuilder . add ( moduleName , version ) ; } payloadBuilder . add ( "requires" , requiresBuilder . build ( ) ) ; } payloadBuilder . add ( "dependencies" , packageJson . getJsonObject ( "dependencies" ) ) ; payloadBuilder . add ( "install" , Json . createArrayBuilder ( ) . build ( ) ) ; payloadBuilder . add ( "remove" , Json . createArrayBuilder ( ) . build ( ) ) ; payloadBuilder . add ( "metadata" , Json . createObjectBuilder ( ) . add ( "npm_version" , "6.1.0" ) . add ( "node_version" , "v10.5.0" ) . add ( "platform" , "linux" ) ) ; // Create a new ' package - lock . json ' object return payloadBuilder . build ( ) ;
public class GenMapAndTopicListModule { /** * Prefix path . * @ param relativeRootFile relative path for root temporary file * @ return either an empty string or a path which ends in { @ link java . io . File # separator File . separator } */ private String getPrefix ( final File relativeRootFile ) { } }
String res ; final File p = relativeRootFile . getParentFile ( ) ; if ( p != null ) { res = p . toString ( ) + File . separator ; } else { res = "" ; } return res ;
public class CodeLocations { /** * Get absolute path from URL objects starting with file : * This method takes care of decoding % - encoded chars , e . g . % 20 - > space etc * Since we do not use a File object , the system specific path encoding * is not used ( e . g . C : \ on Windows ) . This is necessary to facilitate * the removal of a class file with path in codeLocationFromClass * @ param url the file - URL * @ return String absolute decoded path * @ throws InvalidCodeLocation if URL contains format errors */ public static String getPathFromURL ( URL url ) { } }
URI uri ; try { uri = url . toURI ( ) ; } catch ( URISyntaxException e ) { // this will probably not happen since the url was created // from a filename beforehand throw new InvalidCodeLocation ( e . toString ( ) ) ; } if ( uri . toString ( ) . startsWith ( "file:" ) || uri . toString ( ) . startsWith ( "jar:" ) ) { return removeStart ( uri . getSchemeSpecificPart ( ) , "file:" ) ; } else { // this is wrong , but should at least give a // helpful error when trying to open the file later return uri . toString ( ) ; }
public class DigestUtils { /** * Append a hexadecimal string representation of the MD5 digest of the given inputStream to the given { @ link * StringBuilder } . * @ param inputStream the inputStream to calculate the digest over . * @ param builder the string builder to append the digest to . * @ return the given string builder . */ public static StringBuilder appendMd5DigestAsHex ( InputStream inputStream , StringBuilder builder ) throws IOException { } }
return appendDigestAsHex ( MD5_ALGORITHM_NAME , inputStream , builder ) ;
public class StatsApi { /** * Get the number of views on a photoset for a given date . * This method requires authentication with ' read ' permission . * @ param date stats will be returned for this date . Required . * @ param photosetId id of the photoset to get stats for . Required . * @ return number of views on a photoset for a given date . * @ throws JinxException if required parameters are missing , or if there are any errors . * @ see < a href = " https : / / www . flickr . com / services / api / flickr . stats . getPhotosetStats . html " > flickr . stats . getPhotosetStats < / a > */ public Stats getPhotosetStats ( Date date , String photosetId ) throws JinxException { } }
JinxUtils . validateParams ( date , photosetId ) ; Map < String , String > params = new TreeMap < > ( ) ; params . put ( "method" , "flickr.stats.getPhotosetStats" ) ; params . put ( "date" , JinxUtils . formatDateAsYMD ( date ) ) ; params . put ( "photoset_id" , photosetId ) ; return jinx . flickrGet ( params , Stats . class ) ;
public class CastedExpressionTypeComputationState { /** * Compute the best candidates for the feature behind the cast operator . * @ param cast the cast operator . * @ return the candidates . */ public List < ? extends ILinkingCandidate > getLinkingCandidates ( SarlCastedExpression cast ) { } }
// Prepare the type resolver . final StackedResolvedTypes demandComputedTypes = pushTypes ( ) ; final AbstractTypeComputationState forked = withNonVoidExpectation ( demandComputedTypes ) ; final ForwardingResolvedTypes demandResolvedTypes = new ForwardingResolvedTypes ( ) { @ Override protected IResolvedTypes delegate ( ) { return forked . getResolvedTypes ( ) ; } @ Override public LightweightTypeReference getActualType ( XExpression expression ) { final LightweightTypeReference type = super . getActualType ( expression ) ; if ( type == null ) { final ITypeComputationResult result = forked . computeTypes ( expression ) ; return result . getActualExpressionType ( ) ; } return type ; } } ; // Create the scope final IScope scope = getCastScopeSession ( ) . getScope ( cast , // Must be the feature of the AbstractFeatureCall in order to enable the scoping for a function call . // XbasePackage . Literals . XABSTRACT _ FEATURE _ CALL _ _ FEATURE , SarlPackage . Literals . SARL_CASTED_EXPRESSION__FEATURE , demandResolvedTypes ) ; // Search for the features into the scope final LightweightTypeReference targetType = getReferenceOwner ( ) . toLightweightTypeReference ( cast . getType ( ) ) ; final List < ILinkingCandidate > resultList = Lists . newArrayList ( ) ; final LightweightTypeReference expressionType = getStackedResolvedTypes ( ) . getActualType ( cast . getTarget ( ) ) ; final ISelector validator = this . candidateValidator . prepare ( getParent ( ) , targetType , expressionType ) ; // FIXME : The call to getAllElements ( ) is not efficient ; find another way in order to be faster . for ( final IEObjectDescription description : scope . getAllElements ( ) ) { final IIdentifiableElementDescription idesc = toIdentifiableDescription ( description ) ; if ( validator . isCastOperatorCandidate ( idesc ) ) { final ExpressionAwareStackedResolvedTypes descriptionResolvedTypes = pushTypes ( cast ) ; final ExpressionTypeComputationState descriptionState = createExpressionComputationState ( cast , descriptionResolvedTypes ) ; final ILinkingCandidate candidate = createCandidate ( cast , descriptionState , idesc ) ; if ( candidate != null ) { resultList . add ( candidate ) ; } } } return resultList ;
public class ToolbarLarge { /** * Sets the width of the navigation . * @ param width * The width , which should be set , in pixels as an { @ link Integer } value . The width must * be greater than 0 */ public final void setNavigationWidth ( @ Px final int width ) { } }
Condition . INSTANCE . ensureGreater ( width , 0 , "The width must be greater than 0" ) ; this . navigationWidth = width ; if ( ! isNavigationHidden ( ) ) { RelativeLayout . LayoutParams layoutParams = ( RelativeLayout . LayoutParams ) toolbar . getLayoutParams ( ) ; layoutParams . width = width ; toolbar . requestLayout ( ) ; }
public class HTODInvalidationBuffer { /** * Call this method to filter out the specified collection of cache ids based on invalidation buffers . * @ param filterValueSet * - a collection of cache ids , */ protected synchronized void filter ( ValueSet filterValueSet ) { } }
boolean explicitBufferEmpty = this . explicitBuffer . isEmpty ( ) ; boolean scanBufferEmpty = this . scanBuffer . isEmpty ( ) ; if ( filterValueSet != null && ! filterValueSet . isEmpty ( ) && ( ! explicitBufferEmpty || ! scanBufferEmpty ) ) { Iterator it = filterValueSet . iterator ( ) ; while ( it . hasNext ( ) ) { Object o = it . next ( ) ; if ( ! explicitBufferEmpty && this . explicitBuffer . containsKey ( o ) ) { it . remove ( ) ; } else if ( ! scanBufferEmpty && this . scanBuffer . contains ( o ) ) { it . remove ( ) ; } } }
public class ContainerClassLoader { /** * Add all the artifact containers to the class path */ protected void addToClassPath ( Iterable < ArtifactContainer > artifacts ) { } }
for ( ArtifactContainer art : artifacts ) { smartClassPath . addArtifactContainer ( art ) ; }
public class Callstacks { /** * Prints call stack with the specified logging level . * @ param logLevel the specified logging level * @ param carePackages the specified packages to print , for example , [ " org . b3log . latke " , " org . b3log . solo " ] , { @ code null } to care * nothing * @ param exceptablePackages the specified packages to skip , for example , [ " com . sun " , " java . io " , " org . b3log . solo . filter " ] , * { @ code null } to skip nothing */ public static void printCallstack ( final Level logLevel , final String [ ] carePackages , final String [ ] exceptablePackages ) { } }
if ( null == logLevel ) { LOGGER . log ( Level . WARN , "Requires parameter [logLevel]" ) ; return ; } final Throwable throwable = new Throwable ( ) ; final StackTraceElement [ ] stackElements = throwable . getStackTrace ( ) ; if ( null == stackElements ) { LOGGER . log ( Level . WARN , "Empty call stack" ) ; return ; } final long tId = Thread . currentThread ( ) . getId ( ) ; final StringBuilder stackBuilder = new StringBuilder ( "CallStack [tId=" ) . append ( tId ) . append ( Strings . LINE_SEPARATOR ) ; for ( int i = 1 ; i < stackElements . length ; i ++ ) { final String stackElemClassName = stackElements [ i ] . getClassName ( ) ; if ( ! StringUtils . startsWithAny ( stackElemClassName , carePackages ) || StringUtils . startsWithAny ( stackElemClassName , exceptablePackages ) ) { continue ; } stackBuilder . append ( " [className=" ) . append ( stackElements [ i ] . getClassName ( ) ) . append ( ", fileName=" ) . append ( stackElements [ i ] . getFileName ( ) ) . append ( ", lineNumber=" ) . append ( stackElements [ i ] . getLineNumber ( ) ) . append ( ", methodName=" ) . append ( stackElements [ i ] . getMethodName ( ) ) . append ( ']' ) . append ( Strings . LINE_SEPARATOR ) ; } stackBuilder . append ( "], full depth [" ) . append ( stackElements . length ) . append ( "]" ) ; LOGGER . log ( logLevel , stackBuilder . toString ( ) ) ;
public class ObjectsShouldInternal { /** * A ClassesTransformer < ? extends T > is in particular a ClassesTransformer < T > ( covariance ) */ @ SuppressWarnings ( "unchecked" ) private ClassesTransformer < T > getTyped ( ClassesTransformer < ? extends T > classesTransformer ) { } }
return ( ClassesTransformer < T > ) classesTransformer ;
public class MainFrame { /** * This is overridden for changing the font size */ @ Override public void addNotify ( ) { } }
super . addNotify ( ) ; float size = Driver . getFontSize ( ) ; JMenuBar menubar = getJMenuBar ( ) ; if ( menubar != null ) { menubar . setFont ( menubar . getFont ( ) . deriveFont ( size ) ) ; for ( int i = 0 ; i < menubar . getMenuCount ( ) ; i ++ ) { for ( int j = 0 ; j < menubar . getMenu ( i ) . getMenuComponentCount ( ) ; j ++ ) { Component temp = menubar . getMenu ( i ) . getMenuComponent ( j ) ; temp . setFont ( temp . getFont ( ) . deriveFont ( size ) ) ; } } mainFrameTree . updateFonts ( size ) ; }
public class HtmlDoclet { /** * Start the generation of files . Call generate methods in the individual * writers , which will in turn genrate the documentation files . Call the * TreeWriter generation first to ensure the Class Hierarchy is built * first and then can be used in the later generation . * For new format . * @ see com . sun . javadoc . RootDoc */ protected void generateOtherFiles ( RootDoc root , ClassTree classtree ) throws Exception { } }
super . generateOtherFiles ( root , classtree ) ; if ( configuration . linksource ) { SourceToHTMLConverter . convertRoot ( configuration , root , DocPaths . SOURCE_OUTPUT ) ; } if ( configuration . topFile . isEmpty ( ) ) { configuration . standardmessage . error ( "doclet.No_Non_Deprecated_Classes_To_Document" ) ; return ; } boolean nodeprecated = configuration . nodeprecated ; performCopy ( configuration . helpfile ) ; performCopy ( configuration . stylesheetfile ) ; // do early to reduce memory footprint if ( configuration . classuse ) { ClassUseWriter . generate ( configuration , classtree ) ; } IndexBuilder indexbuilder = new IndexBuilder ( configuration , nodeprecated ) ; if ( configuration . createtree ) { TreeWriter . generate ( configuration , classtree ) ; } if ( configuration . createindex ) { configuration . buildSearchTagIndex ( ) ; if ( configuration . splitindex ) { SplitIndexWriter . generate ( configuration , indexbuilder ) ; } else { SingleIndexWriter . generate ( configuration , indexbuilder ) ; } } if ( ! ( configuration . nodeprecatedlist || nodeprecated ) ) { DeprecatedListWriter . generate ( configuration ) ; } AllClassesFrameWriter . generate ( configuration , new IndexBuilder ( configuration , nodeprecated , true ) ) ; FrameOutputWriter . generate ( configuration ) ; if ( configuration . createoverview ) { PackageIndexWriter . generate ( configuration ) ; } if ( configuration . helpfile . length ( ) == 0 && ! configuration . nohelp ) { HelpWriter . generate ( configuration ) ; } // If a stylesheet file is not specified , copy the default stylesheet // and replace newline with platform - specific newline . DocFile f ; if ( configuration . stylesheetfile . length ( ) == 0 ) { f = DocFile . createFileForOutput ( configuration , DocPaths . STYLESHEET ) ; f . copyResource ( DocPaths . RESOURCES . resolve ( DocPaths . STYLESHEET ) , false , true ) ; } f = DocFile . createFileForOutput ( configuration , DocPaths . JAVASCRIPT ) ; f . copyResource ( DocPaths . RESOURCES . resolve ( DocPaths . JAVASCRIPT ) , true , true ) ; if ( configuration . createindex ) { f = DocFile . createFileForOutput ( configuration , DocPaths . SEARCH_JS ) ; f . copyResource ( DocPaths . RESOURCES . resolve ( DocPaths . SEARCH_JS ) , true , true ) ; f = DocFile . createFileForOutput ( configuration , DocPaths . RESOURCES . resolve ( DocPaths . GLASS_IMG ) ) ; f . copyResource ( DocPaths . RESOURCES . resolve ( DocPaths . GLASS_IMG ) , true , false ) ; f = DocFile . createFileForOutput ( configuration , DocPaths . RESOURCES . resolve ( DocPaths . X_IMG ) ) ; f . copyResource ( DocPaths . RESOURCES . resolve ( DocPaths . X_IMG ) , true , false ) ; copyJqueryFiles ( ) ; }
public class ConfigService { /** * Method to modify the Postgres config postgresql . conf based on key - value pairs * @ param filename The filename of the config to be updated . * @ param keyValuePairs A map of key - value pairs . */ public static void changeProperty ( String filename , Map < String , Object > keyValuePairs ) throws IOException { } }
if ( keyValuePairs . size ( ) == 0 ) { return ; } final File file = new File ( filename ) ; final File tmpFile = new File ( file + ".tmp" ) ; PrintWriter pw = new PrintWriter ( tmpFile ) ; BufferedReader br = new BufferedReader ( new FileReader ( file ) ) ; Set < String > keys = keyValuePairs . keySet ( ) ; List < String > inConfig = new ArrayList < > ( ) ; for ( String line ; ( line = br . readLine ( ) ) != null ; ) { int keyPos = line . indexOf ( '=' ) ; if ( keyPos > - 1 ) { String key = line . substring ( 0 , keyPos ) . trim ( ) ; if ( ! key . trim ( ) . startsWith ( "#" ) && keys . contains ( key ) && ! inConfig . contains ( key ) ) { // Check if the line has any comments . Split by ' # ' to funs all tokens . String [ ] keyValuePair = line . split ( "=" ) ; StringBuilder lineBuilder = new StringBuilder ( ) ; lineBuilder . append ( keyValuePair [ 0 ] . trim ( ) ) . append ( " = " ) . append ( keyValuePairs . get ( key ) ) ; line = lineBuilder . toString ( ) ; inConfig . add ( key ) ; } } pw . println ( line ) ; } for ( String key : keys ) { if ( ! inConfig . contains ( key ) ) { StringBuilder lineBuilder = new StringBuilder ( ) ; lineBuilder . append ( key ) . append ( " = " ) . append ( keyValuePairs . get ( key ) ) ; pw . println ( lineBuilder . toString ( ) ) ; } } br . close ( ) ; pw . close ( ) ; file . delete ( ) ; tmpFile . renameTo ( file ) ;
public class AbstractCompiler { /** * httl . properties : code . directory = / tmp / javacode */ public void setCodeDirectory ( String codeDirectory ) { } }
if ( codeDirectory != null && codeDirectory . trim ( ) . length ( ) > 0 ) { File file = new File ( codeDirectory ) ; if ( file . exists ( ) || file . mkdirs ( ) ) { this . codeDirectory = file ; } }
public class JobUtils { /** * Waits for a job V3 to complete * @ param cloudFoundryClient the client to use to request job status * @ param completionTimeout the amount of time to wait for the job to complete . * @ param jobId the id of the job * @ return { @ code onComplete } once job has completed */ public static Mono < Void > waitForCompletion ( CloudFoundryClient cloudFoundryClient , Duration completionTimeout , String jobId ) { } }
return requestJobV3 ( cloudFoundryClient , jobId ) . filter ( job -> JobState . PROCESSING != job . getState ( ) ) . repeatWhenEmpty ( exponentialBackOff ( Duration . ofSeconds ( 1 ) , Duration . ofSeconds ( 15 ) , completionTimeout ) ) . filter ( job -> JobState . FAILED == job . getState ( ) ) . flatMap ( JobUtils :: getError ) ;
public class DACLAssertor { /** * Fetches the DACL of the object which is evaluated by { @ linkplain doAssert } * @ throws CommunicationException * @ throws NameNotFoundException * @ throws NamingException */ private void getDACL ( ) throws NamingException { } }
final SearchControls controls = new SearchControls ( ) ; controls . setSearchScope ( SearchControls . SUBTREE_SCOPE ) ; controls . setReturningAttributes ( new String [ ] { "name" , "nTSecurityDescriptor" } ) ; if ( ldapContext == null ) { LOG . warn ( "getDACL, cannot search for DACL with null ldapContext" ) ; throw new CommunicationException ( "NULL ldapContext" ) ; } ldapContext . setRequestControls ( new Control [ ] { new SDFlagsControl ( 0x00000004 ) } ) ; LOG . debug ( "getDACL, attempting to fetch SD for searchFilter: {}, ldapContext: {}" , searchFilter , ldapContext . getNameInNamespace ( ) ) ; NamingEnumeration < SearchResult > results = null ; try { results = ldapContext . search ( "" , searchFilter , controls ) ; if ( ! results . hasMoreElements ( ) ) { LOG . warn ( "getDACL, searchFilter '{}' found nothing in context '{}'" , searchFilter , ldapContext . getNameInNamespace ( ) ) ; throw new NameNotFoundException ( "No results found for: " + searchFilter ) ; } SearchResult res = results . next ( ) ; if ( results . hasMoreElements ( ) ) { // result from search filter is not unique throw new SizeLimitExceededException ( "The search filter '{}' matched more than one AD object" ) ; } final byte [ ] descbytes = ( byte [ ] ) res . getAttributes ( ) . get ( "nTSecurityDescriptor" ) . get ( ) ; final SDDL sddl = new SDDL ( descbytes ) ; dacl = sddl . getDacl ( ) ; LOG . debug ( "getDACL, fetched SD & parsed DACL for searchFilter: {}, ldapContext: {}" , searchFilter , ldapContext . getNameInNamespace ( ) ) ; } finally { try { if ( results != null ) { results . close ( ) ; } } catch ( NamingException e ) { LOG . debug ( "NamingException occurred while closing results: " , e ) ; } }
public class SpringQueryInputProcessor { /** * Parse the SQL statement and locate any placeholders or named parameters . * Named parameters are substituted for a JDBC placeholder and any select list * is expanded to the required number of placeholders . Select lists may contain * an array of objects and in that case the placeholders will be grouped and * enclosed with parantheses . This allows for the use of " expression lists " in * the SQL statement like : < br / > * select id , name , state from table where ( name , age ) in ( ( ' John ' , 35 ) , ( ' Ann ' , 50 ) ) * < p > The parameter values passed in are used to determine the number of * placeholder to be used for a select list . Select lists should be limited * to 100 or fewer elements . A larger number of elements is not guaramteed to * be supported by the database and is strictly vendor - dependent . * @ param processedInput processed Input which stores original SQL and parsed SQL parameters * @ return the SQL statement with substituted parameters */ private String generateParsedSql ( ProcessedInput processedInput ) { } }
String originalSql = processedInput . getOriginalSql ( ) ; StringBuilder actualSql = new StringBuilder ( ) ; List paramNames = processedInput . getSqlParameterNames ( ) ; int lastIndex = 0 ; for ( int i = 0 ; i < paramNames . size ( ) ; i ++ ) { int [ ] indexes = processedInput . getSqlParameterBoundaries ( ) . get ( i ) ; int startIndex = indexes [ 0 ] ; int endIndex = indexes [ 1 ] ; actualSql . append ( originalSql . substring ( lastIndex , startIndex ) ) ; actualSql . append ( "?" ) ; lastIndex = endIndex ; } actualSql . append ( originalSql . substring ( lastIndex , originalSql . length ( ) ) ) ; return actualSql . toString ( ) ;
public class ListT { /** * / * ( non - Javadoc ) * @ see cyclops2 . monads . transformers . values . ListT # distinct ( ) */ @ Override public ListT < W , T > distinct ( ) { } }
return ( ListT < W , T > ) FoldableTransformerSeq . super . distinct ( ) ;
public class JingleS5BTransportSession { /** * Determine , which candidate ( ours / theirs ) is the nominated one . * Connect to this candidate . If it is a proxy and it is ours , activate it and connect . * If its a proxy and it is theirs , wait for activation . * If it is not a proxy , just connect . */ private void connectIfReady ( ) { } }
JingleContent content = jingleSession . getContents ( ) . get ( 0 ) ; if ( ourChoice == null || theirChoice == null ) { // Not yet ready . LOGGER . log ( Level . INFO , "Not ready." ) ; return ; } if ( ourChoice == CANDIDATE_FAILURE && theirChoice == CANDIDATE_FAILURE ) { LOGGER . log ( Level . INFO , "Failure." ) ; jingleSession . onTransportMethodFailed ( getNamespace ( ) ) ; return ; } LOGGER . log ( Level . INFO , "Ready." ) ; // Determine nominated candidate . UsedCandidate nominated ; if ( ourChoice != CANDIDATE_FAILURE && theirChoice != CANDIDATE_FAILURE ) { if ( ourChoice . candidate . getPriority ( ) > theirChoice . candidate . getPriority ( ) ) { nominated = ourChoice ; } else if ( ourChoice . candidate . getPriority ( ) < theirChoice . candidate . getPriority ( ) ) { nominated = theirChoice ; } else { nominated = jingleSession . isInitiator ( ) ? ourChoice : theirChoice ; } } else if ( ourChoice != CANDIDATE_FAILURE ) { nominated = ourChoice ; } else { nominated = theirChoice ; } if ( nominated == theirChoice ) { LOGGER . log ( Level . INFO , "Their choice, so our proposed candidate is used." ) ; boolean isProxy = nominated . candidate . getType ( ) == JingleS5BTransportCandidate . Type . proxy ; try { nominated = connectToOurCandidate ( nominated . candidate ) ; } catch ( InterruptedException | IOException | XMPPException | SmackException | TimeoutException e ) { LOGGER . log ( Level . INFO , "Could not connect to our candidate." , e ) ; // TODO : Proxy - Error return ; } if ( isProxy ) { LOGGER . log ( Level . INFO , "Is external proxy. Activate it." ) ; Bytestream activate = new Bytestream ( ourProposal . getStreamId ( ) ) ; activate . setMode ( null ) ; activate . setType ( IQ . Type . set ) ; activate . setTo ( nominated . candidate . getJid ( ) ) ; activate . setToActivate ( jingleSession . getRemote ( ) ) ; activate . setFrom ( jingleSession . getLocal ( ) ) ; try { jingleSession . getConnection ( ) . createStanzaCollectorAndSend ( activate ) . nextResultOrThrow ( ) ; } catch ( InterruptedException | XMPPException . XMPPErrorException | SmackException . NotConnectedException | SmackException . NoResponseException e ) { LOGGER . log ( Level . WARNING , "Could not activate proxy." , e ) ; return ; } LOGGER . log ( Level . INFO , "Send candidate-activate." ) ; Jingle candidateActivate = transportManager ( ) . createCandidateActivated ( jingleSession . getRemote ( ) , jingleSession . getInitiator ( ) , jingleSession . getSessionId ( ) , content . getSenders ( ) , content . getCreator ( ) , content . getName ( ) , nominated . transport . getStreamId ( ) , nominated . candidate . getCandidateId ( ) ) ; try { jingleSession . getConnection ( ) . createStanzaCollectorAndSend ( candidateActivate ) . nextResultOrThrow ( ) ; } catch ( InterruptedException | XMPPException . XMPPErrorException | SmackException . NotConnectedException | SmackException . NoResponseException e ) { LOGGER . log ( Level . WARNING , "Could not send candidate-activated" , e ) ; return ; } } LOGGER . log ( Level . INFO , "Start transmission." ) ; Socks5BytestreamSession bs = new Socks5BytestreamSession ( nominated . socket , ! isProxy ) ; callback . onSessionInitiated ( bs ) ; } // Our choice else { LOGGER . log ( Level . INFO , "Our choice, so their candidate was used." ) ; boolean isProxy = nominated . candidate . getType ( ) == JingleS5BTransportCandidate . Type . proxy ; if ( ! isProxy ) { LOGGER . log ( Level . INFO , "Direct connection." ) ; Socks5BytestreamSession bs = new Socks5BytestreamSession ( nominated . socket , true ) ; callback . onSessionInitiated ( bs ) ; } else { LOGGER . log ( Level . INFO , "Our choice was their external proxy. wait for candidate-activate." ) ; } }
public class BNFHeadersImpl { /** * Method to flush whatever is in the cache into the input buffers . These * buffers are then returned to the caller as the flush may have needed to * expand the list . * @ param buffers * @ return WsByteBuffer [ ] */ protected WsByteBuffer [ ] flushCache ( WsByteBuffer [ ] buffers ) { } }
// PK13351 - use the offset / length version to write only what we need // to and avoid the extra memory allocation int pos = this . bytePosition ; if ( 0 == pos ) { // nothing to write return buffers ; } this . bytePosition = 0 ; return GenericUtils . putByteArray ( buffers , this . byteCache , 0 , pos , this ) ;