signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class Vector3d { /** * ( non - Javadoc ) * @ see org . joml . Vector3dc # absolute ( org . joml . Vector3d ) */ public Vector3d absolute ( Vector3d dest ) { } }
dest . x = Math . abs ( this . x ) ; dest . y = Math . abs ( this . y ) ; dest . z = Math . abs ( this . z ) ; return dest ;
public class pqpolicy { /** * Use this API to update pqpolicy . */ public static base_response update ( nitro_service client , pqpolicy resource ) throws Exception { } }
pqpolicy updateresource = new pqpolicy ( ) ; updateresource . policyname = resource . policyname ; updateresource . weight = resource . weight ; updateresource . qdepth = resource . qdepth ; updateresource . polqdepth = resource . polqdepth ; return updateresource . update_resource ( client ) ;
public class SqlHelper { /** * < bind name = " pattern " value = " ' % ' + _ parameter . getTitle ( ) + ' % ' " / > * @ param column * @ return */ public static String getIfCacheNotNull ( EntityColumn column , String contents ) { } }
StringBuilder sql = new StringBuilder ( ) ; sql . append ( "<if test=\"" ) . append ( column . getProperty ( ) ) . append ( "_cache != null\">" ) ; sql . append ( contents ) ; sql . append ( "</if>" ) ; return sql . toString ( ) ;
public class JingleTransport { /** * Get the list of candidates . * @ return The candidates list . */ public List < JingleTransportCandidate > getCandidatesList ( ) { } }
ArrayList < JingleTransportCandidate > res ; synchronized ( candidates ) { res = new ArrayList < > ( candidates ) ; } return res ;
public class UniverseApi { /** * Get structure information ( asynchronously ) Returns information on * requested structure if you are on the ACL . Otherwise , returns * \ & quot ; Forbidden \ & quot ; for all inputs . - - - This route is cached for up * to 3600 seconds * @ param structureId * An Eve structure ID ( required ) * @ param datasource * The server name you would like data from ( optional , default to * tranquility ) * @ param ifNoneMatch * ETag from a previous request . A 304 will be returned if this * matches the current ETag ( optional ) * @ param token * Access token to use if unable to set a header ( optional ) * @ param callback * The callback to be executed when the API call finishes * @ return The request call * @ throws ApiException * If fail to process the API call , e . g . serializing the request * body object */ public com . squareup . okhttp . Call getUniverseStructuresStructureIdAsync ( Long structureId , String datasource , String ifNoneMatch , String token , final ApiCallback < StructureResponse > callback ) throws ApiException { } }
com . squareup . okhttp . Call call = getUniverseStructuresStructureIdValidateBeforeCall ( structureId , datasource , ifNoneMatch , token , callback ) ; Type localVarReturnType = new TypeToken < StructureResponse > ( ) { } . getType ( ) ; apiClient . executeAsync ( call , localVarReturnType , callback ) ; return call ;
public class CitrusArchiveBuilder { /** * Resolve artifacts for given coordinates . * @ return */ public File [ ] build ( ) { } }
MavenStrategyStage maven = Maven . configureResolver ( ) . workOffline ( offline ) . resolve ( artifactCoordinates ) ; return applyTransitivity ( maven ) . asFile ( ) ;
public class SanitizedContents { /** * Wraps an assumed - safe constant string . */ @ SuppressWarnings ( "ReferenceEquality" ) // need to use a reference check to ensure it is a constant private static SanitizedContent fromConstant ( @ CompileTimeConstant final String constant , ContentKind kind , @ Nullable Dir dir ) { } }
// Extra runtime check in case the compile - time check doesn ' t work . Preconditions . checkArgument ( constant . intern ( ) == constant , "The provided argument does not look like a compile-time constant." ) ; return SanitizedContent . create ( constant , kind , dir ) ;
public class WPopupRenderer { /** * Paints the given WPopup . * @ param component the WPopup to paint . * @ param renderContext the RenderContext to paint to . */ @ Override public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { } }
WPopup popup = ( WPopup ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; int width = popup . getWidth ( ) ; int height = popup . getHeight ( ) ; String targetWindow = popup . getTargetWindow ( ) ; xml . appendTagOpen ( "ui:popup" ) ; xml . appendUrlAttribute ( "url" , popup . getUrl ( ) ) ; xml . appendOptionalAttribute ( "width" , width > 0 , width ) ; xml . appendOptionalAttribute ( "height" , height > 0 , height ) ; xml . appendOptionalAttribute ( "resizable" , popup . isResizable ( ) , "true" ) ; xml . appendOptionalAttribute ( "showScrollbars" , popup . isScrollable ( ) , "true" ) ; xml . appendOptionalAttribute ( "targetWindow" , ! Util . empty ( targetWindow ) , targetWindow ) ; xml . appendClose ( ) ; xml . appendEndTag ( "ui:popup" ) ;
public class TypeResolver { /** * Resolves the type argument for the { @ code genericType } using type variable information from the * { @ code sourceType } . If { @ code genericType } is an instance of class , then { @ code genericType } is * returned . If no arguments can be resolved then { @ code Unknown . class } is returned . * @ param genericType to resolve upwards from * @ param targetType to resolve arguments for * @ return type argument for { @ code initialType } else { @ code null } if no type arguments are * declared * @ throws IllegalArgumentException if more or less than one type argument is resolved for the * give types */ public static Class < ? > resolveArgument ( Type genericType , Class < ? > targetType ) { } }
Class < ? > [ ] arguments = resolveArguments ( genericType , targetType ) ; if ( arguments == null ) return Unknown . class ; if ( arguments . length != 1 ) throw new IllegalArgumentException ( "Expected 1 type argument on generic type " + targetType . getName ( ) + " but found " + arguments . length ) ; return arguments [ 0 ] ;
public class FastDateFormat { /** * < p > Formats a < code > Date < / code > object into the * supplied < code > StringBuffer < / code > . < / p > * @ param date the date to format * @ param buf the buffer to format into * @ return the specified string buffer */ public StringBuffer format ( Date date , StringBuffer buf ) { } }
Calendar c = new GregorianCalendar ( mTimeZone ) ; c . setTime ( date ) ; return applyRules ( c , buf ) ;
public class TaskRouterResource { /** * Converts a resource to JSON . * @ return JSON representation of the resource * @ throws IOException if unable to transform to JSON */ public String toJson ( ) throws IOException { } }
ObjectMapper mapper = new ObjectMapper ( ) ; ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; mapper . writeValue ( out , this ) ; return out . toString ( ) ;
public class PlotCanvas { /** * Zooms in / out the plot . * @ param inout true if zoom in . Otherwise , zoom out . */ public void zoom ( boolean inout ) { } }
for ( int i = 0 ; i < base . dimension ; i ++ ) { int s = baseGrid . getAxis ( i ) . getLinearSlices ( ) ; double r = inout ? - 1.0 / s : 1.0 / s ; double d = ( base . upperBound [ i ] - base . lowerBound [ i ] ) * r ; base . lowerBound [ i ] -= d ; base . upperBound [ i ] += d ; } for ( int i = 0 ; i < base . dimension ; i ++ ) { base . setPrecisionUnit ( i ) ; } base . initBaseCoord ( ) ; graphics . projection . reset ( ) ; baseGrid . setBase ( base ) ; canvas . repaint ( ) ;
public class NiceTable { /** * Adds a header row to the table . can be used to give a table some title . * < pre > * addHeader ( & quot ; hello & quot ; , ' . ' , NiceTable . LEFT ) * would produce a row like * . . . hello . . . . . * { rows in here . } * < / pre > * @ param title * the string to display as a header * @ param mark * the mark to use for the rest of the column * @ param orientation * the orientation of the header column . */ public void addHeader ( final String title , final char mark , final Alignment orientation ) { } }
final Header header = new Header ( title , mark , orientation , this ) ; rows . add ( header ) ;
public class TreeCoreset { /** * tests if a node is a leaf */ boolean isLeaf ( treeNode node ) { } }
if ( node . lc == null && node . rc == null ) { return true ; } else { return false ; }
public class GVRPeriodicEngine { /** * Run a task periodically , with a callback . * @ param task * Task to run . * @ param delay * The first execution will happen in { @ code delay } seconds . * @ param period * Subsequent executions will happen every { @ code period } seconds * after the first . * @ param callback * Callback that lets you cancel the task . { @ code null } means run * indefinitely . * @ return An interface that lets you query the status ; cancel ; or * reschedule the event . */ public PeriodicEvent runEvery ( Runnable task , float delay , float period , KeepRunning callback ) { } }
validateDelay ( delay ) ; validatePeriod ( period ) ; return new Event ( task , delay , period , callback ) ;
public class MainModule { /** * Provisioning of a RendererAdapter implementation to work with tv shows ListView . More * information in this library : { @ link https : / / github . com / pedrovgs / Renderers } */ @ Provides protected RendererAdapter < TvShowViewModel > provideTvShowRendererAdapter ( LayoutInflater layoutInflater , TvShowCollectionRendererBuilder tvShowCollectionRendererBuilder , TvShowCollectionViewModel tvShowCollectionViewModel ) { } }
return new RendererAdapter < TvShowViewModel > ( layoutInflater , tvShowCollectionRendererBuilder , tvShowCollectionViewModel ) ;
public class OntologyRepositoryCollection { /** * Creates a { @ link OntologyTermNodePathMetadata } { @ link Entity } and stores it in the { @ link * # nodePathRepository } . * @ param container { @ link OWLClassContainer } for the path to the ontology term * @ param ontologyTermNodePathText the node path * @ return the created { @ link Entity } */ private OntologyTermNodePath createNodePathEntity ( OWLClassContainer container , String ontologyTermNodePathText ) { } }
OntologyTermNodePath ontologyTermNodePath = ontologyTermNodePathFactory . create ( ) ; ontologyTermNodePath . setId ( idGenerator . generateId ( ) ) ; ontologyTermNodePath . setNodePath ( ontologyTermNodePathText ) ; ontologyTermNodePath . setRoot ( container . isRoot ( ) ) ; nodePathRepository . add ( ontologyTermNodePath ) ; return ontologyTermNodePath ;
public class JAXBHandle { /** * Creates a factory to create a JAXBHandle instance for POJO instances * of the specified classes . * @ param pojoClassesthe POJO classes for which this factory provides a handle * @ returnthe factory * @ throws JAXBException if a JAXB error occurs while initializing the new factory */ static public ContentHandleFactory newFactory ( Class < ? > ... pojoClasses ) throws JAXBException { } }
if ( pojoClasses == null || pojoClasses . length == 0 ) return null ; return new JAXBHandleFactory ( pojoClasses ) ;
public class AbstractTextViewAssert { public S hasTextScaleX ( float scale ) { } }
isNotNull ( ) ; float actualScale = actual . getTextScaleX ( ) ; assertThat ( actualScale ) . overridingErrorMessage ( "Expected text X scale <%s> but was <%s>." , scale , actualScale ) . isEqualTo ( scale ) ; return myself ;
public class HttpTransportUtils { /** * 根据序列化名称获得序列化类型 * @ param serialization 序列化类型名称 * @ return 序列化编码 */ public static byte getSerializeTypeByName ( String serialization ) throws SofaRpcException { } }
String sz = serialization . toLowerCase ( ) ; Byte code ; if ( RpcConstants . SERIALIZE_HESSIAN2 . equals ( sz ) || RpcConstants . SERIALIZE_HESSIAN . equals ( sz ) ) { code = SerializerFactory . getCodeByAlias ( RpcConstants . SERIALIZE_HESSIAN2 ) ; } else { code = SerializerFactory . getCodeByAlias ( serialization ) ; } if ( code != null ) { return code ; } else { throw new SofaRpcException ( RpcErrorType . SERVER_DESERIALIZE , "Unsupported serialize type " + serialization + " in http protocol." ) ; }
public class Environment { /** * Adds Selenium cookies to response ' s cookie store . * @ param response response to which cookies must be added . */ public void addSeleniumCookies ( HttpResponse response ) { } }
CookieStore cookieStore = ensureResponseHasCookieStore ( response ) ; CookieConverter converter = getCookieConverter ( ) ; Set < Cookie > browserCookies = getSeleniumHelper ( ) . getCookies ( ) ; converter . copySeleniumCookies ( browserCookies , cookieStore ) ;
public class Util { /** * Return a StringArray resulting from decoding the given String which * should have been encoded by encodeArray * @ param val String value encoded by encodeArray * @ return String [ ] decoded value */ public static String [ ] decodeArray ( final String val ) { } }
if ( val == null ) { return null ; } int len = val . length ( ) ; if ( len == 0 ) { return new String [ 0 ] ; } ArrayList < String > al = new ArrayList < String > ( ) ; int i = 0 ; while ( i < len ) { int end = val . indexOf ( " " , i ) ; String s ; if ( end < 0 ) { s = val . substring ( i ) ; i = len ; } else { s = val . substring ( i , end ) ; i = end + 1 ; } try { if ( s . equals ( "\t" ) ) { al . add ( null ) ; } else { al . add ( URLDecoder . decode ( s , "UTF-8" ) ) ; } } catch ( Throwable t ) { throw new RuntimeException ( t ) ; } } return al . toArray ( new String [ al . size ( ) ] ) ;
public class ExtensionManager { /** * Print out information of all the plugins to stdout * @ deprecated */ public void printAllExtensions ( ) { } }
Extension [ ] exts = getExtensionList ( ) ; System . out . println ( "There are totally " + exts . length + " plugin(s) registered." ) ; for ( int i = 0 ; i < exts . length ; i ++ ) { System . out . println ( "\n ---- Plugin # " + ( i + 1 ) + " ---- " ) ; System . out . println ( "Key: " + exts [ i ] . getKey ( ) ) ; System . out . println ( "Version: " + exts [ i ] . getVersion ( ) ) ; System . out . println ( "Registration Time: " + exts [ i ] . getLastHeartbeatTime ( ) . getTime ( ) ) ; System . out . println ( "Configuration URL: " + exts [ i ] . getServer ( ) [ 0 ] . getUrl ( ) ) ; }
public class LightMetaProperty { /** * Creates an instance from a { @ code Field } . * @ param < P > the property type * @ param metaBean the meta bean , not null * @ param field the field , not null * @ param constructorIndex the index of the property in the constructor * @ return the property , not null */ @ SuppressWarnings ( "unchecked" ) static < P > LightMetaProperty < P > of ( MetaBean metaBean , Field field , MethodHandles . Lookup lookup , String propertyName , int constructorIndex ) { } }
MethodHandle getter ; try { getter = lookup . findGetter ( field . getDeclaringClass ( ) , field . getName ( ) , field . getType ( ) ) ; } catch ( IllegalArgumentException | NoSuchFieldException | IllegalAccessException ex ) { throw new UnsupportedOperationException ( "Property cannot be read: " + propertyName , ex ) ; } MethodHandle setter = null ; if ( ! Modifier . isFinal ( field . getModifiers ( ) ) ) { try { setter = lookup . findSetter ( field . getDeclaringClass ( ) , field . getName ( ) , field . getType ( ) ) ; } catch ( IllegalArgumentException | NoSuchFieldException | IllegalAccessException ex ) { throw new UnsupportedOperationException ( "Property cannot be read: " + propertyName , ex ) ; } } return new LightMetaProperty < > ( metaBean , propertyName , ( Class < P > ) field . getType ( ) , field . getGenericType ( ) , Arrays . asList ( field . getAnnotations ( ) ) , getter , setter , constructorIndex , calculateStyle ( metaBean , setter ) ) ;
public class ServerService { /** * Add public IP to list servers * @ param serverFilter server search criteria * @ param publicIpConfig publicIp config * @ return OperationFuture wrapper for list of ServerRef */ public OperationFuture < List < Server > > addPublicIp ( ServerFilter serverFilter , CreatePublicIpConfig publicIpConfig ) { } }
return addPublicIp ( Arrays . asList ( getRefsFromFilter ( serverFilter ) ) , publicIpConfig ) ;
public class CmsGalleryController { /** * Returns the gallery folder info to the given path . < p > * @ param galleryPath the gallery folder path * @ return the gallery folder info */ public CmsGalleryFolderBean getGalleryInfo ( String galleryPath ) { } }
CmsGalleryFolderBean result = null ; for ( CmsGalleryFolderBean folderBean : getAvailableGalleries ( ) ) { if ( folderBean . getPath ( ) . equals ( galleryPath ) ) { result = folderBean ; break ; } } return result ;
public class GeneralizedExtremeValueDistribution { /** * CDF of GEV distribution * @ param val Value * @ param mu Location parameter mu * @ param sigma Scale parameter sigma * @ param k Shape parameter k * @ return CDF at position x . */ public static double cdf ( double val , double mu , double sigma , double k ) { } }
final double x = ( val - mu ) / sigma ; if ( k > 0 || k < 0 ) { if ( k * x > 1 ) { return k > 0 ? 1 : 0 ; } return FastMath . exp ( - FastMath . exp ( FastMath . log ( 1 - k * x ) / k ) ) ; } else { // Gumbel case : return FastMath . exp ( - FastMath . exp ( - x ) ) ; }
public class COMUtil { /** * translate a Variant Object to Object , when it is a Dispatch translate it to COMWrapper * @ param parent * @ param variant * @ param key * @ return Object from Variant * @ throws ExpressionException */ public static Object toObject ( COMObject parent , Variant variant , String key ) throws ExpressionException { } }
short type = variant . getvt ( ) ; // print . ln ( key + " - > variant . getvt ( " + toStringType ( type ) + " ) " ) ; /* * TODO impl this Variant . VariantByref ; Variant . VariantError ; Variant . VariantTypeMask ; */ if ( type == Variant . VariantEmpty ) return null ; else if ( type == Variant . VariantNull ) return null ; else if ( type == Variant . VariantShort ) return Short . valueOf ( variant . getShort ( ) ) ; else if ( type == Variant . VariantInt ) return Integer . valueOf ( variant . getInt ( ) ) ; else if ( type == Variant . VariantFloat ) return new Float ( variant . getFloat ( ) ) ; else if ( type == Variant . VariantDouble ) return new Double ( variant . getDouble ( ) ) ; else if ( type == Variant . VariantCurrency ) { long l ; try { l = variant . getCurrency ( ) . longValue ( ) ; } // this reflection allows support for old and new jacob version catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; try { Method toCurrency = variant . getClass ( ) . getMethod ( "toCurrency" , new Class [ 0 ] ) ; Object curreny = toCurrency . invoke ( variant , new Object [ 0 ] ) ; Method longValue = curreny . getClass ( ) . getMethod ( "longValue" , new Class [ 0 ] ) ; l = Caster . toLongValue ( longValue . invoke ( curreny , new Object [ 0 ] ) , 0 ) ; } catch ( Throwable t2 ) { ExceptionUtil . rethrowIfNecessary ( t2 ) ; l = 0 ; } } return Long . valueOf ( l ) ; } else if ( type == Variant . VariantObject ) return variant . toEnumVariant ( ) ; else if ( type == Variant . VariantDate ) return new DateTimeImpl ( ( long ) variant . getDate ( ) , true ) ; else if ( type == Variant . VariantString ) return variant . getString ( ) ; else if ( type == Variant . VariantBoolean ) return variant . getBoolean ( ) ? Boolean . TRUE : Boolean . FALSE ; else if ( type == Variant . VariantByte ) return new Byte ( variant . getByte ( ) ) ; else if ( type == Variant . VariantVariant ) { throw new ExpressionException ( "type variant is not supported" ) ; // return toObject ( variant . getV . get ( ) ) ; } else if ( type == Variant . VariantArray ) { Variant [ ] varr = variant . getVariantArrayRef ( ) ; Object [ ] oarr = new Object [ varr . length ] ; for ( int i = 0 ; i < varr . length ; i ++ ) { oarr [ i ] = toObject ( parent , varr [ i ] , Caster . toString ( i ) ) ; } return new ArrayImpl ( oarr ) ; } else if ( type == Variant . VariantDispatch ) { return new COMObject ( variant , variant . toDispatch ( ) , parent . getName ( ) + "." + key ) ; } // TODO ? ? else if ( type = = Variant . VariantError ) return variant . toError ( ) ; throw new ExpressionException ( "COM Type [" + toStringType ( type ) + "] not supported" ) ;
public class MergeUtils { /** * Return if this path has been visited before . * @ param path topic path , may contain a fragment * @ return true if has been visited */ public boolean isVisited ( final URI path ) { } }
final URI localPath = stripFragment ( path ) . normalize ( ) ; return visitSet . contains ( localPath ) ;
public class ApiOvhOrder { /** * Create order * REST : POST / order / dedicated / server / { serviceName } / staticIP / { duration } * @ param country [ required ] Ip localization * @ param serviceName [ required ] The internal name of your dedicated server * @ param duration [ required ] Duration */ public OvhOrder dedicated_server_serviceName_staticIP_duration_POST ( String serviceName , String duration , OvhIpStaticCountryEnum country ) throws IOException { } }
String qPath = "/order/dedicated/server/{serviceName}/staticIP/{duration}" ; StringBuilder sb = path ( qPath , serviceName , duration ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "country" , country ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhOrder . class ) ;
public class UrlIO { /** * Allows to add a single request property . * @ param name * @ param value * @ return this for convenience . */ @ Scope ( DocScope . IO ) public UrlIO addRequestProperty ( final String name , final String value ) { } }
requestProperties . put ( name , value ) ; return this ;
public class UpdateResourceShareRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateResourceShareRequest updateResourceShareRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateResourceShareRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateResourceShareRequest . getResourceShareArn ( ) , RESOURCESHAREARN_BINDING ) ; protocolMarshaller . marshall ( updateResourceShareRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( updateResourceShareRequest . getAllowExternalPrincipals ( ) , ALLOWEXTERNALPRINCIPALS_BINDING ) ; protocolMarshaller . marshall ( updateResourceShareRequest . getClientToken ( ) , CLIENTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CalibratedCurves { /** * Get a forward curve from the model , if not existing create a forward curve . * @ param swapTenorDefinition The swap tenor associated with the forward curve . * @ param forwardCurveName The name of the forward curve to create . * @ return The forward curve associated with the given name . */ private String createForwardCurve ( Schedule swapTenorDefinition , String forwardCurveName ) { } }
/* * Temporary " hack " - we try to infer index maturity codes from curve name . */ String indexMaturityCode = null ; if ( forwardCurveName . contains ( "_12M" ) || forwardCurveName . contains ( "-12M" ) || forwardCurveName . contains ( " 12M" ) ) { indexMaturityCode = "12M" ; } if ( forwardCurveName . contains ( "_1M" ) || forwardCurveName . contains ( "-1M" ) || forwardCurveName . contains ( " 1M" ) ) { indexMaturityCode = "1M" ; } if ( forwardCurveName . contains ( "_6M" ) || forwardCurveName . contains ( "-6M" ) || forwardCurveName . contains ( " 6M" ) ) { indexMaturityCode = "6M" ; } if ( forwardCurveName . contains ( "_3M" ) || forwardCurveName . contains ( "-3M" ) || forwardCurveName . contains ( " 3M" ) ) { indexMaturityCode = "3M" ; } if ( forwardCurveName == null || forwardCurveName . isEmpty ( ) ) { return null ; } // Check if the curves exists , if not create it Curve curve = model . getCurve ( forwardCurveName ) ; Curve forwardCurve = null ; if ( curve == null ) { // Create a new forward curve if ( isUseForwardCurve ) { curve = new ForwardCurveInterpolation ( forwardCurveName , swapTenorDefinition . getReferenceDate ( ) , indexMaturityCode , ForwardCurveInterpolation . InterpolationEntityForward . FORWARD , null ) ; } else { // Alternative : Model the forward curve through an underlying discount curve . curve = DiscountCurveInterpolation . createDiscountCurveFromDiscountFactors ( forwardCurveName , new double [ ] { 0.0 } , new double [ ] { 1.0 } ) ; model = model . addCurves ( curve ) ; } } // Check if the curve is a discount curve , if yes - create a forward curve wrapper . if ( DiscountCurve . class . isInstance ( curve ) ) { /* * If the specified forward curve exits as a discount curve , we generate a forward curve * by wrapping the discount curve and calculating the * forward from discount factors using the formula ( df ( T ) / df ( T + Delta T ) - 1 ) / Delta T ) . * If no index maturity is used , the forward curve is interpreted " single curve " , i . e . * T + Delta T is always the payment . */ forwardCurve = new ForwardCurveFromDiscountCurve ( curve . getName ( ) , swapTenorDefinition . getReferenceDate ( ) , indexMaturityCode ) ; } else { // Use a given forward curve forwardCurve = curve ; } model = model . addCurves ( forwardCurve ) ; return forwardCurve . getName ( ) ;
public class UTF8String { /** * Returns the underline bytes , will be a copy of it if it ' s part of another array . */ public byte [ ] getBytes ( ) { } }
// avoid copy if ` base ` is ` byte [ ] ` if ( offset == BYTE_ARRAY_OFFSET && base instanceof byte [ ] && ( ( byte [ ] ) base ) . length == numBytes ) { return ( byte [ ] ) base ; } else { byte [ ] bytes = new byte [ numBytes ] ; copyMemory ( base , offset , bytes , BYTE_ARRAY_OFFSET , numBytes ) ; return bytes ; }
public class Security { /** * Decrypt a string value . * @ param value Value to decrypt . * @ return Decrypted value . */ protected static final String decrypt ( String value , String cipherKey ) { } }
int len = value == null ? 0 : value . length ( ) ; if ( len < 3 ) { return "" ; } int identifierIndex = value . charAt ( 0 ) - 32 ; int associatorIndex = value . charAt ( len - 1 ) - 32 ; String [ ] cipher = CipherRegistry . getCipher ( cipherKey ) ; return StrUtil . xlate ( value . substring ( 1 , len - 1 ) , cipher [ associatorIndex ] , cipher [ identifierIndex ] ) ;
public class Choice6 { /** * { @ inheritDoc } */ @ Override public < G > Choice6 < A , B , C , D , E , G > fmap ( Function < ? super F , ? extends G > fn ) { } }
return Monad . super . < G > fmap ( fn ) . coerce ( ) ;
public class MisoScenePanel { /** * Issues a warning to the error log that the specified block became visible prior to being * resolved . Derived classes may wish to augment or inhibit this warning . */ protected void warnVisible ( SceneBlock block , Rectangle sbounds ) { } }
log . warning ( "Block visible during resolution " + block + " sbounds:" + StringUtil . toString ( sbounds ) + " vbounds:" + StringUtil . toString ( _vbounds ) + "." ) ;
public class CompositeDialogPage { /** * Adds a new page to the list of pages managed by this CompositeDialogPage . * The page is created by wrapping the form page in a FormBackedDialogPage . * @ param form the form page to be insterted * @ return the DialogPage that wraps formPage */ public DialogPage addForm ( Form form ) { } }
DialogPage page = createDialogPage ( form ) ; addPage ( page ) ; return page ;
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getOVS ( ) { } }
if ( ovsEClass == null ) { ovsEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 330 ) ; } return ovsEClass ;
public class GetDomainNamesRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetDomainNamesRequest getDomainNamesRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getDomainNamesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getDomainNamesRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( getDomainNamesRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class SkewedInfo { /** * A list of values that appear so frequently as to be considered skewed . * @ param skewedColumnValues * A list of values that appear so frequently as to be considered skewed . */ public void setSkewedColumnValues ( java . util . Collection < String > skewedColumnValues ) { } }
if ( skewedColumnValues == null ) { this . skewedColumnValues = null ; return ; } this . skewedColumnValues = new java . util . ArrayList < String > ( skewedColumnValues ) ;
public class Node { /** * Check the health of the node and try to ping it if necessary . * @ param threshold the threshold after which the node should be removed * @ param healthChecker the node health checker */ protected void checkHealth ( long threshold , NodeHealthChecker healthChecker ) { } }
final int state = this . state ; if ( anyAreSet ( state , REMOVED | ACTIVE_PING ) ) { return ; } healthCheckPing ( threshold , healthChecker ) ;
public class Station { /** * Location is inside one of the maps . * @ param location * @ return */ public boolean inAnyMap ( Location location ) { } }
return maps . values ( ) . stream ( ) . anyMatch ( ( org . vesalainen . ham . MapArea m ) -> m . isInside ( location ) ) ;
public class JBossModuleUtils { /** * Helper method to create a revisionId in a consistent manner */ public static ModuleIdentifier createRevisionId ( ModuleId scriptModuleId , long revisionNumber ) { } }
Objects . requireNonNull ( scriptModuleId , "scriptModuleId" ) ; return ModuleIdentifier . create ( scriptModuleId . toString ( ) , Long . toString ( revisionNumber ) ) ;
public class Mapper { /** * < p > Loads the mapper tables if not already done so . This method is usually invoked implicity * by the various < code > run < / code > methods . Don ' t call < code > load < / code > explicitly unless * you want to force loading of mapper tables . < / p > * < p > I tried to load the mapper from a background Thread started in the constructor . But * the overall performance ( of the jp example ) was worse , probably because class loading * is to fast ( and out - performes the threading overhead ) . * @ throws IllegalStateException to indicate a class loading problem */ public void load ( ) { } }
ClassLoader loader ; Class c ; Method m ; Object [ ] tables ; if ( isLoaded ( ) ) { return ; } loader = Mapper . class . getClassLoader ( ) ; try { c = loader . loadClass ( name ) ; } catch ( ClassNotFoundException e ) { throw new IllegalStateException ( name + ": cannot load class: " + e . getMessage ( ) , e ) ; } try { m = c . getMethod ( "load" , new Class [ ] { } ) ; } catch ( NoSuchMethodException e ) { throw new IllegalStateException ( e . getMessage ( ) , e ) ; } try { tables = ( Object [ ] ) m . invoke ( null , new Object [ ] { } ) ; } catch ( InvocationTargetException e ) { throw new IllegalStateException ( e . getTargetException ( ) . getMessage ( ) , e ) ; } catch ( IllegalAccessException e ) { throw new IllegalStateException ( e . getMessage ( ) , e ) ; } parser = ( Parser ) tables [ 0 ] ; oag = ( Oag ) tables [ 1 ] ;
public class Solo { /** * Presses a MenuItem matching the specified index . Index { @ code 0 } is the first item in the * first row , Index { @ code 3 } is the first item in the second row and * index { @ code 6 } is the first item in the third row . * @ param index the index of the { @ link android . view . MenuItem } to press */ public void pressMenuItem ( int index ) { } }
if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "pressMenuItem(" + index + ")" ) ; } presser . pressMenuItem ( index ) ;
public class TangoUser { public void addTangoUserListener ( ITangoUserListener listener , boolean stateless ) throws DevFailed { } }
event_listeners . add ( ITangoUserListener . class , listener ) ; event_identifier = subscribe_user_event ( attr_name , filters , stateless ) ;
public class ReflectionUtils { /** * Returns the Field object for the specified field name declared in the * specified class . Returns null if no such field can be found . * @ param clazz * The declaring class where the field will be reflected . This * method will NOT attempt to reflect its superclass if such * field is not found in this class . * @ param fieldName * The case - sensitive name of the field to be searched . */ static Field getClassFieldByName ( Class < ? > clazz , String fieldName ) { } }
try { return clazz . getDeclaredField ( fieldName ) ; } catch ( SecurityException e ) { throw new DynamoDBMappingException ( "Denied access to the [" + fieldName + "] field in class [" + clazz + "]." , e ) ; } catch ( NoSuchFieldException e ) { return null ; }
public class XMLConfigAdmin { /** * important ! returns null when not a bundle ! */ static BundleFile installBundle ( Config config , Resource resJar , String extVersion , boolean convert2bundle ) throws IOException , BundleException { } }
BundleFile bf = new BundleFile ( resJar ) ; // resJar is a bundle if ( bf . isBundle ( ) ) { return installBundle ( config , bf ) ; } if ( ! convert2bundle ) return null ; // name String name = bf . getSymbolicName ( ) ; if ( StringUtil . isEmpty ( name ) ) name = BundleBuilderFactory . createSymbolicName ( resJar ) ; // version Version version = bf . getVersion ( ) ; if ( version == null ) version = OSGiUtil . toVersion ( extVersion ) ; SystemOut . printDate ( "failed to load [" + resJar + "] as OSGi Bundle" ) ; BundleBuilderFactory bbf = new BundleBuilderFactory ( resJar , name ) ; bbf . setVersion ( version ) ; bbf . setIgnoreExistingManifest ( false ) ; bbf . build ( ) ; bf = new BundleFile ( resJar ) ; SystemOut . printDate ( "converted [" + resJar + "] to an OSGi Bundle" ) ; return installBundle ( config , bf ) ;
public class Utils { /** * Logs action ( event and method ) */ static void log ( Task action , String msg ) { } }
log ( action . event . getKey ( ) , action . method , msg ) ;
public class VLongWritable { /** * Compares two VLongWritables . */ public int compareTo ( Object o ) { } }
long thisValue = this . value ; long thatValue = ( ( VLongWritable ) o ) . value ; return ( thisValue < thatValue ? - 1 : ( thisValue == thatValue ? 0 : 1 ) ) ;
public class BidiagonalDecompositionRow_DDRM { /** * Returns the orthogonal U matrix . * @ param U If not null then the results will be stored here . Otherwise a new matrix will be created . * @ return The extracted Q matrix . */ @ Override public DMatrixRMaj getU ( DMatrixRMaj U , boolean transpose , boolean compact ) { } }
U = handleU ( U , transpose , compact , m , n , min ) ; CommonOps_DDRM . setIdentity ( U ) ; for ( int i = 0 ; i < m ; i ++ ) u [ i ] = 0 ; for ( int j = min - 1 ; j >= 0 ; j -- ) { u [ j ] = 1 ; for ( int i = j + 1 ; i < m ; i ++ ) { u [ i ] = UBV . get ( i , j ) ; } if ( transpose ) QrHelperFunctions_DDRM . rank1UpdateMultL ( U , u , gammasU [ j ] , j , j , m ) ; else QrHelperFunctions_DDRM . rank1UpdateMultR ( U , u , gammasU [ j ] , j , j , m , this . b ) ; } return U ;
public class Blade { /** * Add a before route to routes , the before route will be executed before matching route * @ param path your route path * @ param handler route implement * @ return return blade instance * @ see # before ( String , RouteHandler ) */ @ Deprecated public Blade before ( @ NonNull String path , @ NonNull RouteHandler0 handler ) { } }
this . routeMatcher . addRoute ( path , handler , HttpMethod . BEFORE ) ; return this ;
public class GenericProblem { /** * Evaluates a solution by taking into account both the evaluation calculated by the objective function and the * penalizing constraints ( if any ) . Penalties are assigned for any violated penalizing constraint , which are * subtracted from the evaluation in case of maximization , and added to it in case of minimization . * If there are no penalizing constraints , this method returns the evaluation object obtained from applying * the objective function to the given solution . If one or more penalizing constraints have been specified , * a penalized evaluation is constructed taking into account both the main objective function evaluation * and assigned penalties . * @ param solution solution to be evaluated * @ return aggregated evaluation taking into account both the objective function and penalizing constraints */ @ Override public Evaluation evaluate ( SolutionType solution ) { } }
if ( penalizingConstraints . isEmpty ( ) ) { // CASE 1 : no penalizing constraints return objective . evaluate ( solution , data ) ; } else { // CASE 2 ( default ) : aggregate evaluation and penalties Evaluation eval = objective . evaluate ( solution , data ) ; // initialize penalized evaluation object PenalizedEvaluation penEval = new PenalizedEvaluation ( eval , isMinimizing ( ) ) ; // add penalties penalizingConstraints . forEach ( pc -> penEval . addPenalizingValidation ( pc , pc . validate ( solution , data ) ) ) ; // return aggregated evaluation return penEval ; }
public class NetworkChat { /** * Add a new message . * @ param message The message to add . */ protected void addMessage ( String message ) { } }
messages . add ( message ) ; messageCount ++ ; if ( messageCount > messagesQueueMax ) { messages . remove ( ) ; messageCount -- ; }
public class AddAdGroups { /** * Runs the example . * @ param adWordsServices the services factory . * @ param session the session . * @ param campaignId the ID of the campaign where the ad groups will be created . * @ throws ApiException if the API request failed with one or more service errors . * @ throws RemoteException if the API request failed due to other errors . */ public static void runExample ( AdWordsServicesInterface adWordsServices , AdWordsSession session , long campaignId ) throws RemoteException { } }
// Get the AdGroupService . AdGroupServiceInterface adGroupService = adWordsServices . get ( session , AdGroupServiceInterface . class ) ; // Create ad group . AdGroup adGroup = new AdGroup ( ) ; adGroup . setName ( "Earth to Mars Cruises #" + System . currentTimeMillis ( ) ) ; adGroup . setStatus ( AdGroupStatus . ENABLED ) ; adGroup . setCampaignId ( campaignId ) ; // Optional settings . // Targeting restriction settings . Depending on the criterionTypeGroup // value , most TargetingSettingDetail only affect Display campaigns . // However , the USER _ INTEREST _ AND _ LIST value works for RLSA campaigns - // Search campaigns targeting using a remarketing list . TargetingSetting targeting = new TargetingSetting ( ) ; // Restricting to serve ads that match your ad group placements . // This is equivalent to choosing " Target and bid " in the UI . TargetingSettingDetail placements = new TargetingSettingDetail ( ) ; placements . setCriterionTypeGroup ( CriterionTypeGroup . PLACEMENT ) ; placements . setTargetAll ( Boolean . FALSE ) ; // Using your ad group verticals only for bidding . This is equivalent // to choosing " Bid only " in the UI . TargetingSettingDetail verticals = new TargetingSettingDetail ( ) ; verticals . setCriterionTypeGroup ( CriterionTypeGroup . VERTICAL ) ; verticals . setTargetAll ( Boolean . TRUE ) ; targeting . setDetails ( new TargetingSettingDetail [ ] { placements , verticals } ) ; adGroup . setSettings ( new Setting [ ] { targeting } ) ; // Set the rotation mode . AdGroupAdRotationMode rotationMode = new AdGroupAdRotationMode ( AdRotationMode . OPTIMIZE ) ; adGroup . setAdGroupAdRotationMode ( rotationMode ) ; // Create ad group bid . BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration ( ) ; Money cpcBidMoney = new Money ( ) ; cpcBidMoney . setMicroAmount ( 10_000_000L ) ; CpcBid bid = new CpcBid ( ) ; bid . setBid ( cpcBidMoney ) ; biddingStrategyConfiguration . setBids ( new Bids [ ] { bid } ) ; adGroup . setBiddingStrategyConfiguration ( biddingStrategyConfiguration ) ; // Add as many additional ad groups as you need . AdGroup adGroup2 = new AdGroup ( ) ; adGroup2 . setName ( "Earth to Venus Cruises #" + System . currentTimeMillis ( ) ) ; adGroup2 . setStatus ( AdGroupStatus . ENABLED ) ; adGroup2 . setCampaignId ( campaignId ) ; BiddingStrategyConfiguration biddingStrategyConfiguration2 = new BiddingStrategyConfiguration ( ) ; Money cpcBidMoney2 = new Money ( ) ; cpcBidMoney2 . setMicroAmount ( 10_000_000L ) ; CpcBid bid2 = new CpcBid ( ) ; bid2 . setBid ( cpcBidMoney2 ) ; biddingStrategyConfiguration2 . setBids ( new Bids [ ] { bid2 } ) ; adGroup2 . setBiddingStrategyConfiguration ( biddingStrategyConfiguration2 ) ; // Create operations . AdGroupOperation operation = new AdGroupOperation ( ) ; operation . setOperand ( adGroup ) ; operation . setOperator ( Operator . ADD ) ; AdGroupOperation operation2 = new AdGroupOperation ( ) ; operation2 . setOperand ( adGroup2 ) ; operation2 . setOperator ( Operator . ADD ) ; AdGroupOperation [ ] operations = new AdGroupOperation [ ] { operation , operation2 } ; // Add ad groups . AdGroupReturnValue result = adGroupService . mutate ( operations ) ; // Display new ad groups . for ( AdGroup adGroupResult : result . getValue ( ) ) { System . out . printf ( "Ad group with name '%s' and ID %d was added.%n" , adGroupResult . getName ( ) , adGroupResult . getId ( ) ) ; }
public class ExecutorServiceHelper { /** * Call shutdown on the { @ link ExecutorService } and wait indefinitely until it * terminated . * @ param aES * The { @ link ExecutorService } to operate on . May not be * < code > null < / code > . * @ return { @ link EInterrupt # INTERRUPTED } if the executor service was * interrupted while awaiting termination . Never < code > null < / code > . */ @ Nonnull public static EInterrupt shutdownAndWaitUntilAllTasksAreFinished ( @ Nonnull final ExecutorService aES ) { } }
return shutdownAndWaitUntilAllTasksAreFinished ( aES , 1 , TimeUnit . SECONDS ) ;
public class KNNOutlier { /** * Runs the algorithm in the timed evaluation part . * @ param relation Data relation */ public OutlierResult run ( Relation < O > relation ) { } }
final DistanceQuery < O > distanceQuery = relation . getDistanceQuery ( getDistanceFunction ( ) ) ; final KNNQuery < O > knnQuery = relation . getKNNQuery ( distanceQuery , k ) ; FiniteProgress prog = LOG . isVerbose ( ) ? new FiniteProgress ( "kNN distance for objects" , relation . size ( ) , LOG ) : null ; DoubleMinMax minmax = new DoubleMinMax ( ) ; WritableDoubleDataStore knno_score = DataStoreUtil . makeDoubleStorage ( relation . getDBIDs ( ) , DataStoreFactory . HINT_STATIC ) ; // compute distance to the k nearest neighbor . for ( DBIDIter it = relation . iterDBIDs ( ) ; it . valid ( ) ; it . advance ( ) ) { // distance to the kth nearest neighbor // ( assuming the query point is always included , with distance 0) final double dkn = knnQuery . getKNNForDBID ( it , k ) . getKNNDistance ( ) ; knno_score . putDouble ( it , dkn ) ; minmax . put ( dkn ) ; LOG . incrementProcessed ( prog ) ; } LOG . ensureCompleted ( prog ) ; DoubleRelation scoreres = new MaterializedDoubleRelation ( "kNN Outlier Score" , "knn-outlier" , knno_score , relation . getDBIDs ( ) ) ; OutlierScoreMeta meta = new BasicOutlierScoreMeta ( minmax . getMin ( ) , minmax . getMax ( ) , 0. , Double . POSITIVE_INFINITY , 0. ) ; return new OutlierResult ( meta , scoreres ) ;
public class CsvEscape { /** * Perform a CSV < strong > escape < / strong > operation on a < tt > char [ ] < / tt > input . * This method is < strong > thread - safe < / strong > . * @ param text the < tt > char [ ] < / tt > to be escaped . * @ param offset the position in < tt > text < / tt > at which the escape operation should start . * @ param len the number of characters in < tt > text < / tt > that should be escaped . * @ param writer the < tt > java . io . Writer < / tt > to which the escaped result will be written . Nothing will * be written at all to this writer if input is < tt > null < / tt > . * @ throws IOException if an input / output exception occurs */ public static void escapeCsv ( final char [ ] text , final int offset , final int len , final Writer writer ) throws IOException { } }
if ( writer == null ) { throw new IllegalArgumentException ( "Argument 'writer' cannot be null" ) ; } final int textLen = ( text == null ? 0 : text . length ) ; if ( offset < 0 || offset > textLen ) { throw new IllegalArgumentException ( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen ) ; } if ( len < 0 || ( offset + len ) > textLen ) { throw new IllegalArgumentException ( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen ) ; } CsvEscapeUtil . escape ( text , offset , len , writer ) ;
public class EntityListenersProcessor { /** * Adds the call back method . * @ param metadata * the metadata * @ param jpaAnnotation * the jpa annotation * @ param callbackMethod * the callback method */ @ SuppressWarnings ( "unchecked" ) private void addCallBackMethod ( EntityMetadata metadata , Class < ? > jpaAnnotation , CallbackMethod callbackMethod ) { } }
Map < Class < ? > , List < ? extends CallbackMethod > > callBackMethodsMap = metadata . getCallbackMethodsMap ( ) ; List < CallbackMethod > list = ( List < CallbackMethod > ) callBackMethodsMap . get ( jpaAnnotation ) ; if ( null == list ) { list = new ArrayList < CallbackMethod > ( ) ; callBackMethodsMap . put ( jpaAnnotation , list ) ; } list . add ( callbackMethod ) ;
public class Task { /** * Get the final state of each construct used by this task and add it to the { @ link org . apache . gobblin . runtime . TaskState } . * @ param extractor the { @ link org . apache . gobblin . instrumented . extractor . InstrumentedExtractorBase } used by this task . * @ param converter the { @ link org . apache . gobblin . converter . Converter } used by this task . * @ param rowChecker the { @ link RowLevelPolicyChecker } used by this task . */ private void addConstructsFinalStateToTaskState ( InstrumentedExtractorBase < ? , ? > extractor , Converter < ? , ? , ? , ? > converter , RowLevelPolicyChecker rowChecker ) { } }
ConstructState constructState = new ConstructState ( ) ; if ( extractor != null ) { constructState . addConstructState ( Constructs . EXTRACTOR , new ConstructState ( extractor . getFinalState ( ) ) ) ; } if ( converter != null ) { constructState . addConstructState ( Constructs . CONVERTER , new ConstructState ( converter . getFinalState ( ) ) ) ; } if ( rowChecker != null ) { constructState . addConstructState ( Constructs . ROW_QUALITY_CHECKER , new ConstructState ( rowChecker . getFinalState ( ) ) ) ; } int forkIdx = 0 ; for ( Optional < Fork > fork : this . forks . keySet ( ) ) { constructState . addConstructState ( Constructs . FORK_OPERATOR , new ConstructState ( fork . get ( ) . getFinalState ( ) ) , Integer . toString ( forkIdx ) ) ; forkIdx ++ ; } constructState . mergeIntoWorkUnitState ( this . taskState ) ;
public class EnvUtil { /** * Checks whether config file exists in directory . * @ param dirPath the dir path * @ return true , if successful */ public static boolean hasConfigFileExists ( String dirPath ) { } }
String filePath = dirPath + File . separator + Configurations . CONFIG_FILE_NAME + "." ; if ( AuditUtil . isFileExists ( filePath + Configurations . YML_EXTENTION ) || AuditUtil . isFileExists ( filePath + Configurations . YAML_EXTENTION ) || AuditUtil . isFileExists ( filePath + Configurations . XML_EXTENTION ) ) { return true ; } return false ;
public class ReferenceBuilder { /** * Adds the given property and value to the constructed reference . * @ param propertyIdValue * the property to add * @ param value * the value to add * @ return builder object to continue construction */ public ReferenceBuilder withPropertyValue ( PropertyIdValue propertyIdValue , Value value ) { } }
getSnakList ( propertyIdValue ) . add ( factory . getValueSnak ( propertyIdValue , value ) ) ; return getThis ( ) ;
public class InternalJSONUtil { /** * 将Property的键转化为JSON形式 < br > * 用于识别类似于 : com . luxiaolei . package . hutool这类用点隔开的键 * @ param jsonObject JSONObject * @ param key 键 * @ param value 值 * @ return JSONObject */ protected static JSONObject propertyPut ( JSONObject jsonObject , Object key , Object value ) { } }
String keyStr = Convert . toStr ( key ) ; String [ ] path = StrUtil . split ( keyStr , StrUtil . DOT ) ; int last = path . length - 1 ; JSONObject target = jsonObject ; for ( int i = 0 ; i < last ; i += 1 ) { String segment = path [ i ] ; JSONObject nextTarget = target . getJSONObject ( segment ) ; if ( nextTarget == null ) { nextTarget = new JSONObject ( ) ; target . put ( segment , nextTarget ) ; } target = nextTarget ; } target . put ( path [ last ] , value ) ; return jsonObject ;
public class ExampleDataUtil { /** * Creates the example data . * @ param rows the number of rows to create * @ param documents the number of documents to add to each person * @ return the example data . */ public static List < PersonBean > createExampleData ( final int rows , final int documents ) { } }
List < PersonBean > data = new ArrayList < > ( rows ) ; Date date1 = DateUtilities . createDate ( 1 , 2 , 1973 ) ; Date date2 = DateUtilities . createDate ( 2 , 3 , 1985 ) ; Date date3 = DateUtilities . createDate ( 3 , 4 , 2004 ) ; for ( int i = 1 ; i <= rows ; i ++ ) { PersonBean bean = new PersonBean ( "P" + i , "Joe" + i , "Bloggs" + i , date1 ) ; List < TravelDoc > docs = new ArrayList < > ( documents ) ; for ( int j = 1 ; j <= documents ; j ++ ) { String prefix = i + "-" + j ; TravelDoc doc = new TravelDoc ( "DOC" + prefix , "Canada" + prefix , "Ottawa" + prefix , date2 , date3 ) ; docs . add ( doc ) ; } bean . setDocuments ( docs ) ; data . add ( bean ) ; } return data ;
public class Checks { /** * Performs check with the predicate . * @ param reference the reference to check * @ param predicate the predicate to use * @ param errorMessage the exception message to use if the check fails ; will * be converted to a string using { @ link String # valueOf ( Object ) } * @ param < T > the reference type * @ return the original reference * @ throws IllegalArgumentException if the { @ code reference } is empty * @ throws NullPointerException if the { @ code reference } is null * @ see # checkNotEmpty ( Object , String , Object . . . ) */ public static < T > T check ( T reference , Predicate < T > predicate , @ Nullable Object errorMessage ) { } }
check ( reference , predicate , String . valueOf ( errorMessage ) , EMPTY_ERROR_MESSAGE_ARGS ) ; return reference ;
public class ClustersInner { /** * Executes script actions on the specified HDInsight cluster . * @ param resourceGroupName The name of the resource group . * @ param clusterName The name of the cluster . * @ param parameters The parameters for executing script actions . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceResponse } object if successful . */ public Observable < ServiceResponse < Void > > beginExecuteScriptActionsWithServiceResponseAsync ( String resourceGroupName , String clusterName , ExecuteScriptActionParameters parameters ) { } }
if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( clusterName == null ) { throw new IllegalArgumentException ( "Parameter clusterName is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } if ( parameters == null ) { throw new IllegalArgumentException ( "Parameter parameters is required and cannot be null." ) ; } Validator . validate ( parameters ) ; return service . beginExecuteScriptActions ( this . client . subscriptionId ( ) , resourceGroupName , clusterName , this . client . apiVersion ( ) , parameters , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Void > > > ( ) { @ Override public Observable < ServiceResponse < Void > > call ( Response < ResponseBody > response ) { try { ServiceResponse < Void > clientResponse = beginExecuteScriptActionsDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class SharesInner { /** * Gets a share by name . * @ param deviceName The device name . * @ param name The share name . * @ param resourceGroupName The resource group name . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the ShareInner object */ public Observable < ShareInner > getAsync ( String deviceName , String name , String resourceGroupName ) { } }
return getWithServiceResponseAsync ( deviceName , name , resourceGroupName ) . map ( new Func1 < ServiceResponse < ShareInner > , ShareInner > ( ) { @ Override public ShareInner call ( ServiceResponse < ShareInner > response ) { return response . body ( ) ; } } ) ;
public class AllWindowedStream { /** * Applies an aggregation that that gives the maximum value of the pojo data * stream at the given field expression for every window . A field expression * is either the name of a public field or a getter method with parentheses * of the { @ link DataStream DataStreams } underlying type . A dot can be used to drill * down into objects , as in { @ code " field1 . getInnerField2 ( ) " } . * @ param field The field expression based on which the aggregation will be applied . * @ return The transformed DataStream . */ public SingleOutputStreamOperator < T > max ( String field ) { } }
return aggregate ( new ComparableAggregator < > ( field , input . getType ( ) , AggregationFunction . AggregationType . MAX , false , input . getExecutionConfig ( ) ) ) ;
public class AccountManager { /** * < p > insertGroup . < / p > * @ param name a { @ link java . lang . String } object . * @ return a boolean . */ public boolean insertGroup ( String name ) { } }
if ( isGroupExist ( name ) ) { throw new SystemException ( String . format ( "Group '%s' already exist." , name ) ) ; } return allGroups . add ( name ) ;
public class ContinuousDistributions { /** * Internal function used by gammaCdf * @ param x * @ param A * @ return */ private static double gSer ( double x , double A ) { } }
// Good for X < A + 1. double T9 = 1 / A ; double G = T9 ; double I = 1 ; while ( T9 > G * 0.00001 ) { T9 = T9 * x / ( A + I ) ; G = G + T9 ; ++ I ; } G = G * Math . exp ( A * Math . log ( x ) - x - logGamma ( A ) ) ; return G ;
public class CouchDBClient { /** * ( non - Javadoc ) * @ see * com . impetus . kundera . client . Client # persistJoinTable ( com . impetus . kundera * . persistence . context . jointable . JoinTableData ) */ @ Override public void persistJoinTable ( JoinTableData joinTableData ) { } }
String joinTableName = joinTableData . getJoinTableName ( ) ; String joinColumnName = joinTableData . getJoinColumnName ( ) ; String invJoinColumnName = joinTableData . getInverseJoinColumnName ( ) ; Map < Object , Set < Object > > joinTableRecords = joinTableData . getJoinTableRecords ( ) ; for ( Object key : joinTableRecords . keySet ( ) ) { Set < Object > values = joinTableRecords . get ( key ) ; Object joinColumnValue = key ; for ( Object childId : values ) { Map < String , Object > obj = new HashMap < String , Object > ( ) ; String id = joinTableName + "#" + joinColumnValue . toString ( ) + "#" + childId ; obj . put ( "_id" , id ) ; obj . put ( joinColumnName , joinColumnValue ) ; obj . put ( invJoinColumnName , childId ) ; JsonObject object = gson . toJsonTree ( obj ) . getAsJsonObject ( ) ; HttpResponse response = null ; try { URI uri = new URI ( CouchDBConstants . PROTOCOL , null , httpHost . getHostName ( ) , httpHost . getPort ( ) , CouchDBConstants . URL_SEPARATOR + joinTableData . getSchemaName ( ) . toLowerCase ( ) + CouchDBConstants . URL_SEPARATOR + id , null , null ) ; HttpPut put = new HttpPut ( uri ) ; StringEntity stringEntity = null ; stringEntity = new StringEntity ( object . toString ( ) , Constants . CHARSET_UTF8 ) ; stringEntity . setContentType ( "application/json" ) ; put . setEntity ( stringEntity ) ; response = httpClient . execute ( httpHost , put , CouchDBUtils . getContext ( httpHost ) ) ; } catch ( Exception e ) { log . error ( "Error while persisting joinTable data, coused by {}." , e ) ; throw new KunderaException ( e ) ; } finally { closeContent ( response ) ; } } }
public class CommerceWishListModelImpl { /** * Converts the soap model instances into normal model instances . * @ param soapModels the soap model instances to convert * @ return the normal model instances */ public static List < CommerceWishList > toModels ( CommerceWishListSoap [ ] soapModels ) { } }
if ( soapModels == null ) { return null ; } List < CommerceWishList > models = new ArrayList < CommerceWishList > ( soapModels . length ) ; for ( CommerceWishListSoap soapModel : soapModels ) { models . add ( toModel ( soapModel ) ) ; } return models ;
public class GanttChartView12 { /** * { @ inheritDoc } */ @ Override protected void processProgressLines ( Map < Integer , FontBase > fontBases , byte [ ] progressLineData ) { } }
// MPPUtility . fileDump ( " c : \ \ temp \ \ props . txt " , ByteArrayHelper . hexdump ( progressLineData , false , 16 , " " ) . getBytes ( ) ) ; m_progressLinesEnabled = ( progressLineData [ 0 ] != 0 ) ; m_progressLinesAtCurrentDate = ( progressLineData [ 2 ] != 0 ) ; m_progressLinesAtRecurringIntervals = ( progressLineData [ 4 ] != 0 ) ; m_progressLinesInterval = Interval . getInstance ( progressLineData [ 6 ] ) ; m_progressLinesIntervalDailyDayNumber = progressLineData [ 8 ] ; m_progressLinesIntervalDailyWorkday = ( progressLineData [ 10 ] != 0 ) ; m_progressLinesIntervalWeeklyDay [ Day . SUNDAY . getValue ( ) ] = ( progressLineData [ 14 ] != 0 ) ; m_progressLinesIntervalWeeklyDay [ Day . MONDAY . getValue ( ) ] = ( progressLineData [ 16 ] != 0 ) ; m_progressLinesIntervalWeeklyDay [ Day . TUESDAY . getValue ( ) ] = ( progressLineData [ 18 ] != 0 ) ; m_progressLinesIntervalWeeklyDay [ Day . WEDNESDAY . getValue ( ) ] = ( progressLineData [ 20 ] != 0 ) ; m_progressLinesIntervalWeeklyDay [ Day . THURSDAY . getValue ( ) ] = ( progressLineData [ 22 ] != 0 ) ; m_progressLinesIntervalWeeklyDay [ Day . FRIDAY . getValue ( ) ] = ( progressLineData [ 24 ] != 0 ) ; m_progressLinesIntervalWeeklyDay [ Day . SATURDAY . getValue ( ) ] = ( progressLineData [ 26 ] != 0 ) ; m_progressLinesIntervalWeekleyWeekNumber = progressLineData [ 30 ] ; m_progressLinesIntervalMonthlyDay = ( progressLineData [ 32 ] != 0 ) ; m_progressLinesIntervalMonthlyDayDayNumber = progressLineData [ 34 ] ; m_progressLinesIntervalMonthlyDayMonthNumber = progressLineData [ 28 ] ; m_progressLinesIntervalMonthlyFirstLastDay = ProgressLineDay . getInstance ( progressLineData [ 36 ] ) ; m_progressLinesIntervalMonthlyFirstLast = ( progressLineData [ 40 ] == 1 ) ; m_progressLinesIntervalMonthlyFirstLastMonthNumber = progressLineData [ 30 ] ; m_progressLinesBeginAtProjectStart = ( progressLineData [ 44 ] != 0 ) ; m_progressLinesBeginAtDate = MPPUtility . getDate ( progressLineData , 46 ) ; m_progressLinesDisplaySelected = ( progressLineData [ 48 ] != 0 ) ; m_progressLinesActualPlan = ( progressLineData [ 52 ] != 0 ) ; m_progressLinesDisplayType = MPPUtility . getShort ( progressLineData , 54 ) ; m_progressLinesShowDate = ( progressLineData [ 56 ] != 0 ) ; m_progressLinesDateFormat = MPPUtility . getShort ( progressLineData , 58 ) ; m_progressLinesFontStyle = getFontStyle ( progressLineData , 60 , fontBases ) ; m_progressLinesCurrentLineColor = ColorType . getInstance ( progressLineData [ 64 ] ) . getColor ( ) ; m_progressLinesCurrentLineStyle = LineStyle . getInstance ( progressLineData [ 65 ] ) ; m_progressLinesCurrentProgressPointColor = ColorType . getInstance ( progressLineData [ 66 ] ) . getColor ( ) ; m_progressLinesCurrentProgressPointShape = progressLineData [ 67 ] ; m_progressLinesOtherLineColor = ColorType . getInstance ( progressLineData [ 68 ] ) . getColor ( ) ; m_progressLinesOtherLineStyle = LineStyle . getInstance ( progressLineData [ 69 ] ) ; m_progressLinesOtherProgressPointColor = ColorType . getInstance ( progressLineData [ 70 ] ) . getColor ( ) ; m_progressLinesOtherProgressPointShape = progressLineData [ 71 ] ; int dateCount = MPPUtility . getShort ( progressLineData , 50 ) ; if ( dateCount != 0 ) { m_progressLinesDisplaySelectedDates = new Date [ dateCount ] ; int offset = 72 ; int count = 0 ; while ( count < dateCount && offset < progressLineData . length ) { m_progressLinesDisplaySelectedDates [ count ] = MPPUtility . getDate ( progressLineData , offset ) ; offset += 2 ; ++ count ; } }
public class FlowTypeCheck { /** * Type check a continue statement . This requires propagating the current * environment to the block destination , to ensure that the actual types of all * variables at that point are precise . * @ param stmt * Statement to type check * @ param environment * Determines the type of all variables immediately going into this * block * @ return */ private Environment checkContinue ( Stmt . Continue stmt , Environment environment , EnclosingScope scope ) { } }
// FIXME : need to check environment to the continue destination return FlowTypeUtils . BOTTOM ;
public class Client { /** * Make a call , passing < code > param < / code > , to the IPC server running at < code > address < / code > which is servicing the * < code > protocol < / code > protocol , * with the < code > ticket < / code > credentials , returning the value . * Throws exceptions if there are network problems or if the remote code * threw an exception . */ public IOReadableWritable call ( IOReadableWritable param , InetSocketAddress addr , Class < ? > protocol ) throws InterruptedException , IOException { } }
Call call = new Call ( param ) ; Connection connection = getConnection ( addr , protocol , call ) ; connection . sendParam ( call ) ; // send the parameter synchronized ( call ) { while ( ! call . done ) { try { call . wait ( ) ; // wait for the result } catch ( InterruptedException ignored ) { } } if ( call . error != null ) { if ( call . error instanceof RemoteException ) { call . error . fillInStackTrace ( ) ; throw call . error ; } else { // local exception throw wrapException ( addr , call . error ) ; } } else { return call . value ; } }
public class WorkflowServiceImpl { /** * Gets the workflow by workflow Id . * @ param workflowId Id of the workflow . * @ param includeTasks Includes tasks associated with workflow . * @ return an instance of { @ link Workflow } */ @ Service public Workflow getExecutionStatus ( String workflowId , boolean includeTasks ) { } }
Workflow workflow = executionService . getExecutionStatus ( workflowId , includeTasks ) ; if ( workflow == null ) { throw new ApplicationException ( ApplicationException . Code . NOT_FOUND , String . format ( "Workflow with Id: %s not found." , workflowId ) ) ; } return workflow ;
public class EntityField { /** * 是否有该注解 * @ param annotationClass * @ return */ public boolean isAnnotationPresent ( Class < ? extends Annotation > annotationClass ) { } }
boolean result = false ; if ( field != null ) { result = field . isAnnotationPresent ( annotationClass ) ; } if ( ! result && setter != null ) { result = setter . isAnnotationPresent ( annotationClass ) ; } if ( ! result && getter != null ) { result = getter . isAnnotationPresent ( annotationClass ) ; } return result ;
public class MMElementRule { /** * Gets the parameters attribute of the MMElementRule object . * @ return The parameters value * @ see # setParameters */ @ Override public Object [ ] getParameters ( ) { } }
// return the parameters as used for the rule validation Object [ ] params = new Object [ 2 ] ; params [ 0 ] = databaseUsed ; params [ 1 ] = rangeMassUsed ; return params ;
public class Utils { /** * Returns a shared preferences for storing any library preferences . */ public static SharedPreferences getSegmentSharedPreferences ( Context context , String tag ) { } }
return context . getSharedPreferences ( "analytics-android-" + tag , MODE_PRIVATE ) ;
public class Utils { /** * コレクションの要素を指定した区切り文字で繋げて1つの文字列とする 。 * @ param col 処理対象のコレクション 。 * @ param separator 区切り文字 。 * @ param ignoreEmptyElement 空 、 nullの要素を無視するかどうか 。 * @ param trim トリムをするかどうか 。 * @ param elementConverter 要素を変換するクラス 。 * @ return 結合した文字列 */ @ SuppressWarnings ( "rawtypes" ) public static String join ( final Collection < ? > col , final String separator , final boolean ignoreEmptyElement , final boolean trim , final ElementConverter elementConverter ) { } }
final List < Object > list = new ArrayList < Object > ( ) ; for ( Object element : col ) { if ( element == null ) { continue ; } Object value = element ; if ( element instanceof String ) { String str = ( String ) element ; if ( ignoreEmptyElement && isEmpty ( str ) ) { continue ; } else if ( trim ) { value = str . trim ( ) ; } } else if ( element instanceof Character && isEmpty ( element . toString ( ) ) ) { String str = element . toString ( ) ; if ( ignoreEmptyElement && isEmpty ( str ) ) { continue ; } else if ( trim ) { value = str . trim ( ) . charAt ( 0 ) ; } } else if ( char . class . isAssignableFrom ( element . getClass ( ) ) ) { String str = element . toString ( ) ; if ( ignoreEmptyElement && isEmpty ( str ) ) { continue ; } else if ( trim ) { value = str . trim ( ) . charAt ( 0 ) ; } } list . add ( value ) ; } return join ( list , separator , elementConverter ) ;
public class FileOperations { /** * Create a new directory if it does not exist . The direct parent directory * already needs to exist . * @ param aDir * The directory to be created if it does not exist . May not be * < code > null < / code > . * @ return A non - < code > null < / code > error code . * @ see # createDirRecursive ( File ) */ @ Nonnull public static FileIOError createDirRecursiveIfNotExisting ( @ Nonnull final File aDir ) { } }
final FileIOError aError = createDirRecursive ( aDir ) ; if ( aError . getErrorCode ( ) . equals ( EFileIOErrorCode . TARGET_ALREADY_EXISTS ) ) return EFileIOErrorCode . NO_ERROR . getAsIOError ( EFileIOOperation . CREATE_DIR_RECURSIVE , aDir ) ; return aError ;
public class JaxWsUtils { /** * get the targetNamespace from SEI . * If it is webServiceProvider just return the targetNamespace attribute from annotation . * If it is webService and no SEI specified , return the implementedTargetNamespace ; * If it is webService and SEI specified with no targetNamespace attribute , should report error ? * If it is webService and SEI specified with targetNamespace attribute , just return the targetNamespace attribute value . * @ param classInfo * @ param String * @ param InfoStore * @ return */ public static String getInterfaceTargetNamespace ( ClassInfo classInfo , String seiClassName , String implementedTargetNamespace , InfoStore infoStore ) { } }
AnnotationInfo annotationInfo = getAnnotationInfoFromClass ( classInfo , JaxWsConstants . TARGETNAMESPACE_ATTRIBUTE ) ; if ( annotationInfo == null ) { return "" ; } boolean isProvider = isProvider ( classInfo ) ; // if the serviceImplBean is a WebServiceProvider , return the attribute value or the defaultValue if ( isProvider ) { AnnotationValue attrValue = annotationInfo . getValue ( JaxWsConstants . TARGETNAMESPACE_ATTRIBUTE ) ; String attrFromAnnotation = attrValue == null ? null : attrValue . getStringValue ( ) . trim ( ) ; return StringUtils . isEmpty ( attrFromAnnotation ) ? implementedTargetNamespace : attrFromAnnotation ; } if ( null == infoStore || StringUtils . isEmpty ( seiClassName ) ) { return implementedTargetNamespace ; } // if can get the SEI className , go here . // Here , the SEI package name instead of implementation class package name should be used as the default value for the targetNameSpace ClassInfo seiClassInfo = infoStore . getDelayableClassInfo ( seiClassName ) ; String defaultValue = getNamespace ( seiClassInfo , null ) ; if ( StringUtils . isEmpty ( defaultValue ) ) { defaultValue = JaxWsConstants . UNKNOWN_NAMESPACE ; } annotationInfo = seiClassInfo . getAnnotation ( JaxWsConstants . WEB_SERVICE_ANNOTATION_NAME ) ; if ( null == annotationInfo ) { // if the SEI does not have the @ WebService annotation , we should report it as error ? ( RI 2.2 will do ) if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "No @WebService or @WebServiceProvider annotation is found on the class " + seiClassInfo + " will return " + defaultValue ) ; } return defaultValue ; } // if the attribute is presented in SEI ' s @ WebService , just return it . or , return the default value for Service String attrFromSEI = annotationInfo . getValue ( JaxWsConstants . TARGETNAMESPACE_ATTRIBUTE ) . getStringValue ( ) . trim ( ) ; return StringUtils . isEmpty ( attrFromSEI ) ? defaultValue : attrFromSEI ;
public class ReUtil { /** * 从content中匹配出多个值并根据template生成新的字符串 < br > * 匹配结束后会删除匹配内容之前的内容 ( 包括匹配内容 ) < br > * 例如 : < br > * content 2013年5月 pattern ( . * ? ) 年 ( . * ? ) 月 template : $ 1 - $ 2 return 2013-5 * @ param regex 匹配正则字符串 * @ param content 被匹配的内容 * @ param template 生成内容模板 , 变量 $ 1 表示group1的内容 , 以此类推 * @ return 按照template拼接后的字符串 */ public static String extractMulti ( String regex , CharSequence content , String template ) { } }
if ( null == content || null == regex || null == template ) { return null ; } // Pattern pattern = Pattern . compile ( regex , Pattern . DOTALL ) ; final Pattern pattern = PatternPool . get ( regex , Pattern . DOTALL ) ; return extractMulti ( pattern , content , template ) ;
public class TypedArgument { /** * Extract the argument values from an array of { @ link TypedArgument } s . * @ param arguments the arguments to extract the values from . * @ return the values of the arguments . */ public static Object [ ] values ( TypedArgument ... arguments ) { } }
Object [ ] values = new Object [ arguments . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) { values [ i ] = arguments [ i ] . value ; } return values ;
public class RTMPHandshake { /** * Returns a digest byte offset . * @ param handshake handshake sequence * @ param bufferOffset buffer offset * @ return digest offset */ protected int getDigestOffset2 ( byte [ ] handshake , int bufferOffset ) { } }
bufferOffset += 772 ; int offset = handshake [ bufferOffset ] & 0xff ; // & 0x0ff ; bufferOffset ++ ; offset += handshake [ bufferOffset ] & 0xff ; bufferOffset ++ ; offset += handshake [ bufferOffset ] & 0xff ; bufferOffset ++ ; offset += handshake [ bufferOffset ] & 0xff ; int res = Math . abs ( ( offset % 728 ) + 776 ) ; if ( res + DIGEST_LENGTH > 1535 ) { log . error ( "Invalid digest offset calc: {}" , res ) ; } return res ;
public class RelationshipPrefetcherFactory { /** * create either a CollectionPrefetcher or a ReferencePrefetcher */ public RelationshipPrefetcher createRelationshipPrefetcher ( ClassDescriptor anOwnerCld , String aRelationshipName ) { } }
ObjectReferenceDescriptor ord ; ord = anOwnerCld . getCollectionDescriptorByName ( aRelationshipName ) ; if ( ord == null ) { ord = anOwnerCld . getObjectReferenceDescriptorByName ( aRelationshipName ) ; if ( ord == null ) { throw new PersistenceBrokerException ( "Relationship named '" + aRelationshipName + "' not found in owner class " + ( anOwnerCld != null ? anOwnerCld . getClassNameOfObject ( ) : null ) ) ; } } return createRelationshipPrefetcher ( ord ) ;
public class VarOptItemsSketch { /** * Construct a varopt sampling sketch with up to k samples using the specified resize factor . * @ param k Maximum size of sampling . Allocated size may be smaller until sketch fills . * Unlike many sketches in this package , this value does < em > not < / em > need to be a * power of 2. * @ param rf < a href = " { @ docRoot } / resources / dictionary . html # resizeFactor " > See Resize Factor < / a > * @ param < T > The type of object held in the sketch . * @ return A VarOptItemsSketch initialized with maximum size k and resize factor rf . */ public static < T > VarOptItemsSketch < T > newInstance ( final int k , final ResizeFactor rf ) { } }
return new VarOptItemsSketch < > ( k , rf ) ;
public class QRSparseFactorization { /** * Constructs and returns a new QR decomposition object ; computed by * Householder reflections ; If m < n then then the QR of A ' is computed . The * decomposed matrices can be retrieved via instance methods of the returned * decomposition object . * @ param A * A rectangular matrix . * @ param order * ordering option ( 0 to 3 ) ; 0 : natural ordering , 1 : amd ( A + A ' ) , 2: * amd ( S ' * S ) , 3 : amd ( A ' * A ) * @ throws IllegalArgumentException * if < tt > A < / tt > is not sparse * @ throws IllegalArgumentException * if < tt > order < / tt > is not in [ 0,3] */ public void factorize ( ) throws Exception { } }
m = A . rows ( ) ; n = A . columns ( ) ; if ( this . rescaler != null ) { double [ ] cn_00_original = null ; double [ ] cn_2_original = null ; double [ ] cn_00_scaled = null ; double [ ] cn_2_scaled = null ; if ( log . isDebugEnabled ( ) ) { cn_00_original = ColtUtils . getConditionNumberRange ( new Array2DRowRealMatrix ( A . toArray ( ) ) , Integer . MAX_VALUE ) ; log . debug ( "cn_00_original Q before scaling: " + ArrayUtils . toString ( cn_00_original ) ) ; cn_2_original = ColtUtils . getConditionNumberRange ( new Array2DRowRealMatrix ( A . toArray ( ) ) , 2 ) ; log . debug ( "cn_2_original Q before scaling : " + ArrayUtils . toString ( cn_2_original ) ) ; } // scaling the A matrix , we have : // A1 = U . A . V [ T ] DoubleMatrix1D [ ] UV = rescaler . getMatrixScalingFactors ( A ) ; this . U = UV [ 0 ] ; this . V = UV [ 1 ] ; if ( log . isDebugEnabled ( ) ) { boolean checkOK = rescaler . checkScaling ( A , U , V ) ; if ( ! checkOK ) { log . warn ( "Scaling failed (checkScaling = false)" ) ; } } this . A = ( SparseDoubleMatrix2D ) ColtUtils . diagonalMatrixMult ( U , A , V ) ; if ( log . isDebugEnabled ( ) ) { cn_00_scaled = ColtUtils . getConditionNumberRange ( new Array2DRowRealMatrix ( A . toArray ( ) ) , Integer . MAX_VALUE ) ; log . debug ( "cn_00_scaled Q after scaling : " + ArrayUtils . toString ( cn_00_scaled ) ) ; cn_2_scaled = ColtUtils . getConditionNumberRange ( new Array2DRowRealMatrix ( A . toArray ( ) ) , 2 ) ; log . debug ( "cn_2_scaled Q after scaling : " + ArrayUtils . toString ( cn_2_scaled ) ) ; if ( cn_00_original [ 0 ] < cn_00_scaled [ 0 ] || cn_2_original [ 0 ] < cn_2_scaled [ 0 ] ) { log . warn ( "Problematic scaling" ) ; // throw new RuntimeException ( " Scaling failed " ) ; } } } Dcs dcs ; if ( m >= n ) { dcs = ColtUtils . matrixToDcs ( A ) ; } else { dcs = ColtUtils . matrixToDcs ( ( SparseDoubleMatrix2D ) ALG . transpose ( A ) ) ; } S = Dcs_sqr . cs_sqr ( order , dcs , true ) ; if ( S == null ) { throw new IllegalArgumentException ( "Exception occured in cs_sqr()" ) ; } N = Dcs_qr . cs_qr ( dcs , S ) ; if ( N == null ) { throw new IllegalArgumentException ( "Exception occured in cs_qr()" ) ; }
public class SQLUtilityImpl { /** * Adds or replaces a row in the given table . * @ param conn * the connection to use * @ param table * the name of the table * @ param columns * the names of the columns whose values we ' re setting . * @ param values * associated values * @ param uniqueColumn * which column name is unique ? The value of this column will be used * in the where clause . It must be a column which is not numeric . * @ param numeric * for each associated column , is it numeric ? if null , all columns * are assumed to be strings . */ @ Override protected void i_replaceInto ( Connection conn , String table , String [ ] columns , String [ ] values , String uniqueColumn , boolean [ ] numeric ) throws SQLException { } }
if ( ! i_updateRow ( conn , table , columns , values , uniqueColumn , numeric ) ) { i_addRow ( conn , table , columns , values , numeric ) ; }
public class PluginManager { /** * Sets the specified plugin ' s properties from the specified properties file under the specified plugin directory . * @ param pluginDirName the specified plugin directory * @ param plugin the specified plugin * @ param props the specified properties file * @ throws Exception exception */ private static void setPluginProps ( final String pluginDirName , final AbstractPlugin plugin , final Properties props ) throws Exception { } }
final String author = props . getProperty ( Plugin . PLUGIN_AUTHOR ) ; final String name = props . getProperty ( Plugin . PLUGIN_NAME ) ; final String version = props . getProperty ( Plugin . PLUGIN_VERSION ) ; final String types = props . getProperty ( Plugin . PLUGIN_TYPES ) ; LOGGER . log ( Level . TRACE , "Plugin[name={0}, author={1}, version={2}, types={3}]" , name , author , version , types ) ; plugin . setAuthor ( author ) ; plugin . setName ( name ) ; plugin . setId ( name + "_" + version ) ; plugin . setVersion ( version ) ; plugin . setDir ( pluginDirName ) ; plugin . readLangs ( ) ; // try to find the setting config . json final File settingFile = Latkes . getWebFile ( "/plugins/" + pluginDirName + "/config.json" ) ; if ( null != settingFile && settingFile . exists ( ) ) { try { final String config = FileUtils . readFileToString ( settingFile ) ; final JSONObject jsonObject = new JSONObject ( config ) ; plugin . setSetting ( jsonObject ) ; } catch ( final IOException ie ) { LOGGER . log ( Level . ERROR , "reading the config of the plugin[" + name + "] failed" , ie ) ; } catch ( final JSONException e ) { LOGGER . log ( Level . ERROR , "convert the config of the plugin[" + name + "] to json failed" , e ) ; } } Arrays . stream ( types . split ( "," ) ) . map ( PluginType :: valueOf ) . forEach ( plugin :: addType ) ;
public class JavaCompiler { /** * Perform dataflow checks on attributed parse trees . * These include checks for definite assignment and unreachable statements . * If any errors occur , an empty list will be returned . * @ return the list of attributed parse trees */ public Queue < Env < AttrContext > > flow ( Queue < Env < AttrContext > > envs ) { } }
ListBuffer < Env < AttrContext > > results = new ListBuffer < > ( ) ; for ( Env < AttrContext > env : envs ) { flow ( env , results ) ; } return stopIfError ( CompileState . FLOW , results ) ;
public class Img { /** * 计算旋转后的图片尺寸 * @ param width 宽度 * @ param height 高度 * @ param degree 旋转角度 * @ return 计算后目标尺寸 * @ since 4.1.20 */ private static Rectangle calcRotatedSize ( int width , int height , int degree ) { } }
if ( degree >= 90 ) { if ( degree / 90 % 2 == 1 ) { int temp = height ; height = width ; width = temp ; } degree = degree % 90 ; } double r = Math . sqrt ( height * height + width * width ) / 2 ; double len = 2 * Math . sin ( Math . toRadians ( degree ) / 2 ) * r ; double angel_alpha = ( Math . PI - Math . toRadians ( degree ) ) / 2 ; double angel_dalta_width = Math . atan ( ( double ) height / width ) ; double angel_dalta_height = Math . atan ( ( double ) width / height ) ; int len_dalta_width = ( int ) ( len * Math . cos ( Math . PI - angel_alpha - angel_dalta_width ) ) ; int len_dalta_height = ( int ) ( len * Math . cos ( Math . PI - angel_alpha - angel_dalta_height ) ) ; int des_width = width + len_dalta_width * 2 ; int des_height = height + len_dalta_height * 2 ; return new Rectangle ( des_width , des_height ) ;
public class ConstFold { /** * Fold unary operation . * @ param opcode The operation ' s opcode instruction ( usually a byte code ) , * as entered by class Symtab . * opcode ' s ifeq to ifge are for postprocessing * xcmp ; ifxx pairs of instructions . * @ param operand The operation ' s operand type . * Argument types are assumed to have non - null constValue ' s . */ Type fold1 ( int opcode , Type operand ) { } }
try { Object od = operand . constValue ( ) ; switch ( opcode ) { case nop : return operand ; case ineg : // unary - return syms . intType . constType ( - intValue ( od ) ) ; case ixor : return syms . intType . constType ( ~ intValue ( od ) ) ; case bool_not : return syms . booleanType . constType ( b2i ( intValue ( od ) == 0 ) ) ; case ifeq : return syms . booleanType . constType ( b2i ( intValue ( od ) == 0 ) ) ; case ifne : return syms . booleanType . constType ( b2i ( intValue ( od ) != 0 ) ) ; case iflt : return syms . booleanType . constType ( b2i ( intValue ( od ) < 0 ) ) ; case ifgt : return syms . booleanType . constType ( b2i ( intValue ( od ) > 0 ) ) ; case ifle : return syms . booleanType . constType ( b2i ( intValue ( od ) <= 0 ) ) ; case ifge : return syms . booleanType . constType ( b2i ( intValue ( od ) >= 0 ) ) ; case lneg : // unary - return syms . longType . constType ( new Long ( - longValue ( od ) ) ) ; case lxor : return syms . longType . constType ( new Long ( ~ longValue ( od ) ) ) ; case fneg : // unary - return syms . floatType . constType ( new Float ( - floatValue ( od ) ) ) ; case dneg : return syms . doubleType . constType ( new Double ( - doubleValue ( od ) ) ) ; default : return null ; } } catch ( ArithmeticException e ) { return null ; }
public class ProbabilityWeightedMoments { /** * Compute the alpha _ r factors using the method of probability - weighted * moments . * @ param data < b > Presorted < / b > data array . * @ param adapter Array adapter . * @ param nmom Number of moments to compute * @ return Alpha moments ( 0 - indexed ) */ public static < A > double [ ] alphaPWM ( A data , NumberArrayAdapter < ? , A > adapter , final int nmom ) { } }
final int n = adapter . size ( data ) ; final double [ ] xmom = new double [ nmom ] ; double weight = 1. / n ; for ( int i = 0 ; i < n ; i ++ ) { final double val = adapter . getDouble ( data , i ) ; xmom [ 0 ] += weight * val ; for ( int j = 1 ; j < nmom ; j ++ ) { weight *= ( n - i - j + 1 ) / ( n - j + 1 ) ; xmom [ j ] += weight * val ; } } return xmom ;
public class AWSSimpleSystemsManagementClient { /** * Set the default version of a document . * @ param updateDocumentDefaultVersionRequest * @ return Result of the UpdateDocumentDefaultVersion operation returned by the service . * @ throws InternalServerErrorException * An error occurred on the server side . * @ throws InvalidDocumentException * The specified document does not exist . * @ throws InvalidDocumentVersionException * The document version is not valid or does not exist . * @ throws InvalidDocumentSchemaVersionException * The version of the document schema is not supported . * @ sample AWSSimpleSystemsManagement . UpdateDocumentDefaultVersion * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ssm - 2014-11-06 / UpdateDocumentDefaultVersion " * target = " _ top " > AWS API Documentation < / a > */ @ Override public UpdateDocumentDefaultVersionResult updateDocumentDefaultVersion ( UpdateDocumentDefaultVersionRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeUpdateDocumentDefaultVersion ( request ) ;
public class FileInputFormat { /** * List input directories . * The file locations are also returned together with the file status . * Subclasses may override to , e . g . , select only files matching a regular * expression . * @ param job the job to list input paths for * @ return array of LocatedFileStatus objects * @ throws IOException if zero items . */ protected LocatedFileStatus [ ] listLocatedStatus ( JobConf job ) throws IOException { } }
Path [ ] dirs = getInputPaths ( job ) ; if ( dirs . length == 0 ) { throw new IOException ( "No input paths specified in job" ) ; } // Whether we need to recursive look into the directory structure final boolean recursive = job . getBoolean ( "mapred.input.dir.recursive" , false ) ; final List < LocatedFileStatus > result = Collections . synchronizedList ( new ArrayList < LocatedFileStatus > ( ) ) ; final List < IOException > errors = Collections . synchronizedList ( new ArrayList < IOException > ( ) ) ; final List < IOException > ioexceptions = Collections . synchronizedList ( new ArrayList < IOException > ( ) ) ; // creates a MultiPathFilter with the hiddenFileFilter and the // user provided one ( if any ) . List < PathFilter > filters = new ArrayList < PathFilter > ( ) ; filters . add ( hiddenFileFilter ) ; PathFilter jobFilter = getInputPathFilter ( job ) ; if ( jobFilter != null ) { filters . add ( jobFilter ) ; } final PathFilter inputFilter = new MultiPathFilter ( filters ) ; ThreadPoolExecutor executor = null ; int numExecutors = Math . min ( job . getInt ( "mapred.dfsclient.parallelism.max" , 1 ) , dirs . length ) ; if ( numExecutors > 1 ) { LOG . info ( "Using " + numExecutors + " threads for listLocatedStatus" ) ; executor = new ThreadPoolExecutor ( numExecutors , numExecutors , 60 , TimeUnit . SECONDS , new LinkedBlockingQueue < Runnable > ( ) ) ; } for ( Path one : dirs ) { final Path p = one ; final FileSystem fs = p . getFileSystem ( job ) ; Runnable r = new Runnable ( ) { public void run ( ) { try { List < Path > plist = new ArrayList < Path > ( ) ; if ( p . isAbsolute ( ) && ! FileSystem . hasGlobComponent ( p ) ) { plist . add ( p ) ; } else { FileStatus [ ] matches = fs . globStatus ( p , inputFilter ) ; if ( matches == null ) { errors . add ( new IOException ( "Input path does not exist: " + p ) ) ; } else if ( matches . length == 0 ) { errors . add ( new IOException ( "Input Pattern " + p + " matches 0 files" ) ) ; } else { for ( FileStatus globStat : matches ) plist . add ( globStat . getPath ( ) ) ; } } for ( Path onePath : plist ) { for ( RemoteIterator < LocatedFileStatus > itor = fs . listLocatedStatus ( onePath , inputFilter ) ; itor . hasNext ( ) ; ) { LocatedFileStatus stat = itor . next ( ) ; if ( recursive && stat . isDir ( ) ) { addLocatedInputPathRecursively ( result , fs , stat . getPath ( ) , inputFilter ) ; } else { result . add ( stat ) ; } } } } catch ( IOException e ) { ioexceptions . add ( e ) ; } } } ; if ( executor != null ) executor . submit ( r ) ; else r . run ( ) ; } boolean executorDone = false ; if ( executor != null ) { executor . shutdown ( ) ; do { try { executor . awaitTermination ( Integer . MAX_VALUE , TimeUnit . SECONDS ) ; executorDone = true ; } catch ( InterruptedException e ) { } } while ( ! executorDone ) ; } if ( ! ioexceptions . isEmpty ( ) ) { throw ioexceptions . get ( 0 ) ; } if ( ! errors . isEmpty ( ) ) { throw new InvalidInputException ( errors ) ; } LOG . info ( "Total input paths to process : " + result . size ( ) ) ; verifyLocatedFileStatus ( job , result ) ; return result . toArray ( new LocatedFileStatus [ result . size ( ) ] ) ;
public class OntologyTermRepository { /** * Finds exact { @ link OntologyTerm } s within { @ link Ontology } s . * @ param ontologyIds IDs of the { @ link Ontology } s to search in * @ param terms { @ link List } of search terms . the { @ link OntologyTerm } must match at least one of * these terms * @ param pageSize max number of results * @ return { @ link List } of { @ link OntologyTerm } s */ public List < OntologyTerm > findExcatOntologyTerms ( List < String > ontologyIds , Set < String > terms , int pageSize ) { } }
List < OntologyTerm > findOntologyTerms = findOntologyTerms ( ontologyIds , terms , pageSize ) ; return findOntologyTerms . stream ( ) . filter ( ontologyTerm -> isOntologyTermExactMatch ( terms , ontologyTerm ) ) . collect ( Collectors . toList ( ) ) ;
public class Input { /** * Returns an array * @ return int Length of array */ @ SuppressWarnings ( { } }
"unchecked" , "rawtypes" } ) @ Override public Object readArray ( Type target ) { int count = readInteger ( ) ; log . debug ( "Count: {} and {} ref {}" , new Object [ ] { count , ( count & 1 ) , ( count >> 1 ) } ) ; if ( ( count & 1 ) == 0 ) { // Reference Object ref = getReference ( count >> 1 ) ; if ( ref != null ) { return ref ; } } count = ( count >> 1 ) ; String key = readString ( ) ; amf3_mode += 1 ; Object result ; if ( key . equals ( "" ) ) { Class < ? > nested = Object . class ; Class < ? > collection = Collection . class ; Collection resultCollection ; if ( target instanceof ParameterizedType ) { ParameterizedType t = ( ParameterizedType ) target ; Type [ ] actualTypeArguments = t . getActualTypeArguments ( ) ; if ( actualTypeArguments . length == 1 ) { nested = ( Class < ? > ) actualTypeArguments [ 0 ] ; } target = t . getRawType ( ) ; } if ( target instanceof Class ) { collection = ( Class ) target ; } if ( collection . isArray ( ) ) { nested = ArrayUtils . getGenericType ( collection . getComponentType ( ) ) ; result = Array . newInstance ( nested , count ) ; storeReference ( result ) ; for ( int i = 0 ; i < count ; i ++ ) { final Object value = Deserializer . deserialize ( this , nested ) ; Array . set ( result , i , value ) ; } } else { if ( SortedSet . class . isAssignableFrom ( collection ) ) { resultCollection = new TreeSet ( ) ; } else if ( Set . class . isAssignableFrom ( collection ) ) { resultCollection = new HashSet ( count ) ; } else { resultCollection = new ArrayList ( count ) ; } result = resultCollection ; storeReference ( result ) ; for ( int i = 0 ; i < count ; i ++ ) { final Object value = Deserializer . deserialize ( this , nested ) ; resultCollection . add ( value ) ; } } } else { Class < ? > v = Object . class ; Class < ? > collection = Collection . class ; if ( target instanceof ParameterizedType ) { ParameterizedType t = ( ParameterizedType ) target ; Type [ ] actualTypeArguments = t . getActualTypeArguments ( ) ; if ( actualTypeArguments . length == 2 ) { // k = ( Class < ? > ) actualTypeArguments [ 0 ] ; v = ( Class < ? > ) actualTypeArguments [ 1 ] ; } target = t . getRawType ( ) ; } if ( target instanceof Class ) { collection = ( Class ) target ; } if ( SortedMap . class . isAssignableFrom ( collection ) ) { collection = TreeMap . class ; } else { collection = HashMap . class ; } Map resultMap ; try { resultMap = ( Map ) collection . newInstance ( ) ; } catch ( Exception e ) { resultMap = new HashMap ( count ) ; } // associative array storeReference ( resultMap ) ; while ( ! key . equals ( "" ) ) { final Object value = Deserializer . deserialize ( this , v ) ; resultMap . put ( key , value ) ; key = readString ( ) ; } for ( int i = 0 ; i < count ; i ++ ) { final Object value = Deserializer . deserialize ( this , v ) ; resultMap . put ( i , value ) ; } result = resultMap ; } amf3_mode -= 1 ; return result ;
public class IPv6AddressRange { /** * Remove a network from the range , resulting in one , none or two new ranges . If a network outside ( or partially outside ) the range is * removed , this has no effect . If the network which is removed is aligned with the beginning or end of the range , a single new ranges * is returned ( potentially empty if the range was equal to the network which is removed from it ) . If a network somewhere else in the * range is removed , two new ranges are returned . * @ param network network to remove from the range * @ return list of resulting ranges */ public List < IPv6AddressRange > remove ( IPv6Network network ) { } }
if ( network == null ) throw new IllegalArgumentException ( "invalid network [null]" ) ; if ( ! contains ( network ) ) return Collections . singletonList ( this ) ; else if ( this . equals ( network ) ) return Collections . emptyList ( ) ; else if ( first . equals ( network . getFirst ( ) ) ) return Collections . singletonList ( fromFirstAndLast ( network . getLast ( ) . add ( 1 ) , last ) ) ; else if ( last . equals ( network . getLast ( ) ) ) return Collections . singletonList ( fromFirstAndLast ( first , network . getFirst ( ) . subtract ( 1 ) ) ) ; else return Arrays . asList ( fromFirstAndLast ( first , network . getFirst ( ) . subtract ( 1 ) ) , fromFirstAndLast ( network . getLast ( ) . add ( 1 ) , last ) ) ;