idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
40,400 | public void add ( final Modulo2Equation equation ) { int i = 0 , j = 0 , k = 0 ; final int s = variables . size ( ) , t = equation . variables . size ( ) ; final int [ ] a = variables . elements ( ) , b = equation . variables . elements ( ) , result = new int [ s + t ] ; if ( t != 0 && s != 0 ) { for ( ; ; ) { if ( a [... | Adds the provided equation to this equation . | 262 | 8 |
40,401 | public static long scalarProduct ( final Modulo2Equation e , long [ ] solution ) { long sum = 0 ; for ( final IntListIterator iterator = e . variables . iterator ( ) ; iterator . hasNext ( ) ; ) sum ^= solution [ iterator . nextInt ( ) ] ; return sum ; } | Returns the modulo - 2 scalar product of the two provided bit vectors . | 67 | 16 |
40,402 | private static void next ( ) { final long t0 = s0 ; long t1 = s1 ; t1 ^= t0 ; s0 = Long . rotateLeft ( t0 , 55 ) ^ t1 ^ t1 << 14 ; s1 = Long . rotateLeft ( t1 , 36 ) ; } | 55 - 14 - 36 63 x^128 + x^118 + x^117 + x^114 + x^112 + x^109 + x^108 + x^107 + x^106 + x^103 + x^102 + x^101 + x^99 + x^98 + x^96 + x^94 + x^93 + x^92 + x^91 + x^90 + x^89 + x^88 + x^85 + x^83 + x^80 + x^79 + x^78 + x^77 + x^76 + x^75 + x^71 + x^67 + x^65 + x^62 + x^60 + x^59 + x^58 + x^57 + x^56 + x^55 + x^54 + x^52 ... | 66 | 255 |
40,403 | @ Override public Object convert ( String value , Class type ) { if ( isNullOrEmpty ( value ) ) { return null ; } if ( Character . isDigit ( value . charAt ( 0 ) ) ) { return resolveByOrdinal ( value , type ) ; } else { return resolveByName ( value , type ) ; } } | Enums are always final so I can suppress this warning safely | 73 | 12 |
40,404 | @ PreDestroy public void removeGeneratedClasses ( ) { ClassPool pool = ClassPool . getDefault ( ) ; for ( Class < ? > clazz : interfaces . values ( ) ) { CtClass ctClass = pool . getOrNull ( clazz . getName ( ) ) ; if ( ctClass != null ) { ctClass . detach ( ) ; logger . debug ( "class {} is detached" , clazz . getName... | Remove generated classes when application stops due reload context issues . | 102 | 11 |
40,405 | private boolean hasConstraints ( ControllerMethod controllerMethod ) { Method method = controllerMethod . getMethod ( ) ; if ( method . getParameterTypes ( ) . length == 0 ) { logger . debug ( "method {} has no parameters, skipping" , controllerMethod ) ; return false ; } BeanDescriptor bean = bvalidator . getConstrain... | Only accepts if method isn t parameterless and have at least one constraint . | 150 | 15 |
40,406 | protected String extractCategory ( ValuedParameter [ ] params , ConstraintViolation < Object > violation ) { Iterator < Node > path = violation . getPropertyPath ( ) . iterator ( ) ; Node method = path . next ( ) ; logger . debug ( "Constraint violation on method {}: {}" , method , violation ) ; StringBuilder cat = new... | Returns the category for this constraint violation . By default the category returned is the full path for property . You can override this method if you prefer another strategy . | 156 | 31 |
40,407 | protected String extractInternacionalizedMessage ( ConstraintViolation < Object > v ) { return interpolator . interpolate ( v . getMessageTemplate ( ) , new BeanValidatorContext ( v ) , locale . get ( ) ) ; } | Returns the internacionalized message for this constraint violation . | 52 | 12 |
40,408 | @ AroundCall public void intercept ( SimpleInterceptorStack stack ) { User current = info . getUser ( ) ; try { dao . refresh ( current ) ; } catch ( Exception e ) { // could happen if the user does not exist in the database or if there's no user logged in. } /** * You can use the result even in interceptors, but you c... | Intercepts the request and checks if there is a user logged in . | 193 | 15 |
40,409 | public void registerComponents ( XStream xstream ) { for ( Converter converter : converters ) { xstream . registerConverter ( converter ) ; logger . debug ( "registered Xstream converter for {}" , converter . getClass ( ) . getName ( ) ) ; } for ( SingleValueConverter converter : singleValueConverters ) { xstream . reg... | Method used to register all the XStream converters scanned to a XStream instance | 115 | 16 |
40,410 | @ Public @ Path ( "/musics/list/json" ) public void showAllMusicsAsJSON ( ) { result . use ( json ( ) ) . from ( musicDao . listAll ( ) ) . serialize ( ) ; } | Show all list of registered musics in json format | 52 | 10 |
40,411 | @ Public @ Path ( "/musics/list/xml" ) public void showAllMusicsAsXML ( ) { result . use ( xml ( ) ) . from ( musicDao . listAll ( ) ) . serialize ( ) ; } | Show all list of registered musics in xml format | 53 | 10 |
40,412 | @ Public @ Path ( "/musics/list/http" ) public void showAllMusicsAsHTTP ( ) { result . use ( http ( ) ) . body ( "<p class=\"content\">" + musicDao . listAll ( ) . toString ( ) + "</p>" ) ; } | Show all list of registered musics in http format | 65 | 10 |
40,413 | public Map < String , Collection < Message > > getGrouped ( ) { if ( grouped == null ) { grouped = FluentIterable . from ( delegate ) . index ( byCategoryMapping ( ) ) . asMap ( ) ; } return grouped ; } | Return messages grouped by category . This method can useful if you want to get messages for a specific category . | 55 | 21 |
40,414 | public MessageListItem from ( final String category ) { List < String > messages = FluentIterable . from ( delegate ) . filter ( byCategory ( category ) ) . transform ( toMessageString ( ) ) . toList ( ) ; return new MessageListItem ( messages ) ; } | Return all messages by category . This method can useful if you want to get messages from a specific category . | 60 | 21 |
40,415 | protected String extractControllerNameFrom ( Class < ? > type ) { String prefix = extractPrefix ( type ) ; if ( isNullOrEmpty ( prefix ) ) { String baseName = StringUtils . lowercaseFirst ( type . getSimpleName ( ) ) ; if ( baseName . endsWith ( "Controller" ) ) { return "/" + baseName . substring ( 0 , baseName . last... | You can override this method for use a different convention for your controller name given a type | 111 | 17 |
40,416 | protected Route getRouteStrategy ( ControllerMethod controllerMethod , Parameter [ ] parameterNames ) { return new FixedMethodStrategy ( originalUri , controllerMethod , this . supportedMethods , builder . build ( ) , priority , parameterNames ) ; } | Override this method to change the default Route implementation | 52 | 9 |
40,417 | public String buildGroupName ( Boolean doValidation ) { NameValidation . notEmpty ( appName , "appName" ) ; if ( doValidation ) { validateNames ( appName , stack , countries , devPhase , hardware , partners , revision , usedBy , redBlackSwap , zoneVar ) ; if ( detail != null && ! detail . isEmpty ( ) && ! NameValidatio... | Construct and return the name of the auto scaling group . | 345 | 11 |
40,418 | public static String notEmpty ( String value , String variableName ) { if ( value == null ) { throw new NullPointerException ( "ERROR: Trying to use String with null " + variableName ) ; } if ( value . isEmpty ( ) ) { throw new IllegalArgumentException ( "ERROR: Illegal empty string for " + variableName ) ; } return va... | Validates if provided value is non - null and non - empty . | 79 | 14 |
40,419 | public static Boolean usesReservedFormat ( String name ) { return checkMatch ( name , PUSH_FORMAT_PATTERN ) || checkMatch ( name , LABELED_VARIABLE_PATTERN ) ; } | Determines whether a name ends with the reserved format - v000 where 0 represents any digit or starts with the reserved format z0 where z is any letter or contains a hyphen - separated token that starts with the z0 format . | 50 | 48 |
40,420 | public static < T > Map < String , List < T > > groupByClusterName ( List < T > inputs , AsgNameProvider < T > nameProvider ) { Map < String , List < T > > clusterNamesToAsgs = new HashMap < String , List < T > > ( ) ; for ( T input : inputs ) { String clusterName = Names . parseName ( nameProvider . extractAsgName ( i... | Groups a list of ASG related objects by cluster name . | 166 | 13 |
40,421 | public static Map < String , List < String > > groupAsgNamesByClusterName ( List < String > asgNames ) { return groupByClusterName ( asgNames , new AsgNameProvider < String > ( ) { public String extractAsgName ( String asgName ) { return asgName ; } } ) ; } | Groups a list of ASG names by cluster name . | 74 | 12 |
40,422 | public static AppVersion parseName ( String amiName ) { if ( amiName == null ) { return null ; } Matcher matcher = APP_VERSION_PATTERN . matcher ( amiName ) ; if ( ! matcher . matches ( ) ) { return null ; } AppVersion parsedName = new AppVersion ( ) ; parsedName . packageName = matcher . group ( 1 ) ; parsedName . ver... | Parses the appversion tag into its component parts . | 277 | 12 |
40,423 | public static BaseAmiInfo parseDescription ( String imageDescription ) { BaseAmiInfo info = new BaseAmiInfo ( ) ; if ( imageDescription == null ) { return info ; } info . baseAmiId = extractBaseAmiId ( imageDescription ) ; info . baseAmiName = extractBaseAmiName ( imageDescription ) ; if ( info . baseAmiName != null ) ... | Parse an AMI description into its component parts . | 182 | 11 |
40,424 | public boolean isExistingID ( ) { try { String userId = getPost ( ) . getString ( Defines . Jsonkey . Identity . getKey ( ) ) ; return ( userId != null && userId . equals ( prefHelper_ . getIdentity ( ) ) ) ; } catch ( JSONException e ) { e . printStackTrace ( ) ; return false ; } } | Return true if the user id provided for user identification is the same as existing id | 84 | 16 |
40,425 | public ContentMetadata addCustomMetadata ( String key , String value ) { customMetadata . put ( key , value ) ; return this ; } | Adds any custom metadata associated with the qualifying content item | 31 | 10 |
40,426 | public void setDialogWindowAttributes ( ) { requestWindowFeature ( Window . FEATURE_NO_TITLE ) ; getWindow ( ) . setBackgroundDrawable ( new ColorDrawable ( Color . TRANSPARENT ) ) ; getWindow ( ) . addFlags ( WindowManager . LayoutParams . FLAG_DIM_BEHIND ) ; getWindow ( ) . addFlags ( WindowManager . LayoutParams . F... | Set the window attributes for the invite dialog . | 240 | 9 |
40,427 | static DeviceInfo initialize ( Context context ) { if ( thisInstance_ == null ) { thisInstance_ = new DeviceInfo ( context ) ; } return thisInstance_ ; } | Initialize the singleton instance for deviceInfo class | 36 | 10 |
40,428 | void updateRequestWithV1Params ( JSONObject requestObj ) { try { SystemObserver . UniqueId hardwareID = getHardwareID ( ) ; if ( ! isNullOrEmptyOrBlank ( hardwareID . getId ( ) ) ) { requestObj . put ( Defines . Jsonkey . HardwareID . getKey ( ) , hardwareID . getId ( ) ) ; requestObj . put ( Defines . Jsonkey . IsHard... | Update the given server request JSON with device params | 668 | 9 |
40,429 | void updateLinkReferrerParams ( ) { // Add link identifier if present String linkIdentifier = prefHelper_ . getLinkClickIdentifier ( ) ; if ( ! linkIdentifier . equals ( PrefHelper . NO_STRING_VALUE ) ) { try { getPost ( ) . put ( Defines . Jsonkey . LinkIdentifier . getKey ( ) , linkIdentifier ) ; getPost ( ) . put ( ... | Update link referrer params like play store referrer params For link clicked installs link click id is updated when install referrer broadcast is received Also update any googleSearchReferrer available with play store referrer broadcast | 425 | 41 |
40,430 | static String getPackageName ( Context context ) { String packageName = "" ; if ( context != null ) { try { final PackageInfo packageInfo = context . getPackageManager ( ) . getPackageInfo ( context . getPackageName ( ) , 0 ) ; packageName = packageInfo . packageName ; } catch ( Exception e ) { PrefHelper . LogExceptio... | Get the package name for this application . | 93 | 8 |
40,431 | static String getAppVersion ( Context context ) { String appVersion = "" ; if ( context != null ) { try { final PackageInfo packageInfo = context . getPackageManager ( ) . getPackageInfo ( context . getPackageName ( ) , 0 ) ; appVersion = packageInfo . versionName ; } catch ( Exception e ) { PrefHelper . LogException (... | Get the App Version Name of the current application that the SDK is integrated with . | 109 | 16 |
40,432 | static long getFirstInstallTime ( Context context ) { long firstTime = 0L ; if ( context != null ) { try { final PackageInfo packageInfo = context . getPackageManager ( ) . getPackageInfo ( context . getPackageName ( ) , 0 ) ; firstTime = packageInfo . firstInstallTime ; } catch ( Exception e ) { PrefHelper . LogExcept... | Get the time at which the app was first installed in milliseconds . | 97 | 13 |
40,433 | static boolean isPackageInstalled ( Context context ) { boolean isInstalled = false ; if ( context != null ) { try { final PackageManager packageManager = context . getPackageManager ( ) ; Intent intent = context . getPackageManager ( ) . getLaunchIntentForPackage ( context . getPackageName ( ) ) ; if ( intent == null ... | Determine if the package is installed . | 160 | 9 |
40,434 | static long getLastUpdateTime ( Context context ) { long lastTime = 0L ; if ( context != null ) { try { final PackageInfo packageInfo = context . getPackageManager ( ) . getPackageInfo ( context . getPackageName ( ) , 0 ) ; lastTime = packageInfo . lastUpdateTime ; } catch ( Exception e ) { PrefHelper . LogException ( ... | Get the time at which the app was last updated in milliseconds . | 97 | 13 |
40,435 | boolean prefetchGAdsParams ( Context context , GAdsParamsFetchEvents callback ) { boolean isPrefetchStarted = false ; if ( TextUtils . isEmpty ( GAIDString_ ) ) { isPrefetchStarted = true ; new GAdsPrefetchTask ( context , callback ) . executeTask ( ) ; } return isPrefetchStarted ; } | Method to prefetch the GAID and LAT values . | 84 | 11 |
40,436 | static String getLocalIPAddress ( ) { String ipAddress = "" ; try { List < NetworkInterface > netInterfaces = Collections . list ( NetworkInterface . getNetworkInterfaces ( ) ) ; for ( NetworkInterface netInterface : netInterfaces ) { List < InetAddress > addresses = Collections . list ( netInterface . getInetAddresses... | Get IP address from first non local net Interface | 161 | 9 |
40,437 | public Dialog shareLink ( Branch . ShareLinkBuilder builder ) { builder_ = builder ; context_ = builder . getActivity ( ) ; callback_ = builder . getCallback ( ) ; channelPropertiesCallback_ = builder . getChannelPropertiesCallback ( ) ; shareLinkIntent_ = new Intent ( Intent . ACTION_SEND ) ; shareLinkIntent_ . setTyp... | Creates an application selector and shares a link on user selecting the application . | 273 | 15 |
40,438 | public void cancelShareLinkDialog ( boolean animateClose ) { if ( shareDlg_ != null && shareDlg_ . isShowing ( ) ) { if ( animateClose ) { // Cancel the dialog with animation shareDlg_ . cancel ( ) ; } else { // Dismiss the dialog immediately shareDlg_ . dismiss ( ) ; } } } | Dismiss the share dialog if showing . Should be called on activity stopping . | 79 | 16 |
40,439 | private void invokeSharingClient ( final ResolveInfo selectedResolveInfo ) { isShareInProgress_ = true ; final String channelName = selectedResolveInfo . loadLabel ( context_ . getPackageManager ( ) ) . toString ( ) ; BranchShortLinkBuilder shortLinkBuilder = builder_ . getShortLinkBuilder ( ) ; shortLinkBuilder . gene... | Invokes a sharing client with a link created by the given json objects . | 343 | 15 |
40,440 | @ SuppressWarnings ( "deprecation" ) @ SuppressLint ( "NewApi" ) private void addLinkToClipBoard ( String url , String label ) { int sdk = android . os . Build . VERSION . SDK_INT ; if ( sdk < android . os . Build . VERSION_CODES . HONEYCOMB ) { android . text . ClipboardManager clipboard = ( android . text . Clipboard... | Adds a given link to the clip board . | 234 | 9 |
40,441 | void setInstallOrOpenCallback ( Branch . BranchReferralInitListener callback ) { synchronized ( reqQueueLockObject ) { for ( ServerRequest req : queue ) { if ( req != null ) { if ( req instanceof ServerRequestRegisterInstall ) { ( ( ServerRequestRegisterInstall ) req ) . setInitFinishedCallback ( callback ) ; } else if... | Sets the given callback to the existing open or install request in the queue | 108 | 15 |
40,442 | void setStrongMatchWaitLock ( ) { synchronized ( reqQueueLockObject ) { for ( ServerRequest req : queue ) { if ( req != null ) { if ( req instanceof ServerRequestInitSession ) { req . addProcessWaitLock ( ServerRequest . PROCESS_WAIT_LOCK . STRONG_MATCH_PENDING_WAIT_LOCK ) ; } } } } } | Sets the strong match wait for any init session request in the queue | 83 | 14 |
40,443 | public String getFailReason ( ) { String causeMsg = "" ; try { JSONObject postObj = getObject ( ) ; if ( postObj != null && postObj . has ( "error" ) && postObj . getJSONObject ( "error" ) . has ( "message" ) ) { causeMsg = postObj . getJSONObject ( "error" ) . getString ( "message" ) ; if ( causeMsg != null && causeMs... | Get the reason for failure if there any | 131 | 8 |
40,444 | static JSONObject addSource ( JSONObject params ) { if ( params == null ) { params = new JSONObject ( ) ; } try { params . put ( "source" , "android" ) ; } catch ( JSONException e ) { e . printStackTrace ( ) ; } return params ; } | Convert the given JSONObject to string and adds source value as | 64 | 13 |
40,445 | public JSONObject getLinkDataJsonObject ( ) { JSONObject linkDataJson = new JSONObject ( ) ; try { if ( ! TextUtils . isEmpty ( channel ) ) { linkDataJson . put ( "~" + Defines . LinkParam . Channel . getKey ( ) , channel ) ; } if ( ! TextUtils . isEmpty ( alias ) ) { linkDataJson . put ( "~" + Defines . LinkParam . Al... | Creates the Json object with link params and link properties . | 367 | 13 |
40,446 | public BranchEvent setAdType ( AdType adType ) { return addStandardProperty ( Defines . Jsonkey . AdType . getKey ( ) , adType . getName ( ) ) ; } | Set the Ad Type associated with the event . | 43 | 9 |
40,447 | public BranchEvent setTransactionID ( String transactionID ) { return addStandardProperty ( Defines . Jsonkey . TransactionID . getKey ( ) , transactionID ) ; } | Set the transaction id associated with this event if there in any | 37 | 12 |
40,448 | public BranchEvent setCurrency ( CurrencyType currency ) { return addStandardProperty ( Defines . Jsonkey . Currency . getKey ( ) , currency . toString ( ) ) ; } | Set the currency related with this transaction event | 40 | 8 |
40,449 | public BranchEvent setCoupon ( String coupon ) { return addStandardProperty ( Defines . Jsonkey . Coupon . getKey ( ) , coupon ) ; } | Set any coupons associated with this transaction event | 36 | 8 |
40,450 | public BranchEvent setAffiliation ( String affiliation ) { return addStandardProperty ( Defines . Jsonkey . Affiliation . getKey ( ) , affiliation ) ; } | Set any affiliation for this transaction event | 35 | 7 |
40,451 | public BranchEvent setDescription ( String description ) { return addStandardProperty ( Defines . Jsonkey . Description . getKey ( ) , description ) ; } | Set description for this transaction event | 33 | 6 |
40,452 | public BranchEvent setSearchQuery ( String searchQuery ) { return addStandardProperty ( Defines . Jsonkey . SearchQuery . getKey ( ) , searchQuery ) ; } | Set any search query associated with the event | 37 | 8 |
40,453 | public BranchEvent addCustomDataProperty ( String propertyName , String propertyValue ) { try { this . customProperties . put ( propertyName , propertyValue ) ; } catch ( JSONException e ) { e . printStackTrace ( ) ; } return this ; } | Adds a custom data property associated with this Branch Event | 56 | 10 |
40,454 | public boolean logEvent ( Context context ) { boolean isReqQueued = false ; String reqPath = isStandardEvent ? Defines . RequestPath . TrackStandardEvent . getPath ( ) : Defines . RequestPath . TrackCustomEvent . getPath ( ) ; if ( Branch . getInstance ( ) != null ) { Branch . getInstance ( ) . handleNewRequest ( new S... | Logs this BranchEvent to Branch for tracking and analytics | 109 | 11 |
40,455 | public boolean setBranchKey ( String key ) { Branch_Key = key ; String currentBranchKey = getString ( KEY_BRANCH_KEY ) ; if ( key == null || currentBranchKey == null || ! currentBranchKey . equals ( key ) ) { clearPrefOnBranchKeyChange ( ) ; setString ( KEY_BRANCH_KEY , key ) ; return true ; } return false ; } | Set the given Branch Key to preference . Clears the preference data if the key is a new key . | 92 | 21 |
40,456 | private ArrayList < String > getBuckets ( ) { String bucketList = getString ( KEY_BUCKETS ) ; if ( bucketList . equals ( NO_STRING_VALUE ) ) { return new ArrayList <> ( ) ; } else { return deserializeString ( bucketList ) ; } } | REWARD TRACKING CALLS | 67 | 7 |
40,457 | private ArrayList < String > getActions ( ) { String actionList = getString ( KEY_ACTIONS ) ; if ( actionList . equals ( NO_STRING_VALUE ) ) { return new ArrayList <> ( ) ; } else { return deserializeString ( actionList ) ; } } | EVENT REFERRAL INSTALL CALLS | 65 | 9 |
40,458 | private String serializeArrayList ( ArrayList < String > strings ) { String retString = "" ; for ( String value : strings ) { retString = retString + value + "," ; } retString = retString . substring ( 0 , retString . length ( ) - 1 ) ; return retString ; } | ALL GENERIC CALLS | 67 | 6 |
40,459 | public void onUrlAvailable ( String url ) { if ( callback_ != null ) { callback_ . onLinkCreate ( url , null ) ; } updateShareEventToFabric ( url ) ; } | Calls the callback with the URL . This should be called on finding an existing url up on trying to create a URL asynchronously | 42 | 27 |
40,460 | public JSONObject convertToJson ( ) { JSONObject buoJsonModel = new JSONObject ( ) ; try { // Add all keys in plane format initially. All known keys will be replaced with corresponding data type in the following section JSONObject metadataJsonObject = metadata_ . convertToJson ( ) ; Iterator < String > keys = metadataJ... | Convert the BUO to corresponding Json representation | 593 | 10 |
40,461 | static void shutDown ( ) { ServerRequestQueue . shutDown ( ) ; PrefHelper . shutDown ( ) ; BranchUtil . shutDown ( ) ; DeviceInfo . shutDown ( ) ; // BranchStrongMatchHelper.shutDown(); // BranchViewHandler.shutDown(); // DeepLinkRoutingValidator.shutDown(); // InstallListener.shutDown(); // InstantAppUtil.shutDown(); ... | For Unit Testing we need to reset the Branch state | 253 | 10 |
40,462 | String getSessionReferredLink ( ) { String link = prefHelper_ . getExternalIntentUri ( ) ; return ( link . equals ( PrefHelper . NO_STRING_VALUE ) ? null : link ) ; } | Package Private . | 48 | 3 |
40,463 | private JSONObject appendDebugParams ( JSONObject originalParams ) { try { if ( originalParams != null && deeplinkDebugParams_ != null ) { if ( deeplinkDebugParams_ . length ( ) > 0 ) { PrefHelper . Debug ( "You're currently in deep link debug mode. Please comment out 'setDeepLinkDebugMode' to receive the deep link par... | Append the deep link debug params to the original params | 173 | 11 |
40,464 | private void registerAppInit ( BranchReferralInitListener callback , ServerRequest . PROCESS_WAIT_LOCK lock ) { ServerRequest request = getInstallOrOpenRequest ( callback ) ; request . addProcessWaitLock ( lock ) ; if ( isGAParamsFetchInProgress_ ) { request . addProcessWaitLock ( ServerRequest . PROCESS_WAIT_LOCK . GA... | Registers app init with params filtered from the intent . This will wait on the wait locks to complete any pending operations | 301 | 23 |
40,465 | protected void addGetParam ( String paramKey , String paramValue ) { try { params_ . put ( paramKey , paramValue ) ; } catch ( JSONException ignore ) { } } | Adds a param and its value to the get request | 39 | 10 |
40,466 | private void updateGAdsParams ( ) { BRANCH_API_VERSION version = getBranchRemoteAPIVersion ( ) ; int LATVal = DeviceInfo . getInstance ( ) . getSystemObserver ( ) . getLATVal ( ) ; String gaid = DeviceInfo . getInstance ( ) . getSystemObserver ( ) . getGAID ( ) ; if ( ! TextUtils . isEmpty ( gaid ) ) { try { if ( versi... | Updates the google ads parameters . This should be called only from a background thread since it involves GADS method invocation using reflection | 455 | 25 |
40,467 | private long [ ] getUsersListMembers ( String [ ] tUserlists ) { logger . debug ( "Fetching user id of given lists" ) ; List < Long > listUserIdToFollow = new ArrayList < Long > ( ) ; Configuration cb = buildTwitterConfiguration ( ) ; Twitter twitterImpl = new TwitterFactory ( cb ) . getInstance ( ) ; //For each list g... | Get users id of each list to stream them . | 330 | 10 |
40,468 | private Configuration buildTwitterConfiguration ( ) { logger . debug ( "creating twitter configuration" ) ; ConfigurationBuilder cb = new ConfigurationBuilder ( ) ; cb . setOAuthConsumerKey ( oauthConsumerKey ) . setOAuthConsumerSecret ( oauthConsumerSecret ) . setOAuthAccessToken ( oauthAccessToken ) . setOAuthAccessT... | Build configuration object with credentials and proxy settings | 201 | 8 |
40,469 | private void startTwitterStream ( ) { logger . info ( "starting {} twitter stream" , streamType ) ; if ( stream == null ) { logger . debug ( "creating twitter stream" ) ; stream = new TwitterStreamFactory ( buildTwitterConfiguration ( ) ) . getInstance ( ) ; if ( streamType . equals ( "user" ) ) { stream . addListener ... | Start twitter stream | 238 | 3 |
40,470 | @ Override public void insertArchive ( JarScriptArchive jarScriptArchive ) throws IOException { Objects . requireNonNull ( jarScriptArchive , "jarScriptArchive" ) ; ScriptModuleSpec moduleSpec = jarScriptArchive . getModuleSpec ( ) ; ModuleId moduleId = moduleSpec . getModuleId ( ) ; Path jarFilePath ; try { jarFilePat... | insert a Jar into the script archive | 425 | 7 |
40,471 | @ Override public void deleteArchive ( ModuleId moduleId ) throws IOException { Objects . requireNonNull ( moduleId , "moduleId" ) ; cassandra . deleteRow ( moduleId . toString ( ) ) ; } | Delete an archive by ID | 49 | 5 |
40,472 | protected Iterable < Row < String , String > > getRows ( EnumSet < ? > columns ) throws Exception { int shardCount = config . getShardCount ( ) ; List < Future < Rows < String , String > > > futures = new ArrayList < Future < Rows < String , String > > > ( ) ; for ( int i = 0 ; i < shardCount ; i ++ ) { futures . add (... | Get all of the rows in in the table . Attempts to reduce the load on cassandra by splitting up the query into smaller sub - queries | 196 | 29 |
40,473 | public static ScriptCompilerPluginSpec getCompilerSpec ( ) { Path groovyRuntimePath = ClassPathUtils . findRootPathForResource ( "META-INF/groovy-release-info.properties" , Groovy2PluginUtils . class . getClassLoader ( ) ) ; if ( groovyRuntimePath == null ) { throw new IllegalStateException ( "couldn't find groovy-all.... | Helper method to orchestrate commonly required setup of nicobar - groovy2 and return a groovy2 compiler spec . | 297 | 24 |
40,474 | protected Path getModuleJarPath ( ModuleId moduleId ) { Path moduleJarPath = rootDir . resolve ( moduleId + ".jar" ) ; return moduleJarPath ; } | Translated a module id to an absolute path of the module jar | 37 | 13 |
40,475 | protected ModuleSpec createModuleSpec ( ScriptArchive archive , ModuleIdentifier moduleId , Map < ModuleId , ModuleIdentifier > moduleIdMap , Path moduleCompilationRoot ) throws ModuleLoadException { ScriptModuleSpec archiveSpec = archive . getModuleSpec ( ) ; // create the jboss module pre-cursor artifact ModuleSpec .... | Create a JBoss module spec for an about to be created script module . | 353 | 15 |
40,476 | protected void compileModule ( Module module , Path moduleCompilationRoot ) throws ScriptCompilationException , IOException { // compile the script archive for the module, and inject the resultant classes into // the ModuleClassLoader ModuleClassLoader moduleClassLoader = module . getClassLoader ( ) ; if ( moduleClassL... | Compiles and links the scripts within the module by locating the correct compiler and delegating the compilation . the classes will be loaded into the module s classloader upon completion . | 211 | 34 |
40,477 | public synchronized void addCompilerPlugin ( ScriptCompilerPluginSpec pluginSpec ) throws ModuleLoadException { Objects . requireNonNull ( pluginSpec , "pluginSpec" ) ; ModuleIdentifier pluginModuleId = JBossModuleUtils . getPluginModuleId ( pluginSpec ) ; ModuleSpec . Builder moduleSpecBuilder = ModuleSpec . build ( p... | Add a language plugin to this module | 462 | 7 |
40,478 | public synchronized void removeScriptModule ( ModuleId scriptModuleId ) { jbossModuleLoader . unloadAllModuleRevision ( scriptModuleId . toString ( ) ) ; ScriptModule oldScriptModule = loadedScriptModules . remove ( scriptModuleId ) ; if ( oldScriptModule != null ) { notifyModuleUpdate ( null , oldScriptModule ) ; } } | Remove a module from being served by this instance . Note that any instances of the module cached outside of this module loader will remain un - effected and will continue to operate . | 76 | 34 |
40,479 | public void addListeners ( Set < ScriptModuleListener > listeners ) { Objects . requireNonNull ( listeners ) ; this . listeners . addAll ( listeners ) ; } | Add listeners to this module loader . Listeners will only be notified of events that occurred after they were added . | 35 | 22 |
40,480 | protected List < ScriptArchiveCompiler > findCompilers ( ScriptArchive archive ) { List < ScriptArchiveCompiler > candidateCompilers = new ArrayList < ScriptArchiveCompiler > ( ) ; for ( ScriptArchiveCompiler compiler : compilers ) { if ( compiler . shouldCompile ( archive ) ) { candidateCompilers . add ( compiler ) ; ... | Select a set of compilers to compile this archive . | 86 | 11 |
40,481 | public static Path createModulePath ( ModuleIdentifier moduleIdentifier ) { return Paths . get ( moduleIdentifier . getName ( ) + "-" + moduleIdentifier . getSlot ( ) ) ; } | Create module path from module moduleIdentifier . | 44 | 9 |
40,482 | public static Set < Class < ? > > findAssignableClasses ( ScriptModule module , Class < ? > targetClass ) { Set < Class < ? > > result = new LinkedHashSet < Class < ? > > ( ) ; for ( Class < ? > candidateClass : module . getLoadedClasses ( ) ) { if ( targetClass . isAssignableFrom ( candidateClass ) ) { result . add ( ... | Find all of the classes in the module that are subclasses or equal to the target class | 101 | 18 |
40,483 | @ Nullable public static Class < ? > findAssignableClass ( ScriptModule module , Class < ? > targetClass ) { for ( Class < ? > candidateClass : module . getLoadedClasses ( ) ) { if ( targetClass . isAssignableFrom ( candidateClass ) ) { return candidateClass ; } } return null ; } | Find the first class in the module that is a subclasses or equal to the target class | 73 | 18 |
40,484 | @ Nullable public static Class < ? > findClass ( ScriptModule module , String className ) { Set < Class < ? > > classes = module . getLoadedClasses ( ) ; Class < ? > targetClass = null ; for ( Class < ? > clazz : classes ) { if ( clazz . getName ( ) . equals ( className ) ) { targetClass = clazz ; break ; } } return ta... | Find a class in the module that matches the given className | 93 | 12 |
40,485 | public List < V > executeModules ( List < String > moduleIds , ScriptModuleExecutable < V > executable , ScriptModuleLoader moduleLoader ) { Objects . requireNonNull ( moduleIds , "moduleIds" ) ; Objects . requireNonNull ( executable , "executable" ) ; Objects . requireNonNull ( moduleLoader , "moduleLoader" ) ; List <... | Execute a collection of ScriptModules identified by moduleId . | 162 | 13 |
40,486 | public List < V > executeModules ( List < ScriptModule > modules , ScriptModuleExecutable < V > executable ) { Objects . requireNonNull ( modules , "modules" ) ; Objects . requireNonNull ( executable , "executable" ) ; List < Future < V > > futureResults = new ArrayList < Future < V > > ( modules . size ( ) ) ; for ( S... | Execute a collection of modules . | 346 | 7 |
40,487 | @ Nullable public ExecutionStatistics getModuleStatistics ( ModuleId moduleId ) { ExecutionStatistics moduleStats = statistics . get ( moduleId ) ; return moduleStats ; } | Get the statistics for the given moduleId | 34 | 8 |
40,488 | protected ExecutionStatistics getOrCreateModuleStatistics ( ModuleId moduleId ) { ExecutionStatistics moduleStats = statistics . get ( moduleId ) ; if ( moduleStats == null ) { moduleStats = new ExecutionStatistics ( ) ; ExecutionStatistics existing = statistics . put ( moduleId , moduleStats ) ; if ( existing != null ... | Helper method to get or create a ExecutionStatistics instance | 79 | 10 |
40,489 | @ GET @ Path ( "/repositorysummaries" ) public List < RepositorySummary > getRepositorySummaries ( ) { List < RepositorySummary > result = new ArrayList < RepositorySummary > ( repositories . size ( ) ) ; for ( String repositoryId : repositories . keySet ( ) ) { RepositorySummary repositorySummary = getScriptRepo ( rep... | Get a list of all of the repository summaries | 103 | 10 |
40,490 | @ GET @ Path ( "/archivesummaries" ) public Map < String , List < ArchiveSummary > > getArchiveSummaries ( @ QueryParam ( "repositoryIds" ) Set < String > repositoryIds ) { if ( CollectionUtils . isEmpty ( repositoryIds ) ) { repositoryIds = repositories . keySet ( ) ; } Map < String , List < ArchiveSummary > > result ... | Get a map of summaries from different repositories . | 161 | 10 |
40,491 | public static < V > void swapVertices ( DirectedGraph < V , DefaultEdge > graph , Map < V , Set < V > > alternates ) { Objects . requireNonNull ( graph , "graph" ) ; Objects . requireNonNull ( alternates , "alternates" ) ; // add all of the new vertices to prep for linking addAllVertices ( graph , alternates . keySet (... | replace the vertices in the graph with an alternate set of vertices . | 312 | 15 |
40,492 | public static < V > void addAllVertices ( DirectedGraph < V , DefaultEdge > graph , Set < V > vertices ) { // add all of the new vertices to prep for linking for ( V vertex : vertices ) { graph . addVertex ( vertex ) ; } } | Add all of the vertices to the graph without any edges . If the the graph already contains any one of the vertices that vertex is not added . | 62 | 31 |
40,493 | public static < V > Set < V > getIncomingVertices ( DirectedGraph < V , DefaultEdge > graph , V target ) { Set < DefaultEdge > edges = graph . incomingEdgesOf ( target ) ; Set < V > sources = new LinkedHashSet < V > ( ) ; for ( DefaultEdge edge : edges ) { sources . add ( graph . getEdgeSource ( edge ) ) ; } return sou... | Fetch all of the dependents of the given target vertex | 92 | 12 |
40,494 | public static < V > Set < V > getOutgoingVertices ( DirectedGraph < V , DefaultEdge > graph , V source ) { Set < DefaultEdge > edges = graph . outgoingEdgesOf ( source ) ; Set < V > targets = new LinkedHashSet < V > ( ) ; for ( DefaultEdge edge : edges ) { targets . add ( graph . getEdgeTarget ( edge ) ) ; } return tar... | Fetch all of the dependencies of the given source vertex | 92 | 11 |
40,495 | public static < V > void copyGraph ( DirectedGraph < V , DefaultEdge > sourceGraph , DirectedGraph < V , DefaultEdge > targetGraph ) { addAllVertices ( targetGraph , sourceGraph . vertexSet ( ) ) ; for ( DefaultEdge edge : sourceGraph . edgeSet ( ) ) { targetGraph . addEdge ( sourceGraph . getEdgeSource ( edge ) , sour... | Copy the source graph into the target graph | 95 | 8 |
40,496 | public static < V > Set < V > getLeafVertices ( DirectedGraph < V , DefaultEdge > graph ) { Set < V > vertexSet = graph . vertexSet ( ) ; Set < V > leaves = new HashSet < V > ( vertexSet . size ( ) * 2 ) ; for ( V vertex : vertexSet ) { if ( graph . outgoingEdgesOf ( vertex ) . isEmpty ( ) ) { leaves . add ( vertex ) ;... | Find the leave vertices in the graph . I . E . Vertices that have no outgoing edges | 104 | 20 |
40,497 | public static < V > void removeVertices ( DirectedGraph < V , DefaultEdge > graph , Set < V > vertices ) { for ( V vertex : vertices ) { if ( graph . containsVertex ( vertex ) ) { graph . removeVertex ( vertex ) ; } } } | Removes vertices from graph | 62 | 6 |
40,498 | @ Nullable public static Path findRootPathForResource ( String resourceName , ClassLoader classLoader ) { Objects . requireNonNull ( resourceName , "resourceName" ) ; Objects . requireNonNull ( classLoader , "classLoader" ) ; URL resource = classLoader . getResource ( resourceName ) ; if ( resource != null ) { String p... | Find the root path for the given resource . If the resource is found in a Jar file then the result will be an absolute path to the jar file . If the resource is found in a directory then the result will be the parent path of the given resource . | 158 | 52 |
40,499 | @ Nullable public static Path findRootPathForClass ( Class < ? > clazz ) { Objects . requireNonNull ( clazz , "resourceName" ) ; String resourceName = classToResourceName ( clazz ) ; return findRootPathForResource ( resourceName , clazz . getClassLoader ( ) ) ; } | Find the root path for the given class . If the class is found in a Jar file then the result will be an absolute path to the jar file . If the resource is found in a directory then the result will be the parent path of the given resource . | 69 | 52 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.