signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class LoggingAppender { /** * Gets the { @ link LoggingOptions } to use for this { @ link LoggingAppender } . */ LoggingOptions getLoggingOptions ( ) { } }
if ( loggingOptions == null ) { if ( Strings . isNullOrEmpty ( credentialsFile ) ) { loggingOptions = LoggingOptions . getDefaultInstance ( ) ; } else { try { loggingOptions = LoggingOptions . newBuilder ( ) . setCredentials ( GoogleCredentials . fromStream ( new FileInputStream ( credentialsFile ) ) ) . build ( ) ; } catch ( IOException e ) { throw new RuntimeException ( String . format ( "Could not read credentials file %s. Please verify that the file exists and is a valid Google credentials file." , credentialsFile ) , e ) ; } } } return loggingOptions ;
public class ManagedDatabasesInner { /** * Gets a managed database . * @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal . * @ param managedInstanceName The name of the managed instance . * @ param databaseName The name of the database . * @ 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 < ManagedDatabaseInner > getAsync ( String resourceGroupName , String managedInstanceName , String databaseName , final ServiceCallback < ManagedDatabaseInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( getWithServiceResponseAsync ( resourceGroupName , managedInstanceName , databaseName ) , serviceCallback ) ;
public class FNDImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setNomPtSize ( Integer newNomPtSize ) { } }
Integer oldNomPtSize = nomPtSize ; nomPtSize = newNomPtSize ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . FND__NOM_PT_SIZE , oldNomPtSize , nomPtSize ) ) ;
public class MockEc2Controller { /** * Get mock ec2 instances by instance IDs . * @ param instanceIDs * IDs of the mock ec2 instances to get * @ return the mock ec2 instances object */ private Collection < AbstractMockEc2Instance > getInstances ( final Set < String > instanceIDs ) { } }
Collection < AbstractMockEc2Instance > ret = new ArrayList < AbstractMockEc2Instance > ( ) ; for ( String instanceID : instanceIDs ) { ret . add ( getMockEc2Instance ( instanceID ) ) ; } return ret ;
public class DateTimeFormatterBuilder { /** * Appends the reduced value of a date - time field to the formatter . * Since fields such as year vary by chronology , it is recommended to use the * { @ link # appendValueReduced ( TemporalField , int , int , ChronoLocalDate ) } date } * variant of this method in most cases . This variant is suitable for * simple fields or working with only the ISO chronology . * For formatting , the { @ code width } and { @ code maxWidth } are used to * determine the number of characters to format . * If they are equal then the format is fixed width . * If the value of the field is within the range of the { @ code baseValue } using * { @ code width } characters then the reduced value is formatted otherwise the value is * truncated to fit { @ code maxWidth } . * The rightmost characters are output to match the width , left padding with zero . * For strict parsing , the number of characters allowed by { @ code width } to { @ code maxWidth } are parsed . * For lenient parsing , the number of characters must be at least 1 and less than 10. * If the number of digits parsed is equal to { @ code width } and the value is positive , * the value of the field is computed to be the first number greater than * or equal to the { @ code baseValue } with the same least significant characters , * otherwise the value parsed is the field value . * This allows a reduced value to be entered for values in range of the baseValue * and width and absolute values can be entered for values outside the range . * For example , a base value of { @ code 1980 } and a width of { @ code 2 } will have * valid values from { @ code 1980 } to { @ code 2079 } . * During parsing , the text { @ code " 12 " } will result in the value { @ code 2012 } as that * is the value within the range where the last two characters are " 12 " . * By contrast , parsing the text { @ code " 1915 " } will result in the value { @ code 1915 } . * @ param field the field to append , not null * @ param width the field width of the printed and parsed field , from 1 to 10 * @ param maxWidth the maximum field width of the printed field , from 1 to 10 * @ param baseValue the base value of the range of valid values * @ return this , for chaining , not null * @ throws IllegalArgumentException if the width or base value is invalid */ public DateTimeFormatterBuilder appendValueReduced ( TemporalField field , int width , int maxWidth , int baseValue ) { } }
Jdk8Methods . requireNonNull ( field , "field" ) ; ReducedPrinterParser pp = new ReducedPrinterParser ( field , width , maxWidth , baseValue , null ) ; appendValue ( pp ) ; return this ;
public class Parser { /** * that the TableCell will include only the text of the cell . */ public Rule TableCell ( ) { } }
return Sequence ( NodeSequence ( push ( new TableCellNode ( ) ) , TestNot ( Sp ( ) , Optional ( ':' ) , Sp ( ) , OneOrMore ( '-' ) , Sp ( ) , Optional ( ':' ) , Sp ( ) , FirstOf ( '|' , Newline ( ) ) ) , Optional ( Sp ( ) , TestNot ( '|' ) , NotNewline ( ) ) , OneOrMore ( TestNot ( '|' ) , TestNot ( Sp ( ) , Newline ( ) ) , Inline ( ) , addAsChild ( ) , Optional ( Sp ( ) , Test ( '|' ) , Test ( Newline ( ) ) ) ) ) , ZeroOrMore ( '|' ) , ( ( TableCellNode ) peek ( ) ) . setColSpan ( Math . max ( 1 , matchLength ( ) ) ) ) ;
public class AppSummaryService { /** * interprets the number of runs based on number of columns in raw col family * @ param { @ link Result } * @ return number of runs */ long getNumberRunsScratch ( Map < byte [ ] , byte [ ] > rawFamily ) { } }
long numberRuns = 0L ; if ( rawFamily != null ) { numberRuns = rawFamily . size ( ) ; } if ( numberRuns == 0L ) { LOG . error ( "Number of runs in scratch column family can't be 0," + " if processing within TTL" ) ; throw new ProcessingException ( "Number of runs is 0" ) ; } return numberRuns ;
public class IndexTaskClient { /** * To use this method , { @ link # objectMapper } should be a jsonMapper . */ protected FullResponseHolder submitJsonRequest ( String taskId , HttpMethod method , String encodedPathSuffix , @ Nullable String encodedQueryString , byte [ ] content , boolean retry ) throws IOException , ChannelException , NoTaskLocationException { } }
return submitRequest ( taskId , MediaType . APPLICATION_JSON , method , encodedPathSuffix , encodedQueryString , content , retry ) ;
public class AnnotationsUtil { /** * Register all relevant annotation post processors in the given registry . * @ param registry the registry to operate on * @ param source the configuration source element ( already extracted ) * that this registration was triggered from . May be < code > null < / code > . * @ return a Set of BeanDefinitionHolders , containing all bean definitions * that have actually been registered by this call */ public static Set < BeanDefinitionHolder > registerAnnotationConfigProcessors ( BeanDefinitionRegistry registry , Object source , ReleaseId releaseId ) { } }
Set < BeanDefinitionHolder > beanDefs = new LinkedHashSet < BeanDefinitionHolder > ( 1 ) ; if ( ! registry . containsBeanDefinition ( KIE_ANNOTATION_PROCESSOR_CLASS_NAME ) ) { RootBeanDefinition def = new RootBeanDefinition ( AnnotationsPostProcessor . class ) ; def . setSource ( source ) ; def . getPropertyValues ( ) . add ( "releaseId" , releaseId ) ; beanDefs . add ( registerPostProcessor ( registry , def , KIE_ANNOTATION_PROCESSOR_CLASS_NAME ) ) ; } return beanDefs ;
public class FaultRootCauseServiceMarshaller { /** * Marshall the given parameter object . */ public void marshall ( FaultRootCauseService faultRootCauseService , ProtocolMarshaller protocolMarshaller ) { } }
if ( faultRootCauseService == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( faultRootCauseService . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( faultRootCauseService . getNames ( ) , NAMES_BINDING ) ; protocolMarshaller . marshall ( faultRootCauseService . getType ( ) , TYPE_BINDING ) ; protocolMarshaller . marshall ( faultRootCauseService . getAccountId ( ) , ACCOUNTID_BINDING ) ; protocolMarshaller . marshall ( faultRootCauseService . getEntityPath ( ) , ENTITYPATH_BINDING ) ; protocolMarshaller . marshall ( faultRootCauseService . getInferred ( ) , INFERRED_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DefaultEntityHandler { /** * SELECT SQL生成 * @ param metadata エンティティメタ情報 * @ param type エイティティタイプ * @ param sqlConfig SQLコンフィグ * @ param addCondition 条件を追加するかどうか 。 追加する場合 < code > true < / code > * @ return SELECT SQL */ protected String buildSelectSQL ( final TableMetadata metadata , final Class < ? extends Object > type , final SqlConfig sqlConfig , final boolean addCondition ) { } }
final List < ? extends TableMetadata . Column > columns = metadata . getColumns ( ) ; final StringBuilder sql = new StringBuilder ( buildSelectClause ( metadata , type , sqlConfig . getSqlAgentFactory ( ) . getSqlIdKeyName ( ) ) ) ; if ( addCondition ) { sql . append ( "/*BEGIN*/" ) . append ( System . lineSeparator ( ) ) ; sql . append ( "WHERE" ) . append ( System . lineSeparator ( ) ) ; for ( final TableMetadata . Column col : columns ) { final String camelColName = col . getCamelColumnName ( ) ; final StringBuilder parts = new StringBuilder ( ) . append ( "\t" ) . append ( "AND " ) . append ( col . getColumnIdentifier ( ) ) . append ( " = " ) . append ( "/*" ) . append ( camelColName ) . append ( "*/''" ) . append ( System . lineSeparator ( ) ) ; wrapIfComment ( sql , parts , col ) ; } sql . append ( "/*END*/" ) . append ( System . lineSeparator ( ) ) ; boolean firstFlag = true ; final List < ? extends TableMetadata . Column > keys = metadata . getKeyColumns ( ) ; if ( ! keys . isEmpty ( ) ) { sql . append ( "ORDER BY" ) . append ( System . lineSeparator ( ) ) ; firstFlag = true ; for ( final TableMetadata . Column col : keys ) { sql . append ( "\t" ) ; if ( firstFlag ) { sql . append ( " " ) ; firstFlag = false ; } else { sql . append ( ", " ) ; } sql . append ( col . getColumnIdentifier ( ) ) . append ( System . lineSeparator ( ) ) ; } } } return sql . toString ( ) ;
public class WeightedIndex { /** * Produces an evaluation object that reflects the weighted sum of evaluations of all underlying objectives . * @ param solution solution to evaluate * @ param data data to be used for evaluation * @ return weighted index evaluation */ @ Override public WeightedIndexEvaluation evaluate ( SolutionType solution , DataType data ) { } }
// initialize evaluation object WeightedIndexEvaluation eval = new WeightedIndexEvaluation ( ) ; // add evaluations produced by contained objectives weights . keySet ( ) . forEach ( obj -> { // evaluate solution using objective Evaluation objEval = obj . evaluate ( solution , data ) ; // flip weight sign if minimizing double w = weights . get ( obj ) ; if ( obj . isMinimizing ( ) ) { w = - w ; } // register in weighted index evaluation eval . addEvaluation ( obj , objEval , w ) ; } ) ; // return weighted index evaluation return eval ;
public class ChronicleMapBuilder { /** * Returns a new { @ code ChronicleMapBuilder } instance which is able to { @ linkplain # create ( ) * create } maps with the specified key and value classes . * @ param keyClass class object used to infer key type and discover it ' s properties via * reflection * @ param valueClass class object used to infer value type and discover it ' s properties via * reflection * @ param < K > key type of the maps , created by the returned builder * @ param < V > value type of the maps , created by the returned builder * @ return a new builder for the given key and value classes */ public static < K , V > ChronicleMapBuilder < K , V > of ( @ NotNull Class < K > keyClass , @ NotNull Class < V > valueClass ) { } }
return new ChronicleMapBuilder < > ( keyClass , valueClass ) ;
public class Interval { /** * A convenience method to retrieve a zoned date time based on the start * date , start time , and time zone id . * @ return the zoned start time */ public ZonedDateTime getStartZonedDateTime ( ) { } }
if ( zonedStartDateTime == null ) { zonedStartDateTime = ZonedDateTime . of ( startDate , startTime , zoneId ) ; } return zonedStartDateTime ;
public class MultiMEProxyHandler { /** * When a topic space is deleted , there may be proxy subscriptions * that need removing from the match space and putting into " limbo " * until the delete proxy subscriptions request is made * @ param destination The destination topic space that has been deleted * @ exception SIResourceException */ public void topicSpaceDeletedEvent ( DestinationHandler destination ) throws SIResourceException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "topicSpaceDeletedEvent" , destination ) ; try { _lockManager . lockExclusive ( ) ; _neighbours . topicSpaceDeleted ( destination ) ; } finally { _lockManager . unlockExclusive ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "topicSpaceDeletedEvent" ) ;
public class AbstractTrigger { /** * Set the name of this < code > Trigger < / code > . * @ param group * if < code > null < / code > , Scheduler . DEFAULT _ GROUP will be used . * @ exception IllegalArgumentException * if group is an empty string . */ public void setGroup ( final String group ) { } }
if ( group != null && group . trim ( ) . length ( ) == 0 ) throw new IllegalArgumentException ( "Group name cannot be an empty string." ) ; if ( group == null ) m_sGroup = IScheduler . DEFAULT_GROUP ; else m_sGroup = group ; m_aKey = null ;
public class HttpResponseImpl { /** * Initialize with a new wrapped message . * @ param context */ public void init ( HttpInboundServiceContext context ) { } }
this . isc = context ; this . message = context . getResponse ( ) ; this . body = null ;
public class GFARCImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . GFARC__XPOS : return XPOS_EDEFAULT == null ? xpos != null : ! XPOS_EDEFAULT . equals ( xpos ) ; case AfplibPackage . GFARC__YPOS : return YPOS_EDEFAULT == null ? ypos != null : ! YPOS_EDEFAULT . equals ( ypos ) ; case AfplibPackage . GFARC__MH : return MH_EDEFAULT == null ? mh != null : ! MH_EDEFAULT . equals ( mh ) ; case AfplibPackage . GFARC__MFR : return MFR_EDEFAULT == null ? mfr != null : ! MFR_EDEFAULT . equals ( mfr ) ; } return super . eIsSet ( featureID ) ;
public class CommonOps_DDF4 { /** * < p > Performs the vector dot product : < br > * < br > * c = a * b < br > * < br > * c & ge ; & sum ; < sub > k = 1 : n < / sub > { b < sub > k < / sub > * a < sub > k < / sub > } * @ param a The left vector in the multiplication operation . Not modified . * @ param b The right matrix in the multiplication operation . Not modified . * @ return The dot product */ public static double dot ( DMatrix4 a , DMatrix4 b ) { } }
return a . a1 * b . a1 + a . a2 * b . a2 + a . a3 * b . a3 + a . a4 * b . a4 ;
public class ModelsImpl { /** * Get All Entity Roles for a given entity . * @ param appId The application ID . * @ param versionId The version ID . * @ param hEntityId The hierarchical entity extractor ID . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the List & lt ; EntityRole & gt ; object */ public Observable < List < EntityRole > > getHierarchicalEntityRolesAsync ( UUID appId , String versionId , UUID hEntityId ) { } }
return getHierarchicalEntityRolesWithServiceResponseAsync ( appId , versionId , hEntityId ) . map ( new Func1 < ServiceResponse < List < EntityRole > > , List < EntityRole > > ( ) { @ Override public List < EntityRole > call ( ServiceResponse < List < EntityRole > > response ) { return response . body ( ) ; } } ) ;
public class MapElementConstants { /** * Set the default color for map elements . * @ param color is the default color for map elements . */ public static void setPreferredColor ( int color ) { } }
final Preferences prefs = Preferences . userNodeForPackage ( MapElementConstants . class ) ; if ( prefs != null ) { prefs . putInt ( "COLOR" , color ) ; // $ NON - NLS - 1 $ try { prefs . flush ( ) ; } catch ( BackingStoreException exception ) { } }
public class DocEnv { /** * Look up PackageDoc by qualified name . */ public PackageDocImpl lookupPackage ( String name ) { } }
// # # # Jing alleges that class check is needed // # # # to avoid a compiler bug . Most likely // # # # instead a dummy created for error recovery . // # # # Should investigate this . Name nameImpl = names . fromString ( name ) ; ModuleSymbol mod = syms . inferModule ( nameImpl ) ; PackageSymbol p = mod != null ? syms . getPackage ( mod , nameImpl ) : null ; ClassSymbol c = getClassSymbol ( name ) ; if ( p != null && c == null ) { return getPackageDoc ( p ) ; } else { return null ; }
public class ModelsImpl { /** * Updates the closed list model . * @ param appId The application ID . * @ param versionId The version ID . * @ param clEntityId The closed list model ID . * @ param closedListModelUpdateObject The new entity name and words list . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws ErrorResponseException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the OperationStatus object if successful . */ public OperationStatus updateClosedList ( UUID appId , String versionId , UUID clEntityId , ClosedListModelUpdateObject closedListModelUpdateObject ) { } }
return updateClosedListWithServiceResponseAsync ( appId , versionId , clEntityId , closedListModelUpdateObject ) . toBlocking ( ) . single ( ) . body ( ) ;
public class PersistenceType { /** * Returns the corresponding PersistenceType for a given Byte . * This method should NOT be called by any code outside the MFP component . * It is only public so that it can be accessed by sub - packages . * @ param aValue The Byte for which an PersistenceType is required . * @ return The corresponding PersistenceType */ public final static PersistenceType getPersistenceType ( Byte aValue ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Value = " + aValue ) ; return set [ aValue . intValue ( ) ] ;
public class Fetcher { /** * Iterates over child objects of the given biopax element , * using BioPAX object - type properties , until the element * with specified URI and class ( including its sub - classes ) . * is found . * @ param root biopax element to process * @ param uri URI to match * @ param type class to match * @ return true if the match found ; false - otherwise */ public boolean subgraphContains ( final BioPAXElement root , final String uri , final Class < ? extends BioPAXElement > type ) { } }
final AtomicBoolean found = new AtomicBoolean ( false ) ; Traverser traverser = new AbstractTraverser ( editorMap , filters ) { @ Override protected void visit ( Object range , BioPAXElement domain , Model model , PropertyEditor editor ) { if ( range instanceof BioPAXElement && ! found . get ( ) ) { if ( ( ( BioPAXElement ) range ) . getUri ( ) . equals ( uri ) ) found . set ( true ) ; // set global flag ; done . else if ( ! ( skipSubPathways && ( range instanceof Pathway ) ) ) traverse ( ( BioPAXElement ) range , model ) ; } } } ; traverser . traverse ( root , null ) ; return found . get ( ) ;
public class Neighbours { /** * Removes all the proxies associated with this Neighbour . * @ param neighbour * @ param transaction */ private void removeRegisteredProxies ( Neighbour neighbour , Transaction transaction , boolean wasRecovered ) throws SIResourceException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "removeRegisteredProxies" , new Object [ ] { neighbour , transaction , new Boolean ( wasRecovered ) } ) ; // Get all the proxies that this Neighbour has registered final Hashtable registeredProxies = neighbour . getRegisteredProxies ( ) ; // Check that there is actually some proxies to remove . if ( ! registeredProxies . isEmpty ( ) ) { boolean proxiesDeregistered = false ; final Enumeration subscriptions = registeredProxies . elements ( ) ; final ArrayList topics = new ArrayList ( ) ; final ArrayList topicSpaces = new ArrayList ( ) ; // Loop through each of the subscriptions that where registered and // remove them . while ( subscriptions . hasMoreElements ( ) ) { final MESubscription subscription = ( MESubscription ) subscriptions . nextElement ( ) ; // Remove the proxy from the list of proxies for this Neighbour . neighbour . proxyDeregistered ( subscription . getTopicSpaceUuid ( ) , subscription . getTopic ( ) , transaction ) ; DestinationHandler destination = _destinationManager . getDestinationInternal ( subscription . getTopicSpaceUuid ( ) , false ) ; // delete the proxy subscription final boolean deleted = deleteProxy ( destination , subscription , neighbour , subscription . getTopicSpaceUuid ( ) , subscription . getTopic ( ) , wasRecovered , true ) ; // If a PubSubOutputHandler is deleted , then add this topic and // topic space to the set to be fed through the topic space deleted // event . if ( deleted ) { topics . add ( subscription . getTopic ( ) ) ; topicSpaces . add ( subscription . getTopicSpaceUuid ( ) ) ; proxiesDeregistered = true ; } } // If there were any proxies removed , then call the proxy handler code to // publish that these subscriptions have been deleted if ( proxiesDeregistered && wasRecovered ) { _proxyHandler . unsubscribeEvent ( topicSpaces , topics , neighbour . getBusId ( ) , null ) ; } } else if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "no proxies registered for neighbour " + neighbour . getUUID ( ) . toString ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "removeRegisteredProxies" ) ;
public class RDSMetadataMarshaller { /** * Marshall the given parameter object . */ public void marshall ( RDSMetadata rDSMetadata , ProtocolMarshaller protocolMarshaller ) { } }
if ( rDSMetadata == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( rDSMetadata . getDatabase ( ) , DATABASE_BINDING ) ; protocolMarshaller . marshall ( rDSMetadata . getDatabaseUserName ( ) , DATABASEUSERNAME_BINDING ) ; protocolMarshaller . marshall ( rDSMetadata . getSelectSqlQuery ( ) , SELECTSQLQUERY_BINDING ) ; protocolMarshaller . marshall ( rDSMetadata . getResourceRole ( ) , RESOURCEROLE_BINDING ) ; protocolMarshaller . marshall ( rDSMetadata . getServiceRole ( ) , SERVICEROLE_BINDING ) ; protocolMarshaller . marshall ( rDSMetadata . getDataPipelineId ( ) , DATAPIPELINEID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ObjectNameBuilder { /** * Adds the key / value as a { @ link ObjectName } property . * @ param key the key to add * @ param value the value to add * @ return This builder */ public ObjectNameBuilder addProperty ( String key , String value ) { } }
nameStrBuilder . append ( sanitizeValue ( key ) ) . append ( '=' ) . append ( sanitizeValue ( value ) ) . append ( "," ) ; return this ;
public class JingleUtil { public IQ createErrorUnknownSession ( Jingle request ) { } }
StanzaError . Builder error = StanzaError . getBuilder ( ) ; error . setCondition ( StanzaError . Condition . item_not_found ) . addExtension ( JingleError . UNKNOWN_SESSION ) ; return IQ . createErrorResponse ( request , error ) ;
public class ExchangeRate { /** * Convert a coin amount to a fiat amount using this exchange rate . * @ throws ArithmeticException if the converted fiat amount is too high or too low . */ public Fiat coinToFiat ( Coin convertCoin ) { } }
// Use BigInteger because it ' s much easier to maintain full precision without overflowing . final BigInteger converted = BigInteger . valueOf ( convertCoin . value ) . multiply ( BigInteger . valueOf ( fiat . value ) ) . divide ( BigInteger . valueOf ( coin . value ) ) ; if ( converted . compareTo ( BigInteger . valueOf ( Long . MAX_VALUE ) ) > 0 || converted . compareTo ( BigInteger . valueOf ( Long . MIN_VALUE ) ) < 0 ) throw new ArithmeticException ( "Overflow" ) ; return Fiat . valueOf ( fiat . currencyCode , converted . longValue ( ) ) ;
public class appfwfieldtype { /** * Use this API to fetch appfwfieldtype resource of given name . */ public static appfwfieldtype get ( nitro_service service , String name ) throws Exception { } }
appfwfieldtype obj = new appfwfieldtype ( ) ; obj . set_name ( name ) ; appfwfieldtype response = ( appfwfieldtype ) obj . get_resource ( service ) ; return response ;
public class FixedDurationTemporalRandomIndexingMain { /** * Prints the semantic space to file , inserting the tag into the . sspace * file name */ private void printSpace ( SemanticSpace sspace , String tag ) { } }
try { String EXT = ".sspace" ; File output = ( overwrite ) ? new File ( outputDir , sspace . getSpaceName ( ) + tag + EXT ) : File . createTempFile ( sspace . getSpaceName ( ) + tag , EXT , outputDir ) ; long startTime = System . currentTimeMillis ( ) ; SemanticSpaceIO . save ( sspace , output , format ) ; long endTime = System . currentTimeMillis ( ) ; verbose ( "printed space in %.3f seconds%n" , ( ( endTime - startTime ) / 1000d ) ) ; } catch ( IOException ioe ) { throw new IOError ( ioe ) ; }
public class ApiOvhDbaaslogs { /** * Returns specified elasticsearch index * REST : GET / dbaas / logs / { serviceName } / output / elasticsearch / index / { indexId } * @ param serviceName [ required ] Service name * @ param indexId [ required ] Index ID */ public OvhIndex serviceName_output_elasticsearch_index_indexId_GET ( String serviceName , String indexId ) throws IOException { } }
String qPath = "/dbaas/logs/{serviceName}/output/elasticsearch/index/{indexId}" ; StringBuilder sb = path ( qPath , serviceName , indexId ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhIndex . class ) ;
public class AdditionalAnswers { /** * Creates an answer from a functional interface - allows for a strongly typed answer to be created * idiomatically in Java 8 * @ param answer interface to the answer - a void method * @ param < A > input parameter type 1 * @ param < B > input parameter type 2 * @ param < C > input parameter type 3 * @ param < D > input parameter type 4 * @ param < E > input parameter type 5 * @ param < F > input parameter type 6 * @ return the answer object to use * @ since 2.26.0 */ @ Incubating public static < A , B , C , D , E , F > Answer < Void > answerVoid ( VoidAnswer6 < A , B , C , D , E , F > answer ) { } }
return toAnswer ( answer ) ;
public class RoutesInner { /** * Creates or updates a route in the specified route table . * @ param resourceGroupName The name of the resource group . * @ param routeTableName The name of the route table . * @ param routeName The name of the route . * @ param routeParameters Parameters supplied to the create or update route operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable for the request */ public Observable < ServiceResponse < RouteInner > > createOrUpdateWithServiceResponseAsync ( String resourceGroupName , String routeTableName , String routeName , RouteInner routeParameters ) { } }
if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( routeTableName == null ) { throw new IllegalArgumentException ( "Parameter routeTableName is required and cannot be null." ) ; } if ( routeName == null ) { throw new IllegalArgumentException ( "Parameter routeName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( routeParameters == null ) { throw new IllegalArgumentException ( "Parameter routeParameters is required and cannot be null." ) ; } Validator . validate ( routeParameters ) ; final String apiVersion = "2018-08-01" ; Observable < Response < ResponseBody > > observable = service . createOrUpdate ( resourceGroupName , routeTableName , routeName , this . client . subscriptionId ( ) , routeParameters , apiVersion , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) ; return client . getAzureClient ( ) . getPutOrPatchResultAsync ( observable , new TypeToken < RouteInner > ( ) { } . getType ( ) ) ;
public class SimpleDataArrayCompactor { /** * Note that this method is called only by SimpleDataArray . */ final void clear ( ) { } }
reset ( ) ; _freeQueue . clear ( ) ; _targetQueue . clear ( ) ; _compactedQueue . clear ( ) ; while ( ! _updateManager . isServiceQueueEmpty ( ) ) { CompactionUpdateBatch batch = _updateManager . pollBatch ( ) ; _updateManager . recycleBatch ( batch ) ; }
public class StatsConfigHelper { /** * in which case we dont cache */ private static NLS getNLS ( Locale l , String resourceBundle , String statsType ) { } }
// init Locale boolean bDefaultLocale = false ; if ( l == null || l == Locale . getDefault ( ) ) { bDefaultLocale = true ; l = Locale . getDefault ( ) ; } NLS aNLS = null ; if ( resourceBundle == null ) { // resourceBundle is NULL // trial 1 : try prepending the 5.0 default resourcebundle location prefix ( to support commerce , portal , etc . ) // trial 2 : if that fails return default 6.0 PMI resourcebundle int trial = 1 ; do { if ( trial == 1 ) resourceBundle = PMI_RESOURCE_BUNDLE_PREFIX_50 + statsType ; else if ( trial == 2 ) resourceBundle = PMI_RESOURCE_BUNDLE ; // 234782 - JPM : Check in NLS cache aNLS = ( NLS ) nlsMap . get ( getNlsKey ( resourceBundle , l ) ) ; if ( aNLS != null ) return aNLS ; else aNLS = new NLS ( resourceBundle , l , true , false ) ; // first time create if ( aNLS . isResourceLoaded ( ) ) break ; ++ trial ; } while ( trial <= 2 ) ; } else { // resourcebundle ! = null // Custom resource bundle // 234782 - JPM : Check in NLS cache aNLS = ( NLS ) nlsMap . get ( getNlsKey ( resourceBundle , l ) ) ; if ( aNLS != null ) return aNLS ; else aNLS = new NLS ( resourceBundle , l , true , false ) ; // first time create // resourcebundle not loaded . so try using contextClassLoader to support // custom pmi in applications ( war / ear file ) // custom pmi resource bundle that is not found in the path // may its an application so use context classloader if ( ! aNLS . isResourceLoaded ( ) ) { // - - - - - security code final String _rbName = resourceBundle ; final Locale _locale = l ; try { aNLS = ( NLS ) AccessController . doPrivileged ( new PrivilegedExceptionAction ( ) { @ Override public Object run ( ) throws Exception { return new NLS ( _rbName , _locale , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; } } ) ; } catch ( Exception e1 ) { Tr . warning ( tc , "PMI0030W" , resourceBundle ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Error loading custom resource bundle using context classloader: " + e1 . getMessage ( ) ) ; } if ( aNLS == null || ! aNLS . isResourceLoaded ( ) ) { aNLS = null ; } // - - - - - security code } } // 234782 - JPM : Cache NLS object if successfully created if ( aNLS != null && aNLS . isResourceLoaded ( ) ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Caching resource bundle: " + resourceBundle + " locale: " + l ) ; // 234782 - JPM : Cache resourcebundle for this locale nlsMap . put ( getNlsKey ( resourceBundle , l ) , aNLS ) ; } return aNLS ;
public class KamImpl { /** * { @ inheritDoc } */ @ Override public KamNode findNode ( String label , NodeFilter filter ) { } }
for ( KamNode kamNode : idNodeMap . values ( ) ) { String nodeLabel = kamNode . getLabel ( ) ; if ( nodeLabel . equalsIgnoreCase ( label ) ) { if ( filter != null ) { if ( ! filter . accept ( kamNode ) ) { return null ; } } return kamNode ; } } return null ;
public class GraphUtil { /** * Returns the reverse of a given navigator . In the resulting * reverse navigator , the < code > next < / code > method returns the * same result as < code > nav . prev < / code > , and the < code > prev < / code > * method returns the same result as < code > nav . next < / code > . */ public static < Vertex > BiDiNavigator < Vertex > reverseBiDiNavigator ( BiDiNavigator < Vertex > nav ) { } }
return new ReverseBiDiNavigator < Vertex > ( nav ) ;
public class JdiInitiator { /** * The JShell specific Connector args for the LaunchingConnector . * @ param portthe socket port for ( non - JDI ) commands * @ param remoteVMOptions any user requested VM options * @ return the argument map */ private Map < String , String > launchArgs ( int port , String remoteVMOptions ) { } }
Map < String , String > argumentName2Value = new HashMap < > ( ) ; argumentName2Value . put ( "main" , remoteAgent + " " + port ) ; argumentName2Value . put ( "options" , remoteVMOptions ) ; return argumentName2Value ;
public class PathOverrideService { /** * given the groupId , and 2 string arrays , adds the name - responses pair to the table _ override * @ param groupId ID of group * @ param methodName name of method * @ param className name of class * @ throws Exception exception */ public void createOverride ( int groupId , String methodName , String className ) throws Exception { } }
// first make sure this doesn ' t already exist for ( Method method : EditService . getInstance ( ) . getMethodsFromGroupId ( groupId , null ) ) { if ( method . getMethodName ( ) . equals ( methodName ) && method . getClassName ( ) . equals ( className ) ) { // don ' t add if it already exists in the group return ; } } try ( Connection sqlConnection = sqlService . getConnection ( ) ) { PreparedStatement statement = sqlConnection . prepareStatement ( "INSERT INTO " + Constants . DB_TABLE_OVERRIDE + "(" + Constants . OVERRIDE_METHOD_NAME + "," + Constants . OVERRIDE_CLASS_NAME + "," + Constants . OVERRIDE_GROUP_ID + ")" + " VALUES (?, ?, ?)" ) ; statement . setString ( 1 , methodName ) ; statement . setString ( 2 , className ) ; statement . setInt ( 3 , groupId ) ; statement . executeUpdate ( ) ; } catch ( SQLException e ) { e . printStackTrace ( ) ; }
public class TableIndexDao { /** * Get or create a Geometry Index DAO * @ return geometry index dao * @ throws SQLException */ private GeometryIndexDao getGeometryIndexDao ( ) throws SQLException { } }
if ( geometryIndexDao == null ) { geometryIndexDao = DaoManager . createDao ( connectionSource , GeometryIndex . class ) ; } return geometryIndexDao ;
public class FsPermission { /** * Get the user file creation mask ( umask ) */ public static FsPermission getUMask ( Configuration conf ) { } }
int umask = DEFAULT_UMASK ; // To ensure backward compatibility first use the deprecated key . // If the deprecated key is not present then check for the new key if ( conf != null ) { String confUmask = conf . get ( UMASK_LABEL ) ; if ( confUmask != null ) { umask = new UmaskParser ( confUmask ) . getUMask ( ) ; } int oldUmask = conf . getInt ( DEPRECATED_UMASK_LABEL , Integer . MIN_VALUE ) ; if ( oldUmask != Integer . MIN_VALUE ) { // Property was set with old key if ( umask != oldUmask ) { LOG . warn ( DEPRECATED_UMASK_LABEL + " configuration key is deprecated. " + "Convert to " + UMASK_LABEL + ", using octal or symbolic umask " + "specifications." ) ; // Old and new umask values do not match - Use old umask umask = oldUmask ; } } } return new FsPermission ( ( short ) umask ) ;
public class ID3v2Frame { /** * Return the length of this frame in bytes , including the header . * @ return the length of this frame */ public int getFrameLength ( ) { } }
int length = frameData . length + FRAME_HEAD_SIZE ; if ( grouped ) { length ++ ; } if ( encrypted ) { length ++ ; } if ( lengthIndicator ) { length += 4 ; } return length ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcPositiveLengthMeasure ( ) { } }
if ( ifcPositiveLengthMeasureEClass == null ) { ifcPositiveLengthMeasureEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 901 ) ; } return ifcPositiveLengthMeasureEClass ;
public class Link { /** * Returns true if the information in this link should take * precedence over the information in the other link . */ public boolean overrides ( Link other ) { } }
if ( other . getStatus ( ) == LinkStatus . ASSERTED && status != LinkStatus . ASSERTED ) return false ; else if ( status == LinkStatus . ASSERTED && other . getStatus ( ) != LinkStatus . ASSERTED ) return true ; // the two links are from equivalent sources of information , so we // believe the most recent return timestamp > other . getTimestamp ( ) ;
public class IdlToDSMojo { /** * Package name comes from explicit plugin param ( if set ) , else the namespace definition , else * skream and die . * Having the plugin override allows backwards compatibility as well as being useful for * fiddling and tweaking . */ private String derivePackageName ( Service service , Document iddDoc ) { } }
String packageName = service . getPackageName ( ) ; if ( packageName == null ) { packageName = readNamespaceAttr ( iddDoc ) ; if ( packageName == null ) { throw new PluginException ( "Cannot find a package name " + "(not specified in plugin and no namespace in IDD" ) ; } } return packageName ;
public class SnappingMode { /** * Set a new coordinate ready to be snapped . */ public void setCoordinate ( Coordinate coordinate ) { } }
if ( coordinate == null ) { throw new IllegalArgumentException ( "Can't snap to a null coordinate." ) ; } this . coordinate = coordinate ; bounds = new Bbox ( coordinate . getX ( ) - rule . getDistance ( ) , coordinate . getY ( ) - rule . getDistance ( ) , rule . getDistance ( ) * 2 , rule . getDistance ( ) * 2 ) ; distance = Double . MAX_VALUE ; snappedCoordinate = coordinate ;
public class AbstractCollection { /** * For the parameter < i > _ expr < / i > the index in the list of all field * expressions is returned . * @ param _ expr expression for which the index is searched * @ return index of the field expression * @ see # addFieldExpr * @ see # getAllFieldExpr * @ see # allFieldExpr */ public int getFieldExprIndex ( final String _expr ) { } }
int ret = - 1 ; if ( getAllFieldExpr ( ) . containsKey ( _expr ) ) { final Integer ident = getAllFieldExpr ( ) . get ( _expr ) ; ret = ident . intValue ( ) ; } return ret ;
public class DefaultServiceRegistry { /** * - - - STOP SERVICE REGISTRY - - - */ @ Override public void stopped ( ) { } }
// Stop timer ScheduledFuture < ? > task = callTimeoutTimer . get ( ) ; if ( task != null ) { task . cancel ( false ) ; } // Stop pending invocations Iterator < PendingPromise > pendingPromises = promises . values ( ) . iterator ( ) ; while ( pendingPromises . hasNext ( ) ) { PendingPromise pending = pendingPromises . next ( ) ; pendingPromises . remove ( ) ; try { pending . promise . complete ( new RequestRejectedError ( nodeID , pending . action ) ) ; } catch ( Throwable cause ) { logger . warn ( "Unable to reject action \"" + pending . action + "\"!" , cause ) ; } } // Stop middlewares for ( Middleware middleware : middlewares ) { try { middleware . stopped ( ) ; } catch ( Throwable cause ) { logger . warn ( "Unable to stop middleware \"" + middleware . name + "\"!" , cause ) ; } } // Stop registered services stopAllLocalServices ( ) ; // Clear registries final long stamp = lock . writeLock ( ) ; try { // Delete strategies ( and registered actions ) strategies . clear ( ) ; // Delete all service names names . clear ( ) ; // Delete middlewares middlewares . clear ( ) ; // Delete cached node descriptor clearDescriptorCache ( ) ; } finally { lock . unlockWrite ( stamp ) ; }
public class ByteBufUtil { /** * Returns { @ code true } if the specified { @ link ByteBuf } starting at { @ code index } with { @ code length } is valid * UTF8 text , otherwise return { @ code false } . * @ param buf The given { @ link ByteBuf } . * @ param index The start index of the specified buffer . * @ param length The length of the specified buffer . * @ see * < a href = http : / / www . ietf . org / rfc / rfc3629 . txt > UTF - 8 Definition < / a > * < pre > * 1 . Bytes format of UTF - 8 * The table below summarizes the format of these different octet types . * The letter x indicates bits available for encoding bits of the character number . * Char . number range | UTF - 8 octet sequence * ( hexadecimal ) | ( binary ) * 0000 0000-0000 007F | 0xxxxx * 0000 0080-0000 07FF | 110xxxxx 10xxxxx * 0000 0800-0000 FFFF | 1110xxxx 10xxxxx 10xxxxx * 0001 0000-0010 FFFF | 11110xxx 10xxxxx 10xxxxx 10xxxxx * < / pre > * < pre > * 2 . Syntax of UTF - 8 Byte Sequences * UTF8 - octets = * ( UTF8 - char ) * UTF8 - char = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4 * UTF8-1 = % x00-7F * UTF8-2 = % xC2 - DF UTF8 - tail * UTF8-3 = % xE0 % xA0 - BF UTF8 - tail / * % xE1 - EC 2 ( UTF8 - tail ) / * % xED % x80-9F UTF8 - tail / * % xEE - EF 2 ( UTF8 - tail ) * UTF8-4 = % xF0 % x90 - BF 2 ( UTF8 - tail ) / * % xF1 - F3 3 ( UTF8 - tail ) / * % xF4 % x80-8F 2 ( UTF8 - tail ) * UTF8 - tail = % x80 - BF * < / pre > */ private static boolean isUtf8 ( ByteBuf buf , int index , int length ) { } }
final int endIndex = index + length ; while ( index < endIndex ) { byte b1 = buf . getByte ( index ++ ) ; byte b2 , b3 , b4 ; if ( ( b1 & 0x80 ) == 0 ) { // 1 byte continue ; } if ( ( b1 & 0xE0 ) == 0xC0 ) { // 2 bytes // Bit / Byte pattern // 110xxxxx 10xxxxx // C2 . . DF 80 . . BF if ( index >= endIndex ) { // no enough bytes return false ; } b2 = buf . getByte ( index ++ ) ; if ( ( b2 & 0xC0 ) != 0x80 ) { // 2nd byte not starts with 10 return false ; } if ( ( b1 & 0xFF ) < 0xC2 ) { // out of lower bound return false ; } } else if ( ( b1 & 0xF0 ) == 0xE0 ) { // 3 bytes // Bit / Byte pattern // 1110xxxx 10xxxxx 10xxxxx // E0 A0 . . BF 80 . . BF // E1 . . EC 80 . . BF 80 . . BF // ED 80 . . 9F 80 . . BF // E1 . . EF 80 . . BF 80 . . BF if ( index > endIndex - 2 ) { // no enough bytes return false ; } b2 = buf . getByte ( index ++ ) ; b3 = buf . getByte ( index ++ ) ; if ( ( b2 & 0xC0 ) != 0x80 || ( b3 & 0xC0 ) != 0x80 ) { // 2nd or 3rd bytes not start with 10 return false ; } if ( ( b1 & 0x0F ) == 0x00 && ( b2 & 0xFF ) < 0xA0 ) { // out of lower bound return false ; } if ( ( b1 & 0x0F ) == 0x0D && ( b2 & 0xFF ) > 0x9F ) { // out of upper bound return false ; } } else if ( ( b1 & 0xF8 ) == 0xF0 ) { // 4 bytes // Bit / Byte pattern // 11110xxx 10xxxxx 10xxxxx 10xxxxx // F0 90 . . BF 80 . . BF 80 . . BF // F1 . . F3 80 . . BF 80 . . BF 80 . . BF // F4 80 . . 8F 80 . . BF 80 . . BF if ( index > endIndex - 3 ) { // no enough bytes return false ; } b2 = buf . getByte ( index ++ ) ; b3 = buf . getByte ( index ++ ) ; b4 = buf . getByte ( index ++ ) ; if ( ( b2 & 0xC0 ) != 0x80 || ( b3 & 0xC0 ) != 0x80 || ( b4 & 0xC0 ) != 0x80 ) { // 2nd , 3rd or 4th bytes not start with 10 return false ; } if ( ( b1 & 0xFF ) > 0xF4 // b1 invalid || ( b1 & 0xFF ) == 0xF0 && ( b2 & 0xFF ) < 0x90 // b2 out of lower bound || ( b1 & 0xFF ) == 0xF4 && ( b2 & 0xFF ) > 0x8F ) { // b2 out of upper bound return false ; } } else { return false ; } } return true ;
public class KeySet { /** * Creates a key set containing a single key . { @ code key } should contain exactly as many elements * as there are columns in the primary or index key with this this key set is used . */ public static KeySet singleKey ( Key key ) { } }
return new KeySet ( false , ImmutableList . of ( key ) , ImmutableList . < KeyRange > of ( ) ) ;
public class VirtualMachineScaleSetExtensionsInner { /** * The operation to create or update an extension . * @ param resourceGroupName The name of the resource group . * @ param vmScaleSetName The name of the VM scale set where the extension should be create or updated . * @ param vmssExtensionName The name of the VM scale set extension . * @ param extensionParameters Parameters supplied to the Create VM scale set Extension operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the VirtualMachineScaleSetExtensionInner object */ public Observable < VirtualMachineScaleSetExtensionInner > beginCreateOrUpdateAsync ( String resourceGroupName , String vmScaleSetName , String vmssExtensionName , VirtualMachineScaleSetExtensionInner extensionParameters ) { } }
return beginCreateOrUpdateWithServiceResponseAsync ( resourceGroupName , vmScaleSetName , vmssExtensionName , extensionParameters ) . map ( new Func1 < ServiceResponse < VirtualMachineScaleSetExtensionInner > , VirtualMachineScaleSetExtensionInner > ( ) { @ Override public VirtualMachineScaleSetExtensionInner call ( ServiceResponse < VirtualMachineScaleSetExtensionInner > response ) { return response . body ( ) ; } } ) ;
public class DeleteTagsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DeleteTagsRequest deleteTagsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( deleteTagsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteTagsRequest . getConfigurationIds ( ) , CONFIGURATIONIDS_BINDING ) ; protocolMarshaller . marshall ( deleteTagsRequest . getTags ( ) , TAGS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class InstantiationUtils { /** * Try to instantiate the given class using the most optimal strategy first trying the { @ link io . micronaut . core . beans . BeanIntrospector } and * if no bean is present falling back to reflection . * @ param type The type * @ param < T > The generic type * @ return The instantiated instance or { @ link Optional # empty ( ) } */ public static @ Nonnull < T > Optional < T > tryInstantiate ( @ Nonnull Class < T > type ) { } }
ArgumentUtils . requireNonNull ( "type" , type ) ; final Supplier < T > reflectionFallback = ( ) -> { final Logger logger = ClassUtils . REFLECTION_LOGGER ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Cannot instantiate type [{}] without reflection. Attempting reflective instantiation" , type ) ; } try { T bean = type . newInstance ( ) ; if ( type . isInstance ( bean ) ) { return bean ; } return null ; } catch ( Throwable e ) { try { Constructor < T > defaultConstructor = type . getDeclaredConstructor ( ) ; defaultConstructor . setAccessible ( true ) ; return tryInstantiate ( defaultConstructor ) . orElse ( null ) ; } catch ( Throwable e1 ) { Logger log = LoggerFactory . getLogger ( InstantiationUtils . class ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Tried, but could not instantiate type: " + type , e ) ; } return null ; } } } ; final T result = BeanIntrospector . SHARED . findIntrospection ( type ) . map ( introspection -> { try { return introspection . instantiate ( ) ; } catch ( InstantiationException e ) { return reflectionFallback . get ( ) ; } } ) . orElseGet ( reflectionFallback ) ; return Optional . ofNullable ( result ) ;
public class OAuth20Utils { /** * Parse request scopes set . * @ param context the context * @ return the set */ public static Set < String > parseRequestScopes ( final HttpServletRequest context ) { } }
val parameterValues = context . getParameter ( OAuth20Constants . SCOPE ) ; if ( StringUtils . isBlank ( parameterValues ) ) { return new HashSet < > ( 0 ) ; } return CollectionUtils . wrapSet ( parameterValues . split ( " " ) ) ;
public class GroupApi { /** * Get all details of a group . * < pre > < code > GitLab Endpoint : GET / groups / : id < / code > < / pre > * @ param groupIdOrPath the group ID , path of the group , or a Group instance holding the group ID or path * @ return the Group instance for the specified group path * @ throws GitLabApiException if any exception occurs */ public Group getGroup ( Object groupIdOrPath ) throws GitLabApiException { } }
Response response = get ( Response . Status . OK , null , "groups" , getGroupIdOrPath ( groupIdOrPath ) ) ; return ( response . readEntity ( Group . class ) ) ;
public class CookieFlagsDetector { /** * This method is used to track calls made on a specific object . For instance , this could be used to track if " setHttpOnly ( true ) " * was executed on a specific cookie object . * This allows the detector to find interchanged calls like this * Cookie cookie1 = new Cookie ( " f " , " foo " ) ; < - This cookie is unsafe * Cookie cookie2 = new Cookie ( " b " , " bar " ) ; < - This cookie is safe * cookie1 . setHttpOnly ( false ) ; * cookie2 . setHttpOnly ( true ) ; * @ param cpg ConstantPoolGen * @ param startLocation The Location of the cookie initialization call . * @ param objectStackLocation The index of the cookie on the stack . * @ param invokeInstruction The instruction we want to detect . s * @ return The location of the invoke instruction provided for the cookie at a specific index on the stack . */ private Location getCookieInstructionLocation ( ConstantPoolGen cpg , Location startLocation , int objectStackLocation , String invokeInstruction ) { } }
Location location = startLocation ; InstructionHandle handle = location . getHandle ( ) ; int loadedStackValue = 0 ; // Loop until we find the setSecure call for this cookie while ( handle . getNext ( ) != null ) { handle = handle . getNext ( ) ; Instruction nextInst = handle . getInstruction ( ) ; // We check if the index of the cookie used for this invoke is the same as the one provided if ( nextInst instanceof ALOAD ) { ALOAD loadInst = ( ALOAD ) nextInst ; loadedStackValue = loadInst . getIndex ( ) ; } if ( nextInst instanceof INVOKEVIRTUAL && loadedStackValue == objectStackLocation ) { INVOKEVIRTUAL invoke = ( INVOKEVIRTUAL ) nextInst ; String methodNameWithSignature = invoke . getClassName ( cpg ) + "." + invoke . getMethodName ( cpg ) ; if ( methodNameWithSignature . equals ( invokeInstruction ) ) { Integer val = ByteCode . getConstantInt ( handle . getPrev ( ) ) ; if ( val != null && val == TRUE_INT_VALUE ) { return new Location ( handle , location . getBasicBlock ( ) ) ; } } } } return null ;
public class CmsOUEditDialog { /** * Saves the OU . < p > */ void saveOU ( ) { } }
try { List < String > resources = new ArrayList < String > ( ) ; for ( I_CmsEditableGroupRow row : m_ouResources . getRows ( ) ) { resources . add ( ( ( CmsPathSelectField ) row . getComponent ( ) ) . getValue ( ) ) ; } if ( m_ou == null ) { String parentOu = m_parentOu . getValue ( ) ; if ( ! parentOu . endsWith ( "/" ) ) { parentOu += "/" ; } if ( resources . contains ( "null" ) ) { resources . remove ( "null" ) ; } List < String > resourceNames = CmsFileUtil . removeRedundancies ( resources ) ; m_ou = OpenCms . getOrgUnitManager ( ) . createOrganizationalUnit ( m_cms , parentOu + m_name . getValue ( ) , m_description . getValue ( ) , getFlags ( ) , resourceNames . isEmpty ( ) ? null : resourceNames . get ( 0 ) ) ; if ( ! resourceNames . isEmpty ( ) ) { resourceNames . remove ( 0 ) ; Iterator < String > itResourceNames = CmsFileUtil . removeRedundancies ( resourceNames ) . iterator ( ) ; while ( itResourceNames . hasNext ( ) ) { OpenCms . getOrgUnitManager ( ) . addResourceToOrgUnit ( m_cms , m_ou . getName ( ) , itResourceNames . next ( ) ) ; } } } else { m_ou . setDescription ( m_description . getValue ( ) ) ; m_ou . setFlags ( getFlags ( ) ) ; List < String > resourceNamesNew = CmsFileUtil . removeRedundancies ( resources ) ; List < CmsResource > resourcesOld = OpenCms . getOrgUnitManager ( ) . getResourcesForOrganizationalUnit ( m_cms , m_ou . getName ( ) ) ; List < String > resourceNamesOld = new ArrayList < String > ( ) ; Iterator < CmsResource > itResourcesOld = resourcesOld . iterator ( ) ; while ( itResourcesOld . hasNext ( ) ) { CmsResource resourceOld = itResourcesOld . next ( ) ; resourceNamesOld . add ( m_cms . getSitePath ( resourceOld ) ) ; } Iterator < String > itResourceNamesNew = resourceNamesNew . iterator ( ) ; // add new resources to ou while ( itResourceNamesNew . hasNext ( ) ) { String resourceNameNew = itResourceNamesNew . next ( ) ; if ( ! resourceNamesOld . contains ( resourceNameNew ) ) { OpenCms . getOrgUnitManager ( ) . addResourceToOrgUnit ( m_cms , m_ou . getName ( ) , resourceNameNew ) ; } } Iterator < String > itResourceNamesOld = resourceNamesOld . iterator ( ) ; // delete old resources from ou while ( itResourceNamesOld . hasNext ( ) ) { String resourceNameOld = itResourceNamesOld . next ( ) ; if ( ! resourceNamesNew . contains ( resourceNameOld ) ) { OpenCms . getOrgUnitManager ( ) . removeResourceFromOrgUnit ( m_cms , m_ou . getName ( ) , resourceNameOld ) ; } } // write the edited organizational unit OpenCms . getOrgUnitManager ( ) . writeOrganizationalUnit ( m_cms , m_ou ) ; } } catch ( CmsException e ) { LOG . error ( "Unable to save OU" , e ) ; }
public class MacroCycleLayout { /** * Get the shared indices of a macrocycle and atoms shared with another ring . * @ param macrocycle macrocycle ring * @ param shared shared atoms * @ return the integers */ private List < Integer > getAttachedInOrder ( IRing macrocycle , IAtomContainer shared ) { } }
List < Integer > ringAttach = new ArrayList < > ( ) ; Set < IAtom > visit = new HashSet < > ( ) ; IAtom atom = shared . getAtom ( 0 ) ; while ( atom != null ) { visit . add ( atom ) ; ringAttach . add ( macrocycle . indexOf ( atom ) ) ; List < IAtom > connected = shared . getConnectedAtomsList ( atom ) ; atom = null ; for ( IAtom neighbor : connected ) { if ( ! visit . contains ( neighbor ) ) { atom = neighbor ; break ; } } } return ringAttach ;
public class Primes { /** * Returns the i - th prime number in the sequence of * all prime numbers below 19700 . The first in the sequence * ( n = 0 ) is the prime number 2. */ public static int getPrimeAt ( int index ) { } }
if ( index < 0 || index > PRIMES . length - 1 ) throw new ArrayIndexOutOfBoundsException ( "out of range " + index ) ; return PRIMES [ index ] ;
public class CmsObject { /** * Checks if the current user has required permissions to access a given resource . < p > * @ param resource the resource to check the permissions for * @ param requiredPermissions the set of permissions to check for * @ return < code > true < / code > if the required permissions are satisfied * @ throws CmsException if something goes wrong */ public boolean hasPermissions ( CmsResource resource , CmsPermissionSet requiredPermissions ) throws CmsException { } }
return m_securityManager . hasPermissions ( m_context , resource , requiredPermissions , true , CmsResourceFilter . ALL ) . isAllowed ( ) ;
public class ViewInstruction { /** * 注册一个 { @ link ViewDispatcher } 定义到上下文中 , 以被这个类的所有实例使用 */ protected ViewDispatcher registerViewDispatcher ( WebApplicationContext applicationContext ) { } }
// 并发下 , 重复注册虽然不会错误 , 但没有必要重复注册 synchronized ( applicationContext ) { if ( SpringUtils . getBean ( applicationContext , viewDispatcherName ) == null ) { GenericBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition ( ViewDispatcherImpl . class ) ; ( ( BeanDefinitionRegistry ) applicationContext . getAutowireCapableBeanFactory ( ) ) . registerBeanDefinition ( viewDispatcherName , beanDefinition ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "registered bean definition:" + ViewDispatcherImpl . class . getName ( ) ) ; } } return ( ViewDispatcher ) SpringUtils . getBean ( applicationContext , viewDispatcherName ) ; }
public class MultiNormalizerHybrid { /** * Apply min - max scaling to a specific output , overriding the global output strategy if any * @ param output the index of the input * @ param rangeFrom lower bound of the target range * @ param rangeTo upper bound of the target range * @ return the normalizer */ public MultiNormalizerHybrid minMaxScaleOutput ( int output , double rangeFrom , double rangeTo ) { } }
perOutputStrategies . put ( output , new MinMaxStrategy ( rangeFrom , rangeTo ) ) ; return this ;
public class Matrix3f { /** * Apply rotation of < code > angles . y < / code > radians about the Y axis , followed by a rotation of < code > angles . x < / code > radians about the X axis and * followed by a rotation of < code > angles . z < / code > radians about the Z axis . * 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 . * If < code > M < / code > is < code > this < / code > matrix and < code > R < / code > the rotation matrix , * then the new matrix will be < code > M * R < / code > . So when transforming a * vector < code > v < / code > with the new matrix by using < code > M * R * v < / code > , the * rotation will be applied first ! * This method is equivalent to calling : < code > rotateY ( angles . y ) . rotateX ( angles . x ) . rotateZ ( angles . z ) < / code > * @ param angles * the Euler angles * @ return this */ public Matrix3f rotateYXZ ( Vector3f angles ) { } }
return rotateYXZ ( angles . y , angles . x , angles . z ) ;
public class BGZFSplitFileInputFormat { /** * file repeatedly and checking addIndexedSplits for an index repeatedly . */ private int addProbabilisticSplits ( List < InputSplit > splits , int i , List < InputSplit > newSplits , Configuration cfg ) throws IOException { } }
final Path path = ( ( FileSplit ) splits . get ( i ) ) . getPath ( ) ; final FSDataInputStream in = path . getFileSystem ( cfg ) . open ( path ) ; final BGZFSplitGuesser guesser = new BGZFSplitGuesser ( in ) ; FileSplit fspl ; do { fspl = ( FileSplit ) splits . get ( i ) ; final long beg = fspl . getStart ( ) ; final long end = beg + fspl . getLength ( ) ; final long alignedBeg = guesser . guessNextBGZFBlockStart ( beg , end ) ; newSplits . add ( new FileSplit ( path , alignedBeg , end - alignedBeg , fspl . getLocations ( ) ) ) ; ++ i ; } while ( i < splits . size ( ) && fspl . getPath ( ) . equals ( path ) ) ; in . close ( ) ; return i ;
public class PolyUtils { /** * Find edge closest to the given coordinate */ public static int findEdge ( Poly node , MeshData tile , float value , int comp ) { } }
float error = Float . MAX_VALUE ; int edge = 0 ; for ( int i = 0 ; i < node . vertCount ; i ++ ) { int j = ( i + 1 ) % node . vertCount ; float v1 = tile . verts [ 3 * node . verts [ i ] + comp ] - value ; float v2 = tile . verts [ 3 * node . verts [ j ] + comp ] - value ; float d = v1 * v1 + v2 * v2 ; if ( d < error ) { error = d ; edge = i ; } } return edge ;
public class Node { /** * Replaces the current node with nodes defined using builder - style notation via a Closure . * @ param c A Closure defining the new nodes using builder - style notation . * @ return the original now replaced node */ public Node replaceNode ( Closure c ) { } }
if ( parent ( ) == null ) { throw new UnsupportedOperationException ( "Replacing the root node is not supported" ) ; } appendNodes ( c ) ; getParentList ( parent ( ) ) . remove ( this ) ; this . setParent ( null ) ; return this ;
public class ArrayContext { /** * Join the contents of the given array separated by the given separator . * For example , the array [ a , b , c ] with separator ' ' would result in : * < code > a b c < / code > . * @ param array The array to join * @ param separator The separator between values * @ return The resulting string */ public String join ( int [ ] array , String separator ) { } }
int size = array . length ; StringBuilder buffer = new StringBuilder ( 512 ) ; for ( int i = 0 ; i < size ; i ++ ) { int item = array [ i ] ; if ( i > 0 ) { buffer . append ( separator ) ; } buffer . append ( item ) ; } return buffer . toString ( ) ;
public class WASReactiveStreamsEngineImpl { /** * Declarative Services method for setting the context service reference * @ param ref reference to the service */ @ Reference ( name = "contextService" , service = WSContextService . class ) protected void setContextService ( ServiceReference < WSContextService > ref ) { } }
contextServiceRef . setReference ( ref ) ;
public class QueryStringBuilder { /** * Build query string . * @ return Query string or null if query string contains no parameters at all . */ public @ Nullable String build ( ) { } }
StringBuilder queryString = new StringBuilder ( ) ; for ( NameValuePair param : params ) { if ( queryString . length ( ) > 0 ) { queryString . append ( PARAM_SEPARATOR ) ; } queryString . append ( Escape . urlEncode ( param . getName ( ) ) ) ; queryString . append ( VALUE_SEPARATOR ) ; queryString . append ( Escape . urlEncode ( param . getValue ( ) ) ) ; } if ( queryString . length ( ) > 0 ) { return queryString . toString ( ) ; } else { return null ; }
public class XWikiExtensionRepositoryFactory { /** * ExtensionRepositoryFactory */ @ Override public ExtensionRepository createRepository ( ExtensionRepositoryDescriptor repositoryDescriptor ) throws ExtensionRepositoryException { } }
try { return new XWikiExtensionRepository ( repositoryDescriptor , this , this . licenseManager , this . httpClientFactory , this . factory ) ; } catch ( Exception e ) { throw new ExtensionRepositoryException ( "Failed to create repository [" + repositoryDescriptor + "]" , e ) ; }
public class LogBuffer { /** * Sets this buffer ' s position . If the mark is defined and larger than the * new position then it is discarded . < / p > * @ param newPosition The new position value ; must be non - negative and no * larger than the current limit * @ return This buffer * @ throws IllegalArgumentException If the preconditions on * < tt > newPosition < / tt > do not hold */ public final LogBuffer position ( final int newPosition ) { } }
if ( newPosition > limit || newPosition < 0 ) throw new IllegalArgumentException ( "limit excceed: " + newPosition ) ; this . position = origin + newPosition ; return this ;
public class HttpClient { /** * Setup a callback called when { @ link HttpClientRequest } is about to be sent . * @ param doOnRequest a consumer observing connected events * @ return a new { @ link HttpClient } */ public final HttpClient doOnRequest ( BiConsumer < ? super HttpClientRequest , ? super Connection > doOnRequest ) { } }
Objects . requireNonNull ( doOnRequest , "doOnRequest" ) ; return new HttpClientDoOn ( this , doOnRequest , null , null , null ) ;
public class BM25 { /** * 计算一个句子与一个文档的BM25相似度 * @ param sentence 句子 ( 查询语句 ) * @ param index 文档 ( 用语料库中的下标表示 ) * @ return BM25 score */ public double sim ( List < String > sentence , int index ) { } }
double score = 0 ; for ( String word : sentence ) { if ( ! f [ index ] . containsKey ( word ) ) continue ; int d = docs . get ( index ) . size ( ) ; Integer tf = f [ index ] . get ( word ) ; score += ( idf . get ( word ) * tf * ( k1 + 1 ) / ( tf + k1 * ( 1 - b + b * d / avgdl ) ) ) ; } return score ;
public class CounterMap { /** * This method purges counter for a given first element * @ param element */ public void clear ( F element ) { } }
Counter < S > s = maps . get ( element ) ; if ( s != null ) s . clear ( ) ;
public class ErrorCollector { /** * Adds a failure with the given { @ code reason } * to the table if { @ code matcher } does not match { @ code value } . * Execution continues , but the test will fail at the end if the match fails . */ public < T > void checkThat ( final String reason , final T value , final Matcher < T > matcher ) { } }
checkSucceeds ( new Callable < Object > ( ) { public Object call ( ) throws Exception { assertThat ( reason , value , matcher ) ; return value ; } } ) ;
public class DescribeInstancePatchesRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DescribeInstancePatchesRequest describeInstancePatchesRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( describeInstancePatchesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeInstancePatchesRequest . getInstanceId ( ) , INSTANCEID_BINDING ) ; protocolMarshaller . marshall ( describeInstancePatchesRequest . getFilters ( ) , FILTERS_BINDING ) ; protocolMarshaller . marshall ( describeInstancePatchesRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( describeInstancePatchesRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class JMLambda { /** * Run and return r . * @ param < R > the type parameter * @ param runnable the runnable * @ param returnSupplier the return supplier * @ return the r */ public static < R > R runAndReturn ( Runnable runnable , Supplier < R > returnSupplier ) { } }
runnable . run ( ) ; return returnSupplier . get ( ) ;
public class SBTAddManagedSourcesMojo { /** * Adds default SBT managed sources location to Maven project . * < code > $ { project . build . directory } / src _ managed < / code > is added to project ' s compile source roots */ @ Override public void execute ( ) { } }
if ( "pom" . equals ( project . getPackaging ( ) ) ) { return ; } File managedPath = new File ( project . getBuild ( ) . getDirectory ( ) , "src_managed" ) ; String managedPathStr = managedPath . getAbsolutePath ( ) ; if ( ! project . getCompileSourceRoots ( ) . contains ( managedPathStr ) ) { project . addCompileSourceRoot ( managedPathStr ) ; getLog ( ) . debug ( "Added source directory: " + managedPathStr ) ; }
public class HealthCheckMarshaller { /** * Marshall the given parameter object . */ public void marshall ( HealthCheck healthCheck , ProtocolMarshaller protocolMarshaller ) { } }
if ( healthCheck == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( healthCheck . getCommand ( ) , COMMAND_BINDING ) ; protocolMarshaller . marshall ( healthCheck . getInterval ( ) , INTERVAL_BINDING ) ; protocolMarshaller . marshall ( healthCheck . getTimeout ( ) , TIMEOUT_BINDING ) ; protocolMarshaller . marshall ( healthCheck . getRetries ( ) , RETRIES_BINDING ) ; protocolMarshaller . marshall ( healthCheck . getStartPeriod ( ) , STARTPERIOD_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class JSpinnerEditorValueProvider { /** * Retrieves the formatter currently in the text component of the spinner , if any . * Note that if editor of the spinner has been customized , this method may need to be adapted in a sub - class . * @ return Spinner formatter or null if not found . */ protected JFormattedTextField . AbstractFormatter getFormatter ( ) { } }
JFormattedTextField . AbstractFormatter formatter = null ; // Try to find a text component in the spinner JFormattedTextField textEditorComponent ; if ( spinner . getEditor ( ) instanceof JFormattedTextField ) { textEditorComponent = ( JFormattedTextField ) spinner . getEditor ( ) ; } else if ( spinner . getEditor ( ) instanceof JSpinner . DefaultEditor ) { textEditorComponent = ( ( JSpinner . DefaultEditor ) spinner . getEditor ( ) ) . getTextField ( ) ; } else { LOGGER . error ( "No formatted textfield can be found in the spinner to get the formatter: " + spinner ) ; textEditorComponent = null ; } // Read text from text component if ( textEditorComponent != null ) { formatter = textEditorComponent . getFormatter ( ) ; } return formatter ;
public class BigComplexMath { /** * Calculates the arc sine ( inverted sine ) of { @ link BigComplex } x in the complex domain . * < p > See : < a href = " https : / / en . wikipedia . org / wiki / Inverse _ trigonometric _ functions # Extension _ to _ complex _ plane " > Wikipedia : Inverse trigonometric functions ( Extension to complex plane ) < / a > < / p > * @ param x the { @ link BigComplex } to calculate the arc sine for * @ param mathContext the { @ link MathContext } used for the result * @ return the calculated arc sine { @ link BigComplex } with the precision specified in the < code > mathContext < / code > */ public static BigComplex asin ( BigComplex x , MathContext mathContext ) { } }
MathContext mc = new MathContext ( mathContext . getPrecision ( ) + 4 , mathContext . getRoundingMode ( ) ) ; return I . negate ( ) . multiply ( log ( I . multiply ( x , mc ) . add ( sqrt ( BigComplex . ONE . subtract ( x . multiply ( x , mc ) , mc ) , mc ) , mc ) , mc ) , mc ) . round ( mathContext ) ;
public class PubSubRealization { /** * Attaches to a created DurableSubscription which is homed on * the local ME . * @ param consumerPoint The consumer point to attach . * @ param subState The ConsumerDispatcherState describing the subscription . */ public ConsumableKey attachToLocalDurableSubscription ( LocalConsumerPoint consumerPoint , ConsumerDispatcherState subState ) throws SIDurableSubscriptionMismatchException , SIDurableSubscriptionNotFoundException , SIDestinationLockedException , SISelectorSyntaxException , SIDiscriminatorSyntaxException , SINotPossibleInCurrentConfigurationException , SIResourceException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "attachToLocalDurableSubscription" , new Object [ ] { consumerPoint , subState } ) ; ConsumerDispatcher consumerDispatcher = null ; ConsumableKey data = null ; /* * Lock the list of durable subscriptions to prevent others creating / using an * identical subscription */ synchronized ( _consumerDispatchersDurable ) { /* * Get the consumerDispatcher . If it does not exist then we create it . If it exists * already and is EXACTLY the same , then we connect to it . If it exists but only * the same in ID then throw exception . */ consumerDispatcher = getDurableSubscriptionConsumerDispatcher ( subState ) ; if ( consumerDispatcher != null ) { // If subscription already has consumers attached then reject the create // unless we are setting up a cloned subscriber . if ( consumerDispatcher . hasConsumersAttached ( ) && ! subState . isCloned ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "attachToLocalDurableSubscription" , "Consumers already attached" ) ; throw new SIDestinationLockedException ( nls . getFormattedMessage ( "SUBSCRIPTION_IN_USE_ERROR_CWSIP0152" , new Object [ ] { subState . getSubscriberID ( ) , _messageProcessor . getMessagingEngineName ( ) } , null ) ) ; } // Attach to the consumerDispatcher if it is EXACTLY the same if ( ! consumerDispatcher . getConsumerDispatcherState ( ) . isReady ( ) || ! consumerDispatcher . getConsumerDispatcherState ( ) . equals ( subState ) ) { // Found consumer dispatcher but only the IDs match , therefore cannot connect if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "attachToLocalDurableSubscription" , subState ) ; throw new SIDurableSubscriptionMismatchException ( nls . getFormattedMessage ( "SUBSCRIPTION_ALREADY_EXISTS_ERROR_CWSIP0143" , new Object [ ] { subState . getSubscriberID ( ) , _messageProcessor . getMessagingEngineName ( ) } , null ) ) ; } // If security is enabled , then check the user who is attempting // to attach matches the user who created the durable sub . if ( _messageProcessor . isBusSecure ( ) ) { if ( ! consumerDispatcher . getConsumerDispatcherState ( ) . equalUser ( subState ) ) { // Users don ' t match if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "attachToLocalDurableSubscription" , subState ) ; throw new SIDurableSubscriptionMismatchException ( nls . getFormattedMessage ( "USER_NOT_AUTH_ACTIVATE_ERROR_CWSIP0312" , new Object [ ] { subState . getUser ( ) , subState . getSubscriberID ( ) , _baseDestinationHandler . getName ( ) } , null ) ) ; } } // Attach the consumerpoint to the subscription . data = ( ConsumableKey ) consumerDispatcher . attachConsumerPoint ( consumerPoint , null , consumerPoint . getConsumerSession ( ) . getConnectionUuid ( ) , consumerPoint . getConsumerSession ( ) . getReadAhead ( ) , consumerPoint . getConsumerSession ( ) . getForwardScanning ( ) , null ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "attachToLocalDurableSubscription" , "SIDurableSubscriptionNotFoundException" ) ; throw new SIDurableSubscriptionNotFoundException ( nls . getFormattedMessage ( "SUBSCRIPTION_DOESNT_EXIST_ERROR_CWSIP0146" , new Object [ ] { subState . getSubscriberID ( ) , _messageProcessor . getMessagingEngineName ( ) } , null ) ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "attachToLocalDurableSubscription" , data ) ; return data ;
public class SharedPreferenceUtils { /** * put the int value to shared preference * @ param key * the name of the preference to save * @ param value * the name of the preference to modify . * @ see android . content . SharedPreferences # edit ( ) # putInt ( String , int ) */ public void putInt ( String key , int value ) { } }
sharedPreferences . edit ( ) . putInt ( key , value ) . commit ( ) ;
public class MapDotApi { /** * Get map value by path . * @ param < A > map key type * @ param < B > map value type * @ param map subject * @ param pathString nodes to walk in map * @ return value */ public static < A , B > Map < A , B > dotGetNullableMap ( final Map map , final String pathString ) { } }
return dotGetNullable ( map , Map . class , pathString ) ;
public class JKCollectionUtil { /** * To properties . * @ param propString the prop string * @ return the properties */ public static Properties toProperties ( String propString ) { } }
Properties prop = new Properties ( ) ; try { prop . load ( new StringReader ( propString ) ) ; return prop ; } catch ( IOException e ) { JK . throww ( e ) ; return null ; }
public class LhsBuilder { /** * Work out the type of " field " that is being specified , * as in : * age * age < * age = = $ param * age = = $ 1 | | age = = $ 2 * forall { age < $ } { , } * etc . as we treat them all differently . */ public FieldType calcFieldType ( String content ) { } }
final SnippetBuilder . SnippetType snippetType = SnippetBuilder . getType ( content ) ; if ( snippetType . equals ( SnippetBuilder . SnippetType . FORALL ) ) { return FieldType . FORALL_FIELD ; } else if ( ! snippetType . equals ( SnippetBuilder . SnippetType . SINGLE ) ) { return FieldType . NORMAL_FIELD ; } for ( String op : operators ) { if ( content . endsWith ( op ) ) { return FieldType . OPERATOR_FIELD ; } } return FieldType . SINGLE_FIELD ;
public class BatchOptions { /** * Jitters the batch flush interval by a random amount . This is primarily to avoid * large write spikes for users running a large number of client instances . * ie , a jitter of 5s and flush duration 10s means flushes will happen every 10-15s . * @ param jitterDuration ( milliseconds ) * @ return the BatchOptions instance to be able to use it in a fluent manner . */ public BatchOptions jitterDuration ( final int jitterDuration ) { } }
BatchOptions clone = getClone ( ) ; clone . jitterDuration = jitterDuration ; return clone ;
public class AbstractApi { /** * Constructs bad request response * @ param message message * @ return response */ protected Response createBadRequest ( String message ) { } }
ErrorResponse entity = new ErrorResponse ( ) ; entity . setMessage ( message ) ; return Response . status ( Response . Status . BAD_REQUEST ) . entity ( entity ) . build ( ) ;
public class RaidNode { /** * Determine a PolicyInfo from the codec , to re - generate the parity files * of modified source files . * @ param codec * @ return */ public PolicyInfo determinePolicy ( Codec codec ) { } }
for ( PolicyInfo info : configMgr . getAllPolicies ( ) ) { if ( ! info . getShouldRaid ( ) ) { continue ; } if ( info . getCodecId ( ) . equals ( codec . id ) ) { return info ; } } return null ;
public class CPRuleUserSegmentRelPersistenceImpl { /** * Caches the cp rule user segment rel in the entity cache if it is enabled . * @ param cpRuleUserSegmentRel the cp rule user segment rel */ @ Override public void cacheResult ( CPRuleUserSegmentRel cpRuleUserSegmentRel ) { } }
entityCache . putResult ( CPRuleUserSegmentRelModelImpl . ENTITY_CACHE_ENABLED , CPRuleUserSegmentRelImpl . class , cpRuleUserSegmentRel . getPrimaryKey ( ) , cpRuleUserSegmentRel ) ; cpRuleUserSegmentRel . resetOriginalValues ( ) ;
public class GeoJsonReaderDriver { /** * Parses a GeometryCollection * the geometry objects are described above : * { " type " : " GeometryCollection " , " geometries " : [ { " type " : " Point " , * " coordinates " : [ 100.0 , 0.0 ] } , { " type " : " LineString " , " coordinates " : [ * [ 101.0 , 0.0 ] , [ 102.0 , 1.0 ] ] } ] * @ param jp * @ throws IOException * @ throws SQLException * @ return GeometryCollection */ private void parseGeometryCollectionMetadata ( JsonParser jp ) throws IOException , SQLException { } }
jp . nextToken ( ) ; // FIELD _ NAME geometries String coordinatesField = jp . getText ( ) ; if ( coordinatesField . equalsIgnoreCase ( GeoJsonField . GEOMETRIES ) ) { jp . nextToken ( ) ; // START array jp . nextToken ( ) ; // START object while ( jp . getCurrentToken ( ) != JsonToken . END_ARRAY ) { jp . nextToken ( ) ; // FIELD _ NAME type jp . nextToken ( ) ; // VALUE _ STRING Point String geometryType = jp . getText ( ) ; parseGeometryMetadata ( jp , geometryType ) ; jp . nextToken ( ) ; } jp . nextToken ( ) ; // END _ OBJECT } geometry } else { throw new SQLException ( "Malformed GeoJSON file. Expected 'geometries', found '" + coordinatesField + "'" ) ; }
public class Task { /** * Terminates the running children of this task starting from the specified index up to the end . * @ param startIndex the start index */ protected void cancelRunningChildren ( int startIndex ) { } }
for ( int i = startIndex , n = getChildCount ( ) ; i < n ; i ++ ) { Task < E > child = getChild ( i ) ; if ( child . status == Status . RUNNING ) child . cancel ( ) ; }
public class File { /** * The label is always the filename . */ @ Override public String getLabel ( ) { } }
ResourceStore rs ; ResourceRef rr ; synchronized ( lock ) { rs = this . resourceStore ; rr = this . resourceRef ; } if ( rr != null ) { String path = rr . getPath ( ) . toString ( ) ; boolean isDirectory = path . endsWith ( Path . SEPARATOR_STRING ) ; int slashBefore ; if ( isDirectory ) { slashBefore = path . lastIndexOf ( Path . SEPARATOR_CHAR , path . length ( ) - 2 ) ; } else { slashBefore = path . lastIndexOf ( Path . SEPARATOR_CHAR ) ; } String filename = path . substring ( slashBefore + 1 ) ; if ( filename . isEmpty ( ) ) throw new IllegalArgumentException ( "Invalid filename for file: " + path ) ; if ( ! isDirectory ) { if ( rs != null ) { try { try ( ResourceConnection conn = rs . getResource ( rr . getPath ( ) ) . open ( ) ) { if ( conn . exists ( ) ) { return filename + " (" + StringUtility . getApproximateSize ( conn . getLength ( ) ) + ')' ; } } } catch ( FileNotFoundException e ) { // Resource removed between calls to exists ( ) and getLength ( ) // fall - through to return filename } catch ( IOException e ) { throw new WrappedException ( e ) ; } } } return filename ; } throw new IllegalStateException ( "Path not set" ) ;
public class JainSipUtils { /** * https : / / github . com / Mobicents / sip - servlets / issues / 62 */ public static String findRouteOrRequestUriTransport ( Request request ) { } }
RouteHeader route = ( RouteHeader ) request . getHeader ( RouteHeader . NAME ) ; if ( route != null ) { URI uri = route . getAddress ( ) . getURI ( ) ; return findURITransport ( uri , request . getContentLength ( ) . getContentLength ( ) ) ; } URI ruri = request . getRequestURI ( ) ; return findURITransport ( ruri , request . getContentLength ( ) . getContentLength ( ) ) ;
public class ScanCollectionDefault { /** * Scan List with closest RT less or equal to the provided one are returned . */ @ Override public List < IScan > getScansByRtLower ( double rt ) { } }
Map . Entry < Double , List < IScan > > lowerEntry = getRt2scan ( ) . lowerEntry ( rt ) ; if ( lowerEntry == null ) { return null ; } List < IScan > scans = lowerEntry . getValue ( ) ; if ( scans != null ) { return scans ; } return null ;
public class ExponentialBuckets { /** * { @ inheritDoc } * Override the base method making it faster thanks to exponential regression . */ protected Bucket getBucketForValue ( long value ) { } }
Bucket bucket ; if ( value >= max ) { bucket = buckets [ bucketNb + 1 ] ; } else { if ( value < min ) { bucket = buckets [ 0 ] ; } else { int idx = ( int ) Math . floor ( ( Math . log ( value ) - logMin ) / power ) + 1 ; bucket = buckets [ idx ] ; if ( value >= bucket . getMax ( ) ) { bucket = buckets [ idx + 1 ] ; } } } return bucket ;
public class BsAccessTokenCB { public AccessTokenCB acceptPK ( String id ) { } }
assertObjectNotNull ( "id" , id ) ; BsAccessTokenCB cb = this ; cb . query ( ) . docMeta ( ) . setId_Equal ( id ) ; return ( AccessTokenCB ) this ;
public class VehicleManager { /** * Remove a previously registered sink from the data pipeline . */ public void removeSink ( VehicleDataSink sink ) { } }
if ( sink != null ) { mRemoteOriginPipeline . removeSink ( sink ) ; sink . stop ( ) ; }