signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class StreamingContentHandler { /** * Writes the given text to the output stream for this { @ link StreamingContentHandler } . * @ param text the text to output * @ throws SAXException if there is an error writing to the stream */ private void emit ( String text ) throws SAXException { } }
try { // System . out . print ( text ) ; writer . write ( text ) ; } catch ( IOException ioe ) { throw new SAXException ( ioe ) ; }
public class LogQueue { /** * Indicate if the list contains logs of a specific level . * @ param level the level of the logs to return * @ return true if log of provided level or less exist * @ since 6.0M1 */ public boolean containLogsFrom ( LogLevel level ) { } }
for ( LogEvent log : this ) { if ( log . getLevel ( ) . compareTo ( level ) <= 0 ) { return true ; } } return false ;
public class SymmetricQREigenHelper_DDRM { /** * Sets the size of the matrix being decomposed , declares new memory if needed , * and sets all helper functions to their initial value . */ public void reset ( int N ) { } }
this . N = N ; this . diag = null ; this . off = null ; if ( splits . length < N ) { splits = new int [ N ] ; } numSplits = 0 ; x1 = 0 ; x2 = N - 1 ; steps = numExceptional = lastExceptional = 0 ; this . Q = null ;
public class UIViewRoot { /** * < p class = " changed _ added _ 2_0 " > Broadcast any events that have been * queued . First broadcast events that have been queued for { @ link * PhaseId # ANY _ PHASE } . Then broadcast ane events that have been * queued for the current phase . In both cases , { @ link * UIComponent # pushComponentToEL } must be called before the event is * broadcast , and { @ link UIComponent # popComponentFromEL } must be * called after the return from the broadcast , even in the case of * an exception . < / p > * @ param context { @ link FacesContext } for the current request * @ param phaseId { @ link PhaseId } of the current phase * @ since 2.0 */ public void broadcastEvents ( FacesContext context , PhaseId phaseId ) { } }
if ( null == events ) { // no events have been queued return ; } boolean hasMoreAnyPhaseEvents ; boolean hasMoreCurrentPhaseEvents ; List < FacesEvent > eventsForPhaseId = events . get ( PhaseId . ANY_PHASE . getOrdinal ( ) ) ; // keep iterating till we have no more events to broadcast . // This is necessary for events that cause other events to be // queued . PENDING ( edburns ) : here ' s where we ' d put in a check // to prevent infinite event queueing . do { // broadcast the ANY _ PHASE events first if ( null != eventsForPhaseId ) { // We cannot use an Iterator because we will get // ConcurrentModificationException errors , so fake it while ( ! eventsForPhaseId . isEmpty ( ) ) { FacesEvent event = eventsForPhaseId . get ( 0 ) ; UIComponent source = event . getComponent ( ) ; UIComponent compositeParent = null ; try { if ( ! UIComponent . isCompositeComponent ( source ) ) { compositeParent = UIComponent . getCompositeComponentParent ( source ) ; } if ( compositeParent != null ) { compositeParent . pushComponentToEL ( context , null ) ; } source . pushComponentToEL ( context , null ) ; source . broadcast ( event ) ; } catch ( AbortProcessingException e ) { context . getApplication ( ) . publishEvent ( context , ExceptionQueuedEvent . class , new ExceptionQueuedEventContext ( context , e , source , phaseId ) ) ; } finally { source . popComponentFromEL ( context ) ; if ( compositeParent != null ) { compositeParent . popComponentFromEL ( context ) ; } } eventsForPhaseId . remove ( 0 ) ; // Stay at current position } } // then broadcast the events for this phase . if ( null != ( eventsForPhaseId = events . get ( phaseId . getOrdinal ( ) ) ) ) { // We cannot use an Iterator because we will get // ConcurrentModificationException errors , so fake it while ( ! eventsForPhaseId . isEmpty ( ) ) { FacesEvent event = eventsForPhaseId . get ( 0 ) ; UIComponent source = event . getComponent ( ) ; UIComponent compositeParent = null ; try { if ( ! UIComponent . isCompositeComponent ( source ) ) { compositeParent = getCompositeComponentParent ( source ) ; } if ( compositeParent != null ) { compositeParent . pushComponentToEL ( context , null ) ; } source . pushComponentToEL ( context , null ) ; source . broadcast ( event ) ; } catch ( AbortProcessingException ape ) { // A " return " here would abort remaining events too context . getApplication ( ) . publishEvent ( context , ExceptionQueuedEvent . class , new ExceptionQueuedEventContext ( context , ape , source , phaseId ) ) ; } finally { source . popComponentFromEL ( context ) ; if ( compositeParent != null ) { compositeParent . popComponentFromEL ( context ) ; } } eventsForPhaseId . remove ( 0 ) ; // Stay at current position } } // true if we have any more ANY _ PHASE events hasMoreAnyPhaseEvents = ( null != ( eventsForPhaseId = events . get ( PhaseId . ANY_PHASE . getOrdinal ( ) ) ) ) && ! eventsForPhaseId . isEmpty ( ) ; // true if we have any more events for the argument phaseId hasMoreCurrentPhaseEvents = ( null != events . get ( phaseId . getOrdinal ( ) ) ) && ! events . get ( phaseId . getOrdinal ( ) ) . isEmpty ( ) ; } while ( hasMoreAnyPhaseEvents || hasMoreCurrentPhaseEvents ) ;
public class Windows { /** * Selects the only < code > _ blank < / code > window . A window open with < code > target = ' _ blank ' < / code > * will have a < code > window . name = null < / code > . * This method assumes that there will only be one single < code > _ blank < / code > window and selects * the first one with no name . Therefore if for any reasons there are multiple windows with * < code > window . name = null < / code > the first found one will be selected . * If none of the windows have < code > window . name = null < / code > the last selected one will be * re - selected and a { @ link SeleniumException } will be thrown . * @ param driver WebDriver * @ throws NoSuchWindowException if no window with < code > window . name = null < / code > is found . */ public void selectBlankWindow ( WebDriver driver ) { } }
String current = driver . getWindowHandle ( ) ; // Find the first window without a " name " attribute List < String > handles = new ArrayList < > ( driver . getWindowHandles ( ) ) ; for ( String handle : handles ) { // the original window will never be a _ blank window , so don ' t even look at it // this is also important to skip , because the original / root window won ' t have // a name either , so if we didn ' t know better we might think it ' s a _ blank popup ! if ( handle . equals ( originalWindowHandle ) ) { continue ; } driver . switchTo ( ) . window ( handle ) ; String value = ( String ) ( ( JavascriptExecutor ) driver ) . executeScript ( "return window.name;" ) ; if ( value == null || "" . equals ( value ) ) { // We found it ! return ; } } // We couldn ' t find it driver . switchTo ( ) . window ( current ) ; throw new SeleniumException ( "Unable to select window _blank" ) ;
public class DebugBond { /** * { @ inheritDoc } */ @ Override public void setStereo ( IBond . Stereo stereo ) { } }
logger . debug ( "Setting stereo: " , stereo ) ; super . setStereo ( stereo ) ;
public class PaySignUtil { /** * 对于私钥是非常保密的信息 , 强烈建议将私钥存储在服务端 。 * 开发者首先调用getStringForSign获取待签名字符串 , 然后将待签名字符串发送到服务器 , 由开发者服务端对待签名字符串进行签名 。 * 签名方法可以参考rsaSign方法的实现 。 * @ deprecated * @ param request 要计算签名的请求 * @ param privKey 私钥 * @ return 生成的签名字符串 */ public static String calculateSignString ( PayReq request , String privKey ) { } }
return rsaSign ( getStringForSign ( request ) , privKey ) ;
public class ExportConfigurationsInner { /** * Update the Continuous Export configuration for this export id . * @ param resourceGroupName The name of the resource group . * @ param resourceName The name of the Application Insights component resource . * @ param exportId The Continuous Export configuration ID . This is unique within a Application Insights component . * @ param exportProperties Properties that need to be specified to update the Continuous Export configuration . * @ 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 ApplicationInsightsComponentExportConfigurationInner object if successful . */ public ApplicationInsightsComponentExportConfigurationInner update ( String resourceGroupName , String resourceName , String exportId , ApplicationInsightsComponentExportRequest exportProperties ) { } }
return updateWithServiceResponseAsync ( resourceGroupName , resourceName , exportId , exportProperties ) . toBlocking ( ) . single ( ) . body ( ) ;
public class SessionDataManager { /** * Commit changes * @ param path * @ throws RepositoryException * @ throws AccessDeniedException * @ throws ReferentialIntegrityException * @ throws InvalidItemStateException */ public void commit ( QPath path ) throws RepositoryException , AccessDeniedException , ReferentialIntegrityException , InvalidItemStateException , ItemExistsException { } }
// validate all , throw an exception if validation failed validate ( path ) ; PlainChangesLog cLog = changesLog . pushLog ( path ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( " ----- commit -------- \n" + cLog . dump ( ) ) ; } try { transactionableManager . save ( cLog ) ; invalidated . clear ( ) ; } catch ( AccessDeniedException e ) { remainChangesBack ( cLog ) ; throw new AccessDeniedException ( e ) ; } catch ( InvalidItemStateException e ) { remainChangesBack ( cLog ) ; throw new InvalidItemStateException ( e ) ; } catch ( ItemExistsException e ) { remainChangesBack ( cLog ) ; throw new ItemExistsException ( e ) ; } catch ( ReferentialIntegrityException e ) { remainChangesBack ( cLog ) ; throw new ReferentialIntegrityException ( e ) ; } catch ( RepositoryException e ) { remainChangesBack ( cLog ) ; throw new RepositoryException ( e ) ; }
public class ResourceFactory { /** * 判断是否包含指定资源名和资源类型的资源对象 * @ param < A > 泛型 * @ param recursive 是否遍历父节点 * @ param name 资源名 * @ param clazz 资源类型 * @ return 是否存在 */ public < A > boolean contains ( boolean recursive , String name , Class < ? extends A > clazz ) { } }
Map < String , ResourceEntry > map = this . store . get ( clazz ) ; return map == null ? ( ( recursive && parent != null ) ? parent . contains ( recursive , name , clazz ) : false ) : map . containsKey ( name ) ;
public class MTable { /** * Ajoute une colonne dans la table . * @ param attribute * Nom de l ' attribut des objets à afficher dans la colonne < br / > * @ param libelle * Libellé à afficher en entête de la colonne * @ return this ( fluent ) */ public MTable < T > addColumn ( final String attribute , final String libelle ) { } }
final int modelIndex = getColumnCount ( ) ; final TableColumn tableColumn = new TableColumn ( modelIndex ) ; // on met l ' énumération de l ' attribut comme identifier dans le TableColumn pour s ' en servir dans MTableModel tableColumn . setIdentifier ( attribute ) ; if ( libelle == null ) { // on prend par défaut l ' attribut si le libellé n ' est pas précisé , tableColumn . setHeaderValue ( attribute ) ; } else { // le libellé a été précisé pour l ' entête de cette colonne tableColumn . setHeaderValue ( libelle ) ; } // ajoute la colonne dans la table super . addColumn ( tableColumn ) ; return this ;
public class EthiopianTime { /** * / * [ deutsch ] * < p > Erzeugt eine neue Instanz im ISO - Bereich ( 18:00:00-05:59:59 um Mitternacht herum ) . < / p > * @ param hour ethiopian hour in range 1-12 during night * @ param minute minute of hour * @ param second second of hour * @ return ethiopian time * @ see # ofDay ( int , int , int ) * @ since 3.11/4.8 */ public static EthiopianTime ofNight ( int hour , int minute , int second ) { } }
return EthiopianTime . of ( true , hour , minute , second ) ;
public class ThreadDump { /** * Returns the singleton instance , creating if necessary . An instance of * com . caucho . server . admin . ProThreadDump will be returned if available and * licensed . ProThreadDump includes the URI of the request the thread is * processing , if applicable . */ public static ThreadDump create ( ) { } }
ThreadDump threadDump = _threadDumpRef . get ( ) ; if ( threadDump == null ) { threadDump = new ThreadDumpPro ( ) ; _threadDumpRef . compareAndSet ( null , threadDump ) ; threadDump = _threadDumpRef . get ( ) ; } return threadDump ;
public class Csv { /** * Test if this Csv contains specified row . * Note : Provided row may only contain part of the columns . * @ param row Each row is represented as a map , with column name as key , and column value as value * @ return */ public boolean containsRow ( Map < String , String > row ) { } }
for ( CsvRow csvRow : data ) { if ( csvRow . contains ( row ) ) { return true ; } } return false ;
public class MDC { /** * For all the methods that operate against the context , return true if the MDC should use the PaxContext object ffrom the PaxLoggingManager , * or if the logging manager is not set , or does not have its context available yet , use a default context local to this MDC . * @ return true if the MDC should use the PaxContext object ffrom the PaxLoggingManager , * or if the logging manager is not set , or does not have its context available yet , use a default context local to this MDC . */ private static boolean setContext ( ) { } }
if ( m_context == null && m_paxLogging != null ) { m_context = ( m_paxLogging . getPaxLoggingService ( ) != null ) ? m_paxLogging . getPaxLoggingService ( ) . getPaxContext ( ) : null ; } return m_context != null ;
public class Clicker { /** * Long clicks a given coordinate on the screen . * @ param x the x coordinate * @ param y the y coordinate * @ param time the amount of time to long click */ public void clickLongOnScreen ( float x , float y , int time , View view ) { } }
boolean successfull = false ; int retry = 0 ; SecurityException ex = null ; long downTime = SystemClock . uptimeMillis ( ) ; long eventTime = SystemClock . uptimeMillis ( ) ; MotionEvent event = MotionEvent . obtain ( downTime , eventTime , MotionEvent . ACTION_DOWN , x , y , 0 ) ; while ( ! successfull && retry < 20 ) { try { inst . sendPointerSync ( event ) ; successfull = true ; sleeper . sleep ( MINI_WAIT ) ; } catch ( SecurityException e ) { ex = e ; dialogUtils . hideSoftKeyboard ( null , false , true ) ; sleeper . sleep ( MINI_WAIT ) ; retry ++ ; View identicalView = viewFetcher . getIdenticalView ( view ) ; if ( identicalView != null ) { float [ ] xyToClick = getClickCoordinates ( identicalView ) ; x = xyToClick [ 0 ] ; y = xyToClick [ 1 ] ; } } } if ( ! successfull ) { Assert . fail ( "Long click at (" + x + ", " + y + ") can not be completed! (" + ( ex != null ? ex . getClass ( ) . getName ( ) + ": " + ex . getMessage ( ) : "null" ) + ")" ) ; } eventTime = SystemClock . uptimeMillis ( ) ; event = MotionEvent . obtain ( downTime , eventTime , MotionEvent . ACTION_MOVE , x + 1.0f , y + 1.0f , 0 ) ; inst . sendPointerSync ( event ) ; if ( time > 0 ) sleeper . sleep ( time ) ; else sleeper . sleep ( ( int ) ( ViewConfiguration . getLongPressTimeout ( ) * 2.5f ) ) ; eventTime = SystemClock . uptimeMillis ( ) ; event = MotionEvent . obtain ( downTime , eventTime , MotionEvent . ACTION_UP , x , y , 0 ) ; inst . sendPointerSync ( event ) ; sleeper . sleep ( ) ;
public class SyncListReader { /** * Make the request to the Twilio API to perform the read . * @ param client TwilioRestClient with which to make the request * @ return SyncList ResourceSet */ @ Override public ResourceSet < SyncList > read ( final TwilioRestClient client ) { } }
return new ResourceSet < > ( this , client , firstPage ( client ) ) ;
public class AuthenticationMethod { /** * Checks if another method is of the same type . * @ param other the other * @ return true , if is same type */ public boolean isSameType ( AuthenticationMethod other ) { } }
if ( other == null ) return false ; return other . getClass ( ) . equals ( this . getClass ( ) ) ;
public class JdbcAccessImpl { /** * Set the locking values * @ param cld * @ param obj * @ param oldLockingValues */ private void setLockingValues ( ClassDescriptor cld , Object obj , ValueContainer [ ] oldLockingValues ) { } }
FieldDescriptor fields [ ] = cld . getLockingFields ( ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { PersistentField field = fields [ i ] . getPersistentField ( ) ; Object lockVal = oldLockingValues [ i ] . getValue ( ) ; field . set ( obj , lockVal ) ; }
public class PluralFormat { /** * Initializes the < code > PluralRules < / code > object . * Postcondition : < br / > * < code > ulocale < / code > : is < code > locale < / code > < br / > * < code > pluralRules < / code > : if < code > rules < / code > ! = < code > null < / code > * it ' s set to rules , otherwise it is the * predefined plural rule set for the locale * < code > ulocale < / code > . < br / > * < code > parsedValues < / code > : is < code > null < / code > < br / > * < code > pattern < / code > : is < code > null < / code > < br / > * < code > numberFormat < / code > : a < code > NumberFormat < / code > for the locale * < code > ulocale < / code > . */ private void init ( PluralRules rules , PluralType type , ULocale locale , NumberFormat numberFormat ) { } }
ulocale = locale ; pluralRules = ( rules == null ) ? PluralRules . forLocale ( ulocale , type ) : rules ; resetPattern ( ) ; this . numberFormat = ( numberFormat == null ) ? NumberFormat . getInstance ( ulocale ) : numberFormat ;
public class SparseMatrix { /** * Get Object from matrix by row and column . * @ param row item row position * @ param column item column position * @ return Object in row , column position in the matrix */ @ Nullable TObj get ( int row , int column ) { } }
SparseArrayCompat < TObj > array = mData . get ( row ) ; return array == null ? null : array . get ( column ) ;
public class JsonWriter { /** * Write the binary as object key . * @ param key The binary key . * @ return The JSON Writer . */ public JsonWriter key ( Binary key ) { } }
startKey ( ) ; if ( key == null ) { throw new IllegalArgumentException ( "Expected map key, but got null." ) ; } writer . write ( '\"' ) ; writer . write ( key . toBase64 ( ) ) ; writer . write ( '\"' ) ; writer . write ( ':' ) ; return this ;
public class DateTimeExtensions { /** * Iterates from this to the { @ code to } { @ link java . time . temporal . Temporal } , inclusive , decrementing by one * { @ code unit } each iteration , calling the closure once per iteration . The closure may accept a single * { @ link java . time . temporal . Temporal } argument . * If the unit is too large to iterate to the second Temporal exactly , such as iterating from two LocalDateTimes * that are seconds apart using { @ link java . time . temporal . ChronoUnit # DAYS } as the unit , the iteration will cease * as soon as the current value of the iteration is earlier than the second Temporal argument . The closure will * not be called with any value earlier than the { @ code to } value . * @ param from the starting Temporal * @ param to the ending Temporal * @ param unit the TemporalUnit to increment by * @ param closure the zero or one - argument closure to call * @ throws GroovyRuntimeException if this value is earlier than { @ code to } * @ throws GroovyRuntimeException if { @ code to } is a different type than this * @ since 2.5.0 */ public static void downto ( Temporal from , Temporal to , TemporalUnit unit , Closure closure ) { } }
if ( isDowntoEligible ( from , to ) ) { for ( Temporal i = from ; isDowntoEligible ( i , to ) ; i = i . minus ( 1 , unit ) ) { closure . call ( i ) ; } } else { throw new GroovyRuntimeException ( "The argument (" + to + ") to downto() cannot be later than the value (" + from + ") it's called on." ) ; }
public class CmsPropertyChange { /** * Builds the html for the property definition select box . < p > * @ param attributes optional attributes for the & lt ; select & gt ; tag * @ return the html for the property definition select box */ public String buildSelectProperty ( String attributes ) { } }
return buildSelectProperty ( getCms ( ) , Messages . get ( ) . getBundle ( getLocale ( ) ) . key ( Messages . GUI_PLEASE_SELECT_0 ) , attributes , getParamPropertyName ( ) ) ;
public class DancingLinks { /** * Hide a column in the table * @ param col the column to hide */ private void coverColumn ( ColumnHeader < ColumnName > col ) { } }
LOG . debug ( "cover " + col . head . name ) ; // remove the column col . right . left = col . left ; col . left . right = col . right ; Node < ColumnName > row = col . down ; while ( row != col ) { Node < ColumnName > node = row . right ; while ( node != row ) { node . down . up = node . up ; node . up . down = node . down ; node . head . size -= 1 ; node = node . right ; } row = row . down ; }
public class CyclicWriteBehindQueue { /** * Removes all available elements from this queue and adds them * to the given collection . * @ param collection all elements to be added to this collection . * @ return number of removed items from this queue . */ @ Override public int drainTo ( Collection < DelayedEntry > collection ) { } }
checkNotNull ( collection , "collection can not be null" ) ; Iterator < DelayedEntry > iterator = deque . iterator ( ) ; while ( iterator . hasNext ( ) ) { DelayedEntry e = iterator . next ( ) ; collection . add ( e ) ; iterator . remove ( ) ; } resetCountIndex ( ) ; return collection . size ( ) ;
public class AES256JNCryptorInputStream { /** * Reads a number of bytes into the byte array . If this includes the last byte * in the stream ( determined by peeking ahead to the next byte ) , the value of * the HMAC is verified . If the verification fails an exception is thrown . * @ param b * the buffer into which the data is read . * @ param off * the start offset in array < code > b < / code > at which the data is * written . * @ param len * the maximum number of bytes to read . * @ return the total number of bytes read into the buffer , or < code > - 1 < / code > * if there is no more data because the end of the stream has been * reached . * @ throws IOException * If the first byte cannot be read for any reason other than end of * file , or if the input stream has been closed , or if some other * I / O error occurs . * @ throws NullPointerException * If < code > b < / code > is < code > null < / code > . * @ throws IndexOutOfBoundsException * If < code > off < / code > is negative , < code > len < / code > is negative , or * < code > len < / code > is greater than < code > b . length - off < / code > * @ throws StreamIntegrityException * if the final byte has been read and the HMAC fails validation */ @ Override public int read ( byte [ ] b , int off , int len ) throws IOException { } }
Validate . notNull ( b , "Byte array cannot be null." ) ; Validate . isTrue ( off >= 0 , "Offset cannot be negative." ) ; Validate . isTrue ( len >= 0 , "Length cannot be negative." ) ; Validate . isTrue ( len + off <= b . length , "Length plus offset cannot be longer than byte array." ) ; if ( len == 0 ) { return 0 ; } if ( trailerIn == null ) { initializeStream ( ) ; } int result = pushbackInputStream . read ( b , off , len ) ; return completeRead ( result ) ;
public class ClassLoaderUtils { /** * This method determines whether it is known that a this class loader is a " leaf " , in the sense that * going up through its hierarchy we are able to find both the class class loader and the system class * loader . This is used for determining whether we should be confident on the thread - context class loader * delegation mechanism or rather try to perform class / resource resolution manually on the other class loaders . */ private static boolean isKnownLeafClassLoader ( final ClassLoader classLoader ) { } }
if ( classLoader == null ) { return false ; } if ( ! isKnownClassLoaderAccessibleFrom ( classClassLoader , classLoader ) ) { // We cannot access the class class loader from the specified class loader , so this is not a leaf return false ; } // Now we know there is a way to reach the class class loader from the argument class loader , so we should // base or results on whether there is a way to reach the system class loader from the class class loader . return systemClassLoaderAccessibleFromClassClassLoader ;
public class AbstractNewSarlElementWizardPage { /** * Create the default standard SARL event templates . * @ param elementTypeName the name of the element type . * @ param behaviorUnitAdder the adder of behavior unit . * @ param usesAdder the adder of uses statement . * @ return { @ code true } if the units are added ; { @ code false } otherwise . * @ since 0.5 */ protected boolean createStandardSARLEventTemplates ( String elementTypeName , Function1 < ? super String , ? extends ISarlBehaviorUnitBuilder > behaviorUnitAdder , Procedure1 < ? super String > usesAdder ) { } }
if ( ! isCreateStandardEventHandlers ( ) ) { return false ; } Object type ; try { type = getTypeFinder ( ) . findType ( INITIALIZE_EVENT_NAME ) ; } catch ( JavaModelException e ) { type = null ; } if ( type != null ) { // SARL Libraries are on the classpath usesAdder . apply ( LOGGING_CAPACITY_NAME ) ; ISarlBehaviorUnitBuilder unit = behaviorUnitAdder . apply ( INITIALIZE_EVENT_NAME ) ; IBlockExpressionBuilder block = unit . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_9 , elementTypeName ) ) ; IExpressionBuilder expr = block . addExpression ( ) ; createInfoCall ( expr , "The " + elementTypeName + " was started." ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $ unit = behaviorUnitAdder . apply ( DESTROY_EVENT_NAME ) ; block = unit . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_10 , elementTypeName ) ) ; expr = block . addExpression ( ) ; createInfoCall ( expr , "The " + elementTypeName + " was stopped." ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $ unit = behaviorUnitAdder . apply ( AGENTSPAWNED_EVENT_NAME ) ; block = unit . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_11 , elementTypeName ) ) ; unit = behaviorUnitAdder . apply ( AGENTKILLED_EVENT_NAME ) ; block = unit . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_12 , elementTypeName ) ) ; unit = behaviorUnitAdder . apply ( CONTEXTJOINED_EVENT_NAME ) ; block = unit . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_13 , elementTypeName ) ) ; unit = behaviorUnitAdder . apply ( CONTEXTLEFT_EVENT_NAME ) ; block = unit . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_14 , elementTypeName ) ) ; unit = behaviorUnitAdder . apply ( MEMBERJOINED_EVENT_NAME ) ; block = unit . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_15 , elementTypeName ) ) ; unit = behaviorUnitAdder . apply ( MEMBERLEFT_EVENT_NAME ) ; block = unit . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_16 , elementTypeName ) ) ; return true ; } return false ;
public class AmazonKinesisVideoPutMediaClient { /** * Netty needs an explicit port so resolve that from the endpoint provided . * @ param endpoint Configured endpoint * @ return Port number to use . */ private int getPort ( URI endpoint ) { } }
if ( endpoint . getPort ( ) != - 1 ) { return endpoint . getPort ( ) ; } else if ( "https" . equals ( endpoint . getScheme ( ) ) ) { return 443 ; } else { return 80 ; }
public class FormMappingOption { public FormMappingOption filterRequestParameterMap ( Function < Map < String , Object > , Map < String , Object > > requestParameterMapFilter ) { } }
if ( requestParameterMapFilter == null ) { throw new IllegalArgumentException ( "The argument 'requestParameterMapFilter' should not be null." ) ; } this . requestParameterMapFilter = OptionalThing . of ( requestParameterMapFilter ) ; return this ;
public class AbstractDependenceMeasure { /** * Build a sorted index of objects . * @ param adapter Data adapter * @ param data Data array * @ param len Length of data * @ return Sorted index */ protected static < A > int [ ] sortedIndex ( final NumberArrayAdapter < ? , A > adapter , final A data , int len ) { } }
int [ ] s1 = MathUtil . sequence ( 0 , len ) ; IntegerArrayQuickSort . sort ( s1 , ( x , y ) -> Double . compare ( adapter . getDouble ( data , x ) , adapter . getDouble ( data , y ) ) ) ; return s1 ;
public class DoubleOutputStream { /** * Write a portion of an array of characters . * @ param bbuf Array of characters * @ param off Offset from which to start writing characters * @ param len Number of characters to write * @ throws IOException */ @ Override public void write ( byte bbuf [ ] , int off , int len ) throws IOException { } }
for ( OutputStream os : oss ) { os . write ( bbuf , off , len ) ; }
public class ParsedScheduleExpression { /** * Returns the next day of the month after < tt > day < / tt > that satisfies * the variableDayOfMonthRanges constraint . * @ param day the current 0 - based day of the month * @ param lastDay the current 0 - based last day of the month * @ param dayOfWeek the current 0 - based day of the week * @ return a value greater than or equal to < tt > day < / tt > */ private int getNextVariableDay ( int day , int lastDay , int dayOfWeek ) // d659945 { } }
int nextDay = ADVANCE_TO_NEXT_MONTH ; for ( int i = 0 ; i < variableDayOfMonthRanges . size ( ) ; i ++ ) { int result = variableDayOfMonthRanges . get ( i ) . getNextDay ( day , lastDay , dayOfWeek ) ; if ( result == day ) { return day ; } nextDay = Math . min ( nextDay , result ) ; } return nextDay ;
public class MinMaxBinaryArrayDoubleEndedHeap { /** * { @ inheritDoc } */ @ Override @ SuppressWarnings ( "unchecked" ) public K deleteMax ( ) { } }
K result ; switch ( size ) { case 0 : throw new NoSuchElementException ( ) ; case 1 : result = array [ 1 ] ; array [ 1 ] = null ; size -- ; break ; case 2 : result = array [ 2 ] ; array [ 2 ] = null ; size -- ; break ; default : if ( comparator == null ) { if ( ( ( Comparable < ? super K > ) array [ 3 ] ) . compareTo ( array [ 2 ] ) > 0 ) { result = array [ 3 ] ; array [ 3 ] = array [ size ] ; array [ size ] = null ; size -- ; if ( size >= 3 ) { fixdownMax ( 3 ) ; } } else { result = array [ 2 ] ; array [ 2 ] = array [ size ] ; array [ size ] = null ; size -- ; fixdownMax ( 2 ) ; } } else { if ( comparator . compare ( array [ 3 ] , array [ 2 ] ) > 0 ) { result = array [ 3 ] ; array [ 3 ] = array [ size ] ; array [ size ] = null ; size -- ; if ( size >= 3 ) { fixdownMaxWithComparator ( 3 ) ; } } else { result = array [ 2 ] ; array [ 2 ] = array [ size ] ; array [ size ] = null ; size -- ; fixdownMaxWithComparator ( 2 ) ; } } break ; } if ( Constants . NOT_BENCHMARK ) { if ( 2 * minCapacity < array . length - 1 && 4 * size < array . length - 1 ) { ensureCapacity ( ( array . length - 1 ) / 2 ) ; } } return result ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcPhysicalQuantity ( ) { } }
if ( ifcPhysicalQuantityEClass == null ) { ifcPhysicalQuantityEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 352 ) ; } return ifcPhysicalQuantityEClass ;
public class UserService { /** * if user token has been saved from previous logins , the method checks if the user token is still valid ; * if user token is not saved , but user logged in , the method checks if the user session is still valid * @ return true , if user token is valid or user is logged in , else false */ public boolean isValidLogin ( ) { } }
String userToken = UserTokenStorageFactory . instance ( ) . getStorage ( ) . get ( ) ; if ( userToken != null && ! userToken . equals ( "" ) ) { return Invoker . < Boolean > invokeSync ( USER_MANAGER_SERVER_ALIAS , "isValidUserToken" , new Object [ ] { userToken } ) ; } else { return CurrentUser ( ) != null ; }
public class FluentCloseableIterable { /** * Returns a fluent iterable whose iterators traverse first the elements of this fluent iterable , * followed by { @ code elements } . */ @ SafeVarargs public final FluentCloseableIterable < T > append ( T ... elements ) { } }
return from ( wrap ( Iterables . concat ( this , asList ( elements ) ) , this ) ) ;
public class ChronoEntity { /** * / * [ deutsch ] * < p > Erstellt eine Kopie dieser Instanz mit dem ge & auml ; nderten * Elementwert . < / p > * @ param element chronological element * @ param value new element value * @ return changed copy of the same type , this instance remains unaffected * @ throws ChronoException if the element is not registered and there * is no element rule for setting the value * @ throws IllegalArgumentException if the value is not valid * @ throws ArithmeticException in case of arithmetic overflow * @ see # isValid ( ChronoElement , Object ) isValid ( ChronoElement , V ) */ public T with ( ChronoElement < Integer > element , int value ) { } }
IntElementRule < T > intRule = this . getChronology ( ) . getIntegerRule ( element ) ; if ( intRule != null ) { return intRule . withValue ( this . getContext ( ) , value , element . isLenient ( ) ) ; } return this . with ( element , Integer . valueOf ( value ) ) ;
public class DescriptionStrategyFactory { /** * Creates description strategy for hh : mm : ss . * @ param bundle - locale * @ return - DescriptionStrategy instance , never null */ public static DescriptionStrategy hhMMssInstance ( final ResourceBundle bundle , final FieldExpression hours , final FieldExpression minutes , final FieldExpression seconds ) { } }
return new TimeDescriptionStrategy ( bundle , hours , minutes , seconds ) ;
public class PlacementDescriptionMarshaller { /** * Marshall the given parameter object . */ public void marshall ( PlacementDescription placementDescription , ProtocolMarshaller protocolMarshaller ) { } }
if ( placementDescription == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( placementDescription . getProjectName ( ) , PROJECTNAME_BINDING ) ; protocolMarshaller . marshall ( placementDescription . getPlacementName ( ) , PLACEMENTNAME_BINDING ) ; protocolMarshaller . marshall ( placementDescription . getAttributes ( ) , ATTRIBUTES_BINDING ) ; protocolMarshaller . marshall ( placementDescription . getCreatedDate ( ) , CREATEDDATE_BINDING ) ; protocolMarshaller . marshall ( placementDescription . getUpdatedDate ( ) , UPDATEDDATE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class KuduDBSchemaManager { /** * ( non - Javadoc ) * @ see com . impetus . kundera . configure . schema . api . AbstractSchemaManager # * initiateClient ( ) */ @ Override protected boolean initiateClient ( ) { } }
for ( String host : hosts ) { if ( host == null || ! StringUtils . isNumeric ( port ) || port . isEmpty ( ) ) { logger . error ( "Host or port should not be null / port should be numeric" ) ; throw new IllegalArgumentException ( "Host or port should not be null / port should be numeric" ) ; } try { client = new KuduClient . KuduClientBuilder ( host + ":" + port ) . build ( ) ; } catch ( Exception e ) { logger . error ( "Database host cannot be resolved, Caused by: " + e . getMessage ( ) ) ; throw new SchemaGenerationException ( "Database host cannot be resolved, Caused by: " + e . getMessage ( ) ) ; } } return true ;
public class DocEnv { /** * Return the ConstructorDoc for a MethodSymbol . * Should be called only on symbols representing constructors . */ public ConstructorDocImpl getConstructorDoc ( MethodSymbol meth ) { } }
assert meth . isConstructor ( ) : "expecting a constructor symbol" ; ConstructorDocImpl result = ( ConstructorDocImpl ) methodMap . get ( meth ) ; if ( result != null ) return result ; result = new ConstructorDocImpl ( this , meth ) ; methodMap . put ( meth , result ) ; return result ;
public class PropertiesIO { /** * Read properties file . * @ param absolutePath absolute path in file system . */ public static Properties load ( String absolutePath ) { } }
Properties configs = new Properties ( ) ; if ( absolutePath == null ) { return configs ; } File configFile = new File ( absolutePath ) ; FileInputStream inStream = null ; try { inStream = new FileInputStream ( configFile ) ; configs . load ( new UnicodeInputStream ( inStream ) . skipBOM ( ) ) ; } catch ( IOException e ) { LOGGER . warn ( "Load " + absolutePath + " error!" , e ) ; } finally { try { if ( inStream != null ) { inStream . close ( ) ; } } catch ( IOException ignore ) { // do nothing . } } return configs ;
public class CreateLagRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CreateLagRequest createLagRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( createLagRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createLagRequest . getNumberOfConnections ( ) , NUMBEROFCONNECTIONS_BINDING ) ; protocolMarshaller . marshall ( createLagRequest . getLocation ( ) , LOCATION_BINDING ) ; protocolMarshaller . marshall ( createLagRequest . getConnectionsBandwidth ( ) , CONNECTIONSBANDWIDTH_BINDING ) ; protocolMarshaller . marshall ( createLagRequest . getLagName ( ) , LAGNAME_BINDING ) ; protocolMarshaller . marshall ( createLagRequest . getConnectionId ( ) , CONNECTIONID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CodahaleHealthChecker { /** * Register Dropwizard health checks . * @ param pool the pool to register health checks for * @ param hikariConfig the pool configuration * @ param registry the HealthCheckRegistry into which checks will be registered */ public static void registerHealthChecks ( final HikariPool pool , final HikariConfig hikariConfig , final HealthCheckRegistry registry ) { } }
final Properties healthCheckProperties = hikariConfig . getHealthCheckProperties ( ) ; final MetricRegistry metricRegistry = ( MetricRegistry ) hikariConfig . getMetricRegistry ( ) ; final long checkTimeoutMs = Long . parseLong ( healthCheckProperties . getProperty ( "connectivityCheckTimeoutMs" , String . valueOf ( hikariConfig . getConnectionTimeout ( ) ) ) ) ; registry . register ( MetricRegistry . name ( hikariConfig . getPoolName ( ) , "pool" , "ConnectivityCheck" ) , new ConnectivityHealthCheck ( pool , checkTimeoutMs ) ) ; final long expected99thPercentile = Long . parseLong ( healthCheckProperties . getProperty ( "expected99thPercentileMs" , "0" ) ) ; if ( metricRegistry != null && expected99thPercentile > 0 ) { SortedMap < String , Timer > timers = metricRegistry . getTimers ( ( name , metric ) -> name . equals ( MetricRegistry . name ( hikariConfig . getPoolName ( ) , "pool" , "Wait" ) ) ) ; if ( ! timers . isEmpty ( ) ) { final Timer timer = timers . entrySet ( ) . iterator ( ) . next ( ) . getValue ( ) ; registry . register ( MetricRegistry . name ( hikariConfig . getPoolName ( ) , "pool" , "Connection99Percent" ) , new Connection99Percent ( timer , expected99thPercentile ) ) ; } }
public class Recycler { /** * Recycle an object for reuse by a subsequent call to { @ link # acquire ( ) } . If the object is an instance of * { @ link Resettable } , then { @ link Resettable # reset ( ) } will be called on the instance before recycling it . * @ param instance * the instance to recycle . * @ throws IllegalArgumentException * if the object instance was not originally obtained from this { @ link Recycler } . */ public final void recycle ( final T instance ) { } }
if ( instance != null ) { usedInstances . remove ( instance ) ; if ( instance instanceof Resettable ) { ( ( Resettable ) instance ) . reset ( ) ; } unusedInstances . add ( instance ) ; }
public class AndroidMobileCommandHelper { /** * This method forms a { @ link Map } of parameters for the getting of the current package . * @ return a key - value pair . The key is the command name . The value is a { @ link Map } command arguments . */ public static Map . Entry < String , Map < String , ? > > currentPackageCommand ( ) { } }
return new AbstractMap . SimpleEntry < > ( GET_CURRENT_PACKAGE , ImmutableMap . of ( ) ) ;
public class PortletAuthenticationProcessingFilter { /** * Extracts the principal information by checking the following in order : * { @ link javax . portlet . PortletRequest # getRemoteUser ( ) } * { @ link javax . portlet . PortletRequest # getUserPrincipal ( ) } * { @ link javax . portlet . PortletRequest # USER _ INFO } * Returns null if no principal is found * @ param request a { @ link javax . portlet . PortletRequest } object . * @ return a { @ link java . lang . Object } object . */ @ SuppressWarnings ( "unchecked" ) protected Object getPreAuthenticatedPrincipal ( PortletRequest request ) { } }
// first try getRemoteUser ( ) String remoteUser = request . getRemoteUser ( ) ; if ( remoteUser != null ) { return remoteUser ; } // next try getUserPrincipal ( ) Principal userPrincipal = request . getUserPrincipal ( ) ; if ( userPrincipal != null ) { String userPrincipalName = userPrincipal . getName ( ) ; if ( userPrincipalName != null ) { return userPrincipalName ; } } // last try entries in USER _ INFO if any attributes were defined if ( this . userNameAttributes != null ) { Map < String , String > userInfo = null ; try { userInfo = ( Map < String , String > ) request . getAttribute ( PortletRequest . USER_INFO ) ; } catch ( Exception e ) { logger . warn ( "unable to retrieve USER_INFO map from portlet request" , e ) ; } if ( userInfo != null ) { Iterator < String > i = this . userNameAttributes . iterator ( ) ; while ( i . hasNext ( ) ) { Object principal = ( String ) userInfo . get ( i . next ( ) ) ; if ( principal != null ) { return principal ; } } } } // none found so return null return null ;
public class InputStreamInterceptingFilter { /** * Injects a " blob " instruction into the outbound Guacamole protocol * stream , as if sent by the connected client . " blob " instructions are used * to send chunks of data along a stream . * @ param index * The index of the stream that this " blob " instruction relates to . * @ param blob * The chunk of data to send within the " blob " instruction . */ private void sendBlob ( String index , byte [ ] blob ) { } }
// Send " blob " containing provided data sendInstruction ( new GuacamoleInstruction ( "blob" , index , BaseEncoding . base64 ( ) . encode ( blob ) ) ) ;
public class AbstractMain { /** * This method is invoked if an { @ link Exception } occurred . It implements how to handle the error . You may override to * add a custom handling . * @ param exception is the actual error that occurred . * @ param parser is the { @ link CliParser } . * @ return the error - code ( NOT { @ code 0 } ) . */ protected int handleError ( Exception exception , CliParser parser ) { } }
int exitCode ; AppendableWriter writer = new AppendableWriter ( this . standardError ) ; PrintWriter printStream = new PrintWriter ( writer ) ; if ( exception instanceof CliException ) { // TODO : NLS printStream . println ( "Error: " + exception . getMessage ( ) ) ; printStream . println ( ) ; printStream . flush ( ) ; printHelp ( parser ) ; exitCode = 1 ; } else { printStream . println ( "An unexpected error has occurred:" ) ; exception . printStackTrace ( printStream ) ; exitCode = - 1 ; } printStream . flush ( ) ; return exitCode ;
public class JsLocalizer { /** * Returns the name of the destination associated with the supplied * localization point . * @ param lp a localization point proxy . * @ return the identifier of the destination associated with the supplied * localization point proxy . */ private String getMasterMapKey ( LWMConfig lp ) { } }
String key = null ; String lpIdentifier = ( ( SIBLocalizationPoint ) lp ) . getIdentifier ( ) ; key = lpIdentifier . substring ( 0 , lpIdentifier . indexOf ( "@" ) ) ; return key ;
public class AWSCloud9Client { /** * Deletes an AWS Cloud9 development environment . If an Amazon EC2 instance is connected to the environment , also * terminates the instance . * @ param deleteEnvironmentRequest * @ return Result of the DeleteEnvironment operation returned by the service . * @ throws BadRequestException * The target request is invalid . * @ throws ConflictException * A conflict occurred . * @ throws NotFoundException * The target resource cannot be found . * @ throws ForbiddenException * An access permissions issue occurred . * @ throws TooManyRequestsException * Too many service requests were made over the given time period . * @ throws LimitExceededException * A service limit was exceeded . * @ throws InternalServerErrorException * An internal server error occurred . * @ sample AWSCloud9 . DeleteEnvironment * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / cloud9-2017-09-23 / DeleteEnvironment " target = " _ top " > AWS API * Documentation < / a > */ @ Override public DeleteEnvironmentResult deleteEnvironment ( DeleteEnvironmentRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDeleteEnvironment ( request ) ;
public class MathUtil { /** * Ternary min , < i > without < / i > handling of special values . * Because of the lack of special case handling , this is faster than * { @ link Math # min } . But usually , it should be written inline . * @ param a First value * @ param b Second value * @ param c Third value * @ return minimum */ public static int min ( int a , int b , int c ) { } }
return a <= b ? ( a <= c ? a : c ) : ( b <= c ? b : c ) ;
public class PermissionsRESTController { /** * Provide a JSON view of all known permission owners registered with uPortal . */ @ PreAuthorize ( "hasPermission('ALL', 'java.lang.String', new org.apereo.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))" ) @ RequestMapping ( value = "/permissions/owners.json" , method = RequestMethod . GET ) public ModelAndView getOwners ( ) { } }
// get a list of all currently defined permission owners List < IPermissionOwner > owners = permissionOwnerDao . getAllPermissionOwners ( ) ; ModelAndView mv = new ModelAndView ( ) ; mv . addObject ( "owners" , owners ) ; mv . setViewName ( "json" ) ; return mv ;
public class PolicyEventsInner { /** * Gets OData metadata XML document . * @ param scope A valid scope , i . e . management group , subscription , resource group , or resource ID . Scope used has no effect on metadata returned . * @ 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 < String > getMetadataAsync ( String scope , final ServiceCallback < String > serviceCallback ) { } }
return ServiceFuture . fromResponse ( getMetadataWithServiceResponseAsync ( scope ) , serviceCallback ) ;
public class IncrementPoolOnTimeoutConnectionAcquiringStrategy { /** * { @ inheritDoc } */ @ Override public Connection getConnection ( ConnectionRequestContext requestContext ) throws SQLException { } }
do { int expectingMaxSize = poolAdapter . getMaxPoolSize ( ) ; try { long startNanos = System . nanoTime ( ) ; Connection connection = getConnectionFactory ( ) . getConnection ( requestContext ) ; long endNanos = System . nanoTime ( ) ; long connectionAcquireDurationMillis = TimeUnit . NANOSECONDS . toMillis ( endNanos - startNanos ) ; if ( connectionAcquireDurationMillis > timeoutMillis ) { LOGGER . warn ( "Connection was acquired in {} millis, timeoutMillis is set to {}" , connectionAcquireDurationMillis , timeoutMillis ) ; int maxPoolSize = poolAdapter . getMaxPoolSize ( ) ; if ( maxPoolSize < maxOverflowPoolSize ) { if ( ! incrementPoolSize ( expectingMaxSize ) ) { LOGGER . warn ( "Can't acquire connection, pool size has already overflown to its max size." ) ; } } else { LOGGER . info ( "Pool size has already overflown to its max size of {}" , maxPoolSize ) ; } } return connection ; } catch ( AcquireTimeoutException e ) { if ( ! incrementPoolSize ( expectingMaxSize ) ) { LOGGER . warn ( "Can't acquire connection due to adaptor timeout, pool size has already overflown to its max size." ) ; throw e ; } } } while ( true ) ;
public class RequestBuilder { /** * Sends an HTTP request based on the current builder configuration with the * specified data and callback . If no request headers have been set , the * header " Content - Type " will be used with a value of " text / plain ; * charset = utf - 8 " . This method does not cache < code > requestData < / code > or * < code > callback < / code > . * @ param requestData the data to send as part of the request * @ param callback the response handler to be notified when the request fails * or completes * @ return a { @ link Request } object that can be used to track the request * @ throws NullPointerException if < code > callback < / code > < code > null < / code > */ public Request sendRequest ( String requestData , RequestCallback callback ) throws RequestException { } }
StringValidator . throwIfNull ( "callback" , callback ) ; return doSend ( requestData , callback ) ;
public class MiniTemplatorParser { /** * Skips blanks ( white space ) in string s starting at position p . */ private static int skipBlanks ( String s , int p ) { } }
while ( p < s . length ( ) && Character . isWhitespace ( s . charAt ( p ) ) ) p ++ ; return p ;
public class LdiSrl { /** * Get the index of the last - found delimiter . * < pre > * indexOfLast ( " foo . bar / baz . qux " , " . " , " / " ) * returns the index of " . qux " * < / pre > * @ param str The target string . ( NotNull ) * @ param delimiters The array of delimiters . ( NotNull ) * @ return The information of index . ( NullAllowed : if delimiter not found ) */ public static IndexOfInfo indexOfLast ( final String str , final String ... delimiters ) { } }
return doIndexOfLast ( false , str , delimiters ) ;
public class Animators { /** * Create a backported Animator for * { @ code @ android : anim / progress _ indeterminate _ rotation _ material } . * @ param target The object whose properties are to be animated . * @ return An Animator object that is set up to behave the same as the its native counterpart . */ @ NonNull public static Animator createIndeterminateRotation ( @ NonNull Object target ) { } }
@ SuppressLint ( "ObjectAnimatorBinding" ) ObjectAnimator rotationAnimator = ObjectAnimator . ofFloat ( target , "rotation" , 0 , 720 ) ; rotationAnimator . setDuration ( 6665 ) ; rotationAnimator . setInterpolator ( Interpolators . LINEAR . INSTANCE ) ; rotationAnimator . setRepeatCount ( ValueAnimator . INFINITE ) ; return rotationAnimator ;
public class AtomicReferenceFieldUpdater { /** * Creates and returns an updater for objects with the given field . * The Class arguments are needed to check that reflective types and * generic types match . * @ param tclass the class of the objects holding the field * @ param vclass the class of the field * @ param fieldName the name of the field to be updated * @ param < U > the type of instances of tclass * @ param < W > the type of instances of vclass * @ return the updater * @ throws ClassCastException if the field is of the wrong type * @ throws IllegalArgumentException if the field is not volatile * @ throws RuntimeException with a nested reflection - based * exception if the class does not hold field or is the wrong type , * or the field is inaccessible to the caller according to Java language * access control */ @ CallerSensitive public static < U , W > AtomicReferenceFieldUpdater < U , W > newUpdater ( Class < U > tclass , Class < W > vclass , String fieldName ) { } }
return new AtomicReferenceFieldUpdaterImpl < U , W > ( tclass , vclass , fieldName , null ) ; /* J2ObjC : Call stack not available . return new AtomicReferenceFieldUpdaterImpl < U , W > ( tclass , vclass , fieldName , VMStack . getStackClass1 ( ) ) ; / / android - changed */
public class RelatedItemSearchServlet { /** * string */ private static String getId ( String path ) { } }
log . debug ( "obtaining id from endpoint {}" , path ) ; if ( path == null ) return "" ; int index = path . lastIndexOf ( '/' ) ; return ( index == - 1 ) ? "" : path . substring ( index + 1 ) ;
public class TextComponent { /** * Creates a text component with the content of { @ link String # valueOf ( char ) } . * @ param value the char value * @ return the component */ static @ NonNull TextComponent of ( final char value ) { } }
if ( value == '\n' ) return Component0 . NEWLINE ; if ( value == ' ' ) return Component0 . SPACE ; return TextComponent . of ( String . valueOf ( value ) ) ;
public class Smaz { /** * Decompress byte array from compress back into String * @ param strBytes * @ return decompressed String * @ see Smaz # compress ( String ) */ public static String decompress ( final byte [ ] strBytes ) { } }
if ( strBytes [ 0 ] == UNCOMPRESSED_FLAG ) { return new String ( strBytes , 1 , strBytes . length , Charsets . UTF_8 ) ; } final StringBuilder out = new StringBuilder ( ) ; for ( int i = 0 ; i < strBytes . length ; i ++ ) { final char b = ( char ) ( 0xFF & strBytes [ i ] ) ; if ( b == 254 ) { out . append ( ( char ) strBytes [ ++ i ] ) ; } else if ( b == 255 ) { final int length = 0xFF & strBytes [ ++ i ] ; for ( int j = 1 ; j <= length ; j ++ ) { out . append ( ( char ) strBytes [ i + j ] ) ; } i += length ; } else { final int loc = 0xFF & b ; out . append ( REVERSE_CODEBOOK [ loc ] ) ; } } return out . toString ( ) ;
public class ParameterImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eSet ( int featureID , Object newValue ) { } }
switch ( featureID ) { case SimpleAntlrPackage . PARAMETER__TYPE : setType ( ( String ) newValue ) ; return ; case SimpleAntlrPackage . PARAMETER__NAME : setName ( ( String ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ;
public class ReverseState { /** * Update the state with the next certificate added to the path . * @ param cert the certificate which is used to update the state */ public void updateState ( X509Certificate cert ) throws CertificateException , IOException , CertPathValidatorException { } }
if ( cert == null ) { return ; } /* update subject DN */ subjectDN = cert . getSubjectX500Principal ( ) ; /* check for key needing to inherit alg parameters */ X509CertImpl icert = X509CertImpl . toImpl ( cert ) ; PublicKey newKey = cert . getPublicKey ( ) ; if ( PKIX . isDSAPublicKeyWithoutParams ( newKey ) ) { newKey = BasicChecker . makeInheritedParamsKey ( newKey , pubKey ) ; } /* update subject public key */ pubKey = newKey ; /* * if this is a trusted cert ( init = = true ) , then we * don ' t update any of the remaining fields */ if ( init ) { init = false ; return ; } /* update subject key identifier */ subjKeyId = icert . getSubjectKeyIdentifierExtension ( ) ; /* update crlSign */ crlSign = RevocationChecker . certCanSignCrl ( cert ) ; /* update current name constraints */ if ( nc != null ) { nc . merge ( icert . getNameConstraintsExtension ( ) ) ; } else { nc = icert . getNameConstraintsExtension ( ) ; if ( nc != null ) { // Make sure we do a clone here , because we ' re probably // going to modify this object later and we don ' t want to // be sharing it with a Certificate object ! nc = ( NameConstraintsExtension ) nc . clone ( ) ; } } /* update policy state variables */ explicitPolicy = PolicyChecker . mergeExplicitPolicy ( explicitPolicy , icert , false ) ; policyMapping = PolicyChecker . mergePolicyMapping ( policyMapping , icert ) ; inhibitAnyPolicy = PolicyChecker . mergeInhibitAnyPolicy ( inhibitAnyPolicy , icert ) ; certIndex ++ ; /* * Update remaining CA certs */ remainingCACerts = ConstraintsChecker . mergeBasicConstraints ( cert , remainingCACerts ) ; init = false ;
public class MediaHttpUploader { /** * Sets the maximum size of individual chunks that will get uploaded by single HTTP requests . The * default value is { @ link # DEFAULT _ CHUNK _ SIZE } . * The minimum allowable value is { @ link # MINIMUM _ CHUNK _ SIZE } and the specified chunk size must be * a multiple of { @ link # MINIMUM _ CHUNK _ SIZE } . */ public MediaHttpUploader setChunkSize ( int chunkSize ) { } }
Preconditions . checkArgument ( chunkSize > 0 && chunkSize % MINIMUM_CHUNK_SIZE == 0 , "chunkSize" + " must be a positive multiple of " + MINIMUM_CHUNK_SIZE + "." ) ; this . chunkSize = chunkSize ; return this ;
public class BasicFunctionsRuntime { /** * Returns a list of all the keys in the given map . For the JavaSource variant , while the function * signature is ? instead of legacy _ object _ map . */ public static List < SoyValue > keys ( SoyValue sv ) { } }
SoyLegacyObjectMap map = ( SoyLegacyObjectMap ) sv ; List < SoyValue > list = new ArrayList < > ( map . getItemCnt ( ) ) ; Iterables . addAll ( list , map . getItemKeys ( ) ) ; return list ;
public class SecurityUtils { /** * Create a proxied user based on the explicit user name , taking other parameters necessary from * properties file . */ public static synchronized UserGroupInformation getProxiedUser ( final String toProxy , final Properties prop , final Logger log , final Configuration conf ) throws IOException { } }
if ( conf == null ) { throw new IllegalArgumentException ( "conf can't be null" ) ; } UserGroupInformation . setConfiguration ( conf ) ; if ( toProxy == null ) { throw new IllegalArgumentException ( "toProxy can't be null" ) ; } if ( loginUser == null ) { log . info ( "No login user. Creating login user" ) ; final String keytab = verifySecureProperty ( prop , PROXY_KEYTAB_LOCATION , log ) ; final String proxyUser = verifySecureProperty ( prop , PROXY_USER , log ) ; UserGroupInformation . loginUserFromKeytab ( proxyUser , keytab ) ; loginUser = UserGroupInformation . getLoginUser ( ) ; log . info ( "Logged in with user " + loginUser ) ; } else { log . info ( "loginUser (" + loginUser + ") already created, refreshing tgt." ) ; loginUser . checkTGTAndReloginFromKeytab ( ) ; } return UserGroupInformation . createProxyUser ( toProxy , loginUser ) ;
public class UserService { /** * Registers a new user . Initially , the user will be inactive . An email with * an activation link will be sent to the user . * @ param user A user with an UNencrypted password ( ! ) * @ param request * @ throws Exception */ public E registerUser ( E user , HttpServletRequest request ) throws Exception { } }
String email = user . getEmail ( ) ; // check if a user with the email already exists E existingUser = dao . findByEmail ( email ) ; if ( existingUser != null ) { final String errorMessage = "User with eMail '" + email + "' already exists." ; LOG . info ( errorMessage ) ; throw new Exception ( errorMessage ) ; } user = ( E ) this . persistNewUser ( user , true ) ; // create a token for the user and send an email with an " activation " link registrationTokenService . sendRegistrationActivationMail ( request , user ) ; return user ;
public class FamilyVisitor { /** * Visit a Child . We track this and , if set , the Person who is the * child . * @ see GedObjectVisitor # visit ( Child ) */ @ Override public void visit ( final Child child ) { } }
final Person person = child . getChild ( ) ; if ( child . isSet ( ) && person . isSet ( ) ) { childList . add ( child ) ; children . add ( person ) ; }
public class IncomeRange { /** * Gets the incomeRangeType value for this IncomeRange . * @ return incomeRangeType * < span class = " constraint ReadOnly " > This field is read only and * will be ignored when sent to the API . < / span > */ public com . google . api . ads . adwords . axis . v201809 . cm . IncomeRangeIncomeRangeType getIncomeRangeType ( ) { } }
return incomeRangeType ;
public class RETURN { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div > * < div color = ' red ' style = " font - size : 18px ; color : red " > < i > return the size of a collection < / i > < / div > * < div color = ' red ' style = " font - size : 18px ; color : red " > < i > e . g . < b > RETURN . count ( ) . value ( p . nodes ( ) ) < / b > < / i > < / div > * < br / > */ public static RCount count ( ) { } }
RCount ret = RFactory . count ( ) ; ASTNode an = APIObjectAccess . getAstNode ( ret ) ; an . setClauseType ( ClauseType . RETURN ) ; return ret ;
public class ApiOvhStore { /** * Add CORS support on your container * REST : POST / store / document / cors * @ param origin [ required ] Allow this origin * API beta */ public void document_cors_POST ( String origin ) throws IOException { } }
String qPath = "/store/document/cors" ; StringBuilder sb = path ( qPath ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "origin" , origin ) ; exec ( qPath , "POST" , sb . toString ( ) , o ) ;
public class ZWaveMultiInstanceCommandClass { /** * Handles Multi Channel Capability Report message . Handles Report on * an endpoint and adds command classes to the endpoint . * @ param serialMessage the serial message to process . * @ param offset the offset at which to start processing . */ private void handleMultiChannelCapabilityReportResponse ( SerialMessage serialMessage , int offset ) { } }
logger . debug ( "Process Multi-channel capability Report" ) ; int receivedEndpointId = serialMessage . getMessagePayloadByte ( offset ) & 0x7F ; boolean dynamic = ( ( serialMessage . getMessagePayloadByte ( offset ) & 0x80 ) != 0 ) ; int genericDeviceClass = serialMessage . getMessagePayloadByte ( offset + 1 ) ; int specificDeviceClass = serialMessage . getMessagePayloadByte ( offset + 2 ) ; logger . debug ( "Endpoints are the same device class = {}" , endpointsAreTheSameDeviceClass ? "true" : false ) ; // Loop either all endpoints , or just set command classes on one , depending on whether // all endpoints have the same device class . int startId = this . endpointsAreTheSameDeviceClass ? 1 : receivedEndpointId ; int endId = this . endpointsAreTheSameDeviceClass ? this . endpoints . size ( ) : receivedEndpointId ; boolean supportsBasicCommandClass = this . getNode ( ) . supportsCommandClass ( CommandClass . BASIC ) ; for ( int endpointId = startId ; endpointId <= endId ; endpointId ++ ) { ZWaveEndpoint endpoint = this . endpoints . get ( endpointId ) ; if ( endpoint == null ) { logger . error ( "Endpoint {} not found on node {}. Cannot set command classes." , endpoint , this . getNode ( ) . getNodeId ( ) ) ; continue ; } ZWaveDeviceClass . Basic basic = this . getNode ( ) . getDeviceClass ( ) . getBasicDeviceClass ( ) ; ZWaveDeviceClass . Generic generic = ZWaveDeviceClass . Generic . getGeneric ( genericDeviceClass ) ; if ( generic == null ) { logger . error ( String . format ( "Endpoint %d has invalid device class. generic = 0x%02x, specific = 0x%02x." , endpoint , genericDeviceClass , specificDeviceClass ) ) ; continue ; } ZWaveDeviceClass . Specific specific = ZWaveDeviceClass . Specific . getSpecific ( generic , specificDeviceClass ) ; if ( specific == null ) { logger . error ( String . format ( "Endpoint %d has invalid device class. generic = 0x%02x, specific = 0x%02x." , endpoint , genericDeviceClass , specificDeviceClass ) ) ; continue ; } logger . debug ( "Endpoint Id = {}" , endpointId ) ; logger . debug ( "Endpoints is dynamic = {}" , dynamic ? "true" : false ) ; logger . debug ( String . format ( "Basic = %s 0x%02x" , basic . getLabel ( ) , basic . getKey ( ) ) ) ; logger . debug ( String . format ( "Generic = %s 0x%02x" , generic . getLabel ( ) , generic . getKey ( ) ) ) ; logger . debug ( String . format ( "Specific = %s 0x%02x" , specific . getLabel ( ) , specific . getKey ( ) ) ) ; ZWaveDeviceClass deviceClass = endpoint . getDeviceClass ( ) ; deviceClass . setBasicDeviceClass ( basic ) ; deviceClass . setGenericDeviceClass ( generic ) ; deviceClass . setSpecificDeviceClass ( specific ) ; // add basic command class , if it ' s also supported by the parent node . if ( supportsBasicCommandClass ) { ZWaveCommandClass commandClass = new ZWaveBasicCommandClass ( this . getNode ( ) , this . getController ( ) , endpoint ) ; endpoint . addCommandClass ( commandClass ) ; } for ( int i = 0 ; i < serialMessage . getMessagePayload ( ) . length - offset - 3 ; i ++ ) { int data = serialMessage . getMessagePayloadByte ( offset + 3 + i ) ; if ( data == 0xef ) { // TODO : Implement control command classes break ; } logger . debug ( String . format ( "Adding command class 0x%02X to the list of supported command classes." , data ) ) ; ZWaveCommandClass commandClass = ZWaveCommandClass . getInstance ( data , this . getNode ( ) , this . getController ( ) , endpoint ) ; if ( commandClass == null ) { continue ; } endpoint . addCommandClass ( commandClass ) ; ZWaveCommandClass parentClass = this . getNode ( ) . getCommandClass ( commandClass . getCommandClass ( ) ) ; // copy version info to endpoint classes . if ( parentClass != null ) { commandClass . setVersion ( parentClass . getVersion ( ) ) ; } } } if ( this . endpointsAreTheSameDeviceClass ) // advance node stage . this . getNode ( ) . advanceNodeStage ( ) ; else { for ( ZWaveEndpoint ep : this . endpoints . values ( ) ) { if ( ep . getDeviceClass ( ) . getBasicDeviceClass ( ) == ZWaveDeviceClass . Basic . NOT_KNOWN ) // only advance node stage when all endpoints are known . return ; } // advance node stage . this . getNode ( ) . advanceNodeStage ( ) ; }
public class OperationsApi { /** * PostImport . * postImport * @ return ApiResponse & lt ; PostImportResponse & gt ; * @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */ public ApiResponse < PostImportResponse > postImportWithHttpInfo ( ) throws ApiException { } }
com . squareup . okhttp . Call call = postImportValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < PostImportResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ;
public class LoggerHelpers { /** * Traces the fact that a method entry has occurred . * @ param log The Logger to log to . * @ param context Identifying context for the operation . For example , this can be used to differentiate between * different instances of the same object . * @ param method The name of the method . * @ param args The arguments to the method . * @ return A generated identifier that can be used to correlate this traceEnter with its corresponding traceLeave . * This is usually generated from the current System time , and when used with traceLeave it can be used to log * elapsed call times . */ public static long traceEnterWithContext ( Logger log , String context , String method , Object ... args ) { } }
if ( ! log . isTraceEnabled ( ) ) { return 0 ; } long time = CURRENT_TIME . get ( ) ; log . trace ( "ENTER {}::{}@{} {}." , context , method , time , args ) ; return time ;
public class PolicyAssignmentsInner { /** * Deletes a policy assignment . * @ param scope The scope of the policy assignment . * @ param policyAssignmentName The name of the policy assignment to delete . * @ 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 < PolicyAssignmentInner > deleteAsync ( String scope , String policyAssignmentName , final ServiceCallback < PolicyAssignmentInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( deleteWithServiceResponseAsync ( scope , policyAssignmentName ) , serviceCallback ) ;
public class ParticipationStatus { /** * Searches for a parameter value that is defined as a static constant in * this class . * @ param value the parameter value * @ return the object or null if not found */ public static ParticipationStatus find ( String value ) { } }
if ( "NEEDS ACTION" . equalsIgnoreCase ( value ) ) { // vCal return NEEDS_ACTION ; } return enums . find ( value ) ;
public class JSONBuilder { /** * Delivers the correct JSON Object for outgoings * @ param outgoings * @ throws org . json . JSONException */ private static JSONArray parseOutgoings ( ArrayList < Shape > outgoings ) throws JSONException { } }
if ( outgoings != null ) { JSONArray outgoingsArray = new JSONArray ( ) ; for ( Shape outgoing : outgoings ) { JSONObject outgoingObject = new JSONObject ( ) ; outgoingObject . put ( "resourceId" , outgoing . getResourceId ( ) . toString ( ) ) ; outgoingsArray . put ( outgoingObject ) ; } return outgoingsArray ; } return new JSONArray ( ) ;
public class GitlabAPI { /** * Resolve or unresolve a whole discussion of a merge request . * @ param mergeRequest The merge request of the discussion . * @ param discussionId The id of the discussion to resolve . * @ param resolved Resolve or unresolve the note . * @ return The discussion object . * @ throws IOException on a GitLab api call error */ public GitlabDiscussion resolveDiscussion ( GitlabMergeRequest mergeRequest , int discussionId , boolean resolved ) throws IOException { } }
String tailUrl = GitlabProject . URL + "/" + mergeRequest . getProjectId ( ) + GitlabMergeRequest . URL + "/" + mergeRequest . getIid ( ) + GitlabDiscussion . URL + "/" + discussionId ; return retrieve ( ) . method ( PUT ) . with ( "resolved" , resolved ) . to ( tailUrl , GitlabDiscussion . class ) ;
public class FileRecorder { /** * Determines if the file should be recorded based on the given * configuration . Note that additional filtering may happen in monitor ( s ) , * e . g . , temp files . * @ param file * File name to check * @ return True if file should be recorded , false otherwise */ protected boolean isRelevant ( String file ) { } }
if ( mExcludes != null && mExcludes . matcher ( file ) . find ( ) ) { return false ; } if ( mIncludes != null && ! mIncludes . matcher ( file ) . find ( ) ) { return false ; } return true ;
public class ApplicationErrorUtils { /** * Returns a stack for the provided exception , trimmed to exclude * internal classes ( except for the first ones in a group ) */ public static String getTrimmedStackHtml ( Throwable ex ) { } }
StringBuilder buffer = new StringBuilder ( ) ; TruncatableThrowable niceException = new TruncatableThrowable ( ex ) ; // add link back to tools if property is set String toolsLink = System . getProperty ( "was4d.error.page" ) ; // For security , only add obvious branding when using the tools // We may wish to check the removeServerHeader instead , in future boolean isAnonymous = toolsLink == null ; BufferedReader reader = null ; try { final String errorHtml ; if ( ! isAnonymous ) { errorHtml = "pretty-error.html" ; } else { errorHtml = "minimal-error.html" ; } reader = new BufferedReader ( new InputStreamReader ( ApplicationErrorUtils . class . getResourceAsStream ( errorHtml ) , "UTF-8" ) ) ; for ( String line = reader . readLine ( ) ; line != null ; line = reader . readLine ( ) ) { if ( line . contains ( "{toolsLink}" ) ) { line = line . replace ( "{toolsLink}" , "http://" + toolsLink + "/" ) ; } buffer . append ( line ) ; buffer . append ( "\r\n" ) ; if ( line . contains ( "id=\"box\"" ) ) { // Guess we should have NLSed this title - only show it when tools are active if ( toolsLink != null ) { buffer . append ( "<div id=\"title\">Application Error</div>" ) ; } StackTraceElement topSte = niceException . getStackTraceEliminatingDuplicateFrames ( ) [ 0 ] ; String failingClassAndLine = topSte . getClassName ( ) + "." + topSte . getMethodName ( ) + "():" + topSte . getLineNumber ( ) ; // add the error message with link to failing source line final String linkOpener ; final String linkCloser ; if ( toolsLink != null ) { linkOpener = "<a href=\"javascript:IDELink('" + failingClassAndLine + "')\">" ; linkCloser = "</a>" ; } else { linkOpener = "" ; linkCloser = "" ; } final String key = "SRVE0777E" ; // The message would normally format the exception , but that ' s the opposite of what we // want , so pass through a blank argument as the last parameter String exceptionText = "" ; // Rely on our knowledge of the message parameters , and the fact they won ' t change order in different locales , // to tack anchor elements onto the beginning and end of what will turn into the formatted class name String defaultString = "SRVE0777E: Exception thrown by application class ''{0}.{1}:{2}''\n{3}" ; String formatted = nls . getFormattedMessage ( key , new Object [ ] { linkOpener + topSte . getClassName ( ) , topSte . getMethodName ( ) , topSte . getLineNumber ( ) + linkCloser , exceptionText } , defaultString ) ; // If we ' re trying to not advertise the server identity , strip off the key from the message if ( isAnonymous ) { int keyIndex = formatted . indexOf ( key ) ; if ( keyIndex >= 0 ) { // Strip off the key and the colon formatted = formatted . substring ( keyIndex + key . length ( ) + 1 ) ; } } buffer . append ( "\n<div id=\"error\">" ) ; buffer . append ( formatted ) ; buffer . append ( "</div>" ) ; // print exception name and message buffer . append ( "\n<div id=\"code\">" ) ; printException ( niceException , toolsLink , buffer ) ; buffer . append ( "\n</div>\n" ) ; } } } catch ( UnsupportedEncodingException e ) { // This can ' t happen because JVMs are required to support UTF - 8 } catch ( IOException e ) { // TODO handle this } finally { if ( reader != null ) { try { reader . close ( ) ; } catch ( IOException e ) { // I don ' t care about this since we are doing tidy up . } } } return buffer . toString ( ) ;
public class ArrayUtil { /** * 将object数组转换为原始类型数组 * @ param array eg . Integer [ ] , Boolean [ ] , Double [ ] * @ return eg . int [ ] , boolean [ ] , double [ ] */ public static Object toPrimitiveArray ( Object [ ] array ) { } }
Class primitiveType ; if ( array . length > 0 ) { LOG . debug ( "很可能array是用new Object[length]()构造的,这个时候array.getClass().getComponentType()返回的是Object类型,这不是我们期望的" + "我们希望使用元素的实际类型,这里有一个风险点,即数组类型不一致,后面可能就会抛出类型转换异常" ) ; primitiveType = Reflection . getPrimitiveType ( array [ 0 ] . getClass ( ) ) ; } else { primitiveType = Reflection . getPrimitiveType ( array . getClass ( ) . getComponentType ( ) ) ; } Object primitiveArray = Array . newInstance ( primitiveType , array . length ) ; for ( int i = 0 ; i < array . length ; i ++ ) { Array . set ( primitiveArray , i , array [ i ] ) ; } return primitiveArray ;
public class SqlEntityQueryImpl { /** * { @ inheritDoc } * @ see jp . co . future . uroborosql . fluent . SqlEntityQuery # asc ( java . lang . String , jp . co . future . uroborosql . fluent . SqlEntityQuery . Nulls ) */ @ Override public SqlEntityQuery < E > asc ( final String col , final Nulls nulls ) { } }
this . sortOrders . add ( new SortOrder ( col , Order . ASCENDING , nulls ) ) ; return this ;
public class RegExAnnotator { /** * Acquires references to CAS Type and Feature objects that are later used during the * { @ link # process ( CAS ) } method . */ public void typeSystemInit ( TypeSystem aTypeSystem ) throws AnalysisEngineProcessException { } }
// initialize types for the regex concepts if ( this . regexConcepts != null ) { try { for ( int i = 0 ; i < this . regexConcepts . length ; i ++ ) { ( ( Concept_impl ) this . regexConcepts [ i ] ) . typeInit ( aTypeSystem ) ; } } catch ( ResourceInitializationException ex ) { throw new RegexAnnotatorProcessException ( ex ) ; } }
public class Vector2D { /** * Calculate the distance between 2 vector by using Pythagoras ' formula . * @ param vector2d * The other vector . * @ returns The distance between these 2 vectors as a Double . */ public double distance ( Vector2D vector2d ) { } }
double a = vector2d . x - x ; double b = vector2d . y - y ; return Math . sqrt ( a * a + b * b ) ;
public class ExpectedValueCheckingStore { /** * { @ inheritDoc } * This implementation supports locking when { @ code lockStore } is non - null . * Consider the following scenario . This method is called twice with * identical key , column , and txh arguments , but with different * expectedValue arguments in each call . In testing , it seems titan ' s * graphdb requires that implementations discard the second expectedValue * and , when checking expectedValues vs actual values just prior to mutate , * only the initial expectedValue argument should be considered . */ @ Override public void acquireLock ( StaticBuffer key , StaticBuffer column , StaticBuffer expectedValue , StoreTransaction txh ) throws BackendException { } }
if ( locker != null ) { ExpectedValueCheckingTransaction tx = ( ExpectedValueCheckingTransaction ) txh ; if ( tx . isMutationStarted ( ) ) throw new PermanentLockingException ( "Attempted to obtain a lock after mutations had been persisted" ) ; KeyColumn lockID = new KeyColumn ( key , column ) ; log . debug ( "Attempting to acquireLock on {} ev={}" , lockID , expectedValue ) ; locker . writeLock ( lockID , tx . getConsistentTx ( ) ) ; tx . storeExpectedValue ( this , lockID , expectedValue ) ; } else { store . acquireLock ( key , column , expectedValue , unwrapTx ( txh ) ) ; }
public class Tabs { /** * Parses an integer . * @ param value * The value to parse . * @ return The parsed integer . */ private int parseInteger ( String value , int defaultValue ) { } }
try { return Integer . parseInt ( value ) ; } catch ( NumberFormatException e ) { return defaultValue ; }
public class HtmlDataTable { /** * < p > Return the value of the < code > captionClass < / code > property . < / p > * < p > Contents : Space - separated list of CSS style class ( es ) that will be * applied to any caption generated for this table . */ public java . lang . String getCaptionClass ( ) { } }
return ( java . lang . String ) getStateHelper ( ) . eval ( PropertyKeys . captionClass ) ;
public class FullFrameRect { /** * Adjust the MVP Matrix to rotate and crop the texture * to make vertical video appear upright */ public void adjustForVerticalVideo ( SCREEN_ROTATION orientation , boolean scaleToFit ) { } }
synchronized ( mDrawLock ) { mCorrectVerticalVideo = true ; mScaleToFit = scaleToFit ; requestedOrientation = orientation ; Matrix . setIdentityM ( IDENTITY_MATRIX , 0 ) ; switch ( orientation ) { case VERTICAL : if ( scaleToFit ) { Matrix . rotateM ( IDENTITY_MATRIX , 0 , - 90 , 0f , 0f , 1f ) ; Matrix . scaleM ( IDENTITY_MATRIX , 0 , 3.16f , 1.0f , 1f ) ; } else { Matrix . scaleM ( IDENTITY_MATRIX , 0 , 0.316f , 1f , 1f ) ; } break ; case UPSIDEDOWN_LANDSCAPE : if ( scaleToFit ) { Matrix . rotateM ( IDENTITY_MATRIX , 0 , - 180 , 0f , 0f , 1f ) ; } break ; case UPSIDEDOWN_VERTICAL : if ( scaleToFit ) { Matrix . rotateM ( IDENTITY_MATRIX , 0 , 90 , 0f , 0f , 1f ) ; Matrix . scaleM ( IDENTITY_MATRIX , 0 , 3.16f , 1.0f , 1f ) ; } else { Matrix . scaleM ( IDENTITY_MATRIX , 0 , 0.316f , 1f , 1f ) ; } break ; } }
public class HtmlDocletWriter { /** * Get the script to show or hide the All classes link . * @ param id id of the element to show or hide * @ return a content tree for the script */ public Content getAllClassesLinkScript ( String id ) { } }
HtmlTree script = new HtmlTree ( HtmlTag . SCRIPT ) ; script . addAttr ( HtmlAttr . TYPE , "text/javascript" ) ; String scriptCode = "<!--" + DocletConstants . NL + " allClassesLink = document.getElementById(\"" + id + "\");" + DocletConstants . NL + " if(window==top) {" + DocletConstants . NL + " allClassesLink.style.display = \"block\";" + DocletConstants . NL + " }" + DocletConstants . NL + " else {" + DocletConstants . NL + " allClassesLink.style.display = \"none\";" + DocletConstants . NL + " }" + DocletConstants . NL + " //-->" + DocletConstants . NL ; Content scriptContent = new RawHtml ( scriptCode ) ; script . addContent ( scriptContent ) ; Content div = HtmlTree . DIV ( script ) ; return div ;
public class UserInterfaceApi { /** * Open Information Window ( asynchronously ) Open the information window for * a character , corporation or alliance inside the client - - - SSO Scope : * esi - ui . open _ window . v1 * @ param targetId * The target to open ( required ) * @ param datasource * The server name you would like data from ( optional , default to * tranquility ) * @ param token * Access token to use if unable to set a header ( optional ) * @ param callback * The callback to be executed when the API call finishes * @ return The request call * @ throws ApiException * If fail to process the API call , e . g . serializing the request * body object */ public com . squareup . okhttp . Call postUiOpenwindowInformationAsync ( Integer targetId , String datasource , String token , final ApiCallback < Void > callback ) throws ApiException { } }
com . squareup . okhttp . Call call = postUiOpenwindowInformationValidateBeforeCall ( targetId , datasource , token , callback ) ; apiClient . executeAsync ( call , callback ) ; return call ;
public class ExclusionChecker { /** * Given the current randomization context , should the field be excluded from being populated ? * @ param field the field to check * @ param context the current randomization context * @ return true if the field should be excluded , false otherwise */ public boolean shouldBeExcluded ( final Field field , final RandomizerContext context ) { } }
if ( isStatic ( field ) ) { return true ; } Set < Predicate < Field > > fieldExclusionPredicates = context . getParameters ( ) . getFieldExclusionPredicates ( ) ; for ( Predicate < Field > fieldExclusionPredicate : fieldExclusionPredicates ) { if ( fieldExclusionPredicate . test ( field ) ) { return true ; } } return false ;
public class AnnoConstruct { /** * Helper to getAnnotationsByType */ private static Attribute [ ] unpackAttributes ( Attribute . Compound container ) { } }
// We now have an instance of the container , // unpack it returning an instance of the // contained type or null return ( ( Attribute . Array ) container . member ( container . type . tsym . name . table . names . value ) ) . values ;
public class WatchTimeExceptionData { /** * If today is a day configured as an exception . * @ return true if so . * @ see # daysOfWeek */ public boolean isExceptionToday ( ) { } }
if ( daysOfWeek != null && daysOfWeek . length > 0 ) { int dayOfWeekNow = Calendar . getInstance ( ) . get ( Calendar . DAY_OF_WEEK ) ; for ( int exceptionDay : daysOfWeek ) { if ( exceptionDay == dayOfWeekNow ) { return true ; } } } return false ;
public class CommerceTierPriceEntryPersistenceImpl { /** * Returns the commerce tier price entry where uuid = & # 63 ; and groupId = & # 63 ; or throws a { @ link NoSuchTierPriceEntryException } if it could not be found . * @ param uuid the uuid * @ param groupId the group ID * @ return the matching commerce tier price entry * @ throws NoSuchTierPriceEntryException if a matching commerce tier price entry could not be found */ @ Override public CommerceTierPriceEntry findByUUID_G ( String uuid , long groupId ) throws NoSuchTierPriceEntryException { } }
CommerceTierPriceEntry commerceTierPriceEntry = fetchByUUID_G ( uuid , groupId ) ; if ( commerceTierPriceEntry == null ) { StringBundler msg = new StringBundler ( 6 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "uuid=" ) ; msg . append ( uuid ) ; msg . append ( ", groupId=" ) ; msg . append ( groupId ) ; msg . append ( "}" ) ; if ( _log . isDebugEnabled ( ) ) { _log . debug ( msg . toString ( ) ) ; } throw new NoSuchTierPriceEntryException ( msg . toString ( ) ) ; } return commerceTierPriceEntry ;
public class Examples { /** * / * Get all mutualfunds holdings */ public void getMFHoldings ( KiteConnect kiteConnect ) throws KiteException , IOException { } }
List < MFHolding > MFHoldings = kiteConnect . getMFHoldings ( ) ; System . out . println ( "mf holdings " + MFHoldings . size ( ) ) ;
public class ScreenSteps { /** * Take a screenshot and add to result . * @ param conditions * list of ' expected ' values condition and ' actual ' values ( { @ link com . github . noraui . gherkin . GherkinStepCondition } ) . */ @ Conditioned @ Et ( "Je prends une capture d'écran[\\.|\\?]" ) @ And ( "I take a screenshot[\\.|\\?]" ) public void takeScreenshot ( List < GherkinStepCondition > conditions ) { } }
logger . debug ( "I take a screenshot for [{}] scenario." , Context . getCurrentScenario ( ) ) ; screenService . takeScreenshot ( Context . getCurrentScenario ( ) ) ;