signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AbstractRedisStorage { /** * Retrieve a job from redis
* @ param jobKey the job key detailing the identity of the job to be retrieved
* @ param jedis a thread - safe Redis connection
* @ return the { @ link org . quartz . JobDetail } of the desired job
* @ throws JobPersistenceException if the desired job does not exist
* @ throws ClassNotFoundException */
public JobDetail retrieveJob ( JobKey jobKey , T jedis ) throws JobPersistenceException , ClassNotFoundException { } } | final String jobHashKey = redisSchema . jobHashKey ( jobKey ) ; final String jobDataMapHashKey = redisSchema . jobDataMapHashKey ( jobKey ) ; final Map < String , String > jobDetailMap = jedis . hgetAll ( jobHashKey ) ; if ( jobDetailMap == null || jobDetailMap . size ( ) == 0 ) { // desired job does not exist
return null ; } JobDetailImpl jobDetail = mapper . convertValue ( jobDetailMap , JobDetailImpl . class ) ; jobDetail . setKey ( jobKey ) ; final Map < String , String > jobData = jedis . hgetAll ( jobDataMapHashKey ) ; if ( jobData != null && ! jobData . isEmpty ( ) ) { JobDataMap jobDataMap = new JobDataMap ( ) ; jobDataMap . putAll ( jobData ) ; jobDetail . setJobDataMap ( jobDataMap ) ; } return jobDetail ; |
public class CmsXmlContent { /** * Adds a new XML content value for the given element name and locale at the given index position
* to this XML content document . < p >
* @ param cms the current users OpenCms context
* @ param path the path to the XML content value element
* @ param locale the locale where to add the new value
* @ param index the index where to add the value ( relative to all other values of this type )
* @ return the created XML content value
* @ throws CmsIllegalArgumentException if the given path is invalid
* @ throws CmsRuntimeException if the element identified by the path already occurred { @ link I _ CmsXmlSchemaType # getMaxOccurs ( ) }
* or the given < code > index < / code > is invalid ( too high ) . */
public I_CmsXmlContentValue addValue ( CmsObject cms , String path , Locale locale , int index ) throws CmsIllegalArgumentException , CmsRuntimeException { } } | // get the schema type of the requested path
I_CmsXmlSchemaType type = m_contentDefinition . getSchemaType ( path ) ; if ( type == null ) { throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . ERR_XMLCONTENT_UNKNOWN_ELEM_PATH_SCHEMA_1 , path ) ) ; } Element parentElement ; String elementName ; CmsXmlContentDefinition contentDefinition ; if ( CmsXmlUtils . isDeepXpath ( path ) ) { // this is a nested content definition , so the parent element must be in the bookmarks
String parentPath = CmsXmlUtils . createXpath ( CmsXmlUtils . removeLastXpathElement ( path ) , 1 ) ; Object o = getBookmark ( parentPath , locale ) ; if ( o == null ) { throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . ERR_XMLCONTENT_UNKNOWN_ELEM_PATH_1 , path ) ) ; } CmsXmlNestedContentDefinition parentValue = ( CmsXmlNestedContentDefinition ) o ; parentElement = parentValue . getElement ( ) ; elementName = CmsXmlUtils . getLastXpathElement ( path ) ; contentDefinition = parentValue . getNestedContentDefinition ( ) ; } else { // the parent element is the locale element
parentElement = getLocaleNode ( locale ) ; elementName = CmsXmlUtils . removeXpathIndex ( path ) ; contentDefinition = m_contentDefinition ; } int insertIndex ; if ( contentDefinition . getChoiceMaxOccurs ( ) > 0 ) { // for a choice sequence with maxOccurs we do not check the index position , we rather check if maxOccurs has already been hit
// additionally we ensure that the insert index is not too big
List < ? > choiceSiblings = parentElement . content ( ) ; int numSiblings = choiceSiblings != null ? choiceSiblings . size ( ) : 0 ; if ( ( numSiblings >= contentDefinition . getChoiceMaxOccurs ( ) ) || ( index > numSiblings ) ) { throw new CmsRuntimeException ( Messages . get ( ) . container ( Messages . ERR_XMLCONTENT_ADD_ELEM_INVALID_IDX_CHOICE_3 , new Integer ( index ) , elementName , parentElement . getUniquePath ( ) ) ) ; } insertIndex = index ; } else { // read the XML siblings from the parent node
List < Element > siblings = CmsXmlGenericWrapper . elements ( parentElement , elementName ) ; if ( siblings . size ( ) > 0 ) { // we want to add an element to a sequence , and there are elements already of the same type
if ( siblings . size ( ) >= type . getMaxOccurs ( ) ) { // must not allow adding an element if max occurs would be violated
throw new CmsRuntimeException ( Messages . get ( ) . container ( Messages . ERR_XMLCONTENT_ELEM_MAXOCCURS_2 , elementName , new Integer ( type . getMaxOccurs ( ) ) ) ) ; } if ( index > siblings . size ( ) ) { // index position behind last element of the list
throw new CmsRuntimeException ( Messages . get ( ) . container ( Messages . ERR_XMLCONTENT_ADD_ELEM_INVALID_IDX_3 , new Integer ( index ) , new Integer ( siblings . size ( ) ) ) ) ; } // check for offset required to append beyond last position
int offset = ( index == siblings . size ( ) ) ? 1 : 0 ; // get the element from the parent at the selected position
Element sibling = siblings . get ( index - offset ) ; // check position of the node in the parent node content
insertIndex = sibling . getParent ( ) . content ( ) . indexOf ( sibling ) + offset ; } else { // we want to add an element to a sequence , but there are no elements of the same type yet
if ( index > 0 ) { // since the element does not occur , index must be 0
throw new CmsRuntimeException ( Messages . get ( ) . container ( Messages . ERR_XMLCONTENT_ADD_ELEM_INVALID_IDX_2 , new Integer ( index ) , elementName ) ) ; } // check where in the type sequence the type should appear
int typeIndex = contentDefinition . getTypeSequence ( ) . indexOf ( type ) ; if ( typeIndex == 0 ) { // this is the first type , so we just add at the very first position
insertIndex = 0 ; } else { // create a list of all element names that should occur before the selected type
List < String > previousTypeNames = new ArrayList < String > ( ) ; for ( int i = 0 ; i < typeIndex ; i ++ ) { I_CmsXmlSchemaType t = contentDefinition . getTypeSequence ( ) . get ( i ) ; previousTypeNames . add ( t . getName ( ) ) ; } // iterate all elements of the parent node
Iterator < Node > i = CmsXmlGenericWrapper . content ( parentElement ) . iterator ( ) ; int pos = 0 ; while ( i . hasNext ( ) ) { Node node = i . next ( ) ; if ( node instanceof Element ) { if ( ! previousTypeNames . contains ( node . getName ( ) ) ) { // the element name is NOT in the list of names that occurs before the selected type ,
// so it must be an element that occurs AFTER the type
break ; } } pos ++ ; } insertIndex = pos ; } } } // just append the new element at the calculated position
I_CmsXmlContentValue newValue = addValue ( cms , parentElement , type , locale , insertIndex ) ; // re - initialize this XML content
initDocument ( m_document , m_encoding , m_contentDefinition ) ; // return the value instance that was stored in the bookmarks
// just returning " newValue " isn ' t enough since this instance is NOT stored in the bookmarks
return getBookmark ( getBookmarkName ( newValue . getPath ( ) , locale ) ) ; |
public class CPInstancePersistenceImpl { /** * Returns the first cp instance in the ordered set where groupId = & # 63 ; and status & ne ; & # 63 ; .
* @ param groupId the group ID
* @ param status the status
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching cp instance , or < code > null < / code > if a matching cp instance could not be found */
@ Override public CPInstance fetchByG_NotST_First ( long groupId , int status , OrderByComparator < CPInstance > orderByComparator ) { } } | List < CPInstance > list = findByG_NotST ( groupId , status , 0 , 1 , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ; |
public class MethodUtils { /** * Get the { @ link TypeVariable } instance for the specified { @ link Type } .
* If the type is not a { @ link TypeVariable } , then < code > null < / code > is
* returned . If the type is a { @ link GenericArrayType } , its root type is
* looked up and then checked .
* @ param type The associated type
* @ return The type variable instance or < code > null < / code > */
private static TypeVariable < ? > getTypeVariable ( Type type ) { } } | // find root type if generic array
while ( type instanceof GenericArrayType ) { type = ( ( GenericArrayType ) type ) . getGenericComponentType ( ) ; } // return type variable if valid
if ( type instanceof TypeVariable ) { return ( TypeVariable < ? > ) type ; } // non - type variable , return null
return null ; |
public class MapperFactoryBean { /** * 函数参数信息
* @ param args 参数列表
* @ return 格式化输出 */
protected String getParameters ( Object [ ] args ) { } } | if ( args == null ) return "" ; StringBuilder sbd = new StringBuilder ( ) ; if ( args . length > 0 ) { for ( Object i : args ) { if ( i == null ) { sbd . append ( "null" ) ; } else { Class clz = i . getClass ( ) ; if ( isPrimitive ( clz ) ) { sbd . append ( evalPrimitive ( i ) ) ; } else if ( clz . isArray ( ) ) { evalArray ( i , sbd ) ; } else if ( Collection . class . isAssignableFrom ( clz ) ) { Object [ ] arr = ( ( Collection < ? > ) i ) . toArray ( ) ; evalArray ( arr , sbd ) ; } else if ( i instanceof Date ) { sbd . append ( '"' ) . append ( formatYmdHis ( ( ( Date ) i ) ) ) . append ( '"' ) ; } else if ( i instanceof IdEntity ) { sbd . append ( i . getClass ( ) . getSimpleName ( ) ) . append ( "[id=" ) . append ( ( ( IdEntity ) i ) . getId ( ) ) . append ( ']' ) ; } else { sbd . append ( clz . getSimpleName ( ) ) . append ( ":OBJ" ) ; } } sbd . append ( ',' ) ; } sbd . setLength ( sbd . length ( ) - 1 ) ; } return sbd . toString ( ) ; |
public class CommerceShipmentLocalServiceUtil { /** * Returns a range of all the commerce shipments .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link com . liferay . commerce . model . impl . CommerceShipmentModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param start the lower bound of the range of commerce shipments
* @ param end the upper bound of the range of commerce shipments ( not inclusive )
* @ return the range of commerce shipments */
public static java . util . List < com . liferay . commerce . model . CommerceShipment > getCommerceShipments ( int start , int end ) { } } | return getService ( ) . getCommerceShipments ( start , end ) ; |
public class GridFTPServerFacade { /** * Store the data from the data channel to the data sink .
* Does not block .
* If operation fails , exception might be thrown via local control channel .
* @ param sink source of data */
public void store ( DataSink sink ) { } } | try { localControlChannel . resetReplyCount ( ) ; if ( session . transferMode != GridFTPSession . MODE_EBLOCK ) { // no EBLOCK
EBlockParallelTransferContext context = ( EBlockParallelTransferContext ) createTransferContext ( ) ; context . setEodsTotal ( 0 ) ; if ( session . serverMode == Session . SERVER_PASSIVE ) { transferThreadManager . passiveConnect ( sink , context , 1 , serverSocket ) ; } else { // 1 non reusable connection
transferThreadManager . startTransfer ( sink , context , 1 , ManagedSocketBox . NON_REUSABLE ) ; } } else if ( session . serverMode != GridFTPSession . SERVER_EPAS && session . serverMode != GridFTPSession . SERVER_PASSIVE ) { // EBLOCK , local server not passive
exceptionToControlChannel ( new DataChannelException ( DataChannelException . BAD_SERVER_MODE ) , "refusing to store with active mode" ) ; } else { // EBLOCK , local server passive
// data channels will
// share this transfer context
EBlockParallelTransferContext context = ( EBlockParallelTransferContext ) createTransferContext ( ) ; // we are the passive side , so we don ' t really get to decide
// how many connections will be used
int willReuseConnections = socketPool . countFree ( ) ; int needNewConnections = 0 ; if ( gSession . parallel > willReuseConnections ) { needNewConnections = gSession . parallel - willReuseConnections ; } logger . debug ( "will reuse " + willReuseConnections + " connections and start " + needNewConnections + " new ones." ) ; transferThreadManager . startTransfer ( sink , context , willReuseConnections , ManagedSocketBox . REUSABLE ) ; if ( needNewConnections > 0 ) { transferThreadManager . passiveConnect ( sink , context , needNewConnections , serverSocket ) ; } } } catch ( Exception e ) { exceptionToControlChannel ( e , "ocurred during store()" ) ; } |
public class AbstractMaterialDialogBuilder { /** * Obtains the background from a specific theme .
* @ param themeResourceId
* The resource id of the theme , the background should be obtained from , as an { @ link
* Integer } value */
private void obtainBackground ( @ StyleRes final int themeResourceId ) { } } | TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogBackground } ) ; int resourceId = typedArray . getResourceId ( 0 , 0 ) ; if ( resourceId != 0 ) { setBackground ( resourceId ) ; } else { setBackgroundColor ( ContextCompat . getColor ( getContext ( ) , R . color . dialog_background_light ) ) ; } |
public class AppsManagerImpl { /** * / * ( non - Javadoc )
* @ see com . github . chrisprice . phonegapbuild . api . managers . AppsManager # getApps ( com . sun . jersey . api . client . WebResource , com . github . chrisprice . phonegapbuild . api . data . ResourcePath ) */
@ Override public AppsResponse getApps ( WebResource resource , ResourcePath < Apps > appsResponsePath ) { } } | return resource . path ( appsResponsePath . getPath ( ) ) . get ( AppsResponse . class ) ; |
public class DraeneiSearchService { /** * { @ inheritDoc } */
@ Override public void addDocument ( @ NotNull Document document ) { } } | if ( documentsCache != null && rankingAlgorithm != null && documentIndexCache != null ) { Set < FacetRank > facetRanks = rankingAlgorithm . calculate ( buildFacets ( document ) ) ; documentsCache . put ( document . getId ( ) , document ) ; documentIndexCache . put ( document . getId ( ) , new DocumentIndex ( document , facetRanks ) ) ; } |
public class ConnectionMonitorsInner { /** * Create or update a connection monitor .
* @ param resourceGroupName The name of the resource group containing Network Watcher .
* @ param networkWatcherName The name of the Network Watcher resource .
* @ param connectionMonitorName The name of the connection monitor .
* @ param parameters Parameters that define the operation to create a connection monitor .
* @ 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 < ConnectionMonitorResultInner > createOrUpdateAsync ( String resourceGroupName , String networkWatcherName , String connectionMonitorName , ConnectionMonitorInner parameters , final ServiceCallback < ConnectionMonitorResultInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( createOrUpdateWithServiceResponseAsync ( resourceGroupName , networkWatcherName , connectionMonitorName , parameters ) , serviceCallback ) ; |
public class CmsFlexCacheKey { /** * A helper method for the parsing process which parses
* Strings like groups = ( a , b , c ) . < p >
* @ param value the String to parse
* @ return a Map that contains of the parsed values , only the keyset of the Map is needed later */
private Set < String > parseValueList ( String value ) { } } | if ( value . charAt ( 0 ) == '(' ) { value = value . substring ( 1 ) ; } int len = value . length ( ) - 1 ; if ( value . charAt ( len ) == ')' ) { value = value . substring ( 0 , len ) ; } if ( value . charAt ( len - 1 ) == ',' ) { value = value . substring ( 0 , len - 1 ) ; } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_FLEXCACHEKEY_PARSE_VALUES_1 , value ) ) ; } List < String > tokens = CmsStringUtil . splitAsList ( value , ',' , true ) ; Set < String > result = new HashSet < String > ( ) ; result . addAll ( tokens ) ; return result ; |
public class Publishers { /** * Attempts to convert the publisher to the given type .
* @ param object The object to convert
* @ param publisherType The publisher type
* @ param < T > The generic type
* @ return The Resulting in publisher */
public static < T > T convertPublisher ( Object object , Class < T > publisherType ) { } } | Objects . requireNonNull ( object , "Invalid argument [object]: " + object ) ; Objects . requireNonNull ( object , "Invalid argument [publisherType]: " + publisherType ) ; if ( object instanceof CompletableFuture ) { @ SuppressWarnings ( "unchecked" ) Publisher < T > futurePublisher = ( Publisher < T > ) Publishers . fromCompletableFuture ( ( ) -> ( ( CompletableFuture ) object ) ) ; return ConversionService . SHARED . convert ( futurePublisher , publisherType ) . orElseThrow ( ( ) -> new IllegalArgumentException ( "Unsupported Reactive type: " + object . getClass ( ) ) ) ; } else { return ConversionService . SHARED . convert ( object , publisherType ) . orElseThrow ( ( ) -> new IllegalArgumentException ( "Unsupported Reactive type: " + object . getClass ( ) ) ) ; } |
public class Ledgers { /** * Reliably retrieves the LastAddConfirmed for the Ledger with given LedgerId , by opening the Ledger in fencing mode
* and getting the value . NOTE : this open - fences the Ledger which will effectively stop any writing action on it .
* @ param ledgerId The Id of the Ledger to query .
* @ param bookKeeper A references to the BookKeeper client to use .
* @ param config Configuration to use .
* @ return The LastAddConfirmed for the given LedgerId .
* @ throws DurableDataLogException If an exception occurred . The causing exception is wrapped inside it . */
static long readLastAddConfirmed ( long ledgerId , BookKeeper bookKeeper , BookKeeperConfig config ) throws DurableDataLogException { } } | LedgerHandle h = null ; try { // Here we open the Ledger WITH recovery , to force BookKeeper to reconcile any appends that may have been
// interrupted and not properly acked . Otherwise there is no guarantee we can get an accurate value for
// LastAddConfirmed .
h = openFence ( ledgerId , bookKeeper , config ) ; return h . getLastAddConfirmed ( ) ; } finally { if ( h != null ) { close ( h ) ; } } |
public class JSONHelpers { /** * Return the value mapped by enum if it exists and is a { @ link JSONObject } by mapping " x " and
* " y " members into a { @ link PointF } . The values in { @ code fallback } are used if either field
* is missing ; if { @ code fallback } is { @ code null } , { @ link Float # NaN } is used .
* @ param json { @ code JSONObject } to get data from
* @ param e { @ link Enum } labeling the data to get
* @ param fallback Default value to return if there is no mapping
* @ return An instance of { @ code PointF } or { @ code fallback } if there is no object mapping for
* { @ code e } . */
public static < P extends Enum < P > > PointF optPointF ( final JSONObject json , P e , PointF fallback ) { } } | JSONObject value = optJSONObject ( json , e ) ; PointF p = asPointF ( value , fallback ) ; return p ; |
public class DataSourceConnectionSupplierImpl { /** * データソース名を指定したプロパティの取得
* @ param dataSourceName データソース名
* @ return データソースに紐付くプロパティ */
protected Map < String , String > getConnPropsByDataSourceName ( final String dataSourceName ) { } } | return connProps . computeIfAbsent ( dataSourceName , k -> new ConcurrentHashMap < > ( ) ) ; |
public class DatasourceDependencyBuilder { /** * Returns a builder instance that is initialized using a prototype DatasourceDependency .
* All values of the prototype are copied .
* @ param prototype the prototype dependency
* @ return DatasourceDependencyBuilder */
public static DatasourceDependencyBuilder copyOf ( final DatasourceDependency prototype ) { } } | return new DatasourceDependencyBuilder ( ) . withName ( prototype . getName ( ) ) . withDescription ( prototype . getDescription ( ) ) . withType ( prototype . getType ( ) ) . withSubtype ( prototype . getSubtype ( ) ) . withDatasources ( prototype . getDatasources ( ) ) . withCriticality ( prototype . getCriticality ( ) ) . withExpectations ( prototype . getExpectations ( ) ) ; |
public class Bitstream { /** * Parse ID3v2 tag header to find out size of ID3v2 frames .
* @ param in MP3 InputStream
* @ return size of ID3v2 frames + header
* @ throws IOException
* @ author JavaZOOM */
private int readID3v2Header ( InputStream in ) throws IOException { } } | byte [ ] id3header = new byte [ 4 ] ; int size = - 10 ; in . read ( id3header , 0 , 3 ) ; // Look for ID3v2
if ( ( id3header [ 0 ] == 'I' ) && ( id3header [ 1 ] == 'D' ) && ( id3header [ 2 ] == '3' ) ) { in . read ( id3header , 0 , 3 ) ; // int majorVersion = id3header [ 0 ] ;
// int revision = id3header [ 1 ] ;
in . read ( id3header , 0 , 4 ) ; size = ( int ) ( id3header [ 0 ] << 21 ) + ( id3header [ 1 ] << 14 ) + ( id3header [ 2 ] << 7 ) + ( id3header [ 3 ] ) ; } return ( size + 10 ) ; |
public class MPP14Reader { /** * Read group definitions .
* @ throws IOException */
private void processGroupData ( ) throws IOException { } } | DirectoryEntry dir = ( DirectoryEntry ) m_viewDir . getEntry ( "CGrouping" ) ; FixedMeta fixedMeta = new FixedMeta ( new DocumentInputStream ( ( ( DocumentEntry ) dir . getEntry ( "FixedMeta" ) ) ) , 10 ) ; FixedData fixedData = new FixedData ( fixedMeta , m_inputStreamFactory . getInstance ( dir , "FixedData" ) ) ; VarMeta varMeta = new VarMeta12 ( new DocumentInputStream ( ( ( DocumentEntry ) dir . getEntry ( "VarMeta" ) ) ) ) ; Var2Data varData = new Var2Data ( varMeta , new DocumentInputStream ( ( ( DocumentEntry ) dir . getEntry ( "Var2Data" ) ) ) ) ; // System . out . println ( fixedMeta ) ;
// System . out . println ( fixedData ) ;
// System . out . println ( varMeta ) ;
// System . out . println ( varData ) ;
GroupReader14 reader = new GroupReader14 ( ) ; reader . process ( m_file , fixedData , varData , m_fontBases ) ; |
public class DatabaseManager { /** * thrown exception to an HsqlException in the process */
private static String filePathToKey ( String path ) { } } | try { return FileUtil . getDefaultInstance ( ) . canonicalPath ( path ) ; } catch ( Exception e ) { return path ; } |
public class JavaUtil { /** * Code to fetch an instance of { @ link java . nio . charset . Charset } corresponding to the given encoding .
* @ param encoding as a string name ( eg . UTF - 8 ) .
* @ return the code to fetch the associated Charset . */
public static String charset ( final String encoding ) { } } | final String charsetName = STD_CHARSETS . get ( encoding ) ; if ( charsetName != null ) { return "java.nio.charset.StandardCharsets." + charsetName ; } else { return "java.nio.charset.Charset.forName(\"" + encoding + "\")" ; } |
public class AuthHandler { /** * Handles the SASL defined callbacks to set user and password ( the { @ link CallbackHandler } interface ) . */
@ Override public void handle ( Callback [ ] callbacks ) throws IOException , UnsupportedCallbackException { } } | for ( Callback callback : callbacks ) { if ( callback instanceof NameCallback ) { ( ( NameCallback ) callback ) . setName ( username ) ; } else if ( callback instanceof PasswordCallback ) { ( ( PasswordCallback ) callback ) . setPassword ( password . toCharArray ( ) ) ; } else { throw new AuthenticationException ( "SASLClient requested unsupported callback: " + callback ) ; } } |
public class CmsSitemapTreeItem { /** * Helper method to add an additional info bean to a list . < p >
* @ param infos the list of additional info beans
* @ param label the label for the new bean
* @ param value the value for the new bean */
protected static void addInfo ( List < CmsAdditionalInfoBean > infos , String label , String value ) { } } | infos . add ( new CmsAdditionalInfoBean ( label , value , null ) ) ; |
public class FastAggregation { /** * Uses a priority queue to compute the xor aggregate .
* This function runs in linearithmic ( O ( n log n ) ) time with respect to the number of bitmaps .
* @ param bitmaps input bitmaps
* @ return aggregated bitmap
* @ see # horizontal _ xor ( RoaringBitmap . . . ) */
public static RoaringBitmap priorityqueue_xor ( RoaringBitmap ... bitmaps ) { } } | // TODO : This code could be faster , see priorityqueue _ or
if ( bitmaps . length == 0 ) { return new RoaringBitmap ( ) ; } PriorityQueue < RoaringBitmap > pq = new PriorityQueue < > ( bitmaps . length , new Comparator < RoaringBitmap > ( ) { @ Override public int compare ( RoaringBitmap a , RoaringBitmap b ) { return ( int ) ( a . getLongSizeInBytes ( ) - b . getLongSizeInBytes ( ) ) ; } } ) ; Collections . addAll ( pq , bitmaps ) ; while ( pq . size ( ) > 1 ) { RoaringBitmap x1 = pq . poll ( ) ; RoaringBitmap x2 = pq . poll ( ) ; pq . add ( RoaringBitmap . xor ( x1 , x2 ) ) ; } return pq . poll ( ) ; |
public class PeerManager { /** * TODO : peer stats & reaper */
public @ NotNull Map < String , Integer > getStats ( ) { } } | int in = 0 ; int out = 0 ; for ( Peer peer : peers . values ( ) ) { Map < String , Integer > connStats = peer . getStats ( ) ; in += connStats . get ( "connections.in" ) ; out += connStats . get ( "connections.out" ) ; } Map < String , Integer > result = Maps . newHashMapWithExpectedSize ( 2 ) ; result . put ( "connections.in" , in ) ; result . put ( "connections.out" , out ) ; return result ; |
public class SARLHoverSignatureProvider { /** * Replies the hover for a SARL casted expression .
* @ param castExpression the casted expression .
* @ param typeAtEnd indicates if the type should be put at end .
* @ return the string representation into the hover . */
protected String _signature ( XCastedExpression castExpression , boolean typeAtEnd ) { } } | if ( castExpression instanceof SarlCastedExpression ) { final JvmOperation delegate = ( ( SarlCastedExpression ) castExpression ) . getFeature ( ) ; if ( delegate != null ) { return _signature ( delegate , typeAtEnd ) ; } } return MessageFormat . format ( Messages . SARLHoverSignatureProvider_0 , getTypeName ( castExpression . getType ( ) ) ) ; |
public class SibRaConnection { /** * Returns the userid associated with this connection . Checks that the
* connection is valid and then delegates .
* @ throws SIErrorException
* if the delegation fails
* @ throws SIResourceException
* if the delegation fails
* @ throws SIConnectionLostException
* if the delegation fails
* @ throws SIConnectionUnavailableException
* if the connection is not valid
* @ throws SIConnectionDroppedException
* if the delegation fails */
@ Override public String getResolvedUserid ( ) throws SIConnectionDroppedException , SIConnectionUnavailableException , SIConnectionLostException , SIResourceException , SIErrorException { } } | checkValid ( ) ; return _delegateConnection . getResolvedUserid ( ) ; |
public class IterableUtils { /** * Applys a one - to - many transform to each element of an { @ code Iterable } and concatenates all the
* results into one { @ code Iterable } . This is done lazily .
* @ deprecated Prefer { @ link FluentIterable # transformAndConcat ( Function ) } now that it
* exists . */
@ Deprecated public static < InType , OutType > Iterable < OutType > applyOneToManyTransform ( final Iterable < InType > input , final Function < ? super InType , ? extends Iterable < OutType > > function ) { } } | return FluentIterable . from ( input ) . transformAndConcat ( function ) ; |
public class AbstractInternalAntlrParser { protected EObject createModelElementForParent ( AbstractRule rule ) { } } | return createModelElement ( rule . getType ( ) . getClassifier ( ) , currentNode . getParent ( ) ) ; |
public class ReflectionUtil { /** * Checks if the class is available on the current thread ' s context class
* loader .
* @ param s fully qualified name of the class to check .
* @ return < code > true < / code > if the class is available , < code > false < / code >
* otherwise . */
public static boolean isClassAvailable ( String s ) { } } | final ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; try { classLoader . loadClass ( s ) ; return true ; } catch ( ClassNotFoundException e ) { return false ; } |
public class ConditionalCheck { /** * Ensures that a given state is { @ code true } .
* @ param condition
* condition must be { @ code true } ^ so that the check will be performed
* @ param expression
* an expression that must be { @ code true } to indicate a valid state
* @ param description
* will be used in the error message to describe why the arguments caused an invalid state
* @ throws IllegalStateOfArgumentException
* if the given arguments caused an invalid state */
@ Throws ( IllegalStateOfArgumentException . class ) public static void stateIsTrue ( final boolean condition , final boolean expression , @ Nonnull final String description ) { } } | if ( condition ) { Check . stateIsTrue ( expression , description ) ; } |
public class ProductPartitionTreeImpl { /** * Using the criteria in { @ code parentIdMap } , recursively adds all children under the partition ID
* of { @ code parentNode } to { @ code parentNode } .
* @ param parentNode required
* @ param parentIdMap the multimap from parent partition ID to list of child criteria */
private static void addChildNodes ( ProductPartitionNode parentNode , ListMultimap < Long , AdGroupCriterion > parentIdMap ) { } } | if ( parentIdMap . containsKey ( parentNode . getProductPartitionId ( ) ) ) { parentNode = parentNode . asSubdivision ( ) ; } for ( AdGroupCriterion adGroupCriterion : parentIdMap . get ( parentNode . getProductPartitionId ( ) ) ) { ProductPartition partition = ( ProductPartition ) adGroupCriterion . getCriterion ( ) ; ProductPartitionNode childNode = parentNode . addChild ( partition . getCaseValue ( ) ) ; childNode = childNode . setProductPartitionId ( partition . getId ( ) ) ; if ( ProductPartitionType . SUBDIVISION . equals ( partition . getPartitionType ( ) ) ) { childNode = childNode . asSubdivision ( ) ; } else { if ( adGroupCriterion instanceof BiddableAdGroupCriterion ) { childNode = childNode . asBiddableUnit ( ) ; BiddableAdGroupCriterion biddableAdGroupCriterion = ( BiddableAdGroupCriterion ) adGroupCriterion ; Money cpcBidAmount = getBid ( biddableAdGroupCriterion ) ; if ( cpcBidAmount != null ) { childNode = childNode . setBid ( cpcBidAmount . getMicroAmount ( ) ) ; } childNode = childNode . setTrackingUrlTemplate ( biddableAdGroupCriterion . getTrackingUrlTemplate ( ) ) ; childNode = copyCustomParametersToNode ( biddableAdGroupCriterion , childNode ) ; } else { childNode = childNode . asExcludedUnit ( ) ; } } addChildNodes ( childNode , parentIdMap ) ; } |
public class IfcMaterialClassificationRelationshipImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) public EList < IfcClassificationNotationSelect > getMaterialClassifications ( ) { } } | return ( EList < IfcClassificationNotationSelect > ) eGet ( Ifc2x3tc1Package . Literals . IFC_MATERIAL_CLASSIFICATION_RELATIONSHIP__MATERIAL_CLASSIFICATIONS , true ) ; |
public class WebMvcLinkBuilderFactory { /** * ( non - Javadoc )
* @ see org . springframework . hateoas . MethodLinkBuilderFactory # linkTo ( java . lang . reflect . Method , java . lang . Object [ ] ) */
@ Override public WebMvcLinkBuilder linkTo ( Method method , Object ... parameters ) { } } | return WebMvcLinkBuilder . linkTo ( method , parameters ) ; |
public class SARLValidator { /** * Check if the given local variable has a valid name .
* @ param variable the variable to test .
* @ see SARLFeatureNameValidator */
@ Check ( CheckType . FAST ) public void checkParameterName ( XVariableDeclaration variable ) { } } | if ( this . grammarAccess . getOccurrenceKeyword ( ) . equals ( variable . getName ( ) ) ) { error ( MessageFormat . format ( Messages . SARLValidator_15 , this . grammarAccess . getOccurrenceKeyword ( ) ) , variable , XbasePackage . Literals . XVARIABLE_DECLARATION__NAME , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , VARIABLE_NAME_DISALLOWED ) ; } |
public class Expression { /** * Convert this expression to a statement , by executing it and throwing away the result .
* < p > This is useful for invoking non - void methods when we don ' t care about the result . */
public Statement toStatement ( ) { } } | return new Statement ( ) { @ Override protected void doGen ( CodeBuilder adapter ) { Expression . this . gen ( adapter ) ; switch ( resultType ( ) . getSize ( ) ) { case 0 : throw new AssertionError ( "void expressions are not allowed" ) ; case 1 : adapter . pop ( ) ; break ; case 2 : adapter . pop2 ( ) ; break ; default : throw new AssertionError ( ) ; } } } ; |
public class BaseTemplate { /** * Includes contents of another file , not as a template but as escaped text .
* @ param templatePath the path to the other file
* @ throws IOException */
public void includeEscaped ( String templatePath ) throws IOException { } } | URL resource = engine . resolveTemplate ( templatePath ) ; yield ( ResourceGroovyMethods . getText ( resource , engine . getCompilerConfiguration ( ) . getSourceEncoding ( ) ) ) ; |
public class ListMigrationTasksResult { /** * Lists the migration task ' s summary which includes : < code > MigrationTaskName < / code > , < code > ProgressPercent < / code > ,
* < code > ProgressUpdateStream < / code > , < code > Status < / code > , and the < code > UpdateDateTime < / code > for each task .
* @ param migrationTaskSummaryList
* Lists the migration task ' s summary which includes : < code > MigrationTaskName < / code > ,
* < code > ProgressPercent < / code > , < code > ProgressUpdateStream < / code > , < code > Status < / code > , and the
* < code > UpdateDateTime < / code > for each task . */
public void setMigrationTaskSummaryList ( java . util . Collection < MigrationTaskSummary > migrationTaskSummaryList ) { } } | if ( migrationTaskSummaryList == null ) { this . migrationTaskSummaryList = null ; return ; } this . migrationTaskSummaryList = new java . util . ArrayList < MigrationTaskSummary > ( migrationTaskSummaryList ) ; |
public class JDBCInputFormat { /** * Checks whether all data has been read .
* @ return boolean value indication whether all data has been read .
* @ throws IOException */
@ Override public boolean reachedEnd ( ) throws IOException { } } | try { if ( resultSet . isLast ( ) ) { close ( ) ; return true ; } return false ; } catch ( SQLException se ) { throw new IOException ( "Couldn't evaluate reachedEnd() - " + se . getMessage ( ) , se ) ; } |
public class Utilities { /** * Convert the appinfo string to the address the application is available on
* @ param info the string of the appinfo
* @ return the address application is available on */
public static InetAddress appInfoToAddress ( String info ) { } } | Matcher m = INET_ADDRESS_PATTERN . matcher ( info ) ; if ( m . find ( ) ) { int port = Integer . parseInt ( m . group ( 2 ) ) ; return new InetAddress ( m . group ( 1 ) , port ) ; } return null ; |
public class InstanceHelpers { /** * Finds the root instance ' s path from another instance path .
* @ param scopedInstancePath a scoped instance path ( may be null )
* @ return a non - null root instance path */
public static String findRootInstancePath ( String scopedInstancePath ) { } } | String result ; if ( Utils . isEmptyOrWhitespaces ( scopedInstancePath ) ) { // Do not return null
result = "" ; } else if ( scopedInstancePath . contains ( "/" ) ) { // Be as flexible as possible with paths
String s = scopedInstancePath . replaceFirst ( "^/*" , "" ) ; int index = s . indexOf ( '/' ) ; result = index > 0 ? s . substring ( 0 , index ) : s ; } else { // Assumed to be a root instance name
result = scopedInstancePath ; } return result ; |
public class Subsumption { /** * Generates a UBTree from the formulas operands ( clauses in CNF , minterms in DNF )
* where all subsumed operands are already deleted .
* @ param formula the formula ( must be an n - ary operator and CNF or DNF )
* @ return the UBTree with the operands and deleted subsumed operands */
protected static UBTree < Literal > generateSubsumedUBTree ( final Formula formula ) { } } | final SortedMap < Integer , List < SortedSet < Literal > > > mapping = new TreeMap < > ( ) ; for ( final Formula term : formula ) { List < SortedSet < Literal > > terms = mapping . get ( term . literals ( ) . size ( ) ) ; if ( terms == null ) { terms = new LinkedList < > ( ) ; mapping . put ( term . literals ( ) . size ( ) , terms ) ; } terms . add ( term . literals ( ) ) ; } final UBTree < Literal > ubTree = new UBTree < > ( ) ; for ( final Map . Entry < Integer , List < SortedSet < Literal > > > entry : mapping . entrySet ( ) ) { for ( final SortedSet < Literal > set : entry . getValue ( ) ) { if ( ubTree . firstSubset ( set ) == null ) { ubTree . addSet ( set ) ; } } } return ubTree ; |
public class MPP14Reader { /** * Clear transient member data . */
private void clearMemberData ( ) { } } | m_reader = null ; m_eventManager = null ; m_file = null ; m_root = null ; m_resourceMap = null ; m_projectDir = null ; m_viewDir = null ; m_outlineCodeVarData = null ; m_outlineCodeVarMeta = null ; m_projectProps = null ; m_fontBases = null ; m_taskSubProjects = null ; m_parentTasks = null ; m_taskOrder = null ; m_nullTaskOrder = null ; |
public class Attachment { /** * Returns the { @ link # encoding } encoding using the string in the attachment ' s JSON metadata .
* @ param encodingString the string containing the attachment ' s { @ link # encoding } encoding .
* @ return the attachment ' s { @ link # encoding } encoding . */
public static Encoding getEncodingFromString ( String encodingString ) { } } | if ( encodingString == null || encodingString . isEmpty ( ) || encodingString . equalsIgnoreCase ( "Plain" ) ) { return Encoding . Plain ; } else if ( encodingString . equalsIgnoreCase ( "gzip" ) ) { return Encoding . Gzip ; } else { throw new IllegalArgumentException ( "Unsupported encoding" ) ; } |
public class ResponsePromise { /** * Handles a retry
* @ param cause of last connect fail */
public void handleRetry ( Throwable cause ) { } } | try { this . retryPolicy . retry ( connectionState , retryHandler , connectionFailHandler ) ; } catch ( RetryPolicy . RetryCancelled retryCancelled ) { this . getNettyPromise ( ) . setFailure ( cause ) ; } |
public class TopLevelDocumentToApiModelVisitor { /** * { @ inheritDoc } */
@ Override public final void visit ( final TrailerDocument document ) { } } | setBaseObject ( new ApiObject ( document . getType ( ) , document . getString ( ) ) ) ; addAttributes ( document ) ; |
public class UnicodeSet { /** * Find the last index before fromIndex where the UnicodeSet matches at that index .
* If findNot is true , then reverse the sense of the match : find the last place where the UnicodeSet doesn ' t match .
* If there is no match , - 1 is returned .
* BEFORE index is not in the UnicodeSet .
* @ deprecated This API is ICU internal only . Use spanBack instead .
* @ hide original deprecated declaration
* @ hide draft / provisional / internal are hidden on Android */
@ Deprecated public int findLastIn ( CharSequence value , int fromIndex , boolean findNot ) { } } | // TODO add strings , optimize , using ICU4C algorithms
int cp ; fromIndex -= 1 ; for ( ; fromIndex >= 0 ; fromIndex -= UTF16 . getCharCount ( cp ) ) { cp = UTF16 . charAt ( value , fromIndex ) ; if ( contains ( cp ) != findNot ) { break ; } } return fromIndex < 0 ? - 1 : fromIndex ; |
public class SQLActionParser { /** * Parses SQL query action with result set validation elements .
* @ param element the root element .
* @ param scriptValidationElement the optional script validation element .
* @ param validateElements validation elements .
* @ param extractElements variable extraction elements .
* @ return */
private BeanDefinitionBuilder parseSqlQueryAction ( Element element , Element scriptValidationElement , List < Element > validateElements , List < Element > extractElements ) { } } | BeanDefinitionBuilder beanDefinition = BeanDefinitionBuilder . rootBeanDefinition ( ExecuteSQLQueryAction . class ) ; // check for script validation
if ( scriptValidationElement != null ) { beanDefinition . addPropertyValue ( "scriptValidationContext" , getScriptValidationContext ( scriptValidationElement ) ) ; } Map < String , List < String > > controlResultSet = new HashMap < String , List < String > > ( ) ; for ( Iterator < ? > iter = validateElements . iterator ( ) ; iter . hasNext ( ) ; ) { Element validateElement = ( Element ) iter . next ( ) ; Element valueListElement = DomUtils . getChildElementByTagName ( validateElement , "values" ) ; if ( valueListElement != null ) { List < String > valueList = new ArrayList < String > ( ) ; List < ? > valueElements = DomUtils . getChildElementsByTagName ( valueListElement , "value" ) ; for ( Iterator < ? > valueElementsIt = valueElements . iterator ( ) ; valueElementsIt . hasNext ( ) ; ) { Element valueElement = ( Element ) valueElementsIt . next ( ) ; valueList . add ( DomUtils . getTextValue ( valueElement ) ) ; } controlResultSet . put ( validateElement . getAttribute ( "column" ) , valueList ) ; } else if ( validateElement . hasAttribute ( "value" ) ) { controlResultSet . put ( validateElement . getAttribute ( "column" ) , Collections . singletonList ( validateElement . getAttribute ( "value" ) ) ) ; } else { throw new BeanCreationException ( element . getLocalName ( ) , "Neither value attribute nor value list is set for column validation: " + validateElement . getAttribute ( "column" ) ) ; } } beanDefinition . addPropertyValue ( "controlResultSet" , controlResultSet ) ; Map < String , String > extractVariables = new HashMap < String , String > ( ) ; for ( Iterator < ? > iter = extractElements . iterator ( ) ; iter . hasNext ( ) ; ) { Element validate = ( Element ) iter . next ( ) ; extractVariables . put ( validate . getAttribute ( "column" ) , validate . getAttribute ( "variable" ) ) ; } beanDefinition . addPropertyValue ( "extractVariables" , extractVariables ) ; return beanDefinition ; |
public class Matrix4f { /** * Apply rotation of < code > angleY < / code > radians about the Y axis , followed by a rotation of < code > angleX < / code > radians about the X axis and
* followed by a rotation of < code > angleZ < / code > radians about the Z axis .
* When used with a right - handed coordinate system , the produced rotation will rotate a vector
* counter - clockwise around the rotation axis , when viewing along the negative axis direction towards the origin .
* When used with a left - handed coordinate system , the rotation is clockwise .
* If < code > M < / code > is < code > this < / code > matrix and < code > R < / code > the rotation matrix ,
* then the new matrix will be < code > M * R < / code > . So when transforming a
* vector < code > v < / code > with the new matrix by using < code > M * R * v < / code > , the
* rotation will be applied first !
* This method is equivalent to calling : < code > rotateY ( angleY ) . rotateX ( angleX ) . rotateZ ( angleZ ) < / code >
* @ param angleY
* the angle to rotate about Y
* @ param angleX
* the angle to rotate about X
* @ param angleZ
* the angle to rotate about Z
* @ return a matrix holding the result */
public Matrix4f rotateYXZ ( float angleY , float angleX , float angleZ ) { } } | return rotateYXZ ( angleY , angleX , angleZ , thisOrNew ( ) ) ; |
public class ProtectionIntentsInner { /** * Create Intent for Enabling backup of an item . This is a synchronous operation .
* @ param vaultName The name of the recovery services vault .
* @ param resourceGroupName The name of the resource group where the recovery services vault is present .
* @ param fabricName Fabric name associated with the backup item .
* @ param intentObjectName Intent object name .
* @ param parameters resource backed up item
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the ProtectionIntentResourceInner object */
public Observable < ProtectionIntentResourceInner > createOrUpdateAsync ( String vaultName , String resourceGroupName , String fabricName , String intentObjectName , ProtectionIntentResourceInner parameters ) { } } | return createOrUpdateWithServiceResponseAsync ( vaultName , resourceGroupName , fabricName , intentObjectName , parameters ) . map ( new Func1 < ServiceResponse < ProtectionIntentResourceInner > , ProtectionIntentResourceInner > ( ) { @ Override public ProtectionIntentResourceInner call ( ServiceResponse < ProtectionIntentResourceInner > response ) { return response . body ( ) ; } } ) ; |
public class WnsClient { /** * Based on < a href = " http : / / msdn . microsoft . com / en - us / library / windows / apps / hh465407 . aspx " > http : / / msdn . microsoft . com / en - us / library / windows / apps / hh465407 . aspx < / a >
* @ throws WnsException when authentication fails */
public void refreshAccessToken ( ) throws WnsException { } } | WebTarget target = client . target ( getAuthenticationUri ( ) ) ; MultivaluedStringMap formData = new MultivaluedStringMap ( ) ; formData . add ( "grant_type" , GRANT_TYPE_CLIENT_CREDENTIALS ) ; formData . add ( "client_id" , this . sid ) ; formData . add ( "client_secret" , this . clientSecret ) ; formData . add ( "scope" , SCOPE ) ; Response response = target . request ( MediaType . APPLICATION_FORM_URLENCODED_TYPE ) . accept ( MediaType . APPLICATION_JSON_TYPE ) . post ( Entity . form ( formData ) ) ; if ( response . getStatus ( ) != 200 ) { throw new WnsException ( "Authentication failed. HTTP error code: " + response . getStatus ( ) ) ; } this . token = response . readEntity ( WnsOAuthToken . class ) ; |
public class LogRepositoryListener { /** * ( non - Javadoc )
* @ see org . eclipse . aether . util . listener . AbstractRepositoryListener # metadataResolving
* ( org . eclipse . aether . RepositoryEvent ) */
@ Override public void metadataResolving ( RepositoryEvent event ) { } } | log . finer ( "Resolving metadata " + event . getMetadata ( ) + " from " + event . getRepository ( ) ) ; |
public class Signature { /** * Retrieve the offset of the given argument name in this signature ' s
* arguments . If the argument name is not in the argument list , returns - 1.
* @ param pattern the argument name to search for
* @ return the offset at which the argument name was found or - 1 */
public int argOffsets ( String pattern ) { } } | for ( int i = 0 ; i < argNames . length ; i ++ ) { if ( Pattern . compile ( pattern ) . matcher ( argNames [ i ] ) . find ( ) ) return i ; } return - 1 ; |
public class HeartbeatImpl { /** * Heartbeat from a hub server includes the heartbeat status of its rack . */
public void hubHeartbeat ( UpdateServerHeartbeat updateServer , UpdateRackHeartbeat updateRack , UpdatePodSystem updatePod , long sourceTime ) { } } | RackHeartbeat rack = getCluster ( ) . findRack ( updateRack . getId ( ) ) ; if ( rack == null ) { rack = getRack ( ) ; } updateRack ( updateRack ) ; updateServerStart ( updateServer ) ; // XXX : _ podService . onUpdateFromPeer ( updatePod ) ;
// rack . update ( ) ;
updateTargetServers ( ) ; PodHeartbeatService podHeartbeat = getPodHeartbeat ( ) ; if ( podHeartbeat != null && updatePod != null ) { podHeartbeat . updatePodSystem ( updatePod ) ; } _joinState = _joinState . onHubHeartbeat ( this ) ; // updateHubHeartbeat ( ) ;
updateHeartbeats ( ) ; |
public class DestroyAttempts { /** * Gets an immutable instance that represents an attempt where the process is already terminated .
* This attempt ' s { @ link DestroyAttempt # result ( ) result ( ) } method will return
* { @ link DestroyResult # TERMINATED TERMINATED } .
* @ param < A > kill or term attempt type
* @ return */
@ SuppressWarnings ( "unchecked" ) public static < A extends DestroyAttempt . KillAttempt & DestroyAttempt . TermAttempt > A terminated ( ) { } } | return ( A ) ALREADY_TERMINATED ; |
public class RepositoryResourceImpl { /** * { @ inheritDoc } */
protected void setType ( ResourceType type ) { } } | if ( type == null ) { _asset . setType ( null ) ; _asset . getWlpInformation ( ) . setTypeLabel ( null ) ; } else { _asset . setType ( type ) ; _asset . getWlpInformation ( ) . setTypeLabel ( type . getTypeLabel ( ) ) ; } |
public class SAMkNN { /** * Removes predictions of the largest window size and shifts the remaining ones accordingly . */
private void adaptHistories ( int numberOfDeletions ) { } } | for ( int i = 0 ; i < numberOfDeletions ; i ++ ) { SortedSet < Integer > keys = new TreeSet < > ( this . predictionHistories . keySet ( ) ) ; this . predictionHistories . remove ( keys . first ( ) ) ; keys = new TreeSet < > ( this . predictionHistories . keySet ( ) ) ; for ( Integer key : keys ) { List < Integer > predHistory = this . predictionHistories . remove ( key ) ; this . predictionHistories . put ( key - keys . first ( ) , predHistory ) ; } } |
public class BNFHeadersImpl { /** * Clear the array of buffers used during the parsing or marshalling of
* headers . */
private void clearBuffers ( ) { } } | // simply null out the parse buffers list , then release all the created buffers
final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; for ( int i = 0 ; i <= this . parseIndex ; i ++ ) { if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Removing reference to parse buffer: " + this . parseBuffers [ i ] ) ; } this . parseBuffers [ i ] = null ; this . parseBuffersStartPos [ i ] = HeaderStorage . NOTSET ; } this . parseIndex = HeaderStorage . NOTSET ; for ( int i = 0 ; i <= this . createdIndex ; i ++ ) { if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Releasing marshall buffer: " + this . myCreatedBuffers [ i ] ) ; } this . myCreatedBuffers [ i ] . release ( ) ; this . myCreatedBuffers [ i ] = null ; } this . createdIndex = HeaderStorage . NOTSET ; |
public class MessageStoreImpl { /** * JsMonitoredComponent Implementation */
@ Override public final void reportLocalError ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "reportLocalError" ) ; // Only need to set to LOCAL _ ERROR
// if we are currently OK . We don ' t want
// to overwrite a GLOBAL _ ERROR .
if ( _healthState . isOK ( ) ) { _healthState = JsHealthState . getLocalError ( ) ; } if ( _healthMonitor == null ) { if ( _messagingEngine != null && _messagingEngine instanceof JsHealthMonitor ) { _healthMonitor = ( JsHealthMonitor ) _messagingEngine ; _healthMonitor . reportLocalError ( ) ; } } else { _healthMonitor . reportLocalError ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "reportLocalError" ) ; |
public class WTemplate { /** * Pass configuration options to the template engine .
* The options are determined by the { @ link TemplateRenderer } implementation for the template engine .
* The { @ link TemplateRenderer } implemented is determined by the { @ link TemplateRendererFactory } .
* @ param key the engine option key
* @ param value the engine option value */
public void addEngineOption ( final String key , final Object value ) { } } | if ( Util . empty ( key ) ) { throw new IllegalArgumentException ( "A key must be provided" ) ; } TemplateModel model = getOrCreateComponentModel ( ) ; if ( model . engineOptions == null ) { model . engineOptions = new HashMap < > ( ) ; } model . engineOptions . put ( key , value ) ; |
public class HashIntSet { /** * Custom deserializer . */
private void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException { } } | in . defaultReadObject ( ) ; createBuckets ( getBucketCount ( _size ) ) ; for ( int ii = 0 ; ii < _size ; ii ++ ) { readd ( in . readInt ( ) ) ; } |
public class ScanResult { /** * Get classes that have a method with a parameter that is annotated with an annotation of the named type .
* @ param methodParameterAnnotationName
* the name of the method parameter annotation .
* @ return A list of classes that have a method with a parameter annotated with the named annotation type , or
* the empty list if none . */
public ClassInfoList getClassesWithMethodParameterAnnotation ( final String methodParameterAnnotationName ) { } } | if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } if ( ! scanSpec . enableClassInfo || ! scanSpec . enableMethodInfo || ! scanSpec . enableAnnotationInfo ) { throw new IllegalArgumentException ( "Please call ClassGraph#enableClassInfo(), #enableMethodInfo(), " + "and #enableAnnotationInfo() before #scan()" ) ; } final ClassInfo classInfo = classNameToClassInfo . get ( methodParameterAnnotationName ) ; return classInfo == null ? ClassInfoList . EMPTY_LIST : classInfo . getClassesWithMethodParameterAnnotation ( ) ; |
public class ParityFilePair { /** * Return whether if parity file of the source file exists or not
* @ param src The FileStatus of the source file .
* @ param codec The Codec of the parity to check
* @ param conf
* @ return
* @ throws IOException */
public static boolean parityExists ( FileStatus src , Codec codec , Configuration conf ) throws IOException { } } | return ParityFilePair . getParityFile ( codec , src , conf ) != null ; |
public class WorkflowsInner { /** * Gets a workflow .
* @ param resourceGroupName The resource group name .
* @ param workflowName The workflow name .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the WorkflowInner object if successful . */
public WorkflowInner getByResourceGroup ( String resourceGroupName , String workflowName ) { } } | return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , workflowName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class TextSimilarity { /** * 将字符串的所有数据依次写成一行 , 去除无意义字符串
* @ param str 字符串
* @ return 处理后的字符串 */
private static String removeSign ( String str ) { } } | StringBuilder sb = StrUtil . builder ( str . length ( ) ) ; // 遍历字符串str , 如果是汉字数字或字母 , 则追加到ab上面
int length = str . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { sb . append ( charReg ( str . charAt ( i ) ) ) ; } return sb . toString ( ) ; |
public class PercentConverter { /** * Retrieve ( in string format ) from this field .
* @ return This field as a percent string . */
public String getString ( ) { } } | String string = Constants . BLANK ; if ( this . getNextConverter ( ) . getData ( ) != null ) { double doubleValue = this . getValue ( ) ; synchronized ( gPercentFormat ) { string = gPercentFormat . format ( doubleValue ) ; } } return string ; |
public class Memoize { /** * Creates a new closure delegating to the supplied one and memoizing all return values by the arguments .
* The supplied cache is used to store the memoized values and it is the cache ' s responsibility to put limits
* on the cache size or implement cache eviction strategy .
* The LRUCache , for example , allows to set the maximum cache size constraint and implements
* the LRU ( Last Recently Used ) eviction strategy .
* @ param cache A map to hold memoized return values
* @ param closure The closure to memoize
* @ param < V > The closure ' s return type
* @ return A new memoized closure */
public static < V > Closure < V > buildMemoizeFunction ( final MemoizeCache < Object , Object > cache , final Closure < V > closure ) { } } | return new MemoizeFunction < V > ( cache , closure ) ; |
import java . lang . Math ; class CalculateSquareRoot { /** * This function calculates the square root of a perfect square .
* Args :
* n : an input integer which is a perfect square
* Returns :
* An integer that is the square root of the input perfect square
* Examples :
* > > > calculateSquareRoot ( 4)
* > > > calculateSquareRoot ( 16)
* > > > calculateSquareRoot ( 400)
* 20 */
public static int calculateSquareRoot ( int n ) { } } | int sqRoot = Math . sqrt ( n ) ; return sqRoot ; |
public class MinerAdapter { /** * Gets the position of the modification feature as a String .
* @ param mf modification feature
* @ return location */
public String getPositionInString ( ModificationFeature mf ) { } } | Set vals = SITE_ACC . getValueFromBean ( mf ) ; if ( ! vals . isEmpty ( ) ) { int x = ( ( Integer ) vals . iterator ( ) . next ( ) ) ; if ( x > 0 ) return "@" + x ; } vals = INTERVAL_BEGIN_ACC . getValueFromBean ( mf ) ; if ( ! vals . isEmpty ( ) ) { int begin = ( ( Integer ) vals . iterator ( ) . next ( ) ) ; vals = INTERVAL_END_ACC . getValueFromBean ( mf ) ; if ( ! vals . isEmpty ( ) ) { int end = ( ( Integer ) vals . iterator ( ) . next ( ) ) ; if ( begin > 0 && end > 0 && begin <= end ) { if ( begin == end ) return "@" + begin ; else return "@" + "[" + begin + "-" + end + "]" ; } } } return "" ; |
public class JsonRpcHttpAsyncClient { /** * Invokes the given method with the given arguments and invokes the
* { @ code JsonRpcCallback } with the result .
* @ param methodName the name of the method to invoke
* @ param argument the arguments to the method
* @ param callback the { @ code JsonRpcCallback } */
public void invoke ( String methodName , Object argument , JsonRpcCallback < Object > callback ) { } } | invoke ( methodName , argument , Object . class , new HashMap < String , String > ( ) , callback ) ; |
public class TzdbZoneRulesCompiler { /** * Output usage text for the command line . */
private static void outputHelp ( ) { } } | System . out . println ( "Usage: TzdbZoneRulesCompiler <options> <tzdb source filenames>" ) ; System . out . println ( "where options include:" ) ; System . out . println ( " -srcdir <directory> Where to find source directories (required)" ) ; System . out . println ( " -dstdir <directory> Where to output generated files (default srcdir)" ) ; System . out . println ( " -version <version> Specify the version, such as 2009a (optional)" ) ; System . out . println ( " -unpacked Generate dat files without jar files" ) ; System . out . println ( " -help Print this usage message" ) ; System . out . println ( " -verbose Output verbose information during compilation" ) ; System . out . println ( " There must be one directory for each version in srcdir" ) ; System . out . println ( " Each directory must have the name of the version, such as 2009a" ) ; System . out . println ( " Each directory must contain the unpacked tzdb files, such as asia or europe" ) ; System . out . println ( " Directories must match the regex [12][0-9][0-9][0-9][A-Za-z0-9._-]+" ) ; System . out . println ( " There will be one jar file for each version and one combined jar in dstdir" ) ; System . out . println ( " If the version is specified, only that version is processed" ) ; |
public class VirtualHost { /** * Method getSessionContext .
* @ param moduleConfig
* @ param webApp
* @ return IHttpSessionContext */
@ SuppressWarnings ( "unchecked" ) public IHttpSessionContext getSessionContext ( DeployedModule moduleConfig , WebApp webApp , ArrayList [ ] listeners ) throws Throwable { } } | // System . out . println ( " Vhost createSC " ) ;
return ( ( WebContainer ) parent ) . getSessionContext ( moduleConfig , webApp , this . vHostConfig . getName ( ) , listeners ) ; |
public class IndexAVL { /** * Returns either child node
* @ param x node
* @ param isleft boolean
* @ return child node */
private static NodeAVL child ( PersistentStore store , NodeAVL x , boolean isleft ) { } } | return isleft ? x . getLeft ( store ) : x . getRight ( store ) ; |
public class MapperFactoryBean { /** * { @ inheritDoc } */
public T getObject ( ) throws Exception { } } | final T mapper = getSqlSession ( ) . getMapper ( this . mapperInterface ) ; return Reflection . newProxy ( this . mapperInterface , new InvocationHandler ( ) { @ Override public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { long start = System . currentTimeMillis ( ) ; TraceContext rpc = TraceContext . get ( ) ; String parameters = getParameters ( args ) ; String iface = MapperFactoryBean . this . iface ; rpc . reset ( ) . inc ( ) . setStamp ( start ) . setIface ( iface ) . setMethod ( method . getName ( ) ) . setParameter ( parameters ) ; try { return method . invoke ( mapper , args ) ; } catch ( Exception e ) { rpc . setFail ( true ) . setReason ( e . getMessage ( ) ) ; LOG . error ( "{}.{}({})" , iface , method . getName ( ) , parameters , e ) ; throw e ; } finally { rpc . setCost ( System . currentTimeMillis ( ) - start ) ; TraceRecorder . getInstance ( ) . post ( rpc . copy ( ) ) ; } } } ) ; |
public class TypeDescription { /** * Returns the type ' s PropertyDescriptors . */
public PropertyDescriptor [ ] getPropertyDescriptors ( ) { } } | BeanInfo info = getBeanInfo ( ) ; if ( info == null ) { return null ; } PropertyDescriptor [ ] pds = info . getPropertyDescriptors ( ) ; getTeaToolsUtils ( ) . sortPropertyDescriptors ( pds ) ; return pds ; |
public class Client { /** * Gets a list of the user Ids assigned to a privilege .
* @ param id
* Id of the privilege
* @ param maxResults
* Limit the number of users returned
* @ return List of user Ids
* @ throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
* @ throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
* @ throws URISyntaxException - if there is an error when generating the target URL at the getResource call
* @ see < a target = " _ blank " href = " https : / / developers . onelogin . com / api - docs / 1 / privileges / get - users " > Get Assigned Users documentation < / a > */
public List < Long > getUsersAssignedToPrivileges ( String id , int maxResults ) throws OAuthSystemException , OAuthProblemException , URISyntaxException { } } | ExtractionContext context = getResource ( Constants . GET_USERS_ASSIGNED_TO_PRIVILEGE_URL , id ) ; OneloginOAuth2JSONResourceResponse oAuth2Response = null ; String afterCursor = null ; List < Long > userIds = new ArrayList < Long > ( maxResults ) ; while ( oAuth2Response == null || ( userIds . size ( ) < maxResults && afterCursor != null ) ) { oAuth2Response = context . oAuthClient . resource ( context . bearerRequest , OAuth . HttpMethod . GET , OneloginOAuth2JSONResourceResponse . class ) ; if ( ( afterCursor = getUsersAssignedToPrivilegesBatch ( userIds , context . url , context . bearerRequest , oAuth2Response ) ) == null ) { break ; } } return userIds ; |
public class CancelResizeResult { /** * The names of tables that are being currently imported .
* Valid Values : List of table names .
* @ param importTablesInProgress
* The names of tables that are being currently imported . < / p >
* Valid Values : List of table names . */
public void setImportTablesInProgress ( java . util . Collection < String > importTablesInProgress ) { } } | if ( importTablesInProgress == null ) { this . importTablesInProgress = null ; return ; } this . importTablesInProgress = new com . amazonaws . internal . SdkInternalList < String > ( importTablesInProgress ) ; |
public class SimonManagerMXBeanImpl { /** * Sample all Counters whose name matches given pattern
* @ param namePattern Name pattern , null means all Counters
* @ return One Sample for each Counter */
@ Override public List < CounterSample > getCounterSamples ( String namePattern ) { } } | List < CounterSample > counterSamples = new ArrayList < > ( ) ; for ( Simon simon : manager . getSimons ( SimonPattern . createForCounter ( namePattern ) ) ) { counterSamples . add ( sampleCounter ( simon ) ) ; } return counterSamples ; |
public class PropertiesListener { /** * Overwrites the default writer to which the output is directed . */
public void setOutputWriter ( Writer writer ) { } } | if ( writer instanceof PrintWriter ) { this . out = ( PrintWriter ) writer ; } else if ( writer == null ) { this . out = null ; } else { this . out = new PrintWriter ( writer ) ; } |
public class FlinkKafkaProducer011 { /** * Initializes the connection to Kafka . */
@ Override public void open ( Configuration configuration ) throws Exception { } } | if ( logFailuresOnly ) { callback = new Callback ( ) { @ Override public void onCompletion ( RecordMetadata metadata , Exception e ) { if ( e != null ) { LOG . error ( "Error while sending record to Kafka: " + e . getMessage ( ) , e ) ; } acknowledgeMessage ( ) ; } } ; } else { callback = new Callback ( ) { @ Override public void onCompletion ( RecordMetadata metadata , Exception exception ) { if ( exception != null && asyncException == null ) { asyncException = exception ; } acknowledgeMessage ( ) ; } } ; } super . open ( configuration ) ; |
public class ApiOvhEmaildomain { /** * List of email address available for migration
* REST : GET / email / domain / { domain } / account / { accountName } / migrate / { destinationServiceName } / destinationEmailAddress
* @ param quota [ required ] Account maximum size
* @ param domain [ required ] Name of your domain name
* @ param accountName [ required ] Name of account
* @ param destinationServiceName [ required ] Service name allowed as migration destination
* API beta */
public ArrayList < String > domain_account_accountName_migrate_destinationServiceName_destinationEmailAddress_GET ( String domain , String accountName , String destinationServiceName , Long quota ) throws IOException { } } | String qPath = "/email/domain/{domain}/account/{accountName}/migrate/{destinationServiceName}/destinationEmailAddress" ; StringBuilder sb = path ( qPath , domain , accountName , destinationServiceName ) ; query ( sb , "quota" , quota ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t1 ) ; |
public class HTMLUtil { /** * returns all urls in a html String
* @ param html HTML String to search urls
* @ param url Absolute URL path to set
* @ return urls found in html String */
public List < URL > getURLS ( String html , URL url ) { } } | List < URL > urls = new ArrayList < URL > ( ) ; SourceCode cfml = new SourceCode ( html , false , CFMLEngine . DIALECT_CFML ) ; while ( ! cfml . isAfterLast ( ) ) { if ( cfml . forwardIfCurrent ( '<' ) ) { for ( int i = 0 ; i < tags . length ; i ++ ) { if ( cfml . forwardIfCurrent ( tags [ i ] . tag + " " ) ) { getSingleUrl ( urls , cfml , tags [ i ] , url ) ; } } } else { cfml . next ( ) ; } } return urls ; |
public class AbstractGauge { /** * Sets the image of the currently used led image .
* @ param CURRENT _ LED _ IMAGE */
protected void setCurrentLedImage ( final BufferedImage CURRENT_LED_IMAGE ) { } } | if ( currentLedImage != null ) { currentLedImage . flush ( ) ; } currentLedImage = CURRENT_LED_IMAGE ; repaint ( getInnerBounds ( ) ) ; |
public class StringUtils { /** * Tests a char to see if is it whitespace .
* This method considers the same characters to be white
* space as the Pattern class does when matching \ s
* @ param ch the character to be tested
* @ return true if the character is white space , false otherwise . */
private static boolean isWhiteSpace ( final char ch ) { } } | if ( ch == CHAR_SPACE ) return true ; if ( ch == CHAR_TAB ) return true ; if ( ch == CHAR_NEW_LINE ) return true ; if ( ch == CHAR_VERTICAL_TAB ) return true ; if ( ch == CHAR_CARRIAGE_RETURN ) return true ; if ( ch == CHAR_FORM_FEED ) return true ; return false ; |
public class CategoryChart { private void sanityCheck ( String seriesName , List < ? > xData , List < ? extends Number > yData , List < ? extends Number > errorBars ) { } } | if ( seriesMap . keySet ( ) . contains ( seriesName ) ) { throw new IllegalArgumentException ( "Series name >" + seriesName + "< has already been used. Use unique names for each series!!!" ) ; } if ( yData == null ) { throw new IllegalArgumentException ( "Y-Axis data cannot be null!!!" ) ; } if ( yData . size ( ) == 0 ) { throw new IllegalArgumentException ( "Y-Axis data cannot be empty!!!" ) ; } if ( xData != null && xData . size ( ) == 0 ) { throw new IllegalArgumentException ( "X-Axis data cannot be empty!!!" ) ; } if ( errorBars != null && errorBars . size ( ) != yData . size ( ) ) { throw new IllegalArgumentException ( "Error bars and Y-Axis sizes are not the same!!!" ) ; } |
public class SQLSharedServerLeaseLog { /** * ( non - Javadoc )
* @ see com . ibm . ws . recoverylog . spi . SharedServerLeaseLog # setPeerRecoveryLeaseTimeout ( int ) */
@ Override public void setPeerRecoveryLeaseTimeout ( int leaseTimeout ) { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "setPeerRecoveryLeaseTimeout" , leaseTimeout ) ; // Store the Lease Timeout
_leaseTimeout = leaseTimeout ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "setPeerRecoveryLeaseTimeout" , this ) ; |
public class ListPortfolioAccessRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListPortfolioAccessRequest listPortfolioAccessRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listPortfolioAccessRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listPortfolioAccessRequest . getAcceptLanguage ( ) , ACCEPTLANGUAGE_BINDING ) ; protocolMarshaller . marshall ( listPortfolioAccessRequest . getPortfolioId ( ) , PORTFOLIOID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class StreamEx { /** * Returns a new { @ code StreamEx } which is a concatenation of this stream
* and the stream created from supplied collection .
* This is a < a href = " package - summary . html # StreamOps " > quasi - intermediate
* operation < / a > .
* May return this if the supplied collection is empty and non - concurrent .
* @ param collection the collection to append to the stream
* @ return the new stream
* @ since 0.2.1 */
public StreamEx < T > append ( Collection < ? extends T > collection ) { } } | return appendSpliterator ( null , collection . spliterator ( ) ) ; |
public class ChannelImpl { /** * Extracts the peer name from a full channel name . The channel name is
* created by asterisk and consists of the peer name a hypen and a unique
* sequence number . e . g . SIP / 100-00000123 * For SIP channels the Peer name
* is of the form : SIP / 100 For dahdi channels the channel name is of the
* form : DAHDI / i < span > / < number > [ : < subaddress > ] - 00000123 With the peer name
* of the form : DAHDI / i < span > / < number > [ : < subaddress > ] */
private final String extractPeerName ( final String channelName ) { } } | // Find the start of the sequence number
int channelNameEndPoint = channelName . lastIndexOf ( "-" ) ; // $ NON - NLS - 1 $
if ( channelNameEndPoint == - 1 ) { channelNameEndPoint = channelName . length ( ) ; } // return the peer name which is everything before the sequence number
// ( and its hypen ) .
return channelName . substring ( 0 , channelNameEndPoint ) ; |
public class ConversationAPI { /** * Creates a reply to the conversation .
* @ param conversationId
* The id of the conversation to reply to
* @ param text
* The text of the reply
* @ return The id of the new message */
public int addReply ( int conversationId , String text ) { } } | return getResourceFactory ( ) . getApiResource ( "/conversation/" + conversationId + "/reply" ) . entity ( new MessageCreate ( text ) , MediaType . APPLICATION_JSON_TYPE ) . get ( MessageCreateResponse . class ) . getMessageId ( ) ; |
public class KamDialect { /** * { @ inheritDoc } */
@ Override public KamEdge replaceEdge ( KamEdge kamEdge , FunctionEnum sourceFunction , String sourceLabel , RelationshipType relationship , FunctionEnum targetFunction , String targetLabel ) { } } | return kam . replaceEdge ( kamEdge , sourceFunction , sourceLabel , relationship , targetFunction , targetLabel ) ; |
public class UploadOfflineData { /** * Returns the { @ link FieldPathElement # getIndex ( ) } for the specified { @ code field } name , if
* present in the error ' s field path elements .
* @ param apiError the error to inspect .
* @ param field the name of the field to search for in the error ' s field path elements .
* @ return the index of the entry with the specified field , or { @ code null } if no such entry
* exists or the entry has a null index . */
private static Integer getFieldPathElementIndex ( ApiError apiError , String field ) { } } | FieldPathElement [ ] fieldPathElements = apiError . getFieldPathElements ( ) ; if ( fieldPathElements == null ) { return null ; } for ( int i = 0 ; i < fieldPathElements . length ; i ++ ) { FieldPathElement fieldPathElement = fieldPathElements [ i ] ; if ( field . equals ( fieldPathElement . getField ( ) ) ) { return fieldPathElement . getIndex ( ) ; } } return null ; |
public class Vector4i { /** * Read this vector from the supplied { @ link IntBuffer } starting at the
* specified absolute buffer position / index .
* This method will not increment the position of the given IntBuffer .
* @ param index
* the absolute position into the IntBuffer
* @ param buffer
* values will be read in < code > x , y , z , w < / code > order
* @ return this */
public Vector4i set ( int index , IntBuffer buffer ) { } } | MemUtil . INSTANCE . get ( this , index , buffer ) ; return this ; |
public class DefaultDelegate { @ Override public void progressiveStop ( CircularProgressDrawable . OnEndListener listener ) { } } | if ( ! mParent . isRunning ( ) || mEndAnimator . isRunning ( ) ) { return ; } mOnEndListener = listener ; mEndAnimator . addListener ( new SimpleAnimatorListener ( ) { @ Override public void onPreAnimationEnd ( Animator animation ) { mEndAnimator . removeListener ( this ) ; CircularProgressDrawable . OnEndListener endListener = mOnEndListener ; mOnEndListener = null ; if ( isStartedAndNotCancelled ( ) ) { setEndRatio ( 0f ) ; mParent . stop ( ) ; if ( endListener != null ) { endListener . onEnd ( mParent ) ; } } } } ) ; mEndAnimator . start ( ) ; |
public class XPathParser { /** * Parses the the rule ForExpr according to the following production rule :
* ForExpr : : = SimpleForClause " return " ExprSingle .
* @ throws TTXPathException */
private void parseForExpr ( ) throws TTXPathException { } } | // get number of all for conditions
final int rangeVarNo = parseSimpleForClause ( ) ; consume ( "return" , true ) ; // parse return clause
parseExprSingle ( ) ; mPipeBuilder . addForExpression ( rangeVarNo ) ; |
public class FieldRefConstant { /** * Writes the contents of the pool entry . */
void write ( ByteCodeWriter out ) throws IOException { } } | out . write ( ConstantPool . CP_FIELD_REF ) ; out . writeShort ( _classIndex ) ; out . writeShort ( _nameAndTypeIndex ) ; |
public class Char { /** * Encodes a character to a backslash code ( if necessary ) */
public static String encodeBackslash ( char c ) { } } | if ( isAlphanumeric ( c ) || c == ' ' ) return ( "" + c ) ; String hex = Integer . toHexString ( c ) ; while ( hex . length ( ) < 4 ) hex = "0" + hex ; return ( "\\u" + hex ) ; |
public class ConfusionMatrix { /** * The percentage of positive predictions that are correct .
* @ return Precision */
public double precision ( ) { } } | if ( ! isBinary ( ) ) throw new UnsupportedOperationException ( "precision is only implemented for 2 class problems." ) ; if ( tooLarge ( ) ) throw new UnsupportedOperationException ( "precision cannot be computed: too many classes" ) ; double tp = _cm [ 1 ] [ 1 ] ; double fp = _cm [ 0 ] [ 1 ] ; return tp / ( tp + fp ) ; |
public class ProductDimensionComparator { /** * Returns the deep comparator that will compare the appropriate values between two instances of
* type D . Throws an IllegalArgumentException if { @ code D } is a subclass of ProductDimension not
* supported by Shopping campaigns . As of v201409 , the types not supported by Shopping campaigns
* are :
* < ul >
* < li > ProductAdWordsGrouping < / li >
* < li > ProductAdWordsLabels < / li >
* < li > ProductLegacyCondition < / li >
* < li > ProductTypeFull < / li >
* < / ul >
* @ throws IllegalArgumentException if { @ code D } is not a dimension type supported by this
* comparator */
private < D extends ProductDimension > Comparator < D > getDeepComparator ( D dimension ) { } } | @ SuppressWarnings ( "unchecked" ) Comparator < D > comparator = ( Comparator < D > ) comparatorMap . get ( dimension . getClass ( ) ) ; Preconditions . checkArgument ( comparator != null , "No comparator exists for %s. This comparator only supports comparisons of " + "ProductDimension subclasses supported by Shopping campaigns." , dimension ) ; return comparator ; |
public class RestAction { /** * Schedules a call to { @ link # complete ( ) } to be executed after the specified { @ code delay } .
* < br > This is an < b > asynchronous < / b > operation that will return a
* { @ link java . util . concurrent . ScheduledFuture ScheduledFuture } representing the task .
* < p > The returned Future will provide the return type of a { @ link # complete ( ) } operation when
* received through the < b > blocking < / b > call to { @ link java . util . concurrent . Future # get ( ) } !
* < p > The specified { @ link java . util . concurrent . ScheduledExecutorService ScheduledExecutorService } is used for this operation .
* @ param delay
* The delay after which this computation should be executed , negative to execute immediately
* @ param unit
* The { @ link java . util . concurrent . TimeUnit TimeUnit } to convert the specified { @ code delay }
* @ param executor
* The Non - null { @ link java . util . concurrent . ScheduledExecutorService ScheduledExecutorService } that should be used
* to schedule this operation
* @ throws java . lang . IllegalArgumentException
* If the provided TimeUnit or ScheduledExecutorService is { @ code null }
* @ return { @ link java . util . concurrent . ScheduledFuture ScheduledFuture }
* representing the delayed operation */
public ScheduledFuture < T > submitAfter ( long delay , TimeUnit unit , ScheduledExecutorService executor ) { } } | Checks . notNull ( executor , "Scheduler" ) ; Checks . notNull ( unit , "TimeUnit" ) ; return executor . schedule ( ( Callable < T > ) new ContextRunnable ( ( Callable < T > ) this :: complete ) , delay , unit ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.