signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class EvaluationResult { /** * Add a new measurement group .
* @ param string Group name
* @ return Measurement group . */
public EvaluationResult . MeasurementGroup newGroup ( String string ) { } } | EvaluationResult . MeasurementGroup g = new MeasurementGroup ( string ) ; groups . add ( g ) ; return g ; |
public class Store { /** * add to lowlevel store content of Fedora object not already in
* lowlevel store
* @ return size - size of the object stored */
public final long add ( String pid , InputStream content ) throws LowlevelStorageException { } } | String filePath ; File file = null ; // check that object is not already in store
if ( pathRegistry . exists ( pid ) ) { throw new ObjectAlreadyInLowlevelStorageException ( pid ) ; } filePath = pathAlgorithm . get ( pid ) ; if ( filePath == null || filePath . equals ( "" ) ) { // guard against algorithm implementation
throw new LowlevelStorageException ( true , "null path from algorithm for pid " + pid ) ; } try { file = new File ( filePath ) ; } catch ( Exception eFile ) { // purposefully general catch - all
throw new LowlevelStorageException ( true , "couldn't make File for " + filePath , eFile ) ; } fileSystem . write ( file , content ) ; pathRegistry . put ( pid , filePath ) ; return file . length ( ) ; |
public class AWSServiceCatalogClient { /** * Deletes the specified constraint .
* @ param deleteConstraintRequest
* @ return Result of the DeleteConstraint operation returned by the service .
* @ throws ResourceNotFoundException
* The specified resource was not found .
* @ throws InvalidParametersException
* One or more parameters provided to the operation are not valid .
* @ sample AWSServiceCatalog . DeleteConstraint
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / servicecatalog - 2015-12-10 / DeleteConstraint "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DeleteConstraintResult deleteConstraint ( DeleteConstraintRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDeleteConstraint ( request ) ; |
public class DocumentVersionInfo { /** * Given a DocumentVersionInfo , returns a BSON document representing the next version . This means
* and incremented version count for a non - empty version , or a fresh version document for an
* empty version .
* @ return a BsonDocument representing a synchronization version */
BsonDocument getNextVersion ( ) { } } | if ( ! this . hasVersion ( ) || this . getVersionDoc ( ) == null ) { return getFreshVersionDocument ( ) ; } final BsonDocument nextVersion = BsonUtils . copyOfDocument ( this . getVersionDoc ( ) ) ; nextVersion . put ( Fields . VERSION_COUNTER_FIELD , new BsonInt64 ( this . getVersion ( ) . getVersionCounter ( ) + 1 ) ) ; return nextVersion ; |
public class Database { /** * Starts a transaction . Until commit ( ) or rollback ( ) is called on the
* source this will set the query context for all created queries to be a
* single threaded executor with one ( new ) connection .
* @ param dependency
* @ return */
public Observable < Boolean > beginTransaction ( Observable < ? > dependency ) { } } | return update ( "begin" ) . dependsOn ( dependency ) . count ( ) . map ( Functions . constant ( true ) ) ; |
public class SingleNumericValueExpression { /** * / * ( non - Javadoc )
* @ see com . github . mkolisnyk . aerial . expressions . ValueExpression # generate ( ) */
@ Override public List < InputRecord > generate ( ) throws Exception { } } | List < InputRecord > result = new ArrayList < InputRecord > ( ) ; InputRecord testRecord = ( InputRecord ) this . getInput ( ) . clone ( ) ; this . validate ( ) ; // Value is set explicitly
result . add ( testRecord ) ; result . add ( nonCurrentValue ( this . getInput ( ) ) ) ; return result ; |
public class EmptyBlockChainingListener { /** * { @ inheritDoc }
* @ since 2.0RC1 */
@ Override public void beginDefinitionList ( Map < String , String > parameters ) { } } | markNotEmpty ( ) ; startContainerBlock ( ) ; super . beginDefinitionList ( parameters ) ; |
public class HeaderContentListPanel { /** * Factory method for creating the new { @ link Component } for the list panel . This method is
* invoked in the constructor from the derived classes and can be overridden so users can
* provide their own version of a new { @ link Component } for the list panel .
* @ param id
* the id
* @ param model
* the model
* @ return the new { @ link Component } for the list panel . */
protected Component newListPanel ( final String id , final IModel < ContentListModelBean > model ) { } } | return new ResourceBundleKeysPanel ( id , model . getObject ( ) . getContentResourceKeys ( ) ) { private static final long serialVersionUID = 1L ; @ Override protected Component newListComponent ( final String id , final ListItem < ResourceBundleKey > item ) { return HeaderContentListPanel . this . newListComponent ( id , item ) ; } } ; |
public class Table { /** * Returns any foreign key constraint equivalent to the column sets */
Constraint getFKConstraintForColumns ( Table tableMain , int [ ] mainCols , int [ ] refCols ) { } } | for ( int i = 0 , size = constraintList . length ; i < size ; i ++ ) { Constraint c = constraintList [ i ] ; if ( c . isEquivalent ( tableMain , mainCols , this , refCols ) ) { return c ; } } return null ; |
public class Refunds { /** * 通过微信退款单号查询退款
* @ param refundId 微信退款单号
* @ return 退款查询对象 , 或抛WepayException */
public RefundQueryResponse queryByRefundId ( String refundId ) { } } | Map < String , String > queryParams = buildQueryParams ( WepayField . REFUND_ID , refundId ) ; Map < String , Object > respData = doPost ( QUERY , queryParams ) ; return renderQueryResp ( respData ) ; |
public class SetTimeAction { /** * / * ( non - Javadoc )
* @ see org . osgi . service . upnp . UPnPAction # getStateVariable ( java . lang . String ) */
public UPnPStateVariable getStateVariable ( String argumentName ) { } } | if ( argumentName . equals ( "NewTime" ) ) return time ; else if ( argumentName . equals ( "Result" ) ) return result ; else return null ; |
public class FnInteger { /** * A { @ link String } representing a percentage is created from the target number .
* @ return the string representation of the input number as a percentage */
public static final Function < Integer , String > toPercentStr ( ) { } } | return ( Function < Integer , String > ) ( ( Function ) FnNumber . toPercentStr ( ) ) ; |
public class HttpRequestMessageImpl { /** * Find the target port of the request . This checks the VirtualPort data and
* falls back on the socket port information if need be .
* @ return int */
private int getTargetPort ( ) { } } | int port = getVirtualPort ( ) ; if ( NOTSET == port ) { port = ( isIncoming ( ) ) ? getServiceContext ( ) . getLocalPort ( ) : getServiceContext ( ) . getRemotePort ( ) ; } return port ; |
public class S3_PING { /** * Sanitizes bucket and folder names according to AWS guidelines */
protected static String sanitize ( final String name ) { } } | String retval = name ; retval = retval . replace ( '/' , '-' ) ; retval = retval . replace ( '\\' , '-' ) ; return retval ; |
public class XLinkUtils { /** * Sets the value , of the field defined in the OpenEngSBModelEntry , the the given model ,
* with reflection . */
public static void setValueOfModel ( Object model , OpenEngSBModelEntry entry , Object value ) throws NoSuchFieldException , IllegalArgumentException , IllegalAccessException { } } | Class clazz = model . getClass ( ) ; Field field = clazz . getDeclaredField ( entry . getKey ( ) ) ; field . setAccessible ( true ) ; field . set ( model , value ) ; |
public class LocalStrategy { /** * We need to override this even if we override calculateNaturalEndpoints ,
* because the default implementation depends on token calculations but
* LocalStrategy may be used before tokens are set up . */
@ Override public ArrayList < InetAddress > getNaturalEndpoints ( RingPosition searchPosition ) { } } | ArrayList < InetAddress > l = new ArrayList < InetAddress > ( 1 ) ; l . add ( FBUtilities . getBroadcastAddress ( ) ) ; return l ; |
public class EntityFieldsUtils { /** * < p > filterBeanFields . < / p >
* @ param src a { @ link java . util . Collection } object .
* @ param pathProperties a { @ link ameba . message . internal . BeanPathProperties } object .
* @ param < T > a T object .
* @ return a { @ link java . util . Collection } object . */
@ SuppressWarnings ( "unchecked" ) public static < T > Collection < BeanMap < T > > filterBeanFields ( Collection < T > src , BeanPathProperties pathProperties ) { } } | return ( Collection < BeanMap < T > > ) FilteringBeanMap . from ( src , pathProperties ) ; |
public class ComputationGraph { /** * Conduct forward pass using the stored inputs
* @ param train If true : do forward pass at training time ; false : do forward pass at test time
* @ param layerTillIndex the index of the layer to feed forward to
* @ return A map of activations for each layer ( not each GraphVertex ) . Keys = layer name , values = layer activations */
public Map < String , INDArray > feedForward ( boolean train , int layerTillIndex ) { } } | int graphVertexIndexOfLayer = layers [ layerTillIndex ] . getIndex ( ) ; try { return ffToLayerActivationsDetached ( train , FwdPassType . STANDARD , false , graphVertexIndexOfLayer , null , inputs , inputMaskArrays , labelMaskArrays , true ) ; } catch ( OutOfMemoryError e ) { CrashReportingUtil . writeMemoryCrashDump ( this , e ) ; throw e ; } |
public class MessageRenderer { /** * Renders a collection of messages .
* @ param messages the collection of messages to render
* @ return string with rendered messages */
public String render ( Collection < Message5WH > messages ) { } } | StrBuilder ret = new StrBuilder ( 50 ) ; for ( Message5WH msg : messages ) { ret . appendln ( this . render ( msg ) ) ; } return ret . toString ( ) ; |
public class Boxing { /** * Transforms any array into an array of { @ code Byte } .
* @ param src source array
* @ param srcPos start position
* @ param len length
* @ return Byte array */
public static Byte [ ] boxBytes ( Object src , int srcPos , int len ) { } } | return boxBytes ( array ( src ) , srcPos , len ) ; |
public class ComplexDouble { /** * Subtract two complex numbers , in - place
* @ param c complex number to subtract
* @ param result resulting complex number
* @ return same as result */
public ComplexDouble subi ( ComplexDouble c , ComplexDouble result ) { } } | if ( this == result ) { r -= c . r ; i -= c . i ; } else { result . r = r - c . r ; result . i = i - c . i ; } return this ; |
public class LinearViterbi { /** * 前向Viterbi算法
* @ param lattice 网格
* @ param carrier 样本实例 */
protected void doForwardViterbi ( Node [ ] [ ] lattice , Instance carrier ) { } } | for ( int l = 1 ; l < lattice . length ; l ++ ) { for ( int c = 0 ; c < lattice [ l ] . length ; c ++ ) { if ( lattice [ l ] [ c ] == null ) continue ; float bestScore = Float . NEGATIVE_INFINITY ; int bestPath = - 1 ; for ( int p = 0 ; p < lattice [ l - 1 ] . length ; p ++ ) { if ( lattice [ l - 1 ] [ p ] == null ) continue ; float score = lattice [ l - 1 ] [ p ] . score + lattice [ l ] [ c ] . trans [ p ] ; if ( score > bestScore ) { bestScore = score ; bestPath = p ; } } bestScore += lattice [ l ] [ c ] . score ; lattice [ l ] [ c ] . addScore ( bestScore , bestPath ) ; } } |
public class SVGPath { /** * Cubic Bezier line to the given relative coordinates .
* @ param c1x first control point x
* @ param c1y first control point y
* @ param c2x second control point x
* @ param c2y second control point y
* @ param x new coordinates
* @ param y new coordinates
* @ return path object , for compact syntax . */
public SVGPath relativeCubicTo ( double c1x , double c1y , double c2x , double c2y , double x , double y ) { } } | return append ( PATH_CUBIC_TO_RELATIVE ) . append ( c1x ) . append ( c1y ) . append ( c2x ) . append ( c2y ) . append ( x ) . append ( y ) ; |
public class Utils { /** * 返回多个字符串中长度最长的字符串
* @ param strings 多个字符串
* @ return { @ link String } */
public static String maxLengthString ( String ... strings ) { } } | String res = "" ; for ( String string : strings ) { if ( string . length ( ) > res . length ( ) ) { res = string ; } } return res ; |
public class Solo { /** * Waits for a Dialog to open .
* @ param timeout the amount of time in milliseconds to wait
* @ return { @ code true } if the { @ link android . app . Dialog } is opened before the timeout and { @ code false } if it is not opened */
public boolean waitForDialogToOpen ( long timeout ) { } } | if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "waitForDialogToOpen(" + timeout + ")" ) ; } return dialogUtils . waitForDialogToOpen ( timeout , true ) ; |
public class Lifecycle { /** * Registers a component with the lifecycle . This should be done during dependency resolution
* by injecting the Lifecycle into your constructor and calling this method there . */
public void addComponent ( BaseComponent comp ) { } } | if ( comp instanceof InitComponent ) { if ( _initers == null ) { throw new IllegalStateException ( "Too late to register InitComponent." ) ; } _initers . add ( ( InitComponent ) comp ) ; } if ( comp instanceof ShutdownComponent ) { if ( _downers == null ) { throw new IllegalStateException ( "Too late to register ShutdownComponent." ) ; } _downers . add ( ( ShutdownComponent ) comp ) ; } |
public class AWSLambdaClient { /** * Returns the version - specific settings of a Lambda function or version . The output includes only options that can
* vary between versions of a function . To modify these settings , use < a > UpdateFunctionConfiguration < / a > .
* To get all of a function ' s details , including function - level settings , use < a > GetFunction < / a > .
* @ param getFunctionConfigurationRequest
* @ return Result of the GetFunctionConfiguration operation returned by the service .
* @ throws ServiceException
* The AWS Lambda service encountered an internal error .
* @ throws ResourceNotFoundException
* The resource ( for example , a Lambda function or access policy statement ) specified in the request does
* not exist .
* @ throws TooManyRequestsException
* Request throughput limit exceeded .
* @ throws InvalidParameterValueException
* One of the parameters in the request is invalid . For example , if you provided an IAM role for AWS Lambda
* to assume in the < code > CreateFunction < / code > or the < code > UpdateFunctionConfiguration < / code > API , that
* AWS Lambda is unable to assume you will get this exception .
* @ sample AWSLambda . GetFunctionConfiguration
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / lambda - 2015-03-31 / GetFunctionConfiguration "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public GetFunctionConfigurationResult getFunctionConfiguration ( GetFunctionConfigurationRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetFunctionConfiguration ( request ) ; |
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIfcColumnTypeEnumToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class CTB2CONLL { /** * 对ctb的格式进行预处理 , 去掉尖括号注释信息 , 只保留圆括号里的内容
* @ param file 文件名
* @ throws IOException
* 下午5:34:24 */
private static void clean ( String file ) throws IOException { } } | StringBuffer sb = new StringBuffer ( ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( new FileInputStream ( file ) , Charset . forName ( "utf8" ) ) ) ; String str ; while ( ( str = br . readLine ( ) ) != null ) { if ( str . length ( ) != 0 && ! str . trim ( ) . startsWith ( "<" ) ) { if ( str . equalsIgnoreCase ( "root" ) ) continue ; if ( str . contains ( "</HEADER> " ) || str . contains ( "</HEADLINE>" ) ) continue ; sb . append ( str + "\n" ) ; } } br . close ( ) ; Writer wr = new OutputStreamWriter ( new FileOutputStream ( new File ( file ) ) , Charset . forName ( "gbk" ) ) ; // 输出目录
wr . write ( sb . toString ( ) ) ; wr . close ( ) ; |
public class ColorPository { /** * Loads up a serialized ColorPository from the supplied resource manager . */
public static ColorPository loadColorPository ( ResourceManager rmgr ) { } } | try { return loadColorPository ( rmgr . getResource ( CONFIG_PATH ) ) ; } catch ( IOException ioe ) { log . warning ( "Failure loading color pository" , "path" , CONFIG_PATH , "error" , ioe ) ; return new ColorPository ( ) ; } |
public class SQLSharedServerLeaseLog { /** * Insert a new lease in the table
* @ param recoveryIdentity
* @ param recoveryGroup
* @ param conn
* @ throws SQLException */
private void insertNewLease ( String recoveryIdentity , String recoveryGroup , Connection conn ) throws SQLException { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "insertNewLease" , this ) ; short serviceId = ( short ) 1 ; String insertString = "INSERT INTO " + _leaseTableName + " (SERVER_IDENTITY, RECOVERY_GROUP, LEASE_OWNER, LEASE_TIME)" + " VALUES (?,?,?,?)" ; PreparedStatement specStatement = null ; long fir1 = System . currentTimeMillis ( ) ; Tr . audit ( tc , "WTRN0108I: Insert New Lease for server with recovery identity " + recoveryIdentity ) ; try { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Need to setup new row using - " + insertString + ", and time: " + fir1 ) ; specStatement = conn . prepareStatement ( insertString ) ; specStatement . setString ( 1 , recoveryIdentity ) ; specStatement . setString ( 2 , recoveryGroup ) ; specStatement . setString ( 3 , recoveryIdentity ) ; specStatement . setLong ( 4 , fir1 ) ; int ret = specStatement . executeUpdate ( ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Have inserted Server row with return: " + ret ) ; } finally { if ( specStatement != null && ! specStatement . isClosed ( ) ) specStatement . close ( ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "insertNewLease" ) ; |
public class ConcurrentCircularFifoBuffer { /** * { @ inheritDoc } */
@ Override @ SuppressWarnings ( "unchecked" ) public List < T > toList ( ) { } } | T [ ] elementsArray = ( T [ ] ) queue . toArray ( ) ; return List . ofAll ( Arrays . asList ( elementsArray ) ) ; |
public class Cob2CobolTypesGenerator { /** * Given a COBOL copybook , produce a set of java classes ( source code ) used
* to convert mainframe data ( matching the copybook ) at runtime .
* @ param cobolReader reads the COBOL copybook source
* @ param targetPackageName the java package the generated classes should
* reside in
* @ param xsltFileName an optional xslt to apply on the XML Schema
* @ return a map of java class names to their source code */
public Map < String , String > generate ( Reader cobolReader , String targetPackageName , final String xsltFileName ) { } } | // The XML schema is an intermediary result which we do not keep .
String xmlSchemaSource = cob2xsd . translate ( cobolReader , NamespaceUtils . toNamespace ( targetPackageName ) , xsltFileName ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Generated Cobol-annotated XML Schema: " ) ; log . debug ( xmlSchemaSource ) ; } return xsd2CobolTypes . generate ( xmlSchemaSource , targetPackageName ) ; |
public class ScaleSelect { /** * When the user selects a different scale , have the map zoom to it .
* @ see com . smartgwt . client . widgets . form . fields . events . ChangedHandler # onChanged
* ( com . smartgwt . client . widgets . form . fields . events . ChangedEvent ) */
public void onChanged ( ChangedEvent event ) { } } | String value = ( String ) scaleItem . getValue ( ) ; Double scale = valueToScale . get ( value ) ; if ( scale != null && ! Double . isNaN ( pixelLength ) && 0.0 != pixelLength ) { mapView . setCurrentScale ( scale / pixelLength , MapView . ZoomOption . LEVEL_CLOSEST ) ; } |
public class TcpChannelHub { /** * closes the existing connections */
synchronized void closeSocket ( ) { } } | @ Nullable SocketChannel clientChannel = this . clientChannel ; if ( clientChannel != null ) { try { clientChannel . socket ( ) . shutdownInput ( ) ; } catch ( ClosedChannelException ignored ) { } catch ( IOException e ) { Jvm . debug ( ) . on ( getClass ( ) , e ) ; } try { clientChannel . socket ( ) . shutdownOutput ( ) ; } catch ( ClosedChannelException ignored ) { } catch ( IOException e ) { Jvm . debug ( ) . on ( getClass ( ) , e ) ; } Closeable . closeQuietly ( clientChannel ) ; this . clientChannel = null ; if ( LOG . isDebugEnabled ( ) ) Jvm . debug ( ) . on ( getClass ( ) , "closing" , new StackTrace ( "only added for logging - please ignore !" ) ) ; @ NotNull final TcpSocketConsumer tcpSocketConsumer = this . tcpSocketConsumer ; tcpSocketConsumer . tid = 0 ; tcpSocketConsumer . omap . clear ( ) ; onDisconnected ( ) ; } |
public class Complex { /** * Returns the complex sine . */
public Complex sin ( ) { } } | return new Complex ( Math . sin ( re ) * Math . cosh ( im ) , Math . cos ( re ) * Math . sinh ( im ) ) ; |
public class UserRegistryProxy { /** * { @ inheritDoc } */
@ Override @ FFDCIgnore ( EntryNotFoundException . class ) public String getGroupDisplayName ( String groupSecurityName ) throws EntryNotFoundException , RegistryException { } } | for ( UserRegistry registry : delegates ) { try { return registry . getGroupDisplayName ( groupSecurityName ) ; } catch ( EntryNotFoundException enf ) { // We ignore this and keep trying . If we can ' t find we ' ll throw below
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "EntryNotFoundException caught on getGroupDisplayName" , registry , groupSecurityName , enf ) ; } } } throw new EntryNotFoundException ( groupSecurityName + " does not exist" ) ; |
public class URIUtils { /** * Convert an URI without a scheme to a file scheme .
* @ param uri the source URI
* @ return the converted URI */
public static URI convertUriWithoutSchemeToFileScheme ( URI uri ) { } } | if ( uri . getScheme ( ) == null ) { return Paths . get ( uri . getPath ( ) ) . toUri ( ) ; } return uri ; |
public class IsotopePatternManipulator { /** * Return the isotope pattern sorted and normalized by intensity
* to the highest abundance .
* @ param isotopeP The IsotopePattern object to sort
* @ return The IsotopePattern sorted */
public static IsotopePattern sortAndNormalizedByIntensity ( IsotopePattern isotopeP ) { } } | IsotopePattern isoNorma = normalize ( isotopeP ) ; return sortByIntensity ( isoNorma ) ; |
public class RectangularPrism3ifx { /** * Replies the property that is the depth of the box .
* @ return the depth property . */
@ Pure public IntegerProperty depthProperty ( ) { } } | if ( this . depth == null ) { this . depth = new ReadOnlyIntegerWrapper ( this , MathFXAttributeNames . DEPTH ) ; this . depth . bind ( Bindings . subtract ( maxZProperty ( ) , minZProperty ( ) ) ) ; } return this . depth ; |
public class AdminFileconfigAction { public static OptionalEntity < FileConfig > getEntity ( final CreateForm form , final String username , final long currentTime ) { } } | switch ( form . crudMode ) { case CrudMode . CREATE : return OptionalEntity . of ( new FileConfig ( ) ) . map ( entity -> { entity . setCreatedBy ( username ) ; entity . setCreatedTime ( currentTime ) ; return entity ; } ) ; case CrudMode . EDIT : if ( form instanceof EditForm ) { return ComponentUtil . getComponent ( FileConfigService . class ) . getFileConfig ( ( ( EditForm ) form ) . id ) ; } break ; default : break ; } return OptionalEntity . empty ( ) ; |
public class ListCreateAccountStatusRequest { /** * A list of one or more states that you want included in the response . If this parameter is not present , then all
* requests are included in the response .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setStates ( java . util . Collection ) } or { @ link # withStates ( java . util . Collection ) } if you want to override the
* existing values .
* @ param states
* A list of one or more states that you want included in the response . If this parameter is not present ,
* then all requests are included in the response .
* @ return Returns a reference to this object so that method calls can be chained together .
* @ see CreateAccountState */
public ListCreateAccountStatusRequest withStates ( String ... states ) { } } | if ( this . states == null ) { setStates ( new java . util . ArrayList < String > ( states . length ) ) ; } for ( String ele : states ) { this . states . add ( ele ) ; } return this ; |
public class Trends { /** * Removes elements that points to the oldest items .
* Leave trends unchanged if the limit is bigger than current trends length .
* @ param limit number of elements that will be leave */
public void limitItems ( int limit ) { } } | buildNumbers = copyLastElements ( buildNumbers , limit ) ; passedFeatures = copyLastElements ( passedFeatures , limit ) ; failedFeatures = copyLastElements ( failedFeatures , limit ) ; totalFeatures = copyLastElements ( totalFeatures , limit ) ; passedScenarios = copyLastElements ( passedScenarios , limit ) ; failedScenarios = copyLastElements ( failedScenarios , limit ) ; totalScenarios = copyLastElements ( totalScenarios , limit ) ; passedSteps = copyLastElements ( passedSteps , limit ) ; failedSteps = copyLastElements ( failedSteps , limit ) ; skippedSteps = copyLastElements ( skippedSteps , limit ) ; pendingSteps = copyLastElements ( pendingSteps , limit ) ; undefinedSteps = copyLastElements ( undefinedSteps , limit ) ; totalSteps = copyLastElements ( totalSteps , limit ) ; durations = copyLastElements ( durations , limit ) ; |
public class XMLSerializer { /** * Write attribute .
* @ param attributeName the attribute name
* @ param value the value
* @ throws IOException Signals that an I / O exception has occurred . */
public void writeAttribute ( String attributeName , String value ) throws IOException { } } | this . attribute ( null , attributeName , value ) ; |
public class FacesContext { /** * < p class = " changed _ added _ 2_0 " > The implementation must call this method
* at the earliest possble point in time after entering into a new phase
* in the request processing lifecycle . < / p >
* @ param currentPhaseId The { @ link javax . faces . event . PhaseId } for the
* current phase .
* @ throws IllegalStateException if this method is called after
* this instance has been released
* @ since 2.0 */
public void setCurrentPhaseId ( PhaseId currentPhaseId ) { } } | if ( defaultFacesContext != null ) { defaultFacesContext . setCurrentPhaseId ( currentPhaseId ) ; } else if ( ! isCreatedFromValidFactory ) { this . currentPhaseIdForInvalidFactoryConstruction = currentPhaseId ; } else { throw new UnsupportedOperationException ( ) ; } |
public class PageFlowUtils { /** * Get a named action output that was registered in the current request .
* @ param name the name of the action output .
* @ param request the current ServletRequest
* @ see # addActionOutput */
public static Object getActionOutput ( String name , ServletRequest request ) { } } | Map map = InternalUtils . getActionOutputMap ( request , false ) ; return map != null ? map . get ( name ) : null ; |
public class SentryAppender { /** * Builds an EventBuilder based on the logging event .
* @ param iLoggingEvent Log generated .
* @ return EventBuilder containing details provided by the logging system . */
protected EventBuilder createEventBuilder ( ILoggingEvent iLoggingEvent ) { } } | EventBuilder eventBuilder = new EventBuilder ( ) . withSdkIntegration ( "logback" ) . withTimestamp ( new Date ( iLoggingEvent . getTimeStamp ( ) ) ) . withMessage ( iLoggingEvent . getFormattedMessage ( ) ) . withLogger ( iLoggingEvent . getLoggerName ( ) ) . withLevel ( formatLevel ( iLoggingEvent . getLevel ( ) ) ) . withExtra ( THREAD_NAME , iLoggingEvent . getThreadName ( ) ) ; if ( iLoggingEvent . getArgumentArray ( ) != null ) { eventBuilder . withSentryInterface ( new MessageInterface ( iLoggingEvent . getMessage ( ) , formatMessageParameters ( iLoggingEvent . getArgumentArray ( ) ) , iLoggingEvent . getFormattedMessage ( ) ) ) ; } if ( iLoggingEvent . getThrowableProxy ( ) != null ) { eventBuilder . withSentryInterface ( new ExceptionInterface ( extractExceptionQueue ( iLoggingEvent ) ) ) ; } else if ( iLoggingEvent . getCallerData ( ) . length > 0 ) { eventBuilder . withSentryInterface ( new StackTraceInterface ( iLoggingEvent . getCallerData ( ) ) ) ; } for ( Map . Entry < String , String > contextEntry : iLoggingEvent . getLoggerContextVO ( ) . getPropertyMap ( ) . entrySet ( ) ) { eventBuilder . withExtra ( contextEntry . getKey ( ) , contextEntry . getValue ( ) ) ; } for ( Map . Entry < String , String > mdcEntry : iLoggingEvent . getMDCPropertyMap ( ) . entrySet ( ) ) { if ( Sentry . getStoredClient ( ) . getMdcTags ( ) . contains ( mdcEntry . getKey ( ) ) ) { eventBuilder . withTag ( mdcEntry . getKey ( ) , mdcEntry . getValue ( ) ) ; } else { eventBuilder . withExtra ( mdcEntry . getKey ( ) , mdcEntry . getValue ( ) ) ; } } if ( iLoggingEvent . getMarker ( ) != null ) { eventBuilder . withTag ( LOGBACK_MARKER , iLoggingEvent . getMarker ( ) . getName ( ) ) ; } return eventBuilder ; |
public class ObjectCacheDefaultImpl { /** * Lookup object with Identity oid in objectTable .
* Returns null if no matching id is found */
public Object lookup ( Identity oid ) { } } | processQueue ( ) ; hitCount ++ ; Object result = null ; CacheEntry entry = ( CacheEntry ) objectTable . get ( buildKey ( oid ) ) ; if ( entry != null ) { result = entry . get ( ) ; if ( result == null || entry . getLifetime ( ) < System . currentTimeMillis ( ) ) { /* cached object was removed by gc or lifetime was exhausted
remove CacheEntry from map */
gcCount ++ ; remove ( oid ) ; // make sure that we return null
result = null ; } else { /* TODO : Not sure if this makes sense , could help to avoid corrupted objects
when changed in tx but not stored . */
traceIdentity ( oid ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Object match " + oid ) ; } } else { failCount ++ ; } return result ; |
public class Context { /** * Set the associated debugger .
* @ param debugger the debugger to be used on callbacks from
* the engine .
* @ param contextData arbitrary object that debugger can use to store
* per Context data . */
public final void setDebugger ( Debugger debugger , Object contextData ) { } } | if ( sealed ) onSealedMutation ( ) ; this . debugger = debugger ; debuggerData = contextData ; |
public class AdUnit { /** * Gets the smartSizeMode value for this AdUnit .
* @ return smartSizeMode * The smart size mode for this ad unit . This attribute is optional
* and defaults to { @ link
* SmartSizeMode # NONE } for fixed sizes . */
public com . google . api . ads . admanager . axis . v201902 . SmartSizeMode getSmartSizeMode ( ) { } } | return smartSizeMode ; |
public class ConfusionMatrix { /** * Returns F - measure for categories ; see See http : / / en . wikipedia . org / wiki / F1 _ score
* @ return double */
public Map < String , Double > getFMeasureForLabels ( ) { } } | Map < String , Double > fMeasure = new LinkedHashMap < > ( ) ; Map < String , Double > precisionForLabels = getPrecisionForLabels ( ) ; Map < String , Double > recallForLabels = getRecallForLabels ( ) ; for ( String label : allGoldLabels ) { double p = precisionForLabels . get ( label ) ; double r = recallForLabels . get ( label ) ; double fm = 0 ; if ( ( p + r ) > 0 ) { fm = ( 2 * p * r ) / ( p + r ) ; } fMeasure . put ( label , fm ) ; } return fMeasure ; |
public class ResourceRequestQueue { /** * Satisfies one resource for the front - most request . If that satisfies the
* request , it is removed from the queue . */
synchronized ResourceRequestEvent satisfyOne ( ) { } } | final ResourceRequest req = this . requestQueue . element ( ) ; req . satisfyOne ( ) ; if ( req . isSatisfied ( ) ) { this . requestQueue . poll ( ) ; } return req . getRequestProto ( ) ; |
public class CmsGroupEditDialog { /** * Save group . < p > */
protected void saveGroup ( ) { } } | if ( m_group == null ) { m_group = new CmsGroup ( ) ; String ou = m_ou . getValue ( ) ; if ( ! ou . endsWith ( "/" ) ) { ou += "/" ; } m_group . setName ( m_name . getValue ( ) ) ; try { m_cms . createGroup ( ou + m_name . getValue ( ) , m_description . getValue ( ) , 0 , null ) ; } catch ( CmsException e ) { } } m_group . setDescription ( m_description . getValue ( ) ) ; m_group . setEnabled ( m_enabled . getValue ( ) . booleanValue ( ) ) ; try { m_cms . writeGroup ( m_group ) ; } catch ( CmsException e ) { } |
public class Convert { /** * 转换为Enum对象 < br >
* 如果给定的值为空 , 或者转换失败 , 返回默认值 < br >
* @ param < E > 枚举类型
* @ param clazz Enum的Class
* @ param value 值
* @ param defaultValue 默认值
* @ return Enum */
public static < E extends Enum < E > > E toEnum ( Class < E > clazz , Object value , E defaultValue ) { } } | return ( new GenericEnumConverter < > ( clazz ) ) . convert ( value , defaultValue ) ; |
public class MetaDataService { /** * Add specified entities to entity group .
* @ param entityGroupName Entity group name .
* @ param createEntities Automatically create new entities from the submitted list if such entities don ' t already exist .
* @ param entities Entities to create .
* @ return { @ code true } if entities added .
* @ throws AtsdClientException raised if there is any client problem
* @ throws AtsdServerException raised if there is any server problem */
public boolean addGroupEntities ( String entityGroupName , Boolean createEntities , Entity ... entities ) { } } | checkEntityGroupIsEmpty ( entityGroupName ) ; List < String > entitiesNames = new ArrayList < > ( ) ; for ( Entity entity : entities ) { entitiesNames . add ( entity . getName ( ) ) ; } QueryPart < EntityGroup > query = new Query < EntityGroup > ( "entity-groups" ) . path ( entityGroupName , true ) . path ( "entities/add" ) . param ( "createEntities" , createEntities ) ; return httpClientManager . updateData ( query , post ( entitiesNames ) ) ; |
public class FrequencyCap { /** * Gets the timeUnit value for this FrequencyCap .
* @ return timeUnit * Unit of time the cap is defined at .
* Only the Day , Week and Month time units are supported . */
public com . google . api . ads . adwords . axis . v201809 . cm . TimeUnit getTimeUnit ( ) { } } | return timeUnit ; |
public class Gauge { /** * Sets the minimum value of the gauge scale to the given value
* @ param VALUE */
public void setMinValue ( final double VALUE ) { } } | if ( Status . RUNNING == timeline . getStatus ( ) ) { timeline . jumpTo ( Duration . ONE ) ; } if ( null == minValue ) { if ( VALUE > getMaxValue ( ) ) { setMaxValue ( VALUE ) ; } _minValue = Helper . clamp ( - Double . MAX_VALUE , getMaxValue ( ) , VALUE ) ; setRange ( getMaxValue ( ) - _minValue ) ; if ( Double . compare ( originalMinValue , - Double . MAX_VALUE ) == 0 ) originalMinValue = _minValue ; if ( isStartFromZero ( ) && _minValue < 0 ) setValue ( 0 ) ; if ( Double . compare ( originalThreshold , getThreshold ( ) ) < 0 ) { setThreshold ( Helper . clamp ( _minValue , getMaxValue ( ) , originalThreshold ) ) ; } updateFormatString ( ) ; fireUpdateEvent ( RECALC_EVENT ) ; if ( ! valueProperty ( ) . isBound ( ) ) Gauge . this . setValue ( Helper . clamp ( getMinValue ( ) , getMaxValue ( ) , Gauge . this . getValue ( ) ) ) ; } else { minValue . set ( VALUE ) ; } |
public class FsDataWriter { /** * { @ inheritDoc } .
* This default implementation simply deletes the staging file if it exists .
* @ throws IOException if deletion of the staging file fails */
@ Override public void cleanup ( ) throws IOException { } } | // Delete the staging file
if ( this . fs . exists ( this . stagingFile ) ) { HadoopUtils . deletePath ( this . fs , this . stagingFile , false ) ; } |
public class SQLiteRepository { /** * This method allows to replace all entity children of a given parent , it will remove any children which are not in
* the list , add the new ones and update which are in the list . .
* @ param list of children to replace .
* @ param parentId id of parent entity .
* @ param clazz entity class . */
public static < T extends Entity > void replaceChildren ( List < T > list , String parentId , Class < T > clazz ) { } } | SQLiteRepository < T > repository = ( SQLiteRepository < T > ) AbstractApplication . get ( ) . getRepositoryInstance ( clazz ) ; repository . replaceChildren ( list , parentId ) ; |
public class MessageBuffer { /** * Write a big - endian integer value to the memory
* @ param index
* @ param v */
public void putInt ( int index , int v ) { } } | // Reversing the endian
v = Integer . reverseBytes ( v ) ; unsafe . putInt ( base , address + index , v ) ; |
public class ClassUtil { /** * getAnnotatedFields .
* @ param object
* a { @ link java . lang . Object } object .
* @ param annotationClass
* a { @ link java . lang . Class } object .
* @ param < T >
* a T object .
* @ return a { @ link java . util . List } object . */
public static < T > List < Field > getAnnotatedFields ( Object object , Class < ? extends Annotation > annotationClass ) { } } | return getAnnotatedFields ( object . getClass ( ) , annotationClass ) ; |
public class BamManager { /** * Creates a BAM / CRAM index file .
* @ param outputIndex The bai index file to be created .
* @ return
* @ throws IOException */
public Path createIndex ( Path outputIndex ) throws IOException { } } | FileUtils . checkDirectory ( outputIndex . toAbsolutePath ( ) . getParent ( ) , true ) ; SamReaderFactory srf = SamReaderFactory . make ( ) . enable ( SamReaderFactory . Option . INCLUDE_SOURCE_IN_RECORDS ) ; srf . validationStringency ( ValidationStringency . LENIENT ) ; try ( SamReader reader = srf . open ( SamInputResource . of ( bamFile . toFile ( ) ) ) ) { // Files need to be sorted by coordinates to create the index
SAMFileHeader . SortOrder sortOrder = reader . getFileHeader ( ) . getSortOrder ( ) ; if ( ! sortOrder . equals ( SAMFileHeader . SortOrder . coordinate ) ) { throw new IOException ( "Sorted file expected. File '" + bamFile . toString ( ) + "' is not sorted by coordinates (" + sortOrder . name ( ) + ")" ) ; } if ( reader . type ( ) . equals ( SamReader . Type . BAM_TYPE ) ) { BAMIndexer . createIndex ( reader , outputIndex . toFile ( ) , Log . getInstance ( BamManager . class ) ) ; } else { if ( reader . type ( ) . equals ( SamReader . Type . CRAM_TYPE ) ) { // TODO This really needs to be tested !
SeekableStream streamFor = SeekableStreamFactory . getInstance ( ) . getStreamFor ( bamFile . toString ( ) ) ; CRAMBAIIndexer . createIndex ( streamFor , outputIndex . toFile ( ) , Log . getInstance ( BamManager . class ) , ValidationStringency . DEFAULT_STRINGENCY ) ; } else { throw new IOException ( "This is not a BAM or CRAM file. SAM files cannot be indexed" ) ; } } } return outputIndex ; |
public class Specification { /** * < p > newInstance . < / p >
* @ param name a { @ link java . lang . String } object .
* @ return a { @ link com . greenpepper . server . domain . Specification } object . */
public static Specification newInstance ( String name ) { } } | Specification specification = new Specification ( ) ; specification . setName ( name ) ; return specification ; |
public class JCalendar { /** * Sets the date . Fires the property change " date " .
* @ param date
* the new date .
* @ throws NullPointerException -
* if tha date is null */
public void setDate ( Date date ) { } } | Date oldDate = calendar . getTime ( ) ; calendar . setTime ( date ) ; int year = calendar . get ( Calendar . YEAR ) ; int month = calendar . get ( Calendar . MONTH ) ; int day = calendar . get ( Calendar . DAY_OF_MONTH ) ; yearChooser . setYear ( year ) ; monthChooser . setMonth ( month ) ; dayChooser . setCalendar ( calendar ) ; dayChooser . setDay ( day ) ; firePropertyChange ( "date" , oldDate , date ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcRotationalMassMeasure ( ) { } } | if ( ifcRotationalMassMeasureEClass == null ) { ifcRotationalMassMeasureEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 859 ) ; } return ifcRotationalMassMeasureEClass ; |
public class tools { /** * Converts a byte into a hex string ( e . g . 164 - & gt ; " a4 " )
* @ param b input byte
* @ return hex representation of input byte */
public static String toHexString ( byte b ) { } } | final char [ ] out = new char [ 2 ] ; out [ 0 ] = hexDigits [ ( 0xF0 & b ) >>> 4 ] ; out [ 1 ] = hexDigits [ 0x0F & b ] ; return new String ( out ) ; |
public class InstrumentedConverterBase { /** * Called before conversion .
* @ param outputSchema output schema of the { @ link # convertSchema ( Object , WorkUnitState ) } method
* @ param inputRecord an input data record
* @ param workUnit a { @ link WorkUnitState } instance */
public void beforeConvert ( SO outputSchema , DI inputRecord , WorkUnitState workUnit ) { } } | Instrumented . markMeter ( this . recordsInMeter ) ; |
public class BigtableRegionLocator { /** * { @ inheritDoc } */
@ Override public Pair < byte [ ] [ ] , byte [ ] [ ] > getStartEndKeys ( ) throws IOException { } } | List < HRegionLocation > regions = getAllRegionLocations ( ) ; byte [ ] [ ] startKeys = new byte [ regions . size ( ) ] [ ] ; byte [ ] [ ] endKeys = new byte [ regions . size ( ) ] [ ] ; int i = 0 ; for ( HRegionLocation region : regions ) { startKeys [ i ] = region . getRegionInfo ( ) . getStartKey ( ) ; endKeys [ i ] = region . getRegionInfo ( ) . getEndKey ( ) ; i ++ ; } return Pair . newPair ( startKeys , endKeys ) ; |
public class ExpressRouteCrossConnectionsInner { /** * Update the specified ExpressRouteCrossConnection .
* @ param resourceGroupName The name of the resource group .
* @ param crossConnectionName The name of the ExpressRouteCrossConnection .
* @ param parameters Parameters supplied to the update express route crossConnection operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the ExpressRouteCrossConnectionInner object if successful . */
public ExpressRouteCrossConnectionInner beginCreateOrUpdate ( String resourceGroupName , String crossConnectionName , ExpressRouteCrossConnectionInner parameters ) { } } | return beginCreateOrUpdateWithServiceResponseAsync ( resourceGroupName , crossConnectionName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class JournalEntry { /** * convenience method for setting values into the Context recovery space . */
public void setRecoveryValue ( URI attribute , String value ) { } } | checkOpen ( ) ; context . setRecoveryValue ( attribute , value ) ; |
public class DefaultClientResources { /** * Returns a builder to create new { @ link DefaultClientResources } whose settings are replicated from the current
* { @ link DefaultClientResources } .
* Note : The resulting { @ link DefaultClientResources } retains shared state for { @ link Timer } ,
* { @ link CommandLatencyCollector } , { @ link EventExecutorGroup } , and { @ link EventLoopGroupProvider } if these are left
* unchanged . Thus you need only to shut down the last created { @ link ClientResources } instances . Shutdown affects any
* previously created { @ link ClientResources } .
* @ return a { @ link DefaultClientResources . Builder } to create new { @ link DefaultClientResources } whose settings are
* replicated from the current { @ link DefaultClientResources } .
* @ since 5.1 */
@ Override public DefaultClientResources . Builder mutate ( ) { } } | Builder builder = new Builder ( ) ; builder . eventExecutorGroup ( eventExecutorGroup ( ) ) . timer ( timer ( ) ) . eventBus ( eventBus ( ) ) . commandLatencyCollector ( commandLatencyCollector ( ) ) . commandLatencyPublisherOptions ( commandLatencyPublisherOptions ( ) ) . dnsResolver ( dnsResolver ( ) ) . socketAddressResolver ( socketAddressResolver ( ) ) . reconnectDelay ( reconnectDelay ) . nettyCustomizer ( nettyCustomizer ( ) ) . tracing ( tracing ( ) ) ; builder . sharedCommandLatencyCollector = sharedEventLoopGroupProvider ; builder . sharedEventExecutor = sharedEventExecutor ; builder . sharedEventLoopGroupProvider = sharedEventLoopGroupProvider ; builder . sharedTimer = sharedTimer ; return builder ; |
public class EsStorage { /** * Finds entities using a generic search criteria bean .
* @ param criteria
* @ param type
* @ param unmarshaller
* @ throws StorageException */
private < T > SearchResultsBean < T > find ( SearchCriteriaBean criteria , String type , IUnmarshaller < T > unmarshaller ) throws StorageException { } } | try { SearchResultsBean < T > rval = new SearchResultsBean < > ( ) ; // Set some default in the case that paging information was not included in the request .
PagingBean paging = criteria . getPaging ( ) ; if ( paging == null ) { paging = new PagingBean ( ) ; paging . setPage ( 1 ) ; paging . setPageSize ( 20 ) ; } int page = paging . getPage ( ) ; int pageSize = paging . getPageSize ( ) ; int start = ( page - 1 ) * pageSize ; SearchSourceBuilder builder = new SearchSourceBuilder ( ) . size ( pageSize ) . from ( start ) . fetchSource ( true ) ; // Sort order
OrderByBean orderBy = criteria . getOrderBy ( ) ; if ( orderBy != null ) { String name = orderBy . getName ( ) ; if ( name . equals ( "name" ) || name . equals ( "fullName" ) ) { // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
name += ".raw" ; // $ NON - NLS - 1 $
} if ( orderBy . isAscending ( ) ) { builder . sort ( name , SortOrder . ASC ) ; } else { builder . sort ( name , SortOrder . DESC ) ; } } // Now process the filter criteria
List < SearchCriteriaFilterBean > filters = criteria . getFilters ( ) ; QueryBuilder q = null ; if ( filters != null && ! filters . isEmpty ( ) ) { FilterBuilder andFilter = FilterBuilders . filter ( ) ; int filterCount = 0 ; for ( SearchCriteriaFilterBean filter : filters ) { String propertyName = filter . getName ( ) ; if ( filter . getOperator ( ) == SearchCriteriaFilterOperator . eq ) { andFilter . add ( FilterBuilders . termFilter ( propertyName , filter . getValue ( ) ) ) ; filterCount ++ ; } else if ( filter . getOperator ( ) == SearchCriteriaFilterOperator . like ) { q = QueryBuilders . wildcardQuery ( propertyName , filter . getValue ( ) . toLowerCase ( ) . replace ( '%' , '*' ) ) ; } else if ( filter . getOperator ( ) == SearchCriteriaFilterOperator . bool_eq ) { andFilter . add ( FilterBuilders . termFilter ( propertyName , "true" . equals ( filter . getValue ( ) ) ) ) ; // $ NON - NLS - 1 $
filterCount ++ ; } // TODO implement the other filter operators here !
} if ( filterCount > 0 ) { q = FilterBuilders . boolFilter ( andFilter ) ; } } builder . query ( q ) ; String query = builder . string ( ) ; Search search = new Search . Builder ( query ) . addIndex ( getIndexName ( ) ) . addType ( type ) . build ( ) ; SearchResult response = esClient . execute ( search ) ; @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) List < Hit < Map < String , Object > , Void > > thehits = ( List ) response . getHits ( Map . class ) ; rval . setTotalSize ( ( int ) ( long ) response . getTotal ( ) ) ; for ( Hit < Map < String , Object > , Void > hit : thehits ) { Map < String , Object > sourceAsMap = hit . source ; T bean = unmarshaller . unmarshal ( sourceAsMap ) ; rval . getBeans ( ) . add ( bean ) ; } return rval ; } catch ( Exception e ) { throw new StorageException ( e ) ; } |
public class PolicyStatesInner { /** * Summarizes policy states for the resources under the management group .
* @ param managementGroupName Management group name .
* @ param queryOptions Additional parameters for the operation
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the SummarizeResultsInner object */
public Observable < SummarizeResultsInner > summarizeForManagementGroupAsync ( String managementGroupName , QueryOptions queryOptions ) { } } | return summarizeForManagementGroupWithServiceResponseAsync ( managementGroupName , queryOptions ) . map ( new Func1 < ServiceResponse < SummarizeResultsInner > , SummarizeResultsInner > ( ) { @ Override public SummarizeResultsInner call ( ServiceResponse < SummarizeResultsInner > response ) { return response . body ( ) ; } } ) ; |
public class MBCImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EList < MBCRG > getRG ( ) { } } | if ( rg == null ) { rg = new EObjectContainmentEList . Resolving < MBCRG > ( MBCRG . class , this , AfplibPackage . MBC__RG ) ; } return rg ; |
public class Log { /** * Logs { @ code msg } at the error level .
* @ param args additional arguments formatted via { @ link # format } and appended to the message .
* { @ code args } may contain an exception as its lone final argument which will be logged long
* with the formatted message . */
public void error ( String msg , Object ... args ) { } } | error ( format ( msg , args ) , getCause ( args ) ) ; |
public class SingleInputPlanNode { /** * Sets the key field information for the specified driver comparator .
* @ param keys The key field indexes for the specified driver comparator .
* @ param sortOrder The key sort order for the specified driver comparator .
* @ param id The ID of the driver comparator . */
public void setDriverKeyInfo ( FieldList keys , boolean [ ] sortOrder , int id ) { } } | if ( id < 0 || id >= driverKeys . length ) { throw new CompilerException ( "Invalid id for driver key information. DriverStrategy requires only " + super . getDriverStrategy ( ) . getNumRequiredComparators ( ) + " comparators." ) ; } this . driverKeys [ id ] = keys ; this . driverSortOrders [ id ] = sortOrder ; |
public class NodeSet { /** * Pop a node from the tail of the vector and return the result .
* @ return the node at the tail of the vector */
public final Node pop ( ) { } } | m_firstFree -- ; Node n = m_map [ m_firstFree ] ; m_map [ m_firstFree ] = null ; return n ; |
public class CmsHtml2TextConverter { /** * Appends text . < p >
* @ param text the text */
private void appendText ( String text ) { } } | if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( text ) ) { text = Translate . decode ( text ) ; text = collapse ( text ) ; } if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( text ) ) { if ( m_storedBrCount > 0 ) { m_appendBr = true ; appendLinebreak ( m_storedBrCount ) ; } appendIndentation ( ) ; m_brCount = 0 ; List < String > wordList = CmsStringUtil . splitAsList ( text , ' ' ) ; Iterator < String > i = wordList . iterator ( ) ; while ( i . hasNext ( ) ) { String word = i . next ( ) ; boolean hasNbsp = ( ( word . charAt ( 0 ) == 160 ) || ( word . charAt ( word . length ( ) - 1 ) == 160 ) ) ; if ( ( word . length ( ) + 1 + m_lineLength ) > m_maxLineLength ) { m_appendBr = true ; appendLinebreak ( 1 ) ; appendIndentation ( ) ; m_brCount = 0 ; } else { if ( ! hasNbsp && ( m_lineLength > m_indent ) && ( m_result . charAt ( m_result . length ( ) - 1 ) != 160 ) && ( m_result . charAt ( m_result . length ( ) - 1 ) != 32 ) ) { m_result . append ( ' ' ) ; m_lineLength ++ ; } } m_result . append ( word ) ; m_lineLength += word . length ( ) ; } } |
public class Connect { /** * This method is used to build the URL to request access permission for your seller .
* @ param clientId
* { @ code String } the APP ID .
* @ param redirectUri
* { @ code String } the address that you want to redirect your user after they grant the permission .
* @ param scope
* { @ code String array } the array of permissions that you want to request .
* Ex : RECEIVE _ FUNDS , MANAGE _ ACCOUNT _ INFO , TRANSFER _ FUNDS . . .
* @ param setup
* { @ code Setup } the setup object .
* @ return { @ code String } */
public String buildUrl ( String clientId , String redirectUri , String [ ] scope , Setup setup ) { } } | String url = setup . getEnvironment ( ) + "/oauth/authorize" ; url += String . format ( "?response_type=code&client_id=%s&redirect_uri=%s&scope=" , clientId , redirectUri ) ; for ( Integer index = 0 ; index < scope . length ; ++ index ) { url += scope [ index ] ; if ( ( index + 1 ) < scope . length ) url += ',' ; } return url ; |
public class ShuffleMethodArrangement { /** * { @ inheritDoc } */
@ Override protected List < BenchmarkElement > arrangeList ( final List < BenchmarkElement > methods ) { } } | final Random ran = new Random ( SEED ) ; final List < BenchmarkElement > inputList = new LinkedList < BenchmarkElement > ( ) ; inputList . addAll ( methods ) ; Collections . shuffle ( inputList , ran ) ; return inputList ; |
public class Main { /** * Scan the arguments to find the option ( - copy ) that setup copying rules into the bin dir .
* For example : - copy . html
* The found copiers are stored as suffix rules as well . No translation is done , just copying . */
private void findCopyOptions ( String [ ] args , Map < String , Transformer > suffix_rules ) throws ProblemException , ProblemException { } } | for ( int i = 0 ; i < args . length ; ++ i ) { if ( args [ i ] . equals ( "-copy" ) ) { if ( i + 1 >= args . length ) { throw new ProblemException ( "You have to specify a translate rule following -tr." ) ; } String s = args [ i + 1 ] ; checkCopyPattern ( s ) ; if ( suffix_rules . get ( s ) != null ) { throw new ProblemException ( "You have already specified a " + "rule for the suffix " + s ) ; } if ( s . equals ( ".class" ) ) { throw new ProblemException ( "You cannot have a copy rule for .class files!" ) ; } if ( s . equals ( ".java" ) ) { throw new ProblemException ( "You cannot have a copy rule for .java files!" ) ; } suffix_rules . put ( s , javac_state . getCopier ( ) ) ; } } |
public class AmazonCloudSearchClient { /** * Indexes the search suggestions . For more information , see < a href =
* " http : / / docs . aws . amazon . com / cloudsearch / latest / developerguide / getting - suggestions . html # configuring - suggesters "
* > Configuring Suggesters < / a > in the < i > Amazon CloudSearch Developer Guide < / i > .
* @ param buildSuggestersRequest
* Container for the parameters to the < code > < a > BuildSuggester < / a > < / code > operation . Specifies the name of
* the domain you want to update .
* @ return Result of the BuildSuggesters operation returned by the service .
* @ throws BaseException
* An error occurred while processing the request .
* @ throws InternalException
* An internal error occurred while processing the request . If this problem persists , report an issue from
* the < a href = " http : / / status . aws . amazon . com / " target = " _ blank " > Service Health Dashboard < / a > .
* @ throws ResourceNotFoundException
* The request was rejected because it attempted to reference a resource that does not exist .
* @ sample AmazonCloudSearch . BuildSuggesters */
@ Override public BuildSuggestersResult buildSuggesters ( BuildSuggestersRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeBuildSuggesters ( request ) ; |
public class BTree { /** * Creates a BTree containing all of the objects in the provided collection
* @ param source the items to build the tree with
* @ param comparator the comparator that defines the ordering over the items in the tree
* @ param sorted if false , the collection will be copied and sorted to facilitate construction
* @ param < V >
* @ return */
public static < V > Object [ ] build ( Iterable < V > source , int size , Comparator < V > comparator , boolean sorted , UpdateFunction < V > updateF ) { } } | if ( size < FAN_FACTOR ) { // pad to even length to match contract that all leaf nodes are even
V [ ] values = ( V [ ] ) new Object [ size + ( size & 1 ) ] ; { int i = 0 ; for ( V v : source ) values [ i ++ ] = v ; } // inline sorting since we ' re already calling toArray
if ( ! sorted ) Arrays . sort ( values , 0 , size , comparator ) ; // if updateF is specified
if ( updateF != null ) { for ( int i = 0 ; i < size ; i ++ ) values [ i ] = updateF . apply ( values [ i ] ) ; updateF . allocated ( ObjectSizes . sizeOfArray ( values ) ) ; } return values ; } if ( ! sorted ) source = sorted ( source , comparator , size ) ; Queue < Builder > queue = modifier . get ( ) ; Builder builder = queue . poll ( ) ; if ( builder == null ) builder = new Builder ( ) ; Object [ ] btree = builder . build ( source , updateF , size ) ; queue . add ( builder ) ; return btree ; |
public class HtmlDecorator { /** * ( non - Javadoc )
* @ see org . apache . myfaces . view . facelets . tag . TagDecorator # decorate ( org . apache . myfaces . view . facelets . tag . Tag ) */
public Tag decorate ( Tag tag ) { } } | if ( XHTML_NAMESPACE . equals ( tag . getNamespace ( ) ) ) { String n = tag . getLocalName ( ) ; if ( "a" . equals ( n ) ) { return new Tag ( tag . getLocation ( ) , HtmlLibrary . NAMESPACE , "commandLink" , tag . getQName ( ) , tag . getAttributes ( ) ) ; } if ( "form" . equals ( n ) ) { return new Tag ( tag . getLocation ( ) , HtmlLibrary . NAMESPACE , "form" , tag . getQName ( ) , tag . getAttributes ( ) ) ; } if ( "input" . equals ( n ) ) { TagAttribute attr = tag . getAttributes ( ) . get ( "type" ) ; if ( attr != null ) { String t = attr . getValue ( ) ; TagAttributes na = removeType ( tag . getAttributes ( ) ) ; if ( "text" . equals ( t ) ) { return new Tag ( tag . getLocation ( ) , HtmlLibrary . NAMESPACE , "inputText" , tag . getQName ( ) , na ) ; } if ( "password" . equals ( t ) ) { return new Tag ( tag . getLocation ( ) , HtmlLibrary . NAMESPACE , "inputSecret" , tag . getQName ( ) , na ) ; } if ( "hidden" . equals ( t ) ) { return new Tag ( tag . getLocation ( ) , HtmlLibrary . NAMESPACE , "inputHidden" , tag . getQName ( ) , na ) ; } if ( "submit" . equals ( t ) ) { return new Tag ( tag . getLocation ( ) , HtmlLibrary . NAMESPACE , "commandButton" , tag . getQName ( ) , na ) ; } } } } return null ; |
public class Graph { /** * Records the field of a target object is visited
* @ param object The field holder
* @ param objectField The field which holds the object in its parent
* @ param field The field of the holder */
private void recordVisitField ( Object object , Field objectField , Field field ) { } } | Map < String , Set < String > > bag = visitedFields . get ( object ) ; if ( bag == null ) { bag = new HashMap < > ( ) ; visitedFields . put ( object , bag ) ; } Set < String > fields = bag . get ( objectField ) ; String objectFiledKey = objectField == null ? "" : objectField . toGenericString ( ) ; if ( fields == null ) { fields = new HashSet < > ( ) ; bag . put ( objectFiledKey , fields ) ; } fields . add ( field . toGenericString ( ) ) ; |
public class ZeroMQNetworkService { /** * Notifies that a peer was discovered .
* @ param peerURI
* - the URI of the remote kernel that was disconnected to . */
protected void firePeerDiscovered ( URI peerURI ) { } } | final NetworkServiceListener [ ] ilisteners ; synchronized ( this . listeners ) { ilisteners = new NetworkServiceListener [ this . listeners . size ( ) ] ; this . listeners . toArray ( ilisteners ) ; } for ( final NetworkServiceListener listener : ilisteners ) { listener . peerDiscovered ( peerURI ) ; } |
public class JobInProgress { /** * Adds a failed TIP in the front of the list for non - running reduces
* @ param tip the tip that needs to be failed */
private synchronized void failReduce ( TaskInProgress tip ) { } } | if ( nonRunningReduces == null ) { LOG . warn ( "Failed cache for reducers missing!! " + "Job details are missing." ) ; return ; } nonRunningReduces . add ( 0 , tip ) ; |
public class MvtValue { /** * Covert an { @ link Object } to a new { @ link VectorTile . Tile . Value } instance .
* @ param value target for conversion
* @ return new instance with String or primitive value set */
public static VectorTile . Tile . Value toValue ( Object value ) { } } | final VectorTile . Tile . Value . Builder tileValue = VectorTile . Tile . Value . newBuilder ( ) ; if ( value instanceof Boolean ) { tileValue . setBoolValue ( ( Boolean ) value ) ; } else if ( value instanceof Integer ) { tileValue . setSintValue ( ( Integer ) value ) ; } else if ( value instanceof Long ) { tileValue . setSintValue ( ( Long ) value ) ; } else if ( value instanceof Float ) { tileValue . setFloatValue ( ( Float ) value ) ; } else if ( value instanceof Double ) { tileValue . setDoubleValue ( ( Double ) value ) ; } else if ( value instanceof String ) { tileValue . setStringValue ( ( String ) value ) ; } return tileValue . build ( ) ; |
public class BeanJsonDeserializerCreator { /** * Generate the instance builder class body for a constructor with parameters or factory method . We will declare all the fields and
* instanciate the bean only on build ( ) method when all properties have been deserialiazed
* @ param newInstanceMethodBuilder builder for the
* { @ link InstanceBuilder # newInstance ( JsonReader , JsonDeserializationContext , JsonDeserializerParameters , Map , Map ) } method
* @ param createMethod the create method */
private void buildNewInstanceMethodForConstructorOrFactoryMethod ( MethodSpec . Builder newInstanceMethodBuilder , MethodSpec createMethod ) { } } | // we don ' t use directly the property name to name our variable in case it contains invalid character
ImmutableMap . Builder < String , String > propertyNameToVariableBuilder = ImmutableMap . builder ( ) ; List < String > requiredProperties = new ArrayList < String > ( ) ; int propertyIndex = 0 ; for ( String name : beanInfo . getCreatorParameters ( ) . keySet ( ) ) { String variableName = String . format ( INSTANCE_BUILDER_VARIABLE_FORMAT , propertyIndex ++ ) ; propertyNameToVariableBuilder . put ( name , variableName ) ; PropertyInfo propertyInfo = properties . get ( name ) ; newInstanceMethodBuilder . addCode ( "$T $L = $L; // property '$L'\n" , typeName ( propertyInfo . getType ( ) ) , variableName , getDefaultValueForType ( propertyInfo . getType ( ) ) , name ) ; if ( propertyInfo . isRequired ( ) ) { requiredProperties . add ( name ) ; } } newInstanceMethodBuilder . addCode ( "\n" ) ; ImmutableMap < String , String > propertyNameToVariable = propertyNameToVariableBuilder . build ( ) ; newInstanceMethodBuilder . addStatement ( "int nbParamToFind = $L" , beanInfo . getCreatorParameters ( ) . size ( ) ) ; if ( ! requiredProperties . isEmpty ( ) ) { CodeBlock code = CodeBlock . builder ( ) . add ( Joiner . on ( ", " ) . join ( Collections2 . transform ( requiredProperties , new Function < String , Object > ( ) { @ Override public Object apply ( String s ) { return "$S" ; } } ) ) , requiredProperties . toArray ( ) ) . build ( ) ; newInstanceMethodBuilder . addStatement ( "$T requiredProperties = new $T($T.asList($L))" , ParameterizedTypeName . get ( Set . class , String . class ) , ParameterizedTypeName . get ( HashSet . class , String . class ) , Arrays . class , code ) ; } newInstanceMethodBuilder . addCode ( "\n" ) ; newInstanceMethodBuilder . beginControlFlow ( "if (null != bufferedPropertiesValues)" ) ; newInstanceMethodBuilder . addStatement ( "Object value" ) ; for ( String name : beanInfo . getCreatorParameters ( ) . keySet ( ) ) { String variableName = propertyNameToVariable . get ( name ) ; PropertyInfo propertyInfo = properties . get ( name ) ; newInstanceMethodBuilder . addCode ( "\n" ) ; newInstanceMethodBuilder . addStatement ( "value = bufferedPropertiesValues.remove($S)" , name ) ; newInstanceMethodBuilder . beginControlFlow ( "if (null != value)" ) ; newInstanceMethodBuilder . addStatement ( "$L = ($T) value" , variableName , typeName ( true , propertyInfo . getType ( ) ) ) ; newInstanceMethodBuilder . addStatement ( "nbParamToFind--" ) ; if ( propertyInfo . isRequired ( ) ) { newInstanceMethodBuilder . addStatement ( "requiredProperties.remove($S)" , name ) ; } newInstanceMethodBuilder . endControlFlow ( ) ; } newInstanceMethodBuilder . endControlFlow ( ) ; newInstanceMethodBuilder . addCode ( "\n" ) ; newInstanceMethodBuilder . beginControlFlow ( "if (null != bufferedProperties)" ) ; newInstanceMethodBuilder . addStatement ( "String value" ) ; for ( String name : beanInfo . getCreatorParameters ( ) . keySet ( ) ) { String variableName = propertyNameToVariable . get ( name ) ; PropertyInfo propertyInfo = properties . get ( name ) ; newInstanceMethodBuilder . addCode ( "\n" ) ; newInstanceMethodBuilder . addStatement ( "value = bufferedProperties.remove($S)" , name ) ; newInstanceMethodBuilder . beginControlFlow ( "if (null != value)" ) ; if ( null != propertyInfo . getType ( ) . isPrimitive ( ) ) { newInstanceMethodBuilder . addStatement ( "$L = ($T) $L.deserialize(ctx.newJsonReader(value), ctx)" , variableName , typeName ( true , propertyInfo . getType ( ) ) , INSTANCE_BUILDER_DESERIALIZER_PREFIX + variableName ) ; } else { newInstanceMethodBuilder . addStatement ( "$L = $L.deserialize(ctx.newJsonReader(value), ctx)" , variableName , INSTANCE_BUILDER_DESERIALIZER_PREFIX + variableName ) ; } newInstanceMethodBuilder . addStatement ( "nbParamToFind--" ) ; if ( propertyInfo . isRequired ( ) ) { newInstanceMethodBuilder . addStatement ( "requiredProperties.remove($S)" , name ) ; } newInstanceMethodBuilder . endControlFlow ( ) ; } newInstanceMethodBuilder . endControlFlow ( ) ; newInstanceMethodBuilder . addCode ( "\n" ) ; newInstanceMethodBuilder . addStatement ( "String name" ) ; newInstanceMethodBuilder . beginControlFlow ( "while (nbParamToFind > 0 && $T.NAME == reader.peek())" , JsonToken . class ) ; newInstanceMethodBuilder . addStatement ( "name = reader.nextName()" ) ; newInstanceMethodBuilder . addCode ( "\n" ) ; for ( String name : beanInfo . getCreatorParameters ( ) . keySet ( ) ) { String variableName = propertyNameToVariable . get ( name ) ; PropertyInfo propertyInfo = properties . get ( name ) ; newInstanceMethodBuilder . beginControlFlow ( "if ($S.equals(name))" , name ) ; newInstanceMethodBuilder . addStatement ( "$L = $L.deserialize(reader, ctx)" , variableName , INSTANCE_BUILDER_DESERIALIZER_PREFIX + variableName ) ; newInstanceMethodBuilder . addStatement ( "nbParamToFind--" ) ; if ( propertyInfo . isRequired ( ) ) { newInstanceMethodBuilder . addStatement ( "requiredProperties.remove($S)" , name ) ; } newInstanceMethodBuilder . addStatement ( "continue" ) ; newInstanceMethodBuilder . endControlFlow ( ) ; newInstanceMethodBuilder . addCode ( "\n" ) ; } newInstanceMethodBuilder . beginControlFlow ( "if (null == bufferedProperties)" ) ; newInstanceMethodBuilder . addStatement ( "bufferedProperties = new $T()" , ParameterizedTypeName . get ( HashMap . class , String . class , String . class ) ) ; newInstanceMethodBuilder . endControlFlow ( ) ; newInstanceMethodBuilder . addStatement ( "bufferedProperties.put(name, reader.nextValue())" ) ; newInstanceMethodBuilder . endControlFlow ( ) ; newInstanceMethodBuilder . addCode ( "\n" ) ; if ( ! requiredProperties . isEmpty ( ) ) { newInstanceMethodBuilder . beginControlFlow ( "if (!requiredProperties.isEmpty())" ) ; newInstanceMethodBuilder . addStatement ( "throw ctx.traceError(\"Required properties are missing : \" + requiredProperties, reader)" ) ; newInstanceMethodBuilder . endControlFlow ( ) ; newInstanceMethodBuilder . addCode ( "\n" ) ; } newInstanceMethodBuilder . addStatement ( "return new $T($N($L), bufferedProperties)" , parameterizedName ( Instance . class , beanInfo . getType ( ) ) , createMethod , Joiner . on ( ", " ) . join ( propertyNameToVariable . values ( ) ) ) ; |
public class CommerceOrderNotePersistenceImpl { /** * Returns the last commerce order note in the ordered set where commerceOrderId = & # 63 ; and restricted = & # 63 ; .
* @ param commerceOrderId the commerce order ID
* @ param restricted the restricted
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commerce order note , or < code > null < / code > if a matching commerce order note could not be found */
@ Override public CommerceOrderNote fetchByC_R_Last ( long commerceOrderId , boolean restricted , OrderByComparator < CommerceOrderNote > orderByComparator ) { } } | int count = countByC_R ( commerceOrderId , restricted ) ; if ( count == 0 ) { return null ; } List < CommerceOrderNote > list = findByC_R ( commerceOrderId , restricted , count - 1 , count , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ; |
public class LdiSrl { /** * Extract front sub - string from first - found delimiter ignoring case .
* < pre >
* substringFirstFront ( " foo . bar / baz . qux " , " A " , " U " )
* returns " foo . b "
* < / pre >
* @ param str The target string . ( NotNull )
* @ param delimiters The array of delimiters . ( NotNull )
* @ return The part of string . ( NotNull : if delimiter not found , returns argument - plain string ) */
public static String substringFirstFrontIgnoreCase ( final String str , final String ... delimiters ) { } } | assertStringNotNull ( str ) ; return doSubstringFirstRear ( false , false , true , str , delimiters ) ; |
public class JavaParser { /** * src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 624:1 : elementValuePair : ( Identifier ' = ' ) ? elementValue ; */
public final void elementValuePair ( ) throws RecognitionException { } } | int elementValuePair_StartIndex = input . index ( ) ; try { if ( state . backtracking > 0 && alreadyParsedRule ( input , 68 ) ) { return ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 625:5 : ( ( Identifier ' = ' ) ? elementValue )
// src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 625:7 : ( Identifier ' = ' ) ? elementValue
{ // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 625:7 : ( Identifier ' = ' ) ?
int alt90 = 2 ; int LA90_0 = input . LA ( 1 ) ; if ( ( LA90_0 == Identifier ) ) { int LA90_1 = input . LA ( 2 ) ; if ( ( LA90_1 == 54 ) ) { alt90 = 1 ; } } switch ( alt90 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 625:8 : Identifier ' = '
{ match ( input , Identifier , FOLLOW_Identifier_in_elementValuePair2383 ) ; if ( state . failed ) return ; match ( input , 54 , FOLLOW_54_in_elementValuePair2385 ) ; if ( state . failed ) return ; } break ; } pushFollow ( FOLLOW_elementValue_in_elementValuePair2389 ) ; elementValue ( ) ; state . _fsp -- ; if ( state . failed ) return ; } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { // do for sure before leaving
if ( state . backtracking > 0 ) { memoize ( input , 68 , elementValuePair_StartIndex ) ; } } |
public class IPAccessHandler { /** * Main method for testing & debugging . */
private static void main ( String [ ] args ) { } } | IPAccessHandler ipah = new IPAccessHandler ( ) ; ipah . setStandard ( "deny" ) ; ipah . setAllowIP ( "217.215.71.167" ) ; ipah . setDenyIP ( "217.215.71.149" ) ; System . out . println ( ipah . checkIP ( "217.215.71.245" ) + " = false" ) ; System . out . println ( ipah . checkIP ( "217.215.71.167" ) + " = true" ) ; System . out . println ( ipah . checkIP ( "217.215.71.149" ) + " = false" ) ; System . out . println ( ipah . checkIP ( "0.0.0.0" ) + " = false" ) ; IPAccessHandler ipah2 = new IPAccessHandler ( ) ; ipah2 . setStandard ( "allow" ) ; ipah2 . setAllowIP ( "217.215.71.167" ) ; ipah2 . setDenyIP ( "217.215.71.149" ) ; System . out . println ( ipah2 . checkIP ( "217.215.71.245" ) + " = true" ) ; System . out . println ( ipah2 . checkIP ( "217.215.71.167" ) + " = true" ) ; System . out . println ( ipah2 . checkIP ( "217.215.71.149" ) + " = false" ) ; System . out . println ( ipah2 . checkIP ( "0.0.0.0" ) + " = true" ) ; |
public class Validator { /** * Validates a user provided required parameter to be not null .
* An { @ link IllegalArgumentException } is thrown if a property fails the validation .
* @ param parameter the parameter to validate
* @ throws IllegalArgumentException thrown when the Validator determines the argument is invalid */
public static void validate ( Object parameter ) { } } | // Validation of top level payload is done outside
if ( parameter == null ) { return ; } Class < ? > type = parameter . getClass ( ) ; if ( type == Double . class || type == Float . class || type == Long . class || type == Integer . class || type == Short . class || type == Character . class || type == Byte . class || type == Boolean . class ) { type = wrapperToPrimitive ( type ) ; } if ( type . isPrimitive ( ) || type . isEnum ( ) || type . isAssignableFrom ( Class . class ) || type . isAssignableFrom ( LocalDate . class ) || type . isAssignableFrom ( OffsetDateTime . class ) || type . isAssignableFrom ( String . class ) || type . isAssignableFrom ( DateTimeRfc1123 . class ) || type . isAssignableFrom ( Duration . class ) ) { return ; } Annotation skipParentAnnotation = type . getAnnotation ( SkipParentValidation . class ) ; if ( skipParentAnnotation == null ) { for ( Class < ? > c : TypeUtil . getAllClasses ( type ) ) { validateClass ( c , parameter ) ; } } else { validateClass ( type , parameter ) ; } |
public class VMCommandLine { /** * Save parameters that permit to relaunch a VM with
* { @ link # relaunchVM ( ) } .
* @ param classToLaunch is the class which contains a < code > main < / code > .
* @ param parameters is the parameters to pass to the < code > main < / code > . */
@ Inline ( value = "VMCommandLine.saveVMParametersIfNotSet(($1).getCanonicalName(), ($2))" , imported = { } } | VMCommandLine . class } , statementExpression = true ) public static void saveVMParametersIfNotSet ( Class < ? > classToLaunch , String ... parameters ) { saveVMParametersIfNotSet ( classToLaunch . getCanonicalName ( ) , parameters ) ; |
public class Client { /** * Validates all the input to this client . */
private void validateInput ( ) { } } | // Check for null values first .
if ( url == null ) { throw new NullPointerException ( "URL should not be null" ) ; } if ( ! url . getProtocol ( ) . matches ( "^https?$" ) ) { throw new IllegalArgumentException ( "URL protocol should be HTTP or HTTPS" ) ; } if ( url . getRef ( ) != null ) { throw new IllegalArgumentException ( "URL should contain no reference" ) ; } if ( url . getQuery ( ) != null ) { throw new IllegalArgumentException ( "URL should contain no query string" ) ; } if ( handler == null ) { throw new NullPointerException ( "Callback handler should not be null" ) ; } |
public class CommercePriceListPersistenceImpl { /** * Returns the last commerce price list in the ordered set where groupId = & # 63 ; and status & ne ; & # 63 ; .
* @ param groupId the group ID
* @ param status the status
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commerce price list
* @ throws NoSuchPriceListException if a matching commerce price list could not be found */
@ Override public CommercePriceList findByG_NotS_Last ( long groupId , int status , OrderByComparator < CommercePriceList > orderByComparator ) throws NoSuchPriceListException { } } | CommercePriceList commercePriceList = fetchByG_NotS_Last ( groupId , status , orderByComparator ) ; if ( commercePriceList != null ) { return commercePriceList ; } StringBundler msg = new StringBundler ( 6 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "groupId=" ) ; msg . append ( groupId ) ; msg . append ( ", status=" ) ; msg . append ( status ) ; msg . append ( "}" ) ; throw new NoSuchPriceListException ( msg . toString ( ) ) ; |
public class CommandLine { /** * Equivalent to { @ code new CommandLine ( runnableClass , factory ) . execute ( args ) } .
* @ param runnableClass class of the command to run when { @ linkplain # parseArgs ( String . . . ) parsing } succeeds .
* @ param factory the factory responsible for instantiating the specified Runnable class and potentially injecting other components
* @ param args the command line arguments to parse
* @ param < R > the annotated class must implement Runnable
* @ throws InitializationException if the specified class cannot be instantiated by the factory , or does not have a { @ link Command } , { @ link Option } or { @ link Parameters } annotation
* @ throws ExecutionException if the Runnable throws an exception
* @ see # execute ( String . . . )
* @ since 3.2 */
public static < R extends Runnable > void run ( Class < R > runnableClass , IFactory factory , String ... args ) { } } | run ( runnableClass , factory , System . out , System . err , Help . Ansi . AUTO , args ) ; |
public class AbstractContextualMonitor { /** * Returns a monitor instance for the current context . If no monitor exists for the current
* context then a new one will be created . */
protected M getMonitorForCurrentContext ( ) { } } | MonitorConfig contextConfig = getConfig ( ) ; M monitor = monitors . get ( contextConfig ) ; if ( monitor == null ) { M newMon = newMonitor . apply ( contextConfig ) ; if ( newMon instanceof SpectatorMonitor ) { ( ( SpectatorMonitor ) newMon ) . initializeSpectator ( spectatorTags ) ; } monitor = monitors . putIfAbsent ( contextConfig , newMon ) ; if ( monitor == null ) { monitor = newMon ; } } return monitor ; |
public class StructurizrAnnotationsComponentFinderStrategy { /** * Finds @ UsedByContainer annotations . */
private void findUsedByContainerAnnotations ( Component component , String typeName ) { } } | try { Class < ? > type = getTypeRepository ( ) . loadClass ( typeName ) ; UsedByContainer [ ] annotations = type . getAnnotationsByType ( UsedByContainer . class ) ; for ( UsedByContainer annotation : annotations ) { String name = annotation . name ( ) ; String description = annotation . description ( ) ; String technology = annotation . technology ( ) ; Container container = findContainerByNameOrCanonicalName ( component , name ) ; if ( container != null ) { container . uses ( component , description , technology ) ; } else { log . warn ( "A container named \"" + name + "\" could not be found." ) ; } } } catch ( ClassNotFoundException e ) { log . warn ( "Could not load type " + typeName ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.