signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class FogbugzManager { /** * Fetches the XML from the Fogbugz API and returns a Document object
* with the response XML in it , so we can use that . */
private Document getFogbugzDocument ( Map < String , String > parameters ) throws IOException , ParserConfigurationException , SAXException { } } | URL uri = new URL ( this . mapToFogbugzUrl ( parameters ) ) ; HttpURLConnection con = ( HttpURLConnection ) uri . openConnection ( ) ; DocumentBuilderFactory dbFactory = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder dBuilder = dbFactory . newDocumentBuilder ( ) ; return dBuilder . parse ( con . getInputStream ( ) ) ; |
public class Cache { /** * Find the specified key in the cache ; the object is returned without
* an additional pin . If there is no object in the cache with the
* specified key , the < code > FaultStrategy < / code > , if installed , is
* invoked . < p >
* If the returned object were previously pinned , it will be returned
* in the pinned state , but an additional pin will not be obtained .
* An < code > unpin < / code > should not be performed in conjunction with
* a call to < code > findAndFault < / code > . Any LRU data maintained by
* the < code > Cache < / code > will be updated , similar to performing
* an < code > unpin < / code > . < p >
* Note that < code > Cache < / code > will hold the bucket lock when calling
* the < code > FaultStrategy < / code > . < p >
* @ param key key for the object to locate in the cache .
* @ return the object from the cache ; if the object is not in the
* cache and the < code > FaultStrategy < / code > does not create it ,
* null is returned .
* @ exception FaultException if an Exception occurs in the FaultStrategy .
* @ see Cache # pin
* @ see Cache # unpin */
@ Override public Object findAndFault ( Object key ) throws FaultException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "findAndFault" , key ) ; Bucket bucket = getOrCreateBucketForKey ( key ) ; // d739870
Element element ; Object object = null ; synchronized ( bucket ) { element = bucket . findByKey ( key ) ; if ( element != null ) { // We found the object in the bucket ; do not pin for performance ,
// update the LRU data , and return it to the caller d140003.5
element . accessedSweep = numSweeps ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "findAndFault : found in cache" ) ; return element . object ; } else if ( faultStrategy == null ) { // We could not find the object and no FaultStrategy is
// installed .
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "findAndFault : not in cache : no FaultStrategy" ) ; return null ; } // We could not find the object in the bucket : we ' ll notify
// the FaultStrategy so that it can attempt to fault the
// object in . We ' ll hold the lock on the bucket while we do this
try { // Notify the FaultStrategy and see if it is able to fault in the
// object
object = faultStrategy . faultOnKey ( this , key ) ; if ( object != null ) { // The object was faulted in , and must be inserted into
// the cache .
// Insert the object .
element = bucket . insertByKey ( key , object ) ; // Just update the LRU data - do not pin . d140003.5
element . accessedSweep = numSweeps ; } } catch ( Exception e ) { FFDCFilter . processException ( e , CLASS_NAME + ".findAndFault" , "417" , this ) ; throw new FaultException ( e , key . toString ( ) ) ; // PK59118
} } if ( object != null ) { synchronized ( this ) { // ACK ! This is going to be a choke point
numObjects ++ ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "findAndFault : not in cache : faulted" ) ; return object ; |
public class MappableJournalSegmentWriter { /** * Maps the segment writer into memory , returning the mapped buffer .
* @ return the buffer that was mapped into memory */
MappedByteBuffer map ( ) { } } | if ( writer instanceof MappedJournalSegmentWriter ) { return ( ( MappedJournalSegmentWriter < E > ) writer ) . buffer ( ) ; } try { JournalWriter < E > writer = this . writer ; MappedByteBuffer buffer = channel . map ( FileChannel . MapMode . READ_WRITE , 0 , segment . descriptor ( ) . maxSegmentSize ( ) ) ; this . writer = new MappedJournalSegmentWriter < > ( buffer , segment , maxEntrySize , index , namespace ) ; writer . close ( ) ; return buffer ; } catch ( IOException e ) { throw new StorageException ( e ) ; } |
public class MXBeanUtil { /** * UnRegisters the mxbean if registered already .
* @ param cacheManagerName name generated by URI and classloader .
* @ param name cache name .
* @ param stats is mxbean , a statistics mxbean . */
public static void unregisterCacheObject ( String cacheManagerName , String name , boolean stats ) { } } | synchronized ( mBeanServer ) { ObjectName objectName = calculateObjectName ( cacheManagerName , name , stats ) ; Set < ObjectName > registeredObjectNames = mBeanServer . queryNames ( objectName , null ) ; if ( isRegistered ( cacheManagerName , name , stats ) ) { // should just be one
for ( ObjectName registeredObjectName : registeredObjectNames ) { try { mBeanServer . unregisterMBean ( registeredObjectName ) ; } catch ( InstanceNotFoundException e ) { // it can happen that the instance that we want to unregister isn ' t found . So lets ignore it
// https : / / github . com / hazelcast / hazelcast / issues / 11055
ignore ( e ) ; } catch ( Exception e ) { throw new CacheException ( "Error unregistering object instance " + registeredObjectName + ". Error was " + e . getMessage ( ) , e ) ; } } } } |
public class SphereUtil { /** * Use cosine or haversine dynamically .
* Complexity : 4-5 trigonometric functions , 1 sqrt .
* @ param lat1 Latitude of first point in degree
* @ param lon1 Longitude of first point in degree
* @ param lat2 Latitude of second point in degree
* @ param lon2 Longitude of second point in degree
* @ return Distance on unit sphere */
public static double cosineOrHaversineDeg ( double lat1 , double lon1 , double lat2 , double lon2 ) { } } | return cosineOrHaversineRad ( deg2rad ( lat1 ) , deg2rad ( lon1 ) , deg2rad ( lat2 ) , deg2rad ( lon2 ) ) ; |
public class LongTermRetentionBackupsInner { /** * Lists the long term retention backups for a given server .
* @ param locationName The location of the database
* @ param longTermRetentionServerName the String value
* @ param onlyLatestPerDatabase Whether or not to only get the latest backup for each database .
* @ param databaseState Whether to query against just live databases , just deleted databases , or all databases . Possible values include : ' All ' , ' Live ' , ' Deleted '
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; LongTermRetentionBackupInner & gt ; object */
public Observable < ServiceResponse < Page < LongTermRetentionBackupInner > > > listByServerWithServiceResponseAsync ( final String locationName , final String longTermRetentionServerName , final Boolean onlyLatestPerDatabase , final LongTermRetentionDatabaseState databaseState ) { } } | return listByServerSinglePageAsync ( locationName , longTermRetentionServerName , onlyLatestPerDatabase , databaseState ) . concatMap ( new Func1 < ServiceResponse < Page < LongTermRetentionBackupInner > > , Observable < ServiceResponse < Page < LongTermRetentionBackupInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < LongTermRetentionBackupInner > > > call ( ServiceResponse < Page < LongTermRetentionBackupInner > > page ) { String nextPageLink = page . body ( ) . nextPageLink ( ) ; if ( nextPageLink == null ) { return Observable . just ( page ) ; } return Observable . just ( page ) . concatWith ( listByServerNextWithServiceResponseAsync ( nextPageLink ) ) ; } } ) ; |
public class CipherUtil { /** * Converts a time to timestamp format .
* @ param time Time to convert , or null for current time .
* @ return Time in timestamp format . */
public static String getTimestamp ( Date time ) { } } | return getTimestampFormatter ( ) . format ( time == null ? new Date ( ) : time ) ; |
public class PROXY { /** * Find the method for a target of its parent
* @ param objClass the object class
* @ param methodName the method name
* @ param parameterTypes the method parameter types
* @ return the method
* @ throws NoSuchMethodException */
public static Method findMethod ( Class < ? > objClass , String methodName , Class < ? > [ ] parameterTypes ) throws NoSuchMethodException { } } | try { return objClass . getDeclaredMethod ( methodName , parameterTypes ) ; } catch ( NoSuchMethodException e ) { if ( Object . class . equals ( objClass ) ) throw e ; try { // try super
return findMethod ( objClass . getSuperclass ( ) , methodName , parameterTypes ) ; } catch ( NoSuchMethodException parentException ) { throw e ; } } |
public class LdapHelper { /** * Load all Users for a given Group .
* @ param group the given Group .
* @ return Users as a Set of Nodes for that Group . */
@ Override public Set < Node > getUsersForGroup ( Node group ) { } } | Set < Node > users = new TreeSet < > ( ) ; try { String query = "(" + groupIdentifyer + "=" + group . getName ( ) + ")" ; SearchResult searchResult ; Attributes attributes ; SearchControls controls = new SearchControls ( ) ; controls . setSearchScope ( SearchControls . SUBTREE_SCOPE ) ; NamingEnumeration < SearchResult > results = ctx . search ( "" , query , controls ) ; Node user ; while ( results . hasMore ( ) ) { searchResult = results . next ( ) ; attributes = searchResult . getAttributes ( ) ; NamingEnumeration < ? > members = attributes . get ( groupMemberAttribut ) . getAll ( ) ; while ( members . hasMoreElements ( ) ) { String memberDN = ( String ) members . nextElement ( ) ; String uid = getIdentifyerValueFromDN ( memberDN ) ; user = getUser ( uid ) ; user . setDn ( memberDN ) ; users . add ( user ) ; } } } catch ( NamingException ex ) { handleNamingException ( group , ex ) ; } return users ; |
public class XlsUtil { /** * 导出list对象到excel
* @ param config 配置
* @ param list 导出的list
* @ param filePath 保存xls路径
* @ param fileName 保存xls文件名
* @ return 处理结果 , true成功 , false失败
* @ throws Exception */
public static boolean list2Xls ( ExcelConfig config , List < ? > list , String filePath , String fileName ) throws Exception { } } | // 创建目录
File file = new File ( filePath ) ; if ( ! ( file . exists ( ) ) ) { if ( ! file . mkdirs ( ) ) { throw new RuntimeException ( "创建导出目录失败!" ) ; } } OutputStream outputStream = null ; try { if ( ! fileName . toLowerCase ( ) . endsWith ( EXCEL ) ) { fileName += EXCEL ; } File excelFile = new File ( filePath + "/" + fileName ) ; outputStream = new FileOutputStream ( excelFile ) ; return list2Xls ( config , list , outputStream ) ; } catch ( Exception e1 ) { return false ; } finally { if ( outputStream != null ) { outputStream . close ( ) ; } } |
public class ManagementClientImpl { /** * / * ( non - Javadoc )
* @ see tuwien . auto . calimero . mgmt . ManagementClient # writeDomainAddress ( byte [ ] ) */
public void writeDomainAddress ( byte [ ] domain ) throws KNXTimeoutException , KNXLinkClosedException { } } | if ( domain . length != 2 && domain . length != 6 ) throw new KNXIllegalArgumentException ( "invalid length of domain address" ) ; tl . broadcast ( true , priority , DataUnitBuilder . createAPDU ( DOA_WRITE , domain ) ) ; |
public class N { /** * Removes the first occurrence of the specified element from the specified
* array . All subsequent elements are shifted to the left ( subtracts one
* from their indices ) . If the array doesn ' t contains such an element , no
* elements are removed from the array .
* This method returns a new array with the same elements of the input array
* except the first occurrence of the specified element . The component type
* of the returned array is always the same as that of the input array .
* @ param a
* @ param element
* the element to be removed
* @ return A new array containing the existing elements except the first
* occurrence of the specified element . */
public static byte [ ] remove ( final byte [ ] a , final byte element ) { } } | if ( N . isNullOrEmpty ( a ) ) { return N . EMPTY_BYTE_ARRAY ; } int index = indexOf ( a , 0 , element ) ; return index == INDEX_NOT_FOUND ? a . clone ( ) : delete ( a , index ) ; |
public class FeatureSearch { private void buildUI ( ) { } } | // Create the layout :
VLayout layout = new VLayout ( ) ; layout . setWidth100 ( ) ; layout . setHeight100 ( ) ; logicalOperatorRadio = new RadioGroupItem ( "logicalOperator" ) ; logicalOperatorRadio . setValueMap ( I18nProvider . getSearch ( ) . radioOperatorOr ( ) , I18nProvider . getSearch ( ) . radioOperatorAnd ( ) ) ; logicalOperatorRadio . setVertical ( false ) ; logicalOperatorRadio . setRequired ( true ) ; logicalOperatorRadio . setAlign ( Alignment . LEFT ) ; logicalOperatorRadio . setWidth ( 250 ) ; logicalOperatorRadio . setShowTitle ( false ) ; HLayout optionLayout = new HLayout ( ) ; optionLayout . setHeight ( 50 ) ; optionLayout . setWidth100 ( ) ; VLayout leftLayout = new VLayout ( ) ; leftLayout . setAlign ( Alignment . LEFT ) ; HLayout layerLayout = new HLayout ( ) ; layerLayout . setWidth ( 420 ) ; DynamicForm layerForm = new DynamicForm ( ) ; layerForm . setHeight ( 30 ) ; if ( manualLayerSelection ) { layerSelect = new SelectItem ( ) ; layerSelect . setTitle ( I18nProvider . getSearch ( ) . labelLayerSelected ( ) ) ; layerSelect . setWidth ( 250 ) ; layerSelect . setHint ( I18nProvider . getSearch ( ) . labelNoLayerSelected ( ) ) ; ( ( SelectItem ) layerSelect ) . setShowHintInField ( true ) ; layerSelect . addChangedHandler ( new ChangedHandler ( ) { public void onChanged ( ChangedEvent event ) { String layerLabel = ( String ) event . getValue ( ) ; for ( Layer < ? > vLayer : mapModel . getLayers ( ) ) { if ( vLayer . getLabel ( ) . equals ( layerLabel ) ) { setLayer ( ( VectorLayer ) vLayer ) ; } } } } ) ; mapModel . addMapModelChangedHandler ( new MapModelChangedHandler ( ) { public void onMapModelChanged ( MapModelChangedEvent event ) { fillLayerSelect ( ) ; } } ) ; // needed if map is already loaded !
fillLayerSelect ( ) ; } else { mapModel . addLayerSelectionHandler ( new LayerSelectionHandler ( ) { public void onDeselectLayer ( LayerDeselectedEvent event ) { empty ( ) ; updateLabelTitle ( I18nProvider . getSearch ( ) . labelNoLayerSelected ( ) ) ; } public void onSelectLayer ( LayerSelectedEvent event ) { if ( event . getLayer ( ) instanceof VectorLayer ) { setLayer ( ( VectorLayer ) event . getLayer ( ) ) ; if ( event . getLayer ( ) != null ) { updateLabelTitle ( event . getLayer ( ) . getLabel ( ) ) ; } } } } ) ; layerSelect = new BlurbItem ( ) ; layerSelect . setShowTitle ( true ) ; layerSelect . setTitle ( I18nProvider . getSearch ( ) . labelLayerSelected ( ) ) ; layerSelect . setWidth ( 250 ) ; layerSelect . setValue ( "<b>" + I18nProvider . getSearch ( ) . labelNoLayerSelected ( ) + "</b>" ) ; } layerForm . setFields ( layerSelect ) ; layerLayout . addMember ( layerForm ) ; leftLayout . addMember ( layerLayout ) ; DynamicForm logicalForm = new DynamicForm ( ) ; logicalForm . setAutoWidth ( ) ; logicalForm . setLayoutAlign ( Alignment . CENTER ) ; logicalForm . setFields ( logicalOperatorRadio ) ; leftLayout . setWidth ( 420 ) ; leftLayout . addMember ( logicalForm ) ; VLayout rightLayout = new VLayout ( ) ; rightLayout . setLayoutAlign ( VerticalAlignment . TOP ) ; rightLayout . setMargin ( 5 ) ; rightLayout . setMembersMargin ( 5 ) ; rightLayout . setWidth ( 100 ) ; searchButton = new IButton ( I18nProvider . getSearch ( ) . btnSearch ( ) ) ; searchButton . setIcon ( WidgetLayout . iconFind ) ; searchButton . setWidth ( 100 ) ; searchButton . setDisabled ( true ) ; searchButton . addClickHandler ( new ClickHandler ( ) { public void onClick ( ClickEvent event ) { search ( ) ; } } ) ; resetButton = new IButton ( I18nProvider . getSearch ( ) . btnReset ( ) ) ; resetButton . setIcon ( WidgetLayout . iconUndo ) ; resetButton . setWidth ( 100 ) ; resetButton . setDisabled ( true ) ; resetButton . addClickHandler ( new ClickHandler ( ) { public void onClick ( ClickEvent event ) { empty ( ) ; } } ) ; rightLayout . addMember ( searchButton ) ; rightLayout . addMember ( resetButton ) ; optionLayout . addMember ( leftLayout ) ; optionLayout . addMember ( new LayoutSpacer ( ) ) ; optionLayout . addMember ( rightLayout ) ; // Create a header for the criterionStack :
HLayout headerLayout = new HLayout ( ) ; headerLayout . setHeight ( 26 ) ; headerLayout . setStyleName ( STYLE_HEADER_BAR ) ; HTMLPane attrHeader = new HTMLPane ( ) ; attrHeader . setStyleName ( STYLE_SEARCH_HEADER ) ; attrHeader . setContents ( "Attribute" ) ; attrHeader . setWidth ( 140 ) ; HTMLPane operatorHeader = new HTMLPane ( ) ; operatorHeader . setContents ( "Operator" ) ; operatorHeader . setWidth ( 140 ) ; operatorHeader . setStyleName ( STYLE_SEARCH_HEADER ) ; HTMLPane valueHeader = new HTMLPane ( ) ; valueHeader . setContents ( "Value" ) ; valueHeader . setStyleName ( STYLE_SEARCH_HEADER ) ; criterionStack = new VStack ( ) ; criterionStack . setAlign ( VerticalAlignment . TOP ) ; headerLayout . addMember ( attrHeader ) ; headerLayout . addMember ( operatorHeader ) ; headerLayout . addMember ( valueHeader ) ; criterionStack . addMember ( headerLayout ) ; buttonStack = new VStack ( ) ; buttonStack . setWidth ( 70 ) ; buttonStack . setAlign ( VerticalAlignment . TOP ) ; HTMLPane btnHeader = new HTMLPane ( ) ; btnHeader . setStyleName ( STYLE_HEADER_BAR ) ; btnHeader . setWidth ( 70 ) ; btnHeader . setHeight ( 26 ) ; buttonStack . addMember ( btnHeader ) ; HLayout searchGrid = new HLayout ( ) ; searchGrid . addMember ( criterionStack ) ; searchGrid . addMember ( buttonStack ) ; searchGrid . setBorder ( "1px solid lightgrey" ) ; layout . addMember ( optionLayout ) ; layout . addMember ( searchGrid ) ; addChild ( layout ) ; |
public class DynamicArray { /** * Removes all of the elements from this list . The list will
* be empty after this call returns . */
public void clear ( ) { } } | modCount ++ ; // Let gc do its work
for ( int i = 0 ; i < size ; i ++ ) data [ i ] = null ; size = 0 ; |
public class GenericClientFactory { /** * Load client metadata .
* @ param puProperties */
protected void loadClientMetadata ( Map < String , Object > puProperties ) { } } | clientMetadata = new ClientMetadata ( ) ; String luceneDirectoryPath = puProperties != null ? ( String ) puProperties . get ( PersistenceProperties . KUNDERA_INDEX_HOME_DIR ) : null ; String indexerClass = puProperties != null ? ( String ) puProperties . get ( PersistenceProperties . KUNDERA_INDEXER_CLASS ) : null ; String autoGenClass = puProperties != null ? ( String ) puProperties . get ( PersistenceProperties . KUNDERA_AUTO_GENERATOR_CLASS ) : null ; if ( indexerClass == null ) { indexerClass = kunderaMetadata . getApplicationMetadata ( ) . getPersistenceUnitMetadata ( persistenceUnit ) . getProperties ( ) . getProperty ( PersistenceProperties . KUNDERA_INDEXER_CLASS ) ; } if ( autoGenClass == null ) { autoGenClass = kunderaMetadata . getApplicationMetadata ( ) . getPersistenceUnitMetadata ( persistenceUnit ) . getProperties ( ) . getProperty ( PersistenceProperties . KUNDERA_AUTO_GENERATOR_CLASS ) ; } if ( luceneDirectoryPath == null ) { luceneDirectoryPath = kunderaMetadata . getApplicationMetadata ( ) . getPersistenceUnitMetadata ( persistenceUnit ) . getProperty ( PersistenceProperties . KUNDERA_INDEX_HOME_DIR ) ; } if ( autoGenClass != null ) { clientMetadata . setAutoGenImplementor ( autoGenClass ) ; } // in case set empty via external property , means want to avoid lucene
// directory set up .
if ( luceneDirectoryPath != null && ! StringUtils . isEmpty ( luceneDirectoryPath ) ) { // Add client metadata
clientMetadata . setLuceneIndexDir ( luceneDirectoryPath ) ; // Set Index Manager
try { Method method = Class . forName ( IndexingConstants . LUCENE_INDEXER ) . getDeclaredMethod ( "getInstance" , String . class ) ; Indexer indexer = ( Indexer ) method . invoke ( null , luceneDirectoryPath ) ; indexManager = new IndexManager ( indexer , kunderaMetadata ) ; } catch ( Exception e ) { logger . error ( "Missing lucene from classpath. Please make sure those are available to load lucene directory {}!" , luceneDirectoryPath ) ; throw new InvalidConfigurationException ( e ) ; } // indexManager = new IndexManager ( LuceneIndexer . getInstance ( new
// StandardAnalyzer ( Version . LUCENE _ CURRENT ) ,
// luceneDirectoryPath ) ) ;
} else if ( indexerClass != null ) { try { Class < ? > indexerClazz = Class . forName ( indexerClass ) ; Indexer indexer = ( Indexer ) indexerClazz . newInstance ( ) ; indexManager = new IndexManager ( indexer , kunderaMetadata ) ; clientMetadata . setIndexImplementor ( indexerClass ) ; } catch ( Exception cnfex ) { logger . error ( "Error while initialzing indexer:" + indexerClass , cnfex ) ; throw new KunderaException ( cnfex ) ; } } else { indexManager = new IndexManager ( null , kunderaMetadata ) ; } // if
// ( kunderaMetadata . getClientMetadata ( persistenceUnit )
// null )
// kunderaMetadata . addClientMetadata ( persistenceUnit ,
// clientMetadata ) ; |
public class OdsFileWriterAdapter { /** * Flushes all available flushers to the adaptee writer .
* The thread falls asleep if we reach the end of the queue without a FinalizeFlusher .
* @ throws IOException if the adaptee throws an IOException */
public synchronized void flushAdaptee ( ) throws IOException { } } | OdsFlusher flusher = this . flushers . poll ( ) ; if ( flusher == null ) return ; while ( flusher != null ) { this . adaptee . update ( flusher ) ; if ( flusher . isEnd ( ) ) { this . stopped = true ; this . notifyAll ( ) ; // wakes up other threads : end of game
return ; } flusher = this . flushers . poll ( ) ; } try { this . wait ( ) ; } catch ( final InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; throw new RuntimeException ( e ) ; } this . notifyAll ( ) ; // wakes up other threads : no flusher left |
public class Utils { /** * Writes the contents of source to target without mutating source ( so safe for
* multithreaded access to source ) and without GC ( unless source is a direct buffer ) . */
public static void putByteBuffer ( ByteBuffer source , ByteBuffer target ) { } } | if ( source . hasArray ( ) ) { byte [ ] array = source . array ( ) ; int arrayOffset = source . arrayOffset ( ) ; target . put ( array , arrayOffset + source . position ( ) , source . remaining ( ) ) ; } else { target . put ( source . duplicate ( ) ) ; } |
public class AssetAttributes { /** * An array of the network interfaces interacting with the EC2 instance where the finding is generated .
* @ param networkInterfaces
* An array of the network interfaces interacting with the EC2 instance where the finding is generated . */
public void setNetworkInterfaces ( java . util . Collection < NetworkInterface > networkInterfaces ) { } } | if ( networkInterfaces == null ) { this . networkInterfaces = null ; return ; } this . networkInterfaces = new java . util . ArrayList < NetworkInterface > ( networkInterfaces ) ; |
public class ECPImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . ECP__RS_NAME : setRSName ( ( String ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class MapWidget { /** * Return the Object that represents one the default RenderGroups in the DOM tree when drawing .
* @ param group
* The general group definition ( RenderGroup . SCREEN , RenderGroup . WORLD , . . . )
* @ return paintable group */
public PaintableGroup getGroup ( RenderGroup group ) { } } | switch ( group ) { case RASTER : return rasterGroup ; case VECTOR : return vectorGroup ; case WORLD : return worldGroup ; case SCREEN : default : return screenGroup ; } |
public class AWSLogsClient { /** * Creates or updates a subscription filter and associates it with the specified log group . Subscription filters
* allow you to subscribe to a real - time stream of log events ingested through < a > PutLogEvents < / a > and have them
* delivered to a specific destination . Currently , the supported destinations are :
* < ul >
* < li >
* An Amazon Kinesis stream belonging to the same account as the subscription filter , for same - account delivery .
* < / li >
* < li >
* A logical destination that belongs to a different account , for cross - account delivery .
* < / li >
* < li >
* An Amazon Kinesis Firehose delivery stream that belongs to the same account as the subscription filter , for
* same - account delivery .
* < / li >
* < li >
* An AWS Lambda function that belongs to the same account as the subscription filter , for same - account delivery .
* < / li >
* < / ul >
* There can only be one subscription filter associated with a log group . If you are updating an existing filter ,
* you must specify the correct name in < code > filterName < / code > . Otherwise , the call fails because you cannot
* associate a second filter with a log group .
* @ param putSubscriptionFilterRequest
* @ return Result of the PutSubscriptionFilter operation returned by the service .
* @ throws InvalidParameterException
* A parameter is specified incorrectly .
* @ throws ResourceNotFoundException
* The specified resource does not exist .
* @ throws OperationAbortedException
* Multiple requests to update the same resource were in conflict .
* @ throws LimitExceededException
* You have reached the maximum number of resources that can be created .
* @ throws ServiceUnavailableException
* The service cannot complete the request .
* @ sample AWSLogs . PutSubscriptionFilter
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / logs - 2014-03-28 / PutSubscriptionFilter " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public PutSubscriptionFilterResult putSubscriptionFilter ( PutSubscriptionFilterRequest request ) { } } | request = beforeClientExecution ( request ) ; return executePutSubscriptionFilter ( request ) ; |
public class FXBindableASTTransformation { /** * Creates a new PropertyNode for the JavaFX property based on the original property . The new property
* will have " Property " appended to its name and its type will be one of the * Property types in JavaFX .
* @ param orig The original property
* @ return A new PropertyNode for the JavaFX property */
private PropertyNode createFXProperty ( PropertyNode orig ) { } } | ClassNode origType = orig . getType ( ) ; ClassNode newType = PROPERTY_TYPE_MAP . get ( origType ) ; // For the ObjectProperty , we need to add the generic type to it .
if ( newType == null ) { if ( isTypeCompatible ( ClassHelper . LIST_TYPE , origType ) || isTypeCompatible ( OBSERVABLE_LIST_CNODE , origType ) ) { newType = makeClassSafe ( SIMPLE_LIST_PROPERTY_CNODE ) ; GenericsType [ ] genericTypes = origType . getGenericsTypes ( ) ; newType . setGenericsTypes ( genericTypes ) ; } else if ( isTypeCompatible ( ClassHelper . MAP_TYPE , origType ) || isTypeCompatible ( OBSERVABLE_MAP_CNODE , origType ) ) { newType = makeClassSafe ( SIMPLE_MAP_PROPERTY_CNODE ) ; GenericsType [ ] genericTypes = origType . getGenericsTypes ( ) ; newType . setGenericsTypes ( genericTypes ) ; } else if ( isTypeCompatible ( SET_TYPE , origType ) || isTypeCompatible ( OBSERVABLE_SET_CNODE , origType ) ) { newType = makeClassSafe ( SIMPLE_SET_PROPERTY_CNODE ) ; GenericsType [ ] genericTypes = origType . getGenericsTypes ( ) ; newType . setGenericsTypes ( genericTypes ) ; } else { // Object Type
newType = makeClassSafe ( OBJECT_PROPERTY_CNODE ) ; ClassNode genericType = origType ; if ( genericType . isPrimaryClassNode ( ) ) { genericType = ClassHelper . getWrapper ( genericType ) ; } newType . setGenericsTypes ( new GenericsType [ ] { new GenericsType ( genericType ) } ) ; } } FieldNode fieldNode = createFieldNodeCopy ( orig . getName ( ) + "Property" , newType , orig . getField ( ) ) ; return new PropertyNode ( fieldNode , orig . getModifiers ( ) , orig . getGetterBlock ( ) , orig . getSetterBlock ( ) ) ; |
public class DetectorImpl { /** * Searches DTMF tone .
* @ param f the low frequency array
* @ param F the high frequency array .
* @ return DTMF tone . */
private String getTone ( double f [ ] , double F [ ] ) { } } | int fm = getMax ( f ) ; boolean fd = true ; for ( int i = 0 ; i < f . length ; i ++ ) { if ( fm == i ) { continue ; } double r = f [ fm ] / ( f [ i ] + 1E-15 ) ; if ( r < threshold ) { fd = false ; break ; } } if ( ! fd ) { return null ; } int Fm = getMax ( F ) ; boolean Fd = true ; for ( int i = 0 ; i < F . length ; i ++ ) { if ( Fm == i ) { continue ; } double r = F [ Fm ] / ( F [ i ] + 1E-15 ) ; if ( r < threshold ) { Fd = false ; break ; } } if ( ! Fd ) { return null ; } return events [ fm ] [ Fm ] ; |
public class SrvTradingSettings { /** * < p > Save entity into DB . < / p >
* @ param pAddParam additional param
* @ param pEntity entity
* @ throws Exception - an exception */
@ Override public final synchronized void saveTradingSettings ( final Map < String , Object > pAddParam , final TradingSettings pEntity ) throws Exception { } } | if ( pEntity . getIsNew ( ) ) { throw new ExceptionWithCode ( ExceptionWithCode . FORBIDDEN , "insert_not_allowed::" + pAddParam . get ( "user" ) ) ; } else if ( pEntity . getItsId ( ) != 1L ) { throw new ExceptionWithCode ( ExceptionWithCode . FORBIDDEN , "id_not_allowed::" + pAddParam . get ( "user" ) ) ; } else { getSrvOrm ( ) . updateEntity ( pAddParam , pEntity ) ; this . tradingSettings = null ; lazyGetTradingSettings ( pAddParam ) ; } |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link Dictionary } { @ code > } } */
@ XmlElementDecl ( namespace = PROV_NS , name = "dictionary" ) public JAXBElement < Dictionary > createDictionary ( Dictionary value ) { } } | return new JAXBElement < Dictionary > ( _Dictionary_QNAME , Dictionary . class , null , value ) ; |
public class AdminParserUtils { /** * Adds OPT _ FORMAT option to OptionParser , with one argument .
* @ param parser OptionParser to be modified
* @ param required Tells if this option is required or optional */
public static void acceptsFormat ( OptionParser parser ) { } } | parser . accepts ( OPT_FORMAT , "format of key or entry, could be hex, json or binary" ) . withRequiredArg ( ) . describedAs ( "hex | json | binary" ) . ofType ( String . class ) ; |
public class Swarm { /** * Deploy an archive .
* @ param deployment The ShrinkWrap archive to deploy .
* @ return The container .
* @ throws DeploymentException if an error occurs . */
public Swarm deploy ( Archive < ? > deployment ) throws Exception { } } | if ( this . server == null ) { throw SwarmMessages . MESSAGES . containerNotStarted ( "deploy(Archive<?>)" ) ; } this . server . deployer ( ) . deploy ( deployment ) ; return this ; |
public class FatFileSystem { /** * Returns the volume label of this file system .
* @ return the volume label */
public String getVolumeLabel ( ) { } } | checkClosed ( ) ; final String fromDir = rootDirStore . getLabel ( ) ; if ( fromDir == null && fatType != FatType . FAT32 ) { return ( ( Fat16BootSector ) bs ) . getVolumeLabel ( ) ; } else { return fromDir ; } |
public class FastMath { /** * Internal helper function to compute arctangent .
* @ param xa number from which arctangent is requested
* @ param xb extra bits for x ( may be 0.0)
* @ param leftPlane if true , result angle must be put in the left half plane
* @ return atan ( xa + xb ) ( or angle shifted by { @ code PI } if leftPlane is true ) */
private static double atan ( double xa , double xb , boolean leftPlane ) { } } | boolean negate = false ; int idx ; if ( xa == 0.0 ) { // Matches + / - 0.0 ; return correct sign
return leftPlane ? copySign ( Math . PI , xa ) : xa ; } if ( xa < 0 ) { // negative
xa = - xa ; xb = - xb ; negate = true ; } if ( xa > 1.633123935319537E16 ) { // Very large input
return ( negate ^ leftPlane ) ? ( - Math . PI * F_1_2 ) : ( Math . PI * F_1_2 ) ; } /* Estimate the closest tabulated arctan value , compute eps = xa - tangentTable */
if ( xa < 1 ) { idx = ( int ) ( ( ( - 1.7168146928204136 * xa * xa + 8.0 ) * xa ) + 0.5 ) ; } else { final double oneOverXa = 1 / xa ; idx = ( int ) ( - ( ( - 1.7168146928204136 * oneOverXa * oneOverXa + 8.0 ) * oneOverXa ) + 13.07 ) ; } double epsA = xa - TANGENT_TABLE_A [ idx ] ; double epsB = - ( epsA - xa + TANGENT_TABLE_A [ idx ] ) ; epsB += xb - TANGENT_TABLE_B [ idx ] ; double temp = epsA + epsB ; epsB = - ( temp - epsA - epsB ) ; epsA = temp ; /* Compute eps = eps / ( 1.0 + xa * tangent ) */
temp = xa * HEX_40000000 ; double ya = xa + temp - temp ; double yb = xb + xa - ya ; xa = ya ; xb += yb ; // if ( idx > 8 | | idx = = 0)
if ( idx == 0 ) { /* If the slope of the arctan is gentle enough ( < 0.45 ) , this approximation will suffice */
// double denom = 1.0 / ( 1.0 + xa * tangentTableA [ idx ] + xb * tangentTableA [ idx ] + xa * tangentTableB [ idx ] + xb * tangentTableB [ idx ] ) ;
final double denom = 1d / ( 1d + ( xa + xb ) * ( TANGENT_TABLE_A [ idx ] + TANGENT_TABLE_B [ idx ] ) ) ; // double denom = 1.0 / ( 1.0 + xa * tangentTableA [ idx ] ) ;
ya = epsA * denom ; yb = epsB * denom ; } else { double temp2 = xa * TANGENT_TABLE_A [ idx ] ; double za = 1d + temp2 ; double zb = - ( za - 1d - temp2 ) ; temp2 = xb * TANGENT_TABLE_A [ idx ] + xa * TANGENT_TABLE_B [ idx ] ; temp = za + temp2 ; zb += - ( temp - za - temp2 ) ; za = temp ; zb += xb * TANGENT_TABLE_B [ idx ] ; ya = epsA / za ; temp = ya * HEX_40000000 ; final double yaa = ( ya + temp ) - temp ; final double yab = ya - yaa ; temp = za * HEX_40000000 ; final double zaa = ( za + temp ) - temp ; final double zab = za - zaa ; /* Correct for rounding in division */
yb = ( epsA - yaa * zaa - yaa * zab - yab * zaa - yab * zab ) / za ; yb += - epsA * zb / za / za ; yb += epsB / za ; } epsA = ya ; epsB = yb ; /* Evaluate polynomial */
final double epsA2 = epsA * epsA ; /* yb = - 0.09001346640161823;
yb = yb * epsA2 + 0.11110718400605211;
yb = yb * epsA2 + - 0.1428571349122913;
yb = yb * epsA2 + 0.199999273194;
yb = yb * epsA2 + - 0.33333093;
yb = yb * epsA2 * epsA ; */
yb = 0.07490822288864472 ; yb = yb * epsA2 + - 0.09088450866185192 ; yb = yb * epsA2 + 0.11111095942313305 ; yb = yb * epsA2 + - 0.1428571423679182 ; yb = yb * epsA2 + 0.19999999999923582 ; yb = yb * epsA2 + - 0.33333333333333287 ; yb = yb * epsA2 * epsA ; ya = epsA ; temp = ya + yb ; yb = - ( temp - ya - yb ) ; ya = temp ; /* Add in effect of epsB . atan ' ( x ) = 1 / ( 1 + x ^ 2) */
yb += epsB / ( 1d + epsA * epsA ) ; // result = yb + eighths [ idx ] + ya ;
double za = EIGHTHS [ idx ] + ya ; double zb = - ( za - EIGHTHS [ idx ] - ya ) ; temp = za + yb ; zb += - ( temp - za - yb ) ; za = temp ; double result = za + zb ; double resultb = - ( result - za - zb ) ; if ( leftPlane ) { // Result is in the left plane
final double pia = 1.5707963267948966 * 2 ; final double pib = 6.123233995736766E-17 * 2 ; za = pia - result ; zb = - ( za - pia + result ) ; zb += pib - resultb ; result = za + zb ; resultb = - ( result - za - zb ) ; } if ( negate ^ leftPlane ) { result = - result ; } return result ; |
public class GeneralizedImageOps { /** * If an image is to be created then the generic type can ' t be used a specific one needs to be . An arbitrary
* specific image type is returned here . */
public static < T > T convertGenericToSpecificType ( Class < ? > type ) { } } | if ( type == GrayI8 . class ) return ( T ) GrayU8 . class ; if ( type == GrayI16 . class ) return ( T ) GrayS16 . class ; if ( type == InterleavedI8 . class ) return ( T ) InterleavedU8 . class ; if ( type == InterleavedI16 . class ) return ( T ) InterleavedS16 . class ; return ( T ) type ; |
public class ChangePasswordDialog { /** * This method is called from within the constructor to
* initialize the form . */
private void initComponents ( String initialMessage , String initialUsername ) { } } | java . awt . GridBagConstraints gridBagConstraints ; getContentPane ( ) . setLayout ( new java . awt . GridBagLayout ( ) ) ; addWindowListener ( new java . awt . event . WindowAdapter ( ) { public void windowClosing ( java . awt . event . WindowEvent evt ) { closeDialog ( evt ) ; } } ) ; userMessage = new javax . swing . JLabel ( ) ; userMessage . setText ( initialMessage ) ; gridBagConstraints = new java . awt . GridBagConstraints ( ) ; gridBagConstraints . gridwidth = java . awt . GridBagConstraints . REMAINDER ; gridBagConstraints . insets = new java . awt . Insets ( 5 , 5 , 5 , 5 ) ; getContentPane ( ) . add ( userMessage , gridBagConstraints ) ; userLabel = new javax . swing . JLabel ( ) ; userLabel . setText ( "Email address" ) ; gridBagConstraints = new java . awt . GridBagConstraints ( ) ; gridBagConstraints . insets = new java . awt . Insets ( 5 , 5 , 5 , 5 ) ; getContentPane ( ) . add ( userLabel , gridBagConstraints ) ; userField = new javax . swing . JTextField ( 20 ) ; userField . setText ( initialUsername ) ; gridBagConstraints = new java . awt . GridBagConstraints ( ) ; gridBagConstraints . gridwidth = java . awt . GridBagConstraints . REMAINDER ; gridBagConstraints . insets = new java . awt . Insets ( 5 , 5 , 5 , 5 ) ; getContentPane ( ) . add ( userField , gridBagConstraints ) ; currentPasswordLabel = new javax . swing . JLabel ( ) ; currentPasswordLabel . setText ( "Current password" ) ; gridBagConstraints = new java . awt . GridBagConstraints ( ) ; gridBagConstraints . insets = new java . awt . Insets ( 5 , 5 , 5 , 5 ) ; getContentPane ( ) . add ( currentPasswordLabel , gridBagConstraints ) ; currentPasswordField = new javax . swing . JPasswordField ( 20 ) ; gridBagConstraints = new java . awt . GridBagConstraints ( ) ; gridBagConstraints . gridwidth = java . awt . GridBagConstraints . REMAINDER ; gridBagConstraints . insets = new java . awt . Insets ( 5 , 5 , 5 , 5 ) ; getContentPane ( ) . add ( currentPasswordField , gridBagConstraints ) ; newPasswordLabel = new javax . swing . JLabel ( ) ; newPasswordLabel . setText ( "New password" ) ; gridBagConstraints = new java . awt . GridBagConstraints ( ) ; gridBagConstraints . insets = new java . awt . Insets ( 5 , 5 , 5 , 5 ) ; getContentPane ( ) . add ( newPasswordLabel , gridBagConstraints ) ; newPasswordField = new javax . swing . JPasswordField ( 20 ) ; gridBagConstraints = new java . awt . GridBagConstraints ( ) ; gridBagConstraints . gridwidth = java . awt . GridBagConstraints . REMAINDER ; gridBagConstraints . insets = new java . awt . Insets ( 5 , 5 , 5 , 5 ) ; getContentPane ( ) . add ( newPasswordField , gridBagConstraints ) ; confirmPasswordLabel = new javax . swing . JLabel ( ) ; confirmPasswordLabel . setText ( "Confirm password" ) ; gridBagConstraints = new java . awt . GridBagConstraints ( ) ; gridBagConstraints . insets = new java . awt . Insets ( 5 , 5 , 5 , 5 ) ; getContentPane ( ) . add ( confirmPasswordLabel , gridBagConstraints ) ; confirmPasswordField = new javax . swing . JPasswordField ( 20 ) ; gridBagConstraints = new java . awt . GridBagConstraints ( ) ; gridBagConstraints . gridwidth = java . awt . GridBagConstraints . REMAINDER ; gridBagConstraints . insets = new java . awt . Insets ( 5 , 5 , 5 , 5 ) ; getContentPane ( ) . add ( confirmPasswordField , gridBagConstraints ) ; cancelButton = new javax . swing . JButton ( ) ; cancelButton . setText ( "Cancel" ) ; cancelButton . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent evt ) { cancelButtonActionPerformed ( evt ) ; } } ) ; gridBagConstraints = new java . awt . GridBagConstraints ( ) ; gridBagConstraints . insets = new java . awt . Insets ( 5 , 5 , 5 , 5 ) ; getContentPane ( ) . add ( cancelButton , gridBagConstraints ) ; loginButton = new javax . swing . JButton ( ) ; loginButton . setText ( "Change password" ) ; loginButton . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent evt ) { loginButtonActionPerformed ( evt ) ; } } ) ; gridBagConstraints = new java . awt . GridBagConstraints ( ) ; gridBagConstraints . insets = new java . awt . Insets ( 5 , 5 , 5 , 5 ) ; getContentPane ( ) . add ( loginButton , gridBagConstraints ) ; pack ( ) ; |
public class BaseMojo { /** * Set up a classloader for the execution of the main class .
* @ return the classloader
* @ throws org . apache . maven . plugin . MojoExecutionException */
protected ClassLoader getClassLoader ( Set < Artifact > artifacts ) throws Exception { } } | Set < URL > classpathURLs = new LinkedHashSet < URL > ( ) ; addCustomClasspaths ( classpathURLs , true ) ; // add ourselves to top of classpath
URL mainClasses = new File ( project . getBuild ( ) . getOutputDirectory ( ) ) . toURI ( ) . toURL ( ) ; getLog ( ) . debug ( "Adding to classpath : " + mainClasses ) ; classpathURLs . add ( mainClasses ) ; for ( Artifact artifact : artifacts ) { File file = artifact . getFile ( ) ; if ( file != null ) { classpathURLs . add ( file . toURI ( ) . toURL ( ) ) ; } } addCustomClasspaths ( classpathURLs , false ) ; if ( logClasspath ) { getLog ( ) . info ( "Classpath (" + classpathURLs . size ( ) + " entries):" ) ; for ( URL url : classpathURLs ) { getLog ( ) . info ( " " + url . getFile ( ) . toString ( ) ) ; } } return new URLClassLoader ( classpathURLs . toArray ( new URL [ classpathURLs . size ( ) ] ) ) ; |
public class TypeConverter { /** * Discover all the type key mappings for this conversion */
private static List < Object > getTypeKeys ( Conversion < ? > conversion ) { } } | List < Object > result = new ArrayList < Object > ( ) ; synchronized ( typeConversions ) { // Clone the conversions
Map < Object , Conversion < ? > > map = new HashMap < Object , Conversion < ? > > ( typeConversions ) ; // Find all keys that map to this conversion instance
for ( Map . Entry < Object , Conversion < ? > > entry : map . entrySet ( ) ) { if ( entry . getValue ( ) == conversion ) { result . add ( entry . getKey ( ) ) ; } } } return result ; |
public class Ifc4FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public IfcBuildingSystemTypeEnum createIfcBuildingSystemTypeEnumFromString ( EDataType eDataType , String initialValue ) { } } | IfcBuildingSystemTypeEnum result = IfcBuildingSystemTypeEnum . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class FSNamesystem { /** * Remove the indicated filename from the namespace . This may
* invalidate some blocks that make up the file . */
boolean deleteInternal ( String src , INode [ ] inodes , boolean recursive , boolean enforcePermission ) throws IOException { } } | ArrayList < BlockInfo > collectedBlocks = new ArrayList < BlockInfo > ( ) ; INode targetNode = null ; byte [ ] [ ] components = inodes == null ? INodeDirectory . getPathComponents ( src ) : null ; writeLock ( ) ; try { if ( NameNode . stateChangeLog . isDebugEnabled ( ) ) { NameNode . stateChangeLog . debug ( "DIR* NameSystem.delete: " + src ) ; } if ( isInSafeMode ( ) ) { throw new SafeModeException ( "Cannot delete " + src , safeMode ) ; } if ( inodes == null ) { inodes = new INode [ components . length ] ; dir . rootDir . getExistingPathINodes ( components , inodes ) ; } if ( enforcePermission && isPermissionEnabled && isPermissionCheckingEnabled ( inodes ) ) { checkPermission ( src , inodes , false , null , FsAction . WRITE , null , FsAction . ALL ) ; } if ( neverDeletePaths . contains ( src ) ) { NameNode . stateChangeLog . warn ( "DIR* NameSystem.delete: " + " Trying to delete a whitelisted path " + src + " by user " + getCurrentUGI ( ) + " from server " + Server . getRemoteIp ( ) ) ; throw new IOException ( "Deleting a whitelisted directory is not allowed. " + src ) ; } if ( ( ! recursive ) && ( ! dir . isDirEmpty ( inodes [ inodes . length - 1 ] ) ) ) { throw new IOException ( src + " is non empty" ) ; } targetNode = dir . delete ( src , inodes , collectedBlocks , BLOCK_DELETION_INCREMENT ) ; if ( targetNode == null ) { return false ; } } finally { writeUnlock ( ) ; } List < INode > removedINodes = new ArrayList < INode > ( ) ; while ( targetNode . name != null ) { // Interatively Remove blocks
collectedBlocks . clear ( ) ; // sleep to make sure that the lock can be grabbed by another thread
try { Thread . sleep ( 1 ) ; } catch ( InterruptedException e ) { throw new InterruptedIOException ( e . getMessage ( ) ) ; } writeLock ( ) ; try { int filesRemoved = targetNode . collectSubtreeBlocksAndClear ( collectedBlocks , BLOCK_DELETION_INCREMENT , removedINodes ) ; incrDeletedFileCount ( this , filesRemoved ) ; removeBlocks ( collectedBlocks ) ; // remove from inodeMap
dir . removeFromInodeMap ( removedINodes ) ; } finally { writeUnlock ( ) ; } } collectedBlocks . clear ( ) ; removedINodes . clear ( ) ; return true ; |
public class ID3v2Frame { /** * Read the information from the flags array .
* @ param flags the flags found in the frame header
* @ exception ID3v2FormatException if an error occurs */
private void parseFlags ( byte [ ] flags ) throws ID3v2FormatException { } } | if ( flags . length != FRAME_FLAGS_SIZE ) { throw new ID3v2FormatException ( "Error parsing flags of frame: " + id + ". Expected 2 bytes." ) ; } else { tagAlterDiscard = ( flags [ 0 ] & 0x40 ) != 0 ; fileAlterDiscard = ( flags [ 0 ] & 0x20 ) != 0 ; readOnly = ( flags [ 0 ] & 0x10 ) != 0 ; grouped = ( flags [ 1 ] & 0x40 ) != 0 ; compressed = ( flags [ 1 ] & 0x08 ) != 0 ; encrypted = ( flags [ 1 ] & 0x04 ) != 0 ; unsynchronised = ( flags [ 1 ] & 0x02 ) != 0 ; lengthIndicator = ( flags [ 1 ] & 0x01 ) != 0 ; if ( compressed && ! lengthIndicator ) { throw new ID3v2FormatException ( "Error parsing flags of frame: " + id + ". Compressed bit set without data length bit set." ) ; } } |
public class TextAdapterActivity { /** * Default behavior returns true if Throwable is included in RETRY _ EXCEPTIONS
* attribute ( if declared ) . If this attribute is not declared , any IOExceptions are
* considered retryable . */
public boolean isRetryable ( Throwable ex ) { } } | try { String retryableAttr = getAttributeValueSmart ( PROP_RETRY_EXCEPTIONS ) ; if ( retryableAttr != null ) { for ( String retryableExClass : retryableAttr . split ( "," ) ) { if ( ex . getClass ( ) . getName ( ) . equals ( retryableExClass ) || ( ex . getCause ( ) != null && ex . getCause ( ) . getClass ( ) . getName ( ) . equals ( retryableExClass ) ) ) return true ; } return false ; } } catch ( Exception e ) { logger . severeException ( e . getMessage ( ) , e ) ; } return ex instanceof IOException ; |
public class WikiPageUtil { /** * Returns the decoded http string - all special symbols , replaced by
* replaced by the % [ HEX HEX ] sequence , where [ HEX HEX ] is the hexadecimal
* code of the escaped symbol will be restored to its original characters
* ( see RFC - 2616 http : / / www . w3 . org / Protocols / rfc2616 / ) .
* @ param str the string to decode
* @ return the decoded string . */
public static String decodeHttpParams ( String str ) { } } | if ( str == null ) { return "" ; } StringBuffer buf = new StringBuffer ( ) ; char [ ] array = str . toCharArray ( ) ; for ( int i = 0 ; i < array . length ; i ++ ) { char ch = array [ i ] ; if ( ch == '%' ) { if ( i + 2 >= array . length ) { break ; } int val = ( array [ ++ i ] - '0' ) ; val <<= 4 ; val |= ( array [ ++ i ] - '0' ) ; ch = ( char ) val ; } buf . append ( ch ) ; } return buf . toString ( ) ; |
public class IntIteratorUtils { /** * Merges several iterators of ascending { @ code int } values into a single iterator of ascending { @ code int } values .
* It isn ' t checked if the given source iterators are actually ascending , if they are not , the order of values in the
* returned iterator is undefined .
* This is similar to what { @ link org . apache . druid . java . util . common . guava . MergeIterator } does with simple
* { @ link java . util . Iterator } s .
* @ param iterators iterators to merge , must return ascending values */
public static IntIterator mergeAscending ( List < IntIterator > iterators ) { } } | if ( iterators . isEmpty ( ) ) { return IntIterators . EMPTY_ITERATOR ; } if ( iterators . size ( ) == 1 ) { return iterators . get ( 0 ) ; } return new MergeIntIterator ( iterators ) ; |
public class VersionsImpl { /** * Deleted an unlabelled utterance .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param utterance The utterance text to delete .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the OperationStatus object if successful . */
public OperationStatus deleteUnlabelledUtterance ( UUID appId , String versionId , String utterance ) { } } | return deleteUnlabelledUtteranceWithServiceResponseAsync ( appId , versionId , utterance ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class GrpcSerializationUtils { /** * Gets a Netty buffer directly from a gRPC ReadableBuffer .
* @ param buffer the input buffer
* @ return the raw ByteBuf , or null if the ByteBuf cannot be extracted */
public static ByteBuf getByteBufFromReadableBuffer ( ReadableBuffer buffer ) { } } | if ( ! sZeroCopyReceiveSupported ) { return null ; } try { if ( buffer instanceof CompositeReadableBuffer ) { Queue < ReadableBuffer > buffers = ( Queue < ReadableBuffer > ) sCompositeBuffers . get ( buffer ) ; if ( buffers . size ( ) == 1 ) { return getByteBufFromReadableBuffer ( buffers . peek ( ) ) ; } else { CompositeByteBuf buf = PooledByteBufAllocator . DEFAULT . compositeBuffer ( ) ; for ( ReadableBuffer readableBuffer : buffers ) { ByteBuf subBuffer = getByteBufFromReadableBuffer ( readableBuffer ) ; if ( subBuffer == null ) { return null ; } buf . addComponent ( true , subBuffer ) ; } return buf ; } } else if ( buffer . getClass ( ) . equals ( sReadableByteBuf . getDeclaringClass ( ) ) ) { return ( ByteBuf ) sReadableByteBuf . get ( buffer ) ; } } catch ( Exception e ) { LOG . warn ( "Failed to get data buffer from stream: {}." , e . getMessage ( ) ) ; return null ; } return null ; |
public class GattError { /** * Converts the bluetooth communication status given by other BluetoothGattCallbacks to error name . It also parses the DFU errors .
* @ param error the status number
* @ return the error name as stated in the gatt _ api . h file */
public static String parse ( final int error ) { } } | switch ( error ) { case 0x0001 : return "GATT INVALID HANDLE" ; case 0x0002 : return "GATT READ NOT PERMIT" ; case 0x0003 : return "GATT WRITE NOT PERMIT" ; case 0x0004 : return "GATT INVALID PDU" ; case 0x0005 : return "GATT INSUF AUTHENTICATION" ; case 0x0006 : return "GATT REQ NOT SUPPORTED" ; case 0x0007 : return "GATT INVALID OFFSET" ; case 0x0008 : return "GATT INSUF AUTHORIZATION" ; case 0x0009 : return "GATT PREPARE Q FULL" ; case 0x000a : return "GATT NOT FOUND" ; case 0x000b : return "GATT NOT LONG" ; case 0x000c : return "GATT INSUF KEY SIZE" ; case 0x000d : return "GATT INVALID ATTR LEN" ; case 0x000e : return "GATT ERR UNLIKELY" ; case 0x000f : return "GATT INSUF ENCRYPTION" ; case 0x0010 : return "GATT UNSUPPORT GRP TYPE" ; case 0x0011 : return "GATT INSUF RESOURCE" ; case 0x001A : return "HCI ERROR UNSUPPORTED REMOTE FEATURE" ; case 0x001E : return "HCI ERROR INVALID LMP PARAM" ; case 0x0022 : return "GATT CONN LMP TIMEOUT" ; case 0x002A : return "HCI ERROR DIFF TRANSACTION COLLISION" ; case 0x003A : return "GATT CONTROLLER BUSY" ; case 0x003B : return "GATT UNACCEPT CONN INTERVAL" ; case 0x0087 : return "GATT ILLEGAL PARAMETER" ; case 0x0080 : return "GATT NO RESOURCES" ; case 0x0081 : return "GATT INTERNAL ERROR" ; case 0x0082 : return "GATT WRONG STATE" ; case 0x0083 : return "GATT DB FULL" ; case 0x0084 : return "GATT BUSY" ; case 0x0085 : return "GATT ERROR" ; case 0x0086 : return "GATT CMD STARTED" ; case 0x0088 : return "GATT PENDING" ; case 0x0089 : return "GATT AUTH FAIL" ; case 0x008a : return "GATT MORE" ; case 0x008b : return "GATT INVALID CFG" ; case 0x008c : return "GATT SERVICE STARTED" ; case 0x008d : return "GATT ENCRYPTED NO MITM" ; case 0x008e : return "GATT NOT ENCRYPTED" ; case 0x008f : return "GATT CONGESTED" ; case 0x00FD : return "GATT CCCD CFG ERROR" ; case 0x00FE : return "GATT PROCEDURE IN PROGRESS" ; case 0x00FF : return "GATT VALUE OUT OF RANGE" ; case 0x0101 : return "TOO MANY OPEN CONNECTIONS" ; case DfuBaseService . ERROR_DEVICE_DISCONNECTED : return "DFU DEVICE DISCONNECTED" ; case DfuBaseService . ERROR_FILE_NOT_FOUND : return "DFU FILE NOT FOUND" ; case DfuBaseService . ERROR_FILE_ERROR : return "DFU FILE ERROR" ; case DfuBaseService . ERROR_FILE_INVALID : return "DFU NOT A VALID HEX FILE" ; case DfuBaseService . ERROR_FILE_IO_EXCEPTION : return "DFU IO EXCEPTION" ; case DfuBaseService . ERROR_SERVICE_DISCOVERY_NOT_STARTED : return "DFU SERVICE DISCOVERY NOT STARTED" ; case DfuBaseService . ERROR_SERVICE_NOT_FOUND : return "DFU CHARACTERISTICS NOT FOUND" ; case DfuBaseService . ERROR_INVALID_RESPONSE : return "DFU INVALID RESPONSE" ; case DfuBaseService . ERROR_FILE_TYPE_UNSUPPORTED : return "DFU FILE TYPE NOT SUPPORTED" ; case DfuBaseService . ERROR_BLUETOOTH_DISABLED : return "BLUETOOTH ADAPTER DISABLED" ; case DfuBaseService . ERROR_INIT_PACKET_REQUIRED : return "DFU INIT PACKET REQUIRED" ; case DfuBaseService . ERROR_FILE_SIZE_INVALID : return "DFU INIT PACKET REQUIRED" ; case DfuBaseService . ERROR_CRC_ERROR : return "DFU CRC ERROR" ; case DfuBaseService . ERROR_DEVICE_NOT_BONDED : return "DFU DEVICE NOT BONDED" ; default : return "UNKNOWN (" + error + ")" ; } |
public class StringTool { /** * Generates a copyright string for the specified copyright holder from the
* specified first year to the current year . */
public static String copyright ( String holder , int startYear ) { } } | Calendar cal = Calendar . getInstance ( ) ; int year = cal . get ( Calendar . YEAR ) ; return "© " + holder + " " + startYear + "-" + year ; |
public class ApiOvhTelephony { /** * Alter this object properties
* REST : PUT / telephony / { billingAccount } / line / { serviceName } / abbreviatedNumber / { abbreviatedNumber }
* @ param body [ required ] New object properties
* @ param billingAccount [ required ] The name of your billingAccount
* @ param serviceName [ required ]
* @ param abbreviatedNumber [ required ] The abbreviated number which must start with " 2 " and must have a length of 3 or 4 digits */
public void billingAccount_line_serviceName_abbreviatedNumber_abbreviatedNumber_PUT ( String billingAccount , String serviceName , Long abbreviatedNumber , OvhAbbreviatedNumber body ) throws IOException { } } | String qPath = "/telephony/{billingAccount}/line/{serviceName}/abbreviatedNumber/{abbreviatedNumber}" ; StringBuilder sb = path ( qPath , billingAccount , serviceName , abbreviatedNumber ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ; |
public class SemaphoreCompletionService { /** * Signal that a task that called { @ link # continueTaskInBackground ( ) } has finished and
* optionally execute another task on the just - freed thread . */
public Future < T > backgroundTaskFinished ( final Callable < T > cleanupTask ) { } } | QueueingTask futureTask = null ; if ( cleanupTask != null ) { if ( trace ) log . tracef ( "Background task finished, executing cleanup task" ) ; futureTask = new QueueingTask ( cleanupTask ) ; executor . execute ( futureTask ) ; } else { semaphore . release ( ) ; if ( trace ) log . tracef ( "Background task finished, available permits %d" , semaphore . availablePermits ( ) ) ; executeFront ( ) ; } return futureTask ; |
public class OperationMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Operation operation , ProtocolMarshaller protocolMarshaller ) { } } | if ( operation == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( operation . getId ( ) , ID_BINDING ) ; protocolMarshaller . marshall ( operation . getType ( ) , TYPE_BINDING ) ; protocolMarshaller . marshall ( operation . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( operation . getErrorMessage ( ) , ERRORMESSAGE_BINDING ) ; protocolMarshaller . marshall ( operation . getErrorCode ( ) , ERRORCODE_BINDING ) ; protocolMarshaller . marshall ( operation . getCreateDate ( ) , CREATEDATE_BINDING ) ; protocolMarshaller . marshall ( operation . getUpdateDate ( ) , UPDATEDATE_BINDING ) ; protocolMarshaller . marshall ( operation . getTargets ( ) , TARGETS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Session { /** * Get a snapshot of the grants used for this session for the web server .
* This method should be synchronized by the caller around the session .
* @ return List of { @ link GrantReport } objects for this session sorted by id . */
public List < GrantReport > getGrantReportList ( ) { } } | Map < Integer , GrantReport > grantReportMap = new TreeMap < Integer , GrantReport > ( ) ; for ( Map . Entry < Integer , ResourceGrant > entry : idToGrant . entrySet ( ) ) { grantReportMap . put ( entry . getKey ( ) , new GrantReport ( entry . getKey ( ) . intValue ( ) , entry . getValue ( ) . getAddress ( ) . toString ( ) , entry . getValue ( ) . getType ( ) , entry . getValue ( ) . getGrantedTime ( ) ) ) ; } return new ArrayList < GrantReport > ( grantReportMap . values ( ) ) ; |
public class CorruptReplicasMap { /** * Get Nodes which have corrupt replicas of Block
* @ param blk Block for which nodes are requested
* @ return collection of nodes . Null if does not exists */
Collection < DatanodeDescriptor > getNodes ( Block blk ) { } } | if ( corruptReplicasMap . size ( ) == 0 ) return null ; return corruptReplicasMap . get ( blk ) ; |
public class Util { /** * Convert this class name by inserting this package after the domain .
* ie . , if location = 2 , com . xyz . abc . ClassName - > com . xyz . newpackage . abc . ClassName .
* @ param className
* @ param package location ( positive = from left , negative = from right ; 0 = before package , - 1 = before class name , etc . )
* @ param stringToInsert
* @ return Converted string */
public static String convertClassName ( String className , String stringToInsert , int location ) { } } | int startSeq = 0 ; if ( location >= 0 ) { for ( int i = 0 ; i < location ; i ++ ) { startSeq = className . indexOf ( '.' , startSeq + 1 ) ; } } else { startSeq = className . length ( ) ; for ( int i = location ; i < 0 ; i ++ ) { startSeq = className . lastIndexOf ( '.' , startSeq - 1 ) ; } } if ( startSeq == - 1 ) return null ; int domainSeq = startSeq ; if ( className . indexOf ( Constant . THIN_SUBPACKAGE , startSeq ) == startSeq + 1 ) startSeq = startSeq + Constant . THIN_SUBPACKAGE . length ( ) ; className = className . substring ( 0 , domainSeq + 1 ) + stringToInsert + className . substring ( startSeq + 1 ) ; return className ; |
public class CmsRewriteAliasMatcher { /** * Tries to rewrite a given path , and either returns the rewrite result or null if no
* rewrite alias matched the path . < p >
* @ param path the path to match
* @ return the rewrite result or null if no rewrite alias matched */
public RewriteResult match ( String path ) { } } | for ( CmsRewriteAlias alias : m_aliases ) { try { Pattern pattern = Pattern . compile ( alias . getPatternString ( ) ) ; Matcher matcher = pattern . matcher ( path ) ; if ( matcher . matches ( ) ) { String newPath = matcher . replaceFirst ( alias . getReplacementString ( ) ) ; return new RewriteResult ( newPath , alias ) ; } } catch ( PatternSyntaxException e ) { LOG . warn ( e . getLocalizedMessage ( ) , e ) ; } catch ( IndexOutOfBoundsException e ) { LOG . warn ( e . getLocalizedMessage ( ) , e ) ; } } return null ; |
public class FileListFromTaskOptions { /** * Set the time the request was issued . Client libraries typically set this to the current system clock time ; set it explicitly if you are calling the REST API directly .
* @ param ocpDate the ocpDate value to set
* @ return the FileListFromTaskOptions object itself . */
public FileListFromTaskOptions withOcpDate ( DateTime ocpDate ) { } } | if ( ocpDate == null ) { this . ocpDate = null ; } else { this . ocpDate = new DateTimeRfc1123 ( ocpDate ) ; } return this ; |
public class KoreanCalendar { /** * / * [ deutsch ]
* < p > Erzeugt ein neues koreanisches Kalenderdatum . < / p >
* @ param year references the year using different systems like eras or sexagesimal cycles
* @ param month the month which might be a leap month
* @ param dayOfMonth the day of month to be checked
* @ return new instance of { @ code KoreanCalendar }
* @ throws IllegalArgumentException in case of any inconsistencies */
public static KoreanCalendar of ( EastAsianYear year , EastAsianMonth month , int dayOfMonth ) { } } | int cycle = year . getCycle ( ) ; int yearOfCycle = year . getYearOfCycle ( ) . getNumber ( ) ; return KoreanCalendar . of ( cycle , yearOfCycle , month , dayOfMonth ) ; |
public class LambdaUtils { /** * 将val分发给consumer */
public static < T > T pass ( T val , Consumer < T > consumer ) { } } | if ( consumer != null ) consumer . accept ( val ) ; return val ; |
public class StandardAlgConfigPanel { /** * Searches inside the children of " root " for a component that ' s a JPanel . Then inside the JPanel it
* looks for the target . If the target is inside the JPanel the JPanel is removed from root . */
protected static void removeChildInsidePanel ( JComponent root , JComponent target ) { } } | int N = root . getComponentCount ( ) ; for ( int i = 0 ; i < N ; i ++ ) { try { JPanel p = ( JPanel ) root . getComponent ( i ) ; Component [ ] children = p . getComponents ( ) ; for ( int j = 0 ; j < children . length ; j ++ ) { if ( children [ j ] == target ) { root . remove ( i ) ; return ; } } } catch ( ClassCastException ignore ) { } } |
public class StreamResource { /** * Intercepts the stream represented by this StreamResource , sending the
* contents of the given InputStream over that stream as " blob "
* instructions .
* @ param data
* An InputStream containing the data to be sent over the intercepted
* stream .
* @ throws GuacamoleException
* If the intercepted stream closes with an error . */
@ POST @ Consumes ( MediaType . WILDCARD ) public void setStreamContents ( InputStream data ) throws GuacamoleException { } } | // Send input over stream
tunnel . interceptStream ( streamIndex , data ) ; |
public class TeaToolsUtils { /** * A function that returns an array of all the available properties on
* a given class .
* < b > NOTE : < / b > If possible , the results of this method should be cached
* by the caller .
* @ param beanClass the bean class to introspect
* @ return an array of all the available properties on the specified class . */
public PropertyDescriptor [ ] getTeaBeanPropertyDescriptors ( Class < ? > beanClass ) { } } | // Code taken from KettleUtilities . getPropertyDescriptors ( Class )
if ( beanClass == null ) { return NO_PROPERTIES ; } PropertyDescriptor [ ] properties = null ; Map < String , PropertyDescriptor > allProps = null ; try { allProps = BeanAnalyzer . getAllProperties ( new GenericType ( beanClass ) ) ; } catch ( Throwable t ) { return NO_PROPERTIES ; } Collection < PropertyDescriptor > cleanProps = new ArrayList < PropertyDescriptor > ( allProps . size ( ) ) ; Iterator < Map . Entry < String , PropertyDescriptor > > it = allProps . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Map . Entry < String , PropertyDescriptor > entry = it . next ( ) ; String name = entry . getKey ( ) ; PropertyDescriptor desc = entry . getValue ( ) ; // Discard properties that have no name or should be hidden .
if ( name == null || name . length ( ) == 0 || "class" . equals ( name ) ) { continue ; } if ( desc instanceof KeyedPropertyDescriptor ) { KeyedPropertyDescriptor keyed = ( KeyedPropertyDescriptor ) desc ; Class < ? > type = keyed . getKeyedPropertyType ( ) . getRawType ( ) . getType ( ) ; try { // Convert the KeyedPropertyDescriptor to a
// ArrayIndexPropertyDescriptor
desc = new ArrayIndexPropertyDescriptor ( beanClass , type ) ; } catch ( Throwable t ) { continue ; } } else if ( ! beanClass . isArray ( ) && desc . getReadMethod ( ) == null ) { continue ; } cleanProps . add ( desc ) ; } properties = cleanProps . toArray ( new PropertyDescriptor [ cleanProps . size ( ) ] ) ; // Sort ' em !
sortPropertyDescriptors ( properties ) ; return properties ; |
public class Postconditions { /** * A { @ code double } specialized version of { @ link # checkPostcondition ( Object ,
* ContractConditionType ) } .
* @ param value The value
* @ param condition The predicate
* @ return value
* @ throws PostconditionViolationException If the predicate is false */
public static double checkPostconditionD ( final double value , final ContractDoubleConditionType condition ) throws PostconditionViolationException { } } | return checkPostconditionD ( value , condition . predicate ( ) , condition . describer ( ) ) ; |
public class IndirectSort { /** * Creates the initial order array . */
private static int [ ] createOrderArray ( final int start , final int length ) { } } | final int [ ] order = new int [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { order [ i ] = start + i ; } return order ; |
public class MetricValueMarshaller { /** * Marshall the given parameter object . */
public void marshall ( MetricValue metricValue , ProtocolMarshaller protocolMarshaller ) { } } | if ( metricValue == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( metricValue . getCount ( ) , COUNT_BINDING ) ; protocolMarshaller . marshall ( metricValue . getCidrs ( ) , CIDRS_BINDING ) ; protocolMarshaller . marshall ( metricValue . getPorts ( ) , PORTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ProxyHandler { /** * Customize proxy URL connection . Method to allow derived handlers to customize the connection . */
protected void customizeConnection ( String pathInContext , String pathParams , HttpRequest request , URLConnection connection ) throws IOException { } } | |
public class Latency { /** * Copy the current immutable object by setting a value for the { @ link AbstractLatency # getPercentile999th ( ) percentile999th } attribute .
* @ param value A new value for percentile999th
* @ return A modified copy of the { @ code this } object */
public final Latency withPercentile999th ( double value ) { } } | double newValue = value ; return new Latency ( this . median , this . percentile98th , this . percentile99th , newValue , this . mean , this . min , this . max ) ; |
public class PolicyEventsInner { /** * Queries policy events for the resource group level policy assignment .
* @ param subscriptionId Microsoft Azure subscription ID .
* @ param resourceGroupName Resource group name .
* @ param policyAssignmentName Policy assignment name .
* @ param queryOptions Additional parameters for the operation
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < PolicyEventsQueryResultsInner > listQueryResultsForResourceGroupLevelPolicyAssignmentAsync ( String subscriptionId , String resourceGroupName , String policyAssignmentName , QueryOptions queryOptions , final ServiceCallback < PolicyEventsQueryResultsInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync ( subscriptionId , resourceGroupName , policyAssignmentName , queryOptions ) , serviceCallback ) ; |
public class ScannerParamFilter { /** * Check if the parameter should be excluded by the scanner
* @ param msg the message that is currently under scanning
* @ param param the Value / Name param object that is currently under scanning
* @ return true if the parameter should be excluded */
public boolean isToExclude ( HttpMessage msg , NameValuePair param ) { } } | return ( ( paramType == NameValuePair . TYPE_UNDEFINED ) || ( param . getType ( ) == paramType ) ) && ( ( urlPattern == null ) || urlPattern . matcher ( msg . getRequestHeader ( ) . getURI ( ) . toString ( ) . toUpperCase ( Locale . ROOT ) ) . matches ( ) ) && ( paramNamePattern . matcher ( param . getName ( ) ) . matches ( ) ) ; |
public class EnvironmentsInner { /** * Claims the environment and assigns it to the user .
* @ param resourceGroupName The name of the resource group .
* @ param labAccountName The name of the lab Account .
* @ param labName The name of the lab .
* @ param environmentSettingName The name of the environment Setting .
* @ param environmentName The name of the environment .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponse } object if successful . */
public Observable < Void > claimAsync ( String resourceGroupName , String labAccountName , String labName , String environmentSettingName , String environmentName ) { } } | return claimWithServiceResponseAsync ( resourceGroupName , labAccountName , labName , environmentSettingName , environmentName ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class BDDFactory { /** * Returns a LogicNG internal BDD data structure of a given BDD .
* @ param bdd the BDD
* @ return the BDD as LogicNG data structure */
public BDDNode toLngBdd ( final int bdd ) { } } | final BDDConstant falseNode = BDDConstant . getFalsumNode ( this . f ) ; final BDDConstant trueNode = BDDConstant . getVerumNode ( this . f ) ; if ( bdd == BDDKernel . BDD_FALSE ) return falseNode ; if ( bdd == BDDKernel . BDD_TRUE ) return trueNode ; final List < int [ ] > nodes = this . kernel . allNodes ( bdd ) ; final Map < Integer , BDDInnerNode > innerNodes = new HashMap < > ( ) ; for ( final int [ ] node : nodes ) { final int nodenum = node [ 0 ] ; final Variable variable = this . idx2var . get ( node [ 1 ] ) ; final BDDNode lowNode = getInnerNode ( node [ 2 ] , falseNode , trueNode , innerNodes ) ; final BDDNode highNode = getInnerNode ( node [ 3 ] , falseNode , trueNode , innerNodes ) ; if ( innerNodes . get ( nodenum ) == null ) innerNodes . put ( nodenum , new BDDInnerNode ( variable , lowNode , highNode ) ) ; } return innerNodes . get ( bdd ) ; |
public class XPATHErrorResources { /** * Return a named ResourceBundle for a particular locale . This method mimics the behavior
* of ResourceBundle . getBundle ( ) .
* @ param className Name of local - specific subclass .
* @ return the ResourceBundle
* @ throws MissingResourceException */
public static final XPATHErrorResources loadResourceBundle ( String className ) throws MissingResourceException { } } | Locale locale = Locale . getDefault ( ) ; String suffix = getResourceSuffix ( locale ) ; try { // first try with the given locale
return ( XPATHErrorResources ) ResourceBundle . getBundle ( className + suffix , locale ) ; } catch ( MissingResourceException e ) { try // try to fall back to en _ US if we can ' t load
{ // Since we can ' t find the localized property file ,
// fall back to en _ US .
return ( XPATHErrorResources ) ResourceBundle . getBundle ( className , new Locale ( "en" , "US" ) ) ; } catch ( MissingResourceException e2 ) { // Now we are really in trouble .
// very bad , definitely very bad . . . not going to get very far
throw new MissingResourceException ( "Could not load any resource bundles." , className , "" ) ; } } |
public class ViewBackgroundPreferenceController { /** * Display the main user - facing view of the portlet .
* @ param request
* @ return */
@ RenderMapping public String getView ( RenderRequest req , Model model ) { } } | final String [ ] images = imageSetSelectionStrategy . getImageSet ( req ) ; model . addAttribute ( "images" , images ) ; final String [ ] thumbnailImages = imageSetSelectionStrategy . getImageThumbnailSet ( req ) ; model . addAttribute ( "thumbnailImages" , thumbnailImages ) ; final String [ ] imageCaptions = imageSetSelectionStrategy . getImageCaptions ( req ) ; model . addAttribute ( "imageCaptions" , imageCaptions ) ; final String preferredBackgroundImage = imageSetSelectionStrategy . getSelectedImage ( req ) ; model . addAttribute ( "backgroundImage" , preferredBackgroundImage ) ; final String backgroundContainerSelector = imageSetSelectionStrategy . getBackgroundContainerSelector ( req ) ; model . addAttribute ( "backgroundContainerSelector" , backgroundContainerSelector ) ; final PortletPreferences prefs = req . getPreferences ( ) ; model . addAttribute ( "applyOpacityTo" , prefs . getValue ( "applyOpacityTo" , null ) ) ; model . addAttribute ( "opacityCssValue" , prefs . getValue ( "opacityCssValue" , "1.0" ) ) ; return "/jsp/BackgroundPreference/viewBackgroundPreference" ; |
public class DisassociateSkillFromSkillGroupRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DisassociateSkillFromSkillGroupRequest disassociateSkillFromSkillGroupRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( disassociateSkillFromSkillGroupRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( disassociateSkillFromSkillGroupRequest . getSkillGroupArn ( ) , SKILLGROUPARN_BINDING ) ; protocolMarshaller . marshall ( disassociateSkillFromSkillGroupRequest . getSkillId ( ) , SKILLID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class GetStagesResult { /** * The current page of elements from this collection .
* @ param item
* The current page of elements from this collection . */
public void setItem ( java . util . Collection < Stage > item ) { } } | if ( item == null ) { this . item = null ; return ; } this . item = new java . util . ArrayList < Stage > ( item ) ; |
public class ManagementRemotingServices { /** * Set up the services to create a channel listener and operation handler service .
* @ param serviceTarget the service target to install the services into
* @ param endpointName the endpoint name to install the services into
* @ param channelName the name of the channel
* @ param executorServiceName service name of the executor service to use in the operation handler service
* @ param scheduledExecutorServiceName service name of the scheduled executor service to use in the operation handler service */
public static void installManagementChannelServices ( final ServiceTarget serviceTarget , final ServiceName endpointName , final AbstractModelControllerOperationHandlerFactoryService operationHandlerService , final ServiceName modelControllerName , final String channelName , final ServiceName executorServiceName , final ServiceName scheduledExecutorServiceName ) { } } | final OptionMap options = OptionMap . EMPTY ; final ServiceName operationHandlerName = endpointName . append ( channelName ) . append ( ModelControllerClientOperationHandlerFactoryService . OPERATION_HANDLER_NAME_SUFFIX ) ; serviceTarget . addService ( operationHandlerName , operationHandlerService ) . addDependency ( modelControllerName , ModelController . class , operationHandlerService . getModelControllerInjector ( ) ) . addDependency ( executorServiceName , ExecutorService . class , operationHandlerService . getExecutorInjector ( ) ) . addDependency ( scheduledExecutorServiceName , ScheduledExecutorService . class , operationHandlerService . getScheduledExecutorInjector ( ) ) . setInitialMode ( ACTIVE ) . install ( ) ; installManagementChannelOpenListenerService ( serviceTarget , endpointName , channelName , operationHandlerName , options , false ) ; |
public class GeometryExtrude { /** * Extract the roof of a polygon
* @ param polygon
* @ param height
* @ return */
public static Polygon extractRoof ( Polygon polygon , double height ) { } } | GeometryFactory factory = polygon . getFactory ( ) ; Polygon roofP = ( Polygon ) polygon . copy ( ) ; roofP . apply ( new TranslateCoordinateSequenceFilter ( height ) ) ; final LinearRing shell = factory . createLinearRing ( getCounterClockWise ( roofP . getExteriorRing ( ) ) . getCoordinates ( ) ) ; final int nbOfHoles = roofP . getNumInteriorRing ( ) ; final LinearRing [ ] holes = new LinearRing [ nbOfHoles ] ; for ( int i = 0 ; i < nbOfHoles ; i ++ ) { holes [ i ] = factory . createLinearRing ( getClockWise ( roofP . getInteriorRingN ( i ) ) . getCoordinates ( ) ) ; } return factory . createPolygon ( shell , holes ) ; |
public class Select { /** * Save any body content of this tag , which will generally be the
* option ( s ) representing the values displayed to the user .
* @ throws JspException if a JSP exception has occurred */
public int doAfterBody ( ) throws JspException { } } | if ( hasErrors ( ) ) { return SKIP_BODY ; } // if this is a repeater we need to repeater over the body . . .
if ( _repeater ) { if ( doRepeaterAfterBody ( ) ) return EVAL_BODY_AGAIN ; } if ( bodyContent != null ) { String value = bodyContent . getString ( ) ; bodyContent . clearBody ( ) ; if ( value == null ) value = "" ; _saveBody = value . trim ( ) ; } return SKIP_BODY ; |
public class SARLSemanticSequencer { /** * Contexts :
* XCastedExpression returns XUnaryOperation
* XCastedExpression . SarlCastedExpression _ 1_0_0_0 returns XUnaryOperation
* XPrimaryExpression returns XUnaryOperation
* XMultiplicativeExpression returns XUnaryOperation
* XMultiplicativeExpression . XBinaryOperation _ 1_0_0_0 returns XUnaryOperation
* XExponentExpression returns XUnaryOperation
* XExponentExpression . XBinaryOperation _ 1_0_0_0 returns XUnaryOperation
* XUnaryOperation returns XUnaryOperation
* XExpressionOrSimpleConstructorCall returns XUnaryOperation
* RichStringPart returns XUnaryOperation
* XAnnotationElementValueOrCommaList returns XUnaryOperation
* XAnnotationElementValueOrCommaList . XListLiteral _ 1_1_0 returns XUnaryOperation
* XAnnotationElementValue returns XUnaryOperation
* XAnnotationOrExpression returns XUnaryOperation
* XExpression returns XUnaryOperation
* XAssignment returns XUnaryOperation
* XAssignment . XBinaryOperation _ 1_1_0_0_0 returns XUnaryOperation
* XOrExpression returns XUnaryOperation
* XOrExpression . XBinaryOperation _ 1_0_0_0 returns XUnaryOperation
* XAndExpression returns XUnaryOperation
* XAndExpression . XBinaryOperation _ 1_0_0_0 returns XUnaryOperation
* XEqualityExpression returns XUnaryOperation
* XEqualityExpression . XBinaryOperation _ 1_0_0_0 returns XUnaryOperation
* XRelationalExpression returns XUnaryOperation
* XRelationalExpression . XInstanceOfExpression _ 1_0_0_0_0 returns XUnaryOperation
* XRelationalExpression . XBinaryOperation _ 1_1_0_0_0 returns XUnaryOperation
* XOtherOperatorExpression returns XUnaryOperation
* XOtherOperatorExpression . XBinaryOperation _ 1_0_0_0 returns XUnaryOperation
* XAdditiveExpression returns XUnaryOperation
* XAdditiveExpression . XBinaryOperation _ 1_0_0_0 returns XUnaryOperation
* XPostfixOperation returns XUnaryOperation
* XPostfixOperation . XPostfixOperation _ 1_0_0 returns XUnaryOperation
* XMemberFeatureCall returns XUnaryOperation
* XMemberFeatureCall . XAssignment _ 1_0_0_0_0 returns XUnaryOperation
* XMemberFeatureCall . XMemberFeatureCall _ 1_1_0_0_0 returns XUnaryOperation
* XParenthesizedExpression returns XUnaryOperation
* XExpressionOrVarDeclaration returns XUnaryOperation
* Constraint :
* ( feature = [ JvmIdentifiableElement | OpUnary ] operand = XUnaryOperation ) */
protected void sequence_XUnaryOperation ( ISerializationContext context , XUnaryOperation semanticObject ) { } } | if ( errorAcceptor != null ) { if ( transientValues . isValueTransient ( semanticObject , XbasePackage . Literals . XABSTRACT_FEATURE_CALL__FEATURE ) == ValueTransient . YES ) errorAcceptor . accept ( diagnosticProvider . createFeatureValueMissing ( semanticObject , XbasePackage . Literals . XABSTRACT_FEATURE_CALL__FEATURE ) ) ; if ( transientValues . isValueTransient ( semanticObject , XbasePackage . Literals . XUNARY_OPERATION__OPERAND ) == ValueTransient . YES ) errorAcceptor . accept ( diagnosticProvider . createFeatureValueMissing ( semanticObject , XbasePackage . Literals . XUNARY_OPERATION__OPERAND ) ) ; } SequenceFeeder feeder = createSequencerFeeder ( context , semanticObject ) ; feeder . accept ( grammarAccess . getXUnaryOperationAccess ( ) . getFeatureJvmIdentifiableElementOpUnaryParserRuleCall_0_1_0_1 ( ) , semanticObject . eGet ( XbasePackage . Literals . XABSTRACT_FEATURE_CALL__FEATURE , false ) ) ; feeder . accept ( grammarAccess . getXUnaryOperationAccess ( ) . getOperandXUnaryOperationParserRuleCall_0_2_0 ( ) , semanticObject . getOperand ( ) ) ; feeder . finish ( ) ; |
public class JoinSomeValueCreator { /** * { @ inheritDoc } */
@ Override protected void init ( ) { } } | dataJoinNo = StringUtil . getMatchNos ( labels , conf . getStrings ( SimpleJob . JOIN_DATA_COLUMN ) ) ; |
public class StringRecord { /** * Read a UTF8 encoded string from in */
public static String readString ( final DataInput in ) throws IOException { } } | if ( in . readBoolean ( ) ) { final int length = in . readInt ( ) ; if ( length < 0 ) { throw new IOException ( "length of StringRecord is " + length ) ; } final byte [ ] bytes = new byte [ length ] ; in . readFully ( bytes , 0 , length ) ; return decode ( bytes ) ; } return null ; |
public class ACRA { /** * Initialize ACRA for a given Application . The call to this method should
* be placed as soon as possible in the { @ link Application # attachBaseContext ( Context ) }
* method .
* @ param app Your Application class .
* @ param config CoreConfiguration to manually set up ACRA configuration .
* @ param checkReportsOnApplicationStart Whether to invoke ErrorReporter . checkReportsOnApplicationStart ( ) .
* @ throws IllegalStateException if it is called more than once . */
public static void init ( @ NonNull Application app , @ NonNull CoreConfiguration config , boolean checkReportsOnApplicationStart ) { } } | final boolean senderServiceProcess = isACRASenderServiceProcess ( ) ; if ( senderServiceProcess ) { if ( ACRA . DEV_LOGGING ) log . d ( LOG_TAG , "Not initialising ACRA to listen for uncaught Exceptions as this is the SendWorker process and we only send reports, we don't capture them to avoid infinite loops" ) ; } final boolean supportedAndroidVersion = Build . VERSION . SDK_INT >= Build . VERSION_CODES . ICE_CREAM_SANDWICH ; if ( ! supportedAndroidVersion ) { // NB We keep initialising so that everything is configured . But ACRA is never enabled below .
log . w ( LOG_TAG , "ACRA 5.1.0+ requires ICS or greater. ACRA is disabled and will NOT catch crashes or send messages." ) ; } if ( isInitialised ( ) ) { log . w ( LOG_TAG , "ACRA#init called more than once. This might have unexpected side effects. Doing this outside of tests is discouraged." ) ; if ( DEV_LOGGING ) log . d ( LOG_TAG , "Removing old ACRA config..." ) ; ( ( ErrorReporterImpl ) errorReporterSingleton ) . unregister ( ) ; errorReporterSingleton = StubCreator . createErrorReporterStub ( ) ; } // noinspection ConstantConditions
if ( config == null ) { log . e ( LOG_TAG , "ACRA#init called but no CoreConfiguration provided" ) ; return ; } final SharedPreferences prefs = new SharedPreferencesFactory ( app , config ) . create ( ) ; new LegacyFileHandler ( app , prefs ) . updateToCurrentVersionIfNecessary ( ) ; if ( ! senderServiceProcess ) { // Initialize ErrorReporter with all required data
final boolean enableAcra = supportedAndroidVersion && SharedPreferencesFactory . shouldEnableACRA ( prefs ) ; // Indicate that ACRA is or is not listening for crashes .
log . i ( LOG_TAG , "ACRA is " + ( enableAcra ? "enabled" : "disabled" ) + " for " + app . getPackageName ( ) + ", initializing..." ) ; ErrorReporterImpl reporter = new ErrorReporterImpl ( app , config , enableAcra , supportedAndroidVersion , checkReportsOnApplicationStart ) ; errorReporterSingleton = reporter ; // register after initAcra is called to avoid a
// NPE in ErrorReporter . disable ( ) because
// the context could be null at this moment .
prefs . registerOnSharedPreferenceChangeListener ( reporter ) ; } |
public class TransmitMessageRequest { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . runtime . SIMPRemoteMessageControllable # getStartTick ( ) */
public long getStartTick ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getStateTick" ) ; long startTick = getTickRange ( ) . startstamp ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getStartTick" , new Long ( startTick ) ) ; return startTick ; |
public class RuntimeUtil { /** * 返回输入的JVM参数列表 */
public static String getVmArguments ( ) { } } | List < String > vmArguments = ManagementFactory . getRuntimeMXBean ( ) . getInputArguments ( ) ; return StringUtils . join ( vmArguments , " " ) ; |
public class AbstractConverterBuilder { /** * Configures a worker pool for the converter . This worker pool implicitly sets a maximum
* number of conversions that are concurrently undertaken by the resulting converter . When a
* converter is requested to concurrently execute more conversions than { @ code maximumPoolSize } ,
* it will queue excess conversions until capacities are available again .
* < p > & nbsp ; < / p >
* If this number is set too low , the concurrent performance of the resulting converter will be weak
* compared to a higher number . If this number is set too high , the converter might < i > overheat < / i >
* when accessing the underlying external resource ( such as for example an external process or a
* HTTP connection ) . A remote converter that shares a conversion server with another converter might
* also starve these other remote converters .
* @ param corePoolSize The core pool size of the worker pool .
* @ param maximumPoolSize The maximum pool size of the worker pool .
* @ param keepAliveTime The keep alive time of the worker pool .
* @ param unit The time unit of the specified keep alive time .
* @ return This builder instance . */
@ SuppressWarnings ( "unchecked" ) public T workerPool ( int corePoolSize , int maximumPoolSize , long keepAliveTime , TimeUnit unit ) { } } | assertNumericArgument ( corePoolSize , true ) ; assertNumericArgument ( maximumPoolSize , false ) ; assertSmallerEquals ( corePoolSize , maximumPoolSize ) ; assertNumericArgument ( keepAliveTime , true ) ; assertNumericArgument ( keepAliveTime , true ) ; this . corePoolSize = corePoolSize ; this . maximumPoolSize = maximumPoolSize ; this . keepAliveTime = unit . toMillis ( keepAliveTime ) ; return ( T ) this ; |
public class BuilderImpl { /** * Create a builder with specified builder */
@ Override public synchronized Builder create ( String builderConfigId ) throws InvalidBuilderException { } } | if ( builderConfigId == null || builderConfigId . isEmpty ( ) ) { String err = Tr . formatMessage ( tc , "JWT_BUILDER_INVALID" , new Object [ ] { builderConfigId } ) ; throw new InvalidBuilderException ( err ) ; } if ( ! active ) { String err = Tr . formatMessage ( tc , "JWT_BUILDER_NOT_ACTIVE" , new Object [ ] { builderConfigId } ) ; throw new InvalidBuilderException ( err ) ; } // Tr . error ( tc , " JWT _ BUILDER _ NOT _ ACTIVE " , new Object [ ] { builderConfigId
// return null ;
return new BuilderImpl ( builderConfigId ) ; |
public class AcceptDirectConnectGatewayAssociationProposalRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AcceptDirectConnectGatewayAssociationProposalRequest acceptDirectConnectGatewayAssociationProposalRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( acceptDirectConnectGatewayAssociationProposalRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( acceptDirectConnectGatewayAssociationProposalRequest . getDirectConnectGatewayId ( ) , DIRECTCONNECTGATEWAYID_BINDING ) ; protocolMarshaller . marshall ( acceptDirectConnectGatewayAssociationProposalRequest . getProposalId ( ) , PROPOSALID_BINDING ) ; protocolMarshaller . marshall ( acceptDirectConnectGatewayAssociationProposalRequest . getAssociatedGatewayOwnerAccount ( ) , ASSOCIATEDGATEWAYOWNERACCOUNT_BINDING ) ; protocolMarshaller . marshall ( acceptDirectConnectGatewayAssociationProposalRequest . getOverrideAllowedPrefixesToDirectConnectGateway ( ) , OVERRIDEALLOWEDPREFIXESTODIRECTCONNECTGATEWAY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class PoolablePreparedStatement { /** * Method setRef .
* @ param parameterIndex
* @ param x
* @ throws SQLException
* @ see java . sql . PreparedStatement # setRef ( int , Ref ) */
@ Override public void setRef ( int parameterIndex , Ref x ) throws SQLException { } } | internalStmt . setRef ( parameterIndex , x ) ; |
public class Utils { /** * Gets the actual type arguments that are used in a given implementation of a given generic base class or interface .
* ( Based on code copyright 2007 by Ian Robertson ) .
* @ param base the generic base class or interface
* @ param implementation the type ( potentially ) implementing the given base class or interface
* @ return a list of the raw classes for the actual type arguments . */
public static List < Class < ? > > getTypeArguments ( Class < ? > base , Class < ? > implementation ) { } } | checkArgNotNull ( base , "base" ) ; checkArgNotNull ( implementation , "implementation" ) ; Map < Type , Type > resolvedTypes = new HashMap < Type , Type > ( ) ; // first we need to resolve all supertypes up to the required base class or interface
// and find the right Type for it
Type type ; Queue < Type > toCheck = new LinkedList < Type > ( ) ; toCheck . add ( implementation ) ; while ( true ) { // if we have checked everything and not found the base class we return an empty list
if ( toCheck . isEmpty ( ) ) return ImmutableList . of ( ) ; type = toCheck . remove ( ) ; Class < ? > clazz ; if ( type instanceof Class ) { // there is no useful information for us in raw types , so just keep going up the inheritance chain
clazz = ( Class ) type ; if ( base . isInterface ( ) ) { // if we are actually looking for the type parameters to an interface we also need to
// look at all the ones implemented by the given current one
toCheck . addAll ( Arrays . asList ( clazz . getGenericInterfaces ( ) ) ) ; } } else if ( type instanceof ParameterizedType ) { ParameterizedType parameterizedType = ( ParameterizedType ) type ; clazz = ( Class ) parameterizedType . getRawType ( ) ; // for instances of ParameterizedType we extract and remember all type arguments
TypeVariable < ? > [ ] typeParameters = clazz . getTypeParameters ( ) ; Type [ ] actualTypeArguments = parameterizedType . getActualTypeArguments ( ) ; for ( int i = 0 ; i < actualTypeArguments . length ; i ++ ) { resolvedTypes . put ( typeParameters [ i ] , actualTypeArguments [ i ] ) ; } } else { return ImmutableList . of ( ) ; } // we can stop if we have reached the sought for base type
if ( base . equals ( getClass ( type ) ) ) break ; toCheck . add ( clazz . getGenericSuperclass ( ) ) ; } // finally , for each actual type argument provided to baseClass ,
// determine ( if possible ) the raw class for that type argument .
Type [ ] actualTypeArguments ; if ( type instanceof Class ) { actualTypeArguments = ( ( Class ) type ) . getTypeParameters ( ) ; } else { actualTypeArguments = ( ( ParameterizedType ) type ) . getActualTypeArguments ( ) ; } List < Class < ? > > typeArgumentsAsClasses = new ArrayList < Class < ? > > ( ) ; // resolve types by chasing down type variables .
for ( Type baseType : actualTypeArguments ) { while ( resolvedTypes . containsKey ( baseType ) ) { baseType = resolvedTypes . get ( baseType ) ; } typeArgumentsAsClasses . add ( getClass ( baseType ) ) ; } return typeArgumentsAsClasses ; |
public class DBUtils { /** * 本函数所查找的结果只能返回一条记录 , 若查找到的多条记录符合要求将返回第一条符合要求的记录
* @ param sql 传入的SQL 语句
* @ param arg 占位符参数
* @ return 将查找到的的记录包装成一个Map对象 , 并返回该Map , 若没有记录则返回null */
public static Map < String , Object > getMap ( String sql , Object ... arg ) { } } | List < Map < String , Object > > list = DBUtils . getListMap ( sql , arg ) ; if ( list . isEmpty ( ) ) { return null ; } return list . get ( 0 ) ; |
public class AttributeProvider { /** * if the the FAV is actually a BasicFileAttributeView then there is an isLink method
* if this is not already set and FAV implements LinkInfoSettable use it to add this link info */
@ SuppressWarnings ( "PMD.CollapsibleIfStatements" ) private < V extends FileAttributeView > V addIsLinkIfPossible ( Class < V > type , V fav ) { } } | if ( BasicFileAttributeView . class . isAssignableFrom ( type ) ) { if ( ( ! v ( ( ) -> BasicFileAttributeView . class . cast ( fav ) . readAttributes ( ) ) . isSymbolicLink ( ) ) ) { if ( ! ( fav instanceof LinkInfoSettable ) ) { throw new UnsupportedOperationException ( "the attribute view need to implement LinkInfoSettable in order to make SymLinks work" ) ; } ( ( LinkInfoSettable ) ( fav ) ) . setLink ( ) ; } } return fav ; |
public class Evaluation { /** * Get a String representation of the confusion matrix */
public String confusionToString ( ) { } } | int nClasses = confusion ( ) . getClasses ( ) . size ( ) ; // First : work out the longest label size
int maxLabelSize = 0 ; for ( String s : labelsList ) { maxLabelSize = Math . max ( maxLabelSize , s . length ( ) ) ; } // Build the formatting for the rows :
int labelSize = Math . max ( maxLabelSize + 5 , 10 ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( "%-3d" ) ; sb . append ( "%-" ) ; sb . append ( labelSize ) ; sb . append ( "s | " ) ; StringBuilder headerFormat = new StringBuilder ( ) ; headerFormat . append ( " %-" ) . append ( labelSize ) . append ( "s " ) ; for ( int i = 0 ; i < nClasses ; i ++ ) { sb . append ( "%7d" ) ; headerFormat . append ( "%7d" ) ; } String rowFormat = sb . toString ( ) ; StringBuilder out = new StringBuilder ( ) ; // First : header row
Object [ ] headerArgs = new Object [ nClasses + 1 ] ; headerArgs [ 0 ] = "Predicted:" ; for ( int i = 0 ; i < nClasses ; i ++ ) headerArgs [ i + 1 ] = i ; out . append ( String . format ( headerFormat . toString ( ) , headerArgs ) ) . append ( "\n" ) ; // Second : divider rows
out . append ( " Actual:\n" ) ; // Finally : data rows
for ( int i = 0 ; i < nClasses ; i ++ ) { Object [ ] args = new Object [ nClasses + 2 ] ; args [ 0 ] = i ; args [ 1 ] = labelsList . get ( i ) ; for ( int j = 0 ; j < nClasses ; j ++ ) { args [ j + 2 ] = confusion ( ) . getCount ( i , j ) ; } out . append ( String . format ( rowFormat , args ) ) ; out . append ( "\n" ) ; } return out . toString ( ) ; |
public class ItemsUnion { /** * Create an instance of ItemsUnion based on ItemsSketch
* @ param < T > type of item
* @ param sketch the basis of the union
* @ return an instance of ItemsUnion */
public static < T > ItemsUnion < T > getInstance ( final ItemsSketch < T > sketch ) { } } | return new ItemsUnion < > ( sketch . getK ( ) , sketch . getComparator ( ) , ItemsSketch . copy ( sketch ) ) ; |
public class Manager { /** * This method is invoked by iPojo every time a new target handler appears .
* @ param targetItf the appearing target handler */
public void targetAppears ( TargetHandler targetItf ) { } } | this . defaultTargetHandlerResolver . addTargetHandler ( targetItf ) ; // When a target is deployed , we may also have to update instance states .
// Consider as an example when the DM restarts . Targets may be injected
// before and after the pojo was started by iPojo .
// See # 519 for more details .
// Notice we restore instances only when the DM was started ( the messaging
// must be ready ) . If it is not started , do nothing . The " start " method
// will trigger the restoration .
// We consider the DM is started if the timer is not null .
if ( this . timer != null ) restoreInstancesFrom ( targetItf ) ; |
public class CommerceOrderItemPersistenceImpl { /** * Returns the first commerce order item in the ordered set where commerceOrderId = & # 63 ; and CPInstanceId = & # 63 ; .
* @ param commerceOrderId the commerce order ID
* @ param CPInstanceId the cp instance ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce order item , or < code > null < / code > if a matching commerce order item could not be found */
@ Override public CommerceOrderItem fetchByC_I_First ( long commerceOrderId , long CPInstanceId , OrderByComparator < CommerceOrderItem > orderByComparator ) { } } | List < CommerceOrderItem > list = findByC_I ( commerceOrderId , CPInstanceId , 0 , 1 , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ; |
public class AMPManager { /** * Check if server supports specified action .
* @ param connection active xmpp connection
* @ param action action to check
* @ return true if this action is supported .
* @ throws XMPPErrorException
* @ throws NoResponseException
* @ throws NotConnectedException
* @ throws InterruptedException */
public static boolean isActionSupported ( XMPPConnection connection , AMPExtension . Action action ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } } | String featureName = AMPExtension . NAMESPACE + "?action=" + action . toString ( ) ; return isFeatureSupportedByServer ( connection , featureName ) ; |
public class CommandFactory { /** * This command accelerates the player in the direction of its body .
* @ param power Power is between minpower ( - 100 ) and maxpower ( + 100 ) . */
public void addDashCommand ( int power ) { } } | StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(dash " ) ; buf . append ( power ) ; buf . append ( ')' ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; |
public class RDBMUserLayoutStore { /** * Save the user layout . */
@ Override public void setUserLayout ( final IPerson person , final IUserProfile profile , final Document layoutXML , final boolean channelsAdded ) { } } | final long startTime = System . currentTimeMillis ( ) ; final int userId = person . getID ( ) ; final int profileId = profile . getProfileId ( ) ; // don ' t try to save null layouts .
if ( layoutXML == null ) { logger . error ( "Invalid attempt to save NULL user layout for user " + person . getUserName ( ) + ". Skipping!" ) ; return ; } transactionOperations . execute ( status -> jdbcOperations . execute ( ( ConnectionCallback < Object > ) con -> { int layoutId ; ResultSet rs ; // Eventually we want to be able to just get layoutId
// from
// the
// profile , but because of the template user layouts we
// have
// to do this for now . . .
layoutId = getLayoutID ( userId , profileId ) ; boolean firstLayout = false ; if ( layoutId == 0 ) { // First personal layout for this user / profile
layoutId = 1 ; firstLayout = true ; } String sql = "DELETE FROM UP_LAYOUT_PARAM WHERE USER_ID=? AND LAYOUT_ID=?" ; PreparedStatement pstmt = con . prepareStatement ( sql ) ; try { pstmt . clearParameters ( ) ; pstmt . setInt ( 1 , userId ) ; pstmt . setInt ( 2 , layoutId ) ; logger . debug ( sql ) ; pstmt . executeUpdate ( ) ; } finally { pstmt . close ( ) ; } sql = "DELETE FROM UP_LAYOUT_STRUCT WHERE USER_ID=? AND LAYOUT_ID=?" ; pstmt = con . prepareStatement ( sql ) ; try { pstmt . clearParameters ( ) ; pstmt . setInt ( 1 , userId ) ; pstmt . setInt ( 2 , layoutId ) ; logger . debug ( sql ) ; pstmt . executeUpdate ( ) ; } finally { pstmt . close ( ) ; } int firstStructId ; try ( PreparedStatement structStmt = con . prepareStatement ( "INSERT INTO UP_LAYOUT_STRUCT " + "(USER_ID, LAYOUT_ID, STRUCT_ID, NEXT_STRUCT_ID, CHLD_STRUCT_ID,EXTERNAL_ID,CHAN_ID,NAME,TYPE,HIDDEN,IMMUTABLE,UNREMOVABLE) " + "VALUES (" + userId + "," + layoutId + ",?,?,?,?,?,?,?,?,?,?)" ) ; PreparedStatement parmStmt = con . prepareStatement ( "INSERT INTO UP_LAYOUT_PARAM " + "(USER_ID, LAYOUT_ID, STRUCT_ID, STRUCT_PARM_NM, STRUCT_PARM_VAL) " + "VALUES (" + userId + "," + layoutId + ",?,?,?)" ) ) { firstStructId = saveStructure ( layoutXML . getFirstChild ( ) . getFirstChild ( ) , structStmt , parmStmt ) ; } // Check to see if the user has a matching layout
sql = "SELECT * FROM UP_USER_LAYOUT WHERE USER_ID=? AND LAYOUT_ID=?" ; pstmt = con . prepareStatement ( sql ) ; try { pstmt . clearParameters ( ) ; pstmt . setInt ( 1 , userId ) ; pstmt . setInt ( 2 , layoutId ) ; logger . debug ( sql ) ; rs = pstmt . executeQuery ( ) ; try { if ( ! rs . next ( ) ) { /* * In ancient times , uPortal had a notion of
* a " template user , " and here we used to
* set up profiles based on the emplate
* user . Now we use the ' system ' user . */
final int defaultUserId = getSystemUser ( ) . getID ( ) ; // Add to UP _ USER _ LAYOUT
sql = "SELECT USER_ID,LAYOUT_ID,LAYOUT_TITLE,INIT_STRUCT_ID FROM UP_USER_LAYOUT WHERE USER_ID=?" ; try ( PreparedStatement pstmt2 = con . prepareStatement ( sql ) ) { pstmt2 . clearParameters ( ) ; pstmt2 . setInt ( 1 , defaultUserId ) ; logger . debug ( sql ) ; try ( ResultSet rs2 = pstmt2 . executeQuery ( ) ) { if ( rs2 . next ( ) ) { // There is a row for this
// user ' s
// template user . . .
sql = "INSERT INTO UP_USER_LAYOUT (USER_ID, LAYOUT_ID, LAYOUT_TITLE, INIT_STRUCT_ID) VALUES (?,?,?,?)" ; try ( PreparedStatement pstmt3 = con . prepareStatement ( sql ) ) { pstmt3 . clearParameters ( ) ; pstmt3 . setInt ( 1 , userId ) ; pstmt3 . setInt ( 2 , rs2 . getInt ( "LAYOUT_ID" ) ) ; pstmt3 . setString ( 3 , rs2 . getString ( "LAYOUT_TITLE" ) ) ; pstmt3 . setInt ( 4 , rs2 . getInt ( "INIT_STRUCT_ID" ) ) ; logger . debug ( sql ) ; pstmt3 . executeUpdate ( ) ; } } else { // We can ' t rely on the template
// user , but we still need a
// row . . .
sql = "INSERT INTO UP_USER_LAYOUT (USER_ID, LAYOUT_ID, LAYOUT_TITLE, INIT_STRUCT_ID) VALUES (?,?,?,?)" ; try ( PreparedStatement pstmt3 = con . prepareStatement ( sql ) ) { pstmt3 . clearParameters ( ) ; pstmt3 . setInt ( 1 , userId ) ; pstmt3 . setInt ( 2 , layoutId ) ; pstmt3 . setString ( 3 , "default layout" ) ; pstmt3 . setInt ( 4 , 1 ) ; logger . debug ( sql ) ; pstmt3 . executeUpdate ( ) ; } } } } } } finally { rs . close ( ) ; } } finally { pstmt . close ( ) ; } // Update the users layout with the correct inital
// structure
// ID
sql = "UPDATE UP_USER_LAYOUT SET INIT_STRUCT_ID=? WHERE USER_ID=? AND LAYOUT_ID=?" ; pstmt = con . prepareStatement ( sql ) ; try { pstmt . clearParameters ( ) ; pstmt . setInt ( 1 , firstStructId ) ; pstmt . setInt ( 2 , userId ) ; pstmt . setInt ( 3 , layoutId ) ; logger . debug ( sql ) ; pstmt . executeUpdate ( ) ; } finally { pstmt . close ( ) ; } // Update the last time the user saw the list of
// available
// channels
if ( channelsAdded ) { sql = "UPDATE UP_USER SET LST_CHAN_UPDT_DT=? WHERE USER_ID=?" ; pstmt = con . prepareStatement ( sql ) ; try { pstmt . clearParameters ( ) ; pstmt . setDate ( 1 , new Date ( System . currentTimeMillis ( ) ) ) ; pstmt . setInt ( 2 , userId ) ; logger . debug ( sql ) ; pstmt . executeUpdate ( ) ; } finally { pstmt . close ( ) ; } } if ( firstLayout ) { sql = "UPDATE UP_USER_PROFILE SET LAYOUT_ID=1 WHERE USER_ID=? AND PROFILE_ID=?" ; pstmt = con . prepareStatement ( sql ) ; try { pstmt . clearParameters ( ) ; pstmt . setInt ( 1 , userId ) ; pstmt . setInt ( 2 , profileId ) ; logger . debug ( sql ) ; pstmt . executeUpdate ( ) ; } finally { pstmt . close ( ) ; } } return null ; } ) ) ; if ( logger . isDebugEnabled ( ) ) { long stopTime = System . currentTimeMillis ( ) ; long timeTook = stopTime - startTime ; logger . debug ( "setUserLayout(): Layout document for user {} took {} milliseconds to save" , userId , timeTook ) ; } |
public class JSONObject { /** * get int value .
* @ param key key .
* @ param def default value .
* @ return value or default value . */
public int getInt ( String key , int def ) { } } | Object tmp = objectMap . get ( key ) ; return tmp != null && tmp instanceof Number ? ( ( Number ) tmp ) . intValue ( ) : def ; |
public class JScoreElementAbstract { /** * For debugging purpose , draw the outer of bounding box of
* the element */
protected void renderDebugBoundingBoxOuter ( Graphics2D context ) { } } | java . awt . Color previousColor = context . getColor ( ) ; context . setColor ( java . awt . Color . RED ) ; Rectangle2D bb = getBoundingBox ( ) ; bb . setRect ( bb . getX ( ) - 1 , bb . getY ( ) - 1 , bb . getWidth ( ) + 2 , bb . getHeight ( ) + 2 ) ; context . draw ( bb ) ; context . setColor ( previousColor ) ; |
public class XMLResultsParser { /** * Parses the input stream as either XML select or ask results . */
@ Override public Result parse ( Command cmd , InputStream input , ResultType type ) { } } | return parseResults ( cmd , input , type ) ; |
public class DefaultMethodCall { /** * Creates a { @ link net . bytebuddy . implementation . DefaultMethodCall } implementation which searches the given list
* of interface types for a suitable default method in their order . If no such prioritized interface is suitable ,
* because it is either not defined on the instrumented type or because it does not define a suitable default method ,
* any remaining interface is searched for a suitable default method . If no or more than one method defines a
* suitable default method , an exception is thrown .
* @ param prioritizedInterfaces A list of prioritized default method interfaces in their prioritization order .
* @ return An implementation which calls an instrumented method ' s compatible default method that considers the given
* interfaces to be prioritized in their order . */
public static Implementation prioritize ( Iterable < ? extends Class < ? > > prioritizedInterfaces ) { } } | List < Class < ? > > list = new ArrayList < Class < ? > > ( ) ; for ( Class < ? > prioritizedInterface : prioritizedInterfaces ) { list . add ( prioritizedInterface ) ; } return prioritize ( new TypeList . ForLoadedTypes ( list ) ) ; |
public class BinaryNode { /** * { @ inheritDoc } */
public Node replaceNode ( int index , Node newNode ) { } } | if ( index == 0 ) { return newNode ; } int leftNodes = left . countNodes ( ) ; if ( index <= leftNodes ) { return newInstance ( left . replaceNode ( index - 1 , newNode ) , right ) ; } else { return newInstance ( left , right . replaceNode ( index - leftNodes - 1 , newNode ) ) ; } |
public class SSLConfig { /** * This method tries to normalize the ConfigURL value in an attempt to
* correct any URL parsing errors .
* @ param propertiesURL
* @ return String */
public static String validateURL ( final String propertiesURL ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Existing propertiesURL: " + propertiesURL ) ; int end = 0 ; // get rid of all of the / or \ after file : and replace with just /
char c ; for ( int i = propertiesURL . indexOf ( ':' , 0 ) + 1 ; i < propertiesURL . length ( ) ; i ++ ) { c = propertiesURL . charAt ( i ) ; if ( c != '/' && c != '\\' ) { end = i ; break ; } } String rc = "file:/" + propertiesURL . substring ( end ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "New propertiesURL: " + rc ) ; return rc ; |
public class VoltCompiler { /** * Key prefix includes attributes that make a cached statement usable if they match
* For example , if the SQL is the same , but the partitioning isn ' t , then the statements
* aren ' t actually interchangeable . */
String getKeyPrefix ( StatementPartitioning partitioning , DeterminismMode detMode , String joinOrder ) { } } | // no caching for inferred yet
if ( partitioning . isInferred ( ) ) { return null ; } String joinOrderPrefix = "#" ; if ( joinOrder != null ) { joinOrderPrefix += joinOrder ; } boolean partitioned = partitioning . wasSpecifiedAsSingle ( ) ; return joinOrderPrefix + String . valueOf ( detMode . toChar ( ) ) + ( partitioned ? "P#" : "R#" ) ; |
public class PendingCloudwatchLogsExports { /** * Log types that are in the process of being enabled . After they are enabled , these log types are exported to
* Amazon CloudWatch Logs .
* @ param logTypesToDisable
* Log types that are in the process of being enabled . After they are enabled , these log types are exported
* to Amazon CloudWatch Logs . */
public void setLogTypesToDisable ( java . util . Collection < String > logTypesToDisable ) { } } | if ( logTypesToDisable == null ) { this . logTypesToDisable = null ; return ; } this . logTypesToDisable = new java . util . ArrayList < String > ( logTypesToDisable ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.