signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AbstractBuildingType { /** * Gets the value of the genericApplicationPropertyOfAbstractBuilding property .
* This accessor method returns a reference to the live list ,
* not a snapshot . Therefore any modification you make to the
* returned list will be present inside the JAXB object .
* This is why there is not a < CODE > set < / CODE > method for the genericApplicationPropertyOfAbstractBuilding property .
* For example , to add a new item , do as follows :
* < pre >
* get _ GenericApplicationPropertyOfAbstractBuilding ( ) . add ( newItem ) ;
* < / pre >
* Objects of the following type ( s ) are allowed in the list
* { @ link JAXBElement } { @ code < } { @ link Object } { @ code > }
* { @ link JAXBElement } { @ code < } { @ link Object } { @ code > } */
public List < JAXBElement < Object > > get_GenericApplicationPropertyOfAbstractBuilding ( ) { } } | if ( _GenericApplicationPropertyOfAbstractBuilding == null ) { _GenericApplicationPropertyOfAbstractBuilding = new ArrayList < JAXBElement < Object > > ( ) ; } return this . _GenericApplicationPropertyOfAbstractBuilding ; |
public class JavaBackedType { /** * If clazz can be represented as a JavaBackedType , returns a JavaBackedType for representing clazz .
* If clazz can not be represented as a JavaBackedType , returns BuiltInType . UNKNOWN .
* This method performs memoization when necessary .
* @ param clazz the class to be represented as JavaBackedType
* @ return JavaBackedType representing clazz or BuiltInType . UNKNOWN */
public static Type of ( Class < ? > clazz ) { } } | return Optional . ofNullable ( ( Type ) cache . computeIfAbsent ( clazz , JavaBackedType :: createIfAnnotated ) ) . orElse ( BuiltInType . UNKNOWN ) ; |
public class SwimMembershipProtocol { /** * Handles a probe from another peer .
* @ param members the probing member and local member info
* @ return the current term */
private ImmutableMember handleProbe ( Pair < ImmutableMember , ImmutableMember > members ) { } } | ImmutableMember remoteMember = members . getLeft ( ) ; ImmutableMember localMember = members . getRight ( ) ; LOGGER . trace ( "{} - Received probe {} from {}" , this . localMember . id ( ) , localMember , remoteMember ) ; // If the probe indicates a term greater than the local term , update the local term , increment and respond .
if ( localMember . incarnationNumber ( ) > this . localMember . getIncarnationNumber ( ) ) { this . localMember . setIncarnationNumber ( localMember . incarnationNumber ( ) + 1 ) ; if ( config . isBroadcastDisputes ( ) ) { broadcast ( this . localMember . copy ( ) ) ; } } // If the probe indicates this member is suspect , increment the local term and respond .
else if ( localMember . state ( ) == State . SUSPECT ) { this . localMember . setIncarnationNumber ( this . localMember . getIncarnationNumber ( ) + 1 ) ; if ( config . isBroadcastDisputes ( ) ) { broadcast ( this . localMember . copy ( ) ) ; } } // Update the state of the probing member .
updateState ( remoteMember ) ; return this . localMember . copy ( ) ; |
public class ParamConvertUtils { /** * Creates a converter function that converts value using a constructor that accepts a single String argument .
* @ return A converter function or { @ code null } if the given type doesn ' t have a public constructor that accepts
* a single String argument . */
private static Converter < List < String > , Object > createStringConstructorConverter ( Class < ? > resultClass ) { } } | try { final Constructor < ? > constructor = resultClass . getConstructor ( String . class ) ; return new BasicConverter ( defaultValue ( resultClass ) ) { @ Override protected Object convert ( String value ) throws Exception { return constructor . newInstance ( value ) ; } } ; } catch ( Exception e ) { return null ; } |
public class Helpers { /** * Returns the string form of the specified key mapping to a JSON object enclosing the selector .
* < pre >
* { @ code
* Selector selector = eq ( " year " , 2017 ) ;
* System . out . println ( selector . toString ( ) ) ;
* / / Output : " year " : { " $ eq " : 2017}
* System . out . println ( SelectorUtils . withKey ( " selector " , selector ) ) ;
* / / Output : " selector " : { " year " : { " $ eq " : 2017 } }
* < / pre >
* @ param key key to use for the selector ( usually " selector " or " partial _ filter _ selector " )
* @ param selector the selector
* @ return the string form of the selector enclosed in a JSON object , keyed by key */
public static String withKey ( String key , Selector selector ) { } } | return String . format ( "\"%s\": %s" , key , enclose ( selector ) ) ; |
public class DescribeFileSystemsRequest { /** * ( Optional ) IDs of the file systems whose descriptions you want to retrieve ( String ) .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setFileSystemIds ( java . util . Collection ) } or { @ link # withFileSystemIds ( java . util . Collection ) } if you want
* to override the existing values .
* @ param fileSystemIds
* ( Optional ) IDs of the file systems whose descriptions you want to retrieve ( String ) .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeFileSystemsRequest withFileSystemIds ( String ... fileSystemIds ) { } } | if ( this . fileSystemIds == null ) { setFileSystemIds ( new java . util . ArrayList < String > ( fileSystemIds . length ) ) ; } for ( String ele : fileSystemIds ) { this . fileSystemIds . add ( ele ) ; } return this ; |
public class CommonsAssert { /** * Like JUnit assertEquals but using { @ link EqualsHelper } .
* @ param sUserMsg
* Optional user message . May be < code > null < / code > .
* @ param x
* Fist object . May be < code > null < / code >
* @ param y
* Second object . May be < code > null < / code > . */
public static < T > void assertEquals ( @ Nullable final String sUserMsg , @ Nullable final T x , @ Nullable final T y ) { } } | if ( ! EqualsHelper . equals ( x , y ) ) fail ( "<" + x + "> is not equal to <" + y + ">" + ( sUserMsg != null && sUserMsg . length ( ) > 0 ? ": " + sUserMsg : "" ) ) ; |
public class Strings { /** * count inner string in host string
* @ param host
* a { @ link java . lang . String } object .
* @ param searchStr
* a { @ link java . lang . String } object .
* @ return a int . */
public static int count ( final String host , final String searchStr ) { } } | int count = 0 ; for ( int startIndex = 0 ; startIndex < host . length ( ) ; startIndex ++ ) { int findLoc = host . indexOf ( searchStr , startIndex ) ; if ( findLoc == - 1 ) { break ; } else { count ++ ; startIndex = findLoc + searchStr . length ( ) - 1 ; } } return count ; |
public class Matrix4x3f { /** * Set this matrix to a rotation matrix which rotates the given radians about a given axis .
* The axis described by the < code > axis < / code > vector needs to be a unit vector .
* When used with a right - handed coordinate system , the produced rotation will rotate a vector
* counter - clockwise around the rotation axis , when viewing along the negative axis direction towards the origin .
* When used with a left - handed coordinate system , the rotation is clockwise .
* The resulting matrix can be multiplied against another transformation
* matrix to obtain an additional rotation .
* In order to post - multiply a rotation transformation directly to a
* matrix , use { @ link # rotate ( float , Vector3fc ) rotate ( ) } instead .
* @ see # rotate ( float , Vector3fc )
* @ param angle
* the angle in radians
* @ param axis
* the axis to rotate about ( needs to be { @ link Vector3f # normalize ( ) normalized } )
* @ return this */
public Matrix4x3f rotation ( float angle , Vector3fc axis ) { } } | return rotation ( angle , axis . x ( ) , axis . y ( ) , axis . z ( ) ) ; |
public class AutoAssignChecker { /** * Runs one page of target assignments within a dedicated transaction
* @ param targetFilterQuery
* the target filter query
* @ param dsId
* distribution set id to assign
* @ return count of targets */
private int runTransactionalAssignment ( final TargetFilterQuery targetFilterQuery , final Long dsId ) { } } | final String actionMessage = String . format ( ACTION_MESSAGE , targetFilterQuery . getName ( ) ) ; return DeploymentHelper . runInNewTransaction ( transactionManager , "autoAssignDSToTargets" , Isolation . READ_COMMITTED . value ( ) , status -> { final List < TargetWithActionType > targets = getTargetsWithActionType ( targetFilterQuery . getQuery ( ) , dsId , targetFilterQuery . getAutoAssignActionType ( ) , PAGE_SIZE ) ; final int count = targets . size ( ) ; if ( count > 0 ) { deploymentManagement . assignDistributionSet ( dsId , targets , actionMessage ) ; } return count ; } ) ; |
public class ReflectUtil { /** * Check package access on the proxy interfaces that the given proxy class
* implements .
* @ param clazz Proxy class object */
public static void checkProxyPackageAccess ( Class < ? > clazz ) { } } | SecurityManager s = System . getSecurityManager ( ) ; if ( s != null ) { // check proxy interfaces if the given class is a proxy class
if ( Proxy . isProxyClass ( clazz ) ) { for ( Class < ? > intf : clazz . getInterfaces ( ) ) { checkPackageAccess ( intf ) ; } } } |
public class BootstrapBorderBuilder { /** * Set the border radius . Default is no radius .
* @ param eRadius
* Border type . May not be < code > null < / code > .
* @ return this for chaining */
@ Nonnull public BootstrapBorderBuilder radius ( @ Nonnull final EBootstrapBorderRadiusType eRadius ) { } } | ValueEnforcer . notNull ( eRadius , "Radius" ) ; m_eRadius = eRadius ; return this ; |
public class AOPool { /** * Gets the total number of connects for the entire pool . */
final public long getConnects ( ) { } } | long total = 0 ; synchronized ( poolLock ) { for ( PooledConnection < C > conn : allConnections ) { total += conn . connectCount . get ( ) ; } } return total ; |
public class VodClient { /** * Get the HTML5 code snippet ( encoded in Base64 ) to play the specific media resource .
* @ param request The request object containing all the options on how to
* @ return The Flash and HTML5 code snippet */
public GenerateMediaPlayerCodeResponse generateMediaPlayerCode ( GenerateMediaPlayerCodeRequest request ) { } } | checkStringNotEmpty ( request . getMediaId ( ) , "Media ID should not be null or empty!" ) ; checkIsTrue ( request . getHeight ( ) > 0 , "Height of playback view should be positive!" ) ; checkIsTrue ( request . getWidth ( ) > 0 , "Width of playback view should be positive!" ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . GET , request , PATH_MEDIA , request . getMediaId ( ) , PARA_GENCODE ) ; internalRequest . addParameter ( PARA_WIDTH , Integer . toString ( request . getWidth ( ) ) ) ; internalRequest . addParameter ( PARA_HEIGHT , Integer . toString ( request . getHeight ( ) ) ) ; internalRequest . addParameter ( PARA_AUTO_START_NEW , Boolean . toString ( request . isAutoStart ( ) ) ) ; internalRequest . addParameter ( PARA_AK , config . getCredentials ( ) . getAccessKeyId ( ) ) ; internalRequest . addParameter ( PARAM_TRANSCODING_PRESET_NAME , request . getTranscodingPresetName ( ) ) ; return invokeHttpClient ( internalRequest , GenerateMediaPlayerCodeResponse . class ) ; |
public class SDBaseOps { /** * Less than operation : elementwise x < y < br >
* If x and y arrays have equal shape , the output shape is the same as these inputs . < br >
* Note : supports broadcasting if x and y have different shapes and are broadcastable . < br >
* Returns an array with values 1 where condition is satisfied , or value 0 otherwise .
* @ param x Input 1
* @ param y Input 2
* @ return Output SDVariable with values 0 and 1 based on where the condition is satisfied */
public SDVariable lt ( SDVariable x , SDVariable y ) { } } | return lt ( null , x , y ) ; |
public class PreferenceFragment { /** * Restores the default values of all preferences , which are contained by the fragment . */
public final void restoreDefaults ( ) { } } | SharedPreferences sharedPreferences = getPreferenceManager ( ) . getSharedPreferences ( ) ; if ( getPreferenceScreen ( ) != null ) { restoreDefaults ( getPreferenceScreen ( ) , sharedPreferences ) ; } |
public class ObjectDAO { /** * Returns a list of objects that are similar to the specified object
* @ param object
* @ param threshold
* @ return */
public List < Similarity > similar ( Image object , double threshold ) { } } | // return getDatastore ( ) . find ( Similarity . class ) . field ( " firstObject " ) . equal ( object ) . order ( " similarityScore " ) . asList ( ) ;
Query < Similarity > q = getDatastore ( ) . createQuery ( Similarity . class ) ; q . or ( q . criteria ( "firstObject" ) . equal ( object ) , q . criteria ( "secondObject" ) . equal ( object ) ) ; return q . order ( "-similarityScore" ) . filter ( "similarityScore >" , threshold ) . asList ( ) ; |
public class Emitter { /** * syck _ emitter _ mark _ node */
public long markNode ( Object n ) { } } | long oid = 0 ; if ( this . markers == null ) { this . markers = new IdentityHashMap < Object , Long > ( ) ; } if ( ! this . markers . containsKey ( n ) ) { oid = this . markers . size ( ) + 1 ; markers . put ( n , oid ) ; } else { oid = this . markers . get ( n ) ; if ( this . anchors == null ) { this . anchors = new HashMap < Long , String > ( ) ; } if ( ! anchors . containsKey ( oid ) ) { int idx = 0 ; String anc = this . anchor_format == null ? YAML . DEFAULT_ANCHOR_FORMAT : this . anchor_format ; idx = anchors . size ( ) + 1 ; String anchor_name = String . format ( anc , idx ) ; anchors . put ( oid , anchor_name ) ; } } return oid ; |
public class LockedMessageEnumerationImpl { /** * Private method to determine how many messages have not been seen as yet . It does this by
* looking at the number of non - null elements from the current item to the end of the array .
* @ return Returns the number of unseen items . */
private int getUnSeenMessageCount ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getUnseenMessageCount" ) ; int remain = 0 ; for ( int x = nextIndex ; x < messages . length ; x ++ ) { if ( messages [ x ] != null ) remain ++ ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getUnseenMessageCount" , "" + remain ) ; return remain ; |
public class Journaler { /** * Delegate to the JournalWorker . */
public Date purgeObject ( Context context , String pid , String logMessage ) throws ServerException { } } | return worker . purgeObject ( context , pid , logMessage ) ; |
public class JQMList { /** * Find the divider with the given text . This method will search all the dividers and return the first divider
* found with the given text .
* @ return the divider with the given text ( if found , or null otherwise ) . */
public JQMListDivider findDivider ( String text ) { } } | for ( int k = 0 ; k < list . getWidgetCount ( ) ; k ++ ) { Widget w = list . getWidget ( k ) ; if ( isDivider ( w ) && w . getElement ( ) . getInnerText ( ) . equals ( text ) ) { return ( JQMListDivider ) w ; } } return null ; |
public class FixedCalendarInterval { /** * helper method for toString ( ) in subclasses */
static void formatYear ( StringBuilder sb , int year ) { } } | int value = year ; if ( value < 0 ) { sb . append ( '-' ) ; value = Math . negateExact ( year ) ; } if ( value >= 10000 ) { if ( year > 0 ) { sb . append ( '+' ) ; } } else if ( value < 1000 ) { sb . append ( '0' ) ; if ( value < 100 ) { sb . append ( '0' ) ; if ( value < 10 ) { sb . append ( '0' ) ; } } } sb . append ( value ) ; |
public class Job { /** * Set the value class for job outputs .
* @ param theClass the value class for job outputs .
* @ throws IllegalStateException if the job is submitted */
public void setOutputValueClass ( Class < ? > theClass ) throws IllegalStateException { } } | ensureState ( JobState . DEFINE ) ; conf . setOutputValueClass ( theClass ) ; |
public class HeapClusterAnalyzer { /** * Process entry point and blacklist configuration */
public void prepare ( ) { } } | for ( JavaClass jc : heap . getAllClasses ( ) ) { for ( TypeFilterStep it : interestingTypes ) { if ( it . evaluate ( jc ) ) { rootClasses . add ( jc . getName ( ) ) ; } } for ( TypeFilterStep bt : blacklistedTypes ) { if ( bt . evaluate ( jc ) ) { blacklist . add ( jc . getName ( ) ) ; } } for ( PathStep [ ] bp : blacklistedMethods ) { TypeFilterStep ts = ( TypeFilterStep ) bp [ 0 ] ; String fn = ( ( FieldStep ) bp [ 1 ] ) . getFieldName ( ) ; if ( ts . evaluate ( jc ) ) { for ( Field f : jc . getFields ( ) ) { if ( fn == null || fn . equals ( f . getName ( ) ) ) { blacklist . add ( jc . getName ( ) + "#" + f . getName ( ) ) ; } } } } } |
public class TxtmarkMarkdownConverter { /** * / * ( non - Javadoc )
* @ see org . opoo . press . Converter # convert ( java . lang . String ) */
@ Override public String convert ( String content ) { } } | if ( config != null ) { return Processor . process ( content , config ) ; } else { return Processor . process ( content ) ; } |
public class Transaction { /** * Rolls a transaction back and releases all read locks . */
ApiFuture < Void > rollback ( ) { } } | pending = false ; RollbackRequest . Builder reqBuilder = RollbackRequest . newBuilder ( ) ; reqBuilder . setTransaction ( transactionId ) ; reqBuilder . setDatabase ( firestore . getDatabaseName ( ) ) ; ApiFuture < Empty > rollbackFuture = firestore . sendRequest ( reqBuilder . build ( ) , firestore . getClient ( ) . rollbackCallable ( ) ) ; return ApiFutures . transform ( rollbackFuture , new ApiFunction < Empty , Void > ( ) { @ Override public Void apply ( Empty beginTransactionResponse ) { return null ; } } ) ; |
public class OidcClientRegistrationUtils { /** * Gets client registration response .
* @ param registeredService the registered service
* @ param serverPrefix the server prefix
* @ return the client registration response */
@ SneakyThrows public static OidcClientRegistrationResponse getClientRegistrationResponse ( final OidcRegisteredService registeredService , final String serverPrefix ) { } } | val clientResponse = new OidcClientRegistrationResponse ( ) ; clientResponse . setApplicationType ( registeredService . getApplicationType ( ) ) ; clientResponse . setClientId ( registeredService . getClientId ( ) ) ; clientResponse . setClientSecret ( registeredService . getClientSecret ( ) ) ; clientResponse . setSubjectType ( registeredService . getSubjectType ( ) ) ; clientResponse . setTokenEndpointAuthMethod ( registeredService . getTokenEndpointAuthenticationMethod ( ) ) ; clientResponse . setClientName ( registeredService . getName ( ) ) ; clientResponse . setRedirectUris ( CollectionUtils . wrap ( registeredService . getServiceId ( ) ) ) ; clientResponse . setContacts ( registeredService . getContacts ( ) . stream ( ) . map ( RegisteredServiceContact :: getName ) . filter ( StringUtils :: isNotBlank ) . collect ( Collectors . toList ( ) ) ) ; clientResponse . setGrantTypes ( Arrays . stream ( OAuth20GrantTypes . values ( ) ) . map ( type -> type . getType ( ) . toLowerCase ( ) ) . collect ( Collectors . toList ( ) ) ) ; clientResponse . setResponseTypes ( Arrays . stream ( OAuth20ResponseTypes . values ( ) ) . map ( type -> type . getType ( ) . toLowerCase ( ) ) . collect ( Collectors . toList ( ) ) ) ; val validator = new SimpleUrlValidatorFactoryBean ( false ) . getObject ( ) ; if ( Objects . requireNonNull ( validator ) . isValid ( registeredService . getJwks ( ) ) ) { clientResponse . setJwksUri ( registeredService . getJwks ( ) ) ; } else { val jwks = new JsonWebKeySet ( registeredService . getJwks ( ) ) ; clientResponse . setJwks ( jwks . toJson ( ) ) ; } clientResponse . setLogo ( registeredService . getLogo ( ) ) ; clientResponse . setPolicyUri ( registeredService . getInformationUrl ( ) ) ; clientResponse . setTermsOfUseUri ( registeredService . getPrivacyUrl ( ) ) ; clientResponse . setRedirectUris ( CollectionUtils . wrapList ( registeredService . getServiceId ( ) ) ) ; val clientConfigUri = getClientConfigurationUri ( registeredService , serverPrefix ) ; clientResponse . setRegistrationClientUri ( clientConfigUri ) ; return clientResponse ; |
public class BeanMap { /** * { @ inheritDoc }
* Returns the value of the bean ' s property with the given name .
* < br >
* The given name must be a { @ link String } and must not be
* null ; otherwise , this method returns < code > null < / code > .
* If the bean defines a property with the given name , the value of
* that property is returned . Otherwise , < code > null < / code > is
* returned .
* < br >
* Write - only properties will not be matched as the test operates against
* property read methods . */
@ Override public Object get ( Object name ) { } } | if ( bean != null ) { BeanInvoker invoker = getReadInvoker ( ( String ) name ) ; if ( invoker != null ) { try { return transform ( invoker ) ; } catch ( Throwable e ) { throw new IllegalArgumentException ( e ) ; } } } return null ; |
public class KMLOutputHandler { /** * Get color from a simple heatmap .
* @ param val Score value
* @ return Color in heatmap */
public static final Color getColorForValue ( double val ) { } } | // Color positions
double [ ] pos = new double [ ] { 0.0 , 0.6 , 0.8 , 1.0 } ; // Colors at these positions
Color [ ] cols = new Color [ ] { new Color ( 0.0f , 0.0f , 0.0f , 0.6f ) , new Color ( 0.0f , 0.0f , 1.0f , 0.8f ) , new Color ( 1.0f , 0.0f , 0.0f , 0.9f ) , new Color ( 1.0f , 1.0f , 0.0f , 1.0f ) } ; assert ( pos . length == cols . length ) ; if ( val < pos [ 0 ] ) { val = pos [ 0 ] ; } // Linear interpolation :
for ( int i = 1 ; i < pos . length ; i ++ ) { if ( val <= pos [ i ] ) { Color prev = cols [ i - 1 ] ; Color next = cols [ i ] ; final double mix = ( val - pos [ i - 1 ] ) / ( pos [ i ] - pos [ i - 1 ] ) ; final int r = ( int ) ( ( 1 - mix ) * prev . getRed ( ) + mix * next . getRed ( ) ) ; final int g = ( int ) ( ( 1 - mix ) * prev . getGreen ( ) + mix * next . getGreen ( ) ) ; final int b = ( int ) ( ( 1 - mix ) * prev . getBlue ( ) + mix * next . getBlue ( ) ) ; final int a = ( int ) ( ( 1 - mix ) * prev . getAlpha ( ) + mix * next . getAlpha ( ) ) ; Color col = new Color ( r , g , b , a ) ; return col ; } } return cols [ cols . length - 1 ] ; |
public class MetadataService { /** * Adds { @ link Permission } s to the specified { @ code path } . */
private CompletableFuture < Revision > addPermissionAtPointer ( Author author , String projectName , JsonPointer path , Collection < Permission > permission , String commitSummary ) { } } | final Change < JsonNode > change = Change . ofJsonPatch ( METADATA_JSON , asJsonArray ( new TestAbsenceOperation ( path ) , new AddOperation ( path , Jackson . valueToTree ( permission ) ) ) ) ; return metadataRepo . push ( projectName , Project . REPO_DOGMA , author , commitSummary , change ) ; |
public class CommonsArchiver { /** * Returns a new ArchiveInputStream for reading archives . Subclasses can override this to return their own custom
* implementation .
* @ param archive the archive file to stream from
* @ return a new ArchiveInputStream for the given archive file
* @ throws IOException propagated IO exceptions */
protected ArchiveInputStream createArchiveInputStream ( File archive ) throws IOException { } } | try { return CommonsStreamFactory . createArchiveInputStream ( archive ) ; } catch ( ArchiveException e ) { throw new IOException ( e ) ; } |
public class HString { /** * Left context h string .
* @ param type the type
* @ param windowSize the window size
* @ return the h string */
public HString leftContext ( @ NonNull AnnotationType type , int windowSize ) { } } | windowSize = Math . abs ( windowSize ) ; Preconditions . checkArgument ( windowSize >= 0 ) ; int sentenceStart = sentence ( ) . start ( ) ; if ( windowSize == 0 || start ( ) <= sentenceStart ) { return Fragments . detachedEmptyHString ( ) ; } HString context = firstToken ( ) . previous ( type ) ; for ( int i = 1 ; i < windowSize ; i ++ ) { HString next = context . firstToken ( ) . previous ( type ) ; if ( next . end ( ) <= sentenceStart ) { break ; } context = context . union ( next ) ; } return context ; |
public class TileConfiguration { /** * Get the index for the fixed resolution that is closest to the provided resolution .
* @ param resolution The resolution to request the closest fixed resolution level for .
* @ return Returns the fixed resolution level index . */
public int getResolutionIndex ( double resolution ) { } } | double maximumResolution = getMaximumResolution ( ) ; if ( resolution >= maximumResolution ) { return 0 ; } double minimumResolution = getMinimumResolution ( ) ; if ( resolution <= minimumResolution ) { return resolutions . size ( ) - 1 ; } for ( int i = 0 ; i < resolutions . size ( ) ; i ++ ) { double upper = resolutions . get ( i ) ; double lower = resolutions . get ( i + 1 ) ; if ( resolution < upper && resolution >= lower ) { if ( Math . abs ( upper - resolution ) >= Math . abs ( lower - resolution ) ) { return i + 1 ; } else { return i ; } } } return 0 ; |
public class CompactionJobConfigurator { /** * Concatenate multiple directory or file names into one path
* @ return Concatenated path or null if the parameter is empty */
private Path concatPaths ( String ... names ) { } } | if ( names == null || names . length == 0 ) { return null ; } Path cur = new Path ( names [ 0 ] ) ; for ( int i = 1 ; i < names . length ; ++ i ) { cur = new Path ( cur , new Path ( names [ i ] ) ) ; } return cur ; |
public class Array { /** * Adds an entry to the end of an array and returns the new array .
* @ param ar array to be resized
* @ param e entry to be added
* @ param < T > array type
* @ return array */
public static < T > T [ ] add ( final T [ ] ar , final T e ) { } } | final int s = ar . length ; final T [ ] t = Arrays . copyOf ( ar , s + 1 ) ; t [ s ] = e ; return t ; |
public class LPPrimalDualMethod { /** * Return the upper bounds for the problem . If the original upper bounds are null , the they are set to
* the value of < i > maxUBValue < / i > . Otherwise , any upper bound is limited to the value of < i > maxUBValue < / i > */
@ Override protected DoubleMatrix1D getUb ( ) { } } | if ( this . limitedUb == null ) { if ( super . getUb ( ) == null ) { this . limitedUb = F1 . make ( getC ( ) . size ( ) , maxUBValue ) ; } else { this . limitedUb = F1 . make ( super . getUb ( ) . size ( ) ) ; for ( int i = 0 ; i < super . getUb ( ) . size ( ) ; i ++ ) { double ubi = super . getUb ( ) . getQuick ( i ) ; if ( maxUBValue < ubi ) { log . warn ( "the " + i + "-th upper bound was limited form " + ubi + " to the value of maxUBValue: " + maxUBValue ) ; limitedUb . setQuick ( i , maxUBValue ) ; } else { limitedUb . setQuick ( i , ubi ) ; } } } } return limitedUb ; |
public class ExportClientVpnClientCertificateRevocationListRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < ExportClientVpnClientCertificateRevocationListRequest > getDryRunRequest ( ) { } } | Request < ExportClientVpnClientCertificateRevocationListRequest > request = new ExportClientVpnClientCertificateRevocationListRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class Props { /** * Check key in current Props then search in parent */
public boolean containsKey ( final Object k ) { } } | return this . _current . containsKey ( k ) || ( this . _parent != null && this . _parent . containsKey ( k ) ) ; |
public class TrustedIdProvidersInner { /** * Updates the specified trusted identity provider .
* @ param resourceGroupName The name of the Azure resource group .
* @ param accountName The name of the Data Lake Store account .
* @ param trustedIdProviderName The name of the trusted identity provider . This is used for differentiation of providers in the account .
* @ 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 < TrustedIdProviderInner > updateAsync ( String resourceGroupName , String accountName , String trustedIdProviderName , final ServiceCallback < TrustedIdProviderInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( updateWithServiceResponseAsync ( resourceGroupName , accountName , trustedIdProviderName ) , serviceCallback ) ; |
public class SimpleKeyValue { /** * Factory method used to construct a new instance of { @ link SimpleKeyValue } initialized from the given { @ link Map . Entry } .
* @ param < KEY > { @ link Class type } of the key .
* @ param < VALUE > { @ link Class type } of the value .
* @ param mapEntry { @ link Map . Entry } used to construct and initialize an instance of { @ link SimpleKeyValue } .
* @ return a new instance of { @ link SimpleKeyValue } initialized from the the given { @ link Map . Entry } .
* @ see # newKeyValue ( Object , Object )
* @ see java . util . Map . Entry */
public static < KEY , VALUE > SimpleKeyValue < KEY , VALUE > from ( Map . Entry < KEY , VALUE > mapEntry ) { } } | Assert . notNull ( mapEntry , "Map.Entry is required" ) ; return newKeyValue ( mapEntry . getKey ( ) , mapEntry . getValue ( ) ) ; |
public class Matrix4f { /** * Apply a symmetric perspective projection frustum transformation for a left - handed coordinate system
* using the given NDC z range to this matrix .
* If < code > M < / code > is < code > this < / code > matrix and < code > P < / code > the perspective projection matrix ,
* then the new matrix will be < code > M * P < / code > . So when transforming a
* vector < code > v < / code > with the new matrix by using < code > M * P * v < / code > ,
* the perspective projection will be applied first !
* In order to set the matrix to a perspective frustum transformation without post - multiplying ,
* use { @ link # setPerspectiveLH ( float , float , float , float , boolean ) setPerspectiveLH } .
* @ see # setPerspectiveLH ( float , float , float , float , boolean )
* @ param fovy
* the vertical field of view in radians ( must be greater than zero and less than { @ link Math # PI PI } )
* @ param aspect
* the aspect ratio ( i . e . width / height ; must be greater than zero )
* @ param zNear
* near clipping plane distance . If the special value { @ link Float # POSITIVE _ INFINITY } is used , the near clipping plane will be at positive infinity .
* In that case , < code > zFar < / code > may not also be { @ link Float # POSITIVE _ INFINITY } .
* @ param zFar
* far clipping plane distance . If the special value { @ link Float # POSITIVE _ INFINITY } is used , the far clipping plane will be at positive infinity .
* In that case , < code > zNear < / code > may not also be { @ link Float # POSITIVE _ INFINITY } .
* @ param zZeroToOne
* whether to use Vulkan ' s and Direct3D ' s NDC z range of < code > [ 0 . . + 1 ] < / code > when < code > true < / code >
* or whether to use OpenGL ' s NDC z range of < code > [ - 1 . . + 1 ] < / code > when < code > false < / code >
* @ return a matrix holding the result */
public Matrix4f perspectiveLH ( float fovy , float aspect , float zNear , float zFar , boolean zZeroToOne ) { } } | return perspectiveLH ( fovy , aspect , zNear , zFar , zZeroToOne , thisOrNew ( ) ) ; |
public class FixtureCompilerMojo { /** * { @ inheritDoc } */
@ Override public void execute ( ) throws MojoExecutionException , CompilationFailureException { } } | if ( skip ) { getLog ( ) . info ( "Not compiling fixture sources." ) ; } else { getLog ( ) . info ( "Compiling fixture sources at " + fixtureSourceDirectory . getAbsolutePath ( ) ) ; getLog ( ) . info ( "to directory " + fixtureOutputDirectory . getAbsolutePath ( ) ) ; super . execute ( ) ; } |
public class Base64 { /** * Decodes bytes from base 64 , returning bytes .
* @ param in bytes to decode
* @ return decoded bytes */
public static byte [ ] decode ( byte [ ] in ) { } } | return org . apache . commons . codec . binary . Base64 . decodeBase64 ( in ) ; |
public class ToStringGenerator { /** * Generates a toString method using concatenation or a StringBuilder . */
public static void addToString ( SourceBuilder code , Datatype datatype , Map < Property , PropertyCodeGenerator > generatorsByProperty , boolean forPartial ) { } } | String typename = ( forPartial ? "partial " : "" ) + datatype . getType ( ) . getSimpleName ( ) ; Predicate < PropertyCodeGenerator > isOptional = generator -> { Initially initially = generator . initialState ( ) ; return ( initially == Initially . OPTIONAL || ( initially == Initially . REQUIRED && forPartial ) ) ; } ; boolean anyOptional = generatorsByProperty . values ( ) . stream ( ) . anyMatch ( isOptional ) ; boolean allOptional = generatorsByProperty . values ( ) . stream ( ) . allMatch ( isOptional ) && ! generatorsByProperty . isEmpty ( ) ; code . addLine ( "" ) . addLine ( "@%s" , Override . class ) . addLine ( "public %s toString() {" , String . class ) ; if ( allOptional ) { bodyWithBuilderAndSeparator ( code , datatype , generatorsByProperty , typename ) ; } else if ( anyOptional ) { bodyWithBuilder ( code , datatype , generatorsByProperty , typename , isOptional ) ; } else { bodyWithConcatenation ( code , generatorsByProperty , typename ) ; } code . addLine ( "}" ) ; |
public class MediaModuleGenerator { /** * Generation of responses tag .
* @ param m source
* @ param e element to attach new element to */
private void generateResponses ( final Metadata m , final Element e ) { } } | if ( m . getResponses ( ) == null || m . getResponses ( ) . length == 0 ) { return ; } final Element responsesElements = new Element ( "responses" , NS ) ; for ( final String response : m . getResponses ( ) ) { addNotNullElement ( responsesElements , "response" , response ) ; } e . addContent ( responsesElements ) ; |
public class Session { /** * Executes SQL query , which returns single entity .
* @ param < T > Entity type .
* @ param query SQL query string .
* @ param entityClass Entity class .
* @ param params Parameters , which will be placed instead of ' ? ' signs .
* @ return Single result entity .
* @ throws SQLException In general SQL error case .
* @ throws NoSuchFieldException If result set has field which entity class doesn ' t .
* @ throws InstantiationException If entity class hasn ' t default constructor .
* @ throws IllegalAccessException If entity class is not accessible . */
public < T > T getSingle ( String query , Class < T > entityClass , Object ... params ) throws SQLException , NoSuchFieldException , InstantiationException , IllegalAccessException { } } | Cursor < T > cursor = getCursor ( query , entityClass , params ) ; return cursor . fetchSingle ( ) ; |
public class TrmMessageFactoryImpl { /** * Create a new , empty TrmMeConnectReply message
* @ return The new TrmMeConnectReply .
* @ exception MessageCreateFailedException Thrown if such a message can not be created */
public TrmMeConnectReply createNewTrmMeConnectReply ( ) throws MessageCreateFailedException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createNewTrmMeConnectReply" ) ; TrmMeConnectReply msg = null ; try { msg = new TrmMeConnectReplyImpl ( ) ; } catch ( MessageDecodeFailedException e ) { /* No need to FFDC this as JsMsgObject will already have done so */
// No FFDC code needed
throw new MessageCreateFailedException ( e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createNewTrmMeConnectReply" ) ; return msg ; |
public class ExpressRouteGatewaysInner { /** * Fetches the details of a ExpressRoute gateway in a resource group .
* @ param resourceGroupName The name of the resource group .
* @ param expressRouteGatewayName The name of the ExpressRoute gateway .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the ExpressRouteGatewayInner object if successful . */
public ExpressRouteGatewayInner getByResourceGroup ( String resourceGroupName , String expressRouteGatewayName ) { } } | return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , expressRouteGatewayName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class Topic { public void remove ( SubjectObserver < T > subjectObserver ) { } } | if ( subjectObserver == null || subjectObserver . getId ( ) == null || subjectObserver . getId ( ) . length ( ) == 0 ) return ; // do nothing
// remove
observerMap . remove ( subjectObserver . getId ( ) ) ; |
public class SecurityUtils { /** * An app can edit itself or delete itself . It can ' t read , edit , overwrite or delete other apps , unless it is the
* root app .
* @ param app an app
* @ param object another object
* @ return true if app passes the check */
public static boolean checkImplicitAppPermissions ( App app , ParaObject object ) { } } | if ( app != null && object != null ) { return isNotAnApp ( object . getType ( ) ) || app . getId ( ) . equals ( object . getId ( ) ) || app . isRootApp ( ) ; } return false ; |
public class Requests { /** * Create a new { @ link PublishUpdate } instance that is used to publish
* a list of metadata on a link between two { @ link Identifier } instances
* with a specific { @ link MetadataLifetime } .
* @ param i1 the first { @ link Identifier } of the link
* @ param i2 the second { @ link Identifier } of the link
* @ param mdlist a list of metadata objects
* @ param lifetime the lifetime of the new metadata
* @ return the new { @ link PublishUpdate } instance */
public static PublishUpdate createPublishUpdate ( Identifier i1 , Identifier i2 , Collection < Document > mdlist , MetadataLifetime lifetime ) { } } | if ( mdlist == null ) { throw new NullPointerException ( "mdlist not allowed to be null" ) ; } PublishUpdate pu = createPublishUpdate ( ) ; fillMetadataHolder ( pu , i1 , i2 , mdlist ) ; pu . setLifeTime ( lifetime ) ; return pu ; |
public class ClassHash { /** * Set class hash .
* @ param classHash
* the class hash value to set */
public void setClassHash ( byte [ ] classHash ) { } } | this . classHash = new byte [ classHash . length ] ; System . arraycopy ( classHash , 0 , this . classHash , 0 , classHash . length ) ; |
public class RenderScopedContext { /** * Context Methods */
@ SuppressWarnings ( "unchecked" ) public < T > T get ( final Contextual < T > component ) { } } | assertActive ( ) ; return ( T ) getComponentInstanceMap ( ) . get ( component ) ; |
public class Router { /** * TODO : To be compatible with CBL iOS , this method should move to Replicator . activeTaskInfo ( ) .
* TODO : Reference : - ( NSDictionary * ) activeTaskInfo in CBL _ Replicator . m */
private static Map < String , Object > getActivity ( Replication replicator ) { } } | // For schema , see http : / / wiki . apache . org / couchdb / HttpGetActiveTasks
Map < String , Object > activity = new HashMap < String , Object > ( ) ; String source = replicator . getRemoteUrl ( ) . toExternalForm ( ) ; String target = replicator . getLocalDatabase ( ) . getName ( ) ; if ( ! replicator . isPull ( ) ) { String tmp = source ; source = target ; target = tmp ; } int processed = replicator . getCompletedChangesCount ( ) ; int total = replicator . getChangesCount ( ) ; String status = String . format ( Locale . ENGLISH , "Processed %d / %d changes" , processed , total ) ; if ( ! replicator . getStatus ( ) . equals ( ReplicationStatus . REPLICATION_ACTIVE ) ) { // These values match the values for IOS .
if ( replicator . getStatus ( ) . equals ( ReplicationStatus . REPLICATION_IDLE ) ) { status = "Idle" ; // nonstandard
} else if ( replicator . getStatus ( ) . equals ( ReplicationStatus . REPLICATION_STOPPED ) ) { status = "Stopped" ; } else if ( replicator . getStatus ( ) . equals ( ReplicationStatus . REPLICATION_OFFLINE ) ) { status = "Offline" ; // nonstandard
} } int progress = ( total > 0 ) ? ( int ) 100 * processed / total : 0 ; activity . put ( "type" , "Replication" ) ; activity . put ( "task" , replicator . getSessionID ( ) ) ; activity . put ( "source" , source ) ; activity . put ( "target" , target ) ; activity . put ( "status" , status ) ; activity . put ( "progress" , progress ) ; activity . put ( "continuous" , replicator . isContinuous ( ) ) ; // NOTE : Need to support " x _ active _ requests "
if ( replicator . getLastError ( ) != null ) { String msg = String . format ( Locale . ENGLISH , "Replicator error: %s. Repl: %s. Source: %s, Target: %s" , replicator . getLastError ( ) , replicator , source , target ) ; Log . w ( TAG , msg ) ; Throwable error = replicator . getLastError ( ) ; int statusCode = 400 ; if ( error instanceof RemoteRequestResponseException ) { statusCode = ( ( RemoteRequestResponseException ) error ) . getCode ( ) ; } Object [ ] errorObjects = new Object [ ] { statusCode , replicator . getLastError ( ) . toString ( ) } ; activity . put ( "error" , errorObjects ) ; } else { // NOTE : Following two parameters : CBL iOS does not support . We might remove them in the future .
activity . put ( "change_count" , total ) ; activity . put ( "completed_change_count" , processed ) ; } return activity ; |
public class CmsCategoryDialog { /** * Initializes the dialog content . < p >
* @ param categoryInfo the resource category info */
public void initialize ( CmsResourceCategoryInfo categoryInfo ) { } } | m_initializing = false ; m_initialized = true ; m_main . add ( new CmsListItemWidget ( categoryInfo . getResourceInfo ( ) ) ) ; m_categoryTree = new CmsCategoryTree ( categoryInfo . getCurrentCategories ( ) , 300 , false , categoryInfo . getCategoryTree ( ) , m_collapsed ) ; m_categoryTree . addValueChangeHandler ( new ValueChangeHandler < List < String > > ( ) { public void onValueChange ( ValueChangeEvent < List < String > > event ) { setChanged ( ) ; } } ) ; m_main . add ( m_categoryTree ) ; m_categoryTree . truncate ( "CATEGORIES" , WIDE_WIDTH - 20 ) ; LockIcon lock = categoryInfo . getResourceInfo ( ) . getLockIcon ( ) ; if ( ( lock == null ) || lock . equals ( LockIcon . NONE ) || lock . equals ( LockIcon . OPEN ) || lock . equals ( LockIcon . SHARED_OPEN ) ) { m_saveButton . disable ( Messages . get ( ) . key ( Messages . GUI_NOTHING_CHANGED_0 ) ) ; } else { m_categoryTree . disable ( Messages . get ( ) . key ( Messages . GUI_RESOURCE_LOCKED_0 ) ) ; m_saveButton . disable ( Messages . get ( ) . key ( Messages . GUI_RESOURCE_LOCKED_0 ) ) ; } setWidth ( WIDE_WIDTH ) ; if ( isShowing ( ) ) { center ( ) ; } |
public class Txt2Bin { /** * 输出模型
* @ param inText
* @ param outBin
* @ throws IOException */
private static void text2binModel ( String inText , String outBin ) throws IOException { } } | ObjectOutputStream out = new ObjectOutputStream ( new BufferedOutputStream ( new GZIPOutputStream ( new FileOutputStream ( outBin ) ) ) ) ; String rules = loadtxt ( inText ) ; Pattern p = Pattern . compile ( rules ) ; out . writeObject ( p ) ; out . close ( ) ; |
public class TorqueModelDef { /** * Adds a table for the given class descriptor ( if necessary ) .
* @ param classDef The class descriptor */
private void addTableFor ( ClassDescriptorDef classDef ) { } } | String name = classDef . getProperty ( PropertyHelper . OJB_PROPERTY_TABLE ) ; TableDef tableDef = getTable ( name ) ; FieldDescriptorDef fieldDef ; ReferenceDescriptorDef refDef ; CollectionDescriptorDef collDef ; ColumnDef columnDef ; IndexDef indexDef ; if ( tableDef == null ) { tableDef = new TableDef ( name ) ; addTable ( tableDef ) ; } if ( classDef . hasProperty ( PropertyHelper . OJB_PROPERTY_DOCUMENTATION ) ) { tableDef . setProperty ( PropertyHelper . OJB_PROPERTY_DOCUMENTATION , classDef . getProperty ( PropertyHelper . OJB_PROPERTY_DOCUMENTATION ) ) ; } if ( classDef . hasProperty ( PropertyHelper . OJB_PROPERTY_TABLE_DOCUMENTATION ) ) { tableDef . setProperty ( PropertyHelper . OJB_PROPERTY_TABLE_DOCUMENTATION , classDef . getProperty ( PropertyHelper . OJB_PROPERTY_TABLE_DOCUMENTATION ) ) ; } for ( Iterator fieldIt = classDef . getFields ( ) ; fieldIt . hasNext ( ) ; ) { fieldDef = ( FieldDescriptorDef ) fieldIt . next ( ) ; if ( fieldDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_IGNORE , false ) || fieldDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_VIRTUAL_FIELD , false ) ) { continue ; } columnDef = addColumnFor ( fieldDef , tableDef ) ; if ( fieldDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_INDEXED , false ) ) { // add the field to the default index
indexDef = tableDef . getIndex ( null ) ; if ( indexDef == null ) { indexDef = new IndexDef ( null , false ) ; tableDef . addIndex ( indexDef ) ; } indexDef . addColumn ( columnDef . getName ( ) ) ; } } for ( Iterator refIt = classDef . getReferences ( ) ; refIt . hasNext ( ) ; ) { refDef = ( ReferenceDescriptorDef ) refIt . next ( ) ; if ( ! refDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_IGNORE , false ) ) { addForeignkeys ( refDef , tableDef ) ; } } for ( Iterator collIt = classDef . getCollections ( ) ; collIt . hasNext ( ) ; ) { collDef = ( CollectionDescriptorDef ) collIt . next ( ) ; if ( ! collDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_IGNORE , false ) ) { if ( collDef . hasProperty ( PropertyHelper . OJB_PROPERTY_INDIRECTION_TABLE ) ) { addIndirectionTable ( collDef ) ; } else { addForeignkeys ( collDef , tableDef ) ; } } } for ( Iterator indexIt = classDef . getIndexDescriptors ( ) ; indexIt . hasNext ( ) ; ) { addIndex ( ( IndexDescriptorDef ) indexIt . next ( ) , tableDef ) ; } |
public class JobScheduler { /** * Executes a { @ link ScheduledJob } immediately .
* @ param scheduledJobId ID of the { @ link ScheduledJob } to run */
public synchronized void runNow ( String scheduledJobId ) { } } | ScheduledJob scheduledJob = getJob ( scheduledJobId ) ; try { JobKey jobKey = new JobKey ( scheduledJobId , SCHEDULED_JOB_GROUP ) ; if ( quartzScheduler . checkExists ( jobKey ) ) { // Run job now
quartzScheduler . triggerJob ( jobKey ) ; } else { // Schedule with ' now ' trigger
Trigger trigger = newTrigger ( ) . withIdentity ( scheduledJobId , SCHEDULED_JOB_GROUP ) . startNow ( ) . build ( ) ; schedule ( scheduledJob , trigger ) ; } } catch ( SchedulerException e ) { LOG . error ( "Error runNow ScheduledJob" , e ) ; throw new MolgenisDataException ( "Error job runNow" , e ) ; } |
public class LongStreamEx { /** * Returns the maximum element of this stream according to the provided key
* extractor function .
* This is a terminal operation .
* @ param keyExtractor a non - interfering , stateless function
* @ return an { @ code OptionalLong } describing the first element of this
* stream for which the highest value was returned by key extractor ,
* or an empty { @ code OptionalLong } if the stream is empty
* @ since 0.1.2 */
public OptionalLong maxByInt ( LongToIntFunction keyExtractor ) { } } | return collect ( PrimitiveBox :: new , ( box , l ) -> { int key = keyExtractor . applyAsInt ( l ) ; if ( ! box . b || box . i < key ) { box . b = true ; box . i = key ; box . l = l ; } } , PrimitiveBox . MAX_INT ) . asLong ( ) ; |
public class CommonDataProvider { /** * Writes some data as result .
* @ param column
* The column name
* @ param line
* The line number
* @ param value
* The data value */
public void writeDataResult ( String column , int line , String value ) { } } | logger . debug ( "Write Data result => column:{} line:{} value:{}" , column , line , value ) ; writeValue ( column , line , value ) ; |
public class AppServiceEnvironmentsInner { /** * Get metric definitions for a specific instance of a multi - role pool of an App Service Environment .
* Get metric definitions for a specific instance of a multi - role pool of an App Service Environment .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the App Service Environment .
* @ param instance Name of the instance in the multi - role pool .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; ResourceMetricDefinitionInner & gt ; object */
public Observable < Page < ResourceMetricDefinitionInner > > listMultiRolePoolInstanceMetricDefinitionsAsync ( final String resourceGroupName , final String name , final String instance ) { } } | return listMultiRolePoolInstanceMetricDefinitionsWithServiceResponseAsync ( resourceGroupName , name , instance ) . map ( new Func1 < ServiceResponse < Page < ResourceMetricDefinitionInner > > , Page < ResourceMetricDefinitionInner > > ( ) { @ Override public Page < ResourceMetricDefinitionInner > call ( ServiceResponse < Page < ResourceMetricDefinitionInner > > response ) { return response . body ( ) ; } } ) ; |
public class DFSClient { /** * Move blocks from src to trg and delete src
* See { @ link ClientProtocol # concat ( String , String [ ] ) } . */
public void concat ( String trg , String [ ] srcs , boolean restricted ) throws IOException { } } | checkOpen ( ) ; clearFileStatusCache ( ) ; try { if ( namenodeProtocolProxy != null && namenodeProtocolProxy . isMethodSupported ( "concat" , String . class , String [ ] . class , boolean . class ) ) { namenode . concat ( trg , srcs , restricted ) ; } else if ( ! restricted ) { throw new UnsupportedOperationException ( "Namenode does not support variable length blocks" ) ; } else { namenode . concat ( trg , srcs ) ; } } catch ( RemoteException re ) { throw re . unwrapRemoteException ( AccessControlException . class , NSQuotaExceededException . class , DSQuotaExceededException . class ) ; } |
public class UnionPayApi { /** * 退货交 、 撤销交易
* @ param reqData
* 请求参数
* @ return { Map < String , String > } */
@ Deprecated public static Map < String , String > refundByMap ( Map < String , String > reqData ) { } } | return SDKUtil . convertResultStringToMap ( refund ( reqData ) ) ; |
public class ConnectorTypeImpl { /** * If not already created , a new < code > license < / code > element with the given value will be created .
* Otherwise , the existing < code > license < / code > element will be returned .
* @ return a new or existing instance of < code > LicenseType < ConnectorType < T > > < / code > */
public LicenseType < ConnectorType < T > > getOrCreateLicense ( ) { } } | Node node = childNode . getOrCreate ( "license" ) ; LicenseType < ConnectorType < T > > license = new LicenseTypeImpl < ConnectorType < T > > ( this , "license" , childNode , node ) ; return license ; |
public class PinViewBaseHelper { /** * Set a Title with all attributes
* @ param pinTitle to set attributes */
private void setStylesPinTitle ( TextView pinTitle ) { } } | if ( mColorTextTitles != PinViewSettings . DEFAULT_TEXT_COLOR_TITLES ) { pinTitle . setTextColor ( mColorTextTitles ) ; } pinTitle . setTextSize ( PinViewUtils . convertPixelToDp ( getContext ( ) , mTextSizeTitles ) ) ; |
public class CmsSiteManagerImpl { /** * Returns the site for the given resource path , using the fall back site root
* in case the resource path is no root path . < p >
* In case neither the given resource path , nor the given fall back site root
* matches any configured site , the default site is returned . < p >
* Usually the fall back site root should be taken from { @ link org . opencms . file . CmsRequestContext # getSiteRoot ( ) } ,
* in which case a site for the site root should always exist . < p >
* This is the same as first calling { @ link # getSiteForRootPath ( String ) } with the
* < code > resourcePath < / code > parameter , and if this fails calling
* { @ link # getSiteForSiteRoot ( String ) } with the < code > fallbackSiteRoot < / code > parameter ,
* and if this fails calling { @ link # getDefaultSite ( ) } . < p >
* @ param rootPath the resource root path to get the site for
* @ param fallbackSiteRoot site root to use in case the resource path is no root path
* @ return the site for the given resource path , using the fall back site root
* in case the resource path is no root path
* @ see # getSiteForRootPath ( String ) */
public CmsSite getSite ( String rootPath , String fallbackSiteRoot ) { } } | CmsSite result = getSiteForRootPath ( rootPath ) ; if ( result == null ) { result = getSiteForSiteRoot ( fallbackSiteRoot ) ; if ( result == null ) { result = getDefaultSite ( ) ; } } return result ; |
public class CreateDeploymentGroupRequest { /** * The target Amazon ECS services in the deployment group . This applies only to deployment groups that use the
* Amazon ECS compute platform . A target Amazon ECS service is specified as an Amazon ECS cluster and service name
* pair using the format < code > & lt ; clustername & gt ; : & lt ; servicename & gt ; < / code > .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setEcsServices ( java . util . Collection ) } or { @ link # withEcsServices ( java . util . Collection ) } if you want to
* override the existing values .
* @ param ecsServices
* The target Amazon ECS services in the deployment group . This applies only to deployment groups that use
* the Amazon ECS compute platform . A target Amazon ECS service is specified as an Amazon ECS cluster and
* service name pair using the format < code > & lt ; clustername & gt ; : & lt ; servicename & gt ; < / code > .
* @ return Returns a reference to this object so that method calls can be chained together . */
public CreateDeploymentGroupRequest withEcsServices ( ECSService ... ecsServices ) { } } | if ( this . ecsServices == null ) { setEcsServices ( new com . amazonaws . internal . SdkInternalList < ECSService > ( ecsServices . length ) ) ; } for ( ECSService ele : ecsServices ) { this . ecsServices . add ( ele ) ; } return this ; |
public class CatalogMetadataBuilder { /** * Adds tables to the catalog .
* @ param tableMetadataList the table metadata list
* @ return the catalog metadata builder */
@ TimerJ public CatalogMetadataBuilder withTables ( TableMetadata ... tableMetadataList ) { } } | for ( TableMetadata tableMetadata : tableMetadataList ) { tables . put ( tableMetadata . getName ( ) , tableMetadata ) ; } return this ; |
public class LBiDblFunctionBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */
@ Nonnull public static < R > LBiDblFunction < R > biDblFunctionFrom ( Consumer < LBiDblFunctionBuilder < R > > buildingFunction ) { } } | LBiDblFunctionBuilder builder = new LBiDblFunctionBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class JsMessageImpl { /** * Common prefix for all trace summary lines of messages that stem from the
* JsMessage side of the MFP class structure .
* All subclasses should call this , and then append any additional details
* if applicable . */
public void getTraceSummaryLine ( StringBuilder buff ) { } } | buff . append ( "MESSAGE:" ) ; buff . append ( "type=" ) ; buff . append ( getJsMessageType ( ) ) ; buff . append ( ",id=" ) ; buff . append ( getSystemMessageId ( ) ) ; buff . append ( ",proto=" ) ; buff . append ( getGuaranteedProtocolType ( ) ) ; buff . append ( ",tick=" ) ; buff . append ( getGuaranteedValueValueTick ( ) ) ; |
public class HTMLExtractor { /** * Checks if any of the elements matched by the { @ code selector } contain the attribute { @ code attributeName } with value { @ code
* attributeValue } . The { @ code url } is used only for caching purposes , to avoid parsing multiple times the markup returned for the
* same resource .
* @ param url the url that identifies the markup
* @ param markup the markup
* @ param selector the selector used for retrieval
* @ param attributeName the attribute ' s name
* @ param attributeValue the attribute ' s value
* @ return { @ code true } if the attribute was found and has the specified value , { @ code false } otherwise */
public static boolean hasAttributeValue ( String url , String markup , String selector , String attributeName , String attributeValue ) { } } | ensureMarkup ( url , markup ) ; Document document = documents . get ( url ) ; Elements elements = document . select ( selector ) ; return ! elements . isEmpty ( ) && elements . hasAttr ( attributeName ) && attributeValue . equals ( elements . attr ( attributeName ) ) ; |
public class DTMDocumentImpl { /** * Replaces the deprecated DocumentHandler interface . */
public void characters ( char [ ] ch , int start , int length ) throws org . xml . sax . SAXException { } } | // Actually creating the text node is handled by
// processAccumulatedText ( ) ; here we just accumulate the
// characters into the buffer .
m_char . append ( ch , start , length ) ; |
public class BridgeMethodResolver { /** * Determines whether or not the bridge { @ link Method } is the bridge for the
* supplied candidate { @ link Method } . */
static boolean isBridgeMethodFor ( Method bridgeMethod , Method candidateMethod , Map < TypeVariable , Type > typeVariableMap ) { } } | if ( isResolvedTypeMatch ( candidateMethod , bridgeMethod , typeVariableMap ) ) { return true ; } Method method = findGenericDeclaration ( bridgeMethod ) ; return ( method != null && isResolvedTypeMatch ( method , candidateMethod , typeVariableMap ) ) ; |
public class MotionEventUtils { /** * Calculate the horizontal move motion direction .
* @ param e1 start point of the motion .
* @ param e2 end point of the motion .
* @ param threshold threshold to detect the motion .
* @ return the motion direction for the horizontal axis . */
public static MotionDirection getHorizontalMotionDirection ( MotionEvent e1 , MotionEvent e2 , float threshold ) { } } | float delta = getHorizontalMotionRawDelta ( e1 , e2 ) ; return getHorizontalMotionDirection ( delta , threshold ) ; |
public class Tracy { /** * In case where an exception is thrown Tracy . frameError ( errorString ) can be used to
* close Tracy stack frame with a user error message while still flow to continue . < br >
* This can be useful when in a retry exception where the task may be recoverable . < br >
* If the current frame is not the only Tracy stack frame the next frame will resume normally .
* In case the user wants to raise an error all the way up to the inner Tracy stack frame ,
* then outerError ( errorString ) should be used instead */
public static void frameError ( String error ) { } } | TracyThreadContext ctx = threadContext . get ( ) ; if ( isValidContext ( ctx ) ) { ctx . popFrameWithError ( error ) ; } |
public class ParaClient { /** * Checks if a subject is allowed to call method X on resource Y .
* @ param subjectid subject id
* @ param resourcePath resource path or object type
* @ param httpMethod HTTP method name
* @ return true if allowed */
public boolean isAllowedTo ( String subjectid , String resourcePath , String httpMethod ) { } } | if ( StringUtils . isBlank ( subjectid ) || StringUtils . isBlank ( resourcePath ) || StringUtils . isBlank ( httpMethod ) ) { return false ; } resourcePath = Utils . urlEncode ( resourcePath ) ; String url = Utils . formatMessage ( "_permissions/{0}/{1}/{2}" , subjectid , resourcePath , httpMethod ) ; Boolean result = getEntity ( invokeGet ( url , null ) , Boolean . class ) ; return result != null && result ; |
public class Seq { /** * Merge series of adjacent elements which satisfy the given predicate using the merger function .
* < p > Example :
* < pre >
* < code >
* Seq . of ( new Integer [ 0 ] ) . collapse ( ( a , b ) - > a < b , Collectors . summingInt ( Fn . unboxI ( ) ) ) = > [ ]
* Seq . of ( 1 ) . collapse ( ( a , b ) - > a < b , Collectors . summingInt ( Fn . unboxI ( ) ) ) = > [ 1]
* Seq . of ( 1 , 2 ) . collapse ( ( a , b ) - > a < b , Collectors . summingInt ( Fn . unboxI ( ) ) ) = > [ 3]
* Seq . of ( 1 , 2 , 3 ) . collapse ( ( a , b ) - > a < b , Collectors . summingInt ( Fn . unboxI ( ) ) ) = > [ 6]
* Seq . of ( 1 , 2 , 3 , 3 , 2 , 1 ) . collapse ( ( a , b ) - > a < b , Collectors . summingInt ( Fn . unboxI ( ) ) ) = > [ 6 , 3 , 2 , 1]
* < / code >
* < / pre >
* @ param collapsible
* @ param collector
* @ return */
public < R , A , E extends Exception > List < R > collapse ( final Try . BiPredicate < ? super T , ? super T , E > collapsible , final Collector < ? super T , A , R > collector ) throws E { } } | N . checkArgNotNull ( collapsible ) ; N . checkArgNotNull ( collector ) ; final List < R > result = new ArrayList < > ( ) ; final Supplier < A > supplier = collector . supplier ( ) ; final BiConsumer < A , ? super T > accumulator = collector . accumulator ( ) ; final Function < A , R > finisher = collector . finisher ( ) ; final Iterator < T > iter = iterator ( ) ; boolean hasNext = false ; T next = null ; while ( hasNext || iter . hasNext ( ) ) { final A c = supplier . get ( ) ; accumulator . accept ( c , hasNext ? next : ( next = iter . next ( ) ) ) ; while ( ( hasNext = iter . hasNext ( ) ) ) { if ( collapsible . test ( next , ( next = iter . next ( ) ) ) ) { accumulator . accept ( c , next ) ; } else { break ; } } result . add ( finisher . apply ( c ) ) ; } return result ; |
public class PolicyMappingsExtension { /** * Delete the attribute value . */
public void delete ( String name ) throws IOException { } } | if ( name . equalsIgnoreCase ( MAP ) ) { maps = null ; } else { throw new IOException ( "Attribute name not recognized by " + "CertAttrSet:PolicyMappingsExtension." ) ; } encodeThis ( ) ; |
public class TokenLoader { /** * Tries to dispatch tokens ; returns true if tokens were successfully queued .
* Detects when queue is full and in that case returns false .
* @ return returns true if tokens were successfully queued ; returns false if queue was full */
private boolean tryToDispatchTokens ( MessageHolderWithTokens msg ) { } } | try { dispatchTokensEvent . fire ( msg ) ; return true ; } catch ( MessageDeliveryException e ) { Throwable cause = e . getCause ( ) ; if ( isQueueFullException ( cause ) ) { return false ; } throw e ; } |
public class SOS { /** * Vote for neighbors not being outliers . The key method of SOS .
* @ param ignore Object to ignore
* @ param di Neighbor object IDs .
* @ param p Probabilities
* @ param norm Normalization factor ( 1 / sum )
* @ param scores Output score storage */
public static void nominateNeighbors ( DBIDIter ignore , DBIDArrayIter di , double [ ] p , double norm , WritableDoubleDataStore scores ) { } } | for ( di . seek ( 0 ) ; di . valid ( ) ; di . advance ( ) ) { if ( DBIDUtil . equal ( ignore , di ) ) { continue ; } double v = p [ di . getOffset ( ) ] * norm ; // Normalize
if ( ! ( v > 0 ) ) { break ; } scores . putDouble ( di , scores . doubleValue ( di ) * ( 1 - v ) ) ; } |
public class JaxbPUnit10 { /** * Gets the value of the excludeUnlistedClasses property . < p >
* Note that the default value defined in the 1.0 persistence xsd is ' false ' ,
* however , that is for when the stanza is specified , but without a value .
* If the stanza is not present in persistence . xml , then the default is
* also ' false ' . < p >
* @ return value of the excludeUnlistedClasses property . */
public boolean isExcludeUnlistedClasses ( ) { } } | // The JAXB generated classes will return ' false ' if the stanza was
// specified , but without a value
Boolean exclude = ivPUnit . isExcludeUnlistedClasses ( ) ; // The version 1.0 persistence . xsd spelled out the default for
// exclude - unlisted - classes is false .
// This means there are 4 choices :
// < exclude - unlisted - classes > not specified - - > Not excluded
// < exclude - unlisted - classes > false < / exclude - unlisted - classes > - - > Not excluded
// < exclude - unlisted - classes > true < / exclude - unlisted - classes > - - > Excluded
// < exclude - unlisted - classes / > - - > Not excluded
// The last choice contradicts the sample ' s implied semantics .
// Patrick Linskey confirms that this is a problem in the JPA spec and
// the spec decided that the XSD is the final correct specification .
// i . e . unlisted classes are excluded iff
// < exclude - unlisted - classes > true < / exclude - unlisted - classes > is used .
if ( JPA_OVERRIDE_EXCLUDE_UNLISTED_CLASSES ) { // If " com . ibm . jpa . override . exclude . unlisted . classes " system property is set to
// true , all variations of < exclude - unlisted - classes > specification in
// persistence unit are treated as
// < exclude - unlisted - classes > true < / exclude - listed - classes > , which matches the
// original intent as used in the JPA spec samples .
// This is NOT the default behavior .
if ( exclude != null ) { exclude = Boolean . TRUE ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "isExcludeUnlistedClasses : overriden to TRUE" ) ; } } // The default when not present at all is ' false '
if ( exclude == null ) { exclude = Boolean . FALSE ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "isExcludeUnlistedClasses : defaulted to FALSE" ) ; } return exclude . booleanValue ( ) ; |
public class AbstractDatabase { /** * Adds a new mapping for given eFaps column type used for mapping from and
* to the SQL database .
* @ param _ columnType column type within eFaps
* @ param _ writeTypeName SQL type name used to write ( create new column
* within a SQL table )
* @ param _ nullValueSelect null value select used within the query if a link
* target could be a null ( and so all selected values must null
* in the SQL statement for objects without this link )
* @ param _ readTypeNames list of SQL type names returned from the database
* meta data reading
* @ see # readColTypeMap to map from an eFaps column type to a SQL type name
* @ see # writeColTypeMap to map from a SQL type name to possible eFaps
* column types */
protected void addMapping ( final ColumnType _columnType , final String _writeTypeName , final String _nullValueSelect , final String ... _readTypeNames ) { } } | this . writeColTypeMap . put ( _columnType , _writeTypeName ) ; this . nullValueColTypeMap . put ( _columnType , _nullValueSelect ) ; for ( final String readTypeName : _readTypeNames ) { Set < AbstractDatabase . ColumnType > colTypes = this . readColTypeMap . get ( readTypeName ) ; if ( colTypes == null ) { colTypes = new HashSet < > ( ) ; this . readColTypeMap . put ( readTypeName , colTypes ) ; } colTypes . add ( _columnType ) ; } |
public class NodeUtil { /** * An operator taking only one operand .
* These all parse very similarly , taking LeftHandSideExpression operands . */
static boolean isUnaryOperatorType ( Token type ) { } } | switch ( type ) { case DELPROP : case VOID : case TYPEOF : case POS : case NEG : case BITNOT : case NOT : return true ; default : return false ; } |
public class TimeSensor { /** * Set the TimeSensor ' s cycleInterval property
* Currently , this does not change the duration of the animation .
* @ param newCycleInterval */
public void setCycleInterval ( float newCycleInterval ) { } } | if ( ( this . cycleInterval != newCycleInterval ) && ( newCycleInterval > 0 ) ) { for ( GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations ) { // TODO Cannot easily change the GVRAnimation ' s GVRChannel once set .
} this . cycleInterval = newCycleInterval ; } |
public class TranslateToPyExprVisitor { /** * { @ inheritDoc }
* < p > The source of available functions is a look - up map provided by Guice in { @ link
* SharedModule # provideSoyFunctionsMap } .
* @ see BuiltinFunction
* @ see SoyPySrcFunction */
@ Override protected PyExpr visitFunctionNode ( FunctionNode node ) { } } | Object soyFunction = node . getSoyFunction ( ) ; if ( soyFunction instanceof BuiltinFunction ) { return visitNonPluginFunction ( node , ( BuiltinFunction ) soyFunction ) ; } else if ( soyFunction instanceof SoyPythonSourceFunction ) { return pluginValueFactory . applyFunction ( node . getSourceLocation ( ) , node . getFunctionName ( ) , ( SoyPythonSourceFunction ) soyFunction , visitChildren ( node ) ) ; } else if ( soyFunction instanceof SoyPySrcFunction ) { List < PyExpr > args = visitChildren ( node ) ; return ( ( SoyPySrcFunction ) soyFunction ) . computeForPySrc ( args ) ; } else if ( soyFunction instanceof LoggingFunction ) { // trivial logging function support
return new PyStringExpr ( "'" + ( ( LoggingFunction ) soyFunction ) . getPlaceholder ( ) + "'" ) ; } else { errorReporter . report ( node . getSourceLocation ( ) , SOY_PY_SRC_FUNCTION_NOT_FOUND , node . getFunctionName ( ) ) ; return ERROR ; } |
public class WorkspaceUtils { /** * Serializes the specified workspace to a JSON string .
* @ param workspace a Workspace instance
* @ param indentOutput whether to indent the output ( prettify )
* @ return a JSON string
* @ throws Exception if something goes wrong */
public static String toJson ( Workspace workspace , boolean indentOutput ) throws Exception { } } | if ( workspace == null ) { throw new IllegalArgumentException ( "A workspace must be provided." ) ; } JsonWriter jsonWriter = new JsonWriter ( indentOutput ) ; StringWriter stringWriter = new StringWriter ( ) ; jsonWriter . write ( workspace , stringWriter ) ; stringWriter . flush ( ) ; stringWriter . close ( ) ; return stringWriter . toString ( ) ; |
public class OriginateBaseClass { /** * It is important that this method is synchronised as there is some
* interaction between the events and we need to ensure we process one at a
* time . */
@ Override synchronized public void onManagerEvent ( final ManagerEvent event ) { } } | if ( event instanceof HangupEvent ) { final HangupEvent hangupEvt = ( HangupEvent ) event ; final Channel hangupChannel = hangupEvt . getChannel ( ) ; if ( channelId . equals ( hangupEvt . getUniqueId ( ) ) ) { this . originateSuccess = false ; OriginateBaseClass . logger . warn ( "Dest channel " + this . newChannel + " hungup" ) ; originateLatch . countDown ( ) ; } if ( ( this . monitorChannel1 != null ) && ( hangupChannel . isSame ( this . monitorChannel1 ) ) ) { this . originateSuccess = false ; this . hungup = true ; if ( this . newChannel != null ) { OriginateBaseClass . logger . debug ( "hanging up " + this . newChannel ) ; this . result . setChannelHungup ( true ) ; PBX pbx = PBXFactory . getActivePBX ( ) ; try { logger . warn ( "Hanging up" ) ; pbx . hangup ( this . newChannel ) ; } catch ( IllegalArgumentException | IllegalStateException | PBXException e ) { logger . error ( e , e ) ; } } OriginateBaseClass . logger . debug ( "notify channel 1 hungup" ) ; originateLatch . countDown ( ) ; } if ( ( this . monitorChannel2 != null ) && ( hangupChannel . isSame ( this . monitorChannel2 ) ) ) { this . originateSuccess = false ; this . hungup = true ; if ( this . newChannel != null ) { OriginateBaseClass . logger . debug ( "Hanging up channel " + this . newChannel ) ; this . result . setChannelHungup ( true ) ; PBX pbx = PBXFactory . getActivePBX ( ) ; try { pbx . hangup ( this . newChannel ) ; } catch ( IllegalArgumentException | IllegalStateException | PBXException e ) { logger . error ( e , e ) ; } } OriginateBaseClass . logger . debug ( "Notify channel 2 (" + this . monitorChannel2 + ") hungup" ) ; // $ NON - NLS - 2 $
originateLatch . countDown ( ) ; } } if ( event instanceof OriginateResponseEvent ) { OriginateBaseClass . logger . debug ( "response : " + this . newChannel ) ; final OriginateResponseEvent response = ( OriginateResponseEvent ) event ; OriginateBaseClass . logger . debug ( "OriginateResponseEvent: channel=" + ( response . isChannel ( ) ? response . getChannel ( ) : response . getEndPoint ( ) ) + " originateID:" + this . originateID ) ; OriginateBaseClass . logger . debug ( "{" + response . getReason ( ) + ":" + response . getResponse ( ) + "}" ) ; // $ NON - NLS - 2 $ / / $ NON - NLS - 3 $
if ( this . originateID != null ) { if ( this . originateID . compareToIgnoreCase ( response . getActionId ( ) ) == 0 ) { this . originateSuccess = response . isSuccess ( ) ; OriginateBaseClass . logger . debug ( "OriginateResponse: matched actionId, success=" + this . originateSuccess + " channelSeen=" + this . channelSeen ) ; this . originateSeen = true ; if ( originateSuccess ) { if ( newChannel == null ) { this . newChannel = response . getChannel ( ) ; } channelSeen = newChannel != null ; // if we have also seen the channel then we can notify
// the
// originate ( ) method
// that the call is up . Otherwise we will rely on the
// NewChannelEvent doing the
// notify .
if ( this . channelSeen == true ) { OriginateBaseClass . logger . info ( "notify originate response event " + this . originateSuccess ) ; originateLatch . countDown ( ) ; } else { logger . error ( "Originate Response didn't contain the channel" ) ; } } } } else { OriginateBaseClass . logger . warn ( "actionid is null" ) ; } } if ( event instanceof NewChannelEvent ) { final NewChannelEvent newState = ( NewChannelEvent ) event ; if ( channelId . equalsIgnoreCase ( newState . getChannel ( ) . getUniqueId ( ) ) ) { final Channel channel = newState . getChannel ( ) ; OriginateBaseClass . logger . debug ( "new channel event :" + channel + " context = " + newState . getContext ( ) // $ NON - NLS - 2 $
+ " state =" + newState . getChannelStateDesc ( ) + " state =" + newState . getChannelState ( ) ) ; // $ NON - NLS - 2 $
handleId ( channel ) ; } } if ( event instanceof BridgeEvent ) { if ( ( ( BridgeEvent ) event ) . isLink ( ) ) { final BridgeEvent bridgeEvent = ( BridgeEvent ) event ; Channel channel = bridgeEvent . getChannel1 ( ) ; if ( bridgeEvent . getChannel1 ( ) . isLocal ( ) ) { channel = bridgeEvent . getChannel2 ( ) ; } if ( channelId . equalsIgnoreCase ( bridgeEvent . getChannel1 ( ) . getUniqueId ( ) ) || channelId . equalsIgnoreCase ( bridgeEvent . getChannel2 ( ) . getUniqueId ( ) ) ) { OriginateBaseClass . logger . debug ( "new bridge event :" + channel + " channel1 = " + bridgeEvent . getChannel1 ( ) // $ NON - NLS - 2 $
+ " channel2 =" + bridgeEvent . getChannel2 ( ) ) ; handleId ( channel ) ; } } } if ( event instanceof DialEndEvent ) { if ( channelId . equalsIgnoreCase ( ( ( DialEndEvent ) event ) . getDestChannel ( ) . getUniqueId ( ) ) ) { String forward = ( ( DialEndEvent ) event ) . getForward ( ) ; if ( forward != null && forward . length ( ) > 0 ) { originateLatch . countDown ( ) ; } } } |
public class RingByteBuffer { /** * Writes bytes from mark ( included ) to position ( excluded ) to bb as much as
* bb has remaining . bb positions are updated .
* @ param bb
* @ return
* @ throws IOException */
public int writeTo ( ByteBuffer bb ) throws IOException { } } | return writeTo ( ( srcs , offset , len ) -> ByteBuffers . move ( srcs , offset , len , bb ) , writeToSplitter ) ; |
public class AccessClassLoader { /** * Returns null if the access class has not yet been defined . */
Class loadAccessClass ( String name ) { } } | // No need to check the parent class loader if the access class hasn ' t been defined yet .
if ( localClassNames . contains ( name ) ) { try { return loadClass ( name , false ) ; } catch ( ClassNotFoundException ex ) { throw new RuntimeException ( ex ) ; // Should not happen , since we know the class has been defined .
} } return null ; |
public class Validate { /** * Method without varargs to increase performance */
public static < T > T [ ] noNullElements ( final T [ ] array , final String message ) { } } | return INSTANCE . noNullElements ( array , message ) ; |
public class ConvertibleType { /** * Returns the conversion type for the generic type . */
private static < T > ConvertibleType < T > of ( Type genericType ) { } } | final Class < T > targetType ; if ( genericType instanceof Class ) { targetType = ( Class < T > ) genericType ; } else if ( genericType instanceof ParameterizedType ) { targetType = ( Class < T > ) ( ( ParameterizedType ) genericType ) . getRawType ( ) ; } else if ( genericType . toString ( ) . equals ( "byte[]" ) ) { targetType = ( Class < T > ) byte [ ] . class ; } else { targetType = ( Class < T > ) Object . class ; } final TypedMap < T > annotations = StandardAnnotationMaps . < T > of ( targetType ) ; return new ConvertibleType < T > ( genericType , annotations , null ) ; |
public class MoveMetaModule { /** * Push information from topicmeta in the map into the corresponding topics and maps . */
private void pushMetadata ( final Map < URI , Map < String , Element > > mapSet ) { } } | if ( ! mapSet . isEmpty ( ) ) { // process map first
final DitaMapMetaWriter mapInserter = new DitaMapMetaWriter ( ) ; mapInserter . setLogger ( logger ) ; mapInserter . setJob ( job ) ; for ( final Entry < URI , Map < String , Element > > entry : mapSet . entrySet ( ) ) { final URI key = stripFragment ( entry . getKey ( ) ) ; final FileInfo fi = job . getFileInfo ( key ) ; if ( fi == null ) { logger . error ( "File " + new File ( job . tempDir , key . getPath ( ) ) + " was not found." ) ; continue ; } final URI targetFileName = job . tempDirURI . resolve ( fi . uri ) ; assert targetFileName . isAbsolute ( ) ; if ( fi . format != null && ATTR_FORMAT_VALUE_DITAMAP . equals ( fi . format ) ) { mapInserter . setMetaTable ( entry . getValue ( ) ) ; if ( toFile ( targetFileName ) . exists ( ) ) { logger . info ( "Processing " + targetFileName ) ; mapInserter . read ( toFile ( targetFileName ) ) ; } else { logger . error ( "File " + targetFileName + " does not exist" ) ; } } } // process topic
final DitaMetaWriter topicInserter = new DitaMetaWriter ( ) ; topicInserter . setLogger ( logger ) ; topicInserter . setJob ( job ) ; for ( final Entry < URI , Map < String , Element > > entry : mapSet . entrySet ( ) ) { final URI key = stripFragment ( entry . getKey ( ) ) ; final FileInfo fi = job . getFileInfo ( key ) ; if ( fi == null ) { logger . error ( "File " + new File ( job . tempDir , key . getPath ( ) ) + " was not found." ) ; continue ; } final URI targetFileName = job . tempDirURI . resolve ( fi . uri ) ; assert targetFileName . isAbsolute ( ) ; if ( fi . format == null || fi . format . equals ( ATTR_FORMAT_VALUE_DITA ) ) { final String topicid = entry . getKey ( ) . getFragment ( ) ; topicInserter . setTopicId ( topicid ) ; topicInserter . setMetaTable ( entry . getValue ( ) ) ; if ( toFile ( targetFileName ) . exists ( ) ) { topicInserter . read ( toFile ( targetFileName ) ) ; } else { logger . error ( "File " + targetFileName + " does not exist" ) ; } } } } |
public class HBase94QueueConsumer { /** * Creates a HBase filter that will filter out rows that that has committed state = PROCESSED . */
private Filter createFilter ( ) { } } | return new FilterList ( FilterList . Operator . MUST_PASS_ONE , processedStateFilter , new SingleColumnValueFilter ( QueueEntryRow . COLUMN_FAMILY , stateColumnName , CompareFilter . CompareOp . GREATER , new BinaryPrefixComparator ( Bytes . toBytes ( transaction . getReadPointer ( ) ) ) ) ) ; |
public class RecurlyClient { /** * Return all the invoices given query params
* @ param params { @ link QueryParams }
* @ return the count of invoices matching the query */
public int getInvoicesCount ( final QueryParams params ) { } } | FluentCaseInsensitiveStringsMap map = doHEAD ( Invoices . INVOICES_RESOURCE , params ) ; return Integer . parseInt ( map . getFirstValue ( X_RECORDS_HEADER_NAME ) ) ; |
public class JmsErrorUtils { /** * Used by the JMS API layer to create new < code > Throwable < / code > ' s , usually
* < code > Exceptions < / code > ( both < code > JMSException < / code > s and other Java
* exception types ) . If a previous exception has not been caught , an
* overloaded version of this method which does not specify the caught
* exception may be called .
* The method provides a single place where the error handling and creation
* occurs , ensuring that these actions are always performed completely and
* correctly .
* The exact actions performed by this method depend on whether a previously
* caught < code > Throwable < / code > is supplied as a parameter to this method ,
* and whether a < code > JMSException < / code > or other type of exception is
* being constructed ( note that < code > JMSException < / code > subclasses behave
* similarly to < code > JMSException < / code > s ) .
* The newly created < code > Throwable < / code > is created with its reason value
* set to the nls message corresponding to the message key passed to this
* method . The message key must end in " SIAPnnnn " ( where n ' s are digits ) , as
* an error code may be derived from the key . This is done if the newly
* created < code > Throwable < / code > is a < code > JMSException < / code > , in which
* case it is created using the constructor that sets the error code .
* Finally , if a trace component is supplied and is debug - enabled , the newly
* created < code > Throwable < / code > is traced .
* If the probeId is non - null an FFDC will be generated . This will contain
* the caughtThrowable if non - null , otherwise the newly generated exception
* will be FFDC ' d .
* No errors are expected to occur in this method , but if exceptions are
* thrown by methods invoked here , a < code > RuntimeException < / code > is thrown .
* @ param throwableClass
* the type of < code > Throwable < / code > to construct .
* @ param messageKey
* index into the message catalog ( must end with " SIAPnnnn " ) .
* @ param messageInserts
* inserts for the message .
* @ param caughtThrowable
* non - null if the new < code > Throwable < / code > is being constructed
* from within a < code > catch < / code > block .
* @ param probeId
* uniquely identifies the code which caught / generated caughtThrowable
* ( must have the format " className . methodName # n " ) .
* If probeId = = null , no FFDC is generated .
* New - if probeId is non - null an FFDC will be generated , even if caughtThrowable is null
* @ param caller
* non - null if non - static code caught < code > caughtThrowable < / code > .
* @ param traceComponent
* if this is set to a non - null value , and is debug - enabled , the newly
* created < code > Throwable < / code > will be traced using this component . */
static Throwable newThrowable ( Class throwableClass , String messageKey , Object [ ] messageInserts , Throwable caughtThrowable , String probeId , Object caller , TraceComponent traceComponent ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "newThrowable" , new Object [ ] { throwableClass , messageKey , caughtThrowable , probeId , caller , } ) ; Throwable t = null ; try { // If test environment is enabled then take this opportunity to check
// the the message exists in the file . Note that this is not called in
// the mainline product codepath .
if ( UTEHelperFactory . jmsTestEnvironmentEnabled ) { String defaultIfMissing = "XXX_MISSING_XXX" ; String msg = nls . getFormattedMessage ( messageKey , messageInserts , defaultIfMissing ) ; if ( defaultIfMissing . equals ( msg ) ) { // NB . NLS translation is not required since this only occurs in the test environment .
throw new IllegalArgumentException ( "The message key " + messageKey + " does not exist." ) ; } // Now check that the correct number of inserts have been provided .
// This call gets the number of inserts in the message .
int numInserts = getNumberOfInserts ( messageKey ) ; int gotInserts = 0 ; if ( messageInserts != null ) { gotInserts = messageInserts . length ; } if ( numInserts != gotInserts ) { // NB . NLS translation is not required since this only occurs in the test environment .
throw new IllegalArgumentException ( "Expected " + numInserts + " for " + messageKey + " but got " + gotInserts ) ; } } // If an invalid throwable class was supplied throw a runtime exception .
if ( ! Throwable . class . isAssignableFrom ( throwableClass ) ) { RuntimeException re = new RuntimeException ( "JmsErrorUtils.newThrowable#1" ) ; FFDCFilter . processException ( re , "JmsErrorUtils.newThrowable" , "JmsErrorUtils.newThrowable#1" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "exception : " , re ) ; throw re ; } // First note if the throwable to be constructed is a JMSException
// or subclass of JMSException .
boolean wantJMSExceptionOrSubclass = JMSException . class . isAssignableFrom ( throwableClass ) ; // If a JMSException constructor is required , get the two String arg
// constructor , else get a one String arg constructor .
Constructor throwableConstructor = null ; try { if ( wantJMSExceptionOrSubclass ) { throwableConstructor = throwableClass . getConstructor ( new Class [ ] { String . class , String . class } ) ; } else { throwableConstructor = throwableClass . getConstructor ( new Class [ ] { String . class } ) ; } } catch ( Exception e ) { // No FFDC code needed
RuntimeException re = new RuntimeException ( "JmsErrorUtils.newThrowable#2" ) ; re . initCause ( e ) ; FFDCFilter . processException ( re , "JmsErrorUtils.newThrowable" , "JmsErrorUtils.newThrowable#2" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "exception : " , re ) ; throw re ; } // Get the nls text for the message . ' messageInserts ' may be null .
String reason = nls . getFormattedMessage ( messageKey , messageInserts , null ) ; // Get the error code for the throwable , ' messageKey ' is assumed to have
// the form " . . . CWSIAxxxx " .
String errorCode = null ; if ( messageKey . length ( ) >= 9 ) { errorCode = messageKey . substring ( messageKey . length ( ) - 9 ) ; } // Construct the throwable .
try { if ( wantJMSExceptionOrSubclass ) { t = ( Throwable ) throwableConstructor . newInstance ( new Object [ ] { reason , errorCode } ) ; } else { t = ( Throwable ) throwableConstructor . newInstance ( new Object [ ] { reason } ) ; } } catch ( Exception e ) { // No FFDC code needed
RuntimeException re = new RuntimeException ( "JmsErrorUtils.newThrowable#3" ) ; re . initCause ( e ) ; FFDCFilter . processException ( re , "JmsErrorUtils.newThrowable" , "JmsErrorUtils.newThrowable#3" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "exception : " , re ) ; throw re ; } // If ' caughtThrowable ' refers to an exception , and if a JMSException is
// being constructed , set the linked exception in the new JMSException to
// refer to the previously caught exception .
if ( ( caughtThrowable instanceof Exception ) && wantJMSExceptionOrSubclass ) { Exception caughtException = ( Exception ) caughtThrowable ; ( ( JMSException ) t ) . setLinkedException ( caughtException ) ; } // If ' caughtThrowable ' is non - null , set the cause in the Throwable
// being constructed .
if ( caughtThrowable != null ) { t . initCause ( caughtThrowable ) ; } // This method removes all trace of the newThrowable method and
// associated reflection calls .
if ( filterStack ) { filterThrowable ( t ) ; } // If a trace component was supplied and is debug enabled , trace
// the newly constructed throwable .
if ( ( traceComponent != null ) && TraceComponent . isAnyTracingEnabled ( ) && ( traceComponent . isDebugEnabled ( ) ) ) { SibTr . debug ( traceComponent , "throwable : " , t ) ; } // If probeId is non - null , generate an FFDC
if ( probeId != null ) { // ' probeId ' is assumed to
// have the form " className . methodName # . . . " , usually with a number after
// the ' # ' . If the invoking method is static , ' caller ' will be null .
// d238447 FFDC review . A null probeId is used to indicate that FFDC is not required .
String sourceId = "" ; int index = probeId . indexOf ( '#' ) ; if ( index == - 1 ) { // no seperator , so we can ' t make any assumptions about the format
sourceId = probeId ; } else { sourceId = probeId . substring ( 0 , index ) ; } // If caughtThrowable is non - null we FFDC that . Otherwise we FFDC the newly generated exception .
Throwable foo ; if ( caughtThrowable != null ) { foo = caughtThrowable ; } else { foo = t ; } if ( caller != null ) { FFDCFilter . processException ( foo , sourceId , probeId , caller ) ; } else { FFDCFilter . processException ( foo , sourceId , probeId ) ; } } // Return the newly created exception .
} catch ( RuntimeException re ) { // No FFDC code needed
// d238447 FFDC review . This is an internal error , we should FFDC the RE .
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "caught : " , re ) ; FFDCFilter . processException ( re , "JmsErrorUtils.newThrowable" , "newThrowable#4" ) ; throw re ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "newThrowable" , t ) ; return t ; |
public class HndlBalancePdfReq { /** * < p > Handle file - report request . < / p >
* @ param pReqVars Request scoped variables
* @ param pRequestData Request Data
* @ param pSous servlet output stream
* @ throws Exception - an exception */
@ Override public final void handle ( final Map < String , Object > pReqVars , final IRequestData pRequestData , final OutputStream pSous ) throws Exception { } } | try { this . srvDatabase . setIsAutocommit ( false ) ; this . srvDatabase . setTransactionIsolation ( ISrvDatabase . TRANSACTION_READ_UNCOMMITTED ) ; this . srvDatabase . beginTransaction ( ) ; Date date2 = srvDate . fromIso8601DateTimeNoTz ( pRequestData . getParameter ( "date2" ) , null ) ; BalanceSheet balanceSheet = getSrvBalanceSheet ( ) . retrieveBalance ( pReqVars , date2 ) ; this . balanceSheetPdf . makeReport ( pReqVars , balanceSheet , pSous ) ; this . srvDatabase . commitTransaction ( ) ; } catch ( Exception ex ) { this . srvDatabase . rollBackTransaction ( ) ; throw ex ; } finally { this . srvDatabase . releaseResources ( ) ; } |
public class TextBoxView { /** * Repaints the content , used by blink decoration .
* @ param ms
* time - the upper bound of delay
* @ param bounds
* the bounds */
protected void repaint ( final int ms , final Rectangle bounds ) { } } | if ( container != null ) { container . repaint ( ms , bounds . x , bounds . y , bounds . width , bounds . height ) ; } |
public class ICalComponent { /** * Adds an experimental property to this component , removing all existing
* properties that have the same name .
* @ param name the property name ( e . g . " X - ALT - DESC " )
* @ param value the property value
* @ return the property object that was created */
public RawProperty setExperimentalProperty ( String name , String value ) { } } | return setExperimentalProperty ( name , null , value ) ; |
public class UserListLogicalRule { /** * Gets the ruleOperands value for this UserListLogicalRule .
* @ return ruleOperands * The list of operands of the rule .
* < span class = " constraint ContentsNotNull " > This field
* must not contain { @ code null } elements . < / span >
* < span class = " constraint NotEmpty " > This field must
* contain at least one element . < / span >
* < span class = " constraint Required " > This field is required
* and should not be { @ code null } . < / span > */
public com . google . api . ads . adwords . axis . v201809 . rm . LogicalUserListOperand [ ] getRuleOperands ( ) { } } | return ruleOperands ; |
public class ReferenceEntityLockService { /** * Returns a lock for the entity , lock type and owner if no conflicting locks exist .
* @ param entityType
* @ param entityKey
* @ param lockType
* @ param owner
* @ return org . apereo . portal . groups . IEntityLock
* @ exception LockingException */
@ Override public IEntityLock newLock ( Class entityType , String entityKey , int lockType , String owner ) throws LockingException { } } | return newLock ( entityType , entityKey , lockType , owner , defaultLockPeriod ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.