signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class BpsimFactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public String convertResultTypeToString ( EDataType eDataType , Object instanceValue ) { } }
return instanceValue == null ? null : instanceValue . toString ( ) ;
public class Jenkins { /** * Serves static resources placed along with Jelly view files . * This method can serve a lot of files , so care needs to be taken * to make this method secure . It ' s not clear to me what ' s the best * strategy here , though the current implementation is based on * file extensions . */ public void doResources ( StaplerRequest req , StaplerResponse rsp ) throws IOException , ServletException { } }
String path = req . getRestOfPath ( ) ; // cut off the " . . . " portion of / resources / . . . / path / to / file // as this is only used to make path unique ( which in turn // allows us to set a long expiration date path = path . substring ( path . indexOf ( '/' , 1 ) + 1 ) ; int idx = path . lastIndexOf ( '.' ) ; String extension = path . substring ( idx + 1 ) ; if ( ALLOWED_RESOURCE_EXTENSIONS . contains ( extension ) ) { URL url = pluginManager . uberClassLoader . getResource ( path ) ; if ( url != null ) { long expires = MetaClass . NO_CACHE ? 0 : TimeUnit . DAYS . toMillis ( 365 ) ; rsp . serveFile ( req , url , expires ) ; return ; } } rsp . sendError ( HttpServletResponse . SC_NOT_FOUND ) ;
public class CommercePriceEntryModelImpl { /** * Converts the soap model instances into normal model instances . * @ param soapModels the soap model instances to convert * @ return the normal model instances */ public static List < CommercePriceEntry > toModels ( CommercePriceEntrySoap [ ] soapModels ) { } }
if ( soapModels == null ) { return null ; } List < CommercePriceEntry > models = new ArrayList < CommercePriceEntry > ( soapModels . length ) ; for ( CommercePriceEntrySoap soapModel : soapModels ) { models . add ( toModel ( soapModel ) ) ; } return models ;
public class PackagesReport { /** * SetupSFields Method . */ public void setupSFields ( ) { } }
this . getRecord ( Part . PART_FILE ) . getField ( Part . DESCRIPTION ) . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ; this . getRecord ( Part . PART_FILE ) . getField ( Part . KIND ) . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ; this . getRecord ( Part . PART_FILE ) . getField ( Part . PART_TYPE ) . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ; this . getRecord ( Part . PART_FILE ) . getField ( Part . PATH ) . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ;
public class ApiOvhOrder { /** * Get allowed durations for ' ipMigration ' option * REST : GET / order / dedicated / server / { serviceName } / ipMigration * @ param ip [ required ] The IP to move to this server * @ param token [ required ] IP migration token * @ param serviceName [ required ] The internal name of your dedicated server */ public ArrayList < String > dedicated_server_serviceName_ipMigration_GET ( String serviceName , String ip , String token ) throws IOException { } }
String qPath = "/order/dedicated/server/{serviceName}/ipMigration" ; StringBuilder sb = path ( qPath , serviceName ) ; query ( sb , "ip" , ip ) ; query ( sb , "token" , token ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t1 ) ;
public class DOMConfigurator { /** * Used internally to parse appenders by IDREF name . */ protected Appender findAppenderByName ( Document doc , String appenderName ) { } }
Appender appender = ( Appender ) appenderBag . get ( appenderName ) ; if ( appender != null ) { return appender ; } else { // Doesn ' t work on DOM Level 1 : // Element element = doc . getElementById ( appenderName ) ; // Endre ' s hack : Element element = null ; NodeList list = doc . getElementsByTagName ( "appender" ) ; for ( int t = 0 ; t < list . getLength ( ) ; t ++ ) { Node node = list . item ( t ) ; NamedNodeMap map = node . getAttributes ( ) ; Node attrNode = map . getNamedItem ( "name" ) ; if ( appenderName . equals ( attrNode . getNodeValue ( ) ) ) { element = ( Element ) node ; break ; } } // Hack finished . if ( element == null ) { LogLog . error ( "No appender named [" + appenderName + "] could be found." ) ; return null ; } else { appender = parseAppender ( element ) ; if ( appender != null ) { appenderBag . put ( appenderName , appender ) ; } return appender ; } }
public class UniversalJdbcQueue { /** * { @ inheritDoc } */ @ Override protected UniversalIdIntQueueMessage readFromQueueStorage ( Connection conn ) { } }
Map < String , Object > dbRow = getJdbcHelper ( ) . executeSelectOne ( conn , SQL_READ_FROM_QUEUE ) ; if ( dbRow != null ) { UniversalIdIntQueueMessage msg = new UniversalIdIntQueueMessage ( ) ; return msg . fromMap ( dbRow ) ; } return null ;
public class EntityIntrospector { /** * Processes the Key field and builds the entity metadata . * @ param field * the Key field */ private void processKeyField ( Field field ) { } }
String fieldName = field . getName ( ) ; Class < ? > type = field . getType ( ) ; if ( ! type . equals ( DatastoreKey . class ) ) { String message = String . format ( "Invalid type, %s, for Key field %s in class %s. " , type , fieldName , entityClass ) ; throw new EntityManagerException ( message ) ; } KeyMetadata keyMetadata = new KeyMetadata ( field ) ; entityMetadata . setKeyMetadata ( keyMetadata ) ;
public class CommerceTierPriceEntryUtil { /** * Returns the first commerce tier price entry in the ordered set where commercePriceEntryId = & # 63 ; and minQuantity & le ; & # 63 ; . * @ param commercePriceEntryId the commerce price entry ID * @ param minQuantity the min quantity * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the first matching commerce tier price entry , or < code > null < / code > if a matching commerce tier price entry could not be found */ public static CommerceTierPriceEntry fetchByC_LtM_First ( long commercePriceEntryId , int minQuantity , OrderByComparator < CommerceTierPriceEntry > orderByComparator ) { } }
return getPersistence ( ) . fetchByC_LtM_First ( commercePriceEntryId , minQuantity , orderByComparator ) ;
public class IntentUtils { /** * Pick contact from phone book * @ param scope You can restrict selection by passing required content type . Examples : * < code > < pre > * / / Select only from users with emails * IntentUtils . pickContact ( ContactsContract . CommonDataKinds . Email . CONTENT _ TYPE ) ; * / / Select only from users with phone numbers on pre Eclair devices * IntentUtils . pickContact ( Contacts . Phones . CONTENT _ TYPE ) ; * / / Select only from users with phone numbers on devices with Eclair and higher * IntentUtils . pickContact ( ContactsContract . CommonDataKinds . Phone . CONTENT _ TYPE ) ; * < / pre > < / code > */ public static Intent pickContact ( String scope ) { } }
Intent intent ; if ( isSupportsContactsV2 ( ) ) { intent = new Intent ( Intent . ACTION_PICK , Uri . parse ( "content://com.android.contacts/contacts" ) ) ; } else { intent = new Intent ( Intent . ACTION_PICK , Contacts . People . CONTENT_URI ) ; } if ( ! TextUtils . isEmpty ( scope ) ) { intent . setType ( scope ) ; } return intent ;
public class ChainedProperty { /** * Returns true if any property in the chain is derived . * @ see com . amazon . carbonado . Derived * @ since 1.2 */ public boolean isDerived ( ) { } }
if ( mPrime . isDerived ( ) ) { return true ; } if ( mChain != null ) { for ( StorableProperty < ? > prop : mChain ) { if ( prop . isDerived ( ) ) { return true ; } } } return false ;
public class EffectUtil { /** * Prompts the user for a value that represents a fixed number of options . * All options are strings . * @ param options The first array has an entry for each option . Each entry is either a String [ 1 ] that is both the display value * and actual value , or a String [ 2 ] whose first element is the display value and second element is the actual value . * @ param name The name of the value being prompted for * @ param currentValue The current value to show as default * @ param description The description of the value * @ return The value selected by the user */ static public Value optionValue ( String name , final String currentValue , final String [ ] [ ] options , final String description ) { } }
return new DefaultValue ( name , currentValue . toString ( ) ) { public void showDialog ( ) { int selectedIndex = - 1 ; DefaultComboBoxModel model = new DefaultComboBoxModel ( ) ; for ( int i = 0 ; i < options . length ; i ++ ) { model . addElement ( options [ i ] [ 0 ] ) ; if ( getValue ( i ) . equals ( currentValue ) ) selectedIndex = i ; } JComboBox comboBox = new JComboBox ( model ) ; comboBox . setSelectedIndex ( selectedIndex ) ; if ( showValueDialog ( comboBox , description ) ) value = getValue ( comboBox . getSelectedIndex ( ) ) ; } private String getValue ( int i ) { if ( options [ i ] . length == 1 ) return options [ i ] [ 0 ] ; return options [ i ] [ 1 ] ; } public String toString ( ) { for ( int i = 0 ; i < options . length ; i ++ ) if ( getValue ( i ) . equals ( value ) ) return options [ i ] [ 0 ] . toString ( ) ; return "" ; } public Object getObject ( ) { return value ; } } ;
public class FullFeaturePhase { /** * { @ inheritDoc } */ @ Override public final boolean write ( final ITask task , final Session session , final ByteBuffer src , final int logicalBlockAddress , final long length ) throws Exception { } }
if ( src . remaining ( ) < length ) { throw new IllegalArgumentException ( "Source buffer is too small. Buffer size: " + src . remaining ( ) + " Expected: " + length ) ; } int startAddress = logicalBlockAddress ; final long blockSize = session . getBlockSize ( ) ; int totalBlocks = ( int ) Math . ceil ( length / ( double ) blockSize ) ; long bytes2Process = length ; int bufferPosition = 0 ; final Connection connection = session . getNextFreeConnection ( ) ; connection . getSession ( ) . addOutstandingTask ( connection , task ) ; // first stage short blocks = ( short ) Math . min ( WRITE_FIRST_STAGE_BLOCKS , totalBlocks ) ; if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "Now sending sequences of length " + blocks + " blocks." ) ; } int expectedDataTransferLength = ( int ) Math . min ( bytes2Process , blocks * blockSize ) ; connection . nextState ( new WriteRequestState ( connection , src , bufferPosition , TaskAttributes . SIMPLE , expectedDataTransferLength , startAddress , blocks ) ) ; startAddress += blocks ; totalBlocks -= blocks ; bytes2Process -= blocks * blockSize ; bufferPosition += expectedDataTransferLength ; // second stage blocks = ( short ) Math . min ( WRITE_SECOND_STAGE_BLOCKS , totalBlocks ) ; if ( blocks > 0 ) { if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "Now sending sequences of length " + blocks + " blocks." ) ; LOGGER . info ( "Remaining, DataSegmentLength: " + bytes2Process + ", " + expectedDataTransferLength ) ; } expectedDataTransferLength = ( int ) Math . min ( bytes2Process , blocks * blockSize ) ; connection . nextState ( new WriteRequestState ( connection , src , bufferPosition , TaskAttributes . SIMPLE , expectedDataTransferLength , startAddress , blocks ) ) ; startAddress += blocks ; totalBlocks -= blocks ; bytes2Process -= blocks * blockSize ; bufferPosition += expectedDataTransferLength ; } // third stage blocks = ( short ) Math . min ( WRITE_THIRD_STAGE_BLOCKS , totalBlocks ) ; while ( blocks > 0 ) { if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "Now sending sequences of length " + blocks + " blocks." ) ; } expectedDataTransferLength = ( int ) Math . min ( bytes2Process , blocks * blockSize ) ; connection . nextState ( new WriteRequestState ( connection , src , bufferPosition , TaskAttributes . SIMPLE , expectedDataTransferLength , startAddress , blocks ) ) ; startAddress += blocks ; totalBlocks -= blocks ; blocks = ( short ) Math . min ( READ_THIRD_STAGE_BLOCKS , totalBlocks ) ; bufferPosition += expectedDataTransferLength ; } return true ;
public class KeyUpdateCollection { /** * Includes the given { @ link BucketUpdate . KeyUpdate } into this collection . * If we get multiple updates for the same key , only the one with highest version will be kept . Due to compaction , * it is possible that a lower version of a Key will end up after a higher version of the same Key , in which case * the higher version should take precedence . * @ param update The { @ link BucketUpdate . KeyUpdate } to include . * @ param entryLength The total length of the given update , as serialized in the Segment . * @ param originalOffset If this update was a result of a compaction copy , then this should be the original offset * where it was copied from ( as serialized in the Segment ) . If no such information exists , then * { @ link TableKey # NO _ VERSION } should be used . */ void add ( BucketUpdate . KeyUpdate update , int entryLength , long originalOffset ) { } }
val existing = this . updates . get ( update . getKey ( ) ) ; if ( existing == null || update . supersedes ( existing ) ) { this . updates . put ( update . getKey ( ) , update ) ; } // Update remaining counters , regardless of whether we considered this update or not . this . totalUpdateCount . incrementAndGet ( ) ; long lastOffset = update . getOffset ( ) + entryLength ; this . lastIndexedOffset . updateAndGet ( e -> Math . max ( lastOffset , e ) ) ; if ( originalOffset >= 0 ) { this . highestCopiedOffset . updateAndGet ( e -> Math . max ( e , originalOffset + entryLength ) ) ; }
public class LogManager { /** * get a list of whitespace separated classnames from a property . */ private String [ ] parseClassNames ( String propertyName ) { } }
String hands = getProperty ( propertyName ) ; if ( hands == null ) { return new String [ 0 ] ; } hands = hands . trim ( ) ; int ix = 0 ; Vector < String > result = new Vector < > ( ) ; while ( ix < hands . length ( ) ) { int end = ix ; while ( end < hands . length ( ) ) { if ( Character . isWhitespace ( hands . charAt ( end ) ) ) { break ; } if ( hands . charAt ( end ) == ',' ) { break ; } end ++ ; } String word = hands . substring ( ix , end ) ; ix = end + 1 ; word = word . trim ( ) ; if ( word . length ( ) == 0 ) { continue ; } result . add ( word ) ; } return result . toArray ( new String [ result . size ( ) ] ) ;
public class LocalizationActivityDelegate { /** * If yes , bundle will obe remove and set boolean flag to " true " . */ private void checkBeforeLocaleChanging ( ) { } }
boolean isLocalizationChanged = activity . getIntent ( ) . getBooleanExtra ( KEY_ACTIVITY_LOCALE_CHANGED , false ) ; if ( isLocalizationChanged ) { this . isLocalizationChanged = true ; activity . getIntent ( ) . removeExtra ( KEY_ACTIVITY_LOCALE_CHANGED ) ; }
public class Client { /** * Returns a cursor of datapoints specified by series . * < p > The system default timezone is used for the returned DateTimes . * @ param series The series * @ param interval An interval of time for the query ( start / end datetimes ) * @ return A Cursor of DataPoints . The cursor . iterator ( ) . next ( ) may throw a { @ link TempoDBException } if an error occurs while making a request . * @ see Cursor * @ since 1.0.0 */ public Cursor < DataPoint > readDataPoints ( Series series , Interval interval ) { } }
return readDataPoints ( series , interval , DateTimeZone . getDefault ( ) , null , null ) ;
public class SessionMonitor { /** * TO DO - - Use StoreCallback instead of SessionEventDispatcher ? ? */ @ ProbeAtEntry @ ProbeSite ( clazz = "com.ibm.ws.session.SessionEventDispatcher" , method = "sessionLiveCountInc" , args = "java.lang.Object" ) public void IncrementLiveCount ( @ Args Object [ ] myargs ) { } }
if ( tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "IncrementLiveCount" ) ; } if ( myargs == null ) { if ( tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "IncrementLiveCount" , "Args list is null" ) ; } return ; } ISession session = ( ISession ) myargs [ 0 ] ; if ( session == null ) { if ( tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "IncrementLiveCount" , "session object is null" ) ; } return ; } String appName = session . getIStore ( ) . getId ( ) ; SessionStats sStats = sessionCountByName . get ( appName ) ; if ( sStats == null ) { sStats = initializeSessionStats ( appName , new SessionStats ( ) ) ; } sStats . liveCountInc ( ) ; if ( tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "IncrementLiveCount" ) ; }
public class SetUtilities { /** * Selects a random subset of a specific size from a given set ( uniformly distributed ) . * Applies a full scan algorithm that iterates once through the given set and selects each item with probability * ( # remaining to select ) / ( # remaining to scan ) . It can be proven that this algorithm creates uniformly distributed * random subsets ( for example , a proof is given < a href = " http : / / eyalsch . wordpress . com / 2010/04/01 / random - sample " > here < / a > ) . * In the worst case , this algorithm has linear time complexity with respect to the size of the given set . * The items from the selected subset are added to the given collection < code > subset < / code > . This collection is * < b > not < / b > cleared so that already contained items will be retained . A reference to this same collection is * returned after it has been modified . To store the generated subset in a newly allocated { @ link LinkedHashSet } * the alternative method { @ link # getRandomSubset ( Set , int , Random ) } may also be used . * @ see < a href = " http : / / eyalsch . wordpress . com / 2010/04/01 / random - sample " > http : / / eyalsch . wordpress . com / 2010/04/01 / random - sample < / a > * @ param < T > type of elements in randomly selected subset * @ param set set from which a random subset is to be sampled * @ param size desired subset size , should be a number in [ 0 , | set | ] * @ param rg random generator * @ param subset collection to which the items from the selected subset are added * @ throws IllegalArgumentException if an invalid subset size outside [ 0 , | set | ] is specified * @ return reference to given collection < code > subset < / code > after it has been filled with the * items from the randomly generated subset */ public static < T > Collection < T > getRandomSubset ( Set < ? extends T > set , int size , Random rg , Collection < T > subset ) { } }
// check size if ( size < 0 || size > set . size ( ) ) { throw new IllegalArgumentException ( "Error in SetUtilities: desired subset size should be a number in [0,|set|]." ) ; } // remaining number of items to select int remainingToSelect = size ; // remaining number of candidates to consider int remainingToScan = set . size ( ) ; Iterator < ? extends T > it = set . iterator ( ) ; // randomly add items until desired size is obtained while ( remainingToSelect > 0 ) { // get next element T item = it . next ( ) ; // select item : // 1 ) always , if all remaining items have to be selected ( # remaining to select = = # remaining to scan ) // 2 ) else , with probability ( # remaining to select ) / ( # remaining to scan ) < 1 if ( remainingToSelect == remainingToScan || rg . nextDouble ( ) < ( ( double ) remainingToSelect ) / remainingToScan ) { subset . add ( item ) ; remainingToSelect -- ; } remainingToScan -- ; } // return selected subset return subset ;
public class filterpostbodyinjection { /** * Use this API to fetch all the filterpostbodyinjection resources that are configured on netscaler . */ public static filterpostbodyinjection get ( nitro_service service ) throws Exception { } }
filterpostbodyinjection obj = new filterpostbodyinjection ( ) ; filterpostbodyinjection [ ] response = ( filterpostbodyinjection [ ] ) obj . get_resources ( service ) ; return response [ 0 ] ;
public class TopHints { /** * Adds a resource collection with execution hints . */ public void add ( ResourceCollection rc ) { } }
if ( rc instanceof FileSet ) { FileSet fs = ( FileSet ) rc ; fs . setProject ( getProject ( ) ) ; } resources . add ( rc ) ;
public class Parameter { /** * Creates a map of all possible parameter names to their corresponding object . No two parameters may have the same name . * @ param params the list of parameters to create a map for * @ return a map of string names to their parameters * @ throws RuntimeException if two parameters have the same name */ public static Map < String , Parameter > toParameterMap ( List < Parameter > params ) { } }
Map < String , Parameter > map = new HashMap < String , Parameter > ( params . size ( ) ) ; for ( Parameter param : params ) { if ( map . put ( param . getASCIIName ( ) , param ) != null ) throw new RuntimeException ( "Name collision, two parameters use the name '" + param . getASCIIName ( ) + "'" ) ; if ( ! param . getName ( ) . equals ( param . getASCIIName ( ) ) ) // Dont put it in again if ( map . put ( param . getName ( ) , param ) != null ) throw new RuntimeException ( "Name collision, two parameters use the name '" + param . getName ( ) + "'" ) ; } return map ;
public class SDCA { /** * Sets the regularization term , where larger values indicate a larger * regularization penalty . * @ param lambda the positive regularization term */ @ Parameter . WarmParameter ( prefLowToHigh = false ) public void setLambda ( double lambda ) { } }
if ( lambda <= 0 || Double . isInfinite ( lambda ) || Double . isNaN ( lambda ) ) throw new IllegalArgumentException ( "Regularization term lambda must be a positive value, not " + lambda ) ; this . lambda = lambda ;
public class ReportRequest { /** * Gets map which property is an object and what type of object . * @ return Collection of field name - field type pairs . */ @ Override public Map < String , Type > getSubObjects ( ) { } }
Map < String , Type > result = super . getSubObjects ( ) ; result . put ( "Filters" , FilterReports . class ) ; return result ;
public class Utils { /** * PostProcessなどのメソッドを実行する 。 * < p > メソッドの引数が既知のものであれば 、 インスタンスを設定する 。 * @ param processObj 実行対象の処理が埋め込まれているオブジェクト 。 * @ param method 実行対象のメソッド情報 * @ param beanObj 処理対象のBeanオブジェクト 。 * @ param sheet シート情報 * @ param config 共通設定 * @ param errors エラー情報 * @ param processCase 処理ケース * @ throws XlsMapperException */ public static void invokeNeedProcessMethod ( final Object processObj , final Method method , final Object beanObj , final Sheet sheet , final Configuration config , final SheetBindingErrors < ? > errors , final ProcessCase processCase ) throws XlsMapperException { } }
final Class < ? > [ ] paramTypes = method . getParameterTypes ( ) ; final Object [ ] paramValues = new Object [ paramTypes . length ] ; for ( int i = 0 ; i < paramTypes . length ; i ++ ) { if ( Sheet . class . isAssignableFrom ( paramTypes [ i ] ) ) { paramValues [ i ] = sheet ; } else if ( Configuration . class . isAssignableFrom ( paramTypes [ i ] ) ) { paramValues [ i ] = config ; } else if ( SheetBindingErrors . class . isAssignableFrom ( paramTypes [ i ] ) ) { paramValues [ i ] = errors ; } else if ( paramTypes [ i ] . isAssignableFrom ( beanObj . getClass ( ) ) ) { paramValues [ i ] = beanObj ; } else if ( ProcessCase . class . equals ( paramTypes [ i ] ) ) { paramValues [ i ] = processCase ; } else if ( paramTypes [ i ] . equals ( Object . class ) ) { paramValues [ i ] = beanObj ; } else { paramValues [ i ] = null ; } } try { method . setAccessible ( true ) ; method . invoke ( processObj , paramValues ) ; } catch ( IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { Throwable t = e . getCause ( ) == null ? e : e . getCause ( ) ; throw new XlsMapperException ( String . format ( "fail execute method '%s#%s'." , processObj . getClass ( ) . getName ( ) , method . getName ( ) ) , t ) ; }
public class BasicAgigaSentence { /** * / * ( non - Javadoc ) * @ see edu . jhu . hltcoe . sp . data . depparse . AgigaSentence # getAgigaDeps ( edu . jhu . hltcoe . sp . data . depparse . DependencyForm ) */ public List < AgigaTypedDependency > getAgigaDeps ( DependencyForm form ) { } }
List < AgigaTypedDependency > agigaDeps ; if ( form == DependencyForm . BASIC_DEPS ) { agigaDeps = basicDeps ; } else if ( form == DependencyForm . COL_DEPS ) { agigaDeps = colDeps ; } else if ( form == DependencyForm . COL_CCPROC_DEPS ) { agigaDeps = colCcprocDeps ; } else { throw new IllegalStateException ( "Unsupported DependencyForm: " + form ) ; } return agigaDeps ;
public class ResampleOp { /** * round ( ) * Round an FP value to its closest int representation . * General routine ; ideally belongs in general math lib file . */ static int round ( double d ) { } }
// NOTE : This code seems to be faster than Math . round ( double ) . . . // Version that uses no function calls at all . int n = ( int ) d ; double diff = d - ( double ) n ; if ( diff < 0 ) { diff = - diff ; } if ( diff >= 0.5 ) { if ( d < 0 ) { n -- ; } else { n ++ ; } } return n ;
public class GetConfigRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetConfigRequest getConfigRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getConfigRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getConfigRequest . getClientArn ( ) , CLIENTARN_BINDING ) ; protocolMarshaller . marshall ( getConfigRequest . getClientVersion ( ) , CLIENTVERSION_BINDING ) ; protocolMarshaller . marshall ( getConfigRequest . getHapgList ( ) , HAPGLIST_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class JQMNavBar { /** * Restore the button ' s active state each time the page is shown while it exists in the DOM . */ @ UiChild ( limit = 1 , tagname = "buttonActivePersist" ) public void addActivePersist ( final JQMButton button ) { } }
if ( button == null ) return ; addActive ( button ) ; button . getElement ( ) . addClassName ( "ui-state-persist" ) ;
public class JProperties { /** * < p > Returns the real value associated with { @ code key } in the * properties referenced by { @ code properties } . < / p > * @ param properties The loaded properties . * @ param key The requested key . * @ return The value associated with the key , parsed as an real . * @ throws JPropertyNonexistent If the key does not exist in the given * properties . * @ throws JPropertyIncorrectType If the value associated with the key cannot * be parsed as a real . */ public static BigDecimal getBigDecimal ( final Properties properties , final String key ) throws JPropertyNonexistent , JPropertyIncorrectType { } }
Objects . requireNonNull ( properties , "Properties" ) ; Objects . requireNonNull ( key , "Key" ) ; final String text = getString ( properties , key ) ; return parseReal ( key , text ) ;
public class LBFGS_port { /** * int * brackt */ private static StatusCode update_trial_interval ( UpdVals uv ) { } }
double x = uv . x ; double fx = uv . fx ; double dx = uv . dx ; double y = uv . y ; double fy = uv . fy ; double dy = uv . dy ; double t = uv . t ; double ft = uv . ft ; double dt = uv . dt ; double tmin = uv . tmin ; double tmax = uv . tmax ; int brackt = uv . brackt ; int bound ; boolean dsign = fsigndiff ( dt , dx ) ; double mc = 0 ; /* minimizer of an interpolated cubic . */ double mq = 0 ; /* minimizer of an interpolated quadratic . */ double newt = 0 ; /* new trial value . */ // TODO : Remove : USES _ MINIMIZER ; / * for CUBIC _ MINIMIZER and QUARD _ MINIMIZER . * / /* Check the input parameters for errors . */ if ( brackt != 0 ) { if ( t <= min2 ( x , y ) || max2 ( x , y ) <= t ) { /* The trival value t is out of the interval . */ return LBFGSERR_OUTOFINTERVAL ; } if ( 0. <= dx * ( t - x ) ) { /* The function must decrease from x . */ return LBFGSERR_INCREASEGRADIENT ; } if ( tmax < tmin ) { /* Incorrect tmin and tmax specified . */ return LBFGSERR_INCORRECT_TMINMAX ; } } /* Trial value selection . */ if ( fx < ft ) { /* Case 1 : a higher function value . The minimum is brackt . If the cubic minimizer is closer to x than the quadratic one , the cubic one is taken , else the average of the minimizers is taken . */ brackt = 1 ; bound = 1 ; mc = CUBIC_MINIMIZER ( mc , x , fx , dx , t , ft , dt ) ; mq = QUARD_MINIMIZER ( mq , x , fx , dx , t , ft ) ; if ( Math . abs ( mc - x ) < Math . abs ( mq - x ) ) { newt = mc ; } else { newt = mc + 0.5 * ( mq - mc ) ; } } else if ( dsign ) { /* Case 2 : a lower function value and derivatives of opposite sign . The minimum is brackt . If the cubic minimizer is closer to x than the quadratic ( secant ) one , the cubic one is taken , else the quadratic one is taken . */ brackt = 1 ; bound = 0 ; mc = CUBIC_MINIMIZER ( mc , x , fx , dx , t , ft , dt ) ; mq = QUARD_MINIMIZER2 ( mq , x , dx , t , dt ) ; if ( Math . abs ( mc - t ) > Math . abs ( mq - t ) ) { newt = mc ; } else { newt = mq ; } } else if ( Math . abs ( dt ) < Math . abs ( dx ) ) { /* Case 3 : a lower function value , derivatives of the same sign , and the magnitude of the derivative decreases . The cubic minimizer is only used if the cubic tends to infinity in the direction of the minimizer or if the minimum of the cubic is beyond t . Otherwise the cubic minimizer is defined to be either tmin or tmax . The quadratic ( secant ) minimizer is also computed and if the minimum is brackt then the the minimizer closest to x is taken , else the one farthest away is taken . */ bound = 1 ; mc = CUBIC_MINIMIZER2 ( mc , x , fx , dx , t , ft , dt , tmin , tmax ) ; mq = QUARD_MINIMIZER2 ( mq , x , dx , t , dt ) ; if ( brackt != 0 ) { if ( Math . abs ( t - mc ) < Math . abs ( t - mq ) ) { newt = mc ; } else { newt = mq ; } } else { if ( Math . abs ( t - mc ) > Math . abs ( t - mq ) ) { newt = mc ; } else { newt = mq ; } } } else { /* Case 4 : a lower function value , derivatives of the same sign , and the magnitude of the derivative does not decrease . If the minimum is not brackt , the step is either tmin or tmax , else the cubic minimizer is taken . */ bound = 0 ; if ( brackt != 0 ) { newt = CUBIC_MINIMIZER ( newt , t , ft , dt , y , fy , dy ) ; } else if ( x < t ) { newt = tmax ; } else { newt = tmin ; } } /* Update the interval of uncertainty . This update does not depend on the new step or the case analysis above . - Case a : if f ( x ) < f ( t ) , x < - x , y < - t . - Case b : if f ( t ) < = f ( x ) & & f ' ( t ) * f ' ( x ) > 0, x < - t , y < - y . - Case c : if f ( t ) < = f ( x ) & & f ' ( t ) * f ' ( x ) < 0, x < - t , y < - x . */ if ( fx < ft ) { /* Case a */ y = t ; fy = ft ; dy = dt ; } else { /* Case c */ if ( dsign ) { y = x ; fy = fx ; dy = dx ; } /* Cases b and c */ x = t ; fx = ft ; dx = dt ; } /* Clip the new trial value in [ tmin , tmax ] . */ if ( tmax < newt ) newt = tmax ; if ( newt < tmin ) newt = tmin ; /* Redefine the new trial value if it is close to the upper bound of the interval . */ if ( brackt != 0 && bound != 0 ) { mq = x + 0.66 * ( y - x ) ; if ( x < y ) { if ( mq < newt ) newt = mq ; } else { if ( newt < mq ) newt = mq ; } } /* Return the new trial value . */ t = newt ; uv . x = x ; uv . fx = fx ; uv . dx = dx ; uv . y = y ; uv . fy = fy ; uv . dy = dy ; uv . t = t ; uv . ft = ft ; uv . dt = dt ; // uv . tmin = tmin ; // uv . tmax = tmax ; uv . brackt = brackt ; return LBFGS_CONTINUE ;
public class InvoiceProcessApplication { /** * In a @ PostDeploy Hook you can interact with the process engine and access * the processes the application has deployed . */ @ PostDeploy public void startFirstProcess ( ProcessEngine processEngine ) { } }
createUsers ( processEngine ) ; // enable metric reporting ProcessEngineConfigurationImpl processEngineConfiguration = ( ProcessEngineConfigurationImpl ) processEngine . getProcessEngineConfiguration ( ) ; processEngineConfiguration . setDbMetricsReporterActivate ( true ) ; processEngineConfiguration . getDbMetricsReporter ( ) . setReporterId ( "REPORTER" ) ; startProcessInstances ( processEngine , "invoice" , 1 ) ; startProcessInstances ( processEngine , "invoice" , null ) ; // disable reporting processEngineConfiguration . setDbMetricsReporterActivate ( false ) ;
public class TextMateGenerator2 { /** * Generate the rules for the literals . * @ param literals the literals . * @ return the rules . */ protected List < Map < String , ? > > generateLiterals ( Set < String > literals ) { } }
final List < Map < String , ? > > list = new ArrayList < > ( ) ; if ( ! literals . isEmpty ( ) ) { list . add ( pattern ( it -> { it . matches ( keywordRegex ( literals ) ) ; it . style ( LITERAL_STYLE ) ; it . comment ( "SARL Literals and Constants" ) ; // $ NON - NLS - 1 $ } ) ) ; } return list ;
public class A_CmsUploadDialog { /** * Starts the upload progress bar . < p > */ private void showProgress ( ) { } }
removeContent ( ) ; displayDialogInfo ( org . opencms . gwt . client . Messages . get ( ) . key ( org . opencms . gwt . client . Messages . GUI_UPLOAD_INFO_UPLOADING_0 ) , false ) ; m_selectionSummary . removeFromParent ( ) ; List < String > files = new ArrayList < String > ( getFilesToUpload ( ) . keySet ( ) ) ; Collections . sort ( files , String . CASE_INSENSITIVE_ORDER ) ; m_progressInfo = new CmsUploadProgressInfo ( files ) ; m_progressInfo . setContentLength ( m_contentLength ) ; m_contentWrapper . add ( m_progressInfo ) ; m_updateProgressTimer . scheduleRepeating ( UPDATE_PROGRESS_INTERVALL ) ; startLoadingAnimation ( Messages . get ( ) . key ( Messages . GUI_UPLOAD_CLIENT_LOADING_0 ) , 0 ) ; setHeight ( ) ; changeHeight ( ) ;
public class DateTimePatternGenerator { /** * Utility to return a unique base skeleton from a given pattern . This is * the same as the skeleton , except that differences in length are minimized * so as to only preserve the difference between string and numeric form . So * for example , both " MMM - dd " and " d / MMM " produce the skeleton " MMMd " * ( notice the single d ) . * @ param pattern Input pattern , such as " dd / MMM " * @ return skeleton , such as " MMMdd " */ public String getBaseSkeleton ( String pattern ) { } }
synchronized ( this ) { // synchronized since a getter must be thread - safe current . set ( pattern , fp , false ) ; return current . getBasePattern ( ) ; }
public class RandomNumberFunction { /** * Remove leading Zero numbers . * @ param generated * @ param paddingOn */ public static String checkLeadingZeros ( String generated , boolean paddingOn ) { } }
if ( paddingOn ) { return replaceLeadingZero ( generated ) ; } else { return removeLeadingZeros ( generated ) ; }
public class AdapterRegistry { /** * Search for an adapter . */ @ SuppressWarnings ( "unchecked" ) public < Input , Output > Adapter < Input , Output > findAdapter ( Object in , Class < Input > input , Class < Output > output ) { } }
ArrayList < Adapter > acceptInput = new ArrayList < > ( ) ; ArrayList < Adapter > matching = new ArrayList < > ( ) ; for ( Adapter a : adapters ) { if ( ! a . getInputType ( ) . isAssignableFrom ( input ) ) continue ; if ( ! a . canAdapt ( in ) ) continue ; acceptInput . add ( a ) ; if ( output . equals ( a . getOutputType ( ) ) ) return a ; if ( output . isAssignableFrom ( a . getOutputType ( ) ) ) matching . add ( a ) ; } if ( acceptInput . isEmpty ( ) ) return null ; if ( matching . size ( ) == 1 ) return matching . get ( 0 ) ; if ( ! matching . isEmpty ( ) ) return getBest ( matching ) ; LinkedList < LinkedList < Adapter > > paths = findPathsTo ( input , acceptInput , output ) ; LinkedList < Adapter > best = null ; while ( ! paths . isEmpty ( ) ) { LinkedList < Adapter > path = paths . removeFirst ( ) ; if ( best != null && best . size ( ) <= path . size ( ) ) continue ; Object o = in ; boolean valid = true ; int i = 0 ; for ( Adapter a : path ) { if ( ! a . canAdapt ( o ) ) { valid = false ; break ; } if ( i == path . size ( ) - 1 ) break ; // we are on the last , so no need to do it i ++ ; try { o = a . adapt ( o ) ; } catch ( Exception e ) { valid = false ; break ; } } if ( valid ) best = path ; } if ( best == null ) return null ; return new LinkedAdapter ( best ) ;
public class VectorOps_DDRB { /** * Row vector scale : < br > * scale : b < sub > i < / sub > = & alpha ; * a < sub > i < / sub > < br > * where ' a ' and ' b ' are row vectors within the row block vector A and B . * @ param A submatrix . Not modified . * @ param rowA which row in A the vector is contained in . * @ param alpha scale factor . * @ param B submatrix that the results are written to . Modified . * @ param offset Index at which the vectors start at . * @ param end Index at which the vectors end at . */ public static void scale_row ( final int blockLength , DSubmatrixD1 A , int rowA , double alpha , DSubmatrixD1 B , int rowB , int offset , int end ) { } }
final double dataA [ ] = A . original . data ; final double dataB [ ] = B . original . data ; // handle the case where offset is more than a block int startI = offset - offset % blockLength ; offset = offset % blockLength ; // handle rows in any block int rowBlockA = A . row0 + rowA - rowA % blockLength ; rowA = rowA % blockLength ; int rowBlockB = B . row0 + rowB - rowB % blockLength ; rowB = rowB % blockLength ; final int heightA = Math . min ( blockLength , A . row1 - rowBlockA ) ; final int heightB = Math . min ( blockLength , B . row1 - rowBlockB ) ; for ( int i = startI ; i < end ; i += blockLength ) { int segment = Math . min ( blockLength , end - i ) ; int widthA = Math . min ( blockLength , A . col1 - A . col0 - i ) ; int widthB = Math . min ( blockLength , B . col1 - B . col0 - i ) ; int indexA = rowBlockA * A . original . numCols + ( A . col0 + i ) * heightA + rowA * widthA ; int indexB = rowBlockB * B . original . numCols + ( B . col0 + i ) * heightB + rowB * widthB ; if ( i == startI ) { indexA += offset ; indexB += offset ; for ( int j = offset ; j < segment ; j ++ ) { dataB [ indexB ++ ] = alpha * dataA [ indexA ++ ] ; } } else { for ( int j = 0 ; j < segment ; j ++ ) { dataB [ indexB ++ ] = alpha * dataA [ indexA ++ ] ; } } }
public class DataModelUtil { /** * Get the data model for the given type . * @ param < E > The entity type * @ param type The Java class of the entity type * @ return The appropriate data model for the given type */ public static < E > GenericData getDataModelForType ( Class < E > type ) { } }
// Need to check if SpecificRecord first because specific records also // implement GenericRecord if ( SpecificRecord . class . isAssignableFrom ( type ) ) { return new SpecificData ( type . getClassLoader ( ) ) ; } else if ( IndexedRecord . class . isAssignableFrom ( type ) ) { return GenericData . get ( ) ; } else { return AllowNulls . get ( ) ; }
public class ReaderInputStream { /** * Fills the internal char buffer from the reader . * @ throws IOException If an I / O error occurs */ private void fillBuffer ( ) throws IOException { } }
if ( ! endOfInput && ( lastCoderResult == null || lastCoderResult . isUnderflow ( ) ) ) { encoderIn . compact ( ) ; int position = encoderIn . position ( ) ; // We don ' t use Reader # read ( CharBuffer ) here because it is more efficient // to write directly to the underlying char array ( the default implementation // copies data to a temporary char array ) . int c = reader . read ( encoderIn . array ( ) , position , encoderIn . remaining ( ) ) ; if ( c == - 1 ) { endOfInput = true ; } else { encoderIn . position ( position + c ) ; } encoderIn . flip ( ) ; } encoderOut . compact ( ) ; lastCoderResult = encoder . encode ( encoderIn , encoderOut , endOfInput ) ; encoderOut . flip ( ) ;
public class InMemoryStateFlowGraph { /** * Adds the specified edge to this graph , going from the source vertex to the target vertex . * More formally , adds the specified edge , e , to this graph if this graph contains no edge e2 * such that e2 . equals ( e ) . If this graph already contains such an edge , the call leaves this * graph unchanged and returns false . Some graphs do not allow edge - multiplicity . In such cases , * if the graph already contains an edge from the specified source to the specified target , than * this method does not change the graph and returns false . If the edge was added to the graph , * returns true . The source and target vertices must already be contained in this graph . If they * are not found in graph IllegalArgumentException is thrown . * @ param sourceVertex source vertex of the edge . * @ param targetVertex target vertex of the edge . * @ param clickable the clickable edge to be added to this graph . * @ return true if this graph did not already contain the specified edge . * @ see org . jgrapht . Graph # addEdge ( Object , Object , Object ) */ public boolean addEdge ( StateVertex sourceVertex , StateVertex targetVertex , Eventable clickable ) { } }
clickable . setSource ( sourceVertex ) ; clickable . setTarget ( targetVertex ) ; writeLock . lock ( ) ; try { boolean added = sfg . addEdge ( sourceVertex , targetVertex , clickable ) ; if ( ! added ) { Set < Eventable > allEdges = sfg . getAllEdges ( sourceVertex , targetVertex ) ; for ( Eventable edge : allEdges ) { if ( edge . equals ( clickable ) ) { /* * Setting the clickable provided to the clone edge so that crawlpath is in * sync with SFG */ clickable . setId ( - 1 ) ; } } } return added ; } finally { writeLock . unlock ( ) ; }
public class Toolbar { /** * Add a new action button to the toolbar . An action button is the kind of button that executes immediately when * clicked upon . It can not be selected or deselected , it just executes every click . * @ param action * The actual action to execute on click . */ public void addActionButton ( final ToolbarAction action ) { } }
final IButton button = new IButton ( ) ; button . setWidth ( buttonSize ) ; button . setHeight ( buttonSize ) ; button . setIconSize ( buttonSize - WidgetLayout . toolbarStripHeight ) ; button . setIcon ( action . getIcon ( ) ) ; button . setActionType ( SelectionType . BUTTON ) ; button . addClickHandler ( action ) ; button . setShowRollOver ( false ) ; button . setShowFocused ( false ) ; button . setTooltip ( action . getTooltip ( ) ) ; button . setDisabled ( action . isDisabled ( ) ) ; if ( getMembers ( ) != null && getMembers ( ) . length > 0 ) { LayoutSpacer spacer = new LayoutSpacer ( ) ; spacer . setWidth ( 2 ) ; super . addMember ( spacer ) ; } action . addToolbarActionHandler ( new ToolbarActionHandler ( ) { public void onToolbarActionDisabled ( ToolbarActionDisabledEvent event ) { button . setDisabled ( true ) ; } public void onToolbarActionEnabled ( ToolbarActionEnabledEvent event ) { button . setDisabled ( false ) ; } } ) ; super . addMember ( button ) ;
public class Months { /** * Adds this amount to the specified temporal object . * This returns a temporal object of the same observable type as the input * with this amount added . * In most cases , it is clearer to reverse the calling pattern by using * { @ link Temporal # plus ( TemporalAmount ) } . * < pre > * / / these two lines are equivalent , but the second approach is recommended * dateTime = thisAmount . addTo ( dateTime ) ; * dateTime = dateTime . plus ( thisAmount ) ; * < / pre > * Only non - zero amounts will be added . * This instance is immutable and unaffected by this method call . * @ param temporal the temporal object to adjust , not null * @ return an object of the same type with the adjustment made , not null * @ throws DateTimeException if unable to add * @ throws UnsupportedTemporalTypeException if the MONTHS unit is not supported * @ throws ArithmeticException if numeric overflow occurs */ @ Override public Temporal addTo ( Temporal temporal ) { } }
if ( months != 0 ) { temporal = temporal . plus ( months , MONTHS ) ; } return temporal ;
public class TaskManager { /** * Main loop - - Task State Transition */ private synchronized void mainLoop ( ) { } }
for ( Task task : taskDao . listTasks ( ) ) { if ( task . getState ( ) . equals ( Task . STARTING ) ) { startTask ( task ) ; } else if ( task . getState ( ) . equals ( Task . PAUSING ) ) { pauseTask ( task ) ; } else if ( task . getState ( ) . equals ( Task . RESUMING ) ) { resumeTask ( task ) ; } else if ( task . getState ( ) . equals ( Task . CANCELING ) ) { cancelTask ( task ) ; } } try { wait ( POLL_SECONDS * 1000 ) ; } catch ( InterruptedException e ) { }
public class ResolverComparator { /** * / * ( non - Javadoc ) * @ see java . util . Comparator # compare ( java . lang . Object , java . lang . Object ) */ @ Override public int compare ( ResourceGeneratorResolver o1 , ResourceGeneratorResolver o2 ) { } }
int result = 0 ; if ( o1 . getType ( ) . equals ( SUFFIXED ) && o2 . getType ( ) . equals ( PREFIXED ) ) { result = - 1 ; } else if ( o1 . getType ( ) . equals ( PREFIXED ) && o2 . getType ( ) . equals ( SUFFIXED ) ) { result = 1 ; } return result ;
public class ReplicaSettingsUpdate { /** * Represents the settings of a global secondary index for a global table that will be modified . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setReplicaGlobalSecondaryIndexSettingsUpdate ( java . util . Collection ) } or * { @ link # withReplicaGlobalSecondaryIndexSettingsUpdate ( java . util . Collection ) } if you want to override the existing * values . * @ param replicaGlobalSecondaryIndexSettingsUpdate * Represents the settings of a global secondary index for a global table that will be modified . * @ return Returns a reference to this object so that method calls can be chained together . */ public ReplicaSettingsUpdate withReplicaGlobalSecondaryIndexSettingsUpdate ( ReplicaGlobalSecondaryIndexSettingsUpdate ... replicaGlobalSecondaryIndexSettingsUpdate ) { } }
if ( this . replicaGlobalSecondaryIndexSettingsUpdate == null ) { setReplicaGlobalSecondaryIndexSettingsUpdate ( new java . util . ArrayList < ReplicaGlobalSecondaryIndexSettingsUpdate > ( replicaGlobalSecondaryIndexSettingsUpdate . length ) ) ; } for ( ReplicaGlobalSecondaryIndexSettingsUpdate ele : replicaGlobalSecondaryIndexSettingsUpdate ) { this . replicaGlobalSecondaryIndexSettingsUpdate . add ( ele ) ; } return this ;
public class SRTServletRequest { /** * Returns the request URI as string . */ public String getRequestURI ( ) { } }
if ( WCCustomProperties . CHECK_REQUEST_OBJECT_IN_USE ) { checkRequestObjectInUse ( ) ; } // Begin PK06988 , strip session id of when url rewriting is enabled SRTServletRequestThreadData reqData = SRTServletRequestThreadData . getInstance ( ) ; if ( reqData != null && reqData . getRequestURI ( ) == null ) { String aURI = getEncodedRequestURI ( ) ; if ( aURI == null ) return null ; else reqData . setRequestURI ( WebGroup . stripURL ( aURI ) ) ; } // 321485 String uri = null ; if ( reqData != null ) uri = reqData . getRequestURI ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { // 306998.15 logger . logp ( Level . FINE , CLASS_NAME , "getRequestURI" , " uri --> " + uri ) ; } return uri ; // End PK06988 , strip session id of when url rewriting is enabled
public class StripeNetworkUtils { /** * A utility function to map the fields of a { @ link Card } object into a { @ link Map } we * can use in network communications . * @ param card the { @ link Card } to be read * @ return a { @ link Map } containing the appropriate values read from the card */ @ NonNull Map < String , Object > hashMapFromCard ( @ NonNull Card card ) { } }
final Map < String , Object > tokenParams = new HashMap < > ( ) ; final AbstractMap < String , Object > cardParams = new HashMap < > ( ) ; cardParams . put ( "number" , StripeTextUtils . nullIfBlank ( card . getNumber ( ) ) ) ; cardParams . put ( "cvc" , StripeTextUtils . nullIfBlank ( card . getCVC ( ) ) ) ; cardParams . put ( "exp_month" , card . getExpMonth ( ) ) ; cardParams . put ( "exp_year" , card . getExpYear ( ) ) ; cardParams . put ( "name" , StripeTextUtils . nullIfBlank ( card . getName ( ) ) ) ; cardParams . put ( "currency" , StripeTextUtils . nullIfBlank ( card . getCurrency ( ) ) ) ; cardParams . put ( "address_line1" , StripeTextUtils . nullIfBlank ( card . getAddressLine1 ( ) ) ) ; cardParams . put ( "address_line2" , StripeTextUtils . nullIfBlank ( card . getAddressLine2 ( ) ) ) ; cardParams . put ( "address_city" , StripeTextUtils . nullIfBlank ( card . getAddressCity ( ) ) ) ; cardParams . put ( "address_zip" , StripeTextUtils . nullIfBlank ( card . getAddressZip ( ) ) ) ; cardParams . put ( "address_state" , StripeTextUtils . nullIfBlank ( card . getAddressState ( ) ) ) ; cardParams . put ( "address_country" , StripeTextUtils . nullIfBlank ( card . getAddressCountry ( ) ) ) ; // Remove all null values ; they cause validation errors removeNullAndEmptyParams ( cardParams ) ; // We store the logging items in this field , which is extracted from the parameters // sent to the API . tokenParams . put ( LoggingUtils . FIELD_PRODUCT_USAGE , card . getLoggingTokens ( ) ) ; tokenParams . put ( Token . TYPE_CARD , cardParams ) ; addUidParams ( tokenParams ) ; return tokenParams ;
public class AbstractIoSession { /** * TODO Add method documentation */ public final void increaseReadMessages ( long currentTime ) { } }
readMessages ++ ; lastReadTime = currentTime ; idleCountForBoth . set ( 0 ) ; idleCountForRead . set ( 0 ) ; if ( getService ( ) instanceof AbstractIoService ) { getService ( ) . getStatistics ( ) . increaseReadMessages ( currentTime ) ; }
public class StringHelper { /** * / * public static boolean containsDigits ( String string ) { * for ( int i = 0 ; i < string . length ( ) ; i + + ) { * if ( Character . isDigit ( string . charAt ( i ) ) ) return true ; * return false ; */ public static int lastIndexOfLetter ( String string ) { } }
for ( int i = 0 ; i < string . length ( ) ; i ++ ) { char character = string . charAt ( i ) ; // Include " _ " . See HHH - 8073 if ( ! Character . isLetter ( character ) && ! ( '_' == character ) ) return i - 1 ; } return string . length ( ) - 1 ;
public class AzkabanJobLauncher { /** * Add additional properties such as flow . group , flow . name , executionUrl . Useful for tracking * job executions on Azkaban triggered by Gobblin - as - a - Service ( GaaS ) . * @ param jobProps job properties * @ return a list of tags uniquely identifying a job execution on Azkaban . */ private static List < ? extends Tag < ? > > addAdditionalMetadataTags ( Properties jobProps ) { } }
List < Tag < ? > > metadataTags = Lists . newArrayList ( ) ; String jobExecutionId = jobProps . getProperty ( AZKABAN_FLOW_EXEC_ID , "" ) ; String jobExecutionUrl = jobProps . getProperty ( AZKABAN_LINK_JOBEXEC_URL , "" ) ; metadataTags . add ( new Tag < > ( TimingEvent . FlowEventConstants . FLOW_GROUP_FIELD , jobProps . getProperty ( ConfigurationKeys . FLOW_GROUP_KEY , "" ) ) ) ; metadataTags . add ( new Tag < > ( TimingEvent . FlowEventConstants . FLOW_NAME_FIELD , jobProps . getProperty ( ConfigurationKeys . FLOW_NAME_KEY ) ) ) ; // use job execution id if flow execution id is not present metadataTags . add ( new Tag < > ( TimingEvent . FlowEventConstants . FLOW_EXECUTION_ID_FIELD , jobProps . getProperty ( ConfigurationKeys . FLOW_EXECUTION_ID_KEY , jobExecutionId ) ) ) ; // Use azkaban . flow . execid as the jobExecutionId metadataTags . add ( new Tag < > ( TimingEvent . FlowEventConstants . JOB_EXECUTION_ID_FIELD , jobExecutionId ) ) ; metadataTags . add ( new Tag < > ( TimingEvent . FlowEventConstants . JOB_GROUP_FIELD , jobProps . getProperty ( ConfigurationKeys . JOB_GROUP_KEY , "" ) ) ) ; metadataTags . add ( new Tag < > ( TimingEvent . FlowEventConstants . JOB_NAME_FIELD , jobProps . getProperty ( ConfigurationKeys . JOB_NAME_KEY , "" ) ) ) ; metadataTags . add ( new Tag < > ( TimingEvent . METADATA_MESSAGE , jobExecutionUrl ) ) ; LOG . debug ( String . format ( "AzkabanJobLauncher.addAdditionalMetadataTags: metadataTags %s" , metadataTags ) ) ; return metadataTags ;
public class XmlUtil { /** * 对象转xml * @ param object * @ return */ public static String toXml ( Object object ) { } }
if ( object == null ) { throw new NullPointerException ( "object对象不存在!" ) ; } JAXBContext jc = null ; Marshaller m = null ; String xml = null ; try { jc = JAXBContext . newInstance ( object . getClass ( ) ) ; m = jc . createMarshaller ( ) ; ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; m . marshal ( object , bos ) ; xml = new String ( bos . toByteArray ( ) ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } return xml ;
public class CallableStatementHandle { /** * { @ inheritDoc } * @ see java . sql . CallableStatement # setNull ( java . lang . String , int ) */ public void setNull ( String parameterName , int sqlType ) throws SQLException { } }
checkClosed ( ) ; try { this . internalCallableStatement . setNull ( parameterName , sqlType ) ; if ( this . logStatementsEnabled ) { this . logParams . put ( parameterName , PoolUtil . safePrint ( "[SQL NULL type " , sqlType , "]" ) ) ; } } catch ( SQLException e ) { throw this . connectionHandle . markPossiblyBroken ( e ) ; }
public class DJXYLineChartBuilder { /** * Adds the specified serie column to the dataset with custom label . * @ param column the serie column * @ param label column the custom label */ public DJXYLineChartBuilder addSerie ( AbstractColumn column , String label ) { } }
getDataset ( ) . addSerie ( column , label ) ; return this ;
public class FavoritesInner { /** * Get a single favorite by its FavoriteId , defined within an Application Insights component . * @ param resourceGroupName The name of the resource group . * @ param resourceName The name of the Application Insights component resource . * @ param favoriteId The Id of a specific favorite defined in the Application Insights component * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the ApplicationInsightsComponentFavoriteInner object */ public Observable < ApplicationInsightsComponentFavoriteInner > getAsync ( String resourceGroupName , String resourceName , String favoriteId ) { } }
return getWithServiceResponseAsync ( resourceGroupName , resourceName , favoriteId ) . map ( new Func1 < ServiceResponse < ApplicationInsightsComponentFavoriteInner > , ApplicationInsightsComponentFavoriteInner > ( ) { @ Override public ApplicationInsightsComponentFavoriteInner call ( ServiceResponse < ApplicationInsightsComponentFavoriteInner > response ) { return response . body ( ) ; } } ) ;
public class Counters { /** * Returns a Counter which is a weighted average of c1 and c2 . Counts from c1 * are weighted with weight w1 and counts from c2 are weighted with w2. */ public static < E > Counter < E > linearCombination ( Counter < E > c1 , double w1 , Counter < E > c2 , double w2 ) { } }
Counter < E > result = c1 . getFactory ( ) . create ( ) ; for ( E o : c1 . keySet ( ) ) { result . incrementCount ( o , c1 . getCount ( o ) * w1 ) ; } for ( E o : c2 . keySet ( ) ) { result . incrementCount ( o , c2 . getCount ( o ) * w2 ) ; } return result ;
public class Normalizer { /** * Normalize the character sequence < code > src < / code > according to the * normalization method < code > form < / code > . * @ param src character sequence to read for normalization * @ param form normalization form * @ return string normalized according to < code > form < / code > */ public static String normalize ( CharSequence src , Form form ) { } }
switch ( form ) { case NFD : return normalizeNFD ( src . toString ( ) ) ; case NFC : return normalizeNFC ( src . toString ( ) ) ; case NFKD : return normalizeNFKD ( src . toString ( ) ) ; case NFKC : return normalizeNFKC ( src . toString ( ) ) ; default : throw new AssertionError ( "unknown Form: " + form ) ; }
public class CalendarPanel { /** * labelIndicatorMouseExited , This event is called when the user move the mouse outside of a * monitored label . This is used to generate mouse over effects for the calendar panel . */ private void labelIndicatorMouseExited ( MouseEvent e ) { } }
JLabel label = ( ( JLabel ) e . getSource ( ) ) ; labelIndicatorSetColorsToDefaultState ( label ) ;
public class SVGParser { /** * Parse a rendering quality property */ private static RenderQuality parseRenderQuality ( String val ) { } }
switch ( val ) { case "auto" : return RenderQuality . auto ; case "optimizeQuality" : return RenderQuality . optimizeQuality ; case "optimizeSpeed" : return RenderQuality . optimizeSpeed ; default : return null ; }
public class ConsoleMenu { /** * Generates a menu with a list of options and return the value selected . * @ param title * for the command line * @ param optionNames * name for each option * @ param optionValues * value for each option * @ return String as selected by the user of the console app */ public static String selectOne ( final String title , final String [ ] optionNames , final String [ ] optionValues , final int defaultOption ) { } }
if ( optionNames . length != optionValues . length ) { throw new IllegalArgumentException ( "option names and values must have same length" ) ; } ConsoleMenu . println ( "Please chose " + title + DEFAULT_TITLE + defaultOption + ")" ) ; for ( int i = 0 ; i < optionNames . length ; i ++ ) { ConsoleMenu . println ( i + 1 + ") " + optionNames [ i ] ) ; } int choice ; do { choice = ConsoleMenu . getInt ( "Your Choice 1-" + optionNames . length + ": " , defaultOption ) ; } while ( choice <= 0 || choice > optionNames . length ) ; return optionValues [ choice - 1 ] ;
public class AWSSecretsManagerClient { /** * Cancels the scheduled deletion of a secret by removing the < code > DeletedDate < / code > time stamp . This makes the * secret accessible to query once again . * < b > Minimum permissions < / b > * To run this command , you must have the following permissions : * < ul > * < li > * secretsmanager : RestoreSecret * < / li > * < / ul > * < b > Related operations < / b > * < ul > * < li > * To delete a secret , use < a > DeleteSecret < / a > . * < / li > * < / ul > * @ param restoreSecretRequest * @ return Result of the RestoreSecret operation returned by the service . * @ throws ResourceNotFoundException * We can ' t find the resource that you asked for . * @ throws InvalidParameterException * You provided an invalid value for a parameter . * @ throws InvalidRequestException * You provided a parameter value that is not valid for the current state of the resource . < / p > * Possible causes : * < ul > * < li > * You tried to perform the operation on a secret that ' s currently marked deleted . * < / li > * < li > * You tried to enable rotation on a secret that doesn ' t already have a Lambda function ARN configured and * you didn ' t include such an ARN as a parameter in this call . * < / li > * @ throws InternalServiceErrorException * An error occurred on the server side . * @ sample AWSSecretsManager . RestoreSecret * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / secretsmanager - 2017-10-17 / RestoreSecret " target = " _ top " > AWS * API Documentation < / a > */ @ Override public RestoreSecretResult restoreSecret ( RestoreSecretRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeRestoreSecret ( request ) ;
public class Configuration { /** * Add a trailing file separator , if not found . Remove superfluous * file separators if any . Preserve the front double file separator for * UNC paths . * @ param path Path under consideration . * @ return String Properly constructed path string . */ public static String addTrailingFileSep ( String path ) { } }
String fs = System . getProperty ( "file.separator" ) ; String dblfs = fs + fs ; int indexDblfs ; while ( ( indexDblfs = path . indexOf ( dblfs , 1 ) ) >= 0 ) { path = path . substring ( 0 , indexDblfs ) + path . substring ( indexDblfs + fs . length ( ) ) ; } if ( ! path . endsWith ( fs ) ) path += fs ; return path ;
public class Predicates { /** * Returns a predicate that evaluates to { @ code true } if the class being tested is assignable * < b > TO < / b > { @ code clazz } , that is , if it is a < b > subtype < / b > of { @ code clazz } . Yes , this method * is named very incorrectly ! Example : < pre > { @ code * List < Class < ? > > classes = Arrays . asList ( * Object . class , String . class , Number . class , Long . class ) ; * return Iterables . filter ( classes , assignableFrom ( Number . class ) ) ; } < / pre > * The code above returns { @ code Number . class } and { @ code Long . class } , < b > not < / b > { @ code * Number . class } and { @ code Object . class } as the name implies ! * < p > The returned predicate does not allow null inputs . * @ deprecated Use the correctly - named method { @ link # subtypeOf } instead . * @ since 10.0 */ @ GwtIncompatible // Class . isAssignableFrom @ Beta @ Deprecated public static Predicate < Class < ? > > assignableFrom ( Class < ? > clazz ) { } }
return subtypeOf ( clazz ) ;
public class AWSsignerClient { /** * Returns information on a specific signing profile . * @ param getSigningProfileRequest * @ return Result of the GetSigningProfile operation returned by the service . * @ throws ResourceNotFoundException * A specified resource could not be found . * @ throws AccessDeniedException * You do not have sufficient access to perform this action . * @ throws ThrottlingException * The signing job has been throttled . * @ throws InternalServiceErrorException * An internal error occurred . * @ sample AWSsigner . GetSigningProfile * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / signer - 2017-08-25 / GetSigningProfile " target = " _ top " > AWS API * Documentation < / a > */ @ Override public GetSigningProfileResult getSigningProfile ( GetSigningProfileRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeGetSigningProfile ( request ) ;
public class TableInput { /** * These key - value pairs define properties associated with the table . * @ param parameters * These key - value pairs define properties associated with the table . * @ return Returns a reference to this object so that method calls can be chained together . */ public TableInput withParameters ( java . util . Map < String , String > parameters ) { } }
setParameters ( parameters ) ; return this ;
public class Closer { /** * Stores the given throwable and rethrows it . It will be rethrown as is if it is an * { @ code IOException } , { @ code RuntimeException } or { @ code Error } . Otherwise , it will be rethrown * wrapped in a { @ code RuntimeException } . < b > Note : < / b > Be sure to declare all of the checked * exception types your try block can throw when calling an overload of this method so as to avoid * losing the original exception type . * < p > This method always throws , and as such should be called as { @ code throw closer . rethrow ( e ) ; } * to ensure the compiler knows that it will throw . * @ return this method does not return ; it always throws * @ throws IOException when the given throwable is an IOException */ public RuntimeException rethrow ( Throwable e ) throws IOException { } }
Preconditions . checkNotNull ( e ) ; thrown = e ; Throwables . propagateIfPossible ( e , IOException . class ) ; throw new RuntimeException ( e ) ;
public class LTieFltConsumerBuilder { /** * One of ways of creating builder . This might be the only way ( considering all _ functional _ builders ) that might be utilize to specify generic params only once . */ @ Nonnull public static < T > LTieFltConsumerBuilder < T > tieFltConsumer ( Consumer < LTieFltConsumer < T > > consumer ) { } }
return new LTieFltConsumerBuilder ( consumer ) ;
public class FaceRecordMarshaller { /** * Marshall the given parameter object . */ public void marshall ( FaceRecord faceRecord , ProtocolMarshaller protocolMarshaller ) { } }
if ( faceRecord == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( faceRecord . getFace ( ) , FACE_BINDING ) ; protocolMarshaller . marshall ( faceRecord . getFaceDetail ( ) , FACEDETAIL_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class SRTP { /** * Starts a new SRTP Session , using the preset master key and salt to * generate the session keys * @ return error code */ public int startNewSession ( ) { } }
if ( txSessEncKey != null ) return SESSION_ERROR_ALREADY_ACTIVE ; if ( ( txMasterSalt == null ) || ( rxMasterSalt == null ) ) return SESSION_ERROR_MASTER_SALT_UDNEFINED ; if ( ( txMasterKey == null ) || ( rxMasterKey == null ) ) return SESSION_ERROR_MASTER_SALT_UDNEFINED ; if ( ! txSessionKeyDerivation ( ) ) { log ( "startNewSession txSessionKeyDerivation failed" ) ; return SESSION_ERROR_KEY_DERIVATION_FAILED ; } // Create encryptor components for tx session try { // and the HMAC components txEncryptorSuite = platform . getCrypto ( ) . createEncryptorSuite ( txSessEncKey , initVector ) ; txHMAC = platform . getCrypto ( ) . createHMACSHA1 ( txSessAuthKey ) ; } catch ( Throwable e ) { log ( "startNewSession failed to create Tx encryptor" ) ; return SESSION_ERROR_RESOURCE_CREATION_PROBLEM ; } replayWindow = platform . getUtils ( ) . createSortedVector ( ) ; receivedFirst = false ; rollOverCounter = 0 ; rxRoc = 0 ; txIV = new byte [ 16 ] ; // Always uses a 128 bit IV rxIV = new byte [ 16 ] ; txEncOut = new byte [ 16 ] ; rxEncOut = new byte [ 16 ] ; return SESSION_OK ;
public class Sequential { /** * Iterates through the subscribers , considering the type hierarchy , and * invokes the receiveO method . * @ param p * - The publish object . * @ return If a message was published to at least one subscriber , then it * will return true . Otherwise , false . */ private boolean consideringHierarchy ( Publish p ) { } }
boolean sent = false ; for ( Entry < Class < ? > , List < SubscriberParent > > e : p . mapping . entrySet ( ) ) { if ( e . getKey ( ) . isAssignableFrom ( p . message . getClass ( ) ) ) { for ( SubscriberParent parent : e . getValue ( ) ) { if ( ! predicateApplies ( parent . getSubscriber ( ) , p . message ) ) { continue ; } parent . getSubscriber ( ) . receiveO ( p . message ) ; sent = true ; } } } return sent ;
public class GoogleMapsUrlSigner { /** * Converts the given private key as String to an base 64 encoded byte array . * @ param yourGooglePrivateKeyString * the google private key as String * @ return the base 64 encoded byte array . */ public static byte [ ] convertToKeyByteArray ( String yourGooglePrivateKeyString ) { } }
yourGooglePrivateKeyString = yourGooglePrivateKeyString . replace ( '-' , '+' ) ; yourGooglePrivateKeyString = yourGooglePrivateKeyString . replace ( '_' , '/' ) ; return Base64 . getDecoder ( ) . decode ( yourGooglePrivateKeyString ) ;
public class ReadSerialDiagnosticsResponse { /** * readData - - Read the function code and data value * @ throws java . io . IOException If the data cannot be read */ public void readData ( DataInput din ) throws IOException { } }
function = din . readUnsignedShort ( ) ; data = ( short ) ( din . readShort ( ) & 0xFFFF ) ;
public class ControlMessageImpl { /** * Set the unique StreamId used by the flush protocol to determine * whether a stream is active or flushed . * Javadoc description supplied by CommonMessageHeaders interface . */ public final void setGuaranteedStreamUUID ( SIBUuid12 value ) { } }
if ( value != null ) jmo . setField ( ControlAccess . STREAMUUID , value . toByteArray ( ) ) ; else jmo . setField ( ControlAccess . STREAMUUID , null ) ;
public class CreateRule { /** * The time , in UTC , to start the operation . * The operation occurs within a one - hour window following the specified time . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setTimes ( java . util . Collection ) } or { @ link # withTimes ( java . util . Collection ) } if you want to override the * existing values . * @ param times * The time , in UTC , to start the operation . < / p > * The operation occurs within a one - hour window following the specified time . * @ return Returns a reference to this object so that method calls can be chained together . */ public CreateRule withTimes ( String ... times ) { } }
if ( this . times == null ) { setTimes ( new java . util . ArrayList < String > ( times . length ) ) ; } for ( String ele : times ) { this . times . add ( ele ) ; } return this ;
public class Policies { /** * The policies other than the stickiness policies . * @ param otherPolicies * The policies other than the stickiness policies . */ public void setOtherPolicies ( java . util . Collection < String > otherPolicies ) { } }
if ( otherPolicies == null ) { this . otherPolicies = null ; return ; } this . otherPolicies = new com . amazonaws . internal . SdkInternalList < String > ( otherPolicies ) ;
public class TableFormatter { /** * Writes the table to a resource . * @ param resource the resource to write to * @ return the resource written to * @ throws IOException Something went wrong writing to the resource */ public Resource write ( @ NonNull Resource resource ) throws IOException { } }
Resource stringResource = new StringResource ( ) ; try ( PrintStream printStream = new PrintStream ( stringResource . outputStream ( ) ) ) { print ( printStream ) ; } resource . write ( stringResource . readToString ( ) ) ; return resource ;
public class BlockReader { /** * Java Doc required */ public static BlockReader newBlockReader ( int dataTransferVersion , int namespaceId , Socket sock , String file , long blockId , long genStamp , long startOffset , long len , int bufferSize , boolean verifyChecksum ) throws IOException { } }
return newBlockReader ( dataTransferVersion , namespaceId , sock , file , blockId , genStamp , startOffset , len , bufferSize , verifyChecksum , "" , Long . MAX_VALUE , - 1 , false , null , new ReadOptions ( ) ) ;
public class BindParameterMapperManager { /** * 指定されたパラメータをPreparedStatementにセットするパラメータに変換 * @ param object 指定パラメータ * @ param connection パラメータ生成用にConnectionを渡す * @ return PreparedStatementにセットするパラメータ */ @ SuppressWarnings ( "unchecked" ) public Object toJdbc ( final Object object , final Connection connection ) { } }
if ( object == null ) { return null ; } for ( @ SuppressWarnings ( "rawtypes" ) BindParameterMapper parameterMapper : mappers ) { if ( parameterMapper . canAccept ( object ) ) { return parameterMapper . toJdbc ( object , connection , this ) ; } } if ( object instanceof Boolean || object instanceof Byte || object instanceof Short || object instanceof Integer || object instanceof Long || object instanceof Float || object instanceof Double || object instanceof BigDecimal || object instanceof String || object instanceof byte [ ] || object instanceof java . sql . Date || object instanceof java . sql . Time || object instanceof java . sql . Timestamp || object instanceof java . sql . Array || object instanceof java . sql . Ref || object instanceof java . sql . Blob || object instanceof java . sql . Clob || object instanceof java . sql . SQLXML || object instanceof java . sql . Struct ) { return object ; } for ( @ SuppressWarnings ( "rawtypes" ) BindParameterMapper parameterMapper : DEFAULT_MAPPERS ) { if ( parameterMapper . canAccept ( object ) ) { return parameterMapper . toJdbc ( object , connection , this ) ; } } return object ;
public class InjectionEngineAccessor { /** * F46994.2 */ static void setInjectionEngine ( InternalInjectionEngine ie ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "setInjectionEngine : " + ie ) ; svInstance = ie ;
public class SQLMultiScopeRecoveryLog { /** * Attempts to replay the cached up SQL work if an error is * encountered during open log processing and if the error is * determined to be transient . * @ return true if the error cannot be handled and should be * reported . */ private boolean handleOpenLogSQLException ( SQLException sqlex ) throws InterruptedException { } }
if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "handleOpenLogSQLException" , new java . lang . Object [ ] { sqlex , this } ) ; boolean retryBatch = true ; boolean failAndReport = false ; int batchRetries = 0 ; // Set the exception that will be reported _nonTransientExceptionAtOpen = sqlex ; Connection conn = null ; while ( retryBatch && ! failAndReport && batchRetries < _transientRetryAttempts ) { // Should we attempt to reconnect ? This method works through the set of SQL exceptions and will // return TRUE if we determine that a transient DB error has occurred retryBatch = sqlTransientErrorHandlingEnabled && isSQLErrorTransient ( sqlex ) ; batchRetries ++ ; if ( retryBatch ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Try to reexecute the SQL using connection from DS: " + _theDS + ", attempt number: " + batchRetries ) ; if ( _theDS != null ) { // Re - execute the SQL try { // Get a connection to database via its datasource conn = _theDS . getConnection ( ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Acquired connection in Database retry scenario" ) ; conn . setAutoCommit ( false ) ; Statement lockingStmt = conn . createStatement ( ) ; // Use RDBMS SELECT FOR UPDATE to lock table for recovery String queryString = "SELECT SERVER_NAME" + " FROM " + _recoveryTableName + _logIdentifierString + _recoveryTableNameSuffix + " WHERE RU_ID=" + "-1 FOR UPDATE" ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Attempt to select the HA LOCKING ROW for UPDATE - " + queryString ) ; ResultSet lockingRS = lockingStmt . executeQuery ( queryString ) ; // Update the HA DB lock and then recover updateHADBLock ( conn , lockingStmt , lockingRS ) ; // Clear out recovery caches in case they were partially filled before the failure . _recoverableUnits . clear ( ) ; _recUnitIdTable = new RecoverableUnitIdTable ( ) ; // Drive recover again recover ( conn ) ; conn . commit ( ) ; // The Batch has executed successfully and we can continue processing retryBatch = false ; } catch ( SQLException sqlex2 ) { // We ' ve caught another SQLException . Assume that we ' ve retried the connection too soon . // Make sure we inspect the latest exception if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "reset the sqlex to " + sqlex2 ) ; sqlex = sqlex2 ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "sleeping for " + _transientRetrySleepTime + " millisecs" ) ; Thread . sleep ( _transientRetrySleepTime ) ; } catch ( Throwable exc ) { // Not a SQLException , break out of the loop and report the exception if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Failed got exception: " + exc ) ; for ( StackTraceElement ste : Thread . currentThread ( ) . getStackTrace ( ) ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , " " + ste ) ; } failAndReport = true ; _nonTransientExceptionAtOpen = exc ; } finally { // Tidy up the connection and its artefacets , if we can but allow // processing to continue on the pre - determined path if we cannot . if ( conn != null ) { if ( retryBatch ) { // Attempt a rollback . If it fails , trace the failure but allow processing to continue try { conn . rollback ( ) ; } catch ( Throwable exc ) { // Trace the exception if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Rollback Failed, when handling OpenLog SQLException, got exception: " + exc ) ; } } // Attempt a close . If it fails , trace the failure but allow processing to continue try { conn . close ( ) ; } catch ( Throwable exc ) { // Trace the exception if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Close Failed, when handling OpenLog SQLException, got exception: " + exc ) ; } } } } else { // This is unexpected and catastrophic , the reference to the DataSource is null if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "NULL DataSource reference" ) ; failAndReport = true ; } } else failAndReport = true ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "handleOpenLogSQLException" , failAndReport ) ; return failAndReport ;
public class AlexaRequestStreamHandler { /** * The handler method is called on a Lambda execution . * @ param input the input stream containing the Lambda request payload * @ param output the output stream containing the Lambda response payload * @ param context a context for a Lambda execution . * @ throws IOException exception is thrown on invalid request payload or on a provided speechlet * handler having no public constructor taking a String containing the locale */ @ Override public void handleRequest ( final InputStream input , final OutputStream output , final Context context ) throws IOException { } }
byte [ ] serializedSpeechletRequest = IOUtils . toByteArray ( input ) ; final AlexaSpeechlet speechlet = AlexaSpeechletFactory . createSpeechletFromRequest ( serializedSpeechletRequest , getSpeechlet ( ) , getUtteranceReader ( ) ) ; final SpeechletRequestHandler handler = getRequestStreamHandler ( ) ; try { byte [ ] outputBytes = handler . handleSpeechletCall ( speechlet , serializedSpeechletRequest ) ; output . write ( outputBytes ) ; } catch ( SpeechletRequestHandlerException | SpeechletException e ) { // wrap actual exception in expected IOException throw new IOException ( e ) ; }
public class SibRaConnection { /** * Receives a message . Checks that the connection is valid . Maps the * transaction parameter before delegating . * @ param tran * the transaction to receive the message under * @ param unrecoverableReliability * the unrecoverable reliability * @ param destinationAddress * the destination to receive the message from * @ param destType * the type for the destination * @ param criteria * the selection criteria * @ param reliability * the reliability * @ param alternateUser * the name of the user under whose authority the receive should * be performed ( may be null ) * @ return the message or < code > null < / code > if none was available * @ throws SINotPossibleInCurrentConfigurationException * if the delegation fails * @ throws SIIncorrectCallException * if the transaction parameter is not valid given the current * application and container transactions * @ throws SIErrorException * if the delegation fails * @ throws SIResourceException * if the current container transaction cannot be determined * @ throws SITemporaryDestinationNotFoundException * if the delegation fails * @ throws SIDestinationLockedException * if the delegation fails * @ throws SINotAuthorizedException * if the delegation fails * @ throws SILimitExceededException * 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 SIBusMessage receiveNoWait ( final SITransaction tran , final Reliability unrecoverableReliability , final SIDestinationAddress destinationAddress , final DestinationType destType , final SelectionCriteria criteria , final Reliability reliability , final String alternateUser ) throws SIConnectionDroppedException , SIConnectionUnavailableException , SIConnectionLostException , SILimitExceededException , SINotAuthorizedException , SIDestinationLockedException , SITemporaryDestinationNotFoundException , SIResourceException , SIErrorException , SIIncorrectCallException , SINotPossibleInCurrentConfigurationException { } }
checkValid ( ) ; return _delegateConnection . receiveNoWait ( mapTransaction ( tran ) , unrecoverableReliability , destinationAddress , destType , criteria , reliability , alternateUser ) ;
public class LineBufferedReader { /** * Returns the current line in the buffer . Or empty string if not usable . * @ return The line string , not including the line - break . */ @ Nonnull public String getLine ( ) { } }
if ( preLoaded ) { if ( bufferOffset >= 0 ) { int lineStart = bufferOffset ; if ( linePos > 0 ) { lineStart -= linePos - 1 ; } int lineEnd = bufferOffset ; while ( lineEnd < bufferLimit && buffer [ lineEnd ] != '\n' ) { ++ lineEnd ; } return new String ( buffer , lineStart , lineEnd - lineStart ) ; } } else if ( bufferLimit > 0 ) { if ( Math . abs ( ( linePos - 1 ) - bufferOffset ) < 2 ) { // only return the line if the line has not been consolidated before the // exception . This should avoid showing a bad exception line pointing to // the wrong content . This should never be the case in pretty - printed // JSON unless some really really long strings are causing the error . // Since linePos does not exactly follow offset , we must accept + - 1. return new String ( buffer , 0 , bufferLimit - ( bufferLineEnd ? 1 : 0 ) ) ; } } // Otherwise we don ' t have the requested line , return empty string . return "" ;
public class Exceptional { /** * Returns inner value if there were no exceptions , otherwise returns value produced by supplier function . * @ param other the supplier function that produces value if there were any exception * @ return inner value if there were no exceptions , otherwise value produced by supplier function * @ since 1.1.9 */ @ Nullable public T getOrElse ( @ NotNull Supplier < ? extends T > other ) { } }
return throwable == null ? value : other . get ( ) ;
public class DAO { /** * / * - - - - - [ Delete ] - - - - - */ public int delete ( String query , Object ... args ) throws DAOException { } }
if ( query == null ) query = "" ; return jdbc . executeUpdate ( "DELETE FROM " + table . name + " " + query , args ) ;
public class WebJsptaglibraryDescriptorImpl { /** * If not already created , a new < code > function < / code > element will be created and returned . * Otherwise , the first existing < code > function < / code > element will be returned . * @ return the instance defined for the element < code > function < / code > */ public FunctionType < WebJsptaglibraryDescriptor > getOrCreateFunction ( ) { } }
List < Node > nodeList = model . get ( "function" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new FunctionTypeImpl < WebJsptaglibraryDescriptor > ( this , "function" , model , nodeList . get ( 0 ) ) ; } return createFunction ( ) ;
public class AudioWife { /** * Sets the audio play functionality on click event of this view . You can set { @ link android . widget . Button } or * an { @ link android . widget . ImageView } as audio play control * @ see nl . changer . audiowife . AudioWife # addOnPauseClickListener ( android . view . View . OnClickListener ) */ public AudioWife setPlayView ( View play ) { } }
if ( play == null ) { throw new NullPointerException ( "PlayView cannot be null" ) ; } if ( mHasDefaultUi ) { Log . w ( TAG , "Already using default UI. Setting play view will have no effect" ) ; return this ; } mPlayButton = play ; initOnPlayClick ( ) ; return this ;
public class DividableGridAdapter { /** * Returns , whether the item at a specific index is enabled , or not . * @ param index * The index of the item , which should be checked , as an { @ link Integer } value * @ return True , if the item is enabled , false otherwise */ public final boolean isItemEnabled ( final int index ) { } }
AbstractItem item = items . get ( index ) ; return item instanceof Item && ( ( Item ) item ) . isEnabled ( ) ;
public class CustomFieldContainer { /** * When an alias for a field is added , index it here to allow lookup by alias and type . * @ param type field type * @ param alias field alias */ void registerAlias ( FieldType type , String alias ) { } }
m_aliasMap . put ( new Pair < FieldTypeClass , String > ( type . getFieldTypeClass ( ) , alias ) , type ) ;
public class FVVisitor { /** * Get the parameters types from the function signature . * @ return An array of parameter class names */ private String [ ] getParameters ( ELNode . Function func ) throws JspTranslationException { } }
FunctionInfo funcInfo = func . getFunctionInfo ( ) ; String signature = funcInfo . getFunctionSignature ( ) ; ArrayList params = new ArrayList ( ) ; // Signature is of the form // < return - type > S < method - name S ? ' ( ' // < < arg - type > ( ' , ' < arg - type > ) * ) ? ' ) ' int start = signature . indexOf ( '(' ) + 1 ; boolean lastArg = false ; while ( true ) { int p = signature . indexOf ( ',' , start ) ; if ( p < 0 ) { p = signature . indexOf ( ')' , start ) ; if ( p < 0 ) { throw new JspTranslationException ( "jsp.error.tld.fn.invalid.signature " + func . getPrefix ( ) + " " + func . getName ( ) ) ; } lastArg = true ; } String arg = signature . substring ( start , p ) . trim ( ) ; if ( ! "" . equals ( arg ) ) { params . add ( arg ) ; } if ( lastArg ) { break ; } start = p + 1 ; } return ( String [ ] ) params . toArray ( new String [ params . size ( ) ] ) ;
public class ConversationAwareViewHandler { /** * Allow the delegate to produce the action URL . If the conversation is * long - running , append the conversation id request parameter to the query * string part of the URL , but only if the request parameter is not already * present . * This covers form actions Ajax calls , and redirect URLs ( which we want ) and * link hrefs ( which we don ' t ) * @ see { @ link ViewHandler # getActionURL ( FacesContext , String ) } */ @ Override public String getActionURL ( FacesContext facesContext , String viewId ) { } }
if ( contextId == null ) { if ( facesContext . getAttributes ( ) . containsKey ( Container . CONTEXT_ID_KEY ) ) { contextId = ( String ) facesContext . getAttributes ( ) . get ( Container . CONTEXT_ID_KEY ) ; } else { contextId = RegistrySingletonProvider . STATIC_INSTANCE ; } } String actionUrl = super . getActionURL ( facesContext , viewId ) ; final ConversationContext ctx = getConversationContext ( contextId ) ; if ( ctx != null && ctx . isActive ( ) && ! getSource ( ) . equals ( Source . BOOKMARKABLE ) && ! ctx . getCurrentConversation ( ) . isTransient ( ) ) { return new FacesUrlTransformer ( actionUrl , facesContext ) . appendConversationIdIfNecessary ( getConversationContext ( contextId ) . getParameterName ( ) , ctx . getCurrentConversation ( ) . getId ( ) ) . getUrl ( ) ; } else { return actionUrl ; }
public class TypeExtractionUtils { /** * Checks whether the given type has the generic parameters declared in the class definition . * @ param t type to be validated */ public static void validateLambdaType ( Class < ? > baseClass , Type t ) { } }
if ( ! ( t instanceof Class ) ) { return ; } final Class < ? > clazz = ( Class < ? > ) t ; if ( clazz . getTypeParameters ( ) . length > 0 ) { throw new InvalidTypesException ( "The generic type parameters of '" + clazz . getSimpleName ( ) + "' are missing. " + "In many cases lambda methods don't provide enough information for automatic type extraction when Java generics are involved. " + "An easy workaround is to use an (anonymous) class instead that implements the '" + baseClass . getName ( ) + "' interface. " + "Otherwise the type has to be specified explicitly using type information." ) ; }
public class Branch { /** * - - - - - Content Indexing methods - - - - - / / */ public void registerView ( BranchUniversalObject branchUniversalObject , BranchUniversalObject . RegisterViewStatusListener callback ) { } }
if ( context_ != null ) { new BranchEvent ( BRANCH_STANDARD_EVENT . VIEW_ITEM ) . addContentItems ( branchUniversalObject ) . logEvent ( context_ ) ; }
public class AbstractFlagEncoder { /** * Sets default flags with specified access . */ protected void flagsDefault ( IntsRef edgeFlags , boolean forward , boolean backward ) { } }
if ( forward ) speedEncoder . setDecimal ( false , edgeFlags , speedDefault ) ; if ( backward ) speedEncoder . setDecimal ( true , edgeFlags , speedDefault ) ; accessEnc . setBool ( false , edgeFlags , forward ) ; accessEnc . setBool ( true , edgeFlags , backward ) ;
public class SolverAggregatorConnection { /** * Called when the aggregator sends a sample . Enqueues the sample into the internal buffer . * @ param aggregator the aggregator that sent the sample . * @ param sample the sample that was sent . */ void sampleReceived ( SolverAggregatorInterface aggregator , SampleMessage sample ) { } }
if ( ! this . sampleQueue . offer ( sample ) && this . warnBufferFull ) { log . warn ( "Unable to insert a sample due to a full buffer." ) ; }
public class MembershipHandlerImpl { /** * Remove membership record . */ void removeMembership ( Node refUserNode , Node refTypeNode ) throws Exception { } }
refTypeNode . remove ( ) ; if ( ! refUserNode . hasNodes ( ) ) { refUserNode . remove ( ) ; }
public class TypeConversion { /** * A utility method to convert the int from the byte array to an int . * @ param bytes * The byte array containing the int . * @ param offset * The index at which the int is located . * @ return The int value . */ public static int bytesToInt ( byte [ ] bytes , int offset ) { } }
return ( ( bytes [ offset + 3 ] & 0xFF ) << 0 ) + ( ( bytes [ offset + 2 ] & 0xFF ) << 8 ) + ( ( bytes [ offset + 1 ] & 0xFF ) << 16 ) + ( ( bytes [ offset + 0 ] & 0xFF ) << 24 ) ;
public class TextRankSentence { /** * 将句子列表转化为文档 * @ param sentenceList * @ return */ private static List < List < String > > convertSentenceListToDocument ( List < String > sentenceList ) { } }
List < List < String > > docs = new ArrayList < List < String > > ( sentenceList . size ( ) ) ; for ( String sentence : sentenceList ) { List < Term > termList = StandardTokenizer . segment ( sentence . toCharArray ( ) ) ; List < String > wordList = new LinkedList < String > ( ) ; for ( Term term : termList ) { if ( CoreStopWordDictionary . shouldInclude ( term ) ) { wordList . add ( term . word ) ; } } docs . add ( wordList ) ; } return docs ;
public class CellGridImpl { /** * / * ( non - Javadoc ) * @ see org . drools . examples . conway . CellGrid # setPattern ( org . drools . examples . conway . patterns . ConwayPattern ) */ public void setPattern ( final ConwayPattern pattern ) { } }
final boolean [ ] [ ] gridData = pattern . getPattern ( ) ; int gridWidth = gridData [ 0 ] . length ; int gridHeight = gridData . length ; int columnOffset = 0 ; int rowOffset = 0 ; if ( gridWidth > getNumberOfColumns ( ) ) { gridWidth = getNumberOfColumns ( ) ; } else { columnOffset = ( getNumberOfColumns ( ) - gridWidth ) / 2 ; } if ( gridHeight > getNumberOfRows ( ) ) { gridHeight = getNumberOfRows ( ) ; } else { rowOffset = ( getNumberOfRows ( ) - gridHeight ) / 2 ; } this . delegate . killAll ( ) ; for ( int column = 0 ; column < gridWidth ; column ++ ) { for ( int row = 0 ; row < gridHeight ; row ++ ) { if ( gridData [ row ] [ column ] ) { final Cell cell = getCellAt ( row + rowOffset , column + columnOffset ) ; updateCell ( cell , CellState . LIVE ) ; } } } // this . delegate . setPattern ( ) ;
public class BasicStreamReader { /** * Method called to parse quoted xml declaration pseudo - attribute values . * Works similar to attribute value parsing , except no entities can be * included , and in general need not be as picky ( since caller is to * verify contents ) . One exception is that we do check for linefeeds * and lt chars , since they generally would indicate problems and * are useful to catch early on ( can happen if a quote is missed etc ) * Note : since it ' ll be called at most 3 times per document , this method * is not optimized too much . */ protected final void parseQuoted ( String name , char quoteChar , TextBuffer tbuf ) throws XMLStreamException { } }
if ( quoteChar != '"' && quoteChar != '\'' ) { throwUnexpectedChar ( quoteChar , " in xml declaration; waited ' or \" to start a value for pseudo-attribute '" + name + "'" ) ; } char [ ] outBuf = tbuf . getCurrentSegment ( ) ; int outPtr = 0 ; while ( true ) { char c = ( mInputPtr < mInputEnd ) ? mInputBuffer [ mInputPtr ++ ] : getNextChar ( SUFFIX_IN_XML_DECL ) ; if ( c == quoteChar ) { break ; } if ( c < CHAR_SPACE || c == '<' ) { throwUnexpectedChar ( c , SUFFIX_IN_XML_DECL ) ; } else if ( c == CHAR_NULL ) { throwNullChar ( ) ; } if ( outPtr >= outBuf . length ) { outBuf = tbuf . finishCurrentSegment ( ) ; outPtr = 0 ; } outBuf [ outPtr ++ ] = c ; } tbuf . setCurrentLength ( outPtr ) ;