signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class CharSequences { /** * Utility to compare a string to a code point . * Same results as turning the code point into a string ( with the [ ugly ] new StringBuilder ( ) . appendCodePoint ( codepoint ) . toString ( ) ) * and comparing , but much faster ( no object creation ) . * Actually , there is one difference ; a null compares as less . * Note that this ( = String ) order is UTF - 16 order - - * not * code point order . * @ deprecated This API is ICU internal only . * @ hide draft / provisional / internal are hidden on Android */ @ Deprecated public static int compare ( CharSequence string , int codePoint ) { } }
if ( codePoint < Character . MIN_CODE_POINT || codePoint > Character . MAX_CODE_POINT ) { throw new IllegalArgumentException ( ) ; } int stringLength = string . length ( ) ; if ( stringLength == 0 ) { return - 1 ; } char firstChar = string . charAt ( 0 ) ; int offset = codePoint - Character . MIN_SUPPLEMENTARY_CODE_POINT ; if ( offset < 0 ) { // BMP codePoint int result = firstChar - codePoint ; if ( result != 0 ) { return result ; } return stringLength - 1 ; } // non BMP char lead = ( char ) ( ( offset >>> 10 ) + Character . MIN_HIGH_SURROGATE ) ; int result = firstChar - lead ; if ( result != 0 ) { return result ; } if ( stringLength > 1 ) { char trail = ( char ) ( ( offset & 0x3ff ) + Character . MIN_LOW_SURROGATE ) ; result = string . charAt ( 1 ) - trail ; if ( result != 0 ) { return result ; } } return stringLength - 2 ;
public class JnlpDownloadServletMojo { @ Override public void execute ( ) throws MojoExecutionException , MojoFailureException { } }
// Check configuration and get all configured jar resources checkConfiguration ( ) ; // Prepare working directory layout IOUtil ioUtil = getIoUtil ( ) ; ioUtil . makeDirectoryIfNecessary ( getWorkDirectory ( ) ) ; ioUtil . copyResources ( getResourcesDirectory ( ) , getWorkDirectory ( ) ) ; // Resolve common jar resources getLog ( ) . info ( "-- Prepare commons jar resources" ) ; Set < ResolvedJarResource > resolvedCommonJarResources ; if ( CollectionUtils . isEmpty ( commonJarResources ) ) { resolvedCommonJarResources = Collections . emptySet ( ) ; } else { resolvedCommonJarResources = resolveJarResources ( commonJarResources , null ) ; } Set < ResolvedJarResource > allResolvedJarResources = new LinkedHashSet < > ( ) ; allResolvedJarResources . addAll ( resolvedCommonJarResources ) ; // Resolved jnlpFiles getLog ( ) . info ( "-- Prepare jnlp files" ) ; Set < ResolvedJnlpFile > resolvedJnlpFiles = new LinkedHashSet < > ( ) ; for ( JnlpFile jnlpFile : jnlpFiles ) { verboseLog ( "prepare jnlp " + jnlpFile ) ; // resolve jar resources of the jnpl file Set < ResolvedJarResource > resolvedJarResources = resolveJarResources ( jnlpFile . getJarResources ( ) , resolvedCommonJarResources ) ; // keep them ( to generate the versions . xml file ) allResolvedJarResources . addAll ( resolvedJarResources ) ; // create the resolved jnlp file ResolvedJnlpFile resolvedJnlpFile = new ResolvedJnlpFile ( jnlpFile , resolvedJarResources ) ; resolvedJnlpFiles . add ( resolvedJnlpFile ) ; } // Process collected jars signOrRenameJars ( ) ; // Generate jnlp files for ( ResolvedJnlpFile jnlpFile : resolvedJnlpFiles ) { generateJnlpFile ( jnlpFile , getLibPath ( ) ) ; } // Generate version xml file generateVersionXml ( allResolvedJarResources ) ; // Copy to final directory // FIXME Should be able to configure this File outputDir = new File ( getProject ( ) . getBuild ( ) . getDirectory ( ) , getProject ( ) . getBuild ( ) . getFinalName ( ) + File . separator + outputDirectoryName ) ; ioUtil . copyDirectoryStructure ( getWorkDirectory ( ) , outputDir ) ;
public class CrawlController { /** * Run the configured crawl . This method blocks until the crawl is done . * @ return the CrawlSession once the crawl is done . */ @ Override public CrawlSession call ( ) { } }
setMaximumCrawlTimeIfNeeded ( ) ; plugins . runPreCrawlingPlugins ( config ) ; CrawlTaskConsumer firstConsumer = consumerFactory . get ( ) ; StateVertex firstState = firstConsumer . crawlIndex ( ) ; crawlSessionProvider . setup ( firstState ) ; plugins . runOnNewStatePlugins ( firstConsumer . getContext ( ) , firstState ) ; executeConsumers ( firstConsumer ) ; return crawlSessionProvider . get ( ) ;
public class LspGetq { /** * lsp _ expand _ 1_2 - . . */ public static void lsp_expand_1_2 ( float buf [ ] , /* in / out : LSP parameters */ float gap /* input */ ) { } }
int j ; float diff , tmp ; for ( j = 1 ; j < LD8KConstants . M ; j ++ ) { diff = buf [ j - 1 ] - buf [ j ] ; tmp = ( diff + gap ) * ( float ) 0.5 ; if ( tmp > 0 ) { buf [ j - 1 ] -= tmp ; buf [ j ] += tmp ; } } return ;
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EEnum getObjectContainerPresentationSpaceSizePDFSize ( ) { } }
if ( objectContainerPresentationSpaceSizePDFSizeEEnum == null ) { objectContainerPresentationSpaceSizePDFSizeEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 177 ) ; } return objectContainerPresentationSpaceSizePDFSizeEEnum ;
public class DefaultEntityHandler { /** * { @ inheritDoc } * @ see jp . co . future . uroborosql . mapping . EntityHandler # setDeleteParams ( jp . co . future . uroborosql . context . SqlContext , java . lang . Object ) */ @ Override public void setDeleteParams ( final SqlContext context , final Object entity ) { } }
setFields ( context , entity , SqlKind . DELETE , MappingColumn :: getCamelName ) ;
public class AnimaQuery { /** * Save a model * @ param model model instance * @ param < S > * @ return ResultKey */ public < S extends Model > ResultKey save ( S model ) { } }
List < Object > columnValues = AnimaUtils . toColumnValues ( model , true ) ; String sql = this . buildInsertSQL ( model , columnValues ) ; Connection conn = getConn ( ) ; try { List < Object > params = columnValues . stream ( ) . filter ( Objects :: nonNull ) . collect ( toList ( ) ) ; return new ResultKey ( conn . createQuery ( sql ) . withParams ( params ) . executeUpdate ( ) . getKey ( ) ) ; } finally { this . closeConn ( conn ) ; this . clean ( conn ) ; }
public class CmsDriverManager { /** * Sorts the given list of { @ link CmsAccessControlEntry } objects . < p > * The the ' all others ' ace in first place , the ' overwrite all ' ace in second . < p > * @ param aces the list of ACEs to sort * @ return < code > true < / code > if the list contains the ' overwrite all ' ace */ private boolean sortAceList ( List < CmsAccessControlEntry > aces ) { } }
// sort the list of entries Collections . sort ( aces , CmsAccessControlEntry . COMPARATOR_ACE ) ; // after sorting just the first 2 positions come in question for ( int i = 0 ; i < Math . min ( aces . size ( ) , 2 ) ; i ++ ) { CmsAccessControlEntry acEntry = aces . get ( i ) ; if ( acEntry . getPrincipal ( ) . equals ( CmsAccessControlEntry . PRINCIPAL_OVERWRITE_ALL_ID ) ) { return true ; } } return false ;
public class IdentityHashMap { /** * Tests whether the specified object reference is a value in this identity * hash map . * @ param value value whose presence in this map is to be tested * @ return < tt > true < / tt > if this map maps one or more keys to the * specified object reference * @ see # containsKey ( Object ) */ public boolean containsValue ( Object value ) { } }
Object [ ] tab = table ; for ( int i = 1 ; i < tab . length ; i += 2 ) if ( tab [ i ] == value && tab [ i - 1 ] != null ) return true ; return false ;
public class Finalizer { /** * Starts the Finalizer thread . FinalizableReferenceQueue calls this method * reflectively . * @ param finalizableReferenceClass FinalizableReference . class * @ param frq reference to instance of FinalizableReferenceQueue that started * this thread * @ return ReferenceQueue which Finalizer will poll */ public static ReferenceQueue < Object > startFinalizer ( Class < ? > finalizableReferenceClass , Object frq ) { } }
/* * We use FinalizableReference . class for two things : * 1 ) To invoke FinalizableReference . finalizeReferent ( ) * 2 ) To detect when FinalizableReference ' s class loader has to be garbage * collected , at which point , Finalizer can stop running */ if ( ! finalizableReferenceClass . getName ( ) . equals ( FINALIZABLE_REFERENCE ) ) { throw new IllegalArgumentException ( "Expected " + FINALIZABLE_REFERENCE + "." ) ; } Finalizer finalizer = new Finalizer ( finalizableReferenceClass , frq ) ; finalizer . start ( ) ; return finalizer . queue ;
public class TypedLinkSchemaAndFacetNameMarshaller { /** * Marshall the given parameter object . */ public void marshall ( TypedLinkSchemaAndFacetName typedLinkSchemaAndFacetName , ProtocolMarshaller protocolMarshaller ) { } }
if ( typedLinkSchemaAndFacetName == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( typedLinkSchemaAndFacetName . getSchemaArn ( ) , SCHEMAARN_BINDING ) ; protocolMarshaller . marshall ( typedLinkSchemaAndFacetName . getTypedLinkName ( ) , TYPEDLINKNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DispatcherServletHelper { /** * " cannot resolve view named : " + viewName ) ; */ private @ Nullable View resolveViewName ( String viewName , Locale locale ) throws Exception { } }
for ( ViewResolver r : resolvers ) { View view = r . resolveViewName ( viewName , locale ) ; if ( view != null ) { return view ; } } return null ;
public class AbstractAliasMappingBuilder { /** * This method will add the given routings as both search & index routing . */ public K addRouting ( List < String > routings ) { } }
this . indexRouting . addAll ( routings ) ; this . searchRouting . addAll ( routings ) ; return ( K ) this ;
public class MwRevisionDumpFileProcessor { /** * Processes current XML starting from a & lt ; revision & gt ; start tag up to * the corresponding end tag . This method uses the current state of * { @ link # xmlReader } and stores its results in according member fields . * When the method has finished , { @ link # xmlReader } will be at the next * element after the closing tag of this block . * @ throws XMLStreamException * if there was a problem reading the XML or if the XML is * malformed * @ throws MwDumpFormatException * if the contents of the XML file did not match our * expectations of a MediaWiki XML dump */ void processXmlRevision ( ) throws XMLStreamException , MwDumpFormatException { } }
this . mwRevision . resetCurrentRevisionData ( ) ; this . xmlReader . next ( ) ; // skip current start tag while ( this . xmlReader . hasNext ( ) ) { switch ( this . xmlReader . getEventType ( ) ) { case XMLStreamConstants . START_ELEMENT : switch ( this . xmlReader . getLocalName ( ) ) { case MwRevisionDumpFileProcessor . E_REV_COMMENT : this . mwRevision . comment = this . xmlReader . getElementText ( ) ; break ; case MwRevisionDumpFileProcessor . E_REV_TEXT : this . mwRevision . text = this . xmlReader . getElementText ( ) ; break ; case MwRevisionDumpFileProcessor . E_REV_TIMESTAMP : this . mwRevision . timeStamp = this . xmlReader . getElementText ( ) ; break ; case MwRevisionDumpFileProcessor . E_REV_FORMAT : this . mwRevision . format = this . xmlReader . getElementText ( ) ; break ; case MwRevisionDumpFileProcessor . E_REV_MODEL : this . mwRevision . model = this . xmlReader . getElementText ( ) ; break ; case MwRevisionDumpFileProcessor . E_REV_CONTRIBUTOR : processXmlContributor ( ) ; break ; case MwRevisionDumpFileProcessor . E_REV_ID : this . mwRevision . revisionId = Long . parseLong ( this . xmlReader . getElementText ( ) ) ; break ; case MwRevisionDumpFileProcessor . E_REV_PARENT_ID : this . mwRevision . parentRevisionId = Long . parseLong ( this . xmlReader . getElementText ( ) ) ; break ; case MwRevisionDumpFileProcessor . E_REV_SHA1 : case MwRevisionDumpFileProcessor . E_REV_MINOR : break ; default : throw new MwDumpFormatException ( "Unexpected element \"" + this . xmlReader . getLocalName ( ) + "\" in revision." ) ; } break ; case XMLStreamConstants . END_ELEMENT : if ( MwRevisionDumpFileProcessor . E_PAGE_REVISION . equals ( this . xmlReader . getLocalName ( ) ) ) { this . mwRevisionProcessor . processRevision ( this . mwRevision ) ; return ; } break ; } this . xmlReader . next ( ) ; }
public class TypefaceHelper { /** * Set the typeface to the target view . * @ param view to set typeface . * @ param typefaceName typeface name . * @ param < V > text view parameter . */ public < V extends TextView > void setTypeface ( V view , String typefaceName ) { } }
Typeface typeface = mCache . get ( typefaceName ) ; view . setTypeface ( typeface ) ;
public class JobInProgress { /** * Refresh speculative task candidates and running tasks . This needs to be * called periodically to obtain fresh values . */ void refresh ( long now ) { } }
refreshCandidateSpeculativeMaps ( now ) ; refreshCandidateSpeculativeReduces ( now ) ; refreshTaskCountsAndWaitTime ( TaskType . MAP , now ) ; refreshTaskCountsAndWaitTime ( TaskType . REDUCE , now ) ;
public class BaseServiceImp { /** * / * ( non - Javadoc ) * @ see com . popbill . api . BaseService # getCorpInfo ( java . lang . String , java . lang . String ) */ @ Override public CorpInfo getCorpInfo ( String CorpNum , String UserID ) throws PopbillException { } }
return httpget ( "/CorpInfo" , CorpNum , UserID , CorpInfo . class ) ;
public class BCPImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) @ Override public void eSet ( int featureID , Object newValue ) { } }
switch ( featureID ) { case AfplibPackage . BCP__RS_NAME : setRSName ( ( String ) newValue ) ; return ; case AfplibPackage . BCP__TRIPLETS : getTriplets ( ) . clear ( ) ; getTriplets ( ) . addAll ( ( Collection < ? extends Triplet > ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ;
public class N { /** * Mostly it ' s designed for one - step operation to complete the operation in one step . * < code > java . util . stream . Stream < / code > is preferred for multiple phases operation . * Note : This is NOT a replacement of traditional for loop statement . * The traditional for loop is still recommended in regular programming . * @ param c * @ param fromIndex * @ param toIndex * @ param action */ public static < T , C extends Collection < ? extends T > , E extends Exception > void forEach ( final C c , int fromIndex , final int toIndex , final Try . IndexedConsumer < ? super T , E > action ) throws E { } }
N . checkFromToIndex ( fromIndex < toIndex ? fromIndex : ( toIndex == - 1 ? 0 : toIndex ) , fromIndex < toIndex ? toIndex : fromIndex , size ( c ) ) ; N . checkArgNotNull ( action ) ; if ( N . isNullOrEmpty ( c ) && fromIndex == 0 && toIndex == 0 ) { return ; } fromIndex = N . min ( c . size ( ) - 1 , fromIndex ) ; if ( c instanceof List && c instanceof RandomAccess ) { final List < T > list = ( List < T > ) c ; if ( fromIndex <= toIndex ) { for ( int i = fromIndex ; i < toIndex ; i ++ ) { action . accept ( i , list . get ( i ) ) ; } } else { for ( int i = fromIndex ; i > toIndex ; i -- ) { action . accept ( i , list . get ( i ) ) ; } } } else { final Iterator < ? extends T > iter = c . iterator ( ) ; int idx = 0 ; if ( fromIndex < toIndex ) { while ( idx < fromIndex && iter . hasNext ( ) ) { iter . next ( ) ; idx ++ ; } while ( iter . hasNext ( ) ) { action . accept ( idx , iter . next ( ) ) ; if ( ++ idx >= toIndex ) { break ; } } } else { while ( idx <= toIndex && iter . hasNext ( ) ) { iter . next ( ) ; idx ++ ; } final T [ ] a = ( T [ ] ) new Object [ fromIndex - toIndex ] ; while ( iter . hasNext ( ) ) { a [ idx - 1 - toIndex ] = iter . next ( ) ; if ( idx ++ >= fromIndex ) { break ; } } for ( int i = a . length - 1 ; i >= 0 ; i -- ) { action . accept ( i + toIndex + 1 , a [ i ] ) ; } } }
public class JsonConverter { /** * 获取签名源串内容 * @ param body * @ param rootNode * @ param indexOfRootNode * @ return */ private String parseSignSourceData ( String body , String rootNode , int indexOfRootNode ) { } }
// 第一个字母 + 长度 + 引号和分号 int signDataStartIndex = indexOfRootNode + rootNode . length ( ) + 2 ; int indexOfSign = body . indexOf ( "\"" + AlipayConstants . SIGN + "\"" ) ; if ( indexOfSign < 0 ) { return null ; } // 签名前 - 逗号 int signDataEndIndex = indexOfSign - 1 ; return body . substring ( signDataStartIndex , signDataEndIndex ) ;
public class JndiRepositoryFactory { /** * Get or initialize the JCR Repository instance as described by the supplied configuration file and repository name . * @ param configFileName the name of the file containing the configuration information for the { @ code ModeShapeEngine } ; may * not be null . This method will first attempt to load this file as a resource from the classpath . If no resource with * the given name exists , the name will be treated as a file name and loaded from the file system . May be null if the * repository should already exist . * @ param repositoryName the name of the repository ; may be null if the repository name is to be read from the configuration * file ( note that this does require parsing the configuration file ) * @ param nameCtx the naming context used to register a removal listener to shut down the repository when removed from JNDI ; * may be null * @ param jndiName the name in JNDI where the repository is to be found * @ return the JCR repository instance * @ throws IOException if there is an error or problem reading the configuration resource at the supplied path * @ throws RepositoryException if the repository could not be started * @ throws NamingException if there is an error registering the namespace listener */ private static synchronized JcrRepository getRepository ( String configFileName , String repositoryName , final Context nameCtx , final Name jndiName ) throws IOException , RepositoryException , NamingException { } }
if ( ! StringUtil . isBlank ( repositoryName ) ) { // Make sure the engine is running . . . ENGINE . start ( ) ; // See if we can shortcut the process by using the name . . . try { JcrRepository repository = ENGINE . getRepository ( repositoryName ) ; switch ( repository . getState ( ) ) { case STARTING : case RUNNING : return repository ; default : LOG . error ( JcrI18n . repositoryIsNotRunningOrHasBeenShutDown , repositoryName ) ; return null ; } } catch ( NoSuchRepositoryException e ) { if ( configFileName == null ) { // No configuration file given , so we can ' t do anything . . . throw e ; } // Nothing found , so continue . . . } } RepositoryConfiguration config = RepositoryConfiguration . read ( configFileName ) ; if ( repositoryName == null ) { repositoryName = config . getName ( ) ; } else if ( ! repositoryName . equals ( config . getName ( ) ) ) { LOG . warn ( JcrI18n . repositoryNameDoesNotMatchConfigurationName , repositoryName , config . getName ( ) , configFileName ) ; } // Try to deploy and start the repository . . . ENGINE . start ( ) ; JcrRepository repository = ENGINE . deploy ( config ) ; try { ENGINE . startRepository ( repository . getName ( ) ) . get ( ) ; } catch ( InterruptedException e ) { Thread . interrupted ( ) ; throw new RepositoryException ( e ) ; } catch ( ExecutionException e ) { throw new RepositoryException ( e . getCause ( ) ) ; } // Register the JNDI listener , to shut down the repository when removed from JNDI . . . if ( nameCtx instanceof EventContext ) { registerNamingListener ( ( EventContext ) nameCtx , jndiName ) ; } return repository ;
public class HttpDispatcher { /** * Access the event engine service . * @ return EventEngine - null if not found */ public static EventEngine getEventService ( ) { } }
HttpDispatcher f = instance . get ( ) . get ( ) ; if ( f != null ) return f . eventSvc ; return null ;
public class KeyMap { /** * For testing only : Actively counts the number of entries , rather than using the * counter variable . This method has linear complexity , rather than constant . * @ return The counted number of entries . */ int traverseAndCountElements ( ) { } }
int num = 0 ; for ( Entry < ? , ? > entry : table ) { while ( entry != null ) { num ++ ; entry = entry . next ; } } return num ;
public class KmeansCalculator { /** * double配列の除算結果を算出する 。 * @ param base ベース配列 * @ param subNumber 除算を行う数 * @ return 除算結果 */ protected static double [ ] sub ( double [ ] base , double subNumber ) { } }
int dataNum = base . length ; double [ ] result = new double [ dataNum ] ; for ( int index = 0 ; index < dataNum ; index ++ ) { result [ index ] = base [ index ] / subNumber ; } return result ;
public class XmlSchemaParser { /** * Helper function to convert a schema byteOrderName into a { @ link ByteOrder } * @ param byteOrderName specified as a FIX SBE string * @ return ByteOrder representation */ public static ByteOrder getByteOrder ( final String byteOrderName ) { } }
switch ( byteOrderName ) { case "littleEndian" : return ByteOrder . LITTLE_ENDIAN ; case "bigEndian" : return ByteOrder . BIG_ENDIAN ; default : return ByteOrder . LITTLE_ENDIAN ; }
public class AlignedBox3f { /** * Sets the framing box of this < code > Shape < / code > * based on the specified center point coordinates and corner point * coordinates . The framing box is used by the subclasses of * < code > BoxedShape < / code > to define their geometry . * @ param centerX the X coordinate of the specified center point * @ param centerY the Y coordinate of the specified center point * @ param centerZ the Z coordinate of the specified center point * @ param cornerX the X coordinate of the specified corner point * @ param cornerY the Y coordinate of the specified corner point * @ param cornerZ the Z coordinate of the specified corner point */ @ Override public void setFromCenter ( double centerX , double centerY , double centerZ , double cornerX , double cornerY , double cornerZ ) { } }
double dx = centerX - cornerX ; double dy = centerY - cornerY ; double dz = centerZ - cornerZ ; setFromCorners ( cornerX , cornerY , cornerZ , centerX + dx , centerY + dy , centerZ + dz ) ;
public class CassandraSchemaMgr { /** * Create a new ColumnFamily with the given parameters . If the new CF is * created successfully , wait for all nodes in the cluster to receive the schema * change before returning . An exception is thrown if the CF create fails . The * current DB connection can be connected to any keyspace . * @ param dbConn Database connection to use . * @ param keyspace Keyspace that owns new CF . * @ param cfName name of new CF . * @ param bBinaryValues True if column values shoud be binary . */ public void createColumnFamily ( DBConn dbConn , String keyspace , String cfName , boolean bBinaryValues ) { } }
m_logger . info ( "Creating ColumnFamily: {}:{}" , keyspace , cfName ) ; CfDef cfDef = new CfDef ( ) ; cfDef . setKeyspace ( keyspace ) ; cfDef . setName ( cfName ) ; cfDef . setColumn_type ( "Standard" ) ; cfDef . setComparator_type ( "UTF8Type" ) ; cfDef . setKey_validation_class ( "UTF8Type" ) ; if ( bBinaryValues ) { cfDef . setDefault_validation_class ( "BytesType" ) ; } else { cfDef . setDefault_validation_class ( "UTF8Type" ) ; } Map < String , Object > cfOptions = m_service . getParamMap ( "cf_defaults" ) ; if ( cfOptions != null ) { for ( String optName : cfOptions . keySet ( ) ) { Object optValue = cfOptions . get ( optName ) ; CfDef . _Fields fieldEnum = CfDef . _Fields . findByName ( optName ) ; if ( fieldEnum == null ) { m_logger . warn ( "Unknown ColumnFamily option: {}" , optName ) ; continue ; } try { cfDef . setFieldValue ( fieldEnum , optValue ) ; } catch ( Exception e ) { m_logger . warn ( "Error setting ColumnFamily option '" + optName + "' to '" + optValue + "' -- ignoring" , e ) ; } } } // In a multi - node startup , multiple nodes may be trying to create the same CF . for ( int attempt = 1 ; ! columnFamilyExists ( dbConn , keyspace , cfName ) ; attempt ++ ) { try { dbConn . getClientSession ( ) . system_add_column_family ( cfDef ) ; waitForSchemaPropagation ( dbConn ) ; } catch ( Exception ex ) { if ( attempt > m_service . getParamInt ( "max_commit_attempts" , 10 ) ) { String msg = String . format ( "%d attempts to create ColumnFamily %s:%s failed" , attempt , keyspace , cfName ) ; throw new RuntimeException ( msg , ex ) ; } try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException e ) { } } }
public class Shell { /** * Executes a giving shell command * @ param command the commands to execute * @ param background execute in background * @ return process information handle */ public ProcessInfo execute ( boolean background , String ... command ) { } }
ProcessBuilder pb = new ProcessBuilder ( command ) ; return executeProcess ( background , pb ) ;
public class MatrixIO { /** * Reads in the content of the file as a two dimensional Java array matrix . * This method has been deprecated in favor of using purely { @ link Matrix } * objects for all operations . If a Java array is needed , the { @ link * Matrix # toArray ( ) } method may be used to generate one . * @ return a two - dimensional array of the matrix contained in provided file */ @ Deprecated public static double [ ] [ ] readMatrixArray ( File input , Format format ) throws IOException { } }
// Use the same code path for reading the Matrix object and then dump to // an array . This comes at a potential 2X space usage , but greatly // reduces the possibilities for bugs . return readMatrix ( input , format ) . toDenseArray ( ) ;
public class S3RestServiceHandler { /** * under the temporary multipart upload directory are combined into the final object . */ private Response completeMultipartUpload ( final String bucket , final String object , final long uploadId ) { } }
return S3RestUtils . call ( bucket , new S3RestUtils . RestCallable < CompleteMultipartUploadResult > ( ) { @ Override public CompleteMultipartUploadResult call ( ) throws S3Exception { String bucketPath = parseBucketPath ( AlluxioURI . SEPARATOR + bucket ) ; checkBucketIsAlluxioDirectory ( bucketPath ) ; String objectPath = bucketPath + AlluxioURI . SEPARATOR + object ; AlluxioURI multipartTemporaryDir = new AlluxioURI ( S3RestUtils . getMultipartTemporaryDirForObject ( bucketPath , object ) ) ; checkUploadId ( multipartTemporaryDir , uploadId ) ; try { List < URIStatus > parts = mFileSystem . listStatus ( multipartTemporaryDir ) ; Collections . sort ( parts , new URIStatusNameComparator ( ) ) ; CreateFilePOptions options = CreateFilePOptions . newBuilder ( ) . setRecursive ( true ) . setWriteType ( getS3WriteType ( ) ) . build ( ) ; FileOutStream os = mFileSystem . createFile ( new AlluxioURI ( objectPath ) , options ) ; MessageDigest md5 = MessageDigest . getInstance ( "MD5" ) ; DigestOutputStream digestOutputStream = new DigestOutputStream ( os , md5 ) ; try { for ( URIStatus part : parts ) { try ( FileInStream is = mFileSystem . openFile ( new AlluxioURI ( part . getPath ( ) ) ) ) { ByteStreams . copy ( is , digestOutputStream ) ; } } } finally { digestOutputStream . close ( ) ; } mFileSystem . delete ( multipartTemporaryDir , DeletePOptions . newBuilder ( ) . setRecursive ( true ) . build ( ) ) ; String entityTag = Hex . encodeHexString ( md5 . digest ( ) ) ; return new CompleteMultipartUploadResult ( objectPath , bucket , object , entityTag ) ; } catch ( Exception e ) { throw toObjectS3Exception ( e , objectPath ) ; } } } ) ;
public class HttpRequestParser { /** * Parses a header value . This is called from the generated bytecode . * @ param buffer The buffer * @ param state The current state * @ param builder The exchange builder * @ return The number of bytes remaining */ @ SuppressWarnings ( "unused" ) final void handleHeaderValue ( ByteBuffer buffer , ParseState state , HttpServerExchange builder ) throws BadRequestException { } }
HttpString headerName = state . nextHeader ; StringBuilder stringBuilder = state . stringBuilder ; CacheMap < HttpString , String > headerValuesCache = state . headerValuesCache ; if ( headerName != null && stringBuilder . length ( ) == 0 && headerValuesCache != null ) { String existing = headerValuesCache . get ( headerName ) ; if ( existing != null ) { if ( handleCachedHeader ( existing , buffer , state , builder ) ) { return ; } } } handleHeaderValueCacheMiss ( buffer , state , builder , headerName , headerValuesCache , stringBuilder ) ;
public class MPLSH { /** * Returns the approximate k - nearest neighbors . A posteriori multiple probe * model has to be trained already . * @ param q the query object . * @ param kthe number of nearest neighbors to search for . * @ param recall the expected recall rate . * @ param T the maximum number of probes . */ public Neighbor < double [ ] , E > [ ] knn ( double [ ] q , int k , double recall , int T ) { } }
if ( recall > 1 || recall < 0 ) { throw new IllegalArgumentException ( "Invalid recall: " + recall ) ; } if ( k < 1 ) { throw new IllegalArgumentException ( "Invalid k: " + k ) ; } double alpha = 1 - Math . pow ( 1 - recall , 1.0 / hash . size ( ) ) ; int hit = 0 ; IntArrayList candidates = new IntArrayList ( ) ; for ( int i = 0 ; i < hash . size ( ) ; i ++ ) { IntArrayList buckets = model . get ( i ) . getProbeSequence ( q , alpha , T ) ; for ( int j = 0 ; j < buckets . size ( ) ; j ++ ) { int bucket = buckets . get ( j ) ; ArrayList < HashEntry > bin = hash . get ( i ) . table [ bucket % H ] ; if ( bin != null ) { for ( HashEntry e : bin ) { if ( e . bucket == bucket ) { if ( q != e . key || identicalExcluded ) { candidates . add ( e . index ) ; } } } } } } int [ ] cand = candidates . toArray ( ) ; Arrays . sort ( cand ) ; Neighbor < double [ ] , E > neighbor = new Neighbor < > ( null , null , 0 , Double . MAX_VALUE ) ; @ SuppressWarnings ( "unchecked" ) Neighbor < double [ ] , E > [ ] neighbors = ( Neighbor < double [ ] , E > [ ] ) java . lang . reflect . Array . newInstance ( neighbor . getClass ( ) , k ) ; HeapSelect < Neighbor < double [ ] , E > > heap = new HeapSelect < > ( neighbors ) ; for ( int i = 0 ; i < k ; i ++ ) { heap . add ( neighbor ) ; } int prev = - 1 ; for ( int index : cand ) { if ( index == prev ) { continue ; } else { prev = index ; } double [ ] key = keys . get ( index ) ; double dist = Math . distance ( q , key ) ; if ( dist < heap . peek ( ) . distance ) { heap . add ( new Neighbor < > ( key , data . get ( index ) , index , dist ) ) ; hit ++ ; } } heap . sort ( ) ; if ( hit < k ) { @ SuppressWarnings ( "unchecked" ) Neighbor < double [ ] , E > [ ] n2 = ( Neighbor < double [ ] , E > [ ] ) java . lang . reflect . Array . newInstance ( neighbor . getClass ( ) , hit ) ; int start = k - hit ; for ( int i = 0 ; i < hit ; i ++ ) { n2 [ i ] = neighbors [ i + start ] ; } neighbors = n2 ; } return neighbors ;
public class Agg { /** * Get a { @ link Collector } that calculates the * < code > COUNT ( DISTINCT expr ) < / code > function . */ public static < T , U > Collector < T , ? , Long > countDistinctBy ( Function < ? super T , ? extends U > function ) { } }
return Collector . of ( ( ) -> new HashSet < U > ( ) , ( s , v ) -> s . add ( function . apply ( v ) ) , ( s1 , s2 ) -> { s1 . addAll ( s2 ) ; return s1 ; } , s -> ( long ) s . size ( ) ) ;
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIDD ( ) { } }
if ( iddEClass == null ) { iddEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 273 ) ; } return iddEClass ;
public class Counters { /** * Prints one or more lines ( with a newline at the end ) describing the * difference between the two Counters . Great for debugging . */ public static < E > void printCounterComparison ( Counter < E > a , Counter < E > b , PrintWriter out ) { } }
if ( a . equals ( b ) ) { out . println ( "Counters are equal." ) ; return ; } for ( E key : a . keySet ( ) ) { double aCount = a . getCount ( key ) ; double bCount = b . getCount ( key ) ; if ( Math . abs ( aCount - bCount ) > 1e-5 ) { out . println ( "Counters differ on key " + key + '\t' + a . getCount ( key ) + " vs. " + b . getCount ( key ) ) ; } } // left overs Set < E > rest = new HashSet < E > ( b . keySet ( ) ) ; rest . removeAll ( a . keySet ( ) ) ; for ( E key : rest ) { double aCount = a . getCount ( key ) ; double bCount = b . getCount ( key ) ; if ( Math . abs ( aCount - bCount ) > 1e-5 ) { out . println ( "Counters differ on key " + key + '\t' + a . getCount ( key ) + " vs. " + b . getCount ( key ) ) ; } }
public class HostStatusTracker { /** * Helper method that actually changes the state of the class to reflect the new set of hosts up and down * Note that the new HostStatusTracker is returned that holds onto the new state . Calling classes must update their * references to use the new HostStatusTracker * @ param hostsUp * @ param hostsDown * @ return */ public HostStatusTracker computeNewHostStatus ( Collection < Host > hostsUp , Collection < Host > hostsDown ) { } }
verifyMutuallyExclusive ( hostsUp , hostsDown ) ; Set < Host > nextActiveHosts = new HashSet < Host > ( hostsUp ) ; // Get the hosts that are currently down Set < Host > nextInactiveHosts = new HashSet < Host > ( hostsDown ) ; // add any previous hosts that were currently down iff they are still reported by the HostSupplier Set < Host > union = new HashSet < > ( hostsUp ) ; union . addAll ( hostsDown ) ; if ( ! union . containsAll ( inactiveHosts ) ) { logger . info ( "REMOVING at least one inactive host from {} b/c it is no longer reported by HostSupplier" , inactiveHosts ) ; inactiveHosts . retainAll ( union ) ; } nextInactiveHosts . addAll ( inactiveHosts ) ; // Now remove from the total set of inactive hosts any host that is currently up . // This typically happens when a host moves from the inactive state to the active state . // And hence it will be there in the prev inactive set , and will also be there in the new active set // for this round . for ( Host host : nextActiveHosts ) { nextInactiveHosts . remove ( host ) ; } // Now add any host that is not in the new active hosts set and that was in the previous active set Set < Host > prevActiveHosts = new HashSet < Host > ( activeHosts ) ; prevActiveHosts . removeAll ( hostsUp ) ; // If anyone is remaining in the prev set then add it to the inactive set , since it has gone away nextInactiveHosts . addAll ( prevActiveHosts ) ; for ( Host host : nextActiveHosts ) { host . setStatus ( Status . Up ) ; } for ( Host host : nextInactiveHosts ) { host . setStatus ( Status . Down ) ; } return new HostStatusTracker ( nextActiveHosts , nextInactiveHosts ) ;
public class LNDImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setFntLID ( Integer newFntLID ) { } }
Integer oldFntLID = fntLID ; fntLID = newFntLID ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . LND__FNT_LID , oldFntLID , fntLID ) ) ;
public class BusItinerary { /** * Remove the bus halt at the specified index . * @ param index is the index of the bus halt to remove . * @ return < code > true < / code > if the bus halt was successfully removed , otherwise < code > false < / code > */ public boolean removeBusHalt ( int index ) { } }
try { final BusItineraryHalt removedBushalt ; if ( index < this . validHalts . size ( ) ) { removedBushalt = this . validHalts . remove ( index ) ; } else { final int idx = index - this . validHalts . size ( ) ; removedBushalt = this . invalidHalts . remove ( idx ) ; } removedBushalt . setContainer ( null ) ; removedBushalt . setRoadSegmentIndex ( - 1 ) ; removedBushalt . setPositionOnSegment ( Float . NaN ) ; removedBushalt . setEventFirable ( true ) ; removedBushalt . checkPrimitiveValidity ( ) ; fireShapeChanged ( new BusChangeEvent ( this , BusChangeEventType . ITINERARY_HALT_REMOVED , removedBushalt , removedBushalt . indexInParent ( ) , "shape" , // $ NON - NLS - 1 $ null , null ) ) ; checkPrimitiveValidity ( ) ; return true ; } catch ( Throwable exception ) { } return false ;
public class JaxWsHttpServletRequestAdapter { /** * ( non - Javadoc ) * @ see javax . servlet . http . HttpServletRequest # getIntHeader ( java . lang . String ) */ @ Override public int getIntHeader ( String arg0 ) { } }
try { collaborator . preInvoke ( componentMetaData ) ; return request . getIntHeader ( arg0 ) ; } finally { collaborator . postInvoke ( ) ; }
public class GrammarError { /** * setter for ruleId - sets * @ generated */ public void setRuleId ( String v ) { } }
if ( GrammarError_Type . featOkTst && ( ( GrammarError_Type ) jcasType ) . casFeat_ruleId == null ) jcasType . jcas . throwFeatMissing ( "ruleId" , "cogroo.uima.GrammarError" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( GrammarError_Type ) jcasType ) . casFeatCode_ruleId , v ) ;
public class GetBuiltinIntentRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetBuiltinIntentRequest getBuiltinIntentRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getBuiltinIntentRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getBuiltinIntentRequest . getSignature ( ) , SIGNATURE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CheckAccessControls { /** * Determines whether a deprecation warning should be emitted . * @ param t The current traversal . * @ param n The node which we are checking . * @ param parent The parent of the node which we are checking . */ private boolean shouldEmitDeprecationWarning ( NodeTraversal t , Node n ) { } }
// In the global scope , there are only two kinds of accesses that should // be flagged for warnings : // 1 ) Calls of deprecated functions and methods . // 2 ) Instantiations of deprecated classes . // For now , we just let everything else by . if ( t . inGlobalScope ( ) ) { if ( ! NodeUtil . isInvocationTarget ( n ) && ! n . isNew ( ) ) { return false ; } } return ! canAccessDeprecatedTypes ( t ) ;
public class AssetsApi { /** * Get character asset locations Return locations for a set of item ids , * which you can get from character assets endpoint . Coordinates for items * in hangars or stations are set to ( 0,0,0 ) - - - SSO Scope : * esi - assets . read _ assets . v1 * @ param characterId * An EVE character ID ( required ) * @ param requestBody * A list of item ids ( required ) * @ param datasource * The server name you would like data from ( optional , default to * tranquility ) * @ param token * Access token to use if unable to set a header ( optional ) * @ return ApiResponse & lt ; List & lt ; CharacterAssetsLocationsResponse & gt ; & gt ; * @ throws ApiException * If fail to call the API , e . g . server error or cannot * deserialize the response body */ public ApiResponse < List < CharacterAssetsLocationsResponse > > postCharactersCharacterIdAssetsLocationsWithHttpInfo ( Integer characterId , List < Long > requestBody , String datasource , String token ) throws ApiException { } }
com . squareup . okhttp . Call call = postCharactersCharacterIdAssetsLocationsValidateBeforeCall ( characterId , requestBody , datasource , token , null ) ; Type localVarReturnType = new TypeToken < List < CharacterAssetsLocationsResponse > > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ;
public class LetsEncryptService { /** * Issue a certificate for a domain ( or a set of domains ) * @ param domains * @ return */ public LetsEncryptCertificateEntity issue ( final String domains ) { } }
// First , prove that we own the domains for ( String domain : domains . split ( "," ) ) proveOwnership ( domain ) ; // Next , ( re ) generate certificates return generateOrRenewCertificate ( domains ) ;
public class ImmutableRoaringBitmap { /** * Cardinality of the bitwise OR ( union ) operation . The provided bitmaps are * not * modified . This * operation is thread - safe as long as the provided bitmaps remain unchanged . * If you have more than 2 bitmaps , consider using the FastAggregation class . * @ param x1 first bitmap * @ param x2 other bitmap * @ return cardinality of the union * @ see BufferFastAggregation # or ( ImmutableRoaringBitmap . . . ) * @ see BufferFastAggregation # horizontal _ or ( ImmutableRoaringBitmap . . . ) */ public static int orCardinality ( final ImmutableRoaringBitmap x1 , final ImmutableRoaringBitmap x2 ) { } }
// we use the fact that the cardinality of the bitmaps is known so that // the union is just the total cardinality minus the intersection return x1 . getCardinality ( ) + x2 . getCardinality ( ) - andCardinality ( x1 , x2 ) ;
public class HadoopUtils { /** * Provisions resource represented as { @ link File } to the { @ link FileSystem } for a given application * @ param localResource * @ param fs * @ param applicationName * @ return */ public static Path provisionResourceToFs ( File localResource , FileSystem fs , String applicationName ) throws Exception { } }
String destinationFilePath = applicationName + "/" + localResource . getName ( ) ; Path provisionedPath = new Path ( fs . getHomeDirectory ( ) , destinationFilePath ) ; provisioinResourceToFs ( fs , new Path ( localResource . getAbsolutePath ( ) ) , provisionedPath ) ; return provisionedPath ;
public class AbstractPlanNode { /** * Remove child from this node . * @ param child to remove . */ public void unlinkChild ( AbstractPlanNode child ) { } }
assert ( child != null ) ; m_children . remove ( child ) ; child . m_parents . remove ( this ) ;
public class HostVsanInternalSystem { /** * Abdicate ownership of DOM objects . The objects must be currently owned by this host . * Which host has ownership of an object at a given point in time can be queried from * QueryVsanObjects ( ) or QueryCmmds ( ) APIs . Abidcating ownership tears down DOM owner * in - memory state . Hosts in the cluster will then compete to become the new owner of * the object , similar to a host failure event . There is a short interuption of IO flow * while the owner re - election is going on , but it is transparent to any consumers of the * object . This API is meant as a troubleshooting and debugging tool . It is internal * at this point and can be used to resolve issues where DOM owner gets " stuck " . * @ param uuids List of VSAN / DOM object UUIDs . * @ return String [ ] * @ throws RemoteException * @ throws RuntimeFault * @ since 6.0 */ public String [ ] abdicateDomOwnership ( String [ ] uuids ) throws RuntimeFault , RemoteException { } }
return getVimService ( ) . abdicateDomOwnership ( getMOR ( ) , uuids ) ;
public class MulticastTransport { /** * This method attempts to join the multicast group in a particular Network * Interface ( NI ) . This is useful for when inbound multicast ONLY can occur on * a particular interface channel . However , if there is some issue with the NI * name , then it attempts to join on the localhost NI . It is possible , * however , unlikely that this will fail as well . This happens when strange * things are happening to the routing tables and the presentation of the NIs * in the OS . This can happen with you have VPN clients or hypervisors running * on the host OS . . . so look out . * @ throws TransportConfigException if there was a problem joining the group */ private void joinGroup ( ) throws TransportConfigException { } }
InetSocketAddress socketAddress = new InetSocketAddress ( multicastAddress , multicastPort ) ; try { // Setup for incoming multicast requests maddress = InetAddress . getByName ( multicastAddress ) ; if ( networkInterface != null ) { ni = NetworkInterface . getByName ( networkInterface ) ; } if ( ni == null ) { InetAddress localhost = InetAddress . getLocalHost ( ) ; LOGGER . debug ( "Network Interface name not specified. Using the NI for localhost [" + localhost . getHostAddress ( ) + "]" ) ; ni = NetworkInterface . getByInetAddress ( localhost ) ; if ( ni != null && ni . isLoopback ( ) ) { LOGGER . warn ( "DEFAULT NETWORK INTERFACE IS THE LOOPBACK !!!!." ) ; LOGGER . warn ( "Attempting to use the NI for localhost [" + ni . getName ( ) + "] is a loopback." ) ; LOGGER . warn ( "Please run the Responder with the -ni switch selecting a more appropriate network interface to use (e.g. -ni eth0)." ) ; throw new TransportConfigException ( "DEFAULT NETWORK INTERFACE IS THE LOOPBACK !!!!." ) ; } } LOGGER . info ( "Starting Responder: Receiving mulitcast @ [" + multicastAddress + ":" + multicastPort + "]" ) ; this . inboundSocket = new MulticastSocket ( multicastPort ) ; if ( ni == null ) { // for some reason NI is still NULL . Not sure why // this happens . this . inboundSocket . joinGroup ( maddress ) ; LOGGER . warn ( "Unable to determine the network interface for the localhost address. Check /etc/hosts for weird entry like 127.0.1.1 mapped to DNS name." ) ; LOGGER . info ( "Unknown network interface joined group [" + socketAddress . toString ( ) + "]" ) ; } else { this . inboundSocket . joinGroup ( socketAddress , ni ) ; LOGGER . info ( ni . getName ( ) + " joined group " + socketAddress . toString ( ) ) ; } } catch ( IOException e ) { if ( ni == null ) { LOGGER . error ( "Error attempting to joint multicast address." , e ) ; } else { StringBuffer buf = new StringBuffer ( ) ; try { buf . append ( "(lb:" + this . ni . isLoopback ( ) + " " ) ; } catch ( SocketException e2 ) { buf . append ( "(lb:err " ) ; } try { buf . append ( "m:" + this . ni . supportsMulticast ( ) + " " ) ; } catch ( SocketException e3 ) { buf . append ( "(m:err " ) ; } try { buf . append ( "p2p:" + this . ni . isPointToPoint ( ) + " " ) ; } catch ( SocketException e1 ) { buf . append ( "p2p:err " ) ; } try { buf . append ( "up:" + this . ni . isUp ( ) + " " ) ; } catch ( SocketException e1 ) { buf . append ( "up:err " ) ; } buf . append ( "v:" + this . ni . isVirtual ( ) + ") " ) ; throw new TransportConfigException ( ni . getName ( ) + " " + buf . toString ( ) + ": could not join group " + socketAddress . toString ( ) , e ) ; } }
public class Matrix4d { /** * Apply an asymmetric off - center perspective projection frustum transformation for a right - handed coordinate system * using OpenGL ' s NDC z range of < code > [ - 1 . . + 1 ] < / code > to this matrix . * The given angles < code > offAngleX < / code > and < code > offAngleY < / code > are the horizontal and vertical angles between * the line of sight and the line given by the center of the near and far frustum planes . So , when < code > offAngleY < / code > * is just < code > fovy / 2 < / code > then the projection frustum is rotated towards + Y and the bottom frustum plane * is parallel to the XZ - plane . * If < code > M < / code > is < code > this < / code > matrix and < code > P < / code > the perspective projection matrix , * then the new matrix will be < code > M * P < / code > . So when transforming a * vector < code > v < / code > with the new matrix by using < code > M * P * v < / code > , * the perspective projection will be applied first ! * In order to set the matrix to a perspective frustum transformation without post - multiplying , * use { @ link # setPerspectiveOffCenter ( double , double , double , double , double , double ) setPerspectiveOffCenter } . * @ see # setPerspectiveOffCenter ( double , double , double , double , double , double ) * @ param fovy * the vertical field of view in radians ( must be greater than zero and less than { @ link Math # PI PI } ) * @ param offAngleX * the horizontal angle between the line of sight and the line crossing the center of the near and far frustum planes * @ param offAngleY * the vertical angle between the line of sight and the line crossing the center of the near and far frustum planes * @ param aspect * the aspect ratio ( i . e . width / height ; must be greater than zero ) * @ param zNear * near clipping plane distance . If the special value { @ link Double # POSITIVE _ INFINITY } is used , the near clipping plane will be at positive infinity . * In that case , < code > zFar < / code > may not also be { @ link Double # POSITIVE _ INFINITY } . * @ param zFar * far clipping plane distance . If the special value { @ link Double # POSITIVE _ INFINITY } is used , the far clipping plane will be at positive infinity . * In that case , < code > zNear < / code > may not also be { @ link Double # POSITIVE _ INFINITY } . * @ return a matrix holding the result */ public Matrix4d perspectiveOffCenter ( double fovy , double offAngleX , double offAngleY , double aspect , double zNear , double zFar ) { } }
return perspectiveOffCenter ( fovy , offAngleX , offAngleY , aspect , zNear , zFar , this ) ;
public class PreDestroyMonitor { /** * final cleanup of managed instances if any */ @ Override public void close ( ) throws Exception { } }
if ( scopeCleaner . close ( ) ) { // executor thread to exit processing loop LOGGER . info ( "closing PreDestroyMonitor..." ) ; List < Map . Entry < Object , UnscopedCleanupAction > > actions = new ArrayList < > ( cleanupActions . entrySet ( ) ) ; if ( actions . size ( ) > 0 ) { LOGGER . warn ( "invoking predestroy action for {} unscoped instances" , actions . size ( ) ) ; actions . stream ( ) . map ( Map . Entry :: getValue ) . collect ( Collectors . groupingBy ( UnscopedCleanupAction :: getContext , Collectors . counting ( ) ) ) . forEach ( ( source , count ) -> { LOGGER . warn ( " including {} objects from source '{}'" , count , source ) ; } ) ; } actions . stream ( ) . sorted ( Map . Entry . comparingByValue ( ) ) . forEach ( action -> { Optional . ofNullable ( action . getKey ( ) ) . ifPresent ( obj -> action . getValue ( ) . call ( obj ) ) ; } ) ; actions . clear ( ) ; cleanupActions . clear ( ) ; scopeBindings . clear ( ) ; scopeBindings = Collections . emptyMap ( ) ; } else { LOGGER . warn ( "PreDestroyMonitor.close() invoked but instance is not running" ) ; }
public class ServletContextInitParameterPhrase { /** * { @ inheritDoc } */ public void init ( EntityConfig config ) { } }
this . source = ( Phrase ) config . getValue ( SOURCE ) ; this . parameter_name = ( Phrase ) config . getValue ( PARAMETER_NAME ) ;
public class CmsSitemapController { /** * Edits an entry and changes its URL name . < p > * @ param entry the entry which is being edited * @ param newUrlName the new URL name of the entry * @ param propertyChanges the property changes * @ param keepNewStatus < code > true < / code > if the entry should keep it ' s new status * @ param reloadStatus a value indicating which entries need to be reloaded after the change */ public void editAndChangeName ( final CmsClientSitemapEntry entry , String newUrlName , List < CmsPropertyModification > propertyChanges , final boolean keepNewStatus , final CmsReloadMode reloadStatus ) { } }
CmsSitemapChange change = getChangeForEdit ( entry , propertyChanges ) ; change . setName ( newUrlName ) ; final CmsUUID entryId = entry . getId ( ) ; final boolean newStatus = keepNewStatus && entry . isNew ( ) ; final CmsUUID updateTarget = ( ( reloadStatus == CmsReloadMode . reloadParent ) ) ? getParentEntry ( entry ) . getId ( ) : entryId ; Command callback = new Command ( ) { public void execute ( ) { if ( ( reloadStatus == CmsReloadMode . reloadParent ) || ( reloadStatus == CmsReloadMode . reloadEntry ) ) { updateEntry ( updateTarget ) ; } getEntryById ( entryId ) . setNew ( newStatus ) ; } } ; commitChange ( change , callback ) ;
public class HttpMeta { /** * Validation . * @ return true , if successful * @ throws ParallelTaskInvalidException * the parallel task invalid exception */ public boolean validation ( ) throws ParallelTaskInvalidException { } }
if ( this . getAsyncHttpClient ( ) == null ) { logger . info ( "USE DEFAULT HTTP CLIENT: Did not set special asyncHttpClient, will use the current default one: " + HttpClientStore . getInstance ( ) . getHttpClientTypeCurrentDefault ( ) . toString ( ) ) ; this . asyncHttpClient = HttpClientStore . getInstance ( ) . getCurrentDefaultClient ( ) ; } if ( this . getHttpMethod ( ) == null ) throw new ParallelTaskInvalidException ( "Missing getHttpMethod!" ) ; if ( this . getHeaderMetadata ( ) == null ) { logger . info ( "USE DEFAULT EMPTY HEADER: Did not specify HTTP header. Will use empty header." + " Use .setHeaders to add headers" ) ; this . setHeaderMetadata ( new ParallecHeader ( ) ) ; } // if null it is OK , just set as the default if ( this . getEntityBody ( ) == null ) setEntityBody ( PcConstants . COMMAND_VAR_DEFAULT_REQUEST_CONTENT ) ; if ( this . getRequestPort ( ) == null ) { setRequestPort ( "80" ) ; logger . info ( "USE DEFAULT PORT: Missing port. SET default port to be 80" ) ; } if ( this . getRequestUrlPostfix ( ) == null || this . getRequestUrlPostfix ( ) . trim ( ) . isEmpty ( ) ) { setRequestUrlPostfix ( "" ) ; logger . info ( "USE DEFAULT URL: RequestUrlPostfix is null or empty. SET as empty \"\". e.g. just want to GET http://parallec.io" ) ; } if ( this . isPollable ( ) && this . getHttpPollerProcessor ( ) == null ) { throw new ParallelTaskInvalidException ( "set pollable but httpPollerProcessor is null!! Invalid. please set httpPollerProcessor() " ) ; } return true ;
public class ZWaveController { /** * Request the battery level from the node / endpoint ; * @ param nodeId the node id to request the battery level for . * @ param endpoint the endpoint to request the battery level for . */ public void requestBatteryLevel ( int nodeId , int endpoint ) { } }
ZWaveNode node = this . getNode ( nodeId ) ; SerialMessage serialMessage = null ; ZWaveBatteryCommandClass zwaveBatteryCommandClass = ( ZWaveBatteryCommandClass ) node . resolveCommandClass ( ZWaveCommandClass . CommandClass . BATTERY , endpoint ) ; if ( zwaveBatteryCommandClass == null ) { logger . error ( "No Command Class BATTERY found on node {}, instance/endpoint {} to request value." , nodeId , endpoint ) ; return ; } serialMessage = node . encapsulate ( zwaveBatteryCommandClass . getValueMessage ( ) , zwaveBatteryCommandClass , endpoint ) ; if ( serialMessage != null ) this . sendData ( serialMessage ) ;
public class Tree { /** * Classify on the compressed tree bytes , from the pre - packed double data */ public static double classify ( AutoBuffer ts , double [ ] ds , double badat , boolean regression ) { } }
ts . get4 ( ) ; // Skip tree - id ts . get8 ( ) ; // Skip seed ts . get1 ( ) ; // Skip producer id byte b ; while ( ( b = ( byte ) ts . get1 ( ) ) != '[' ) { // While not a leaf indicator assert b == '(' || b == 'S' || b == 'E' ; int col = ts . get2 ( ) ; // Column number in model - space float fcmp = ts . get4f ( ) ; // Float to compare against float fdat = Double . isNaN ( ds [ col ] ) ? fcmp - 1 : ( float ) ds [ col ] ; int skip = ( ts . get1 ( ) & 0xFF ) ; if ( skip == 0 ) skip = ts . get3 ( ) ; if ( b == 'E' ) { if ( fdat != fcmp ) ts . position ( ts . position ( ) + skip ) ; } else { // Picking right subtree ? then skip left subtree if ( fdat > fcmp ) ts . position ( ts . position ( ) + skip ) ; } } if ( regression ) return ts . get4f ( ) ; return ts . get1 ( ) & 0xFF ; // Return the leaf ' s class
public class ExpressionProperties { /** * < p > Returns property value with all { @ code $ { propKey } } like references replaced with the value of * the relevant property with recursive resolution . < / p > * < p > The method returns < code > null < / code > if the property is not found . < / p > * @ param key the property key . * @ return the value in this property list with * the specified key value . */ @ Override public String getProperty ( String key ) { } }
String value = getRawPropertyValue ( key ) ; return replaceProperties ( value ) ;
public class CheckGlobalNames { /** * Whether the set is in the global scope and occurs in a module the original ref depends on */ private static boolean isSetFromPrecedingModule ( Ref originalRef , Ref set , JSModuleGraph moduleGraph ) { } }
return set . type == Ref . Type . SET_FROM_GLOBAL && ( originalRef . getModule ( ) == set . getModule ( ) || moduleGraph . dependsOn ( originalRef . getModule ( ) , set . getModule ( ) ) ) ;
public class MembershipHandlerImpl { /** * { @ inheritDoc } */ public void linkMembership ( User user , Group group , MembershipType m , boolean broadcast ) throws Exception { } }
if ( user == null ) { throw new InvalidNameException ( "Can not create membership record because user is null" ) ; } if ( group == null ) { throw new InvalidNameException ( "Can not create membership record because group is null" ) ; } if ( m == null ) { throw new InvalidNameException ( "Can not create membership record because membership type is null" ) ; } Session session = service . getStorageSession ( ) ; try { MembershipImpl membership = new MembershipImpl ( ) ; membership . setMembershipType ( m . getName ( ) ) ; membership . setGroupId ( group . getId ( ) ) ; membership . setUserName ( user . getUserName ( ) ) ; createMembership ( session , membership , broadcast ) ; } finally { session . logout ( ) ; }
public class SvgGraphicsContext { /** * Set the controller on an element of this < code > GraphicsContext < / code > so it can react to events . * @ param object * the element on which the controller should be set . * @ param controller * The new < code > GraphicsController < / code > */ public void setController ( Object object , GraphicsController controller ) { } }
if ( isAttached ( ) ) { helper . setController ( object , controller ) ; }
public class ListAttributeDefinition { /** * Creates a { @ link ModelNode } using the given { @ code value } after first validating the node * against { @ link # getElementValidator ( ) this object ' s element validator } , and then stores it in the given { @ code operation } * model node as an element in a { @ link ModelType # LIST } value in a key / value pair whose key is this attribute ' s * { @ link # getName ( ) name } . * If { @ code value } is { @ code null } an { @ link ModelType # UNDEFINED undefined } node will be stored if such a value * is acceptable to the validator . * The expected usage of this method is in parsers seeking to build up an operation to store their parsed data * into the configuration . * @ param value the value . Will be { @ link String # trim ( ) trimmed } before use if not { @ code null } . * @ param operation model node of type { @ link ModelType # OBJECT } into which the parsed value should be stored * @ param reader { @ link XMLStreamReader } from which the { @ link XMLStreamReader # getLocation ( ) location } from which * the attribute value was read can be obtained and used in any { @ code XMLStreamException } , in case * the given value is invalid . * @ throws XMLStreamException if { @ code value } is not valid * @ deprecated use { @ link # getParser ( ) } */ @ Deprecated public void parseAndAddParameterElement ( final String value , final ModelNode operation , final XMLStreamReader reader ) throws XMLStreamException { } }
ModelNode paramVal = parse ( value , reader ) ; operation . get ( getName ( ) ) . add ( paramVal ) ;
public class DefaultLmlSyntax { /** * Listener tags attributes . */ protected void registerListenerAttributes ( ) { } }
addAttributeProcessor ( new ConditionLmlAttribute ( ) , "if" ) ; addAttributeProcessor ( new KeepListenerLmlAttribute ( ) , "keep" ) ; addAttributeProcessor ( new ListenerIdsLmlAttribute ( ) , "ids" ) ; // InputListener : addAttributeProcessor ( new CombinedKeysLmlAttribute ( ) , "combined" ) ; addAttributeProcessor ( new ListenerKeysLmlAttribute ( ) , "keys" ) ;
public class Partition { /** * Splits this partition by taking the cell at cellIndex and making two * new cells - the first with the singleton splitElement and the second * with the rest of the elements from that cell . * @ param cellIndex the index of the cell to split on * @ param splitElement the element to put in its own cell * @ return a new ( finer ) Partition */ public Partition splitBefore ( int cellIndex , int splitElement ) { } }
Partition r = new Partition ( ) ; // copy the cells up to cellIndex for ( int j = 0 ; j < cellIndex ; j ++ ) { r . addCell ( this . copyBlock ( j ) ) ; } // split the block at block index r . addSingletonCell ( splitElement ) ; SortedSet < Integer > splitBlock = this . copyBlock ( cellIndex ) ; splitBlock . remove ( splitElement ) ; r . addCell ( splitBlock ) ; // copy the blocks after blockIndex , shuffled up by one for ( int j = cellIndex + 1 ; j < this . size ( ) ; j ++ ) { r . addCell ( this . copyBlock ( j ) ) ; } return r ;
public class AbstractAlpineQueryManager { /** * Returns the number of items that would have resulted from returning all object . * This method is performant in that the objects are not actually retrieved , only * the count . * @ param query the query to return a count from * @ return the number of items * @ since 1.0.0 */ public long getCount ( final Query query ) { } }
// query . addExtension ( " datanucleus . query . resultSizeMethod " , " count " ) ; final String ordering = ( ( JDOQuery ) query ) . getInternalQuery ( ) . getOrdering ( ) ; query . setResult ( "count(id)" ) ; query . setOrdering ( null ) ; final long count = ( Long ) query . execute ( ) ; query . setOrdering ( ordering ) ; return count ;
public class NewJFrame { /** * Validate and set the datetime field on the screen given a datetime string . * @ param dateTime The datetime string */ public void setDateTime ( String dateTimeString ) { } }
Date dateTime = null ; try { if ( ( dateTimeString != null ) && ( dateTimeString . length ( ) > 0 ) ) dateTime = dateTimeFormat . parse ( dateTimeString ) ; } catch ( Exception e ) { dateTime = null ; } this . setDateTime ( dateTime ) ;
public class Server { /** * Builds and returns a < code > Map < / code > of parameter name - value pairs * defined as children of the given < code > Element < / code > , according to * the server configuration schema . * If the given element is a CONFIG _ ELEMENT _ ROOT , this method will return * ( along with the server ' s parameter name - value pairs ) a < code > null < / code > - keyed * value , which is an < code > ArrayList < / code > of three < code > HashMap < / code > * objects . The first will contain the name - value pair HashMaps of each of * the CONFIG _ ELEMENT _ MODULE elements found ( in a < code > HashMap < / code > * keyed by < i > role < / i > ) , the second will contain a < code > HashMap < / code > * mapping module < i > role < / i > s to implementation classnames , and the third * will contain the the name - value pair < code > HashMaps < / code > of each of * the CONFIG _ ELEMENT _ DATASTORE elements found ( keyed by * CONFIG _ ATTRIBUTE _ ID ) . * @ param element * The element containing the name - value pair definitions . * @ param dAttribute * The name of the attribute of the < code > Element < / code > whose * value will distinguish this element from others that may occur in * the < code > Document < / code > . If there is no distinguishing * attribute , this should be an empty string . */ private static final Map < String , String > loadParameters ( Element element , String dAttribute ) throws ServerInitializationException { } }
Map < String , String > params = new HashMap < String , String > ( ) ; logger . debug ( MessageFormat . format ( INIT_CONFIG_CONFIG_EXAMININGELEMENT , new Object [ ] { element . getLocalName ( ) , dAttribute } ) ) ; for ( int i = 0 ; i < element . getChildNodes ( ) . getLength ( ) ; i ++ ) { Node n = element . getChildNodes ( ) . item ( i ) ; if ( n . getNodeType ( ) == Node . ELEMENT_NODE ) { if ( n . getLocalName ( ) . equals ( CONFIG_ELEMENT_PARAM ) ) { // if name - value pair , save in the HashMap NamedNodeMap attrs = n . getAttributes ( ) ; Node nameNode = attrs . getNamedItemNS ( CONFIG_NAMESPACE , CONFIG_ATTRIBUTE_NAME ) ; if ( nameNode == null ) { nameNode = attrs . getNamedItem ( CONFIG_ATTRIBUTE_NAME ) ; } Node valueNode = null ; if ( s_serverProfile != null ) { valueNode = attrs . getNamedItemNS ( CONFIG_NAMESPACE , s_serverProfile + "value" ) ; if ( valueNode == null ) { valueNode = attrs . getNamedItem ( s_serverProfile + "value" ) ; } } if ( valueNode == null ) { valueNode = attrs . getNamedItemNS ( CONFIG_NAMESPACE , CONFIG_ATTRIBUTE_VALUE ) ; if ( valueNode == null ) { valueNode = attrs . getNamedItem ( CONFIG_ATTRIBUTE_VALUE ) ; } if ( nameNode == null || valueNode == null ) { throw new ServerInitializationException ( INIT_CONFIG_SEVERE_INCOMPLETEPARAM ) ; } } if ( nameNode . getNodeValue ( ) . isEmpty ( ) || valueNode . getNodeValue ( ) . isEmpty ( ) ) { throw new ServerInitializationException ( MessageFormat . format ( INIT_CONFIG_SEVERE_INCOMPLETEPARAM , new Object [ ] { CONFIG_ELEMENT_PARAM , CONFIG_ATTRIBUTE_NAME , CONFIG_ATTRIBUTE_VALUE } ) ) ; } if ( params . get ( nameNode . getNodeValue ( ) ) != null ) { throw new ServerInitializationException ( MessageFormat . format ( INIT_CONFIG_SEVERE_REASSIGNMENT , new Object [ ] { CONFIG_ELEMENT_PARAM , CONFIG_ATTRIBUTE_NAME , nameNode . getNodeValue ( ) } ) ) ; } params . put ( nameNode . getNodeValue ( ) , valueNode . getNodeValue ( ) ) ; logger . debug ( MessageFormat . format ( INIT_CONFIG_CONFIG_PARAMETERIS , new Object [ ] { nameNode . getNodeValue ( ) , valueNode . getNodeValue ( ) } ) ) ; } else if ( ! n . getLocalName ( ) . equals ( CONFIG_ELEMENT_COMMENT ) ) { } } } params . remove ( null ) ; return params ;
public class SauceLabsRestApi { /** * Get the number of test cases running in sauce labs for the sauce labs sub - account / user * @ param user * id of the sub - account * @ return number of test case running or < code > - 1 < / code > on failure */ public int getNumberOfTCRunningForSubAccount ( String user ) { } }
LOGGER . entering ( user ) ; int tcRunning = - 1 ; try { SauceLabsHttpResponse result = doSauceRequest ( "/activity" ) ; JsonObject obj = result . getEntityAsJsonObject ( ) ; tcRunning = obj . getAsJsonObject ( "subaccounts" ) . getAsJsonObject ( user ) . get ( "all" ) . getAsInt ( ) ; } catch ( JsonSyntaxException | IllegalStateException | IOException e ) { LOGGER . log ( Level . SEVERE , "Unable to get number of test cases running for sub-account." , e ) ; } LOGGER . exiting ( tcRunning ) ; return tcRunning ;
public class ElementHelper { /** * Return the value of an element attribute . * @ param node the DOM node * @ param key the attribute key * @ return the attribute value or null if the attribute is undefined */ public static String getAttribute ( Element node , String key ) { } }
return getAttribute ( node , key , null ) ;
public class Strings { /** * splitToLong . * @ param ids * a { @ link java . lang . String } object . * @ return an array of { @ link java . lang . Long } objects . */ public static Long [ ] splitToLong ( final String ids ) { } }
if ( isEmpty ( ids ) ) { return new Long [ 0 ] ; } else { return transformToLong ( split ( ids , ',' ) ) ; }
public class InterceptorMetaDataFactory { /** * Adds a class to the list of loaded classes . getInterceptorProxies relies * on every interceptor class either being added via updateNamesToClassMap * or this method . * @ param klass the class * @ return the list of class names */ private List < String > addLoadedInterceptorClasses ( Class < ? > [ ] classes ) // d630717 { } }
List < String > names = new ArrayList < String > ( ) ; for ( Class < ? > klass : classes ) { String className = klass . getName ( ) ; ivInterceptorNameToClassMap . put ( className , klass ) ; names . add ( className ) ; } return names ;
public class MessageConverterService { /** * Returns a { @ link Response } object which will be converted to a text by the * { @ link CustomResponseConverter } . A { @ link Request } is also automatically converted by * the { @ link CustomRequestConverter } . * < p > If you want to specify converters for every methods in a service class , you can specify them * above the class definition as follows : * < pre > { @ code * > @ RequestConverter ( CustomRequestConverter . class ) * > @ ResponseConverter ( CustomResponseConverter . class ) * > public class MyAnnotatedService { * } < / pre > */ @ Post ( "/custom" ) @ ProducesText @ RequestConverter ( CustomRequestConverter . class ) @ ResponseConverter ( CustomResponseConverter . class ) public Response custom ( @ RequestObject Request request ) { } }
return new Response ( Response . SUCCESS , request . name ( ) ) ;
public class FnInteger { /** * Determines whether the target object and the specified object are equal * by calling the < tt > equals < / tt > method on the target object . * @ param object the { @ link Integer } to compare to the target * @ return true if both objects are equal , false if not . */ public static final Function < Integer , Boolean > eq ( final Integer object ) { } }
return ( Function < Integer , Boolean > ) ( ( Function ) FnObject . eq ( object ) ) ;
public class Log { /** * Prints debug info to the current debugLog * @ param message The message to log * @ param exception An Exception */ public void logDebug ( String message , Exception exception ) { } }
if ( ! ( logDebug || globalLog . logDebug ) ) return ; if ( debugLog != null ) log ( debugLog , "DEBUG" , owner , message , exception ) ; else log ( globalLog . debugLog , "DEBUG" , owner , message , exception ) ;
public class DecompositionFactory_DDRM { /** * Returns a { @ link SingularValueDecomposition } that has been optimized for the specified matrix size . * For improved performance only the portion of the decomposition that the user requests will be computed . * @ param numRows Number of rows the returned decomposition is optimized for . * @ param numCols Number of columns that the returned decomposition is optimized for . * @ param needU Should it compute the U matrix . If not sure set to true . * @ param needV Should it compute the V matrix . If not sure set to true . * @ param compact Should it compute the SVD in compact form . If not sure set to false . * @ return SVD */ public static SingularValueDecomposition_F64 < DMatrixRMaj > svd ( int numRows , int numCols , boolean needU , boolean needV , boolean compact ) { } }
// Don ' t allow the tall decomposition by default since it * might * be less stable return new SvdImplicitQrDecompose_DDRM ( compact , needU , needV , false ) ;
public class Result { /** * The projecting result value for the given key as a Object * Returns null if the key doesn ' t exist . * @ param key The select result key . * @ return The Object . */ @ Override public Object getValue ( @ NonNull String key ) { } }
if ( key == null ) { throw new IllegalArgumentException ( "key cannot be null." ) ; } final int index = indexForColumnName ( key ) ; return index >= 0 ? getValue ( index ) : null ;
public class PrefixedPropertiesPersister { /** * Loads from json . * @ param props * the props * @ param is * the is * @ throws IOException * Signals that an I / O exception has occurred . */ public void loadFromJson ( final Properties props , final InputStream is ) throws IOException { } }
try { ( ( PrefixedProperties ) props ) . loadFromJSON ( is ) ; } catch ( final NoSuchMethodError err ) { throw new IOException ( "Cannot load properties JSON file - not using PrefixedProperties: " + err . getMessage ( ) ) ; }
public class OsiamGroupService { /** * See { @ link OsiamConnector # updateGroup ( String , UpdateGroup , AccessToken ) } * @ deprecated Updating with PATCH has been removed in OSIAM 3.0 . This method is going to go away with version 1.12 or 2.0. */ @ Deprecated Group updateGroup ( String id , Group group , AccessToken accessToken ) { } }
return updateResource ( id , group , accessToken ) ;
public class GenericMultiBoJdbcDao { /** * Lookup the delegate dao . * @ param clazz * @ return */ @ SuppressWarnings ( "unchecked" ) protected < T > IGenericBoDao < T > lookupDelegateDao ( Class < T > clazz ) throws DelegateDaoNotFound { } }
IGenericBoDao < ? > result = delegateDaos . get ( clazz ) ; if ( result == null ) { throw new DelegateDaoNotFound ( "Delegate dao for [" + clazz + "] not found!" ) ; } return ( IGenericBoDao < T > ) result ;
public class CmsRequestUtil { /** * Returns the link without parameters from a String that is formatted for a GET request . < p > * @ param url the URL to remove the parameters from * @ return the URL without any parameters */ public static String getRequestLink ( String url ) { } }
if ( CmsStringUtil . isEmpty ( url ) ) { return null ; } int pos = url . indexOf ( URL_DELIMITER ) ; if ( pos >= 0 ) { return url . substring ( 0 , pos ) ; } return url ;
public class SimpleAxFetchListFactory { /** * A list of OpenID attributes to send in a request . * @ param identifier a user identifier * @ return a list of attributes */ public List < OpenIDAttribute > createAttributeList ( String identifier ) { } }
List < OpenIDAttribute > list = new LinkedList < > ( ) ; if ( identifier != null && identifier . matches ( "https://www.google.com/.*" ) ) { OpenIDAttribute email = new OpenIDAttribute ( "email" , "http://axschema.org/contact/email" ) ; OpenIDAttribute first = new OpenIDAttribute ( "firstname" , "http://axschema.org/namePerson/first" ) ; OpenIDAttribute last = new OpenIDAttribute ( "lastname" , "http://axschema.org/namePerson/last" ) ; email . setCount ( 1 ) ; email . setRequired ( true ) ; first . setRequired ( true ) ; last . setRequired ( true ) ; list . add ( email ) ; list . add ( first ) ; list . add ( last ) ; } return list ;
public class Primitives { /** * Parses next double in scientific form * @ param cs * @ param beginIndex * @ param endIndex * @ return */ public static final double findScientific ( CharSequence cs , int beginIndex , int endIndex ) { } }
int begin = CharSequences . indexOf ( cs , Primitives :: isScientificDigit , beginIndex ) ; int end = CharSequences . indexOf ( cs , ( c ) -> ! Primitives . isScientificDigit ( c ) , begin ) ; return parseDouble ( cs , begin , endIndex ( end , endIndex ) ) ;
public class AdapterWrapper { /** * Get a View that displays the data at the specified * position in the data set . * @ param position Position of the item whose data we want * @ param convertView View to recycle , if not null * @ param parent ViewGroup containing the returned View */ @ Override public View getView ( int position , View convertView , ViewGroup parent ) { } }
return ( wrapped . getView ( position , convertView , parent ) ) ;
public class ConditionMessage { /** * Return a new builder to construct a new { @ link ConditionMessage } based on the * instance and a new condition outcome . * @ param condition the condition * @ param details details of the condition * @ return a { @ link Builder } builder * @ see # andCondition ( String , Object . . . ) * @ see # forCondition ( Class , Object . . . ) */ public Builder andCondition ( Class < ? extends Annotation > condition , Object ... details ) { } }
Assert . notNull ( condition , "Condition must not be null" ) ; return andCondition ( "@" + ClassUtils . getShortName ( condition ) , details ) ;
public class BaseDestinationHandler { /** * Being a ' real ' destination , there is no implicit need to add a routing destination * address to any messages sent to this destination . However , if the sender is bound * to a single message point then we need to set a routing destination so that a particular * ME Uuid can be set into it . * Another reason for setting a routing address is if we ' re sending to a remote system or * temporary queue */ @ Override public JsDestinationAddress getRoutingDestinationAddr ( JsDestinationAddress inAddress , boolean fixedMessagePoint ) throws SIResourceException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getRoutingDestinationAddr" , new Object [ ] { this , inAddress , Boolean . valueOf ( fixedMessagePoint ) } ) ; JsDestinationAddress routingAddress = null ; // Pull out any encoded ME from a system or temporary queue SIBUuid8 encodedME = null ; if ( _isSystem || _isTemporary ) encodedME = SIMPUtils . parseME ( inAddress . getDestinationName ( ) ) ; // If this is a system or temporary queue that is located on a different ME to us // we need to set the actual address as the routing destination . if ( ( encodedME != null ) && ! ( encodedME . equals ( getMessageProcessor ( ) . getMessagingEngineUuid ( ) ) ) ) { routingAddress = inAddress ; } // The only other reason for setting a routing destination is if the sender is bound // ( or will be bound ) to a single message point . In which case we use the routing // address to transmit the chosen ME ( added later by the caller ) else if ( fixedMessagePoint ) { // TODO what if inAddres is isLocalOnly ( ) or already has an ME ? routingAddress = _destinationAddr ; } else if ( ( inAddress != null ) && ( inAddress . getME ( ) != null ) ) { routingAddress = _destinationAddr ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getRoutingDestinationAddr" , routingAddress ) ; return routingAddress ;
public class Validators { /** * Creates and returns a validator , which allows to validate texts to ensure , that they only * contain numbers . Empty texts are also accepted . * @ param context * The context , which should be used to retrieve the error message , as an instance of * the class { @ link Context } . The context may not be null * @ param resourceId * The resource ID of the string resource , which contains the error message , which * should be set , as an { @ link Integer } value . The resource ID must correspond to a * valid string resource * @ return The validator , which has been created , as an instance of the type { @ link Validator } */ public static Validator < CharSequence > number ( @ NonNull final Context context , @ StringRes final int resourceId ) { } }
return new NumberValidator ( context , resourceId ) ;
public class JournalConsumer { /** * Reject API calls from outside while we are in recovery mode . */ public Date modifyObject ( Context context , String pid , String state , String label , String ownerId , String logMessage , Date lastModifiedDate ) throws ServerException { } }
throw rejectCallsFromOutsideWhileInRecoveryMode ( ) ;
public class ProjectNodeSupport { /** * Return a list of resource model configuration * @ param serviceName service name * @ param props properties * @ param keyprefix prefix for properties * @ return List of Maps , each map containing " type " : String , " props " : Properties */ public static List < ExtPluginConfiguration > listPluginConfigurations ( final Map < String , String > props , final String keyprefix , final String serviceName , final boolean extra ) { } }
final ArrayList < ExtPluginConfiguration > list = new ArrayList < > ( ) ; int i = 1 ; boolean done = false ; while ( ! done ) { final String prefix = keyprefix + "." + i ; if ( props . containsKey ( prefix + ".type" ) ) { final String providerType = props . get ( prefix + ".type" ) ; final Map < String , Object > configProps = new HashMap < > ( ) ; final Map < String , Object > extraData = extra ? new HashMap < > ( ) : null ; final int len = ( prefix + ".config." ) . length ( ) ; for ( final Object o : props . keySet ( ) ) { final String key = ( String ) o ; if ( key . startsWith ( prefix + ".config." ) ) { configProps . put ( key . substring ( len ) , props . get ( key ) ) ; } } if ( extra ) { // list all extra props for ( String s : props . keySet ( ) ) { if ( s . startsWith ( prefix + "." ) ) { String suffix = s . substring ( prefix . length ( ) + 1 ) ; if ( ! "type" . equalsIgnoreCase ( suffix ) && ! suffix . startsWith ( "config." ) ) { extraData . put ( suffix , props . get ( s ) ) ; } } } } list . add ( new SimplePluginConfiguration ( serviceName , providerType , configProps , extraData ) ) ; } else { done = true ; } i ++ ; } return list ;
public class PaginationAutoMapInterceptor { /** * 从传递的参数中找Page对象 , 并返回 * @ param paramObj * @ return */ public Page findPageParameter ( Object paramObj ) { } }
Page page = null ; if ( paramObj instanceof Page ) { page = ( Page ) paramObj ; } else if ( paramObj instanceof Map ) { Map m = ( Map ) paramObj ; for ( Object o : m . values ( ) ) { if ( o instanceof Page ) { page = ( Page ) o ; break ; } } } if ( page != null ) { PAGE_THREAD_LOCAL . set ( page ) ; } return page ;
public class LineageInfo { /** * Get the full lineage event name from a state */ public static String getFullEventName ( State state ) { } }
return Joiner . on ( '.' ) . join ( LineageEventBuilder . LIENAGE_EVENT_NAMESPACE , state . getProp ( getKey ( NAME_KEY ) ) ) ;
public class Pool { /** * Place an object in the pool , unless it is already there . * If object is a symbol also enter its owner unless the owner is a * package . Return the object ' s index in the pool . */ public int put ( Object value ) { } }
value = makePoolValue ( value ) ; Assert . check ( ! ( value instanceof Type . TypeVar ) ) ; Assert . check ( ! ( value instanceof Types . UniqueType && ( ( UniqueType ) value ) . type instanceof Type . TypeVar ) ) ; Integer index = indices . get ( value ) ; if ( index == null ) { index = pp ; indices . put ( value , index ) ; pool = ArrayUtils . ensureCapacity ( pool , pp ) ; pool [ pp ++ ] = value ; if ( value instanceof Long || value instanceof Double ) { pool = ArrayUtils . ensureCapacity ( pool , pp ) ; pool [ pp ++ ] = null ; } } return index . intValue ( ) ;
public class Utils { /** * Generates a . dot format string for visualizing a suffix tree . * @ param tree The tree for which we are generating a dot file . * @ return A string containing the contents of a . dot representation of the * tree . */ static < T , S extends Iterable < T > > String printTreeForGraphViz ( SuffixTree < T , S > tree , boolean printSuffixLinks ) { } }
LinkedList < Node < T , S > > stack = new LinkedList < > ( ) ; stack . add ( tree . getRoot ( ) ) ; Map < Node < T , S > , Integer > nodeMap = new HashMap < > ( ) ; nodeMap . put ( tree . getRoot ( ) , 0 ) ; int nodeId = 1 ; StringBuilder sb = new StringBuilder ( "\ndigraph suffixTree{\n node [shape=circle, label=\"\", fixedsize=true, width=0.1, height=0.1]\n" ) ; while ( stack . size ( ) > 0 ) { LinkedList < Node < T , S > > childNodes = new LinkedList < > ( ) ; for ( Node < T , S > node : stack ) { // List < Edge > edges = node . getEdges ( ) ; for ( Edge < T , S > edge : node ) { int id = nodeId ++ ; if ( edge . isTerminating ( ) ) { childNodes . push ( edge . getTerminal ( ) ) ; nodeMap . put ( edge . getTerminal ( ) , id ) ; } sb . append ( nodeMap . get ( node ) ) . append ( " -> " ) . append ( id ) . append ( " [label=\"" ) ; for ( T item : edge ) { // if ( item ! = null ) sb . append ( item . toString ( ) ) ; } sb . append ( "\"];\n" ) ; } } stack = childNodes ; } if ( printSuffixLinks ) { // loop again to find all suffix links . sb . append ( "edge [color=red]\n" ) ; for ( Map . Entry < Node < T , S > , Integer > entry : nodeMap . entrySet ( ) ) { Node n1 = entry . getKey ( ) ; int id1 = entry . getValue ( ) ; if ( n1 . hasSuffixLink ( ) ) { Node n2 = n1 . getSuffixLink ( ) ; Integer id2 = nodeMap . get ( n2 ) ; // if ( id2 ! = null ) sb . append ( id1 ) . append ( " -> " ) . append ( id2 ) . append ( " ;\n" ) ; } } } sb . append ( "}" ) ; return ( sb . toString ( ) ) ;
public class BaseRule { /** * Invokes the outer rule - if set - around the base { @ link Statement } */ @ Override public Statement apply ( final Statement base , final Description description ) { } }
if ( outerRule != null ) { return outerRule . apply ( base , description ) ; } return base ;
public class Annotation { /** * Attempts to fetch a global annotation from storage * @ param tsdb The TSDB to use for storage access * @ param start _ time The start time as a Unix epoch timestamp * @ return A valid annotation object if found , null if not */ public static Deferred < Annotation > getAnnotation ( final TSDB tsdb , final long start_time ) { } }
return getAnnotation ( tsdb , ( byte [ ] ) null , start_time ) ;
public class PushNotificationSenderEndpoint { /** * returns application if the masterSecret is valid for the request PushApplicationEntity */ private PushApplication loadPushApplicationWhenAuthorized ( HttpServletRequest request ) { } }
// extract the pushApplicationID and its secret from the HTTP Basic header : String [ ] credentials = HttpBasicHelper . extractUsernameAndPasswordFromBasicHeader ( request ) ; String pushApplicationID = credentials [ 0 ] ; String secret = credentials [ 1 ] ; final PushApplication pushApplication = pushApplicationService . findByPushApplicationID ( pushApplicationID ) ; if ( pushApplication != null && pushApplication . getMasterSecret ( ) . equals ( secret ) ) { return pushApplication ; } // unauthorized . . . return null ;
public class Mockery { /** * Creates a mock object of type < var > typeToMock < / var > and generates a name for it . * @ param < T > is the class of the mock * @ param typeToMock is the class of the mock * @ return the mock of typeToMock */ public < T > T mock ( Class < T > typeToMock ) { } }
return mock ( typeToMock , namingScheme . defaultNameFor ( typeToMock ) ) ;
public class SoapUtils { /** * A method to create a SOAP message and retrieve it as byte . * @ param version * the SOAP version to be used ( 1.1 or 1.2 ) . * @ param headerBlocks * the list of Header Blocks to be included in the SOAP Header . * @ param body * the XML message to be included in the SOAP BODY element . * @ param encoding * the encoding to be used for the message creation . * @ return The created SOAP message as byte . * @ author Simone Gianfranceschi */ public static byte [ ] getSoapMessageAsByte ( String version , List headerBlocks , Element body , String encoding ) throws Exception { } }
Document message = createSoapMessage ( version , headerBlocks , body ) ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; TransformerFactory tf = TransformerFactory . newInstance ( ) ; // Fortify Mod : prevent external entity injection tf . setFeature ( XMLConstants . FEATURE_SECURE_PROCESSING , true ) ; Transformer t = tf . newTransformer ( ) ; // End Fortify Mod t . setOutputProperty ( OutputKeys . ENCODING , encoding ) ; t . transform ( new DOMSource ( message ) , new StreamResult ( baos ) ) ; // System . out . println ( " SOAP MESSAGE : " + baos . toString ( ) ) ; return baos . toByteArray ( ) ;
public class CmsObject { /** * Imports a resource to the OpenCms VFS . < p > * If a resource already exists in the VFS ( i . e . has the same name and * same id ) it is replaced by the imported resource . < p > * If a resource with the same name but a different id exists , * the imported resource is ( usually ) moved to the " lost and found " folder . < p > * @ param resourcename the name for the resource after import ( full current site relative path ) * @ param resource the resource object to be imported * @ param content the content of the resource * @ param properties the properties of the resource * @ return the imported resource * @ throws CmsException if something goes wrong * @ see CmsObject # moveToLostAndFound ( String ) */ public CmsResource importResource ( String resourcename , CmsResource resource , byte [ ] content , List < CmsProperty > properties ) throws CmsException { } }
return getResourceType ( resource ) . importResource ( this , m_securityManager , resourcename , resource , content , properties ) ;
public class HttpRequest { /** * Adds one header to match on or to not match on using the NottableString , each NottableString can either be a positive matching value , * such as string ( " match " ) , or a value to not match on , such as not ( " do not match " ) , the string values passed to the NottableString * can also be a plain string or a regex ( for more details of the supported regex syntax * see http : / / docs . oracle . com / javase / 6 / docs / api / java / util / regex / Pattern . html ) * @ param name the header name as a NottableString * @ param values the header values which can be a varags of NottableStrings */ public HttpRequest withHeader ( NottableString name , NottableString ... values ) { } }
this . headers . withEntry ( header ( name , values ) ) ; return this ;
public class GetProposalsPendingApproval { /** * Runs the example . * @ param adManagerServices the services factory . * @ param session the session . * @ throws ApiException if the API request failed with one or more service errors . * @ throws RemoteException if the API request failed due to other errors . */ public static void runExample ( AdManagerServices adManagerServices , AdManagerSession session ) throws RemoteException { } }
ProposalServiceInterface proposalService = adManagerServices . get ( session , ProposalServiceInterface . class ) ; // Create a statement to select proposals . StatementBuilder statementBuilder = new StatementBuilder ( ) . where ( "status = :status" ) . orderBy ( "id ASC" ) . limit ( StatementBuilder . SUGGESTED_PAGE_LIMIT ) . withBindVariableValue ( "status" , ProposalStatus . PENDING_APPROVAL . toString ( ) ) ; // Retrieve a small amount of proposals at a time , paging through // until all proposals have been retrieved . int totalResultSetSize = 0 ; do { ProposalPage page = proposalService . getProposalsByStatement ( statementBuilder . toStatement ( ) ) ; if ( page . getResults ( ) != null ) { // Print out some information for each proposal . totalResultSetSize = page . getTotalResultSetSize ( ) ; int i = page . getStartIndex ( ) ; for ( Proposal proposal : page . getResults ( ) ) { System . out . printf ( "%d) Proposal with ID %d and name '%s' was found.%n" , i ++ , proposal . getId ( ) , proposal . getName ( ) ) ; } } statementBuilder . increaseOffsetBy ( StatementBuilder . SUGGESTED_PAGE_LIMIT ) ; } while ( statementBuilder . getOffset ( ) < totalResultSetSize ) ; System . out . printf ( "Number of results found: %d%n" , totalResultSetSize ) ;
public class FileBeanStore { /** * RTC102568 */ public void removeAll ( ) { } }
final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "removeAll" ) ; FileBeanFilter theFilter = new FileBeanFilter ( ) ; File [ ] files = new File ( passivationDir == null ? "." : passivationDir ) . listFiles ( theFilter ) ; if ( files != null ) { for ( File file : files ) { final String name = file . getName ( ) ; if ( name . startsWith ( FILENAME_PREFIX ) ) { if ( file . delete ( ) ) { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "deleted " + name ) ; } else { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "failed to delete " + name ) ; } } else { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "skipping " + name ) ; } } } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "removeAll" ) ;