signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class TasksBase { /** * Returns the compact task records for all tasks with the given tag .
* @ param tag The tag in which to search for tasks .
* @ return Request object */
public CollectionRequest < Task > findByTag ( String tag ) { } } | String path = String . format ( "/tags/%s/tasks" , tag ) ; return new CollectionRequest < Task > ( this , Task . class , path , "GET" ) ; |
public class InMemoryRegistry { /** * Gets an API by its unique identifying info ( orgid , id , version ) .
* @ param apiOrgId
* @ param apiId
* @ param apiVersion
* @ return an Api or null if not found */
private Api getApiInternal ( String apiOrgId , String apiId , String apiVersion ) { } } | String key = getApiIndex ( apiOrgId , apiId , apiVersion ) ; Api api ; synchronized ( mutex ) { api = ( Api ) getMap ( ) . get ( key ) ; } return api ; |
public class AbstractEquinoxCommandProvider { /** * Run command method
* @ param commandName command name
* @ param interpreter interpreter */
protected void runCommand ( String commandName , CommandInterpreter interpreter ) { } } | PrintWriter out = new PrintWriter ( new CommandInterpreterWriter ( interpreter ) ) ; String [ ] args = fetchCommandParams ( interpreter ) ; try { Method method = service . getClass ( ) . getMethod ( commandName , PrintWriter . class , String [ ] . class ) ; method . invoke ( service , out , args ) ; } catch ( NoSuchMethodException e ) { out . println ( "No such command: " + commandName ) ; } catch ( Exception e ) { LOG . log ( Level . WARNING , "Unable to execute command: " + commandName + " with args: " + Arrays . toString ( args ) , e ) ; e . printStackTrace ( out ) ; } |
public class DisplacedList { /** * Inherited from ArrayList
* @ param index
* @ return */
@ Override public T get ( int index ) { } } | if ( displacement != null ) { return super . get ( index - displacement ) ; } return super . get ( index ) ; |
public class Include { public void write ( Writer out ) throws IOException { } } | if ( reader == null ) return ; try { IO . copy ( reader , out ) ; } finally { reader . close ( ) ; reader = null ; } |
public class Hessian2Output { /** * Writes a fault . The fault will be written
* as a descriptive string followed by an object :
* < code > < pre >
* F map
* < / pre > < / code >
* < code > < pre >
* F H
* \ x04code
* \ x10the fault code
* \ x07message
* \ x11the fault message
* \ x06detail
* M \ xnnjavax . ejb . FinderException
* < / pre > < / code >
* @ param code the fault code , a three digit */
public void writeFault ( String code , String message , Object detail ) throws IOException { } } | flushIfFull ( ) ; writeVersion ( ) ; _buffer [ _offset ++ ] = ( byte ) 'F' ; _buffer [ _offset ++ ] = ( byte ) 'H' ; addRef ( new Object ( ) , _refCount ++ , false ) ; writeString ( "code" ) ; writeString ( code ) ; writeString ( "message" ) ; writeString ( message ) ; if ( detail != null ) { writeString ( "detail" ) ; writeObject ( detail ) ; } flushIfFull ( ) ; _buffer [ _offset ++ ] = ( byte ) 'Z' ; |
public class CliFrontend { /** * Executions the run action .
* @ param args Command line arguments for the run action . */
protected int run ( String [ ] args ) { } } | // Parse command line options
CommandLine line ; try { line = parser . parse ( RUN_OPTIONS , args , false ) ; evaluateGeneralOptions ( line ) ; } catch ( MissingOptionException e ) { System . out . println ( e . getMessage ( ) ) ; printHelpForRun ( ) ; return 1 ; } catch ( UnrecognizedOptionException e ) { System . out . println ( e . getMessage ( ) ) ; printHelpForRun ( ) ; return 2 ; } catch ( Exception e ) { return handleError ( e ) ; } // - - - - - check for help first - - - - -
if ( printHelp ) { printHelpForRun ( ) ; return 0 ; } try { PackagedProgram program = buildProgram ( line ) ; if ( program == null ) { printHelpForRun ( ) ; return 1 ; } Client client = getClient ( line ) ; if ( client == null ) { printHelpForRun ( ) ; return 1 ; } int parallelism = - 1 ; if ( line . hasOption ( PARALLELISM_OPTION . getOpt ( ) ) ) { String parString = line . getOptionValue ( PARALLELISM_OPTION . getOpt ( ) ) ; try { parallelism = Integer . parseInt ( parString ) ; } catch ( NumberFormatException e ) { System . out . println ( "The value " + parString + " is invalid for the degree of parallelism." ) ; printHelpForRun ( ) ; return 1 ; } if ( parallelism <= 0 ) { System . out . println ( "Invalid value for the degree-of-parallelism. Parallelism must be greater than zero." ) ; printHelpForRun ( ) ; return 1 ; } } return executeProgram ( program , client , parallelism ) ; } catch ( Throwable t ) { return handleError ( t ) ; } |
public class ConstructorLeakChecker { /** * For each class , visits constructors , instance variables , and instance initializers . Delegates
* further scanning of these " constructor - scope " constructs to { @ link # traverse } . */
@ Override public Description matchClass ( ClassTree tree , VisitorState state ) { } } | // TODO ( b / 36395371 ) : filter here to exclude some classes ( e . g . not immutable )
if ( TEST_CLASS . matches ( tree , state ) ) { return NO_MATCH ; } for ( Tree member : tree . getMembers ( ) ) { if ( isSuppressed ( member ) ) { continue ; } if ( ( member instanceof MethodTree && Matchers . methodIsConstructor ( ) . matches ( ( MethodTree ) member , state ) ) || ( member instanceof BlockTree && ! ( ( BlockTree ) member ) . isStatic ( ) ) || ( member instanceof VariableTree && ! Matchers . isStatic ( ) . matches ( member , state ) ) ) { traverse ( member , state ) ; } } return NO_MATCH ; |
public class JMethod { /** * Returns a full method name with arguments . */
public String getFullName ( ) { } } | StringBuilder name = new StringBuilder ( ) ; name . append ( getName ( ) ) ; name . append ( "(" ) ; JClass [ ] params = getParameterTypes ( ) ; for ( int i = 0 ; i < params . length ; i ++ ) { if ( i != 0 ) name . append ( ", " ) ; name . append ( params [ i ] . getShortName ( ) ) ; } name . append ( ')' ) ; return name . toString ( ) ; |
public class MessageProcessInfo { /** * Add this field in the Record ' s field sequence . */
public BaseField setupField ( int iFieldSeq ) { } } | BaseField field = null ; // if ( iFieldSeq = = 0)
// field = new CounterField ( this , ID , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ;
// field . setHidden ( true ) ;
// if ( iFieldSeq = = 1)
// field = new RecordChangedField ( this , LAST _ CHANGED , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ;
// field . setHidden ( true ) ;
// if ( iFieldSeq = = 2)
// field = new BooleanField ( this , DELETED , Constants . DEFAULT _ FIELD _ LENGTH , null , new Boolean ( false ) ) ;
// field . setHidden ( true ) ;
if ( iFieldSeq == 3 ) field = new StringField ( this , CODE , 30 , null , null ) ; if ( iFieldSeq == 4 ) field = new StringField ( this , DESCRIPTION , 50 , null , null ) ; if ( iFieldSeq == 5 ) field = new QueueNameField ( this , QUEUE_NAME_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 6 ) field = new MessageProcessInfoField ( this , REPLY_MESSAGE_PROCESS_INFO_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 7 ) field = new MessageProcessInfoField ( this , LOCAL_MESSAGE_PROCESS_INFO_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 8 ) field = new MessageInfoField ( this , MESSAGE_INFO_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 9 ) field = new MessageTypeField ( this , MESSAGE_TYPE_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 10 ) field = new ProcessTypeField ( this , PROCESS_TYPE_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 11 ) field = new StringField ( this , PROCESSOR_CLASS , 127 , null , null ) ; if ( iFieldSeq == 12 ) field = new PropertiesField ( this , PROPERTIES , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 13 ) field = new MessageTransportSelect ( this , DEFAULT_MESSAGE_TRANSPORT_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 14 ) field = new BaseStatusSelect ( this , INITIAL_MESSAGE_STATUS_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( field == null ) field = super . setupField ( iFieldSeq ) ; return field ; |
public class AmazonWebServiceClient { /** * Returns the service name of this AWS http client by first looking it up from the SDK internal
* configuration , and if not found , derive it from the class name of the immediate subclass of
* { @ link AmazonWebServiceClient } . No configuration is necessary if the simple class name of the
* http client follows the convention of < code > ( Amazon | AWS ) . * ( JavaClient | Client ) < / code > . */
private String computeServiceName ( ) { } } | final String httpClientName = getHttpClientName ( ) ; String service = ServiceNameFactory . getServiceName ( httpClientName ) ; if ( service != null ) { return service ; // only if it is so explicitly configured
} // Otherwise , make use of convention over configuration
int j = httpClientName . indexOf ( "JavaClient" ) ; if ( j == - 1 ) { j = httpClientName . indexOf ( "Client" ) ; if ( j == - 1 ) { throw new IllegalStateException ( "Unrecognized suffix for the AWS http client class name " + httpClientName ) ; } } int i = httpClientName . indexOf ( AMAZON ) ; int len ; if ( i == - 1 ) { i = httpClientName . indexOf ( AWS ) ; if ( i == - 1 ) { throw new IllegalStateException ( "Unrecognized prefix for the AWS http client class name " + httpClientName ) ; } len = AWS . length ( ) ; } else { len = AMAZON . length ( ) ; } if ( i >= j ) { throw new IllegalStateException ( "Unrecognized AWS http client class name " + httpClientName ) ; } String serviceName = httpClientName . substring ( i + len , j ) ; return StringUtils . lowerCase ( serviceName ) ; |
public class RequestContext { /** * Sends the specified error status code .
* @ param sc the specified error status code */
public void sendError ( final int sc ) { } } | try { response . sendError ( sc ) ; } catch ( final Exception e ) { LOGGER . log ( Level . ERROR , "Sends error status code [" + sc + "] failed: " + e . getMessage ( ) ) ; } |
public class FirstPartyAudienceSegmentRule { /** * Sets the customCriteriaRule value for this FirstPartyAudienceSegmentRule .
* @ param customCriteriaRule * Specifies the collection of custom criteria that are part of
* the rule of a
* { @ link FirstPartyAudienceSegment } .
* Once the { @ link FirstPartyAudienceSegment } is updated
* or modified with custom criteria , the
* server may return a normalized , but equivalent representation
* of the custom criteria rule .
* < ul >
* { @ code customCriteriaRule } will have up to three levels
* including itself .
* < li >
* The top level { @ link CustomCriteriaSet } i . e . the { @ code
* customTargeting } object can only
* contain a { @ link CustomCriteriaSet . LogicalOperator # OR }
* of all its children .
* < li >
* The second level of { @ link CustomCriteriaSet } objects
* can only contain
* { @ link CustomCriteriaSet . LogicalOperator # AND } of all
* their children . If a
* { @ link CustomCriteria } is placed on this level , the
* server will wrap it in a
* { @ link CustomCriteriaSet } .
* < li >
* The third level can only comprise of { @ link CustomCriteria }
* objects .
* < / ul >
* The resulting custom criteria rule would be of the
* form : < br >
* < img
* src = " https : / / chart . apis . google . com / chart ? cht = gv & chl = digraph { customTargeting _ LogicalOperator _ OR - % 3ECustomCriteriaSet _ LogicalOperator _ AND _ 1 - % 3ECustomCriteria _ 1 ; CustomCriteriaSet _ LogicalOperator _ AND _ 1 - % 3Eellipsis1 ; customTargeting _ LogicalOperator _ OR - % 3Eellipsis2 ; ellipsis1 [ label = % 22 . . . % 22 , shape = none , fontsize = 32 ] ; ellipsis2 [ label = % 22 . . . % 22 , shape = none , fontsize = 32 ] } & chs = 450x200 " / > */
public void setCustomCriteriaRule ( com . google . api . ads . admanager . axis . v201902 . CustomCriteriaSet customCriteriaRule ) { } } | this . customCriteriaRule = customCriteriaRule ; |
public class AbstractDeployMojo { /** * Return projectId from either projectId or project . Show deprecation message if configured as
* project and throw error if both specified . */
public String getProjectId ( ) { } } | if ( project != null ) { if ( projectId != null ) { throw new IllegalArgumentException ( "Configuring <project> and <projectId> is not allowed, please use only <projectId>" ) ; } getLog ( ) . warn ( "Configuring <project> is deprecated," + " use <projectId> to set your Google Cloud ProjectId" ) ; return project ; } return projectId ; |
public class ElasticHashinator { /** * Figure out the token interval from the first 3 ranges , assuming that there is at most one token that doesn ' t
* fall onto the bucket boundary at any given time . The largest range will be the hashinator ' s bucket size .
* @ return The bucket size , or token interval if you prefer . */
private static long deriveTokenInterval ( ImmutableSortedSet < Integer > tokens ) { } } | long interval = 0 ; int count = 4 ; int prevToken = Integer . MIN_VALUE ; UnmodifiableIterator < Integer > tokenIter = tokens . iterator ( ) ; while ( tokenIter . hasNext ( ) && count -- > 0 ) { int nextToken = tokenIter . next ( ) ; interval = Math . max ( interval , nextToken - prevToken ) ; prevToken = nextToken ; } return interval ; |
public class JobsInner { /** * List all directories and files inside the given directory of the output directory ( Only if the output directory is on Azure File Share or Azure Storage container ) .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ param serviceFuture the ServiceFuture object tracking the Retrofit calls
* @ 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 < List < FileInner > > listOutputFilesNextAsync ( final String nextPageLink , final ServiceFuture < List < FileInner > > serviceFuture , final ListOperationCallback < FileInner > serviceCallback ) { } } | return AzureServiceFuture . fromPageResponse ( listOutputFilesNextSinglePageAsync ( nextPageLink ) , new Func1 < String , Observable < ServiceResponse < Page < FileInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < FileInner > > > call ( String nextPageLink ) { return listOutputFilesNextSinglePageAsync ( nextPageLink ) ; } } , serviceCallback ) ; |
public class CmsDNDHandler { /** * Clears all references used within the current drag process . < p > */
protected void clear ( ) { } } | for ( I_CmsDropTarget target : m_targets ) { target . removePlaceholder ( ) ; } if ( m_dragHelper != null ) { m_dragHelper . removeFromParent ( ) ; m_dragHelper = null ; } m_placeholder = null ; m_currentTarget = null ; m_draggable = null ; Document . get ( ) . getBody ( ) . removeClassName ( org . opencms . gwt . client . ui . css . I_CmsLayoutBundle . INSTANCE . dragdropCss ( ) . dragStarted ( ) ) ; m_currentAnimation = null ; m_modifierCTRL = false ; |
public class MessageBuilder { /** * Creates CEPOCH message .
* @ param proposedEpoch the last proposed epoch .
* @ param acknowledgedEpoch the acknowledged epoch .
* @ param config the current seen configuration .
* @ return the protobuf message . */
public static Message buildProposedEpoch ( long proposedEpoch , long acknowledgedEpoch , ClusterConfiguration config , int syncTimeoutMs ) { } } | ZabMessage . Zxid version = toProtoZxid ( config . getVersion ( ) ) ; ZabMessage . ClusterConfiguration zCnf = ZabMessage . ClusterConfiguration . newBuilder ( ) . setVersion ( version ) . addAllServers ( config . getPeers ( ) ) . build ( ) ; ProposedEpoch pEpoch = ProposedEpoch . newBuilder ( ) . setProposedEpoch ( proposedEpoch ) . setCurrentEpoch ( acknowledgedEpoch ) . setConfig ( zCnf ) . setSyncTimeout ( syncTimeoutMs ) . build ( ) ; return Message . newBuilder ( ) . setType ( MessageType . PROPOSED_EPOCH ) . setProposedEpoch ( pEpoch ) . build ( ) ; |
public class MessageCell { /** * private static final Template TEMPLATE = GWT . create ( Template . class ) ; */
@ Override public void render ( Context context , Message message , SafeHtmlBuilder safeHtmlBuilder ) { } } | // ImageResource icon = MessageCenterView . getSeverityIcon ( message . getSeverity ( ) ) ;
// AbstractImagePrototype prototype = AbstractImagePrototype . create ( icon ) ;
String styles = ( context . getIndex ( ) % 2 > 0 ) ? "message-list-item message-list-item-odd" : "message-list-item" ; String rowStyle = message . isNew ( ) ? "" : "message-list-item-old" ; styles = styles + " list-" + message . getSeverity ( ) . getStyle ( ) ; safeHtmlBuilder . appendHtmlConstant ( "<table width='100%' cellpadding=4 cellspacing=0>" ) ; safeHtmlBuilder . appendHtmlConstant ( "<tr valign='middle' class='" + rowStyle + "'>" ) ; /* safeHtmlBuilder . appendHtmlConstant ( " < td width = ' 10 % ' > " ) ;
safeHtmlBuilder . appendHtmlConstant ( message . getSeverity ( ) . getTag ( ) ) ;
safeHtmlBuilder . appendHtmlConstant ( " < / td > " ) ; */
safeHtmlBuilder . appendHtmlConstant ( "<td>" ) ; safeHtmlBuilder . appendHtmlConstant ( "<div class='" + styles + "'>" ) ; String actualMessage = message . getConciseMessage ( ) . length ( ) > 30 ? message . getConciseMessage ( ) . substring ( 0 , 30 ) + " ..." : message . getConciseMessage ( ) ; // safeHtmlBuilder . appendHtmlConstant ( TEMPLATE . message ( styles , actualMessage ) ) ;
safeHtmlBuilder . appendEscaped ( actualMessage ) ; safeHtmlBuilder . appendHtmlConstant ( "</div>" ) ; safeHtmlBuilder . appendHtmlConstant ( "</td></tr></table>" ) ; |
public class StoreNamingRules { /** * Gets fully - qualified name of a table or sequence .
* @ param localName local table name .
* @ param params params .
* @ return fully - qualified table name . */
@ NotNull private String getFQName ( @ NotNull final String localName , Object ... params ) { } } | final StringBuilder builder = new StringBuilder ( ) ; builder . append ( storeName ) ; builder . append ( '.' ) ; builder . append ( localName ) ; for ( final Object param : params ) { builder . append ( '#' ) ; builder . append ( param ) ; } // noinspection ConstantConditions
return StringInterner . intern ( builder . toString ( ) ) ; |
public class FullDemo { /** * clearOneAndTwoButtonClicked , This clears date picker one . */
private static void clearOneAndTwoButtonClicked ( ActionEvent e ) { } } | // Clear the date pickers .
datePicker1 . clear ( ) ; datePicker2 . clear ( ) ; // Display message .
String message = "The datePicker1 and datePicker2 dates were cleared!\n\n" ; message += getDatePickerOneDateText ( ) + "\n" ; String date2String = datePicker2 . getDateStringOrSuppliedString ( "(null)" ) ; message += ( "The datePicker2 date is currently set to: " + date2String + "." ) ; panel . messageTextArea . setText ( message ) ; |
public class ParseUtil { /** * Parse a long integer from a character sequence .
* @ param str String
* @ param start Begin
* @ param end End
* @ return Long value */
public static long parseLongBase10 ( final CharSequence str , final int start , final int end ) { } } | // Current position and character .
int pos = start ; char cur = str . charAt ( pos ) ; // Match sign
boolean isNegative = ( cur == '-' ) ; // Carefully consume the - character , update c and i :
if ( ( isNegative || ( cur == '+' ) ) && ( ++ pos < end ) ) { cur = str . charAt ( pos ) ; } // Begin parsing real numbers !
if ( ( cur < '0' ) || ( cur > '9' ) ) { throw NOT_A_NUMBER ; } // Parse digits into a long , remember offset of decimal point .
long decimal = 0 ; while ( true ) { final int digit = cur - '0' ; if ( ( digit >= 0 ) && ( digit <= 9 ) ) { final long tmp = ( decimal << 3 ) + ( decimal << 1 ) + digit ; if ( tmp < decimal ) { throw PRECISION_OVERFLOW ; } decimal = tmp ; } else { // No more digits , or a second dot .
break ; } if ( ++ pos < end ) { cur = str . charAt ( pos ) ; } else { break ; } } if ( pos != end ) { throw TRAILING_CHARACTERS ; } return isNegative ? - decimal : decimal ; |
public class DescribeMeshRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeMeshRequest describeMeshRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeMeshRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeMeshRequest . getMeshName ( ) , MESHNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class DiGraph { /** * Returns the number of vertices in < code > this < / code > directed
* graph .
* Complexity : linear in the size of the graph . Cached if the
* < code > CACHING < / code > argument to the constructor was true . */
public int numVertices ( ) { } } | if ( CACHING && ( cachedNumVertices != - 1 ) ) { return cachedNumVertices ; } int numVertices = vertices ( ) . size ( ) ; if ( CACHING ) { cachedNumVertices = numVertices ; } return numVertices ; |
public class BeanUtil { /** * 获得字段名和字段描述Map 。 内部使用 , 直接获取Bean类的PropertyDescriptor
* @ param clazz Bean类
* @ param ignoreCase 是否忽略大小写
* @ return 字段名和字段描述Map
* @ throws BeanException 获取属性异常 */
private static Map < String , PropertyDescriptor > internalGetPropertyDescriptorMap ( Class < ? > clazz , boolean ignoreCase ) throws BeanException { } } | final PropertyDescriptor [ ] propertyDescriptors = getPropertyDescriptors ( clazz ) ; final Map < String , PropertyDescriptor > map = ignoreCase ? new CaseInsensitiveMap < String , PropertyDescriptor > ( propertyDescriptors . length , 1 ) : new HashMap < String , PropertyDescriptor > ( ( int ) ( propertyDescriptors . length ) , 1 ) ; for ( PropertyDescriptor propertyDescriptor : propertyDescriptors ) { map . put ( propertyDescriptor . getName ( ) , propertyDescriptor ) ; } return map ; |
public class TaskGroup { /** * Mark root of this task task group depends on the given TaskItem .
* This ensure this task group ' s root get picked for execution only after the completion
* of invocation of provided TaskItem .
* @ param dependencyTaskItem the task item that this task group depends on
* @ return the key of the dependency */
public String addDependency ( FunctionalTaskItem dependencyTaskItem ) { } } | IndexableTaskItem dependency = IndexableTaskItem . create ( dependencyTaskItem ) ; this . addDependency ( dependency ) ; return dependency . key ( ) ; |
public class FilterExprIteratorSimple { /** * This function is used to fixup variables from QNames to stack frame
* indexes at stylesheet build time .
* @ param vars List of QNames that correspond to variables . This list
* should be searched backwards for the first qualified name that
* corresponds to the variable reference qname . The position of the
* QName in the vector from the start of the vector will be its position
* in the stack frame ( but variables above the globalsTop value will need
* to be offset to the current stack frame ) . */
public void fixupVariables ( java . util . Vector vars , int globalsSize ) { } } | super . fixupVariables ( vars , globalsSize ) ; m_expr . fixupVariables ( vars , globalsSize ) ; |
public class ESRIFileUtil { /** * Replies if the given value is assumed to be NaN according to the
* ESRI specifications .
* @ param value the value .
* @ return < code > true < / code > if the value corresponds to NaN , otherwise < code > false < / code > . */
@ Pure public static boolean isESRINaN ( float value ) { } } | return Float . isInfinite ( value ) || Float . isNaN ( value ) || value <= ESRI_NAN ; |
public class Utils { /** * This method should be called by common install kernel only .
* @ param installDir */
public static void setInstallDir ( File installDir ) { } } | Utils . installDir = StaticValue . mutateStaticValue ( Utils . installDir , new FileInitializer ( installDir ) ) ; |
public class CircuitAssigmentMapImpl { /** * Enables circuit
* @ param circuitNumber - index of circuit - must be number < 1,31 >
* @ throws IllegalArgumentException - when number is not in range */
public void enableCircuit ( int circuitNumber ) throws IllegalArgumentException { } } | if ( circuitNumber < 1 || circuitNumber > 31 ) { throw new IllegalArgumentException ( "Cicruit number is out of range[" + circuitNumber + "] <1,31>" ) ; } this . mapFormat |= _CIRCUIT_ENABLED << ( circuitNumber - 1 ) ; |
public class Single { /** * Returns a Single that emits the item emitted by the source Single until a Publisher emits an item . Upon
* emission of an item from { @ code other } , this will emit a { @ link CancellationException } rather than go to
* { @ link SingleObserver # onSuccess ( Object ) } .
* < img width = " 640 " height = " 380 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / takeUntil . png " alt = " " >
* < dl >
* < dt > < b > Backpressure : < / b > < / dt >
* < dd > The { @ code other } publisher is consumed in an unbounded fashion but will be
* cancelled after the first item it produced . < / dd >
* < dt > < b > Scheduler : < / b > < / dt >
* < dd > { @ code takeUntil } does not operate by default on a particular { @ link Scheduler } . < / dd >
* < / dl >
* @ param other
* the Publisher whose first emitted item will cause { @ code takeUntil } to emit the item from the source
* Single
* @ param < E >
* the type of items emitted by { @ code other }
* @ return a Single that emits the item emitted by the source Single until such time as { @ code other } emits
* its first item
* @ see < a href = " http : / / reactivex . io / documentation / operators / takeuntil . html " > ReactiveX operators documentation : TakeUntil < / a > */
@ BackpressureSupport ( BackpressureKind . FULL ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < E > Single < T > takeUntil ( final Publisher < E > other ) { } } | ObjectHelper . requireNonNull ( other , "other is null" ) ; return RxJavaPlugins . onAssembly ( new SingleTakeUntil < T , E > ( this , other ) ) ; |
public class HornSchunckPyramid { /** * Computes the flow for a layer using Taylor series expansion and Successive Over - Relaxation linear solver .
* Flow estimates from previous layers are feed into this by setting initFlow and flow to their values . */
protected void processLayer ( GrayF32 image1 , GrayF32 image2 , GrayF32 derivX2 , GrayF32 derivY2 ) { } } | float w = SOR_RELAXATION ; float uf , vf ; // outer Taylor expansion iterations
for ( int warp = 0 ; warp < numWarps ; warp ++ ) { initFlowX . setTo ( flowX ) ; initFlowY . setTo ( flowY ) ; warpImageTaylor ( derivX2 , initFlowX , initFlowY , warpDeriv2X ) ; warpImageTaylor ( derivY2 , initFlowX , initFlowY , warpDeriv2Y ) ; warpImageTaylor ( image2 , initFlowX , initFlowY , warpImage2 ) ; float error ; int iter = 0 ; do { // inner SOR iteration .
error = 0 ; // inner portion
for ( int y = 1 ; y < image1 . height - 1 ; y ++ ) { int pixelIndex = y * image1 . width + 1 ; for ( int x = 1 ; x < image1 . width - 1 ; x ++ , pixelIndex ++ ) { // could speed this up a bit more by precomputing the constant portion before the do - while loop
float ui = initFlowX . data [ pixelIndex ] ; float vi = initFlowY . data [ pixelIndex ] ; float u = flowX . data [ pixelIndex ] ; float v = flowY . data [ pixelIndex ] ; float I1 = image1 . data [ pixelIndex ] ; float I2 = warpImage2 . data [ pixelIndex ] ; float I2x = warpDeriv2X . data [ pixelIndex ] ; float I2y = warpDeriv2Y . data [ pixelIndex ] ; float AU = A ( x , y , flowX ) ; float AV = A ( x , y , flowY ) ; flowX . data [ pixelIndex ] = uf = ( 1 - w ) * u + w * ( ( I1 - I2 + I2x * ui - I2y * ( v - vi ) ) * I2x + alpha2 * AU ) / ( I2x * I2x + alpha2 ) ; flowY . data [ pixelIndex ] = vf = ( 1 - w ) * v + w * ( ( I1 - I2 + I2y * vi - I2x * ( uf - ui ) ) * I2y + alpha2 * AV ) / ( I2y * I2y + alpha2 ) ; error += ( uf - u ) * ( uf - u ) + ( vf - v ) * ( vf - v ) ; } } // border regions require special treatment
int pixelIndex0 = 0 ; int pixelIndex1 = ( image1 . height - 1 ) * image1 . width ; for ( int x = 0 ; x < image1 . width ; x ++ ) { error += iterationSorSafe ( image1 , x , 0 , pixelIndex0 ++ ) ; error += iterationSorSafe ( image1 , x , image1 . height - 1 , pixelIndex1 ++ ) ; } pixelIndex0 = image1 . width ; pixelIndex1 = image1 . width + image1 . width - 1 ; for ( int y = 1 ; y < image1 . height - 1 ; y ++ ) { error += iterationSorSafe ( image1 , 0 , y , pixelIndex0 ) ; error += iterationSorSafe ( image1 , image1 . width - 1 , y , pixelIndex1 ) ; pixelIndex0 += image1 . width ; pixelIndex1 += image1 . width ; } } while ( error > convergeTolerance * image1 . width * image1 . height && ++ iter < maxInnerIterations ) ; } |
public class ModelsImpl { /** * Deletes a sublist of a specific closed list model .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param clEntityId The closed list entity extractor ID .
* @ param subListId The sublist ID .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the OperationStatus object if successful . */
public OperationStatus deleteSubList ( UUID appId , String versionId , UUID clEntityId , int subListId ) { } } | return deleteSubListWithServiceResponseAsync ( appId , versionId , clEntityId , subListId ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class AbstractGpxParserTrk { /** * Fires whenever an XML start markup is encountered . It creates a new
* trackSegment when a < trkseg > markup is encountered . It creates a new
* trackPoint when a < trkpt > markup is encountered . It saves informations
* about < link > in currentPoint or currentLine .
* @ param uri URI of the local element
* @ param localName Name of the local element ( without prefix )
* @ param qName qName of the local element ( with prefix )
* @ param attributes Attributes of the local element ( contained in the
* markup )
* @ throws SAXException Any SAX exception , possibly wrapping another
* exception */
@ Override public void startElement ( String uri , String localName , String qName , Attributes attributes ) throws SAXException { } } | if ( localName . equalsIgnoreCase ( GPXTags . TRKSEG ) ) { segment = true ; GPXLine trkSegment = new GPXLine ( GpxMetadata . TRKSEGFIELDCOUNT ) ; trkSegment . setValue ( GpxMetadata . LINEID , trksegID ++ ) ; trkSegment . setValue ( GpxMetadata . TRKSEG_TRKID , getCurrentLine ( ) . getValues ( ) [ GpxMetadata . LINEID ] ) ; setCurrentSegment ( trkSegment ) ; trksegList . clear ( ) ; } else if ( localName . equalsIgnoreCase ( GPXTags . TRKPT ) ) { point = true ; GPXPoint trackPoint = new GPXPoint ( GpxMetadata . TRKPTFIELDCOUNT ) ; Coordinate coordinate = GPXCoordinate . createCoordinate ( attributes ) ; Point geom = getGeometryFactory ( ) . createPoint ( coordinate ) ; geom . setSRID ( 4326 ) ; trackPoint . setValue ( GpxMetadata . THE_GEOM , geom ) ; trackPoint . setValue ( GpxMetadata . PTLAT , coordinate . y ) ; trackPoint . setValue ( GpxMetadata . PTLON , coordinate . x ) ; trackPoint . setValue ( GpxMetadata . PTELE , coordinate . z ) ; trackPoint . setValue ( GpxMetadata . PTID , trkptID ++ ) ; trackPoint . setValue ( GpxMetadata . TRKPT_TRKSEGID , trksegID ) ; trksegList . add ( coordinate ) ; setCurrentPoint ( trackPoint ) ; } // Clear content buffer
getContentBuffer ( ) . delete ( 0 , getContentBuffer ( ) . length ( ) ) ; // Store name of current element in stack
getElementNames ( ) . push ( qName ) ; |
public class CommerceWishListItemLocalServiceBaseImpl { /** * Adds the commerce wish list item to the database . Also notifies the appropriate model listeners .
* @ param commerceWishListItem the commerce wish list item
* @ return the commerce wish list item that was added */
@ Indexable ( type = IndexableType . REINDEX ) @ Override public CommerceWishListItem addCommerceWishListItem ( CommerceWishListItem commerceWishListItem ) { } } | commerceWishListItem . setNew ( true ) ; return commerceWishListItemPersistence . update ( commerceWishListItem ) ; |
public class TagLibFactory { /** * Laedt mehrere TagLib ' s die innerhalb eines Verzeichnisses liegen .
* @ param dir Verzeichnis im dem die TagLib ' s liegen .
* @ param saxParser Definition des Sax Parser mit dem die TagLib ' s eingelesen werden sollen .
* @ return TagLib ' s als Array
* @ throws TagLibException */
public static TagLib [ ] loadFromDirectory ( Resource dir , Identification id ) throws TagLibException { } } | if ( ! dir . isDirectory ( ) ) return new TagLib [ 0 ] ; ArrayList < TagLib > arr = new ArrayList < TagLib > ( ) ; Resource [ ] files = dir . listResources ( new ExtensionResourceFilter ( new String [ ] { "tld" , "tldx" } ) ) ; for ( int i = 0 ; i < files . length ; i ++ ) { if ( files [ i ] . isFile ( ) ) arr . add ( TagLibFactory . loadFromFile ( files [ i ] , id ) ) ; } return arr . toArray ( new TagLib [ arr . size ( ) ] ) ; |
public class ParallelTaskBuilder { /** * Sets the HTTP poller processor to handle Async API .
* Will auto enable the pollable mode with this call
* @ param httpPollerProcessor
* the http poller processor
* @ return the parallel task builder */
public ParallelTaskBuilder setHttpPollerProcessor ( HttpPollerProcessor httpPollerProcessor ) { } } | this . httpMeta . setHttpPollerProcessor ( httpPollerProcessor ) ; this . httpMeta . setPollable ( true ) ; return this ; |
public class DefaultGroovyMethods { /** * Splits all items into two collections based on the closure condition .
* The first list contains all items which match the closure expression .
* The second list all those that don ' t .
* @ param self an Array
* @ param closure a closure condition
* @ return a List whose first item is the accepted values and whose second item is the rejected values
* @ since 2.5.0 */
public static < T > Collection < Collection < T > > split ( T [ ] self , @ ClosureParams ( FirstParam . Component . class ) Closure closure ) { } } | List < T > accept = new ArrayList < T > ( ) ; List < T > reject = new ArrayList < T > ( ) ; Iterator < T > iter = new ArrayIterator < T > ( self ) ; return split ( closure , accept , reject , iter ) ; |
public class DefaultMailMessageParser { /** * Returns the sender email from the provided mail object .
* @ param mailMessage
* The mail message with the fax data
* @ return The sender email
* @ throws MessagingException
* Any exception while handling the mail message */
protected String getSenderEmail ( Message mailMessage ) throws MessagingException { } } | Address [ ] addresses = mailMessage . getFrom ( ) ; String senderEmail = null ; if ( ( addresses != null ) && ( addresses . length > 0 ) ) { // get sender mail address ( only first from is used )
Address address = addresses [ 0 ] ; // get as string
senderEmail = address . toString ( ) ; } return senderEmail ; |
public class ShrinkWrapFileSystemProvider { /** * Writes the contents of the { @ link InputStream } to the { @ link SeekableByteChannel }
* @ param in
* @ param out
* @ throws IOException */
private void copy ( final InputStream in , final SeekableByteChannel out ) throws IOException { } } | assert in != null : "InStream must be specified" ; assert out != null : "Channel must be specified" ; final byte [ ] backingBuffer = new byte [ 1024 * 4 ] ; final ByteBuffer byteBuffer = ByteBuffer . wrap ( backingBuffer ) ; int bytesRead = 0 ; while ( ( bytesRead = in . read ( backingBuffer , 0 , backingBuffer . length ) ) > - 1 ) { // Limit to the amount we ' ve actually read in , so we don ' t overflow into old data blocks
byteBuffer . limit ( bytesRead ) ; out . write ( byteBuffer ) ; // Position back to 0
byteBuffer . clear ( ) ; } |
public class NegationImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case XtextPackage . NEGATION__VALUE : setValue ( ( Condition ) null ) ; return ; } super . eUnset ( featureID ) ; |
public class PoolStopResizeHeaders { /** * Set the time at which the resource was last modified .
* @ param lastModified the lastModified value to set
* @ return the PoolStopResizeHeaders object itself . */
public PoolStopResizeHeaders withLastModified ( DateTime lastModified ) { } } | if ( lastModified == null ) { this . lastModified = null ; } else { this . lastModified = new DateTimeRfc1123 ( lastModified ) ; } return this ; |
public class policyexpression { /** * Use this API to fetch policyexpression resource of given name . */
public static policyexpression get ( nitro_service service , String name ) throws Exception { } } | policyexpression obj = new policyexpression ( ) ; obj . set_name ( name ) ; policyexpression response = ( policyexpression ) obj . get_resource ( service ) ; return response ; |
public class ValuesResolver { /** * The http : / / facebook . github . io / graphql / # sec - Coercing - Variable - Values says :
* < pre >
* 1 . Let coercedValues be an empty unordered Map .
* 2 . Let variableDefinitions be the variables defined by operation .
* 3 . For each variableDefinition in variableDefinitions :
* a . Let variableName be the name of variableDefinition .
* b . Let variableType be the expected type of variableDefinition .
* c . Let defaultValue be the default value for variableDefinition .
* d . Let value be the value provided in variableValues for the name variableName .
* e . If value does not exist ( was not provided in variableValues ) :
* i . If defaultValue exists ( including null ) :
* 1 . Add an entry to coercedValues named variableName with the value defaultValue .
* ii . Otherwise if variableType is a Non ‐ Nullable type , throw a query error .
* iii . Otherwise , continue to the next variable definition .
* f . Otherwise , if value cannot be coerced according to the input coercion rules of variableType , throw a query error .
* g . Let coercedValue be the result of coercing value according to the input coercion rules of variableType .
* h . Add an entry to coercedValues named variableName with the value coercedValue .
* 4 . Return coercedValues .
* < / pre >
* @ param schema the schema
* @ param variableDefinitions the variable definitions
* @ param variableValues the supplied variables
* @ return coerced variable values as a map */
public Map < String , Object > coerceArgumentValues ( GraphQLSchema schema , List < VariableDefinition > variableDefinitions , Map < String , Object > variableValues ) { } } | GraphqlFieldVisibility fieldVisibility = schema . getFieldVisibility ( ) ; Map < String , Object > coercedValues = new LinkedHashMap < > ( ) ; for ( VariableDefinition variableDefinition : variableDefinitions ) { String variableName = variableDefinition . getName ( ) ; GraphQLType variableType = TypeFromAST . getTypeFromAST ( schema , variableDefinition . getType ( ) ) ; // 3 . e
if ( ! variableValues . containsKey ( variableName ) ) { Value defaultValue = variableDefinition . getDefaultValue ( ) ; if ( defaultValue != null ) { // 3 . e . i
Object coercedValue = coerceValueAst ( fieldVisibility , variableType , variableDefinition . getDefaultValue ( ) , null ) ; coercedValues . put ( variableName , coercedValue ) ; } else if ( isNonNull ( variableType ) ) { // 3 . e . ii
throw new NonNullableValueCoercedAsNullException ( variableDefinition , variableType ) ; } } else { Object value = variableValues . get ( variableName ) ; // 3 . f
Object coercedValue = getVariableValue ( fieldVisibility , variableDefinition , variableType , value ) ; // 3 . g
coercedValues . put ( variableName , coercedValue ) ; } } return coercedValues ; |
public class MalisisSlot { /** * Extract a specified < b > amount < / b > from this { @ link MalisisSlot } .
* @ param amount the amount
* @ return the { @ link ItemStack } extracted */
public ItemStack extract ( int amount ) { } } | ItemStackSplitter iss = new ItemUtils . ItemStackSplitter ( getItemStack ( ) ) ; iss . split ( amount ) ; setItemStack ( iss . source ) ; // if ( hasChanged ( ) )
onSlotChanged ( ) ; return iss . split ; |
public class TemplCommand { /** * Analyse the method given at construction time .
* This method check if the method ( s ) given at construction time fulfill the
* required specification . It always analyse the execution method and eventually
* the command allowed method .
* @ exception DevFailed If one of the method does not fulfill the requirements .
* Click < a href = " . . / . . / tango _ basic / idl _ html / Tango . html # DevFailed " > here < / a > to read
* < b > DevFailed < / b > exception specification */
public void analyse_methods ( ) throws DevFailed { } } | // Analyse the execution method given by the user
this . exe_method = analyse_method_exe ( device_class_name , exe_method_name ) ; // Analyse the state method if one is given by the user
if ( state_method_name != null ) this . state_method = analyse_method_state ( device_class_name , state_method_name ) ; |
public class PullDependencies { /** * Create the extension directory for a specific maven coordinate .
* The name of this directory should be the artifactId in the coordinate */
private void createExtensionDirectory ( String coordinate , File atLocation ) { } } | if ( atLocation . isDirectory ( ) ) { log . info ( "Directory [%s] already exists, skipping creating a directory" , atLocation . getAbsolutePath ( ) ) ; return ; } if ( ! atLocation . mkdir ( ) ) { throw new ISE ( "Unable to create directory at [%s] for coordinate [%s]" , atLocation . getAbsolutePath ( ) , coordinate ) ; } |
public class DecimalFormatSymbols { /** * < strong > [ icu ] < / strong > Sets the string used for decimal sign .
* < b > Note : < / b > When the input decimal separator String is represented
* by multiple Java chars , then { @ link # getDecimalSeparator ( ) } will
* return the default decimal separator character ( ' . ' ) .
* @ param decimalSeparatorString the decimal sign string
* @ throws NullPointerException if < code > decimalSeparatorString < / code > is null .
* @ see # getDecimalSeparatorString ( )
* @ hide draft / provisional / internal are hidden on Android */
public void setDecimalSeparatorString ( String decimalSeparatorString ) { } } | if ( decimalSeparatorString == null ) { throw new NullPointerException ( "The input decimal separator is null" ) ; } this . decimalSeparatorString = decimalSeparatorString ; if ( decimalSeparatorString . length ( ) == 1 ) { this . decimalSeparator = decimalSeparatorString . charAt ( 0 ) ; } else { // Use the default decimal separator character as fallback
this . decimalSeparator = DEF_DECIMAL_SEPARATOR ; } |
public class Types { /** * Builds ( class name - > class ) map for given classes . */
@ SuppressWarnings ( "all" ) public static < C extends Class < ? > > Map < String , C > buildClassNameMap ( Iterable < C > set ) { } } | Map < String , C > classNameMap = new HashMap < String , C > ( ) ; for ( C javaClass : set ) { classNameMap . put ( javaClass . getName ( ) , javaClass ) ; } return classNameMap ; |
public class IfcTypeObjectImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcPropertySetDefinition > getHasPropertySets ( ) { } } | return ( EList < IfcPropertySetDefinition > ) eGet ( Ifc4Package . Literals . IFC_TYPE_OBJECT__HAS_PROPERTY_SETS , true ) ; |
public class AmazonCloudFormationClient { /** * Returns drift information for the resources that have been checked for drift in the specified stack . This
* includes actual and expected configuration values for resources where AWS CloudFormation detects configuration
* drift .
* For a given stack , there will be one < code > StackResourceDrift < / code > for each stack resource that has been
* checked for drift . Resources that have not yet been checked for drift are not included . Resources that do not
* currently support drift detection are not checked , and so not included . For a list of resources that support
* drift detection , see < a
* href = " https : / / docs . aws . amazon . com / AWSCloudFormation / latest / UserGuide / using - cfn - stack - drift - resource - list . html "
* > Resources that Support Drift Detection < / a > .
* Use < a > DetectStackResourceDrift < / a > to detect drift on individual resources , or < a > DetectStackDrift < / a > to detect
* drift on all supported resources for a given stack .
* @ param describeStackResourceDriftsRequest
* @ return Result of the DescribeStackResourceDrifts operation returned by the service .
* @ sample AmazonCloudFormation . DescribeStackResourceDrifts
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / cloudformation - 2010-05-15 / DescribeStackResourceDrifts "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DescribeStackResourceDriftsResult describeStackResourceDrifts ( DescribeStackResourceDriftsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeStackResourceDrifts ( request ) ; |
public class ModuleInfoHandler { /** * Here is the information to expose ( use ModuleLoaderMXBean as a source of information ) :
* Loaded module names
* For each module :
* Module name
* Main class name ( if any )
* Class loader name string
* Fallback loader name string
* Dependency information :
* Dependency type
* Export filter string
* Import filter string
* Dependency module name
* Is - optional flag
* Local loader type class name
* Local loader paths
* Resource loader information for each module :
* Resource loader type string
* Resource loader paths
* Note that there are multiple module loaders . For our purposes there should be ( at least ) two categories displayed :
* The static module loader
* The deployment module loader */
private ModelNode populateModuleInfo ( ModuleInfo module ) throws Exception { } } | ModelNode result = new ModelNode ( ) ; result . get ( "name" ) . set ( module . getName ( ) ) ; ModelNode value ; value = result . get ( "main-class" ) ; if ( module . getMainClass ( ) != null ) { value . set ( module . getMainClass ( ) ) ; } value = result . get ( "fallback-loader" ) ; if ( module . getFallbackLoader ( ) != null ) { value . set ( module . getFallbackLoader ( ) ) ; } ModelNode dependencies = result . get ( "dependencies" ) . setEmptyList ( ) ; for ( DependencyInfo dependencySpec : module . getDependencies ( ) ) { if ( dependencySpec . getModuleName ( ) == null ) { continue ; // todo check why it returns empty dependancy
} ModelNode dependency = dependencies . add ( ) ; dependency . get ( "dependency-name" ) . set ( dependencySpec . getDependencyType ( ) ) ; dependency . get ( "module-name" ) . set ( dependencySpec . getModuleName ( ) ) ; dependency . get ( "export-filter" ) . set ( dependencySpec . getExportFilter ( ) ) ; dependency . get ( "import-filter" ) . set ( dependencySpec . getImportFilter ( ) ) ; dependency . get ( "optional" ) . set ( dependencySpec . isOptional ( ) ) ; value = result . get ( "local-loader-class" ) ; if ( dependencySpec . getLocalLoader ( ) != null ) { value . set ( dependencySpec . getLocalLoader ( ) ) ; } if ( dependencySpec . getLocalLoaderPaths ( ) != null ) { ModelNode paths = dependency . get ( "local-loader-paths" ) ; for ( String path : dependencySpec . getLocalLoaderPaths ( ) ) { paths . add ( path ) ; } } } ModelNode resourceLoaders = result . get ( "resource-loaders" ) . setEmptyList ( ) ; for ( ResourceLoaderInfo loaderInfo : module . getResourceLoaders ( ) ) { ModelNode loader = resourceLoaders . add ( ) ; loader . get ( "type" ) . set ( loaderInfo . getType ( ) ) ; ModelNode paths = loader . get ( "paths" ) ; for ( String path : loaderInfo . getPaths ( ) ) { paths . add ( path ) ; } } return result ; |
public class JFinalViewResolver { /** * 设置 shared function 文件 , 多个文件用逗号分隔
* 主要用于 Spring MVC 的 xml 配置方式
* Spring Boot 的代码配置方式可使用 addSharedFunction ( . . . ) 进行配置 */
public void setSharedFunction ( String sharedFunctionFiles ) { } } | if ( StrKit . isBlank ( sharedFunctionFiles ) ) { throw new IllegalArgumentException ( "sharedFunctionFiles can not be blank" ) ; } String [ ] fileArray = sharedFunctionFiles . split ( "," ) ; for ( String fileName : fileArray ) { JFinalViewResolver . sharedFunctionFiles . add ( fileName ) ; } |
public class AWSLambdaClient { /** * Deletes a version of an < a href = " https : / / docs . aws . amazon . com / lambda / latest / dg / configuration - layers . html " > AWS
* Lambda layer < / a > . Deleted versions can no longer be viewed or added to functions . To avoid breaking functions , a
* copy of the version remains in Lambda until no functions refer to it .
* @ param deleteLayerVersionRequest
* @ return Result of the DeleteLayerVersion operation returned by the service .
* @ throws ServiceException
* The AWS Lambda service encountered an internal error .
* @ throws TooManyRequestsException
* Request throughput limit exceeded .
* @ sample AWSLambda . DeleteLayerVersion
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / lambda - 2015-03-31 / DeleteLayerVersion " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DeleteLayerVersionResult deleteLayerVersion ( DeleteLayerVersionRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDeleteLayerVersion ( request ) ; |
public class MetricKeyDataPoints { /** * An array of timestamp - value pairs , representing measurements over a period of time .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setDataPoints ( java . util . Collection ) } or { @ link # withDataPoints ( java . util . Collection ) } if you want to
* override the existing values .
* @ param dataPoints
* An array of timestamp - value pairs , representing measurements over a period of time .
* @ return Returns a reference to this object so that method calls can be chained together . */
public MetricKeyDataPoints withDataPoints ( DataPoint ... dataPoints ) { } } | if ( this . dataPoints == null ) { setDataPoints ( new java . util . ArrayList < DataPoint > ( dataPoints . length ) ) ; } for ( DataPoint ele : dataPoints ) { this . dataPoints . add ( ele ) ; } return this ; |
public class FilterTypeImpl { /** * If not already created , a new < code > init - param < / code > element will be created and returned .
* Otherwise , the first existing < code > init - param < / code > element will be returned .
* @ return the instance defined for the element < code > init - param < / code > */
public InitParamType < FilterType < T > > getOrCreateInitParam ( ) { } } | List < Node > nodeList = childNode . get ( "init-param" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new InitParamTypeImpl < FilterType < T > > ( this , "init-param" , childNode , nodeList . get ( 0 ) ) ; } return createInitParam ( ) ; |
public class Timestamp { /** * Creates an instance representing the value of { @ code Date } .
* @ throws IllegalArgumentException if the timestamp is outside the representable range */
public static Timestamp of ( Date date ) { } } | return ofTimeMicroseconds ( TimeUnit . MILLISECONDS . toMicros ( date . getTime ( ) ) ) ; |
public class ClassUtils { /** * Given a JVM Qualified Name produce a readable classname
* @ param qualifiedName The Qualified Name
* @ return The readable classname */
public static String determineReadableClassName ( String qualifiedName ) { } } | String readableClassName = StringUtils . removeWhitespace ( qualifiedName ) ; if ( readableClassName == null ) { throw new IllegalArgumentException ( "qualifiedName must not be null." ) ; } else if ( readableClassName . startsWith ( "[" ) ) { StringBuilder classNameBuffer = new StringBuilder ( ) ; while ( readableClassName . startsWith ( "[" ) ) { classNameBuffer . append ( "[]" ) ; readableClassName = readableClassName . substring ( 1 ) ; } if ( PRIMITIVE_MAPPING . containsValue ( readableClassName ) ) { for ( Map . Entry < String , String > next : PRIMITIVE_MAPPING . entrySet ( ) ) { if ( next . getValue ( ) . equals ( readableClassName ) ) { readableClassName = next . getKey ( ) + classNameBuffer . toString ( ) ; break ; } } } else if ( readableClassName . startsWith ( "L" ) && readableClassName . endsWith ( ";" ) ) { readableClassName = readableClassName . substring ( 1 , readableClassName . length ( ) - 1 ) + classNameBuffer . toString ( ) ; } else { throw new IllegalArgumentException ( "qualifiedName was invalid {" + readableClassName + "}" ) ; } } else if ( readableClassName . endsWith ( "]" ) ) { throw new IllegalArgumentException ( "qualifiedName was invalid {" + readableClassName + "}" ) ; } return readableClassName ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcPlateType ( ) { } } | if ( ifcPlateTypeEClass == null ) { ifcPlateTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 363 ) ; } return ifcPlateTypeEClass ; |
public class BoundedBuffer { /** * Increases the buffer ' s capacity by the given amount .
* @ param additionalCapacity
* The amount by which the buffer ' s capacity should be increased . */
@ SuppressWarnings ( "unchecked" ) public synchronized void expand ( int additionalCapacity ) { } } | if ( additionalCapacity <= 0 ) { throw new IllegalArgumentException ( ) ; } int capacityBefore = buffer . length ; synchronized ( lock ) { // D312598
int capacityAfter = buffer . length ; // Check that no one was expanding while we waited on this lock
if ( capacityAfter == capacityBefore ) { final Object [ ] newBuffer = new Object [ buffer . length + additionalCapacity ] ; // PK53203 - put ( ) acquires two locks in sequence . First , it acquires
// the insert lock to update putIndex . Then , it drops the insert lock
// and acquires the extract lock to update numberOfUsedSlots . As a
// result , there is a window where putIndex has been updated , but
// numberOfUsedSlots has not . Consequently , even though we have
// acquired both locks in this method , we cannot rely on the values in
// numberOfUsedSlots ; we can only rely on putIndex and takeIndex .
if ( putIndex > takeIndex ) { // The contents of the buffer do not wrap round
// the end of the array . We can move its contents
// into the new expanded buffer in one go .
int used = putIndex - takeIndex ; System . arraycopy ( buffer , takeIndex , newBuffer , 0 , used ) ; putIndex = used ; // PK53203.1 - If putIndex = = takeIndex , then the buffer is either
// completely full or completely empty . If it is completely full , then
// we need to copy and adjust putIndex . Otherwise , we need to set
// putIndex to 0.
} else if ( putIndex != takeIndex || buffer [ takeIndex ] != null ) { // The contents of the buffer wrap round the end
// of the array . We have to perform two copies to
// move its contents into the new buffer .
int used = buffer . length - takeIndex ; System . arraycopy ( buffer , takeIndex , newBuffer , 0 , used ) ; System . arraycopy ( buffer , 0 , newBuffer , used , putIndex ) ; putIndex += used ; } else { putIndex = 0 ; } // The contents of the buffer now begin at 0 - update the head pointer .
takeIndex = 0 ; // The buffer ' s capacity has been increased so update the count of the
// empty slots to reflect this .
buffer = ( T [ ] ) newBuffer ; } } // D312598 |
public class PromptTask { /** * Implementation . */
private boolean isValid ( String response , List < String > options ) { } } | boolean rslt = false ; // default . . .
if ( options . size ( ) == 0 ) { // If no acceptable responses are specified , it ' s wide open . . .
rslt = true ; } else { for ( String o : options ) { if ( response . matches ( o ) ) { rslt = true ; break ; } } } return rslt ; |
public class MathUtil { /** * Returns the next larger positive prime integer . < p >
* The integer specified will be returned if it is positive and a prime . < p >
* If the integer specified is greater than the maximumn prime integer , then
* the next odd integer will be returned . */
public static int findNextPrime ( int number ) { } } | // 2 is the smallest positive prime number .
if ( number <= 2 ) return 2 ; // Even numbers ( other than 2 ) are not prime .
if ( isEven ( number ) ) ++ number ; if ( number > MAX_PRIME_INTEGER ) return number ; // For safety , don ' t loop forever looking for a prime , and skip
// all of the evens , as they are not prime ( except 2 ) .
for ( int next = number ; next < number + 1000 ; next += 2 ) { if ( isPrime ( next ) ) return next ; } return number ; |
public class NetworkClient { /** * Retrieves the list of networks available to the specified project .
* < p > Sample code :
* < pre > < code >
* try ( NetworkClient networkClient = NetworkClient . create ( ) ) {
* ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ;
* for ( Network element : networkClient . listNetworks ( project ) . iterateAll ( ) ) {
* / / doThingsWith ( element ) ;
* < / code > < / pre >
* @ param project Project ID for this request .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final ListNetworksPagedResponse listNetworks ( ProjectName project ) { } } | ListNetworksHttpRequest request = ListNetworksHttpRequest . newBuilder ( ) . setProject ( project == null ? null : project . toString ( ) ) . build ( ) ; return listNetworks ( request ) ; |
public class DrawableUtils { /** * Normalize value between minimum and maximum .
* @ param val value
* @ param minVal minimum value
* @ param maxVal maximum value
* @ return normalized value in range < code > 0 . . 1 < / code >
* @ throws IllegalArgumentException if value is out of range < code > [ minVal , maxVal ] < / code > */
public static float normalize ( float val , float minVal , float maxVal ) { } } | if ( val < minVal || val > maxVal ) throw new IllegalArgumentException ( "Value must be between min and max values. [val, min, max]: [" + val + "," + minVal + ", " + maxVal + "]" ) ; return ( val - minVal ) / ( maxVal - minVal ) ; |
import java . util . Collections ; import java . util . Arrays ; import java . util . List ; class RetrieveMaximum { /** * This function finds the greatest number in a list of tuples .
* Examples :
* retrieveMaximum ( [ ( 2 , 4 ) , ( 6 , 7 ) , ( 5 , 1 ) , ( 6 , 10 ) , ( 8 , 7 ) ] ) - > 10
* retrieveMaximum ( [ ( 3 , 5 ) , ( 7 , 8 ) , ( 6 , 2 ) , ( 7 , 11 ) , ( 9 , 8 ) ] ) - > 11
* retrieveMaximum ( [ ( 4 , 6 ) , ( 8 , 9 ) , ( 7 , 3 ) , ( 8 , 12 ) , ( 10 , 9 ) ] ) - > 12 */
public static int retrieveMaximum ( List < List < Integer > > input_tuples_list ) { } } | int maximum = Collections . max ( Arrays . asList ( Collections . max ( input_tuples_list , ( t1 , t2 ) -> Collections . max ( t1 ) - Collections . max ( t2 ) ) ) ) ; return maximum ; |
public class Type { /** * Returns the conversion cost of assigning the given type to this type .
* Conversions are allowed between arrays as well if they have the
* same dimensions . If no legal conversion exists , - 1 is returned .
* The conversion costs are as follows :
* < ol >
* < li > any type is assignable by its own type
* < li > any superclass type is assignable by a subclass type
* < li > any object with a primitive peer can be converted to its primitive
* < li > any primitive can be converted to its object peer
* < li > any byte or short can be widened to an int
* < li > any byte , short or int can be widened to a long
* < li > any byte or short can be widened to a float
* < li > any primitive number can be widened to a double
* < li > any Number object can be converted to a primitive and widened
* < li > any primitive number can be converted to a Number object
* < li > any primitive number can be widened to a Number object
* < li > any Number object can be widened to another Number object
* < li > any primitive number can be narrowed to a double
* < li > any Number object can be narrowed to a double
* < li > any primitive number can be narrowed to a Double object
* < li > any Number object can be narrowed to a Double object
* < li > any primitive number can be narrowed to a long
* < li > any Number object can be narrowed to a long
* < li > any primitive number can be narrowed to a Long object
* < li > any Number object can be narrowed to a Long object
* < li > any primitive number can be narrowed to a float
* < li > any Number object can be narrowed to a float
* < li > any primitive number can be narrowed to a Float object
* < li > any Number object can be narrowed to a Float object
* < li > any primitive number can be narrowed to a int
* < li > any Number object can be narrowed to a int
* < li > any primitive number can be narrowed to a Integer object
* < li > any Number object can be narrowed to a Integer object
* < li > any primitive number can be narrowed to a short
* < li > any Number object can be narrowed to a short
* < li > any primitive number can be narrowed to a Short object
* < li > any Number object can be narrowed to a Short object
* < li > any primitive number can be narrowed to a byte
* < li > any Number object can be narrowed to a byte
* < li > any primitive number can be narrowed to a Byte object
* < li > any Number object can be narrowed to a Byte object
* < li > any primitive can be converted to an object
* < li > NULL _ TYPE can be converted to any object
* < li > anything can be converted to a String
* < / ol >
* @ return the conversion cost , or - 1 if the other can ' t assign to this */
public int convertableFrom ( Type other ) { } } | // if ( equals ( other ) ) {
// return 1;
Class < ? > thisNat = mNaturalClass ; Class < ? > otherNat = other . mNaturalClass ; if ( thisNat . equals ( otherNat ) ) { return 1 ; } if ( thisNat . isAssignableFrom ( otherNat ) ) { return 2 ; } if ( other == NULL_TYPE && ! thisNat . isPrimitive ( ) ) { return 38 ; } boolean arrayConversion = thisNat . isArray ( ) && otherNat . isArray ( ) ; if ( arrayConversion ) { // Get dimensions of each array .
int thisDim = 0 ; while ( thisNat . isArray ( ) ) { thisDim ++ ; thisNat = thisNat . getComponentType ( ) ; } int otherDim = 0 ; while ( otherNat . isArray ( ) ) { otherDim ++ ; otherNat = otherNat . getComponentType ( ) ; } if ( thisDim != otherDim ) { return - 1 ; } } int aCode = typeCode ( thisNat ) ; if ( aCode < 0 ) { return - 1 ; } int cost ; int bCode = typeCode ( otherNat ) ; if ( bCode < 0 ) { if ( aCode == 18 ) { // Anything can be converted to a String .
return 40 ; } else { return - 1 ; } } cost = mCostTable [ bCode ] [ aCode ] ; if ( cost == 40 && arrayConversion ) { // Since types are both arrays , lower the cost so that a conversion
// from int [ ] to String [ ] is preferred over int [ ] to String .
cost -- ; } return cost ; |
public class ClientRegistry { /** * Return next client id
* @ return Next client id */
public String nextId ( ) { } } | String id = "-1" ; do { // when we reach max int , reset to zero
if ( nextId . get ( ) == Integer . MAX_VALUE ) { nextId . set ( 0 ) ; } id = String . format ( "%d" , nextId . getAndIncrement ( ) ) ; } while ( hasClient ( id ) ) ; return id ; |
public class CmsUpdateDBProjectId { /** * Renames the column of the given table the new name . < p >
* @ param dbCon the db connection interface
* @ param tablename the table in which the column shall be renamed
* @ param oldname the old name of the column
* @ param newname the new name of the column
* @ throws SQLException if something goes wrong */
private void renameColumn ( CmsSetupDb dbCon , String tablename , String oldname , String newname ) throws SQLException { } } | System . out . println ( new Exception ( ) . getStackTrace ( ) [ 0 ] . toString ( ) ) ; if ( dbCon . hasTableOrColumn ( tablename , oldname ) ) { String query = readQuery ( QUERY_RENAME_COLUMN ) ; Map < String , String > replacer = new HashMap < String , String > ( ) ; replacer . put ( REPLACEMENT_TABLENAME , tablename ) ; replacer . put ( REPLACEMENT_COLUMN , oldname ) ; replacer . put ( REPLACEMENT_NEW_COLUMN , newname ) ; dbCon . updateSqlStatement ( query , replacer , null ) ; } else { System . out . println ( "column " + oldname + " in table " + tablename + " not found exists" ) ; } |
public class ResourceSnippet { /** * extract a ResourceSnippet from InputStream at the given char positions
* @ param is - InputStream of the Resource
* @ param startChar - start position of the snippet
* @ param endChar - end position of the snippet
* @ param charset - use server ' s charset , default should be UTF - 8
* @ return */
public static ResourceSnippet createResourceSnippet ( InputStream is , int startChar , int endChar , String charset ) { } } | return createResourceSnippet ( getContents ( is , charset ) , startChar , endChar ) ; |
public class Connection { /** * { @ inheritDoc }
* @ throws IllegalArgumentException if | properties | is null */
public void setClientInfo ( final Properties properties ) throws SQLClientInfoException { } } | if ( properties == null ) { throw new IllegalArgumentException ( ) ; } // end of if
if ( this . closed ) { throw new SQLClientInfoException ( ) ; } // end of if
this . clientInfo = properties ; |
public class PDF417HighLevelEncoder { /** * Encode parts of the message using Text Compaction as described in ISO / IEC 15438:2001 ( E ) ,
* chapter 4.4.2.
* @ param msg the message
* @ param startpos the start position within the message
* @ param count the number of characters to encode
* @ param sb receives the encoded codewords
* @ param initialSubmode should normally be SUBMODE _ ALPHA
* @ return the text submode in which this method ends */
private static int encodeText ( CharSequence msg , int startpos , int count , StringBuilder sb , int initialSubmode ) { } } | StringBuilder tmp = new StringBuilder ( count ) ; int submode = initialSubmode ; int idx = 0 ; while ( true ) { char ch = msg . charAt ( startpos + idx ) ; switch ( submode ) { case SUBMODE_ALPHA : if ( isAlphaUpper ( ch ) ) { if ( ch == ' ' ) { tmp . append ( ( char ) 26 ) ; // space
} else { tmp . append ( ( char ) ( ch - 65 ) ) ; } } else { if ( isAlphaLower ( ch ) ) { submode = SUBMODE_LOWER ; tmp . append ( ( char ) 27 ) ; // ll
continue ; } else if ( isMixed ( ch ) ) { submode = SUBMODE_MIXED ; tmp . append ( ( char ) 28 ) ; // ml
continue ; } else { tmp . append ( ( char ) 29 ) ; // ps
tmp . append ( ( char ) PUNCTUATION [ ch ] ) ; break ; } } break ; case SUBMODE_LOWER : if ( isAlphaLower ( ch ) ) { if ( ch == ' ' ) { tmp . append ( ( char ) 26 ) ; // space
} else { tmp . append ( ( char ) ( ch - 97 ) ) ; } } else { if ( isAlphaUpper ( ch ) ) { tmp . append ( ( char ) 27 ) ; // as
tmp . append ( ( char ) ( ch - 65 ) ) ; // space cannot happen here , it is also in " Lower "
break ; } else if ( isMixed ( ch ) ) { submode = SUBMODE_MIXED ; tmp . append ( ( char ) 28 ) ; // ml
continue ; } else { tmp . append ( ( char ) 29 ) ; // ps
tmp . append ( ( char ) PUNCTUATION [ ch ] ) ; break ; } } break ; case SUBMODE_MIXED : if ( isMixed ( ch ) ) { tmp . append ( ( char ) MIXED [ ch ] ) ; } else { if ( isAlphaUpper ( ch ) ) { submode = SUBMODE_ALPHA ; tmp . append ( ( char ) 28 ) ; // al
continue ; } else if ( isAlphaLower ( ch ) ) { submode = SUBMODE_LOWER ; tmp . append ( ( char ) 27 ) ; // ll
continue ; } else { if ( startpos + idx + 1 < count ) { char next = msg . charAt ( startpos + idx + 1 ) ; if ( isPunctuation ( next ) ) { submode = SUBMODE_PUNCTUATION ; tmp . append ( ( char ) 25 ) ; // pl
continue ; } } tmp . append ( ( char ) 29 ) ; // ps
tmp . append ( ( char ) PUNCTUATION [ ch ] ) ; } } break ; default : // SUBMODE _ PUNCTUATION
if ( isPunctuation ( ch ) ) { tmp . append ( ( char ) PUNCTUATION [ ch ] ) ; } else { submode = SUBMODE_ALPHA ; tmp . append ( ( char ) 29 ) ; // al
continue ; } } idx ++ ; if ( idx >= count ) { break ; } } char h = 0 ; int len = tmp . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { boolean odd = ( i % 2 ) != 0 ; if ( odd ) { h = ( char ) ( ( h * 30 ) + tmp . charAt ( i ) ) ; sb . append ( h ) ; } else { h = tmp . charAt ( i ) ; } } if ( ( len % 2 ) != 0 ) { sb . append ( ( char ) ( ( h * 30 ) + 29 ) ) ; // ps
} return submode ; |
public class NFRule { /** * Checks to see whether a string consists entirely of ignorable
* characters .
* @ param str The string to test .
* @ return true if the string is empty of consists entirely of
* characters that the number formatter ' s collator says are
* ignorable at the primary - order level . false otherwise . */
private boolean allIgnorable ( String str ) { } } | // if the string is empty , we can just return true
if ( str == null || str . length ( ) == 0 ) { return true ; } RbnfLenientScanner scanner = formatter . getLenientScanner ( ) ; return scanner != null && scanner . allIgnorable ( str ) ; |
public class ReportQuery { /** * Gets the timeZoneType value for this ReportQuery .
* @ return timeZoneType * Gets the { @ link TimeZoneType } for this report , which determines
* the time zone used for the
* report ' s date range . Defaults to { @ link TimeZoneType . PUBLISHER } . */
public com . google . api . ads . admanager . axis . v201811 . TimeZoneType getTimeZoneType ( ) { } } | return timeZoneType ; |
public class BasicComponent { /** * Increments the { @ link MyData } bean ' s count by 1 . Called by the action on { @ link # decBtn } . */
private void decrement ( ) { } } | MyData data = ( MyData ) getData ( ) ; int dataCount = data . getCount ( ) ; if ( dataCount > 0 ) { dataCount -- ; } data . setCount ( dataCount ) ; |
public class GeometryUtil { /** * Calculates the center of mass for the < code > Atom < / code > s in the AtomContainer .
* @ param ac AtomContainer for which the center of mass is calculated
* @ return The center of mass of the molecule , or < code > NULL < / code > if the molecule
* does not have 3D coordinates or if any of the atoms do not have a valid atomic mass
* @ cdk . keyword center of mass
* @ cdk . dictref blue - obelisk : calculate3DCenterOfMass */
public static Point3d get3DCentreOfMass ( IAtomContainer ac ) { } } | double xsum = 0.0 ; double ysum = 0.0 ; double zsum = 0.0 ; double totalmass = 0.0 ; Isotopes isotopes ; try { isotopes = Isotopes . getInstance ( ) ; } catch ( IOException e ) { throw new RuntimeException ( "Could not initialize Isotopes" ) ; } for ( IAtom a : ac . atoms ( ) ) { Double mass = a . getExactMass ( ) ; // some sanity checking
if ( a . getPoint3d ( ) == null ) return null ; if ( mass == null ) mass = isotopes . getNaturalMass ( a ) ; totalmass += mass ; xsum += mass * a . getPoint3d ( ) . x ; ysum += mass * a . getPoint3d ( ) . y ; zsum += mass * a . getPoint3d ( ) . z ; } return new Point3d ( xsum / totalmass , ysum / totalmass , zsum / totalmass ) ; |
public class ListT { /** * Filter the wrapped List
* < pre >
* { @ code
* ListT . of ( AnyM . fromStream ( Arrays . asList ( 10,11 ) )
* . filter ( t - > t ! = 10 ) ;
* / / ListT < AnyM < Stream < List [ 11 ] > > >
* < / pre >
* @ param test Predicate to filter the wrapped List
* @ return ListT that applies the provided filter */
@ Override public ListT < W , T > filter ( final Predicate < ? super T > test ) { } } | return of ( run . map ( seq -> seq . filter ( test ) ) ) ; |
public class AdBrokerBenchmark { /** * Produce a random longitude / latitude point within the bounding box
* where advertisers are placing bids .
* @ return a random point */
private GeographyPointValue getRandomPoint ( ) { } } | double lngRange = Regions . MAX_LNG - Regions . MIN_LNG ; double lng = Regions . MIN_LNG + lngRange * m_rand . nextDouble ( ) ; double latRange = Regions . MAX_LAT - Regions . MIN_LAT ; double lat = Regions . MIN_LAT + latRange * m_rand . nextDouble ( ) ; return new GeographyPointValue ( lng , lat ) ; |
public class IonCharacterReader { /** * Uses the push back implementation but normalizes newlines to " \ n " . */
@ Override public int read ( ) throws IOException { } } | int nextChar = super . read ( ) ; // process the character
if ( nextChar != - 1 ) { if ( nextChar == '\n' ) { m_line ++ ; pushColumn ( m_column ) ; m_column = 0 ; } else if ( nextChar == '\r' ) { int aheadChar = super . read ( ) ; // if the lookahead is not a newline combo , unread it
if ( aheadChar != '\n' ) { // no need to unread it with line / offset update .
unreadImpl ( aheadChar , false ) ; } m_line ++ ; pushColumn ( m_column ) ; m_column = 0 ; // normalize
nextChar = '\n' ; } else { m_column ++ ; } m_consumed ++ ; } return nextChar ; |
public class DiameterStackMultiplexer { /** * ( non - Javadoc )
* @ see org . mobicents . diameter . stack . DiameterStackMultiplexerMBean # _ LocalPeer _ removeIPAddress ( java . lang . String ) */
@ Override public void _LocalPeer_removeIPAddress ( String ipAddress ) throws MBeanException { } } | Configuration [ ] oldIPAddressesConfig = getMutableConfiguration ( ) . getChildren ( OwnIPAddresses . ordinal ( ) ) ; Configuration ipAddressToRemove = null ; List < Configuration > newIPAddressesConfig = Arrays . asList ( oldIPAddressesConfig ) ; for ( Configuration curIPAddress : newIPAddressesConfig ) { if ( curIPAddress . getStringValue ( OwnIPAddress . ordinal ( ) , DEFAULT_STRING ) . equals ( ipAddress ) ) { ipAddressToRemove = curIPAddress ; break ; } } if ( ipAddressToRemove != null ) { newIPAddressesConfig . remove ( ipAddressToRemove ) ; getMutableConfiguration ( ) . setChildren ( OwnIPAddresses . ordinal ( ) , ( Configuration [ ] ) newIPAddressesConfig . toArray ( ) ) ; if ( logger . isInfoEnabled ( ) ) { logger . info ( "Local Peer IP Address " + ipAddress + " successfully added. Restart to Diameter stack is needed to apply changes." ) ; } } else { if ( logger . isInfoEnabled ( ) ) { logger . info ( "Local Peer IP Address " + ipAddress + " not found. No changes were made." ) ; } } |
public class Image { /** * Draw a section of this image at a particular location and scale on the screen
* @ param x The x position to draw the image
* @ param y The y position to draw the image
* @ param x2 The x position of the bottom right corner of the drawn image
* @ param y2 The y position of the bottom right corner of the drawn image
* @ param srcx The x position of the rectangle to draw from this image ( i . e . relative to this image )
* @ param srcy The y position of the rectangle to draw from this image ( i . e . relative to this image )
* @ param srcx2 The x position of the bottom right cornder of rectangle to draw from this image ( i . e . relative to this image )
* @ param srcy2 The t position of the bottom right cornder of rectangle to draw from this image ( i . e . relative to this image )
* @ param filter The colour filter to apply when drawing */
public void draw ( float x , float y , float x2 , float y2 , float srcx , float srcy , float srcx2 , float srcy2 , Color filter ) { } } | init ( ) ; if ( alpha != 1 ) { if ( filter == null ) { filter = Color . white ; } filter = new Color ( filter ) ; filter . a *= alpha ; } filter . bind ( ) ; texture . bind ( ) ; GL . glTranslatef ( x , y , 0 ) ; if ( angle != 0 ) { GL . glTranslatef ( centerX , centerY , 0.0f ) ; GL . glRotatef ( angle , 0.0f , 0.0f , 1.0f ) ; GL . glTranslatef ( - centerX , - centerY , 0.0f ) ; } GL . glBegin ( SGL . GL_QUADS ) ; drawEmbedded ( 0 , 0 , x2 - x , y2 - y , srcx , srcy , srcx2 , srcy2 ) ; GL . glEnd ( ) ; if ( angle != 0 ) { GL . glTranslatef ( centerX , centerY , 0.0f ) ; GL . glRotatef ( - angle , 0.0f , 0.0f , 1.0f ) ; GL . glTranslatef ( - centerX , - centerY , 0.0f ) ; } GL . glTranslatef ( - x , - y , 0 ) ; // GL . glBegin ( SGL . GL _ QUADS ) ;
// drawEmbedded ( x , y , x2 , y2 , srcx , srcy , srcx2 , srcy2 ) ;
// GL . glEnd ( ) ; |
public class ConfigImpl { /** * Initializes and returns the flag indicating if files and directories
* located under the base directory should be scanned for javascript files
* when building the module dependency mappings . The default is false .
* @ param cfg
* The parsed config JavaScript as a properties map
* @ return true if files and folder under the base directory should be
* scanned */
protected boolean loadDepsIncludeBaseUrl ( Scriptable cfg ) { } } | boolean result = false ; Object value = cfg . get ( DEPSINCLUDEBASEURL_CONFIGPARAM , cfg ) ; if ( value != Scriptable . NOT_FOUND ) { result = TypeUtil . asBoolean ( toString ( value ) , false ) ; } return result ; |
public class DB { /** * Selects a page of posts with a specified type .
* @ param type The post type . May be { @ code null } for any type .
* @ param status The required post status .
* @ param terms A collection of terms attached to the posts .
* @ param sort The page sort .
* @ param paging The page range and interval .
* @ return The list of posts .
* @ throws SQLException on database error . */
public List < Long > selectPostIds ( final Post . Type type , final Post . Status status , final Collection < TaxonomyTerm > terms , final Post . Sort sort , final Paging paging ) throws SQLException { } } | return selectPostIds ( type != null ? EnumSet . of ( type ) : null , status , terms , sort , paging ) ; |
public class GVRTexture { /** * Set the list of { @ link GVRAtlasInformation } to map the texture atlas
* to each object of the scene .
* @ param atlasInformation Atlas information to map the texture atlas to each
* scene object . */
public void setAtlasInformation ( List < GVRAtlasInformation > atlasInformation ) { } } | if ( ( mImage != null ) && ( mImage instanceof GVRImageAtlas ) ) { ( ( GVRImageAtlas ) mImage ) . setAtlasInformation ( atlasInformation ) ; } |
public class DescribeTrainingJobResult { /** * A history of all of the secondary statuses that the training job has transitioned through .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setSecondaryStatusTransitions ( java . util . Collection ) } or
* { @ link # withSecondaryStatusTransitions ( java . util . Collection ) } if you want to override the existing values .
* @ param secondaryStatusTransitions
* A history of all of the secondary statuses that the training job has transitioned through .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeTrainingJobResult withSecondaryStatusTransitions ( SecondaryStatusTransition ... secondaryStatusTransitions ) { } } | if ( this . secondaryStatusTransitions == null ) { setSecondaryStatusTransitions ( new java . util . ArrayList < SecondaryStatusTransition > ( secondaryStatusTransitions . length ) ) ; } for ( SecondaryStatusTransition ele : secondaryStatusTransitions ) { this . secondaryStatusTransitions . add ( ele ) ; } return this ; |
public class ServerDispatcher { /** * Must be called with the clientsModificationLock hold . */
private void updateClients ( ) { } } | assignedClients . addAll ( newlyAssignedClients ) ; assignedClients . removeAll ( removedClients ) ; newlyAssignedClients . clear ( ) ; removedClients . clear ( ) ; |
public class BeatGrid { /** * Helper function to find the beat grid section in a rekordbox track analysis file .
* @ param anlzFile the file that was downloaded from the player
* @ return the section containing the beat grid */
private RekordboxAnlz . BeatGridTag findTag ( RekordboxAnlz anlzFile ) { } } | for ( RekordboxAnlz . TaggedSection section : anlzFile . sections ( ) ) { if ( section . body ( ) instanceof RekordboxAnlz . BeatGridTag ) { return ( RekordboxAnlz . BeatGridTag ) section . body ( ) ; } } throw new IllegalArgumentException ( "No beat grid found inside analysis file " + anlzFile ) ; |
public class NodeTypes { /** * Get the mandatory property definitions for a node with the named primary type and mixin types . Note that the
* { @ link # hasMandatoryPropertyDefinitions ( Name , Set ) } method should first be called with the primary type and mixin types ; if
* that method returns < code > true < / code > , then this method will never return an empty collection .
* @ param primaryType the primary type name ; may not be null
* @ param mixinTypes the mixin type names ; may not be null but may be empty
* @ return the collection of mandatory property definitions ; never null but possibly empty */
public Collection < JcrPropertyDefinition > getMandatoryPropertyDefinitions ( Name primaryType , Set < Name > mixinTypes ) { } } | if ( mixinTypes . isEmpty ( ) ) { return mandatoryPropertiesNodeTypes . get ( primaryType ) ; } Set < JcrPropertyDefinition > defn = new HashSet < JcrPropertyDefinition > ( ) ; defn . addAll ( mandatoryPropertiesNodeTypes . get ( primaryType ) ) ; for ( Name mixinType : mixinTypes ) { defn . addAll ( mandatoryPropertiesNodeTypes . get ( mixinType ) ) ; } return defn ; |
public class BigComplexMath { /** * Calculates the arc tangens ( inverted tangens ) of { @ link BigComplex } x in the complex domain .
* < p > See : < a href = " https : / / en . wikipedia . org / wiki / Inverse _ trigonometric _ functions # Extension _ to _ complex _ plane " > Wikipedia : Inverse trigonometric functions ( Extension to complex plane ) < / a > < / p >
* @ param x the { @ link BigComplex } to calculate the arc tangens for
* @ param mathContext the { @ link MathContext } used for the result
* @ return the calculated arc tangens { @ link BigComplex } with the precision specified in the < code > mathContext < / code > */
public static BigComplex atan ( BigComplex x , MathContext mathContext ) { } } | MathContext mc = new MathContext ( mathContext . getPrecision ( ) + 4 , mathContext . getRoundingMode ( ) ) ; return log ( I . subtract ( x , mc ) . divide ( I . add ( x , mc ) , mc ) , mc ) . divide ( I , mc ) . divide ( TWO , mc ) . round ( mathContext ) ; |
public class ChannelUtil { /** * Returns all the channel Names in the given Collection of channels
* @ param channels - list of channels
* @ return a set of all the unique names associated with the each channel in
* channels */
public static Collection < String > getChannelNames ( Collection < Channel > channels ) { } } | Collection < String > channelNames = new HashSet < String > ( ) ; for ( Channel channel : channels ) { channelNames . add ( channel . getName ( ) ) ; } return channelNames ; |
public class HtmlDocletWriter { /** * Adds the navigation bar for the Html page at the top and and the bottom .
* @ param header If true print navigation bar at the top of the page else
* @ param htmlTree the HtmlTree to which the nav links will be added */
protected void addNavLinks ( boolean header , Content htmlTree ) { } } | if ( ! configuration . nonavbar ) { Content tree = ( configuration . allowTag ( HtmlTag . NAV ) ) ? HtmlTree . NAV ( ) : htmlTree ; String allClassesId = "allclasses_" ; HtmlTree navDiv = new HtmlTree ( HtmlTag . DIV ) ; fixedNavDiv . addStyle ( HtmlStyle . fixedNav ) ; Content skipNavLinks = configuration . getContent ( "doclet.Skip_navigation_links" ) ; if ( header ) { fixedNavDiv . addContent ( HtmlConstants . START_OF_TOP_NAVBAR ) ; navDiv . addStyle ( HtmlStyle . topNav ) ; allClassesId += "navbar_top" ; Content a = getMarkerAnchor ( SectionName . NAVBAR_TOP ) ; // WCAG - Hyperlinks should contain text or an image with alt text - for AT tools
navDiv . addContent ( a ) ; Content skipLinkContent = HtmlTree . DIV ( HtmlStyle . skipNav , getHyperLink ( getDocLink ( SectionName . SKIP_NAVBAR_TOP ) , skipNavLinks , skipNavLinks . toString ( ) , "" ) ) ; navDiv . addContent ( skipLinkContent ) ; } else { tree . addContent ( HtmlConstants . START_OF_BOTTOM_NAVBAR ) ; navDiv . addStyle ( HtmlStyle . bottomNav ) ; allClassesId += "navbar_bottom" ; Content a = getMarkerAnchor ( SectionName . NAVBAR_BOTTOM ) ; navDiv . addContent ( a ) ; Content skipLinkContent = HtmlTree . DIV ( HtmlStyle . skipNav , getHyperLink ( getDocLink ( SectionName . SKIP_NAVBAR_BOTTOM ) , skipNavLinks , skipNavLinks . toString ( ) , "" ) ) ; navDiv . addContent ( skipLinkContent ) ; } if ( header ) { navDiv . addContent ( getMarkerAnchor ( SectionName . NAVBAR_TOP_FIRSTROW ) ) ; } else { navDiv . addContent ( getMarkerAnchor ( SectionName . NAVBAR_BOTTOM_FIRSTROW ) ) ; } HtmlTree navList = new HtmlTree ( HtmlTag . UL ) ; navList . addStyle ( HtmlStyle . navList ) ; navList . addAttr ( HtmlAttr . TITLE , configuration . getText ( "doclet.Navigation" ) ) ; if ( configuration . createoverview ) { navList . addContent ( getNavLinkContents ( ) ) ; } if ( configuration . showModules ) { if ( configuration . modules . size ( ) == 1 ) { navList . addContent ( getNavLinkModule ( configuration . modules . first ( ) ) ) ; } else if ( ! configuration . modules . isEmpty ( ) ) { navList . addContent ( getNavLinkModule ( ) ) ; } } if ( configuration . packages . size ( ) == 1 ) { navList . addContent ( getNavLinkPackage ( configuration . packages . first ( ) ) ) ; } else if ( ! configuration . packages . isEmpty ( ) ) { navList . addContent ( getNavLinkPackage ( ) ) ; } navList . addContent ( getNavLinkClass ( ) ) ; if ( configuration . classuse ) { navList . addContent ( getNavLinkClassUse ( ) ) ; } if ( configuration . createtree ) { navList . addContent ( getNavLinkTree ( ) ) ; } if ( ! ( configuration . nodeprecated || configuration . nodeprecatedlist ) ) { navList . addContent ( getNavLinkDeprecated ( ) ) ; } if ( configuration . createindex ) { navList . addContent ( getNavLinkIndex ( ) ) ; } if ( ! configuration . nohelp ) { navList . addContent ( getNavLinkHelp ( ) ) ; } navDiv . addContent ( navList ) ; Content aboutDiv = HtmlTree . DIV ( HtmlStyle . aboutLanguage , getUserHeaderFooter ( header ) ) ; navDiv . addContent ( aboutDiv ) ; if ( header ) { fixedNavDiv . addContent ( navDiv ) ; } else { tree . addContent ( navDiv ) ; } Content ulNav = HtmlTree . UL ( HtmlStyle . navList , getNavLinkPrevious ( ) , getNavLinkNext ( ) ) ; Content subDiv = HtmlTree . DIV ( HtmlStyle . subNav , ulNav ) ; if ( configuration . frames ) { Content ulFrames = HtmlTree . UL ( HtmlStyle . navList , getNavShowLists ( ) , getNavHideLists ( filename ) ) ; subDiv . addContent ( ulFrames ) ; } HtmlTree ulAllClasses = HtmlTree . UL ( HtmlStyle . navList , getNavLinkClassIndex ( ) ) ; ulAllClasses . addAttr ( HtmlAttr . ID , allClassesId ) ; subDiv . addContent ( ulAllClasses ) ; if ( header && configuration . createindex ) { HtmlTree inputText = HtmlTree . INPUT ( "text" , "search" ) ; HtmlTree inputReset = HtmlTree . INPUT ( "reset" , "reset" ) ; Content searchTxt = new ContentBuilder ( ) ; searchTxt . addContent ( configuration . getContent ( "doclet.search" ) ) ; searchTxt . addContent ( Contents . SPACE ) ; HtmlTree liInput = HtmlTree . LI ( HtmlTree . SPAN ( searchTxt ) ) ; liInput . addContent ( inputText ) ; liInput . addContent ( inputReset ) ; HtmlTree ulSearch = HtmlTree . UL ( HtmlStyle . navListSearch , liInput ) ; subDiv . addContent ( ulSearch ) ; } subDiv . addContent ( getAllClassesLinkScript ( allClassesId ) ) ; addSummaryDetailLinks ( subDiv ) ; if ( header ) { subDiv . addContent ( getMarkerAnchor ( SectionName . SKIP_NAVBAR_TOP ) ) ; fixedNavDiv . addContent ( subDiv ) ; fixedNavDiv . addContent ( HtmlConstants . END_OF_TOP_NAVBAR ) ; tree . addContent ( fixedNavDiv ) ; HtmlTree paddingDiv = HtmlTree . DIV ( HtmlStyle . navPadding , Contents . SPACE ) ; tree . addContent ( paddingDiv ) ; HtmlTree scriptTree = HtmlTree . SCRIPT ( ) ; String scriptCode = "<!--\n" + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n" + "//-->\n" ; RawHtml scriptContent = new RawHtml ( scriptCode . replace ( "\n" , DocletConstants . NL ) ) ; scriptTree . addContent ( scriptContent ) ; tree . addContent ( scriptTree ) ; } else { subDiv . addContent ( getMarkerAnchor ( SectionName . SKIP_NAVBAR_BOTTOM ) ) ; tree . addContent ( subDiv ) ; tree . addContent ( HtmlConstants . END_OF_BOTTOM_NAVBAR ) ; } if ( configuration . allowTag ( HtmlTag . NAV ) ) { htmlTree . addContent ( tree ) ; } } |
public class HttpSupport { /** * Produces a writer for sending raw data to HTTP clients .
* @ param contentType content type . If null - will not be set on the response
* @ param headers headers . If null - will not be set on the response
* @ param status will be sent to browser .
* @ return instance of a writer for writing content to HTTP client . */
protected PrintWriter writer ( String contentType , Map headers , int status ) { } } | try { RequestContext . setControllerResponse ( new NopResponse ( contentType , status ) ) ; if ( headers != null ) { for ( Object key : headers . keySet ( ) ) { if ( headers . get ( key ) != null ) RequestContext . getHttpResponse ( ) . addHeader ( key . toString ( ) , headers . get ( key ) . toString ( ) ) ; } } return RequestContext . getHttpResponse ( ) . getWriter ( ) ; } catch ( Exception e ) { throw new ControllerException ( e ) ; } |
public class SecurityUtils { /** * Generates a new JWT token .
* @ param user a User object belonging to the app
* @ param app the app object
* @ return a new JWT or null */
public static SignedJWT generateJWToken ( User user , App app ) { } } | if ( app != null ) { try { Date now = new Date ( ) ; JWTClaimsSet . Builder claimsSet = new JWTClaimsSet . Builder ( ) ; String userSecret = "" ; claimsSet . issueTime ( now ) ; claimsSet . expirationTime ( new Date ( now . getTime ( ) + ( app . getTokenValiditySec ( ) * 1000 ) ) ) ; claimsSet . notBeforeTime ( now ) ; claimsSet . claim ( "refresh" , getNextRefresh ( app . getTokenValiditySec ( ) ) ) ; claimsSet . claim ( Config . _APPID , app . getId ( ) ) ; if ( user != null ) { claimsSet . subject ( user . getId ( ) ) ; userSecret = user . getTokenSecret ( ) ; } JWSSigner signer = new MACSigner ( app . getSecret ( ) + userSecret ) ; SignedJWT signedJWT = new SignedJWT ( new JWSHeader ( JWSAlgorithm . HS256 ) , claimsSet . build ( ) ) ; signedJWT . sign ( signer ) ; return signedJWT ; } catch ( JOSEException e ) { logger . warn ( "Unable to sign JWT: {}." , e . getMessage ( ) ) ; } } return null ; |
public class DomHelper { /** * Generic creation method for non - group elements .
* @ param parent
* the parent group
* @ param name
* local group name of the element ( should be unique within the group )
* @ param type
* the type of the element ( tag name , e . g . ' image ' )
* @ param style
* The style to apply on the element .
* @ param generateId
* true if a unique id may be generated , otherwise the name will be used as id
* @ return the newly created element or null if creation failed or the name was null */
protected Element createElement ( Object parent , String name , String type , Style style , boolean generateId ) { } } | if ( null == name ) { return null ; } Element parentElement ; if ( parent == null ) { parentElement = getRootElement ( ) ; } else { parentElement = getGroup ( parent ) ; } if ( parentElement == null ) { return null ; } else { Element element ; String id = generateId ? Dom . assembleId ( parentElement . getId ( ) , name ) : name ; elementToName . put ( id , name ) ; switch ( namespace ) { case SVG : element = Dom . createElementNS ( Dom . NS_SVG , type , id ) ; if ( style != null ) { applyStyle ( element , style ) ; } break ; case VML : element = Dom . createElementNS ( Dom . NS_VML , type , id ) ; Element stroke = Dom . createElementNS ( Dom . NS_VML , "stroke" ) ; element . appendChild ( stroke ) ; Element fill = Dom . createElementNS ( Dom . NS_VML , "fill" ) ; element . appendChild ( fill ) ; if ( "shape" . equals ( name ) ) { // Set the size . . . . . if the parent has a coordsize defined , take it over :
String coordsize = parentElement . getAttribute ( "coordsize" ) ; if ( coordsize != null && coordsize . length ( ) > 0 ) { element . setAttribute ( "coordsize" , coordsize ) ; } } Dom . setStyleAttribute ( element , "position" , "absolute" ) ; VmlStyleUtil . applyStyle ( element , style ) ; break ; case HTML : default : element = Dom . createElementNS ( Dom . NS_HTML , type , id ) ; if ( style != null ) { applyStyle ( element , style ) ; } } parentElement . appendChild ( element ) ; Dom . setElementAttribute ( element , "id" , id ) ; return element ; } |
public class AmfWriter { /** * Enables the uses of the Vector and Dictionary type markers ( defaults
* to array serialization otherwise ) . */
public void enableExtendedSerializers ( ) { } } | amf3Serializers . put ( int [ ] . class , new Amf3IntVectorSerializer ( this ) ) ; amf3Serializers . put ( long [ ] . class , new Amf3UintVectorSerializer ( this ) ) ; amf3Serializers . put ( double [ ] . class , new Amf3DoubleVectorSerializer ( this ) ) ; amf3Serializers . put ( ArrayList . class , new Amf3VectorSerializer ( this ) ) ; amf3Serializers . put ( HashMap . class , new Amf3DictSerializer ( this ) ) ; |
public class SimpleConversionService { /** * / * ( non - Javadoc ) */
private boolean isJarFile ( URL resourceLocation ) { } } | String resourceLocationString = resourceLocation . toExternalForm ( ) ; return resourceLocationString . startsWith ( "jar:file:" ) || resourceLocationString . contains ( ".jar!" ) ; |
public class GrantFlowEntitlementsRequest { /** * The list of entitlements that you want to grant .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setEntitlements ( java . util . Collection ) } or { @ link # withEntitlements ( java . util . Collection ) } if you want to
* override the existing values .
* @ param entitlements
* The list of entitlements that you want to grant .
* @ return Returns a reference to this object so that method calls can be chained together . */
public GrantFlowEntitlementsRequest withEntitlements ( GrantEntitlementRequest ... entitlements ) { } } | if ( this . entitlements == null ) { setEntitlements ( new java . util . ArrayList < GrantEntitlementRequest > ( entitlements . length ) ) ; } for ( GrantEntitlementRequest ele : entitlements ) { this . entitlements . add ( ele ) ; } return this ; |
public class SecureUtil { /** * 生成签名对象 , 仅用于非对称加密
* @ param asymmetricAlgorithm { @ link AsymmetricAlgorithm } 非对称加密算法
* @ param digestAlgorithm { @ link DigestAlgorithm } 摘要算法
* @ return { @ link Signature } */
public static Signature generateSignature ( AsymmetricAlgorithm asymmetricAlgorithm , DigestAlgorithm digestAlgorithm ) { } } | try { return Signature . getInstance ( generateAlgorithm ( asymmetricAlgorithm , digestAlgorithm ) ) ; } catch ( NoSuchAlgorithmException e ) { throw new CryptoException ( e ) ; } |
public class MorcBuilder { /** * Add a set of processors to handle an outgoing exchange at a particular offset ( n ' th message )
* @ param index The exchange offset that these processors should be applied to
* @ param processors The processors that will handle populating the exchange with an appropriate outgoing value */
public Builder addProcessors ( int index , Processor ... processors ) { } } | while ( index >= this . processors . size ( ) ) { this . processors . add ( new ArrayList < > ( ) ) ; } this . processors . get ( index ) . addAll ( new ArrayList < > ( Arrays . asList ( processors ) ) ) ; return self ( ) ; |
public class Tags { /** * Optimized version of { @ code String # split } that doesn ' t use regexps .
* This function works in O ( 5n ) where n is the length of the string to
* split .
* @ param s The string to split .
* @ param c The separator to use to split the string .
* @ return A non - null , non - empty array . */
public static String [ ] splitString ( final String s , final char c ) { } } | final char [ ] chars = s . toCharArray ( ) ; int num_substrings = 1 ; for ( final char x : chars ) { if ( x == c ) { num_substrings ++ ; } } final String [ ] result = new String [ num_substrings ] ; final int len = chars . length ; int start = 0 ; // starting index in chars of the current substring .
int pos = 0 ; // current index in chars .
int i = 0 ; // number of the current substring .
for ( ; pos < len ; pos ++ ) { if ( chars [ pos ] == c ) { result [ i ++ ] = new String ( chars , start , pos - start ) ; start = pos + 1 ; } } result [ i ] = new String ( chars , start , pos - start ) ; return result ; |
public class JvmExecutableBuilder { @ Override public AnnotationVisitor visitAnnotationDefault ( ) { } } | return new JvmAnnotationValueBuilder ( proxies ) { int array = 0 ; @ Override public void visitEnd ( ) { if ( array == 0 ) { JvmOperation operation = ( JvmOperation ) JvmExecutableBuilder . this . result ; if ( result == null ) { if ( returnType . equals ( "()[Ljava/lang/Class;" ) ) { result = TypesFactory . eINSTANCE . createJvmTypeAnnotationValue ( ) ; } else if ( returnType . length ( ) == 4 ) { switch ( returnType . charAt ( 3 ) ) { case 'B' : result = TypesFactory . eINSTANCE . createJvmByteAnnotationValue ( ) ; break ; case 'C' : result = TypesFactory . eINSTANCE . createJvmCharAnnotationValue ( ) ; break ; case 'D' : result = TypesFactory . eINSTANCE . createJvmDoubleAnnotationValue ( ) ; break ; case 'F' : result = TypesFactory . eINSTANCE . createJvmFloatAnnotationValue ( ) ; break ; case 'I' : result = TypesFactory . eINSTANCE . createJvmIntAnnotationValue ( ) ; break ; case 'J' : result = TypesFactory . eINSTANCE . createJvmLongAnnotationValue ( ) ; break ; case 'S' : result = TypesFactory . eINSTANCE . createJvmShortAnnotationValue ( ) ; break ; case 'Z' : result = TypesFactory . eINSTANCE . createJvmBooleanAnnotationValue ( ) ; break ; default : throw new IllegalArgumentException ( returnType . toString ( ) ) ; } } else { result = TypesFactory . eINSTANCE . createJvmCustomAnnotationValue ( ) ; } } result . setOperation ( operation ) ; operation . setDefaultValue ( result ) ; } else { array -- ; } } @ Override public AnnotationVisitor visitArray ( String name ) { array ++ ; return this ; } } ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.