signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class RPCParameter { /** * Copies source values from an input array as integer - indexed vector values .
* @ param source Source values . */
public void assignArray ( Object source ) { } } | int len = Array . getLength ( source ) ; List < Object > list = new ArrayList < Object > ( len ) ; for ( int i = 0 ; i < len ; i ++ ) { list . add ( Array . get ( source , i ) ) ; } assign ( list ) ; |
public class ArrayUtils { /** * Shuffles the first n elements of the array in - place .
* @ param elements the array to shuffle .
* @ param n the number of elements to shuffle ; must be { @ code < = elements . length } .
* @ param random the { @ link ThreadLocalRandom } instance to use . This is mainly intended to
* facilitate tests .
* @ see < a
* href = " https : / / en . wikipedia . org / wiki / Fisher % E2%80%93Yates _ shuffle # The _ modern _ algorithm " > Modern
* Fisher - Yates shuffle < / a > */
public static < ElementT > void shuffleHead ( @ NonNull ElementT [ ] elements , int n , @ NonNull ThreadLocalRandom random ) { } } | if ( n > elements . length ) { throw new ArrayIndexOutOfBoundsException ( String . format ( "Can't shuffle the first %d elements, there are only %d" , n , elements . length ) ) ; } if ( n > 1 ) { for ( int i = n - 1 ; i > 0 ; i -- ) { int j = random . nextInt ( i + 1 ) ; swap ( elements , i , j ) ; } } |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link FeaturePropertyType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link FeaturePropertyType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/citygml/1.0" , name = "cityObjectMember" , substitutionHeadNamespace = "http://www.opengis.net/gml" , substitutionHeadName = "featureMember" ) public JAXBElement < FeaturePropertyType > createCityObjectMember ( FeaturePropertyType value ) { } } | return new JAXBElement < FeaturePropertyType > ( _CityObjectMember_QNAME , FeaturePropertyType . class , null , value ) ; |
public class CharacterApi { /** * Get agents research Return a list of agents research information for a
* character . The formula for finding the current research points with an
* agent is : currentPoints & # x3D ; remainderPoints + pointsPerDay *
* days ( currentTime - researchStartDate ) - - - This route is cached for up to
* 3600 seconds SSO Scope : esi - characters . read _ agents _ research . v1
* @ param characterId
* An EVE character ID ( required )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param ifNoneMatch
* ETag from a previous request . A 304 will be returned if this
* matches the current ETag ( optional )
* @ param token
* Access token to use if unable to set a header ( optional )
* @ return List & lt ; CharacterResearchAgentsResponse & gt ;
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public List < CharacterResearchAgentsResponse > getCharactersCharacterIdAgentsResearch ( Integer characterId , String datasource , String ifNoneMatch , String token ) throws ApiException { } } | ApiResponse < List < CharacterResearchAgentsResponse > > resp = getCharactersCharacterIdAgentsResearchWithHttpInfo ( characterId , datasource , ifNoneMatch , token ) ; return resp . getData ( ) ; |
public class ToXMLSAXHandler { /** * Adds the given attribute to the set of attributes , and also makes sure
* that the needed prefix / uri mapping is declared , but only if there is a
* currently open element .
* @ param uri the URI of the attribute
* @ param localName the local name of the attribute
* @ param rawName the qualified name of the attribute
* @ param type the type of the attribute ( probably CDATA )
* @ param value the value of the attribute
* @ param XSLAttribute true if this attribute is coming from an xsl : attribute element
* @ see ExtendedContentHandler # addAttribute ( String , String , String , String , String ) */
public void addAttribute ( String uri , String localName , String rawName , String type , String value , boolean XSLAttribute ) throws SAXException { } } | if ( m_elemContext . m_startTagOpen ) { ensurePrefixIsDeclared ( uri , rawName ) ; addAttributeAlways ( uri , localName , rawName , type , value , false ) ; } |
public class WhileyFileParser { /** * Parse a block of zero or more statements which share the same indentation
* level . Their indentation level must be strictly greater than that of
* their parent , otherwise the end of block is signaled . The < i > indentation
* level < / i > for the block is set by the first statement encountered
* ( assuming their is one ) . An error occurs if a subsequent statement is
* reached with an indentation level < i > greater < / i > than the block ' s
* indentation level .
* @ param parentIndent
* The indentation level of the parent , for which all statements
* in this block must have a greater indent . May not be
* < code > null < / code > .
* @ param isLoop
* Indicates whether or not this block represents the body of a
* loop . This is important in order to setup the scope for this
* block appropriately .
* @ return */
private Stmt . Block parseBlock ( EnclosingScope scope , boolean isLoop ) { } } | // First , determine the initial indentation of this block based on the
// first statement ( or null if there is no statement ) .
Indent indent = getIndent ( ) ; // We must clone the environment here , in order to ensure variables
// declared within this block are properly scoped .
EnclosingScope blockScope = scope . newEnclosingScope ( indent , isLoop ) ; // Second , check that this is indeed the initial indentation for this
// block ( i . e . that it is strictly greater than parent indent ) .
if ( indent == null || indent . lessThanEq ( scope . getIndent ( ) ) ) { // Initial indent either doesn ' t exist or is not strictly greater
// than parent indent and , therefore , signals an empty block .
return new Stmt . Block ( ) ; } else { // Initial indent is valid , so we proceed parsing statements with
// the appropriate level of indent .
ArrayList < Stmt > stmts = new ArrayList < > ( ) ; Indent nextIndent ; while ( ( nextIndent = getIndent ( ) ) != null && indent . lessThanEq ( nextIndent ) ) { // At this point , nextIndent contains the indent of the current
// statement . However , this still may not be equivalent to this
// block ' s indentation level .
// First , check the indentation matches that for this block .
if ( ! indent . equivalent ( nextIndent ) ) { // No , it ' s not equivalent so signal an error .
syntaxError ( "unexpected end-of-block" , nextIndent ) ; } // Second , parse the actual statement at this point !
stmts . add ( parseStatement ( blockScope ) ) ; } // Finally , construct the block
return new Stmt . Block ( stmts . toArray ( new Stmt [ stmts . size ( ) ] ) ) ; } |
public class GeoDistanceRangeCondition { /** * { @ inheritDoc } */
@ Override public Query query ( Schema schema ) { } } | GeoCircle minCircle = new GeoCircle ( longitude , latitude , minDistance ) ; GeoCircle maxCircle = new GeoCircle ( longitude , latitude , maxDistance ) ; Condition minCondition = new GeoShapeCondition ( boost , field , GeoOperator . IsDisjointTo , minCircle ) ; Condition maxCondition = new GeoShapeCondition ( boost , field , GeoOperator . Intersects , maxCircle ) ; BooleanQuery query = new BooleanQuery ( ) ; query . add ( minCondition . query ( schema ) , BooleanClause . Occur . MUST ) ; query . add ( maxCondition . query ( schema ) , BooleanClause . Occur . MUST ) ; return query ; |
public class ExceptionQueuedEventContext { /** * < p class = " changed _ added _ 2_0 " > A < code > Map < / code > of attributes
* relevant to the context of this < code > ExceptionQueuedEvent < / code > . < / p > */
public Map < Object , Object > getAttributes ( ) { } } | if ( null == attributes ) { attributes = new HashMap < Object , Object > ( ) ; } return attributes ; |
public class MobicentsSipServletsEmbeddedImpl { /** * / * ( non - Javadoc )
* @ see org . jboss . arquillian . container . mobicents . servlet . sip . embedded _ 1 . MobicentsSipServletsEmbedded # createConnector ( java . net . InetAddress , int , boolean ) */
@ Override public Connector createConnector ( InetAddress address , int port , boolean secure ) { } } | return createConnector ( address != null ? address . toString ( ) : null , port , secure ) ; |
public class ContentSpec { /** * Sets the SpecTopic of the Revision History for the Content Specification .
* @ param revisionHistory The SpecTopic for the Revision History */
public void setRevisionHistory ( final SpecTopic revisionHistory ) { } } | if ( revisionHistory == null && this . revisionHistory == null ) { return ; } else if ( revisionHistory == null ) { removeChild ( this . revisionHistory ) ; this . revisionHistory = null ; } else if ( this . revisionHistory == null ) { revisionHistory . setTopicType ( TopicType . REVISION_HISTORY ) ; this . revisionHistory = new KeyValueNode < SpecTopic > ( CommonConstants . CS_REV_HISTORY_TITLE , revisionHistory ) ; appendChild ( this . revisionHistory , false ) ; } else { revisionHistory . setTopicType ( TopicType . REVISION_HISTORY ) ; this . revisionHistory . setValue ( revisionHistory ) ; } |
public class GrapesClient { /** * Add a license to an artifact
* @ param gavc
* @ param licenseId
* @ throws GrapesCommunicationException
* @ throws javax . naming . AuthenticationException */
public void addLicense ( final String gavc , final String licenseId , final String user , final String password ) throws GrapesCommunicationException , AuthenticationException { } } | final Client client = getClient ( user , password ) ; final WebResource resource = client . resource ( serverURL ) . path ( RequestUtils . getArtifactLicensesPath ( gavc ) ) ; final ClientResponse response = resource . queryParam ( ServerAPI . LICENSE_ID_PARAM , licenseId ) . post ( ClientResponse . class ) ; client . destroy ( ) ; if ( ClientResponse . Status . OK . getStatusCode ( ) != response . getStatus ( ) ) { final String message = "Failed to add license " + licenseId + " to artifact " + gavc ; if ( LOG . isErrorEnabled ( ) ) { LOG . error ( String . format ( HTTP_STATUS_TEMPLATE_MSG , message , response . getStatus ( ) ) ) ; } throw new GrapesCommunicationException ( message , response . getStatus ( ) ) ; } |
public class Choice8 { /** * Static factory method for wrapping a value of type < code > C < / code > in a { @ link Choice8 } .
* @ param c the value
* @ param < A > the first possible type
* @ param < B > the second possible type
* @ param < C > the third possible type
* @ param < D > the fourth possible type
* @ param < E > the fifth possible type
* @ param < F > the sixth possible type
* @ param < G > the seventh possible type
* @ param < H > the eighth possible type
* @ return the wrapped value as a { @ link Choice8 } & lt ; A , B , C , D , E , F , G , H & gt ; */
public static < A , B , C , D , E , F , G , H > Choice8 < A , B , C , D , E , F , G , H > c ( C c ) { } } | return new _C < > ( c ) ; |
public class CmsDomUtil { /** * Generates a form element with hidden input fields . < p >
* @ param action the form action
* @ param method the form method
* @ param target the form target
* @ param values the input values
* @ return the generated form element */
public static FormElement generateHiddenForm ( String action , Method method , String target , Map < String , String > values ) { } } | FormElement formElement = Document . get ( ) . createFormElement ( ) ; formElement . setMethod ( method . name ( ) ) ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( target ) ) { formElement . setTarget ( target ) ; } formElement . setAction ( action ) ; for ( Entry < String , String > input : values . entrySet ( ) ) { formElement . appendChild ( createHiddenInput ( input . getKey ( ) , input . getValue ( ) ) ) ; } return formElement ; |
public class Director { /** * Resolves assetIds
* @ param assetIds Collection of assetIds to resolve
* @ param download If assets should be downloaded
* @ throws InstallException */
public void resolve ( Collection < String > assetIds , boolean download ) throws InstallException { } } | getResolveDirector ( ) . resolve ( assetIds , download ) ; |
public class HijriCalendar { /** * / * [ deutsch ]
* < p > Bestimmt die Datenversion der angegebenen Kalendervariante . < / p >
* < p > Diese Methode dient nur Analysezwecken . < / p >
* @ param variant name of islamic calendar variant
* @ return version info ( maybe empty if not relevant )
* @ throws ChronoException if the variant is not recognized
* @ since 3.9/4.6 */
public static String getVersion ( String variant ) { } } | Object data = getCalendarSystem ( variant ) ; if ( data instanceof AstronomicalHijriData ) { return AstronomicalHijriData . class . cast ( data ) . getVersion ( ) ; } return "" ; |
public class InvocationInfo { /** * Returns { @ code true } is the return type is { @ link Void } or represents the pseudo - type to the keyword { @ code void } .
* E . g : { @ code void foo ( ) } or { @ code Void bar ( ) } */
public boolean isVoid ( ) { } } | final MockCreationSettings mockSettings = MockUtil . getMockHandler ( invocation . getMock ( ) ) . getMockSettings ( ) ; Class < ? > returnType = GenericMetadataSupport . inferFrom ( mockSettings . getTypeToMock ( ) ) . resolveGenericReturnType ( this . method ) . rawType ( ) ; return returnType == Void . TYPE || returnType == Void . class ; |
public class InjectionUtils { /** * Liberty Change for CXF End */
@ SuppressWarnings ( "unchecked" ) public static void injectConstructorProxies ( Object o , AbstractResourceInfo cri , Message m ) { } } | Map < Class < ? > , ThreadLocalProxy < ? > > proxies = cri . getConstructorProxies ( ) ; if ( proxies != null ) { for ( Map . Entry < Class < ? > , ThreadLocalProxy < ? > > entry : proxies . entrySet ( ) ) { Object value = JAXRSUtils . createContextValue ( m , entry . getKey ( ) , entry . getKey ( ) ) ; ( ( ThreadLocalProxy < Object > ) entry . getValue ( ) ) . set ( value ) ; } } |
public class QueryRendererDelegateImpl { /** * Sets a property path representing one property in the SELECT , GROUP BY , WHERE or HAVING clause of a given query .
* @ param propertyPath the property path to set */
@ Override public void setPropertyPath ( PropertyPath < TypeDescriptor < TypeMetadata > > propertyPath ) { } } | if ( aggregationFunction != null ) { if ( propertyPath == null && aggregationFunction != AggregationFunction . COUNT && aggregationFunction != AggregationFunction . COUNT_DISTINCT ) { throw log . getAggregationCanOnlyBeAppliedToPropertyReferencesException ( aggregationFunction . name ( ) ) ; } propertyPath = new AggregationPropertyPath < > ( aggregationFunction , propertyPath . getNodes ( ) ) ; } if ( phase == Phase . SELECT ) { if ( projections == null ) { projections = new ArrayList < > ( ARRAY_INITIAL_LENGTH ) ; projectedTypes = new ArrayList < > ( ARRAY_INITIAL_LENGTH ) ; projectedNullMarkers = new ArrayList < > ( ARRAY_INITIAL_LENGTH ) ; } PropertyPath < TypeDescriptor < TypeMetadata > > projection ; Class < ? > propertyType ; Object nullMarker ; if ( propertyPath . getLength ( ) == 1 && propertyPath . isAlias ( ) ) { projection = new PropertyPath < > ( Collections . singletonList ( new PropertyPath . PropertyReference < > ( "__HSearch_This" , null , true ) ) ) ; // todo [ anistor ] this is a leftover from hsearch ? ? ? ? this represents the entity itself . see org . hibernate . search . ProjectionConstants
propertyType = null ; nullMarker = null ; } else { projection = resolveAlias ( propertyPath ) ; propertyType = propertyHelper . getPrimitivePropertyType ( targetEntityMetadata , projection . asArrayPath ( ) ) ; nullMarker = fieldIndexingMetadata . getNullMarker ( projection . asArrayPath ( ) ) ; } projections . add ( projection ) ; projectedTypes . add ( propertyType ) ; projectedNullMarkers . add ( nullMarker ) ; } else { this . propertyPath = propertyPath ; } |
public class JsonMetaInformation { /** * Converts this generic meta information to the provided type .
* @ param metaClass to return
* @ return meta information based on the provided type . */
@ Override public < M extends MetaInformation > M as ( Class < M > metaClass ) { } } | try { return mapper . readerFor ( metaClass ) . readValue ( data ) ; } catch ( IOException e ) { throw new IllegalStateException ( e ) ; } |
public class HumanTime { /** * Appends an approximate , human - formatted representation of the time delta to the given { @ link Appendable } object .
* @ param < T > the return type
* @ param a the Appendable object , may not be < code > null < / code >
* @ return the given Appendable object , never < code > null < / code > */
public < T extends Appendable > T getApproximately ( T a ) { } } | try { MutableInt parts = new MutableInt ( 0 ) ; long d = delta ; long mod = d % YEAR ; if ( ! append ( d , mod , YEAR , 'y' , a , parts ) ) { d %= YEAR ; mod = d % MONTH ; if ( ! append ( d , mod , MONTH , 'n' , a , parts ) && parts . intValue ( ) < 2 ) { d %= MONTH ; mod = d % DAY ; if ( ! append ( d , mod , DAY , 'd' , a , parts ) && parts . intValue ( ) < 2 ) { d %= DAY ; mod = d % HOUR ; if ( ! append ( d , mod , HOUR , 'h' , a , parts ) && parts . intValue ( ) < 2 ) { d %= HOUR ; mod = d % MINUTE ; if ( ! append ( d , mod , MINUTE , 'm' , a , parts ) && parts . intValue ( ) < 2 ) { d %= MINUTE ; mod = d % SECOND ; if ( ! append ( d , mod , SECOND , 's' , a , parts ) && parts . intValue ( ) < 2 ) { d %= SECOND ; if ( d > 0 ) { a . append ( Integer . toString ( ( int ) d ) ) ; a . append ( 'm' ) ; a . append ( 's' ) ; } } } } } } } } catch ( IOException ex ) { // What were they thinking . . .
LoggerFactory . getLogger ( HumanTime . class ) . warn ( null , ex ) ; } return a ; |
public class KeyVaultClientBaseImpl { /** * Lists the deleted certificates in the specified vault currently available for recovery .
* The GetDeletedCertificates operation retrieves the certificates in the current vault which are in a deleted state and ready for recovery or purging . This operation includes deletion - specific information . This operation requires the certificates / get / list permission . This operation can only be enabled on soft - delete enabled vaults .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the PagedList & lt ; DeletedCertificateItem & gt ; object wrapped in { @ link ServiceResponse } if successful . */
public Observable < ServiceResponse < Page < DeletedCertificateItem > > > getDeletedCertificatesNextSinglePageAsync ( final String nextPageLink ) { } } | if ( nextPageLink == null ) { throw new IllegalArgumentException ( "Parameter nextPageLink is required and cannot be null." ) ; } String nextUrl = String . format ( "%s" , nextPageLink ) ; return service . getDeletedCertificatesNext ( nextUrl , this . acceptLanguage ( ) , this . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Page < DeletedCertificateItem > > > > ( ) { @ Override public Observable < ServiceResponse < Page < DeletedCertificateItem > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < PageImpl < DeletedCertificateItem > > result = getDeletedCertificatesNextDelegate ( response ) ; return Observable . just ( new ServiceResponse < Page < DeletedCertificateItem > > ( result . body ( ) , result . response ( ) ) ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class UBench { /** * Benchmark all added tasks until they exceed the set time limit
* @ param mode
* The UMode execution model to use for task execution
* @ param timeLimit
* combined with the timeUnit , indicates how long to run tests
* for . A value less than or equal to 0 turns off this check .
* @ param timeUnit
* combined with the timeLimit , indicates how long to run tests
* for .
* @ return the results of all completed tasks . */
public UReport press ( UMode mode , final long timeLimit , final TimeUnit timeUnit ) { } } | return press ( mode , 0 , 0 , 0.0 , timeLimit , timeUnit ) ; |
public class ClassSearch { /** * 根据类名得到指定类 , 如果类名是带包名 , 则直接用当前classloader加载 , 如果仅仅类名
* 则尝试用内置的或者配置的包名作为包名尝试加载
* @ param name
* @ return 不成功 , 返回null */
public Class getClassByName ( String name ) { } } | if ( name . indexOf ( "." ) != - 1 ) { try { return Class . forName ( name , true , gt . getClassLoader ( ) ) ; } catch ( ClassNotFoundException e ) { return null ; } } else { Class cls = map . get ( name ) ; if ( cls == null ) { for ( String pkg : pkgList ) { try { String clsName = pkg . concat ( name ) ; cls = Class . forName ( clsName , true , gt . getClassLoader ( ) ) ; map . put ( name , cls ) ; return cls ; } catch ( Exception ex ) { // continue ;
} } return null ; } else { return cls ; } } |
public class DenseLU { /** * Creates an LU decomposition of the given matrix
* @ param A
* Matrix to decompose . Not modified
* @ return The current decomposition */
public static DenseLU factorize ( Matrix A ) { } } | return new DenseLU ( A . numRows ( ) , A . numColumns ( ) ) . factor ( new DenseMatrix ( A ) ) ; |
public class Global { /** * Load and execute a script compiled to a class file .
* This method is defined as a JavaScript function .
* When called as a JavaScript function , a single argument is
* expected . This argument should be the name of a class that
* implements the Script interface , as will any script
* compiled by jsc .
* @ exception IllegalAccessException if access is not available
* to the class
* @ exception InstantiationException if unable to instantiate
* the named class */
public static void loadClass ( Context cx , Scriptable thisObj , Object [ ] args , Function funObj ) throws IllegalAccessException , InstantiationException { } } | Class < ? > clazz = getClass ( args ) ; if ( ! Script . class . isAssignableFrom ( clazz ) ) { throw reportRuntimeError ( "msg.must.implement.Script" ) ; } Script script = ( Script ) clazz . newInstance ( ) ; script . exec ( cx , thisObj ) ; |
public class AbstractDataChannel { /** * mode / transfer types */
private static String getHandlerID ( int transferMode , int transferType , int type ) { } } | String id = "" ; switch ( transferMode ) { case Session . MODE_STREAM : id += "S-" ; break ; case GridFTPSession . MODE_EBLOCK : id += "E-" ; break ; default : throw new IllegalArgumentException ( "Mode not supported: " + transferMode ) ; } switch ( transferType ) { case Session . TYPE_IMAGE : id += "I-" ; break ; case Session . TYPE_ASCII : id += "A-" ; break ; default : throw new IllegalArgumentException ( "Type not supported: " + transferType ) ; } switch ( type ) { case SOURCE : id += "R" ; break ; case SINK : id += "W" ; break ; default : throw new IllegalArgumentException ( "Type not supported: " + type ) ; } if ( id . equals ( "" ) ) { return null ; } return id ; |
public class Link { /** * Returns the default header fragment for this link .
* @ param ref the name { @ link String } of the reference of this link .
* @ return a header fragment { @ link String } .
* @ see # headerFragment ( ) */
final String createHeaderFragment ( String ref ) { } } | int size = this . propIdsAsSet . size ( ) ; boolean sep1Needed = size > 0 && this . constraints . length > 0 ; String sep1 = sep1Needed ? ", " : "" ; String id = size > 0 ? "id=" : "" ; boolean parenNeeded = size > 0 || this . constraints . length > 0 ; String startParen = parenNeeded ? "(" : "" ; String finishParen = parenNeeded ? ")" : "" ; String range = rangeString ( ) ; boolean sep2Needed = sep1Needed && range . length ( ) > 0 ; String sep2 = sep2Needed ? ", " : "" ; return '.' + ref + startParen + id + StringUtils . join ( this . propIdsAsSet , ',' ) + sep1 + constraintHeaderString ( this . constraints ) + finishParen + sep2 + range ; |
public class FileUtils { /** * Just like { @ link Files # asCharSink ( java . io . File , java . nio . charset . Charset ,
* com . google . common . io . FileWriteMode . . . ) } , but decompresses the incoming data using GZIP . */
public static CharSink asCompressedCharSink ( File f , Charset charSet ) throws IOException { } } | return asCompressedByteSink ( f ) . asCharSink ( charSet ) ; |
public class KeyVaultClientBaseImpl { /** * Recovers the deleted key to its latest version .
* The Recover Deleted Key operation is applicable for deleted keys in soft - delete enabled vaults . It recovers the deleted key back to its latest version under / keys . An attempt to recover an non - deleted key will return an error . Consider this the inverse of the delete operation on soft - delete enabled vaults . This operation requires the keys / recover permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param keyName The name of the deleted key .
* @ 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 < KeyBundle > recoverDeletedKeyAsync ( String vaultBaseUrl , String keyName , final ServiceCallback < KeyBundle > serviceCallback ) { } } | return ServiceFuture . fromResponse ( recoverDeletedKeyWithServiceResponseAsync ( vaultBaseUrl , keyName ) , serviceCallback ) ; |
public class ntpserver { /** * Use this API to add ntpserver . */
public static base_response add ( nitro_service client , ntpserver resource ) throws Exception { } } | ntpserver addresource = new ntpserver ( ) ; addresource . serverip = resource . serverip ; addresource . servername = resource . servername ; addresource . minpoll = resource . minpoll ; addresource . maxpoll = resource . maxpoll ; addresource . autokey = resource . autokey ; addresource . key = resource . key ; return addresource . add_resource ( client ) ; |
public class BitcoinBlockReader { /** * Parses the Bitcoin transaction inputs in a byte buffer .
* @ param rawByteBuffer ByteBuffer from which the transaction inputs have to be parsed
* @ param noOfTransactionInputs Number of expected transaction inputs
* @ return Array of transactions */
public List < BitcoinTransactionInput > parseTransactionInputs ( ByteBuffer rawByteBuffer , long noOfTransactionInputs ) { } } | ArrayList < BitcoinTransactionInput > currentTransactionInput = new ArrayList < > ( ( int ) noOfTransactionInputs ) ; for ( int i = 0 ; i < noOfTransactionInputs ; i ++ ) { // read previous Hash of Transaction
byte [ ] currentTransactionInputPrevTransactionHash = new byte [ 32 ] ; rawByteBuffer . get ( currentTransactionInputPrevTransactionHash , 0 , 32 ) ; // read previousTxOutIndex
long currentTransactionInputPrevTxOutIdx = BitcoinUtil . convertSignedIntToUnsigned ( rawByteBuffer . getInt ( ) ) ; // read InScript length ( Potential Internal Exceed Java Type )
byte [ ] currentTransactionTxInScriptLengthVarInt = BitcoinUtil . convertVarIntByteBufferToByteArray ( rawByteBuffer ) ; long currentTransactionTxInScriptSize = BitcoinUtil . getVarInt ( currentTransactionTxInScriptLengthVarInt ) ; // read inScript
int currentTransactionTxInScriptSizeInt = ( int ) currentTransactionTxInScriptSize ; byte [ ] currentTransactionInScript = new byte [ currentTransactionTxInScriptSizeInt ] ; rawByteBuffer . get ( currentTransactionInScript , 0 , currentTransactionTxInScriptSizeInt ) ; // read sequence no
long currentTransactionInputSeqNo = BitcoinUtil . convertSignedIntToUnsigned ( rawByteBuffer . getInt ( ) ) ; // add input
currentTransactionInput . add ( new BitcoinTransactionInput ( currentTransactionInputPrevTransactionHash , currentTransactionInputPrevTxOutIdx , currentTransactionTxInScriptLengthVarInt , currentTransactionInScript , currentTransactionInputSeqNo ) ) ; } return currentTransactionInput ; |
public class FastjsonEncoder { /** * 将指定java对象序列化成相应字符串
* @ param obj java对象
* @ param namingStyle 命名风格
* @ param useUnicode 是否使用unicode编码 ( 当有中文字段时 )
* @ return 序列化后的json字符串
* @ author Zhanghongdong */
public static String encodeAsString ( Object obj , NamingStyle namingStyle , boolean useUnicode ) { } } | SerializeConfig config = SerializeConfig . getGlobalInstance ( ) ; config . propertyNamingStrategy = getNamingStrategy ( namingStyle ) ; if ( useUnicode ) { return JSON . toJSONString ( obj , config , SerializerFeature . BrowserCompatible , SerializerFeature . WriteNullListAsEmpty , SerializerFeature . NotWriteDefaultValue ) ; } return JSON . toJSONString ( obj , config ) ; |
public class UserThreadPoolManager { /** * 得到用户线程池
* @ param service 服务唯一名
* @ return 用户自定义线程池 */
public static UserThreadPool getUserThread ( String service ) { } } | return userThreadMap == null ? null : userThreadMap . get ( service ) ; |
public class CalendarApi { /** * List calendar event summaries Get 50 event summaries from the calendar .
* If no from _ event ID is given , the resource will return the next 50
* chronological event summaries from now . If a from _ event ID is specified ,
* it will return the next 50 chronological event summaries from after that
* event - - - This route is cached for up to 5 seconds SSO Scope :
* esi - calendar . read _ calendar _ events . v1
* @ param characterId
* An EVE character ID ( required )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param fromEvent
* The event ID to retrieve events from ( optional )
* @ param ifNoneMatch
* ETag from a previous request . A 304 will be returned if this
* matches the current ETag ( optional )
* @ param token
* Access token to use if unable to set a header ( optional )
* @ return List & lt ; CharacterCalendarResponse & gt ;
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public List < CharacterCalendarResponse > getCharactersCharacterIdCalendar ( Integer characterId , String datasource , Integer fromEvent , String ifNoneMatch , String token ) throws ApiException { } } | ApiResponse < List < CharacterCalendarResponse > > resp = getCharactersCharacterIdCalendarWithHttpInfo ( characterId , datasource , fromEvent , ifNoneMatch , token ) ; return resp . getData ( ) ; |
public class PatternFlattener { /** * Get the list of parameters from the given pattern .
* @ param pattern the given pattern
* @ return the parameters list , or empty if no parameter found from the given pattern */
static List < String > parsePattern ( String pattern ) { } } | List < String > parameters = new ArrayList < > ( 4 ) ; Matcher matcher = PARAM_REGEX . matcher ( pattern ) ; while ( matcher . find ( ) ) { parameters . add ( matcher . group ( 1 ) ) ; } return parameters ; |
public class AppServicePlansInner { /** * Get all apps that use a Hybrid Connection in an App Service Plan .
* Get all apps that use a Hybrid Connection in an App Service Plan .
* @ 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 ; String & gt ; object */
public Observable < Page < String > > listWebAppsByHybridConnectionNextAsync ( final String nextPageLink ) { } } | return listWebAppsByHybridConnectionNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < String > > , Page < String > > ( ) { @ Override public Page < String > call ( ServiceResponse < Page < String > > response ) { return response . body ( ) ; } } ) ; |
public class AltBeaconParser { /** * Construct an AltBeacon from a Bluetooth LE packet collected by Android ' s Bluetooth APIs ,
* including the raw Bluetooth device info
* @ param scanData The actual packet bytes
* @ param rssi The measured signal strength of the packet
* @ param device The Bluetooth device that was detected
* @ return An instance of an < code > Beacon < / code > */
@ Override public Beacon fromScanData ( byte [ ] scanData , int rssi , BluetoothDevice device ) { } } | return fromScanData ( scanData , rssi , device , new AltBeacon ( ) ) ; |
public class AmazonSimpleDBClient { /** * Returns information about the domain , including when the domain was created , the number of items and attributes
* in the domain , and the size of the attribute names and values .
* @ param domainMetadataRequest
* @ return Result of the DomainMetadata operation returned by the service .
* @ throws MissingParameterException
* The request must contain the specified missing parameter .
* @ throws NoSuchDomainException
* The specified domain does not exist .
* @ sample AmazonSimpleDB . DomainMetadata */
@ Override public DomainMetadataResult domainMetadata ( DomainMetadataRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDomainMetadata ( request ) ; |
public class InputUtils { /** * InputHandler converts every object into Map .
* This function returns Class name of object from which this Map was created .
* @ param map Map from which Class name would be returned
* @ return Class name from which Map was built */
public static String getClassName ( Map < String , Object > map ) { } } | String className = null ; if ( map . containsKey ( MAP_CLASS_NAME ) == true ) { className = ( String ) map . get ( MAP_CLASS_NAME ) ; } return className ; |
public class PathClassLoader { /** * Add a new path to the ClassLoader , such as a Jar or directory of compiled
* classes .
* @ param path String
* @ return boolean if path is loaded .
* @ throws MalformedURLException exception */
public boolean addPath ( String path ) throws MalformedURLException { } } | File file = new File ( path ) ; return addPath ( file ) ; |
public class LuaScriptBuilder { /** * End building the prepared script , adding a return value statement
* @ param value the value to return
* @ param config the configuration for the script to build
* @ return the new { @ link LuaPreparedScript } instance */
public LuaPreparedScript endPreparedScriptReturn ( LuaValue value , LuaScriptConfig config ) { } } | add ( new LuaAstReturnStatement ( argument ( value ) ) ) ; return endPreparedScript ( config ) ; |
public class IfcCompositeCurveImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) public EList < IfcCompositeCurveSegment > getSegments ( ) { } } | return ( EList < IfcCompositeCurveSegment > ) eGet ( Ifc2x3tc1Package . Literals . IFC_COMPOSITE_CURVE__SEGMENTS , true ) ; |
public class HCRenderer { /** * Customize the passed base node and all child nodes recursively .
* @ param aStartNode
* Base node to start customizing ( incl . ) . May not be < code > null < / code > .
* @ param aGlobalTargetNode
* The target node where new nodes should be appended to in case the
* direct parent node is not suitable . May not be < code > null < / code > .
* @ param aConversionSettings
* The conversion settings to use . May not be < code > null < / code > . */
public static void prepareForConversion ( @ Nonnull final IHCNode aStartNode , @ Nonnull final IHCHasChildrenMutable < ? , ? super IHCNode > aGlobalTargetNode , @ Nonnull final IHCConversionSettingsToNode aConversionSettings ) { } } | ValueEnforcer . notNull ( aStartNode , "NodeToBeCustomized" ) ; ValueEnforcer . notNull ( aGlobalTargetNode , "TargetNode" ) ; ValueEnforcer . notNull ( aConversionSettings , "ConversionSettings" ) ; final IHCCustomizer aCustomizer = aConversionSettings . getCustomizer ( ) ; final EHTMLVersion eHTMLVersion = aConversionSettings . getHTMLVersion ( ) ; // Customize all elements before extracting out - of - band nodes , in case the
// customizer adds some out - of - band nodes as well
// Than finalize and register external resources
final IHCIteratorNonBreakableCallback aCB = ( aParentNode , aChildNode ) -> { // If the parent node is suitable , use it , else use the global target
// node
IHCHasChildrenMutable < ? , ? super IHCNode > aRealTargetNode ; if ( aParentNode instanceof IHCHasChildrenMutable < ? , ? > ) { // Unchecked conversion
aRealTargetNode = GenericReflection . uncheckedCast ( aParentNode ) ; } else aRealTargetNode = aGlobalTargetNode ; final int nTargetNodeChildren = aRealTargetNode . getChildCount ( ) ; // Run the global customizer
aChildNode . customizeNode ( aCustomizer , eHTMLVersion , aRealTargetNode ) ; // finalize the node
aChildNode . finalizeNodeState ( aConversionSettings , aRealTargetNode ) ; // Consistency check
aChildNode . consistencyCheck ( aConversionSettings ) ; // No forced registration here
final boolean bForcedResourceRegistration = false ; aChildNode . registerExternalResources ( aConversionSettings , bForcedResourceRegistration ) ; // Something was added ?
if ( aRealTargetNode . getChildCount ( ) > nTargetNodeChildren ) { // Recursive call on the target node only .
// It ' s important to scan the whole tree , as a hierarchy of nodes may
// have been added !
prepareForConversion ( aRealTargetNode , aRealTargetNode , aConversionSettings ) ; } } ; HCHelper . iterateTreeNonBreakable ( aStartNode , aCB ) ; |
public class QueryAtomContainer { /** * Grows the single electron array by a given size .
* @ see # growArraySize */
private void growSingleElectronArray ( ) { } } | growArraySize = ( singleElectrons . length < growArraySize ) ? growArraySize : singleElectrons . length ; ISingleElectron [ ] newSingleElectrons = new ISingleElectron [ singleElectrons . length + growArraySize ] ; System . arraycopy ( singleElectrons , 0 , newSingleElectrons , 0 , singleElectrons . length ) ; singleElectrons = newSingleElectrons ; |
public class InMemoryDocumentSessionOperations { /** * Evicts the specified entity from the session .
* Remove the entity from the delete queue and stops tracking changes for this entity .
* @ param < T > entity class
* @ param entity Entity to evict */
public < T > void evict ( T entity ) { } } | DocumentInfo documentInfo = documentsByEntity . get ( entity ) ; if ( documentInfo != null ) { documentsByEntity . remove ( entity ) ; documentsById . remove ( documentInfo . getId ( ) ) ; } deletedEntities . remove ( entity ) ; if ( _countersByDocId != null ) { _countersByDocId . remove ( documentInfo . getId ( ) ) ; } |
public class AgentManager { /** * Add a new agent to the manager .
* @ param agent agent to add . */
private void addAgent ( AsteriskAgentImpl agent ) { } } | synchronized ( agents ) { agents . put ( agent . getAgentId ( ) , agent ) ; } server . fireNewAgent ( agent ) ; |
public class NominatimSearchRequest { /** * Sets the preferred area to find search results ;
* @ param west
* the west bound
* @ param north
* the north bound
* @ param east
* the east bound
* @ param south
* the south bound */
public void setViewBox ( final double west , final double north , final double east , final double south ) { } } | this . viewBox = new BoundingBox ( ) ; this . viewBox . setWest ( west ) ; this . viewBox . setNorth ( north ) ; this . viewBox . setEast ( east ) ; this . viewBox . setSouth ( south ) ; |
public class ExtractorUtils { /** * Get the list of build numbers that are to be kept forever . */
public static List < String > getBuildNumbersNotToBeDeleted ( Run build ) { } } | List < String > notToDelete = Lists . newArrayList ( ) ; List < ? extends Run < ? , ? > > builds = build . getParent ( ) . getBuilds ( ) ; for ( Run < ? , ? > run : builds ) { if ( run . isKeepLog ( ) ) { notToDelete . add ( String . valueOf ( run . getNumber ( ) ) ) ; } } return notToDelete ; |
public class GcsDelegationTokens { /** * Attempt to bind to any existing DT , including unmarshalling its contents and creating the GCP
* credential provider used to authenticate the client .
* < p > If successful :
* < ol >
* < li > { @ link # boundDT } is set to the retrieved token .
* < li > { @ link # accessTokenProvider } is set to the credential provider ( s ) returned by the token
* binding .
* < / ol >
* If unsuccessful , { @ link # deployUnbonded ( ) } is called for the unbonded codepath instead , which
* will set { @ link # accessTokenProvider } to its value .
* < p > This means after this call ( and only after ) the token operations can be invoked .
* @ throws IOException selection / extraction / validation failure . */
public void bindToAnyDelegationToken ( ) throws IOException { } } | validateAccessTokenProvider ( ) ; Token < DelegationTokenIdentifier > token = selectTokenFromFsOwner ( ) ; if ( token != null ) { bindToDelegationToken ( token ) ; } else { deployUnbonded ( ) ; } if ( accessTokenProvider == null ) { throw new DelegationTokenIOException ( "No AccessTokenProvider created by Delegation Token Binding " + tokenBinding . getKind ( ) ) ; } |
public class SmoothRateLimiter { /** * Updates { @ code storedPermits } and { @ code nextFreeTicketMicros } based on the current time . */
void resync ( long nowMicros ) { } } | // if nextFreeTicket is in the past , resync to now
if ( nowMicros > nextFreeTicketMicros ) { storedPermits = min ( maxPermits , storedPermits + ( nowMicros - nextFreeTicketMicros ) / coolDownIntervalMicros ( ) ) ; nextFreeTicketMicros = nowMicros ; } |
public class RepositoryChainLogPathHelper { /** * Will be returned relative path { name } / { name } . xml for all OS .
* @ param path
* String , path to
* @ param backupDirCanonicalPath
* String , path to backup dir
* @ return String
* Will be returned relative path { name } / { name } . xml for all OS
* @ throws MalformedURLException */
public static String getRelativePath ( String path , String backupDirCanonicalPath ) throws MalformedURLException { } } | URL urlPath = new URL ( resolveFileURL ( "file:" + path ) ) ; URL urlBackupDir = new URL ( resolveFileURL ( "file:" + backupDirCanonicalPath ) ) ; return urlPath . toString ( ) . replace ( urlBackupDir . toString ( ) + "/" , "" ) ; |
public class Scale { /** * Sets the starting scale .
* @ param x the x
* @ param y the y
* @ param z the z
* @ return the scale */
protected Scale from ( float x , float y , float z ) { } } | fromX = x ; fromY = y ; fromZ = z ; return this ; |
public class GetAuthorizerRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetAuthorizerRequest getAuthorizerRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getAuthorizerRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getAuthorizerRequest . getApiId ( ) , APIID_BINDING ) ; protocolMarshaller . marshall ( getAuthorizerRequest . getAuthorizerId ( ) , AUTHORIZERID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class IpUtil { /** * 通过ip获取位置
* @ param ip ip地址
* @ return ( 国家 ) ( 地区 ) ( 省份 ) ( 城市 ) ( 县级 ) ( 运营商 )
* @ throws IOException io异常 */
public static String getPosition ( String ip ) throws IOException { } } | JSONObject jsonObject = getIpInfo ( ip ) ; if ( jsonObject != null ) { String country = jsonObject . get ( "country" ) . toString ( ) ; String area = jsonObject . get ( "area" ) . toString ( ) ; String region = jsonObject . get ( "region" ) . toString ( ) ; String city = jsonObject . get ( "city" ) . toString ( ) ; String county = jsonObject . get ( "county" ) . toString ( ) ; String isp = jsonObject . get ( "isp" ) . toString ( ) ; return country + area + region + city + county + isp ; } return null ; |
public class YamlUtils { /** * returns null for empty */
public static Map < String , Object > getYamlObjectValue ( Map < String , Object > yamlObject , String key , boolean allowsEmpty ) throws YamlConvertException { } } | Object obj = getObjectValue ( yamlObject , key , allowsEmpty ) ; @ SuppressWarnings ( "unchecked" ) Map < String , Object > result = ( Map < String , Object > ) obj ; return result ; |
public class CmsSearchWorkplaceBean { /** * Sets the query . < p >
* @ param query the query to set */
public void setQuery ( String query ) { } } | if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( query ) ) { throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . ERR_VALIDATE_SEARCH_QUERY_0 ) ) ; } m_query = query ; |
public class UNode { /** * Get the list of child nodes of this collection UNode as an Iterable UNode object .
* The UNode must be a MAP or an ARRAY .
* @ return An Iterable UNode object that iterates through this node ' s children . The
* result will never be null , but there might not be any child nodes . */
public Iterable < UNode > getMemberList ( ) { } } | assert m_type == NodeType . MAP || m_type == NodeType . ARRAY ; if ( m_children == null ) { m_children = new ArrayList < UNode > ( ) ; } return m_children ; |
public class StringUtils { /** * Returns given string with its first letter in uppercase . */
public static @ NotNull String capitalize ( @ NotNull String s ) { } } | return s . isEmpty ( ) ? s : ( toUpperCase ( s . charAt ( 0 ) ) + s . substring ( 1 ) ) ; |
public class SipApplicationSessionActivationListenerAttribute { /** * / * ( non - Javadoc )
* @ see javax . servlet . sip . SipApplicationSessionActivationListener # sessionDidActivate ( javax . servlet . sip . SipApplicationSessionEvent ) */
public void sessionDidActivate ( SipApplicationSessionEvent event ) { } } | logger . info ( "Following sip application session just activated " + event . getApplicationSession ( ) . getId ( ) + " cause " + ( ( SipApplicationSessionActivationEvent ) event ) . getCause ( ) ) ; if ( ( ( SipApplicationSessionActivationEvent ) event ) . getCause ( ) == SessionActivationNotificationCause . FAILOVER ) { event . getApplicationSession ( ) . setAttribute ( SIP_APPLICATION_SESSION_ACTIVATED , "true" ) ; } |
public class Switch { /** * Animate the switch . Default value : true .
* @ return Returns the value of the attribute , or null , if it hasn ' t been
* set by the JSF file . */
public boolean isAnimate ( ) { } } | Boolean value = ( Boolean ) getStateHelper ( ) . eval ( PropertyKeys . animate , false ) ; return ( boolean ) value ; |
public class ChainingSecurityContext { /** * be returned in the order they appeared in the properties file . */
@ Override public synchronized Enumeration getSubContexts ( ) { } } | Enumeration e = mySubContexts . elements ( ) ; class Adapter implements Enumeration { Enumeration base ; public Adapter ( Enumeration e ) { this . base = e ; } @ Override public boolean hasMoreElements ( ) { return base . hasMoreElements ( ) ; } @ Override public Object nextElement ( ) { return ( ( Entry ) base . nextElement ( ) ) . getCtx ( ) ; } } return new Adapter ( e ) ; |
public class Util { /** * Get boolean type property value from a property map .
* If { @ code properties } is null or property value is null , default value is returned
* @ param properties map of properties
* @ param key property name
* @ param defaultVal default value of the property
* @ return integer value of the property , */
public static Boolean getBooleanProperty ( Map < String , Object > properties , String key , boolean defaultVal ) { } } | if ( properties == null ) { return defaultVal ; } Object propertyVal = properties . get ( key ) ; if ( propertyVal == null ) { return defaultVal ; } if ( ! ( propertyVal instanceof Boolean ) ) { throw new IllegalArgumentException ( "Property : " + key + " must be a boolean" ) ; } return ( Boolean ) propertyVal ; |
public class NfsWccData { /** * Extracts the post - operation attributes .
* @ param xdr
* @ return The attributes . */
private static NfsGetAttributes makeAttributes ( Xdr xdr ) { } } | NfsGetAttributes attributes = null ; if ( xdr != null ) { attributes = NfsResponseBase . makeNfsGetAttributes ( xdr ) ; } return attributes ; |
public class LNGBooleanVector { /** * Ensures that this vector has the given size . If not - the size is doubled and the old elements are copied .
* @ param newSize the size to ensure */
private void ensure ( final int newSize ) { } } | if ( newSize >= this . elements . length ) { final boolean [ ] newArray = new boolean [ Math . max ( newSize , this . size * 2 ) ] ; System . arraycopy ( this . elements , 0 , newArray , 0 , this . size ) ; this . elements = newArray ; } |
public class SamlSettingsApi { /** * Get SAML state .
* Returns SAML current state .
* @ return ApiResponse & lt ; GetEnabledResponse & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < GetEnabledResponse > getEnabledWithHttpInfo ( ) throws ApiException { } } | com . squareup . okhttp . Call call = getEnabledValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetEnabledResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class Vector3f { /** * / * ( non - Javadoc )
* @ see org . joml . Vector3fc # mul ( float , org . joml . Vector3f ) */
public Vector3f mul ( float scalar , Vector3f dest ) { } } | dest . x = x * scalar ; dest . y = y * scalar ; dest . z = z * scalar ; return dest ; |
public class CharsetEncoder { /** * Tells whether or not this encoder can encode the given character
* sequence .
* < p > If this method returns < tt > false < / tt > for a particular character
* sequence then more information about why the sequence cannot be encoded
* may be obtained by performing a full < a href = " # steps " > encoding
* operation < / a > .
* < p > This method may modify this encoder ' s state ; it should therefore not
* be invoked if an encoding operation is already in progress .
* < p > The default implementation of this method is not very efficient ; it
* should generally be overridden to improve performance . < / p >
* @ return < tt > true < / tt > if , and only if , this encoder can encode
* the given character without throwing any exceptions and without
* performing any replacements
* @ throws IllegalStateException
* If an encoding operation is already in progress */
public boolean canEncode ( CharSequence cs ) { } } | CharBuffer cb ; if ( cs instanceof CharBuffer ) cb = ( ( CharBuffer ) cs ) . duplicate ( ) ; else cb = CharBuffer . wrap ( cs ) ; return canEncode ( cb ) ; |
public class ClassInfo { /** * Get the names of any classes referenced in this class ' type descriptor , or the type descriptors of fields ,
* methods or annotations .
* @ param referencedClassNames
* the referenced class names */
@ Override protected void findReferencedClassNames ( final Set < String > referencedClassNames ) { } } | if ( this . referencedClassNames != null ) { referencedClassNames . addAll ( this . referencedClassNames ) ; } getMethodInfo ( ) . findReferencedClassNames ( referencedClassNames ) ; getFieldInfo ( ) . findReferencedClassNames ( referencedClassNames ) ; getAnnotationInfo ( ) . findReferencedClassNames ( referencedClassNames ) ; if ( annotationDefaultParamValues != null ) { annotationDefaultParamValues . findReferencedClassNames ( referencedClassNames ) ; } final ClassTypeSignature classSig = getTypeSignature ( ) ; if ( classSig != null ) { classSig . findReferencedClassNames ( referencedClassNames ) ; } // Remove any self - references
referencedClassNames . remove ( name ) ; |
public class ReferenceField { /** * Display a button that shows the icon from the current record in the secondary file . */
public ScreenComponent setupIconView ( ScreenLoc itsLocation , ComponentParent targetScreen , Convert converter , int iDisplayFieldDesc , boolean bIncludeBlankOption ) { } } | ScreenComponent screenField = null ; Record record = this . makeReferenceRecord ( ) ; // Set up the listener to read the current record on a valid main record
ImageField fldDisplayFieldDesc = this . getIconField ( record ) ; if ( fldDisplayFieldDesc . getListener ( BlankButtonHandler . class ) == null ) fldDisplayFieldDesc . addListener ( new BlankButtonHandler ( null ) ) ; if ( fldDisplayFieldDesc != null ) { // The next two lines are so in GridScreen ( s ) , the converter leads to this field , while it displays the fielddesc .
FieldConverter fldDescConverter = new FieldDescConverter ( fldDisplayFieldDesc , ( Converter ) converter ) ; Map < String , Object > properties = new HashMap < String , Object > ( ) ; properties . put ( ScreenModel . IMAGE , ScreenModel . NONE ) ; properties . put ( ScreenModel . NEVER_DISABLE , Constants . TRUE ) ; screenField = createScreenComponent ( ScreenModel . BUTTON_BOX , itsLocation , targetScreen , fldDescConverter , iDisplayFieldDesc , properties ) ; // ? public void setEnabled ( boolean bEnabled )
// ? super . setEnabled ( true ) ; / / Never disable
String strDisplay = converter . getFieldDesc ( ) ; if ( ! ( targetScreen instanceof GridScreenParent ) ) if ( ( strDisplay != null ) && ( strDisplay . length ( ) > 0 ) ) { // Since display string does not come with buttons
ScreenLoc descLocation = targetScreen . getNextLocation ( ScreenConstants . FIELD_DESC , ScreenConstants . DONT_SET_ANCHOR ) ; properties = new HashMap < String , Object > ( ) ; properties . put ( ScreenModel . DISPLAY_STRING , strDisplay ) ; createScreenComponent ( ScreenModel . STATIC_STRING , descLocation , targetScreen , converter , iDisplayFieldDesc , properties ) ; } } if ( ( ( targetScreen instanceof GridScreenParent ) ) || ( iDisplayFieldDesc == ScreenConstants . DONT_DISPLAY_FIELD_DESC ) ) { // If there is no popupbox to display the icon , I must explicitly read it .
this . addListener ( new ReadSecondaryHandler ( fldDisplayFieldDesc . getRecord ( ) ) ) ; } return screenField ; |
public class Rx2Apollo { /** * Converts an { @ link ApolloStoreOperation } to a Single .
* @ param operation the ApolloStoreOperation to convert
* @ param < T > the value type
* @ return the converted Single */
@ NotNull public static < T > Single < T > from ( @ NotNull final ApolloStoreOperation < T > operation ) { } } | checkNotNull ( operation , "operation == null" ) ; return Single . create ( new SingleOnSubscribe < T > ( ) { @ Override public void subscribe ( final SingleEmitter < T > emitter ) { operation . enqueue ( new ApolloStoreOperation . Callback < T > ( ) { @ Override public void onSuccess ( T result ) { emitter . onSuccess ( result ) ; } @ Override public void onFailure ( Throwable t ) { emitter . onError ( t ) ; } } ) ; } } ) ; |
public class ApiOvhLicensedirectadmin { /** * Change the Operating System for a license
* REST : POST / license / directadmin / { serviceName } / changeOs
* @ param os [ required ] The operating system you want for this license
* @ param serviceName [ required ] The name of your DirectAdmin license */
public OvhTask serviceName_changeOs_POST ( String serviceName , OvhDirectAdminOsEnum os ) throws IOException { } } | String qPath = "/license/directadmin/{serviceName}/changeOs" ; StringBuilder sb = path ( qPath , serviceName ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "os" , os ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhTask . class ) ; |
public class ByteUtil { /** * Splits the source array into multiple array segments using the given
* separator , up to a maximum of count items . This will naturally produce
* copied byte arrays for each of the split segments . To identify the split
* ranges without the array copies , see
* { @ link ByteUtil # splitRanges ( byte [ ] , byte [ ] ) } .
* @ param source
* @ param separator
* @ return */
public static byte [ ] [ ] split ( byte [ ] source , byte [ ] separator , int limit ) { } } | List < Range > segments = splitRanges ( source , separator , limit ) ; byte [ ] [ ] splits = new byte [ segments . size ( ) ] [ ] ; for ( int i = 0 ; i < segments . size ( ) ; i ++ ) { Range r = segments . get ( i ) ; byte [ ] tmp = new byte [ r . length ( ) ] ; if ( tmp . length > 0 ) { System . arraycopy ( source , r . start ( ) , tmp , 0 , r . length ( ) ) ; } splits [ i ] = tmp ; } return splits ; |
public class FactoryMotion2D { /** * Estimates the image motion then combines images together . Typically used for mosaics and stabilization .
* @ param maxJumpFraction If the area changes by this much between two consecuative frames then the transform
* is reset .
* @ param motion2D Estimates the image motion .
* @ param imageType Type of image processed
* @ param < I > Image input type .
* @ param < IT > Model model
* @ return StitchingFromMotion2D */
@ SuppressWarnings ( "unchecked" ) public static < I extends ImageBase < I > , IT extends InvertibleTransform > StitchingFromMotion2D < I , IT > createVideoStitch ( double maxJumpFraction , ImageMotion2D < I , IT > motion2D , ImageType < I > imageType ) { } } | StitchingTransform < IT > transform ; if ( motion2D . getTransformType ( ) == Affine2D_F64 . class ) { transform = ( StitchingTransform ) FactoryStitchingTransform . createAffine_F64 ( ) ; } else { transform = ( StitchingTransform ) FactoryStitchingTransform . createHomography_F64 ( ) ; } InterpolatePixel < I > interp ; if ( imageType . getFamily ( ) == ImageType . Family . GRAY || imageType . getFamily ( ) == ImageType . Family . PLANAR ) { interp = FactoryInterpolation . createPixelS ( 0 , 255 , InterpolationType . BILINEAR , BorderType . EXTENDED , imageType . getImageClass ( ) ) ; } else { throw new IllegalArgumentException ( "Unsupported image type" ) ; } ImageDistort < I , I > distorter = FactoryDistort . distort ( false , interp , imageType ) ; distorter . setRenderAll ( false ) ; return new StitchingFromMotion2D < > ( motion2D , distorter , transform , maxJumpFraction ) ; |
public class FacebookRestClient { /** * Retrieves the groups associated with a user
* @ param userId Optional : User associated with groups .
* A null parameter will default to the session user .
* @ param groupIds Optional : group ids to query .
* A null parameter will get all groups for the user .
* @ return array of groups */
public T groups_get ( Integer userId , Collection < Long > groupIds ) throws FacebookException , IOException { } } | boolean hasGroups = ( null != groupIds && ! groupIds . isEmpty ( ) ) ; if ( null != userId ) return hasGroups ? this . callMethod ( FacebookMethod . GROUPS_GET , new Pair < String , CharSequence > ( "uid" , userId . toString ( ) ) , new Pair < String , CharSequence > ( "gids" , delimit ( groupIds ) ) ) : this . callMethod ( FacebookMethod . GROUPS_GET , new Pair < String , CharSequence > ( "uid" , userId . toString ( ) ) ) ; else return hasGroups ? this . callMethod ( FacebookMethod . GROUPS_GET , new Pair < String , CharSequence > ( "gids" , delimit ( groupIds ) ) ) : this . callMethod ( FacebookMethod . GROUPS_GET ) ; |
public class Scope { /** * Uninitialize scope and unregister from parent . */
public void uninit ( ) { } } | log . debug ( "Un-init scope" ) ; for ( IBasicScope child : children . keySet ( ) ) { if ( child instanceof Scope ) { ( ( Scope ) child ) . uninit ( ) ; } } stop ( ) ; setEnabled ( false ) ; if ( hasParent ( ) ) { if ( parent . hasChildScope ( name ) ) { parent . removeChildScope ( this ) ; } } |
public class Tr { /** * Print the provided trace point if the input trace component allows entry
* level messages .
* @ param tc
* the non - null < code > TraceComponent < / code > the event is
* associated with .
* @ param methodName
* @ param objs
* a variable number ( zero to n ) of < code > Objects < / code > .
* toString ( ) is called on each object and the results are
* appended to the message . */
public static final void entry ( TraceComponent tc , String methodName , Object ... objs ) { } } | TrConfigurator . getDelegate ( ) . entry ( tc , methodName , objs ) ; |
public class StockholmFileParser { /** * Parses a Stockholm file and returns a { @ link StockholmStructure } object with its content . < br >
* This function is meant to be used for single access to specific file and it closes the file after doing its
* assigned job . Any subsequent call to { @ link # parseNext ( int ) } will throw an exception or will function with
* unpredicted behavior .
* @ param filename
* complete ( ? ) path to the file from where to read the content
* @ return stockholm file content
* @ throws IOException
* when an exception occurred while opening / reading / closing the file +
* @ throws ParserException
* if unexpected format is encountered */
public StockholmStructure parse ( String filename ) throws IOException , ParserException { } } | InputStream inStream = new InputStreamProvider ( ) . getInputStream ( filename ) ; StockholmStructure structure = parse ( inStream ) ; inStream . close ( ) ; return structure ; |
public class CachingPersonAttributeDaoImpl { /** * / * ( non - Javadoc )
* @ see org . jasig . services . persondir . IPersonAttributeDao # getAvailableQueryAttributes ( ) */
@ Override @ JsonIgnore public Set < String > getAvailableQueryAttributes ( final IPersonAttributeDaoFilter filter ) { } } | return this . cachedPersonAttributesDao . getAvailableQueryAttributes ( filter ) ; |
public class ComputeSignatureV4 { /** * Computes the AWS Signature Version 4 used to authenticate requests by using the authorization header .
* For this signature type the checksum of the entire payload is computed .
* Note : The " authorizationHeader " output ' s value should be added in the " Authorization " header .
* @ param endpoint Service endpoint used to compute the signature . Ex . : " ec2 . amazonaws . com " , " s3 . amazonaws . com "
* Default : " ec2 . amazonaws . com "
* @ param identity ID of the secret access key associated with your Amazon AWS or IAM account .
* @ param credential Secret access key associated with your Amazon AWS or IAM account .
* @ param amazonApi Amazon API corresponding to where the request is send .
* Examples : " ec2 " , " s3"
* @ param uri request ' s relative URI . The URI should be from the service endpoint to the query params .
* Default : " / "
* @ param httpVerb Method used for the request . You need to specify this with upper case .
* Valid values : GET , DELETE , HEAD , POST , PUT
* Default : GET
* @ param payloadHash Payload ' s hash that will be included in the signature . The hashing should be computed using
* the " SHA - 256 " hashing algorithm and then hex encoded .
* @ param securityToken URI - encoded session token . The string you received from AWS STS when you obtained temporary
* security credentials .
* @ param date Date of the request . The date should be also included in the " x - amz - date " header and should
* be in the in the YYYYMMDD ' T ' HHMMSS ' Z ' format form UTC time zone .
* Example : 20150416T112043Z for April 16 , 2015 11:20:43 AM UTC
* Default : The current date and time in UTC time zone
* @ param headers String containing the headers to use for the request separated by new line ( CRLF ) . The header
* name - value pair will be separated by " : " .
* Format : Conforming with HTTP standard for headers ( RFC 2616)
* Examples : Accept : text / plain
* @ param queryParams String containing query parameters that will be appended to the URL . The names and the values
* must not be URL encoded because if they are encoded then a double encoded will occur . The
* separator between name - value pairs is " & " symbol . The query name will be separated from query
* value by " = "
* Examples : parameterName1 = parameterValue1 & parameterName2 = parameterValue2;
* @ param prefix Optional - used to sign request for Simple Storage Service ( S3 ) . This prefix will precede the
* endpoint when made calls for specific bucket ( for e . g . if prefix is " mybucket " then the endpoint
* where the request are made will be " mybucket . s3 . amazonaws . com " )
* Default : " "
* @ return A map , with strings as keys and values , that contains : outcome of the action , returnCode of the operation
* or failure message , the exception if there is one , signature value and authorization header value */
@ Action ( name = "Compute Signature V4" , outputs = { } } | @ Output ( Outputs . RETURN_CODE ) , @ Output ( Outputs . RETURN_RESULT ) , @ Output ( Outputs . EXCEPTION ) , @ Output ( SIGNATURE_RESULT ) , @ Output ( AUTHORIZATION_HEADER_RESULT ) } , responses = { @ Response ( text = Outputs . SUCCESS , field = Outputs . RETURN_CODE , value = Outputs . SUCCESS_RETURN_CODE , matchType = MatchType . COMPARE_EQUAL , responseType = ResponseType . RESOLVED ) , @ Response ( text = Outputs . FAILURE , field = Outputs . RETURN_CODE , value = Outputs . FAILURE_RETURN_CODE , matchType = MatchType . COMPARE_EQUAL , responseType = ResponseType . ERROR , isOnFail = true ) } ) public Map < String , String > execute ( @ Param ( value = ENDPOINT ) String endpoint , @ Param ( value = IDENTITY , required = true ) String identity , @ Param ( value = CREDENTIAL , required = true , encrypted = true ) String credential , @ Param ( value = HEADERS ) String headers , @ Param ( value = QUERY_PARAMS ) String queryParams , @ Param ( value = AMAZON_API ) String amazonApi , @ Param ( value = URI ) String uri , @ Param ( value = HTTP_VERB ) String httpVerb , @ Param ( value = PAYLOAD_HASH ) String payloadHash , @ Param ( value = DATE ) String date , @ Param ( value = SECURITY_TOKEN ) String securityToken , @ Param ( value = PREFIX ) String prefix ) { try { Map < String , String > headersMap = getHeadersOrQueryParamsMap ( new HashMap < String , String > ( ) , headers , HEADER_DELIMITER , COLON , true ) ; Map < String , String > queryParamsMap = getHeadersOrQueryParamsMap ( new HashMap < String , String > ( ) , queryParams , AMPERSAND , EQUAL , false ) ; CommonInputs commonInputs = new CommonInputs . Builder ( ) . withEndpoint ( endpoint , amazonApi , prefix ) . withIdentity ( identity ) . withCredential ( credential ) . build ( ) ; InputsWrapper wrapper = new InputsWrapper . Builder ( ) . withCommonInputs ( commonInputs ) . withApiService ( amazonApi ) . withRequestUri ( uri ) . withHttpVerb ( httpVerb ) . withRequestPayload ( payloadHash ) . withDate ( date ) . withHeaders ( headers ) . withQueryParams ( queryParams ) . withSecurityToken ( securityToken ) . build ( ) ; AuthorizationHeader authorizationHeader = new AmazonSignatureService ( ) . signRequestHeaders ( wrapper , headersMap , queryParamsMap ) ; return OutputsUtil . populateSignatureResultsMap ( authorizationHeader ) ; } catch ( Exception exception ) { return ExceptionProcessor . getExceptionResult ( exception ) ; } |
public class Element { /** * Maintains a shadow copy of this element ' s child elements . If the nodelist is changed , this cache is invalidated .
* TODO - think about pulling this out as a helper as there are other shadow lists ( like in Attributes ) kept around .
* @ return a list of child elements */
private List < Element > childElementsList ( ) { } } | List < Element > children ; if ( shadowChildrenRef == null || ( children = shadowChildrenRef . get ( ) ) == null ) { final int size = childNodes . size ( ) ; children = new ArrayList < > ( size ) ; // noinspection ForLoopReplaceableByForEach ( beacause it allocates an Iterator which is wasteful here )
for ( int i = 0 ; i < size ; i ++ ) { final Node node = childNodes . get ( i ) ; if ( node instanceof Element ) children . add ( ( Element ) node ) ; } shadowChildrenRef = new WeakReference < > ( children ) ; } return children ; |
public class ExcelUtils { /** * 多sheet数据导出 */
private Workbook exportExcelNoTemplateHandler ( List < NoTemplateSheetWrapper > sheetWrappers , boolean isXSSF ) throws Excel4JException { } } | Workbook workbook ; if ( isXSSF ) { workbook = new XSSFWorkbook ( ) ; } else { workbook = new HSSFWorkbook ( ) ; } // 导出sheet
for ( NoTemplateSheetWrapper sheet : sheetWrappers ) { generateSheet ( workbook , sheet . getData ( ) , sheet . getClazz ( ) , sheet . isWriteHeader ( ) , sheet . getSheetName ( ) ) ; } return workbook ; |
public class MPD9AbstractReader { /** * Read task baseline values .
* @ param row result set row */
protected void processTaskBaseline ( Row row ) { } } | Integer id = row . getInteger ( "TASK_UID" ) ; Task task = m_project . getTaskByUniqueID ( id ) ; if ( task != null ) { int index = row . getInt ( "TB_BASE_NUM" ) ; task . setBaselineDuration ( index , MPDUtility . getAdjustedDuration ( m_project , row . getInt ( "TB_BASE_DUR" ) , MPDUtility . getDurationTimeUnits ( row . getInt ( "TB_BASE_DUR_FMT" ) ) ) ) ; task . setBaselineStart ( index , row . getDate ( "TB_BASE_START" ) ) ; task . setBaselineFinish ( index , row . getDate ( "TB_BASE_FINISH" ) ) ; task . setBaselineWork ( index , row . getDuration ( "TB_BASE_WORK" ) ) ; task . setBaselineCost ( index , row . getCurrency ( "TB_BASE_COST" ) ) ; } |
public class NumFailedFlowMetric { /** * Listen for events to maintain correct value of number of failed flows { @ inheritDoc }
* @ see azkaban . event . EventListener # handleEvent ( azkaban . event . Event ) */
@ Override public synchronized void handleEvent ( final Event event ) { } } | if ( event . getType ( ) == EventType . FLOW_FINISHED ) { final FlowRunner runner = ( FlowRunner ) event . getRunner ( ) ; if ( runner != null && runner . getExecutableFlow ( ) . getStatus ( ) . equals ( Status . FAILED ) ) { this . value = this . value + 1 ; } } |
public class PlayEngine { /** * Connects to the data provider .
* @ param itemName
* name of the item to play */
private final void connectToProvider ( String itemName ) { } } | log . debug ( "Attempting connection to {}" , itemName ) ; IMessageInput in = msgInReference . get ( ) ; if ( in == null ) { in = providerService . getLiveProviderInput ( subscriberStream . getScope ( ) , itemName , true ) ; msgInReference . set ( in ) ; } if ( in != null ) { log . debug ( "Provider: {}" , msgInReference . get ( ) ) ; if ( in . subscribe ( this , null ) ) { log . debug ( "Subscribed to {} provider" , itemName ) ; // execute the processes to get Live playback setup
try { playLive ( ) ; } catch ( IOException e ) { log . warn ( "Could not play live stream: {}" , itemName , e ) ; } } else { log . warn ( "Subscribe to {} provider failed" , itemName ) ; } } else { log . warn ( "Provider was not found for {}" , itemName ) ; StreamService . sendNetStreamStatus ( subscriberStream . getConnection ( ) , StatusCodes . NS_PLAY_STREAMNOTFOUND , "Stream was not found" , itemName , Status . ERROR , streamId ) ; } |
public class FacesServletMapping { /** * Creates a new FacesServletMapping object using extension mapping .
* @ param path The extension ( " . jsf " , for example ) which has been
* specified in the url - pattern of the FacesServlet mapping .
* @ return a newly created FacesServletMapping */
public static FacesServletMapping createExtensionMapping ( String extension ) { } } | FacesServletMapping mapping = new FacesServletMapping ( ) ; mapping . setExtension ( extension ) ; return mapping ; |
public class Nfs3 { /** * / * ( non - Javadoc )
* @ see com . emc . ecs . nfsclient . nfs . Nfs # getFsStat ( com . emc . ecs . nfsclient . nfs . NfsFsStatRequest ) */
public Nfs3FsStatResponse getFsStat ( NfsFsStatRequest request ) throws IOException { } } | Nfs3FsStatResponse response = new Nfs3FsStatResponse ( ) ; _rpcWrapper . callRpcNaked ( request , response ) ; return response ; |
public class CreateNotificationSubscriptionRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateNotificationSubscriptionRequest createNotificationSubscriptionRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createNotificationSubscriptionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createNotificationSubscriptionRequest . getOrganizationId ( ) , ORGANIZATIONID_BINDING ) ; protocolMarshaller . marshall ( createNotificationSubscriptionRequest . getEndpoint ( ) , ENDPOINT_BINDING ) ; protocolMarshaller . marshall ( createNotificationSubscriptionRequest . getProtocol ( ) , PROTOCOL_BINDING ) ; protocolMarshaller . marshall ( createNotificationSubscriptionRequest . getSubscriptionType ( ) , SUBSCRIPTIONTYPE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class VerboseFormatter { /** * Append date .
* @ param message The message builder . */
private static void appendDate ( StringBuilder message ) { } } | final String date = DATE_TIME_FORMAT . format ( Calendar . getInstance ( ) . getTime ( ) ) ; message . append ( date ) ; message . append ( Constant . SPACE ) ; |
public class PP20 { /** * Read a big - endian 32 - bit word from four bytes in memory . No
* endian - specific optimizations applied .
* @ param ptr
* @ param pos
* @ return */
int /* udword _ ppt */
readBEdword ( final short [ ] /* ubyte _ ppt [ 4] */
ptr , int pos ) { } } | return ( ( ( ( ( short /* udword _ ppt */
) ptr [ pos + 0 ] ) << 24 ) + ( ( ( short /* udword _ ppt */
) ptr [ pos + 1 ] ) << 16 ) + ( ( ( short /* udword _ ppt */
) ptr [ pos + 2 ] ) << 8 ) + ( ( short /* udword _ ppt */
) ptr [ pos + 3 ] ) ) << 0 ) ; |
public class SipStandardContextValve { /** * Select the appropriate child Wrapper to process this request ,
* based on the specified request URI . If no matching Wrapper can
* be found , return an appropriate HTTP error .
* @ param request Request to be processed
* @ param response Response to be produced
* @ param valveContext Valve context used to forward to the next Valve
* @ exception IOException if an input / output error occurred
* @ exception ServletException if a servlet error occurred */
public final void invoke ( Request request , Response response ) throws IOException , ServletException { } } | // Disallow any direct access to resources under WEB - INF or META - INF
MessageBytes requestPathMB = request . getRequestPathMB ( ) ; if ( ( requestPathMB . startsWithIgnoreCase ( "/META-INF/" , 0 ) ) || ( requestPathMB . equalsIgnoreCase ( "/META-INF" ) ) || ( requestPathMB . startsWithIgnoreCase ( "/WEB-INF/" , 0 ) ) || ( requestPathMB . equalsIgnoreCase ( "/WEB-INF" ) ) ) { notFound ( response ) ; return ; } // Wait if we are reloading
boolean reloaded = false ; while ( context . getPaused ( ) ) { reloaded = true ; try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException e ) { ; } } // Reloading will have stopped the old webappclassloader and
// created a new one
if ( reloaded && context . getLoader ( ) != null && context . getLoader ( ) . getClassLoader ( ) != null ) { Thread . currentThread ( ) . setContextClassLoader ( context . getLoader ( ) . getClassLoader ( ) ) ; } // Select the Wrapper to be used for this Request
Wrapper wrapper = request . getWrapper ( ) ; if ( wrapper == null ) { notFound ( response ) ; return ; } else if ( wrapper . isUnavailable ( ) ) { // May be as a result of a reload , try and find the new wrapper
wrapper = ( Wrapper ) container . findChild ( wrapper . getName ( ) ) ; if ( wrapper == null ) { notFound ( response ) ; return ; } } // Acknowledge the request
try { response . sendAcknowledgement ( ) ; } catch ( IOException ioe ) { container . getLogger ( ) . error ( MESSAGES . errorAcknowledgingRequest ( "standardContextValve.acknowledgeException" ) , ioe ) ; request . setAttribute ( RequestDispatcher . ERROR_EXCEPTION , ioe ) ; response . sendError ( HttpServletResponse . SC_INTERNAL_SERVER_ERROR ) ; return ; } // Normal request processing
Object instances [ ] = context . getApplicationEventListeners ( ) ; ServletRequestEvent event = null ; if ( ( instances != null ) && ( instances . length > 0 ) ) { event = new ServletRequestEvent ( ( ( StandardContext ) container ) . getServletContext ( ) , request . getRequest ( ) ) ; // create pre - service event
for ( int i = 0 ; i < instances . length ; i ++ ) { if ( instances [ i ] == null ) continue ; if ( ! ( instances [ i ] instanceof ServletRequestListener ) ) continue ; ServletRequestListener listener = ( ServletRequestListener ) instances [ i ] ; try { listener . requestInitialized ( event ) ; } catch ( Throwable t ) { container . getLogger ( ) . error ( MESSAGES . requestListenerInitException ( instances [ i ] . getClass ( ) . getName ( ) ) , t ) ; ServletRequest sreq = request . getRequest ( ) ; sreq . setAttribute ( RequestDispatcher . ERROR_EXCEPTION , t ) ; return ; } } } boolean batchStarted = context . enterSipAppHa ( false ) ; // the line below was replaced by the whole bunch of code because getting the parameter from the request is causing
// JRuby - Rails persistence to fail , go figure . . .
// String sipApplicationKey = request . getParameter ( MobicentsSipApplicationSession . SIP _ APPLICATION _ KEY _ PARAM _ NAME ) ;
String sipApplicationKey = null ; String queryString = request . getQueryString ( ) ; if ( queryString != null ) { int indexOfSipAppKey = queryString . indexOf ( MobicentsSipApplicationSession . SIP_APPLICATION_KEY_PARAM_NAME ) ; if ( indexOfSipAppKey != - 1 ) { // + 1 to remove the = sign also
String sipAppKeyParam = queryString . substring ( indexOfSipAppKey + MobicentsSipApplicationSession . SIP_APPLICATION_KEY_PARAM_NAME . length ( ) + 1 ) ; int indexOfPoundSign = sipAppKeyParam . indexOf ( "&" ) ; if ( indexOfPoundSign != - 1 ) { sipAppKeyParam = sipAppKeyParam . substring ( 0 , indexOfPoundSign ) ; } sipApplicationKey = sipAppKeyParam ; } } MobicentsSipApplicationSession sipApplicationSessionImpl = null ; if ( sipApplicationKey != null && sipApplicationKey . length ( ) > 0 ) { try { SipApplicationSessionKey sipApplicationSessionKey = SessionManagerUtil . parseSipApplicationSessionKey ( sipApplicationKey ) ; sipApplicationSessionImpl = ( ( SipManager ) context . getManager ( ) ) . getSipApplicationSession ( sipApplicationSessionKey , false ) ; sipApplicationSessionImpl . addHttpSession ( request . getSession ( ) ) ; } catch ( ParseException pe ) { logger . error ( "Unexpected exception while parsing the sip application session key" + sipApplicationKey , pe ) ; } } else { // Fix for Issue 882 : HTTP requests to a SIP application always create an HTTP session , even for static resources
// Don ' t create an http session if not already created
final HttpSession httpSession = request . getSession ( false ) ; if ( httpSession != null ) { context . getSipFactoryFacade ( ) . storeHttpSession ( httpSession ) ; ConvergedSession convergedSession = ( ConvergedSession ) httpSession ; sipApplicationSessionImpl = convergedSession . getApplicationSession ( false ) ; } } // Fix for http : / / code . google . com / p / mobicents / issues / detail ? id = 1386 :
// Ensure SipApplicationSession concurrency control on converged HTTP apps
context . enterSipApp ( sipApplicationSessionImpl , null , false , true ) ; try { wrapper . getPipeline ( ) . getFirst ( ) . invoke ( request , response ) ; } finally { context . exitSipApp ( sipApplicationSessionImpl , null ) ; context . exitSipAppHa ( null , null , batchStarted ) ; } // Fix for Issue 882 : remove the http session from the thread local to avoid any leaking of the session
context . getSipFactoryFacade ( ) . removeHttpSession ( ) ; if ( ( instances != null ) && ( instances . length > 0 ) ) { // create post - service event
for ( int i = 0 ; i < instances . length ; i ++ ) { if ( instances [ i ] == null ) continue ; if ( ! ( instances [ i ] instanceof ServletRequestListener ) ) continue ; ServletRequestListener listener = ( ServletRequestListener ) instances [ i ] ; try { listener . requestDestroyed ( event ) ; } catch ( Throwable t ) { container . getLogger ( ) . error ( MESSAGES . requestListenerDestroyException ( instances [ i ] . getClass ( ) . getName ( ) ) , t ) ; ServletRequest sreq = request . getRequest ( ) ; sreq . setAttribute ( RequestDispatcher . ERROR_EXCEPTION , t ) ; } } } |
public class TriangularSolver_DSCC { /** * < p > If ata = false then it computes the elimination tree for sparse lower triangular square matrix
* generated from Cholesky decomposition . If ata = true then it computes the elimination tree of
* A < sup > T < / sup > A without forming A < sup > T < / sup > A explicitly . In an elimination tree the parent of
* node ' i ' is ' j ' , where the first off - diagonal non - zero in column ' i ' has row index ' j ' ; j & gt ; i
* for which l [ k , i ] ! = 0 . < / p >
* < p > This tree encodes the non - zero elements in L given A , e . g . L * L ' = A , and enables faster to compute solvers
* than the general purpose implementations . < / p >
* < p > Functionally identical to cs _ etree in csparse < / p >
* @ param A ( Input ) M by N sparse upper triangular matrix . If ata is false then M = N otherwise M & ge ; N
* @ param ata If true then it computes elimination treee of A ' A without forming A ' A otherwise computes elimination
* tree for cholesky factorization
* @ param parent ( Output ) Parent of each node in tree . This is the elimination tree . - 1 if no parent . Size N .
* @ param gwork ( Optional ) Internal workspace . Can be null . */
public static void eliminationTree ( DMatrixSparseCSC A , boolean ata , int parent [ ] , @ Nullable IGrowArray gwork ) { } } | int m = A . numRows ; int n = A . numCols ; if ( parent . length < n ) throw new IllegalArgumentException ( "parent must be of length N" ) ; int [ ] work = UtilEjml . adjust ( gwork , n + ( ata ? m : 0 ) ) ; int ancestor = 0 ; // reference to index in work array
int previous = n ; // reference to index in work array
if ( ata ) { for ( int i = 0 ; i < m ; i ++ ) { work [ previous + i ] = - 1 ; } } // step through each column
for ( int k = 0 ; k < n ; k ++ ) { parent [ k ] = - 1 ; work [ ancestor + k ] = - 1 ; int idx0 = A . col_idx [ k ] ; // node k has no parent
int idx1 = A . col_idx [ k + 1 ] ; // node k has no ancestor
for ( int p = idx0 ; p < idx1 ; p ++ ) { int nz_row_p = A . nz_rows [ p ] ; int i = ata ? work [ previous + nz_row_p ] : nz_row_p ; int inext ; while ( i != - 1 && i < k ) { inext = work [ ancestor + i ] ; work [ ancestor + i ] = k ; if ( inext == - 1 ) { parent [ i ] = k ; break ; } else { i = inext ; } } if ( ata ) { work [ previous + nz_row_p ] = k ; } } } |
public class QueryEngine { /** * closes the QueryEngine , clearing the cached information are closing the AerospikeClient .
* Once the QueryEngine is closed , it cannot be used , nor can the AerospikeClient . */
@ Override public void close ( ) throws IOException { } } | if ( this . client != null ) this . client . close ( ) ; indexCache . clear ( ) ; indexCache = null ; updatePolicy = null ; insertPolicy = null ; infoPolicy = null ; queryPolicy = null ; moduleCache . clear ( ) ; moduleCache = null ; |
public class RtfFont { /** * Writes the font definition */
public void writeDefinition ( final OutputStream result ) throws IOException { } } | result . write ( FONT_FAMILY ) ; result . write ( FONT_CHARSET ) ; result . write ( intToByteArray ( charset ) ) ; result . write ( DELIMITER ) ; document . filterSpecialChar ( result , fontName , true , false ) ; |
public class TlvUtil { /** * This is just a list of Tag And Lengths ( eg DOLs ) */
public static String getFormattedTagAndLength ( final byte [ ] data , final int indentLength ) { } } | StringBuilder buf = new StringBuilder ( ) ; String indent = getSpaces ( indentLength ) ; TLVInputStream stream = new TLVInputStream ( new ByteArrayInputStream ( data ) ) ; boolean firstLine = true ; try { while ( stream . available ( ) > 0 ) { if ( firstLine ) { firstLine = false ; } else { buf . append ( "\n" ) ; } buf . append ( indent ) ; ITag tag = searchTagById ( stream . readTag ( ) ) ; int length = stream . readLength ( ) ; buf . append ( prettyPrintHex ( tag . getTagBytes ( ) ) ) ; buf . append ( " " ) ; buf . append ( String . format ( "%02x" , length ) ) ; buf . append ( " -- " ) ; buf . append ( tag . getName ( ) ) ; } } catch ( IOException e ) { LOGGER . error ( e . getMessage ( ) , e ) ; } finally { IOUtils . closeQuietly ( stream ) ; } return buf . toString ( ) ; |
public class Hosts { /** * Returns the local hostname . It loops through the network interfaces and returns the first non loopback address
* @ return
* @ throws UnknownHostException */
public static String getLocalHostName ( ) throws UnknownHostException { } } | String preffered = System . getProperty ( PREFERED_ADDRESS_PROPERTY_NAME ) ; return chooseAddress ( preffered ) . getHostName ( ) ; |
public class Wave { /** * Trim the wave data
* @ param leftTrimSecond
* Seconds trimmed from beginning
* @ param rightTrimSecond
* Seconds trimmed from ending */
public void trim ( double leftTrimSecond , double rightTrimSecond ) { } } | int sampleRate = waveHeader . getSampleRate ( ) ; int bitsPerSample = waveHeader . getBitsPerSample ( ) ; int channels = waveHeader . getChannels ( ) ; int leftTrimNumberOfSample = ( int ) ( sampleRate * bitsPerSample / 8 * channels * leftTrimSecond ) ; int rightTrimNumberOfSample = ( int ) ( sampleRate * bitsPerSample / 8 * channels * rightTrimSecond ) ; trim ( leftTrimNumberOfSample , rightTrimNumberOfSample ) ; |
public class ApplicationVersion { /** * Appends a step which is ignored within the installation of this version .
* @ param _ step ignored step
* @ see # ignoredSteps */
@ CallMethod ( pattern = "install/version/lifecyle/ignore" ) public void addIgnoredStep ( @ CallParam ( pattern = "install/version/lifecyle/ignore" , attributeName = "step" ) final String _step ) { } } | this . ignoredSteps . add ( UpdateLifecycle . valueOf ( _step . toUpperCase ( ) ) ) ; |
public class AbstractWriteHandler { /** * Handles errors from the request .
* @ param cause the exception */
public void onError ( Throwable cause ) { } } | if ( cause instanceof StatusRuntimeException && ( ( StatusRuntimeException ) cause ) . getStatus ( ) . getCode ( ) == Status . Code . CANCELLED ) { // Cancellation is already handled .
return ; } mSerializingExecutor . execute ( ( ) -> { LogUtils . warnWithException ( LOG , "Exception thrown while handling write request {}" , mContext == null ? "unknown" : mContext . getRequest ( ) , cause ) ; abort ( new Error ( AlluxioStatusException . fromThrowable ( cause ) , false ) ) ; } ) ; |
public class Case1Cases { /** * Matches a case class of one element . */
public static < T extends Case1 < A > , A > DecomposableMatchBuilder0 < T > case1 ( Class < T > clazz , MatchesExact < A > a ) { } } | List < Matcher < Object > > matchers = Lists . of ( ArgumentMatchers . eq ( a . t ) ) ; return new DecomposableMatchBuilder0 < T > ( matchers , new Case1FieldExtractor < > ( clazz ) ) ; |
public class CsvMapperImpl { /** * IFJAVA8 _ END */
@ Override public Enumerable < T > enumerate ( CsvRowSet source ) throws IOException , MappingException { } } | return setRowMapper . enumerate ( source ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.