signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Application { /** * Get the codebase for this application .
* < pre >
* Tries to get the codebase in the following order :
* 1 . From the applet codebase .
* 2 . From the jnlp codebase .
* 3 . From the codebase param .
* 4 . From the server param
* 5 . From the current host name
* 6 . Localhost
* < / pre >
* @ param applet The ( optional ) applet .
* @ return A URL for this codebase ( or null if not found ) . */
public URL getCodeBase ( BaseAppletReference applet ) { } } | URL urlCodeBase = null ; if ( applet != null ) applet = applet . getApplet ( ) ; // Get the Applet if this is an applet .
else if ( Application . getRootApplet ( ) != null ) // If they didn ' t pass me an applet , get the applet from the static reference .
applet = Application . getRootApplet ( ) . getApplet ( ) ; if ( applet != null ) urlCodeBase = applet . getCodeBase ( ) ; // In an applet window .
else { // Standalone .
if ( this . getMuffinManager ( ) != null ) if ( this . getMuffinManager ( ) . isServiceAvailable ( ) ) urlCodeBase = this . getMuffinManager ( ) . getCodeBase ( ) ; } String strCodeBase = this . getProperty ( Params . CODEBASE ) ; if ( ( strCodeBase != null ) && ( strCodeBase . length ( ) > 0 ) && ( Character . isLetter ( strCodeBase . charAt ( 0 ) ) ) ) { // If they explicitly specify a codebase , use it .
try { URL newUrlCodeBase = new URL ( strCodeBase ) ; urlCodeBase = newUrlCodeBase ; } catch ( MalformedURLException e ) { if ( urlCodeBase != null ) { // Always . Use codebase with new path
try { urlCodeBase = new URL ( urlCodeBase . getProtocol ( ) , urlCodeBase . getHost ( ) , urlCodeBase . getPort ( ) , strCodeBase ) ; } catch ( MalformedURLException e1 ) { e1 . printStackTrace ( ) ; } } } } else strCodeBase = null ; if ( urlCodeBase == null ) { if ( ( strCodeBase == null ) || ( strCodeBase . length ( ) == 0 ) ) { // Now we ' re really guessing - Try the server for a codebase , then try the localhost
strCodeBase = this . getProperty ( Params . REMOTE_HOST ) ; if ( ( strCodeBase == null ) || ( strCodeBase . length ( ) == 0 ) ) { try { strCodeBase = InetAddress . getLocalHost ( ) . getHostName ( ) ; } catch ( Exception ex ) { strCodeBase = "localhost" ; } } } if ( strCodeBase != null ) { try { int protocolEnd = strCodeBase . indexOf ( ':' ) ; if ( ( protocolEnd == - 1 ) || ( protocolEnd > 6 ) ) { if ( ( getConnectionType ( ) != PROXY ) && ( ( strCodeBase . startsWith ( "/" ) ) || ( strCodeBase . startsWith ( System . getProperty ( "file.separator" ) ) ) ) ) strCodeBase = "file:" + strCodeBase ; else strCodeBase = "http://" + strCodeBase ; } urlCodeBase = new URL ( strCodeBase ) ; } catch ( MalformedURLException ex ) { ex . printStackTrace ( ) ; } } } return urlCodeBase ; |
public class AnimaQuery { /** * Build a paging statement
* @ param pageRow page param
* @ return paging sql */
private String buildPageSQL ( String sql , PageRow pageRow ) { } } | SQLParams sqlParams = SQLParams . builder ( ) . modelClass ( this . modelClass ) . selectColumns ( this . selectColumns ) . tableName ( this . tableName ) . pkName ( this . primaryKeyColumn ) . conditionSQL ( this . conditionSQL ) . excludedColumns ( this . excludedColumns ) . customSQL ( sql ) . orderBy ( this . orderBySQL . toString ( ) ) . pageRow ( pageRow ) . build ( ) ; return Anima . of ( ) . dialect ( ) . paginate ( sqlParams ) ; |
public class ServletLogContext { /** * Sets the transaction id in the logging context
* @ param transactionId The transaction id */
public static void putTransactionId ( final String transactionId ) { } } | if ( ( transactionId != null ) && ( 0 < transactionId . length ( ) ) ) { MDC . put ( TRANSACTION_ID , transactionId ) ; } |
public class A_CmsStaticExportHandler { /** * Deletes the given file from the RFS if it exists ,
* also deletes all parameter variations of the file . < p >
* @ param rfsFilePath the path of the RFS file to delete
* @ param vfsName the VFS name of the file to delete ( required for logging ) */
protected void purgeFile ( String rfsFilePath , String vfsName ) { } } | File rfsFile = new File ( rfsFilePath ) ; // first delete the base file
deleteFile ( rfsFile , vfsName ) ; // now delete the file parameter variations
// get the parent folder
File parent = rfsFile . getParentFile ( ) ; if ( parent != null ) { // list all files in the parent folder that are variations of the base file
File [ ] paramVariants = parent . listFiles ( new PrefixFileFilter ( rfsFile ) ) ; if ( paramVariants != null ) { for ( int v = 0 ; v < paramVariants . length ; v ++ ) { deleteFile ( paramVariants [ v ] , vfsName ) ; } } } |
public class TextIntWritable { /** * Returns the a negative value if the provided { @ code TextIntWritable } has
* a lexicographically less text value or if its position is less , or
* returns a positive value if the provided { @ code TextIntWritable } has text
* with a lexicographically greater value or if its position is larger . */
public int compareTo ( TextIntWritable o ) { } } | int c = t . compareTo ( o . t ) ; if ( c != 0 ) return c ; return position - o . position ; |
public class AssertSoapFaultBuilder { /** * Sets the Spring bean application context .
* @ param applicationContext */
public AssertSoapFaultBuilder withApplicationContext ( ApplicationContext applicationContext ) { } } | if ( applicationContext . containsBean ( "soapFaultValidator" ) ) { validator ( applicationContext . getBean ( "soapFaultValidator" , SoapFaultValidator . class ) ) ; } return this ; |
public class BuildObligationPolicyDatabase { /** * Handle a method with a WillCloseWhenClosed parameter annotation . */
private void handleWillCloseWhenClosed ( XMethod xmethod , Obligation deletedObligation ) { } } | if ( deletedObligation == null ) { if ( DEBUG_ANNOTATIONS ) { System . out . println ( "Method " + xmethod . toString ( ) + " is marked @WillCloseWhenClosed, " + "but its parameter is not an obligation" ) ; } return ; } // See what type of obligation is being created .
Obligation createdObligation = null ; if ( "<init>" . equals ( xmethod . getName ( ) ) ) { // Constructor - obligation type is the type of object being created
// ( or some supertype )
createdObligation = database . getFactory ( ) . getObligationByType ( xmethod . getClassDescriptor ( ) ) ; } else { // Factory method - obligation type is the return type
Type returnType = Type . getReturnType ( xmethod . getSignature ( ) ) ; if ( returnType instanceof ObjectType ) { try { createdObligation = database . getFactory ( ) . getObligationByType ( ( ObjectType ) returnType ) ; } catch ( ClassNotFoundException e ) { reporter . reportMissingClass ( e ) ; return ; } } } if ( createdObligation == null ) { if ( DEBUG_ANNOTATIONS ) { System . out . println ( "Method " + xmethod . toString ( ) + " is marked @WillCloseWhenClosed, " + "but its return type is not an obligation" ) ; } return ; } // Add database entries :
// - parameter obligation is deleted
// - return value obligation is added
database . addEntry ( new MatchMethodEntry ( xmethod , ObligationPolicyDatabaseActionType . DEL , ObligationPolicyDatabaseEntryType . STRONG , deletedObligation ) ) ; database . addEntry ( new MatchMethodEntry ( xmethod , ObligationPolicyDatabaseActionType . ADD , ObligationPolicyDatabaseEntryType . STRONG , createdObligation ) ) ; |
public class XMLOutputter { /** * Writes the specified < code > String < / code > as PCDATA .
* @ param text the PCDATA text to be written , not < code > null < / code > .
* @ throws IllegalStateException if < code > getState ( ) ! = { @ link # START _ TAG _ OPEN } & amp ; & amp ;
* getState ( ) ! = { @ link # WITHIN _ ELEMENT } < / code >
* @ throws IllegalArgumentException if < code > text = = null < / code > .
* @ throws InvalidXMLException if the specified text contains an invalid character .
* @ throws IOException if an I / O error occurs ; this will set the state to { @ link # ERROR _ STATE } . */
@ Override public final void pcdata ( String text ) throws IllegalStateException , IllegalArgumentException , InvalidXMLException , IOException { } } | // Check state
if ( _state != XMLEventListenerStates . START_TAG_OPEN && _state != XMLEventListenerStates . WITHIN_ELEMENT ) { throw new IllegalStateException ( "getState() == " + _state ) ; // Check arguments
} else if ( text == null ) { throw new IllegalArgumentException ( "text == null" ) ; } // Temporarily set the state to ERROR _ STATE . Unless an exception is
// thrown in the write methods , it will be reset to a valid state .
XMLEventListenerState oldState = _state ; _state = XMLEventListenerStates . ERROR_STATE ; // Write output
if ( oldState == XMLEventListenerStates . START_TAG_OPEN ) { closeStartTag ( ) ; _out . write ( _lineBreakChars ) ; } _encoder . text ( _out , text , _escapeAmpersands ) ; // Change the state
_state = XMLEventListenerStates . WITHIN_ELEMENT ; // State has changed , check
checkInvariants ( ) ; |
public class ItemStateReader { /** * Read and set ItemState data .
* @ param in
* ObjectReader .
* @ return ItemState object .
* @ throws UnknownClassIdException
* If read Class ID is not expected or do not exist .
* @ throws IOException
* If an I / O error has occurred . */
public ItemState read ( ObjectReader in ) throws UnknownClassIdException , IOException { } } | // read id
int key ; if ( ( key = in . readInt ( ) ) != SerializationConstants . ITEM_STATE ) { throw new UnknownClassIdException ( "There is unexpected class [" + key + "]" ) ; } ItemState is = null ; try { int state = in . readInt ( ) ; boolean isPersisted = in . readBoolean ( ) ; boolean eventFire = in . readBoolean ( ) ; QPath oldPath = null ; if ( in . readInt ( ) == SerializationConstants . NOT_NULL_DATA ) { byte [ ] buf = new byte [ in . readInt ( ) ] ; in . readFully ( buf ) ; oldPath = QPath . parse ( new String ( buf , Constants . DEFAULT_ENCODING ) ) ; } boolean isNodeData = in . readBoolean ( ) ; if ( isNodeData ) { PersistedNodeDataReader rdr = new PersistedNodeDataReader ( ) ; is = new ItemState ( rdr . read ( in ) , state , eventFire , null , false , isPersisted , oldPath ) ; } else { PersistedPropertyDataReader rdr = new PersistedPropertyDataReader ( holder , spoolConfig ) ; is = new ItemState ( rdr . read ( in ) , state , eventFire , null , false , isPersisted , oldPath ) ; } return is ; } catch ( EOFException e ) { throw new StreamCorruptedException ( "Unexpected EOF in middle of data block." ) ; } catch ( IllegalPathException e ) { throw new IOException ( "Data corrupted" , e ) ; } |
public class GVRVertexBuffer { /** * Updates a vertex attribute from an integer buffer .
* All of the entries of the input buffer are copied into
* the storage for the named vertex attribute . Other vertex
* attributes are not affected .
* The attribute name must be one of the attributes named
* in the descriptor passed to the constructor .
* All vertex attributes have the same number of entries .
* If this is the first attribute added to the vertex buffer ,
* the size of the input data array will determine the number of vertices .
* Updating subsequent attributes will fail if the data array
* size is not consistent . For example , if you create a vertex
* buffer with descriptor " . . . float4 a _ bone _ weights int4 a _ bone _ indices "
* and provide an array of 16 ints this will result in
* a vertex count of 4 . The corresponding data array for the
* " a _ bone _ indices " attribute should also contain 16 floats .
* @ param attributeName name of the attribute to update
* @ param data IntBuffer containing the new values
* @ param stride number of ints in the attribute
* @ param offset offset from start of array of where to start copying source data
* @ throws IllegalArgumentException if attribute name not in descriptor or buffer is wrong size */
public void setIntVec ( String attributeName , IntBuffer data , int stride , int offset ) { } } | if ( ! NativeVertexBuffer . setIntVec ( getNative ( ) , attributeName , data , stride , offset ) ) { throw new IllegalArgumentException ( "Attribute name " + attributeName + " cannot be updated" ) ; } |
public class WebDriverWaitUtils { /** * Waits until element is either invisible or not present on the DOM .
* @ param elementLocator
* identifier of element to be found */
public static void waitUntilElementIsInvisible ( final String elementLocator ) { } } | logger . entering ( elementLocator ) ; By by = HtmlElementUtils . resolveByType ( elementLocator ) ; ExpectedCondition < Boolean > condition = ExpectedConditions . invisibilityOfElementLocated ( by ) ; waitForCondition ( condition ) ; logger . exiting ( ) ; |
public class JCDiagnostic { /** * Methods for javax . tools . Diagnostic */
public Diagnostic . Kind getKind ( ) { } } | switch ( type ) { case NOTE : return Diagnostic . Kind . NOTE ; case WARNING : return flags . contains ( DiagnosticFlag . MANDATORY ) ? Diagnostic . Kind . MANDATORY_WARNING : Diagnostic . Kind . WARNING ; case ERROR : return Diagnostic . Kind . ERROR ; default : return Diagnostic . Kind . OTHER ; } |
public class NonExceptionPostdominatorsAnalysisFactory { /** * ( non - Javadoc )
* @ see
* edu . umd . cs . findbugs . classfile . IAnalysisEngine # analyze ( edu . umd . cs . findbugs
* . classfile . IAnalysisCache , java . lang . Object ) */
@ Override public NonExceptionPostdominatorsAnalysis analyze ( IAnalysisCache analysisCache , MethodDescriptor descriptor ) throws CheckedAnalysisException { } } | CFG cfg = getCFG ( analysisCache , descriptor ) ; ReverseDepthFirstSearch rdfs = getReverseDepthFirstSearch ( analysisCache , descriptor ) ; NonExceptionPostdominatorsAnalysis analysis = new NonExceptionPostdominatorsAnalysis ( cfg , rdfs , getDepthFirstSearch ( analysisCache , descriptor ) ) ; Dataflow < java . util . BitSet , PostDominatorsAnalysis > dataflow = new Dataflow < > ( cfg , analysis ) ; dataflow . execute ( ) ; return analysis ; |
public class PlaceManager { /** * Called when a body object enters this place . */
protected void bodyEntered ( final int bodyOid ) { } } | log . debug ( "Body entered" , "where" , where ( ) , "oid" , bodyOid ) ; // let our delegates know what ' s up
applyToDelegates ( new DelegateOp ( PlaceManagerDelegate . class ) { @ Override public void apply ( PlaceManagerDelegate delegate ) { delegate . bodyEntered ( bodyOid ) ; } } ) ; // if we were on the road to shutting down , step off
cancelShutdowner ( ) ; |
public class Duration { /** * Returns a copy of this duration with the specified duration subtracted .
* The duration amount is measured in terms of the specified unit .
* Only a subset of units are accepted by this method .
* The unit must either have an { @ linkplain TemporalUnit # isDurationEstimated ( ) exact duration } or
* be { @ link ChronoUnit # DAYS } which is treated as 24 hours . Other units throw an exception .
* This instance is immutable and unaffected by this method call .
* @ param amountToSubtract the amount to subtract , measured in terms of the unit , positive or negative
* @ param unit the unit that the amount is measured in , must have an exact duration , not null
* @ return a { @ code Duration } based on this duration with the specified duration subtracted , not null
* @ throws ArithmeticException if numeric overflow occurs */
public Duration minus ( long amountToSubtract , TemporalUnit unit ) { } } | return ( amountToSubtract == Long . MIN_VALUE ? plus ( Long . MAX_VALUE , unit ) . plus ( 1 , unit ) : plus ( - amountToSubtract , unit ) ) ; |
public class XMLStreamEvents { /** * Return true if the given character is considered as a white space . */
public static boolean isSpaceChar ( char c ) { } } | if ( c == 0x20 ) return true ; if ( c > 0xD ) return false ; if ( c < 0x9 ) return false ; return isSpace [ c - 9 ] ; |
public class UIData { /** * Invoke the specified phase on all facets of all UIColumn children of this component . Note that no methods are
* called on the UIColumn child objects themselves .
* @ param context
* is the current faces context .
* @ param processAction
* specifies a JSF phase : decode , validate or update . */
private void processColumnFacets ( FacesContext context , int processAction ) { } } | for ( int i = 0 , childCount = getChildCount ( ) ; i < childCount ; i ++ ) { UIComponent child = getChildren ( ) . get ( i ) ; if ( child instanceof UIColumn ) { if ( ! _ComponentUtils . isRendered ( context , child ) ) { // Column is not visible
continue ; } if ( child . getFacetCount ( ) > 0 ) { for ( UIComponent facet : child . getFacets ( ) . values ( ) ) { process ( context , facet , processAction ) ; } } } } |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcShapeModel ( ) { } } | if ( ifcShapeModelEClass == null ) { ifcShapeModelEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 511 ) ; } return ifcShapeModelEClass ; |
public class HybridizationRatioDescriptor { /** * Calculate sp3 / sp2 hybridization ratio in the supplied { @ link IAtomContainer } .
* @ param container The AtomContainer for which this descriptor is to be calculated .
* @ return The ratio of sp3 to sp2 carbons */
@ Override public DescriptorValue calculate ( IAtomContainer container ) { } } | try { IAtomContainer clone = ( IAtomContainer ) container . clone ( ) ; AtomContainerManipulator . percieveAtomTypesAndConfigureAtoms ( clone ) ; int nsp2 = 0 ; int nsp3 = 0 ; for ( IAtom atom : clone . atoms ( ) ) { if ( ! atom . getSymbol ( ) . equals ( "C" ) ) continue ; if ( atom . getHybridization ( ) == Hybridization . SP2 ) nsp2 ++ ; else if ( atom . getHybridization ( ) == Hybridization . SP3 ) nsp3 ++ ; } double ratio = nsp3 / ( double ) ( nsp2 + nsp3 ) ; return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new DoubleResult ( ratio ) , getDescriptorNames ( ) ) ; } catch ( CloneNotSupportedException e ) { return getDummyDescriptorValue ( e ) ; } catch ( CDKException e ) { return getDummyDescriptorValue ( e ) ; } |
public class TaskBuilder { /** * 设置需要执行的任务
* @ param action Callable
* @ return TaskBuilder */
public TaskBuilder < Result > action ( final Callable < Result > action ) { } } | if ( action instanceof TaskCallable ) { this . action = ( TaskCallable < Result > ) action ; } else { this . action = new WrappedCallable < Result > ( action ) ; } return this ; |
public class LoginValidator { /** * 是否合法用户
* @ param username
* 用户名
* @ param password
* 密码md5
* @ return 是否合法 */
public static boolean isValid ( String username , String password ) { } } | return StringUtils . isNotEmpty ( username ) && StringUtils . isNotEmpty ( password ) && UserWebConstant . USERMAP . containsKey ( username ) && UserWebConstant . USERMAP . get ( username ) . getPasswordMd5 ( ) . equals ( password ) ; |
public class WebAppTypeImpl { /** * Returns all < code > context - param < / code > elements
* @ return list of < code > context - param < / code > */
public List < ParamValueType < WebAppType < T > > > getAllContextParam ( ) { } } | List < ParamValueType < WebAppType < T > > > list = new ArrayList < ParamValueType < WebAppType < T > > > ( ) ; List < Node > nodeList = childNode . get ( "context-param" ) ; for ( Node node : nodeList ) { ParamValueType < WebAppType < T > > type = new ParamValueTypeImpl < WebAppType < T > > ( this , "context-param" , childNode , node ) ; list . add ( type ) ; } return list ; |
public class IniFile { /** * Returns the specified integer property from the specified section .
* @ param pstrSection the INI section name .
* @ param pstrProp the property to be retrieved .
* @ return the integer property value . */
public Integer getIntegerProperty ( String pstrSection , String pstrProp ) { } } | Integer intRet = null ; String strVal = null ; INIProperty objProp = null ; INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec != null ) { objProp = objSec . getProperty ( pstrProp ) ; try { if ( objProp != null ) { strVal = objProp . getPropValue ( ) ; if ( strVal != null ) intRet = new Integer ( strVal ) ; } } catch ( NumberFormatException NFExIgnore ) { } finally { if ( objProp != null ) objProp = null ; } objSec = null ; } return intRet ; |
public class LocalDateTime { /** * Get the date time as a < code > java . util . Date < / code > using the specified time zone .
* The < code > Date < / code > object created has exactly the same fields as this
* date - time , except when the time would be invalid due to a daylight savings
* gap . In that case , the time will be set to the earliest valid time after the gap .
* In the case of a daylight savings overlap , the earlier instant is selected .
* Converting to a JDK Date is full of complications as the JDK Date constructor
* doesn ' t behave as you might expect around DST transitions . This method works
* by taking a first guess and then adjusting . This also handles the situation
* where the JDK time zone data differs from the Joda - Time time zone data .
* Unlike { @ link # toDate ( ) } , this implementation does not rely on Java ' s synchronized
* time zone initialization logic , and should demonstrate better concurrent performance
* characteristics .
* @ return a Date initialised with this date - time , never null
* @ since 2.3 */
public Date toDate ( final TimeZone timeZone ) { } } | final Calendar calendar = Calendar . getInstance ( timeZone ) ; calendar . clear ( ) ; calendar . set ( getYear ( ) , getMonthOfYear ( ) - 1 , getDayOfMonth ( ) , getHourOfDay ( ) , getMinuteOfHour ( ) , getSecondOfMinute ( ) ) ; Date date = calendar . getTime ( ) ; date . setTime ( date . getTime ( ) + getMillisOfSecond ( ) ) ; return correctDstTransition ( date , timeZone ) ; |
public class PhysicalTable { /** * Move the position of the record .
* @ exception DBException File exception . */
public int doMove ( int iRelPosition ) throws DBException { } } | try { BaseBuffer buffer = m_pTable . move ( iRelPosition , this ) ; this . doSetHandle ( buffer , DBConstants . DATA_SOURCE_HANDLE ) ; int iRecordStatus = DBConstants . RECORD_NORMAL ; if ( buffer == null ) if ( ( iRelPosition < 0 ) || ( iRelPosition == DBConstants . LAST_RECORD ) ) iRecordStatus |= DBConstants . RECORD_AT_BOF ; if ( buffer == null ) if ( ( iRelPosition >= 0 ) || ( iRelPosition == DBConstants . FIRST_RECORD ) ) iRecordStatus |= DBConstants . RECORD_AT_EOF ; return iRecordStatus ; } catch ( DBException ex ) { throw DatabaseException . toDatabaseException ( ex ) ; } |
public class MimeUtils { /** * Returns the registered extension for the given MIME type . Note that some
* MIME types map to multiple extensions . This call will return the most
* common extension for the given MIME type .
* @ param mimeType A MIME type ( i . e . text / plain )
* @ return The extension for the given MIME type or null iff there is none . */
public static String getExtensionFromMimeType ( String mimeType ) { } } | if ( mimeType == null || mimeType . length ( ) == 0 ) { return null ; } return mimeTypeToExtensionMap . get ( mimeType ) ; |
public class Mail { /** * set the value to The name of the e - mail message recipient .
* @ param strTo value to set
* @ throws ApplicationException */
public void setTo ( Object to ) throws ApplicationException { } } | if ( StringUtil . isEmpty ( to ) ) return ; try { smtp . addTo ( to ) ; } catch ( Exception e ) { throw new ApplicationException ( "attribute [to] of the tag [mail] is invalid" , e . getMessage ( ) ) ; } |
public class InsertIntoClauseParser { /** * Parse insert into .
* @ param insertStatement insert statement */
public void parse ( final InsertStatement insertStatement ) { } } | lexerEngine . unsupportedIfEqual ( getUnsupportedKeywordsBeforeInto ( ) ) ; lexerEngine . skipUntil ( DefaultKeyword . INTO ) ; lexerEngine . nextToken ( ) ; tableReferencesClauseParser . parse ( insertStatement , true ) ; skipBetweenTableAndValues ( insertStatement ) ; |
public class Ifc4FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIfcShadingDeviceTypeEnumToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class RgbaColor { /** * palettes */
public RgbaColor [ ] getPaletteVaryLightness ( int count ) { } } | // a max of 80 and an offset of 10 keeps us away from the
// edges
float [ ] spread = getSpreadInRange ( l ( ) , count , 80 , 10 ) ; RgbaColor [ ] ret = new RgbaColor [ count ] ; for ( int i = 0 ; i < count ; i ++ ) { ret [ i ] = withLightness ( spread [ i ] ) ; } return ret ; |
public class druidGParser { /** * druidG . g : 441:1 : regexFilter returns [ Filter filter ] : ( a = ID WS LIKE WS b = ( SINGLE _ QUOTE _ STRING ) ) ; */
public final Filter regexFilter ( ) throws RecognitionException { } } | Filter filter = null ; Token a = null ; Token b = null ; filter = new Filter ( "regex" ) ; try { // druidG . g : 443:2 : ( ( a = ID WS LIKE WS b = ( SINGLE _ QUOTE _ STRING ) ) )
// druidG . g : 443:4 : ( a = ID WS LIKE WS b = ( SINGLE _ QUOTE _ STRING ) )
{ // druidG . g : 443:4 : ( a = ID WS LIKE WS b = ( SINGLE _ QUOTE _ STRING ) )
// druidG . g : 443:5 : a = ID WS LIKE WS b = ( SINGLE _ QUOTE _ STRING )
{ a = ( Token ) match ( input , ID , FOLLOW_ID_in_regexFilter3002 ) ; match ( input , WS , FOLLOW_WS_in_regexFilter3004 ) ; match ( input , LIKE , FOLLOW_LIKE_in_regexFilter3006 ) ; match ( input , WS , FOLLOW_WS_in_regexFilter3008 ) ; // druidG . g : 443:24 : ( SINGLE _ QUOTE _ STRING )
// druidG . g : 443:25 : SINGLE _ QUOTE _ STRING
{ b = ( Token ) match ( input , SINGLE_QUOTE_STRING , FOLLOW_SINGLE_QUOTE_STRING_in_regexFilter3014 ) ; } } filter . dimension = ( a != null ? a . getText ( ) : null ) ; filter . pattern = unquote ( ( b != null ? b . getText ( ) : null ) ) ; } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { // do for sure before leaving
} return filter ; |
public class CommandClass { /** * Restores details about this command class from a persistence context .
* @ param ctx the persistence context
* @ param nodeId the node ID associated with this command class
* @ return a Map with the command class properties */
public Map < String , Object > restore ( PersistenceContext ctx , byte nodeId ) { } } | Map < String , Object > map = ctx . getCommandClassMap ( nodeId , getId ( ) ) ; this . version = ( int ) map . get ( "version" ) ; return map ; |
public class RampImport { /** * Marshal from an array of source types to an array of dest types . */
public Class < ? > marshalType ( Class < ? > sourceType ) { } } | if ( sourceType == null ) { return null ; } Class < ? > targetType = getTargetType ( getTargetLoader ( ) , sourceType ) ; if ( targetType != null ) { return targetType ; } else { return sourceType ; } |
public class ComputeNodesImpl { /** * Gets the Remote Desktop Protocol file for the specified compute node .
* Before you can access a node by using the RDP file , you must create a user account on the node . This API can only be invoked on pools created with a cloud service configuration . For pools created with a virtual machine configuration , see the GetRemoteLoginSettings API .
* @ param poolId The ID of the pool that contains the compute node .
* @ param nodeId The ID of the compute node for which you want to get the Remote Desktop Protocol file .
* @ 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 < InputStream > getRemoteDesktopAsync ( String poolId , String nodeId , final ServiceCallback < InputStream > serviceCallback ) { } } | return ServiceFuture . fromHeaderResponse ( getRemoteDesktopWithServiceResponseAsync ( poolId , nodeId ) , serviceCallback ) ; |
public class GetIndicesVersionResponse { /** * Computes a unique hash based on the version of the shards . */
private long getIndexVersion ( List < ShardIndexVersion > shards ) { } } | long version = 1 ; // order shards per their id before computing the hash
Collections . sort ( shards , new Comparator < ShardIndexVersion > ( ) { @ Override public int compare ( ShardIndexVersion o1 , ShardIndexVersion o2 ) { return o1 . getShardRouting ( ) . id ( ) - o2 . getShardRouting ( ) . id ( ) ; } } ) ; // compute hash
for ( ShardIndexVersion shard : shards ) { version = 31 * version + shard . getVersion ( ) ; } return version ; |
public class SpringContext { /** * Get application context for configuration class . */
public static synchronized AbstractApplicationContext getContext ( Class < ? > springConfigurationClass ) { } } | if ( ! CONTEXTS . containsKey ( springConfigurationClass ) ) { AbstractApplicationContext context = new AnnotationConfigApplicationContext ( springConfigurationClass ) ; context . registerShutdownHook ( ) ; CONTEXTS . put ( springConfigurationClass , context ) ; } return CONTEXTS . get ( springConfigurationClass ) ; |
public class AdductionPBMechanism { /** * Initiates the process for the given mechanism . The atoms and bonds to apply are mapped between
* reactants and products .
* @ param atomContainerSet
* @ param atomList The list of atoms taking part in the mechanism . Only allowed three atoms
* @ param bondList The list of bonds taking part in the mechanism . Only allowed one bond
* @ return The Reaction mechanism */
@ Override public IReaction initiate ( IAtomContainerSet atomContainerSet , ArrayList < IAtom > atomList , ArrayList < IBond > bondList ) throws CDKException { } } | CDKAtomTypeMatcher atMatcher = CDKAtomTypeMatcher . getInstance ( atomContainerSet . getBuilder ( ) ) ; if ( atomContainerSet . getAtomContainerCount ( ) != 2 ) { throw new CDKException ( "AdductionPBMechanism expects two IAtomContainer's" ) ; } if ( atomList . size ( ) != 3 ) { throw new CDKException ( "AdductionPBMechanism expects two atoms in the ArrayList" ) ; } if ( bondList . size ( ) != 1 ) { throw new CDKException ( "AdductionPBMechanism don't expect bonds in the ArrayList" ) ; } IAtomContainer molecule1 = atomContainerSet . getAtomContainer ( 0 ) ; IAtomContainer molecule2 = atomContainerSet . getAtomContainer ( 1 ) ; IAtomContainer reactantCloned ; try { reactantCloned = ( IAtomContainer ) atomContainerSet . getAtomContainer ( 0 ) . clone ( ) ; reactantCloned . add ( ( IAtomContainer ) atomContainerSet . getAtomContainer ( 1 ) . clone ( ) ) ; } catch ( CloneNotSupportedException e ) { throw new CDKException ( "Could not clone IAtomContainer!" , e ) ; } IAtom atom1 = atomList . get ( 0 ) ; // Atom 1 : to be deficient in charge
IAtom atom1C = reactantCloned . getAtom ( molecule1 . indexOf ( atom1 ) ) ; IAtom atom2 = atomList . get ( 1 ) ; // Atom 2 : receive the adduct
IAtom atom2C = reactantCloned . getAtom ( molecule1 . indexOf ( atom2 ) ) ; IAtom atom3 = atomList . get ( 2 ) ; // Atom 2 : deficient in charge
IAtom atom3C = reactantCloned . getAtom ( molecule1 . getAtomCount ( ) + molecule2 . indexOf ( atom3 ) ) ; IBond bond1 = bondList . get ( 0 ) ; int posBond1 = atomContainerSet . getAtomContainer ( 0 ) . indexOf ( bond1 ) ; BondManipulator . decreaseBondOrder ( reactantCloned . getBond ( posBond1 ) ) ; IBond newBond = molecule1 . getBuilder ( ) . newInstance ( IBond . class , atom2C , atom3C , IBond . Order . SINGLE ) ; reactantCloned . addBond ( newBond ) ; int charge = atom1C . getFormalCharge ( ) ; atom1C . setFormalCharge ( charge + 1 ) ; atom1C . setHybridization ( null ) ; AtomContainerManipulator . percieveAtomTypesAndConfigureAtoms ( reactantCloned ) ; IAtomType type = atMatcher . findMatchingAtomType ( reactantCloned , atom1C ) ; if ( type == null || type . getAtomTypeName ( ) . equals ( "X" ) ) return null ; atom2C . setHybridization ( null ) ; AtomContainerManipulator . percieveAtomTypesAndConfigureAtoms ( reactantCloned ) ; type = atMatcher . findMatchingAtomType ( reactantCloned , atom2C ) ; if ( type == null || type . getAtomTypeName ( ) . equals ( "X" ) ) return null ; charge = atom3C . getFormalCharge ( ) ; atom3C . setFormalCharge ( charge - 1 ) ; atom3C . setHybridization ( null ) ; AtomContainerManipulator . percieveAtomTypesAndConfigureAtoms ( reactantCloned ) ; type = atMatcher . findMatchingAtomType ( reactantCloned , atom3C ) ; if ( type == null || type . getAtomTypeName ( ) . equals ( "X" ) ) return null ; IReaction reaction = atom1C . getBuilder ( ) . newInstance ( IReaction . class ) ; reaction . addReactant ( molecule1 ) ; /* mapping */
for ( IAtom atom : molecule1 . atoms ( ) ) { IMapping mapping = atom1C . getBuilder ( ) . newInstance ( IMapping . class , atom , reactantCloned . getAtom ( molecule1 . indexOf ( atom ) ) ) ; reaction . addMapping ( mapping ) ; } for ( IAtom atom : molecule2 . atoms ( ) ) { IMapping mapping = atom1C . getBuilder ( ) . newInstance ( IMapping . class , atom , reactantCloned . getAtom ( molecule2 . indexOf ( atom ) ) ) ; reaction . addMapping ( mapping ) ; } reaction . addProduct ( reactantCloned ) ; return reaction ; |
public class ChannelServiceImpl { /** * < pre >
* 根据PipelineID找到对应的Channel
* 优化设想 :
* 应该通过变长参数达到后期扩展的方便性
* < / pre > */
public List < Channel > listByPipelineIds ( Long ... pipelineIds ) { } } | List < Channel > channels = new ArrayList < Channel > ( ) ; try { List < Pipeline > pipelines = pipelineService . listByIds ( pipelineIds ) ; List < Long > channelIds = new ArrayList < Long > ( ) ; for ( Pipeline pipeline : pipelines ) { if ( ! channelIds . contains ( pipeline . getChannelId ( ) ) ) { channelIds . add ( pipeline . getChannelId ( ) ) ; } } channels = listByIds ( channelIds . toArray ( new Long [ channelIds . size ( ) ] ) ) ; } catch ( Exception e ) { logger . error ( "ERROR ## list query channel by pipelineIds:" + pipelineIds . toString ( ) + " has an exception!" ) ; throw new ManagerException ( e ) ; } return channels ; |
public class SqlFilterManagerImpl { /** * { @ inheritDoc }
* @ see jp . co . future . uroborosql . filter . SqlFilter # doQuery ( jp . co . future . uroborosql . context . SqlContext , java . sql . PreparedStatement , java . sql . ResultSet ) */
@ Override public ResultSet doQuery ( final SqlContext sqlContext , final PreparedStatement preparedStatement , final ResultSet resultSet ) throws SQLException { } } | if ( getFilters ( ) . isEmpty ( ) ) { return resultSet ; } ResultSet rs = resultSet ; for ( final SqlFilter filter : getFilters ( ) ) { rs = filter . doQuery ( sqlContext , preparedStatement , rs ) ; } return rs ; |
public class DatabaseHashMap { /** * loadOneValue
* For multirow db , attempts to get the requested attr from the db
* Returns null if attr doesn ' t exist or we ' re not running multirow
* After PM90293 , we consider populatedAppData as well
* populatedAppData is true when session is new or when the entire session is read into memory
* in those cases , we don ' t want to go to the backend to retrieve the attribute */
protected Object loadOneValue ( String attrName , BackedSession sess ) { } } | Object value = null ; if ( _smc . isUsingMultirow ( ) && ! ( ( DatabaseSession ) sess ) . getPopulatedAppData ( ) ) { // PM90293
value = getValue ( attrName , sess ) ; } return value ; |
public class ContainerTx { /** * d111555 */
private final void initialize_beanO_vectors ( ) // d173022.2
{ } } | // ensure allocation not just done in another thread via an enlist call
if ( ivBeanOsEnlistedInTx == false ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) Tr . event ( tc , "Lazy beanOs vector creation" ) ; // ArrayLists and HashMaps are created with the java default values
// for performance - avoids 1 method call each . d532639.2
beanOs = new HashMap < BeanId , BeanO > ( 16 ) ; beanOList = new ArrayList < BeanO > ( 10 ) ; afterList = new ArrayList < BeanO > ( 10 ) ; // 115597
homesForPMManagedBeans = new HashMap < EJSHome , ArrayList < BeanO > > ( 16 ) ; // d140003.22
ivBeanOsEnlistedInTx = true ; // never set to false once set to true
} // if beanOs = = null
// d111555 end |
public class RecastRegion { /** * / @ see rcCompactHeightfield , rcBuildRegions , rcBuildRegionsMonotone */
public static void buildDistanceField ( Context ctx , CompactHeightfield chf ) { } } | ctx . startTimer ( "BUILD_DISTANCEFIELD" ) ; int [ ] src = new int [ chf . spanCount ] ; ctx . startTimer ( "DISTANCEFIELD_DIST" ) ; int maxDist = calculateDistanceField ( chf , src ) ; chf . maxDistance = maxDist ; ctx . stopTimer ( "DISTANCEFIELD_DIST" ) ; ctx . startTimer ( "DISTANCEFIELD_BLUR" ) ; // Blur
src = boxBlur ( chf , 1 , src ) ; // Store distance .
chf . dist = src ; ctx . stopTimer ( "DISTANCEFIELD_BLUR" ) ; ctx . stopTimer ( "BUILD_DISTANCEFIELD" ) ; |
public class Elements2 { /** * Given an executable element in a supertype , returns its ExecutableType when it is viewed as a
* member of a subtype . */
static ExecutableType getExecutableElementAsMemberOf ( Types types , ExecutableElement executableElement , TypeElement subTypeElement ) { } } | checkNotNull ( types ) ; checkNotNull ( executableElement ) ; checkNotNull ( subTypeElement ) ; TypeMirror subTypeMirror = subTypeElement . asType ( ) ; if ( ! subTypeMirror . getKind ( ) . equals ( TypeKind . DECLARED ) ) { throw new IllegalStateException ( "Expected subTypeElement.asType() to return a class/interface type." ) ; } TypeMirror subExecutableTypeMirror = types . asMemberOf ( ( DeclaredType ) subTypeMirror , executableElement ) ; if ( ! subExecutableTypeMirror . getKind ( ) . equals ( TypeKind . EXECUTABLE ) ) { throw new IllegalStateException ( "Expected subExecutableTypeMirror to be an executable type." ) ; } return ( ExecutableType ) subExecutableTypeMirror ; |
public class IslamicCalendar { /** * Override Calendar to compute several fields specific to the Islamic
* calendar system . These are :
* < ul > < li > ERA
* < li > YEAR
* < li > MONTH
* < li > DAY _ OF _ MONTH
* < li > DAY _ OF _ YEAR
* < li > EXTENDED _ YEAR < / ul >
* The DAY _ OF _ WEEK and DOW _ LOCAL fields are already set when this
* method is called . The getGregorianXxx ( ) methods return Gregorian
* calendar equivalents for the given Julian day . */
@ Override protected void handleComputeFields ( int julianDay ) { } } | int year = 0 , month = 0 , dayOfMonth = 0 , dayOfYear = 0 ; long monthStart ; long days = julianDay - CIVIL_EPOC ; if ( cType == CalculationType . ISLAMIC_CIVIL || cType == CalculationType . ISLAMIC_TBLA ) { if ( cType == CalculationType . ISLAMIC_TBLA ) { days = julianDay - ASTRONOMICAL_EPOC ; } // Use the civil calendar approximation , which is just arithmetic
year = ( int ) Math . floor ( ( 30 * days + 10646 ) / 10631.0 ) ; month = ( int ) Math . ceil ( ( days - 29 - yearStart ( year ) ) / 29.5 ) ; month = Math . min ( month , 11 ) ; } else if ( cType == CalculationType . ISLAMIC ) { // Guess at the number of elapsed full months since the epoch
int months = ( int ) Math . floor ( days / CalendarAstronomer . SYNODIC_MONTH ) ; monthStart = ( long ) Math . floor ( months * CalendarAstronomer . SYNODIC_MONTH - 1 ) ; if ( days - monthStart >= 25 && moonAge ( internalGetTimeInMillis ( ) ) > 0 ) { // If we ' re near the end of the month , assume next month and search backwards
months ++ ; } // Find out the last time that the new moon was actually visible at this longitude
// This returns midnight the night that the moon was visible at sunset .
while ( ( monthStart = trueMonthStart ( months ) ) > days ) { // If it was after the date in question , back up a month and try again
months -- ; } year = months / 12 + 1 ; month = months % 12 ; } else if ( cType == CalculationType . ISLAMIC_UMALQURA ) { long umalquraStartdays = yearStart ( UMALQURA_YEAR_START ) ; if ( days < umalquraStartdays ) { // Use Civil calculation
year = ( int ) Math . floor ( ( 30 * days + 10646 ) / 10631.0 ) ; month = ( int ) Math . ceil ( ( days - 29 - yearStart ( year ) ) / 29.5 ) ; month = Math . min ( month , 11 ) ; } else { int y = UMALQURA_YEAR_START - 1 , m = 0 ; long d = 1 ; while ( d > 0 ) { y ++ ; d = days - yearStart ( y ) + 1 ; if ( d == handleGetYearLength ( y ) ) { m = 11 ; break ; } else if ( d < handleGetYearLength ( y ) ) { int monthLen = handleGetMonthLength ( y , m ) ; m = 0 ; while ( d > monthLen ) { d -= monthLen ; m ++ ; monthLen = handleGetMonthLength ( y , m ) ; } break ; } } year = y ; month = m ; } } dayOfMonth = ( int ) ( days - monthStart ( year , month ) ) + 1 ; // Now figure out the day of the year .
dayOfYear = ( int ) ( days - monthStart ( year , 0 ) + 1 ) ; internalSet ( ERA , 0 ) ; internalSet ( YEAR , year ) ; internalSet ( EXTENDED_YEAR , year ) ; internalSet ( MONTH , month ) ; internalSet ( DAY_OF_MONTH , dayOfMonth ) ; internalSet ( DAY_OF_YEAR , dayOfYear ) ; |
public class HOSECodeGenerator { /** * Gets the element rank for a given element symbol as given in Bremser ' s
* publication .
* @ param symbol The element symbol for which the rank is to be determined
* @ return The element rank */
private double getElementRank ( String symbol ) { } } | for ( int f = 0 ; f < rankedSymbols . length ; f ++ ) { if ( rankedSymbols [ f ] . equals ( symbol ) ) { return symbolRankings [ f ] ; } } IIsotope isotope = isotopeFac . getMajorIsotope ( symbol ) ; if ( isotope . getMassNumber ( ) != null ) { return ( ( double ) 800000 - isotope . getMassNumber ( ) ) ; } return 800000 ; |
public class JMessageClient { /** * Set user ' s group message blocking
* @ param payload GroupShieldPayload
* @ param username Necessary
* @ return No content
* @ throws APIConnectionException connect exception
* @ throws APIRequestException request exception */
public ResponseWrapper setGroupShield ( GroupShieldPayload payload , String username ) throws APIConnectionException , APIRequestException { } } | return _userClient . setGroupShield ( payload , username ) ; |
public class CareWebShellEx { /** * Registers the plugin with the specified id and path . If a tree path is absent , the plugin is
* associated with the tab itself .
* @ param path Format is & lt ; tab name & gt ; \ & lt ; tree node path & gt ;
* @ param id Unique id of plugin
* @ param propertySource Optional source for retrieving property values .
* @ return Container created for the plugin .
* @ throws Exception Unspecified exception . */
public ElementBase registerFromId ( String path , String id , IPropertyProvider propertySource ) throws Exception { } } | return register ( path , pluginById ( id ) , propertySource ) ; |
public class IndexSummaryManager { /** * for testing only */
@ VisibleForTesting Long getTimeToNextResize ( TimeUnit timeUnit ) { } } | if ( future == null ) return null ; return future . getDelay ( timeUnit ) ; |
public class WorkspaceBasedKey { /** * { @ inheritDoc } */
public void readExternal ( ObjectInput in ) throws IOException , ClassNotFoundException { } } | super . readExternal ( in ) ; byte [ ] data = new byte [ in . readInt ( ) ] ; in . readFully ( data ) ; workspaceUniqueName = new String ( data , Constants . DEFAULT_ENCODING ) ; |
public class ServerSocketChannelAcceptor { /** * Unbind our listening sockets . */
public void shutdown ( ) { } } | for ( ServerSocketChannel ssocket : _ssockets ) { try { ssocket . socket ( ) . close ( ) ; } catch ( IOException ioe ) { log . warning ( "Failed to close listening socket: " + ssocket , ioe ) ; } } |
public class CompilerUtil { /** * Formats the specified setter method and parameters into a string for display .
* For example : < code > setXXX ( arg1 , ar2 ) < / code >
* @ param setterMethodName
* the method name
* @ param args
* the method arguments
* @ return the formatted string */
private static String formatForDisplay ( String setterMethodName , List < Object > args ) { } } | StringBuilder sb = new StringBuilder ( CompilerOptions . class . getName ( ) ) ; sb . append ( "." ) . append ( setterMethodName ) . append ( "(" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
Joiner . on ( "," ) . appendTo ( sb , args ) . append ( ")" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
return sb . toString ( ) ; |
public class RestAPIDocGenerator { /** * Generates the REST API documentation .
* @ param args args [ 0 ] contains the directory into which the generated files are placed
* @ throws IOException if any file operation failed */
public static void main ( String [ ] args ) throws IOException { } } | String outputDirectory = args [ 0 ] ; for ( final RestAPIVersion apiVersion : RestAPIVersion . values ( ) ) { if ( apiVersion == RestAPIVersion . V0 ) { // this version exists only for testing purposes
continue ; } createHtmlFile ( new DocumentingDispatcherRestEndpoint ( ) , apiVersion , Paths . get ( outputDirectory , "rest_" + apiVersion . getURLVersionPrefix ( ) + "_dispatcher.html" ) ) ; } |
public class CmsAliasTableController { /** * Copies a list of rows . < p >
* @ param data the original data
* @ return the copied data */
List < CmsAliasTableRow > copyData ( List < CmsAliasTableRow > data ) { } } | List < CmsAliasTableRow > result = new ArrayList < CmsAliasTableRow > ( ) ; for ( CmsAliasTableRow row : data ) { CmsAliasTableRow copiedRow = row . copy ( ) ; result . add ( copiedRow ) ; } return result ; |
public class DeleteTagsForDomainRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteTagsForDomainRequest deleteTagsForDomainRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteTagsForDomainRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteTagsForDomainRequest . getDomainName ( ) , DOMAINNAME_BINDING ) ; protocolMarshaller . marshall ( deleteTagsForDomainRequest . getTagsToDelete ( ) , TAGSTODELETE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MP4Reader { /** * Create tag for metadata event .
* Information mostly from http : / / www . kaourantin . net / 2007/08 / what - just - happened - to - video - on - web _ 20 . html
* < pre >
* width : Display width in pixels .
* height : Display height in pixels .
* duration : Duration in seconds . But unlike for FLV files this field will always be present .
* videocodecid : Usually a string such as " avc1 " or " VP6F " , for H . 264 we report ' avc1 ' .
* audiocodecid : Usually a string such as " . mp3 " or " mp4a " , for AAC we report ' mp4a ' and MP3 we report ' . mp3 ' .
* avcprofile : AVC profile number , values of 66 , 77 , 88 , 100 , 110 , 122 or 144 ; which correspond to the H . 264 profiles .
* avclevel : AVC IDC level number , values between 10 and 51.
* aottype : Either 0 , 1 or 2 . This corresponds to AAC Main , AAC LC and SBR audio types .
* moovposition : The offset in bytes of the moov atom in a file .
* trackinfo : An array of objects containing various infomation about all the tracks in a file
* ex .
* trackinfo [ 0 ] . length : 7081
* trackinfo [ 0 ] . timescale : 600
* trackinfo [ 0 ] . sampledescription . sampletype : avc1
* trackinfo [ 0 ] . language : und
* trackinfo [ 1 ] . length : 525312
* trackinfo [ 1 ] . timescale : 44100
* trackinfo [ 1 ] . sampledescription . sampletype : mp4a
* trackinfo [ 1 ] . language : und
* chapters : As mentioned above information about chapters in audiobooks .
* seekpoints : Array that lists the available keyframes in a file as time stamps in milliseconds .
* This is optional as the MP4 file might not contain this information . Generally speaking ,
* most MP4 files will include this by default . You can directly feed the values into NetStream . seek ( ) ;
* videoframerate : The frame rate of the video if a monotone frame rate is used .
* Most videos will have a monotone frame rate .
* audiosamplerate : The original sampling rate of the audio track .
* audiochannels : The original number of channels of the audio track .
* progressivedownloadinfo : Object that provides information from the " pdin " atom . This is optional
* and many files will not have this field .
* tags : Array of key value pairs representing the information present in the " ilst " atom , which is
* the equivalent of ID3 tags for MP4 files . These tags are mostly used by iTunes .
* < / pre >
* @ return Metadata event tag */
ITag createFileMeta ( ) { } } | log . debug ( "Creating onMetaData" ) ; // Create tag for onMetaData event
IoBuffer buf = IoBuffer . allocate ( 1024 ) ; buf . setAutoExpand ( true ) ; Output out = new Output ( buf ) ; out . writeString ( "onMetaData" ) ; Map < Object , Object > props = new HashMap < Object , Object > ( ) ; // Duration property
props . put ( "duration" , ( ( double ) duration / ( double ) timeScale ) ) ; props . put ( "width" , width ) ; props . put ( "height" , height ) ; // Video codec id
props . put ( "videocodecid" , videoCodecId ) ; props . put ( "avcprofile" , avcProfile ) ; props . put ( "avclevel" , avcLevel ) ; props . put ( "videoframerate" , fps ) ; // Audio codec id - watch for mp3 instead of aac
props . put ( "audiocodecid" , audioCodecId ) ; props . put ( "aacaot" , audioCodecType ) ; props . put ( "audiosamplerate" , audioTimeScale ) ; props . put ( "audiochannels" , audioChannels ) ; // position of the moov atom
// props . put ( " moovposition " , moovOffset ) ;
// props . put ( " chapters " , " " ) ; / / this is for f4b - books
if ( seekPoints != null ) { log . debug ( "Seekpoint list size: {}" , seekPoints . size ( ) ) ; props . put ( "seekpoints" , seekPoints ) ; } // tags will only appear if there is an " ilst " atom in the file
// props . put ( " tags " , " " ) ;
List < Map < String , Object > > arr = new ArrayList < Map < String , Object > > ( 2 ) ; if ( hasAudio ) { Map < String , Object > audioMap = new HashMap < String , Object > ( 4 ) ; audioMap . put ( "timescale" , audioTimeScale ) ; audioMap . put ( "language" , "und" ) ; List < Map < String , String > > desc = new ArrayList < Map < String , String > > ( 1 ) ; audioMap . put ( "sampledescription" , desc ) ; Map < String , String > sampleMap = new HashMap < String , String > ( 1 ) ; sampleMap . put ( "sampletype" , audioCodecId ) ; desc . add ( sampleMap ) ; if ( audioSamples != null ) { if ( audioSampleDuration > 0 ) { audioMap . put ( "length_property" , audioSampleDuration * audioSamples . length ) ; } // release some memory
audioSamples = null ; } arr . add ( audioMap ) ; } if ( hasVideo ) { Map < String , Object > videoMap = new HashMap < String , Object > ( 3 ) ; videoMap . put ( "timescale" , videoTimeScale ) ; videoMap . put ( "language" , "und" ) ; List < Map < String , String > > desc = new ArrayList < Map < String , String > > ( 1 ) ; videoMap . put ( "sampledescription" , desc ) ; Map < String , String > sampleMap = new HashMap < String , String > ( 1 ) ; sampleMap . put ( "sampletype" , videoCodecId ) ; desc . add ( sampleMap ) ; if ( videoSamples != null ) { if ( videoSampleDuration > 0 ) { videoMap . put ( "length_property" , videoSampleDuration * videoSamples . length ) ; } // release some memory
videoSamples = null ; } arr . add ( videoMap ) ; } props . put ( "trackinfo" , arr ) ; // set this based on existence of seekpoints
props . put ( "canSeekToEnd" , ( seekPoints != null ) ) ; out . writeMap ( props ) ; buf . flip ( ) ; // now that all the meta properties are done , update the duration
duration = Math . round ( duration * 1000d ) ; ITag result = new Tag ( IoConstants . TYPE_METADATA , 0 , buf . limit ( ) , null , 0 ) ; result . setBody ( buf ) ; return result ; |
public class JQLBuilder { /** * Builds the JQL .
* @ param method
* the method
* @ param preparedJql
* the prepared jql
* @ return the jql */
public static JQL buildJQL ( final SQLiteModelMethod method , String preparedJql ) { } } | Map < JQLDynamicStatementType , String > dynamicReplace = new HashMap < > ( ) ; final JQL result = new JQL ( ) ; // for each method ' s parameter
forEachParameter ( method , new OnMethodParameterListener ( ) { @ Override public void onMethodParameter ( VariableElement item ) { if ( method . getEntity ( ) . getElement ( ) . asType ( ) . equals ( item . asType ( ) ) ) { result . paramBean = item . getSimpleName ( ) . toString ( ) ; } } } ) ; // defined how jql is defined
result . declarationType = JQLDeclarationType . JQL_COMPACT ; if ( StringUtils . hasText ( preparedJql ) ) { result . declarationType = JQLDeclarationType . JQL_EXPLICIT ; } if ( method . hasAnnotation ( BindSqlSelect . class ) ) { checkFieldsDefinitions ( method , BindSqlSelect . class ) ; return buildJQLSelect ( method , result , dynamicReplace , preparedJql ) ; } else if ( method . hasAnnotation ( BindSqlInsert . class ) ) { checkFieldsDefinitions ( method , BindSqlInsert . class ) ; return buildJQLInsert ( method , result , preparedJql ) ; } else if ( method . hasAnnotation ( BindSqlUpdate . class ) ) { checkFieldsDefinitions ( method , BindSqlUpdate . class ) ; return buildJQLUpdate ( method , result , dynamicReplace , preparedJql ) ; } else if ( method . hasAnnotation ( BindSqlDelete . class ) ) { return buildJQLDelete ( method , result , dynamicReplace , preparedJql ) ; } return null ; |
public class Router { public void removeTarget ( T target ) { } } | for ( MethodlessRouter < T > r : routers . values ( ) ) r . removeTarget ( target ) ; anyMethodRouter . removeTarget ( target ) ; |
public class ExpressionUtils { /** * Turns expressions of the form ConstantExpression ( 40 ) + ConstantExpression ( 2)
* into the simplified ConstantExpression ( 42 ) at compile time .
* @ param be the binary expression
* @ param targetType the type of the result
* @ return the transformed expression or the original if no transformation was performed */
public static ConstantExpression transformBinaryConstantExpression ( BinaryExpression be , ClassNode targetType ) { } } | ClassNode wrapperType = ClassHelper . getWrapper ( targetType ) ; if ( isTypeOrArrayOfType ( targetType , ClassHelper . STRING_TYPE , false ) ) { if ( be . getOperation ( ) . getType ( ) == PLUS ) { Expression left = transformInlineConstants ( be . getLeftExpression ( ) , targetType ) ; Expression right = transformInlineConstants ( be . getRightExpression ( ) , targetType ) ; if ( left instanceof ConstantExpression && right instanceof ConstantExpression ) { return configure ( be , new ConstantExpression ( ( String ) ( ( ConstantExpression ) left ) . getValue ( ) + ( ( ConstantExpression ) right ) . getValue ( ) ) ) ; } } } else if ( isNumberOrArrayOfNumber ( wrapperType , false ) ) { int type = be . getOperation ( ) . getType ( ) ; if ( handledTypes . contains ( type ) ) { Expression leftX = transformInlineConstants ( be . getLeftExpression ( ) , targetType ) ; Expression rightX = transformInlineConstants ( be . getRightExpression ( ) , targetType ) ; if ( leftX instanceof ConstantExpression && rightX instanceof ConstantExpression ) { Number left = safeNumber ( ( ConstantExpression ) leftX ) ; Number right = safeNumber ( ( ConstantExpression ) rightX ) ; if ( left == null || right == null ) return null ; Number result = null ; switch ( type ) { case PLUS : result = NumberMath . add ( left , right ) ; break ; case MINUS : result = NumberMath . subtract ( left , right ) ; break ; case MULTIPLY : result = NumberMath . multiply ( left , right ) ; break ; case DIVIDE : result = NumberMath . divide ( left , right ) ; break ; case LEFT_SHIFT : result = NumberMath . leftShift ( left , right ) ; break ; case RIGHT_SHIFT : result = NumberMath . rightShift ( left , right ) ; break ; case RIGHT_SHIFT_UNSIGNED : result = NumberMath . rightShiftUnsigned ( left , right ) ; break ; case BITWISE_AND : result = NumberMath . and ( left , right ) ; break ; case BITWISE_OR : result = NumberMath . or ( left , right ) ; break ; case BITWISE_XOR : result = NumberMath . xor ( left , right ) ; break ; case POWER : result = DefaultGroovyMethods . power ( left , right ) ; break ; } if ( result != null ) { if ( ClassHelper . Byte_TYPE . equals ( wrapperType ) ) { return configure ( be , new ConstantExpression ( result . byteValue ( ) , true ) ) ; } if ( ClassHelper . Short_TYPE . equals ( wrapperType ) ) { return configure ( be , new ConstantExpression ( result . shortValue ( ) , true ) ) ; } if ( ClassHelper . Long_TYPE . equals ( wrapperType ) ) { return configure ( be , new ConstantExpression ( result . longValue ( ) , true ) ) ; } if ( ClassHelper . Integer_TYPE . equals ( wrapperType ) || ClassHelper . Character_TYPE . equals ( wrapperType ) ) { return configure ( be , new ConstantExpression ( result . intValue ( ) , true ) ) ; } if ( ClassHelper . Float_TYPE . equals ( wrapperType ) ) { return configure ( be , new ConstantExpression ( result . floatValue ( ) , true ) ) ; } if ( ClassHelper . Double_TYPE . equals ( wrapperType ) ) { return configure ( be , new ConstantExpression ( result . doubleValue ( ) , true ) ) ; } return configure ( be , new ConstantExpression ( result , true ) ) ; } } } } return null ; |
public class AbstractMappableValidator { /** * Disposes all rules and result handlers that are mapped to each other . */
private void disposeRulesAndResultHandlers ( ) { } } | for ( final Map . Entry < R , List < RH > > entry : rulesToResultHandlers . entrySet ( ) ) { // Dispose rule
final R rule = entry . getKey ( ) ; if ( rule instanceof Disposable ) { ( ( Disposable ) rule ) . dispose ( ) ; } // Dispose result handlers
final List < RH > resultHandlers = entry . getValue ( ) ; if ( resultHandlers != null ) { for ( final RH resultHandler : resultHandlers ) { if ( resultHandler instanceof Disposable ) { ( ( Disposable ) resultHandler ) . dispose ( ) ; } } } } // Clears all triggers
rulesToResultHandlers . clear ( ) ; |
public class SerializeInterceptor { /** * Method to get the file content of the upload file based on the mime type
* @ param requestElements the request elements
* @ return byte [ ] the upload file content
* @ throws FMSException */
private byte [ ] getUploadFileContent ( RequestElements requestElements ) throws FMSException { } } | Attachable attachable = ( Attachable ) requestElements . getEntity ( ) ; InputStream docContent = requestElements . getUploadRequestElements ( ) . getDocContent ( ) ; // gets the mime value form the filename
String mime = getMime ( attachable . getFileName ( ) , "." ) ; // if null then gets the mime value from content - type of the file
mime = ( mime != null ) ? mime : getMime ( attachable . getContentType ( ) , "/" ) ; if ( isImageType ( mime ) ) { return getImageContent ( docContent , mime ) ; } else { return getContent ( docContent ) ; } |
public class OptionsImpl { /** * Loads the Options properties from the aggregator properties file
* into the specified properties object . If the properties file
* does not exist , then try to load from the bundle .
* @ param props
* The properties object to load . May be initialized with default
* values .
* @ return The properties file specified by { @ code props } . */
protected Properties loadProps ( Properties props ) { } } | // try to load the properties file first from the user ' s home directory
File file = getPropsFile ( ) ; if ( file != null ) { // Try to load the file from the user ' s home directory
if ( file . exists ( ) ) { try { URL url = file . toURI ( ) . toURL ( ) ; loadFromUrl ( props , url ) ; } catch ( MalformedURLException ex ) { if ( log . isLoggable ( Level . WARNING ) ) { log . log ( Level . WARNING , ex . getMessage ( ) , ex ) ; } } } } return props ; |
public class GetUserDefinedFunctionsResult { /** * A list of requested function definitions .
* @ param userDefinedFunctions
* A list of requested function definitions . */
public void setUserDefinedFunctions ( java . util . Collection < UserDefinedFunction > userDefinedFunctions ) { } } | if ( userDefinedFunctions == null ) { this . userDefinedFunctions = null ; return ; } this . userDefinedFunctions = new java . util . ArrayList < UserDefinedFunction > ( userDefinedFunctions ) ; |
public class DoubleLaunchChecker { /** * Ignore the problem and go back to using Hudson . */
@ RequirePOST public void doIgnore ( StaplerRequest req , StaplerResponse rsp ) throws IOException { } } | ignore = true ; Jenkins . getInstance ( ) . servletContext . setAttribute ( "app" , Jenkins . getInstance ( ) ) ; rsp . sendRedirect2 ( req . getContextPath ( ) + '/' ) ; |
public class Character { /** * Returns the number of Unicode code points in a subarray of the
* { @ code char } array argument . The { @ code offset }
* argument is the index of the first { @ code char } of the
* subarray and the { @ code count } argument specifies the
* length of the subarray in { @ code char } s . Unpaired
* surrogates within the subarray count as one code point each .
* @ param a the { @ code char } array
* @ param offset the index of the first { @ code char } in the
* given { @ code char } array
* @ param count the length of the subarray in { @ code char } s
* @ return the number of Unicode code points in the specified subarray
* @ exception NullPointerException if { @ code a } is null .
* @ exception IndexOutOfBoundsException if { @ code offset } or
* { @ code count } is negative , or if { @ code offset +
* count } is larger than the length of the given array .
* @ since 1.5 */
public static int codePointCount ( char [ ] a , int offset , int count ) { } } | if ( count > a . length - offset || offset < 0 || count < 0 ) { throw new IndexOutOfBoundsException ( ) ; } return codePointCountImpl ( a , offset , count ) ; |
public class MsgPackVisualizer { @ Override void readArrayItem ( ) throws IOException { } } | indent = indent + "- " ; super . readArrayItem ( ) ; indent = indent . substring ( 0 , indent . length ( ) - 2 ) ; |
public class SRTServletResponse { /** * Get the Cookies that have been set in this response . */
public Cookie [ ] getCookies ( ) { } } | if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { // 306998.15
logger . logp ( Level . FINE , CLASS_NAME , "getCookies" , "[" + this + "]" ) ; } return ( _response . getCookies ( ) ) ; |
public class CmsJspStandardContextBean { /** * Initializes the mapping configuration . < p > */
private void initMetaMappings ( ) { } } | if ( m_metaMappings == null ) { m_metaMappings = new HashMap < String , MetaMapping > ( ) ; try { initPage ( ) ; CmsMacroResolver resolver = new CmsMacroResolver ( ) ; resolver . setKeepEmptyMacros ( true ) ; resolver . setCmsObject ( m_cms ) ; resolver . setMessages ( OpenCms . getWorkplaceManager ( ) . getMessages ( getLocale ( ) ) ) ; CmsResourceFilter filter = getIsEditMode ( ) ? CmsResourceFilter . IGNORE_EXPIRATION : CmsResourceFilter . DEFAULT ; for ( CmsContainerBean container : m_page . getContainers ( ) . values ( ) ) { for ( CmsContainerElementBean element : container . getElements ( ) ) { String settingsKey = CmsFormatterConfig . getSettingsKeyForContainer ( container . getName ( ) ) ; String formatterConfigId = element . getSettings ( ) != null ? element . getSettings ( ) . get ( settingsKey ) : null ; I_CmsFormatterBean formatterBean = null ; if ( CmsUUID . isValidUUID ( formatterConfigId ) ) { formatterBean = OpenCms . getADEManager ( ) . getCachedFormatters ( m_cms . getRequestContext ( ) . getCurrentProject ( ) . isOnlineProject ( ) ) . getFormatters ( ) . get ( new CmsUUID ( formatterConfigId ) ) ; } if ( ( formatterBean != null ) && formatterBean . useMetaMappingsForNormalElements ( ) && m_cms . existsResource ( element . getId ( ) , filter ) ) { addMappingsForFormatter ( formatterBean , element . getId ( ) , resolver , false ) ; } } } if ( getDetailContentId ( ) != null ) { try { CmsResource detailContent = m_cms . readResource ( getDetailContentId ( ) , CmsResourceFilter . ignoreExpirationOffline ( m_cms ) ) ; CmsFormatterConfiguration config = OpenCms . getADEManager ( ) . lookupConfiguration ( m_cms , m_cms . getRequestContext ( ) . getRootUri ( ) ) . getFormatters ( m_cms , detailContent ) ; for ( I_CmsFormatterBean formatter : config . getDetailFormatters ( ) ) { addMappingsForFormatter ( formatter , getDetailContentId ( ) , resolver , true ) ; } } catch ( CmsException e ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . ERR_READING_REQUIRED_RESOURCE_1 , getDetailContentId ( ) ) , e ) ; } } } catch ( Exception e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } } |
public class AmazonSNSClient { /** * Sets the attributes for an endpoint for a device on one of the supported push notification services , such as GCM
* and APNS . For more information , see < a href = " https : / / docs . aws . amazon . com / sns / latest / dg / SNSMobilePush . html " > Using
* Amazon SNS Mobile Push Notifications < / a > .
* @ param setEndpointAttributesRequest
* Input for SetEndpointAttributes action .
* @ return Result of the SetEndpointAttributes operation returned by the service .
* @ throws InvalidParameterException
* Indicates that a request parameter does not comply with the associated constraints .
* @ throws InternalErrorException
* Indicates an internal service error .
* @ throws AuthorizationErrorException
* Indicates that the user has been denied access to the requested resource .
* @ throws NotFoundException
* Indicates that the requested resource does not exist .
* @ sample AmazonSNS . SetEndpointAttributes
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / sns - 2010-03-31 / SetEndpointAttributes " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public SetEndpointAttributesResult setEndpointAttributes ( SetEndpointAttributesRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeSetEndpointAttributes ( request ) ; |
public class IdpMetadataGenerator { /** * Provides set discovery request url or generates a default when none was provided . Primarily value set on
* extenedMetadata property idpDiscoveryURL is used , when empty local property customDiscoveryURL is used , when
* empty URL is automatically generated .
* @ param entityBaseURL
* base URL for generation of endpoints
* @ param entityAlias
* alias of entity , or null when there ' s no alias required
* @ return URL to use for IDP discovery request */
protected String getDiscoveryURL ( String entityBaseURL , String entityAlias ) { } } | if ( extendedMetadata != null && extendedMetadata . getIdpDiscoveryURL ( ) != null && extendedMetadata . getIdpDiscoveryURL ( ) . length ( ) > 0 ) { return extendedMetadata . getIdpDiscoveryURL ( ) ; } else { return getServerURL ( entityBaseURL , entityAlias , getSAMLDiscoveryPath ( ) ) ; } |
public class FileSystemResourceReader { /** * ( non - Javadoc )
* @ see
* net . jawr . web . resource . handler . reader . ResourceBrowser # getFilePath ( java .
* lang . String ) */
@ Override public String getFilePath ( String resourcePath ) { } } | String path = resourcePath . replace ( '/' , File . separatorChar ) ; return new File ( baseDir , path ) . getAbsolutePath ( ) ; |
public class TransmittableChannelMessage { /** * Combine the CommandByte and the serialized message packet together to form a Firmata supported
* byte packet to be sent over the SerialPort . To form the CommandByte for a ChannelMessage , we need to
* pad the command with the channel we want to handle the command ( or in our case , the pin / port )
* @ return byte [ ] array representing the full Firmata command packet to be sent to the Firmata device . */
@ Override public byte [ ] toByteArray ( ) { } } | ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( 32 ) ; outputStream . write ( ( byte ) ( commandByte + ( channelByte & 0x0F ) ) ) ; if ( serialize ( outputStream ) ) { return outputStream . toByteArray ( ) ; } return null ; |
public class ContainerBase { /** * { @ inheritDoc }
* @ see org . jboss . shrinkwrap . api . Archive # merge ( org . jboss . shrinkwrap . api . Archive ) */
@ Override public T merge ( Archive < ? > source ) throws IllegalArgumentException { } } | this . getArchive ( ) . merge ( source ) ; return covarientReturn ( ) ; |
public class Async { /** * Removes messages from queue .
* @ param queueName queue name
* @ param filter filter selector as in JMS specification .
* See : < a href = " http : / / docs . oracle . com / cd / E19798-01/821-1841 / bncer / index . html " > JMS Message Selectors < / a >
* @ return number of messages removed */
public int removeMessages ( String queueName , String filter ) { } } | try { return getQueueControl ( queueName ) . removeMessages ( filter ) ; } catch ( Exception e ) { throw new AsyncException ( e ) ; } |
public class OnlineLDAsvi { /** * The " forgetfulness " factor in the learning rate . Larger values increase
* the rate at which old information is " forgotten "
* @ param kappa the forgetfulness factor in [ 0.5 , 1] */
public void setKappa ( double kappa ) { } } | if ( kappa < 0.5 || kappa > 1.0 || Double . isNaN ( kappa ) ) throw new IllegalArgumentException ( "Kapp must be in [0.5, 1], not " + kappa ) ; this . kappa = kappa ; |
public class CharNormalizer { /** * Character Normalization ( and exclusion ) .
* @ return Normalized character , the space to exclude the character . */
public static char normalize ( char ch ) { } } | // this is even cheaper than the hashmap lookup . because it covers most use cases , it ' s worth the check .
if ( ch <= 127 ) { // ascii ( basic latin )
if ( ch < 'A' || ( ch < 'a' && ch > 'Z' ) || ch > 'z' ) { return ' ' ; } else { return ch ; } } Character result = NORMALIZE_MAP . get ( ch ) ; return result == null ? ch : result ; |
public class ResourcesInner { /** * Deletes a resource by ID .
* @ param resourceId The fully qualified ID of the resource , including the resource name and resource type . Use the format , / subscriptions / { guid } / resourceGroups / { resource - group - name } / { resource - provider - namespace } / { resource - type } / { resource - name }
* @ param apiVersion The API version to use for the operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponse } object if successful . */
public Observable < ServiceResponse < Void > > beginDeleteByIdWithServiceResponseAsync ( String resourceId , String apiVersion ) { } } | if ( resourceId == null ) { throw new IllegalArgumentException ( "Parameter resourceId is required and cannot be null." ) ; } if ( apiVersion == null ) { throw new IllegalArgumentException ( "Parameter apiVersion is required and cannot be null." ) ; } return service . beginDeleteById ( resourceId , apiVersion , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Void > > > ( ) { @ Override public Observable < ServiceResponse < Void > > call ( Response < ResponseBody > response ) { try { ServiceResponse < Void > clientResponse = beginDeleteByIdDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class WhitelistUrlFilter { /** * Initialize " allowUrls " parameter from web . xml .
* @ param filterConfig A filter configuration object used by a servlet container
* to pass information to a filter during initialization . */
public void init ( final FilterConfig filterConfig ) { } } | final String allowParam = filterConfig . getInitParameter ( "allowUrls" ) ; if ( StringUtils . isNotBlank ( allowParam ) ) { this . allowUrls = allowParam . split ( "," ) ; } |
public class Long2ObjectHashMap { /** * Compact the { @ link Map } backing arrays by rehashing with a capacity just larger than current size
* and giving consideration to the load factor . */
public void compact ( ) { } } | final int idealCapacity = ( int ) Math . round ( size ( ) * ( 1.0d / loadFactor ) ) ; rehash ( QuickMath . nextPowerOfTwo ( idealCapacity ) ) ; |
public class GraphSearch { /** * Configures the search
* @ param policy way to select arcs
* @ param enforce true if a decision is an arc enforcing
* false if a decision is an arc removal */
public GraphSearch configure ( int policy , boolean enforce ) { } } | if ( enforce ) { decisionType = GraphAssignment . graph_enforcer ; } else { decisionType = GraphAssignment . graph_remover ; } mode = policy ; return this ; |
public class Element { /** * Selects the frame represented by the element , but only if the element is
* present and displayed . If these conditions are not met , the move action
* will be logged , but skipped and the test will continue . */
public void selectFrame ( ) { } } | String cantSelect = "Unable to focus on frame " ; String action = "Focusing on frame " + prettyOutput ( ) ; String expected = "Frame " + prettyOutput ( ) + " is present, displayed, and focused" ; try { // wait for element to be present
if ( isNotPresent ( action , expected , cantSelect ) ) { return ; } // wait for element to be displayed
if ( isNotDisplayed ( action , expected , cantSelect ) ) { return ; } // select the actual frame
WebElement webElement = getWebElement ( ) ; driver . switchTo ( ) . frame ( webElement ) ; } catch ( Exception e ) { log . warn ( e ) ; reporter . fail ( action , expected , cantSelect + prettyOutputEnd ( ) + e . getMessage ( ) ) ; return ; } reporter . pass ( action , expected , "Focused on frame " + prettyOutputEnd ( ) . trim ( ) ) ; |
public class PermissionUtils { /** * < p > Takes a set of permissions and determines if all of them are granted . < / p >
* < p > Use { @ link Manifest . permission } to reference permission constants . < / p >
* @ param context
* the permissible { @ link Context }
* @ param permissions
* the set of { @ link permission } s to test
* @ return { @ code true } if all the permissions are granted
* @ since 1.1.0 */
public static boolean areAllGranted ( Object context , Set < String > permissions ) { } } | for ( String permission : permissions ) { if ( ContextUtils . discover ( context ) . checkCallingOrSelfPermission ( permission ) == PackageManager . PERMISSION_DENIED ) { return false ; } } return true ; |
public class StorageSnippets { /** * [ VARIABLE " my _ blob _ name2 " ] */
public List < Boolean > batchDelete ( String bucketName , String blobName1 , String blobName2 ) { } } | // [ START batchDelete ]
BlobId firstBlob = BlobId . of ( bucketName , blobName1 ) ; BlobId secondBlob = BlobId . of ( bucketName , blobName2 ) ; List < Boolean > deleted = storage . delete ( firstBlob , secondBlob ) ; // [ END batchDelete ]
return deleted ; |
public class SleepBuilder { /** * Timeout after with { @ code SleepBuilder . build ( ) } is awaked
* @ param timeout after with sleeper should awake
* @ param timeUnit of passed timeout
* @ return { @ code SleepBuilder } with comparer */
public SleepBuilder < T > withTimeout ( long timeout , TimeUnit timeUnit ) { } } | this . timeout = timeUnit . toMillis ( timeout ) ; return this ; |
public class EventJournalReadOperation { /** * { @ inheritDoc }
* On every invocation this method reads from the event journal until
* it has collected the minimum required number of response items .
* Returns { @ code true } if there are currently not enough
* elements in the response and the operation should be parked .
* @ return if the operation should wait on the wait / notify key */
@ Override public boolean shouldWait ( ) { } } | if ( resultSet == null ) { resultSet = createResultSet ( ) ; sequence = startSequence ; } final EventJournal < J > journal = getJournal ( ) ; final int partitionId = getPartitionId ( ) ; journal . cleanup ( namespace , partitionId ) ; sequence = clampToBounds ( journal , partitionId , sequence ) ; if ( minSize == 0 ) { if ( ! journal . isNextAvailableSequence ( namespace , partitionId , sequence ) ) { readMany ( journal , partitionId ) ; } return false ; } if ( resultSet . isMinSizeReached ( ) ) { // enough items have been read , we are done .
return false ; } if ( journal . isNextAvailableSequence ( namespace , partitionId , sequence ) ) { // the sequence is not readable
return true ; } readMany ( journal , partitionId ) ; return ! resultSet . isMinSizeReached ( ) ; |
public class DocBookBuildUtilities { /** * This function scans the supplied XML node and it ' s children for id attributes , collecting them in the usedIdAttributes
* parameter .
* @ param docBookVersion
* @ param topic The topic that we are collecting attribute ID ' s for .
* @ param node The current node being processed ( will be the document root to start with , and then all the children as this
* function is recursively called )
* @ param usedIdAttributes The set of Used ID Attributes that should be added to . */
public static void collectIdAttributes ( final DocBookVersion docBookVersion , final SpecTopic topic , final Node node , final Map < SpecTopic , Set < String > > usedIdAttributes ) { } } | final NamedNodeMap attributes = node . getAttributes ( ) ; if ( attributes != null ) { final Node idAttribute ; if ( docBookVersion == DocBookVersion . DOCBOOK_50 ) { idAttribute = attributes . getNamedItem ( "xml:id" ) ; } else { idAttribute = attributes . getNamedItem ( "id" ) ; } if ( idAttribute != null ) { final String idAttributeValue = idAttribute . getNodeValue ( ) ; if ( ! usedIdAttributes . containsKey ( topic ) ) { usedIdAttributes . put ( topic , new HashSet < String > ( ) ) ; } usedIdAttributes . get ( topic ) . add ( idAttributeValue ) ; } } final NodeList elements = node . getChildNodes ( ) ; for ( int i = 0 ; i < elements . getLength ( ) ; ++ i ) { collectIdAttributes ( docBookVersion , topic , elements . item ( i ) , usedIdAttributes ) ; } |
public class TableFormatter { /** * Print the table to the give PrintStream .
* @ param stream the print stream to write to */
public void print ( @ NonNull PrintStream stream ) { } } | String horizontalBar = StringUtils . repeat ( "─" , longestCell ) ; String hline = middleCMBar ( horizontalBar , longestRow ) ; longestRow = Math . max ( longestRow , header . size ( ) ) ; if ( ! StringUtils . isNullOrBlank ( title ) ) { stream . println ( StringUtils . center ( title , ( longestCell * longestRow ) + longestRow + 1 ) ) ; } stream . printf ( "┌%s" , horizontalBar ) ; for ( int i = 1 ; i < longestRow ; i ++ ) { stream . printf ( "┬%s" , horizontalBar ) ; } stream . println ( "┐" ) ; if ( header . size ( ) > 0 ) { printRow ( stream , header , longestCell , longestRow ) ; stream . println ( bar ( StringUtils . repeat ( "═" , longestCell ) , "╞" , "╡" , "╪" , header . size ( ) ) ) ; } for ( int r = 0 ; r < content . size ( ) ; r ++ ) { printRow ( stream , content . get ( r ) , longestCell , longestRow ) ; if ( r + 1 < content . size ( ) ) { stream . println ( hline ) ; } } if ( ! footer . isEmpty ( ) ) { stream . println ( bar ( StringUtils . repeat ( "═" , longestCell ) , "╞" , "╡" , "╪" , header . size ( ) ) ) ; for ( int r = 0 ; r < footer . size ( ) ; r ++ ) { printRow ( stream , footer . get ( r ) , longestCell , longestRow ) ; if ( r + 1 < footer . size ( ) ) { stream . println ( hline ) ; } } } stream . printf ( "└%s" , horizontalBar ) ; for ( int i = 1 ; i < longestRow ; i ++ ) { stream . printf ( "┴%s" , horizontalBar ) ; } stream . println ( "┘" ) ; |
public class AbstractInteraction { /** * Trigger .
* @ param listeners
* the listeners
* @ param type
* the type */
protected boolean trigger ( List < InteractionListener > listeners , Type type , Throwable e ) { } } | if ( listeners . isEmpty ( ) ) return false ; InteractionEvent event = createInteractionEvent ( type , e ) ; for ( InteractionListener listener : listeners ) { listener . onEvent ( event ) ; } if ( event instanceof AfterFailInteractionEvent ) return ( ( AfterFailInteractionEvent ) event ) . isRetry ( ) ; return false ; |
public class SpringConfigProcessor { /** * findRegistedModules .
* @ param registry a { @ link org . beangle . commons . inject . bind . BindRegistry } object .
* @ return a { @ link java . util . Map } object . */
protected Map < String , BeanDefinition > registerModules ( BindRegistry registry ) { } } | Stopwatch watch = new Stopwatch ( true ) ; List < String > modules = registry . getBeanNames ( BindModule . class ) ; Map < String , BeanDefinition > newBeanDefinitions = CollectUtils . newHashMap ( ) ; for ( String name : modules ) { Class < ? > beanClass = registry . getBeanType ( name ) ; BeanConfig config = null ; try { config = ( ( BindModule ) beanClass . newInstance ( ) ) . getConfig ( ) ; } catch ( Exception e ) { logger . error ( "class initialization error of " + beanClass , e ) ; continue ; } List < BeanConfig . Definition > definitions = config . getDefinitions ( ) ; for ( BeanConfig . Definition definition : definitions ) { String beanName = definition . beanName ; if ( registry . contains ( beanName ) ) { logger . warn ( "Ingore exists bean definition {}" , beanName ) ; } else { BeanDefinition def = registerBean ( definition , registry ) ; newBeanDefinitions . put ( beanName , def ) ; } } } logger . info ( "Auto register {} beans in {}" , newBeanDefinitions . size ( ) , watch ) ; return newBeanDefinitions ; |
public class SecureCredentialsManager { /** * Checks the result after showing the LockScreen to the user .
* Must be called from the { @ link Activity # onActivityResult ( int , int , Intent ) } method with the received parameters .
* It ' s safe to call this method even if { @ link SecureCredentialsManager # requireAuthentication ( Activity , int , String , String ) } was unsuccessful .
* @ param requestCode the request code received in the onActivityResult call .
* @ param resultCode the result code received in the onActivityResult call .
* @ return true if the result was handled , false otherwise . */
public boolean checkAuthenticationResult ( int requestCode , int resultCode ) { } } | if ( requestCode != authenticationRequestCode || decryptCallback == null ) { return false ; } if ( resultCode == Activity . RESULT_OK ) { continueGetCredentials ( decryptCallback ) ; } else { decryptCallback . onFailure ( new CredentialsManagerException ( "The user didn't pass the authentication challenge." ) ) ; decryptCallback = null ; } return true ; |
public class hqlLexer { /** * $ ANTLR start " ALL " */
public final void mALL ( ) throws RecognitionException { } } | try { int _type = ALL ; int _channel = DEFAULT_TOKEN_CHANNEL ; // hql . g : 7:5 : ( ' all ' )
// hql . g : 7:7 : ' all '
{ match ( "all" ) ; if ( state . failed ) return ; } state . type = _type ; state . channel = _channel ; } finally { // do for sure before leaving
} |
public class CmsVaadinUtils { /** * Gives item id from path . < p >
* @ param cnt to be used
* @ param path to obtain item id from
* @ return item id */
public static String getPathItemId ( Container cnt , String path ) { } } | for ( String id : Arrays . asList ( path , CmsFileUtil . toggleTrailingSeparator ( path ) ) ) { if ( cnt . containsId ( id ) ) { return id ; } } return null ; |
public class PassBookmarkExample { /** * Create a company node */
private StatementResult addCompany ( final Transaction tx , final String name ) { } } | return tx . run ( "CREATE (:Company {name: $name})" , parameters ( "name" , name ) ) ; |
public class ConverterUtils { /** * { @ link # clearContent ( Workbook ) } with new { @ link ConverterUtils # newWorkbook ( InputStream ) } . */
static OutputStream clearContent ( InputStream workbook ) { } } | ByteArrayOutputStream xlsx = new ByteArrayOutputStream ( ) ; try { clearContent ( ConverterUtils . newWorkbook ( workbook ) ) . write ( xlsx ) ; } catch ( IOException e ) { throw new CalculationEngineException ( e ) ; } return xlsx ; |
public class ScoreSettingsService { /** * Initialize quality score settings
* If quality widget settings are present merge it with default score settings
* Initialize settings for children scores in quality widget */
private void initQualityScoreSettings ( ) { } } | QualityScoreSettings qualityScoreSettings = this . scoreSettings . getQualityWidget ( ) ; if ( null != qualityScoreSettings ) { qualityScoreSettings . setCriteria ( Utils . mergeCriteria ( this . scoreSettings . getCriteria ( ) , qualityScoreSettings . getCriteria ( ) ) ) ; initQualityScoreChildrenSettings ( qualityScoreSettings ) ; } |
public class Dur { /** * Compares this duration with another , acording to their length .
* @ param arg0 another duration instance
* @ return a postive value if this duration is longer , zero if the duration
* lengths are equal , otherwise a negative value */
public final int compareTo ( final Dur arg0 ) { } } | int result ; if ( isNegative ( ) != arg0 . isNegative ( ) ) { // return Boolean . valueOf ( isNegative ( ) ) . compareTo ( Boolean . valueOf ( arg0 . isNegative ( ) ) ) ;
// for pre - java 1.5 compatibility . .
if ( isNegative ( ) ) { return Integer . MIN_VALUE ; } else { return Integer . MAX_VALUE ; } } else if ( getWeeks ( ) != arg0 . getWeeks ( ) ) { result = getWeeks ( ) - arg0 . getWeeks ( ) ; } else if ( getDays ( ) != arg0 . getDays ( ) ) { result = getDays ( ) - arg0 . getDays ( ) ; } else if ( getHours ( ) != arg0 . getHours ( ) ) { result = getHours ( ) - arg0 . getHours ( ) ; } else if ( getMinutes ( ) != arg0 . getMinutes ( ) ) { result = getMinutes ( ) - arg0 . getMinutes ( ) ; } else { result = getSeconds ( ) - arg0 . getSeconds ( ) ; } // invert sense of all tests if both durations are negative
if ( isNegative ( ) ) { return - result ; } else { return result ; } |
public class AbstractParamDialog { /** * This method initializes btnCancel
* @ return javax . swing . JButton */
protected JButton getBtnCancel ( ) { } } | if ( btnCancel == null ) { btnCancel = new JButton ( ) ; btnCancel . setName ( "btnCancel" ) ; btnCancel . setText ( Constant . messages . getString ( "all.button.cancel" ) ) ; btnCancel . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent e ) { exitResult = JOptionPane . CANCEL_OPTION ; AbstractParamDialog . this . setVisible ( false ) ; } } ) ; } return btnCancel ; |
public class TypefaceHelper { /** * Initialize the instance .
* @ param application the application context . */
public static synchronized void initialize ( Application application ) { } } | if ( sHelper != null ) { Log . v ( TAG , "already initialized" ) ; } sHelper = new TypefaceHelper ( application ) ; |
public class StageMonitor { /** * 监听指定的processId节点的变化 */
private void syncStage ( final Long processId ) { } } | // 1 . 根据pipelineId + processId构造对应的path
String path = null ; try { path = StagePathUtils . getProcess ( getPipelineId ( ) , processId ) ; // 2 . 监听当前的process列表的变化
IZkConnection connection = zookeeper . getConnection ( ) ; // zkclient包装的是一个持久化的zk , 分布式lock只需要一次性的watcher , 需要调用原始的zk链接进行操作
ZooKeeper orginZk = ( ( ZooKeeperx ) connection ) . getZookeeper ( ) ; List < String > currentStages = orginZk . getChildren ( path , new AsyncWatcher ( ) { public void asyncProcess ( WatchedEvent event ) { MDC . put ( ArbitrateConstants . splitPipelineLogFileKey , String . valueOf ( getPipelineId ( ) ) ) ; if ( isStop ( ) ) { return ; } if ( event . getType ( ) == EventType . NodeDeleted ) { processTermined ( processId ) ; // 触发下节点删除
return ; } // 出现session expired / connection losscase下 , 会触发所有的watcher响应 , 同时老的watcher会继续保留 , 所以会导致出现多次watcher响应
boolean dataChanged = event . getType ( ) == EventType . NodeDataChanged || event . getType ( ) == EventType . NodeDeleted || event . getType ( ) == EventType . NodeCreated || event . getType ( ) == EventType . NodeChildrenChanged ; if ( dataChanged ) { // boolean reply = initStage ( processId ) ;
// if ( reply = = false ) { / / 出现过load后就不需要再监听变化 , 剩下的就是节点的删除操作
syncStage ( processId ) ; } } } ) ; Collections . sort ( currentStages , new StageComparator ( ) ) ; List < String > lastStages = this . currentStages . get ( processId ) ; if ( lastStages == null || ! lastStages . equals ( currentStages ) ) { initProcessStage ( processId ) ; // 存在差异 , 立马触发一下
} } catch ( NoNodeException e ) { processTermined ( processId ) ; // 触发下节点删除
} catch ( KeeperException e ) { syncStage ( processId ) ; } catch ( InterruptedException e ) { // ignore
} |
public class Gauge { /** * Defines if the averaging functionality will be enabled . */
public void setAveragingEnabled ( final boolean ENABLED ) { } } | if ( null == averagingEnabled ) { _averagingEnabled = ENABLED ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { averagingEnabled . set ( ENABLED ) ; } |
public class SarlArtifactImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case SarlPackage . SARL_ARTIFACT__EXTENDS : setExtends ( ( JvmParameterizedTypeReference ) null ) ; return ; } super . eUnset ( featureID ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.