signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class PropertyMetadata { /** * Initializes the secondary indexer for this property , if any . */ private void initializeSecondaryIndexer ( ) { } }
SecondaryIndex secondaryIndexAnnotation = field . getAnnotation ( SecondaryIndex . class ) ; if ( secondaryIndexAnnotation == null ) { return ; } String indexName = secondaryIndexAnnotation . name ( ) ; if ( indexName == null || indexName . trim ( ) . length ( ) == 0 ) { indexName = DEFAULT_SECONDARY_INDEX_PREFIX + mappedName ; } this . secondaryIndexName = indexName ; try { secondaryIndexer = IndexerFactory . getInstance ( ) . getIndexer ( field ) ; } catch ( Exception exp ) { String pattern = "No suitable Indexer found or error occurred while creating the indexer " + "for field %s in class %s" ; String message = String . format ( pattern , field . getName ( ) , field . getDeclaringClass ( ) . getName ( ) ) ; throw new EntityManagerException ( message , exp ) ; }
public class BackupManagerImpl { /** * { @ inheritDoc } */ public void restore ( BackupChainLog log , String repositoryName , WorkspaceEntry workspaceEntry , boolean asynchronous ) throws BackupOperationException , BackupConfigurationException , RepositoryException , RepositoryConfigurationException { } }
if ( workspaceEntry == null ) { if ( ! log . getBackupConfig ( ) . getRepository ( ) . equals ( repositoryName ) ) { throw new WorkspaceRestoreException ( "If workspaceEntry is null, so will be restored with original configuration. " + "The repositoryName (\"" + repositoryName + "\") should be equals original repository name (\"" + log . getBackupConfig ( ) . getRepository ( ) + "\"). " ) ; } if ( log . getOriginalWorkspaceEntry ( ) == null ) { throw new RepositoryRestoreExeption ( "The backup log is not contains original repository log : " + log . getLogFilePath ( ) ) ; } this . restore ( log , log . getBackupConfig ( ) . getRepository ( ) , log . getOriginalWorkspaceEntry ( ) , asynchronous ) ; return ; } if ( asynchronous ) { JobWorkspaceRestore jobRestore = new JobWorkspaceRestore ( repoService , this , repositoryName , new File ( log . getLogFilePath ( ) ) , workspaceEntry ) ; restoreJobs . add ( jobRestore ) ; jobRestore . start ( ) ; } else { this . restoreOverInitializer ( log , repositoryName , workspaceEntry ) ; }
public class FileTypeUtil { /** * 根据文件流的头部信息获得文件类型 * @ param fileStreamHexHead 文件流头部16进制字符串 * @ return 文件类型 , 未找到为 < code > null < / code > */ public static String getType ( String fileStreamHexHead ) { } }
for ( Entry < String , String > fileTypeEntry : fileTypeMap . entrySet ( ) ) { if ( StrUtil . startWithIgnoreCase ( fileStreamHexHead , fileTypeEntry . getKey ( ) ) ) { return fileTypeEntry . getValue ( ) ; } } return null ;
public class Path { /** * This method returns the Path as an unmodifiable list of the terms * comprising the Path . */ public List < String > toList ( ) { } }
List < String > list = new LinkedList < String > ( ) ; if ( authority != null ) { list . add ( authority ) ; } for ( Term t : terms ) { list . add ( t . toString ( ) ) ; } return list ;
public class RegisterQualityProfiles { /** * The Quality profiles created by users should be renamed when they have the same name * as the built - in profile to be persisted . * When upgrading from < 6.5 , all existing profiles are considered as " custom " ( created * by users ) because the concept of built - in profile is not persisted . The " Sonar way " profiles * are renamed to " Sonar way ( outdated copy ) in order to avoid conflicts with the new * built - in profile " Sonar way " , which has probably different configuration . */ private void renameOutdatedProfiles ( DbSession dbSession , BuiltInQProfile profile ) { } }
Collection < String > uuids = dbClient . qualityProfileDao ( ) . selectUuidsOfCustomRulesProfiles ( dbSession , profile . getLanguage ( ) , profile . getName ( ) ) ; if ( uuids . isEmpty ( ) ) { return ; } Profiler profiler = Profiler . createIfDebug ( Loggers . get ( getClass ( ) ) ) . start ( ) ; String newName = profile . getName ( ) + " (outdated copy)" ; LOGGER . info ( "Rename Quality profiles [{}/{}] to [{}] in {} organizations" , profile . getLanguage ( ) , profile . getName ( ) , newName , uuids . size ( ) ) ; dbClient . qualityProfileDao ( ) . renameRulesProfilesAndCommit ( dbSession , uuids , newName ) ; profiler . stopDebug ( format ( "%d Quality profiles renamed to [%s]" , uuids . size ( ) , newName ) ) ;
public class TemplateMatcher { /** * / * - - - - - [ File Copy ] - - - - - */ public void copyInto ( File source , File targetDir , final VariableResolver resolver ) throws IOException { } }
FileUtil . copyInto ( source , targetDir , new FileUtil . FileCreator ( ) { @ Override public void createFile ( File sourceFile , File targetFile ) throws IOException { replace ( new FileReader ( sourceFile ) , new FileWriter ( targetFile ) , resolver ) ; } @ Override public String translate ( String name ) { return replace ( name , resolver ) ; } } ) ;
public class Change { /** * Creates a function , which handles binding between a ListProperty and an ObjectProperty . * < p > If this change isn ' t a list change , oldValue and newValue properties will have the single * element inside of the list , for easier usage . * @ param listProperty to be bound to the object property * @ return Callable function , which binds a list to an object property . */ private Callable createListToObjectBinding ( ListProperty < P > listProperty ) { } }
return ( ) -> { if ( ! isListChange ( ) && listProperty . get ( ) != null && listProperty . get ( ) . size ( ) != 0 ) { return listProperty . get ( ) . get ( 0 ) ; } return null ; } ;
public class LdapDao { /** * Inserts an entry into the DIT . Throws { @ link EntryAlreadyExistsException } if an entry with given Dn already * exists . Throws { @ link MissingParentException } if an ancestor of the entry is missing . */ public void store ( Entry entry ) throws EntryAlreadyExistsException , MissingParentException { } }
AddRequest addRequest = new AddRequestImpl ( ) . setEntry ( entry ) ; LdapResult result ; try { result = connection . add ( addRequest ) . getLdapResult ( ) ; } catch ( LdapException e ) { throw new LdapDaoException ( e ) ; } if ( result . getResultCode ( ) == ResultCodeEnum . ENTRY_ALREADY_EXISTS ) { throw new EntryAlreadyExistsException ( entry ) ; } else if ( result . getResultCode ( ) == ResultCodeEnum . NO_SUCH_OBJECT ) { throw new MissingParentException ( lastMatch ( entry . getDn ( ) ) ) ; } else if ( result . getResultCode ( ) != ResultCodeEnum . SUCCESS ) { throw new LdapDaoException ( result . getDiagnosticMessage ( ) ) ; }
public class CmsSearchIndexSourceControlList { /** * Returns the available search indexes of this installation . * @ return the available search indexes of this installation */ private List < CmsSearchIndexSource > searchIndexSources ( ) { } }
CmsSearchManager manager = OpenCms . getSearchManager ( ) ; return new LinkedList < CmsSearchIndexSource > ( manager . getSearchIndexSources ( ) . values ( ) ) ;
public class MimeMessageParser { /** * Parses the MimePart to create a DataSource . * @ param part the current part to be processed * @ return the DataSource */ @ Nonnull private static DataSource createDataSource ( @ Nonnull final MimePart part ) { } }
final DataHandler dataHandler = retrieveDataHandler ( part ) ; final DataSource dataSource = dataHandler . getDataSource ( ) ; final String contentType = parseBaseMimeType ( dataSource . getContentType ( ) ) ; final byte [ ] content = readContent ( retrieveInputStream ( dataSource ) ) ; final ByteArrayDataSource result = new ByteArrayDataSource ( content , contentType ) ; final String dataSourceName = parseDataSourceName ( part , dataSource ) ; result . setName ( dataSourceName ) ; return result ;
public class DetectorFactoryCollection { /** * Register a DetectorFactory . */ void registerDetector ( DetectorFactory factory ) { } }
if ( FindBugs . DEBUG ) { System . out . println ( "Registering detector: " + factory . getFullName ( ) ) ; } String detectorName = factory . getShortName ( ) ; if ( ! factoryList . contains ( factory ) ) { factoryList . add ( factory ) ; } else { LOGGER . log ( Level . WARNING , "Trying to add already registered factory: " + factory + ", " + factory . getPlugin ( ) ) ; } factoriesByName . put ( detectorName , factory ) ; factoriesByDetectorClassName . put ( factory . getFullName ( ) , factory ) ;
public class ViterbiSearcher { /** * Find best path from input lattice . * @ param lattice the result of build method * @ return List of ViterbiNode which consist best path */ public List < ViterbiNode > search ( ViterbiLattice lattice ) { } }
ViterbiNode [ ] [ ] endIndexArr = calculatePathCosts ( lattice ) ; LinkedList < ViterbiNode > result = backtrackBestPath ( endIndexArr [ 0 ] [ 0 ] ) ; return result ;
public class MessagePacker { /** * Writes a byte array to the output . * This method is used with { @ link # packRawStringHeader ( int ) } or { @ link # packBinaryHeader ( int ) } methods . * @ param src the data to add * @ param off the start offset in the data * @ param len the number of bytes to add * @ return this * @ throws IOException when underlying output throws IOException */ public MessagePacker writePayload ( byte [ ] src , int off , int len ) throws IOException { } }
if ( buffer == null || buffer . size ( ) - position < len || len > bufferFlushThreshold ) { flush ( ) ; // call flush before write // Directly write payload to the output without using the buffer out . write ( src , off , len ) ; totalFlushBytes += len ; } else { buffer . putBytes ( position , src , off , len ) ; position += len ; } return this ;
public class StunAttributeDecoder { /** * Decodes the specified binary array and returns the corresponding * attribute object . * @ param bytes * the binary array that should be decoded . * @ param offset * the index where the message starts . * @ param length * the number of bytes that the message is long . * @ return An object representing the attribute encoded in bytes or null if * the attribute was not recognized . * @ throws StunException * if bytes is not a valid STUN attribute . */ public static StunAttribute decode ( byte [ ] bytes , char offset , char length ) throws StunException { } }
if ( bytes == null || bytes . length < StunAttribute . HEADER_LENGTH ) { throw new StunException ( StunException . ILLEGAL_ARGUMENT , "Could not decode the specified binary array." ) ; } // Discover attribute type char attributeType = ( char ) ( ( bytes [ offset ] << 8 ) | bytes [ offset + 1 ] ) ; int len1 = bytes [ offset + 2 ] & 0xff ; int len2 = bytes [ offset + 3 ] & 0xff ; char attributeLength = ( char ) ( ( len1 << 8 ) | len2 ) ; if ( attributeLength > bytes . length - offset ) throw new StunException ( StunException . ILLEGAL_ARGUMENT , "Could not decode the specified binary array." ) ; StunAttribute decodedAttribute = null ; switch ( attributeType ) { /* STUN attributes */ case StunAttribute . CHANGE_REQUEST : decodedAttribute = new ChangeRequestAttribute ( ) ; break ; case StunAttribute . CHANGED_ADDRESS : decodedAttribute = new ChangedAddressAttribute ( ) ; break ; case StunAttribute . MAPPED_ADDRESS : decodedAttribute = new MappedAddressAttribute ( ) ; break ; case StunAttribute . ERROR_CODE : decodedAttribute = new ErrorCodeAttribute ( ) ; break ; case StunAttribute . MESSAGE_INTEGRITY : decodedAttribute = new MessageIntegrityAttribute ( ) ; break ; // case StunAttribute . PASSWORD : // handle as an unknown attribute case StunAttribute . REFLECTED_FROM : decodedAttribute = new ReflectedFromAttribute ( ) ; break ; case StunAttribute . RESPONSE_ADDRESS : decodedAttribute = new ResponseAddressAttribute ( ) ; break ; case StunAttribute . SOURCE_ADDRESS : decodedAttribute = new SourceAddressAttribute ( ) ; break ; case StunAttribute . UNKNOWN_ATTRIBUTES : decodedAttribute = new UnknownAttributesAttribute ( ) ; break ; case StunAttribute . XOR_MAPPED_ADDRESS : decodedAttribute = new XorMappedAddressAttribute ( ) ; break ; case StunAttribute . XOR_ONLY : decodedAttribute = new XorOnlyAttribute ( ) ; break ; case StunAttribute . SOFTWARE : decodedAttribute = new SoftwareAttribute ( ) ; break ; case StunAttribute . USERNAME : decodedAttribute = new UsernameAttribute ( ) ; break ; case StunAttribute . REALM : decodedAttribute = new RealmAttribute ( ) ; break ; case StunAttribute . NONCE : decodedAttribute = new NonceAttribute ( ) ; break ; case StunAttribute . FINGERPRINT : decodedAttribute = new FingerprintAttribute ( ) ; break ; case StunAttribute . ALTERNATE_SERVER : decodedAttribute = new AlternateServerAttribute ( ) ; break ; case StunAttribute . CHANNEL_NUMBER : decodedAttribute = new ChannelNumberAttribute ( ) ; break ; case StunAttribute . LIFETIME : decodedAttribute = new LifetimeAttribute ( ) ; break ; case StunAttribute . XOR_PEER_ADDRESS : decodedAttribute = new XorPeerAddressAttribute ( ) ; break ; case StunAttribute . DATA : decodedAttribute = new DataAttribute ( ) ; break ; case StunAttribute . XOR_RELAYED_ADDRESS : decodedAttribute = new XorRelayedAddressAttribute ( ) ; break ; case StunAttribute . EVEN_PORT : decodedAttribute = new EvenPortAttribute ( ) ; break ; case StunAttribute . REQUESTED_TRANSPORT : decodedAttribute = new RequestedTransportAttribute ( ) ; break ; case StunAttribute . DONT_FRAGMENT : decodedAttribute = new DontFragmentAttribute ( ) ; break ; case StunAttribute . RESERVATION_TOKEN : decodedAttribute = new ReservationTokenAttribute ( ) ; break ; case StunAttribute . PRIORITY : decodedAttribute = new PriorityAttribute ( ) ; break ; case StunAttribute . ICE_CONTROLLING : decodedAttribute = new ControllingAttribute ( ) ; break ; case StunAttribute . ICE_CONTROLLED : decodedAttribute = new ControlledAttribute ( ) ; break ; case StunAttribute . USE_CANDIDATE : decodedAttribute = new UseCandidateAttribute ( ) ; break ; // According to rfc3489 we should silently ignore unknown attributes . default : decodedAttribute = new OptionalAttribute ( StunAttribute . UNKNOWN_OPTIONAL_ATTRIBUTE ) ; break ; } decodedAttribute . setAttributeType ( attributeType ) ; decodedAttribute . setLocationInMessage ( offset ) ; decodedAttribute . decodeAttributeBody ( bytes , ( char ) ( StunAttribute . HEADER_LENGTH + offset ) , attributeLength ) ; return decodedAttribute ;
public class JavacFileManager { /** * Close the JavaFileManager , releasing resources . */ @ Override @ DefinedBy ( Api . COMPILER ) public void close ( ) throws IOException { } }
if ( deferredCloseTimeout > 0 ) { deferredClose ( ) ; return ; } locations . close ( ) ; for ( Container container : containers . values ( ) ) { container . close ( ) ; } containers . clear ( ) ; contentCache . clear ( ) ;
public class UTS46 { /** * returns the new dest . length ( ) */ private int mapDevChars ( StringBuilder dest , int labelStart , int mappingStart ) { } }
int length = dest . length ( ) ; boolean didMapDevChars = false ; for ( int i = mappingStart ; i < length ; ) { char c = dest . charAt ( i ) ; switch ( c ) { case 0xdf : // Map sharp s to ss . didMapDevChars = true ; dest . setCharAt ( i ++ , 's' ) ; dest . insert ( i ++ , 's' ) ; ++ length ; break ; case 0x3c2 : // Map final sigma to nonfinal sigma . didMapDevChars = true ; dest . setCharAt ( i ++ , '\u03c3' ) ; break ; case 0x200c : // Ignore / remove ZWNJ . case 0x200d : // Ignore / remove ZWJ . didMapDevChars = true ; dest . delete ( i , i + 1 ) ; -- length ; break ; default : ++ i ; break ; } } if ( didMapDevChars ) { // Mapping deviation characters might have resulted in an un - NFC string . // We could use either the NFC or the UTS # 46 normalizer . // By using the UTS # 46 normalizer again , we avoid having to load a second . nrm data file . String normalized = uts46Norm2 . normalize ( dest . subSequence ( labelStart , dest . length ( ) ) ) ; dest . replace ( labelStart , 0x7fffffff , normalized ) ; return dest . length ( ) ; } return length ;
public class ClasspathElementZip { /** * Scan for path matches within jarfile , and record ZipEntry objects of matching files . * @ param log * the log */ @ Override void scanPaths ( final LogNode log ) { } }
if ( logicalZipFile == null ) { skipClasspathElement = true ; } if ( skipClasspathElement ) { return ; } if ( scanned . getAndSet ( true ) ) { // Should not happen throw new IllegalArgumentException ( "Already scanned classpath element " + getZipFilePath ( ) ) ; } final LogNode subLog = log == null ? null : log . log ( getZipFilePath ( ) , "Scanning jarfile classpath element " + getZipFilePath ( ) ) ; Set < String > loggedNestedClasspathRootPrefixes = null ; String prevParentRelativePath = null ; ScanSpecPathMatch prevParentMatchStatus = null ; for ( final FastZipEntry zipEntry : logicalZipFile . entries ) { String relativePath = zipEntry . entryNameUnversioned ; // Check if the relative path is within a nested classpath root if ( nestedClasspathRootPrefixes != null ) { // This is O ( mn ) , which is inefficient , but the number of nested classpath roots should be small boolean reachedNestedRoot = false ; for ( final String nestedClasspathRoot : nestedClasspathRootPrefixes ) { if ( relativePath . startsWith ( nestedClasspathRoot ) ) { // relativePath has a prefix of nestedClasspathRoot if ( subLog != null ) { if ( loggedNestedClasspathRootPrefixes == null ) { loggedNestedClasspathRootPrefixes = new HashSet < > ( ) ; } if ( loggedNestedClasspathRootPrefixes . add ( nestedClasspathRoot ) ) { subLog . log ( "Reached nested classpath root, stopping recursion to avoid duplicate " + "scanning: " + nestedClasspathRoot ) ; } } reachedNestedRoot = true ; break ; } } if ( reachedNestedRoot ) { continue ; } } // Ignore entries without the correct classpath root prefix if ( ! packageRootPrefix . isEmpty ( ) && ! relativePath . startsWith ( packageRootPrefix ) ) { continue ; } // Strip the package root prefix from the relative path // N . B . these semantics should mirror those in getResource ( ) if ( ! packageRootPrefix . isEmpty ( ) ) { relativePath = relativePath . substring ( packageRootPrefix . length ( ) ) ; } else { // Strip any package root prefix from the relative path for ( int i = 0 ; i < ClassLoaderHandlerRegistry . AUTOMATIC_PACKAGE_ROOT_PREFIXES . length ; i ++ ) { if ( relativePath . startsWith ( ClassLoaderHandlerRegistry . AUTOMATIC_PACKAGE_ROOT_PREFIXES [ i ] ) ) { relativePath = relativePath . substring ( ClassLoaderHandlerRegistry . AUTOMATIC_PACKAGE_ROOT_PREFIXES [ i ] . length ( ) ) ; } } } // Whitelist / blacklist classpath elements based on file resource paths checkResourcePathWhiteBlackList ( relativePath , log ) ; if ( skipClasspathElement ) { return ; } // Get match status of the parent directory of this ZipEntry file ' s relative path ( or reuse the last // match status for speed , if the directory name hasn ' t changed ) . final int lastSlashIdx = relativePath . lastIndexOf ( '/' ) ; final String parentRelativePath = lastSlashIdx < 0 ? "/" : relativePath . substring ( 0 , lastSlashIdx + 1 ) ; final boolean parentRelativePathChanged = ! parentRelativePath . equals ( prevParentRelativePath ) ; final ScanSpecPathMatch parentMatchStatus = parentRelativePathChanged ? scanSpec . dirWhitelistMatchStatus ( parentRelativePath ) : prevParentMatchStatus ; prevParentRelativePath = parentRelativePath ; prevParentMatchStatus = parentMatchStatus ; if ( parentMatchStatus == ScanSpecPathMatch . HAS_BLACKLISTED_PATH_PREFIX ) { // The parent dir or one of its ancestral dirs is blacklisted if ( subLog != null ) { subLog . log ( "Skipping blacklisted path: " + relativePath ) ; } continue ; } // Add the ZipEntry path as a Resource final Resource resource = newResource ( zipEntry , relativePath ) ; if ( relativePathToResource . putIfAbsent ( relativePath , resource ) == null // If resource is whitelisted && ( parentMatchStatus == ScanSpecPathMatch . HAS_WHITELISTED_PATH_PREFIX || parentMatchStatus == ScanSpecPathMatch . AT_WHITELISTED_PATH || ( parentMatchStatus == ScanSpecPathMatch . AT_WHITELISTED_CLASS_PACKAGE && scanSpec . classfileIsSpecificallyWhitelisted ( relativePath ) ) || ( scanSpec . enableClassInfo && relativePath . equals ( "module-info.class" ) ) ) ) { // Resource is whitelisted addWhitelistedResource ( resource , parentMatchStatus , subLog ) ; } } // Save the last modified time for the zipfile final File zipfile = getFile ( ) ; fileToLastModified . put ( zipfile , zipfile . lastModified ( ) ) ; finishScanPaths ( subLog ) ;
public class DBaseFileWriter { /** * Replies the decimal size of the DBase field which must contains the * value of the given attribute value . * @ throws DBaseFileException if the Dbase file cannot be read . * @ throws AttributeException if an attribute is invalid . */ private static int computeDecimalSize ( AttributeValue value ) throws DBaseFileException , AttributeException { } }
final DBaseFieldType dbftype = DBaseFieldType . fromAttributeType ( value . getType ( ) ) ; return dbftype . getDecimalPointPosition ( value . getString ( ) ) ;
public class AbstractPathFinder { /** * { @ inheritDoc } */ @ Override public SimplePath [ ] scan ( KamNode [ ] sources ) { } }
if ( noItems ( sources ) ) { throw new InvalidArgument ( "sources" , sources ) ; } if ( nulls ( ( Object [ ] ) sources ) ) { throw new InvalidArgument ( "Source nodes contains null elements" ) ; } Kam [ ] kams = kams ( sources ) ; if ( ! sameKAMs ( kams ) ) { throw new InvalidArgument ( "Source KAMs are not equal" ) ; } return scan ( kams [ 0 ] , sources ) ;
public class PollArrayWrapper { /** * Prepare another pollfd struct for use . */ void addEntry ( SelChImpl sc ) { } }
putDescriptor ( totalChannels , IOUtil . fdVal ( sc . getFD ( ) ) ) ; putEventOps ( totalChannels , 0 ) ; putReventOps ( totalChannels , 0 ) ; totalChannels ++ ;
public class ApiOvhHostingprivateDatabase { /** * Get this object properties * REST : GET / hosting / privateDatabase / { serviceName } / database / { databaseName } / dump / { id } * @ param serviceName [ required ] The internal name of your private database * @ param databaseName [ required ] Database name * @ param id [ required ] Dump id */ public OvhDatabaseDump serviceName_database_databaseName_dump_id_GET ( String serviceName , String databaseName , Long id ) throws IOException { } }
String qPath = "/hosting/privateDatabase/{serviceName}/database/{databaseName}/dump/{id}" ; StringBuilder sb = path ( qPath , serviceName , databaseName , id ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhDatabaseDump . class ) ;
public class AbstractVendorPolicy { /** * This function invokes the vendor policy . < br > * The policy may charge a customer for the service , or validate the user * has permissions to invoke the action and so on . < br > * In case the policy takes over the flow and the fax bridge should not * be invoked , this method should return false . * @ param requestDataHolder * The request data holder * @ param faxJob * The submitted fax job * @ return True if to continue the flow , else false ( in case the policy sends the response ) */ public boolean invokePolicyForResponse ( Object requestDataHolder , FaxJob faxJob ) { } }
if ( requestDataHolder == null ) { throw new FaxException ( "Request data holder not provided." ) ; } if ( faxJob == null ) { throw new FaxException ( "Fax job not provided." ) ; } // invoke policy boolean continueFlow = this . invokePolicyForResponseImpl ( requestDataHolder , faxJob ) ; return continueFlow ;
public class NatsTransporter { /** * - - - DISCONNECT - - - */ @ Override public void connectionEvent ( Connection conn , Events type ) { } }
switch ( type ) { case CONNECTED : // The connection is permanently closed , either by manual action or // failed reconnects if ( debug ) { logger . info ( "NATS connection opened." ) ; } break ; case CLOSED : // The connection lost its connection , but may try to reconnect if // configured to logger . info ( "NATS connection closed." ) ; if ( started . get ( ) ) { reconnect ( ) ; } break ; case DISCONNECTED : // The connection was connected , lost its connection and // successfully reconnected if ( debug ) { logger . info ( "NATS pub-sub connection disconnected." ) ; } break ; case RECONNECTED : // The connection was reconnected and the server has been notified // of all subscriptions if ( debug ) { logger . info ( "NATS connection reconnected." ) ; } break ; case RESUBSCRIBED : // The connection was told about new servers from , from the current // server if ( debug ) { logger . info ( "NATS subscriptions re-established." ) ; } break ; case DISCOVERED_SERVERS : // Servers discovered if ( debug ) { logger . info ( "NATS servers discovered." ) ; } break ; default : break ; }
public class SDBaseOps { /** * Sum array reduction operation , optionally along specified dimensions * @ param x Input variable * @ param dimensions Dimensions to reduce over . If dimensions are not specified , full array reduction is performed * @ return Output variable : reduced array of rank ( input rank - num dimensions ) if keepDims = false , or * of rank ( input rank ) if keepdims = true */ public SDVariable sum ( String name , SDVariable x , int ... dimensions ) { } }
return sum ( name , x , false , dimensions ) ;
public class JsonDBTemplate { /** * / * ( non - Javadoc ) * @ see io . jsondb . JsonDBOperations # collectionExists ( java . lang . String ) */ @ Override public boolean collectionExists ( String collectionName ) { } }
CollectionMetaData collectionMeta = cmdMap . get ( collectionName ) ; if ( null == collectionMeta ) { return false ; } collectionMeta . getCollectionLock ( ) . readLock ( ) . lock ( ) ; try { return collectionsRef . get ( ) . containsKey ( collectionName ) ; } finally { collectionMeta . getCollectionLock ( ) . readLock ( ) . unlock ( ) ; }
public class vpnglobal_vpnnexthopserver_binding { /** * Use this API to fetch filtered set of vpnglobal _ vpnnexthopserver _ binding resources . * filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */ public static vpnglobal_vpnnexthopserver_binding [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } }
vpnglobal_vpnnexthopserver_binding obj = new vpnglobal_vpnnexthopserver_binding ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; vpnglobal_vpnnexthopserver_binding [ ] response = ( vpnglobal_vpnnexthopserver_binding [ ] ) obj . getfiltered ( service , option ) ; return response ;
public class StopwatchImpl { /** * Protected method doing the stop work based on provided start nano - time . * @ param split Split object that has been stopped * @ param start start nano - time of the split @ return split time in ns * @ param nowNanos current nano time * @ param subSimon name of the sub - stopwatch ( hierarchy delimiter is added automatically ) , may be { @ code null } */ void stop ( final Split split , final long start , final long nowNanos , final String subSimon ) { } }
StopwatchSample sample = null ; synchronized ( this ) { active -- ; updateUsagesNanos ( nowNanos ) ; if ( subSimon == null ) { long splitNs = nowNanos - start ; addSplit ( splitNs ) ; if ( ! manager . callback ( ) . callbacks ( ) . isEmpty ( ) ) { sample = sample ( ) ; } updateIncrementalSimons ( splitNs , nowNanos ) ; } } if ( subSimon != null ) { Stopwatch effectiveStopwatch = manager . getStopwatch ( getName ( ) + Manager . HIERARCHY_DELIMITER + subSimon ) ; split . setAttribute ( Split . ATTR_EFFECTIVE_STOPWATCH , effectiveStopwatch ) ; effectiveStopwatch . addSplit ( split ) ; return ; } manager . callback ( ) . onStopwatchStop ( split , sample ) ;
public class MethodNode { /** * Returns the LabelNode corresponding to the given Label . Creates a new * LabelNode if necessary . The default implementation of this method uses * the { @ link Label # info } field to store associations between labels and * label nodes . * @ param l * a Label . * @ return the LabelNode corresponding to l . */ protected LabelNode getLabelNode ( final Label l ) { } }
if ( ! ( l . info instanceof LabelNode ) ) { l . info = new LabelNode ( ) ; } return ( LabelNode ) l . info ;
public class RxLoader2 { /** * Saves the last value that the { @ link rx . Observable } returns in { @ link * rx . Observer # onNext ( Object ) } in the Activities ' ss ore Fragment ' s instanceState bundle . When * the { @ code Activity } or { @ code Fragment } is recreated , then the value will be redelivered . * The value < b > must < / b > implement { @ link android . os . Parcelable } . If not , you should use { @ link * me . tatarka . rxloader . RxLoader # save ( SaveCallback ) } to save and restore the value yourself . * @ return the { @ code RxLoader2 } for chaining */ public RxLoader2 < A , B , T > save ( SaveCallback < T > saveCallback ) { } }
super . save ( saveCallback ) ; return this ;
public class AtomPositionMap { /** * Calculates the number of residues of the specified chain in a given range , inclusive . * @ param positionA index of the first atom to count * @ param positionB index of the last atom to count * @ param startingChain Case - sensitive chain * @ return The number of atoms between A and B inclusive belonging to the given chain */ public int getLength ( int positionA , int positionB , String startingChain ) { } }
int positionStart , positionEnd ; if ( positionA <= positionB ) { positionStart = positionA ; positionEnd = positionB ; } else { positionStart = positionB ; positionEnd = positionA ; } int count = 0 ; // Inefficient search for ( Map . Entry < ResidueNumber , Integer > entry : treeMap . entrySet ( ) ) { if ( entry . getKey ( ) . getChainName ( ) . equals ( startingChain ) && positionStart <= entry . getValue ( ) && entry . getValue ( ) <= positionEnd ) { count ++ ; } } return count ;
public class PeepholeReplaceKnownMethods { /** * Try to fold . charCodeAt ( ) calls on strings */ private Node tryFoldStringCharCodeAt ( Node n , Node stringNode , Node arg1 ) { } }
checkArgument ( n . isCall ( ) ) ; checkArgument ( stringNode . isString ( ) ) ; int index ; String stringAsString = stringNode . getString ( ) ; if ( arg1 != null && arg1 . isNumber ( ) && arg1 . getNext ( ) == null ) { index = ( int ) arg1 . getDouble ( ) ; } else { return n ; } if ( index < 0 || stringAsString . length ( ) <= index ) { // http : / / es5 . github . com / # x15.5.4.5 says NaN is returned when index is // out of bounds but we bail . return n ; } Node resultNode = IR . number ( stringAsString . charAt ( index ) ) ; Node parent = n . getParent ( ) ; parent . replaceChild ( n , resultNode ) ; reportChangeToEnclosingScope ( parent ) ; return resultNode ;
public class CapturingClassTransformer { /** * Determines the existence of the server log directory , and attempts to create a capture * directory within the log directory . If this can be accomplished , the field captureEnabled * is set to true . Otherwise , it is left to its default value false if the capture directory * cannot be used . * @ param logDirectory */ private void initialize ( final File logDirectory , final String aaplName ) { } }
if ( logDirectory == null ) { captureEnabled = false ; return ; } AccessController . doPrivileged ( new PrivilegedAction < Void > ( ) { @ Override public Void run ( ) { // Create a new or reuse an existing base capture directory String captureDirStr = "JPATransform" + "/" + ( ( aaplName != null ) ? aaplName : "unknownapp" ) ; captureRootDir = new File ( logDirectory , captureDirStr ) ; captureEnabled = captureRootDir . mkdirs ( ) || captureRootDir . isDirectory ( ) ; if ( ! captureEnabled ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Cannot create server instance capture directory, so enhanced entity bytecode will not be captured." ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Capturing enhanced bytecode for JPA entities to " + captureRootDir . getAbsolutePath ( ) ) ; } } return null ; } } ) ;
public class FileMonitor { /** * Add file to listen for . File may be any java . io . File ( including a * directory ) and may well be a non - existing file in the case where the * creating of the file is to be trepped . * More than one file can be listened for . When the specified file is * created , modified or deleted , listeners are notified . * @ param file File to listen for . */ public void addFile ( File file ) { } }
if ( ! files_ . containsKey ( file ) ) { long modifiedTime = file . exists ( ) ? file . lastModified ( ) : - 1 ; files_ . put ( file , new Long ( modifiedTime ) ) ; }
public class GVRPeriodicEngine { /** * Run a task once , after a delay . * @ param task * Task to run . * @ param delay * Unit is seconds . * @ return An interface that lets you query the status ; cancel ; or * reschedule the event . */ public PeriodicEvent runAfter ( Runnable task , float delay ) { } }
validateDelay ( delay ) ; return new Event ( task , delay ) ;
public class MSPDIWriter { /** * This method determines whether the cost rate table should be written . * A default cost rate table should not be written to the file . * @ param entry cost rate table entry * @ param from from date * @ return boolean flag */ private boolean costRateTableWriteRequired ( CostRateTableEntry entry , Date from ) { } }
boolean fromDate = ( DateHelper . compare ( from , DateHelper . FIRST_DATE ) > 0 ) ; boolean toDate = ( DateHelper . compare ( entry . getEndDate ( ) , DateHelper . LAST_DATE ) > 0 ) ; boolean costPerUse = ( NumberHelper . getDouble ( entry . getCostPerUse ( ) ) != 0 ) ; boolean overtimeRate = ( entry . getOvertimeRate ( ) != null && entry . getOvertimeRate ( ) . getAmount ( ) != 0 ) ; boolean standardRate = ( entry . getStandardRate ( ) != null && entry . getStandardRate ( ) . getAmount ( ) != 0 ) ; return ( fromDate || toDate || costPerUse || overtimeRate || standardRate ) ;
public class PortletWorkerFactoryImpl { /** * / * ( non - Javadoc ) * @ see org . apereo . portal . portlet . rendering . worker . IPortletWorkerFactory # createRenderHeaderWorker ( javax . servlet . http . HttpServletRequest , javax . servlet . http . HttpServletResponse , org . apereo . portal . portlet . om . IPortletWindowId ) */ @ Override public IPortletRenderExecutionWorker createRenderHeaderWorker ( HttpServletRequest request , HttpServletResponse response , IPortletWindowId portletWindowId ) { } }
final IPortletWindow portletWindow = this . portletWindowRegistry . getPortletWindow ( request , portletWindowId ) ; return new PortletRenderHeaderExecutionWorker ( portletThreadPool , executionInterceptors , portletRenderer , request , response , portletWindow ) ;
public class CmsADEManager { /** * Returns the show editor help flag . < p > * @ param cms the cms context * @ return the show editor help flag */ public boolean isShowEditorHelp ( CmsObject cms ) { } }
CmsUser user = cms . getRequestContext ( ) . getCurrentUser ( ) ; String showHelp = ( String ) user . getAdditionalInfo ( ADDINFO_ADE_SHOW_EDITOR_HELP ) ; return CmsStringUtil . isEmptyOrWhitespaceOnly ( showHelp ) || Boolean . parseBoolean ( showHelp ) ;
public class Container { /** * < p > create . < / p > * @ param application a { @ link ameba . core . Application } object . * @ return a { @ link ameba . container . Container } object . * @ throws java . lang . IllegalAccessException if any . * @ throws java . lang . InstantiationException if any . */ @ SuppressWarnings ( "unchecked" ) public static Container create ( Application application ) throws IllegalAccessException , InstantiationException { } }
String provider = ( String ) application . getProperty ( "container.provider" ) ; logger . debug ( Messages . get ( "info.container.provider" , provider ) ) ; try { Class < Container > ContainerClass = ( Class < Container > ) ClassUtils . getClass ( provider ) ; Constructor < Container > constructor = ContainerClass . < Container > getDeclaredConstructor ( Application . class ) ; return constructor . newInstance ( application ) ; } catch ( InvocationTargetException | NoSuchMethodException | ClassNotFoundException e ) { throw new ContainerException ( e ) ; }
public class InApplicationMonitorInterceptor { /** * { @ inheritDoc } */ public Object invoke ( MethodInvocation mi ) /* Honoring the interface earns you a punch in the face . . . CSOFF : IllegalThrows */ throws Throwable /* CSON : IllegalThrows */ { } }
String monitorName = getMonitorName ( mi ) ; final PerfMonitor monitor = PerfTimer . createMonitor ( ) ; try { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "enter [" + monitorName + "]" ) ; } return mi . proceed ( ) ; } finally { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "leave [" + monitorName + "]" ) ; } monitor . handleMeasurement ( monitorName , handlers ) ; }
public class SerializerIntrinsics { /** * Dot Product of Packed DP - FP Values ( SSE4.1 ) . */ public final void dppd ( XMMRegister dst , XMMRegister src , Immediate imm8 ) { } }
emitX86 ( INST_DPPD , dst , src , imm8 ) ;
public class MarcFieldTransformer { /** * Interpolate variables . * @ param marcField MARC field * @ param value the input value * @ return the interpolated string */ private String interpolate ( MarcField marcField , String value ) { } }
if ( value == null ) { return null ; } Matcher m = REP . matcher ( value ) ; if ( m . find ( ) ) { return m . replaceAll ( Integer . toString ( repeatCounter ) ) ; } m = NREP . matcher ( value ) ; if ( m . find ( ) ) { if ( repeatCounter > 99 ) { repeatCounter = 99 ; logger . log ( Level . WARNING , "counter > 99, overflow in %s" , marcField ) ; } return m . replaceAll ( String . format ( "%02d" , repeatCounter ) ) ; } return value ;
public class Time { /** * Converts a string in JDBC time escape format to a < code > Time < / code > value . * @ param s time in format " hh : mm : ss " * @ return a corresponding < code > Time < / code > object */ public static Time valueOf ( String s ) { } }
int hour ; int minute ; int second ; int firstColon ; int secondColon ; if ( s == null ) throw new java . lang . IllegalArgumentException ( ) ; firstColon = s . indexOf ( ':' ) ; secondColon = s . indexOf ( ':' , firstColon + 1 ) ; if ( ( firstColon > 0 ) & ( secondColon > 0 ) & ( secondColon < s . length ( ) - 1 ) ) { hour = Integer . parseInt ( s . substring ( 0 , firstColon ) ) ; minute = Integer . parseInt ( s . substring ( firstColon + 1 , secondColon ) ) ; second = Integer . parseInt ( s . substring ( secondColon + 1 ) ) ; } else { throw new java . lang . IllegalArgumentException ( ) ; } return new Time ( hour , minute , second ) ;
public class CancelSpotFleetRequestsRequest { /** * The IDs of the Spot Fleet requests . * @ param spotFleetRequestIds * The IDs of the Spot Fleet requests . */ public void setSpotFleetRequestIds ( java . util . Collection < String > spotFleetRequestIds ) { } }
if ( spotFleetRequestIds == null ) { this . spotFleetRequestIds = null ; return ; } this . spotFleetRequestIds = new com . amazonaws . internal . SdkInternalList < String > ( spotFleetRequestIds ) ;
public class TagletManager { /** * Given an array of < code > Tag < / code > s , check for spelling mistakes . * @ param doc the Doc object that holds the tags . * @ param tags the list of < code > Tag < / code > s to check . * @ param areInlineTags true if the array of tags are inline and false otherwise . */ public void checkTags ( Doc doc , Tag [ ] tags , boolean areInlineTags ) { } }
if ( tags == null ) { return ; } Taglet taglet ; for ( Tag tag : tags ) { String name = tag . name ( ) ; if ( name . length ( ) > 0 && name . charAt ( 0 ) == '@' ) { name = name . substring ( 1 , name . length ( ) ) ; } if ( ! ( standardTags . contains ( name ) || customTags . containsKey ( name ) ) ) { if ( standardTagsLowercase . contains ( StringUtils . toLowerCase ( name ) ) ) { message . warning ( tag . position ( ) , "doclet.UnknownTagLowercase" , tag . name ( ) ) ; continue ; } else { message . warning ( tag . position ( ) , "doclet.UnknownTag" , tag . name ( ) ) ; continue ; } } // Check if this tag is being used in the wrong location . if ( ( taglet = customTags . get ( name ) ) != null ) { if ( areInlineTags && ! taglet . isInlineTag ( ) ) { printTagMisuseWarn ( taglet , tag , "inline" ) ; } if ( ( doc instanceof RootDoc ) && ! taglet . inOverview ( ) ) { printTagMisuseWarn ( taglet , tag , "overview" ) ; } else if ( ( doc instanceof PackageDoc ) && ! taglet . inPackage ( ) ) { printTagMisuseWarn ( taglet , tag , "package" ) ; } else if ( ( doc instanceof ClassDoc ) && ! taglet . inType ( ) ) { printTagMisuseWarn ( taglet , tag , "class" ) ; } else if ( ( doc instanceof ConstructorDoc ) && ! taglet . inConstructor ( ) ) { printTagMisuseWarn ( taglet , tag , "constructor" ) ; } else if ( ( doc instanceof FieldDoc ) && ! taglet . inField ( ) ) { printTagMisuseWarn ( taglet , tag , "field" ) ; } else if ( ( doc instanceof MethodDoc ) && ! taglet . inMethod ( ) ) { printTagMisuseWarn ( taglet , tag , "method" ) ; } } }
public class EDGImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case AfplibPackage . EDG__DEG_NAME : return getDEGName ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
public class SerializationObjectPool { /** * Gets the next avaialable serialization object . * @ return ISerializationObject instance to do the conversation with . */ public SerializationObject getSerializationObject ( ) { } }
SerializationObject object ; synchronized ( ivListOfObjects ) { if ( ivListOfObjects . isEmpty ( ) ) { object = createNewObject ( ) ; } else { object = ivListOfObjects . remove ( ivListOfObjects . size ( ) - 1 ) ; } } return object ;
public class BatchGetApplicationsResult { /** * Information about the applications . * @ return Information about the applications . */ public java . util . List < ApplicationInfo > getApplicationsInfo ( ) { } }
if ( applicationsInfo == null ) { applicationsInfo = new com . amazonaws . internal . SdkInternalList < ApplicationInfo > ( ) ; } return applicationsInfo ;
public class HttpPanelSyntaxHighlightTextArea { /** * Highlight all found strings */ private void highlightEntryParser ( HighlightSearchEntry entry ) { } }
String text ; int lastPos = 0 ; text = this . getText ( ) ; Highlighter hilite = this . getHighlighter ( ) ; HighlightPainter painter = new DefaultHighlighter . DefaultHighlightPainter ( entry . getColor ( ) ) ; while ( ( lastPos = text . indexOf ( entry . getToken ( ) , lastPos ) ) > - 1 ) { try { hilite . addHighlight ( lastPos , lastPos + entry . getToken ( ) . length ( ) , painter ) ; lastPos += entry . getToken ( ) . length ( ) ; } catch ( BadLocationException e ) { log . warn ( "Could not highlight entry" , e ) ; } }
public class IconTable { /** * Create the style columns * @ return columns */ private static List < UserCustomColumn > createColumns ( ) { } }
List < UserCustomColumn > columns = new ArrayList < > ( ) ; columns . addAll ( createRequiredColumns ( ) ) ; int index = columns . size ( ) ; columns . add ( UserCustomColumn . createColumn ( index ++ , COLUMN_NAME , GeoPackageDataType . TEXT , false , null ) ) ; columns . add ( UserCustomColumn . createColumn ( index ++ , COLUMN_DESCRIPTION , GeoPackageDataType . TEXT , false , null ) ) ; columns . add ( UserCustomColumn . createColumn ( index ++ , COLUMN_WIDTH , GeoPackageDataType . REAL , false , null ) ) ; columns . add ( UserCustomColumn . createColumn ( index ++ , COLUMN_HEIGHT , GeoPackageDataType . REAL , false , null ) ) ; columns . add ( UserCustomColumn . createColumn ( index ++ , COLUMN_ANCHOR_U , GeoPackageDataType . REAL , false , null ) ) ; columns . add ( UserCustomColumn . createColumn ( index ++ , COLUMN_ANCHOR_V , GeoPackageDataType . REAL , false , null ) ) ; return columns ;
public class DefaultArtifactUtil { /** * Tests if the given fully qualified name exists in the given artifact . * @ param artifact artifact to test * @ param mainClass the fully qualified name to find in artifact * @ return { @ code true } if given artifact contains the given fqn , { @ code false } otherwise * @ throws MojoExecutionException if artifact file url is mal formed */ public boolean artifactContainsClass ( Artifact artifact , final String mainClass ) throws MojoExecutionException { } }
boolean containsClass = true ; // JarArchiver . grabFilesAndDirs ( ) URL url ; try { url = artifact . getFile ( ) . toURI ( ) . toURL ( ) ; } catch ( MalformedURLException e ) { throw new MojoExecutionException ( "Could not get artifact url: " + artifact . getFile ( ) , e ) ; } ClassLoader cl = new java . net . URLClassLoader ( new URL [ ] { url } ) ; Class < ? > c = null ; try { c = Class . forName ( mainClass , false , cl ) ; } catch ( ClassNotFoundException e ) { getLogger ( ) . debug ( "artifact " + artifact + " doesn't contain the main class: " + mainClass ) ; containsClass = false ; } catch ( Throwable t ) { getLogger ( ) . info ( "artifact " + artifact + " seems to contain the main class: " + mainClass + " but the jar doesn't seem to contain all dependencies " + t . getMessage ( ) ) ; } if ( c != null ) { getLogger ( ) . debug ( "Checking if the loaded class contains a main method." ) ; try { c . getMethod ( "main" , String [ ] . class ) ; } catch ( NoSuchMethodException e ) { getLogger ( ) . warn ( "The specified main class (" + mainClass + ") doesn't seem to contain a main method... " + "Please check your configuration." + e . getMessage ( ) ) ; } catch ( NoClassDefFoundError e ) { // undocumented in SDK 5.0 . is this due to the ClassLoader lazy loading the Method // thus making this a case tackled by the JVM Spec ( Ref 5.3.5 ) ! // Reported as Incident 633981 to Sun just in case . . . getLogger ( ) . warn ( "Something failed while checking if the main class contains the main() method. " + "This is probably due to the limited classpath we have provided to the class loader. " + "The specified main class (" + mainClass + ") found in the jar is *assumed* to contain a main method... " + e . getMessage ( ) ) ; } catch ( Throwable t ) { getLogger ( ) . error ( "Unknown error: Couldn't check if the main class has a main method. " + "The specified main class (" + mainClass + ") found in the jar is *assumed* to contain a main method..." , t ) ; } } return containsClass ;
public class FunctionLibFactory { /** * does not involve the content to create an id , value returned is based on metadata of the file * ( lastmodified , size ) * @ param res * @ return * @ throws NoSuchAlgorithmException */ public static String id ( Resource res ) { } }
String str = ResourceUtil . getCanonicalPathEL ( res ) + "|" + res . length ( ) + "|" + res . lastModified ( ) ; try { return Hash . md5 ( str ) ; } catch ( NoSuchAlgorithmException e ) { return Caster . toString ( HashUtil . create64BitHash ( str ) ) ; }
public class Parameter { /** * Extract the name from an argument . * < ul > * < li > IdentifierTree - if the identifier is ' this ' then use the name of the enclosing class , * otherwise use the name of the identifier * < li > MemberSelectTree - the name of its identifier * < li > NewClassTree - the name of the class being constructed * < li > Null literal - a wildcard name * < li > MethodInvocationTree - use the method name stripping off ' get ' , ' set ' , ' is ' prefix . If * this results in an empty name then recursively search the receiver * < / ul > * All other trees ( including literals other than Null literal ) do not have a name and this method * will return the marker for an unknown name . */ @ VisibleForTesting static String getArgumentName ( ExpressionTree expressionTree ) { } }
switch ( expressionTree . getKind ( ) ) { case MEMBER_SELECT : return ( ( MemberSelectTree ) expressionTree ) . getIdentifier ( ) . toString ( ) ; case NULL_LITERAL : // null could match anything pretty well return NAME_NULL ; case IDENTIFIER : IdentifierTree idTree = ( IdentifierTree ) expressionTree ; if ( idTree . getName ( ) . contentEquals ( "this" ) ) { // for the ' this ' keyword the argument name is the name of the object ' s class Symbol sym = ASTHelpers . getSymbol ( idTree ) ; return sym != null ? getClassName ( ASTHelpers . enclosingClass ( sym ) ) : NAME_NOT_PRESENT ; } else { // if we have a variable , just extract its name return idTree . getName ( ) . toString ( ) ; } case METHOD_INVOCATION : MethodInvocationTree methodInvocationTree = ( MethodInvocationTree ) expressionTree ; MethodSymbol methodSym = ASTHelpers . getSymbol ( methodInvocationTree ) ; if ( methodSym != null ) { String name = methodSym . getSimpleName ( ) . toString ( ) ; List < String > terms = NamingConventions . splitToLowercaseTerms ( name ) ; String firstTerm = Iterables . getFirst ( terms , null ) ; if ( METHODNAME_PREFIXES_TO_REMOVE . contains ( firstTerm ) ) { if ( terms . size ( ) == 1 ) { ExpressionTree receiver = ASTHelpers . getReceiver ( methodInvocationTree ) ; if ( receiver == null ) { return getClassName ( ASTHelpers . enclosingClass ( methodSym ) ) ; } // recursively try to get a name from the receiver return getArgumentName ( receiver ) ; } else { return name . substring ( firstTerm . length ( ) ) ; } } else { return name ; } } else { return NAME_NOT_PRESENT ; } case NEW_CLASS : MethodSymbol constructorSym = ASTHelpers . getSymbol ( ( NewClassTree ) expressionTree ) ; return constructorSym != null && constructorSym . owner != null ? getClassName ( ( ClassSymbol ) constructorSym . owner ) : NAME_NOT_PRESENT ; default : return NAME_NOT_PRESENT ; }
public class CoverageDataCore { /** * Determine the y source pixel location * @ param y * y pixel * @ param destTop * destination top most pixel * @ param srcTop * source top most pixel * @ param heightRatio * source over destination height ratio * @ return y source pixel */ protected float getYSource ( int y , float destTop , float srcTop , float heightRatio ) { } }
float dest = getYEncodedLocation ( y , encoding ) ; float source = getSource ( dest , destTop , srcTop , heightRatio ) ; return source ;
public class ChildesParser { /** * Parses a single xml file . If { @ code utterancePerDoc } is true , each * utterance will be on a separate line , otherwise they will all be * concantanated , and separated by periods , and stored on a single line . */ public void parseFile ( File file , boolean utterancePerDoc ) { } }
try { // Build an xml document . DocumentBuilderFactory dbf = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder db = dbf . newDocumentBuilder ( ) ; Document doc = db . parse ( file ) ; // Extract all utterances . NodeList utterances = doc . getElementsByTagName ( "u" ) ; StringBuilder fileBuilder = new StringBuilder ( ) ; for ( int i = 0 ; i < utterances . getLength ( ) ; ++ i ) { // Extract all words from the utterance Element item = ( Element ) utterances . item ( i ) ; NodeList words = item . getElementsByTagName ( "w" ) ; StringBuilder utteranceBuilder = new StringBuilder ( ) ; // Iterate over the words and get just the word text . List < String > wordsInUtterance = new ArrayList < String > ( words . getLength ( ) ) ; for ( int j = 0 ; j < words . getLength ( ) ; ++ j ) { // Get the part of speech tag . Element wordNode = ( Element ) words . item ( j ) ; NodeList posNodeList = wordNode . getElementsByTagName ( "pos" ) ; String word = wordNode . getFirstChild ( ) . getNodeValue ( ) ; if ( posNodeList . getLength ( ) > 0 ) { Node posNode = posNodeList . item ( 0 ) . getFirstChild ( ) . getFirstChild ( ) ; String pos = posNode . getNodeValue ( ) ; posTags . put ( word , pos ) ; if ( appendPosTags ) word += "-" + pos ; } wordsInUtterance . add ( word ) ; } // Each of the < a > nodes contains additional information about // the currnet utterances . This may be syntactic information , // comments on the scene , descriptions of the action , or // clarification by the observer . For all comments but the // syntactic , use the comment text to create new pseudo // utterances by combining tokens from the utterance with // pseudo - tokens in the comment . The pseudo - tokens have a // " - GROUNDING " suffix which distiguishes them from tokens // actually present in the uttered speech . NodeList auxNodes = item . getElementsByTagName ( "a" ) ; List < String > augmentedUtterances = new LinkedList < String > ( ) ; if ( generateAugmented ) { for ( int j = 0 ; j < auxNodes . getLength ( ) ; ++ j ) { // Get any comment for the utterance Node n = auxNodes . item ( j ) ; String auxNodeType = n . getAttributes ( ) . getNamedItem ( "type" ) . getNodeValue ( ) ; // Get only those nodes that contain comments or // descriptions on the utterance that may be used to // ground the words being referred to . if ( auxNodeType . equals ( "action" ) || auxNodeType . equals ( "actions" ) || auxNodeType . equals ( "addressee" ) || auxNodeType . equals ( "comments" ) || auxNodeType . equals ( "explanation" ) || auxNodeType . equals ( "gesture" ) || auxNodeType . equals ( "happening" ) || auxNodeType . equals ( "situation" ) ) { String commentOnUtterance = n . getFirstChild ( ) . getNodeValue ( ) ; // Use the iterator factory to tokenize in the event // that the user has specified some form of token // filtering Iterator < String > tokenIter = IteratorFactory . tokenize ( new BufferedReader ( new StringReader ( commentOnUtterance ) ) ) ; // For each of the tokens in the additional // information , create a pseudo - utterance using a // word from the actual utterance and an // grounding - token while ( tokenIter . hasNext ( ) ) { String token = tokenIter . next ( ) ; for ( String word : wordsInUtterance ) { augmentedUtterances . add ( word + " " + token + "-GROUNDING" ) ; } } } } } // Write the utterance if an utterance is a document . for ( Iterator < String > it = wordsInUtterance . iterator ( ) ; it . hasNext ( ) ; ) { utteranceBuilder . append ( it . next ( ) ) ; if ( it . hasNext ( ) ) utteranceBuilder . append ( " " ) ; } String utterance = utteranceBuilder . toString ( ) ; if ( utterancePerDoc ) { print ( utterance ) ; // Print all the psuedo utterances constructed from the // comments for ( String aug : augmentedUtterances ) print ( aug ) ; } else { // otherwise save the utterance . fileBuilder . append ( utterance ) ; if ( separateByPeriod ) fileBuilder . append ( "." ) ; fileBuilder . append ( " " ) ; // Print all the psuedo utterances constructed from the // comments . Unlike the utterances , print these as separate // documents to avoid having them register as co - occurrences // with other utterances . for ( String aug : augmentedUtterances ) print ( aug ) ; } } // Write all the utterances if the whole xml file is a document . if ( ! utterancePerDoc ) print ( fileBuilder . toString ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; }
public class Filters { /** * Gets a filter that always either returns the original object unchanged * or returns < code > null < / code > . * @ param value whether to accept or reject all items . * @ param < T > the type . * @ return the filter . */ public static < T > Filter < T > bool ( final boolean value ) { } }
return new NonMutatingFilter < T > ( ) { @ Override public boolean accepts ( T item ) { return value ; } } ;
public class ExecutorServiceImpl { /** * { @ inheritDoc } */ @ Override public < T > Future < T > submit ( Runnable task , T result ) { } }
threadPoolController . resumeIfPaused ( ) ; return threadPool . submit ( createWrappedRunnable ( task ) , result ) ;
public class BidiFormatter { /** * Factory for creating an instance of BidiFormatter given the context directionality . { @ link * # spanWrap } avoids span wrapping unless there ' s a reason ( ' dir ' attribute should be appended ) . * @ param contextDir The context directionality . Must be RTL or LTR . */ public static BidiFormatter getInstance ( Dir contextDir ) { } }
switch ( contextDir ) { case LTR : return DEFAULT_LTR_INSTANCE ; case RTL : return DEFAULT_RTL_INSTANCE ; case NEUTRAL : throw new IllegalArgumentException ( "invalid context directionality: " + contextDir ) ; } throw new AssertionError ( contextDir ) ;
public class AbstractIntDoubleMap { /** * Applies a procedure to each ( key , value ) pair of the receiver , if any . * Iteration order is guaranteed to be < i > identical < / i > to the order used by method { @ link # forEachKey ( IntProcedure ) } . * @ param procedure the procedure to be applied . Stops iteration if the procedure returns < tt > false < / tt > , otherwise continues . * @ return < tt > false < / tt > if the procedure stopped before all keys where iterated over , < tt > true < / tt > otherwise . */ public boolean forEachPair ( final IntDoubleProcedure procedure ) { } }
return forEachKey ( new IntProcedure ( ) { public boolean apply ( int key ) { return procedure . apply ( key , get ( key ) ) ; } } ) ;
public class X509Key { /** * Initialize an X509Key object from an input stream . The data on that * input stream must be encoded using DER , obeying the X . 509 * < code > SubjectPublicKeyInfo < / code > format . That is , the data is a * sequence consisting of an algorithm ID and a bit string which holds * the key . ( That bit string is often used to encapsulate another DER * encoded sequence . ) * < P > Subclasses should not normally redefine this method ; they should * instead provide a < code > parseKeyBits < / code > method to parse any * fields inside the < code > key < / code > member . * < P > The exception to this rule is that since private keys need not * be encoded using the X . 509 < code > SubjectPublicKeyInfo < / code > format , * private keys may override this method , < code > encode < / code > , and * of course < code > getFormat < / code > . * @ param in an input stream with a DER - encoded X . 509 * SubjectPublicKeyInfo value * @ exception InvalidKeyException on parsing errors . */ public void decode ( InputStream in ) throws InvalidKeyException { } }
DerValue val ; try { val = new DerValue ( in ) ; if ( val . tag != DerValue . tag_Sequence ) throw new InvalidKeyException ( "invalid key format" ) ; algid = AlgorithmId . parse ( val . data . getDerValue ( ) ) ; setKey ( val . data . getUnalignedBitString ( ) ) ; parseKeyBits ( ) ; if ( val . data . available ( ) != 0 ) throw new InvalidKeyException ( "excess key data" ) ; } catch ( IOException e ) { // e . printStackTrace ( ) ; throw new InvalidKeyException ( "IOException: " + e . getMessage ( ) ) ; }
public class SARLImages { /** * Replies the image descriptor for the given element . * @ param type the type of the SARL element , or < code > null < / code > if unknown . * @ param isInner indicates if the element is inner . * @ return the image descriptor . */ public ImageDescriptor getTypeImageDescriptor ( SarlElementType type , boolean isInner ) { } }
return getTypeImageDescriptor ( type , isInner , false , 0 , USE_LIGHT_ICONS ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link PolygonType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link PolygonType } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "Polygon" , substitutionHeadNamespace = "http://www.opengis.net/gml" , substitutionHeadName = "_Surface" ) public JAXBElement < PolygonType > createPolygon ( PolygonType value ) { } }
return new JAXBElement < PolygonType > ( _Polygon_QNAME , PolygonType . class , null , value ) ;
public class ColorPixel { /** * Applies the specified transformation matrix ( 3x3) * to this RGB vector . Alpha is preserved . < br > * { @ code this = m * this } * @ param m00 first row first col * @ param m01 first row second col * @ param m02 first row third col * @ param m10 second row first col * @ param m11 second row second col * @ param m12 second row third col * @ param m20 third row first col * @ param m21 third row second col * @ param m22 third row third col * @ return this pixel for chaining */ public ColorPixel transform ( double m00 , double m01 , double m02 , double m10 , double m11 , double m12 , double m20 , double m21 , double m22 ) { } }
return setRGB_fromDouble_preserveAlpha ( dot ( m00 , m01 , m02 ) , dot ( m10 , m11 , m12 ) , dot ( m20 , m21 , m22 ) ) ;
public class ParallelLayeredWordCloud { /** * constructs the wordcloud specified by layer using the given * wordfrequencies . < br > * This is a non - blocking call . * @ param layer * Wordcloud Layer * @ param wordFrequencies * the WordFrequencies to use as input */ @ Override public void build ( final int layer , final List < WordFrequency > wordFrequencies ) { } }
final Future < ? > completionFuture = executorservice . submit ( ( ) -> { LOGGER . info ( "Starting to build WordCloud Layer {} in new Thread" , layer ) ; super . build ( layer , wordFrequencies ) ; } ) ; executorFutures . add ( completionFuture ) ;
public class TextContentChecker { /** * Returns a < code > DatatypeStreamingValidator < / code > for the element if it * needs < code > textContent < / code > checking or < code > null < / code > if it does * not . * @ param uri * the namespace URI of the element * @ param localName * the local name of the element * @ param atts * the attributes * @ return a < code > DatatypeStreamingValidator < / code > or < code > null < / code > if * checks not necessary */ private DatatypeStreamingValidator streamingValidatorFor ( String uri , String localName , Attributes atts ) { } }
if ( "http://www.w3.org/1999/xhtml" . equals ( uri ) ) { if ( "time" . equals ( localName ) ) { if ( atts . getIndex ( "" , "datetime" ) < 0 ) { return TimeDatetime . THE_INSTANCE . createStreamingValidator ( null ) ; } } if ( "script" . equals ( localName ) ) { if ( atts . getIndex ( "" , "src" ) < 0 ) { return Script . THE_INSTANCE . createStreamingValidator ( null ) ; } else { return ScriptDocumentation . THE_INSTANCE . createStreamingValidator ( null ) ; } } else if ( "style" . equals ( localName ) || "textarea" . equals ( localName ) || "title" . equals ( localName ) ) { return CdoCdcPair . THE_INSTANCE . createStreamingValidator ( null ) ; } } return null ;
public class HomepageHighcharts { /** * Returns a Chart object from the current page parameters * @ param params the page parameters from the page URI * @ return a Chart */ private Chart getChartFromParams ( final PageParameters params ) { } }
String chartString ; String themeString ; Chart config ; // If the showcase is started without any parameters // set the parameters to lineBasic and give us a line Chart if ( params . getAllNamed ( ) . size ( ) < 2 ) { PageParameters temp = new PageParameters ( ) ; temp . add ( "theme" , "default" ) ; temp . add ( "chart" , "line" ) ; setResponsePage ( HomepageHighcharts . class , temp ) ; config = new Chart ( "chart" , new BasicLineOptions ( ) , null ) ; return config ; } themeString = params . getAllNamed ( ) . get ( 0 ) . getValue ( ) ; Theme theme = getThemeFromParams ( themeString ) ; chartString = params . getAllNamed ( ) . get ( 1 ) . getValue ( ) ; if ( chartString == null ) { config = new Chart ( "chart" , new BasicLineOptions ( ) , theme ) ; return config ; } switch ( chartString ) { case "basicBar" : config = new Chart ( "chart" , new BasicBarOptions ( ) , theme ) ; break ; case "splineWithSymbols" : config = new Chart ( "chart" , new SplineWithSymbolsOptions ( ) , theme ) ; break ; case "irregularIntervals" : config = new Chart ( "chart" , new TimeDataWithIrregularIntervalsOptions ( ) , theme ) ; break ; case "logarithmicAxis" : config = new Chart ( "chart" , new LogarithmicAxisOptions ( ) , theme ) ; break ; case "scatter" : config = new Chart ( "chart" , new ScatterPlotOptions ( ) , theme ) ; break ; case "area" : config = new Chart ( "chart" , new BasicAreaOptions ( ) , theme ) ; break ; case "areaWithNegativeValues" : config = new Chart ( "chart" , new AreaWithNegativeValuesOptions ( ) , theme ) ; break ; case "stackedAndGroupedColumn" : config = new Chart ( "chart" , new StackedAndGroupedColumnOptions ( ) , theme ) ; break ; case "combo" : config = new Chart ( "chart" , new ComboOptions ( ) , theme ) ; break ; case "donut" : config = new Chart ( "chart" , new DonutOptions ( ) , theme ) ; break ; case "withDataLabels" : config = new Chart ( "chart" , new LineWithDataLabelsOptions ( ) , theme ) ; break ; case "zoomableTimeSeries" : config = new Chart ( "chart" , new ZoomableTimeSeriesOptions ( ) , theme ) ; break ; case "splineInverted" : config = new Chart ( "chart" , new SplineWithInvertedAxisOptions ( ) , theme ) ; break ; case "splineWithPlotBands" : config = new Chart ( "chart" , new SplineWithPlotBandsOptions ( ) , theme ) ; break ; case "polar" : config = new Chart ( "chart" , new PolarOptions ( ) , theme ) ; break ; case "stackedArea" : config = new Chart ( "chart" , new StackedAreaOptions ( ) , theme ) ; break ; case "percentageArea" : config = new Chart ( "chart" , new PercentageAreaOptions ( ) , theme ) ; break ; case "areaMissing" : config = new Chart ( "chart" , new AreaMissingOptions ( ) , theme ) ; break ; case "areaInverted" : config = new Chart ( "chart" , new AreaInvertedAxisOptions ( ) , theme ) ; break ; case "areaSpline" : config = new Chart ( "chart" , new AreaSplineOptions ( ) , theme ) ; break ; case "areaSplineRange" : config = new Chart ( "chart" , new AreaSplineRangeOptions ( ) , theme ) ; break ; case "columnWithDrilldown" : config = new Chart ( "chart" , new ColumnWithDrilldownOptions ( ) , theme ) ; break ; case "columnRotated" : config = new Chart ( "chart" , new ColumnWithRotatedLabelsOptions ( ) , theme ) ; break ; case "stackedBar" : config = new Chart ( "chart" , new StackedBarOptions ( ) , theme ) ; break ; case "barNegativeStack" : config = new Chart ( "chart" , new StackedBarOptions ( ) , theme ) ; break ; case "basicColumn" : config = new Chart ( "chart" , new BasicColumnOptions ( ) , theme ) ; break ; case "columnWithNegativeValues" : config = new Chart ( "chart" , new ColumnWithNegativeValuesOptions ( ) , theme ) ; break ; case "stackedColumn" : config = new Chart ( "chart" , new StackedColumnOptions ( ) , theme ) ; break ; case "stackedPercentage" : config = new Chart ( "chart" , new StackedPercentageOptions ( ) , theme ) ; break ; case "basicPie" : config = new Chart ( "chart" , new BasicPieOptions ( ) , theme ) ; break ; case "pieWithGradient" : config = new Chart ( "chart" , new PieWithGradientOptions ( ) , theme ) ; break ; case "pieWithLegend" : config = new Chart ( "chart" , new PieWithLegendOptions ( ) , theme ) ; break ; case "splineUpdating" : config = new Chart ( "chart" , new WicketSplineUpdatingOptions ( ) , theme ) ; break ; case "bubble" : config = new Chart ( "chart" , new BubbleChartOptions ( ) , theme ) ; break ; case "3dbubble" : config = new Chart ( "chart" , new BubbleChart3DOptions ( ) , theme ) ; break ; case "boxplot" : config = new Chart ( "chart" , new BoxplotChartOptions ( ) , theme ) ; break ; case "interactive" : config = new Chart ( "chart" , new InteractionOptions ( ) , theme ) ; break ; case "angularGauge" : config = new Chart ( "chart" , new AngularGaugeOptions ( ) , theme ) ; break ; case "spiderweb" : config = new Chart ( "chart" , new SpiderwebOptions ( ) , theme ) ; break ; case "windrose" : config = new Chart ( "chart" , new WindroseOptions ( ) , theme ) ; break ; case "columnrange" : config = new Chart ( "chart" , new ColumnRangeOptions ( ) , theme ) ; break ; case "arearange" : config = new Chart ( "chart" , new AreaRangeOptions ( ) , theme ) ; break ; case "clicktoadd" : config = new Chart ( "chart" , new ClickToAddAPointOptions ( ) , theme ) ; break ; case "dualAxes" : config = new Chart ( "chart" , new DualAxesOptions ( ) , theme ) ; break ; case "scatterWithRegression" : config = new Chart ( "chart" , new ScatterWithRegressionLineOptions ( ) , theme ) ; break ; case "multipleAxes" : config = new Chart ( "chart" , new MultipleAxesOptions ( ) , theme ) ; break ; case "errorBar" : config = new Chart ( "chart" , new ErrorBarOptions ( ) , theme ) ; break ; case "funnel" : config = new Chart ( "chart" , new FunnelOptions ( ) , theme ) ; break ; case "pyramid" : config = new Chart ( "chart" , new PyramidOptions ( ) , theme ) ; break ; case "heatmap" : config = new Chart ( "chart" , new HeatmapOptions ( ) , theme ) ; break ; default : config = new Chart ( "chart" , new BasicLineOptions ( ) , theme ) ; break ; } return config ;
public class CmsFrameset { /** * Returns a html select box filled with the current users accessible sites . < p > * @ param htmlAttributes attributes that will be inserted into the generated html * @ return a html select box filled with the current users accessible sites */ public String getSiteSelect ( String htmlAttributes ) { } }
List < String > options = new ArrayList < String > ( ) ; List < String > values = new ArrayList < String > ( ) ; int selectedIndex = 0 ; List < CmsSite > sites = OpenCms . getSiteManager ( ) . getAvailableSites ( getCms ( ) , true ) ; Iterator < CmsSite > i = sites . iterator ( ) ; int pos = 0 ; while ( i . hasNext ( ) ) { CmsSite site = i . next ( ) ; values . add ( site . getSiteRoot ( ) ) ; options . add ( substituteSiteTitle ( site . getTitle ( ) ) ) ; String siteRoot = CmsFileUtil . addTrailingSeparator ( site . getSiteRoot ( ) ) ; String settingsSiteRoot = getSettings ( ) . getSite ( ) ; if ( settingsSiteRoot != null ) { settingsSiteRoot = CmsFileUtil . addTrailingSeparator ( settingsSiteRoot ) ; } if ( siteRoot . equals ( settingsSiteRoot ) ) { // this is the user ' s current site selectedIndex = pos ; } pos ++ ; } return buildSelect ( htmlAttributes , options , values , selectedIndex ) ;
public class MatchSpaceImpl { /** * handled without ever calling this routine ) . */ private synchronized void pessimisticGet ( Object key , MatchSpaceKey msg , EvalCache cache , Object rootContext , SearchResults result ) throws MatchingException , BadMessageFormatMatchingException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . entry ( this , cclass , "pessimisticGet" , new Object [ ] { key , msg , cache , result } ) ; // Everything must execute under the MatchSpace lock // Obtain the cache entry and determine if its otherMatchers and results entries are // usable , invalidating them if not . CacheEntry e = getCacheEntry ( key , true ) ; if ( e . matchTreeGeneration != matchTreeGeneration ) { e . cachedResults = null ; e . otherMatchers = null ; } // Look in the cache for a usable cachedResults , using them to satisfy the request // iff the results object is willing to accept them . if ( e . cachedResults != null && result . acceptCacheable ( e . cachedResults ) ) { resultCacheHitGets ++ ; pessimisticGets ++ ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "pessimisticGet" ) ; return ; } // Prepare the EvalCache , since we will be passing the msg through at least some // matchers . cache . prepareCache ( subExpr . evalCacheSize ( ) ) ; // Next , look in cache for reusable otherMatchers , to avoid searching // the full matchTree . if ( e . otherMatchers != null ) { // Have a cache hit that covers other matchers , so just run them . for ( int i = 0 ; i < e . otherMatchers . length ; i ++ ) { try { e . otherMatchers [ i ] . get ( null , msg , cache , rootContext , result ) ; } catch ( RuntimeException exc ) { // No FFDC Code Needed . // FFDC driven by wrapper class . FFDC . processException ( this , cclass , "com.ibm.ws.sib.matchspace.impl.MatchSpaceImpl.pessimisticGet" , exc , "1:677:1.44" ) ; // TODO : tc . exception ( tc , exc ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "pessimisticGet" , exc ) ; throw new MatchingException ( exc ) ; } } wildCacheHitGets ++ ; } else // Have to do wildcards the slow way if ( matchTree != null ) { CacheingSearchResults csr = new CacheingSearchResults ( result ) ; try { matchTree . get ( key , msg , cache , rootContext , csr ) ; } catch ( RuntimeException exc ) { // No FFDC Code Needed . // FFDC driven by wrapper class . FFDC . processException ( this , cclass , "com.ibm.ws.sib.matchspace.impl.MatchSpaceImpl.pessimisticGet" , exc , "1:704:1.44" ) ; // TODO : tc . exception ( tc , exc ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "pessimisticGet" , exc ) ; throw new MatchingException ( exc ) ; } e . otherMatchers = csr . getMatchers ( ) ; e . matchTreeGeneration = matchTreeGeneration ; e . noResultCache |= csr . hasContent ; wildCacheMissGets ++ ; } // Now do exact match ( if any ) if ( e . exactMatcher != null ) { try { e . exactMatcher . get ( null , msg , cache , rootContext , result ) ; } catch ( RuntimeException exc ) { // No FFDC Code Needed . // FFDC driven by wrapper class . FFDC . processException ( this , cclass , "com.ibm.ws.sib.matchspace.impl.MatchSpaceImpl.pessimisticGet" , exc , "1:731:1.44" ) ; // TODO : tc . exception ( tc , exc ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "pessimisticGet" , exc ) ; throw new MatchingException ( exc ) ; } exactMatches ++ ; } // If we are able , place something in the cache for next time if ( ! e . noResultCache ) { e . cachedResults = result . provideCacheable ( key ) ; if ( e . cachedResults != null ) resultsCached ++ ; } // And we are done pessimisticGets ++ ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "pessimisticGet" ) ; return ;
public class ConfigurationAction { /** * < p > getClasspaths . < / p > * @ return a { @ link java . util . Set } object . */ public Set < String > getClasspaths ( ) { } }
Set < String > classpaths = selectedRunner . getClasspaths ( ) ; return classpaths == null ? new HashSet < String > ( ) : classpaths ;
public class JobHistoryFileParserHadoop2 { /** * Returns the Task ID or Task Attempt ID , stripped of the leading job ID , appended to the job row * key . */ public byte [ ] getTaskKey ( String prefix , String jobNumber , String fullId ) { } }
String taskComponent = fullId ; if ( fullId == null ) { taskComponent = "" ; } else { String expectedPrefix = prefix + jobNumber + "_" ; if ( ( fullId . startsWith ( expectedPrefix ) ) && ( fullId . length ( ) > expectedPrefix . length ( ) ) ) { taskComponent = fullId . substring ( expectedPrefix . length ( ) ) ; } } return taskKeyConv . toBytes ( new TaskKey ( this . jobKey , taskComponent ) ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link ParameterValueGroupType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link ParameterValueGroupType } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "parameterValueGroup" , substitutionHeadNamespace = "http://www.opengis.net/gml" , substitutionHeadName = "_generalParameterValue" ) public JAXBElement < ParameterValueGroupType > createParameterValueGroup ( ParameterValueGroupType value ) { } }
return new JAXBElement < ParameterValueGroupType > ( _ParameterValueGroup_QNAME , ParameterValueGroupType . class , null , value ) ;
public class AbstractDb { /** * 查询单条单个字段记录 , 并将其转换为Number * @ param sql 查询语句 * @ param params 参数 * @ return 结果对象 * @ throws SQLException SQL执行异常 */ public Number queryNumber ( String sql , Object ... params ) throws SQLException { } }
return query ( sql , new NumberHandler ( ) , params ) ;
public class IfcTextStyleFontModelImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) @ Override public EList < String > getFontFamily ( ) { } }
return ( EList < String > ) eGet ( Ifc4Package . Literals . IFC_TEXT_STYLE_FONT_MODEL__FONT_FAMILY , true ) ;
public class AuthenticationService { /** * Returns the AuthenticatedUser associated with the given session and * credentials , performing a fresh authentication and creating a new * AuthenticatedUser if necessary . * @ param existingSession * The current GuacamoleSession , or null if no session exists yet . * @ param credentials * The Credentials to use to authenticate the user . * @ return * The AuthenticatedUser associated with the given session and * credentials . * @ throws GuacamoleException * If an error occurs while authenticating or re - authenticating the * user . */ private AuthenticatedUser getAuthenticatedUser ( GuacamoleSession existingSession , Credentials credentials ) throws GuacamoleException { } }
try { // Re - authenticate user if session exists if ( existingSession != null ) { AuthenticatedUser updatedUser = updateAuthenticatedUser ( existingSession . getAuthenticatedUser ( ) , credentials ) ; fireAuthenticationSuccessEvent ( updatedUser ) ; return updatedUser ; } // Otherwise , attempt authentication as a new user AuthenticatedUser authenticatedUser = AuthenticationService . this . authenticateUser ( credentials ) ; fireAuthenticationSuccessEvent ( authenticatedUser ) ; if ( logger . isInfoEnabled ( ) ) logger . info ( "User \"{}\" successfully authenticated from {}." , authenticatedUser . getIdentifier ( ) , getLoggableAddress ( credentials . getRequest ( ) ) ) ; return authenticatedUser ; } // Log and rethrow any authentication errors catch ( GuacamoleException e ) { fireAuthenticationFailedEvent ( credentials ) ; // Get request and username for sake of logging HttpServletRequest request = credentials . getRequest ( ) ; String username = credentials . getUsername ( ) ; // Log authentication failures with associated usernames if ( username != null ) { if ( logger . isWarnEnabled ( ) ) logger . warn ( "Authentication attempt from {} for user \"{}\" failed." , getLoggableAddress ( request ) , username ) ; } // Log anonymous authentication failures else if ( logger . isDebugEnabled ( ) ) logger . debug ( "Anonymous authentication attempt from {} failed." , getLoggableAddress ( request ) ) ; // Rethrow exception throw e ; }
public class AbstractRoxListener { /** * Retrieve a name from a test * @ param description The description of the test * @ param mAnnotation The method annotation * @ return The name retrieved */ private String getName ( Description description , RoxableTest mAnnotation ) { } }
if ( mAnnotation == null || mAnnotation . name ( ) == null || mAnnotation . name ( ) . isEmpty ( ) ) { return Inflector . getHumanName ( description . getMethodName ( ) ) ; } else { return mAnnotation . name ( ) ; }
public class Router { /** * Replaces this Router ' s top { @ link Controller } with a new { @ link Controller } * @ param transaction The transaction detailing what should be pushed , including the { @ link Controller } , * and its push and pop { @ link ControllerChangeHandler } , and its tag . */ @ SuppressWarnings ( "WeakerAccess" ) @ UiThread public void replaceTopController ( @ NonNull RouterTransaction transaction ) { } }
ThreadUtils . ensureMainThread ( ) ; RouterTransaction topTransaction = backstack . peek ( ) ; if ( ! backstack . isEmpty ( ) ) { trackDestroyingController ( backstack . pop ( ) ) ; } final ControllerChangeHandler handler = transaction . pushChangeHandler ( ) ; if ( topTransaction != null ) { // noinspection ConstantConditions final boolean oldHandlerRemovedViews = topTransaction . pushChangeHandler ( ) == null || topTransaction . pushChangeHandler ( ) . removesFromViewOnPush ( ) ; final boolean newHandlerRemovesViews = handler == null || handler . removesFromViewOnPush ( ) ; if ( ! oldHandlerRemovedViews && newHandlerRemovesViews ) { for ( RouterTransaction visibleTransaction : getVisibleTransactions ( backstack . iterator ( ) ) ) { performControllerChange ( null , visibleTransaction , true , handler ) ; } } } pushToBackstack ( transaction ) ; if ( handler != null ) { handler . setForceRemoveViewOnPush ( true ) ; } performControllerChange ( transaction . pushChangeHandler ( handler ) , topTransaction , true ) ;
public class DefaultMonetaryCurrenciesSingletonSpi { /** * This default implementation simply returns all providers defined in arbitrary order . * @ return the default provider chain , never null . */ @ Override public List < String > getDefaultProviderChain ( ) { } }
List < String > provList = new ArrayList < > ( ) ; String defaultChain = MonetaryConfig . getConfig ( ) . get ( "currencies.default-chain" ) ; if ( defaultChain != null ) { String [ ] items = defaultChain . split ( "," ) ; for ( String item : items ) { if ( getProviderNames ( ) . contains ( item . trim ( ) ) ) { provList . add ( item ) ; } else { Logger . getLogger ( getClass ( ) . getName ( ) ) . warning ( "Ignoring non existing default provider: " + item ) ; } } } else { Bootstrap . getServices ( CurrencyProviderSpi . class ) . forEach ( p -> provList . add ( p . getProviderName ( ) ) ) ; } return provList ;
public class ArrayUtils { /** * Copies in order { @ code sourceFirst } and { @ code sourceSecond } into { @ code dest } . * @ param sourceFirst * @ param sourceSecond * @ param dest * @ param < T > */ public static < T > void concat ( T [ ] sourceFirst , T [ ] sourceSecond , T [ ] dest ) { } }
System . arraycopy ( sourceFirst , 0 , dest , 0 , sourceFirst . length ) ; System . arraycopy ( sourceSecond , 0 , dest , sourceFirst . length , sourceSecond . length ) ;
public class ScreenUtil { /** * Create the font saved in this key ; null = Not found . * ( Utility method ) . * Font is saved in three properties ( font . fontname , font . size , font . style ) . * @ param returnDefaultIfNone TODO * @ return The registered font . */ public static FontUIResource getFont ( PropertyOwner propertyOwner , Map < String , Object > properties , boolean returnDefaultIfNone ) { } }
String strFontName = ScreenUtil . getPropery ( ScreenUtil . FONT_NAME , propertyOwner , properties , null ) ; String strFontSize = ScreenUtil . getPropery ( ScreenUtil . FONT_SIZE , propertyOwner , properties , null ) ; String strFontStyle = ScreenUtil . getPropery ( ScreenUtil . FONT_STYLE , propertyOwner , properties , null ) ; if ( ( strFontName == null ) || ( strFontName . length ( ) == 0 ) ) { if ( ! returnDefaultIfNone ) return null ; strFontName = Font . DIALOG ; // Default font } int iSize = 18 ; // Default size if ( ( strFontSize != null ) && ( strFontSize . length ( ) > 0 ) ) iSize = Integer . parseInt ( strFontSize ) ; int iStyle = Font . PLAIN ; if ( ( strFontStyle != null ) && ( strFontStyle . length ( ) > 0 ) ) iStyle = Integer . parseInt ( strFontStyle ) ; return new FontUIResource ( strFontName , iStyle , iSize ) ;
public class ShakeAroundAPI { /** * 配置设备与页面的关联关系 * @ param accessToken accessToken * @ param deviceBindPage deviceBindPage * @ return result */ public static DeviceBindPageResult deviceBindPage ( String accessToken , DeviceBindPage deviceBindPage ) { } }
return deviceBindPage ( accessToken , JsonUtil . toJSONString ( deviceBindPage ) ) ;
public class MatcherThread { /** * If the comparator decides that the ( non - key ) attributes do no match , this method is called . * Default implementation is to call preprocessMatch , followed by executor . addForUpdate * @ param oldObject The existing version of the object ( typically from the database ) * @ param newObject The new version of the object ( typically from a file or other source ) */ protected void handleUpdate ( T oldObject , T newObject ) { } }
this . preprocessMatch ( oldObject , newObject ) ; executor . addForUpdate ( oldObject , newObject ) ;
public class DeltaTimeMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DeltaTime deltaTime , ProtocolMarshaller protocolMarshaller ) { } }
if ( deltaTime == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deltaTime . getOffsetSeconds ( ) , OFFSETSECONDS_BINDING ) ; protocolMarshaller . marshall ( deltaTime . getTimeExpression ( ) , TIMEEXPRESSION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class FileInputFormat { /** * Enumerate all files in the directory and recursive if enumerateNestedFiles is true . * @ return the total length of accepted files . */ private long addFilesInDir ( Path path , List < FileStatus > files , boolean logExcludedFiles ) throws IOException { } }
final FileSystem fs = path . getFileSystem ( ) ; long length = 0 ; for ( FileStatus dir : fs . listStatus ( path ) ) { if ( dir . isDir ( ) ) { if ( acceptFile ( dir ) && enumerateNestedFiles ) { length += addFilesInDir ( dir . getPath ( ) , files , logExcludedFiles ) ; } else { if ( logExcludedFiles && LOG . isDebugEnabled ( ) ) { LOG . debug ( "Directory " + dir . getPath ( ) . toString ( ) + " did not pass the file-filter and is excluded." ) ; } } } else { if ( acceptFile ( dir ) ) { files . add ( dir ) ; length += dir . getLen ( ) ; testForUnsplittable ( dir ) ; } else { if ( logExcludedFiles && LOG . isDebugEnabled ( ) ) { LOG . debug ( "Directory " + dir . getPath ( ) . toString ( ) + " did not pass the file-filter and is excluded." ) ; } } } } return length ;
public class ArrayMath { /** * Returns the smallest element of the matrix */ public static int min ( int [ ] [ ] matrix ) { } }
int min = Integer . MAX_VALUE ; for ( int [ ] row : matrix ) { for ( int elem : row ) { min = Math . min ( min , elem ) ; } } return min ;
public class WonderPushView { /** * Sets the resource for the web content displayed in this WonderPushView ' s WebView . */ public void setResource ( String resource , RequestParams params ) { } }
if ( null == resource ) { WonderPush . logError ( "null resource provided to WonderPushView" ) ; return ; } mInitialResource = resource ; mInitialRequestParams = params ; mIsPreloading = false ; if ( null == params ) params = new RequestParams ( ) ; WonderPushRequestParamsDecorator . decorate ( resource , params ) ; String url = String . format ( Locale . getDefault ( ) , "%s?%s" , WonderPushUriHelper . getNonSecureAbsoluteUrl ( resource ) , params . getURLEncodedString ( ) ) ; mWebView . loadUrl ( url ) ;
public class Range { /** * Creates a new { @ link Range } with the specified inclusive start and the specified exclusive end . */ public R of ( @ Nonnull T startClosed , @ Nonnull T endOpen ) { } }
return startClosed ( startClosed ) . endOpen ( endOpen ) ;
public class QuartzScheduler { /** * Resume ( un - pause ) the < code > { @ link ITrigger } < / code > with the given name . * If the < code > Trigger < / code > missed one or more fire - times , then the * < code > Trigger < / code > ' s misfire instruction will be applied . */ public void resumeTrigger ( final TriggerKey triggerKey ) throws SchedulerException { } }
validateState ( ) ; m_aResources . getJobStore ( ) . resumeTrigger ( triggerKey ) ; notifySchedulerThread ( 0L ) ; notifySchedulerListenersResumedTrigger ( triggerKey ) ;
public class NodeAuthModuleContext { /** * Returns the current singleton instance of the Node Authentication Module Context from the * ThreadLocal cache . If the ThreadLocal cache has not been initialized or does not contain * this context , then create and initialize module context , register in the ThreadLocal * and return the new instance . * @ return Context singleton */ public static NodeAuthModuleContext getContext ( ) { } }
SecurityContext securityContext = SecurityContextFactory . getSecurityContext ( ) ; if ( ! securityContext . isInitialized ( ) ) { securityContext . initialize ( ) ; } AbstractModuleContext moduleContext = securityContext . getModuleContext ( CONTEXT_ID ) ; if ( ! ( moduleContext instanceof NodeAuthModuleContext ) ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Initializing the NodeAuthModuleContext" ) ; } moduleContext = ContextInitializer . defaultInitialize ( ) ; securityContext . registerModuleContext ( CONTEXT_ID , moduleContext ) ; } return ( NodeAuthModuleContext ) moduleContext ;
public class MoonPosition { /** * / * [ deutsch ] * < p > Berechnet die Position des Mondes zum angegebenen Zeitpunkt und am angegebenen Beobachterstandpunkt . < / p > * @ param moment the time when the position of moon is to be determined * @ param location geographical location of observer * @ return moon position */ public static MoonPosition at ( Moment moment , GeoLocation location ) { } }
double [ ] data = calculateMeeus ( JulianDay . ofEphemerisTime ( moment ) . getCenturyJ2000 ( ) ) ; double ra = Math . toRadians ( data [ 2 ] ) ; double decl = Math . toRadians ( data [ 3 ] ) ; double distance = data [ 4 ] ; double latRad = Math . toRadians ( location . getLatitude ( ) ) ; double lngRad = Math . toRadians ( location . getLongitude ( ) ) ; double cosLatitude = Math . cos ( latRad ) ; double sinLatitude = Math . sin ( latRad ) ; int altitude = location . getAltitude ( ) ; double mjd = JulianDay . ofMeanSolarTime ( moment ) . getMJD ( ) ; double nutationCorr = data [ 0 ] * Math . cos ( Math . toRadians ( data [ 1 ] ) ) ; // needed for apparent sidereal time double tau = AstroUtils . gmst ( mjd ) + Math . toRadians ( nutationCorr ) + lngRad - ra ; // transformation to horizontal coordinate system double sinElevation = sinLatitude * Math . sin ( decl ) + cosLatitude * Math . cos ( decl ) * Math . cos ( tau ) ; double elevation = Math . toDegrees ( Math . asin ( sinElevation ) ) ; double dip = StdSolarCalculator . TIME4J . getGeodeticAngle ( location . getLatitude ( ) , altitude ) ; if ( elevation >= - 0.5 - dip ) { // if below horizon then we don ' t apply any correction for refraction double parallax = Math . toDegrees ( Math . asin ( 6378.14 / distance ) ) ; double factorTemperaturePressure = AstroUtils . refractionFactorOfStdAtmosphere ( altitude ) ; double refraction = factorTemperaturePressure * AstroUtils . getRefraction ( elevation ) / 60 ; elevation = elevation - parallax + refraction ; // apparent elevation // elevation = elevation - ( 8.0 / 60 ) ; / / simplified formula } double azimuth = // atan2 chosen for correct quadrant Math . toDegrees ( Math . atan2 ( Math . sin ( tau ) , Math . cos ( tau ) * sinLatitude - Math . tan ( decl ) * cosLatitude ) ) + 180 ; return new MoonPosition ( data [ 2 ] , data [ 3 ] , azimuth , elevation , distance ) ;
public class ProvFactory { /** * A factory method to create an instance of a usage { @ link Used } * @ param id an optional identifier for a usage * @ param activity the identifier of the < a href = " http : / / www . w3 . org / TR / prov - dm / # usage . activity " > activity < / a > that used an entity * @ param entity an optional identifier for the < a href = " http : / / www . w3 . org / TR / prov - dm / # usage . entity " > entity < / a > being used * @ return an instance of { @ link Used } */ public Used newUsed ( QualifiedName id , QualifiedName activity , QualifiedName entity ) { } }
Used res = newUsed ( id ) ; res . setActivity ( activity ) ; res . setEntity ( entity ) ; return res ;
public class KafkaLoader { /** * Create a Volt client from the supplied configuration and list of servers . */ private static Client getVoltClient ( ClientConfig config , List < String > hosts ) throws Exception { } }
config . setTopologyChangeAware ( true ) ; final Client client = ClientFactory . createClient ( config ) ; for ( String host : hosts ) { try { client . createConnection ( host ) ; } catch ( IOException e ) { // Only swallow exceptions caused by Java network or connection problem // Unresolved hostname exceptions will be thrown } } if ( client . getConnectedHostList ( ) . isEmpty ( ) ) { try { client . close ( ) ; } catch ( Exception ignore ) { } throw new Exception ( "Unable to connect to any servers" ) ; } return client ;
public class CronPatternUtil { /** * 列举指定日期范围内所有匹配表达式的日期 * @ param pattern 表达式 * @ param start 起始时间 * @ param end 结束时间 * @ param count 列举数量 * @ param isMatchSecond 是否匹配秒 * @ return 日期列表 */ public static List < Date > matchedDates ( CronPattern pattern , long start , long end , int count , boolean isMatchSecond ) { } }
Assert . isTrue ( start < end , "Start date is later than end !" ) ; final List < Date > result = new ArrayList < > ( count ) ; long step = isMatchSecond ? DateUnit . SECOND . getMillis ( ) : DateUnit . MINUTE . getMillis ( ) ; for ( long i = start ; i < end ; i += step ) { if ( pattern . match ( i , isMatchSecond ) ) { result . add ( DateUtil . date ( i ) ) ; if ( result . size ( ) >= count ) { break ; } } } return result ;
public class CharacterJsonSerializer { /** * { @ inheritDoc } */ @ Override public void doSerialize ( JsonWriter writer , Character value , JsonSerializationContext ctx , JsonSerializerParameters params ) { } }
writer . value ( value . toString ( ) ) ;
public class CommerceCountryPersistenceImpl { /** * Removes the commerce country where groupId = & # 63 ; and numericISOCode = & # 63 ; from the database . * @ param groupId the group ID * @ param numericISOCode the numeric iso code * @ return the commerce country that was removed */ @ Override public CommerceCountry removeByG_N ( long groupId , int numericISOCode ) throws NoSuchCountryException { } }
CommerceCountry commerceCountry = findByG_N ( groupId , numericISOCode ) ; return remove ( commerceCountry ) ;
public class DraggableView { /** * Animates the view to become show . * @ param diff * The distance the view has to be vertically moved by , as an { @ link Integer } value * @ param animationSpeed * The speed of the animation in pixels per milliseconds as a { @ link Float } value * @ param interpolator * The interpolator , which should be used by the animation , as an instance of the type * { @ link Interpolator } . The interpolator may not be null */ private void animateShowView ( final int diff , final float animationSpeed , @ NonNull final Interpolator interpolator ) { } }
animateView ( diff , animationSpeed , createAnimationListener ( true , false ) , interpolator ) ;
public class SquaresIntoClusters { /** * Reset and recycle data structures from the previous run */ protected void recycleData ( ) { } }
for ( int i = 0 ; i < nodes . size ( ) ; i ++ ) { SquareNode n = nodes . get ( i ) ; for ( int j = 0 ; j < n . edges . length ; j ++ ) { if ( n . edges [ j ] != null ) { graph . detachEdge ( n . edges [ j ] ) ; } } } for ( int i = 0 ; i < nodes . size ( ) ; i ++ ) { SquareNode n = nodes . get ( i ) ; for ( int j = 0 ; j < n . edges . length ; j ++ ) { if ( n . edges [ j ] != null ) throw new RuntimeException ( "BUG!" ) ; } } nodes . reset ( ) ; for ( int i = 0 ; i < clusters . size ; i ++ ) { clusters . get ( i ) . clear ( ) ; } clusters . reset ( ) ;
public class ServiceDirectoryCache { /** * Get all Services with instances together . * @ return * the List of Service with its ServiceInstances . */ public List < V > getAllServicesWithInstance ( ) { } }
if ( cache == null || cache . size ( ) == 0 ) { return Collections . emptyList ( ) ; } return Lists . newArrayList ( cache . values ( ) ) ;
public class StoredPaymentChannelServerStates { /** * Gets the { @ link StoredServerChannel } with the given channel id ( ie contract transaction hash ) . */ public StoredServerChannel getChannel ( Sha256Hash id ) { } }
lock . lock ( ) ; try { return mapChannels . get ( id ) ; } finally { lock . unlock ( ) ; }
public class MDC { /** * Remove the the context identified by the < code > key < / code > * parameter . */ public static void remove ( String key ) { } }
if ( setContext ( ) ) { m_context . remove ( key ) ; } else { m_defaultContext . remove ( key ) ; }
public class MemoryManager { /** * Tries to release the memory for the specified segment . If the segment has already been released or * is null , the request is simply ignored . * < p > If the memory manager manages pre - allocated memory , the memory segment goes back to the memory pool . * Otherwise , the segment is only freed and made eligible for reclamation by the GC . * @ param segment The segment to be released . * @ throws IllegalArgumentException Thrown , if the given segment is of an incompatible type . */ public void release ( MemorySegment segment ) { } }
// check if segment is null or has already been freed if ( segment == null || segment . getOwner ( ) == null ) { return ; } final Object owner = segment . getOwner ( ) ; // - - - - - BEGIN CRITICAL SECTION - - - - - synchronized ( lock ) { // prevent double return to this memory manager if ( segment . isFreed ( ) ) { return ; } if ( isShutDown ) { throw new IllegalStateException ( "Memory manager has been shut down." ) ; } // remove the reference in the map for the owner try { Set < MemorySegment > segsForOwner = this . allocatedSegments . get ( owner ) ; if ( segsForOwner != null ) { segsForOwner . remove ( segment ) ; if ( segsForOwner . isEmpty ( ) ) { this . allocatedSegments . remove ( owner ) ; } } if ( isPreAllocated ) { // release the memory in any case memoryPool . returnSegmentToPool ( segment ) ; } else { segment . free ( ) ; numNonAllocatedPages ++ ; } } catch ( Throwable t ) { throw new RuntimeException ( "Error removing book-keeping reference to allocated memory segment." , t ) ; } } // - - - - - END CRITICAL SECTION - - - - -
public class CalendarIntervalTrigger { /** * Returns the final time at which the < code > DateIntervalTrigger < / code > will * fire , if there is no end time set , null will be returned . * Note that the return time may be in the past . */ @ Override public Date getFinalFireTime ( ) { } }
if ( m_bComplete || getEndTime ( ) == null ) { return null ; } // back up a second from end time Date fTime = new Date ( getEndTime ( ) . getTime ( ) - 1000L ) ; // find the next fire time after that fTime = getFireTimeAfter ( fTime , true ) ; // the the trigger fires at the end time , that ' s it ! if ( fTime . equals ( getEndTime ( ) ) ) return fTime ; // otherwise we have to back up one interval from the fire time after the // end time final Calendar lTime = PDTFactory . createCalendar ( ) ; if ( m_aTimeZone != null ) lTime . setTimeZone ( m_aTimeZone ) ; lTime . setTime ( fTime ) ; lTime . setLenient ( true ) ; if ( getRepeatIntervalUnit ( ) . equals ( EIntervalUnit . SECOND ) ) { lTime . add ( Calendar . SECOND , - 1 * getRepeatInterval ( ) ) ; } else if ( getRepeatIntervalUnit ( ) . equals ( EIntervalUnit . MINUTE ) ) { lTime . add ( Calendar . MINUTE , - 1 * getRepeatInterval ( ) ) ; } else if ( getRepeatIntervalUnit ( ) . equals ( EIntervalUnit . HOUR ) ) { lTime . add ( Calendar . HOUR_OF_DAY , - 1 * getRepeatInterval ( ) ) ; } else if ( getRepeatIntervalUnit ( ) . equals ( EIntervalUnit . DAY ) ) { lTime . add ( Calendar . DAY_OF_YEAR , - 1 * getRepeatInterval ( ) ) ; } else if ( getRepeatIntervalUnit ( ) . equals ( EIntervalUnit . WEEK ) ) { lTime . add ( Calendar . WEEK_OF_YEAR , - 1 * getRepeatInterval ( ) ) ; } else if ( getRepeatIntervalUnit ( ) . equals ( EIntervalUnit . MONTH ) ) { lTime . add ( Calendar . MONTH , - 1 * getRepeatInterval ( ) ) ; } else if ( getRepeatIntervalUnit ( ) . equals ( EIntervalUnit . YEAR ) ) { lTime . add ( Calendar . YEAR , - 1 * getRepeatInterval ( ) ) ; } return lTime . getTime ( ) ;