signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class DefaultRewriteContentHandler { /** * Checks if the given image element has to be rewritten .
* @ param element Element to check
* @ return null if nothing is to do with this element .
* Return empty list to remove this element .
* Return list with other content to replace element with new content . */
private List < Content > rewriteImage ( Element element ) { } } | // resolve media metadata from DOM element
Media media = getImageMedia ( element ) ; // build image for media metadata
Element imageElement = buildImageElement ( media , element ) ; // return modified element
List < Content > content = new ArrayList < Content > ( ) ; if ( imageElement != null ) { content . add ( imageElement ) ; } return content ; |
public class APRIORI { /** * Build the 1 - itemsets .
* @ param relation Data relation
* @ param dim Maximum dimensionality
* @ param needed Minimum support needed
* @ return 1 - itemsets */
protected List < OneItemset > buildFrequentOneItemsets ( final Relation < ? extends SparseFeatureVector < ? > > relation , final int dim , final int needed ) { } } | // TODO : use TIntList and prefill appropriately to avoid knowing " dim "
// beforehand ?
int [ ] counts = new int [ dim ] ; for ( DBIDIter iditer = relation . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { SparseFeatureVector < ? > bv = relation . get ( iditer ) ; for ( int it = bv . iter ( ) ; bv . iterValid ( it ) ; it = bv . iterAdvance ( it ) ) { counts [ bv . iterDim ( it ) ] ++ ; } } if ( LOG . isStatistics ( ) ) { LOG . statistics ( new LongStatistic ( STAT + "1-items.candidates" , dim ) ) ; } // Generate initial candidates of length 1.
List < OneItemset > frequent = new ArrayList < > ( dim ) ; for ( int i = 0 ; i < dim ; i ++ ) { if ( counts [ i ] >= needed ) { frequent . add ( new OneItemset ( i , counts [ i ] ) ) ; } } return frequent ; |
public class WebSocket { /** * 给自身发送消息 , 消息类型是String或byte [ ] 或可JavaBean对象
* @ param message 不可为空 , 只能是String或byte [ ] 或可JavaBean对象
* @ param last 是否最后一条
* @ return 0表示成功 , 非0表示错误码 */
public final CompletableFuture < Integer > send ( Object message , boolean last ) { } } | return send ( false , message , last ) ; |
public class DisksInner { /** * Revokes access to a disk .
* @ param resourceGroupName The name of the resource group .
* @ param diskName The name of the managed disk that is being created . The name can ' t be changed after the disk is created . Supported characters for the name are a - z , A - Z , 0-9 and _ . The maximum name length is 80 characters .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < Void > revokeAccessAsync ( String resourceGroupName , String diskName ) { } } | return revokeAccessWithServiceResponseAsync ( resourceGroupName , diskName ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class Aggregate { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div >
* < div color = ' red ' style = " font - size : 18px ; color : red " > < i > sum all the numeric values which are encountered . NULLs are silently dropped < / i > < / div >
* < div color = ' red ' style = " font - size : 18px ; color : red " > < i > e . g . . . . aggregate ( ) . < b > sum ( n . property ( " amount " ) ) < / b > < / i > < / div >
* < br / > */
public RElement < RElement < ? > > sum ( JcProperty property ) { } } | ReturnExpression rx = getReturnExpression ( ) ; ReturnAggregate ra = ( ReturnAggregate ) rx . getReturnValue ( ) ; ra . setType ( AggregateFunctionType . SUM ) ; ra . setArgument ( property ) ; RElement < RElement < ? > > ret = new RElement < RElement < ? > > ( rx ) ; return ret ; |
public class LocalTransformExecutor { /** * Execute the specified TransformProcess with the given < i > sequence < / i > input data < br >
* Note : this method can only be used if the TransformProcess starts with sequence data , and also returns sequence data
* @ param inputSequence Input sequence data to process
* @ param transformProcess TransformProcess to execute
* @ return Processed ( non - sequential ) data */
public static List < List < List < Writable > > > executeSequenceToSequence ( List < List < List < Writable > > > inputSequence , TransformProcess transformProcess ) { } } | if ( ! ( transformProcess . getFinalSchema ( ) instanceof SequenceSchema ) ) { List < List < List < Writable > > > ret = new ArrayList < > ( inputSequence . size ( ) ) ; for ( List < List < Writable > > timeStep : inputSequence ) { ret . add ( execute ( timeStep , null , transformProcess ) . getFirst ( ) ) ; } return ret ; } return execute ( null , inputSequence , transformProcess ) . getSecond ( ) ; |
public class Offer { /** * Rejects the offer .
* @ throws NotConnectedException
* @ throws InterruptedException */
public void reject ( ) throws NotConnectedException , InterruptedException { } } | RejectPacket rejectPacket = new RejectPacket ( this . session . getWorkgroupJID ( ) ) ; connection . sendStanza ( rejectPacket ) ; // TODO : listen for a reply .
rejected = true ; |
public class TreeMap { /** * Returns the predecessor of the specified Entry , or null if no such . */
static < K , V > TreeMapEntry < K , V > predecessor ( TreeMapEntry < K , V > t ) { } } | if ( t == null ) return null ; else if ( t . left != null ) { TreeMapEntry < K , V > p = t . left ; while ( p . right != null ) p = p . right ; return p ; } else { TreeMapEntry < K , V > p = t . parent ; TreeMapEntry < K , V > ch = t ; while ( p != null && ch == p . left ) { ch = p ; p = p . parent ; } return p ; } |
public class CmsSourceSearchDialog { /** * Initializes the settings object . < p > */
protected void initSettingsObject ( ) { } } | Object o ; if ( CmsStringUtil . isEmpty ( getParamAction ( ) ) ) { o = new CmsSearchReplaceSettings ( ) ; } else { // this is not the initial call , get the job object from session
o = getDialogObject ( ) ; } if ( o == null ) { // create a new export handler object
m_settings = new CmsSearchReplaceSettings ( ) ; } else { // reuse export handler object stored in session
m_settings = ( CmsSearchReplaceSettings ) o ; } |
public class UtilityElf { /** * Checks whether an object is an instance of given type without throwing exception when the class is not loaded .
* @ param obj the object to check
* @ param className String class
* @ return true if object is assignable from the type , false otherwise or when the class cannot be loaded */
public static boolean safeIsAssignableFrom ( Object obj , String className ) { } } | try { Class < ? > clazz = Class . forName ( className ) ; return clazz . isAssignableFrom ( obj . getClass ( ) ) ; } catch ( ClassNotFoundException ignored ) { return false ; } |
public class DefaultBrokerCache { /** * Get a scoped object from the cache . */
@ SuppressWarnings ( value = "unchecked" ) < T , K extends SharedResourceKey > SharedResourceFactoryResponse < T > getScopedFromCache ( final SharedResourceFactory < T , K , S > factory , @ Nonnull final K key , @ Nonnull final ScopeWrapper < S > scope , final SharedResourcesBrokerImpl < S > broker ) throws ExecutionException { } } | RawJobBrokerKey fullKey = new RawJobBrokerKey ( scope , factory . getName ( ) , key ) ; Object obj = this . sharedResourceCache . get ( fullKey , new Callable < Object > ( ) { @ Override public Object call ( ) throws Exception { return factory . createResource ( broker . getScopedView ( scope . getType ( ) ) , broker . getConfigView ( scope . getType ( ) , key , factory . getName ( ) ) ) ; } } ) ; return ( SharedResourceFactoryResponse < T > ) obj ; |
public class CmsForm { /** * Validates a single field . < p >
* @ param field the field to validate */
public void validateField ( final I_CmsFormField field ) { } } | CmsValidationController validationController = new CmsValidationController ( field , createValidationHandler ( ) ) ; validationController . setFormValidator ( m_validatorClass ) ; validationController . setFormValidatorConfig ( createValidatorConfig ( ) ) ; startValidation ( validationController ) ; |
public class JBossTransactionsService { /** * { @ inheritDoc } */
@ Override protected UserTransaction findUserTransaction ( ) throws Exception { } } | return com . arjuna . ats . jta . UserTransaction . userTransaction ( ) ; |
public class SvdImplicitQrAlgorithm_DDRM { /** * Used to finish up pushing the bulge off the matrix . */
private void rotatorPushRight2 ( int m , int offset ) { } } | double b11 = bulge ; double b12 = diag [ m + offset ] ; computeRotator ( b12 , - b11 ) ; diag [ m + offset ] = b12 * c - b11 * s ; if ( m + offset < N - 1 ) { double b22 = off [ m + offset ] ; off [ m + offset ] = b22 * c ; bulge = b22 * s ; } // SimpleMatrix Q = createQ ( m , m + offset , c , s , true ) ;
// B = Q . mult ( B ) ;
// B . print ( ) ;
// printMatrix ( ) ;
// System . out . println ( " bulge = " + bulge ) ;
// System . out . println ( ) ;
if ( Ut != null ) { updateRotator ( Ut , m , m + offset , c , s ) ; // SimpleMatrix . wrap ( Ut ) . mult ( B ) . mult ( SimpleMatrix . wrap ( Vt ) . transpose ( ) ) . print ( ) ;
// printMatrix ( ) ;
// System . out . println ( " bulge = " + bulge ) ;
// System . out . println ( ) ;
} |
public class FolderOp { /** * 获取目录列表请求
* @ param request
* 获取目录列表请求
* @ return JSON格式的字符串 , 格式为 { " code " : $ code , " message " : " $ mess " } , code为0表示成功 ,
* 其他为失败 , message为success或者失败原因
* @ throws AbstractCosException
* SDK定义的COS异常 , 通常是输入参数有误或者环境问题 ( 如网络不通 ) */
public String listFolder ( ListFolderRequest request ) throws AbstractCosException { } } | request . check_param ( ) ; request . setCosPath ( request . getCosPath ( ) + request . getPrefix ( ) ) ; String url = buildUrl ( request ) ; long signExpired = System . currentTimeMillis ( ) / 1000 + this . config . getSignExpired ( ) ; String sign = Sign . getPeriodEffectiveSign ( request . getBucketName ( ) , request . getCosPath ( ) , this . cred , signExpired ) ; HttpRequest httpRequest = new HttpRequest ( ) ; httpRequest . setUrl ( url ) ; httpRequest . addHeader ( RequestHeaderKey . Authorization , sign ) ; httpRequest . addHeader ( RequestHeaderKey . USER_AGENT , this . config . getUserAgent ( ) ) ; httpRequest . addParam ( RequestBodyKey . OP , RequestBodyValue . OP . LIST ) ; httpRequest . addParam ( RequestBodyKey . NUM , String . valueOf ( request . getNum ( ) ) ) ; httpRequest . addParam ( RequestBodyKey . CONTEXT , request . getContext ( ) ) ; httpRequest . addParam ( RequestBodyKey . ORDER , String . valueOf ( request . getOrder ( ) . ordinal ( ) ) ) ; httpRequest . addParam ( RequestBodyKey . PATTERN , request . getPattern ( ) . toString ( ) ) ; httpRequest . setMethod ( HttpMethod . GET ) ; return httpClient . sendHttpRequest ( httpRequest ) ; |
public class EnvironmentImageMarshaller { /** * Marshall the given parameter object . */
public void marshall ( EnvironmentImage environmentImage , ProtocolMarshaller protocolMarshaller ) { } } | if ( environmentImage == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( environmentImage . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( environmentImage . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( environmentImage . getVersions ( ) , VERSIONS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ServerRequestIdentifyUserRequest { /** * Callback with existing first referral params .
* @ param branch { @ link Branch } instance . */
public void handleUserExist ( Branch branch ) { } } | if ( callback_ != null ) { callback_ . onInitFinished ( branch . getFirstReferringParams ( ) , null ) ; } |
public class CmsMessageBundleEditorModel { /** * Init the bundle type member variable .
* @ return the bundle type of the opened resource . */
private CmsMessageBundleEditorTypes . BundleType initBundleType ( ) { } } | String resourceTypeName = OpenCms . getResourceManager ( ) . getResourceType ( m_resource ) . getTypeName ( ) ; return CmsMessageBundleEditorTypes . BundleType . toBundleType ( resourceTypeName ) ; |
public class Animation { /** * Get the image assocaited with a given frame index
* @ param index The index of the frame image to retrieve
* @ return The image of the specified animation frame */
public Image getImage ( int index ) { } } | Frame frame = ( Frame ) frames . get ( index ) ; return frame . image ; |
public class Math { /** * Sorts each variable and returns the index of values in ascending order .
* Note that the order of original array is NOT altered .
* @ param x a set of variables to be sorted . Each row is an instance . Each
* column is a variable .
* @ return the index of values in ascending order */
public static int [ ] [ ] sort ( double [ ] [ ] x ) { } } | int n = x . length ; int p = x [ 0 ] . length ; double [ ] a = new double [ n ] ; int [ ] [ ] index = new int [ p ] [ ] ; for ( int j = 0 ; j < p ; j ++ ) { for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = x [ i ] [ j ] ; } index [ j ] = QuickSort . sort ( a ) ; } return index ; |
public class FormAutoCompleteTextView { /** * In onFocusChanged ( ) we also have to reshow the error icon as the Editor
* hides it . Because Editor is a hidden class we need to cache the last used
* icon and use that */
@ Override protected void onFocusChanged ( boolean focused , int direction , Rect previouslyFocusedRect ) { } } | super . onFocusChanged ( focused , direction , previouslyFocusedRect ) ; showErrorIconHax ( lastErrorIcon ) ; |
public class IssueCategoryRegistry { /** * Make sure that we have some reasonable defaults available . These would typically be provided by the rulesets
* in the real world . */
private void addDefaults ( ) { } } | this . issueCategories . putIfAbsent ( MANDATORY , new IssueCategory ( MANDATORY , IssueCategoryRegistry . class . getCanonicalName ( ) , "Mandatory" , MANDATORY , 1000 , true ) ) ; this . issueCategories . putIfAbsent ( OPTIONAL , new IssueCategory ( OPTIONAL , IssueCategoryRegistry . class . getCanonicalName ( ) , "Optional" , OPTIONAL , 1000 , true ) ) ; this . issueCategories . putIfAbsent ( POTENTIAL , new IssueCategory ( POTENTIAL , IssueCategoryRegistry . class . getCanonicalName ( ) , "Potential Issues" , POTENTIAL , 1000 , true ) ) ; this . issueCategories . putIfAbsent ( CLOUD_MANDATORY , new IssueCategory ( CLOUD_MANDATORY , IssueCategoryRegistry . class . getCanonicalName ( ) , "Cloud Mandatory" , CLOUD_MANDATORY , 1000 , true ) ) ; this . issueCategories . putIfAbsent ( INFORMATION , new IssueCategory ( INFORMATION , IssueCategoryRegistry . class . getCanonicalName ( ) , "Information" , INFORMATION , 1000 , true ) ) ; |
public class AbstractFieldValidator { /** * Sub classes should remember to call super . getMessageArguments ( ) to ensure that the field label is added to the
* list of arguments .
* @ return The list of arguments to be applied to the validators error message . */
protected List < Serializable > getMessageArguments ( ) { } } | List < Serializable > args = new ArrayList < > ( 1 ) ; WLabel label = input . getLabel ( ) ; if ( label == null ) { args . add ( "" ) ; } else { args . add ( label . getText ( ) ) ; } return args ; |
public class CRCResourceManagementImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setRMValue ( Integer newRMValue ) { } } | Integer oldRMValue = rmValue ; rmValue = newRMValue ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . CRC_RESOURCE_MANAGEMENT__RM_VALUE , oldRMValue , rmValue ) ) ; |
public class AbstractDomainQuery { /** * Create a match for a list of domain objects which were retrieved by another query
* @ param domainObjects a list of domain objects which were retrieved by another query
* @ param domainObjectType the type of those domain objects
* @ return a DomainObjectMatch */
protected < T > DomainObjectMatch < T > createMatchForInternal ( List < T > domainObjects , Class < T > domainObjectType ) { } } | DomainObjectMatch < T > ret = APIAccess . createDomainObjectMatch ( domainObjectType , this . queryExecutor . getDomainObjectMatches ( ) . size ( ) , this . queryExecutor . getMappingInfo ( ) ) ; this . queryExecutor . getDomainObjectMatches ( ) . add ( ret ) ; FromPreviousQueryExpression pqe = new FromPreviousQueryExpression ( ret , domainObjects ) ; this . queryExecutor . addAstObject ( pqe ) ; return ret ; |
public class DescribeInstanceInformationRequest { /** * This is a legacy method . We recommend that you don ' t use this method . Instead , use the
* < a > InstanceInformationFilter < / a > action . The < code > InstanceInformationFilter < / code > action enables you to return
* instance information by using tags that are specified as a key - value mapping .
* If you do use this method , then you can ' t use the < code > InstanceInformationFilter < / code > action . Using this
* method and the < code > InstanceInformationFilter < / code > action causes an exception error .
* @ param instanceInformationFilterList
* This is a legacy method . We recommend that you don ' t use this method . Instead , use the
* < a > InstanceInformationFilter < / a > action . The < code > InstanceInformationFilter < / code > action enables you to
* return instance information by using tags that are specified as a key - value mapping . < / p >
* If you do use this method , then you can ' t use the < code > InstanceInformationFilter < / code > action . Using
* this method and the < code > InstanceInformationFilter < / code > action causes an exception error . */
public void setInstanceInformationFilterList ( java . util . Collection < InstanceInformationFilter > instanceInformationFilterList ) { } } | if ( instanceInformationFilterList == null ) { this . instanceInformationFilterList = null ; return ; } this . instanceInformationFilterList = new com . amazonaws . internal . SdkInternalList < InstanceInformationFilter > ( instanceInformationFilterList ) ; |
public class CSSClassManager { /** * Serialize managed CSS classes to rule file .
* @ param buf String buffer */
public void serialize ( StringBuilder buf ) { } } | for ( CSSClass clss : store . values ( ) ) { clss . appendCSSDefinition ( buf ) ; } |
public class AbstractMessage { /** * - - - - - protected methods - - - - - */
protected void serializeObject ( final DataOutputStream dos , final Object value ) throws IOException { } } | if ( value != null ) { final Integer typeKey = TypeMap . get ( value . getClass ( ) ) ; if ( typeKey != null ) { dos . writeInt ( typeKey ) ; switch ( typeKey ) { case 1 : dos . writeUTF ( ( String ) value ) ; break ; case 2 : dos . writeInt ( ( Integer ) value ) ; break ; case 3 : dos . writeLong ( ( Long ) value ) ; break ; case 4 : dos . writeBoolean ( ( Boolean ) value ) ; break ; case 5 : dos . writeDouble ( ( Double ) value ) ; break ; case 6 : dos . writeFloat ( ( Float ) value ) ; break ; case 100 : serializeList ( dos , ( List < Object > ) value ) ; break ; } } else { System . out . println ( "Unknown type " + value . getClass ( ) + ", cannot serialize!" ) ; } } else { dos . writeInt ( 0 ) ; } |
public class DarkSkyJacksonClient { /** * Returns the forecast as { @ link Forecast } object parsed by Jackson .
* @ param request The Forecast Request which is executed . Use
* { @ link ForecastRequestBuilder } to build the request .
* @ return The forecast parsed as { @ link Forecast } .
* @ throws ForecastException if the forecast cannot be fetched . */
public Forecast forecast ( ForecastRequest request ) throws ForecastException { } } | notNull ( "The ForecastRequest cannot be null." , request ) ; logger . log ( FINE , "Executing Forecat request: {0}" , request ) ; try ( InputStream is = executeForecastRequest ( request ) ) { return mapper . readValue ( is , Forecast . class ) ; } catch ( IOException e ) { throw new ForecastException ( "Forecast cannot be fetched." , e ) ; } |
public class MutateInBuilder { /** * Increment / decrement a numerical fragment in a JSON document .
* If the value ( last element of the path ) doesn ' t exist the counter is created and takes the value of the delta .
* @ param path the path to the counter ( must be containing a number ) .
* @ param delta the value to increment or decrement the counter by .
* @ param optionsBuilder { @ link SubdocOptionsBuilder } */
public MutateInBuilder counter ( String path , long delta , SubdocOptionsBuilder optionsBuilder ) { } } | asyncBuilder . counter ( path , delta , optionsBuilder ) ; return this ; |
public class PdfAction { /** * A set - OCG - state action ( PDF 1.5 ) sets the state of one or more optional content
* groups .
* @ param state an array consisting of any number of sequences beginning with a < CODE > PdfName < / CODE >
* or < CODE > String < / CODE > ( ON , OFF , or Toggle ) followed by one or more optional content group dictionaries
* < CODE > PdfLayer < / CODE > or a < CODE > PdfIndirectReference < / CODE > to a < CODE > PdfLayer < / CODE > . < br >
* The array elements are processed from left to right ; each name is applied
* to the subsequent groups until the next name is encountered :
* < ul >
* < li > ON sets the state of subsequent groups to ON < / li >
* < li > OFF sets the state of subsequent groups to OFF < / li >
* < li > Toggle reverses the state of subsequent groups < / li >
* < / ul >
* @ param preserveRB if < CODE > true < / CODE > , indicates that radio - button state relationships between optional
* content groups ( as specified by the RBGroups entry in the current configuration
* dictionary ) should be preserved when the states in the
* < CODE > state < / CODE > array are applied . That is , if a group is set to ON ( either by ON or Toggle ) during
* processing of the < CODE > state < / CODE > array , any other groups belong to the same radio - button
* group are turned OFF . If a group is set to OFF , there is no effect on other groups . < br >
* If < CODE > false < / CODE > , radio - button state relationships , if any , are ignored
* @ return the action */
public static PdfAction setOCGstate ( ArrayList state , boolean preserveRB ) { } } | PdfAction action = new PdfAction ( ) ; action . put ( PdfName . S , PdfName . SETOCGSTATE ) ; PdfArray a = new PdfArray ( ) ; for ( int k = 0 ; k < state . size ( ) ; ++ k ) { Object o = state . get ( k ) ; if ( o == null ) continue ; if ( o instanceof PdfIndirectReference ) a . add ( ( PdfIndirectReference ) o ) ; else if ( o instanceof PdfLayer ) a . add ( ( ( PdfLayer ) o ) . getRef ( ) ) ; else if ( o instanceof PdfName ) a . add ( ( PdfName ) o ) ; else if ( o instanceof String ) { PdfName name = null ; String s = ( String ) o ; if ( s . equalsIgnoreCase ( "on" ) ) name = PdfName . ON ; else if ( s . equalsIgnoreCase ( "off" ) ) name = PdfName . OFF ; else if ( s . equalsIgnoreCase ( "toggle" ) ) name = PdfName . TOGGLE ; else throw new IllegalArgumentException ( "A string '" + s + " was passed in state. Only 'ON', 'OFF' and 'Toggle' are allowed." ) ; a . add ( name ) ; } else throw new IllegalArgumentException ( "Invalid type was passed in state: " + o . getClass ( ) . getName ( ) ) ; } action . put ( PdfName . STATE , a ) ; if ( ! preserveRB ) action . put ( PdfName . PRESERVERB , PdfBoolean . PDFFALSE ) ; return action ; |
public class NativeUtils { /** * Uses reflection to determine whether or not this operating system and
* java version supports the system tray .
* @ return < code > true < / code > if it supports the tray , otherwise
* < code > false < / code > . */
public static boolean supportsTray ( ) { } } | try { final Class trayClass = Class . forName ( "java.awt.SystemTray" ) ; final Boolean bool = ( Boolean ) trayClass . getDeclaredMethod ( "isSupported" ) . invoke ( null ) ; return bool . booleanValue ( ) ; } catch ( final Exception e ) { LOG . warn ( "Reflection error" , e ) ; return false ; } |
public class ClientHandlerImpl { /** * Returns the most specific request metric collector , starting from the request level , then
* client level , then finally the AWS SDK level . */
private RequestMetricCollector findRequestMetricCollector ( RequestConfig requestConfig ) { } } | RequestMetricCollector reqLevelMetricsCollector = requestConfig . getRequestMetricsCollector ( ) ; if ( reqLevelMetricsCollector != null ) { return reqLevelMetricsCollector ; } else if ( clientLevelMetricCollector != null ) { return clientLevelMetricCollector ; } else { return AwsSdkMetrics . getRequestMetricCollector ( ) ; } |
public class HomographyTotalLeastSquares { /** * Computes the homography matrix given a set of observed points in two images . A set of { @ link AssociatedPair }
* is passed in . The computed homography ' H ' is found such that the attributes ' p1 ' and ' p2 ' in { @ link AssociatedPair }
* refers to x1 and x2 , respectively , in the equation below : < br >
* x < sub > 2 < / sub > = H * x < sub > 1 < / sub >
* @ param points A set of observed image points that are generated from a planar object . Minimum of 4 pairs required .
* @ param foundH Output : Storage for the found solution . 3x3 matrix .
* @ return true if the calculation was a success . */
public boolean process ( List < AssociatedPair > points , DMatrixRMaj foundH ) { } } | if ( points . size ( ) < 4 ) throw new IllegalArgumentException ( "Must be at least 4 points." ) ; // Have to normalize the points . Being zero mean is essential in its derivation
LowLevelMultiViewOps . computeNormalization ( points , N1 , N2 ) ; LowLevelMultiViewOps . applyNormalization ( points , N1 , N2 , X1 , X2 ) ; // Construct the linear system which is used to solve for H [ 6 ] to H [ 8]
constructA678 ( ) ; // Solve for those elements using the null space
if ( ! solverNull . process ( A , 1 , nullspace ) ) return false ; DMatrixRMaj H = foundH ; H . data [ 6 ] = nullspace . data [ 0 ] ; H . data [ 7 ] = nullspace . data [ 1 ] ; H . data [ 8 ] = nullspace . data [ 2 ] ; // Determine H [ 0 ] to H [ 5]
H . data [ 2 ] = - ( XP_bar [ 0 ] * H . data [ 6 ] + XP_bar [ 1 ] * H . data [ 7 ] ) ; H . data [ 5 ] = - ( XP_bar [ 2 ] * H . data [ 6 ] + XP_bar [ 3 ] * H . data [ 7 ] ) ; backsubstitution0134 ( P_plus , X1 , X2 , H . data ) ; // Remove the normalization
HomographyDirectLinearTransform . undoNormalizationH ( foundH , N1 , N2 ) ; CommonOps_DDRM . scale ( 1.0 / foundH . get ( 2 , 2 ) , foundH ) ; return true ; |
public class GetFindingsRequest { /** * A collection of attributes used for sorting findings .
* @ param sortCriteria
* A collection of attributes used for sorting findings . */
public void setSortCriteria ( java . util . Collection < SortCriterion > sortCriteria ) { } } | if ( sortCriteria == null ) { this . sortCriteria = null ; return ; } this . sortCriteria = new java . util . ArrayList < SortCriterion > ( sortCriteria ) ; |
public class MatrixUtil { /** * Embed the lonely dark dot at left bottom corner . JISX0510:2004 ( p . 46) */
private static void embedDarkDotAtLeftBottomCorner ( ByteMatrix matrix ) throws WriterException { } } | if ( matrix . get ( 8 , matrix . getHeight ( ) - 8 ) == 0 ) { throw new WriterException ( ) ; } matrix . set ( 8 , matrix . getHeight ( ) - 8 , 1 ) ; |
public class WebSocketEncoder { /** * Encode the in buffer according to the Section 5.2 . RFC 6455 */
public static IoBuffer encodeOutgoingData ( Packet packet ) { } } | log . debug ( "encode outgoing: {}" , packet ) ; // get the payload data
IoBuffer data = packet . getData ( ) ; // get the frame length based on the byte count
int frameLen = data . limit ( ) ; // start with frame length + 2b ( header info )
IoBuffer buffer = IoBuffer . allocate ( frameLen + 2 , false ) ; buffer . setAutoExpand ( true ) ; // set the proper flags / opcode for the data
byte frameInfo = ( byte ) ( 1 << 7 ) ; switch ( packet . getType ( ) ) { case TEXT : if ( log . isTraceEnabled ( ) ) { log . trace ( "Encoding text frame \r\n{}" , new String ( packet . getData ( ) . array ( ) ) ) ; } frameInfo = ( byte ) ( frameInfo | 1 ) ; break ; case BINARY : log . trace ( "Encoding binary frame" ) ; frameInfo = ( byte ) ( frameInfo | 2 ) ; break ; case CLOSE : frameInfo = ( byte ) ( frameInfo | 8 ) ; break ; case CONTINUATION : frameInfo = ( byte ) ( frameInfo | 0 ) ; break ; case PING : log . trace ( "ping out" ) ; frameInfo = ( byte ) ( frameInfo | 9 ) ; break ; case PONG : log . trace ( "pong out" ) ; frameInfo = ( byte ) ( frameInfo | 0xa ) ; break ; default : break ; } buffer . put ( frameInfo ) ; // set the frame length
log . trace ( "Frame length {} " , frameLen ) ; if ( frameLen <= 125 ) { buffer . put ( ( byte ) ( ( byte ) frameLen & ( byte ) 0x7F ) ) ; } else if ( frameLen > 125 && frameLen <= 65535 ) { buffer . put ( ( byte ) ( ( byte ) 126 & ( byte ) 0x7F ) ) ; buffer . putShort ( ( short ) frameLen ) ; } else { buffer . put ( ( byte ) ( ( byte ) 127 & ( byte ) 0x7F ) ) ; buffer . putLong ( ( int ) frameLen ) ; } buffer . put ( data ) ; buffer . flip ( ) ; if ( log . isTraceEnabled ( ) ) { log . trace ( "Encoded: {}" , buffer ) ; } return buffer ; |
public class ApiOvhTelephony { /** * Get this object properties
* REST : GET / telephony / { billingAccount } / ovhPabx / { serviceName } / menu / { menuId } / entry / { entryId }
* @ param billingAccount [ required ] The name of your billingAccount
* @ param serviceName [ required ]
* @ param menuId [ required ]
* @ param entryId [ required ] */
public OvhOvhPabxMenuEntry billingAccount_ovhPabx_serviceName_menu_menuId_entry_entryId_GET ( String billingAccount , String serviceName , Long menuId , Long entryId ) throws IOException { } } | String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}/entry/{entryId}" ; StringBuilder sb = path ( qPath , billingAccount , serviceName , menuId , entryId ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhOvhPabxMenuEntry . class ) ; |
public class ORCLUS { /** * Reduces the number of seeds to k _ new
* @ param relation the database holding the objects
* @ param clusters the set of current seeds
* @ param k _ new the new number of seeds
* @ param d _ new the new dimensionality of the subspaces for each seed */
private void merge ( Relation < V > relation , List < ORCLUSCluster > clusters , int k_new , int d_new , IndefiniteProgress cprogress ) { } } | ArrayList < ProjectedEnergy > projectedEnergies = new ArrayList < > ( ( clusters . size ( ) * ( clusters . size ( ) - 1 ) ) >>> 1 ) ; for ( int i = 0 ; i < clusters . size ( ) ; i ++ ) { for ( int j = i + 1 ; j < clusters . size ( ) ; j ++ ) { // projected energy of c _ ij in subspace e _ ij
ORCLUSCluster c_i = clusters . get ( i ) ; ORCLUSCluster c_j = clusters . get ( j ) ; projectedEnergies . add ( projectedEnergy ( relation , c_i , c_j , i , j , d_new ) ) ; } } while ( clusters . size ( ) > k_new ) { if ( cprogress != null ) { cprogress . setProcessed ( clusters . size ( ) , LOG ) ; } // find the smallest value of r _ ij
ProjectedEnergy minPE = Collections . min ( projectedEnergies ) ; // renumber the clusters by replacing cluster c _ i with cluster c _ ij
// and discarding cluster c _ j
for ( int c = 0 ; c < clusters . size ( ) ; c ++ ) { if ( c == minPE . i ) { clusters . remove ( c ) ; clusters . add ( c , minPE . cluster ) ; } if ( c == minPE . j ) { clusters . remove ( c ) ; } } // remove obsolete projected energies and renumber the others . . .
int i = minPE . i , j = minPE . j ; for ( Iterator < ProjectedEnergy > it = projectedEnergies . iterator ( ) ; it . hasNext ( ) ; ) { ProjectedEnergy pe = it . next ( ) ; if ( pe . i == i || pe . i == j || pe . j == i || pe . j == j ) { it . remove ( ) ; } else { if ( pe . i > j ) { pe . i -= 1 ; } if ( pe . j > j ) { pe . j -= 1 ; } } } // . . . and recompute them
ORCLUSCluster c_ij = minPE . cluster ; for ( int c = 0 ; c < clusters . size ( ) ; c ++ ) { if ( c < i ) { projectedEnergies . add ( projectedEnergy ( relation , clusters . get ( c ) , c_ij , c , i , d_new ) ) ; } else if ( c > i ) { projectedEnergies . add ( projectedEnergy ( relation , clusters . get ( c ) , c_ij , i , c , d_new ) ) ; } } } |
public class PropertyBundleLookup { /** * Sets system property value to provided classes . Shortcut is useful to set property from code , for example ,
* in unit tests .
* @ param bundles bundles to enable */
@ SafeVarargs public static void enableBundles ( final Class < ? extends GuiceyBundle > ... bundles ) { } } | final String prop = Joiner . on ( ',' ) . join ( toStrings ( Lists . newArrayList ( bundles ) ) ) ; System . setProperty ( BUNDLES_PROPERTY , prop ) ; |
public class EmbeddableAttributesImpl { /** * If not already created , a new < code > basic < / code > element will be created and returned .
* Otherwise , the first existing < code > basic < / code > element will be returned .
* @ return the instance defined for the element < code > basic < / code > */
public Basic < EmbeddableAttributes < T > > getOrCreateBasic ( ) { } } | List < Node > nodeList = childNode . get ( "basic" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new BasicImpl < EmbeddableAttributes < T > > ( this , "basic" , childNode , nodeList . get ( 0 ) ) ; } return createBasic ( ) ; |
public class ProGradePolicy { /** * Private method for reading password for keystore from file .
* @ param keystorePasswordURL URL to file which contain password for keystore
* @ param policyFile used policy file
* @ return password for keystore
* @ throws Exception when there was any problem during reading keystore password */
private char [ ] readKeystorePassword ( String keystorePasswordURL , File policyFile ) throws Exception { } } | // try relative path to policy file
File f = new File ( getPolicyFileHome ( policyFile ) , keystorePasswordURL ) ; if ( ! f . exists ( ) ) { // try absoluth path
f = new File ( keystorePasswordURL ) ; if ( ! f . exists ( ) ) { throw new Exception ( "ER005: File on keystorePasswordURL doesn't exists!" ) ; } } Reader reader = new FileReader ( f ) ; StringBuilder sb = new StringBuilder ( ) ; char buffer [ ] = new char [ 64 ] ; int len ; while ( ( len = reader . read ( buffer ) ) > 0 ) { sb . append ( buffer , 0 , len ) ; } reader . close ( ) ; return sb . toString ( ) . trim ( ) . toCharArray ( ) ; |
public class Invocable { /** * Basic parameter collection with pulling inherited cascade chaining . */
public List < Object > collectParamaters ( Object base , Object [ ] params ) throws Throwable { } } | parameters . clear ( ) ; for ( int i = 0 ; i < getLastParameterIndex ( ) ; i ++ ) parameters . add ( coerceToType ( params [ i ] , getParameterTypes ( ) [ i ] ) ) ; return parameters ; |
public class XMLTextNode { /** * { @ inheritDoc } */
@ Override public IValueNode getValueNode ( String language ) { } } | if ( language == null ) { return null ; } return valueNodeMap . get ( language ) ; |
public class BookKeeperJournalOutputStream { /** * Write the buffer to a new entry in a BookKeeper ledger .
* @ see OutputStream # write ( byte [ ] , int , int )
* @ see # addBookKeeperEntry ( byte [ ] , int , int )
* @ throws IOException If there is an error adding the BookKeeper entry . */
@ Override public void write ( byte [ ] buf , int off , int len ) throws IOException { } } | addBookKeeperEntry ( buf , off , len ) ; |
public class ConfigParams { /** * Gets a list with all 1st level section names .
* @ return a list of section names stored in this ConfigMap . */
public List < String > getSectionNames ( ) { } } | List < String > sections = new ArrayList < String > ( ) ; for ( Map . Entry < String , String > entry : this . entrySet ( ) ) { String key = entry . getKey ( ) ; int pos = key . indexOf ( '.' ) ; if ( pos > 0 ) key = key . substring ( 0 , pos ) ; // Perform case sensitive search
boolean found = false ; for ( String section : sections ) { if ( section . equalsIgnoreCase ( key ) ) { found = true ; break ; } } if ( ! found ) sections . add ( key ) ; } return sections ; |
public class CoronaJobTracker { @ Override public void taskStateChange ( TaskStatus . State state , TaskInProgress tip , TaskAttemptID taskid , String host ) { } } | LOG . info ( "The state of " + taskid + " changed to " + state + " on host " + host ) ; processTaskResource ( state , tip , taskid ) ; |
public class JavaScriptScanner { /** * Read a quoted string .
* It is an error if the beginning of the next tag is detected . */
@ SuppressWarnings ( "fallthrough" ) protected void quotedString ( ) { } } | int pos = bp ; nextChar ( ) ; loop : while ( bp < buflen ) { switch ( ch ) { case '\n' : case '\r' : case '\f' : newline = true ; break ; case ' ' : case '\t' : break ; case '"' : nextChar ( ) ; // trim trailing white - space ?
return ; case '@' : if ( newline ) break loop ; } nextChar ( ) ; } |
public class LocalNetworkGatewaysInner { /** * Creates or updates a local network gateway in the specified resource group .
* @ param resourceGroupName The name of the resource group .
* @ param localNetworkGatewayName The name of the local network gateway .
* @ param parameters Parameters supplied to the create or update local network gateway 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 LocalNetworkGatewayInner object if successful . */
public LocalNetworkGatewayInner beginCreateOrUpdate ( String resourceGroupName , String localNetworkGatewayName , LocalNetworkGatewayInner parameters ) { } } | return beginCreateOrUpdateWithServiceResponseAsync ( resourceGroupName , localNetworkGatewayName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class ConfusionMatrix { /** * The Matthews Correlation Coefficient , takes true negatives into account in contrast to F - Score
* See < a href = " http : / / en . wikipedia . org / wiki / Matthews _ correlation _ coefficient " > MCC < / a >
* MCC = Correlation between observed and predicted binary classification
* @ return mcc ranges from - 1 ( total disagreement ) . . . 0 ( no better than random ) . . . 1 ( perfect ) */
public double mcc ( ) { } } | if ( ! isBinary ( ) ) throw new UnsupportedOperationException ( "precision is only implemented for 2 class problems." ) ; double tn = _arr [ 0 ] [ 0 ] ; double fp = _arr [ 0 ] [ 1 ] ; double tp = _arr [ 1 ] [ 1 ] ; double fn = _arr [ 1 ] [ 0 ] ; double mcc = ( tp * tn - fp * fn ) / Math . sqrt ( ( tp + fp ) * ( tp + fn ) * ( tn + fp ) * ( tn + fn ) ) ; return mcc ; |
public class AttributeValidator { /** * Validate whether the mappedBy attribute is part of the referenced entity .
* @ param attr attribute
* @ param mappedByAttr mappedBy attribute
* @ throws MolgenisDataException if mappedBy is an attribute that is not part of the referenced
* entity */
private static void validateMappedBy ( Attribute attr , Attribute mappedByAttr ) { } } | if ( mappedByAttr != null ) { if ( ! isSingleReferenceType ( mappedByAttr ) ) { throw new MolgenisDataException ( format ( "Invalid mappedBy attribute [%s] data type [%s]." , mappedByAttr . getName ( ) , mappedByAttr . getDataType ( ) ) ) ; } Attribute refAttr = attr . getRefEntity ( ) . getAttribute ( mappedByAttr . getName ( ) ) ; if ( refAttr == null ) { throw new MolgenisDataException ( format ( "mappedBy attribute [%s] is not part of entity [%s]." , mappedByAttr . getName ( ) , attr . getRefEntity ( ) . getId ( ) ) ) ; } } |
public class AsyncMessageServiceGrounding { /** * An IChannelConsumer is created with the controlChannelName associated with
* this grounding .
* A client callback is added to it , that handles the received FunctionalityExecMessage
* and initializes another client callback that will handle the received resulting results , routing
* them accordingly . */
public synchronized IChannelConsumer activateChannelConsumer ( ) throws ServiceGroundingException { } } | if ( null == this . controlChannelConsumer ) { this . controlChannelConsumer = this . newChannelConsumer ( ) ; this . controlChannelConsumer . addClientCallback ( new IAsyncMessageClient ( ) { @ Override public void receiveMessage ( IMessage msg ) throws ModelException { if ( msg instanceof FunctionalityExecMessage ) { BSDFLogger . getLogger ( ) . info ( "Process received FunctionalityExecMessage message: " + msg . toString ( ) + " , callback from: " + AsyncMessageServiceGrounding . this . toString ( ) ) ; final FunctionalityExecMessage feMsg = ( FunctionalityExecMessage ) msg ; AbstractFunctionalityGrounding funGrounding = AsyncMessageServiceGrounding . this . getFunctionalityGrounding ( feMsg . getFunctionalityName ( ) ) ; funGrounding . getProviderChannelFor ( feMsg . getFunctionalityName ( ) , feMsg . getClientName ( ) , feMsg . getConversationId ( ) ) ; AsyncMessageServiceGrounding . this . getServiceDescription ( ) . executeMultipleResultFunctionalityAsyncronously ( feMsg . getFunctionalityName ( ) , feMsg . values ( ) , new IAsyncMessageClient ( ) { // this callback handles the received results and notifications
@ Override public void receiveMessage ( IMessage msg ) throws ModelException { if ( msg instanceof FunctionalityResultMessage ) { BSDFLogger . getLogger ( ) . info ( "Process received FunctionalityResultMessage message: " + msg . toString ( ) + " , callback from: " + AsyncMessageServiceGrounding . this . toString ( ) ) ; FunctionalityResultMessage frMsg = ( FunctionalityResultMessage ) msg ; AbstractFunctionalityGrounding funGrounding = AsyncMessageServiceGrounding . this . getFunctionalityGrounding ( frMsg . getFunctionalityName ( ) ) ; IChannelProducer providerChannel = funGrounding . getProviderChannelFor ( feMsg . getFunctionalityName ( ) , feMsg . getClientName ( ) , feMsg . getConversationId ( ) ) ; frMsg . setConversationId ( feMsg . getConversationId ( ) ) ; providerChannel . send ( frMsg ) ; } } @ Override public String getName ( ) { return feMsg . getClientName ( ) ; } } ) ; } } @ Override public String getName ( ) { return "Message execution client for " + AsyncMessageServiceGrounding . this . toString ( ) ; } } ) ; } return this . controlChannelConsumer ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcRelSequence ( ) { } } | if ( ifcRelSequenceEClass == null ) { ifcRelSequenceEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 482 ) ; } return ifcRelSequenceEClass ; |
public class HostedNumberOrderReader { /** * Add the requested query string arguments to the Request .
* @ param request Request to add query string arguments to */
private void addQueryParams ( final Request request ) { } } | if ( status != null ) { request . addQueryParam ( "Status" , status . toString ( ) ) ; } if ( phoneNumber != null ) { request . addQueryParam ( "PhoneNumber" , phoneNumber . toString ( ) ) ; } if ( incomingPhoneNumberSid != null ) { request . addQueryParam ( "IncomingPhoneNumberSid" , incomingPhoneNumberSid ) ; } if ( friendlyName != null ) { request . addQueryParam ( "FriendlyName" , friendlyName ) ; } if ( uniqueName != null ) { request . addQueryParam ( "UniqueName" , uniqueName ) ; } if ( getPageSize ( ) != null ) { request . addQueryParam ( "PageSize" , Integer . toString ( getPageSize ( ) ) ) ; } |
public class Scope { /** * Disconnect connection from scope
* @ param conn Connection object */
public void disconnect ( IConnection conn ) { } } | log . debug ( "Disconnect: {}" , conn ) ; // call disconnect handlers in reverse order of connection . ie . roomDisconnect is called before appDisconnect .
final IClient client = conn . getClient ( ) ; if ( client == null ) { // early bail out
removeEventListener ( conn ) ; connectionStats . decrement ( ) ; if ( hasParent ( ) ) { parent . disconnect ( conn ) ; } return ; } // remove it if it exists
if ( clients . remove ( client ) ) { IScopeHandler handler = getHandler ( ) ; if ( handler != null ) { try { handler . disconnect ( conn , this ) ; } catch ( Exception e ) { log . error ( "Error while executing \"disconnect\" for connection {} on handler {}. {}" , new Object [ ] { conn , handler , e } ) ; } try { // there may be a timeout here ?
handler . leave ( client , this ) ; } catch ( Exception e ) { log . error ( "Error while executing \"leave\" for client {} on handler {}. {}" , new Object [ ] { conn , handler , e } ) ; } } // remove listener
removeEventListener ( conn ) ; // decrement if there was a set of connections
connectionStats . decrement ( ) ; if ( this . equals ( conn . getScope ( ) ) ) { final IServer server = getServer ( ) ; if ( server instanceof Server ) { ( ( Server ) server ) . notifyDisconnected ( conn ) ; } } } if ( hasParent ( ) ) { parent . disconnect ( conn ) ; } |
public class CommerceWarehouseUtil { /** * Returns the first commerce warehouse in the ordered set where groupId = & # 63 ; .
* @ param groupId the group ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce warehouse , or < code > null < / code > if a matching commerce warehouse could not be found */
public static CommerceWarehouse fetchByGroupId_First ( long groupId , OrderByComparator < CommerceWarehouse > orderByComparator ) { } } | return getPersistence ( ) . fetchByGroupId_First ( groupId , orderByComparator ) ; |
public class MongoDBDialect { /** * Returns the name of the MongoDB collection to execute the given query against . Will either be retrieved
* < ul >
* < li > from the given query descriptor ( in case the query has been translated from JP - QL or it is a native query
* using the extended syntax { @ code db . < COLLECTION > . < OPERATION > ( . . . ) } < / li >
* < li > or from the single mapped entity type if it is a native query using the criteria - only syntax
* @ param customQuery the original query to execute
* @ param queryDescriptor descriptor for the query
* @ param entityKeyMetadata meta - data in case this is a query with exactly one entity return
* @ return the name of the MongoDB collection to execute the given query against */
private static String getCollectionName ( BackendQuery < ? > customQuery , MongoDBQueryDescriptor queryDescriptor , EntityKeyMetadata entityKeyMetadata ) { } } | if ( queryDescriptor . getCollectionName ( ) != null ) { return queryDescriptor . getCollectionName ( ) ; } else if ( entityKeyMetadata != null ) { return entityKeyMetadata . getTable ( ) ; } else { throw log . unableToDetermineCollectionName ( customQuery . getQuery ( ) . toString ( ) ) ; } |
public class Chunks { /** * special operation implemented inline to compute and store sum up until here */
public void sumUp ( ) { } } | int offset = 0 ; int tmp = 0 ; for ( int i = 0 ; i < numChunks ; i ++ ) { int [ ] chunk = chunks [ i ] ; if ( chunk == null ) throw new IllegalStateException ( "Chunks are not continous, null fragement at offset " + i ) ; for ( int j = 0 ; j < chunkSize ; j ++ ) { tmp = chunk [ j ] ; chunk [ j ] = offset ; offset += tmp ; } } |
public class DITypeInfo { /** * Retrieves whether , under the current release , class path and
* hosting JVM , HSQLDB supports passing or receiving this type as
* the value of a procedure column . < p >
* @ return whether , under the current release , class path and
* hosting JVM , HSQLDB supports passing or receiving
* this type as the value of a procedure column . */
Boolean isSupportedAsPCol ( ) { } } | switch ( type ) { case Types . SQL_ALL_TYPES : // - for void return type
case Types . JAVA_OBJECT : // - for Connection as first parm and
// Object for return type
case Types . SQL_ARRAY : // - for Object [ ] row of Trigger . fire ( )
return Boolean . TRUE ; default : return isSupportedAsTCol ( ) ; } |
public class StringUtil { /** * reapeats a string
* @ param str string to repeat
* @ param count how many time string will be repeated
* @ return reapted string */
public static String repeatString ( String str , int count ) { } } | if ( count <= 0 ) return "" ; char [ ] chars = str . toCharArray ( ) ; char [ ] rtn = new char [ chars . length * count ] ; int pos = 0 ; for ( int i = 0 ; i < count ; i ++ ) { for ( int y = 0 ; y < chars . length ; y ++ ) rtn [ pos ++ ] = chars [ y ] ; // rtn . append ( str ) ;
} return new String ( rtn ) ; |
public class HDInsightInstance { /** * Creates a HttpGet request with all the common headers .
* @ param url
* @ return */
private HttpGet prepareGet ( final String url ) { } } | final HttpGet httpGet = new HttpGet ( this . instanceUrl + url ) ; for ( final Header header : this . headers ) { httpGet . addHeader ( header ) ; } return httpGet ; |
public class BytesUtils { /** * Remove a big - endian 4 - byte integer to a sorted array of bytes .
* @ param arr This byte array is assumed to be sorted array
* of signed ints .
* @ param n value to remove .
* @ return new array with the added value . */
public static byte [ ] remove ( byte [ ] arr , int n ) { } } | int index = binarySearch ( arr , n ) ; byte [ ] arr2 = new byte [ arr . length - 4 ] ; System . arraycopy ( arr , 0 , arr2 , 0 , index ) ; System . arraycopy ( arr , index + 4 , arr2 , index , arr . length - index - 4 ) ; return arr2 ; |
public class LongBitSet { /** * Returns the index of the last set bit before or on the index specified .
* - 1 is returned if there are no more set bits . */
long prevSetBit ( long index ) { } } | assert index >= 0 && index < numBits : "index=" + index + " numBits=" + numBits ; int i = ( int ) ( index >> 6 ) ; final int subIndex = ( int ) ( index & 0x3f ) ; // index within the word
long word = ( bits [ i ] << ( 63 - subIndex ) ) ; // skip all the bits to the
// left of index
if ( word != 0 ) { return ( i << 6 ) + subIndex - Long . numberOfLeadingZeros ( word ) ; // See
// LUCENE - 3197
} while ( -- i >= 0 ) { word = bits [ i ] ; if ( word != 0 ) { return ( i << 6 ) + 63 - Long . numberOfLeadingZeros ( word ) ; } } return - 1 ; |
public class TableRTAB { /** * { @ inheritDoc } */
@ Override protected void readRow ( int uniqueID , byte [ ] data ) { } } | if ( ( data [ 0 ] != ( byte ) 0xFF ) ) { Map < String , Object > map = new HashMap < String , Object > ( ) ; map . put ( "ID" , Integer . valueOf ( m_id ++ ) ) ; map . put ( "UNIQUE_ID" , Integer . valueOf ( uniqueID ) ) ; map . put ( "NAME" , PEPUtility . getString ( data , 1 , 20 ) ) ; map . put ( "GROUP" , PEPUtility . getString ( data , 21 , 12 ) ) ; map . put ( "UNIT" , PEPUtility . getString ( data , 33 , 4 ) ) ; map . put ( "RATE" , Integer . valueOf ( PEPUtility . getInt ( data , 39 ) ) ) ; map . put ( "DESCRIPTION" , PEPUtility . getString ( data , 43 , 30 ) ) ; map . put ( "CALENDAR_ID" , Integer . valueOf ( PEPUtility . getShort ( data , 95 ) ) ) ; map . put ( "POOL" , Integer . valueOf ( PEPUtility . getInt ( data , 97 ) ) ) ; map . put ( "PER_DAY" , Integer . valueOf ( PEPUtility . getInt ( data , 101 ) ) ) ; map . put ( "EXPENSES_ONLY" , Boolean . valueOf ( ( data [ 106 ] & 0x01 ) != 0 ) ) ; map . put ( "MODIFY_ON_INTEGRATE" , Boolean . valueOf ( ( data [ 106 ] & 0x02 ) != 0 ) ) ; map . put ( "PRIORITY" , Integer . valueOf ( PEPUtility . getShort ( data , 127 ) ) ) ; map . put ( "PERIOD_DUR" , Integer . valueOf ( PEPUtility . getShort ( data , 129 ) ) ) ; map . put ( "PARENT_ID" , Integer . valueOf ( PEPUtility . getShort ( data , 133 ) ) ) ; addRow ( uniqueID , map ) ; } |
public class TagHandlerPool { /** * Gets the next available tag handler from this tag handler pool ,
* instantiating one if this tag handler pool is empty .
* @ param handlerClass Tag handler class
* @ return Reused or newly instantiated tag handler
* @ throws JspException if a tag handler cannot be instantiated */
public Tag get ( Class handlerClass ) throws JspException { } } | Tag handler = null ; synchronized ( this ) { if ( current >= 0 ) { handler = handlers [ current -- ] ; return handler ; } } // Out of sync block - there is no need for other threads to
// wait for us to construct a tag for this thread .
try { return ( Tag ) handlerClass . newInstance ( ) ; } catch ( Exception e ) { throw new JspException ( e . getMessage ( ) , e ) ; } |
public class Diff { /** * Returns whether the revision described by this diff is a full revision or
* not .
* @ return TRUE | FALSE */
public boolean isFullRevision ( ) { } } | if ( this . parts . size ( ) == 1 ) { DiffPart p = this . parts . get ( 0 ) ; if ( p . getAction ( ) == DiffAction . FULL_REVISION_UNCOMPRESSED ) { return true ; } } return false ; |
public class SpPromoteAlgo { /** * Start fixing survivors : setup scoreboard and request repair logs . */
void prepareForFaultRecovery ( ) { } } | for ( Long hsid : m_survivors ) { m_replicaRepairStructs . put ( hsid , new ReplicaRepairStruct ( ) ) ; } repairLogger . info ( m_whoami + "found (including self) " + m_survivors . size ( ) + " surviving replicas to repair. " + " Survivors: " + CoreUtils . hsIdCollectionToString ( m_survivors ) ) ; VoltMessage logRequest = new Iv2RepairLogRequestMessage ( m_requestId , m_deadHost , Iv2RepairLogRequestMessage . SPREQUEST ) ; m_mailbox . send ( com . google_voltpatches . common . primitives . Longs . toArray ( m_survivors ) , logRequest ) ; |
public class JcifsSpnegoAuthenticationHandler { /** * Gets the principal from the given name . The principal
* is created by the factory instance .
* @ param name the name
* @ param isNtlm the is ntlm
* @ return the simple principal */
protected Principal getPrincipal ( final String name , final boolean isNtlm ) { } } | if ( this . principalWithDomainName ) { return this . principalFactory . createPrincipal ( name ) ; } if ( isNtlm ) { if ( Pattern . matches ( "\\S+\\\\\\S+" , name ) ) { val splitList = Splitter . on ( Pattern . compile ( "\\\\" ) ) . splitToList ( name ) ; if ( splitList . size ( ) == 2 ) { return this . principalFactory . createPrincipal ( splitList . get ( 1 ) ) ; } } return this . principalFactory . createPrincipal ( name ) ; } val splitList = Splitter . on ( "@" ) . splitToList ( name ) ; return this . principalFactory . createPrincipal ( splitList . get ( 0 ) ) ; |
public class ReflectiveRandomIndexing { /** * Computes the reflective semantic vectors for word meanings */
private void processSpace ( ) throws IOException { } } | LOGGER . info ( "generating reflective vectors" ) ; compressedDocumentsWriter . close ( ) ; int numDocuments = documentCounter . get ( ) ; termToIndexVector . clear ( ) ; indexToTerm = new String [ termToIndex . size ( ) ] ; for ( Map . Entry < String , Integer > e : termToIndex . entrySet ( ) ) indexToTerm [ e . getValue ( ) ] = e . getKey ( ) ; // Read in the compressed version of the corpus , re - processing each
// document to build up the document vectors
DataInputStream corpusReader = new DataInputStream ( new BufferedInputStream ( new FileInputStream ( compressedDocuments ) ) ) ; // Set up the concurrent data structures so we can reprocess the
// documents concurrently using a work queue
final BlockingQueue < Runnable > workQueue = new LinkedBlockingQueue < Runnable > ( ) ; for ( int i = 0 ; i < Runtime . getRuntime ( ) . availableProcessors ( ) ; ++ i ) { Thread t = new WorkerThread ( workQueue ) ; t . start ( ) ; } final Semaphore documentsRerocessed = new Semaphore ( 0 ) ; for ( int d = 0 ; d < numDocuments ; ++ d ) { final int docId = d ; // This value already has any filtered tokens taken into account ,
// i . e . in only counts those tokens that remain after filtering
int tokensInDoc = corpusReader . readInt ( ) ; // Read in the document
final int [ ] doc = new int [ tokensInDoc ] ; for ( int i = 0 ; i < tokensInDoc ; ++ i ) doc [ i ] = corpusReader . readInt ( ) ; workQueue . offer ( new Runnable ( ) { public void run ( ) { // This method creates the document vector and then adds
// that document vector with the reflective semantic
// vector for each word occurring in the document
LOGGER . fine ( "reprocessing doc #" + docId ) ; processIntDocument ( docToVector . get ( docId ) , doc ) ; documentsRerocessed . release ( ) ; } } ) ; } corpusReader . close ( ) ; // Wait until all the documents have been processed
try { documentsRerocessed . acquire ( numDocuments ) ; } catch ( InterruptedException ie ) { throw new Error ( "interrupted while waiting for documents to " + "finish reprocessing" , ie ) ; } LOGGER . fine ( "finished reprocessing all documents" ) ; |
public class ClassGenericsUtil { /** * Cast the ( erased ) generics onto a class .
* Note : this function is a hack - notice that it would allow you to up - cast
* any class ! Still it is preferable to have this cast in one place than in
* dozens without any explanation .
* The reason this is needed is the following : There is no
* < code > Class & lt ; Set & lt ; String & gt ; & gt ; . class < / code > .
* This method allows you to do
* < code > Class & lt ; Set & lt ; String & gt ; & gt ; setclass = uglyCastIntoSubclass ( Set . class ) ; < / code >
* We can ' t type check at runtime , since we don ' t have T .
* @ param cls Class type
* @ param < D > Base type
* @ param < T > Supertype
* @ return { @ code cls } parameter , but cast to { @ code Class < T > } */
@ SuppressWarnings ( "unchecked" ) public static < D , T extends D > Class < T > uglyCastIntoSubclass ( Class < D > cls ) { } } | return ( Class < T > ) cls ; |
public class ModelUtils { /** * Gets and splits exported variables separated by a comma .
* Variable names are not prefixed by the type ' s name . < br / >
* Variable values may also be surrounded by quotes .
* @ param holder a property holder ( not null )
* @ return a non - null map ( key = exported variable name , value = the exported variable ) */
public static Map < String , ExportedVariable > getExportedVariables ( AbstractBlockHolder holder ) { } } | Map < String , ExportedVariable > result = new HashMap < > ( ) ; for ( BlockProperty p : holder . findPropertiesBlockByName ( ParsingConstants . PROPERTY_GRAPH_EXPORTS ) ) { result . putAll ( findExportedVariables ( p . getValue ( ) , p . getFile ( ) , p . getLine ( ) ) ) ; } return result ; |
public class DoubleDifference { /** * Constructs a new { @ link IDifference } object .
* @ param name a name reflecting the nature of the created { @ link IDifference }
* @ param first the first object to compare
* @ param second the second object to compare
* @ return an { @ link IDifference } reflecting the differences between the first and second object */
public static IDifference construct ( String name , Double first , Double second ) { } } | if ( first == null && second == null ) { return null ; // no difference
} if ( first == null || second == null ) { return new DoubleDifference ( name , first , second ) ; } if ( Math . abs ( first - second ) < ERROR ) { return null ; // no difference
} return new DoubleDifference ( name , first , second ) ; |
public class ClipboardUtil { /** * 监听剪贴板修改事件
* @ param tryCount 尝试获取剪贴板内容的次数
* @ param delay 响应延迟 , 当从第二次开始 , 延迟一定毫秒数等待剪贴板可以获取
* @ param listener 监听处理接口
* @ param sync 是否同步阻塞
* @ since 4.5.6
* @ see ClipboardMonitor # listen ( boolean ) */
public static void listen ( int tryCount , long delay , ClipboardListener listener , boolean sync ) { } } | ClipboardMonitor . INSTANCE . setTryCount ( tryCount ) . setDelay ( delay ) . addListener ( listener ) . listen ( sync ) ; |
public class SerializerFactory { /** * 按序列化名称返回协议对象
* @ param type 序列号编码
* @ return 序列化器 */
public static Serializer getSerializer ( byte type ) { } } | Serializer serializer = TYPE_SERIALIZER_MAP . get ( type ) ; if ( serializer == null ) { throw new SofaRpcRuntimeException ( "Serializer Not Found :\"" + type + "\"!" ) ; } return serializer ; |
public class CmsResourceUtil { /** * Returns the formatted date of expiration . < p >
* @ return the formatted date of expiration */
public String getDateExpired ( ) { } } | long release = m_resource . getDateExpired ( ) ; if ( release != CmsResource . DATE_EXPIRED_DEFAULT ) { return getMessages ( ) . getDateTime ( release ) ; } else { return CmsWorkplace . DEFAULT_DATE_STRING ; } |
public class LongBitSet { /** * Scans the backing store to check if all bits are clear . The method is
* deliberately not called " isEmpty " to emphasize it is not low cost ( as
* isEmpty usually is ) .
* @ return true if all bits are clear . */
boolean scanIsEmpty ( ) { } } | // This ' slow ' implementation is still faster than any external one
// could be
// ( e . g . : ( bitSet . length ( ) = = 0 | | bitSet . nextSetBit ( 0 ) = = - 1 ) )
// especially for small BitSets
// Depends on the ghost bits being clear !
final int count = numWords ; for ( int i = 0 ; i < count ; i ++ ) { if ( bits [ i ] != 0 ) return false ; } return true ; |
public class TagLibFactory { /** * Laedt die Systeminterne TLD .
* @ param saxParser Definition des Sax Parser mit dem die FunctionLib eingelsesen werden soll .
* @ return FunctionLib
* @ throws TagLibException */
private static TagLib [ ] loadFromSystem ( Identification id ) throws TagLibException { } } | if ( systemTLDs [ CFMLEngine . DIALECT_CFML ] == null ) { TagLib cfml = new TagLibFactory ( null , TLD_BASE , id ) . getLib ( ) ; TagLib lucee = cfml . duplicate ( false ) ; systemTLDs [ CFMLEngine . DIALECT_CFML ] = new TagLibFactory ( cfml , TLD_CFML , id ) . getLib ( ) ; systemTLDs [ CFMLEngine . DIALECT_LUCEE ] = new TagLibFactory ( lucee , TLD_LUCEE , id ) . getLib ( ) ; } return systemTLDs ; |
public class Transformers { /** * create a transform function for BindObject - * [ bean ] type
* @ param beanClazz bean class
* @ param < R > bean type
* @ return new created transform function */
public static < R > Function < BindObject , R > transTo ( Class < R > beanClazz ) { } } | Objects . requireNonNull ( beanClazz , "beanClazz is NULL!!" ) ; return ( bindObj ) -> transform ( bindObj , beanClazz , REGISTRY ) ; |
public class ApkBuilder { /** * Checks a file to make sure it should be packaged as standard resources .
* @ param fileName the name of the file ( including extension )
* @ return true if the file should be packaged as standard java resources . */
public static boolean checkFileForPackaging ( String fileName ) { } } | String [ ] fileSegments = fileName . split ( "\\." ) ; String fileExt = "" ; if ( fileSegments . length > 1 ) { fileExt = fileSegments [ fileSegments . length - 1 ] ; } return checkFileForPackaging ( fileName , fileExt ) ; |
public class JsonByteBufferReader { /** * 读取下一个有效字符
* @ return 有效字符 */
@ Override protected final char nextGoodChar ( ) { } } | char c = nextChar ( ) ; if ( c > ' ' || c == 0 ) return c ; // 0 表示buffer结尾了
for ( ; ; ) { c = nextChar ( ) ; if ( c > ' ' || c == 0 ) return c ; } |
public class JcrNodeTypeManager { /** * Allows the collection of node types to be unregistered if they are not referenced by other node types as supertypes ,
* default primary types of child nodes , or required primary types of child nodes .
* @ param nodeTypeNames the names of the node types to be unregistered
* @ throws NoSuchNodeTypeException if any of the node type names do not correspond to a registered node type
* @ throws InvalidNodeTypeDefinitionException if any of the node types with the given names cannot be unregistered because
* they are the supertype , one of the required primary types , or a default primary type of a node type that is not
* being unregistered .
* @ throws AccessDeniedException if the current session does not have the { @ link ModeShapePermissions # REGISTER _ TYPE register
* type permission } .
* @ throws RepositoryException if any other error occurs */
public void unregisterNodeTypes ( Collection < String > nodeTypeNames ) throws NoSuchNodeTypeException , InvalidNodeTypeDefinitionException , RepositoryException { } } | NameFactory nameFactory = context ( ) . getValueFactories ( ) . getNameFactory ( ) ; try { session . checkWorkspacePermission ( session . workspaceName ( ) , ModeShapePermissions . REGISTER_TYPE ) ; } catch ( AccessControlException ace ) { throw new AccessDeniedException ( ace ) ; } Collection < Name > names = new ArrayList < Name > ( nodeTypeNames . size ( ) ) ; for ( String name : nodeTypeNames ) { names . add ( nameFactory . create ( name ) ) ; } // Unregister the node types , but perform a check to see if any of the node types are currently being used .
// Unregistering a node type that is being used will likely cause the system to become unstable .
boolean failIfNodeTypesAreUsed = true ; repositoryTypeManager . unregisterNodeType ( names , failIfNodeTypesAreUsed ) ; this . schemata = null ; // clear the cached schemata to make sure it is reloaded |
public class PrcCheckOut { /** * < p > It makes S . E . order line . < / p >
* @ param pRqVs Request scoped Vars
* @ param pOrders Orders
* @ param pSel seller
* @ param pItPl item place
* @ param pCartLn Cart Line
* @ param pTs trading settings
* @ throws Exception an Exception */
public final void makeSeOrdLn ( final Map < String , Object > pRqVs , final List < CuOrSe > pOrders , final SeSeller pSel , final AItemPlace < ? , ? > pItPl , final CartLn pCartLn , final TradingSettings pTs ) throws Exception { } } | CuOrSe cuOr = null ; boolean isNdOrInit = true ; for ( CuOrSe co : pOrders ) { if ( co . getCurr ( ) != null && co . getSel ( ) != null && co . getSel ( ) . getSeller ( ) . getItsId ( ) . equals ( pSel . getSeller ( ) . getItsId ( ) ) ) { cuOr = co ; isNdOrInit = false ; break ; } } if ( cuOr == null ) { for ( CuOrSe co : pOrders ) { if ( co . getCurr ( ) == null ) { cuOr = co ; break ; } } } if ( cuOr == null ) { cuOr = new CuOrSe ( ) ; cuOr . setIsNew ( true ) ; cuOr . setTaxes ( new ArrayList < CuOrSeTxLn > ( ) ) ; cuOr . setGoods ( new ArrayList < CuOrSeGdLn > ( ) ) ; cuOr . setServs ( new ArrayList < CuOrSeSrLn > ( ) ) ; pOrders . add ( cuOr ) ; } if ( isNdOrInit ) { cuOr . setDat ( new Date ( ) ) ; cuOr . setSeller ( pSel ) ; cuOr . setStat ( EOrdStat . NEW ) ; cuOr . setDeliv ( pCartLn . getItsOwner ( ) . getDeliv ( ) ) ; cuOr . setPayMeth ( pCartLn . getItsOwner ( ) . getPayMeth ( ) ) ; cuOr . setBuyer ( pCartLn . getItsOwner ( ) . getBuyer ( ) ) ; // TODO method " pickup by buyer from several places "
// cuOr . setPlace ( pItPl . getPickUpPlace ( ) ) ;
cuOr . setPur ( pCartLn . getItsOwner ( ) . getItsVersion ( ) ) ; cuOr . setCurr ( pCartLn . getItsOwner ( ) . getCurr ( ) ) ; cuOr . setExcRt ( pCartLn . getItsOwner ( ) . getExcRt ( ) ) ; cuOr . setDescr ( pCartLn . getItsOwner ( ) . getDescr ( ) ) ; } pRqVs . put ( CartItTxLn . class . getSimpleName ( ) + "itsOwnerdeepLevel" , 1 ) ; pRqVs . put ( CartItTxLn . class . getSimpleName ( ) + "taxdeepLevel" , 1 ) ; List < CartItTxLn > citls = getSrvOrm ( ) . retrieveListWithConditions ( pRqVs , CartItTxLn . class , "where DISAB=0 and ITSOWNER=" + pCartLn . getItsId ( ) ) ; pRqVs . remove ( CartItTxLn . class . getSimpleName ( ) + "itsOwnerdeepLevel" ) ; pRqVs . remove ( CartItTxLn . class . getSimpleName ( ) + "taxdeepLevel" ) ; ACuOrSeLn ol ; if ( pCartLn . getItTyp ( ) . equals ( EShopItemType . SEGOODS ) ) { CuOrSeGdLn ogl = null ; if ( ! cuOr . getIsNew ( ) ) { for ( CuOrSeGdLn gl : cuOr . getGoods ( ) ) { if ( gl . getGood ( ) == null ) { ogl = gl ; break ; } } } if ( ogl == null ) { ogl = new CuOrSeGdLn ( ) ; ogl . setIsNew ( true ) ; cuOr . getGoods ( ) . add ( ogl ) ; } SeGoods gd = new SeGoods ( ) ; gd . setSeller ( pSel ) ; gd . setItsId ( pCartLn . getItId ( ) ) ; gd . setItsName ( pCartLn . getItsName ( ) ) ; ogl . setGood ( gd ) ; if ( citls . size ( ) > 0 ) { if ( ogl . getIsNew ( ) ) { ogl . setItTxs ( new ArrayList < CuOrSeGdTxLn > ( ) ) ; } for ( CartItTxLn citl : citls ) { CuOrSeGdTxLn oitl = null ; if ( ! cuOr . getIsNew ( ) ) { for ( CuOrSeGdTxLn itl : ogl . getItTxs ( ) ) { if ( itl . getTax ( ) == null ) { oitl = itl ; break ; } } } if ( oitl == null ) { oitl = new CuOrSeGdTxLn ( ) ; oitl . setIsNew ( true ) ; ogl . getItTxs ( ) . add ( oitl ) ; } oitl . setItsOwner ( ogl ) ; Tax tx = new Tax ( ) ; tx . setItsId ( citl . getTax ( ) . getItsId ( ) ) ; tx . setItsName ( citl . getTax ( ) . getItsName ( ) ) ; oitl . setTax ( tx ) ; oitl . setTot ( citl . getTot ( ) ) ; } } ol = ogl ; } else { CuOrSeSrLn osl = null ; if ( ! cuOr . getIsNew ( ) ) { for ( CuOrSeSrLn sl : cuOr . getServs ( ) ) { if ( sl . getService ( ) == null ) { osl = sl ; break ; } } } if ( osl == null ) { osl = new CuOrSeSrLn ( ) ; osl . setIsNew ( true ) ; cuOr . getServs ( ) . add ( osl ) ; } SeService sr = new SeService ( ) ; sr . setSeller ( pSel ) ; sr . setItsId ( pCartLn . getItId ( ) ) ; sr . setItsName ( pCartLn . getItsName ( ) ) ; osl . setService ( sr ) ; osl . setDt1 ( pCartLn . getDt1 ( ) ) ; osl . setDt2 ( pCartLn . getDt2 ( ) ) ; if ( citls . size ( ) > 0 ) { if ( osl . getIsNew ( ) ) { osl . setItTxs ( new ArrayList < CuOrSeSrTxLn > ( ) ) ; } for ( CartItTxLn citl : citls ) { CuOrSeSrTxLn oitl = null ; if ( ! cuOr . getIsNew ( ) ) { for ( CuOrSeSrTxLn itl : osl . getItTxs ( ) ) { if ( itl . getTax ( ) == null ) { oitl = itl ; break ; } } } if ( oitl == null ) { oitl = new CuOrSeSrTxLn ( ) ; oitl . setIsNew ( true ) ; osl . getItTxs ( ) . add ( oitl ) ; } oitl . setItsOwner ( osl ) ; Tax tx = new Tax ( ) ; tx . setItsId ( citl . getTax ( ) . getItsId ( ) ) ; tx . setItsName ( citl . getTax ( ) . getItsName ( ) ) ; oitl . setTax ( tx ) ; oitl . setTot ( citl . getTot ( ) ) ; } } ol = osl ; } ol . setItsName ( pCartLn . getItsName ( ) ) ; ol . setDescr ( pCartLn . getDescr ( ) ) ; ol . setUom ( pCartLn . getUom ( ) ) ; ol . setPrice ( pCartLn . getPrice ( ) ) ; ol . setQuant ( pCartLn . getQuant ( ) ) ; ol . setSubt ( pCartLn . getSubt ( ) ) ; ol . setTot ( pCartLn . getTot ( ) ) ; ol . setTotTx ( pCartLn . getTotTx ( ) ) ; ol . setTxCat ( pCartLn . getTxCat ( ) ) ; ol . setTxDsc ( pCartLn . getTxDsc ( ) ) ; |
public class ResourceBundleUtil { /** * Get a bundle JSON using the supplied Locale .
* @ param baseName The bundle base name .
* @ param locale The Locale .
* @ return The bundle JSON .
* @ throws MissingResourceException Missing resource bundle . */
public static @ Nonnull JSONObject getBundle ( @ Nonnull String baseName , @ Nonnull Locale locale ) throws MissingResourceException { } } | String bundleKey = baseName + ":" + locale . toString ( ) ; JSONObject bundleJSON = bundles . get ( bundleKey ) ; if ( bundleJSON != null ) { return bundleJSON ; } ResourceBundle bundle = getBundle ( baseName , locale , Jenkins . class . getClassLoader ( ) ) ; if ( bundle == null ) { // Not in Jenkins core . Check the plugins .
Jenkins jenkins = Jenkins . getInstance ( ) ; // will never return null
if ( jenkins != null ) { for ( PluginWrapper plugin : jenkins . getPluginManager ( ) . getPlugins ( ) ) { bundle = getBundle ( baseName , locale , plugin . classLoader ) ; if ( bundle != null ) { break ; } } } } if ( bundle == null ) { throw new MissingResourceException ( "Can't find bundle for base name " + baseName + ", locale " + locale , baseName + "_" + locale , "" ) ; } bundleJSON = toJSONObject ( bundle ) ; bundles . put ( bundleKey , bundleJSON ) ; return bundleJSON ; |
public class SerializationSpoolFile { /** * { @ inheritDoc } */
@ Override public synchronized boolean delete ( ) { } } | try { if ( ! inUse ( ) ) { PrivilegedAction < Boolean > action = new PrivilegedAction < Boolean > ( ) { public Boolean run ( ) { return SerializationSpoolFile . super . delete ( ) ; } } ; boolean result = SecurityHelper . doPrivilegedAction ( action ) ; if ( result ) { holder . remove ( id ) ; } return result ; } } catch ( FileNotFoundException e ) { if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "An exception occurred: " + e . getMessage ( ) ) ; } } return false ; |
public class RegistrarManager { /** * Begins a new fluent configuration stanza .
* @ param < CFG > the Configuration type .
* @ param name an identifier which will be used to fetch the
* PushRegistrar after configuration is finished .
* @ param pushConfigurationClass the class of the configuration
* type .
* @ return a { @ link PushConfiguration } which can be used to build a
* AuthenticationModule object . */
public static < CFG extends PushConfiguration < CFG > > CFG config ( String name , Class < CFG > pushConfigurationClass ) { } } | @ SuppressWarnings ( "unchecked" ) ConfigurationProvider < ? extends PushConfiguration < CFG > > provider = ( ConfigurationProvider < ? extends PushConfiguration < CFG > > ) CONFIGURATION_PROVIDER_MAP . get ( pushConfigurationClass ) ; if ( provider == null ) { throw new IllegalArgumentException ( "Configuration not registered!" ) ; } return provider . newConfiguration ( ) . setName ( name ) . addOnPushRegistrarCreatedListener ( ON_PUSH_REGISTRAR_CREATED_LISTENER ) ; |
public class TransferSourceThread { /** * called after the transfer completes , before 226 */
protected Object shutdown ( ) throws IOException { } } | logger . debug ( "shutdown" ) ; // close the socket
writer . close ( ) ; // garbage collect the socket
socketBox . setSocket ( null ) ; // attempt to obtain permission to close data source
Object quitToken = context . getQuitToken ( ) ; // data source is shared by all data channels ,
// so should be closed by the last one exiting
if ( quitToken != null ) { source . close ( ) ; } return quitToken ; |
public class SameDiff { /** * This method converts SameDiff instance to
* FlatBuffers and saves it to file which
* can be restored later
* @ param file File to save the FlatBuffers serialized graph ( including arrays ) to */
public void asFlatFile ( @ NonNull File file ) throws IOException { } } | val fb = asFlatBuffers ( ) ; val offset = fb . position ( ) ; val array = fb . array ( ) ; try ( val fos = new FileOutputStream ( file ) ; val bos = new BufferedOutputStream ( fos ) ; val dos = new DataOutputStream ( bos ) ) { dos . write ( array , offset , array . length - offset ) ; } |
public class Parser { /** * A { @ link Parser } that takes as input the tokens returned by { @ code tokenizer } delimited by
* { @ code delim } , and runs { @ code this } to parse the tokens . A common misunderstanding is that
* { @ code tokenizer } has to be a parser of { @ link Token } . It doesn ' t need to be because
* { @ code Terminals } already takes care of wrapping your logical token objects into physical
* { @ code Token } with correct source location information tacked on for free . Your token object
* can literally be anything , as long as your token level parser can recognize it later .
* < p > The following example uses { @ code Terminals . tokenizer ( ) } : < pre class = " code " >
* Terminals terminals = . . . ;
* return parser . from ( terminals . tokenizer ( ) , Scanners . WHITESPACES . optional ( ) ) . parse ( str ) ;
* < / pre >
* And tokens are optionally delimited by whitespaces .
* < p > Optionally , you can skip comments using an alternative scanner than { @ code WHITESPACES } :
* < pre class = " code " > { @ code
* Terminals terminals = . . . ;
* Parser < ? > delim = Parsers . or (
* Scanners . WHITESPACE ,
* Scanners . JAVA _ LINE _ COMMENT ,
* Scanners . JAVA _ BLOCK _ COMMENT ) . skipMany ( ) ;
* return parser . from ( terminals . tokenizer ( ) , delim ) . parse ( str ) ;
* } < / pre >
* < p > In both examples , it ' s important to make sure the delimiter scanner can accept empty string
* ( either through { @ link # optional } or { @ link # skipMany } ) , unless adjacent operator
* characters shouldn ' t be parsed as separate operators .
* i . e . " ( ( " as two left parenthesis operators .
* < p > { @ code this } must be a token level parser . */
public final Parser < T > from ( Parser < ? > tokenizer , Parser < Void > delim ) { } } | return from ( tokenizer . lexer ( delim ) ) ; |
public class JAASAuthenticator { /** * Clone the context
* @ param to
* @ param from */
protected static void cloneInternal ( JAASAuthenticator to , JAASAuthenticator from ) { } } | Kerb5Authenticator . cloneInternal ( to , from ) ; to . serviceName = from . serviceName ; to . configuration = from . configuration ; to . cachedSubject = from . cachedSubject ; |
public class SslCertificateClient { /** * Returns the specified SslCertificate resource . Gets a list of available SSL certificates by
* making a list ( ) request .
* < p > Sample code :
* < pre > < code >
* try ( SslCertificateClient sslCertificateClient = SslCertificateClient . create ( ) ) {
* ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName . of ( " [ PROJECT ] " , " [ SSL _ CERTIFICATE ] " ) ;
* SslCertificate response = sslCertificateClient . getSslCertificate ( sslCertificate ) ;
* < / code > < / pre >
* @ param sslCertificate Name of the SslCertificate resource to return .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final SslCertificate getSslCertificate ( ProjectGlobalSslCertificateName sslCertificate ) { } } | GetSslCertificateHttpRequest request = GetSslCertificateHttpRequest . newBuilder ( ) . setSslCertificate ( sslCertificate == null ? null : sslCertificate . toString ( ) ) . build ( ) ; return getSslCertificate ( request ) ; |
public class ThrowableProxy { /** * Resolve all the stack entries in this stack trace that are not common with the parent .
* @ param stack The callers Class stack .
* @ param map The cache of CacheEntry objects .
* @ param rootTrace The first stack trace resolve or null .
* @ param stackTrace The stack trace being resolved .
* @ return The StackTracePackageElement array . */
ExtendedStackTraceElement [ ] toExtendedStackTrace ( final Stack < Class < ? > > stack , final Map < String , CacheEntry > map , final StackTraceElement [ ] rootTrace , final StackTraceElement [ ] stackTrace ) { } } | int stackLength ; if ( rootTrace != null ) { int rootIndex = rootTrace . length - 1 ; int stackIndex = stackTrace . length - 1 ; while ( rootIndex >= 0 && stackIndex >= 0 && rootTrace [ rootIndex ] . equals ( stackTrace [ stackIndex ] ) ) { -- rootIndex ; -- stackIndex ; } this . commonElementCount = stackTrace . length - 1 - stackIndex ; stackLength = stackIndex + 1 ; } else { this . commonElementCount = 0 ; stackLength = stackTrace . length ; } final ExtendedStackTraceElement [ ] extStackTrace = new ExtendedStackTraceElement [ stackLength ] ; Class < ? > clazz = stack . isEmpty ( ) ? null : stack . peek ( ) ; ClassLoader lastLoader = null ; for ( int i = stackLength - 1 ; i >= 0 ; -- i ) { final StackTraceElement stackTraceElement = stackTrace [ i ] ; final String className = stackTraceElement . getClassName ( ) ; // The stack returned from getCurrentStack may be missing entries for java . lang . reflect . Method . invoke ( )
// and its implementation . The Throwable might also contain stack entries that are no longer
// present as those methods have returned .
ExtendedClassInfo extClassInfo ; if ( clazz != null && className . equals ( clazz . getName ( ) ) ) { final CacheEntry entry = this . toCacheEntry ( stackTraceElement , clazz , true ) ; extClassInfo = entry . element ; lastLoader = entry . loader ; stack . pop ( ) ; clazz = stack . isEmpty ( ) ? null : stack . peek ( ) ; } else { final CacheEntry cacheEntry = map . get ( className ) ; if ( cacheEntry != null ) { final CacheEntry entry = cacheEntry ; extClassInfo = entry . element ; if ( entry . loader != null ) { lastLoader = entry . loader ; } } else { final CacheEntry entry = this . toCacheEntry ( stackTraceElement , this . loadClass ( lastLoader , className ) , false ) ; extClassInfo = entry . element ; map . put ( stackTraceElement . toString ( ) , entry ) ; if ( entry . loader != null ) { lastLoader = entry . loader ; } } } extStackTrace [ i ] = new ExtendedStackTraceElement ( stackTraceElement , extClassInfo ) ; } return extStackTrace ; |
public class DescribePointSift { /** * Sets the image spacial derivatives . These should be computed from an image at the appropriate scale
* in scale - space .
* @ param derivX x - derivative of input image
* @ param derivY y - derivative of input image */
public void setImageGradient ( Deriv derivX , Deriv derivY ) { } } | this . imageDerivX . wrap ( derivX ) ; this . imageDerivY . wrap ( derivY ) ; |
public class ApiUtilDAODefaultImpl { public String [ ] parseTangoHost ( final String tgh ) throws DevFailed { } } | String host = null ; String strport = null ; try { // Check if there is more than one Tango Host
StringTokenizer stk ; if ( tgh . indexOf ( "," ) > 0 ) { stk = new StringTokenizer ( tgh , "," ) ; } else { stk = new StringTokenizer ( tgh ) ; } final ArrayList < String > arrayList = new ArrayList < String > ( ) ; while ( stk . hasMoreTokens ( ) ) { // Get each Tango _ host
final String th = stk . nextToken ( ) ; final StringTokenizer stk2 = new StringTokenizer ( th , ":" ) ; arrayList . add ( stk2 . nextToken ( ) ) ; // Host Name
arrayList . add ( stk2 . nextToken ( ) ) ; // Port Number
} // Get the default one ( first )
host = arrayList . get ( 0 ) ; strport = arrayList . get ( 1 ) ; Integer . parseInt ( strport ) ; // Put second one if exists in a singleton map object
final String def_tango_host = host + ":" + strport ; final DbRedundancy dbr = DbRedundancy . get_instance ( ) ; if ( arrayList . size ( ) > 3 ) { final String redun = arrayList . get ( 2 ) + ":" + arrayList . get ( 3 ) ; dbr . put ( def_tango_host , redun ) ; } } catch ( final Exception e ) { Except . throw_exception ( "TangoApi_TANGO_HOST_NOT_SET" , e . toString ( ) + " occurs when parsing " + "\"TANGO_HOST\" property " + tgh , "TangoApi.ApiUtil.parseTangoHost()" ) ; } return new String [ ] { host , strport } ; |
public class FileBasedTemporalSemanticSpace { /** * { @ inheritDoc } */
public Vector getVectorAfter ( String word , long startTime ) { } } | SemanticVector v = wordToMeaning . get ( word ) ; return ( v == null ) ? null : v . getVectorAfter ( startTime ) ; |
public class DRL5Expressions { /** * src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 774:1 : neg _ operator _ key : { . . . } ? = > id = ID ; */
public final DRL5Expressions . neg_operator_key_return neg_operator_key ( ) throws RecognitionException { } } | DRL5Expressions . neg_operator_key_return retval = new DRL5Expressions . neg_operator_key_return ( ) ; retval . start = input . LT ( 1 ) ; Token id = null ; try { // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 775:3 : ( { . . . } ? = > id = ID )
// src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 775:10 : { . . . } ? = > id = ID
{ if ( ! ( ( ( helper . isPluggableEvaluator ( true ) ) ) ) ) { if ( state . backtracking > 0 ) { state . failed = true ; return retval ; } throw new FailedPredicateException ( input , "neg_operator_key" , "(helper.isPluggableEvaluator(true))" ) ; } id = ( Token ) match ( input , ID , FOLLOW_ID_in_neg_operator_key4819 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { helper . emit ( id , DroolsEditorType . KEYWORD ) ; } } retval . stop = input . LT ( - 1 ) ; } catch ( RecognitionException re ) { throw re ; } finally { // do for sure before leaving
} return retval ; |
public class NewMappingDialogPanel { /** * GEN - LAST : event _ cmdInsertMappingActionPerformed */
private void cmdCancelActionPerformed ( java . awt . event . ActionEvent evt ) { } } | // GEN - FIRST : event _ cmdCancelActionPerformed
parent . setVisible ( false ) ; parent . dispose ( ) ; releaseResultset ( ) ; |
public class FSM2DFAParser { /** * Checks the data definition by ensuring the index in the state vector containing acceptance information is
* defined .
* @ throws FSMParseException
* when the acceptance information could not be found . */
@ Override protected void checkDataDefinitions ( StreamTokenizer streamTokenizer ) throws FSMParseException { } } | if ( acceptIndex == - 1 ) { throw new FSMParseException ( String . format ( ACCEPT_NOT_FOUND , acceptingDataVariableName ) , streamTokenizer ) ; } |
public class ContentSpecValidator { /** * Validates a topic against the database and for formatting issues .
* @ param infoTopic The topic to be validated .
* @ param contentSpec The content spec the topic belongs to .
* @ param infoTopics
* @ return True if the topic is valid otherwise false . */
public boolean preValidateInfoTopic ( final InfoTopic infoTopic , final ContentSpec contentSpec , final Map < String , InfoTopic > infoTopics ) { } } | // Check if the app should be shutdown
if ( isShuttingDown . get ( ) ) { shutdown . set ( true ) ; return false ; } boolean valid = true ; // Checks that the id isn ' t null and is a valid topic ID
if ( infoTopic . getId ( ) == null || ! infoTopic . getId ( ) . matches ( CSConstants . ALL_TOPIC_ID_REGEX ) ) { log . error ( String . format ( ProcessorConstants . ERROR_INVALID_TOPIC_ID_MSG , infoTopic . getLineNumber ( ) , infoTopic . getText ( ) ) ) ; valid = false ; } // Check that we aren ' t using translations for anything but existing topics
if ( ! infoTopic . isTopicAnExistingTopic ( ) ) { // Check that we aren ' t processing translations
if ( processingOptions . isTranslation ( ) ) { log . error ( String . format ( ProcessorConstants . ERROR_TOPIC_NO_NEW_TRANSLATION_TOPIC , infoTopic . getLineNumber ( ) , infoTopic . getText ( ) ) ) ; valid = false ; } } // Check that we are allowed to create new topics
if ( ! infoTopic . isTopicAnExistingTopic ( ) && ! processingOptions . isAllowNewTopics ( ) ) { log . error ( String . format ( ProcessorConstants . ERROR_TOPIC_NO_NEW_TOPIC_BUILD , infoTopic . getLineNumber ( ) , infoTopic . getText ( ) ) ) ; valid = false ; } // Existing Topics
if ( infoTopic . isTopicAnExistingTopic ( ) ) { // Check that tags aren ' t trying to be removed
if ( ! infoTopic . getRemoveTags ( false ) . isEmpty ( ) ) { log . error ( String . format ( ProcessorConstants . ERROR_TOPIC_EXISTING_TOPIC_CANNOT_REMOVE_TAGS , infoTopic . getLineNumber ( ) , infoTopic . getText ( ) ) ) ; valid = false ; } // Check that tags aren ' t trying to be added to a revision
if ( processingOptions . isPrintChangeWarnings ( ) && infoTopic . getRevision ( ) != null && ! infoTopic . getTags ( false ) . isEmpty ( ) ) { log . warn ( String . format ( ProcessorConstants . WARN_TAGS_IGNORE_MSG , infoTopic . getLineNumber ( ) , "revision" , infoTopic . getText ( ) ) ) ; } // Check that the assigned writer and description haven ' t been set
if ( infoTopic . getAssignedWriter ( false ) != null || infoTopic . getDescription ( false ) != null ) { log . error ( String . format ( ProcessorConstants . ERROR_TOPIC_EXISTING_BAD_OPTIONS , infoTopic . getLineNumber ( ) , infoTopic . getText ( ) ) ) ; valid = false ; } // Check that we aren ' t processing translations
if ( ! infoTopic . getTags ( true ) . isEmpty ( ) && processingOptions . isTranslation ( ) ) { log . error ( String . format ( ProcessorConstants . ERROR_TOPIC_NO_TAGS_TRANSLATION_TOPIC , infoTopic . getLineNumber ( ) , infoTopic . getText ( ) ) ) ; valid = false ; } } // Duplicated Topics
else if ( infoTopic . isTopicADuplicateTopic ( ) ) { String temp = "N" + infoTopic . getId ( ) . substring ( 1 ) ; // Check that the topic exists in the content specification
if ( ! infoTopics . containsKey ( temp ) ) { log . error ( String . format ( ProcessorConstants . ERROR_TOPIC_NONEXIST_MSG , infoTopic . getLineNumber ( ) , infoTopic . getText ( ) ) ) ; valid = false ; } // Cloned Topics
} else if ( infoTopic . isTopicAClonedTopic ( ) ) { // Check if a description or type exists . If one does then generate an error .
if ( infoTopic . getDescription ( false ) != null && ! infoTopic . getDescription ( false ) . equals ( "" ) ) { log . error ( String . format ( ProcessorConstants . ERROR_TOPIC_CLONED_BAD_OPTIONS , infoTopic . getLineNumber ( ) , infoTopic . getText ( ) ) ) ; valid = false ; } // Duplicated Cloned Topics
} else if ( infoTopic . isTopicAClonedDuplicateTopic ( ) ) { // Find the duplicate topic in the content spec
final String topicId = infoTopic . getId ( ) . substring ( 1 ) ; int count = 0 ; for ( final Entry < String , InfoTopic > entry : infoTopics . entrySet ( ) ) { final String uniqueTopicId = entry . getKey ( ) ; if ( uniqueTopicId . endsWith ( topicId ) && ! uniqueTopicId . endsWith ( infoTopic . getId ( ) ) ) { count ++ ; } } // Check that the topic exists
if ( count == 0 ) { log . error ( String . format ( ProcessorConstants . ERROR_TOPIC_NONEXIST_MSG , infoTopic . getLineNumber ( ) , infoTopic . getText ( ) ) ) ; valid = false ; } // Check that the referenced topic is unique
else if ( count > 1 ) { log . error ( String . format ( ProcessorConstants . ERROR_TOPIC_DUPLICATE_CLONES_MSG , infoTopic . getLineNumber ( ) , infoTopic . getText ( ) ) ) ; valid = false ; } } // Check for conflicting conditions
checkForConflictingCondition ( infoTopic , contentSpec ) ; return valid ; |
public class ExpressionTreeElement { /** * Add a tree as new child and make the maximum priority for it
* @ param tree a tree to be added as a child , must not be null
* @ return it returns this */
@ Nonnull public ExpressionTreeElement addSubTree ( @ Nonnull final ExpressionTree tree ) { } } | assertNotEmptySlot ( ) ; final ExpressionTreeElement root = tree . getRoot ( ) ; if ( ! root . isEmptySlot ( ) ) { root . makeMaxPriority ( ) ; addElementToNextFreeSlot ( root ) ; } return this ; |
public class FrameHeader { /** * Given a block size , select the proper bit settings to use according to
* the FLAC stream .
* @ param blockSize
* @ return */
private static byte encodeBlockSize ( int blockSize ) { } } | if ( DEBUG_LEV > 0 ) System . err . println ( "FrameHeader::encodeBlockSize : Begin" ) ; byte value = 0 ; int i ; for ( i = 0 ; i < definedBlockSizes . length ; i ++ ) { if ( blockSize == definedBlockSizes [ i ] ) { value = ( byte ) i ; break ; } } if ( i >= definedBlockSizes . length ) { if ( blockSize <= 255 ) value = 0x6 ; else value = 0x7 ; } if ( DEBUG_LEV > 0 ) System . err . println ( "FrameHeader::encodeBlockSize : End" ) ; return value ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.