signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ConfigurationService { /** * Load data source configurations .
* @ param shardingSchemaName sharding schema name
* @ return data source configurations */
@ SuppressWarnings ( "unchecked" ) public Map < String , DataSourceConfiguration > loadDataSourceConfigurations ( final String shardingSchemaName ) { } } | Map < String , YamlDataSourceConfiguration > result = ( Map ) YamlEngine . unmarshal ( regCenter . getDirectly ( configNode . getDataSourcePath ( shardingSchemaName ) ) ) ; Preconditions . checkState ( null != result && ! result . isEmpty ( ) , "No available data sources to load for orchestration." ) ; return Maps . transformValues ( result , new Function < YamlDataSourceConfiguration , DataSourceConfiguration > ( ) { @ Override public DataSourceConfiguration apply ( final YamlDataSourceConfiguration input ) { return new DataSourceConfigurationYamlSwapper ( ) . swap ( input ) ; } } ) ; |
public class MonitoringResultsCollector { /** * Update the worker thread jmeter context with the main thread one
* @ param isInit if true the context a full copy is done , if false only update is done */
private void syncContext ( boolean isInit ) { } } | // jmeter context synchronisation
JMeterContext current = JMeterContextService . getContext ( ) ; JMeterContext ctx = this . getThreadContext ( ) ; if ( isInit ) { current . setCurrentSampler ( ctx . getCurrentSampler ( ) ) ; current . setEngine ( ctx . getEngine ( ) ) ; current . setRestartNextLoop ( ctx . isRestartNextLoop ( ) ) ; current . setSamplingStarted ( ctx . isSamplingStarted ( ) ) ; current . setThread ( ctx . getThread ( ) ) ; current . setThreadGroup ( ctx . getThreadGroup ( ) ) ; current . setThreadNum ( ctx . getThreadNum ( ) ) ; } current . setVariables ( ctx . getVariables ( ) ) ; current . setPreviousResult ( ctx . getPreviousResult ( ) ) ; // current . getSamplerContext ( ) . putAll ( ctx . getSamplerContext ( ) ) ; |
public class OpenIntDoubleHashMap { /** * Fills all values contained in the receiver into the specified list .
* Fills the list , starting at index 0.
* After this call returns the specified list has a new size that equals < tt > this . size ( ) < / tt > .
* Iteration order is guaranteed to be < i > identical < / i > to the order used by method { @ link # forEachKey ( IntProcedure ) } .
* This method can be used to iterate over the values of the receiver .
* @ param list the list to be filled , can have any size . */
public void values ( DoubleArrayList list ) { } } | list . setSize ( distinct ) ; double [ ] elements = list . elements ( ) ; double [ ] val = values ; byte [ ] stat = state ; int j = 0 ; for ( int i = stat . length ; i -- > 0 ; ) { if ( stat [ i ] == FULL ) elements [ j ++ ] = val [ i ] ; } |
public class AmazonCognitoIdentityClient { /** * Sets the roles for an identity pool . These roles are used when making calls to < a > GetCredentialsForIdentity < / a >
* action .
* You must use AWS Developer credentials to call this API .
* @ param setIdentityPoolRolesRequest
* Input to the < code > SetIdentityPoolRoles < / code > action .
* @ return Result of the SetIdentityPoolRoles operation returned by the service .
* @ throws InvalidParameterException
* Thrown for missing or bad input parameter ( s ) .
* @ throws ResourceNotFoundException
* Thrown when the requested resource ( for example , a dataset or record ) does not exist .
* @ throws NotAuthorizedException
* Thrown when a user is not authorized to access the requested resource .
* @ throws ResourceConflictException
* Thrown when a user tries to use a login which is already linked to another account .
* @ throws TooManyRequestsException
* Thrown when a request is throttled .
* @ throws InternalErrorException
* Thrown when the service encounters an error during processing the request .
* @ throws ConcurrentModificationException
* Thrown if there are parallel requests to modify a resource .
* @ sample AmazonCognitoIdentity . SetIdentityPoolRoles
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / cognito - identity - 2014-06-30 / SetIdentityPoolRoles "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public SetIdentityPoolRolesResult setIdentityPoolRoles ( SetIdentityPoolRolesRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeSetIdentityPoolRoles ( request ) ; |
public class RunInstancesRequest { /** * An elastic GPU to associate with the instance . An Elastic GPU is a GPU resource that you can attach to your
* Windows instance to accelerate the graphics performance of your applications . For more information , see < a
* href = " https : / / docs . aws . amazon . com / AWSEC2 / latest / WindowsGuide / elastic - graphics . html " > Amazon EC2 Elastic GPUs < / a >
* in the < i > Amazon Elastic Compute Cloud User Guide < / i > .
* @ return An elastic GPU to associate with the instance . An Elastic GPU is a GPU resource that you can attach to
* your Windows instance to accelerate the graphics performance of your applications . For more information ,
* see < a href = " https : / / docs . aws . amazon . com / AWSEC2 / latest / WindowsGuide / elastic - graphics . html " > Amazon EC2
* Elastic GPUs < / a > in the < i > Amazon Elastic Compute Cloud User Guide < / i > . */
public java . util . List < ElasticGpuSpecification > getElasticGpuSpecification ( ) { } } | if ( elasticGpuSpecification == null ) { elasticGpuSpecification = new com . amazonaws . internal . SdkInternalList < ElasticGpuSpecification > ( ) ; } return elasticGpuSpecification ; |
public class RythmEngine { /** * trim " rythm . " from conf keys */
private Map < String , Object > _processConf ( Map < String , ? > conf ) { } } | Map < String , Object > m = new HashMap < String , Object > ( conf . size ( ) ) ; for ( String s : conf . keySet ( ) ) { Object o = conf . get ( s ) ; if ( s . startsWith ( "rythm." ) ) s = s . replaceFirst ( "rythm\\." , "" ) ; m . put ( s , o ) ; } return m ; |
public class CustomFieldValueReader9 { /** * Reads outline code custom field values and populates container . */
private void processOutlineCodeValues ( ) throws IOException { } } | DirectoryEntry outlineCodeDir = ( DirectoryEntry ) m_projectDir . getEntry ( "TBkndOutlCode" ) ; FixedMeta fm = new FixedMeta ( new DocumentInputStream ( ( ( DocumentEntry ) outlineCodeDir . getEntry ( "FixedMeta" ) ) ) , 10 ) ; FixedData fd = new FixedData ( fm , new DocumentInputStream ( ( ( DocumentEntry ) outlineCodeDir . getEntry ( "FixedData" ) ) ) ) ; Map < Integer , FieldType > map = new HashMap < Integer , FieldType > ( ) ; int items = fm . getItemCount ( ) ; for ( int loop = 0 ; loop < items ; loop ++ ) { byte [ ] data = fd . getByteArrayValue ( loop ) ; if ( data . length < 18 ) { continue ; } int index = MPPUtility . getShort ( data , 0 ) ; int fieldID = MPPUtility . getInt ( data , 12 ) ; FieldType fieldType = FieldTypeHelper . getInstance ( fieldID ) ; if ( fieldType . getFieldTypeClass ( ) != FieldTypeClass . UNKNOWN ) { map . put ( Integer . valueOf ( index ) , fieldType ) ; } } VarMeta outlineCodeVarMeta = new VarMeta9 ( new DocumentInputStream ( ( ( DocumentEntry ) outlineCodeDir . getEntry ( "VarMeta" ) ) ) ) ; Var2Data outlineCodeVarData = new Var2Data ( outlineCodeVarMeta , new DocumentInputStream ( ( ( DocumentEntry ) outlineCodeDir . getEntry ( "Var2Data" ) ) ) ) ; Map < FieldType , List < Pair < String , String > > > valueMap = new HashMap < FieldType , List < Pair < String , String > > > ( ) ; for ( Integer id : outlineCodeVarMeta . getUniqueIdentifierArray ( ) ) { FieldType fieldType = map . get ( id ) ; String value = outlineCodeVarData . getUnicodeString ( id , VALUE ) ; String description = outlineCodeVarData . getUnicodeString ( id , DESCRIPTION ) ; List < Pair < String , String > > list = valueMap . get ( fieldType ) ; if ( list == null ) { list = new ArrayList < Pair < String , String > > ( ) ; valueMap . put ( fieldType , list ) ; } list . add ( new Pair < String , String > ( value , description ) ) ; } for ( Entry < FieldType , List < Pair < String , String > > > entry : valueMap . entrySet ( ) ) { populateContainer ( entry . getKey ( ) , entry . getValue ( ) ) ; } |
public class NotifdEventConsumer { private void cleanup_event_filters ( ) { } } | Enumeration keys = event_callback_map . keys ( ) ; while ( keys . hasMoreElements ( ) ) { String name = ( String ) keys . nextElement ( ) ; EventCallBackStruct callback_struct = event_callback_map . get ( name ) ; if ( callback_struct . consumer instanceof NotifdEventConsumer ) { try { EventChannelStruct ec_struct = channel_map . get ( callback_struct . channel_name ) ; Filter filter = ec_struct . structuredProxyPushSupplier . get_filter ( callback_struct . filter_id ) ; ec_struct . structuredProxyPushSupplier . remove_filter ( callback_struct . filter_id ) ; filter . destroy ( ) ; } catch ( FilterNotFound e ) { // Do nothing
} } } |
public class DescribeNetworkInterfacesRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < DescribeNetworkInterfacesRequest > getDryRunRequest ( ) { } } | Request < DescribeNetworkInterfacesRequest > request = new DescribeNetworkInterfacesRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class InternalXbaseParser { /** * InternalXbase . g : 867:1 : ruleXOtherOperatorExpression returns [ EObject current = null ] : ( this _ XAdditiveExpression _ 0 = ruleXAdditiveExpression ( ( ( ( ( ) ( ( ruleOpOther ) ) ) ) = > ( ( ) ( ( ruleOpOther ) ) ) ) ( ( lv _ rightOperand _ 3_0 = ruleXAdditiveExpression ) ) ) * ) ; */
public final EObject ruleXOtherOperatorExpression ( ) throws RecognitionException { } } | EObject current = null ; EObject this_XAdditiveExpression_0 = null ; EObject lv_rightOperand_3_0 = null ; enterRule ( ) ; try { // InternalXbase . g : 873:2 : ( ( this _ XAdditiveExpression _ 0 = ruleXAdditiveExpression ( ( ( ( ( ) ( ( ruleOpOther ) ) ) ) = > ( ( ) ( ( ruleOpOther ) ) ) ) ( ( lv _ rightOperand _ 3_0 = ruleXAdditiveExpression ) ) ) * ) )
// InternalXbase . g : 874:2 : ( this _ XAdditiveExpression _ 0 = ruleXAdditiveExpression ( ( ( ( ( ) ( ( ruleOpOther ) ) ) ) = > ( ( ) ( ( ruleOpOther ) ) ) ) ( ( lv _ rightOperand _ 3_0 = ruleXAdditiveExpression ) ) ) * )
{ // InternalXbase . g : 874:2 : ( this _ XAdditiveExpression _ 0 = ruleXAdditiveExpression ( ( ( ( ( ) ( ( ruleOpOther ) ) ) ) = > ( ( ) ( ( ruleOpOther ) ) ) ) ( ( lv _ rightOperand _ 3_0 = ruleXAdditiveExpression ) ) ) * )
// InternalXbase . g : 875:3 : this _ XAdditiveExpression _ 0 = ruleXAdditiveExpression ( ( ( ( ( ) ( ( ruleOpOther ) ) ) ) = > ( ( ) ( ( ruleOpOther ) ) ) ) ( ( lv _ rightOperand _ 3_0 = ruleXAdditiveExpression ) ) ) *
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXOtherOperatorExpressionAccess ( ) . getXAdditiveExpressionParserRuleCall_0 ( ) ) ; } pushFollow ( FOLLOW_14 ) ; this_XAdditiveExpression_0 = ruleXAdditiveExpression ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current = this_XAdditiveExpression_0 ; afterParserOrEnumRuleCall ( ) ; } // InternalXbase . g : 883:3 : ( ( ( ( ( ) ( ( ruleOpOther ) ) ) ) = > ( ( ) ( ( ruleOpOther ) ) ) ) ( ( lv _ rightOperand _ 3_0 = ruleXAdditiveExpression ) ) ) *
loop11 : do { int alt11 = 2 ; alt11 = dfa11 . predict ( input ) ; switch ( alt11 ) { case 1 : // InternalXbase . g : 884:4 : ( ( ( ( ) ( ( ruleOpOther ) ) ) ) = > ( ( ) ( ( ruleOpOther ) ) ) ) ( ( lv _ rightOperand _ 3_0 = ruleXAdditiveExpression ) )
{ // InternalXbase . g : 884:4 : ( ( ( ( ) ( ( ruleOpOther ) ) ) ) = > ( ( ) ( ( ruleOpOther ) ) ) )
// InternalXbase . g : 885:5 : ( ( ( ) ( ( ruleOpOther ) ) ) ) = > ( ( ) ( ( ruleOpOther ) ) )
{ // InternalXbase . g : 895:5 : ( ( ) ( ( ruleOpOther ) ) )
// InternalXbase . g : 896:6 : ( ) ( ( ruleOpOther ) )
{ // InternalXbase . g : 896:6 : ( )
// InternalXbase . g : 897:7:
{ if ( state . backtracking == 0 ) { current = forceCreateModelElementAndSet ( grammarAccess . getXOtherOperatorExpressionAccess ( ) . getXBinaryOperationLeftOperandAction_1_0_0_0 ( ) , current ) ; } } // InternalXbase . g : 903:6 : ( ( ruleOpOther ) )
// InternalXbase . g : 904:7 : ( ruleOpOther )
{ // InternalXbase . g : 904:7 : ( ruleOpOther )
// InternalXbase . g : 905:8 : ruleOpOther
{ if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElement ( grammarAccess . getXOtherOperatorExpressionRule ( ) ) ; } } if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXOtherOperatorExpressionAccess ( ) . getFeatureJvmIdentifiableElementCrossReference_1_0_0_1_0 ( ) ) ; } pushFollow ( FOLLOW_4 ) ; ruleOpOther ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { afterParserOrEnumRuleCall ( ) ; } } } } } // InternalXbase . g : 921:4 : ( ( lv _ rightOperand _ 3_0 = ruleXAdditiveExpression ) )
// InternalXbase . g : 922:5 : ( lv _ rightOperand _ 3_0 = ruleXAdditiveExpression )
{ // InternalXbase . g : 922:5 : ( lv _ rightOperand _ 3_0 = ruleXAdditiveExpression )
// InternalXbase . g : 923:6 : lv _ rightOperand _ 3_0 = ruleXAdditiveExpression
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXOtherOperatorExpressionAccess ( ) . getRightOperandXAdditiveExpressionParserRuleCall_1_1_0 ( ) ) ; } pushFollow ( FOLLOW_14 ) ; lv_rightOperand_3_0 = ruleXAdditiveExpression ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElementForParent ( grammarAccess . getXOtherOperatorExpressionRule ( ) ) ; } set ( current , "rightOperand" , lv_rightOperand_3_0 , "org.eclipse.xtext.xbase.Xbase.XAdditiveExpression" ) ; afterParserOrEnumRuleCall ( ) ; } } } } break ; default : break loop11 ; } } while ( true ) ; } } if ( state . backtracking == 0 ) { leaveRule ( ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class TransliteratorRegistry { /** * Given a simple ID ( forward direction , no inline filter , not
* compound ) attempt to instantiate it from the registry . Return
* 0 on failure .
* Return a non - empty aliasReturn value if the ID points to an alias .
* We cannot instantiate it ourselves because the alias may contain
* filters or compounds , which we do not understand . Caller should
* make aliasReturn empty before calling . */
public Transliterator get ( String ID , StringBuffer aliasReturn ) { } } | Object [ ] entry = find ( ID ) ; return ( entry == null ) ? null : instantiateEntry ( ID , entry , aliasReturn ) ; |
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIfcRailingTypeEnumToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class UfsStatus { /** * Converts an array of UFS file status to a listing result where each element in the array is
* a file or directory name .
* @ param children array of listing statuses
* @ return array of file or directory names , or null if the input is null */
@ Nullable public static String [ ] convertToNames ( UfsStatus [ ] children ) { } } | if ( children == null ) { return null ; } String [ ] ret = new String [ children . length ] ; for ( int i = 0 ; i < children . length ; ++ i ) { ret [ i ] = children [ i ] . getName ( ) ; } return ret ; |
public class CmsXmlContentPropertyHelper { /** * Reads property nodes from the given location . < p >
* @ param cms the current cms context
* @ param baseLocation the base location
* @ return the properties */
public static Map < String , String > readProperties ( CmsObject cms , I_CmsXmlContentLocation baseLocation ) { } } | Map < String , String > result = new HashMap < String , String > ( ) ; String elementName = CmsXmlContentProperty . XmlNode . Properties . name ( ) ; String nameElementName = CmsXmlContentProperty . XmlNode . Name . name ( ) ; List < I_CmsXmlContentValueLocation > propertyLocations = baseLocation . getSubValues ( elementName ) ; for ( I_CmsXmlContentValueLocation propertyLocation : propertyLocations ) { I_CmsXmlContentValueLocation nameLocation = propertyLocation . getSubValue ( nameElementName ) ; String name = nameLocation . asString ( cms ) . trim ( ) ; String value = null ; I_CmsXmlContentValueLocation valueLocation = propertyLocation . getSubValue ( CmsXmlContentProperty . XmlNode . Value . name ( ) ) ; I_CmsXmlContentValueLocation stringLocation = valueLocation . getSubValue ( CmsXmlContentProperty . XmlNode . String . name ( ) ) ; I_CmsXmlContentValueLocation fileListLocation = valueLocation . getSubValue ( CmsXmlContentProperty . XmlNode . FileList . name ( ) ) ; if ( stringLocation != null ) { value = stringLocation . asString ( cms ) . trim ( ) ; } else if ( fileListLocation != null ) { List < CmsUUID > idList = new ArrayList < CmsUUID > ( ) ; List < I_CmsXmlContentValueLocation > fileLocations = fileListLocation . getSubValues ( CmsXmlContentProperty . XmlNode . Uri . name ( ) ) ; for ( I_CmsXmlContentValueLocation fileLocation : fileLocations ) { CmsUUID structureId = fileLocation . asId ( cms ) ; idList . add ( structureId ) ; } value = CmsStringUtil . listAsString ( idList , CmsXmlContentProperty . PROP_SEPARATOR ) ; } if ( value != null ) { result . put ( name , value ) ; } } return result ; |
public class BaseNeo4jEntityQueries { /** * Example : CREATE ( n : ENTITY : table { id : { 0 } } ) RETURN n */
private static String initCreateEntityQuery ( EntityKeyMetadata entityKeyMetadata ) { } } | StringBuilder queryBuilder = new StringBuilder ( "CREATE " ) ; appendEntityNode ( ENTITY_ALIAS , entityKeyMetadata , queryBuilder ) ; queryBuilder . append ( " RETURN " ) ; queryBuilder . append ( ENTITY_ALIAS ) ; return queryBuilder . toString ( ) ; |
public class SeaGlassInternalFrameTitlePane { /** * Resets the menuButton icon to match that of the frame . */
private void updateMenuIcon ( ) { } } | Icon frameIcon = frame . getFrameIcon ( ) ; SeaGlassContext context = getContext ( this ) ; if ( frameIcon != null ) { Dimension maxSize = ( Dimension ) context . getStyle ( ) . get ( context , "InternalFrameTitlePane.maxFrameIconSize" ) ; int maxWidth = 16 ; int maxHeight = 16 ; if ( maxSize != null ) { maxWidth = maxSize . width ; maxHeight = maxSize . height ; } if ( ( frameIcon . getIconWidth ( ) > maxWidth || frameIcon . getIconHeight ( ) > maxHeight ) && ( frameIcon instanceof ImageIcon ) ) { frameIcon = new ImageIcon ( ( ( ImageIcon ) frameIcon ) . getImage ( ) . getScaledInstance ( maxWidth , maxHeight , Image . SCALE_SMOOTH ) ) ; } } context . dispose ( ) ; menuButton . setIcon ( frameIcon ) ; |
public class example { /** * This is an example to show you can compress unsorted integers
* as long as most are small . */
public static void unsortedExample ( ) { } } | final int N = 1333333 ; int [ ] data = new int [ N ] ; // initialize the data ( most will be small
for ( int k = 0 ; k < N ; k += 1 ) data [ k ] = 3 ; // throw some larger values
for ( int k = 0 ; k < N ; k += 5 ) data [ k ] = 100 ; for ( int k = 0 ; k < N ; k += 533 ) data [ k ] = 10000 ; int [ ] compressed = new int [ N + 1024 ] ; // could need more
IntegerCODEC codec = new Composition ( new FastPFOR ( ) , new VariableByte ( ) ) ; // compressing
IntWrapper inputoffset = new IntWrapper ( 0 ) ; IntWrapper outputoffset = new IntWrapper ( 0 ) ; codec . compress ( data , inputoffset , data . length , compressed , outputoffset ) ; System . out . println ( "compressed unsorted integers from " + data . length * 4 / 1024 + "KB to " + outputoffset . intValue ( ) * 4 / 1024 + "KB" ) ; // we can repack the data : ( optional )
compressed = Arrays . copyOf ( compressed , outputoffset . intValue ( ) ) ; int [ ] recovered = new int [ N ] ; IntWrapper recoffset = new IntWrapper ( 0 ) ; codec . uncompress ( compressed , new IntWrapper ( 0 ) , compressed . length , recovered , recoffset ) ; if ( Arrays . equals ( data , recovered ) ) System . out . println ( "data is recovered without loss" ) ; else throw new RuntimeException ( "bug" ) ; // could use assert
System . out . println ( ) ; |
public class LObjDblConsumerBuilder { /** * One of ways of creating builder . This might be the only way ( considering all _ functional _ builders ) that might be utilize to specify generic params only once . */
@ Nonnull public static < T > LObjDblConsumerBuilder < T > objDblConsumer ( Consumer < LObjDblConsumer < T > > consumer ) { } } | return new LObjDblConsumerBuilder ( consumer ) ; |
public class BaseDuoSecurityAuthenticationService { /** * Sign http users request http .
* @ param request the request
* @ return the http */
@ SneakyThrows protected Http signHttpUserPreAuthRequest ( final Http request ) { } } | request . signRequest ( duoProperties . getDuoIntegrationKey ( ) , duoProperties . getDuoSecretKey ( ) ) ; return request ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link CombinerParameterType } { @ code > } } */
@ XmlElementDecl ( namespace = "urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" , name = "CombinerParameter" ) public JAXBElement < CombinerParameterType > createCombinerParameter ( CombinerParameterType value ) { } } | return new JAXBElement < CombinerParameterType > ( _CombinerParameter_QNAME , CombinerParameterType . class , null , value ) ; |
public class TextProcessor { /** * < p > Konstruiert eine neue Instanz . < / p >
* @ param element element to be formatted
* @ return new processor instance */
static < V > TextProcessor < V > create ( TextElement < V > element ) { } } | return new TextProcessor < > ( element , false , Locale . ROOT , TextWidth . WIDE , OutputContext . FORMAT , Leniency . SMART , 0 ) ; |
public class DependencyContainer { /** * Sets the modified . */
public void setModified ( boolean isModified ) { } } | _isModified = isModified ; if ( _isModified ) _checkExpiresTime = Long . MAX_VALUE / 2 ; else _checkExpiresTime = CurrentTime . currentTime ( ) + _checkInterval ; if ( ! isModified ) _isModifiedLog = false ; |
public class CompoundList { /** * Creates a list of a left and right list .
* @ param left The left list .
* @ param right The right list .
* @ param < S > The type of the list ' s elements .
* @ return A compound list representing the elements of both lists . */
public static < S > List < S > of ( List < ? extends S > left , List < ? extends S > right ) { } } | List < S > list = new ArrayList < S > ( left . size ( ) + right . size ( ) ) ; list . addAll ( left ) ; list . addAll ( right ) ; return list ; |
public class ArrayBlockingQueueWithShutdown { /** * Inserts the specified element into this queue , waiting if necessary
* for space to become available .
* This may throw an { @ link InterruptedException } in two cases
* < ol >
* < li > If the queue was shut down . < / li >
* < li > If the thread was was interrupted . < / li >
* < / ol >
* So you have to check which is the case , e . g . by calling { @ link # isShutdown ( ) } .
* @ param e the element to add .
* @ throws InterruptedException if interrupted while waiting or if the queue was shut down . */
@ Override public void put ( E e ) throws InterruptedException { } } | checkNotNull ( e ) ; lock . lockInterruptibly ( ) ; try { putInternal ( e , true ) ; } finally { lock . unlock ( ) ; } |
public class AbstractCacheService { /** * Gets the name of the quorum associated with specified cache
* @ param cacheName name of the cache
* @ return name of the associated quorum
* null if there is no associated quorum */
@ Override public String getQuorumName ( String cacheName ) { } } | CacheConfig cacheConfig = getCacheConfig ( cacheName ) ; if ( cacheConfig == null ) { return null ; } return cacheConfig . getQuorumName ( ) ; |
public class LssClient { /** * Get your live recording preset by live recording preset name .
* @ param recording Live recording preset name .
* @ return Your live recording preset */
public GetRecordingResponse getRecording ( String recording ) { } } | checkStringNotEmpty ( recording , "The parameter recording should NOT be null or empty string." ) ; GetRecordingRequest request = new GetRecordingRequest ( ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . GET , request , RECORDING , recording ) ; return invokeHttpClient ( internalRequest , GetRecordingResponse . class ) ; |
public class RequestBuilder { /** * GET */
private static HttpRequestBase addParamsGet ( AsyncRequest asyncRequest ) { } } | HttpGet get = new HttpGet ( asyncRequest . getUrl ( ) ) ; Parameters parameter = asyncRequest . getParameter ( ) ; if ( parameter != null && parameter . getNameValuePair ( ) != null ) { try { get . setURI ( new URIBuilder ( get . getURI ( ) ) . addParameters ( parameter . getNameValuePair ( ) ) . build ( ) ) ; } catch ( URISyntaxException e ) { e . printStackTrace ( ) ; } } Headers header = asyncRequest . getHeader ( ) ; if ( header != null ) { get . setHeaders ( header . toHeaderArray ( ) ) ; } return get ; |
public class ClassUtil { /** * Returns the property set method declared in the specified { @ code cls }
* with the specified property name { @ code propName } .
* { @ code null } is returned if no method is found .
* @ param cls
* @ param propName
* @ return */
public static Method getPropSetMethod ( final Class < ? > cls , final String propName ) { } } | Map < String , Method > propSetMethodMap = entityPropSetMethodPool . get ( cls ) ; if ( propSetMethodMap == null ) { loadPropGetSetMethodList ( cls ) ; propSetMethodMap = entityPropSetMethodPool . get ( cls ) ; } Method method = propSetMethodMap . get ( propName ) ; if ( method == null ) { synchronized ( entityDeclaredPropGetMethodPool ) { Map < String , Method > setterMethodList = getPropSetMethodList ( cls ) ; for ( String key : setterMethodList . keySet ( ) ) { if ( isPropName ( cls , propName , key ) ) { method = propSetMethodMap . get ( key ) ; break ; } } if ( ( method == null ) && ! propName . equalsIgnoreCase ( formalizePropName ( propName ) ) ) { method = getPropSetMethod ( cls , formalizePropName ( propName ) ) ; } // set method mask to avoid query next time .
if ( method == null ) { method = METHOD_MASK ; } propSetMethodMap . put ( propName , method ) ; } } return ( method == METHOD_MASK ) ? null : method ; |
public class CaseEventSupport { /** * fire * CaseRoleAssignmentRemoved */
public void fireBeforeCaseRoleAssignmentRemoved ( String caseId , CaseFileInstance caseFile , String role , OrganizationalEntity entity ) { } } | final Iterator < CaseEventListener > iter = getEventListenersIterator ( ) ; if ( iter . hasNext ( ) ) { final CaseRoleAssignmentEvent event = new CaseRoleAssignmentEvent ( identityProvider . getName ( ) , caseId , caseFile , role , entity ) ; do { iter . next ( ) . beforeCaseRoleAssignmentRemoved ( event ) ; } while ( iter . hasNext ( ) ) ; } |
public class LoadBalancerSupportImpl { /** * Find all VIP
* @ param loadBalancerId optional filter
* @ return
* @ throws CloudException
* @ throws InternalException */
private List < JSONObject > findAllVips ( @ Nullable String loadBalancerId ) throws CloudException , InternalException { } } | NovaMethod method = new NovaMethod ( getProvider ( ) ) ; JSONObject result = method . getNetworks ( getListenersResource ( ) , null , false , "?tenant_id=" + getContext ( ) . getAccountNumber ( ) ) ; List < JSONObject > listeners = new ArrayList < JSONObject > ( ) ; if ( result != null && result . has ( "vips" ) ) { try { JSONArray list = result . getJSONArray ( "vips" ) ; for ( int i = 0 ; i < list . length ( ) ; i ++ ) { JSONObject vip = list . getJSONObject ( i ) ; if ( loadBalancerId == null || loadBalancerId . equalsIgnoreCase ( vip . getString ( "pool_id" ) ) ) { listeners . add ( vip ) ; } } } catch ( JSONException e ) { logger . error ( "Unable to understand listVips response: " + e . getMessage ( ) ) ; throw new CloudException ( e ) ; } } return listeners ; |
public class TargetStreamManager { /** * Handle an ControlAckExpected message . This will result in either a ControlAreYouFlushed
* or a ControlNack being sent back to the source .
* @ param cMsg
* @ throws SIException */
public void handleAckExpectedMessage ( ControlAckExpected cMsg ) throws SIResourceException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "handleAckExpectedMessage" , new Object [ ] { cMsg } ) ; int priority = cMsg . getPriority ( ) . intValue ( ) ; Reliability reliability = cMsg . getReliability ( ) ; SIBUuid12 streamID = cMsg . getGuaranteedStreamUUID ( ) ; StreamSet streamSet = getStreamSetForMessage ( cMsg ) ; if ( streamSet == null ) { // if this is a new streamID , send a flush query
handleNewStreamID ( cMsg ) ; } else { TargetStream targetStream = null ; synchronized ( streamSet ) { targetStream = ( TargetStream ) streamSet . getStream ( priority , reliability ) ; if ( targetStream == null ) { // if the specific stream does not exist , create it
targetStream = createStream ( streamSet , priority , reliability , streamSet . getPersistentData ( priority , reliability ) ) ; } } // Get the tickValue from the message
long tickValue = cMsg . getTick ( ) ; // Get the underlying statestream to process this
// it will call back to the UpstreamControl to send Nacks
targetStream . processAckExpected ( tickValue ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "handleAckExpectedMessage" ) ; |
public class SideEffectsAnalysis { /** * Determines whether it is safe to move code ( { @ code source } ) across
* an environment to another program point ( immediately preceding
* { @ code destination } ) .
* < p > The notion of " environment " is optimization - specific , but it should
* include any code that could be executed between the source program point
* and the destination program point .
* { @ code destination } must not be a descendant of { @ code source } .
* @ param source The node that would be moved
* @ param environment An environment representing the code across which
* the source will be moved .
* @ param destination The node before which the source would be moved
* @ return Whether it is safe to move the source to the destination */
public boolean safeToMoveBefore ( Node source , AbstractMotionEnvironment environment , Node destination ) { } } | checkNotNull ( locationAbstraction ) ; checkArgument ( ! nodeHasAncestor ( destination , source ) ) ; // It is always safe to move pure code .
if ( isPure ( source ) ) { return true ; } // Don ' t currently support interprocedural analysis
if ( nodeHasCall ( source ) ) { return false ; } LocationSummary sourceLocationSummary = locationAbstraction . calculateLocationSummary ( source ) ; EffectLocation sourceModSet = sourceLocationSummary . getModSet ( ) ; // If the source has side effects , then we require that the source
// is executed exactly as many times as the destination .
if ( ! sourceModSet . isEmpty ( ) && ! nodesHaveSameControlFlow ( source , destination ) ) { return false ; } EffectLocation sourceRefSet = sourceLocationSummary . getRefSet ( ) ; Set < Node > environmentNodes = environment . calculateEnvironment ( ) ; for ( Node environmentNode : environmentNodes ) { if ( nodeHasCall ( environmentNode ) ) { return false ; } } LocationSummary environmentLocationSummary = locationAbstraction . calculateLocationSummary ( environmentNodes ) ; EffectLocation environmentModSet = environmentLocationSummary . getModSet ( ) ; EffectLocation environmentRefSet = environmentLocationSummary . getRefSet ( ) ; // If MOD ( environment ) intersects REF ( source ) then moving the
// source across the environment could cause the source
// to read an incorrect value .
// If REF ( environment ) intersects MOD ( source ) then moving the
// source across the environment could cause the environment
// to read an incorrect value .
// If MOD ( environment ) intersects MOD ( source ) then moving the
// source across the environment could cause some later code that reads
// a modified location to get an incorrect value .
return ! environmentModSet . intersectsLocation ( sourceRefSet ) && ! environmentRefSet . intersectsLocation ( sourceModSet ) && ! environmentModSet . intersectsLocation ( sourceModSet ) ; |
public class ServiceCall { /** * Creates new { @ link ServiceCall } ' s definition with a given router .
* @ param router given .
* @ return new { @ link ServiceCall } instance . */
public ServiceCall router ( Router router ) { } } | ServiceCall target = new ServiceCall ( this ) ; target . router = router ; return target ; |
public class Util { /** * Checks whether the given resource is a Java source file .
* @ param resource
* The resource to check .
* @ return < code > true < / code > if the given resource is a Java source file ,
* < code > false < / code > otherwise . */
public static boolean isJavaArchive ( IResource resource ) { } } | if ( resource == null || ( resource . getType ( ) != IResource . FILE ) ) { return false ; } String name = resource . getName ( ) ; return Archive . isArchiveFileName ( name ) ; |
public class Order { /** * Specify the attribute to be used for sorting
* @ param attributeName
* @ return */
public OrderDirection BY ( String attributeName ) { } } | OrderBy ob = this . orderExpression . getCreateOrderCriteriaFor ( attributeName ) ; OrderDirection ret = new OrderDirection ( ob ) ; QueryRecorder . recordInvocation ( this , "BY" , ret , QueryRecorder . literal ( attributeName ) ) ; return ret ; |
public class CPAttachmentFileEntryPersistenceImpl { /** * Returns the cp attachment file entry with the primary key or throws a { @ link com . liferay . portal . kernel . exception . NoSuchModelException } if it could not be found .
* @ param primaryKey the primary key of the cp attachment file entry
* @ return the cp attachment file entry
* @ throws NoSuchCPAttachmentFileEntryException if a cp attachment file entry with the primary key could not be found */
@ Override public CPAttachmentFileEntry findByPrimaryKey ( Serializable primaryKey ) throws NoSuchCPAttachmentFileEntryException { } } | CPAttachmentFileEntry cpAttachmentFileEntry = fetchByPrimaryKey ( primaryKey ) ; if ( cpAttachmentFileEntry == null ) { if ( _log . isDebugEnabled ( ) ) { _log . debug ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } throw new NoSuchCPAttachmentFileEntryException ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } return cpAttachmentFileEntry ; |
public class Unchecked { /** * Wrap a { @ link CheckedCallable < T > } in a { @ link Callable < T > } with a custom handler for checked exceptions .
* Example :
* < code > < pre >
* Executors . newFixedThreadPool ( 1 ) . submit ( Unchecked . callable (
* throw new Exception ( " Cannot execute this task " ) ;
* throw new IllegalStateException ( e ) ;
* ) ) . get ( ) ;
* < / pre > < / code > */
public static < T > Callable < T > callable ( CheckedCallable < T > callable , Consumer < Throwable > handler ) { } } | return ( ) -> { try { return callable . call ( ) ; } catch ( Throwable e ) { handler . accept ( e ) ; throw new IllegalStateException ( "Exception handler must throw a RuntimeException" , e ) ; } } ; |
public class VirtualFlow { /** * Hits this virtual flow at the given coordinates .
* @ param x x offset from the left edge of the viewport
* @ param y y offset from the top edge of the viewport
* @ return hit info containing the cell that was hit and coordinates
* relative to the cell . If the hit was before the cells ( i . e . above a
* vertical flow content or left of a horizontal flow content ) , returns
* a < em > hit before cells < / em > containing offset from the top left corner
* of the content . If the hit was after the cells ( i . e . below a vertical
* flow content or right of a horizontal flow content ) , returns a
* < em > hit after cells < / em > containing offset from the top right corner of
* the content of a horizontal flow or bottom left corner of the content of
* a vertical flow . */
public VirtualFlowHit < C > hit ( double x , double y ) { } } | double bOff = orientation . getX ( x , y ) ; double lOff = orientation . getY ( x , y ) ; bOff += breadthOffset0 . getValue ( ) ; if ( items . isEmpty ( ) ) { return orientation . hitAfterCells ( bOff , lOff ) ; } layout ( ) ; int firstVisible = getFirstVisibleIndex ( ) ; firstVisible = navigator . fillBackwardFrom0 ( firstVisible , lOff ) ; C firstCell = cellPositioner . getVisibleCell ( firstVisible ) ; int lastVisible = getLastVisibleIndex ( ) ; lastVisible = navigator . fillForwardFrom0 ( lastVisible , lOff ) ; C lastCell = cellPositioner . getVisibleCell ( lastVisible ) ; if ( lOff < orientation . minY ( firstCell ) ) { return orientation . hitBeforeCells ( bOff , lOff - orientation . minY ( firstCell ) ) ; } else if ( lOff >= orientation . maxY ( lastCell ) ) { return orientation . hitAfterCells ( bOff , lOff - orientation . maxY ( lastCell ) ) ; } else { for ( int i = firstVisible ; i <= lastVisible ; ++ i ) { C cell = cellPositioner . getVisibleCell ( i ) ; if ( lOff < orientation . maxY ( cell ) ) { return orientation . cellHit ( i , cell , bOff , lOff - orientation . minY ( cell ) ) ; } } throw new AssertionError ( "unreachable code" ) ; } |
public class IdentityHashMap { /** * Saves the state of the < tt > IdentityHashMap < / tt > instance to a stream
* ( i . e . , serializes it ) .
* @ serialData The < i > size < / i > of the HashMap ( the number of key - value
* mappings ) ( < tt > int < / tt > ) , followed by the key ( Object ) and
* value ( Object ) for each key - value mapping represented by the
* IdentityHashMap . The key - value mappings are emitted in no
* particular order . */
private void writeObject ( java . io . ObjectOutputStream s ) throws java . io . IOException { } } | // Write out and any hidden stuff
s . defaultWriteObject ( ) ; // Write out size ( number of Mappings )
s . writeInt ( size ) ; // Write out keys and values ( alternating )
Object [ ] tab = table ; for ( int i = 0 ; i < tab . length ; i += 2 ) { Object key = tab [ i ] ; if ( key != null ) { s . writeObject ( unmaskNull ( key ) ) ; s . writeObject ( tab [ i + 1 ] ) ; } } |
public class MemberTasks { /** * We will always try to gather as many results as possible and never throw an exception .
* TODO : Make MemberResponse hold an exception that we can populate if something bad happens so we always
* get to return something for a member in order to indicate a failure . Getting the result when there
* is an error should throw an exception .
* @ param execSvc
* @ param members
* @ param callable
* @ param maxWaitTime - a value of 0 indicates forever
* @ param unit
* @ return */
public static < T > Collection < MemberResponse < T > > executeOptimistic ( IExecutorService execSvc , Set < Member > members , Callable < T > callable , long maxWaitTime , TimeUnit unit ) { } } | Collection < MemberResponse < T > > result = new ArrayList < MemberResponse < T > > ( members . size ( ) ) ; Map < Member , Future < T > > resultFutures = execSvc . submitToMembers ( callable , members ) ; for ( Entry < Member , Future < T > > futureEntry : resultFutures . entrySet ( ) ) { Future < T > future = futureEntry . getValue ( ) ; Member member = futureEntry . getKey ( ) ; try { if ( maxWaitTime > 0 ) { result . add ( new MemberResponse < T > ( member , future . get ( maxWaitTime , unit ) ) ) ; } else { result . add ( new MemberResponse < T > ( member , future . get ( ) ) ) ; } // ignore exceptions . . . return what you can
} catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; // restore interrupted status and return what we have
return result ; } catch ( MemberLeftException e ) { log . warn ( "Member {} left while trying to get a distributed callable result" , member ) ; } catch ( ExecutionException e ) { if ( e . getCause ( ) instanceof InterruptedException ) { // restore interrupted state and return
Thread . currentThread ( ) . interrupt ( ) ; return result ; } else { log . warn ( "Unable to execute callable on " + member + ". There was an error." , e ) ; } } catch ( TimeoutException e ) { log . error ( "Unable to execute task on " + member + " within 10 seconds." ) ; } catch ( RuntimeException e ) { log . error ( "Unable to execute task on " + member + ". An unexpected error occurred." , e ) ; } } return result ; |
import java . util . HashSet ; import java . util . Set ; public class IdenticalCharacters { /** * Verify if two strings have identical characters irrespective of their frequency or order .
* @ param str1 The first string
* @ param str2 The second string
* @ return True if both strings share the exact characters , False otherwise
* Examples :
* > > > identicalCharacters ( ' eabcdzzzz ' , ' dddzzzzzddeddabc ' )
* True
* > > > identicalCharacters ( ' abcd ' , ' dddddabc ' )
* True
* > > > identicalCharacters ( ' dddddabc ' , ' abcd ' )
* True
* > > > identicalCharacters ( ' eabcd ' , ' dddddabc ' )
* False
* > > > identicalCharacters ( ' abcd ' , ' dddddabce ' )
* False
* > > > identicalCharacters ( ' eabcdzzzz ' , ' dddzzzzzddddabc ' )
* False */
public static boolean identicalCharacters ( String str1 , String str2 ) { } } | Set < Character > set1 = new HashSet < > ( ) ; for ( char c : str1 . toCharArray ( ) ) { set1 . add ( c ) ; } Set < Character > set2 = new HashSet < > ( ) ; for ( char c : str2 . toCharArray ( ) ) { set2 . add ( c ) ; } return set1 . equals ( set2 ) ; |
public class QuickLauncher { /** * Configures and spawns a VM that hosts a cache server . The standard output
* and error are redirected to file prefixed with " start _ " . */
private int start ( final String [ ] args ) throws IOException , InterruptedException { } } | final ArrayList < String > commandLine = new ArrayList < > ( 16 ) ; final HashMap < String , String > env = new HashMap < > ( 2 ) ; final String snappyHome = System . getenv ( "SNAPPY_HOME" ) ; if ( snappyHome == null || snappyHome . isEmpty ( ) ) { throw new IllegalArgumentException ( "SNAPPY_HOME not set" ) ; } // add java path to command - line first
commandLine . add ( System . getProperty ( "java.home" ) + "/bin/java" ) ; commandLine . add ( "-server" ) ; try { // https : / / github . com / airlift / jvmkill is added to libgemfirexd . so
// adding agentpath helps kill jvm in case of OOM . kill - 9 is not
// used as it fails in certain cases
if ( Platform . isLinux ( ) ) { if ( Platform . is64Bit ( ) ) { String agentPath = snappyHome + "/jars/libgemfirexd64.so" ; System . load ( agentPath ) ; commandLine . add ( "-agentpath:" + agentPath ) ; } else { String agentPath = snappyHome + "/jars/libgemfirexd.so" ; System . load ( agentPath ) ; commandLine . add ( "-agentpath:" + agentPath ) ; } } else if ( Platform . isMac ( ) ) { if ( Platform . is64Bit ( ) ) { String agentPath = snappyHome + "/jars/libgemfirexd64.dylib" ; System . load ( agentPath ) ; commandLine . add ( "-agentpath:" + agentPath ) ; } else { String agentPath = snappyHome + "/jars/libgemfirexd.dylib" ; System . load ( agentPath ) ; commandLine . add ( "-agentpath:" + agentPath ) ; } } } catch ( UnsatisfiedLinkError | SecurityException e ) { System . out . println ( "WARNING: agent not loaded due to " + e + ". Service might not be killed on OutOfMemory. Build jvmkill.c on your platform " + "using build.sh script from source on your platform and replace the library " + "in product jars directory to enable the agent." ) ; } // get the startup options and command - line arguments ( JVM arguments etc )
HashMap < String , Object > options = getStartOptions ( args , snappyHome , commandLine , env ) ; // Complain if a cache server is already running in the specified working directory .
// See bug 32574.
String msg = verifyAndClearStatus ( ) ; if ( msg != null ) { System . err . println ( msg ) ; return 1 ; } // add the main class and method
commandLine . add ( this . launcherClass ) ; commandLine . add ( "server" ) ; // add default log - file option if not present
String logFile = ( String ) options . get ( LOG_FILE ) ; if ( logFile == null || logFile . isEmpty ( ) ) { // check for log4j settings
Properties confProps = ClientSharedUtils . getLog4jConfProperties ( snappyHome ) ; if ( confProps != null ) { // read directly avoiding log4j API usage
String rootCategory = confProps . getProperty ( "log4j.rootCategory" ) ; int commaIndex ; if ( rootCategory != null && ( commaIndex = rootCategory . indexOf ( ',' ) ) != - 1 ) { String categoryName = rootCategory . substring ( commaIndex + 1 ) . trim ( ) ; // check for file name property
logFile = confProps . getProperty ( "log4j.appender." + categoryName + ".file" ) ; if ( logFile == null || logFile . isEmpty ( ) ) { // perhaps it is the console appender
String appenderType = confProps . getProperty ( "log4j.appender." + categoryName ) ; if ( appenderType != null && appenderType . contains ( "ConsoleAppender" ) ) { logFile = this . startLogFileName ; } } } } } else { logFile = logFile . substring ( LOG_FILE . length ( ) + 2 ) ; } if ( logFile == null || logFile . isEmpty ( ) ) { logFile = this . defaultLogFileName ; } options . put ( LOG_FILE , "-" + LOG_FILE + '=' + logFile ) ; // add the command options
for ( Object option : options . values ( ) ) { commandLine . add ( ( String ) option ) ; } // finally launch the main process
final Path startLogFile = this . workingDir . resolve ( startLogFileName ) ; final Path pidFile = this . workingDir . resolve ( pidFileName ) ; Files . deleteIfExists ( startLogFile ) ; Files . deleteIfExists ( pidFile ) ; // add command - line to ENV2
StringBuilder fullCommandLine = new StringBuilder ( 1024 ) ; fullCommandLine . append ( ENV_MARKER ) . append ( '[' ) ; Iterator < String > cmds = commandLine . iterator ( ) ; while ( cmds . hasNext ( ) ) { String cmd = cmds . next ( ) ; if ( cmd . equals ( "-cp" ) ) { // skip classpath which is already output separately
cmds . next ( ) ; } else { if ( cmd . indexOf ( ' ' ) != - 1 ) { // quote the argument
fullCommandLine . append ( '"' ) . append ( cmd ) . append ( '"' ) ; } else { fullCommandLine . append ( cmd ) ; } fullCommandLine . append ( ' ' ) ; } } fullCommandLine . setCharAt ( fullCommandLine . length ( ) - 1 , ']' ) ; env . put ( ENV2 , fullCommandLine . toString ( ) ) ; ProcessBuilder process = new ProcessBuilder ( commandLine ) ; process . environment ( ) . putAll ( env ) ; process . directory ( this . workingDir . toFile ( ) ) ; process . redirectErrorStream ( true ) ; process . redirectOutput ( startLogFile . toFile ( ) ) ; process . start ( ) ; // change to absolute path for printing to screen
if ( ! Paths . get ( logFile ) . isAbsolute ( ) ) { logFile = this . workingDir . resolve ( logFile ) . toString ( ) ; } return waitForRunning ( logFile ) ; |
public class HiveMetaStoreBasedRegister { /** * Sets create time if not already set . */
private Table gettableWithCreateTime ( Table table , int createTime ) { } } | if ( table . isSetCreateTime ( ) && table . getCreateTime ( ) > 0 ) { return table ; } Table actualtable = table . deepCopy ( ) ; actualtable . setCreateTime ( createTime ) ; return actualtable ; |
public class ModuleContentTypes { /** * Fetch a specific snapshot of this content type .
* @ param contentType the contentType whose snapshot to be returned .
* @ param snapshotId the snapshot to be returned .
* @ return an array of snapshots .
* @ throws IllegalArgumentException if contentType is null .
* @ throws IllegalArgumentException if contentType ' s id is null .
* @ throws IllegalArgumentException if contentType ' s space id is null .
* @ throws IllegalArgumentException if snapshotId is null . */
public CMASnapshot fetchOneSnapshot ( CMAContentType contentType , String snapshotId ) { } } | assertNotNull ( contentType , "contentType" ) ; assertNotNull ( snapshotId , "snapshotId" ) ; final String contentTypeId = getResourceIdOrThrow ( contentType , "contentType" ) ; final String spaceId = getSpaceIdOrThrow ( contentType , "contentType" ) ; final String environmentId = contentType . getEnvironmentId ( ) ; return service . fetchOneSnapshot ( spaceId , environmentId , contentTypeId , snapshotId ) . blockingFirst ( ) ; |
public class DMatrixUtils { /** * Creates a matrix from the provided range for columns with the given number of rows .
* @ param lower The lower bound ( inclusive ) for the range .
* @ param upper The upper bound ( exclusive ) for the range .
* @ param rows The number of rows .
* @ return A new matrix . */
public static double [ ] [ ] matrixFromRange ( double [ ] lower , double [ ] upper , int rows ) { } } | // Get the number of columns :
final int cols = lower . length ; // Initialize the return value :
final double [ ] [ ] matrix = new double [ rows ] [ cols ] ; // Iterate over columns and fill the array :
for ( int col = 0 ; col < cols ; col ++ ) { // Get the sequence :
final double [ ] sequence = DMatrixUtils . sequence ( lower [ col ] , upper [ col ] , rows ) ; // Assign to each row in the column :
for ( int row = 0 ; row < sequence . length ; row ++ ) { matrix [ row ] [ col ] = sequence [ row ] ; } } // Done , return the populated matrix :
return matrix ; |
public class XmlStringBuilder { /** * Add a new element to this builder .
* @ param name
* @ param content
* @ return the XmlStringBuilder */
public XmlStringBuilder element ( String name , CharSequence content ) { } } | return element ( name , content . toString ( ) ) ; |
public class InterceptorMetaDataFactory { /** * d463727 entire method added . */
private void validateEJBCallbackMethod ( InterceptorMethodKind actualKind , Method m , boolean annotation ) throws EJBConfigurationException { } } | // Get the name of the method .
String methodName = m . getName ( ) ; // Map the method name into one of the InterceptorMethodKind enum value
// it is required to be by the EJB 3 specification .
InterceptorMethodKind requiredKind = mapEjbCallbackName ( methodName ) ; // If the method is required to be a interceptor lifecycle callback method ,
// does the actual kind match the required kind ?
if ( requiredKind != null && actualKind != requiredKind ) { // It is one of the ejbXXXXX methods of the javax . ejb . SessionBean or
// javax . ejb . MessageDriven interfaces , but either annotation or xml was used
// to indicate it is the wrong kind of lifecycle callback event .
// Get the class name of the EJB and map both the required InterceptorMethodKind
// and actual InterceptorMethodKind into a String for the error message .
String ejbClassName = ivEjbClass . getName ( ) ; String required = mapInterceptorMethodKind ( requiredKind , true , annotation ) ; String actual = mapInterceptorMethodKind ( actualKind , false , annotation ) ; // Now build and log the error message based on type of EJB .
StringBuilder sb = new StringBuilder ( ) ; if ( ivMDB ) { // CNTR0243E : Because the { 0 } enterprise bean implements the javax . ejb . MessageDriven interface ,
// the { 1 } method must be a { 2 } method and not a { 3 } method .
sb . append ( "CNTR0243E: Because the " ) . append ( ejbClassName ) ; sb . append ( " enterprise bean implements the javax.ejb.MessageDriven interface, the " ) ; sb . append ( methodName ) . append ( " method must be a " ) . append ( required ) ; sb . append ( " method and not a " ) . append ( actual ) . append ( " method." ) ; Tr . error ( tc , "INVALID_MDB_CALLBACK_METHOD_CNTR0243E" , new Object [ ] { ejbClassName , methodName , required , actual } ) ; } else if ( ivSLSB ) { // CNTR0241E : Because the { 0 } enterprise bean implements the javax . ejb . SessionBean interface ,
// the { 1 } method must be a { 2 } method and not a { 3 } method .
sb . append ( "CNTR0241E: Because the " ) . append ( ejbClassName ) ; sb . append ( " enterprise bean implements the javax.ejb.SessionBean interface, the " ) ; sb . append ( methodName ) . append ( " method must be a " ) . append ( required ) ; sb . append ( " method and not a " ) . append ( actual ) . append ( " method." ) ; Tr . error ( tc , "INVALID_SLSB_CALLBACK_METHOD_CNTR0241E" , new Object [ ] { ejbClassName , methodName , required , actual } ) ; } else if ( ivSFSB ) { // CNTR0242E : Because the { 0 } enterprise bean implements the javax . ejb . SessionBean interface ,
// the { 1 } method must be a { 2 } method and not a { 3 } method .
sb . append ( "CNTR0242E: Because the " ) . append ( ejbClassName ) ; sb . append ( " enterprise bean implements the javax.ejb.SessionBean interface, the " ) ; sb . append ( methodName ) . append ( " method must be a " ) . append ( required ) ; sb . append ( " method and not a " ) . append ( actual ) . append ( " method." ) ; Tr . error ( tc , "INVALID_SFSB_CALLBACK_METHOD_CNTR0242E" , new Object [ ] { ejbClassName , methodName , required , actual } ) ; } // Throw the EJBConfigurationException with message text that was built for the error .
throw new EJBConfigurationException ( sb . toString ( ) ) ; } |
public class Document { /** * setter for events - sets
* @ generated
* @ param v value to set into the feature */
public void setEvents ( FSArray v ) { } } | if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_events == null ) jcasType . jcas . throwFeatMissing ( "events" , "de.julielab.jules.types.ace.Document" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_events , jcasType . ll_cas . ll_getFSRef ( v ) ) ; |
public class UniformUtils { /** * Makes sure that a property name is not empty an is lower - case . Throws an { @ code IllegalArgumentException } if the key is null or empty after trimming .
* @ param key Original key
* @ return Trimmed and lower - case key */
public static String checkPropertyNameAndLowerCase ( String key ) { } } | if ( key == null ) { throw new IllegalArgumentException ( "key cannot be null" ) ; } key = key . trim ( ) . toLowerCase ( ) ; if ( key . isEmpty ( ) ) { throw new IllegalArgumentException ( "key cannot be empty" ) ; } return key ; |
public class Transaction { /** * Loops the outputs of a coinbase transaction to locate the witness commitment . */
public Sha256Hash findWitnessCommitment ( ) { } } | checkState ( isCoinBase ( ) ) ; for ( TransactionOutput out : Lists . reverse ( outputs ) ) { Script scriptPubKey = out . getScriptPubKey ( ) ; if ( ScriptPattern . isWitnessCommitment ( scriptPubKey ) ) return ScriptPattern . extractWitnessCommitmentHash ( scriptPubKey ) ; } return null ; |
public class VorbisFile { /** * - 1 if the stream is not seekable ( we can ' t know the length ) */
public long raw_total ( int i ) { } } | if ( ! seekable || i >= links ) return ( - 1 ) ; if ( i < 0 ) { long acc = 0 ; // bug ?
for ( int j = 0 ; j < links ; j ++ ) { acc += raw_total ( j ) ; } return ( acc ) ; } else { return ( offsets [ i + 1 ] - offsets [ i ] ) ; } |
public class JK { /** * Throww .
* @ param e the e
* @ param msg the msg */
public static void throww ( Throwable e , String msg ) { } } | if ( e instanceof RuntimeException ) { throw ( RuntimeException ) e ; } throw new JKException ( msg , e ) ; |
public class BufferedWriteFilter { /** * { @ inheritDoc }
* @ throws Exception if < code > writeRequest . message < / code > isn ' t an
* { @ link IoBuffer } instance . */
@ Override public void filterWrite ( NextFilter nextFilter , IoSession session , WriteRequest writeRequest ) throws Exception { } } | Object data = writeRequest . getMessage ( ) ; if ( data instanceof IoBuffer ) { write ( session , ( IoBuffer ) data ) ; } else { throw new IllegalArgumentException ( "This filter should only buffer IoBuffer objects" ) ; } |
public class TOperationHandle { /** * Returns true if field corresponding to fieldID is set ( has been assigned a value ) and false otherwise */
public boolean isSet ( _Fields field ) { } } | if ( field == null ) { throw new IllegalArgumentException ( ) ; } switch ( field ) { case OPERATION_ID : return isSetOperationId ( ) ; case OPERATION_TYPE : return isSetOperationType ( ) ; case HAS_RESULT_SET : return isSetHasResultSet ( ) ; case MODIFIED_ROW_COUNT : return isSetModifiedRowCount ( ) ; } throw new IllegalStateException ( ) ; |
public class MapLayer { /** * Fire the event that indicates this object has changed .
* Only the { @ link GISEditableChangeListener } are notified . */
public void fireElementChanged ( ) { } } | if ( this . listeners != null && isEventFirable ( ) ) { final GISEditableChangeListener [ ] theListeners = this . listeners . getListeners ( GISEditableChangeListener . class ) ; for ( final GISEditableChangeListener listener : theListeners ) { listener . editableGISElementHasChanged ( this ) ; } } |
public class Configuration { /** * Gets the fully qualified name of the current WAS server
* @ return String The fully qualified name of the WAS server */
public static final String fqServerName ( ) { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "fqServerName" ) ; String fqServerName = _serverName ; // RLSUtils . FQHAMCompatibleServerName ( _ cellName , _ nodeName , _ serverName ) ; tWAS
if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "fqServerName" , fqServerName ) ; return fqServerName ; |
public class DefaultProxyTimerService { /** * / * ( non - Javadoc )
* @ see org . mobicents . servlet . sip . core . timers . ProxyTimerService # cancel ( org . mobicents . servlet . sip . proxy . ProxyBranchTimerTask ) */
public void cancel ( TimerTask task ) { } } | // CANCEL needs to remove the shceduled timer see http : / / bugs . sun . com / bugdatabase / view _ bug . do ? bug _ id = 6602600
// to improve perf
ScheduledFuture < ? > future = null ; Object [ ] array = super . getQueue ( ) . toArray ( ) ; for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] instanceof ScheduledFuture < ? > ) { future = ( ScheduledFuture < ? > ) array [ i ] ; try { Field callableField = future . getClass ( ) . getDeclaredField ( "callable" ) ; callableField . setAccessible ( true ) ; Object callable = callableField . get ( future ) ; callableField . setAccessible ( false ) ; if ( callable != null ) { Field taskField = callable . getClass ( ) . getDeclaredField ( "task" ) ; taskField . setAccessible ( true ) ; TimerTask scheduledTask = null ; if ( taskField . get ( callable ) instanceof TimerTask ) { scheduledTask = ( TimerTask ) taskField . get ( callable ) ; } taskField . setAccessible ( false ) ; if ( scheduledTask != null && scheduledTask . equals ( task ) ) { break ; } } } catch ( Exception e ) { logger . warn ( "Couldn't clean the timer from the JVM GC " , e ) ; } } } if ( future != null ) { boolean removed = super . remove ( ( Runnable ) future ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "expiration timer on sip proxy task" + task + " removed : " + removed ) ; } boolean cancelled = future . cancel ( true ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "expiration timer on sip proxy task" + task + " Cancelled : " + cancelled ) ; } future = null ; // Purge is expensive when called frequently , only call it every now and then .
// We do not sync the numCancelled variable . We dont care about correctness of
// the number , and we will still call purge rought once on every 25 cancels .
numCancelled ++ ; if ( numCancelled % 100 == 0 ) { super . purge ( ) ; } } else { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "expiration timer future is null, thus cannot be Cancelled" ) ; } } |
public class DecisionTaskMapper { /** * This method gets the list of tasks that need to scheduled when the the task to scheduled is of type { @ link TaskType # DECISION } .
* @ param taskMapperContext : A wrapper class containing the { @ link WorkflowTask } , { @ link WorkflowDef } , { @ link Workflow } and a string representation of the TaskId
* @ return List of tasks in the following order :
* < ul >
* < li >
* { @ link SystemTaskType # DECISION } with { @ link Task . Status # IN _ PROGRESS }
* < / li >
* < li >
* List of task based on the evaluation of { @ link WorkflowTask # getCaseExpression ( ) } are scheduled .
* < / li >
* < li >
* In case of no matching result after the evaluation of the { @ link WorkflowTask # getCaseExpression ( ) } , the { @ link WorkflowTask # getDefaultCase ( ) }
* Tasks are scheduled .
* < / li >
* < / ul > */
@ Override public List < Task > getMappedTasks ( TaskMapperContext taskMapperContext ) { } } | logger . debug ( "TaskMapperContext {} in DecisionTaskMapper" , taskMapperContext ) ; List < Task > tasksToBeScheduled = new LinkedList < > ( ) ; WorkflowTask taskToSchedule = taskMapperContext . getTaskToSchedule ( ) ; Workflow workflowInstance = taskMapperContext . getWorkflowInstance ( ) ; Map < String , Object > taskInput = taskMapperContext . getTaskInput ( ) ; int retryCount = taskMapperContext . getRetryCount ( ) ; String taskId = taskMapperContext . getTaskId ( ) ; // get the expression to be evaluated
String caseValue = getEvaluatedCaseValue ( taskToSchedule , taskInput ) ; // QQ why is the case value and the caseValue passed and caseOutput passes as the same ? ?
Task decisionTask = new Task ( ) ; decisionTask . setTaskType ( SystemTaskType . DECISION . name ( ) ) ; decisionTask . setTaskDefName ( SystemTaskType . DECISION . name ( ) ) ; decisionTask . setReferenceTaskName ( taskToSchedule . getTaskReferenceName ( ) ) ; decisionTask . setWorkflowInstanceId ( workflowInstance . getWorkflowId ( ) ) ; decisionTask . setWorkflowType ( workflowInstance . getWorkflowName ( ) ) ; decisionTask . setCorrelationId ( workflowInstance . getCorrelationId ( ) ) ; decisionTask . setScheduledTime ( System . currentTimeMillis ( ) ) ; decisionTask . getInputData ( ) . put ( "case" , caseValue ) ; decisionTask . getOutputData ( ) . put ( "caseOutput" , Collections . singletonList ( caseValue ) ) ; decisionTask . setTaskId ( taskId ) ; decisionTask . setStatus ( Task . Status . IN_PROGRESS ) ; decisionTask . setWorkflowTask ( taskToSchedule ) ; tasksToBeScheduled . add ( decisionTask ) ; // get the list of tasks based on the decision
List < WorkflowTask > selectedTasks = taskToSchedule . getDecisionCases ( ) . get ( caseValue ) ; // if the tasks returned are empty based on evaluated case value , then get the default case if there is one
if ( selectedTasks == null || selectedTasks . isEmpty ( ) ) { selectedTasks = taskToSchedule . getDefaultCase ( ) ; } // once there are selected tasks that need to proceeded as part of the decision , get the next task to be
// scheduled by using the decider service
if ( selectedTasks != null && ! selectedTasks . isEmpty ( ) ) { WorkflowTask selectedTask = selectedTasks . get ( 0 ) ; // Schedule the first task to be executed . . .
// TODO break out this recursive call using function composition of what needs to be done and then walk back the condition tree
List < Task > caseTasks = taskMapperContext . getDeciderService ( ) . getTasksToBeScheduled ( workflowInstance , selectedTask , retryCount , taskMapperContext . getRetryTaskId ( ) ) ; tasksToBeScheduled . addAll ( caseTasks ) ; decisionTask . getInputData ( ) . put ( "hasChildren" , "true" ) ; } return tasksToBeScheduled ; |
public class ProcessAdapter { /** * Restarts this { @ link Process } by first attempting to stop this { @ link Process } if running
* and then running this { @ link Process } by executing this { @ link Process Process ' s }
* { @ link # getCommandLine ( ) command - line } in the given { @ link # getDirectory ( ) directory } .
* @ return a reference to this newly started and running { @ link ProcessAdapter } .
* @ throws IllegalStateException if this { @ link Process } cannot be stopped and restarted .
* @ see # execute ( ProcessAdapter , ProcessContext )
* @ see # isNotRunning ( )
* @ see # isRunning ( )
* @ see # stopAndWait ( ) */
public synchronized ProcessAdapter restart ( ) { } } | if ( isRunning ( ) ) { stopAndWait ( ) ; } Assert . state ( isNotRunning ( ) , "Process [%d] failed to stop" , safeGetId ( ) ) ; return execute ( this , getProcessContext ( ) ) ; |
public class DoubleBinaryOperatorBuilder { /** * 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 DoubleBinaryOperator dblBinaryOperatorFrom ( Consumer < DoubleBinaryOperatorBuilder > buildingFunction ) { } } | DoubleBinaryOperatorBuilder builder = new DoubleBinaryOperatorBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class ChargingStationEventListener { /** * Updates the location of the charging station .
* @ param event The event which contains the data of the location .
* @ return { @ code true } if the update has been performed , { @ code false } if the charging station can ' t be found . */
private boolean updateChargingStationLocation ( ChargingStationLocationChangedEvent event ) { } } | ChargingStation chargingStation = repository . findOne ( event . getChargingStationId ( ) . getId ( ) ) ; if ( chargingStation != null ) { if ( event . getCoordinates ( ) != null ) { chargingStation . setLatitude ( event . getCoordinates ( ) . getLatitude ( ) ) ; chargingStation . setLongitude ( event . getCoordinates ( ) . getLongitude ( ) ) ; } if ( event . getAddress ( ) != null ) { chargingStation . setAddressLine1 ( event . getAddress ( ) . getAddressLine1 ( ) ) ; chargingStation . setAddressLine2 ( event . getAddress ( ) . getAddressLine2 ( ) ) ; chargingStation . setPostalCode ( event . getAddress ( ) . getPostalCode ( ) ) ; chargingStation . setCity ( event . getAddress ( ) . getCity ( ) ) ; chargingStation . setRegion ( event . getAddress ( ) . getRegion ( ) ) ; chargingStation . setCountry ( event . getAddress ( ) . getCountry ( ) ) ; } chargingStation . setAccessibility ( event . getAccessibility ( ) ) ; repository . createOrUpdate ( chargingStation ) ; } else { LOG . error ( "operator api repo COULD NOT FIND CHARGEPOINT {} and update its location" , event . getChargingStationId ( ) ) ; } return chargingStation != null ; |
public class StringUtils { /** * Returns the index of the first appearance of the given range of the
* target in the given range of the source , source , starting at the
* given index , using the given comparator for characters . Returns - 1 if
* the target string is not found .
* @ param source The source string
* @ param sourceOffset The source offset
* @ param sourceCount The source length
* @ param target The target string
* @ param targetOffset The target offset
* @ param targetCount The target length
* @ param startIndex The start index
* @ param comparator The comparator
* @ return The index */
private static int indexOf ( String source , int sourceOffset , int sourceCount , String target , int targetOffset , int targetCount , int startIndex , IntBinaryOperator comparator ) { } } | int fromIndex = startIndex ; // Adapted from String # indexOf
if ( fromIndex >= sourceCount ) { return ( targetCount == 0 ? sourceCount : - 1 ) ; } if ( fromIndex < 0 ) { fromIndex = 0 ; } if ( targetCount == 0 ) { return fromIndex ; } char first = target . charAt ( targetOffset ) ; int max = sourceOffset + ( sourceCount - targetCount ) ; for ( int i = sourceOffset + fromIndex ; i <= max ; i ++ ) { if ( comparator . applyAsInt ( source . charAt ( i ) , first ) != 0 ) { while ( ++ i <= max && comparator . applyAsInt ( source . charAt ( i ) , first ) != 0 ) { // Empty
} } if ( i <= max ) { int j = i + 1 ; int end = j + targetCount - 1 ; for ( int k = targetOffset + 1 ; j < end && comparator . applyAsInt ( source . charAt ( j ) , target . charAt ( k ) ) == 0 ; j ++ , k ++ ) { // Empty
} if ( j == end ) { return i - sourceOffset ; } } } return - 1 ; |
public class AbstractUuidValueObject { /** * Verifies that a given string is a valid UUID .
* @ param value
* Value to check . A < code > null < / code > value returns < code > true < / code > .
* @ return TRUE if it ' s a valid key , else FALSE . */
public static boolean isValid ( final String value ) { } } | if ( value == null ) { return true ; } final String uuidPattern = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-" + "[0-9a-f]{4}-[0-9a-f]{12}$" ; return Pattern . matches ( uuidPattern , value ) ; |
public class Http2ClientInitializer { /** * Configure the pipeline for a cleartext useing Prior - Knowledge method to start http2. */
private void configureClearTextWithPriorKnowledge ( SocketChannel ch ) { } } | ch . pipeline ( ) . addLast ( connectionHandler , new PrefaceFrameWrittenEventHandler ( ) , new UserEventLogger ( ) ) ; configureEndOfPipeline ( ch . pipeline ( ) ) ; |
public class QualityWidgetScore { /** * Calculate Violations score based on Blocker , Critical & Major violations
* @ param qualityViolationsSettings Violations Param Settings
* @ param codeQualityIterable Quality values
* @ param categoryScores List of category scores */
private void processQualityViolationsScore ( QualityScoreSettings . ViolationsScoreSettings qualityViolationsSettings , Iterable < CodeQuality > codeQualityIterable , List < ScoreWeight > categoryScores ) { } } | ScoreWeight qualityViolationsScore = getCategoryScoreByIdName ( categoryScores , WIDGET_QUALITY_VIOLATIONS_ID_NAME ) ; Double qualityBlockerRatio = fetchQualityValue ( codeQualityIterable , QUALITY_PARAM_BLOCKER_VIOLATIONS ) ; Double qualityCriticalRatio = fetchQualityValue ( codeQualityIterable , QUALITY_PARAM_CRITICAL_VIOLATIONS ) ; Double qualityMajorRatio = fetchQualityValue ( codeQualityIterable , QUALITY_PARAM_MAJOR_VIOLATIONS ) ; if ( null == qualityBlockerRatio && null == qualityCriticalRatio && null == qualityMajorRatio ) { qualityViolationsScore . setScore ( qualityViolationsSettings . getCriteria ( ) . getNoDataFound ( ) ) ; qualityViolationsScore . setMessage ( Constants . SCORE_ERROR_NO_DATA_FOUND ) ; qualityViolationsScore . setState ( ScoreWeight . ProcessingState . criteria_failed ) ; } else { try { // Violation score is calculated based on weight for each type
// Blocker
// Critical
// Major
Double violationScore = Double . valueOf ( Constants . MAX_SCORE ) - ( getViolationScore ( qualityBlockerRatio , qualityViolationsSettings . getBlockerViolationsWeight ( ) ) + getViolationScore ( qualityCriticalRatio , qualityViolationsSettings . getCriticalViolationsWeight ( ) ) + getViolationScore ( qualityMajorRatio , qualityViolationsSettings . getMajorViolationWeight ( ) ) ) ; if ( ! qualityViolationsSettings . isAllowNegative ( ) && violationScore . compareTo ( Constants . ZERO_SCORE ) < 0 ) { violationScore = Constants . ZERO_SCORE ; } // Check thresholds at widget level
checkPercentThresholds ( qualityViolationsSettings , violationScore ) ; qualityViolationsScore . setScore ( new ScoreTypeValue ( violationScore ) ) ; qualityViolationsScore . setState ( ScoreWeight . ProcessingState . complete ) ; } catch ( ThresholdException ex ) { setThresholdFailureWeight ( ex , qualityViolationsScore ) ; } } |
public class BaseProfile { /** * generate outbound code
* @ param def Definition */
void generateOutboundCode ( Definition def ) { } } | if ( def . isSupportOutbound ( ) ) { if ( def . getMcfDefs ( ) == null ) throw new IllegalStateException ( "Should define at least one mcf class" ) ; for ( int num = 0 ; num < def . getMcfDefs ( ) . size ( ) ; num ++ ) { generateMultiMcfClassCode ( def , "Mcf" , num ) ; generateMultiMcfClassCode ( def , "Mc" , num ) ; generateMultiMcfClassCode ( def , "McMeta" , num ) ; if ( ! def . getMcfDefs ( ) . get ( num ) . isUseCciConnection ( ) ) { generateMultiMcfClassCode ( def , "CfInterface" , num ) ; generateMultiMcfClassCode ( def , "Cf" , num ) ; generateMultiMcfClassCode ( def , "ConnInterface" , num ) ; generateMultiMcfClassCode ( def , "ConnImpl" , num ) ; } else { generateMultiMcfClassCode ( def , "CciConn" , num ) ; generateMultiMcfClassCode ( def , "CciConnFactory" , num ) ; generateMultiMcfClassCode ( def , "ConnMeta" , num ) ; generateMultiMcfClassCode ( def , "ConnSpec" , num ) ; } } } |
public class DomConfigurationFactory { /** * Parse an email tag .
* @ param el tag element
* @ return Configuration EMAIL . */
private Email parseEmail ( Node el ) { } } | return new Email ( nodeAttribute ( el , TAG_VAR_ATTR_NAME , Email . DEFAULT_NAME ) , nodeAttribute ( el , TAG_ATTR_GHOST , PatternElement . DEFAULT_GHOST_VALUE ) ) ; |
public class IPMolecularLearningDescriptor { /** * put in increasing order the ArrayList
* @ param array The ArrayList to order
* @ return The DoubleArrayResult ordered */
private DoubleArrayResult arrangingEnergy ( ArrayList < Double > array ) { } } | DoubleArrayResult results = new DoubleArrayResult ( ) ; int count = array . size ( ) ; for ( int i = 0 ; i < count ; i ++ ) { double min = array . get ( 0 ) ; int pos = 0 ; for ( int j = 0 ; j < array . size ( ) ; j ++ ) { double value = array . get ( j ) ; if ( value < min ) { min = value ; pos = j ; } } array . remove ( pos ) ; results . add ( min ) ; } return results ; |
public class PolygonImageEvaluator { /** * Render the polygons as an image and then do a pixel - by - pixel comparison
* against the target image . The fitness score is the total error . A lower
* score means a closer match .
* @ param candidate The image to evaluate .
* @ param population Not used .
* @ return A number indicating how close the candidate image is to the target image
* ( lower is better ) . */
public double getFitness ( List < ColouredPolygon > candidate , List < ? extends List < ColouredPolygon > > population ) { } } | // Use one renderer per thread because they are not thread safe .
Renderer < List < ColouredPolygon > , BufferedImage > renderer = threadLocalRenderer . get ( ) ; if ( renderer == null ) { renderer = new PolygonImageRenderer ( new Dimension ( width , height ) , false , transform ) ; threadLocalRenderer . set ( renderer ) ; } BufferedImage candidateImage = renderer . render ( candidate ) ; Raster candidateImageData = candidateImage . getData ( ) ; int [ ] candidatePixelValues = new int [ targetPixels . length ] ; candidatePixelValues = ( int [ ] ) candidateImageData . getDataElements ( 0 , 0 , candidateImageData . getWidth ( ) , candidateImageData . getHeight ( ) , candidatePixelValues ) ; double fitness = 0 ; for ( int i = 0 ; i < targetPixels . length ; i ++ ) { fitness += comparePixels ( targetPixels [ i ] , candidatePixelValues [ i ] ) ; } return fitness ; |
public class OperationsInner { /** * Lists operations for the resource provider .
* Lists all the supported operations by the Microsoft . DevSpaces resource provider along with their description .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; ResourceProviderOperationDefinitionInner & gt ; object */
public Observable < Page < ResourceProviderOperationDefinitionInner > > listNextAsync ( final String nextPageLink ) { } } | return listNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < ResourceProviderOperationDefinitionInner > > , Page < ResourceProviderOperationDefinitionInner > > ( ) { @ Override public Page < ResourceProviderOperationDefinitionInner > call ( ServiceResponse < Page < ResourceProviderOperationDefinitionInner > > response ) { return response . body ( ) ; } } ) ; |
public class RollupConfig { /** * Fetches the RollupInterval corresponding to the integer interval in seconds .
* It returns a list of matching RollupInterval and best next matches in the
* order . It will help to search on the next best rollup tables .
* It is guaranteed that it return a non - empty list
* For example if the interval is 1 day
* then it may return RollupInterval objects in the order
* 1 day , 1 hour , 10 minutes , 1 minute
* @ param interval The interval in seconds to lookup
* @ param str _ interval String representation of the interval , for logging
* @ return The RollupInterval object configured for the given interval
* @ throws IllegalArgumentException if the interval is null or empty
* @ throws NoSuchRollupForIntervalException if the interval was not configured */
public List < RollupInterval > getRollupInterval ( final long interval , final String str_interval ) { } } | if ( interval <= 0 ) { throw new IllegalArgumentException ( "Interval cannot be null or empty" ) ; } final Map < Long , RollupInterval > rollups = new TreeMap < Long , RollupInterval > ( Collections . reverseOrder ( ) ) ; boolean right_match = false ; for ( RollupInterval rollup : forward_intervals . values ( ) ) { if ( rollup . getIntervalSeconds ( ) == interval ) { rollups . put ( ( long ) rollup . getIntervalSeconds ( ) , rollup ) ; right_match = true ; } else if ( interval % rollup . getIntervalSeconds ( ) == 0 ) { rollups . put ( ( long ) rollup . getIntervalSeconds ( ) , rollup ) ; } } if ( rollups . isEmpty ( ) ) { throw new NoSuchRollupForIntervalException ( Long . toString ( interval ) ) ; } List < RollupInterval > best_matches = new ArrayList < RollupInterval > ( rollups . values ( ) ) ; if ( ! right_match ) { LOG . warn ( "No such rollup interval found, " + str_interval + ". So falling " + "back to the next best match " + best_matches . get ( 0 ) . getInterval ( ) ) ; } return best_matches ; |
public class N1qlParams { /** * Sets the { @ link DocumentFragment } s resulting of a mutation this query should be consistent with .
* @ param fragments the fragments returned from a mutation .
* @ return this { @ link N1qlParams } for chaining . */
@ InterfaceStability . Committed public N1qlParams consistentWith ( DocumentFragment ... fragments ) { } } | return consistentWith ( MutationState . from ( fragments ) ) ; |
public class MapDotApi { /** * Walks by map ' s nodes and extracts optional value of type T .
* @ param < T > value type
* @ param clazz type of value
* @ param map subject
* @ param pathString nodes to walk in map
* @ return value of type T */
public static < T > T dotGetNullable ( final Map map , final Class < T > clazz , final String pathString ) { } } | if ( pathString == null || pathString . isEmpty ( ) ) { throw new IllegalArgumentException ( PATH_MUST_BE_SPECIFIED ) ; } if ( ! pathString . contains ( SEPARATOR ) ) { return ( T ) map . get ( pathString ) ; } final Object [ ] path = pathString . split ( SEPARATOR_REGEX ) ; return MapApi . getUnsafe ( map , clazz , path ) ; |
public class PrimMSTFinder { public void computeMST ( double [ ] [ ] costs , UndirectedGraph graph ) throws ContradictionException { } } | g = graph ; for ( int i = 0 ; i < n ; i ++ ) { Tree . getNeighOf ( i ) . clear ( ) ; } this . costs = costs ; heap . clear ( ) ; inTree . clear ( ) ; treeCost = 0 ; tSize = 0 ; prim ( ) ; |
public class MoneyUtil { /** * δΊΊζ°εΈιι’εδ½θ½¬ζ’ , ε
转ζ’ζε , δΎε¦ : 1 = > 100 */
public static BigDecimal yuan2fen ( String y ) { } } | return new BigDecimal ( Math . round ( new BigDecimal ( y ) . multiply ( new BigDecimal ( 100 ) ) . doubleValue ( ) ) ) ; |
public class DataSetUtils { /** * Range - partitions a DataSet on the specified tuple field positions . */
public static < T > PartitionOperator < T > partitionByRange ( DataSet < T > input , DataDistribution distribution , int ... fields ) { } } | return new PartitionOperator < > ( input , PartitionOperatorBase . PartitionMethod . RANGE , new Keys . ExpressionKeys < > ( fields , input . getType ( ) , false ) , distribution , Utils . getCallLocationName ( ) ) ; |
public class MapReference { /** * Decodes a document in to entities
* @ param datastore the datastore
* @ param mapper the mapper
* @ param mappedField the MappedField
* @ param dbObject the DBObject to decode
* @ return the entities */
public static MapReference decode ( final Datastore datastore , final Mapper mapper , final MappedField mappedField , final DBObject dbObject ) { } } | final Class subType = mappedField . getTypeParameters ( ) . get ( 0 ) . getSubClass ( ) ; final Map < String , Object > ids = ( Map < String , Object > ) mappedField . getDbObjectValue ( dbObject ) ; MapReference reference = null ; if ( ids != null ) { reference = new MapReference ( datastore , mapper . getMappedClass ( subType ) , ids ) ; } return reference ; |
public class Semver { /** * Returns the greatest difference between 2 versions .
* For example , if the current version is " 1.2.3 " and compared version is " 1.3.0 " , the biggest difference
* is the ' MINOR ' number .
* @ param version the version to compare
* @ return the greatest difference */
public VersionDiff diff ( Semver version ) { } } | if ( ! Objects . equals ( this . major , version . getMajor ( ) ) ) return VersionDiff . MAJOR ; if ( ! Objects . equals ( this . minor , version . getMinor ( ) ) ) return VersionDiff . MINOR ; if ( ! Objects . equals ( this . patch , version . getPatch ( ) ) ) return VersionDiff . PATCH ; if ( ! areSameSuffixes ( version . getSuffixTokens ( ) ) ) return VersionDiff . SUFFIX ; if ( ! Objects . equals ( this . build , version . getBuild ( ) ) ) return VersionDiff . BUILD ; return VersionDiff . NONE ; |
public class CommonMatchers { /** * = = > COMMON = = > */
public static Matcher < JsonElement > isOfType ( final String type ) { } } | return new TypeSafeDiagnosingMatcher < JsonElement > ( ) { @ Override protected boolean matchesSafely ( JsonElement item , Description mismatchDescription ) { if ( type . equals ( item . getJsonType ( ) ) ) return true ; else { mismatchDescription . appendText ( ", mismatch type '" + item . getJsonType ( ) + "'" ) ; return false ; } } @ Override public void describeTo ( Description description ) { description . appendText ( "\nMatch to type: " + type ) ; } } ; |
public class AFPTwister { /** * Set the list of equivalent residues in the two proteins given a list of
* AFPs
* WARNING : changes the values for FocusRes1 , focusRes2 and FocusResn in
* afpChain !
* @ param afpChain
* the AFPChain to store resuts
* @ param afpn
* nr of afp
* @ param afpPositions
* @ param listStart
* @ return nr of eq residues */
public static int afp2Res ( AFPChain afpChain , int afpn , int [ ] afpPositions , int listStart ) { } } | int [ ] res1 = afpChain . getFocusRes1 ( ) ; int [ ] res2 = afpChain . getFocusRes2 ( ) ; int minLen = afpChain . getMinLen ( ) ; int n = 0 ; List < AFP > afpSet = afpChain . getAfpSet ( ) ; for ( int i = listStart ; i < listStart + afpn ; i ++ ) { int a = afpPositions [ i ] ; for ( int j = 0 ; j < afpSet . get ( a ) . getFragLen ( ) ; j ++ ) { if ( n >= minLen ) { throw new RuntimeException ( "Error: too many residues in AFPChainer.afp2Res!" ) ; } res1 [ n ] = afpSet . get ( a ) . getP1 ( ) + j ; res2 [ n ] = afpSet . get ( a ) . getP2 ( ) + j ; n ++ ; } } afpChain . setFocusRes1 ( res1 ) ; afpChain . setFocusRes2 ( res2 ) ; afpChain . setFocusResn ( n ) ; if ( n == 0 ) { logger . warn ( "n=0!!! + " + afpn + " " + listStart + " " + afpPositions . length ) ; } return n ; |
public class SeaGlassRootPaneUI { /** * Installs the necessary Listeners on the parent < code > Window < / code > , if
* there is one .
* < p > This takes the parent so that cleanup can be done from < code >
* removeNotify < / code > , at which point the parent hasn ' t been reset yet . < / p >
* @ param root the JRootPane .
* @ param parent The parent of the JRootPane */
private void installWindowListeners ( JRootPane root , Component parent ) { } } | if ( parent instanceof Window ) { window = ( Window ) parent ; } else { window = SwingUtilities . getWindowAncestor ( parent ) ; } if ( window != null ) { if ( mouseInputListener == null ) { mouseInputListener = createWindowMouseInputListener ( root ) ; } window . addMouseListener ( mouseInputListener ) ; window . addMouseMotionListener ( mouseInputListener ) ; if ( windowListener == null ) { windowListener = createFocusListener ( ) ; window . addWindowListener ( windowListener ) ; } } |
public class CmsXmlContentDefinition { /** * Generates a valid locale ( language ) element for the XML schema of this content definition . < p >
* @ param cms the current users OpenCms context
* @ param document the OpenCms XML document the XML is created for
* @ param root the root node of the document where to append the locale to
* @ param locale the locale to create the default element in the document with
* @ return a valid XML element for the locale according to the XML schema of this content definition */
public Element createLocale ( CmsObject cms , I_CmsXmlDocument document , Element root , Locale locale ) { } } | // add an element with a " locale " attribute to the given root node
Element element = root . addElement ( getInnerName ( ) ) ; element . addAttribute ( XSD_ATTRIBUTE_VALUE_LANGUAGE , locale . toString ( ) ) ; // now generate the default XML for the element
return createDefaultXml ( cms , document , element , locale ) ; |
public class CouponSetUrl { /** * Get Resource Url for UpdateCouponSet
* @ param couponSetCode The unique identifier of the coupon set .
* @ param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object . This parameter should only be used to retrieve data . Attempting to update data using this parameter may cause data loss .
* @ return String Resource Url */
public static MozuUrl updateCouponSetUrl ( String couponSetCode , String responseFields ) { } } | UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/couponsets/{couponSetCode}?responseFields={responseFields}" ) ; formatter . formatUrl ( "couponSetCode" , couponSetCode ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; |
public class PrefixedProperties { /** * ( non - Javadoc )
* @ see java . util . Properties # save ( java . io . OutputStream , java . lang . String ) */
@ SuppressWarnings ( "deprecation" ) @ Override public void save ( final OutputStream out , final String comments ) { } } | lock . readLock ( ) . lock ( ) ; try { properties . save ( out , comments ) ; } finally { lock . readLock ( ) . unlock ( ) ; } |
public class EvaluationBinary { /** * Merge the other evaluation object into this one . The result is that this { @ link # EvaluationBinary } instance contains the counts
* etc from both
* @ param other EvaluationBinary object to merge into this one . */
@ Override public void merge ( EvaluationBinary other ) { } } | if ( other . countTruePositive == null ) { // Other is empty - no op
return ; } if ( countTruePositive == null ) { // This evaluation is empty - > take results from other
this . countTruePositive = other . countTruePositive ; this . countFalsePositive = other . countFalsePositive ; this . countTrueNegative = other . countTrueNegative ; this . countFalseNegative = other . countFalseNegative ; this . rocBinary = other . rocBinary ; } else { if ( this . countTruePositive . length != other . countTruePositive . length ) { throw new IllegalStateException ( "Cannot merge EvaluationBinary instances with different sizes. This " + "size: " + this . countTruePositive . length + ", other size: " + other . countTruePositive . length ) ; } // Both have stats
addInPlace ( this . countTruePositive , other . countTruePositive ) ; addInPlace ( this . countTrueNegative , other . countTrueNegative ) ; addInPlace ( this . countFalsePositive , other . countFalsePositive ) ; addInPlace ( this . countFalseNegative , other . countFalseNegative ) ; if ( this . rocBinary != null ) { this . rocBinary . merge ( other . rocBinary ) ; } } |
public class tmglobal_auditnslogpolicy_binding { /** * Use this API to fetch filtered set of tmglobal _ auditnslogpolicy _ binding resources .
* filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */
public static tmglobal_auditnslogpolicy_binding [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | tmglobal_auditnslogpolicy_binding obj = new tmglobal_auditnslogpolicy_binding ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; tmglobal_auditnslogpolicy_binding [ ] response = ( tmglobal_auditnslogpolicy_binding [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class ClientRegistry { /** * Renders the { @ link ItemStack } with a registered { @ link IItemRenderer } .
* @ param itemStack the item stack
* @ return true , if successful */
boolean renderItem ( ItemStack itemStack ) { } } | if ( itemStack . isEmpty ( ) ) return false ; IItemRenderer renderer = getItemRendererOverride ( itemStack ) ; if ( renderer == null ) renderer = itemRenderers . get ( itemStack . getItem ( ) ) ; if ( renderer == null ) return false ; renderer . renderItem ( itemStack , MalisisRenderer . getPartialTick ( ) ) ; return true ; |
public class AbstractPluginManager { /** * Tests for already loaded plugins on given path .
* @ param pluginPath the path to investigate
* @ return id of plugin or null if not loaded */
protected String idForPath ( Path pluginPath ) { } } | for ( PluginWrapper plugin : plugins . values ( ) ) { if ( plugin . getPluginPath ( ) . equals ( pluginPath ) ) { return plugin . getPluginId ( ) ; } } return null ; |
public class CommerceOrderUtil { /** * Removes all the commerce orders where userId = & # 63 ; and createDate & lt ; & # 63 ; and orderStatus = & # 63 ; from the database .
* @ param userId the user ID
* @ param createDate the create date
* @ param orderStatus the order status */
public static void removeByU_LtC_O ( long userId , Date createDate , int orderStatus ) { } } | getPersistence ( ) . removeByU_LtC_O ( userId , createDate , orderStatus ) ; |
public class CmsCloneModuleThread { /** * Creates the target folder for the module clone . < p >
* @ param targetModule the target module
* @ param sourceClassesPath the source module class path
* @ param targetBaseClassesPath the ' classes ' folder of the target module
* @ throws CmsException if something goes wrong */
private void createTargetClassesFolder ( CmsModule targetModule , String sourceClassesPath , String targetBaseClassesPath ) throws CmsException { } } | StringTokenizer tok = new StringTokenizer ( targetModule . getName ( ) , "." ) ; int folderId = CmsResourceTypeFolder . getStaticTypeId ( ) ; String targetClassesPath = targetBaseClassesPath ; while ( tok . hasMoreTokens ( ) ) { String folder = tok . nextToken ( ) ; targetClassesPath += folder + "/" ; if ( ! getCms ( ) . existsResource ( targetClassesPath ) ) { getCms ( ) . createResource ( targetClassesPath , folderId ) ; } } // move exiting content into new classes sub - folder
List < CmsResource > propertyFiles = getCms ( ) . readResources ( sourceClassesPath , CmsResourceFilter . ALL ) ; for ( CmsResource res : propertyFiles ) { if ( ! getCms ( ) . existsResource ( targetClassesPath + res . getName ( ) ) ) { getCms ( ) . copyResource ( res . getRootPath ( ) , targetClassesPath + res . getName ( ) ) ; } } |
public class TypefaceHelper { /** * Apply fonts from map to all children of view ( or view itself )
* @ param view view for which to typeface fonts
* @ param typefaceCollection Collection of typefaces */
public static void typeface ( View view , TypefaceCollection typefaceCollection ) { } } | if ( view instanceof ViewGroup ) { applyTypeface ( ( ViewGroup ) view , typefaceCollection ) ; } else { applyForView ( view , typefaceCollection ) ; } |
public class ElasticSearchSchemaService { /** * testable version of { @ link ElasticSearchSchemaService # extractResponse ( Response ) }
* @ param statusCode
* @ param entity
* @ return */
@ VisibleForTesting static String doExtractResponse ( int statusCode , HttpEntity entity ) { } } | String message = null ; if ( entity != null ) { try ( ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ) { entity . writeTo ( baos ) ; message = baos . toString ( "UTF-8" ) ; } catch ( IOException ex ) { throw new SystemException ( ex ) ; } } // if the response is in the 400 range , use IllegalArgumentException , which currently translates to a 400 error
if ( statusCode >= HttpStatus . SC_BAD_REQUEST && statusCode < HttpStatus . SC_INTERNAL_SERVER_ERROR ) { throw new IllegalArgumentException ( "Status code: " + statusCode + " . Error occurred. " + message ) ; } // everything else that ' s not in the 200 range , use SystemException , which translates to a 500 error .
if ( ( statusCode < HttpStatus . SC_OK ) || ( statusCode >= HttpStatus . SC_MULTIPLE_CHOICES ) ) { throw new SystemException ( "Status code: " + statusCode + " . Error occurred. " + message ) ; } else { return message ; } |
public class MtasSolrResultUtil { /** * Rewrite .
* @ param nl the nl
* @ param searchComponent the search component
* @ throws IOException Signals that an I / O exception has occurred . */
public static void rewrite ( NamedList < Object > nl , MtasSolrSearchComponent searchComponent ) throws IOException { } } | rewrite ( nl , searchComponent , true ) ; |
public class Main { /** * Main method of LWJGFont in command line mode . */
public static void main ( String [ ] args ) throws IOException , FontFormatException , URISyntaxException { } } | CliArgumentParser parser = new CliArgumentParser ( args ) ; LwjgFontFactory lwjgFont = new LwjgFontFactory ( parser . get ( _p ) ) ; if ( parser . hasArgument ( _x ) ) { // γγ£γ©γ―γΏγΌγγ‘γ€γ«γε±ιγγ
lwjgFont . extractCharacterFiles ( ) ; } else if ( parser . hasArgument ( _v ) ) { // γγγΌγ·γγ§γ³γ葨瀺γγ
lwjgFont . printVersion ( ) ; } else if ( parser . hasArgument ( _l ) ) { // γ·γΉγγ γγθͺθγγ¦γγγγ©γ³γεγδΈθ¦§θ‘¨η€Ίγγ
SystemFont . listLogicalFont ( ) ; } else if ( parser . hasFontSettings ( ) ) { // γγ©γ³γγγγγγδ½ζγγ
for ( FontSetting fontSetting : parser . listFontSettings ( ) ) { lwjgFont . create ( fontSetting ) ; } lwjgFont . makePackage ( ) ; lwjgFont . writeProcessLog ( ) ; } |
public class DefaultTaskManager { /** * TaskManager implementation */
public void run ( ) { } } | this . currentThread = Thread . currentThread ( ) ; this . running . set ( true ) ; while ( this . running . get ( ) ) { Task nextTask = null ; try { if ( _logger . isDebugEnabled ( ) ) _logger . debug ( "Waiting for next task..." ) ; nextTask = this . taskSet . take ( ) ; if ( _logger . isDebugEnabled ( ) ) _logger . debug ( "next from taskset is task: " + nextTask . getCommand ( ) ) ; this . executor . submit ( nextTask ) ; if ( _logger . isDebugEnabled ( ) ) _logger . debug ( "submitted for execution command: " + nextTask . getCommand ( ) ) ; } catch ( InterruptedException e ) { _logger . debug ( "Task manager thread interrupted." ) ; this . running . set ( false ) ; } catch ( Exception e ) { _logger . debug ( "Task manager experienced an unhandled exception, shutting down" ) ; this . running . set ( false ) ; } } _logger . info ( "Shutting down task manager." ) ; this . taskSet . clear ( ) ; executor . shutdown ( ) ; |
public class ProfileUtilities { public static String describeExtensionContext ( StructureDefinition ext ) { } } | CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder ( ) ; for ( StringType t : ext . getContext ( ) ) b . append ( t . getValue ( ) ) ; if ( ! ext . hasContextType ( ) ) throw new Error ( "no context type on " + ext . getUrl ( ) ) ; switch ( ext . getContextType ( ) ) { case DATATYPE : return "Use on data type: " + b . toString ( ) ; case EXTENSION : return "Use on extension: " + b . toString ( ) ; case RESOURCE : return "Use on element: " + b . toString ( ) ; case MAPPING : return "Use where element has mapping: " + b . toString ( ) ; default : return "??" ; } |
public class PaxChronology { /** * Obtains a local date in Pax calendar system from the
* era , year - of - era and day - of - year fields .
* @ param era the Pax era , not null
* @ param yearOfEra the year - of - era
* @ param dayOfYear the day - of - year
* @ return the Pax local date , not null
* @ throws DateTimeException if unable to create the date
* @ throws ClassCastException if the { @ code era } is not a { @ code PaxEra } */
@ Override public PaxDate dateYearDay ( Era era , int yearOfEra , int dayOfYear ) { } } | return dateYearDay ( prolepticYear ( era , yearOfEra ) , dayOfYear ) ; |
public class EnumHelper { /** * Get the enum value with the passed ID . If no such ID is present , an
* { @ link IllegalArgumentException } is thrown .
* @ param < KEYTYPE >
* The ID type
* @ param < ENUMTYPE >
* The enum type
* @ param aClass
* The enum class
* @ param aID
* The ID to search
* @ return The enum item with the given ID . Never < code > null < / code > .
* @ throws IllegalArgumentException
* if no enum item with the given ID is present */
@ Nonnull public static < KEYTYPE , ENUMTYPE extends Enum < ENUMTYPE > & IHasID < KEYTYPE > > ENUMTYPE getFromIDOrThrow ( @ Nonnull final Class < ENUMTYPE > aClass , @ Nullable final KEYTYPE aID ) { } } | final ENUMTYPE aEnum = getFromIDOrNull ( aClass , aID ) ; if ( aEnum == null ) throw new IllegalArgumentException ( "Failed to resolve ID " + aID + " within class " + aClass ) ; return aEnum ; |
public class RequestUtils { /** * Returns a cookie by name , null if not found .
* @ param name name of a cookie .
* @ return a cookie by name , null if not found . */
public static Cookie cookie ( String name ) { } } | javax . servlet . http . Cookie [ ] servletCookies = RequestContext . getHttpRequest ( ) . getCookies ( ) ; if ( servletCookies != null ) { for ( javax . servlet . http . Cookie servletCookie : servletCookies ) { if ( servletCookie . getName ( ) . equals ( name ) ) { return Cookie . fromServletCookie ( servletCookie ) ; } } } return null ; |
public class BondSigmaElectronegativityDescriptor { /** * The method calculates the sigma electronegativity of a given bond
* It is needed to call the addExplicitHydrogensToSatisfyValency method from the class tools . HydrogenAdder .
* @ param atomContainer AtomContainer
* @ return return the sigma electronegativity */
@ Override public DescriptorValue calculate ( IBond aBond , IAtomContainer atomContainer ) { } } | IAtomContainer ac ; IBond bond ; try { ac = ( IAtomContainer ) atomContainer . clone ( ) ; bond = ac . getBond ( atomContainer . indexOf ( aBond ) ) ; AtomContainerManipulator . percieveAtomTypesAndConfigureAtoms ( ac ) ; } catch ( CDKException e ) { return getDummyDescriptorValue ( e ) ; } catch ( CloneNotSupportedException e ) { return getDummyDescriptorValue ( e ) ; } if ( maxIterations != - 1 && maxIterations != 0 ) electronegativity . setMaxIterations ( maxIterations ) ; double electroAtom1 = electronegativity . calculateSigmaElectronegativity ( ac , bond . getBegin ( ) ) ; double electroAtom2 = electronegativity . calculateSigmaElectronegativity ( ac , bond . getEnd ( ) ) ; return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new DoubleResult ( Math . abs ( electroAtom1 - electroAtom2 ) ) , NAMES ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.