signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class ExceptionUtil { /** * 使用运行时异常包装编译异常 * @ param throwable 异常 * @ return 运行时异常 */ public static RuntimeException wrapRuntime ( Throwable throwable ) { } }
if ( throwable instanceof RuntimeException ) { return ( RuntimeException ) throwable ; } if ( throwable instanceof Error ) { throw ( Error ) throwable ; } return new RuntimeException ( throwable ) ;
public class AbstractSimpleDAO { /** * This method must be called every time something changed in the DAO . It * triggers the writing to a file if auto - save is active . This method must be * called within a write - lock as it is not locked ! */ @ MustBeLocked ( ELockType . WRITE ) protected final void markAsChanged ( ) { } }
// Just remember that something changed internalSetPendingChanges ( true ) ; if ( internalIsAutoSaveEnabled ( ) ) { // Auto save if ( _writeToFile ( ) . isSuccess ( ) ) internalSetPendingChanges ( false ) ; else { if ( LOGGER . isErrorEnabled ( ) ) LOGGER . error ( "The DAO of class " + getClass ( ) . getName ( ) + " still has pending changes after markAsChanged!" ) ; } }
public class ListDatastoresResult { /** * A list of " DatastoreSummary " objects . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setDatastoreSummaries ( java . util . Collection ) } or { @ link # withDatastoreSummaries ( java . util . Collection ) } if * you want to override the existing values . * @ param datastoreSummaries * A list of " DatastoreSummary " objects . * @ return Returns a reference to this object so that method calls can be chained together . */ public ListDatastoresResult withDatastoreSummaries ( DatastoreSummary ... datastoreSummaries ) { } }
if ( this . datastoreSummaries == null ) { setDatastoreSummaries ( new java . util . ArrayList < DatastoreSummary > ( datastoreSummaries . length ) ) ; } for ( DatastoreSummary ele : datastoreSummaries ) { this . datastoreSummaries . add ( ele ) ; } return this ;
public class CommandFactory { /** * This is used to initialise a player . * @ param teamName The team the player belongs to . * @ param isGoalie If the player is a goalie . Note : Only one goalie per team . */ public void addPlayerInitCommand ( String teamName , boolean isGoalie ) { } }
StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(init " ) ; buf . append ( teamName ) ; buf . append ( " (version " ) ; if ( isGoalie ) { buf . append ( serverVersion ) ; buf . append ( ") (goalie))" ) ; } else { buf . append ( serverVersion ) ; buf . append ( "))" ) ; } fifo . add ( fifo . size ( ) , buf . toString ( ) ) ;
public class Cache { /** * 查找所有符合给定模式 pattern 的 key 。 * KEYS * 匹配数据库中所有 key 。 * KEYS h ? llo 匹配 hello , hallo 和 hxllo 等 。 * KEYS h * llo 匹配 hllo 和 heeeeello 等 。 * KEYS h [ ae ] llo 匹配 hello 和 hallo , 但不匹配 hillo 。 * 特殊符号用 \ 隔开 */ public Set < String > keys ( String pattern ) { } }
Jedis jedis = getJedis ( ) ; try { return jedis . keys ( pattern ) ; } finally { close ( jedis ) ; }
public class AccountsInner { /** * Lists the Data Lake Store accounts within a specific resource group . The response includes a link to the next page of results , if any . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; DataLakeStoreAccountBasicInner & gt ; object */ public Observable < Page < DataLakeStoreAccountBasicInner > > listByResourceGroupNextAsync ( final String nextPageLink ) { } }
return listByResourceGroupNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < DataLakeStoreAccountBasicInner > > , Page < DataLakeStoreAccountBasicInner > > ( ) { @ Override public Page < DataLakeStoreAccountBasicInner > call ( ServiceResponse < Page < DataLakeStoreAccountBasicInner > > response ) { return response . body ( ) ; } } ) ;
public class Zips { /** * 压缩 * @ param sources * 源 ( 文件或目录 ) 可以是多个文件和多个文件夹 * @ param target * 目标 ( 只能是目录 ) * @ param compressFileName * 压缩后的文件名称 ( 如果为Null , 则使用源的名称 ) * @ throws Exception */ public static void zip ( File [ ] sources , File target , String compressFileName ) throws IOException { } }
$ . notEmpty ( sources ) ; $ . notNull ( target ) ; if ( ! target . isDirectory ( ) ) { throw new IllegalArgumentException ( "The target can be a directory" ) ; } // 压缩后文件的名称 compressFileName = $ . notEmpty ( compressFileName ) ? compressFileName : sources [ 0 ] . getName ( ) + ".zip" ; FileOutputStream fileOut = new FileOutputStream ( target . getAbsolutePath ( ) + File . separator + compressFileName ) ; ZipArchiveOutputStream zipOut = new ZipArchiveOutputStream ( fileOut ) ; for ( int i = 0 ; i < sources . length ; i ++ ) { compress ( sources [ i ] , zipOut , null ) ; } zipOut . close ( ) ;
public class EquirectangularTools_F32 { /** * Convert from latitude - longitude coordinates into equirectangular coordinates * @ param lat Latitude * @ param lon Longitude * @ param rect ( Output ) equirectangular coordinate */ public void latlonToEqui ( float lat , float lon , Point2D_F32 rect ) { } }
rect . x = UtilAngle . wrapZeroToOne ( lon / GrlConstants . F_PI2 + 0.5f ) * width ; rect . y = UtilAngle . reflectZeroToOne ( lat / GrlConstants . F_PI + 0.5f ) * ( height - 1 ) ;
public class Security { /** * https : / / www . owasp . org / index . php / XML _ External _ Entity _ ( XXE ) _ Prevention _ Cheat _ Sheet # JAXP _ DocumentBuilderFactory . 2C _ SAXParserFactory _ and _ DOM4J */ public static void secureSaxParser ( SAXParserFactory factory ) throws ParserConfigurationException , SAXNotRecognizedException , SAXNotSupportedException { } }
String FEATURE = null ; // This is the PRIMARY defense . If DTDs ( doctypes ) are disallowed , almost all XML entity attacks are prevented // Xerces 2 only - http : / / xerces . apache . org / xerces2 - j / features . html # disallow - doctype - decl FEATURE = "http://apache.org/xml/features/disallow-doctype-decl" ; factory . setFeature ( FEATURE , true ) ; // If you can ' t completely disable DTDs , then at least do the following : // Xerces 1 - http : / / xerces . apache . org / xerces - j / features . html # external - general - entities // Xerces 2 - http : / / xerces . apache . org / xerces2 - j / features . html # external - general - entities // JDK7 + - http : / / xml . org / sax / features / external - general - entities FEATURE = "http://xml.org/sax/features/external-general-entities" ; factory . setFeature ( FEATURE , false ) ; // Xerces 1 - http : / / xerces . apache . org / xerces - j / features . html # external - parameter - entities // Xerces 2 - http : / / xerces . apache . org / xerces2 - j / features . html # external - parameter - entities // JDK7 + - http : / / xml . org / sax / features / external - parameter - entities FEATURE = "http://xml.org/sax/features/external-parameter-entities" ; factory . setFeature ( FEATURE , false ) ; // Disable external DTDs as well FEATURE = "http://apache.org/xml/features/nonvalidating/load-external-dtd" ; factory . setFeature ( FEATURE , false ) ; // and these as well , per Timothy Morgan ' s 2014 paper : " XML Schema , DTD , and Entity Attacks " factory . setXIncludeAware ( false ) ; // factory . setExpandEntityReferences ( false ) ; / / not supported by sax factory // And , per Timothy Morgan : " If for some reason support for inline DOCTYPEs are a requirement , then // ensure the entity settings are disabled ( as shown above ) and beware that SSRF attacks // ( http : / / cwe . mitre . org / data / definitions / 918 . html ) and denial // of service attacks ( such as billion laughs or decompression bombs via " jar : " ) are a risk . " // remaining parser logic factory . setValidating ( false ) ;
public class WorkflowsInner { /** * Validates the workflow . * @ param resourceGroupName The resource group name . * @ param workflowName The workflow name . * @ param validate The workflow . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < Void > validateWorkflowAsync ( String resourceGroupName , String workflowName , WorkflowInner validate , final ServiceCallback < Void > serviceCallback ) { } }
return ServiceFuture . fromResponse ( validateWorkflowWithServiceResponseAsync ( resourceGroupName , workflowName , validate ) , serviceCallback ) ;
public class PathFileObject { /** * Create a PathFileObject whose binary name can be inferred from the * relative path to a sibling . */ static PathFileObject createSiblingPathFileObject ( JavacPathFileManager fileManager , final Path path , final String relativePath ) { } }
return new PathFileObject ( fileManager , path ) { @ Override String inferBinaryName ( Iterable < ? extends Path > paths ) { return toBinaryName ( relativePath , "/" ) ; } } ;
public class SerializationUtils { /** * Serialize and encode object byte [ ] . * @ param cipher the cipher * @ param object the object * @ return the byte [ ] */ public static byte [ ] serializeAndEncodeObject ( final CipherExecutor cipher , final Serializable object ) { } }
return serializeAndEncodeObject ( cipher , object , ArrayUtils . EMPTY_OBJECT_ARRAY ) ;
public class Bean { /** * Overwrite / replace the current references with the provided reference . * @ param propertyName name of the property as defined by the bean ' s schema . * @ param values override */ public void setReferences ( final String propertyName , final List < BeanId > values ) { } }
Preconditions . checkNotNull ( propertyName ) ; if ( values == null || values . size ( ) == 0 ) { references . put ( propertyName , null ) ; return ; } checkCircularReference ( values . toArray ( new BeanId [ values . size ( ) ] ) ) ; references . put ( propertyName , values ) ;
public class GeometryUtils { /** * Compute two arbitrary vectors perpendicular to the given normalized vector < code > ( x , y , z ) < / code > , and store them in < code > dest1 < / code > and < code > dest2 < / code > , * respectively . * The computed vectors will themselves be perpendicular to each another and normalized . So the tree vectors < code > ( x , y , z ) < / code > , < code > dest1 < / code > and * < code > dest2 < / code > form an orthonormal basis . * @ param x * the x coordinate of the normalized input vector * @ param y * the y coordinate of the normalized input vector * @ param z * the z coordinate of the normalized input vector * @ param dest1 * will hold the first perpendicular vector * @ param dest2 * will hold the second perpendicular vector */ public static void perpendicular ( float x , float y , float z , Vector3f dest1 , Vector3f dest2 ) { } }
float magX = z * z + y * y ; float magY = z * z + x * x ; float magZ = y * y + x * x ; float mag ; if ( magX > magY && magX > magZ ) { dest1 . x = 0 ; dest1 . y = z ; dest1 . z = - y ; mag = magX ; } else if ( magY > magZ ) { dest1 . x = z ; dest1 . y = 0 ; dest1 . z = x ; mag = magY ; } else { dest1 . x = y ; dest1 . y = - x ; dest1 . z = 0 ; mag = magZ ; } float len = 1.0f / ( float ) Math . sqrt ( mag ) ; dest1 . x *= len ; dest1 . y *= len ; dest1 . z *= len ; dest2 . x = y * dest1 . z - z * dest1 . y ; dest2 . y = z * dest1 . x - x * dest1 . z ; dest2 . z = x * dest1 . y - y * dest1 . x ;
public class ExtendedPalette { /** * factory method for the removeAll component * @ return removeAll component */ protected Component newRemoveAllComponent ( ) { } }
return new PaletteButton ( "removeAllButton" ) { private static final long serialVersionUID = 1L ; protected void onComponentTag ( ComponentTag tag ) { super . onComponentTag ( tag ) ; tag . getAttributes ( ) . put ( "onclick" , getRemoveAllOnClickJS ( ) ) ; } } ;
public class JQMPage { /** * Forcefully recalculates ( if defined , and just once ) page content height * ( needed when content area size is changed , because there is no good way to get resize * notification for DOM elements ) . */ public void recalcContentHeightPercent ( ) { } }
if ( stopPartsPositioning ) return ; if ( ! isVisible ( ) ) return ; Element contentElt = content . getElement ( ) ; if ( contentHeightPercent > 0 ) { final JQMHeader header = getHeader ( ) ; final JQMFooter footer = getFooter ( ) ; int headerH = header == null || isFixedToolbarsHidden ( ) ? 0 : header . getOffsetHeight ( ) ; int footerH = footer == null || isFixedToolbarsHidden ( ) ? 0 : footer . getOffsetHeight ( ) ; int windowH = Window . getClientHeight ( ) ; int clientH = contentElt . getPropertyInt ( "clientHeight" ) ; int offsetH = contentElt . getPropertyInt ( "offsetHeight" ) ; int diff = offsetH - clientH ; // border , . . . if ( diff < 0 ) diff = 0 ; double h = ( windowH - headerH - footerH - diff ) * 0.01d * contentHeightPercent ; h = Math . floor ( h ) ; contentElt . getStyle ( ) . setProperty ( "minHeight" , String . valueOf ( Math . round ( h ) ) + "px" ) ; contentElt . getStyle ( ) . setProperty ( "paddingTop" , "0" ) ; contentElt . getStyle ( ) . setProperty ( "paddingBottom" , "0" ) ; } else { contentElt . getStyle ( ) . clearProperty ( "minHeight" ) ; contentElt . getStyle ( ) . clearProperty ( "paddingTop" ) ; contentElt . getStyle ( ) . clearProperty ( "paddingBottom" ) ; }
public class XmlParser { /** * Parse the content of an element . * < pre > * [ 43 ] content : : = ( element | CharData | Reference * | CDSect | PI | Comment ) * * [ 67 ] Reference : : = EntityRef | CharRef * < / pre > * NOTE : consumes ETtag . */ private void parseContent ( ) throws Exception { } }
char c ; while ( true ) { // consume characters ( or ignorable whitspace ) until delimiter parseCharData ( ) ; // Handle delimiters c = readCh ( ) ; switch ( c ) { case '&' : // Found " & " c = readCh ( ) ; if ( c == '#' ) { parseCharRef ( ) ; } else { unread ( c ) ; parseEntityRef ( true ) ; } isDirtyCurrentElement = true ; break ; case '<' : // Found " < " dataBufferFlush ( ) ; c = readCh ( ) ; switch ( c ) { case '!' : // Found " < ! " c = readCh ( ) ; switch ( c ) { case '-' : // Found " < ! - " require ( '-' ) ; isDirtyCurrentElement = false ; parseComment ( ) ; break ; case '[' : // Found " < ! [ " isDirtyCurrentElement = false ; require ( "CDATA[" ) ; handler . startCDATA ( ) ; inCDATA = true ; parseCDSect ( ) ; inCDATA = false ; handler . endCDATA ( ) ; break ; default : fatal ( "expected comment or CDATA section" , c , null ) ; break ; } break ; case '?' : // Found " < ? " isDirtyCurrentElement = false ; parsePI ( ) ; break ; case '/' : // Found " < / " isDirtyCurrentElement = false ; parseETag ( ) ; return ; default : // Found " < " followed by something else isDirtyCurrentElement = false ; unread ( c ) ; parseElement ( false ) ; break ; } } }
public class SofaRegistrySubscribeCallback { /** * 增加监听器 , 一个dataId增加多的ConsumerConfig的listener * @ param dataId 配置Id * @ param consumerConfig 服务调用者信息 * @ param listener 服务列表监听器 */ void addProviderInfoListener ( String dataId , ConsumerConfig consumerConfig , ProviderInfoListener listener ) { } }
providerInfoListeners . put ( consumerConfig , listener ) ; // 同一个key重复订阅多次 , 提醒用户需要检查一下是否是代码问题 if ( LOGGER . isWarnEnabled ( consumerConfig . getAppName ( ) ) && providerInfoListeners . size ( ) > 5 ) { LOGGER . warnWithApp ( consumerConfig . getAppName ( ) , "Duplicate to add provider listener of {} " + "more than 5 times, now is {}, please check it" , dataId , providerInfoListeners . size ( ) ) ; }
public class ComputeNodesImpl { /** * Enables task scheduling on the specified compute node . * You can enable task scheduling on a node only if its current scheduling state is disabled . * @ param poolId The ID of the pool that contains the compute node . * @ param nodeId The ID of the compute node on which you want to enable task scheduling . * @ param computeNodeEnableSchedulingOptions Additional parameters for the operation * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws BatchErrorException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void enableScheduling ( String poolId , String nodeId , ComputeNodeEnableSchedulingOptions computeNodeEnableSchedulingOptions ) { } }
enableSchedulingWithServiceResponseAsync ( poolId , nodeId , computeNodeEnableSchedulingOptions ) . toBlocking ( ) . single ( ) . body ( ) ;
public class LongTupleIterables { /** * Returns an iterable returning an iterator that returns * { @ link MutableLongTuple } s up to the given maximum values , * in colexicographical order . < br > * < br > * Copies of the given tuples will be stored internally . < br > * < br > * Also see < a href = " . . / . . / package - summary . html # IterationOrder " > * Iteration Order < / a > * @ param max The maximum values , exclusive * @ return The iterable */ public static Iterable < MutableLongTuple > colexicographicalIterable ( LongTuple max ) { } }
return iterable ( Order . COLEXICOGRAPHICAL , LongTuples . zero ( max . getSize ( ) ) , max ) ;
public class KeyGenerator { /** * Initializes this key generator for a certain keysize , using a * user - provided source of randomness . * @ param keysize the keysize . This is an algorithm - specific metric , * specified in number of bits . * @ param random the source of randomness for this key generator * @ exception InvalidParameterException if the keysize is wrong or not * supported . */ public final void init ( int keysize , SecureRandom random ) { } }
if ( serviceIterator == null ) { spi . engineInit ( keysize , random ) ; return ; } RuntimeException failure = null ; KeyGeneratorSpi mySpi = spi ; do { try { mySpi . engineInit ( keysize , random ) ; initType = I_SIZE ; initKeySize = keysize ; initParams = null ; initRandom = random ; return ; } catch ( RuntimeException e ) { if ( failure == null ) { failure = e ; } mySpi = nextSpi ( mySpi , false ) ; } } while ( mySpi != null ) ; throw failure ;
public class MaintenanceWindowLayout { /** * Get list of all time zone offsets supported . */ private static List < String > getAllTimeZones ( ) { } }
final List < String > lst = ZoneId . getAvailableZoneIds ( ) . stream ( ) . map ( id -> ZonedDateTime . now ( ZoneId . of ( id ) ) . getOffset ( ) . getId ( ) . replace ( "Z" , "+00:00" ) ) . distinct ( ) . collect ( Collectors . toList ( ) ) ; lst . sort ( null ) ; return lst ;
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public String convertLineDataObjectPositionMigrationTempOrientToString ( EDataType eDataType , Object instanceValue ) { } }
return instanceValue == null ? null : instanceValue . toString ( ) ;
public class SoapClient { /** * 执行Webservice请求 , 既发送SOAP内容 * @ return 返回结果 */ public SOAPMessage sendForMessage ( ) { } }
final HttpResponse res = sendForResponse ( ) ; final MimeHeaders headers = new MimeHeaders ( ) ; for ( Entry < String , List < String > > entry : res . headers ( ) . entrySet ( ) ) { if ( StrUtil . isNotEmpty ( entry . getKey ( ) ) ) { headers . setHeader ( entry . getKey ( ) , CollUtil . get ( entry . getValue ( ) , 0 ) ) ; } } try { return this . factory . createMessage ( headers , res . bodyStream ( ) ) ; } catch ( IOException | SOAPException e ) { throw new SoapRuntimeException ( e ) ; }
public class BigtableTable { /** * { @ inheritDoc } */ @ Override public boolean checkAndMutate ( final byte [ ] row , final byte [ ] family , final byte [ ] qualifier , final CompareOperator compareOp , final byte [ ] value , final RowMutations rm ) throws IOException { } }
return super . checkAndMutate ( row , family , qualifier , toCompareOp ( compareOp ) , value , rm ) ;
public class ConfigClient { /** * Creates a new exclusion in a specified parent resource . Only log entries belonging to that * resource can be excluded . You can have up to 10 exclusions in a resource . * < p > Sample code : * < pre > < code > * try ( ConfigClient configClient = ConfigClient . create ( ) ) { * ParentName parent = ProjectName . of ( " [ PROJECT ] " ) ; * LogExclusion exclusion = LogExclusion . newBuilder ( ) . build ( ) ; * LogExclusion response = configClient . createExclusion ( parent . toString ( ) , exclusion ) ; * < / code > < / pre > * @ param parent Required . The parent resource in which to create the exclusion : * < p > " projects / [ PROJECT _ ID ] " " organizations / [ ORGANIZATION _ ID ] " * " billingAccounts / [ BILLING _ ACCOUNT _ ID ] " " folders / [ FOLDER _ ID ] " * < p > Examples : ` " projects / my - logging - project " ` , ` " organizations / 123456789 " ` . * @ param exclusion Required . The new exclusion , whose ` name ` parameter is an exclusion name that * is not already used in the parent resource . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ public final LogExclusion createExclusion ( String parent , LogExclusion exclusion ) { } }
CreateExclusionRequest request = CreateExclusionRequest . newBuilder ( ) . setParent ( parent ) . setExclusion ( exclusion ) . build ( ) ; return createExclusion ( request ) ;
public class IOUtils { /** * Serialized gzipped java object to an ObjectOutputStream . The stream remains * open . * @ param o * the java object * @ param out * the output stream */ public static void writeGzipObjectToStream ( final Object o , OutputStream out ) { } }
out = new BufferedOutputStream ( out ) ; try { out = new GZIPOutputStream ( out , true ) ; final ObjectOutputStream oos = new ObjectOutputStream ( out ) ; oos . writeObject ( o ) ; oos . flush ( ) ; } catch ( final IOException e ) { e . printStackTrace ( ) ; }
public class FileBasedCollection { /** * Create a Rome Atom entry based on a Roller entry . Content is escaped . Link is stored as * rel = alternate link . */ private Entry loadAtomEntry ( final InputStream in ) { } }
try { return Atom10Parser . parseEntry ( new BufferedReader ( new InputStreamReader ( in , "UTF-8" ) ) , null , Locale . US ) ; } catch ( final Exception e ) { e . printStackTrace ( ) ; return null ; }
public class StringConverter { /** * Counts Character c in String s * @ param s Java string * @ param c character to count * @ return int count */ static int count ( final String s , final char c ) { } }
int pos = 0 ; int count = 0 ; if ( s != null ) { while ( ( pos = s . indexOf ( c , pos ) ) > - 1 ) { count ++ ; pos ++ ; } } return count ;
public class DbTenantQueryImpl { /** * results / / / / / */ @ Override public long executeCount ( CommandContext commandContext ) { } }
checkQueryOk ( ) ; DbReadOnlyIdentityServiceProvider identityProvider = getIdentityProvider ( commandContext ) ; return identityProvider . findTenantCountByQueryCriteria ( this ) ;
public class CallOptionsBenchmark { /** * Setup . */ @ Setup public void setUp ( ) throws Exception { } }
customOptions = new ArrayList < > ( customOptionsCount ) ; for ( int i = 0 ; i < customOptionsCount ; i ++ ) { customOptions . add ( CallOptions . Key . createWithDefault ( "name " + i , "defaultvalue" ) ) ; } allOpts = CallOptions . DEFAULT ; for ( int i = 0 ; i < customOptionsCount ; i ++ ) { allOpts = allOpts . withOption ( customOptions . get ( i ) , "value" ) ; } shuffledCustomOptions = new ArrayList < > ( customOptions ) ; // Make the shuffling deterministic Collections . shuffle ( shuffledCustomOptions , new Random ( 1 ) ) ;
public class ProcessUtils { /** * Null - safe method to determine whether the given { @ link Process } is still running . * @ param process { @ link Process } object to evaluate if running . * @ return a boolean value indicating whether the given { @ link Process } is still running . * @ see java . lang . Process */ @ NullSafe public static boolean isRunning ( Process process ) { } }
try { return ( process != null && process . exitValue ( ) == Double . NaN ) ; } catch ( IllegalThreadStateException ignore ) { return true ; }
public class BaseTable { /** * Create a new empty table using the definition in the record . * @ exception DBException Open errors passed from SQL . * @ return true if successful . */ public boolean loadInitialData ( ) throws DBException { } }
BaseTable table = this ; Record record = table . getRecord ( ) ; Task task = null ; if ( Record . findRecordOwner ( record ) != null ) task = Record . findRecordOwner ( record ) . getTask ( ) ; if ( task == null ) return false ; while ( ( ( record . getDatabaseType ( ) & DBConstants . SHARED_TABLE ) != 0 ) && ( ( record . getDatabaseType ( ) & DBConstants . BASE_TABLE_CLASS ) == 0 ) ) { String tableName = record . getTableNames ( false ) ; Class < ? > className = record . getClass ( ) . getSuperclass ( ) ; record = Record . makeRecordFromClassName ( className . getName ( ) , record . getRecordOwner ( ) ) ; record . setTableNames ( tableName ) ; table = record . getTable ( ) ; } if ( record . getTable ( ) instanceof PassThruTable ) table = this . getPhysicalTable ( ( PassThruTable ) record . getTable ( ) , record ) ; int iOpenMode = record . getOpenMode ( ) ; record . setOpenMode ( DBConstants . OPEN_NORMAL ) ; // Possible read - only int iCount = record . getFieldCount ( ) ; boolean [ ] brgCurrentSelection = new boolean [ iCount ] ; for ( int i = 0 ; i < iCount ; i ++ ) { brgCurrentSelection [ i ] = record . getField ( i ) . isSelected ( ) ; record . getField ( i ) . setSelected ( true ) ; } BaseBuffer buffer = new VectorBuffer ( null ) ; buffer . fieldsToBuffer ( record ) ; org . jbundle . base . db . xmlutil . XmlInOut xml = new org . jbundle . base . db . xmlutil . XmlInOut ( null , null , null ) ; String filename = record . getArchiveFilename ( true ) ; String defaultFilename = record . getArchiveFilename ( false ) ; InputStream inputStream = task . getInputStream ( filename ) ; boolean bSuccess = false ; try { bSuccess = xml . importXML ( table , filename , inputStream ) ; // Data file read successfully if ( ( ! bSuccess ) && ( ! defaultFilename . equals ( filename ) ) ) { String prefix = this . getDatabase ( ) . getProperty ( DBConstants . DB_USER_PREFIX ) ; if ( prefix != null ) { if ( ! prefix . endsWith ( Character . toString ( BaseDatabase . DB_NAME_SEPARATOR ) ) ) prefix = prefix + BaseDatabase . DB_NAME_SEPARATOR ; String dbName = this . getDatabase ( ) . getDatabaseName ( true ) ; int index = filename . indexOf ( dbName ) ; if ( index != - 1 ) if ( filename . indexOf ( prefix , index ) == index ) { filename = filename . substring ( 0 , index ) + filename . substring ( index + prefix . length ( ) ) ; inputStream = task . getInputStream ( filename ) ; bSuccess = xml . importXML ( table , filename , inputStream ) ; } } if ( ( ! bSuccess ) && ( ! defaultFilename . equals ( filename ) ) ) { inputStream = task . getInputStream ( defaultFilename ) ; bSuccess = xml . importXML ( table , defaultFilename , inputStream ) ; } } if ( ! bSuccess ) Utility . getLogger ( ) . info ( "No initial data for: " + ( ( record . getRecordName ( ) . endsWith ( TEMP_SUFFIX ) ) ? record . getRecordName ( ) . substring ( 0 , record . getRecordName ( ) . length ( ) - TEMP_SUFFIX . length ( ) ) : record . getRecordName ( ) ) + " from " + filename ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; } finally { xml . free ( ) ; } XmlInOut . enableAllBehaviors ( record , false , false ) ; buffer . bufferToFields ( record , DBConstants . DISPLAY , DBConstants . SCREEN_MOVE ) ; XmlInOut . enableAllBehaviors ( record , true , true ) ; for ( int i = 0 ; i < iCount ; i ++ ) { record . getField ( i ) . setSelected ( brgCurrentSelection [ i ] ) ; } record . setOpenMode ( iOpenMode ) ; if ( record != this . getRecord ( ) ) record . free ( ) ; // If this was a base record . return bSuccess ; // Success
public class SqlValidatorImpl { /** * Validates updates against the constraint of a modifiable view . * @ param validatorTable A { @ link SqlValidatorTable } that may wrap a * ModifiableViewTable * @ param update The UPDATE parse tree node * @ param targetRowType The target type */ private void checkConstraint ( SqlValidatorTable validatorTable , SqlUpdate update , RelDataType targetRowType ) { } }
final ModifiableViewTable modifiableViewTable = validatorTable . unwrap ( ModifiableViewTable . class ) ; if ( modifiableViewTable != null ) { final Table table = modifiableViewTable . unwrap ( Table . class ) ; final RelDataType tableRowType = table . getRowType ( typeFactory ) ; final Map < Integer , RexNode > projectMap = RelOptUtil . getColumnConstraints ( modifiableViewTable , targetRowType , typeFactory ) ; final Map < String , Integer > nameToIndex = SqlValidatorUtil . mapNameToIndex ( tableRowType . getFieldList ( ) ) ; // Validate update values against the view constraint . final List < SqlNode > targets = update . getTargetColumnList ( ) . getList ( ) ; final List < SqlNode > sources = update . getSourceExpressionList ( ) . getList ( ) ; for ( final Pair < SqlNode , SqlNode > column : Pair . zip ( targets , sources ) ) { final String columnName = ( ( SqlIdentifier ) column . left ) . getSimple ( ) ; final Integer columnIndex = nameToIndex . get ( columnName ) ; if ( projectMap . containsKey ( columnIndex ) ) { final RexNode columnConstraint = projectMap . get ( columnIndex ) ; final ValidationError validationError = new ValidationError ( column . right , RESOURCE . viewConstraintNotSatisfied ( columnName , Util . last ( validatorTable . getQualifiedName ( ) ) ) ) ; RelOptUtil . validateValueAgainstConstraint ( column . right , columnConstraint , validationError ) ; } } }
public class ClassFactory { /** * TODO : move media type specific into a new class that Reader , Writer factory derives from */ protected T get ( Class < ? > type , Class < ? extends T > byDefinition , InjectionProvider provider , RoutingContext routeContext , MediaType [ ] mediaTypes ) throws ClassFactoryException , ContextException { } }
Class < ? extends T > clazz = byDefinition ; // No class defined . . . try by type if ( clazz == null ) { clazz = get ( type ) ; } // try with media type . . . if ( clazz == null && mediaTypes != null && mediaTypes . length > 0 ) { for ( MediaType mediaType : mediaTypes ) { clazz = get ( mediaType ) ; if ( clazz != null ) { break ; } } } if ( clazz != null ) { return getClassInstance ( clazz , provider , routeContext ) ; } // 3 . find cached instance . . . if any return cache . get ( type . getName ( ) ) ;
public class ExampleColorHistogramLookup { /** * HSV stores color information in Hue and Saturation while intensity is in Value . This computes a 2D histogram * from hue and saturation only , which makes it lighting independent . */ public static List < double [ ] > coupledHueSat ( List < String > images ) { } }
List < double [ ] > points = new ArrayList < > ( ) ; Planar < GrayF32 > rgb = new Planar < > ( GrayF32 . class , 1 , 1 , 3 ) ; Planar < GrayF32 > hsv = new Planar < > ( GrayF32 . class , 1 , 1 , 3 ) ; for ( String path : images ) { BufferedImage buffered = UtilImageIO . loadImage ( path ) ; if ( buffered == null ) throw new RuntimeException ( "Can't load image!" ) ; rgb . reshape ( buffered . getWidth ( ) , buffered . getHeight ( ) ) ; hsv . reshape ( buffered . getWidth ( ) , buffered . getHeight ( ) ) ; ConvertBufferedImage . convertFrom ( buffered , rgb , true ) ; ColorHsv . rgbToHsv ( rgb , hsv ) ; Planar < GrayF32 > hs = hsv . partialSpectrum ( 0 , 1 ) ; // The number of bins is an important parameter . Try adjusting it Histogram_F64 histogram = new Histogram_F64 ( 12 , 12 ) ; histogram . setRange ( 0 , 0 , 2.0 * Math . PI ) ; // range of hue is from 0 to 2PI histogram . setRange ( 1 , 0 , 1.0 ) ; // range of saturation is from 0 to 1 // Compute the histogram GHistogramFeatureOps . histogram ( hs , histogram ) ; UtilFeature . normalizeL2 ( histogram ) ; // normalize so that image size doesn ' t matter points . add ( histogram . value ) ; } return points ;
public class ByteBufUtil { /** * Returns the reader index of needle in haystack , or - 1 if needle is not in haystack . */ public static int indexOf ( ByteBuf needle , ByteBuf haystack ) { } }
// TODO : maybe use Boyer Moore for efficiency . int attempts = haystack . readableBytes ( ) - needle . readableBytes ( ) + 1 ; for ( int i = 0 ; i < attempts ; i ++ ) { if ( equals ( needle , needle . readerIndex ( ) , haystack , haystack . readerIndex ( ) + i , needle . readableBytes ( ) ) ) { return haystack . readerIndex ( ) + i ; } } return - 1 ;
public class ScreenRecordingUploadOptions { /** * Builds a map , which is ready to be passed to the subordinated * Appium API . * @ return arguments mapping . */ public Map < String , Object > build ( ) { } }
final ImmutableMap . Builder < String , Object > builder = ImmutableMap . builder ( ) ; ofNullable ( remotePath ) . map ( x -> builder . put ( "remotePath" , x ) ) ; ofNullable ( user ) . map ( x -> builder . put ( "user" , x ) ) ; ofNullable ( pass ) . map ( x -> builder . put ( "pass" , x ) ) ; ofNullable ( method ) . map ( x -> builder . put ( "method" , x ) ) ; return builder . build ( ) ;
public class AbstractFachwert { /** * Liefert die einzelnen Attribute eines Fachwertes als Map . Bei einem * einzelnen Wert wird als Default - Implementierung der Klassenname und * die toString ( ) - Implementierung herangezogen . * @ return Attribute als Map */ @ Override public Map < String , Object > toMap ( ) { } }
Map < String , Object > map = new HashMap < > ( ) ; map . put ( this . getClass ( ) . getSimpleName ( ) . toLowerCase ( ) , toString ( ) ) ; return map ;
public class AbstractJSON { /** * Fires a start of object event . */ protected static void fireObjectStartEvent ( JsonConfig jsonConfig ) { } }
if ( jsonConfig . isEventTriggeringEnabled ( ) ) { for ( Iterator listeners = jsonConfig . getJsonEventListeners ( ) . iterator ( ) ; listeners . hasNext ( ) ; ) { JsonEventListener listener = ( JsonEventListener ) listeners . next ( ) ; try { listener . onObjectStart ( ) ; } catch ( RuntimeException e ) { log . warn ( e ) ; } } }
public class FilterFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link Filter } { @ code > } } */ @ XmlElementDecl ( namespace = "" , name = "filter" ) public JAXBElement < Filter > createFilter ( Filter value ) { } }
return new JAXBElement < Filter > ( _Filter_QNAME , Filter . class , null , value ) ;
public class AutoReconnectGateway { /** * Get the session . If the session still null or not in bound state , then IO exception will be thrown . * @ return the valid session . * @ throws IOException if there is no valid session or session creation is invalid . */ private SMPPSession getSession ( ) throws IOException { } }
if ( session == null ) { LOGGER . info ( "Initiate session for the first time to {}:{}" , remoteIpAddress , remotePort ) ; session = newSession ( ) ; } else if ( ! session . getSessionState ( ) . isBound ( ) ) { throw new IOException ( "We have no valid session yet" ) ; } return session ;
public class LogServlet { /** * This method helps to display More log information of the node machine . * @ param fileName * It is log file name available in node machine current directory Logs folder , it is used to identify * the current file to display in the web page . * @ param url * It is node machine url ( ex : http : / / 10.232.88.10:5555) * @ return String vlaue to add Form in html page * @ throws IOException */ private String appendMoreLogsLink ( final String fileName , String url ) throws IOException { } }
FileBackedStringBuffer buffer = new FileBackedStringBuffer ( ) ; int index = retrieveIndexValueFromFileName ( fileName ) ; index ++ ; File logFileName = retrieveFileFromLogsFolder ( Integer . toString ( index ) ) ; if ( logFileName == null ) { return "" ; } // TODO put this html code in a template buffer . append ( "<form name ='myform' action=" ) . append ( url ) . append ( " method= 'post'>" ) ; buffer . append ( "<input type='hidden'" ) . append ( " name ='fileName'" ) . append ( " value ='" ) . append ( logFileName . getName ( ) ) . append ( "'>" ) ; buffer . append ( "<a href= 'javascript: submitform();' > More Logs </a>" ) ; buffer . append ( "</form>" ) ; return buffer . toString ( ) ;
public class CmsContainerpageController { /** * Enables the favorites editing drag and drop controller . < p > * @ param enable if < code > true < / code > favorites editing will enabled , otherwise disabled * @ param dndController the favorites editing drag and drop controller */ public void enableFavoriteEditing ( boolean enable , I_CmsDNDController dndController ) { } }
if ( m_dndHandler . isDragging ( ) ) { // never switch drag and drop controllers while dragging return ; } if ( enable ) { m_dndHandler . setController ( dndController ) ; } else { m_dndHandler . setController ( m_cntDndController ) ; }
public class ESJPCompiler { /** * All stored compiled ESJP ' s classes in the eFaps database are stored in * the mapping { @ link # class2id } . If a ESJP ' s program is compiled and * stored with { @ link ESJPCompiler . StoreObject # write ( ) } , the class is * removed . After the compile , { @ link ESJPCompiler # compile ( String ) } removes * all stored classes which are not needed anymore . * @ throws InstallationException if read of the ESJP classes failed * @ see # class2id */ protected void readESJPClasses ( ) throws InstallationException { } }
try { final QueryBuilder queryBldr = new QueryBuilder ( this . classType ) ; final MultiPrintQuery multi = queryBldr . getPrint ( ) ; multi . addAttribute ( "Name" ) ; multi . executeWithoutAccessCheck ( ) ; while ( multi . next ( ) ) { final String name = multi . < String > getAttribute ( "Name" ) ; final Long id = multi . getCurrentInstance ( ) . getId ( ) ; this . class2id . put ( name , id ) ; } } catch ( final EFapsException e ) { throw new InstallationException ( "Could not fetch the information about compiled ESJP's" , e ) ; }
public class UnsafeOperations { /** * Performs a deep copy of the object . With a deep copy all references from the object are also copied . * The identity of referenced objects is preserved , so , for example , if the object graph contains two * references to the same object , the cloned object will preserve this structure . * @ param obj The object to perform a deep copy for . * @ param < T > The type being copied * @ return A deep copy of the original object . */ public < T > T deepCopy ( final T obj ) { } }
return deepCopy ( obj , new IdentityHashMap < Object , Object > ( 10 ) ) ;
public class EventImpl { /** * { @ inheritDoc } */ public void setProperty ( ReservedKey key , Object value ) { } }
this . properties . put ( key . getName ( ) , value ) ;
public class ThreadUtils { /** * Logs a stack trace for all threads currently running in the JVM , similar to jstack . */ public static void logAllThreads ( ) { } }
StringBuilder sb = new StringBuilder ( "Dumping all threads:\n" ) ; for ( Thread t : Thread . getAllStackTraces ( ) . keySet ( ) ) { sb . append ( formatStackTrace ( t ) ) ; } LOG . info ( sb . toString ( ) ) ;
public class CertificateValidityMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CertificateValidity certificateValidity , ProtocolMarshaller protocolMarshaller ) { } }
if ( certificateValidity == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( certificateValidity . getNotBefore ( ) , NOTBEFORE_BINDING ) ; protocolMarshaller . marshall ( certificateValidity . getNotAfter ( ) , NOTAFTER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class AbstractClassFileWriter { /** * Writes the class file to disk in the given directory . * @ param targetDir The target directory * @ param classWriter The current class writer * @ param className The class name * @ throws IOException if there is a problem writing the class to disk */ protected void writeClassToDisk ( File targetDir , ClassWriter classWriter , String className ) throws IOException { } }
if ( targetDir != null ) { String fileName = className . replace ( '.' , '/' ) + ".class" ; File targetFile = new File ( targetDir , fileName ) ; targetFile . getParentFile ( ) . mkdirs ( ) ; try ( OutputStream outputStream = Files . newOutputStream ( targetFile . toPath ( ) ) ) { writeClassToDisk ( outputStream , classWriter ) ; } }
public class Table { /** * Applies the operation in { @ code doable } to every row in the table */ public void doWithRows ( Consumer < Row > doable ) { } }
Row row = new Row ( this ) ; while ( row . hasNext ( ) ) { doable . accept ( row . next ( ) ) ; }
public class SimpleVersionedSerialization { /** * Serializes the version and datum into a byte array . The first four bytes will be occupied by * the version ( as returned by { @ link SimpleVersionedSerializer # getVersion ( ) } ) , * written in < i > big - endian < / i > encoding . The remaining bytes will be the serialized * datum , as produced by { @ link SimpleVersionedSerializer # serialize ( Object ) } . The resulting array * will hence be four bytes larger than the serialized datum . * < p > Data serialized via this method can be deserialized via * { @ link # readVersionAndDeSerialize ( SimpleVersionedSerializer , byte [ ] ) } . * @ param serializer The serializer to serialize the datum with . * @ param datum The datum to serialize . * @ return A byte array containing the serialized version and serialized datum . * @ throws IOException Exceptions from the { @ link SimpleVersionedSerializer # serialize ( Object ) } * method are forwarded . */ public static < T > byte [ ] writeVersionAndSerialize ( SimpleVersionedSerializer < T > serializer , T datum ) throws IOException { } }
checkNotNull ( serializer , "serializer" ) ; checkNotNull ( datum , "datum" ) ; final byte [ ] data = serializer . serialize ( datum ) ; final byte [ ] versionAndData = new byte [ data . length + 8 ] ; final int version = serializer . getVersion ( ) ; versionAndData [ 0 ] = ( byte ) ( version >> 24 ) ; versionAndData [ 1 ] = ( byte ) ( version >> 16 ) ; versionAndData [ 2 ] = ( byte ) ( version >> 8 ) ; versionAndData [ 3 ] = ( byte ) version ; final int length = data . length ; versionAndData [ 4 ] = ( byte ) ( length >> 24 ) ; versionAndData [ 5 ] = ( byte ) ( length >> 16 ) ; versionAndData [ 6 ] = ( byte ) ( length >> 8 ) ; versionAndData [ 7 ] = ( byte ) length ; // move the data to the array System . arraycopy ( data , 0 , versionAndData , 8 , data . length ) ; return versionAndData ;
public class CmsCalendarWidget { /** * Creates the time in milliseconds from the given parameter . < p > * @ param messages the messages that contain the time format definitions * @ param dateString the String representation of the date * @ param useTime true if the time should be parsed , too , otherwise false * @ return the time in milliseconds * @ throws ParseException if something goes wrong */ public static long getCalendarDate ( CmsMessages messages , String dateString , boolean useTime ) throws ParseException { } }
long dateLong = 0 ; // substitute some chars because calendar syntax ! = DateFormat syntax String dateFormat = messages . key ( org . opencms . workplace . Messages . GUI_CALENDAR_DATE_FORMAT_0 ) ; if ( useTime ) { dateFormat += " " + messages . key ( org . opencms . workplace . Messages . GUI_CALENDAR_TIME_FORMAT_0 ) ; } dateFormat = CmsCalendarWidget . getCalendarJavaDateFormat ( dateFormat ) ; SimpleDateFormat df = new SimpleDateFormat ( dateFormat ) ; dateLong = df . parse ( dateString ) . getTime ( ) ; return dateLong ;
public class CommerceVirtualOrderItemPersistenceImpl { /** * Returns the commerce virtual order item where commerceOrderItemId = & # 63 ; or returns < code > null < / code > if it could not be found , optionally using the finder cache . * @ param commerceOrderItemId the commerce order item ID * @ param retrieveFromCache whether to retrieve from the finder cache * @ return the matching commerce virtual order item , or < code > null < / code > if a matching commerce virtual order item could not be found */ @ Override public CommerceVirtualOrderItem fetchByCommerceOrderItemId ( long commerceOrderItemId , boolean retrieveFromCache ) { } }
Object [ ] finderArgs = new Object [ ] { commerceOrderItemId } ; Object result = null ; if ( retrieveFromCache ) { result = finderCache . getResult ( FINDER_PATH_FETCH_BY_COMMERCEORDERITEMID , finderArgs , this ) ; } if ( result instanceof CommerceVirtualOrderItem ) { CommerceVirtualOrderItem commerceVirtualOrderItem = ( CommerceVirtualOrderItem ) result ; if ( ( commerceOrderItemId != commerceVirtualOrderItem . getCommerceOrderItemId ( ) ) ) { result = null ; } } if ( result == null ) { StringBundler query = new StringBundler ( 3 ) ; query . append ( _SQL_SELECT_COMMERCEVIRTUALORDERITEM_WHERE ) ; query . append ( _FINDER_COLUMN_COMMERCEORDERITEMID_COMMERCEORDERITEMID_2 ) ; String sql = query . toString ( ) ; Session session = null ; try { session = openSession ( ) ; Query q = session . createQuery ( sql ) ; QueryPos qPos = QueryPos . getInstance ( q ) ; qPos . add ( commerceOrderItemId ) ; List < CommerceVirtualOrderItem > list = q . list ( ) ; if ( list . isEmpty ( ) ) { finderCache . putResult ( FINDER_PATH_FETCH_BY_COMMERCEORDERITEMID , finderArgs , list ) ; } else { CommerceVirtualOrderItem commerceVirtualOrderItem = list . get ( 0 ) ; result = commerceVirtualOrderItem ; cacheResult ( commerceVirtualOrderItem ) ; } } catch ( Exception e ) { finderCache . removeResult ( FINDER_PATH_FETCH_BY_COMMERCEORDERITEMID , finderArgs ) ; throw processException ( e ) ; } finally { closeSession ( session ) ; } } if ( result instanceof List < ? > ) { return null ; } else { return ( CommerceVirtualOrderItem ) result ; }
public class CheckSignInApi { /** * 处理signInResult回调 * @ param result 回调的signInResult实例 */ private void disposeCheckSignInResult ( SignInResult result ) { } }
if ( result == null ) { HMSAgentLog . e ( "result is null" ) ; onCheckSignInResult ( HMSAgent . AgentResultCode . RESULT_IS_NULL , null ) ; return ; } Status status = result . getStatus ( ) ; if ( status == null ) { HMSAgentLog . e ( "status is null" ) ; onCheckSignInResult ( HMSAgent . AgentResultCode . STATUS_IS_NULL , null ) ; return ; } int rstCode = status . getStatusCode ( ) ; HMSAgentLog . d ( "status=" + status ) ; // 需要重试的错误码 , 并且可以重试 if ( ( rstCode == CommonCode . ErrorCode . SESSION_INVALID || rstCode == CommonCode . ErrorCode . CLIENT_API_INVALID ) && retryTimes > 0 ) { retryTimes -- ; connect ( ) ; } else { if ( result . isSuccess ( ) ) { // 可以获取帐号的 openid , 昵称 , 头像 at信息 SignInHuaweiId account = result . getSignInHuaweiId ( ) ; onCheckSignInResult ( rstCode , account ) ; } else { onCheckSignInResult ( rstCode , null ) ; } }
public class AtomicBiInteger { /** * Atomically sets the hi and lo values to the given updated values only if * the current hi and lo values { @ code = = } the expected hi and lo values . * @ param expectHi the expected hi value * @ param hi the new hi value * @ param expectLo the expected lo value * @ param lo the new lo value * @ return { @ code true } if successful . False return indicates that * the actual hi and lo values were not equal to the expected hi and lo value . */ public boolean compareAndSet ( int expectHi , int hi , int expectLo , int lo ) { } }
long encoded = encode ( expectHi , expectLo ) ; long update = encode ( hi , lo ) ; return compareAndSet ( encoded , update ) ;
public class Payments { /** * 根据tradeNumber查询退款记录 * @ param tradeNumber * @ return */ public RefundQuery refundQueryByTradeNumber ( String tradeNumber ) { } }
RefundQueryRequestWrapper refundQueryRequestWrapper = new RefundQueryRequestWrapper ( ) ; refundQueryRequestWrapper . setTradeNumber ( tradeNumber ) ; return refundQuery ( refundQueryRequestWrapper ) ;
public class IoTDataManager { /** * Get the manger instance responsible for the given connection . * @ param connection the XMPP connection . * @ return a manager instance . */ public static synchronized IoTDataManager getInstanceFor ( XMPPConnection connection ) { } }
IoTDataManager manager = INSTANCES . get ( connection ) ; if ( manager == null ) { manager = new IoTDataManager ( connection ) ; INSTANCES . put ( connection , manager ) ; } return manager ;
public class WhileyFileParser { /** * Parse a reference type , which is of the form : * < pre > * ReferenceType : : = ' & ' Type * | ' & ' Lifetime ' : ' Type * Lifetime : : = Identifier | ' this ' | ' * ' * < / pre > * @ return */ private Type parseReferenceType ( EnclosingScope scope ) { } }
int start = index ; match ( Ampersand ) ; // Try to parse an annotated lifetime int backtrack = index ; Identifier lifetimeIdentifier = parseOptionalLifetimeIdentifier ( scope , false ) ; if ( lifetimeIdentifier != null ) { // We cannot allow a newline after the colon , as it would // unintentionally match a return type that happens to be reference // type without lifetime annotation ( return type in method signature // is always followed by colon and newline ) . if ( tryAndMatch ( true , Colon ) != null && ! isAtEOL ( ) ) { // Now we know that there is an annotated lifetime scope . mustBeLifetime ( lifetimeIdentifier ) ; Type element = parseArrayType ( scope ) ; Type type = new Type . Reference ( element , lifetimeIdentifier ) ; return annotateSourceLocation ( type , start ) ; } } index = backtrack ; Type element = parseArrayType ( scope ) ; Type type = new Type . Reference ( element ) ; return annotateSourceLocation ( type , start ) ;
public class Piece { /** * Read a piece block from the underlying byte storage . * This is the public method for reading this piece ' s data , and it will * only succeed if the piece is complete and valid on disk , thus ensuring * any data that comes out of this function is valid piece data we can send * to other peers . * @ param offset Offset inside this piece where to start reading . * @ param length Number of bytes to read from the piece . * @ return A byte buffer containing the piece data . * @ throws IllegalArgumentException If < em > offset + length < / em > goes over * the piece boundary . * @ throws IllegalStateException If the piece is not valid when attempting * to read it . * @ throws IOException If the read can ' t be completed ( I / O error , or EOF * reached , which can happen if the piece is not complete ) . */ public ByteBuffer read ( long offset , int length , ByteBuffer block ) throws IllegalArgumentException , IllegalStateException , IOException { } }
if ( ! this . valid ) { throw new IllegalStateException ( "Attempting to read an " + "known-to-be invalid piece!" ) ; } return this . _read ( offset , length , block ) ;
public class SerializationUtils { /** * Deserialize a byte array back to an object . * This method uses Kryo lib . * @ param data * @ param clazz * @ return */ public static < T > T fromByteArrayKryo ( byte [ ] data , Class < T > clazz ) { } }
return fromByteArrayKryo ( data , clazz , null ) ;
public class EnumHelper { /** * Get the enum value with the passed ID * @ param < ENUMTYPE > * The enum type * @ param aClass * The enum class * @ param nID * The ID to search * @ return < code > null < / code > if no enum item with the given ID is present . */ @ Nullable public static < ENUMTYPE extends Enum < ENUMTYPE > & IHasIntID > ENUMTYPE getFromIDOrNull ( @ Nonnull final Class < ENUMTYPE > aClass , final int nID ) { } }
return getFromIDOrDefault ( aClass , nID , null ) ;
public class Jdk14Logger { /** * Log a message and exception with trace log level . */ public void trace ( Object message , Throwable exception ) { } }
log ( Level . FINEST , String . valueOf ( message ) , exception ) ;
public class SubscriptionService { /** * registers with the EMSP with passed as argument the endpoints of this * EMSP are stored in the database , as well as the definitive token * @ param tokenProvider */ @ Transactional public void register ( Subscription subscription ) { } }
Endpoint versionsEndpoint = subscription . getEndpoint ( ModuleIdentifier . VERSIONS ) ; if ( versionsEndpoint == null ) { return ; } LOG . info ( "Registering, get versions from endpoint " + versionsEndpoint . getUrl ( ) ) ; Version version = findHighestMutualVersion ( getVersions ( versionsEndpoint . getUrl ( ) , subscription . getPartnerAuthorizationToken ( ) ) ) ; LOG . info ( "Registering, get versiondetails at " + version . url ) ; VersionDetails versionDetails = getVersionDetails ( version . url , subscription . getPartnerAuthorizationToken ( ) ) ; // store version and endpoints for this subscription subscription . setOcpiVersion ( version . version ) ; for ( io . motown . ocpi . dto . Endpoint endpoint : versionDetails . endpoints ) { subscription . addToEndpoints ( new Endpoint ( endpoint . identifier , endpoint . url . toString ( ) ) ) ; // because the endpoints in ' versionInformationResponse ' are not // DTO ' s ( yet ) we must instantiate ModuleIdentifier from value } // if not present generate a new token if ( subscription . getAuthorizationToken ( ) == null ) { subscription . generateNewAuthorizationToken ( ) ; } ocpiRepository . insertOrUpdate ( subscription ) ; Credentials credentials = postCredentials ( subscription ) ; if ( credentials . token != null ) { // if no token update do not overwrite // existing partner token ! LOG . debug ( "Updating partnerToken with: " + credentials . token ) ; subscription . setPartnerAuthorizationToken ( credentials . token ) ; // at this point we can safely remove the versionsEndpoint LOG . info ( "REMOVING VERIONS-ENDPOINT" ) ; subscription . getEndpoints ( ) . remove ( versionsEndpoint ) ; ocpiRepository . insertOrUpdate ( subscription ) ; }
public class PTBConstituent { /** * getter for misc - gets Miscellaneous * @ generated * @ return value of the feature */ public String getMisc ( ) { } }
if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_misc == null ) jcasType . jcas . throwFeatMissing ( "misc" , "de.julielab.jules.types.PTBConstituent" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_misc ) ;
public class AWSWAFRegionalClient { /** * Returns the < a > RuleGroup < / a > that is specified by the < code > RuleGroupId < / code > that you included in the * < code > GetRuleGroup < / code > request . * To view the rules in a rule group , use < a > ListActivatedRulesInRuleGroup < / a > . * @ param getRuleGroupRequest * @ return Result of the GetRuleGroup operation returned by the service . * @ throws WAFInternalErrorException * The operation failed because of a system problem , even though the request was valid . Retry your request . * @ throws WAFNonexistentItemException * The operation failed because the referenced object doesn ' t exist . * @ sample AWSWAFRegional . GetRuleGroup * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / waf - regional - 2016-11-28 / GetRuleGroup " target = " _ top " > AWS API * Documentation < / a > */ @ Override public GetRuleGroupResult getRuleGroup ( GetRuleGroupRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeGetRuleGroup ( request ) ;
public class InboxWrapper { /** * Adds a query callback to handle a later message . * @ param id the unique query identifier * @ param result the application ' s callback for the result */ @ Override public QueryRefAmp addQuery ( String address , ResultChain < ? > result , ClassLoader loader ) { } }
return delegate ( ) . addQuery ( address , result , loader ) ;
public class WSURI { /** * Convert to WebSocket < code > ws < / code > or < code > wss < / code > scheme URIs * Converting < code > http < / code > and < code > https < / code > URIs to their WebSocket equivalent * @ param inputUri the input URI * @ return the WebSocket scheme URI for the input URI . * @ throws URISyntaxException if unable to convert the input URI */ public static URI toWebsocket ( final URI inputUri ) throws URISyntaxException { } }
Objects . requireNonNull ( inputUri , "Input URI must not be null" ) ; String httpScheme = inputUri . getScheme ( ) ; if ( "ws" . equalsIgnoreCase ( httpScheme ) || "wss" . equalsIgnoreCase ( httpScheme ) ) { // keep as - is return inputUri ; } if ( "http" . equalsIgnoreCase ( httpScheme ) ) { // convert to ws return new URI ( "ws" + inputUri . toString ( ) . substring ( httpScheme . length ( ) ) ) ; } if ( "https" . equalsIgnoreCase ( httpScheme ) ) { // convert to wss return new URI ( "wss" + inputUri . toString ( ) . substring ( httpScheme . length ( ) ) ) ; } throw new URISyntaxException ( inputUri . toString ( ) , "Unrecognized HTTP scheme" ) ;
public class TransactionInput { /** * For a connected transaction , runs the script against the connected pubkey and verifies they are correct . * @ throws ScriptException if the script did not verify . * @ throws VerificationException If the outpoint doesn ' t match the given output . */ public void verify ( ) throws VerificationException { } }
final Transaction fromTx = getOutpoint ( ) . fromTx ; long spendingIndex = getOutpoint ( ) . getIndex ( ) ; checkNotNull ( fromTx , "Not connected" ) ; final TransactionOutput output = fromTx . getOutput ( ( int ) spendingIndex ) ; verify ( output ) ;
public class BatchLocationServiceImpl { /** * Note : This method compares the jobexecution ' s REST url with this server ' s REST url . * If they are different , and the jobexecution ' s REST url is equal to the * BatchRestUrlUnavailable constant , that means the jobexecution was created * prior to batchManagement - 1.0 being enabled . In that case , this method * compares the jobexecution ' s serverId with this server ' s serverId . The serverId * is slightly less reliable since it depends on configuration . . . but then again , * so does the REST url . . . so neither is that reliable but the REST url feels * more reliable so we prefer that one . * @ return true if the given jobexecution ran ( or is running ) on this server . */ @ Override public boolean isLocalJobExecution ( WSJobExecution jobExecution ) { } }
return jobExecution . getServerId ( ) == null || jobExecution . getRestUrl ( ) == null // If server ID or rest URL were never set , we can treat as local || getBatchRestUrl ( ) . equals ( jobExecution . getRestUrl ( ) ) || ( BatchRestUrlUnavailable . equals ( jobExecution . getRestUrl ( ) ) && getServerId ( ) . equals ( jobExecution . getServerId ( ) ) ) ;
public class AbstractResourceBundleCli { /** * Determines if the given { @ code bundleClass } is { @ link NlsBundleOptions # productive ( ) productive } . * @ param bundleClass is the { @ link Class } to test . * @ return { @ code true } if { @ link NlsBundleOptions # productive ( ) productive } , { @ code false } otherwise . */ private boolean isProductive ( Class < ? > bundleClass ) { } }
NlsBundleOptions options = bundleClass . getAnnotation ( NlsBundleOptions . class ) ; if ( options != null ) { return options . productive ( ) ; } return true ;
public class FileMask { /** * Adds a filetype " dot " extension to filter against . * Par example : le code suivant crera un filtre qui filtrera * tout les fichier a l ' exception des " . jpg " et " . tif " : * FileMasque filter = new FileMasque ( ) ; * filter . addExtension ( " jpg " ) ; * filter . addExtension ( " tif " ) ; * Noter que le " . " avant les extention n ' est pas requis et sera ignore . */ public void addExtension ( String extension ) { } }
if ( filters == null ) { filters = new Hashtable < > ( 5 ) ; } filters . put ( extension . toLowerCase ( ) , this ) ; fullDescription = null ;
public class SimpleWebServlet { /** * Use the notifyStatus ( String event ) method in order to trigger an update at the client ' s page when needed for any new request . * Here will be used for Bye or new Call requests . */ protected void notifyStatus ( String event ) { } }
BlockingQueue < String > eventsQueue = ( LinkedBlockingQueue < String > ) getServletContext ( ) . getAttribute ( "eventsQueue" ) ; // if ( eventsQueue = = null ) eventsQueue = new LinkedBlockingQueue < String > ( ) ; // getServletContext ( ) . setAttribute ( " eventsQueue " , eventsQueue ) ; try { eventsQueue . put ( event ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; }
public class Servlets { /** * 设置 ETag Header 。 * @ param response * 响应 * @ param etag * 内容的ETag */ public static void setEtag ( final HttpServletResponse response , final String etag ) { } }
response . setHeader ( HttpHeaders . ETAG , etag ) ;
public class Expressions { /** * Create a new Template expression * @ param cl type of expression * @ param template template * @ param args template parameters * @ return template expression */ public static < T extends Comparable < ? > > DateTimeTemplate < T > dateTimeTemplate ( Class < ? extends T > cl , Template template , Object ... args ) { } }
return dateTimeTemplate ( cl , template , ImmutableList . copyOf ( args ) ) ;
public class GetVoiceConnectorOriginationRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetVoiceConnectorOriginationRequest getVoiceConnectorOriginationRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getVoiceConnectorOriginationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getVoiceConnectorOriginationRequest . getVoiceConnectorId ( ) , VOICECONNECTORID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Cursor { /** * A cursor is initially positioned before its first row ; the first call to * next makes the first row the current row ; the second call makes the * second row the current row , etc . * < P > If an input stream from the previous row is open , it is implicitly * closed . The ResultSet ' s warning chain is cleared when a new row is read . * @ return object constructed from fetched record or null if there are no * more rows */ public V next ( ) throws SQLException { } }
// if we closed everything up after the last call to next ( ) , // table will be null here and we should bail immediately if ( _table == null ) { return null ; } if ( _result == null ) { if ( _qbeObject != null ) { PreparedStatement qbeStmt = _conn . prepareStatement ( _query ) ; _table . bindQueryVariables ( qbeStmt , _qbeObject , _qbeMask ) ; _result = qbeStmt . executeQuery ( ) ; _stmt = qbeStmt ; } else { if ( _stmt == null ) { _stmt = _conn . createStatement ( ) ; } _result = _stmt . executeQuery ( _query ) ; } } if ( _result . next ( ) ) { return _currObject = _table . load ( _result ) ; } _result . close ( ) ; _result = null ; _currObject = null ; _table = null ; if ( _stmt != null ) { _stmt . close ( ) ; } return null ;
public class AwsAsgUtil { /** * Gets the task that updates the ASG information periodically . * @ return TimerTask that updates the ASG information periodically . */ private TimerTask getASGUpdateTask ( ) { } }
return new TimerTask ( ) { @ Override public void run ( ) { try { if ( ! serverConfig . shouldUseAwsAsgApi ( ) ) { // Disabled via the config , no - op . return ; } // First get the active ASG names Set < CacheKey > cacheKeys = getCacheKeys ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Trying to refresh the keys for {}" , Arrays . toString ( cacheKeys . toArray ( ) ) ) ; } for ( CacheKey key : cacheKeys ) { try { asgCache . refresh ( key ) ; } catch ( Throwable e ) { logger . error ( "Error updating the ASG cache for {}" , key , e ) ; } } } catch ( Throwable e ) { logger . error ( "Error updating the ASG cache" , e ) ; } } } ;
public class AttributeListImpl { /** * Get the type of an attribute ( by position ) . * @ param i The position of the attribute in the list . * @ return The attribute type as a string ( " NMTOKEN " for an * enumeration , and " CDATA " if no declaration was * read ) , or null if there is no attribute at * that position . * @ see org . xml . sax . AttributeList # getType ( int ) */ public String getType ( int i ) { } }
if ( i < 0 || i >= types . size ( ) ) { return null ; } return types . get ( i ) ;
public class JavaDocText { /** * This method removes the additional astrisks from the java doc . * @ param javaDoc the string builder containing the javadoc . */ private void stripAsterisk ( final StringBuilder javaDoc ) { } }
int index = javaDoc . indexOf ( "*" ) ; while ( index != - 1 ) { javaDoc . replace ( index , index + 1 , "" ) ; index = javaDoc . indexOf ( "*" ) ; }
public class Calc { /** * Center the atoms at the Centroid , if the centroid is already know . * @ param atomSet * a set of Atoms * @ return an Atom representing the Centroid of the set of atoms * @ throws StructureException */ public static final Atom [ ] centerAtoms ( Atom [ ] atomSet , Atom centroid ) throws StructureException { } }
Atom shiftVector = getCenterVector ( atomSet , centroid ) ; Atom [ ] newAtoms = new AtomImpl [ atomSet . length ] ; for ( int i = 0 ; i < atomSet . length ; i ++ ) { Atom a = atomSet [ i ] ; Atom n = add ( a , shiftVector ) ; newAtoms [ i ] = n ; } return newAtoms ;
public class Util { /** * Converts a string into 128 - bit AES key . * @ since 1.308 */ @ Nonnull public static SecretKey toAes128Key ( @ Nonnull String s ) { } }
try { // turn secretKey into 256 bit hash MessageDigest digest = MessageDigest . getInstance ( "SHA-256" ) ; digest . reset ( ) ; digest . update ( s . getBytes ( StandardCharsets . UTF_8 ) ) ; // Due to the stupid US export restriction JDK only ships 128bit version . return new SecretKeySpec ( digest . digest ( ) , 0 , 128 / 8 , "AES" ) ; } catch ( NoSuchAlgorithmException e ) { throw new Error ( e ) ; }
public class Tuple16 { /** * Skip 5 degrees from this tuple . */ public final Tuple11 < T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 > skip5 ( ) { } }
return new Tuple11 < > ( v6 , v7 , v8 , v9 , v10 , v11 , v12 , v13 , v14 , v15 , v16 ) ;
public class BuilderCommonMemberFormatter { /** * Get mutable values . This returns message builders for messages , collection * builders for collections , and the normal immutable value for everything * else . * @ param message The message to get mutable getters for . * @ param field The field to generate getter for . */ private void appendMutableGetters ( JMessage message , JField field ) throws GeneratorException { } }
if ( field . field ( ) . getDescriptor ( ) instanceof PPrimitive || field . type ( ) == PType . ENUM ) { // The other fields will have ordinary non - mutable getters . appendGetter ( field ) ; return ; } BlockCommentBuilder comment = new BlockCommentBuilder ( writer ) ; comment . commentRaw ( "Get the builder for the contained <code>" + field . name ( ) + "</code> message field." ) ; if ( field . hasComment ( ) ) { comment . paragraph ( ) . comment ( field . comment ( ) ) ; } comment . newline ( ) . return_ ( "The field message builder" ) ; if ( JAnnotation . isDeprecated ( field ) ) { String reason = field . field ( ) . getAnnotationValue ( ThriftAnnotation . DEPRECATED ) ; if ( reason != null && reason . trim ( ) . length ( ) > 0 ) { comment . deprecated_ ( reason ) ; } } comment . finish ( ) ; if ( JAnnotation . isDeprecated ( field ) ) { writer . appendln ( JAnnotation . DEPRECATED ) ; } writer . appendln ( JAnnotation . NON_NULL ) ; switch ( field . type ( ) ) { case MESSAGE : { writer . formatln ( "public %s._Builder %s() {" , field . instanceType ( ) , field . mutable ( ) ) . begin ( ) ; if ( message . isUnion ( ) ) { writer . formatln ( "if (%s != _Field.%s) {" , UNION_FIELD , field . fieldEnum ( ) ) . formatln ( " %s();" , field . resetter ( ) ) . appendln ( '}' ) . formatln ( "%s = _Field.%s;" , UNION_FIELD , field . fieldEnum ( ) ) ; writer . appendln ( "modified = true;" ) ; } else { writer . formatln ( "optionals.set(%d);" , field . index ( ) ) ; writer . formatln ( "modified.set(%d);" , field . index ( ) ) ; } writer . newline ( ) . formatln ( "if (%s != null) {" , field . member ( ) ) . formatln ( " %s_builder = %s.mutate();" , field . member ( ) , field . member ( ) ) . formatln ( " %s = null;" , field . member ( ) ) . formatln ( "} else if (%s_builder == null) {" , field . member ( ) ) . formatln ( " %s_builder = %s.builder();" , field . member ( ) , field . instanceType ( ) ) . appendln ( '}' ) . formatln ( "return %s_builder;" , field . member ( ) ) ; writer . end ( ) . appendln ( '}' ) . newline ( ) ; // Also add " normal " getter for the message field , which will // return the message or the builder dependent on which is set . // It will not change the state of the builder . comment = new BlockCommentBuilder ( writer ) ; if ( field . hasComment ( ) ) { comment . comment ( field . comment ( ) ) . newline ( ) ; } comment . return_ ( "The field value" ) ; if ( JAnnotation . isDeprecated ( field ) ) { String reason = field . field ( ) . getAnnotationValue ( ThriftAnnotation . DEPRECATED ) ; if ( reason != null && reason . trim ( ) . length ( ) > 0 ) { comment . deprecated_ ( reason ) ; } } comment . finish ( ) ; if ( JAnnotation . isDeprecated ( field ) ) { writer . appendln ( JAnnotation . DEPRECATED ) ; } writer . formatln ( "public %s %s() {" , field . instanceType ( ) , field . getter ( ) ) . begin ( ) ; if ( message . isUnion ( ) ) { writer . formatln ( "if (%s != _Field.%s) {" , UNION_FIELD , field . fieldEnum ( ) ) . formatln ( " return null;" ) . appendln ( '}' ) ; } writer . newline ( ) . formatln ( "if (%s_builder != null) {" , field . member ( ) ) . formatln ( " return %s_builder.build();" , field . member ( ) ) . appendln ( '}' ) . formatln ( "return %s;" , field . member ( ) ) ; writer . end ( ) . appendln ( '}' ) . newline ( ) ; break ; } case SET : case LIST : case MAP : comment = new BlockCommentBuilder ( writer ) ; if ( field . hasComment ( ) ) { comment . comment ( field . comment ( ) ) . newline ( ) ; } comment . return_ ( "The mutable <code>" + field . name ( ) + "</code> container" ) ; if ( JAnnotation . isDeprecated ( field ) ) { String reason = field . field ( ) . getAnnotationValue ( ThriftAnnotation . DEPRECATED ) ; if ( reason != null && reason . trim ( ) . length ( ) > 0 ) { comment . deprecated_ ( reason ) ; } } comment . finish ( ) ; if ( JAnnotation . isDeprecated ( field ) ) { writer . appendln ( JAnnotation . DEPRECATED ) ; } writer . formatln ( "public %s %s() {" , field . fieldType ( ) , field . mutable ( ) ) . begin ( ) ; if ( message . isUnion ( ) ) { writer . formatln ( "if (%s != _Field.%s) {" , UNION_FIELD , field . fieldEnum ( ) ) . formatln ( " %s();" , field . resetter ( ) ) . appendln ( '}' ) . formatln ( "%s = _Field.%s;" , UNION_FIELD , field . fieldEnum ( ) ) ; writer . appendln ( "modified = true;" ) ; } else { writer . formatln ( "optionals.set(%d);" , field . index ( ) ) ; writer . formatln ( "modified.set(%d);" , field . index ( ) ) ; } writer . newline ( ) . formatln ( "if (%s == null) {" , field . member ( ) ) . formatln ( " %s = new %s<>();" , field . member ( ) , field . builderMutableType ( ) ) . formatln ( "} else if (!(%s instanceof %s)) {" , field . member ( ) , field . builderMutableType ( ) ) . formatln ( " %s = new %s<>(%s);" , field . member ( ) , field . builderMutableType ( ) , field . member ( ) ) . appendln ( "}" ) ; writer . formatln ( "return %s;" , field . member ( ) ) ; writer . end ( ) . appendln ( '}' ) . newline ( ) ; break ; default : throw new GeneratorException ( "Unexpected field type: " + field . type ( ) ) ; }
public class SqlAgentFactoryImpl { /** * { @ inheritDoc } * @ see jp . co . future . uroborosql . SqlAgentFactory # getDefaultInsertsType ( ) */ @ Override public InsertsType getDefaultInsertsType ( ) { } }
return InsertsType . valueOf ( getDefaultProps ( ) . getOrDefault ( PROPS_KEY_DEFAULT_INSERTS_TYPE , InsertsType . BULK . toString ( ) ) ) ;
public class PropertiesUtils { /** * Loads a comma - separated list of strings from Properties . Commas may be quoted if needed , e . g . : * property1 = value1 , value2 , " a quoted value " , ' another quoted value ' * getStringArray ( props , " property1 " ) should return the same thing as * new String [ ] { " value1 " , " value2 " , " a quoted value " , " another quoted value " } ; */ public static String [ ] getStringArray ( Properties props , String key ) { } }
String [ ] results = MetaClass . cast ( props . getProperty ( key ) , String [ ] . class ) ; if ( results == null ) { results = new String [ ] { } ; } return results ;
public class InternalSARLLexer { /** * $ ANTLR start " T _ _ 128" */ public final void mT__128 ( ) throws RecognitionException { } }
try { int _type = T__128 ; int _channel = DEFAULT_TOKEN_CHANNEL ; // InternalSARL . g : 114:8 : ( ' if ' ) // InternalSARL . g : 114:10 : ' if ' { match ( "if" ) ; } state . type = _type ; state . channel = _channel ; } finally { }
public class EnterpriseConnectionMatcher { /** * Tries to find a valid domain with the given input . * @ param email to search the Domain for . * @ return a Connection if found , null otherwise . */ @ Nullable public OAuthConnection parse ( String email ) { } }
String domain = extractDomain ( email ) ; if ( domain == null ) { return null ; } domain = domain . toLowerCase ( ) ; for ( OAuthConnection c : connections ) { String mainDomain = domainForConnection ( c ) ; if ( domain . equalsIgnoreCase ( mainDomain ) ) { return c ; } List < String > aliases = c . valueForKey ( DOMAIN_ALIASES_KEY , List . class ) ; if ( aliases != null ) { for ( String d : aliases ) { if ( d . equalsIgnoreCase ( domain ) ) { return c ; } } } } return null ;
public class SnackbarWrapper { /** * Adds multiple callbacks to the Snackbar for various events . * @ param callbacks The callbacks to be added . * @ return This instance . */ @ NonNull @ SuppressWarnings ( "WeakerAccess" ) public SnackbarWrapper addCallbacks ( List < Callback > callbacks ) { } }
int callbacksSize = callbacks . size ( ) ; for ( int i = 0 ; i < callbacksSize ; i ++ ) { addCallback ( callbacks . get ( i ) ) ; } return this ;
public class WorkQueueManager { /** * Main worker thread routine . * @ param req * @ param ioe */ void workerRun ( TCPBaseRequestContext req , IOException ioe ) { } }
if ( null == req || req . getTCPConnLink ( ) . isClosed ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Ignoring IO on closed socket: " + req ) ; } return ; } try { if ( ioe == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Worker thread processing IO request: " + req ) ; } attemptIO ( req , true ) ; } else { if ( req . isRequestTypeRead ( ) ) { TCPReadRequestContextImpl readReq = ( TCPReadRequestContextImpl ) req ; if ( readReq . getReadCompletedCallback ( ) != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Worker thread processing read error: " + req . getTCPConnLink ( ) . getSocketIOChannel ( ) . getChannel ( ) ) ; } readReq . getReadCompletedCallback ( ) . error ( readReq . getTCPConnLink ( ) . getVirtualConnection ( ) , readReq , ioe ) ; } } else { TCPWriteRequestContextImpl writeReq = ( TCPWriteRequestContextImpl ) req ; if ( writeReq . getWriteCompletedCallback ( ) != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Worker thread processing write error: " + req ) ; } writeReq . getWriteCompletedCallback ( ) . error ( writeReq . getTCPConnLink ( ) . getVirtualConnection ( ) , writeReq , ioe ) ; } } } } catch ( Throwable t ) { // Only issue an FFDC if the framework is up / valid . . if ( FrameworkState . isValid ( ) ) { FFDCFilter . processException ( t , getClass ( ) . getName ( ) , "workerRun(req)" , new Object [ ] { this , req , ioe } ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Unexpected error in worker; " + t ) ; } }
public class TagNameFactoryImpl { /** * { @ inheritDoc } */ @ Override public String getTagDisplayValue ( final String path , final String value ) { } }
final FieldPath fieldPath = getFieldPath ( path ) ; return fieldDisplayNameGenerator . generateDisplayValue ( fieldPath , value , FieldType . STRING ) ;
public class RandomVideoCollectionGenerator { /** * Initialize VIDEO _ INFO data . */ private void initializeVideoInfo ( ) { } }
VIDEO_INFO . put ( "The Big Bang Theory" , "http://thetvdb.com/banners/_cache/posters/80379-9.jpg" ) ; VIDEO_INFO . put ( "Breaking Bad" , "http://thetvdb.com/banners/_cache/posters/81189-22.jpg" ) ; VIDEO_INFO . put ( "Arrow" , "http://thetvdb.com/banners/_cache/posters/257655-15.jpg" ) ; VIDEO_INFO . put ( "Game of Thrones" , "http://thetvdb.com/banners/_cache/posters/121361-26.jpg" ) ; VIDEO_INFO . put ( "Lost" , "http://thetvdb.com/banners/_cache/posters/73739-2.jpg" ) ; VIDEO_INFO . put ( "How I met your mother" , "http://thetvdb.com/banners/_cache/posters/75760-29.jpg" ) ; VIDEO_INFO . put ( "Dexter" , "http://thetvdb.com/banners/_cache/posters/79349-24.jpg" ) ; VIDEO_INFO . put ( "Sleepy Hollow" , "http://thetvdb.com/banners/_cache/posters/269578-5.jpg" ) ; VIDEO_INFO . put ( "The Vampire Diaries" , "http://thetvdb.com/banners/_cache/posters/95491-27.jpg" ) ; VIDEO_INFO . put ( "Friends" , "http://thetvdb.com/banners/_cache/posters/79168-4.jpg" ) ; VIDEO_INFO . put ( "New Girl" , "http://thetvdb.com/banners/_cache/posters/248682-9.jpg" ) ; VIDEO_INFO . put ( "The Mentalist" , "http://thetvdb.com/banners/_cache/posters/82459-1.jpg" ) ; VIDEO_INFO . put ( "Sons of Anarchy" , "http://thetvdb.com/banners/_cache/posters/82696-1.jpg" ) ;
public class responderglobal_binding { /** * Use this API to fetch a responderglobal _ binding resource . */ public static responderglobal_binding get ( nitro_service service ) throws Exception { } }
responderglobal_binding obj = new responderglobal_binding ( ) ; responderglobal_binding response = ( responderglobal_binding ) obj . get_resource ( service ) ; return response ;
public class SignalUtil { /** * Logs a warning message . If the elapsed time is greater than * { @ link # SIGNAL _ LOG _ QUIESCE _ TIMEOUT _ MINUTES } then the log message will indicate that wait * logging for the thread is being quiesced , and a value of true is returned . Otherwise , false * is returned . * @ param log * the logger ( for unit testing ) * @ param callerClass * the class name of the caller * @ param callerMethod * the method name of the caller * @ param waitObj * the object that is being waited on * @ param start * the time that the wait began * @ param extraArgs * caller provided extra arguments * @ return true if the elapsed time is greater than { @ link # SIGNAL _ LOG _ QUIESCE _ TIMEOUT _ MINUTES } */ static boolean logWaiting ( Logger log , String callerClass , String callerMethod , Object waitObj , long start , Object ... extraArgs ) { } }
long elapsed = ( System . currentTimeMillis ( ) - start ) / 1000 ; boolean quiesced = false ; if ( elapsed <= SIGNAL_LOG_QUIESCE_TIMEOUT_MINUTES * 60 ) { ArrayList < Object > args = new ArrayList < Object > ( ) ; args . add ( Thread . currentThread ( ) . getId ( ) ) ; args . add ( elapsed ) ; args . add ( waitObj ) ; if ( extraArgs != null ) { args . addAll ( Arrays . asList ( extraArgs ) ) ; } String msg = SignalUtil . formatMessage ( Messages . SignalUtil_0 , args . toArray ( new Object [ args . size ( ) ] ) ) ; log . logp ( Level . WARNING , callerClass , callerMethod , msg . toString ( ) ) ; } else { if ( ! quiesced ) { quiesced = true ; log . logp ( Level . WARNING , callerClass , callerMethod , MessageFormat . format ( Messages . SignalUtil_1 , new Object [ ] { Thread . currentThread ( ) . getId ( ) , elapsed , waitObj } ) ) ; } } return quiesced ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcMeasureValue ( ) { } }
if ( ifcMeasureValueEClass == null ) { ifcMeasureValueEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 962 ) ; } return ifcMeasureValueEClass ;
public class RangeStreamer { /** * For testing purposes */ Multimap < String , Map . Entry < InetAddress , Collection < Range < Token > > > > toFetch ( ) { } }
return toFetch ;
public class SharedPreferenceUtils { /** * Put the value in given shared preference * @ param key * the name of the preference to save * @ param value * the value to save */ public void put ( String key , Object value ) { } }
if ( value . getClass ( ) . equals ( String . class ) ) { putString ( key , value . toString ( ) ) ; } else if ( value . getClass ( ) . equals ( Integer . class ) ) { putInt ( key , ( Integer ) value ) ; } else if ( value . getClass ( ) . equals ( Float . class ) ) { putFloat ( key , ( Float ) value ) ; } else if ( value . getClass ( ) . equals ( Long . class ) ) { putLong ( key , ( Long ) value ) ; } else if ( value . getClass ( ) . equals ( Boolean . class ) ) { putBoolean ( key , ( Boolean ) value ) ; } else { putString ( key , value . toString ( ) ) ; }
public class TcpWorker { /** * Creates the tcpClient with proper handler . * @ return the bound request builder * @ throws HttpRequestCreateException * the http request create exception */ public ClientBootstrap bootStrapTcpClient ( ) throws HttpRequestCreateException { } }
ClientBootstrap tcpClient = null ; try { // Configure the client . tcpClient = new ClientBootstrap ( tcpMeta . getChannelFactory ( ) ) ; // Configure the pipeline factory . tcpClient . setPipelineFactory ( new MyPipelineFactory ( TcpUdpSshPingResourceStore . getInstance ( ) . getTimer ( ) , this , tcpMeta . getTcpIdleTimeoutSec ( ) ) ) ; tcpClient . setOption ( "connectTimeoutMillis" , tcpMeta . getTcpConnectTimeoutMillis ( ) ) ; tcpClient . setOption ( "tcpNoDelay" , true ) ; // tcpClient . setOption ( " keepAlive " , true ) ; } catch ( Exception t ) { throw new TcpUdpRequestCreateException ( "Error in creating request in Tcpworker. " + " If tcpClient is null. Then fail to create." , t ) ; } return tcpClient ;
public class ParallelMapIterate { /** * A parallel form of forEachKeyValue . * @ see MapIterate # forEachKeyValue ( Map , Procedure2) * @ see ParallelIterate */ public static < K , V > void forEachKeyValue ( Map < K , V > map , Procedure2 < ? super K , ? super V > procedure2 ) { } }
ParallelMapIterate . forEachKeyValue ( map , procedure2 , 2 , map . size ( ) ) ;
public class JournalHelper { /** * Capture the full stack trace of an Exception , and return it in a String . */ public static String captureStackTrace ( Throwable e ) { } }
StringWriter buffer = new StringWriter ( ) ; e . printStackTrace ( new PrintWriter ( buffer ) ) ; return buffer . toString ( ) ;