signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class OntopMappingConfigurationImpl { /** * Can be overloaded by sub - classes */ @ Override protected ImmutableMap < Class < ? extends QueryOptimizationProposal > , Class < ? extends ProposalExecutor > > generateOptimizationConfigurationMap ( ) { } }
ImmutableMap . Builder < Class < ? extends QueryOptimizationProposal > , Class < ? extends ProposalExecutor > > internalExecutorMapBuilder = ImmutableMap . builder ( ) ; internalExecutorMapBuilder . putAll ( super . generateOptimizationConfigurationMap ( ) ) ; internalExecutorMapBuilder . putAll ( optimizationConfiguration . generateOptimizationConfigurationMap ( ) ) ; return internalExecutorMapBuilder . build ( ) ;
public class AbstractNeo4jDatastore { /** * Ensures that an index exists for the given label and property . * @ param session * The datastore session * @ param label * The label . * @ param propertyMethodMetadata * The property metadata . * @ param unique * if < code > true < / code > create a unique constraint */ private void ensureIndex ( DS session , L label , PrimitivePropertyMethodMetadata < PropertyMetadata > propertyMethodMetadata , boolean unique ) { } }
PropertyMetadata propertyMetadata = propertyMethodMetadata . getDatastoreMetadata ( ) ; String statement ; if ( unique ) { LOGGER . debug ( "Creating constraint for label {} on property '{}'." , label , propertyMetadata . getName ( ) ) ; statement = String . format ( "CREATE CONSTRAINT ON (n:%s) ASSERT n.%s IS UNIQUE" , label . getName ( ) , propertyMetadata . getName ( ) ) ; } else { LOGGER . debug ( "Creating index for label {} on property '{}'." , label , propertyMetadata . getName ( ) ) ; statement = String . format ( "CREATE INDEX ON :%s(%s)" , label . getName ( ) , propertyMetadata . getName ( ) ) ; } try ( ResultIterator iterator = session . createQuery ( Cypher . class ) . execute ( statement , Collections . emptyMap ( ) ) ) { }
public class ExecutionTransitioner { /** * Used for job and flow . * @ return */ public ExecutionStatus doExecutionLoop ( ) { } }
final String methodName = "doExecutionLoop" ; // Before we do anything else , see if we ' re already in STOPPING state . if ( runtimeExecution . getBatchStatus ( ) . equals ( BatchStatus . STOPPING ) ) { logger . fine ( methodName + " Exiting execution loop as job is now in stopping state." ) ; return new ExecutionStatus ( ExtendedBatchStatus . JOB_OPERATOR_STOPPING ) ; } try { currentExecutionElement = modelNavigator . getFirstExecutionElement ( runtimeExecution . getRestartOnForThisExecution ( ) ) ; } catch ( IllegalTransitionException e ) { String errorMsg = "Could not transition to first execution element within job." ; throw new IllegalArgumentException ( errorMsg , e ) ; } if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "First execution element = " + currentExecutionElement . getId ( ) ) ; } while ( true ) { IExecutionElementController currentElementController = getNextElementController ( ) ; currentStoppableElementController = currentElementController ; // Now that we ' ve re - established a stoppable element controller , check to see if we missed a stop if ( runtimeExecution . getBatchStatus ( ) . equals ( BatchStatus . STOPPING ) ) { logger . fine ( methodName + " Exiting execution loop as job is now in stopping state." ) ; return new ExecutionStatus ( ExtendedBatchStatus . JOB_OPERATOR_STOPPING ) ; } // Restarting after a failure up until this point would cause you to restart at the previous restartOn value . // Now we will reset this to ' null ' . Another alternative would be to only ' null ' this out when something actually executed . // This could have spec implications . . maybe let ' s think of it more . Or maybe no one cares even . ServicesManagerStaticAnchor . getServicesManager ( ) . getPersistenceManagerService ( ) . updateJobInstanceNullOutRestartOn ( runtimeExecution . getTopLevelInstanceId ( ) ) ; ExecutionStatus status = currentElementController . execute ( ) ; // Nothing special for decision or step except to get exit status . For flow and split we want to bubble up though . if ( ( currentExecutionElement instanceof Split ) || ( currentExecutionElement instanceof Flow ) ) { // Exit status and restartOn should both be in the job context . if ( ! status . getExtendedBatchStatus ( ) . equals ( ExtendedBatchStatus . NORMAL_COMPLETION ) ) { logger . fine ( "Breaking out of loop with return status = " + status . getExtendedBatchStatus ( ) . name ( ) ) ; return status ; } } // Seems like this should only happen if an Error is thrown at the step level , since normally a step - level // exception is caught and the fact that it was thrown capture in the ExecutionStatus if ( runtimeExecution . getBatchStatus ( ) . equals ( BatchStatus . FAILED ) ) { String errorMsg = "Sub-execution returned its own BatchStatus of FAILED. Deal with this by throwing exception to the next layer." ; throw new BatchContainerRuntimeException ( errorMsg ) ; } // set the execution element controller to null so we don ' t try to call stop on it after the element has finished executing currentStoppableElementController = null ; if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "Done executing element=" + currentExecutionElement . getId ( ) + ", exitStatus=" + status . getExitStatus ( ) ) ; } if ( runtimeExecution . getBatchStatus ( ) . equals ( BatchStatus . STOPPING ) ) { logger . fine ( methodName + " Exiting as job has been stopped" ) ; return new ExecutionStatus ( ExtendedBatchStatus . JOB_OPERATOR_STOPPING ) ; } Transition nextTransition = null ; try { nextTransition = modelNavigator . getNextTransition ( currentExecutionElement , status ) ; } catch ( IllegalTransitionException e ) { String errorMsg = "Problem transitioning to next execution element." ; throw new BatchContainerRuntimeException ( errorMsg , e ) ; } // We will find ourselves in one of four states now . // 1 . Finished transitioning after a normal execution , but nothing to do ' next ' . // 2 . We just executed a step which through an exception , but didn ' t match a transition element . // 3 . We are going to ' next ' to another execution element ( and jump back to the top of this ' // ' while ' - loop . // 4 . We matched a terminating transition element ( < end > , < stop > or < fail ) . if ( nextTransition . isFinishedTransitioning ( ) ) { logger . fine ( methodName + " , No next execution element, and no transition element found either. Looks like we're done and ready for COMPLETED state." ) ; this . stepExecIds = currentElementController . getLastRunStepExecutions ( ) ; // Consider just passing the last ' status ' back , but let ' s unwrap the exit status and pass a new NORMAL _ COMPLETION // status back instead . return new ExecutionStatus ( ExtendedBatchStatus . NORMAL_COMPLETION , status . getExitStatus ( ) ) ; } else if ( nextTransition . noTransitionElementMatchedAfterException ( ) ) { return new ExecutionStatus ( ExtendedBatchStatus . EXCEPTION_THROWN , status . getExitStatus ( ) ) ; } else if ( nextTransition . getNextExecutionElement ( ) != null ) { // hold on to the previous execution element for the decider // we need it because we need to inject the context of the // previous execution element into the decider previousExecutionElement = currentExecutionElement ; previousElementController = currentElementController ; currentExecutionElement = nextTransition . getNextExecutionElement ( ) ; } else if ( nextTransition . getTransitionElement ( ) != null ) { ExecutionStatus terminatingStatus = handleTerminatingTransitionElement ( nextTransition . getTransitionElement ( ) ) ; logger . finer ( methodName + " , Breaking out of execution loop after processing terminating transition element." ) ; return terminatingStatus ; } else { throw new IllegalStateException ( "Not sure how we'd end up in this state...aborting rather than looping." ) ; } }
public class AbstractSetVisible { /** * Apply the action against the target . * @ param target the target of the action * @ param value is the evaluated value . */ @ Override protected void applyAction ( final SubordinateTarget target , final Object value ) { } }
if ( value instanceof Boolean ) { boolean visible = ( ( Boolean ) value ) ; target . setValidate ( visible ) ; ( ( AbstractWComponent ) target ) . setHidden ( ! visible ) ; }
public class ComparatorCompat { /** * Adds the comparator , that uses a function for extract * a { @ code double } sort key , to the chain . * @ param keyExtractor the function that extracts the sort key * @ return the new { @ code ComparatorCompat } instance */ @ NotNull public ComparatorCompat < T > thenComparingDouble ( @ NotNull ToDoubleFunction < ? super T > keyExtractor ) { } }
return thenComparing ( comparingDouble ( keyExtractor ) ) ;
public class ServerInstanceLogRecordListImpl { /** * / * ( non - Javadoc ) * @ see com . ibm . websphere . logging . hpel . reader . ServerInstanceLogRecordList # getChildren ( ) */ public Map < String , ServerInstanceLogRecordList > getChildren ( ) { } }
HashMap < String , ServerInstanceLogRecordList > map = new HashMap < String , ServerInstanceLogRecordList > ( ) ; if ( traceBrowser == null ) { for ( Map . Entry < String , LogRepositoryBrowser > entry : logBrowser . getSubProcesses ( ) . entrySet ( ) ) { ServerInstanceLogRecordList value = new ServerInstanceLogRecordListImpl ( entry . getValue ( ) , null , switched ) { @ Override public OnePidRecordListImpl queryResult ( LogRepositoryBrowser browser ) { return ServerInstanceLogRecordListImpl . this . queryResult ( browser ) ; } } ; map . put ( entry . getKey ( ) , value ) ; } } else if ( logBrowser == null ) { for ( Map . Entry < String , LogRepositoryBrowser > entry : traceBrowser . getSubProcesses ( ) . entrySet ( ) ) { ServerInstanceLogRecordList value = new ServerInstanceLogRecordListImpl ( entry . getValue ( ) , null , ! switched ) { @ Override public OnePidRecordListImpl queryResult ( LogRepositoryBrowser browser ) { return ServerInstanceLogRecordListImpl . this . queryResult ( browser ) ; } } ; map . put ( entry . getKey ( ) , value ) ; } } else { Map < String , LogRepositoryBrowser > logSubProcs = logBrowser . getSubProcesses ( ) ; Map < String , LogRepositoryBrowser > traceSubProcs = traceBrowser . getSubProcesses ( ) ; HashSet < String > keys = new HashSet < String > ( ) ; keys . addAll ( logSubProcs . keySet ( ) ) ; keys . addAll ( traceSubProcs . keySet ( ) ) ; for ( String key : keys ) { ServerInstanceLogRecordList value = new ServerInstanceLogRecordListImpl ( logSubProcs . get ( key ) , traceSubProcs . get ( key ) , switched ) { @ Override public OnePidRecordListImpl queryResult ( LogRepositoryBrowser browser ) { return ServerInstanceLogRecordListImpl . this . queryResult ( browser ) ; } } ; map . put ( key , value ) ; } } return map ;
public class GroupDefImpl { /** * / * ( non - Javadoc ) * @ see org . jboss . arquillian . impl . configuration . ArquillianDescriptorImpl # container ( java . lang . String ) */ @ Override public ContainerDef container ( String name ) { } }
return new GroupContainerDefImpl ( getDescriptorName ( ) , getRootNode ( ) , group , group . getOrCreate ( "container@qualifier=" + name ) ) ;
public class VirtualNetworkGatewaysInner { /** * Generates VPN client package for P2S client of the virtual network gateway in the specified resource group . * @ param resourceGroupName The name of the resource group . * @ param virtualNetworkGatewayName The name of the virtual network gateway . * @ param parameters Parameters supplied to the generate virtual network gateway VPN client package operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable for the request */ public Observable < String > generatevpnclientpackageAsync ( String resourceGroupName , String virtualNetworkGatewayName , VpnClientParameters parameters ) { } }
return generatevpnclientpackageWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayName , parameters ) . map ( new Func1 < ServiceResponse < String > , String > ( ) { @ Override public String call ( ServiceResponse < String > response ) { return response . body ( ) ; } } ) ;
public class TangoUtil { /** * Get the list of device names which matches the pattern p * @ param deviceNamePattern * The pattern . The wild char is * * @ return A list of device names * @ throws DevFailed */ public static String [ ] getDevicesForPattern ( final String deviceNamePattern ) throws DevFailed { } }
String [ ] devices ; // is p a device name or a device name pattern ? if ( ! deviceNamePattern . contains ( "*" ) ) { // p is a pure device name devices = new String [ 1 ] ; devices [ 0 ] = TangoUtil . getfullNameForDevice ( deviceNamePattern ) ; } else { // ask the db the list of device matching pattern p final Database db = ApiUtil . get_db_obj ( ) ; devices = db . get_device_exported ( deviceNamePattern ) ; } return devices ;
public class AbstractBehavioredComponent { /** * { @ inheritDoc } */ @ Override @ SuppressWarnings ( "unchecked" ) protected void manageOptionalData ( ) { } }
// Parse optional data provided to search Behavior Class or BehaviorData for ( final Object data : key ( ) . optionalData ( ) ) { if ( data instanceof BehaviorData ) { addBehavior ( ( BehaviorData ) data ) ; } else if ( data instanceof Class && ( ( Class < ? > ) data ) . isAssignableFrom ( Behavior . class ) ) { addBehavior ( ( Class < Behavior < BehaviorData , ? > > ) data ) ; } }
public class BinderExtension { /** * / * @ Override */ public < S , T > FromUnmarshaller < S , T > findUnmarshaller ( Class < S > source , Class < T > target , Class < ? extends Annotation > qualifier ) { } }
return BINDING . findUnmarshaller ( source , target , qualifier ) ;
public class DescribeIamInstanceProfileAssociationsResult { /** * Information about the IAM instance profile associations . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setIamInstanceProfileAssociations ( java . util . Collection ) } or * { @ link # withIamInstanceProfileAssociations ( java . util . Collection ) } if you want to override the existing values . * @ param iamInstanceProfileAssociations * Information about the IAM instance profile associations . * @ return Returns a reference to this object so that method calls can be chained together . */ public DescribeIamInstanceProfileAssociationsResult withIamInstanceProfileAssociations ( IamInstanceProfileAssociation ... iamInstanceProfileAssociations ) { } }
if ( this . iamInstanceProfileAssociations == null ) { setIamInstanceProfileAssociations ( new com . amazonaws . internal . SdkInternalList < IamInstanceProfileAssociation > ( iamInstanceProfileAssociations . length ) ) ; } for ( IamInstanceProfileAssociation ele : iamInstanceProfileAssociations ) { this . iamInstanceProfileAssociations . add ( ele ) ; } return this ;
public class ErrorDetectingWrapper { /** * The basic graph error looks like this : * < pre > * error : { * type : " OAuthException " * message : " Error validating application . " * < / pre > */ protected void checkForStandardGraphError ( JsonNode node ) { } }
JsonNode errorNode = node . get ( "error" ) ; if ( errorNode != null ) { // If we ' re missing type or message , it must be some other kind of error String type = errorNode . path ( "type" ) . textValue ( ) ; if ( type == null ) return ; String msg = errorNode . path ( "message" ) . textValue ( ) ; if ( msg == null ) return ; JsonNode codeNode = errorNode . get ( "code" ) ; Integer code = codeNode == null ? null : codeNode . intValue ( ) ; JsonNode subcodeNode = errorNode . get ( "error_subcode" ) ; Integer subcode = subcodeNode == null ? null : subcodeNode . intValue ( ) ; String userTitle = errorNode . path ( "error_user_title" ) . textValue ( ) ; String userMsg = errorNode . path ( "error_user_msg" ) . textValue ( ) ; if ( code != null ) { // Special case , migration exceptions are poorly structured if ( code == 21 ) this . throwPageMigratedException ( msg , code , subcode , userTitle , userMsg ) ; // Documented here : https : / / developers . facebook . com / docs / graph - api / using - graph - api if ( code == 10 || ( code >= 200 && code <= 299 ) ) throw new PermissionException ( msg , type , code , subcode , userTitle , userMsg ) ; } // We check to see if we have an exception that matches the type , otherwise // we simply throw the base FacebookException String proposedExceptionType = Batcher . class . getPackage ( ) . getName ( ) + ".err." + type ; try { Class < ? > exceptionClass = Class . forName ( proposedExceptionType ) ; Constructor < ? > ctor = exceptionClass . getConstructor ( String . class , String . class , Integer . TYPE , Integer . TYPE ) ; throw ( FacebookException ) ctor . newInstance ( msg , type , code , subcode ) ; } catch ( FacebookException e ) { throw e ; } catch ( Exception e ) { throw new ErrorFacebookException ( type + ": " + msg , type , code , subcode , userTitle , userMsg ) ; } }
public class Criteria { /** * Creates new { @ link Predicate } for { @ code ! geodist } . * @ param circle * @ return * @ since 1.2 */ public Criteria within ( Circle circle ) { } }
Assert . notNull ( circle , "Circle for 'within' must not be 'null'." ) ; return within ( circle . getCenter ( ) , circle . getRadius ( ) ) ;
public class XMLUtils { /** * Returns a String in which some the XML special characters have been * escaped : just the ones that need escaping in an element content . * @ param in The String to escape * @ return The escaped String */ public static String escapeElementXML ( String in ) { } }
int leng = in . length ( ) ; StringBuilder sb = new StringBuilder ( leng ) ; for ( int i = 0 ; i < leng ; i ++ ) { char c = in . charAt ( i ) ; if ( c == '&' ) { sb . append ( "&amp;" ) ; } else if ( c == '<' ) { sb . append ( "&lt;" ) ; } else if ( c == '>' ) { sb . append ( "&gt;" ) ; } else { sb . append ( c ) ; } } return sb . toString ( ) ;
public class BoxFile { /** * Uploads a new version of this file , replacing the current version , while reporting the progress to a * ProgressListener . Note that only users with premium accounts will be able to view and recover previous versions * of the file . * @ param fileContent a stream containing the new file contents . * @ param modified the date that the new version was modified . * @ param fileSize the size of the file used for determining the progress of the upload . * @ param listener a listener for monitoring the upload ' s progress . * @ return the uploaded file version . */ public BoxFile . Info uploadNewVersion ( InputStream fileContent , Date modified , long fileSize , ProgressListener listener ) { } }
return this . uploadNewVersion ( fileContent , null , modified , fileSize , listener ) ;
public class FieldDefinition { /** * Parse the field definition rooted at the given UNode and store the definition in * this object . The given UNode is the field node , hence its name is the field name * and its chuildren are field attributes such as " type " and and " inverse " . An * exception is thrown if the definition is invalid . * @ param fieldNode UNode that defines a field . */ public void parse ( UNode fieldNode ) { } }
assert fieldNode != null ; // Set field name . setName ( fieldNode . getName ( ) ) ; // Parse the nodes child nodes . If we find a " fields " definition , just save it // for later . for ( String childName : fieldNode . getMemberNames ( ) ) { // See if we recognize it . UNode childNode = fieldNode . getMember ( childName ) ; // " type " if ( childName . equals ( "type" ) ) { // Value must be a string . Utils . require ( childNode . isValue ( ) , "Value of 'type' must be a string: " + childNode ) ; Utils . require ( m_type == null , "'type' can only be specified once" ) ; m_type = FieldType . fromString ( childNode . getValue ( ) ) ; Utils . require ( m_type != null , "Unrecognized field 'type': " + childNode . getValue ( ) ) ; // " collection " } else if ( childName . equals ( "collection" ) ) { // Value must be a string . Utils . require ( childNode . isValue ( ) , "Value of 'collection' must be a string: " + childNode ) ; m_bIsCollection = Utils . getBooleanValue ( childNode . getValue ( ) ) ; // " analyzer " } else if ( childName . equals ( "analyzer" ) ) { // Value must be a string . Utils . require ( childNode . isValue ( ) , "Value of 'analyzer' must be a string: " + childNode ) ; Utils . require ( m_analyzerName == null , "'analyzer' can only be specified once" ) ; m_analyzerName = childNode . getValue ( ) ; // " inverse " } else if ( childName . equals ( "inverse" ) ) { // Value must be a string . Utils . require ( childNode . isValue ( ) , "Value of 'inverse' must be a string: " + childNode ) ; Utils . require ( m_linkInverse == null , "'inverse' can only be specified once" ) ; m_linkInverse = childNode . getValue ( ) ; // " table " } else if ( childName . equals ( "table" ) ) { // Value must be a string . Utils . require ( childNode . isValue ( ) , "Value of 'table' must be a string: " + childNode ) ; Utils . require ( m_linkExtent == null , "'table' can only be specified once" ) ; m_linkExtent = childNode . getValue ( ) ; // " fields " } else if ( childName . equals ( "fields" ) ) { // This field must be ( or can become ) a group . Utils . require ( m_type == null || m_type == FieldType . GROUP , "Only group fields can have nested elements: " + m_name ) ; m_type = FieldType . GROUP ; // Value can only be specified once . Utils . require ( m_nestedFieldMap . size ( ) == 0 , "'fields' can only be specified once: " + m_name ) ; Utils . require ( childNode . hasMembers ( ) , "Group field must have at least one nested field defined: " + m_name ) ; for ( String nestedFieldName : childNode . getMemberNames ( ) ) { // Create a FieldDefinition for the nested field and parse details into it . UNode nestedFieldNode = childNode . getMember ( nestedFieldName ) ; FieldDefinition nestedField = new FieldDefinition ( ) ; nestedField . parse ( nestedFieldNode ) ; addNestedField ( nestedField ) ; } // " sharded " } else if ( childName . equals ( "sharded" ) ) { // Value must be a string . Utils . require ( childNode . isValue ( ) , "Value of 'sharded' must be a string: " + childNode ) ; m_bIsSharded = Utils . getBooleanValue ( childNode . getValue ( ) ) ; // " encoding " } else if ( childName . equals ( "encoding" ) ) { Utils . require ( childNode . isValue ( ) , "Value of 'encoding' must be a string: " + childNode ) ; EncodingType encoding = EncodingType . fromString ( childNode . getValue ( ) ) ; Utils . require ( encoding != null , "Unrecognized 'encoding': " + childNode . getValue ( ) ) ; setEncoding ( encoding ) ; // " junction " } else if ( childName . equals ( "junction" ) ) { Utils . require ( childNode . isValue ( ) , "Value of 'junction' must be a string: " + childNode ) ; m_junctionField = childNode . getValue ( ) ; // Unrecognized . } else { Utils . require ( false , "Unrecognized field attribute: " + childName ) ; } } // If we didn ' t get a ' type ' , default to " text " . if ( m_type == null ) { m_type = FieldType . TEXT ; } verify ( ) ;
public class HadoopLogParser { /** * Parse a date found in the Hadoop log . * @ return a Calendar representing the date */ protected Calendar parseDate ( String strDate , String strTime ) { } }
Calendar retval = Calendar . getInstance ( ) ; // set date String [ ] fields = strDate . split ( "-" ) ; retval . set ( Calendar . YEAR , Integer . parseInt ( fields [ 0 ] ) ) ; retval . set ( Calendar . MONTH , Integer . parseInt ( fields [ 1 ] ) ) ; retval . set ( Calendar . DATE , Integer . parseInt ( fields [ 2 ] ) ) ; // set time fields = strTime . split ( ":" ) ; retval . set ( Calendar . HOUR_OF_DAY , Integer . parseInt ( fields [ 0 ] ) ) ; retval . set ( Calendar . MINUTE , Integer . parseInt ( fields [ 1 ] ) ) ; retval . set ( Calendar . SECOND , Integer . parseInt ( fields [ 2 ] ) ) ; return retval ;
public class BELParser { /** * Parses a { @ link Statement } from a BEL statement { @ link String } . Returns * the { @ link Statement } if parse succeeded , { @ code null } if parse failed . * @ param belStatementSyntax { @ link String } * @ return { @ link Statement } if parse succeeded ; { @ code null } if parse * failed or { @ code belTermSyntax } was empty */ public static final Statement parseStatement ( final String belStatementSyntax ) { } }
if ( noLength ( belStatementSyntax ) ) return null ; CharStream stream = new ANTLRStringStream ( belStatementSyntax ) ; BELStatementLexer lexer = new BELStatementLexer ( stream ) ; TokenStream tokenStream = new CommonTokenStream ( lexer ) ; BELStatementParser bsp = new BELStatementParser ( tokenStream ) ; try { return bsp . statement ( ) . r ; } catch ( RecognitionException e ) { return null ; }
public class ProcessEngineConfigurationImpl { /** * session factories / / / / / */ public void initSessionFactories ( ) { } }
if ( sessionFactories == null ) { sessionFactories = new HashMap < Class < ? > , SessionFactory > ( ) ; if ( usingRelationalDatabase ) { initDbSqlSessionFactory ( ) ; } addSessionFactory ( new GenericManagerFactory ( EntityCache . class , EntityCacheImpl . class ) ) ; } if ( customSessionFactories != null ) { for ( SessionFactory sessionFactory : customSessionFactories ) { addSessionFactory ( sessionFactory ) ; } }
public class ComputerVisionImpl { /** * This operation generates a description of an image in human readable language with complete sentences . The description is based on a collection of content tags , which are also returned by the operation . More than one description can be generated for each image . Descriptions are ordered by their confidence score . All descriptions are in English . Two input methods are supported - - ( 1 ) Uploading an image or ( 2 ) specifying an image URL . A successful response will be returned in JSON . If the request failed , the response will contain an error code and a message to help understand what went wrong . * @ param url Publicly reachable URL of an image * @ param describeImageOptionalParameter the object representing the optional parameters to be set before calling this API * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < ImageDescription > describeImageAsync ( String url , DescribeImageOptionalParameter describeImageOptionalParameter , final ServiceCallback < ImageDescription > serviceCallback ) { } }
return ServiceFuture . fromResponse ( describeImageWithServiceResponseAsync ( url , describeImageOptionalParameter ) , serviceCallback ) ;
public class ZonedDateTime { /** * Obtains an instance of { @ code ZonedDateTime } from the instant formed by combining * the local date - time and offset . * This creates a zoned date - time by { @ link LocalDateTime # toInstant ( ZoneOffset ) combining } * the { @ code LocalDateTime } and { @ code ZoneOffset } . * This combination uniquely specifies an instant without ambiguity . * Converting an instant to a zoned date - time is simple as there is only one valid * offset for each instant . If the valid offset is different to the offset specified , * then the date - time and offset of the zoned date - time will differ from those specified . * If the { @ code ZoneId } to be used is a { @ code ZoneOffset } , this method is equivalent * to { @ link # of ( LocalDateTime , ZoneId ) } . * @ param localDateTime the local date - time , not null * @ param offset the zone offset , not null * @ param zone the time - zone , not null * @ return the zoned date - time , not null */ public static ZonedDateTime ofInstant ( LocalDateTime localDateTime , ZoneOffset offset , ZoneId zone ) { } }
Objects . requireNonNull ( localDateTime , "localDateTime" ) ; Objects . requireNonNull ( offset , "offset" ) ; Objects . requireNonNull ( zone , "zone" ) ; if ( zone . getRules ( ) . isValidOffset ( localDateTime , offset ) ) { return new ZonedDateTime ( localDateTime , offset , zone ) ; } return create ( localDateTime . toEpochSecond ( offset ) , localDateTime . getNano ( ) , zone ) ;
public class sslvserver_sslciphersuite_binding { /** * Use this API to count the filtered set of sslvserver _ sslciphersuite _ binding resources . * filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */ public static long count_filtered ( nitro_service service , String vservername , String filter ) throws Exception { } }
sslvserver_sslciphersuite_binding obj = new sslvserver_sslciphersuite_binding ( ) ; obj . set_vservername ( vservername ) ; options option = new options ( ) ; option . set_count ( true ) ; option . set_filter ( filter ) ; sslvserver_sslciphersuite_binding [ ] response = ( sslvserver_sslciphersuite_binding [ ] ) obj . getfiltered ( service , option ) ; if ( response != null ) { return response [ 0 ] . __count ; } return 0 ;
public class RecommendationsInner { /** * Disables the specified rule so it will not apply to a subscription in the future . * Disables the specified rule so it will not apply to a subscription in the future . * @ param name Rule name * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < Void > disableRecommendationForSubscriptionAsync ( String name , final ServiceCallback < Void > serviceCallback ) { } }
return ServiceFuture . fromResponse ( disableRecommendationForSubscriptionWithServiceResponseAsync ( name ) , serviceCallback ) ;
public class InterconnectAttachmentClient { /** * Updates the specified interconnect attachment with the data included in the request . This * method supports PATCH semantics and uses the JSON merge patch format and processing rules . * < p > Sample code : * < pre > < code > * try ( InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient . create ( ) ) { * ProjectRegionInterconnectAttachmentName interconnectAttachment = ProjectRegionInterconnectAttachmentName . of ( " [ PROJECT ] " , " [ REGION ] " , " [ INTERCONNECT _ ATTACHMENT ] " ) ; * InterconnectAttachment interconnectAttachmentResource = InterconnectAttachment . newBuilder ( ) . build ( ) ; * List & lt ; String & gt ; fieldMask = new ArrayList & lt ; & gt ; ( ) ; * Operation response = interconnectAttachmentClient . patchInterconnectAttachment ( interconnectAttachment , interconnectAttachmentResource , fieldMask ) ; * < / code > < / pre > * @ param interconnectAttachment Name of the interconnect attachment to patch . * @ param interconnectAttachmentResource Represents an InterconnectAttachment ( VLAN attachment ) * resource . For more information , see Creating VLAN Attachments . ( = = resource _ for * beta . interconnectAttachments = = ) ( = = resource _ for v1 . interconnectAttachments = = ) * @ param fieldMask The fields that should be serialized ( even if they have empty values ) . If the * containing message object has a non - null fieldmask , then all the fields in the field mask * ( and only those fields in the field mask ) will be serialized . If the containing object does * not have a fieldmask , then only non - empty fields will be serialized . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final Operation patchInterconnectAttachment ( ProjectRegionInterconnectAttachmentName interconnectAttachment , InterconnectAttachment interconnectAttachmentResource , List < String > fieldMask ) { } }
PatchInterconnectAttachmentHttpRequest request = PatchInterconnectAttachmentHttpRequest . newBuilder ( ) . setInterconnectAttachment ( interconnectAttachment == null ? null : interconnectAttachment . toString ( ) ) . setInterconnectAttachmentResource ( interconnectAttachmentResource ) . addAllFieldMask ( fieldMask ) . build ( ) ; return patchInterconnectAttachment ( request ) ;
public class NIOTool { /** * See { @ link Files # getAttribute ( Path , String , LinkOption . . . ) } . * @ param path See { @ link Files # getAttribute ( Path , String , LinkOption . . . ) } * @ param attribute See { @ link Files # getAttribute ( Path , String , LinkOption . . . ) } * @ param options See { @ link Files # getAttribute ( Path , String , LinkOption . . . ) } * @ return See { @ link Files # getAttribute ( Path , String , LinkOption . . . ) } */ public Object getAttribute ( Path path , String attribute , LinkOption ... options ) { } }
try { return Files . getAttribute ( path , attribute , options ) ; } catch ( IOException e ) { return null ; }
public class SQLUtils { /** * 获得软删除SQL * @ param t * @ param values * @ return */ public static < T > String getSoftDeleteSQL ( T t , Column softDeleteColumn , List < Object > values ) { } }
String setSql = getColumnName ( softDeleteColumn ) + "=" + softDeleteColumn . softDelete ( ) [ 1 ] ; return getCustomDeleteSQL ( t , values , setSql ) ;
public class IdentityMap { /** * Removes the mapping for this key from this map if present . * @ param key key whose mapping is to be removed from the map . * @ return previous value associated with specified key , or < tt > null < / tt > * if there was no mapping for key . A < tt > null < / tt > return can * also indicate that the map previously associated < tt > null < / tt > * with the specified key . */ public Object remove ( Object key ) { } }
Entry tab [ ] = mTable ; int hash = System . identityHashCode ( key ) ; int index = ( hash & 0x7FFFFFFF ) % tab . length ; for ( Entry e = tab [ index ] , prev = null ; e != null ; e = e . mNext ) { Object entryKey = e . getKey ( ) ; if ( entryKey == null ) { // Clean up after a cleared Reference . mModCount ++ ; if ( prev != null ) { prev . mNext = e . mNext ; } else { tab [ index ] = e . mNext ; } mCount -- ; } else if ( e . mHash == hash && key == entryKey ) { mModCount ++ ; if ( prev != null ) { prev . mNext = e . mNext ; } else { tab [ index ] = e . mNext ; } mCount -- ; Object oldValue = e . mValue ; e . mValue = null ; return oldValue ; } else { prev = e ; } } return null ;
public class CmsHelpTemplateBean { /** * Generates the HTML for the online help frameset or redirects to the help body , depending on the build frameset flag . < p > * @ return the HTML for the online help frameset or an empty String ( redirect ) * @ throws IOException if redirection fails */ public String displayHelp ( ) throws IOException { } }
String result = "" ; // change to online project to allow static export / export links try { getJsp ( ) . getRequestContext ( ) . setCurrentProject ( m_onlineProject ) ; if ( isBuildFrameset ( ) ) { // build the online help frameset result = displayFrameset ( ) ; } else { // redirect to the help body StringBuffer bodyLink = new StringBuffer ( 8 ) ; bodyLink . append ( TEMPLATEPATH ) ; bodyLink . append ( "help_body.jsp?" ) ; bodyLink . append ( CmsHelpTemplateBean . PARAM_HELPRESOURCE ) ; bodyLink . append ( "=" ) ; bodyLink . append ( getJsp ( ) . getRequestContext ( ) . getUri ( ) ) ; bodyLink . append ( "&" ) ; bodyLink . append ( CmsLocaleManager . PARAMETER_LOCALE ) ; bodyLink . append ( "=" ) ; bodyLink . append ( getLocale ( ) ) ; // add the other parameters too ! String bodyLinkWithParams = attachRequestString ( bodyLink . toString ( ) ) ; String redirectLink = getJsp ( ) . link ( bodyLinkWithParams ) ; // set back to current project getJsp ( ) . getResponse ( ) . sendRedirect ( redirectLink ) ; } return result ; } finally { getJsp ( ) . getRequestContext ( ) . setCurrentProject ( m_onlineProject ) ; }
public class CPDefinitionSpecificationOptionValuePersistenceImpl { /** * Returns all the cp definition specification option values where CPDefinitionId = & # 63 ; and CPOptionCategoryId = & # 63 ; . * @ param CPDefinitionId the cp definition ID * @ param CPOptionCategoryId the cp option category ID * @ return the matching cp definition specification option values */ @ Override public List < CPDefinitionSpecificationOptionValue > findByC_COC ( long CPDefinitionId , long CPOptionCategoryId ) { } }
return findByC_COC ( CPDefinitionId , CPOptionCategoryId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ;
public class NetworkServiceDescriptorAgent { /** * Returns a specific PhysicalNetworkFunctionDescriptor that is contained in a particular * NetworkServiceDescriptor . * @ param idNsd the NetworkServiceDescriptr ' s ID * @ param idPnf the PhysicalNetworkFunctionDescriptor ' s ID * @ return the PhysicalNetworkFunctionDescriptor * @ throws SDKException if the request fails */ @ Help ( help = "Get the PhysicalNetworkFunctionDescriptor with specific id of a NetworkServiceDescriptor with specific id" ) public PhysicalNetworkFunctionDescriptor getPhysicalNetworkFunctionDescriptor ( final String idNsd , final String idPnf ) throws SDKException { } }
String url = idNsd + "/pnfdescriptors" + "/" + idPnf ; return ( PhysicalNetworkFunctionDescriptor ) requestGetWithStatusAccepted ( url , PhysicalNetworkFunctionDescriptor . class ) ;
public class EscapeProcessor { /** * Process the text * @ param source the sourcetext * @ return the result of text processing * @ see TextProcessor # process ( CharSequence ) */ public CharSequence process ( CharSequence source ) { } }
if ( source != null && source . length ( ) > 0 ) { String stringSource = source instanceof String ? ( String ) source : source . toString ( ) ; // Array to cache founded indexes of sequences int [ ] indexes = new int [ escape . length ] ; Arrays . fill ( indexes , - 1 ) ; int length = source . length ( ) ; int offset = 0 ; StringBuilder result = new StringBuilder ( length ) ; while ( offset < length ) { // Find next escape sequence int escPosition = - 1 ; int escIndex = - 1 ; for ( int i = 0 ; i < escape . length ; i ++ ) { int index ; if ( indexes [ i ] < offset ) { index = stringSource . indexOf ( escape [ i ] [ 0 ] , offset ) ; indexes [ i ] = index ; } else { index = indexes [ i ] ; } if ( index >= 0 && ( index < escPosition || escPosition < 0 ) ) { escPosition = index ; escIndex = i ; } } // If escape sequence is found if ( escPosition >= 0 ) { // replace chars before escape sequence result . append ( stringSource , offset , escPosition ) ; // Replace sequence result . append ( escape [ escIndex ] [ 1 ] ) ; offset = escPosition + escape [ escIndex ] [ 0 ] . length ( ) ; } else { // Put other string to result sequence result . append ( stringSource , offset , length ) ; offset = length ; } } return result ; } else { return new StringBuilder ( 0 ) ; }
public class MultiPart { /** * 将文件流读进bytes , 如果超出max指定的值则返回null * @ param max 最大长度限制 * @ return 内容 * @ throws IOException 异常 */ public byte [ ] getContentBytes ( long max ) throws IOException { } }
ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; return save ( max , out ) ? out . toByteArray ( ) : null ;
public class BootPropsTranslator { public Properties readConfigProps ( String propFile ) { } }
final InputStream ins = getClass ( ) . getClassLoader ( ) . getResourceAsStream ( propFile ) ; if ( ins == null ) { throw new IllegalStateException ( "Not found the config file in classpath: " + propFile ) ; } final Properties props = new Properties ( ) ; try { props . load ( ins ) ; } catch ( IOException e ) { throw new IllegalStateException ( "Failed to load the config resource as stream: " + propFile , e ) ; } finally { try { ins . close ( ) ; } catch ( IOException ignored ) { } } return props ;
public class MockiEbean { /** * Set a mock implementation of EbeanServer as the default server . * Typically the mock instance passed in is created by Mockito or similar tool . * The default EbeanSever is the instance returned by { @ link Ebean # getServer ( String ) } when the * server name is null . * @ param mock the mock instance that becomes the default EbeanServer * @ return The MockiEbean with a { @ link # restoreOriginal ( ) } method that can be used to restore the * original EbeanServer implementation . */ public static MockiEbean start ( EbeanServer mock ) { } }
// using $ mock as the server name EbeanServer original = Ebean . mock ( "$mock" , mock , true ) ; if ( mock instanceof DelegateAwareEbeanServer ) { ( ( DelegateAwareEbeanServer ) mock ) . withDelegateIfRequired ( original ) ; } return new MockiEbean ( mock , original ) ;
public class JPartLabel { /** * / * ( non - Javadoc ) * @ see abc . ui . swing . JText # render ( java . awt . Graphics2D ) */ public double render ( Graphics2D g2 ) { } }
double labelSize = ( double ) getMetrics ( ) . getTextFontWidth ( ScoreElements . PART_LABEL , getText ( ) ) ; Font previousFont = g2 . getFont ( ) ; Color previousColor = g2 . getColor ( ) ; setColor ( g2 , ScoreElements . PART_LABEL ) ; Rectangle2D bb = getBoundingBox ( ) ; g2 . setFont ( getTemplate ( ) . getTextFont ( ScoreElements . PART_LABEL ) ) ; float descent = g2 . getFont ( ) . getLineMetrics ( getText ( ) , g2 . getFontRenderContext ( ) ) . getDescent ( ) ; g2 . drawString ( getText ( ) , ( int ) ( bb . getCenterX ( ) - labelSize / 2 ) , ( int ) ( bb . getY ( ) + bb . getHeight ( ) - descent ) ) ; g2 . setFont ( previousFont ) ; g2 . draw ( bb ) ; g2 . setColor ( previousColor ) ; return getWidth ( ) ;
public class FlowController { /** * Add a property - related message as an expression that will be evaluated and shown with the Errors and Error tags . * @ param propertyName the name of the property with which to associate this error . * @ param expression the expression that will be evaluated to generate the error message . * @ param messageArgs zero or more arguments to the message ; may be expressions . */ protected void addActionErrorExpression ( String propertyName , String expression , Object [ ] messageArgs ) { } }
PageFlowUtils . addActionErrorExpression ( getRequest ( ) , propertyName , expression , messageArgs ) ;
public class ThriftClientFactory { /** * Gets the pool using policy . * @ return pool an the basis of LoadBalancing policy . */ private ConnectionPool getPoolUsingPolicy ( ) { } }
if ( ! hostPools . isEmpty ( ) ) { return ( ConnectionPool ) loadBalancingPolicy . getPool ( hostPools . values ( ) ) ; } throw new KunderaException ( "All hosts are down. please check servers manully." ) ;
public class Search { /** * Returns for given parameter < i > _ name < / i > the instance of class * { @ link Command } . * @ param _ name name to search in the cache * @ return instance of class { @ link Command } * @ throws CacheReloadException on error */ public static Search get ( final String _name ) throws CacheReloadException { } }
return AbstractUserInterfaceObject . < Search > get ( _name , Search . class , CIAdminUserInterface . Search . getType ( ) ) ;
public class CompositeParsedAttribute { /** * Creates internal representation of the attribute value . * @ param name name of the attribute * @ param value list of child attribute values of the attribute within the environment * @ return internal representation of the composite attribute value */ private static CompositeValue createCompositeValue ( final String name , final Collection < ? extends ParsedAttribute < ? > > value ) { } }
final Map < String , Value > map = new HashMap < > ( value . size ( ) ) ; for ( final ParsedAttribute < ? > attr : value ) { map . put ( attr . getName ( ) , attr . getValue ( ) ) ; } return new CompositeValue ( name , map ) ;
public class ServerRequestQueue { /** * < p > Gets the queued { @ link ServerRequest } object at position with index specified in the supplied * parameter , within the queue . Like { @ link # peek ( ) } , the item is not removed from the queue . < / p > * @ param index An { @ link Integer } that specifies the position within the queue from which to * pull the { @ link ServerRequest } object . * @ return The { @ link ServerRequest } object at the specified index . Returns null if no * request exists at that position , or if the index supplied is not valid , for * instance if { @ link # getSize ( ) } is 6 and index 6 is called . */ ServerRequest peekAt ( int index ) { } }
ServerRequest req = null ; synchronized ( reqQueueLockObject ) { try { req = queue . get ( index ) ; } catch ( IndexOutOfBoundsException | NoSuchElementException ignored ) { } } return req ;
public class Field { /** * Returns true if this message is generated by parser as a * holder for a map entries . */ public boolean isMap ( ) { } }
if ( type instanceof Message ) { Message message = ( Message ) type ; return message . isMapEntry ( ) ; } return false ;
public class CmsJspElFunctions { /** * Returns an OpenCms user context created from an Object . < p > * < ul > * < li > If the input is already a { @ link CmsObject } , it is casted and returned unchanged . * < li > If the input is a { @ link ServletRequest } , the OpenCms user context is read from the request context . * < li > If the input is a { @ link PageContext } , the OpenCms user context is read from the request of the page context . * < li > Otherwise the input is converted to a String which should be a user name , and creation of a OpenCms * user context with this name is attempted . Please note that this will only work if the user name is * either the " Guest " user or the " Export " user . * < li > If no valid OpenCms user context could be created with all of the above , then a new user context for * the " Guest " user is created . * < / ul > * @ param input the input to create an OpenCms user context from * @ return an OpenCms user context created from an Object */ public static CmsObject convertCmsObject ( Object input ) { } }
CmsObject result ; if ( input instanceof CmsObject ) { result = ( CmsObject ) input ; } else if ( input instanceof ServletRequest ) { result = CmsFlexController . getCmsObject ( ( ServletRequest ) input ) ; } else if ( input instanceof PageContext ) { result = CmsFlexController . getCmsObject ( ( ( PageContext ) input ) . getRequest ( ) ) ; } else { try { // try to use the given name as user name result = OpenCms . initCmsObject ( String . valueOf ( input ) ) ; // try to set the right site root ServletRequest req = convertRequest ( input ) ; if ( req instanceof HttpServletRequest ) { result . getRequestContext ( ) . setSiteRoot ( OpenCms . getSiteManager ( ) . matchRequest ( ( HttpServletRequest ) req ) . getSiteRoot ( ) ) ; } } catch ( CmsException e ) { LOG . warn ( e . getLocalizedMessage ( ) , e ) ; result = null ; } } if ( result == null ) { try { result = OpenCms . initCmsObject ( OpenCms . getDefaultUsers ( ) . getUserGuest ( ) ) ; // try to set the right site root ServletRequest req = convertRequest ( input ) ; if ( req instanceof HttpServletRequest ) { result . getRequestContext ( ) . setSiteRoot ( OpenCms . getSiteManager ( ) . matchRequest ( ( HttpServletRequest ) req ) . getSiteRoot ( ) ) ; } } catch ( CmsException e1 ) { // this should never fail since we can always create a " Guest " user } } return result ;
public class Descriptor { /** * Replace all the service calls provided by this descriptor with the the given service calls . * @ param calls The calls to replace the existing ones with . * @ return A copy of this descriptor with the new calls . */ public Descriptor replaceAllCalls ( PSequence < Call < ? , ? > > calls ) { } }
return new Descriptor ( name , calls , pathParamSerializers , messageSerializers , serializerFactory , exceptionSerializer , autoAcl , acls , headerFilter , locatableService , circuitBreaker , topicCalls ) ;
public class DateContext { /** * Check if all values in the given data are valid and that the result will * be a valid date . * @ param month The month ( 1-12) * @ param day The day ( 1-31) * @ param year The year ( 4 - digit ) * @ param hour The hour ( 0-23) * @ param minute The minutes ( 0-59) * @ param second The seconds ( 0-59) * @ param millisecond The milliseconds ( 0-999) * @ return < code > true < / code > if all data represents a valid date , * < code > false < / code > otherwise */ public boolean isValidDate ( String month , String day , String year , String hour , String minute , String second , String millisecond ) { } }
boolean valid = true ; try { valid = isValidDate ( Integer . parseInt ( month ) , Integer . parseInt ( day ) , Integer . parseInt ( year ) , Integer . parseInt ( hour ) , Integer . parseInt ( minute ) , Integer . parseInt ( second ) , Integer . parseInt ( millisecond ) ) ; } catch ( NumberFormatException nfe ) { valid = false ; } return valid ;
public class SrvFieldShoppingCartWriterXml { /** * Write standard field of entity into a stream * ( writer - file or pass it through network ) . * @ param pAddParam additional params ( e . g . exclude fields set ) * @ param pField value * @ param pFieldName Field Name * @ param pWriter writer * @ throws Exception - an exception */ @ Override public final void write ( final Map < String , Object > pAddParam , final Object pField , final String pFieldName , final Writer pWriter ) throws Exception { } }
String fieldValue ; if ( pField == null ) { fieldValue = "NULL" ; } else { if ( Cart . class != pField . getClass ( ) ) { throw new ExceptionWithCode ( ExceptionWithCode . CONFIGURATION_MISTAKE , "It's wrong service to write that field: " + pField + "/" + pFieldName ) ; } fieldValue = ( ( Cart ) pField ) . getBuyer ( ) . getItsId ( ) . toString ( ) ; } pWriter . write ( " " + pFieldName + "=\"" + fieldValue + "\"\n" ) ;
public class ZipkinExporter { /** * Registers the { @ code ZipkinExporter } . * @ param spanExporter the instance of the { @ code SpanExporter } where this service is registered . */ @ VisibleForTesting static void register ( SpanExporter spanExporter , Handler handler ) { } }
ZipkinTraceExporter . register ( spanExporter , handler ) ;
public class PearClockSkin { /** * * * * * * Canvas * * * * * */ private void drawTicks ( ) { } }
double sinValue ; double cosValue ; double startAngle = 180 ; double angleStep = 360 / 240 + 0.5 ; Point2D center = new Point2D ( size * 0.5 , size * 0.5 ) ; Color hourTickMarkColor = clock . getHourTickMarkColor ( ) ; Color minuteTickMarkColor = clock . getMinuteTickMarkColor ( ) ; Color tickLabelColor = clock . getTickLabelColor ( ) ; boolean hourTickMarksVisible = clock . isHourTickMarksVisible ( ) ; boolean minuteTickMarksVisible = clock . isMinuteTickMarksVisible ( ) ; boolean tickLabelsVisible = clock . isTickLabelsVisible ( ) ; Font font = Fonts . robotoLight ( size * 0.084 ) ; tickCtx . clearRect ( 0 , 0 , size , size ) ; tickCtx . setLineCap ( StrokeLineCap . BUTT ) ; tickCtx . setFont ( font ) ; tickCtx . setLineWidth ( size * 0.005 ) ; for ( double angle = 0 , counter = 0 ; Double . compare ( counter , 239 ) <= 0 ; angle -= angleStep , counter ++ ) { sinValue = Math . sin ( Math . toRadians ( angle + startAngle ) ) ; cosValue = Math . cos ( Math . toRadians ( angle + startAngle ) ) ; Point2D innerPoint = new Point2D ( center . getX ( ) + size * 0.45866667 * sinValue , center . getY ( ) + size * 0.45866667 * cosValue ) ; Point2D innerMinutePoint = new Point2D ( center . getX ( ) + size * 0.47733333 * sinValue , center . getY ( ) + size * 0.47733333 * cosValue ) ; Point2D outerPoint = new Point2D ( center . getX ( ) + size * 0.5 * sinValue , center . getY ( ) + size * 0.5 * cosValue ) ; Point2D textPoint = new Point2D ( center . getX ( ) + size * 0.405 * sinValue , center . getY ( ) + size * 0.405 * cosValue ) ; if ( counter % 20 == 0 ) { tickCtx . setStroke ( hourTickMarkColor ) ; if ( hourTickMarksVisible ) { tickCtx . strokeLine ( innerPoint . getX ( ) , innerPoint . getY ( ) , outerPoint . getX ( ) , outerPoint . getY ( ) ) ; } else if ( minuteTickMarksVisible ) { tickCtx . strokeLine ( innerMinutePoint . getX ( ) , innerMinutePoint . getY ( ) , outerPoint . getX ( ) , outerPoint . getY ( ) ) ; } if ( tickLabelsVisible ) { tickCtx . save ( ) ; tickCtx . translate ( textPoint . getX ( ) , textPoint . getY ( ) ) ; Helper . rotateContextForText ( tickCtx , startAngle , angle , TickLabelOrientation . HORIZONTAL ) ; tickCtx . setTextAlign ( TextAlignment . CENTER ) ; tickCtx . setTextBaseline ( VPos . CENTER ) ; tickCtx . setFill ( tickLabelColor ) ; if ( counter == 0 ) { tickCtx . fillText ( "12" , 0 , 0 ) ; } else { tickCtx . fillText ( Integer . toString ( ( int ) ( counter / 20 ) ) , 0 , 0 ) ; } tickCtx . restore ( ) ; } } else if ( counter % 4 == 0 && minuteTickMarksVisible ) { tickCtx . setStroke ( minuteTickMarkColor ) ; tickCtx . strokeLine ( innerPoint . getX ( ) , innerPoint . getY ( ) , outerPoint . getX ( ) , outerPoint . getY ( ) ) ; } else if ( counter % 1 == 0 && minuteTickMarksVisible ) { tickCtx . setStroke ( minuteTickMarkColor ) ; tickCtx . strokeLine ( innerMinutePoint . getX ( ) , innerMinutePoint . getY ( ) , outerPoint . getX ( ) , outerPoint . getY ( ) ) ; } }
public class NotifierBase { /** * Display dynamically an Ui model . < br > * This method is called from the JIT ( JRebirth Internal Thread ) < br > * Creates the model and its root node . < br > * Then attach it according to the placeholder defined into the wave : < br > * < ul > * < li > JRebirthWaves . ATTACH _ UI _ NODE _ PLACEHOLDER : to replace a property node by the model ' s root node < / li > * < li > JRebirthWaves . ADD _ UI _ CHILDREN _ PLACEHOLDER : to add the model ' s root node into a children list < / li > * < / ul > * @ param wave the wave that contains all informations */ @ SuppressWarnings ( "unchecked" ) private void displayUi ( final Wave wave ) { } }
if ( wave . componentClass ( ) == null ) { LOGGER . error ( MODEL_NOT_FOUND_ERROR , wave . toString ( ) ) ; // When developer mode is activated an error will be thrown by logger // Otherwise the wave will be managed by UnprocessedWaveHandler this . unprocessedWaveHandler . manageUnprocessedWave ( MODEL_NOT_FOUND_MESSAGE . getText ( ) , wave ) ; } else { // This key method could be managed in another way ( fully sync with JAT ) , to see if it could be useful final DisplayModelWaveBean displayModelWaveBean = DisplayModelWaveBean . create ( ) ; if ( wave . contains ( JRebirthWaves . KEY_PARTS ) ) { displayModelWaveBean . showModelKey ( ( UniqueKey < Model > ) Key . create ( wave . componentClass ( ) , wave . get ( JRebirthWaves . KEY_PARTS ) . toArray ( ) ) ) ; } else { displayModelWaveBean . showModelKey ( ( UniqueKey < Model > ) Key . create ( wave . componentClass ( ) ) ) ; } if ( wave . contains ( JRebirthWaves . ATTACH_UI_NODE_PLACEHOLDER ) ) { // Add the Ui view into the place holder provided displayModelWaveBean . uniquePlaceHolder ( wave . get ( JRebirthWaves . ATTACH_UI_NODE_PLACEHOLDER ) ) ; } else if ( wave . contains ( JRebirthWaves . ADD_UI_CHILDREN_PLACEHOLDER ) ) { // Add the Ui view into the children list of its parent container displayModelWaveBean . childrenPlaceHolder ( wave . get ( JRebirthWaves . ADD_UI_CHILDREN_PLACEHOLDER ) ) ; } // Call the command that manage the display UI in 2 steps // 1 - Create the model into the Thread Pool // 2 - Attach it to the graphical tree model according to their placeholder type Class < ? extends Command > showModelCommandClass ; if ( wave . contains ( JRebirthWaves . SHOW_MODEL_COMMAND ) ) { showModelCommandClass = wave . getData ( JRebirthWaves . SHOW_MODEL_COMMAND ) . value ( ) ; } else { showModelCommandClass = ShowModelCommand . class ; } callCommand ( WBuilder . callCommand ( showModelCommandClass ) // Add all extra wave beans . waveBeanList ( wave . getData ( JRebirthWaves . EXTRA_WAVE_BEANS ) . value ( ) ) // Add also DisplayModel Wave Bean . waveBean ( displayModelWaveBean ) ) ; }
public class JQMList { /** * Ignores dividers , only counts JQMListItem bands . * @ return - logical index of this item among other items ( can be useful for matching / sync * between underlying data structure and UI in case of dynamic / multiple dividers * and JQMListItem ' s click handlers ) . */ public int findItemOnlyIdx ( JQMListItem item ) { } }
if ( item == null ) return - 1 ; List < JQMListItem > items = getItems ( ) ; if ( items == null ) return - 1 ; int i = items . indexOf ( item ) ; if ( i == - 1 ) return - 1 ; int j = 0 ; for ( JQMListItem k : items ) { if ( k == null ) continue ; if ( k == item ) return j ; j ++ ; } return - 1 ;
public class LocaleUtil { /** * Handles Locales that can be passed to tags as instances of String or Locale . * If the parameter is an instance of Locale , it is simply returned . * If the parameter is a String and is not empty , then it is parsed to a Locale * using { @ link LocaleUtil # parseLocale ( String ) } . * Otherwise null will be returned . * @ param stringOrLocale locale represented as an instance of Locale or as a String * @ return the locale represented by the parameter , or null if the parameter is undefined */ public static Locale parseLocaleAttributeValue ( Object stringOrLocale ) { } }
if ( stringOrLocale instanceof Locale ) { return ( Locale ) stringOrLocale ; } else if ( stringOrLocale instanceof String ) { String string = ( String ) stringOrLocale ; if ( string . length ( ) == 0 ) { return null ; } else { return parseLocale ( string . trim ( ) ) ; } } else { return null ; }
public class diff_match_patch { /** * Look through the patches and break up any which are longer than the * maximum limit of the match algorithm . Intended to be called only from * within patch _ apply . * @ param patches * LinkedList of Patch objects . */ public void patch_splitMax ( LinkedList < Patch > patches ) { } }
short patch_size = Match_MaxBits ; String precontext , postcontext ; Patch patch ; int start1 , start2 ; boolean empty ; Operation diff_type ; String diff_text ; ListIterator < Patch > pointer = patches . listIterator ( ) ; Patch bigpatch = pointer . hasNext ( ) ? pointer . next ( ) : null ; while ( bigpatch != null ) { if ( bigpatch . length1 <= Match_MaxBits ) { bigpatch = pointer . hasNext ( ) ? pointer . next ( ) : null ; continue ; } // Remove the big old patch . pointer . remove ( ) ; start1 = bigpatch . start1 ; start2 = bigpatch . start2 ; precontext = "" ; while ( ! bigpatch . diffs . isEmpty ( ) ) { // Create one of several smaller patches . patch = new Patch ( ) ; empty = true ; patch . start1 = start1 - precontext . length ( ) ; patch . start2 = start2 - precontext . length ( ) ; if ( precontext . length ( ) != 0 ) { patch . length1 = patch . length2 = precontext . length ( ) ; patch . diffs . add ( new Diff ( Operation . EQUAL , precontext ) ) ; } while ( ! bigpatch . diffs . isEmpty ( ) && patch . length1 < patch_size - Patch_Margin ) { diff_type = bigpatch . diffs . getFirst ( ) . operation ; diff_text = bigpatch . diffs . getFirst ( ) . text ; if ( diff_type == Operation . INSERT ) { // Insertions are harmless . patch . length2 += diff_text . length ( ) ; start2 += diff_text . length ( ) ; patch . diffs . addLast ( bigpatch . diffs . removeFirst ( ) ) ; empty = false ; } else if ( diff_type == Operation . DELETE && patch . diffs . size ( ) == 1 && patch . diffs . getFirst ( ) . operation == Operation . EQUAL && diff_text . length ( ) > 2 * patch_size ) { // This is a large deletion . Let it pass in one chunk . patch . length1 += diff_text . length ( ) ; start1 += diff_text . length ( ) ; empty = false ; patch . diffs . add ( new Diff ( diff_type , diff_text ) ) ; bigpatch . diffs . removeFirst ( ) ; } else { // Deletion or equality . Only take as much as we can // stomach . diff_text = diff_text . substring ( 0 , Math . min ( diff_text . length ( ) , patch_size - patch . length1 - Patch_Margin ) ) ; patch . length1 += diff_text . length ( ) ; start1 += diff_text . length ( ) ; if ( diff_type == Operation . EQUAL ) { patch . length2 += diff_text . length ( ) ; start2 += diff_text . length ( ) ; } else { empty = false ; } patch . diffs . add ( new Diff ( diff_type , diff_text ) ) ; if ( diff_text . equals ( bigpatch . diffs . getFirst ( ) . text ) ) { bigpatch . diffs . removeFirst ( ) ; } else { bigpatch . diffs . getFirst ( ) . text = bigpatch . diffs . getFirst ( ) . text . substring ( diff_text . length ( ) ) ; } } } // Compute the head context for the next patch . precontext = diff_text2 ( patch . diffs ) ; precontext = precontext . substring ( Math . max ( 0 , precontext . length ( ) - Patch_Margin ) ) ; // Append the end context for this patch . if ( diff_text1 ( bigpatch . diffs ) . length ( ) > Patch_Margin ) { postcontext = diff_text1 ( bigpatch . diffs ) . substring ( 0 , Patch_Margin ) ; } else { postcontext = diff_text1 ( bigpatch . diffs ) ; } if ( postcontext . length ( ) != 0 ) { patch . length1 += postcontext . length ( ) ; patch . length2 += postcontext . length ( ) ; if ( ! patch . diffs . isEmpty ( ) && patch . diffs . getLast ( ) . operation == Operation . EQUAL ) { patch . diffs . getLast ( ) . text += postcontext ; } else { patch . diffs . add ( new Diff ( Operation . EQUAL , postcontext ) ) ; } } if ( ! empty ) { pointer . add ( patch ) ; } } bigpatch = pointer . hasNext ( ) ? pointer . next ( ) : null ; }
public class MetricsUtil { /** * Utility method to return the named context . * If the desired context cannot be created for any reason , the exception * is logged , and a null context is returned . */ public static MetricsContext getContext ( String refName , String contextName ) { } }
MetricsContext metricsContext ; try { metricsContext = ContextFactory . getFactory ( ) . getContext ( refName , contextName ) ; if ( ! metricsContext . isMonitoring ( ) ) { metricsContext . startMonitoring ( ) ; } } catch ( Exception ex ) { LOG . error ( "Unable to create metrics context " + contextName , ex ) ; metricsContext = ContextFactory . getNullContext ( contextName ) ; } return metricsContext ;
public class DatePanel { /** * Refresh day btn tables */ @ SuppressWarnings ( "deprecation" ) private void refreshDayBtns ( ) { } }
remove ( daysPanel ) ; daysPanel = new JPanel ( ) ; daysPanel . removeAll ( ) ; daysPanel . setLayout ( new GridLayout ( 0 , 7 ) ) ; int displayYear = getDisplayYear ( ) ; int displayMonth = getDisplayMonth ( ) ; String [ ] days = getDays ( displayYear , displayMonth - 1 ) ; addDayHeadLabels ( ) ; Date d = picker . getDate ( ) ; Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; int currentYear = cal . get ( Calendar . YEAR ) ; int currentMonth = cal . get ( Calendar . MONTH ) ; int currentDay = cal . get ( Calendar . DAY_OF_MONTH ) ; /* * Add days label before 1st */ for ( Date it : getBeforeDays ( displayYear , displayMonth - 1 ) ) { JLabel label = new JLabel ( String . valueOf ( it . getDate ( ) ) ) ; label . setVerticalAlignment ( JLabel . CENTER ) ; label . setHorizontalAlignment ( JLabel . CENTER ) ; label . setEnabled ( false ) ; daysPanel . add ( label ) ; } for ( String it : days ) { DayBtn btn = new DayBtn ( it ) ; if ( displayYear == currentYear && displayMonth == currentMonth + 1 && currentDay == Integer . parseInt ( it ) ) { btn . setBackground ( Color . GRAY ) ; btn . clicked = true ; } dayBtns . add ( btn ) ; daysPanel . add ( btn ) ; } /* * Add days label after last day */ for ( Date it : getAfterDays ( displayYear , displayMonth - 1 ) ) { JLabel label = new JLabel ( String . valueOf ( it . getDate ( ) ) ) ; label . setVerticalAlignment ( JLabel . CENTER ) ; label . setHorizontalAlignment ( JLabel . CENTER ) ; daysPanel . add ( label ) ; label . setEnabled ( false ) ; } add ( daysPanel ) ; /* * Update ui */ updateUI ( ) ; if ( picker . getPopup ( ) != null ) { Method method ; try { method = Popup . class . getDeclaredMethod ( "pack" ) ; method . setAccessible ( true ) ; method . invoke ( picker . getPopup ( ) ) ; } catch ( Exception e ) { } }
public class HibernateAdapter { /** * Hibernate adapter initialization . Read Hibernate properties from configuration object and create the session * factory ; also configure connections pool . All properties from configuration object are passed as they are to * Hibernate session factory builder . * Scan and register mappings files in the configured package ( s ) . For Hibernate mappings there are * < code > mappings < / code > child elements into configuration object . There can be a not limited number of * < code > mappings < / code > elements but usually it is a single one . A mapping element has < code > package < / code > and * < code > files - pattern < / code > attributes . Files pattern is optional with default < code > * . hbm . xml < / code > . * @ param config configuration object , possible null . * @ throws ConfigException if configuration object is not well formed . * @ throws HibernateException if a property is not recognized by Hibernate session factory builder . */ public void config ( Config config ) throws ConfigException , HibernateException { } }
log . trace ( "config(Config)" ) ; // Hibernate configuration class is the session factory builder Configuration configuration = null ; // Hibernate configuration resource is not null if config parameter is null - for zero - config , or provided by config // parameter itself as attribute String configResource = config != null ? config . getAttribute ( "config" ) : DEFAULT_CONFIG ; if ( configResource != null ) { log . debug ( "Configure Hibernate from configuration resource |%s|." , configResource ) ; configuration = new Configuration ( ) ; configuration . configure ( configResource ) ; } else { // at this point config parameter is not null log . debug ( "Configure Hibernate from j(s)-lib configuration object." ) ; configuration = hibernateConfiguration ( config ) ; } String timeout = configuration . getProperty ( "hibernate.transaction.timeout" ) ; this . transactionTimeout = timeout != null ? Integer . parseInt ( timeout ) : 0 ; String driverClassName = configuration . getProperty ( "hibernate.connection.driver_class" ) ; if ( driverClassName == null ) { throw new ConfigException ( "Missing driver class, e.g. property name='hibernate.connection.driver_class' and value 'com.mysql.jdbc.Driver'" ) ; } log . debug ( "Load database driver |%s|." , driverClassName ) ; Classes . forName ( driverClassName ) ; log . debug ( "Create Hibernate session factory." ) ; sessionFactory = configuration . buildSessionFactory ( ) ;
public class SimpleTriggerBuilder { /** * Build the actual Trigger - - NOT intended to be invoked by end users , but will rather be invoked * by a TriggerBuilder which this ScheduleBuilder is given to . */ @ Override public OperableTrigger instantiate ( ) { } }
SimpleTriggerImpl st = new SimpleTriggerImpl ( ) ; st . setRepeatInterval ( interval ) ; st . setRepeatCount ( repeatCount ) ; st . setMisfireInstruction ( misfireInstruction ) ; return st ;
public class KenBurnsView { /** * Fires an end event on { @ link # mTransitionListener } ; * @ param transition the transition that just ended . */ private void fireTransitionEnd ( Transition transition ) { } }
if ( mTransitionListener != null && transition != null ) { mTransitionListener . onTransitionEnd ( transition ) ; }
public class ModelsImpl { /** * Updates one of the closed list ' s sublists . * @ param appId The application ID . * @ param versionId The version ID . * @ param clEntityId The closed list entity extractor ID . * @ param subListId The sublist ID . * @ param wordListBaseUpdateObject A sublist update object containing the new canonical form and the list of words . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the OperationStatus object */ public Observable < OperationStatus > updateSubListAsync ( UUID appId , String versionId , UUID clEntityId , int subListId , WordListBaseUpdateObject wordListBaseUpdateObject ) { } }
return updateSubListWithServiceResponseAsync ( appId , versionId , clEntityId , subListId , wordListBaseUpdateObject ) . map ( new Func1 < ServiceResponse < OperationStatus > , OperationStatus > ( ) { @ Override public OperationStatus call ( ServiceResponse < OperationStatus > response ) { return response . body ( ) ; } } ) ;
public class NumberMap { /** * Creates a NumberMap for Longs . * @ param < K > * @ return NumberMap < K > */ public static < K > NumberMap < K , Long > newLongMap ( ) { } }
return new NumberMap < K , Long > ( ) { @ Override public void add ( K key , Long addend ) { put ( key , containsKey ( key ) ? ( get ( key ) + addend ) : addend ) ; } @ Override public void sub ( K key , Long subtrahend ) { put ( key , ( containsKey ( key ) ? get ( key ) : 0l ) - subtrahend ) ; } } ;
public class ImageMiscOps { /** * Inserts a single band into a multi - band image overwriting the original band * @ param input Single band image * @ param band Which band the image is to be inserted into * @ param output The multi - band image which the input image is to be inserted into */ public static void insertBand ( GrayF32 input , int band , InterleavedF32 output ) { } }
final int numBands = output . numBands ; for ( int y = 0 ; y < input . height ; y ++ ) { int indexIn = input . getStartIndex ( ) + y * input . getStride ( ) ; int indexOut = output . getStartIndex ( ) + y * output . getStride ( ) + band ; int end = indexOut + output . width * numBands - band ; for ( ; indexOut < end ; indexOut += numBands , indexIn ++ ) { output . data [ indexOut ] = input . data [ indexIn ] ; } }
public class RecoveryManager { /** * Informs the RecoveryManager that the transaction service is being shut * down . * The shutdown method can be driven in one of two ways : - * 1 . Real server shutdown . The TxServiceImpl . destroy method runs through * all its FailureScopeControllers and calls shutdown on them . This in * turn directs the associated RecoveryManagers to shutdown . * 2 . Peer recovery termination . The Recovery Log Service has directed the * transactions RecoveryAgent ( TxServiceImpl again ) to terminateRecovery * for the associated failure scope . TxServiceImpl directs the * corrisponding FailureScopeController to shutdown and again this directs * the associated RecoveryManager to shutdown ( on its own this time others * stay running ) * For immediate shutdown , * For quiesce , * YOU MUST HAVE CALLED " prepareToShutdown " BEFORE MAKING THIS CALL . THIS IS * REQUIRED IN ORDER THAT RECOVERY PROCESSING IS STOPPED BEFORE DRIVING * THE SHUTDOWN LOGIC . * @ param immediate Indicates whether to stop immediately . */ public void preShutdown ( boolean transactionsLeft ) throws Exception /* @ PK31789C */ { } }
if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "preShutdown" , transactionsLeft ) ; try { // Terminate partner log activity getPartnerLogTable ( ) . terminate ( ) ; // 172471 // If the tranlog is null then we ' re using in memory logging and // the work the shutdown the log is not required . if ( _tranLog != null ) { // Check if any transactions still active . . . if ( ! transactionsLeft ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "There is no transaction data requiring future recovery" ) ; if ( _tranlogServiceData != null ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Erasing service data from transaction log" ) ; // transactions stopped running now try { _tranLog . removeRecoverableUnit ( _tranlogServiceData . identity ( ) ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.tx.jta.impl.RecoveryManager.preShutdown" , "359" , this ) ; Tr . error ( tc , "WTRN0029_ERROR_CLOSE_LOG_IN_SHUTDOWN" ) ; throw e ; /* @ PK31789A */ } } else { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "No service data to erase from transaction log" ) ; } } else if ( _tranlogServiceData != null ) // Only update epoch if there is data in the log - d671043 { // Force the tranlog by rewriting the epoch in the servicedata . This will ensure // any previous completed transactions will have their end - records forced . Then // it is safe to remove partner log records . Otherwise , we can get into the state // of recovering completed txns that are still in - doubt in the txn log but have // no partner log entries as we ' ve cleaned them up . We can add code to cope with // this but it gets very messy especially if recovery / shutdown keeps repeating // itself - we need to check for NPE at every partner log check . if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "There is transaction data requiring future recovery. Updating epoch" ) ; if ( _failureScopeController . localFailureScope ( ) || ( _tranlogServiceData != null && _tranlogEpochSection != null ) ) { try { _tranlogEpochSection . addData ( Util . intToBytes ( _ourEpoch ) ) ; _tranlogServiceData . forceSections ( ) ; } catch ( Exception e ) { // We were unable to force the tranlog , so just return as if we had crashed // ( or did an immediate shutdown ) and we will recover everything at the next restart . FFDCFilter . processException ( e , "com.ibm.tx.jta.impl.RecoveryManager.preShutdown" , "608" , this ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Exception raised forcing tranlog at shutdown" , e ) ; throw e ; /* @ PK31789C */ } } else { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "No service data to update in transaction log" ) ; } } } } finally { // If this is a peer server , or a local server where there are no transactions left running // then close the log . In the case of the local failure scope , we are unable to close the log if // there are transactions running as this shutdown represents the real server shutdown and // transactions may still attempt to write to the recovery log . If we close the log now in this // situation , server shutdown will be peppered with LogClosedException errors . Needs refinement . if ( _tranLog != null && ( ( ! _failureScopeController . localFailureScope ( ) ) || ( ! transactionsLeft ) ) ) { try { _tranLog . closeLog ( ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.tx.jta.impl.RecoveryManager.preShutdown" , "360" , this ) ; Tr . error ( tc , "WTRN0029_ERROR_CLOSE_LOG_IN_SHUTDOWN" ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "preShutdown" ) ; throw e ; /* @ PK31789A */ } } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "preShutdown" ) ; }
public class ManagedCompletableFuture { /** * Because CompletableFuture . supplyAsync is static , this is not a true override . * It will be difficult for the user to invoke this method because they would need to get the class * of the CompletableFuture implementation and locate the static supplyAsync method on that . * @ throws UnsupportedOperationException directing the user to use the ManagedExecutor spec interface instead . */ @ Trivial public static < U > CompletableFuture < U > supplyAsync ( Supplier < U > action ) { } }
throw new UnsupportedOperationException ( Tr . formatMessage ( tc , "CWWKC1156.not.supported" , "ManagedExecutor.supplyAsync" ) ) ;
public class DescribeSecurityGroupReferencesRequest { /** * The IDs of the security groups in your account . * @ return The IDs of the security groups in your account . */ public java . util . List < String > getGroupId ( ) { } }
if ( groupId == null ) { groupId = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return groupId ;
public class JTune { /** * apply stemming policy to an element */ private void applyStemmingPolicy ( JScoreElementAbstract element ) { } }
if ( element != null && element instanceof JStemmableElement ) { JStemmableElement stemmable = ( JStemmableElement ) element ; if ( stemmable . isFollowingStemmingPolicy ( ) ) { byte noteStemPolicy = ( byte ) getTemplate ( ) . getAttributeNumber ( ScoreAttribute . NOTE_STEM_POLICY ) ; if ( noteStemPolicy == STEMS_AUTO ) { stemmable . setAutoStem ( true ) ; } else { boolean isup = ( noteStemPolicy == STEMS_UP ) ; stemmable . setAutoStem ( false ) ; stemmable . setStemUp ( isup ) ; } } // if element N is up , element N - 1 is middle staff , // and N - 2 is up too , then set N - 1 up // e . g . : in G clef A B A ( B is up ) , c B c ( B is down ) int count = currentStaffLine . countElement ( ) ; if ( stemmable . isStemUp ( ) && ( count >= 2 ) ) { Vector staffElements = currentStaffLine . getStaffElements ( ) ; JScoreElement N1 = ( JScoreElement ) staffElements . get ( count - 2 ) ; JScoreElement N2 = ( JScoreElement ) staffElements . get ( count - 3 ) ; if ( ( N1 instanceof JStemmableElement ) && ( N1 instanceof JNote ) && ( ( ( JStemmableElement ) N1 ) . isFollowingStemmingPolicy ( ) ) && ( N2 instanceof JStemmableElement ) && ! ( ( JStemmableElement ) N1 ) . isStemUp ( ) && ( ( JStemmableElement ) N2 ) . isStemUp ( ) ) { Note n = ( Note ) N1 . getMusicElement ( ) ; if ( n . getHeight ( ) == ( ( JNote ) N1 ) . getClef ( ) . getMiddleNote ( ) . getHeight ( ) ) { ( ( JStemmableElement ) N1 ) . setAutoStem ( false ) ; ( ( JStemmableElement ) N1 ) . setStemUp ( true ) ; } } } // grace notes byte gracenoteStemPolicy = ( byte ) getTemplate ( ) . getAttributeNumber ( ScoreAttribute . GRACENOTE_STEM_POLICY ) ; if ( element instanceof JNoteElementAbstract ) { JNoteElementAbstract jnea = ( JNoteElementAbstract ) element ; if ( ( jnea . m_jGracenotes != null ) && ( jnea . m_jGracenotes instanceof JStemmableElement ) ) { JStemmableElement stemmableGN = ( JStemmableElement ) jnea . m_jGracenotes ; if ( gracenoteStemPolicy == STEMS_AUTO ) { stemmableGN . setAutoStem ( true ) ; } else { boolean isup = ( gracenoteStemPolicy == STEMS_UP ) ; stemmableGN . setAutoStem ( false ) ; stemmableGN . setStemUp ( isup ) ; } } } else if ( element instanceof JGroupOfNotes ) { JGroupOfNotes jgon = ( JGroupOfNotes ) element ; for ( int i = 0 ; i < jgon . m_jNotes . length ; i ++ ) { JNoteElementAbstract jnea = ( JNoteElementAbstract ) jgon . m_jNotes [ i ] ; if ( jnea . m_jGracenotes != null ) { JStemmableElement stemmableGN = ( JStemmableElement ) jnea . m_jGracenotes ; if ( gracenoteStemPolicy == STEMS_AUTO ) { stemmableGN . setAutoStem ( true ) ; } else { boolean isup = ( gracenoteStemPolicy == STEMS_UP ) ; stemmableGN . setAutoStem ( false ) ; stemmableGN . setStemUp ( isup ) ; } } } } }
public class ClassLoaderUtil { /** * Load a given resource . * This method will try to load the resource using the following methods ( in * order ) : * < ul > * < li > From Thread . currentThread ( ) . getContextClassLoader ( ) * < li > From ClassLoaderUtil . class . getClassLoader ( ) * < li > callingClass . getClassLoader ( ) * < / ul > * @ param resourceName * The name IllegalStateException ( " Unable to call " ) of the * resource to load * @ param callingClass * The Class object of the calling object * @ return Matching resouce or null if not found */ public static URL getResource ( String resourceName , Class < ? > callingClass ) { } }
URL url = Thread . currentThread ( ) . getContextClassLoader ( ) . getResource ( resourceName ) ; if ( url == null ) { url = ClassLoaderUtil . class . getClassLoader ( ) . getResource ( resourceName ) ; } if ( url == null ) { ClassLoader cl = callingClass . getClassLoader ( ) ; if ( cl != null ) { url = cl . getResource ( resourceName ) ; } } if ( ( url == null ) && ( resourceName != null ) && ( ( resourceName . length ( ) == 0 ) || ( resourceName . charAt ( 0 ) != '/' ) ) ) { return getResource ( '/' + resourceName , callingClass ) ; } return url ;
public class TypeUtil { /** * JDK 5.0 has a bug of creating { @ link GenericArrayType } where it shouldn ' t . * fix that manually to work around the problem . * See bug 6202725. */ private static Type fix ( Type t ) { } }
if ( ! ( t instanceof GenericArrayType ) ) return t ; GenericArrayType gat = ( GenericArrayType ) t ; if ( gat . getGenericComponentType ( ) instanceof Class ) { Class c = ( Class ) gat . getGenericComponentType ( ) ; return Array . newInstance ( c , 0 ) . getClass ( ) ; } return t ;
public class CmsJspInstanceDateBean { /** * Returns a flag , indicating if the current event is a multi - day event . * The method is only called if the single event has an explicitely set end date * or an explicitely changed whole day option . * @ return a flag , indicating if the current event takes lasts over more than one day . */ private boolean isSingleMultiDay ( ) { } }
long duration = getEnd ( ) . getTime ( ) - getStart ( ) . getTime ( ) ; if ( duration > I_CmsSerialDateValue . DAY_IN_MILLIS ) { return true ; } if ( isWholeDay ( ) && ( duration <= I_CmsSerialDateValue . DAY_IN_MILLIS ) ) { return false ; } Calendar start = new GregorianCalendar ( ) ; start . setTime ( getStart ( ) ) ; Calendar end = new GregorianCalendar ( ) ; end . setTime ( getEnd ( ) ) ; if ( start . get ( Calendar . DAY_OF_MONTH ) == end . get ( Calendar . DAY_OF_MONTH ) ) { return false ; } return true ;
public class HttpOutboundServiceContextImpl { /** * Method to start an asynchronous read for the first response message on * this exchange . It must be only called once per request / response . This * contains the logic to handle request verification , read - ahead handling , * etc . * @ return VirtualConnection */ protected VirtualConnection startResponseRead ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "startResponseRead" ) ; } HttpInvalidMessageException inv = checkRequestValidity ( ) ; if ( null != inv ) { getAppWriteCallback ( ) . error ( getVC ( ) , inv ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "startResponseRead: error" ) ; } return null ; } // check whether read - ahead is enabled . Bypass this code once the // init ( ) method has been called ( d264854 ) and continue as normal if ( isReadAheadEnabled ( ) && READ_STATE_TIME_RESET != getReadState ( ) ) { // read ahead is active int state = CALLBACK_STATE_IDLE ; // grab the read - ahead states in a sync block to avoid timing windows // with the callback kicking in at the same time synchronized ( this . stateSyncObject ) { state = getCallbackState ( ) ; setReadState ( READ_STATE_ASYNC ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Async response read, callback state: " + state ) ; } switch ( state ) { case ( CALLBACK_STATE_COMPLETE ) : // read - ahead has already completed successfully , start the // parse logic now readAsyncResponse ( ) ; break ; case ( CALLBACK_STATE_ERROR ) : // read - ahead already hit an error , trigger that path now setPersistent ( false ) ; reConnect ( getVC ( ) , this . readException ) ; break ; case ( CALLBACK_STATE_PENDING ) : // read - ahead is still going on break ; default : if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Unexpected state (" + state + ") during async readahead" ) ; } setPersistent ( false ) ; reConnect ( getVC ( ) , new IOException ( "Read-ahead state failure" ) ) ; break ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "startResponseRead: read-ahead" ) ; } return null ; } // When we get here , then the final write of the request has finished // and we need to tell the app channel of that IF the temp response // reads have been triggered . We will not read for a response here as // the app channel is using readNextResponse ( ) for that path . // LI4335 - early reads also avoid starting read here if ( this . bEarlyReads || this . bTempResponsesUsed ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "startResponseRead: temp resp env" ) ; } getAppWriteCallback ( ) . complete ( getVC ( ) ) ; return null ; } // otherwise start the read for the response now . . . getResponseImpl ( ) ; readAsyncResponse ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "startResponseRead" ) ; } return null ;
public class Props { /** * Return value if available in current Props otherwise return from parent */ public String get ( final Object key ) { } }
if ( this . _current . containsKey ( key ) ) { return this . _current . get ( key ) ; } else if ( this . _parent != null ) { return this . _parent . get ( key ) ; } else { return null ; }
public class PresenceSubscriber { /** * This method removes this buddy from the SipPhone buddy list and initiates a SUBSCRIBE / NOTIFY * sequence to terminate the subscription unless the subscription is already terminated . * Regardless , this buddy is taken out of the active buddy list and put into the retired buddy * list ( which is a list of PresenceSubscriber objects of buddies that have been removed from the * buddy list and PresenceSubscriber objects for individual fetch operations that have been done ) . * A retired buddy ' s PresenceSubscriber object continues to be valid and accessible via * SipPhone . getBuddyInfo ( ) . * If the subscription is active when this method is called , this method creates a SUBSCRIBE * request message based on the parameters passed in , sends out the request , and waits for a * response to be received . It saves the received response and checks for a " proceedable " * ( positive ) status code value . Positive response status codes include any of the following : * provisional ( status / 100 = = 1 ) , UNAUTHORIZED , PROXY _ AUTHENTICATION _ REQUIRED , OK and ACCEPTED . * Any other status code , or a response timeout or any other error , is considered fatal to the * unsubscribe operation . * This method blocks until one of the above outcomes is reached . * If this method returns true , it means a positive response was received or the unsubscribe * sequence was not required . In order for you to know which is the case ( and whether or not to * proceed forward with the SUBSCRIBE / NOTIFY sequence processing ) , call isRemovalComplete ( ) . It * will tell you if an unsubscribe sequence was initiated or not . If not , you are done . Otherwise * you can find out about the positive response by calling this object ' s getReturnCode ( ) and / or * getCurrentResponse ( ) or getLastReceivedResponse ( ) methods . Your next step will be to call the * processResponse ( ) method to proceed with the unsubscribe sequence . See the processResponse ( ) * javadoc for more details . * If this method returns false , it means the unsubscribe operation was required and it failed . * Call the usual SipUnit failed - operation methods to find out what happened ( ie , * getErrorMessage ( ) , getReturnCode ( ) , and / or getException ( ) methods ) . The getReturnCode ( ) method * will tell you the response status code that was received from the network ( unless it is an * internal SipUnit error code , see the SipSession javadoc for more on that ) . * @ param eventId the event " id " to use in the SUBSCRIBE message , or null for no event " id " * parameter . Whatever is indicated here will be used subsequently , for error checking the * unSUBSCRIBE response and NOTIFY from the server . * @ param timeout The maximum amount of time to wait for a SUBSCRIBE response , in milliseconds . * Use a value of 0 to wait indefinitely . * @ return true if the unsubscribe operation is successful so far or wasn ' t needed , false * otherwise . See more details above . In either case , the buddy is removed from the buddy * list . */ public boolean removeBuddy ( String eventId , long timeout ) { } }
if ( parent . getBuddyList ( ) . get ( targetUri ) == null ) { setReturnCode ( SipSession . INVALID_ARGUMENT ) ; setErrorMessage ( "Buddy removal for URI " + targetUri + " failed, not found in buddy list." ) ; return false ; } Request req = createSubscribeMessage ( 0 , eventId ) ; if ( req == null ) { return false ; } return removeBuddy ( req , timeout ) ;
public class CardNumberEditText { /** * Updates the selection index based on the current ( pre - edit ) index , and * the size change of the number being input . * @ param newLength the post - edit length of the string * @ param editActionStart the position in the string at which the edit action starts * @ param editActionAddition the number of new characters going into the string ( zero for * delete ) * @ return an index within the string at which to put the cursor */ @ VisibleForTesting int updateSelectionIndex ( int newLength , int editActionStart , int editActionAddition ) { } }
int newPosition , gapsJumped = 0 ; Set < Integer > gapSet = Card . AMERICAN_EXPRESS . equals ( mCardBrand ) ? SPACE_SET_AMEX : SPACE_SET_COMMON ; boolean skipBack = false ; for ( Integer gap : gapSet ) { if ( editActionStart <= gap && editActionStart + editActionAddition > gap ) { gapsJumped ++ ; } // editActionAddition can only be 0 if we are deleting , // so we need to check whether or not to skip backwards one space if ( editActionAddition == 0 && editActionStart == gap + 1 ) { skipBack = true ; } } newPosition = editActionStart + editActionAddition + gapsJumped ; if ( skipBack && newPosition > 0 ) { newPosition -- ; } return newPosition <= newLength ? newPosition : newLength ;
public class FilenameUtil { /** * Determines whether the { @ code parent } directory contains the { @ code child } element ( a file or directory ) . * The files names are expected to be normalized . * Edge cases : * < ul > * < li > A { @ code directory } must not be null : if null , throw IllegalArgumentException < / li > * < li > A directory does not contain itself : return false < / li > * < li > A null child file is not contained in any parent : return false < / li > * < / ul > * @ param canonicalParent * the file to consider as the parent . * @ param canonicalChild * the file to consider as the child . * @ return true is the candidate leaf is under by the specified composite . False otherwise . * @ throws IOException * if an IO error occurs while checking the files . * @ since 2.2 */ public static boolean directoryContains ( final String canonicalParent , final String canonicalChild ) throws IOException { } }
// Fail fast against NullPointerException if ( canonicalParent == null ) { throw new IllegalArgumentException ( "Directory must not be null" ) ; } if ( canonicalChild == null ) { return false ; } if ( IOCase . SYSTEM . checkEquals ( canonicalParent , canonicalChild ) ) { return false ; } return IOCase . SYSTEM . checkStartsWith ( canonicalChild , canonicalParent ) ;
public class Parameter { /** * サブパラメータを生成する 。 パラメータ値がBeanの場合 、 プロパティ名に対応するフィールド値をパラメータ値とする サブパラメータを作成して返す 。 * @ param propertyName プロパティ名 * @ return パラメータ */ @ SuppressWarnings ( "rawtypes" ) public Parameter createSubParameter ( final String propertyName ) { } }
String subParameterName = parameterName + "." + propertyName ; Object subValue = null ; if ( value != null ) { if ( value instanceof Map ) { subValue = ( ( Map ) value ) . get ( propertyName ) ; if ( subValue == null ) { LOG . warn ( "Set subparameter value to NULL because property can not be accessed.[{}]" , subParameterName ) ; } } else { try { // フィールドアクセスで値の取得を実施 Field field = value . getClass ( ) . getDeclaredField ( propertyName ) ; field . setAccessible ( true ) ; subValue = field . get ( value ) ; } catch ( NoSuchFieldException e ) { // メソッドアクセスで値の取得を実施 try { String prefix = boolean . class . equals ( value . getClass ( ) ) ? "is" : "get" ; Method method = value . getClass ( ) . getMethod ( prefix + StringUtils . capitalize ( propertyName ) ) ; subValue = method . invoke ( value ) ; } catch ( Exception e2 ) { LOG . warn ( "Set subparameter value to NULL because property can not be accessed.[{}]" , subParameterName , e2 ) ; } } catch ( Exception e ) { LOG . warn ( "Set subparameter value to NULL because property can not be accessed.[{}]" , subParameterName , e ) ; } } } return new Parameter ( subParameterName , subValue ) ;
public class JavacState { /** * For all packages , find all sources belonging to the package , group the sources * based on their transformers and apply the transformers on each source code group . */ private boolean perform ( CompilationService sjavac , File outputDir , Map < String , Transformer > suffixRules ) { } }
boolean rc = true ; // Group sources based on transforms . A source file can only belong to a single transform . Map < Transformer , Map < String , Set < URI > > > groupedSources = new HashMap < > ( ) ; for ( Source src : now . sources ( ) . values ( ) ) { Transformer t = suffixRules . get ( src . suffix ( ) ) ; if ( t != null ) { if ( taintedPackages . contains ( src . pkg ( ) . name ( ) ) && ! src . isLinkedOnly ( ) ) { addFileToTransform ( groupedSources , t , src ) ; } } } // Go through the transforms and transform them . for ( Map . Entry < Transformer , Map < String , Set < URI > > > e : groupedSources . entrySet ( ) ) { Transformer t = e . getKey ( ) ; Map < String , Set < URI > > srcs = e . getValue ( ) ; // These maps need to be synchronized since multiple threads will be // writing results into them . Map < String , Set < URI > > packageArtifacts = Collections . synchronizedMap ( new HashMap < > ( ) ) ; Map < String , Map < String , Set < String > > > packageDependencies = Collections . synchronizedMap ( new HashMap < > ( ) ) ; Map < String , Map < String , Set < String > > > packageCpDependencies = Collections . synchronizedMap ( new HashMap < > ( ) ) ; Map < String , PubApi > packagePublicApis = Collections . synchronizedMap ( new HashMap < > ( ) ) ; Map < String , PubApi > dependencyPublicApis = Collections . synchronizedMap ( new HashMap < > ( ) ) ; boolean r = t . transform ( sjavac , srcs , visibleSrcs , prev . dependents ( ) , outputDir . toURI ( ) , packageArtifacts , packageDependencies , packageCpDependencies , packagePublicApis , dependencyPublicApis , 0 , isIncremental ( ) , numCores ) ; if ( ! r ) rc = false ; for ( String p : srcs . keySet ( ) ) { recompiledPackages . add ( p ) ; } // The transform is done ! Extract all the artifacts and store the info into the Package objects . for ( Map . Entry < String , Set < URI > > a : packageArtifacts . entrySet ( ) ) { Module mnow = now . findModuleFromPackageName ( a . getKey ( ) ) ; mnow . addArtifacts ( a . getKey ( ) , a . getValue ( ) ) ; } // Extract all the dependencies and store the info into the Package objects . for ( Map . Entry < String , Map < String , Set < String > > > a : packageDependencies . entrySet ( ) ) { Map < String , Set < String > > deps = a . getValue ( ) ; Module mnow = now . findModuleFromPackageName ( a . getKey ( ) ) ; mnow . setDependencies ( a . getKey ( ) , deps , false ) ; } for ( Map . Entry < String , Map < String , Set < String > > > a : packageCpDependencies . entrySet ( ) ) { Map < String , Set < String > > deps = a . getValue ( ) ; Module mnow = now . findModuleFromPackageName ( a . getKey ( ) ) ; mnow . setDependencies ( a . getKey ( ) , deps , true ) ; } // This map contains the public api of the types that this // compilation depended upon . This means that it may not contain // full packages . In other words , we shouldn ' t remove knowledge of // public apis but merge these with what we already have . for ( Map . Entry < String , PubApi > a : dependencyPublicApis . entrySet ( ) ) { String pkg = a . getKey ( ) ; PubApi packagePartialPubApi = a . getValue ( ) ; Package pkgNow = now . findModuleFromPackageName ( pkg ) . lookupPackage ( pkg ) ; PubApi currentPubApi = pkgNow . getPubApi ( ) ; PubApi newPubApi = PubApi . mergeTypes ( currentPubApi , packagePartialPubApi ) ; pkgNow . setPubapi ( newPubApi ) ; // See JDK - 8071904 if ( now . packages ( ) . containsKey ( pkg ) ) now . packages ( ) . get ( pkg ) . setPubapi ( newPubApi ) ; else now . packages ( ) . put ( pkg , pkgNow ) ; } // The packagePublicApis cover entire packages ( since sjavac compiles // stuff on package level ) . This means that if a type is missing // in the public api of a given package , it means that it has been // removed . In other words , we should * set * the pubapi to whatever // this map contains , and not merge it with what we already have . for ( Map . Entry < String , PubApi > a : packagePublicApis . entrySet ( ) ) { String pkg = a . getKey ( ) ; PubApi newPubApi = a . getValue ( ) ; Module mprev = prev . findModuleFromPackageName ( pkg ) ; Module mnow = now . findModuleFromPackageName ( pkg ) ; mnow . setPubapi ( pkg , newPubApi ) ; if ( mprev . hasPubapiChanged ( pkg , newPubApi ) ) { // Aha ! The pubapi of this package has changed ! // It can also be a new compile from scratch . if ( mprev . lookupPackage ( pkg ) . existsInJavacState ( ) ) { // This is an incremental compile ! The pubapi // did change . Trigger recompilation of dependents . packagesWithChangedPublicApis . add ( pkg ) ; Log . debug ( "The API of " + Util . justPackageName ( pkg ) + " has changed!" ) ; } } } } return rc ;
public class DeviceProxyDAODefaultImpl { public void write_attribute_reply ( final DeviceProxy deviceProxy , final int id ) throws DevFailed { } }
final Request request = ApiUtil . get_async_request ( id ) ; try { if ( deviceProxy . device_5 != null || deviceProxy . device_4 != null ) { check_asynch_reply ( deviceProxy , request , id , "write_attributes_4" ) ; } else if ( deviceProxy . device_3 != null ) { check_asynch_reply ( deviceProxy , request , id , "write_attributes_3" ) ; } else if ( deviceProxy . device_2 != null ) { check_asynch_reply ( deviceProxy , request , id , "write_attributes" ) ; } else { check_asynch_reply ( deviceProxy , request , id , "write_attributes" ) ; } } catch ( ConnectionFailed e ) { DeviceAttribute [ ] deviceAttributes ; try { // If failed , retrieve data from request object final NVList args = request . arguments ( ) ; final Any any = args . item ( 0 ) . value ( ) ; if ( deviceProxy . idl_version >= 4 ) { AttributeValue_4 [ ] attributeValues_4 = AttributeValueList_4Helper . extract ( any ) ; deviceAttributes = new DeviceAttribute [ attributeValues_4 . length ] ; for ( int i = 0 ; i < attributeValues_4 . length ; i ++ ) { deviceAttributes [ i ] = new DeviceAttribute ( attributeValues_4 [ i ] ) ; } } else if ( deviceProxy . idl_version >= 3 ) { AttributeValue [ ] attributeValues = AttributeValueListHelper . extract ( any ) ; deviceAttributes = new DeviceAttribute [ attributeValues . length ] ; for ( int i = 0 ; i < attributeValues . length ; i ++ ) { deviceAttributes [ i ] = new DeviceAttribute ( attributeValues [ i ] ) ; } } else throw e ; } catch ( org . omg . CORBA . Bounds e1 ) { System . err . println ( e1 ) ; throw e ; } // And do the synchronous write _ attributes deviceProxy . write_attribute ( deviceAttributes ) ; }
public class FactoryDerivative { /** * Filters for computing the gradient of { @ link Planar } images . * @ param type Which gradient to compute * @ param numBands Number of bands in the image * @ param inputType Type of data on input * @ param derivType Type of data on output ( null for default ) * @ param < I > Image type * @ param < D > Derivative type * @ return the filter */ public static < I extends ImageGray < I > , D extends ImageGray < D > > ImageGradient < Planar < I > , Planar < D > > gradientPL ( DerivativeType type , int numBands , Class < I > inputType , Class < D > derivType ) { } }
ImageGradient < I , D > g = gradientSB ( type , inputType , derivType ) ; return new ImageGradient_PL < > ( g , numBands ) ;
public class ImagesInner { /** * Gets an image . * @ param resourceGroupName The name of the resource group . * @ param imageName The name of the image . * @ param expand The expand expression to apply on the operation . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < ImageInner > getByResourceGroupAsync ( String resourceGroupName , String imageName , String expand , final ServiceCallback < ImageInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( getByResourceGroupWithServiceResponseAsync ( resourceGroupName , imageName , expand ) , serviceCallback ) ;
public class ClassWriter { /** * Adds a number or string constant to the constant pool of the class being * build . Does nothing if the constant pool already contains a similar item . * @ param cst * the value of the constant to be added to the constant pool . * This parameter must be an { @ link Integer } , a { @ link Float } , a * { @ link Long } , a { @ link Double } , a { @ link String } or a * { @ link Type } . * @ return a new or already existing constant item with the given value . */ Item newConstItem ( final Object cst ) { } }
if ( cst instanceof Integer ) { int val = ( ( Integer ) cst ) . intValue ( ) ; return newInteger ( val ) ; } else if ( cst instanceof Byte ) { int val = ( ( Byte ) cst ) . intValue ( ) ; return newInteger ( val ) ; } else if ( cst instanceof Character ) { int val = ( ( Character ) cst ) . charValue ( ) ; return newInteger ( val ) ; } else if ( cst instanceof Short ) { int val = ( ( Short ) cst ) . intValue ( ) ; return newInteger ( val ) ; } else if ( cst instanceof Boolean ) { int val = ( ( Boolean ) cst ) . booleanValue ( ) ? 1 : 0 ; return newInteger ( val ) ; } else if ( cst instanceof Float ) { float val = ( ( Float ) cst ) . floatValue ( ) ; return newFloat ( val ) ; } else if ( cst instanceof Long ) { long val = ( ( Long ) cst ) . longValue ( ) ; return newLong ( val ) ; } else if ( cst instanceof Double ) { double val = ( ( Double ) cst ) . doubleValue ( ) ; return newDouble ( val ) ; } else if ( cst instanceof String ) { return newStringishItem ( STR , ( String ) cst ) ; } else if ( cst instanceof Type ) { Type t = ( Type ) cst ; int s = t . getSort ( ) ; if ( s == Type . OBJECT ) { return newStringishItem ( CLASS , t . getInternalName ( ) ) ; } else if ( s == Type . METHOD ) { return newStringishItem ( MTYPE , t . getDescriptor ( ) ) ; } else { // s = = primitive type or array return newStringishItem ( CLASS , t . getDescriptor ( ) ) ; } } else if ( cst instanceof Handle ) { Handle h = ( Handle ) cst ; return newHandleItem ( h . tag , h . owner , h . name , h . desc , h . itf ) ; } else { throw new IllegalArgumentException ( "value " + cst ) ; }
public class Check { /** * Ensures that a passed map as a parameter of the calling method is not empty . * @ param array * a map which should not be empty * @ param name * name of object reference ( in source code ) * @ return the passed reference that is not empty * @ throws IllegalNullArgumentException * if the given argument { @ code array } is { @ code null } * @ throws IllegalEmptyArgumentException * if the given argument { @ code array } is empty */ @ ArgumentsChecked @ Throws ( { } }
IllegalNullArgumentException . class , IllegalEmptyArgumentException . class } ) public static < T > T [ ] notEmpty ( @ Nonnull final T [ ] array , @ Nullable final String name ) { notNull ( array ) ; notEmpty ( array , array . length == 0 , EMPTY_ARGUMENT_NAME ) ; return array ;
public class MutableRoaringBitmap { /** * If present remove the specified integer ( effectively , sets its bit value to false ) * @ param x integer value representing the index in a bitmap * @ return true if the unset bit was already in the bitmap */ public boolean checkedRemove ( final int x ) { } }
final short hb = BufferUtil . highbits ( x ) ; final int i = highLowContainer . getIndex ( hb ) ; if ( i < 0 ) { return false ; } MappeableContainer C = highLowContainer . getContainerAtIndex ( i ) ; int oldcard = C . getCardinality ( ) ; C . remove ( BufferUtil . lowbits ( x ) ) ; int newcard = C . getCardinality ( ) ; if ( newcard == oldcard ) { return false ; } if ( newcard > 0 ) { ( ( MutableRoaringArray ) highLowContainer ) . setContainerAtIndex ( i , C ) ; } else { ( ( MutableRoaringArray ) highLowContainer ) . removeAtIndex ( i ) ; } return true ;
public class Formatter { /** * Formats the description into a String using format specific tags . * @ param description description to be formatted * @ return string representation of the description */ public String format ( Description description ) { } }
for ( BlockElement blockElement : description . getBlocks ( ) ) { blockElement . format ( this ) ; } return finalizeFormatting ( ) ;
public class JvmTypeParameterImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setDeclarator ( JvmTypeParameterDeclarator newDeclarator ) { } }
if ( newDeclarator != eInternalContainer ( ) || ( eContainerFeatureID ( ) != TypesPackage . JVM_TYPE_PARAMETER__DECLARATOR && newDeclarator != null ) ) { if ( EcoreUtil . isAncestor ( this , newDeclarator ) ) throw new IllegalArgumentException ( "Recursive containment not allowed for " + toString ( ) ) ; NotificationChain msgs = null ; if ( eInternalContainer ( ) != null ) msgs = eBasicRemoveFromContainer ( msgs ) ; if ( newDeclarator != null ) msgs = ( ( InternalEObject ) newDeclarator ) . eInverseAdd ( this , TypesPackage . JVM_TYPE_PARAMETER_DECLARATOR__TYPE_PARAMETERS , JvmTypeParameterDeclarator . class , msgs ) ; msgs = basicSetDeclarator ( newDeclarator , msgs ) ; if ( msgs != null ) msgs . dispatch ( ) ; } else if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , TypesPackage . JVM_TYPE_PARAMETER__DECLARATOR , newDeclarator , newDeclarator ) ) ;
public class UnorderedListPanel { /** * { @ inheritDoc } */ @ Override protected Component newListComponent ( final String id , final ListItem < ResourceBundleKey > item ) { } }
return ComponentFactory . newLabel ( id , ResourceModelFactory . newResourceModel ( item . getModel ( ) . getObject ( ) , this ) ) ;
public class XQuery { /** * Returns the text content of this node . * @ return this { @ link XQuery } node ' s text content , non recursively . */ public @ Nonnull String text ( ) { } }
return new NodeListSpliterator ( node . getChildNodes ( ) ) . stream ( ) . filter ( it -> it instanceof Text ) . map ( it -> ( ( Text ) it ) . getNodeValue ( ) ) . collect ( joining ( ) ) ;
public class IOUtils { /** * Write object to temp file which is destroyed when the program exits . * @ param o * object to be written to file * @ param filename * name of the temp file * @ throws IOException * If file cannot be written * @ return File containing the object */ public static File writeObjectToTempFile ( Object o , String filename ) throws IOException { } }
File file = File . createTempFile ( filename , ".tmp" ) ; file . deleteOnExit ( ) ; ObjectOutputStream oos = new ObjectOutputStream ( new BufferedOutputStream ( new GZIPOutputStream ( new FileOutputStream ( file ) ) ) ) ; oos . writeObject ( o ) ; oos . close ( ) ; return file ;
public class WebServer { /** * Start * @ exception Throwable If an error occurs */ public void start ( ) throws Throwable { } }
stop ( ) ; if ( executorService != null ) { server = new Server ( new ExecutorThreadPool ( executorService ) ) ; } else { server = new Server ( ) ; } MBeanContainer jmx = new MBeanContainer ( mbeanServer != null ? mbeanServer : ManagementFactory . getPlatformMBeanServer ( ) ) ; server . addBean ( jmx ) ; Configuration . ClassList classlist = Configuration . ClassList . setServerDefault ( server ) ; classlist . addBefore ( "org.eclipse.jetty.webapp.JettyWebXmlConfiguration" , "org.eclipse.jetty.annotations.AnnotationConfiguration" ) ; ServerConnector connector = new ServerConnector ( server ) ; connector . setHost ( host ) ; connector . setPort ( port ) ; connector . setAcceptQueueSize ( acceptQueueSize ) ; server . setConnectors ( new Connector [ ] { connector } ) ; log . info ( "Jetty " + Server . getVersion ( ) + " started" ) ;
public class SystemKeyspace { /** * Record tokens being used by another node */ public static synchronized void updateTokens ( InetAddress ep , Collection < Token > tokens ) { } }
if ( ep . equals ( FBUtilities . getBroadcastAddress ( ) ) ) { removeEndpoint ( ep ) ; return ; } String req = "INSERT INTO system.%s (peer, tokens) VALUES (?, ?)" ; executeInternal ( String . format ( req , PEERS_CF ) , ep , tokensAsSet ( tokens ) ) ;
public class StringBuilderFutureAppendable { /** * ( non - Javadoc ) * @ see java . util . concurrent . Future # get ( ) */ @ Override public CharSequence get ( ) throws ExecutionException { } }
try { this . futureBuilder . performAppends ( ) ; } catch ( IOException | HttpErrorPage e ) { throw new ExecutionException ( e ) ; } return this . builder . toString ( ) ;
public class ToPojo { /** * Returns the string representation of the code that reads an object property from a reference using a getter . * @ param ref The reference . * @ param source The type of the reference . * @ param property The property to read . * @ return The code . */ private static String readObjectProperty ( String ref , TypeDef source , Property property ) { } }
return ref + "." + getterOf ( source , property ) . getName ( ) + "()" ;
public class TimeUtils { /** * Creates a date string in the format specified for this instance of the class . * @ param date * @ return */ public String createDateString ( Date date ) { } }
if ( date == null ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Null Date object provided; returning null" ) ; } return null ; } if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Creating date string based on date: " + date ) ; } String formatted = simpleDateFormat . format ( date ) ; return formatted ;
public class FutureUtil { /** * Check if all futures are done * @ param futures the list of futures * @ return { @ code true } if all futures are done */ public static boolean allDone ( Collection < Future > futures ) { } }
for ( Future f : futures ) { if ( ! f . isDone ( ) ) { return false ; } } return true ;
public class GCMBaseIntentService { /** * Called from the broadcast receiver . * Will process the received intent , call handleMessage ( ) , registered ( ) , * etc . in background threads , with a wake lock , while keeping the service * alive . */ static void runIntentInService ( Context context , Intent intent , String className ) { } }
synchronized ( LOCK ) { if ( sWakeLock == null ) { // This is called from BroadcastReceiver , there is no init . PowerManager pm = ( PowerManager ) context . getSystemService ( Context . POWER_SERVICE ) ; sWakeLock = pm . newWakeLock ( PowerManager . PARTIAL_WAKE_LOCK , WAKELOCK_KEY ) ; } } Log . v ( TAG , "Acquiring wakelock" ) ; sWakeLock . acquire ( ) ; intent . setClassName ( context , className ) ; context . startService ( intent ) ;
public class RsWithCookie { /** * Build cookie string . * @ param name Cookie name * @ param value Value of it * @ param attrs Optional attributes , for example " Path = / " * @ return Text */ private static String make ( final CharSequence name , final CharSequence value , final CharSequence ... attrs ) { } }
final StringBuilder text = new StringBuilder ( String . format ( "%s=%s;" , name , value ) ) ; for ( final CharSequence attr : attrs ) { text . append ( attr ) . append ( ';' ) ; } return text . toString ( ) ;
public class NamingCodecFactory { /** * Creates a codec only for registration . * @ param factory an identifier factory * @ return a codec */ static Codec < NamingMessage > createRegistryCodec ( final IdentifierFactory factory ) { } }
final Map < Class < ? extends NamingMessage > , Codec < ? extends NamingMessage > > clazzToCodecMap = new HashMap < > ( ) ; clazzToCodecMap . put ( NamingRegisterRequest . class , new NamingRegisterRequestCodec ( factory ) ) ; clazzToCodecMap . put ( NamingRegisterResponse . class , new NamingRegisterResponseCodec ( new NamingRegisterRequestCodec ( factory ) ) ) ; clazzToCodecMap . put ( NamingUnregisterRequest . class , new NamingUnregisterRequestCodec ( factory ) ) ; final Codec < NamingMessage > codec = new MultiCodec < > ( clazzToCodecMap ) ; return codec ;
public class HttpSimulatorConfig { /** * Configures the HttpSimulator running on the specified serverURL ( e . g . http : / / localhost : 8080 ) with the specified * root path and useRootRelativePath . * @ param rootPath the rootPath * @ param useRootRelativePath the useRootRelativePath * @ param serverURL the serverURL * @ throws IOException if something goes wrong */ public static void config ( String rootPath , boolean useRootRelativePath , String serverURL ) throws IOException { } }
HttpURLConnection con = null ; try { String urlString = new StringBuilder ( ) . append ( serverURL ) . append ( "/?" ) . append ( Constants . ROOT_PATH ) . append ( "=" ) . append ( rootPath ) . append ( "&" ) . append ( Constants . USE_ROOT_RELATIVE_PATH ) . append ( "=" ) . append ( String . valueOf ( useRootRelativePath ) ) . toString ( ) ; con = ( HttpURLConnection ) new URL ( urlString ) . openConnection ( ) ; con . setRequestMethod ( METHOD ) ; con . setReadTimeout ( READ_TIMEOUT ) ; con . getResponseCode ( ) ; } finally { con . disconnect ( ) ; }
public class UCharacterIterator { /** * Retreat to the start of the previous code point in the text , and return it ( pre - decrement semantics ) . If the * index is not preceeded by a valid surrogate pair , the behavior is the same as < code > previous ( ) < / code > . Otherwise * the iterator is decremented to the start of the surrogate pair , and the code point represented by the pair is * returned . * @ return the previous code point in the text , or DONE if the new index is before the start of the text . */ public int previousCodePoint ( ) { } }
int ch1 = previous ( ) ; if ( UTF16 . isTrailSurrogate ( ( char ) ch1 ) ) { int ch2 = previous ( ) ; if ( UTF16 . isLeadSurrogate ( ( char ) ch2 ) ) { return Character . toCodePoint ( ( char ) ch2 , ( char ) ch1 ) ; } else if ( ch2 != DONE ) { // unmatched trail surrogate so back out next ( ) ; } } return ch1 ;
public class ESFilterBuilder { /** * Gets the or filter builder . * @ param logicalExp * the logical exp * @ param m * the m * @ param entity * the entity * @ return the or filter builder */ private OrQueryBuilder getOrFilterBuilder ( Expression logicalExp , EntityMetadata m ) { } }
OrExpression orExp = ( OrExpression ) logicalExp ; Expression leftExpression = orExp . getLeftExpression ( ) ; Expression rightExpression = orExp . getRightExpression ( ) ; return new OrQueryBuilder ( populateFilterBuilder ( leftExpression , m ) , populateFilterBuilder ( rightExpression , m ) ) ;
public class JedisUtils { /** * Create a new { @ link JedisCluster } with default pool configs . * @ param hostsAndPorts * format { @ code host1 : port1 , host2 : port2 , . . . } , default Redis port is used if not * specified * @ param password * @ return */ public static JedisCluster newJedisCluster ( String hostsAndPorts , String password ) { } }
return newJedisCluster ( defaultJedisPoolConfig ( ) , hostsAndPorts , password ) ;
public class GeoShapeBase { /** * This is used to fix Kryo serialization issues with lists generated from methods such as * { @ link java . util . Arrays # asList ( Object [ ] ) } */ protected < T > List < ? extends List < T > > toArrayLists ( List < List < T > > lists ) { } }
for ( int i = 0 ; i < lists . size ( ) ; i ++ ) { List < T > list = lists . get ( i ) ; lists . set ( i , toArrayList ( list ) ) ; } return lists ;
public class TimestampStreamReader { /** * This comes from the Apache Hive ORC code */ private static int parseNanos ( long serialized ) { } }
int zeros = ( ( int ) serialized ) & 0b111 ; int result = ( int ) ( serialized >>> 3 ) ; if ( zeros != 0 ) { for ( int i = 0 ; i <= zeros ; ++ i ) { result *= 10 ; } } return result ;