signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class RulePrunerFactory { /** * Performs pruning .
* @ param ts the input time series .
* @ param grammarRules the grammar .
* @ return pruned ruleset . */
public static GrammarRules performPruning ( double [ ] ts , GrammarRules grammarRules ) { } } | RulePruningAlgorithm pruner = new RulePruningAlgorithm ( grammarRules , ts . length ) ; pruner . pruneRules ( ) ; return pruner . regularizePrunedRules ( ) ; |
public class CmsListMetadata { /** * Returns the html code for the multi action bar . < p >
* @ return html code */
public String htmlMultiActionBar ( ) { } } | StringBuffer html = new StringBuffer ( 1024 ) ; html . append ( "<td class='misc'>\n" ) ; html . append ( "\t<div>\n" ) ; Iterator < CmsListMultiAction > itActions = m_multiActions . elementList ( ) . iterator ( ) ; while ( itActions . hasNext ( ) ) { CmsListMultiAction multiAction = itActions . next ( ) ; html . append ( "\t\t" ) ; html . append ( multiAction . buttonHtml ( ) ) ; if ( itActions . hasNext ( ) ) { html . append ( " " ) ; } html . append ( "\n" ) ; } html . append ( "\t</div>\n" ) ; html . append ( "</td>\n" ) ; return html . toString ( ) ; |
public class CallableUtils { /** * Same as @ updateDirections but updates based not on position but on key
* @ param original QueryParameters which would be updated
* @ param source QueryParameters directions of which would be read
* @ return updated clone on @ original with updated directions */
public static QueryParameters updateDirectionsByName ( QueryParameters original , QueryParameters source ) { } } | QueryParameters updatedParams = new QueryParameters ( original ) ; if ( source != null ) { for ( String sourceKey : source . keySet ( ) ) { if ( updatedParams . containsKey ( sourceKey ) == true ) { updatedParams . updateDirection ( sourceKey , source . getDirection ( sourceKey ) ) ; } } } return updatedParams ; |
public class RequirePluginVersions { /** * Add the additional plugins if they don ' t exist yet .
* @ param existing the existing
* @ param additional the additional
* @ return the sets the
* @ throws MojoExecutionException the mojo execution exception */
public Set < Plugin > addAdditionalPlugins ( Set < Plugin > existing , List < String > additional ) throws MojoExecutionException { } } | if ( additional != null ) { for ( String pluginString : additional ) { Plugin plugin = parsePluginString ( pluginString , "AdditionalPlugins" ) ; if ( existing == null ) { existing = new HashSet < Plugin > ( ) ; existing . add ( plugin ) ; } else if ( ! existing . contains ( plugin ) ) { existing . add ( plugin ) ; } } } return existing ; |
public class ipseccounters_stats { /** * < pre >
* converts nitro response into object and returns the object array in case of get request .
* < / pre > */
protected base_resource [ ] get_nitro_response ( nitro_service service , String response ) throws Exception { } } | ipseccounters_stats [ ] resources = new ipseccounters_stats [ 1 ] ; ipseccounters_response result = ( ipseccounters_response ) service . get_payload_formatter ( ) . string_to_resource ( ipseccounters_response . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == 444 ) { service . clear_session ( ) ; } if ( result . severity != null ) { if ( result . severity . equals ( "ERROR" ) ) throw new nitro_exception ( result . message , result . errorcode ) ; } else { throw new nitro_exception ( result . message , result . errorcode ) ; } } resources [ 0 ] = result . ipseccounters ; return resources ; |
public class Cursors { /** * Transforms { @ code cursor } to { @ link com . google . common . collect . FluentIterable }
* of type { @ code T } by applying the { @ code singleRowTransform } to every row . */
public static < T > FluentIterable < T > toFluentIterable ( Cursor cursor , Function < ? super Cursor , T > singleRowTransform ) { } } | List < T > transformed = Lists . newArrayList ( ) ; if ( cursor != null ) { for ( int i = 0 ; cursor . moveToPosition ( i ) ; i ++ ) { transformed . add ( singleRowTransform . apply ( cursor ) ) ; } } return FluentIterable . from ( transformed ) ; |
public class ActionEvent { /** * / * default */
static < V > ActionEvent < V > create ( String name , Callable < V > action ) { } } | return new CallableActionEvent < > ( name , action ) ; |
public class NettyChannelHandler { /** * Handle the incoming message : pass it to the listener .
* @ param ctx the context object for this handler .
* @ param msg the message .
* @ throws Exception */
@ Override public void channelRead ( final ChannelHandlerContext ctx , final Object msg ) throws Exception { } } | try { this . listener . channelRead ( ctx , msg ) ; } finally { ReferenceCountUtil . release ( msg ) ; } |
public class MG2Encoder { /** * Calculate various forms of derivatives in order to reduce data entropy .
* @ param map attributes
* @ param sortVertices sorted vertices
* @ return encoded UV data */
private int [ ] makeUVCoordDeltas ( AttributeData map , SortableVertex [ ] sortVertices ) { } } | // UV coordinate scaling factor
float scale = 1.0f / map . precision ; int vc = sortVertices . length ; int prevU = 0 , prevV = 0 ; int [ ] intUVCoords = new int [ vc * CTM_UV_ELEMENT_COUNT ] ; for ( int i = 0 ; i < vc ; ++ i ) { // Get old UV coordinate index ( before vertex sorting )
int oldIdx = sortVertices [ i ] . originalIndex ; // Convert to fixed point
int u = ( int ) floor ( scale * map . values [ oldIdx * 2 ] + 0.5f ) ; int v = ( int ) floor ( scale * map . values [ oldIdx * 2 + 1 ] + 0.5f ) ; // Calculate delta and store it in the converted array . NOTE : Here we rely
// on the fact that vertices are sorted , and usually close to each other ,
// which means that UV coordinates should also be close to each other . . .
intUVCoords [ i * 2 ] = u - prevU ; intUVCoords [ i * 2 + 1 ] = v - prevV ; prevU = u ; prevV = v ; } return intUVCoords ; |
public class ListLabelingJobsResult { /** * An array of < code > LabelingJobSummary < / code > objects , each describing a labeling job .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setLabelingJobSummaryList ( java . util . Collection ) } or
* { @ link # withLabelingJobSummaryList ( java . util . Collection ) } if you want to override the existing values .
* @ param labelingJobSummaryList
* An array of < code > LabelingJobSummary < / code > objects , each describing a labeling job .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListLabelingJobsResult withLabelingJobSummaryList ( LabelingJobSummary ... labelingJobSummaryList ) { } } | if ( this . labelingJobSummaryList == null ) { setLabelingJobSummaryList ( new java . util . ArrayList < LabelingJobSummary > ( labelingJobSummaryList . length ) ) ; } for ( LabelingJobSummary ele : labelingJobSummaryList ) { this . labelingJobSummaryList . add ( ele ) ; } return this ; |
public class ConfigSystem { /** * Generates a Guice Module for use with Injector creation . The generated Guice Module binds a number of support
* classes to service a dynamically generated implementation of the provided configuration interface . See
* { @ link ConfigBuilder } for more information .
* @ param < C > The configuration interface type to be implemented
* @ param configInterface The configuration interface
* @ param name Named annotation to provide an arbitrary scope to the configuration interface . Used when
* there are multiple implementations of the config interface .
* @ return a module to install in your Guice Injector */
public static < C > Module configModule ( final Class < C > configInterface , Named name ) { } } | checkNotNull ( configInterface ) ; checkNotNull ( name ) ; return ConfigBuilder . configModule ( configInterface , Optional . of ( name ) ) ; |
public class HelloSignClient { /** * Retrieves the necessary information to edit an embedded template .
* @ param templateId String ID of the signature request to embed
* @ param skipSignerRoles true if the edited template should not allow the
* user to modify the template ' s signer roles . Defaults to false .
* @ param skipSubjectMessage true if the edited template should not allow
* the user to modify the template ' s subject and message . Defaults to
* false .
* @ return EmbeddedResponse
* @ throws HelloSignException thrown if there ' s a problem processing the
* HTTP request or the JSON response . */
public EmbeddedResponse getEmbeddedTemplateEditUrl ( String templateId , boolean skipSignerRoles , boolean skipSubjectMessage ) throws HelloSignException { } } | return getEmbeddedTemplateEditUrl ( templateId , skipSignerRoles , skipSubjectMessage , false ) ; |
public class Block { /** * Used for nested block quotes . Removes ' > ' char . */
public void removeBlockQuotePrefix ( ) { } } | Line aLine = m_aLines ; while ( aLine != null ) { if ( ! aLine . m_bIsEmpty ) { if ( aLine . m_sValue . charAt ( aLine . m_nLeading ) == '>' ) { int rem = aLine . m_nLeading + 1 ; if ( aLine . m_nLeading + 1 < aLine . m_sValue . length ( ) && aLine . m_sValue . charAt ( aLine . m_nLeading + 1 ) == ' ' ) rem ++ ; aLine . m_sValue = aLine . m_sValue . substring ( rem ) ; aLine . initLeading ( ) ; } } aLine = aLine . m_aNext ; } |
public class Truth8 { /** * to support Java environments without java . nio . file such as Android and J2CL . */
@ GwtIncompatible public static PathSubject assertThat ( @ NullableDecl Path target ) { } } | return assertAbout ( PathSubject . paths ( ) ) . that ( target ) ; |
public class ObjToIntMap { /** * Ensure key index creating one if necessary */
private int ensureIndex ( Object key ) { } } | int hash = key . hashCode ( ) ; int index = - 1 ; int firstDeleted = - 1 ; if ( keys != null ) { int fraction = hash * A ; index = fraction >>> ( 32 - power ) ; Object test = keys [ index ] ; if ( test != null ) { int N = 1 << power ; if ( test == key || ( values [ N + index ] == hash && test . equals ( key ) ) ) { return index ; } if ( test == DELETED ) { firstDeleted = index ; } // Search in table after first failed attempt
int mask = N - 1 ; int step = tableLookupStep ( fraction , mask , power ) ; int n = 0 ; for ( ; ; ) { if ( check ) { if ( n >= occupiedCount ) Kit . codeBug ( ) ; ++ n ; } index = ( index + step ) & mask ; test = keys [ index ] ; if ( test == null ) { break ; } if ( test == key || ( values [ N + index ] == hash && test . equals ( key ) ) ) { return index ; } if ( test == DELETED && firstDeleted < 0 ) { firstDeleted = index ; } } } } // Inserting of new key
if ( check && keys != null && keys [ index ] != null ) Kit . codeBug ( ) ; if ( firstDeleted >= 0 ) { index = firstDeleted ; } else { // Need to consume empty entry : check occupation level
if ( keys == null || occupiedCount * 4 >= ( 1 << power ) * 3 ) { // Too litle unused entries : rehash
rehashTable ( ) ; return insertNewKey ( key , hash ) ; } ++ occupiedCount ; } keys [ index ] = key ; values [ ( 1 << power ) + index ] = hash ; ++ keyCount ; return index ; |
public class TransactionException { /** * TODO : represent the failure cause using an enum instead */
public boolean isConflict ( ) { } } | if ( getCause ( ) != null && getCause ( ) instanceof DatastoreException ) { DatastoreException datastoreException = ( DatastoreException ) getCause ( ) ; return datastoreException . getCode ( ) == 10 ; } else { return false ; } |
public class ConfigUtils { /** * Returns the specified String property from the configuration
* @ param config the configuration
* @ param key the key of the property
* @ param defaultValue the default value if the property is not found
* @ return the String value of the property , or the default value if not found
* @ throws DeployerConfigurationException if an error occurred */
public static String getStringProperty ( Configuration config , String key , String defaultValue ) throws DeployerConfigurationException { } } | try { return config . getString ( key , defaultValue ) ; } catch ( Exception e ) { throw new DeployerConfigurationException ( "Failed to retrieve property '" + key + "'" , e ) ; } |
public class DwgBlockControl { /** * Read a Block control in the DWG format Version 15
* @ param data Array of unsigned bytes obtained from the DWG binary file
* @ param offset The current bit offset where the value begins
* @ throws Exception If an unexpected bit value is found in the DWG file . Occurs
* when we are looking for LwPolylines . */
public void readDwgBlockControlV15 ( int [ ] data , int offset ) throws Exception { } } | // System . out . println ( " readDwgBlockControl ( ) executed . . . " ) ;
int bitPos = offset ; Vector v = DwgUtil . getBitLong ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; int numReactors = ( ( Integer ) v . get ( 1 ) ) . intValue ( ) ; setNumReactors ( numReactors ) ; v = DwgUtil . getBitShort ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; int enumsz = ( ( Integer ) v . get ( 1 ) ) . intValue ( ) ; v = DwgUtil . getHandle ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; int [ ] handle = new int [ v . size ( ) - 1 ] ; for ( int i = 1 ; i < v . size ( ) ; i ++ ) { handle [ i - 1 ] = ( ( Integer ) v . get ( i ) ) . intValue ( ) ; } Vector handleVect = new Vector ( ) ; for ( int i = 0 ; i < handle . length ; i ++ ) { handleVect . add ( new Integer ( handle [ i ] ) ) ; } nullHandle = DwgUtil . handleBinToHandleInt ( handleVect ) ; v = DwgUtil . getHandle ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; handle = new int [ v . size ( ) - 1 ] ; for ( int i = 1 ; i < v . size ( ) ; i ++ ) { handle [ i - 1 ] = ( ( Integer ) v . get ( i ) ) . intValue ( ) ; } if ( enumsz > 0 ) { Vector handles = new Vector ( ) ; for ( int i = 0 ; i < enumsz ; i ++ ) { v = DwgUtil . getHandle ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; handle = new int [ v . size ( ) - 1 ] ; for ( int j = 1 ; j < v . size ( ) ; j ++ ) { handle [ j - 1 ] = ( ( Integer ) v . get ( j ) ) . intValue ( ) ; } handles . add ( handle ) ; } code2Handles = handles ; } v = DwgUtil . getHandle ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; handle = new int [ v . size ( ) - 1 ] ; for ( int j = 1 ; j < v . size ( ) ; j ++ ) { handle [ j - 1 ] = ( ( Integer ) v . get ( j ) ) . intValue ( ) ; } handleVect = new Vector ( ) ; for ( int i = 0 ; i < handle . length ; i ++ ) { handleVect . add ( new Integer ( handle [ i ] ) ) ; } modelSpaceHandle = DwgUtil . handleBinToHandleInt ( handleVect ) ; v = DwgUtil . getHandle ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; handle = new int [ v . size ( ) - 1 ] ; for ( int j = 1 ; j < v . size ( ) ; j ++ ) { handle [ j - 1 ] = ( ( Integer ) v . get ( j ) ) . intValue ( ) ; } handleVect = new Vector ( ) ; for ( int i = 0 ; i < handle . length ; i ++ ) { handleVect . add ( new Integer ( handle [ i ] ) ) ; } paperSpaceHandle = DwgUtil . handleBinToHandleInt ( handleVect ) ; |
public class CassandraClientBase { /** * Compose column value .
* @ param cqlMetadata
* the cql metadata
* @ param thriftColumnValue
* the thrift column value
* @ param thriftColumnName
* the thrift column name
* @ return the object */
private Object composeColumnValue ( CqlMetadata cqlMetadata , byte [ ] thriftColumnValue , byte [ ] thriftColumnName ) { } } | Map < ByteBuffer , String > schemaTypes = cqlMetadata . getValue_types ( ) ; AbstractType < ? > type = null ; try { type = TypeParser . parse ( schemaTypes . get ( ByteBuffer . wrap ( thriftColumnName ) ) ) ; } catch ( SyntaxException | ConfigurationException ex ) { log . error ( ex . getMessage ( ) ) ; throw new KunderaException ( "Error while deserializing column value " + ex ) ; } if ( type . isCollection ( ) ) { return ( ( CollectionSerializer ) type . getSerializer ( ) ) . deserializeForNativeProtocol ( ByteBuffer . wrap ( thriftColumnValue ) , ProtocolVersion . V2 ) ; } return type . compose ( ByteBuffer . wrap ( thriftColumnValue ) ) ; |
public class Code { /** * Calls the closest superclass ' s virtual method { @ code method } of { @ code
* instance } using { @ code args } and assigns the result to { @ code target } .
* @ param target the local to receive the method ' s return value , or { @ code
* null } if the return type is { @ code void } or if its value not needed . */
public < D , R > void invokeSuper ( MethodId < D , R > method , Local < ? super R > target , Local < ? extends D > instance , Local < ? > ... args ) { } } | invoke ( Rops . opInvokeSuper ( method . prototype ( true ) ) , method , target , instance , args ) ; |
public class NodeIdRepresentation { /** * This method is responsible to delete an XML resource addressed through a
* unique node id ( except root node id ) .
* @ param resourceName
* The name of the database , which the node id belongs to .
* @ param nodeId
* The unique node id .
* @ throws JaxRxException
* The exception occurred . */
public void deleteResource ( final String resourceName , final long nodeId ) throws JaxRxException { } } | synchronized ( resourceName ) { ISession session = null ; INodeWriteTrx wtx = null ; boolean abort = false ; if ( mDatabase . existsResource ( resourceName ) ) { try { // Creating a new session
session = mDatabase . getSession ( new SessionConfiguration ( resourceName , StandardSettings . KEY ) ) ; // Creating a write transaction
wtx = new NodeWriteTrx ( session , session . beginBucketWtx ( ) , HashKind . Rolling ) ; // move to node with given rest id and deletes it
if ( wtx . moveTo ( nodeId ) ) { wtx . remove ( ) ; wtx . commit ( ) ; } else { // workerHelper . closeWTX ( abort , wtx , session , database ) ;
throw new JaxRxException ( 404 , NOTFOUND ) ; } } catch ( final TTException exce ) { abort = true ; throw new JaxRxException ( exce ) ; } finally { try { WorkerHelper . closeWTX ( abort , wtx , session ) ; } catch ( final TTException exce ) { throw new JaxRxException ( exce ) ; } } } else { throw new JaxRxException ( 404 , "DB not found" ) ; } } |
public class LabelOperationMetadata { /** * < code >
* . google . cloud . datalabeling . v1beta1 . LabelImageOrientedBoundingBoxOperationMetadata image _ oriented _ bounding _ box _ details = 14;
* < / code > */
public com . google . cloud . datalabeling . v1beta1 . LabelImageOrientedBoundingBoxOperationMetadataOrBuilder getImageOrientedBoundingBoxDetailsOrBuilder ( ) { } } | if ( detailsCase_ == 14 ) { return ( com . google . cloud . datalabeling . v1beta1 . LabelImageOrientedBoundingBoxOperationMetadata ) details_ ; } return com . google . cloud . datalabeling . v1beta1 . LabelImageOrientedBoundingBoxOperationMetadata . getDefaultInstance ( ) ; |
public class FCWsByteBufferImpl { /** * Return the FileChannel object that is representing this WsByteBufferImpl .
* @ return FileChannel */
public FileChannel getFileChannel ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "getFileChannel(): " + fc ) ; } return this . fc ; |
public class CQJDBCStorageConnection { /** * { @ inheritDoc } */
@ Override public int getLastOrderNumber ( NodeData parent ) throws RepositoryException { } } | if ( ! containerConfig . useSequenceForOrderNumber ) { return super . getLastOrderNumber ( parent ) ; } return getLastOrderNumber ( ) ; |
public class StandardRoadNetwork { @ Override public final void addRoadSegment ( RoadSegment segment ) throws RoadNetworkException { } } | if ( segment instanceof RoadPolyline ) { addRoadPolyline ( ( RoadPolyline ) segment ) ; } else { throw new UnsupportedRoadSegmentException ( ) ; } |
public class Path { /** * Make this Path identical to the given one .
* @ param other
* a Path to which this object should be made identical */
public void copyFrom ( Path other ) { } } | grow ( other . length - 1 ) ; System . arraycopy ( other . blockIdList , 0 , this . blockIdList , 0 , other . length ) ; this . length = other . length ; this . cachedHashCode = other . cachedHashCode ; |
public class GenericInfoUtils { /** * Type analysis in context of analyzed type with child class as target type . Case : we have interface
* ( or base type ) with generic in class ( as field or return type ) , but we need to analyze actual
* instance type ( from value ) . This method will analyze type from new root ( where generics are unknown ) , but
* will add known middle generics .
* NOTE : some of the root generics could possibly be resolved if there are any traceable connectivity between
* the root class and known middle generics . All possible ( known ) cases should be solved . For example ,
* { @ code Root < K > extends Target < List < K > > } when we know { @ code Target < Collection < String > > } then
* K will be tracked as String .
* In essence : root generics are partially resolved by tracking definition from known middle class .
* Other root generics resolved as upper bound ( the same as in usual type resolution case ) .
* If middle type generic is not specified ( and so resolved as Object ) then known specific type used
* ( assuming root type would be used in place with known parametrization and so more specifi generic may be
* counted ) .
* The result is not intended to be cached as it ' s context - sensitive .
* @ param context generics context of containing class
* @ param type type to analyze ( important : this must be generified type and not raw class in
* order to properly resolve generics )
* @ param asType target child type ( this class contain original type in hierarchy )
* @ param ignoreClasses classes to exclude from hierarchy analysis
* @ return analyzed type generics info */
public static GenericsInfo create ( final GenericsContext context , final Type type , final Class < ? > asType , final Class < ? > ... ignoreClasses ) { } } | // root generics are required only to properly solve type
final Map < String , Type > rootGenerics = context . visibleGenericsMap ( ) ; // first step : solve type to replace transitive generics with direct values
final Type actual = GenericsUtils . resolveTypeVariables ( type , rootGenerics ) ; final Class < ? > middleType = context . resolveClass ( actual ) ; if ( ! middleType . isAssignableFrom ( asType ) ) { throw new IllegalArgumentException ( String . format ( "Requested type %s is not a subtype of %s" , asType . getSimpleName ( ) , middleType . getSimpleName ( ) ) ) ; } // known middle type
LinkedHashMap < String , Type > typeGenerics = GenericsResolutionUtils . resolveGenerics ( actual , rootGenerics ) ; final Map < Class < ? > , LinkedHashMap < String , Type > > knownGenerics = new HashMap < Class < ? > , LinkedHashMap < String , Type > > ( ) ; // field could be declared as ( Outer < String > . Inner field ) and already contain actual outer generics
knownGenerics . put ( middleType , GenericsResolutionUtils . fillOuterGenerics ( actual , typeGenerics , context . getGenericsInfo ( ) . getTypesMap ( ) ) ) ; if ( TypeUtils . isInner ( middleType ) ) { // remember possibly specified outer generics ( they were already resolved above )
knownGenerics . put ( ( Class ) TypeUtils . getOuter ( middleType ) , new LinkedHashMap < String , Type > ( GenericsUtils . extractOwnerGenerics ( middleType , knownGenerics . get ( middleType ) ) ) ) ; } else { // store other types for possible outer classes generics resolution
knownGenerics . putAll ( usePossiblyOwnerGenerics ( asType , context . getGenericsInfo ( ) ) ) ; } // root type
typeGenerics = asType . getTypeParameters ( ) . length > 0 ? GenericsTrackingUtils . track ( asType , middleType , typeGenerics ) : EmptyGenericsMap . getInstance ( ) ; typeGenerics = GenericsResolutionUtils . fillOuterGenerics ( asType , typeGenerics , knownGenerics . size ( ) > 1 // if known middle type is inner class then owner already filled
? knownGenerics : context . getGenericsInfo ( ) . getTypesMap ( ) ) ; return create ( asType , typeGenerics , knownGenerics , ignoreClasses ) ; |
public class LibraryVersions { /** * package private for testing purposes */
void findMavenArtifacts ( Enumeration < URL > mavenDirs ) throws IOException , SAXException , XPathExpressionException , ParserConfigurationException { } } | XPath xpath = XPathFactory . newInstance ( ) . newXPath ( ) ; DocumentBuilderFactory builderFactory = DocumentBuilderFactory . newInstance ( ) ; // don ' t allow external entity refs in the poms .
builderFactory . setFeature ( XMLConstants . FEATURE_SECURE_PROCESSING , true ) ; builderFactory . setFeature ( "http://xml.org/sax/features/external-general-entities" , false ) ; builderFactory . setFeature ( "http://xml.org/sax/features/external-parameter-entities" , false ) ; DocumentBuilder builder = builderFactory . newDocumentBuilder ( ) ; while ( mavenDirs . hasMoreElements ( ) ) { URL u = mavenDirs . nextElement ( ) ; // jar : file : / home / username / . m2 / repository / org / slf4j / slf4j - jdk14/1.5.0 / slf4j - jdk14-1.5.0 . jar ! / META - INF / MANIFEST . MF
// we ' re not interested if it ' s not a jar , although how you ' d have a MANIFEST . MF which wasn ' t in a jar ?
if ( u . getProtocol ( ) . equals ( "jar" ) ) { // file : / home / username / . m2 / repository / com / betfair / tornjak / kpi / 3.0 - SNAPSHOT / kpi - 3.0 - SNAPSHOT . jar ! / META - INF / MANIFEST . MF
String file = u . getFile ( ) ; // file : / home / username / . m2 / repository / com / betfair / tornjak / kpi / 3.0 - SNAPSHOT / kpi - 3.0 - SNAPSHOT . jar
file = file . substring ( 0 , file . indexOf ( "!" ) ) ; // / home / username / . m2 / repository / com / betfair / tornjak / kpi / 3.0 - SNAPSHOT / kpi - 3.0 - SNAPSHOT . jar
file = file . substring ( 5 ) ; // remove % 20 etc
file = URLDecoder . decode ( file , "UTF-8" ) ; try ( JarFile jarFile = new JarFile ( file ) ) { Enumeration < JarEntry > entries = jarFile . entries ( ) ; while ( entries . hasMoreElements ( ) ) { JarEntry entry = entries . nextElement ( ) ; try { if ( entry . getName ( ) . endsWith ( "pom.xml" ) ) { try ( InputStream is = jarFile . getInputStream ( entry ) ) { Document doc = builder . parse ( is ) ; String groupId = xpath . evaluate ( "/project/groupId" , doc ) ; if ( groupId == null || "" . equals ( groupId ) ) { groupId = xpath . evaluate ( "/project/parent/groupId" , doc ) ; if ( groupId == null || "" . equals ( groupId ) ) { logger . warn ( "Can't work out groupId for pom: " + file + "!" + entry ) ; break ; } } String artifactId = xpath . evaluate ( "/project/artifactId" , doc ) ; if ( artifactId == null || "" . equals ( artifactId ) ) { artifactId = xpath . evaluate ( "/project/parent/artifactId" , doc ) ; if ( artifactId == null || "" . equals ( artifactId ) ) { logger . warn ( "Can't work out artifactId for pom: " + file + "!" + entry ) ; break ; } } String version = xpath . evaluate ( "/project/version" , doc ) ; if ( version == null || "" . equals ( version ) ) { version = xpath . evaluate ( "/project/parent/version" , doc ) ; if ( version == null || "" . equals ( version ) ) { logger . warn ( "Can't work out version for pom: " + file + "!" + entry ) ; break ; } } artifacts . put ( groupId + ":" + artifactId , version ) ; } } } catch ( IOException e ) { logger . error ( "Can't resolve " + entry . getName ( ) ) ; throw e ; } } } } else { logger . info ( "Can't examine maven artifact in non jar location: " + u ) ; } } |
public class PortMappingMarshaller { /** * Marshall the given parameter object . */
public void marshall ( PortMapping portMapping , ProtocolMarshaller protocolMarshaller ) { } } | if ( portMapping == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( portMapping . getPort ( ) , PORT_BINDING ) ; protocolMarshaller . marshall ( portMapping . getProtocol ( ) , PROTOCOL_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ComplexNumber { /** * Divides scalar value to a complex number .
* @ param z1 Complex Number .
* @ param scalar Scalar value .
* @ return Returns new ComplexNumber instance containing the divide of specified complex number with the scalar value . */
public static ComplexNumber Divide ( ComplexNumber z1 , double scalar ) { } } | return new ComplexNumber ( z1 . real / scalar , z1 . imaginary / scalar ) ; |
public class CheckSum { /** * Update the underlying buffer using the integer
* @ param number number to be stored in checksum buffer */
public void update ( int number ) { } } | byte [ ] numberInBytes = new byte [ ByteUtils . SIZE_OF_INT ] ; ByteUtils . writeInt ( numberInBytes , number , 0 ) ; update ( numberInBytes ) ; |
public class WorkflowTriggerHistoriesInner { /** * Resubmits a workflow run based on the trigger history .
* @ param resourceGroupName The resource group name .
* @ param workflowName The workflow name .
* @ param triggerName The workflow trigger name .
* @ param historyName The workflow trigger history name . Corresponds to the run name for triggers that resulted in a run .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponse } object if successful . */
public Observable < ServiceResponse < Void > > resubmitWithServiceResponseAsync ( String resourceGroupName , String workflowName , String triggerName , String historyName ) { } } | if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( workflowName == null ) { throw new IllegalArgumentException ( "Parameter workflowName is required and cannot be null." ) ; } if ( triggerName == null ) { throw new IllegalArgumentException ( "Parameter triggerName is required and cannot be null." ) ; } if ( historyName == null ) { throw new IllegalArgumentException ( "Parameter historyName is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } return service . resubmit ( this . client . subscriptionId ( ) , resourceGroupName , workflowName , triggerName , historyName , this . client . 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 = resubmitDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class Condition { /** * syntactic sugar */
public ConditionEvidenceComponent addEvidence ( ) { } } | ConditionEvidenceComponent t = new ConditionEvidenceComponent ( ) ; if ( this . evidence == null ) this . evidence = new ArrayList < ConditionEvidenceComponent > ( ) ; this . evidence . add ( t ) ; return t ; |
public class JcrRdfTools { /** * Convert an external statement into a persistable statement by skolemizing
* blank nodes , creating hash - uri subjects , etc
* @ param idTranslator the property of idTranslator
* @ param t the statement
* @ param topic the topic
* @ return the persistable statement
* @ throws RepositoryException if repository exception occurred */
public Statement skolemize ( final IdentifierConverter < Resource , FedoraResource > idTranslator , final Statement t , final String topic ) throws RepositoryException { } } | Statement skolemized = t ; if ( t . getSubject ( ) . isAnon ( ) ) { skolemized = m . createStatement ( getSkolemizedResource ( idTranslator , skolemized . getSubject ( ) , topic ) , skolemized . getPredicate ( ) , skolemized . getObject ( ) ) ; } else if ( idTranslator . inDomain ( t . getSubject ( ) ) && t . getSubject ( ) . getURI ( ) . contains ( "#" ) ) { findOrCreateHashUri ( idTranslator , t . getSubject ( ) ) ; } if ( t . getObject ( ) . isAnon ( ) ) { skolemized = m . createStatement ( skolemized . getSubject ( ) , skolemized . getPredicate ( ) , getSkolemizedResource ( idTranslator , skolemized . getObject ( ) , topic ) ) ; } else if ( t . getObject ( ) . isResource ( ) && idTranslator . inDomain ( t . getObject ( ) . asResource ( ) ) && t . getObject ( ) . asResource ( ) . getURI ( ) . contains ( "#" ) ) { findOrCreateHashUri ( idTranslator , t . getObject ( ) . asResource ( ) ) ; } return skolemized ; |
public class ServerMessageBlock2Response { /** * { @ inheritDoc }
* @ see jcifs . internal . CommonServerMessageBlockResponse # prepare ( jcifs . internal . CommonServerMessageBlockRequest ) */
@ Override public void prepare ( CommonServerMessageBlockRequest next ) { } } | CommonServerMessageBlockResponse n = getNextResponse ( ) ; if ( n != null ) { n . prepare ( next ) ; } |
public class DomainService { /** * Creates a Evse in a charging station type .
* @ param chargingStationTypeId charging station type identifier .
* @ param evse evse object
* @ return created Evse */
public Evse createEvse ( Long chargingStationTypeId , Evse evse ) throws ResourceAlreadyExistsException { } } | ChargingStationType chargingStationType = chargingStationTypeRepository . findOne ( chargingStationTypeId ) ; if ( getEvseByIdentifier ( chargingStationType , evse . getIdentifier ( ) ) != null ) { throw new ResourceAlreadyExistsException ( String . format ( "Evse with identifier '%s' already exists." , evse . getIdentifier ( ) ) ) ; } chargingStationType . getEvses ( ) . add ( evse ) ; chargingStationType = chargingStationTypeRepository . createOrUpdate ( chargingStationType ) ; return getEvseByIdentifier ( chargingStationType , evse . getIdentifier ( ) ) ; |
public class RequestLoggingFilter { protected void before ( HttpServletRequest request , HttpServletResponse response ) { } } | final StringBuilder sb = new StringBuilder ( ) ; final String beginDecoration ; if ( isSubRequestUrl ( request ) ) { beginDecoration = "- - - - - - - - - - {SUB BEGIN}: " ; } else { // mainly here
beginDecoration = "* * * * * * * * * * {BEGIN}: " ; } sb . append ( beginDecoration ) ; sb . append ( getTitlePath ( request ) ) ; sb . append ( LF ) . append ( IND ) ; buildRequestInfo ( sb , request , response , /* showResponse */
false , /* showErrorFlush */
false ) ; logger . debug ( sb . toString ( ) . trim ( ) ) ; |
public class TileBoundingBoxUtils { /** * Get the standard y tile location as TMS or a TMS y location as standard
* @ param zoom
* zoom level
* @ param y
* y coordinate
* @ return opposite tile format y */
public static int getYAsOppositeTileFormat ( int zoom , int y ) { } } | int tilesPerSide = tilesPerSide ( zoom ) ; int oppositeY = tilesPerSide - y - 1 ; return oppositeY ; |
public class EMMImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . EMM__MM_NAME : return getMMName ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class UnboundedLocalCache { /** * A { @ link Map # compute ( Object , BiFunction ) } that does not directly record any cache statistics .
* @ param key key with which the specified value is to be associated
* @ param remappingFunction the function to compute a value
* @ return the new value associated with the specified key , or null if none */
V remap ( K key , BiFunction < ? super K , ? super V , ? extends V > remappingFunction ) { } } | // ensures that the removal notification is processed after the removal has completed
@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) V [ ] oldValue = ( V [ ] ) new Object [ 1 ] ; RemovalCause [ ] cause = new RemovalCause [ 1 ] ; V nv = data . compute ( key , ( K k , V value ) -> { V newValue = remappingFunction . apply ( k , value ) ; if ( ( value == null ) && ( newValue == null ) ) { return null ; } cause [ 0 ] = ( newValue == null ) ? RemovalCause . EXPLICIT : RemovalCause . REPLACED ; if ( hasRemovalListener ( ) && ( value != null ) && ( newValue != value ) ) { oldValue [ 0 ] = value ; } return newValue ; } ) ; if ( oldValue [ 0 ] != null ) { notifyRemoval ( key , oldValue [ 0 ] , cause [ 0 ] ) ; } return nv ; |
public class PredictionsImpl { /** * Predict an image url without saving the result .
* @ param projectId The project id
* @ param iterationId Optional . Specifies the id of a particular iteration to evaluate against .
* The default iteration for the project will be used when not specified
* @ param application Optional . Specifies the name of application using the endpoint
* @ param url the String value
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the ImagePrediction object */
public Observable < ServiceResponse < ImagePrediction > > predictImageUrlWithNoStoreWithServiceResponseAsync ( UUID projectId , UUID iterationId , String application , String url ) { } } | if ( projectId == null ) { throw new IllegalArgumentException ( "Parameter projectId is required and cannot be null." ) ; } if ( this . client . apiKey ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiKey() is required and cannot be null." ) ; } ImageUrl imageUrl = new ImageUrl ( ) ; imageUrl . withUrl ( url ) ; return service . predictImageUrlWithNoStore ( projectId , iterationId , application , this . client . apiKey ( ) , this . client . acceptLanguage ( ) , imageUrl , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < ImagePrediction > > > ( ) { @ Override public Observable < ServiceResponse < ImagePrediction > > call ( Response < ResponseBody > response ) { try { ServiceResponse < ImagePrediction > clientResponse = predictImageUrlWithNoStoreDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class JMLambda { /** * Consume if true .
* @ param < T > the type parameter
* @ param < U > the type parameter
* @ param target1 the target 1
* @ param target2 the target 2
* @ param targetTester the target tester
* @ param biConsumer the bi consumer */
public static < T , U > void consumeIfTrue ( T target1 , U target2 , BiPredicate < T , U > targetTester , BiConsumer < T , U > biConsumer ) { } } | consumeIfTrue ( targetTester . test ( target1 , target2 ) , target1 , target2 , biConsumer ) ; |
public class ValidatorContext { /** * Creates the validator and makes all the connections .
* @ return Newly created and configured validator . */
public DefaultSimpleValidator < D , O > build ( ) { } } | final DefaultSimpleValidator < D , O > validator = new DefaultSimpleValidator < D , O > ( ) ; for ( final Trigger trigger : registeredTriggers ) { validator . addTrigger ( trigger ) ; } for ( final DataProvider < D > dataProvider : registeredDataProviders ) { validator . addDataProvider ( dataProvider ) ; } for ( final Rule < D , O > rule : registeredRules ) { validator . addRule ( rule ) ; } for ( final ResultHandler < O > resultHandler : registeredResultHandlers ) { validator . addResultHandler ( resultHandler ) ; } return validator ; |
public class ReturnTaglet { /** * { @ inheritDoc } */
public void inherit ( DocFinder . Input input , DocFinder . Output output ) { } } | Tag [ ] tags = input . element . tags ( "return" ) ; if ( tags . length > 0 ) { output . holder = input . element ; output . holderTag = tags [ 0 ] ; output . inlineTags = input . isFirstSentence ? tags [ 0 ] . firstSentenceTags ( ) : tags [ 0 ] . inlineTags ( ) ; } |
public class HammingWeight { /** * Count number of bits set to one in the given long ( 64 - bit integers ) .
* @ param i
* @ return */
public static long ofSetBits64_1 ( long i ) { } } | i = i - ( ( i >>> 1 ) & 0x5555555555555555L ) ; i = ( i & 0x3333333333333333L ) + ( ( i >>> 2 ) & 0x3333333333333333L ) ; i = ( ( i + ( i >>> 4 ) ) & 0x0F0F0F0F0F0F0F0FL ) ; return ( i * ( 0x0101010101010101L ) ) >>> 56 ; |
public class ModelFactory { /** * Constructor - method to use when service descriptors are not required ( e . g . schema and wsdl for services )
* @ param groupId
* @ param artifactId
* @ param version
* @ param service
* @ param deploymentModel
* @ return the new model instance */
public static IModel newModel ( String groupId , String artifactId , String version , String service , MuleVersionEnum muleVersion , DeploymentModelEnum deploymentModel , List < TransportEnum > transports ) { } } | return doCreateNewModel ( groupId , artifactId , version , service , muleVersion , deploymentModel , transports , null , null , TransformerEnum . JAVA , null , null ) ; |
public class DomainsInner { /** * Get domain name recommendations based on keywords .
* Get domain name recommendations based on keywords .
* ServiceResponse < PageImpl < NameIdentifierInner > > * @ param parameters Search parameters for domain name recommendations .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the PagedList & lt ; NameIdentifierInner & gt ; object wrapped in { @ link ServiceResponse } if successful . */
public Observable < ServiceResponse < Page < NameIdentifierInner > > > listRecommendationsSinglePageAsync ( final DomainRecommendationSearchParameters parameters ) { } } | if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( parameters == null ) { throw new IllegalArgumentException ( "Parameter parameters is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } Validator . validate ( parameters ) ; return service . listRecommendations ( this . client . subscriptionId ( ) , parameters , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Page < NameIdentifierInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < NameIdentifierInner > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < PageImpl < NameIdentifierInner > > result = listRecommendationsDelegate ( response ) ; return Observable . just ( new ServiceResponse < Page < NameIdentifierInner > > ( result . body ( ) , result . response ( ) ) ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class Cursor { /** * Synchronized . Get the entry currently pointed to by this cursor .
* @ return the entry currently pointed to by this cursor */
public synchronized Entry current ( ) { } } | if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "current" ) ; checkEntryParent ( ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "current" , current ) ; return current ; |
public class Collections { /** * A convenience method to merge a single argument plus the ( possibly zero ) remaining values .
* Useful for iterating over a varargs collection that requires at least one value .
* @ param < T > the type
* @ param pFirst the first ( required ) values
* @ param pRest the remaining values
* @ return the set containing all of the values */
public static < T > List < T > merge ( T pFirst , T ... pRest ) { } } | List < T > result = new ArrayList < T > ( 1 + ( pRest == null ? 0 : pRest . length ) ) ; result . add ( pFirst ) ; if ( pRest != null ) { result . addAll ( Arrays . asList ( pRest ) ) ; } return result ; |
public class WsocOutboundChain { /** * SslOption related functions */
@ Trivial protected void setSslOptions ( ServiceReference < ChannelConfiguration > service ) { } } | sslOptions . setReference ( service ) ; wsocSecureChain . setConfigured ( true ) ; performAction ( updateAction ) ; |
public class StreamUtils { /** * Copy the contents of the given InputStream into a String .
* Leaves the stream open when done .
* @ param in the InputStream to copy from
* @ return the String that has been copied to
* @ throws IOException in case of I / O errors */
public static String copyToString ( InputStream in , Charset charset ) throws IOException { } } | Assert . notNull ( in , "No InputStream specified" ) ; StringBuilder out = new StringBuilder ( ) ; InputStreamReader reader = new InputStreamReader ( in , charset ) ; char [ ] buffer = new char [ BUFFER_SIZE ] ; int bytesRead = - 1 ; while ( ( bytesRead = reader . read ( buffer ) ) != - 1 ) { out . append ( buffer , 0 , bytesRead ) ; } return out . toString ( ) ; |
public class DesignDocumentManager { /** * Removes a design document using DesignDocument object from the database .
* @ param designDocument the design document object to be removed
* @ return { @ link DesignDocument } */
public Response remove ( DesignDocument designDocument ) { } } | assertNotEmpty ( designDocument , "DesignDocument" ) ; ensureDesignPrefixObject ( designDocument ) ; return db . remove ( designDocument ) ; |
public class FilterLoader { /** * Given source and name will compile and store the filter if it detects that the filter code has changed or
* the filter doesn ' t exist . Otherwise it will return an instance of the requested ZuulFilter
* @ param sCode source code
* @ param sName name of the filter
* @ return the IZuulFilter
* @ throws IllegalAccessException
* @ throws InstantiationException */
public ZuulFilter getFilter ( String sCode , String sName ) throws Exception { } } | if ( filterCheck . get ( sName ) == null ) { filterCheck . putIfAbsent ( sName , sName ) ; if ( ! sCode . equals ( filterClassCode . get ( sName ) ) ) { LOG . info ( "reloading code " + sName ) ; filterRegistry . remove ( sName ) ; } } ZuulFilter filter = filterRegistry . get ( sName ) ; if ( filter == null ) { Class clazz = compiler . compile ( sCode , sName ) ; if ( ! Modifier . isAbstract ( clazz . getModifiers ( ) ) ) { filter = filterFactory . newInstance ( clazz ) ; } } return filter ; |
public class RxPresenter { /** * This is a shortcut for calling { @ link # restartableFirst ( int , Func0 , Action2 , Action2 ) } with the last parameter = null . */
public < T > void restartableFirst ( int restartableId , final Func0 < Observable < T > > observableFactory , final Action2 < View , T > onNext ) { } } | restartableFirst ( restartableId , observableFactory , onNext , null ) ; |
public class CommerceCountryLocalServiceUtil { /** * Returns the commerce country matching the UUID and group .
* @ param uuid the commerce country ' s UUID
* @ param groupId the primary key of the group
* @ return the matching commerce country , or < code > null < / code > if a matching commerce country could not be found */
public static com . liferay . commerce . model . CommerceCountry fetchCommerceCountryByUuidAndGroupId ( String uuid , long groupId ) { } } | return getService ( ) . fetchCommerceCountryByUuidAndGroupId ( uuid , groupId ) ; |
public class NettyHelper { /** * 得到服务端业务线程池
* @ param config 服务端配置
* @ param executor 业务线程池
* @ return 服务端业务线程池 */
public static EventLoopGroup getServerBizEventLoopGroup ( ServerTransportConfig config , Executor executor ) { } } | int bizThreads = config . getBizMaxThreads ( ) ; return config . isUseEpoll ( ) ? new EpollEventLoopGroup ( config . getBizMaxThreads ( ) , executor ) : new NioEventLoopGroup ( bizThreads , executor ) ; |
public class CRTable { /** * Create a new CRTEntry and add it to the entries .
* @ param tree The tree or the list of trees for which
* we are storing the code pointers .
* @ param flags The set of flags designating type of the entry .
* @ param startPc The starting code position .
* @ param endPc The ending code position . */
public void put ( Object tree , int flags , int startPc , int endPc ) { } } | entries . append ( new CRTEntry ( tree , flags , startPc , endPc ) ) ; |
public class PatternBox { /** * Constructs a pattern where first and last molecules are participants of a
* MolecularInteraction .
* @ return the pattern */
public static Pattern molecularInteraction ( ) { } } | Pattern p = new Pattern ( SequenceEntityReference . class , "Protein 1" ) ; p . add ( linkedER ( true ) , "Protein 1" , "generic Protein 1" ) ; p . add ( erToPE ( ) , "generic Protein 1" , "SPE1" ) ; p . add ( linkToComplex ( ) , "SPE1" , "PE1" ) ; p . add ( new PathConstraint ( "PhysicalEntity/participantOf:MolecularInteraction" ) , "PE1" , "MI" ) ; p . add ( participant ( ) , "MI" , "PE2" ) ; p . add ( equal ( false ) , "PE1" , "PE2" ) ; // participants are not both baits or preys
p . add ( new NOT ( new AND ( new MappedConst ( isPrey ( ) , 0 ) , new MappedConst ( isPrey ( ) , 1 ) ) ) , "PE1" , "PE2" ) ; p . add ( new NOT ( new AND ( new MappedConst ( isBait ( ) , 0 ) , new MappedConst ( isBait ( ) , 1 ) ) ) , "PE1" , "PE2" ) ; p . add ( linkToSpecific ( ) , "PE2" , "SPE2" ) ; p . add ( type ( SequenceEntity . class ) , "SPE2" ) ; p . add ( new PEChainsIntersect ( false ) , "SPE1" , "PE1" , "SPE2" , "PE2" ) ; p . add ( peToER ( ) , "SPE2" , "generic Protein 2" ) ; p . add ( linkedER ( false ) , "generic Protein 2" , "Protein 2" ) ; p . add ( equal ( false ) , "Protein 1" , "Protein 2" ) ; return p ; |
public class ManagementEJBService { /** * Get the configuration for the EJBs in this module
* EJBSystemBeanConfig ( String name , Class < ? > ejbClass , String remoteHomeBindingName ,
* Class < ? extends EJBHome > remoteHomeInterface , Class < ? extends EJBObject > remoteInterface )
* @ param name the valid EJB name ( e . g . , " MyBean " ) , which is part of the
* persistent identity of EJB references and must not be changed
* or else serialized proxies will no longer work
* @ param ejbClass the implementation class
* @ param remoteHomeBindingName the CosNaming binding name ( e . g . , " ejb / test / MyBean " )
* @ param remoteHomeInterface the remote home interface
* @ param remoteInterface the remote component interface }
* @ return array of EJBSystemBeanConfig */
private EJBSystemBeanConfig [ ] getEJBSystemBeanConfigs ( ) { } } | EJBSystemBeanConfig ejb = new EJBSystemBeanConfig ( BEAN_NAME , ManagementEJB . class , BINDING_NAME , ManagementHome . class , Management . class ) ; EJBSystemBeanConfig [ ] ejbs = new EJBSystemBeanConfig [ ] { ejb } ; return ejbs ; |
public class EasyRandomParameters { /** * Set the string length range .
* @ param minStringLength the minimum string length
* @ param maxStringLength the maximum string length
* @ return the current { @ link EasyRandomParameters } instance for method chaining */
public EasyRandomParameters stringLengthRange ( final int minStringLength , final int maxStringLength ) { } } | if ( minStringLength < 0 ) { throw new IllegalArgumentException ( "minStringLength must be >= 0" ) ; } if ( minStringLength > maxStringLength ) { throw new IllegalArgumentException ( format ( "minStringLength (%s) must be <= than maxStringLength (%s)" , minStringLength , maxStringLength ) ) ; } setStringLengthRange ( new Range < > ( minStringLength , maxStringLength ) ) ; return this ; |
public class EntityClassReader { /** * Retrieves the type of the given property path .
* @ param propertyPath The dot - separated path of the property type to retrieve . E . g . directly property : " name " ,
* sub property : " streetAddress . number "
* @ return the type of the property with the given name or null if the propertyName is not a property of the class managed
* by this reader .
* @ throws IllegalArgumentException if propertyName is null . */
public Class getPropertyType ( String propertyPath ) { } } | if ( propertyPath == null ) { throw new IllegalArgumentException ( "Propertyname may not be null" ) ; } StringTokenizer tokenizer = new StringTokenizer ( propertyPath , "." , false ) ; return getPropertyType ( tokenizer ) ; |
public class LoggingHelper { /** * Helper method for formatting transmission and reception messages .
* @ param protocol
* The protocol used
* @ param source
* Message source
* @ param destination
* Message destination
* @ param message
* The message
* @ return A formatted message in the format :
* " protocol [ & lt ; protocol & gt ; ] source [ & lt ; source & gt ; ] destination [ & lt ; destination & gt ; ] & lt ; message & gt ; "
* < br / >
* e . g . protocol [ OpenCAS ] source [ 234.234.234.234:4321]
* destination [ 123.123.123.123:4567 ] 0x0a0b0c0d0e0f */
public static String formatCommunicationMessage ( final String protocol , final String source , final String destination , final String message ) { } } | return COMM_MESSAGE_FORMAT . format ( new Object [ ] { protocol , source , destination , message } ) ; |
public class CommerceWishListItemPersistenceImpl { /** * Returns the first commerce wish list item in the ordered set where commerceWishListId = & # 63 ; and CProductId = & # 63 ; .
* @ param commerceWishListId the commerce wish list ID
* @ param CProductId the c product ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce wish list item
* @ throws NoSuchWishListItemException if a matching commerce wish list item could not be found */
@ Override public CommerceWishListItem findByCW_CP_First ( long commerceWishListId , long CProductId , OrderByComparator < CommerceWishListItem > orderByComparator ) throws NoSuchWishListItemException { } } | CommerceWishListItem commerceWishListItem = fetchByCW_CP_First ( commerceWishListId , CProductId , orderByComparator ) ; if ( commerceWishListItem != null ) { return commerceWishListItem ; } StringBundler msg = new StringBundler ( 6 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "commerceWishListId=" ) ; msg . append ( commerceWishListId ) ; msg . append ( ", CProductId=" ) ; msg . append ( CProductId ) ; msg . append ( "}" ) ; throw new NoSuchWishListItemException ( msg . toString ( ) ) ; |
public class TypesREST { /** * Bulk retrieval API for retrieving all type definitions in Atlas
* @ return A composite wrapper object with lists of all type definitions
* @ throws Exception
* @ HTTP 200 { @ link AtlasTypesDef } with type definitions matching the search criteria or else returns empty list of type definitions */
@ GET @ Path ( "/typedefs" ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public AtlasTypesDef getAllTypeDefs ( @ Context HttpServletRequest httpServletRequest ) throws AtlasBaseException { } } | SearchFilter searchFilter = getSearchFilter ( httpServletRequest ) ; AtlasTypesDef typesDef = typeDefStore . searchTypesDef ( searchFilter ) ; return typesDef ; |
public class ArchUtils { /** * Adds the given { @ link Processor } with the given keys to the map .
* @ param keys The keys .
* @ param processor The { @ link Processor } to add .
* @ throws IllegalStateException If the key already exists . */
private static void addProcessors ( final Processor processor , final String ... keys ) throws IllegalStateException { } } | for ( final String key : keys ) { addProcessor ( key , processor ) ; } |
public class Matrix4x3d { /** * / * ( non - Javadoc )
* @ see org . joml . Matrix4x3dc # scale ( double , org . joml . Matrix4x3d ) */
public Matrix4x3d scale ( double xyz , Matrix4x3d dest ) { } } | return scale ( xyz , xyz , xyz , dest ) ; |
public class Task { /** * This method will be called in { @ link # run ( ) } to inform control that this task needs to run again */
public final void running ( ) { } } | Status previousStatus = status ; status = Status . RUNNING ; if ( tree . listeners != null && tree . listeners . size > 0 ) tree . notifyStatusUpdated ( this , previousStatus ) ; if ( control != null ) control . childRunning ( this , this ) ; |
public class ContainerDefinition { /** * The environment variables to set in the Docker container . Each key and value in the < code > Environment < / code >
* string to string map can have length of up to 1024 . We support up to 16 entries in the map .
* @ param environment
* The environment variables to set in the Docker container . Each key and value in the
* < code > Environment < / code > string to string map can have length of up to 1024 . We support up to 16 entries
* in the map .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ContainerDefinition withEnvironment ( java . util . Map < String , String > environment ) { } } | setEnvironment ( environment ) ; return this ; |
public class DataContextUtils { /** * Return a converter that can expand the property references within a string
* @ param data property context data
* @ return a Converter to expand property values within a string */
public static Converter < String , String > replaceDataReferencesConverter ( final Map < String , Map < String , String > > data ) { } } | return replaceDataReferencesConverter ( data , null , false ) ; |
public class MigrateToExtensionSettings { /** * Deletes a campaign feed . */
private static CampaignFeed deleteCampaignFeed ( AdWordsServicesInterface adWordsServices , AdWordsSession session , CampaignFeed campaignFeed ) throws RemoteException { } } | // Get the CampaignFeedService .
CampaignFeedServiceInterface campaignFeedService = adWordsServices . get ( session , CampaignFeedServiceInterface . class ) ; CampaignFeedOperation operation = new CampaignFeedOperation ( ) ; operation . setOperand ( campaignFeed ) ; operation . setOperator ( Operator . REMOVE ) ; return campaignFeedService . mutate ( new CampaignFeedOperation [ ] { operation } ) . getValue ( 0 ) ; |
public class FSNamesystem { /** * @ return list of datanodes where decommissioning is in progress */
public ArrayList < DatanodeDescriptor > getDecommissioningNodesList ( ) { } } | try { return getDecommissioningNodesList ( getDatanodeListForReport ( DatanodeReportType . LIVE ) ) ; } catch ( Exception e ) { return new ArrayList < DatanodeDescriptor > ( ) ; } |
public class BooleanSatisfiabilitySolver { private void updateDomains ( int [ ] ... allModels ) { } } | HashSet < Variable > allVars = new HashSet < Variable > ( ) ; allVars . addAll ( Arrays . asList ( this . getConstraintNetwork ( ) . getVariables ( ) ) ) ; for ( int [ ] oneModel : allModels ) { for ( int i : oneModel ) { BooleanVariable bv = ( BooleanVariable ) this . getConstraintNetwork ( ) . getVariable ( Math . abs ( i ) ) ; if ( bv != null ) { if ( i < 0 ) bv . allowFalse ( ) ; else bv . allowTrue ( ) ; if ( allVars . contains ( bv ) ) allVars . remove ( bv ) ; // System . out . println ( " BV ( " + i + " ) " + bv ) ;
} } } for ( Variable var : allVars ) { ( ( BooleanVariable ) var ) . allowFalse ( ) ; ( ( BooleanVariable ) var ) . allowTrue ( ) ; } |
public class CommercePriceListAccountRelLocalServiceBaseImpl { /** * Adds the commerce price list account rel to the database . Also notifies the appropriate model listeners .
* @ param commercePriceListAccountRel the commerce price list account rel
* @ return the commerce price list account rel that was added */
@ Indexable ( type = IndexableType . REINDEX ) @ Override public CommercePriceListAccountRel addCommercePriceListAccountRel ( CommercePriceListAccountRel commercePriceListAccountRel ) { } } | commercePriceListAccountRel . setNew ( true ) ; return commercePriceListAccountRelPersistence . update ( commercePriceListAccountRel ) ; |
public class Utils { public static String interpolate ( List < Object > prepared , JadeModel model , ExpressionHandler expressionHandler ) throws ExpressionException { } } | StringBuffer result = new StringBuffer ( ) ; for ( Object entry : prepared ) { if ( entry instanceof String ) { result . append ( entry ) ; } else if ( entry instanceof ExpressionString ) { ExpressionString expression = ( ExpressionString ) entry ; String stringValue = "" ; String value = expressionHandler . evaluateStringExpression ( expression . getValue ( ) , model ) ; if ( value != null ) { stringValue = value ; } if ( expression . isEscape ( ) ) { stringValue = escapeHTML ( stringValue ) ; } result . append ( stringValue ) ; } } return result . toString ( ) ; |
public class GraphApiCompositeClassLoaderProvider { /** * Creates a classloader which combines classloaders of all addons depending on Graph API . This insures that
* FramedGraph can always load all the relevant types of * Model classes ( as all model classes will be in Addons that
* depend on Graph API ) . */
public ClassLoader getCompositeClassLoader ( ) { } } | List < ClassLoader > loaders = new ArrayList < > ( ) ; AddonFilter filter = new AddonFilter ( ) { @ Override public boolean accept ( Addon addon ) { return addonDependsOnGraphApi ( addon ) ; } } ; for ( Addon addon : furnace . getAddonRegistry ( ) . getAddons ( filter ) ) { loaders . add ( addon . getClassLoader ( ) ) ; } return new FurnaceCompositeClassLoader ( getClass ( ) . getClassLoader ( ) , loaders ) ; |
public class Dynamic { /** * Represents a constant that is resolved by invoking a { @ code static } factory method or a constructor .
* @ param methodDescription The method or constructor to invoke to create the represented constant value .
* @ param rawArguments The method ' s or constructor ' s constant arguments .
* @ return A dynamic constant that is resolved by the supplied factory method or constructor . */
public static Dynamic ofInvocation ( MethodDescription . InDefinedShape methodDescription , List < ? > rawArguments ) { } } | if ( ! methodDescription . isConstructor ( ) && methodDescription . getReturnType ( ) . represents ( void . class ) ) { throw new IllegalArgumentException ( "Bootstrap method is no constructor or non-void static factory: " + methodDescription ) ; } else if ( methodDescription . getParameters ( ) . size ( ) + ( methodDescription . isStatic ( ) || methodDescription . isConstructor ( ) ? 0 : 1 ) != rawArguments . size ( ) ) { throw new IllegalArgumentException ( "Cannot assign " + rawArguments + " to " + methodDescription ) ; } Iterator < TypeDescription > iterator = ( methodDescription . isStatic ( ) || methodDescription . isConstructor ( ) ? methodDescription . getParameters ( ) . asTypeList ( ) . asErasures ( ) : CompoundList . of ( methodDescription . getDeclaringType ( ) , methodDescription . getParameters ( ) . asTypeList ( ) . asErasures ( ) ) ) . iterator ( ) ; List < Object > arguments = new ArrayList < Object > ( rawArguments . size ( ) ) ; for ( Object argument : rawArguments ) { if ( argument == null ) { argument = Dynamic . ofNullConstant ( ) ; } else if ( argument instanceof Class ) { argument = ( ( Class < ? > ) argument ) . isPrimitive ( ) ? ofPrimitiveType ( ( Class < ? > ) argument ) : TypeDescription . ForLoadedType . of ( ( Class < ? > ) argument ) ; } else if ( argument instanceof TypeDescription && ( ( TypeDescription ) argument ) . isPrimitive ( ) ) { argument = ofPrimitiveType ( ( TypeDescription ) argument ) ; } else if ( JavaType . METHOD_HANDLE . isInstance ( argument ) ) { argument = MethodHandle . ofLoaded ( argument ) ; } else if ( JavaType . METHOD_TYPE . isInstance ( argument ) ) { argument = MethodType . ofLoaded ( argument ) ; } TypeDescription targetType ; if ( argument instanceof JavaConstant ) { targetType = ( ( JavaConstant ) argument ) . getType ( ) ; } else if ( argument instanceof TypeDescription ) { targetType = TypeDescription . CLASS ; } else { targetType = TypeDescription . ForLoadedType . of ( argument . getClass ( ) ) ; } if ( ! targetType . asBoxed ( ) . isAssignableTo ( iterator . next ( ) . asBoxed ( ) ) ) { throw new IllegalArgumentException ( "Cannot assign argument of type " + targetType + " to " + methodDescription ) ; } arguments . add ( argument ) ; } Object [ ] asmifiedArgument = new Object [ arguments . size ( ) + 1 ] ; asmifiedArgument [ 0 ] = new Handle ( methodDescription . isConstructor ( ) ? Opcodes . H_NEWINVOKESPECIAL : Opcodes . H_INVOKESTATIC , methodDescription . getDeclaringType ( ) . getInternalName ( ) , methodDescription . getInternalName ( ) , methodDescription . getDescriptor ( ) , false ) ; int index = 1 ; for ( Object argument : arguments ) { if ( argument instanceof TypeDescription ) { argument = Type . getType ( ( ( TypeDescription ) argument ) . getDescriptor ( ) ) ; } else if ( argument instanceof JavaConstant ) { argument = ( ( JavaConstant ) argument ) . asConstantPoolValue ( ) ; } asmifiedArgument [ index ++ ] = argument ; } return new Dynamic ( new ConstantDynamic ( "invoke" , ( methodDescription . isConstructor ( ) ? methodDescription . getDeclaringType ( ) : methodDescription . getReturnType ( ) . asErasure ( ) ) . getDescriptor ( ) , new Handle ( Opcodes . H_INVOKESTATIC , CONSTANT_BOOTSTRAPS , "invoke" , "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;Ljava/lang/invoke/MethodHandle;[Ljava/lang/Object;)Ljava/lang/Object;" , false ) , asmifiedArgument ) , methodDescription . isConstructor ( ) ? methodDescription . getDeclaringType ( ) : methodDescription . getReturnType ( ) . asErasure ( ) ) ; |
public class Gravatar { /** * Retrieve the gravatar URL for the given email .
* @ param email The email for which the avatar URL should be returned .
* @ return URL to the gravatar . */
public String getUrl ( String email ) { } } | if ( email == null ) { throw new IllegalArgumentException ( "Email can't be null." ) ; } String emailHash = DigestUtils . md5Hex ( email . trim ( ) . toLowerCase ( ) ) ; boolean firstParameter = true ; // StringBuilder standard capacity is 16 characters while the minimum
// url is 63 characters long . The maximum length without
// customDefaultImage
// is 91.
StringBuilder builder = new StringBuilder ( 91 ) . append ( https ? HTTPS_URL : URL ) . append ( emailHash ) . append ( FILE_TYPE_EXTENSION ) ; if ( size != DEFAULT_SIZE ) { addParameter ( builder , "s" , Integer . toString ( size ) , firstParameter ) ; firstParameter = false ; } if ( forceDefault ) { addParameter ( builder , "f" , "y" , firstParameter ) ; firstParameter = false ; } if ( rating != DEFAULT_RATING ) { addParameter ( builder , "r" , rating . getKey ( ) , firstParameter ) ; firstParameter = false ; } if ( customDefaultImage != null ) { addParameter ( builder , "d" , customDefaultImage , firstParameter ) ; } else if ( standardDefaultImage != null ) { addParameter ( builder , "d" , standardDefaultImage . getKey ( ) , firstParameter ) ; } return builder . toString ( ) ; |
public class RoleVoterImpl { /** * This method is a pass - through for Spring - RoleVoter .
* @ param authentication principal seeking AuthZ
* @ param resource that is under protection
* @ param config access - attributes defined on resource
* @ return vote ( AccessDecisionVoter . ACCESS _ GRANTED , ACCESS _ DENIED , ACCESS _ ABSTAIN ) */
@ Override public int vote ( Authentication authentication , Object resource , Collection < ConfigAttribute > config ) { } } | int decision = super . vote ( authentication , resource , config ) ; log . debug ( VoterUtil . debugText ( "RoleVoterImpl" , authentication , config , resource , decision ) ) ; return decision ; |
public class BundleUtils { /** * Returns a optional int array value . In other words , returns the value mapped by key if it exists and is a int array .
* The bundle argument is allowed to be { @ code null } . If the bundle is null , this method returns null .
* @ param bundle a bundle . If the bundle is null , this method will return null .
* @ param key a key for the value .
* @ return a int array value if exists , null otherwise .
* @ see android . os . Bundle # getIntArray ( String ) */
@ Nullable public static int [ ] optIntArray ( @ Nullable Bundle bundle , @ Nullable String key ) { } } | return optIntArray ( bundle , key , new int [ 0 ] ) ; |
public class BitmapUtils { /** * 将指定的图片压缩成需要的尺寸
* @ param path 图片的路径
* @ param width 要压缩成的图片的宽度
* @ param height 要压缩成的图片的高度 */
public static Bitmap getBitmapBySize ( String path , int width , int height ) { } } | BitmapFactory . Options option = new BitmapFactory . Options ( ) ; option . inJustDecodeBounds = true ; BitmapFactory . decodeFile ( path , option ) ; option . inSampleSize = computeSampleSize ( option , - 1 , width * height ) ; option . inJustDecodeBounds = false ; Bitmap bitmap = null ; try { bitmap = BitmapFactory . decodeFile ( path , option ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return bitmap ; |
public class AttributeValueImpl { /** * Set the value of this metadata .
* @ param id identifier . */
public void setUUID ( String id ) { } } | try { this . value = ( id != null ) ? UUID . fromString ( id ) : null ; } catch ( Throwable exception ) { assert id != null ; this . value = UUID . nameUUIDFromBytes ( id . getBytes ( ) ) ; } this . type = AttributeType . UUID ; this . assigned = this . value != null ; |
public class PoolablePreparedStatement { /** * Method setBigDecimal .
* @ param parameterIndex
* @ param x
* @ throws SQLException
* @ see java . sql . PreparedStatement # setBigDecimal ( int , BigDecimal ) */
@ Override public void setBigDecimal ( int parameterIndex , BigDecimal x ) throws SQLException { } } | internalStmt . setBigDecimal ( parameterIndex , x ) ; |
public class DocEnv { /** * Create the AnnotationTypeElementDoc for a MethodSymbol .
* Should be called only on symbols representing annotation type elements . */
protected void makeAnnotationTypeElementDoc ( MethodSymbol meth , TreePath treePath ) { } } | AnnotationTypeElementDocImpl result = ( AnnotationTypeElementDocImpl ) methodMap . get ( meth ) ; if ( result != null ) { if ( treePath != null ) result . setTreePath ( treePath ) ; } else { result = new AnnotationTypeElementDocImpl ( this , meth , treePath ) ; methodMap . put ( meth , result ) ; } |
public class PangoolMultipleOutputs { /** * Checks if a named output name is valid .
* @ param namedOutput
* named output Name
* @ throws IllegalArgumentException
* if the output name is not valid . */
private static void checkNamedOutputName ( JobContext job , String namedOutput , boolean alreadyDefined ) { } } | validateOutputName ( namedOutput ) ; List < String > definedChannels = getNamedOutputsList ( job ) ; if ( alreadyDefined && definedChannels . contains ( namedOutput ) ) { throw new IllegalArgumentException ( "Named output '" + namedOutput + "' already alreadyDefined" ) ; } else if ( ! alreadyDefined && ! definedChannels . contains ( namedOutput ) ) { throw new IllegalArgumentException ( "Named output '" + namedOutput + "' not defined" ) ; } |
public class Servlet { /** * Set the { @ link HTTPContext } for this servlet . This is required for
* < code > Servlet < / code > to be fully initialized . Don ' t use
* { @ link # equals ( Object ) } prior to setting the < code > HTTPContext < / code > ,
* which most likely implies not adding this to a collection beforehand
* either .
* @ param context
* the context to set
* @ throws IllegalArgumentException
* if the context host is null
* @ see { @ link HTTPContext # add ( Servlet ) } */
void setParent ( HTTPContext context ) { } } | if ( context . getHost ( ) == null ) { throw new IllegalArgumentException ( context . getClass ( ) . getSimpleName ( ) + " host must not be null" ) ; } this . host = context . getHost ( ) ; this . port = context . getPort ( ) ; |
public class JsonHandler { /** * { @ inheritDoc } */
public String escape ( String request , boolean isCandidate ) { } } | String result = request ; if ( isCandidate && request != null && ! "" . equals ( request ) ) { try { StringBuilder sb = new StringBuilder ( ) ; JsonNode rootNode = mapper . readValue ( request , JsonNode . class ) ; escape ( sb , rootNode , null ) ; result = sb . toString ( ) ; } catch ( Exception e ) { log . error ( null , e ) ; } } return result ; |
public class CmsSessionManager { /** * Switches the current user to the given user . The session info is rebuild as if the given user
* performs a login at the workplace .
* @ param cms the current CmsObject
* @ param req the current request
* @ param user the user to switch to
* @ return the direct edit target if available
* @ throws CmsException if something goes wrong */
public String switchUser ( CmsObject cms , HttpServletRequest req , CmsUser user ) throws CmsException { } } | return switchUserFromSession ( cms , req , user , null ) ; |
public class ArrayQueue { /** * Returns an array containing all of the elements in this queue in
* proper sequence ( from first to last element ) ; the runtime type of the
* returned array is that of the specified array . If the queue fits in
* the specified array , it is returned therein . Otherwise , a new array
* is allocated with the runtime type of the specified array and the
* size of this queue .
* < p > If this queue fits in the specified array with room to spare
* ( i . e . , the array has more elements than this queue ) , the element in
* the array immediately following the end of the queue is set to
* < tt > null < / tt > .
* < p > Like the { @ link # toArray ( ) } method , this method acts as bridge between
* array - based and collection - based APIs . Further , this method allows
* precise control over the runtime type of the output array , and may ,
* under certain circumstances , be used to save allocation costs .
* < p > Suppose < tt > x < / tt > is a queue known to contain only strings .
* The following code can be used to dump the queue into a newly
* allocated array of < tt > String < / tt > :
* < pre > { @ code String [ ] y = x . toArray ( new String [ 0 ] ) ; } < / pre >
* Note that < tt > toArray ( new Object [ 0 ] ) < / tt > is identical in function to
* < tt > toArray ( ) < / tt > .
* @ param a the array into which the elements of the queue are to
* be stored , if it is big enough ; otherwise , a new array of the
* same runtime type is allocated for this purpose
* @ return an array containing all of the elements in this queue
* @ throws ArrayStoreException if the runtime type of the specified array
* is not a supertype of the runtime type of every element in
* this queue
* @ throws NullPointerException if the specified array is null */
@ Override public < T > T [ ] toArray ( T [ ] a ) { } } | int size = size ( ) ; if ( a . length < size ) a = ( T [ ] ) java . lang . reflect . Array . newInstance ( a . getClass ( ) . getComponentType ( ) , size ) ; if ( head < tail ) { System . arraycopy ( elements , head , a , 0 , size ( ) ) ; } else if ( head > tail ) { int headPortionLen = elements . length - head ; System . arraycopy ( elements , head , a , 0 , headPortionLen ) ; System . arraycopy ( elements , 0 , a , headPortionLen , tail ) ; } if ( a . length > size ) a [ size ] = null ; return a ; |
public class WhiteboxImpl { /** * Invoke a private or inner class method in cases where power mock cannot
* automatically determine the type of the parameters , for example when
* mixing primitive types and wrapper types in the same method . For most
* situations use { @ link # invokeMethod ( Class , String , Object . . . ) } instead .
* @ param < T > the generic type
* @ param tested the tested
* @ param methodToExecute the method to execute
* @ param argumentTypes the argument types
* @ param arguments the arguments
* @ return the t
* @ throws Exception Exception that may occur when invoking this method . */
@ SuppressWarnings ( "unchecked" ) public static synchronized < T > T invokeMethod ( Object tested , String methodToExecute , Class < ? > [ ] argumentTypes , Object ... arguments ) throws Exception { } } | final Class < ? > unmockedType = getType ( tested ) ; Method method = getMethod ( unmockedType , methodToExecute , argumentTypes ) ; if ( method == null ) { throwExceptionIfMethodWasNotFound ( unmockedType , methodToExecute , null , arguments ) ; } return ( T ) performMethodInvocation ( tested , method , arguments ) ; |
public class PutTraceSegmentsRequest { /** * A string containing a JSON document defining one or more segments or subsegments .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setTraceSegmentDocuments ( java . util . Collection ) } or
* { @ link # withTraceSegmentDocuments ( java . util . Collection ) } if you want to override the existing values .
* @ param traceSegmentDocuments
* A string containing a JSON document defining one or more segments or subsegments .
* @ return Returns a reference to this object so that method calls can be chained together . */
public PutTraceSegmentsRequest withTraceSegmentDocuments ( String ... traceSegmentDocuments ) { } } | if ( this . traceSegmentDocuments == null ) { setTraceSegmentDocuments ( new java . util . ArrayList < String > ( traceSegmentDocuments . length ) ) ; } for ( String ele : traceSegmentDocuments ) { this . traceSegmentDocuments . add ( ele ) ; } return this ; |
public class GitUtils { /** * Executes a git push .
* @ param git the Git instance used to handle the repository
* @ param remote remote name or URL
* @ param branch the remote branch being pushed to
* @ param authConfigurator the { @ link GitAuthenticationConfigurator } class used to configure the authentication
* with the remote
* repository
* @ return the result of the push
* @ throws GitAPIException if a Git related error occurs */
public static Iterable < PushResult > push ( Git git , String remote , String branch , GitAuthenticationConfigurator authConfigurator ) throws GitAPIException { } } | PushCommand push = git . push ( ) ; push . setRemote ( remote ) ; if ( StringUtils . isNotEmpty ( branch ) ) { push . setRefSpecs ( new RefSpec ( Constants . HEAD + ":" + Constants . R_HEADS + branch ) ) ; } if ( authConfigurator != null ) { authConfigurator . configureAuthentication ( push ) ; } return push . call ( ) ; |
public class WriterUtils { /** * Creates a { @ link CodecFactory } based on the specified codec name and deflate level . If codecName is absent , then
* a { @ link CodecFactory # deflateCodec ( int ) } is returned . Otherwise the codecName is converted into a
* { @ link CodecFactory } via the { @ link CodecFactory # fromString ( String ) } method .
* @ param codecName the name of the codec to use ( e . g . deflate , snappy , xz , etc . ) .
* @ param deflateLevel must be an integer from [ 0-9 ] , and is only applicable if the codecName is " deflate " .
* @ return a { @ link CodecFactory } . */
public static CodecFactory getCodecFactory ( Optional < String > codecName , Optional < String > deflateLevel ) { } } | if ( ! codecName . isPresent ( ) ) { return CodecFactory . deflateCodec ( ConfigurationKeys . DEFAULT_DEFLATE_LEVEL ) ; } else if ( codecName . get ( ) . equalsIgnoreCase ( DataFileConstants . DEFLATE_CODEC ) ) { if ( ! deflateLevel . isPresent ( ) ) { return CodecFactory . deflateCodec ( ConfigurationKeys . DEFAULT_DEFLATE_LEVEL ) ; } return CodecFactory . deflateCodec ( Integer . parseInt ( deflateLevel . get ( ) ) ) ; } else { return CodecFactory . fromString ( codecName . get ( ) . toLowerCase ( ) ) ; } |
public class Multiplication { /** * { @ inheritDoc } */
public Node simplify ( ) { } } | Node simplifiedLeft = left . simplify ( ) ; Node simplifiedRight = right . simplify ( ) ; // If the two arguments are constants , we can simplify by calculating the result , it won ' t
// ever change .
if ( simplifiedLeft instanceof Constant && simplifiedRight instanceof Constant ) { return new Constant ( simplifiedLeft . evaluate ( NO_ARGS ) * simplifiedRight . evaluate ( NO_ARGS ) ) ; } // Multiplying by one is pointless , the expression can be reduced to its other argument .
else if ( simplifiedRight instanceof Constant ) { double constant = simplifiedRight . evaluate ( NO_ARGS ) ; if ( constant == 1 ) { return simplifiedLeft ; } else if ( constant == 0 ) { return new Constant ( 0 ) ; } } else if ( simplifiedLeft instanceof Constant ) { double constant = simplifiedLeft . evaluate ( NO_ARGS ) ; if ( constant == 1 ) { return simplifiedRight ; } else if ( constant == 0 ) { return new Constant ( 0 ) ; } } return simplifiedLeft != left || simplifiedRight != right ? new Multiplication ( simplifiedLeft , simplifiedRight ) : this ; |
public class LargeObject { /** * < p > This method is inefficient , as the only way to find out the size of the object is to seek to
* the end , record the current position , then return to the original position . < / p >
* < p > A better method will be found in the future . < / p >
* @ return the size of the large object
* @ throws SQLException if a database - access error occurs . */
public int size ( ) throws SQLException { } } | int cp = tell ( ) ; seek ( 0 , SEEK_END ) ; int sz = tell ( ) ; seek ( cp , SEEK_SET ) ; return sz ; |
public class OverdueJson { /** * Unless the user knows what it ' s doing ( inputReevaluationInterval ! = null ) , for time based condition we set the reevaluation interval to match the transition to the next state */
private static DefaultDuration computeReevaluationInterval ( final Integer inputReevaluationInterval , int prevTimeSinceEarliestUnpaidInvoice , int curTimeSinceEarliestUnpaidInvoice ) { } } | if ( inputReevaluationInterval != null && inputReevaluationInterval > 0 ) { return new DefaultDuration ( ) . setUnit ( TimeUnit . DAYS ) . setNumber ( inputReevaluationInterval ) ; } if ( prevTimeSinceEarliestUnpaidInvoice == - 1 ) { return null ; } Preconditions . checkState ( prevTimeSinceEarliestUnpaidInvoice - curTimeSinceEarliestUnpaidInvoice > 0 ) ; return new DefaultDuration ( ) . setUnit ( TimeUnit . DAYS ) . setNumber ( prevTimeSinceEarliestUnpaidInvoice - curTimeSinceEarliestUnpaidInvoice ) ; |
public class OrderedThreadPoolExecutor { /** * Get the session ' s tasks queue . */
private SessionTasksQueue getSessionTasksQueue ( IoSession session ) { } } | SessionTasksQueue queue = ( SessionTasksQueue ) session . getAttribute ( TASKS_QUEUE ) ; if ( queue == null ) { queue = new SessionTasksQueue ( ) ; SessionTasksQueue oldQueue = ( SessionTasksQueue ) session . setAttributeIfAbsent ( TASKS_QUEUE , queue ) ; if ( oldQueue != null ) { queue = oldQueue ; } } return queue ; |
public class AppMsg { /** * Sets the Animations to be used when displaying / removing the Crouton .
* @ param inAnimation the Animation to be used when displaying .
* @ param outAnimation the Animation to be used when removing . */
public AppMsg setAnimation ( Animation inAnimation , Animation outAnimation ) { } } | mInAnimation = inAnimation ; mOutAnimation = outAnimation ; return this ; |
public class vrid { /** * Use this API to update vrid resources . */
public static base_responses update ( nitro_service client , vrid resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { vrid updateresources [ ] = new vrid [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { updateresources [ i ] = new vrid ( ) ; updateresources [ i ] . id = resources [ i ] . id ; updateresources [ i ] . priority = resources [ i ] . priority ; updateresources [ i ] . preemption = resources [ i ] . preemption ; updateresources [ i ] . sharing = resources [ i ] . sharing ; updateresources [ i ] . tracking = resources [ i ] . tracking ; } result = update_bulk_request ( client , updateresources ) ; } return result ; |
public class BaseRTMPClientHandler { /** * { @ inheritDoc } */
@ Override protected void onClientBandwidth ( RTMPConnection conn , Channel channel , ClientBW message ) { } } | log . trace ( "onClientBandwidth" ) ; // if the size is not equal to our write size send a server bw control message
int bandwidth = message . getBandwidth ( ) ; if ( bandwidth != bytesWrittenWindow ) { ServerBW serverBw = new ServerBW ( bandwidth ) ; channel . write ( serverBw ) ; } |
public class SamlSettingsApi { /** * Set main settings .
* Change global settings .
* @ return ApiResponse & lt ; PostLocationResponse & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < PostLocationResponse > postLocationWithHttpInfo ( ) throws ApiException { } } | com . squareup . okhttp . Call call = postLocationValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < PostLocationResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.