signature:
public class Venmo { /** * Launches an { @ link Intent } pointing to the Venmo app on the Google Play Store
 * @ param fragment used to open the Venmo ' s Google Play Store */
public static void openVenmoAppPageInGooglePlay ( BraintreeFragment fragment ) { } }

implementation: fragment . sendAnalyticsEvent ( "android.pay-with-venmo.app-store.invoked" ) ; Intent intent = new Intent ( Intent . ACTION_VIEW ) ; intent . setData ( Uri . parse ( "https://play.google.com/store/apps/details?id=" + PACKAGE_NAME ) ) ; fragment . startActivity ( intent ) ;


signature:
public class Venmo { /** * Start the Pay With Venmo flow . This will app switch to the Venmo app .
 * If the Venmo app is not available , { @ link AppSwitchNotAvailableException } will be sent to { @ link
 * com . braintreepayments . api . interfaces . BraintreeErrorListener # onError ( Exception ) } .
 * @ param fragment { @ link BraintreeFragment }
 * @ param vault If true , and you are using Client Token authorization with a customer ID , this payment method will
 * be added to your customer ' s vault . @ see < a href = " https : / / developers . braintreepayments . com / guides / authorization / overview " > our
 * docs on client authorization < / a > for more info .
 * @ param profileId The Venmo profile ID to be used during payment authorization . Customers will see the business
 * name and logo associated with this Venmo profile , and it will show up in the Venmo app as a " Connected Merchant " .
 * Venmo profile IDs can be found in the Braintree Control Panel . Passing ` null ` will use the default Venmo profile . */
public static void authorizeAccount ( final BraintreeFragment fragment , final boolean vault , final String profileId ) { } }

implementation: fragment . waitForConfiguration ( new ConfigurationListener ( ) { @ Override public void onConfigurationFetched ( Configuration configuration ) { fragment . sendAnalyticsEvent ( "pay-with-venmo.selected" ) ; String venmoProfileId = profileId ; if ( TextUtils . isEmpty ( venmoProfileId ) ) { venmoProfileId = configuration . getPayWithVenmo ( ) . getMerchantId ( ) ; } String exceptionMessage = "" ; if ( ! configuration . getPayWithVenmo ( ) . isAccessTokenValid ( ) ) { exceptionMessage = "Venmo is not enabled" ; } else if ( ! Venmo . isVenmoInstalled ( fragment . getApplicationContext ( ) ) ) { exceptionMessage = "Venmo is not installed" ; } if ( ! TextUtils . isEmpty ( exceptionMessage ) ) { fragment . postCallback ( new AppSwitchNotAvailableException ( exceptionMessage ) ) ; fragment . sendAnalyticsEvent ( "pay-with-venmo.app-switch.failed" ) ; } else { persistVenmoVaultOption ( vault && fragment . getAuthorization ( ) instanceof ClientToken , fragment . getApplicationContext ( ) ) ; fragment . startActivityForResult ( getLaunchIntent ( configuration . getPayWithVenmo ( ) , venmoProfileId , fragment ) , BraintreeRequestCodes . VENMO ) ; fragment . sendAnalyticsEvent ( "pay-with-venmo.app-switch.started" ) ; } } } ) ;


signature:
public class CardConfiguration { /** * Parse a { @ link CardConfiguration } from json .
 * @ param json The { @ link JSONObject } to parse .
 * @ return a { @ link CardConfiguration } instance with the data that was able to be parsed from the { @ link JSONObject } . */
public static CardConfiguration fromJson ( JSONObject json ) { } }

implementation: if ( json == null ) { json = new JSONObject ( ) ; } CardConfiguration cardConfiguration = new CardConfiguration ( ) ; JSONArray jsonArray = json . optJSONArray ( SUPPORTED_CARD_TYPES_KEY ) ; if ( jsonArray != null ) { for ( int i = 0 ; i < jsonArray . length ( ) ; i ++ ) { cardConfiguration . mSupportedCardTypes . add ( jsonArray . optString ( i , "" ) ) ; } } cardConfiguration . mCollectFraudData = json . optBoolean ( COLLECT_DEVICE_DATA_KEY , false ) ; return cardConfiguration ;


signature:
public class AmericanExpress { /** * Gets the rewards balance associated with a Braintree nonce . Only for American Express cards .
 * @ param fragment the { @ link BraintreeFragment } This fragment will also be responsible
 * for handling callbacks to it ' s listeners
 * @ param nonce A nonce representing a card that will be used to look up the rewards balance
 * @ param currencyIsoCode The currencyIsoCode to use . Example : ' USD ' */
public static void getRewardsBalance ( final BraintreeFragment fragment , final String nonce , final String currencyIsoCode ) { } }

implementation: fragment . waitForConfiguration ( new ConfigurationListener ( ) { @ Override public void onConfigurationFetched ( Configuration configuration ) { String getRewardsBalanceUrl = Uri . parse ( AMEX_REWARDS_BALANCE_PATH ) . buildUpon ( ) . appendQueryParameter ( "paymentMethodNonce" , nonce ) . appendQueryParameter ( "currencyIsoCode" , currencyIsoCode ) . build ( ) . toString ( ) ; fragment . sendAnalyticsEvent ( "amex.rewards-balance.start" ) ; fragment . getHttpClient ( ) . get ( getRewardsBalanceUrl , new HttpResponseCallback ( ) { @ Override public void success ( String responseBody ) { fragment . sendAnalyticsEvent ( "amex.rewards-balance.success" ) ; try { fragment . postAmericanExpressCallback ( AmericanExpressRewardsBalance . fromJson ( responseBody ) ) ; } catch ( JSONException e ) { fragment . sendAnalyticsEvent ( "amex.rewards-balance.parse.failed" ) ; fragment . postCallback ( e ) ; } } @ Override public void failure ( Exception exception ) { fragment . postCallback ( exception ) ; fragment . sendAnalyticsEvent ( "amex.rewards-balance.error" ) ; } } ) ; } } ) ;


signature:
public class PayPalPaymentResource { /** * Create a PayPalPaymentResource from a jsonString . Checks for keys associated with
 * Single Payment and Billing Agreement flows .
 * @ param jsonString a valid JSON string representing the payment resource
 * @ return a PayPal payment resource
 * @ throws JSONException */
public static PayPalPaymentResource fromJson ( String jsonString ) throws JSONException { } }

implementation: JSONObject json = new JSONObject ( jsonString ) ; PayPalPaymentResource payPalPaymentResource = new PayPalPaymentResource ( ) ; JSONObject redirectJson = json . optJSONObject ( PAYMENT_RESOURCE_KEY ) ; if ( redirectJson != null ) { payPalPaymentResource . redirectUrl ( Json . optString ( redirectJson , REDIRECT_URL_KEY , "" ) ) ; } else { redirectJson = json . optJSONObject ( AGREEMENT_SETUP_KEY ) ; payPalPaymentResource . redirectUrl ( Json . optString ( redirectJson , APPROVAL_URL_KEY , "" ) ) ; } return payPalPaymentResource ;


signature:
public class BraintreeHttpClient { /** * Make a HTTP GET request to Braintree using the base url , path and authorization provided .
 * If the path is a full url , it will be used instead of the previously provided url .
 * @ param path The path or url to request from the server via GET
 * @ param callback The { @ link HttpResponseCallback } to receive the response or error . */
@ Override public void get ( String path , HttpResponseCallback callback ) { } }

implementation: if ( path == null ) { postCallbackOnMainThread ( callback , new IllegalArgumentException ( "Path cannot be null" ) ) ; return ; } Uri uri ; if ( path . startsWith ( "http" ) ) { uri = Uri . parse ( path ) ; } else { uri = Uri . parse ( mBaseUrl + path ) ; } if ( mAuthorization instanceof ClientToken ) { uri = uri . buildUpon ( ) . appendQueryParameter ( AUTHORIZATION_FINGERPRINT_KEY , ( ( ClientToken ) mAuthorization ) . getAuthorizationFingerprint ( ) ) . build ( ) ; } super . get ( uri . toString ( ) , callback ) ;


signature:
public class BraintreeHttpClient { /** * Make a HTTP POST request to Braintree using the base url , path and authorization provided .
 * If the path is a full url , it will be used instead of the previously provided url .
 * @ param path The path or url to request from the server via HTTP POST
 * @ param data The body of the POST request
 * @ param callback The { @ link HttpResponseCallback } to receive the response or error . */
@ Override public void post ( String path , String data , HttpResponseCallback callback ) { } }

implementation: try { if ( mAuthorization instanceof ClientToken ) { data = new JSONObject ( data ) . put ( AUTHORIZATION_FINGERPRINT_KEY , ( ( ClientToken ) mAuthorization ) . getAuthorizationFingerprint ( ) ) . toString ( ) ; } super . post ( path , data , callback ) ; } catch ( JSONException e ) { postCallbackOnMainThread ( callback , e ) ; }


signature:
public class BraintreeHttpClient { /** * Makes a synchronous HTTP POST request to Braintree using the base url , path , and authorization provided .
 * @ see BraintreeHttpClient # post ( String , String , HttpResponseCallback )
 * @ param path the path or url to request from the server via HTTP POST
 * @ param data the body of the post request
 * @ return the HTTP response body */
public String post ( String path , String data ) throws Exception { } }

implementation: if ( mAuthorization instanceof ClientToken ) { data = new JSONObject ( data ) . put ( AUTHORIZATION_FINGERPRINT_KEY , ( ( ClientToken ) mAuthorization ) . getAuthorizationFingerprint ( ) ) . toString ( ) ; } return super . post ( path , data ) ;


signature:
public class VenmoConfiguration { /** * Parses the Venmo configuration from json .
 * @ param json The json to parse .
 * @ return A { @ link VenmoConfiguration } instance with data that was able to be parsed from the
 * { @ link JSONObject } . */
static VenmoConfiguration fromJson ( JSONObject json ) { } }

implementation: if ( json == null ) { json = new JSONObject ( ) ; } VenmoConfiguration venmoConfiguration = new VenmoConfiguration ( ) ; venmoConfiguration . mAccessToken = Json . optString ( json , ACCESS_TOKEN_KEY , "" ) ; venmoConfiguration . mEnvironment = Json . optString ( json , ENVIRONMENT_KEY , "" ) ; venmoConfiguration . mMerchantId = Json . optString ( json , MERCHANT_ID_KEY , "" ) ; return venmoConfiguration ;


signature:
public class ThreeDSecureAuthenticationResponse { /** * Used to parse a response from the Braintree Gateway to be used for 3D Secure .
 * @ param jsonString The json response from the Braintree Gateway 3D Secure authentication route .
 * @ return The { @ link ThreeDSecureAuthenticationResponse } to use when performing 3D Secure
 * authentication . */
public static ThreeDSecureAuthenticationResponse fromJson ( String jsonString ) { } }

implementation: ThreeDSecureAuthenticationResponse authenticationResponse = new ThreeDSecureAuthenticationResponse ( ) ; try { JSONObject json = new JSONObject ( jsonString ) ; JSONObject cardJson = json . optJSONObject ( PAYMENT_METHOD_KEY ) ; if ( cardJson != null ) { CardNonce cardNonce = new CardNonce ( ) ; cardNonce . fromJson ( cardJson ) ; authenticationResponse . mCardNonce = cardNonce ; } authenticationResponse . mSuccess = json . getBoolean ( SUCCESS_KEY ) ; if ( ! authenticationResponse . mSuccess ) { authenticationResponse . mErrors = jsonString ; } } catch ( JSONException e ) { authenticationResponse . mSuccess = false ; } return authenticationResponse ;


signature:
public class DataCollector { /** * Collect device information for fraud identification purposes .
 * @ param fragment { @ link BraintreeFragment }
 * @ param listener to be called with the device data String to send to Braintree . */
public static void collectDeviceData ( BraintreeFragment fragment , BraintreeResponseListener < String > listener ) { } }

implementation: collectDeviceData ( fragment , null , listener ) ;


signature:
public class DataCollector { /** * Collect device information for fraud identification purposes . This should be used in conjunction
 * with a non - aggregate fraud id .
 * @ param fragment { @ link BraintreeFragment }
 * @ param merchantId The fraud merchant id from Braintree .
 * @ param listener listener to be called with the device data String to send to Braintree . */
public static void collectDeviceData ( final BraintreeFragment fragment , final String merchantId , final BraintreeResponseListener < String > listener ) { } }

implementation: fragment . waitForConfiguration ( new ConfigurationListener ( ) { @ Override public void onConfigurationFetched ( Configuration configuration ) { final JSONObject deviceData = new JSONObject ( ) ; try { String clientMetadataId = getPayPalClientMetadataId ( fragment . getApplicationContext ( ) ) ; if ( ! TextUtils . isEmpty ( clientMetadataId ) ) { deviceData . put ( CORRELATION_ID_KEY , clientMetadataId ) ; } } catch ( JSONException ignored ) { } if ( configuration . getKount ( ) . isEnabled ( ) ) { final String id ; if ( merchantId != null ) { id = merchantId ; } else { id = configuration . getKount ( ) . getKountMerchantId ( ) ; } try { final String deviceSessionId = UUIDHelper . getFormattedUUID ( ) ; startDeviceCollector ( fragment , id , deviceSessionId , new BraintreeResponseListener < String > ( ) { @ Override public void onResponse ( String sessionId ) { try { deviceData . put ( DEVICE_SESSION_ID_KEY , deviceSessionId ) ; deviceData . put ( FRAUD_MERCHANT_ID_KEY , id ) ; } catch ( JSONException ignored ) { } listener . onResponse ( deviceData . toString ( ) ) ; } } ) ; } catch ( ClassNotFoundException | NoClassDefFoundError | NumberFormatException ignored ) { listener . onResponse ( deviceData . toString ( ) ) ; } } else { listener . onResponse ( deviceData . toString ( ) ) ; } } } ) ;


signature:
public class DataCollector { /** * Collect PayPal device information for fraud identification purposes .
 * @ param fragment { @ link BraintreeFragment }
 * @ param listener listener to be called with the device data String to send to Braintree . */
public static void collectPayPalDeviceData ( final BraintreeFragment fragment , final BraintreeResponseListener < String > listener ) { } }

implementation: final JSONObject deviceData = new JSONObject ( ) ; try { String clientMetadataId = getPayPalClientMetadataId ( fragment . getApplicationContext ( ) ) ; if ( ! TextUtils . isEmpty ( clientMetadataId ) ) { deviceData . put ( CORRELATION_ID_KEY , clientMetadataId ) ; } } catch ( JSONException ignored ) { } listener . onResponse ( deviceData . toString ( ) ) ;


signature:
public class DataCollector { /** * Collect device information for fraud identification purposes from PayPal only .
 * @ param context A valid { @ link Context }
 * @ return The client metadata id associated with the collected data . */
public static String getPayPalClientMetadataId ( Context context ) { } }

implementation: try { return PayPalOneTouchCore . getClientMetadataId ( context ) ; } catch ( NoClassDefFoundError ignored ) { } try { return PayPalDataCollector . getClientMetadataId ( context ) ; } catch ( NoClassDefFoundError ignored ) { } return "" ;


signature:
public class SignatureVerification { /** * Check if an app has the correct , matching , signature . Used to prevent malicious apps from
 * impersonating other apps .
 * @ param context
 * @ param packageName the package name of the app to verify .
 * @ param certificateSubject the expected certificate subject of the app .
 * @ param certificateIssuer the expected certificate issuer of the app .
 * @ param publicKeyHashCode the hash code of the app ' s public key .
 * @ return true is signature is valid or signature verification has been disabled . */
@ SuppressLint ( "PackageManagerGetSignatures" ) public static boolean isSignatureValid ( Context context , String packageName , String certificateSubject , String certificateIssuer , int publicKeyHashCode ) { } }

implementation: if ( ! sEnableSignatureVerification ) { return true ; } PackageManager packageManager = context . getPackageManager ( ) ; Signature [ ] signatures ; try { signatures = packageManager . getPackageInfo ( packageName , PackageManager . GET_SIGNATURES ) . signatures ; } catch ( NameNotFoundException e ) { return false ; } InputStream certStream = null ; boolean validated = ( signatures . length != 0 ) ; for ( Signature signature : signatures ) { try { certStream = new ByteArrayInputStream ( signature . toByteArray ( ) ) ; X509Certificate x509Cert = ( X509Certificate ) CertificateFactory . getInstance ( "X509" ) . generateCertificate ( certStream ) ; String subject = x509Cert . getSubjectX500Principal ( ) . getName ( ) ; String issuer = x509Cert . getIssuerX500Principal ( ) . getName ( ) ; int actualPublicKeyHashCode = x509Cert . getPublicKey ( ) . hashCode ( ) ; validated &= ( certificateSubject . equals ( subject ) && certificateIssuer . equals ( issuer ) && publicKeyHashCode == actualPublicKeyHashCode ) ; if ( ! validated ) { return false ; } } catch ( CertificateException e ) { return false ; } finally { try { if ( certStream != null ) { certStream . close ( ) ; } } catch ( IOException ignored ) { } } } return validated ;


signature:
public class PaymentMethod { /** * Retrieves the current list of { @ link PaymentMethodNonce } s for the current customer .
 * When finished , the { @ link java . util . List } of { @ link PaymentMethodNonce } s will be sent to { @ link
 * PaymentMethodNoncesUpdatedListener # onPaymentMethodNoncesUpdated ( List ) } .
 * @ param fragment { @ link BraintreeFragment }
 * @ param defaultFirst when { @ code true } the customer ' s default payment method will be first in the list , otherwise
 * payment methods will be ordered my most recently used . */
public static void getPaymentMethodNonces ( final BraintreeFragment fragment , boolean defaultFirst ) { } }

implementation: final Uri uri = Uri . parse ( TokenizationClient . versionedPath ( TokenizationClient . PAYMENT_METHOD_ENDPOINT ) ) . buildUpon ( ) . appendQueryParameter ( "default_first" , String . valueOf ( defaultFirst ) ) . appendQueryParameter ( "session_id" , fragment . getSessionId ( ) ) . build ( ) ; fragment . waitForConfiguration ( new ConfigurationListener ( ) { @ Override public void onConfigurationFetched ( Configuration configuration ) { fragment . getHttpClient ( ) . get ( uri . toString ( ) , new HttpResponseCallback ( ) { @ Override public void success ( String responseBody ) { try { fragment . postCallback ( PaymentMethodNonce . parsePaymentMethodNonces ( responseBody ) ) ; fragment . sendAnalyticsEvent ( "get-payment-methods.succeeded" ) ; } catch ( JSONException e ) { fragment . postCallback ( e ) ; fragment . sendAnalyticsEvent ( "get-payment-methods.failed" ) ; } } @ Override public void failure ( Exception exception ) { fragment . postCallback ( exception ) ; fragment . sendAnalyticsEvent ( "get-payment-methods.failed" ) ; } } ) ; } } ) ;


signature:
public class PaymentMethod { /** * Deletes a payment method owned by the customer whose id was used to generate the { @ link ClientToken }
 * used to create the { @ link BraintreeFragment } .
 * Note : This method only works with Android Lollipop ( > = 21 ) and above .
 * This will invoke { @ link com . braintreepayments . api . interfaces . BraintreeErrorListener # onError ( Exception ) } when
 * < ul >
 * < li > A { @ link com . braintreepayments . api . models . TokenizationKey } is used . < / li >
 * < li > The device is below Lollipop . < / li >
 * < li > If the request fails . < / li >
 * < ul / >
 * @ param fragment { @ link BraintreeFragment }
 * @ param paymentMethodNonce The payment method nonce that references a vaulted payment method . */
public static void deletePaymentMethod ( final BraintreeFragment fragment , final PaymentMethodNonce paymentMethodNonce ) { } }

implementation: boolean usesClientToken = fragment . getAuthorization ( ) instanceof ClientToken ; if ( ! usesClientToken ) { fragment . postCallback ( new BraintreeException ( "A client token with a customer id must be used to delete a payment method nonce." ) ) ; return ; } JSONObject base = new JSONObject ( ) ; JSONObject variables = new JSONObject ( ) ; JSONObject input = new JSONObject ( ) ; try { base . put ( CLIENT_SDK_META_DATA , new MetadataBuilder ( ) . sessionId ( fragment . getSessionId ( ) ) . source ( "client" ) . integration ( fragment . getIntegrationType ( ) ) . build ( ) ) ; base . put ( GraphQLConstants . Keys . QUERY , GraphQLQueryHelper . getQuery ( fragment . getApplicationContext ( ) , R . raw . delete_payment_method_mutation ) ) ; input . put ( SINGLE_USE_TOKEN_ID , paymentMethodNonce . getNonce ( ) ) ; variables . put ( INPUT , input ) ; base . put ( VARIABLES , variables ) ; base . put ( GraphQLConstants . Keys . OPERATION_NAME , "DeletePaymentMethodFromSingleUseToken" ) ; } catch ( Resources . NotFoundException | IOException | JSONException e ) { fragment . postCallback ( new BraintreeException ( "Unable to read GraphQL query" ) ) ; } fragment . getGraphQLHttpClient ( ) . post ( base . toString ( ) , new HttpResponseCallback ( ) { @ Override public void success ( String responseBody ) { fragment . postPaymentMethodDeletedCallback ( paymentMethodNonce ) ; fragment . sendAnalyticsEvent ( "delete-payment-methods.succeeded" ) ; } @ Override public void failure ( Exception exception ) { fragment . postCallback ( new PaymentMethodDeleteException ( paymentMethodNonce , exception ) ) ; fragment . sendAnalyticsEvent ( "delete-payment-methods.failed" ) ; } } ) ;


signature:
public class PayPalOneTouchCore { /** * Get a { @ link PendingRequest } containing an { @ link Intent } used to start a PayPal
 * authentication request using the best possible authentication mechanism : wallet or browser .
 * @ param context
 * @ param request the { @ link Request } used to build the { @ link Intent } .
 * @ return { @ link PendingRequest } . { @ link PendingRequest # isSuccess ( ) } should be
 * checked before attempting to use the { @ link Intent } it contains . If { @ code true } an
 * { @ link Intent } was created and can be used to start a PayPal authentication request .
 * If { @ code false } it is not possible to authenticate given the current environment
 * and request . */
public static PendingRequest getStartIntent ( Context context , Request request ) { } }

implementation:
initService ( context ) ; // calling this method functionally does nothing , but ensures that we send off FPTI data about wallet installs .
isWalletAppInstalled ( context ) ; Recipe recipe = request . getRecipeToExecute ( context , sConfigManager . getConfig ( ) ) ; if ( recipe == null ) { return new PendingRequest ( false , null , null , null ) ; } if ( RequestTarget . wallet == recipe . getTarget ( ) ) { request . trackFpti ( context , TrackingPoint . SwitchToWallet , recipe . getProtocol ( ) ) ; return new PendingRequest ( true , RequestTarget . wallet , request . getClientMetadataId ( ) , AppSwitchHelper . getAppSwitchIntent ( sContextInspector , sConfigManager , request , recipe ) ) ; } else { Intent intent = BrowserSwitchHelper . getBrowserSwitchIntent ( sContextInspector , sConfigManager , request ) ; if ( intent != null ) { return new PendingRequest ( true , RequestTarget . browser , request . getClientMetadataId ( ) , intent ) ; } else { return new PendingRequest ( false , RequestTarget . browser , request . getClientMetadataId ( ) , null ) ; } }


signature:
public class PayPalOneTouchCore { /** * Gets a { @ link Result } from an { @ link Intent } returned by either the PayPal Wallet app or
 * the browser .
 * @ param context
 * @ param request the original { @ link Request } that was used to get this { @ link Result } .
 * @ param data the { @ link Intent } returned by either the PayPal Wallet app or the browser .
 * @ return { @ link Result } */
public static Result parseResponse ( Context context , Request request , Intent data ) { } }

implementation: initService ( context ) ; if ( data != null && data . getData ( ) != null ) { return BrowserSwitchHelper . parseBrowserSwitchResponse ( sContextInspector , request , data . getData ( ) ) ; } else if ( data != null && data . getExtras ( ) != null && ! data . getExtras ( ) . isEmpty ( ) ) { return AppSwitchHelper . parseAppSwitchResponse ( sContextInspector , request , data ) ; } else { request . trackFpti ( context , TrackingPoint . Cancel , null ) ; return new Result ( ) ; }


signature:
public class PayPalOneTouchCore { /** * Gets a Client Metadata ID at the time of payment activity . Once a user initiates a PayPal payment
 * from their device , PayPal uses the Client Metadata ID to verify that the payment is
 * originating from a valid , user - consented device and application . This helps reduce fraud and
 * decrease declines . This method MUST be called prior to initiating a pre - consented payment ( a
 * " future payment " ) from a mobile device . Pass the result to your server , to include in the
 * payment request sent to PayPal . Do not otherwise cache or store this value .
 * @ param context The application context
 * @ param pairingId The desired pairing id
 * @ return clientMetadataId Your server will send this to PayPal */
@ MainThread public static String getClientMetadataId ( Context context , String pairingId ) { } }

implementation: return PayPalDataCollector . getClientMetadataId ( context , pairingId ) ;


signature:
public class ThreeDSecure { /** * Verification is associated with a transaction amount and your merchant account . To specify a
 * different merchant account ( or , in turn , currency ) , you will need to specify the merchant
 * account id when < a href = " https : / / developers . braintreepayments . com / android / sdk / overview / generate - client - token " >
 * generating a client token < / a >
 * During lookup the original payment method nonce is consumed and a new one is returned ,
 * which points to the original payment method , as well as the 3D Secure verification .
 * Transactions created with this nonce will be 3D Secure , and benefit from the appropriate
 * liability shift if authentication is successful or fail with a 3D Secure failure .
 * @ param fragment the { @ link BraintreeFragment } backing the http request . This fragment will
 * also be responsible for handling callbacks to it ' s listeners
 * @ param cardBuilder The cardBuilder created from raw details . Will be tokenized before
 * the 3D Secure verification if performed .
 * @ param amount The amount of the transaction in the current merchant account ' s currency */
public static void performVerification ( final BraintreeFragment fragment , final CardBuilder cardBuilder , final String amount ) { } }

implementation: TokenizationClient . tokenize ( fragment , cardBuilder , new PaymentMethodNonceCallback ( ) { @ Override public void success ( PaymentMethodNonce paymentMethodNonce ) { performVerification ( fragment , paymentMethodNonce . getNonce ( ) , amount ) ; } @ Override public void failure ( Exception exception ) { fragment . postCallback ( exception ) ; } } ) ;


signature:
public class ThreeDSecure { /** * Verification is associated with a transaction amount and your merchant account . To specify a
 * different merchant account ( or , in turn , currency ) , you will need to specify the merchant
 * account id when < a href = " https : / / developers . braintreepayments . com / android / sdk / overview / generate - client - token " >
 * generating a client token < / a >
 * During lookup the original payment method nonce is consumed and a new one is returned ,
 * which points to the original payment method , as well as the 3D Secure verification .
 * Transactions created with this nonce will be 3D Secure , and benefit from the appropriate
 * liability shift if authentication is successful or fail with a 3D Secure failure .
 * @ param fragment the { @ link BraintreeFragment } backing the http request . This fragment will
 * also be responsible for handling callbacks to it ' s listeners
 * @ param nonce The nonce that represents a card to perform a 3D Secure verification against .
 * @ param amount The amount of the transaction in the current merchant account ' s currency . */
public static void performVerification ( final BraintreeFragment fragment , final String nonce , final String amount ) { } }

implementation: ThreeDSecureRequest request = new ThreeDSecureRequest ( ) . nonce ( nonce ) . amount ( amount ) ; performVerification ( fragment , request ) ;


signature:
public class ThreeDSecure { /** * Verification is associated with a transaction amount and your merchant account . To specify a
 * different merchant account ( or , in turn , currency ) , you will need to specify the merchant
 * account id when < a href = " https : / / developers . braintreepayments . com / android / sdk / overview / generate - client - token " >
 * generating a client token < / a >
 * During lookup the original payment method nonce is consumed and a new one is returned ,
 * which points to the original payment method , as well as the 3D Secure verification .
 * Transactions created with this nonce will be 3D Secure , and benefit from the appropriate
 * liability shift if authentication is successful or fail with a 3D Secure failure .
 * @ param fragment the { @ link BraintreeFragment } backing the http request . This fragment will
 * also be responsible for handling callbacks to it ' s listeners
 * @ param request the { @ link ThreeDSecureRequest } with information used for authentication . */
public static void performVerification ( final BraintreeFragment fragment , final ThreeDSecureRequest request ) { } }

implementation: if ( request . getAmount ( ) == null || request . getNonce ( ) == null ) { fragment . postCallback ( new InvalidArgumentException ( "The ThreeDSecureRequest nonce and amount cannot be null" ) ) ; return ; } fragment . waitForConfiguration ( new ConfigurationListener ( ) { @ Override public void onConfigurationFetched ( Configuration configuration ) { if ( ! configuration . isThreeDSecureEnabled ( ) ) { fragment . postCallback ( new BraintreeException ( "Three D Secure is not enabled in the control panel" ) ) ; return ; } final boolean supportsBrowserSwitch = ManifestValidator . isUrlSchemeDeclaredInAndroidManifest ( fragment . getApplicationContext ( ) , fragment . getReturnUrlScheme ( ) , BraintreeBrowserSwitchActivity . class ) ; if ( ! supportsBrowserSwitch ) { fragment . sendAnalyticsEvent ( "three-d-secure.invalid-manifest" ) ; fragment . postCallback ( new BraintreeException ( "BraintreeBrowserSwitchActivity missing, " + "incorrectly configured in AndroidManifest.xml or another app defines the same browser " + "switch url as this app. See " + "https://developers.braintreepayments.com/guides/client-sdk/android/v2#browser-switch " + "for the correct configuration" ) ) ; return ; } fragment . getHttpClient ( ) . post ( TokenizationClient . versionedPath ( TokenizationClient . PAYMENT_METHOD_ENDPOINT + "/" + request . getNonce ( ) + "/three_d_secure/lookup" ) , request . build ( ) , new HttpResponseCallback ( ) { @ Override public void success ( String responseBody ) { try { ThreeDSecureLookup threeDSecureLookup = ThreeDSecureLookup . fromJson ( responseBody ) ; if ( threeDSecureLookup . getAcsUrl ( ) != null ) { launchBrowserSwitch ( fragment , threeDSecureLookup ) ; } else { fragment . postCallback ( threeDSecureLookup . getCardNonce ( ) ) ; } } catch ( JSONException e ) { fragment . postCallback ( e ) ; } } @ Override public void failure ( Exception exception ) { fragment . postCallback ( exception ) ; } } ) ; } } ) ;


signature:
public class KountConfiguration { /** * Parse a { @ link KountConfiguration } from json .
 * @ param json The { @ link JSONObject } to parse .
 * @ return a { @ link KountConfiguration } instance with the data that was able to be parsed from
 * the { @ link JSONObject } . */
public static KountConfiguration fromJson ( JSONObject json ) { } }

implementation: if ( json == null ) { json = new JSONObject ( ) ; } KountConfiguration kountConfiguration = new KountConfiguration ( ) ; kountConfiguration . mKountMerchantId = Json . optString ( json , KOUNT_MERCHANT_ID_KEY , "" ) ; return kountConfiguration ;


signature:
public class Card { /** * Create a { @ link com . braintreepayments . api . models . CardNonce } .
 * On completion , returns the { @ link com . braintreepayments . api . models . PaymentMethodNonce } to
 * { @ link com . braintreepayments . api . interfaces . PaymentMethodNonceCreatedListener } .
 * If creation fails validation , { @ link com . braintreepayments . api . interfaces . BraintreeErrorListener # onError ( Exception ) }
 * will be called with the resulting { @ link com . braintreepayments . api . exceptions . ErrorWithResponse } .
 * If an error not due to validation ( server error , network issue , etc . ) occurs , { @ link
 * com . braintreepayments . api . interfaces . BraintreeErrorListener # onError ( Exception ) }
 * will be called with the { @ link Exception } that occurred .
 * @ param fragment { @ link BraintreeFragment }
 * @ param cardBuilder { @ link CardBuilder } */
public static void tokenize ( final BraintreeFragment fragment , final CardBuilder cardBuilder ) { } }

implementation: TokenizationClient . tokenize ( fragment , cardBuilder , new PaymentMethodNonceCallback ( ) { @ Override public void success ( PaymentMethodNonce paymentMethodNonce ) { DataCollector . collectRiskData ( fragment , paymentMethodNonce ) ; fragment . postCallback ( paymentMethodNonce ) ; fragment . sendAnalyticsEvent ( "card.nonce-received" ) ; } @ Override public void failure ( Exception exception ) { fragment . postCallback ( exception ) ; fragment . sendAnalyticsEvent ( "card.nonce-failed" ) ; } } ) ;


signature:
public class Json { /** * Returns the value mapped by name if it exists , coercing it if necessary , or fallback if no such mapping exists .
 * This is a work around for http : / / code . google . com / p / android / issues / detail ? id = 13830 returning " null " if the json
 * value is null .
 * @ param json
 * @ param name
 * @ param fallback
 * @ return { @ link String } */
public static String optString ( JSONObject json , String name , String fallback ) { } }

implementation: if ( json . isNull ( name ) ) { return fallback ; } else { return json . optString ( name , fallback ) ; }


signature:
public class PaymentMethodNonce { /** * Parses a response from the Braintree gateway for a list of payment method nonces .
 * @ param jsonBody Json - formatted String containing a list of { @ link PaymentMethodNonce } s
 * @ return List of { @ link PaymentMethodNonce } s contained in jsonBody
 * @ throws JSONException */
public static List < PaymentMethodNonce > parsePaymentMethodNonces ( String jsonBody ) throws JSONException { } }

implementation: JSONArray paymentMethods = new JSONObject ( jsonBody ) . getJSONArray ( PAYMENT_METHOD_NONCE_COLLECTION_KEY ) ; if ( paymentMethods == null ) { return Collections . emptyList ( ) ; } List < PaymentMethodNonce > paymentMethodsNonces = new ArrayList < > ( ) ; JSONObject json ; PaymentMethodNonce paymentMethodNonce ; for ( int i = 0 ; i < paymentMethods . length ( ) ; i ++ ) { json = paymentMethods . getJSONObject ( i ) ; paymentMethodNonce = parsePaymentMethodNonces ( json , json . getString ( PAYMENT_METHOD_TYPE_KEY ) ) ; if ( paymentMethodNonce != null ) { paymentMethodsNonces . add ( paymentMethodNonce ) ; } } return paymentMethodsNonces ;


signature:
public class PaymentMethodNonce { /** * Parses a { @ link PaymentMethodNonce } from json .
 * @ param json { @ link String } representation of a { @ link PaymentMethodNonce } .
 * @ param type The { @ link String } type of the { @ link PaymentMethodNonce } .
 * @ return { @ link PaymentMethodNonce }
 * @ throws JSONException */
@ Nullable public static PaymentMethodNonce parsePaymentMethodNonces ( String json , String type ) throws JSONException { } }

implementation: return parsePaymentMethodNonces ( new JSONObject ( json ) , type ) ;


signature:
public class PaymentMethodNonce { /** * Parses a { @ link PaymentMethodNonce } from json .
 * @ param json { @ link JSONObject } representation of a { @ link PaymentMethodNonce } .
 * @ param type The { @ link String } type of the { @ link PaymentMethodNonce } .
 * @ return { @ link PaymentMethodNonce }
 * @ throws JSONException */
@ Nullable public static PaymentMethodNonce parsePaymentMethodNonces ( JSONObject json , String type ) throws JSONException { } }

implementation: switch ( type ) { case CardNonce . TYPE : if ( json . has ( CardNonce . API_RESOURCE_KEY ) || json . has ( CardNonce . DATA_KEY ) ) { return CardNonce . fromJson ( json . toString ( ) ) ; } else { CardNonce cardNonce = new CardNonce ( ) ; cardNonce . fromJson ( json ) ; return cardNonce ; } case PayPalAccountNonce . TYPE : if ( json . has ( PayPalAccountNonce . API_RESOURCE_KEY ) ) { return PayPalAccountNonce . fromJson ( json . toString ( ) ) ; } else { PayPalAccountNonce payPalAccountNonce = new PayPalAccountNonce ( ) ; payPalAccountNonce . fromJson ( json ) ; return payPalAccountNonce ; } case VenmoAccountNonce . TYPE : if ( json . has ( VenmoAccountNonce . API_RESOURCE_KEY ) ) { return VenmoAccountNonce . fromJson ( json . toString ( ) ) ; } else { VenmoAccountNonce venmoAccountNonce = new VenmoAccountNonce ( ) ; venmoAccountNonce . fromJson ( json ) ; return venmoAccountNonce ; } case VisaCheckoutNonce . TYPE : if ( json . has ( VisaCheckoutNonce . API_RESOURCE_KEY ) ) { return VisaCheckoutNonce . fromJson ( json . toString ( ) ) ; } else { VisaCheckoutNonce visaCheckoutNonce = new VisaCheckoutNonce ( ) ; visaCheckoutNonce . fromJson ( json ) ; return visaCheckoutNonce ; } default : return null ; }


signature:
public class OAuth2Recipe { /** * 1 . Look for exact match of environment . ( Could be mock , live , or a particular host : port . ) 2.
 * If environment is anything other than mock or live , then look for develop . 3 . Look for live .
 * ( There should always be a live endpoint specified in any v3 browser - switch recipe . )
 * @ param environment
 * @ return */
public ConfigEndpoint getEndpoint ( String environment ) { } }

implementation:
ConfigEndpoint configEndpoint ; if ( mEndpoints . containsKey ( environment ) ) { configEndpoint = mEndpoints . get ( environment ) ; } else if ( mEndpoints . containsKey ( DEVELOP ) ) { configEndpoint = mEndpoints . get ( DEVELOP ) ; } else { // default to live as fallback
configEndpoint = mEndpoints . get ( EnvironmentManager . LIVE ) ; } return configEndpoint ;


signature:
public class Request { /** * Defines the host to be used in the cancellation url for browser switch ( the package name will
 * be used as the scheme ) */
@ SuppressWarnings ( "unchecked" ) public T cancelUrl ( String scheme , String host ) { } }

implementation: mCancelUrl = scheme + "://" + redirectURLHostAndPath ( ) + host ; return ( T ) this ;


signature:
public class Request { /** * Defines the host to be used in the success url for browser switch ( the package name will be
 * used as the scheme ) */
@ SuppressWarnings ( "unchecked" ) public T successUrl ( String scheme , String host ) { } }

implementation: mSuccessUrl = scheme + "://" + redirectURLHostAndPath ( ) + host ; return ( T ) this ;


signature:
public class OtcConfiguration { /** * Returns the browser recipe that can handle checkout , or null if there is none .
 * @ return */
public CheckoutRecipe getBrowserCheckoutConfig ( ) { } }

implementation: for ( CheckoutRecipe recipe : mCheckoutRecipesInDecreasingPriorityOrder ) { if ( recipe . getTarget ( ) == RequestTarget . browser ) { return recipe ; } } return null ;


signature:
public class OtcConfiguration { /** * Returns the browser recipe that can handle billing agreement , or null if there is none .
 * @ return */
public BillingAgreementRecipe getBrowserBillingAgreementConfig ( ) { } }

implementation: for ( BillingAgreementRecipe recipe : mBillingAgreementRecipesInDecreasingPriorityOrder ) { if ( recipe . getTarget ( ) == RequestTarget . browser ) { return recipe ; } } return null ;


signature:
public class CardNonce { /** * Convert an API response to a { @ link CardNonce } .
 * @ param json Raw JSON response from Braintree of a { @ link CardNonce } .
 * @ return { @ link CardNonce } .
 * @ throws JSONException when parsing the response fails . */
public static CardNonce fromJson ( String json ) throws JSONException { } }

implementation: CardNonce cardNonce = new CardNonce ( ) ; JSONObject jsonObject = new JSONObject ( json ) ; if ( jsonObject . has ( DATA_KEY ) ) { cardNonce . fromGraphQLJson ( jsonObject ) ; } else { cardNonce . fromJson ( CardNonce . getJsonObjectForType ( API_RESOURCE_KEY , jsonObject ) ) ; } return cardNonce ;


signature:
public class CardNonce { /** * Populate properties with values from a { @ link JSONObject } .
 * @ param json { @ link JSONObject }
 * @ throws JSONException when parsing fails . */
protected void fromJson ( JSONObject json ) throws JSONException { } }

implementation: super . fromJson ( json ) ; JSONObject details = json . getJSONObject ( CARD_DETAILS_KEY ) ; mLastTwo = details . getString ( LAST_TWO_KEY ) ; mLastFour = details . getString ( LAST_FOUR_KEY ) ; mCardType = details . getString ( CARD_TYPE_KEY ) ; mThreeDSecureInfo = ThreeDSecureInfo . fromJson ( json . optJSONObject ( THREE_D_SECURE_INFO_KEY ) ) ; mBinData = BinData . fromJson ( json . optJSONObject ( BIN_DATA_KEY ) ) ;


signature:
public class AnalyticsConfiguration { /** * Parse an { @ link AnalyticsConfiguration } from json .
 * @ param json The { @ link JSONObject } to parse .
 * @ return An { @ link AnalyticsConfiguration } instance with data that was able to be parsed from
 * the { @ link JSONObject } . */
public static AnalyticsConfiguration fromJson ( JSONObject json ) { } }

implementation: if ( json == null ) { json = new JSONObject ( ) ; } AnalyticsConfiguration analyticsConfiguration = new AnalyticsConfiguration ( ) ; analyticsConfiguration . mUrl = Json . optString ( json , URL_KEY , null ) ; return analyticsConfiguration ;


signature:
public class TokenizationClient { /** * Create a { @ link PaymentMethodNonce } in the Braintree Gateway .
 * On completion , returns the { @ link PaymentMethodNonce } to { @ link PaymentMethodNonceCallback } .
 * If creation fails validation , { @ link com . braintreepayments . api . interfaces . BraintreeErrorListener # onError ( Exception ) }
 * will be called with the resulting { @ link ErrorWithResponse } .
 * If an error not due to validation ( server error , network issue , etc . ) occurs , { @ link
 * com . braintreepayments . api . interfaces . BraintreeErrorListener # onError ( Exception ) } ( Throwable ) }
 * will be called with the { @ link Exception } that occurred .
 * @ param paymentMethodBuilder { @ link PaymentMethodBuilder } for the { @ link PaymentMethodNonce }
 * to be created . */
static void tokenize ( final BraintreeFragment fragment , final PaymentMethodBuilder paymentMethodBuilder , final PaymentMethodNonceCallback callback ) { } }

implementation: paymentMethodBuilder . setSessionId ( fragment . getSessionId ( ) ) ; fragment . waitForConfiguration ( new ConfigurationListener ( ) { @ Override public void onConfigurationFetched ( Configuration configuration ) { if ( paymentMethodBuilder instanceof CardBuilder && configuration . getGraphQL ( ) . isFeatureEnabled ( Features . TOKENIZE_CREDIT_CARDS ) ) { tokenizeGraphQL ( fragment , ( CardBuilder ) paymentMethodBuilder , callback ) ; } else { tokenizeRest ( fragment , paymentMethodBuilder , callback ) ; } } } ) ;


signature:
public class HttpClient { /** * Make a HTTP GET request to using the base url and path provided . If the path is a full url ,
 * it will be used instead of the previously provided base url .
 * @ param path The path or url to request from the server via GET
 * @ param callback The { @ link HttpResponseCallback } to receive the response or error . */
public void get ( final String path , final HttpResponseCallback callback ) { } }

implementation: if ( path == null ) { postCallbackOnMainThread ( callback , new IllegalArgumentException ( "Path cannot be null" ) ) ; return ; } final String url ; if ( path . startsWith ( "http" ) ) { url = path ; } else { url = mBaseUrl + path ; } mThreadPool . submit ( new Runnable ( ) { @ Override public void run ( ) { HttpURLConnection connection = null ; try { connection = init ( url ) ; connection . setRequestMethod ( METHOD_GET ) ; postCallbackOnMainThread ( callback , parseResponse ( connection ) ) ; } catch ( Exception e ) { postCallbackOnMainThread ( callback , e ) ; } finally { if ( connection != null ) { connection . disconnect ( ) ; } } } } ) ;


signature:
public class HttpClient { /** * Make a HTTP POST request using the base url and path provided . If the path is a full url ,
 * it will be used instead of the previously provided url .
 * @ param path The path or url to request from the server via HTTP POST
 * @ param data The body of the POST request
 * @ param callback The { @ link HttpResponseCallback } to receive the response or error . */
public void post ( final String path , final String data , final HttpResponseCallback callback ) { } }

implementation: if ( path == null ) { postCallbackOnMainThread ( callback , new IllegalArgumentException ( "Path cannot be null" ) ) ; return ; } mThreadPool . submit ( new Runnable ( ) { @ Override public void run ( ) { try { postCallbackOnMainThread ( callback , post ( path , data ) ) ; } catch ( Exception e ) { postCallbackOnMainThread ( callback , e ) ; } } } ) ;


signature:
public class HttpClient { /** * Performs a synchronous post request .
 * @ param path the path or url to request from the server via HTTP POST
 * @ param data the body of the post request
 * @ return The HTTP body the of the response
 * @ see HttpClient # post ( String , String , HttpResponseCallback )
 * @ throws Exception */
public String post ( String path , String data ) throws Exception { } }

implementation: HttpURLConnection connection = null ; try { if ( path . startsWith ( "http" ) ) { connection = init ( path ) ; } else { connection = init ( mBaseUrl + path ) ; } connection . setRequestProperty ( "Content-Type" , "application/json" ) ; connection . setRequestMethod ( METHOD_POST ) ; connection . setDoOutput ( true ) ; writeOutputStream ( connection . getOutputStream ( ) , data ) ; return parseResponse ( connection ) ; } finally { if ( connection != null ) { connection . disconnect ( ) ; } }


signature:
public class VisaCheckoutNonce { /** * Convert an API response to a { @ link VisaCheckoutNonce } .
 * @ param json Raw JSON response from Braintree of a { @ link VisaCheckoutNonce } .
 * @ return { @ link VisaCheckoutNonce } .
 * @ throws JSONException when parsing the response fails . */
public static VisaCheckoutNonce fromJson ( String json ) throws JSONException { } }

implementation: VisaCheckoutNonce visaCheckoutNonce = new VisaCheckoutNonce ( ) ; visaCheckoutNonce . fromJson ( PaymentMethodNonce . getJsonObjectForType ( API_RESOURCE_KEY , new JSONObject ( json ) ) ) ; return visaCheckoutNonce ;


signature:
public class LocalPayment { /** * Prepares the payment flow for a specific type of local payment .
 * @ param fragment { @ link BraintreeFragment }
 * @ param request { @ link LocalPaymentRequest } with the payment details .
 * @ param listener { @ link BraintreeResponseListener } the callback to which the { @ link LocalPaymentRequest } will be sent
 * with a payment ID for preprocessing and an approval URL . Once ready , use { @ link # approvePayment ( BraintreeFragment , LocalPaymentRequest ) }
 * to initiate the browser switch . */
public static void startPayment ( final BraintreeFragment fragment , final LocalPaymentRequest request , final BraintreeResponseListener < LocalPaymentRequest > listener ) { } }

implementation: if ( request == null ) { fragment . postCallback ( new BraintreeException ( "A LocalPaymentRequest is required." ) ) ; return ; } else if ( request . getApprovalUrl ( ) != null || request . getPaymentId ( ) != null ) { fragment . postCallback ( new BraintreeException ( "LocalPaymentRequest is invalid, " + "appovalUrl and paymentId should not be set." ) ) ; return ; } else if ( request . getPaymentType ( ) == null || request . getAmount ( ) == null ) { fragment . postCallback ( new BraintreeException ( "LocalPaymentRequest is invalid, " + "paymentType and amount are required." ) ) ; return ; } else if ( listener == null ) { fragment . postCallback ( new BraintreeException ( "BraintreeResponseListener<LocalPaymentRequest> " + "is required." ) ) ; return ; } fragment . waitForConfiguration ( new ConfigurationListener ( ) { @ Override public void onConfigurationFetched ( Configuration configuration ) { if ( ! configuration . getPayPal ( ) . isEnabled ( ) ) { fragment . postCallback ( new ConfigurationException ( "Local payments are not enabled for this merchant." ) ) ; return ; } sMerchantAccountId = request . getMerchantAccountId ( ) ; sPaymentType = request . getPaymentType ( ) ; String returnUrl = fragment . getReturnUrlScheme ( ) + "://" + LOCAL_PAYMENT_SUCCESSS ; String cancel = fragment . getReturnUrlScheme ( ) + "://" + LOCAL_PAYMENT_CANCEL ; fragment . sendAnalyticsEvent ( paymentTypeForAnalytics ( ) + ".local-payment.start-payment.selected" ) ; fragment . getHttpClient ( ) . post ( "/v1/paypal_hermes/create_payment_resource" , request . build ( returnUrl , cancel ) , new HttpResponseCallback ( ) { @ Override public void success ( String responseBody ) { try { JSONObject responseJson = new JSONObject ( responseBody ) ; request . approvalUrl ( responseJson . getJSONObject ( "paymentResource" ) . getString ( "redirectUrl" ) ) ; request . paymentId ( responseJson . getJSONObject ( "paymentResource" ) . getString ( "paymentToken" ) ) ; fragment . sendAnalyticsEvent ( paymentTypeForAnalytics ( ) + ".local-payment.create.succeeded" ) ; listener . onResponse ( request ) ; } catch ( JSONException jsonException ) { failure ( jsonException ) ; } } @ Override public void failure ( Exception exception ) { fragment . sendAnalyticsEvent ( paymentTypeForAnalytics ( ) + ".local-payment.webswitch.initiate.failed" ) ; fragment . postCallback ( exception ) ; } } ) ; } } ) ;


signature:
public class LocalPayment { /** * Initiates the browser switch for a payment flow by opening a browser where the customer can authenticate with their bank .
 * @ param fragment { @ link BraintreeFragment }
 * @ param request { @ link LocalPaymentRequest } which has already been sent to { @ link # startPayment ( BraintreeFragment , LocalPaymentRequest , BraintreeResponseListener ) }
 * and now has an approvalUrl and paymentId . */
public static void approvePayment ( BraintreeFragment fragment , LocalPaymentRequest request ) { } }

implementation: fragment . browserSwitch ( BraintreeRequestCodes . LOCAL_PAYMENT , request . getApprovalUrl ( ) ) ; fragment . sendAnalyticsEvent ( paymentTypeForAnalytics ( ) + ".local-payment.webswitch.initiate.succeeded" ) ;


signature:
public class Authorization { /** * Returns an { @ link Authorization } of the correct type for a given { @ link String } .
 * @ param authorizationString Given string to transform into an { @ link Authorization } .
 * @ return { @ link Authorization }
 * @ throws InvalidArgumentException This method will throw this exception type if the string
 * passed does not meet any of the criteria supplied for { @ link ClientToken } or { @ link TokenizationKey } . */
public static Authorization fromString ( @ Nullable String authorizationString ) throws InvalidArgumentException { } }

implementation: if ( isTokenizationKey ( authorizationString ) ) { return new TokenizationKey ( authorizationString ) ; } else { return new ClientToken ( authorizationString ) ; }


signature:
public class BraintreeError { /** * Method to extract an error for an individual field , e . g . creditCard , customer , etc .
 * @ param field Name of the field desired , expected to be in camelCase .
 * @ return { @ link BraintreeError } for the field searched , or { @ code null } if not found . */
@ Nullable public BraintreeError errorFor ( String field ) { } }

implementation: BraintreeError returnError ; if ( mFieldErrors != null ) { for ( BraintreeError error : mFieldErrors ) { if ( error . getField ( ) . equals ( field ) ) { return error ; } else if ( error . getFieldErrors ( ) != null ) { returnError = error . errorFor ( field ) ; if ( returnError != null ) { return returnError ; } } } } return null ;


signature:
public class PayPalAccountNonce { /** * Convert an API response to a { @ link PayPalAccountNonce } .
 * @ param jsonString Raw JSON representation of a { @ link PayPalAccountNonce } .
 * @ return { @ link PayPalAccountNonce } for use in payment method selection UIs . */
public static PayPalAccountNonce fromJson ( String jsonString ) throws JSONException { } }

implementation: JSONObject jsonObj = new JSONObject ( jsonString ) ; PayPalAccountNonce payPalAccountNonce = new PayPalAccountNonce ( ) ; if ( jsonObj . has ( PayPalAccountNonce . API_RESOURCE_KEY ) ) { payPalAccountNonce . fromJson ( PayPalAccountNonce . getJsonObjectForType ( API_RESOURCE_KEY , jsonObj ) ) ; } else if ( jsonObj . has ( PayPalAccountNonce . PAYMENT_METHOD_DATA_KEY ) ) { JSONObject tokenObj = new JSONObject ( new JSONObject ( jsonString ) . getJSONObject ( PayPalAccountNonce . PAYMENT_METHOD_DATA_KEY ) . getJSONObject ( PayPalAccountNonce . TOKENIZATION_DATA_KEY ) . getString ( PayPalAccountNonce . TOKEN_KEY ) ) ; payPalAccountNonce . fromJson ( PayPalAccountNonce . getJsonObjectForType ( API_RESOURCE_KEY , tokenObj ) ) ; JSONObject shippingAddress = jsonObj . optJSONObject ( SHIPPING_ADDRESS_KEY ) ; if ( shippingAddress != null ) { payPalAccountNonce . mShippingAddress = PostalAddressParser . fromJson ( shippingAddress ) ; } } else { throw new JSONException ( "Could not parse JSON for a payment method nonce" ) ; } return payPalAccountNonce ;


signature:
public class PayPalAccountNonce { /** * Generates a { @ link PayPalAccountNonce } from the { @ link JSONObject } .
 * @ param json { @ link JSONObject } that holds properties for { @ link PayPalAccountNonce } .
 * @ throws JSONException */
protected void fromJson ( JSONObject json ) throws JSONException { } }

implementation: super . fromJson ( json ) ; JSONObject details = json . getJSONObject ( DETAILS_KEY ) ; mEmail = Json . optString ( details , EMAIL_KEY , null ) ; mClientMetadataId = Json . optString ( details , CLIENT_METADATA_ID_KEY , null ) ; try { if ( details . has ( CREDIT_FINANCING_KEY ) ) { JSONObject creditFinancing = details . getJSONObject ( CREDIT_FINANCING_KEY ) ; mCreditFinancing = PayPalCreditFinancing . fromJson ( creditFinancing ) ; } JSONObject payerInfo = details . getJSONObject ( PAYER_INFO_KEY ) ; JSONObject billingAddress = payerInfo . optJSONObject ( BILLING_ADDRESS_KEY ) ; if ( payerInfo . has ( ACCOUNT_ADDRESS_KEY ) ) { billingAddress = payerInfo . optJSONObject ( ACCOUNT_ADDRESS_KEY ) ; } mShippingAddress = PostalAddressParser . fromJson ( payerInfo . optJSONObject ( SHIPPING_ADDRESS_KEY ) ) ; mBillingAddress = PostalAddressParser . fromJson ( billingAddress ) ; mFirstName = Json . optString ( payerInfo , FIRST_NAME_KEY , "" ) ; mLastName = Json . optString ( payerInfo , LAST_NAME_KEY , "" ) ; mPhone = Json . optString ( payerInfo , PHONE_KEY , "" ) ; mPayerId = Json . optString ( payerInfo , PAYER_ID_KEY , "" ) ; if ( mEmail == null ) { mEmail = Json . optString ( payerInfo , EMAIL_KEY , null ) ; } } catch ( JSONException e ) { mBillingAddress = new PostalAddress ( ) ; mShippingAddress = new PostalAddress ( ) ; }


signature:
public class BraintreeFragment { /** * Create a new instance of { @ link BraintreeFragment } using the client token and add it to the
 * { @ link AppCompatActivity } ' s { @ link FragmentManager } .
 * @ param activity The { @ link AppCompatActivity } to add the { @ link BraintreeFragment } to .
 * @ param authorization The tokenization key or client token to use .
 * @ return { @ link BraintreeFragment }
 * @ throws InvalidArgumentException If the tokenization key or client token is not valid or cannot be
 * parsed . */
public static BraintreeFragment newInstance ( AppCompatActivity activity , String authorization ) throws InvalidArgumentException { } }

implementation: if ( activity == null ) { throw new InvalidArgumentException ( "Activity is null" ) ; } FragmentManager fm = activity . getSupportFragmentManager ( ) ; BraintreeFragment braintreeFragment = ( BraintreeFragment ) fm . findFragmentByTag ( TAG ) ; if ( braintreeFragment == null ) { braintreeFragment = new BraintreeFragment ( ) ; Bundle bundle = new Bundle ( ) ; try { Authorization auth = Authorization . fromString ( authorization ) ; bundle . putParcelable ( EXTRA_AUTHORIZATION_TOKEN , auth ) ; } catch ( InvalidArgumentException e ) { throw new InvalidArgumentException ( "Tokenization Key or client token was invalid." ) ; } bundle . putString ( EXTRA_SESSION_ID , UUIDHelper . getFormattedUUID ( ) ) ; bundle . putString ( EXTRA_INTEGRATION_TYPE , IntegrationType . get ( activity ) ) ; braintreeFragment . setArguments ( bundle ) ; try { if ( VERSION . SDK_INT >= VERSION_CODES . N ) { try { fm . beginTransaction ( ) . add ( braintreeFragment , TAG ) . commitNow ( ) ; } catch ( IllegalStateException | NullPointerException e ) { fm . beginTransaction ( ) . add ( braintreeFragment , TAG ) . commit ( ) ; try { fm . executePendingTransactions ( ) ; } catch ( IllegalStateException ignored ) { } } } else { fm . beginTransaction ( ) . add ( braintreeFragment , TAG ) . commit ( ) ; try { fm . executePendingTransactions ( ) ; } catch ( IllegalStateException ignored ) { } } } catch ( IllegalStateException e ) { throw new InvalidArgumentException ( e . getMessage ( ) ) ; } } braintreeFragment . mContext = activity . getApplicationContext ( ) ; return braintreeFragment ;


signature:
public class BraintreeFragment { /** * Adds a listener .
 * @ param listener the listener to add . */
public < T extends BraintreeListener > void addListener ( T listener ) { } }

implementation: if ( listener instanceof ConfigurationListener ) { mConfigurationListener = ( ConfigurationListener ) listener ; } if ( listener instanceof BraintreeCancelListener ) { mCancelListener = ( BraintreeCancelListener ) listener ; } if ( listener instanceof PaymentMethodNoncesUpdatedListener ) { mPaymentMethodNoncesUpdatedListener = ( PaymentMethodNoncesUpdatedListener ) listener ; } if ( listener instanceof PaymentMethodNonceCreatedListener ) { mPaymentMethodNonceCreatedListener = ( PaymentMethodNonceCreatedListener ) listener ; } if ( listener instanceof PaymentMethodNonceDeletedListener ) { mPaymentMethodNonceDeletedListener = ( PaymentMethodNonceDeletedListener ) listener ; } if ( listener instanceof BraintreePaymentResultListener ) { mBraintreePaymentResultListener = ( BraintreePaymentResultListener ) listener ; } if ( listener instanceof BraintreeErrorListener ) { mErrorListener = ( BraintreeErrorListener ) listener ; } if ( listener instanceof UnionPayListener ) { mUnionPayListener = ( UnionPayListener ) listener ; } if ( listener instanceof AmericanExpressListener ) { mAmericanExpressListener = ( AmericanExpressListener ) listener ; } flushCallbacks ( ) ;


signature:
public class BraintreeFragment { /** * Removes a previously added listener .
 * @ param listener the listener to remove . */
public < T extends BraintreeListener > void removeListener ( T listener ) { } }

implementation: if ( listener instanceof ConfigurationListener ) { mConfigurationListener = null ; } if ( listener instanceof BraintreeCancelListener ) { mCancelListener = null ; } if ( listener instanceof PaymentMethodNoncesUpdatedListener ) { mPaymentMethodNoncesUpdatedListener = null ; } if ( listener instanceof PaymentMethodNonceCreatedListener ) { mPaymentMethodNonceCreatedListener = null ; } if ( listener instanceof PaymentMethodNonceDeletedListener ) { mPaymentMethodNonceDeletedListener = null ; } if ( listener instanceof BraintreePaymentResultListener ) { mBraintreePaymentResultListener = null ; } if ( listener instanceof BraintreeErrorListener ) { mErrorListener = null ; } if ( listener instanceof UnionPayListener ) { mUnionPayListener = null ; } if ( listener instanceof AmericanExpressListener ) { mAmericanExpressListener = null ; }


signature:
public class BraintreeFragment { /** * Obtain an instance of a { @ link GoogleApiClient } that is connected or connecting to be used
 * for Android Pay . This instance will be automatically disconnected in
 * { @ link BraintreeFragment # onStop ( ) } and automatically connected in
 * { @ link BraintreeFragment # onResume ( ) } .
 * Connection failed and connection suspended errors will be sent to
 * { @ link BraintreeErrorListener # onError ( Exception ) } .
 * @ param listener { @ link BraintreeResponseListener < GoogleApiClient > } to receive the
 * { @ link GoogleApiClient } in
 * { @ link BraintreeResponseListener < GoogleApiClient > # onResponse ( GoogleApiClient ) } . */
public void getGoogleApiClient ( final BraintreeResponseListener < GoogleApiClient > listener ) { } }

implementation: waitForConfiguration ( new ConfigurationListener ( ) { @ Override public void onConfigurationFetched ( Configuration configuration ) { GoogleApiClient googleApiClient = getGoogleApiClient ( ) ; if ( googleApiClient != null ) { listener . onResponse ( googleApiClient ) ; } } } ) ;


signature:
public class GooglePaymentConfiguration { /** * Parse an { @ link GooglePaymentConfiguration } from json .
 * @ param json The { @ link JSONObject } to parse .
 * @ return An { @ link GooglePaymentConfiguration } instance with data that was able to be parsed from
 * the { @ link JSONObject } . */
public static GooglePaymentConfiguration fromJson ( JSONObject json ) { } }

implementation: if ( json == null ) { json = new JSONObject ( ) ; } GooglePaymentConfiguration googlePaymentConfiguration = new GooglePaymentConfiguration ( ) ; googlePaymentConfiguration . mEnabled = json . optBoolean ( ENABLED_KEY , false ) ; googlePaymentConfiguration . mGoogleAuthorizationFingerprint = Json . optString ( json , GOOGLE_AUTHORIZATION_FINGERPRINT_KEY , null ) ; googlePaymentConfiguration . mEnvironment = Json . optString ( json , ENVIRONMENT_KEY , null ) ; googlePaymentConfiguration . mDisplayName = Json . optString ( json , DISPLAY_NAME_KEY , "" ) ; JSONArray supportedNetworks = json . optJSONArray ( SUPPORTED_NETWORKS_KEY ) ; if ( supportedNetworks != null ) { googlePaymentConfiguration . mSupportedNetworks = new String [ supportedNetworks . length ( ) ] ; for ( int i = 0 ; i < supportedNetworks . length ( ) ; i ++ ) { try { googlePaymentConfiguration . mSupportedNetworks [ i ] = supportedNetworks . getString ( i ) ; } catch ( JSONException ignored ) { } } } else { googlePaymentConfiguration . mSupportedNetworks = new String [ 0 ] ; } return googlePaymentConfiguration ;


signature:
public class PayPal { /** * Starts the Billing Agreement flow for PayPal with custom PayPal approval handler .
 * @ param fragment A { @ link BraintreeFragment } used to process the request .
 * @ param request A { @ link PayPalRequest } used to customize the request .
 * @ param handler A { @ link PayPalApprovalHandler } for custom approval handling . */
public static void requestBillingAgreement ( BraintreeFragment fragment , PayPalRequest request , PayPalApprovalHandler handler ) { } }

implementation: if ( request . getAmount ( ) == null ) { fragment . sendAnalyticsEvent ( "paypal.billing-agreement.selected" ) ; if ( request . shouldOfferCredit ( ) ) { fragment . sendAnalyticsEvent ( "paypal.billing-agreement.credit.offered" ) ; } requestOneTimePayment ( fragment , request , true , handler ) ; } else { fragment . postCallback ( new BraintreeException ( "There must be no amount specified for the Billing Agreement flow" ) ) ; }


signature:
public class PayPal { /** * Create a PayPalPaymentResource on behalf of the merchant . To be used in the PayPal Checkout
 * flows for Single Payment and Billing Agreement .
 * @ param fragment A { @ link BraintreeFragment } used to process the request .
 * @ param request A { @ link PayPalRequest } used to customize the request .
 * @ param isBillingAgreement A boolean . If true , this will use the Billing Agreement . Otherwise ,
 * PayPal will perform a Single Payment .
 * @ param callback A callback on the http request . */
private static void createPaymentResource ( BraintreeFragment fragment , PayPalRequest request , boolean isBillingAgreement , HttpResponseCallback callback ) throws JSONException , ErrorWithResponse , BraintreeException { } }

implementation: String currencyCode = request . getCurrencyCode ( ) ; if ( currencyCode == null ) { currencyCode = fragment . getConfiguration ( ) . getPayPal ( ) . getCurrencyIsoCode ( ) ; } CheckoutRequest checkoutRequest = getCheckoutRequest ( fragment , null ) ; JSONObject parameters = new JSONObject ( ) . put ( RETURN_URL_KEY , checkoutRequest . getSuccessUrl ( ) ) . put ( CANCEL_URL_KEY , checkoutRequest . getCancelUrl ( ) ) . put ( OFFER_CREDIT_KEY , request . shouldOfferCredit ( ) ) ; if ( fragment . getAuthorization ( ) instanceof ClientToken ) { parameters . put ( AUTHORIZATION_FINGERPRINT_KEY , fragment . getAuthorization ( ) . getBearer ( ) ) ; } else { parameters . put ( TOKENIZATION_KEY , fragment . getAuthorization ( ) . getBearer ( ) ) ; } if ( ! isBillingAgreement ) { parameters . put ( AMOUNT_KEY , request . getAmount ( ) ) . put ( CURRENCY_ISO_CODE_KEY , currencyCode ) . put ( INTENT_KEY , request . getIntent ( ) ) ; } else { if ( ! TextUtils . isEmpty ( request . getBillingAgreementDescription ( ) ) ) { parameters . put ( DESCRIPTION_KEY , request . getBillingAgreementDescription ( ) ) ; } } JSONObject experienceProfile = new JSONObject ( ) ; experienceProfile . put ( NO_SHIPPING_KEY , ! request . isShippingAddressRequired ( ) ) ; experienceProfile . put ( LANDING_PAGE_TYPE_KEY , request . getLandingPageType ( ) ) ; String displayName = request . getDisplayName ( ) ; if ( TextUtils . isEmpty ( displayName ) ) { displayName = fragment . getConfiguration ( ) . getPayPal ( ) . getDisplayName ( ) ; } experienceProfile . put ( DISPLAY_NAME_KEY , displayName ) ; if ( request . getLocaleCode ( ) != null ) { experienceProfile . put ( LOCALE_CODE_KEY , request . getLocaleCode ( ) ) ; } if ( request . getShippingAddressOverride ( ) != null ) { experienceProfile . put ( ADDRESS_OVERRIDE_KEY , ! request . isShippingAddressEditable ( ) ) ; JSONObject shippingAddressJson ; if ( isBillingAgreement ) { shippingAddressJson = new JSONObject ( ) ; parameters . put ( SHIPPING_ADDRESS_KEY , shippingAddressJson ) ; } else { shippingAddressJson = parameters ; } PostalAddress shippingAddress = request . getShippingAddressOverride ( ) ; shippingAddressJson . put ( PostalAddressParser . LINE_1_KEY , shippingAddress . getStreetAddress ( ) ) ; shippingAddressJson . put ( PostalAddressParser . LINE_2_KEY , shippingAddress . getExtendedAddress ( ) ) ; shippingAddressJson . put ( PostalAddressParser . LOCALITY_KEY , shippingAddress . getLocality ( ) ) ; shippingAddressJson . put ( PostalAddressParser . REGION_KEY , shippingAddress . getRegion ( ) ) ; shippingAddressJson . put ( PostalAddressParser . POSTAL_CODE_UNDERSCORE_KEY , shippingAddress . getPostalCode ( ) ) ; shippingAddressJson . put ( PostalAddressParser . COUNTRY_CODE_UNDERSCORE_KEY , shippingAddress . getCountryCodeAlpha2 ( ) ) ; shippingAddressJson . put ( PostalAddressParser . RECIPIENT_NAME_UNDERSCORE_KEY , shippingAddress . getRecipientName ( ) ) ; } else { experienceProfile . put ( ADDRESS_OVERRIDE_KEY , false ) ; } if ( request . getMerchantAccountId ( ) != null ) { parameters . put ( MERCHANT_ACCOUNT_ID , request . getMerchantAccountId ( ) ) ; } parameters . put ( EXPERIENCE_PROFILE_KEY , experienceProfile ) ; String apiUrl = isBillingAgreement ? SETUP_BILLING_AGREEMENT_ENDPOINT : CREATE_SINGLE_PAYMENT_ENDPOINT ; String versionedPath = "/v1/" + apiUrl ; fragment . getHttpClient ( ) . post ( versionedPath , parameters . toString ( ) , callback ) ;


signature:
public class PayPal { /** * The result from PayPal ' s request .
 * @ param fragment A { @ link BraintreeFragment } used to process the request .
 * @ param data Data associated with the result . */
protected static void onActivityResult ( final BraintreeFragment fragment , int resultCode , Intent data ) { } }

implementation: Request request = getPersistedRequest ( fragment . getApplicationContext ( ) ) ; String paymentType = paymentTypeForRequest ( request ) ; String switchType = switchTypeForIntent ( data ) ; String eventPrefix = paymentType + "." + switchType ; if ( resultCode == AppCompatActivity . RESULT_OK && data != null && request != null ) { Result result = PayPalOneTouchCore . parseResponse ( fragment . getApplicationContext ( ) , request , data ) ; switch ( result . getResultType ( ) ) { case Error : fragment . postCallback ( new BrowserSwitchException ( result . getError ( ) . getMessage ( ) ) ) ; fragment . sendAnalyticsEvent ( eventPrefix + ".failed" ) ; break ; case Cancel : fragment . postCancelCallback ( BraintreeRequestCodes . PAYPAL ) ; fragment . sendAnalyticsEvent ( eventPrefix + ".canceled" ) ; break ; case Success : onSuccess ( fragment , data , request , result ) ; fragment . sendAnalyticsEvent ( eventPrefix + ".succeeded" ) ; break ; } } else { fragment . sendAnalyticsEvent ( eventPrefix + ".canceled" ) ; if ( resultCode != AppCompatActivity . RESULT_CANCELED ) { fragment . postCancelCallback ( BraintreeRequestCodes . PAYPAL ) ; } }


signature:
public class PayPal { /** * Parse the PayPal response URL using OneTouchCore .
 * @ param paypalRequest Original { @ link PayPalRequest } that started this flow .
 * @ param result Context that received the result .
 * @ param intent The { @ link Intent } returned in result .
 * @ return A { @ link PayPalAccountBuilder } or null if the intent is invalid . */
private static PayPalAccountBuilder parseResponse ( PayPalRequest paypalRequest , Request request , Result result , Intent intent ) { } }

implementation: PayPalAccountBuilder paypalAccountBuilder = new PayPalAccountBuilder ( ) . clientMetadataId ( request . getClientMetadataId ( ) ) ; if ( paypalRequest != null && paypalRequest . getMerchantAccountId ( ) != null ) { paypalAccountBuilder . merchantAccountId ( paypalRequest . getMerchantAccountId ( ) ) ; } if ( request instanceof CheckoutRequest && paypalRequest != null ) { paypalAccountBuilder . intent ( paypalRequest . getIntent ( ) ) ; } if ( isAppSwitch ( intent ) ) { paypalAccountBuilder . source ( "paypal-app" ) ; } else { paypalAccountBuilder . source ( "paypal-browser" ) ; } paypalAccountBuilder . oneTouchCoreData ( result . getResponse ( ) ) ; return paypalAccountBuilder ;


signature:
public class ThreeDSecureLookup { /** * Used to parse a response from the Braintree Gateway to be used for 3D Secure .
 * @ param jsonString The json response from the Braintree Gateway 3D Secure lookup route .
 * @ return The { @ link com . braintreepayments . api . models . ThreeDSecureLookup } to use when
 * performing 3D Secure authentication .
 * @ throws JSONException when parsing fails . */
public static ThreeDSecureLookup fromJson ( String jsonString ) throws JSONException { } }

implementation: JSONObject json = new JSONObject ( jsonString ) ; ThreeDSecureLookup lookup = new ThreeDSecureLookup ( ) ; CardNonce cardNonce = new CardNonce ( ) ; cardNonce . fromJson ( json . getJSONObject ( CARD_NONCE_KEY ) ) ; lookup . mCardNonce = cardNonce ; JSONObject lookupJson = json . getJSONObject ( LOOKUP_KEY ) ; if ( lookupJson . isNull ( ACS_URL_KEY ) ) { lookup . mAcsUrl = null ; } else { lookup . mAcsUrl = lookupJson . getString ( ACS_URL_KEY ) ; } lookup . mMd = lookupJson . getString ( MD_KEY ) ; lookup . mTermUrl = lookupJson . getString ( TERM_URL_KEY ) ; lookup . mPareq = lookupJson . getString ( PA_REQ_KEY ) ; return lookup ;


signature:
public class PayPalConfiguration { /** * Parse an { @ link PayPalConfiguration } from json .
 * @ param json The { @ link JSONObject } to parse .
 * @ return An { @ link PayPalConfiguration } instance with data that was able to be parsed from
 * the { @ link JSONObject } . */
public static PayPalConfiguration fromJson ( JSONObject json ) { } }

implementation: if ( json == null ) { json = new JSONObject ( ) ; } PayPalConfiguration payPalConfiguration = new PayPalConfiguration ( ) ; payPalConfiguration . mDisplayName = Json . optString ( json , DISPLAY_NAME_KEY , null ) ; payPalConfiguration . mClientId = Json . optString ( json , CLIENT_ID_KEY , null ) ; payPalConfiguration . mPrivacyUrl = Json . optString ( json , PRIVACY_URL_KEY , null ) ; payPalConfiguration . mUserAgreementUrl = Json . optString ( json , USER_AGREEMENT_URL_KEY , null ) ; payPalConfiguration . mDirectBaseUrl = Json . optString ( json , DIRECT_BASE_URL_KEY , null ) ; payPalConfiguration . mEnvironment = Json . optString ( json , ENVIRONMENT_KEY , null ) ; payPalConfiguration . mTouchDisabled = json . optBoolean ( TOUCH_DISABLED_KEY , true ) ; payPalConfiguration . mCurrencyIsoCode = Json . optString ( json , CURRENCY_ISO_CODE_KEY , null ) ; return payPalConfiguration ;


signature:
public class OpenKoreanTextProcessorJava { /** * Add user - defined words to the noun dictionary . Spaced words are ignored .
 * @ param words List of user nouns . */
public static void addNounsToDictionary ( List < String > words ) { } }

implementation: OpenKoreanTextProcessor . addNounsToDictionary ( JavaConverters . asScalaBufferConverter ( words ) . asScala ( ) ) ;


signature:
public class OpenKoreanTextProcessorJava { /** * Remove user - defined word List from the dictionary for the specified KoreanPos .
 * @ param pos KoreanPos of words to add .
 * @ param words Sequence of words to add . */
public static void removeWordFromDictionary ( KoreanPosJava pos , List < String > words ) { } }

implementation: OpenKoreanTextProcessor . removeWordsFromDictionary ( KoreanPos . withName ( pos . toString ( ) ) , JavaConverters . asScalaBufferConverter ( words ) . asScala ( ) ) ;


signature:
public class OpenKoreanTextProcessorJava { /** * Transforms the tokenization output to List < KoreanTokenJava >
 * @ param tokens Korean tokens ( output of tokenize ( CharSequence text ) ) .
 * @ return List of KoreanTokenJava . */
public static List < KoreanTokenJava > tokensToJavaKoreanTokenList ( Seq < KoreanToken > tokens , boolean keepSpace ) { } }

implementation: Iterator < KoreanToken > tokenized = tokens . iterator ( ) ; List < KoreanTokenJava > output = new LinkedList < > ( ) ; while ( tokenized . hasNext ( ) ) { KoreanToken token = tokenized . next ( ) ; String stem = "" ; if ( token . stem ( ) . nonEmpty ( ) ) { stem += token . stem ( ) . get ( ) ; } if ( keepSpace || token . pos ( ) != KoreanPos . Space ( ) ) { output . add ( new KoreanTokenJava ( token . text ( ) , KoreanPosJava . valueOf ( token . pos ( ) . toString ( ) ) , token . offset ( ) , token . length ( ) , token . unknown ( ) , stem ) ) ; } } return output ;


signature:
public class OpenKoreanTextProcessorJava { /** * Tokenize with the builder options into a String Iterable .
 * @ param tokens Korean tokens ( output of tokenize ( CharSequence text ) ) .
 * @ return List of token strings . */
public static List < String > tokensToJavaStringList ( Seq < KoreanToken > tokens , boolean keepSpace ) { } }

implementation: Iterator < KoreanToken > tokenized = tokens . iterator ( ) ; List < String > output = new LinkedList < > ( ) ; while ( tokenized . hasNext ( ) ) { final KoreanToken token = tokenized . next ( ) ; if ( keepSpace || token . pos ( ) != KoreanPos . Space ( ) ) { output . add ( token . text ( ) ) ; } } return output ;


signature:
public class OpenKoreanTextProcessorJava { /** * Extract phrases from Korean input text
 * @ param tokens Korean tokens ( output of tokenize ( CharSequence text ) ) .
 * @ return List of phrase CharSequences . */
public static List < KoreanPhraseExtractor . KoreanPhrase > extractPhrases ( Seq < KoreanToken > tokens , boolean filterSpam , boolean includeHashtags ) { } }

implementation: Seq < KoreanPhraseExtractor . KoreanPhrase > seq = OpenKoreanTextProcessor . extractPhrases ( tokens , filterSpam , includeHashtags ) ; return toJavaList ( seq ) ;


signature:
public class OpenKoreanTextProcessorJava { /** * Detokenize the input list of words .
 * @ param tokens List of words .
 * @ return Detokenized string . */
public static String detokenize ( List < String > tokens ) { } }

implementation: return OpenKoreanTextProcessor . detokenize ( JavaConverters . asScalaBufferConverter ( tokens ) . asScala ( ) ) ;


signature:
public class CharArraySet { /** * Returns an unmodifiable { @ link CharArraySet } . This allows to provide
 * unmodifiable views of internal sets for " read - only " use .
 * @ param set a set for which the unmodifiable set is returned .
 * @ return an new unmodifiable { @ link CharArraySet } .
 * @ throws NullPointerException if the given set is < code > null < / code > . */
public static CharArraySet unmodifiableSet ( CharArraySet set ) { } }

implementation: if ( set == null ) throw new NullPointerException ( "Given set is null" ) ; if ( set == EMPTY_SET ) return EMPTY_SET ; if ( set . map instanceof CharArrayMap . UnmodifiableCharArrayMap ) return set ; return new CharArraySet ( CharArrayMap . unmodifiableMap ( set . map ) ) ;


signature:
public class NIOUtils { /** * Reads size amount of bytes from ch into a new ByteBuffer allocated from a
 * buffer buf
 * @ param buf
 * @ param ch
 * @ param size
 * @ return
 * @ throws IOException */
public static ByteBuffer fetchFrom ( ByteBuffer buf , ReadableByteChannel ch , int size ) throws IOException { } }

implementation: ByteBuffer result = buf . duplicate ( ) ; result . limit ( size ) ; NIOUtils . readFromChannel ( ch , result ) ; result . flip ( ) ; return result ;


signature:
public class NoiseEnvelope { /** * / * [ 0 . . 1] */
public static float calc_Q_div ( SBR sbr , int ch , int m , int l ) { } }

implementation:
if ( sbr . bs_coupling ) { /* left channel */
if ( ( sbr . Q [ 0 ] [ m ] [ l ] < 0 || sbr . Q [ 0 ] [ m ] [ l ] > 30 ) || ( sbr . Q [ 1 ] [ m ] [ l ] < 0 || sbr . Q [ 1 ] [ m ] [ l ] > 24 /* 2 * panOffset ( 1) */
) ) { return 0 ; } else { /* the pan parameter is always even */
if ( ch == 0 ) { return Q_div_tab_left [ sbr . Q [ 0 ] [ m ] [ l ] ] [ sbr . Q [ 1 ] [ m ] [ l ] >> 1 ] ; } else { return Q_div_tab_right [ sbr . Q [ 0 ] [ m ] [ l ] ] [ sbr . Q [ 1 ] [ m ] [ l ] >> 1 ] ; } } } else { /* no coupling */
if ( sbr . Q [ ch ] [ m ] [ l ] < 0 || sbr . Q [ ch ] [ m ] [ l ] > 30 ) { return 0 ; } else { return Q_div_tab [ sbr . Q [ ch ] [ m ] [ l ] ] ; } }


signature:
public class NoiseEnvelope { /** * / * [ 0 . . 1] */
public static float calc_Q_div2 ( SBR sbr , int ch , int m , int l ) { } }

implementation:
if ( sbr . bs_coupling ) { if ( ( sbr . Q [ 0 ] [ m ] [ l ] < 0 || sbr . Q [ 0 ] [ m ] [ l ] > 30 ) || ( sbr . Q [ 1 ] [ m ] [ l ] < 0 || sbr . Q [ 1 ] [ m ] [ l ] > 24 /* 2 * panOffset ( 1) */
) ) { return 0 ; } else { /* the pan parameter is always even */
if ( ch == 0 ) { return Q_div2_tab_left [ sbr . Q [ 0 ] [ m ] [ l ] ] [ sbr . Q [ 1 ] [ m ] [ l ] >> 1 ] ; } else { return Q_div2_tab_right [ sbr . Q [ 0 ] [ m ] [ l ] ] [ sbr . Q [ 1 ] [ m ] [ l ] >> 1 ] ; } } } else { /* no coupling */
if ( sbr . Q [ ch ] [ m ] [ l ] < 0 || sbr . Q [ ch ] [ m ] [ l ] > 30 ) { return 0 ; } else { return Q_div2_tab [ sbr . Q [ ch ] [ m ] [ l ] ] ; } }


signature:
public class H264Utils { /** * Finds next Nth H . 264 bitstream NAL unit ( 0x000001 ) and returns the data
 * that preceeds it as a ByteBuffer slice
 * Segment byte order is always little endian
 * TODO : emulation prevention
 * @ param buf
 * @ return */
public static final ByteBuffer gotoNALUnit ( ByteBuffer buf ) { } }

implementation: if ( ! buf . hasRemaining ( ) ) return null ; int from = buf . position ( ) ; ByteBuffer result = buf . slice ( ) ; result . order ( ByteOrder . BIG_ENDIAN ) ; int val = 0xffffffff ; while ( buf . hasRemaining ( ) ) { val <<= 8 ; val |= ( buf . get ( ) & 0xff ) ; if ( ( val & 0xffffff ) == 1 ) { buf . position ( buf . position ( ) - ( val == 1 ? 4 : 3 ) ) ; result . limit ( buf . position ( ) - from ) ; break ; } } return result ;


signature:
public class H264Utils { /** * Finds next Nth H . 264 bitstream NAL unit ( 0x000001 ) and returns the data
 * that preceeds it as a ByteBuffer slice
 * Segment byte order is always little endian
 * @ param buf
 * @ return data */
public static final ByteBuffer gotoNALUnitWithArray ( ByteBuffer buf ) { } }

implementation: if ( ! buf . hasRemaining ( ) ) return null ; int from = buf . position ( ) ; ByteBuffer result = buf . slice ( ) ; result . order ( ByteOrder . BIG_ENDIAN ) ; byte [ ] arr = buf . array ( ) ; int pos = from + buf . arrayOffset ( ) ; int posFrom = pos ; int lim = buf . limit ( ) + buf . arrayOffset ( ) ; while ( pos < lim ) { byte b = arr [ pos ] ; if ( ( b & 254 ) == 0 ) { while ( b == 0 && ++ pos < lim ) b = arr [ pos ] ; if ( b == 1 ) { if ( pos - posFrom >= 2 && arr [ pos - 1 ] == 0 && arr [ pos - 2 ] == 0 ) { int lenSize = ( pos - posFrom >= 3 && arr [ pos - 3 ] == 0 ) ? 4 : 3 ; buf . position ( pos + 1 - buf . arrayOffset ( ) - lenSize ) ; result . limit ( buf . position ( ) - from ) ; return result ; } } } pos += 3 ; } buf . position ( buf . limit ( ) ) ; return result ;


signature:
public class H264Utils { /** * Encodes AVC frame in ISO BMF format . Takes Annex B format .
 * Scans the packet for each NAL Unit starting with 00 00 00 01 and replaces
 * this 4 byte sequence with 4 byte integer representing this NAL unit
 * length .
 * @ param avcFrame
 * AVC frame encoded in Annex B NAL unit format */
public static void encodeMOVPacketInplace ( ByteBuffer avcFrame ) { } }

implementation: ByteBuffer dup = avcFrame . duplicate ( ) ; ByteBuffer d1 = avcFrame . duplicate ( ) ; for ( int tot = d1 . position ( ) ; ; ) { ByteBuffer buf = H264Utils . nextNALUnit ( dup ) ; if ( buf == null ) break ; d1 . position ( tot ) ; d1 . putInt ( buf . remaining ( ) ) ; tot += buf . remaining ( ) + 4 ; }


signature:
public class H264Utils { /** * Encodes AVC frame in ISO BMF format . Takes Annex B format .
 * Scans the packet for each NAL Unit starting with 00 00 00 01 and replaces
 * this 4 byte sequence with 4 byte integer representing this NAL unit
 * length .
 * @ param avcFrame
 * AVC frame encoded in Annex B NAL unit format */
public static ByteBuffer encodeMOVPacket ( ByteBuffer avcFrame ) { } }

implementation: ByteBuffer dup = avcFrame . duplicate ( ) ; List < ByteBuffer > list = new ArrayList < ByteBuffer > ( ) ; ByteBuffer buf ; int totalLen = 0 ; while ( ( buf = H264Utils . nextNALUnit ( dup ) ) != null ) { list . add ( buf ) ; totalLen += buf . remaining ( ) ; } ByteBuffer result = ByteBuffer . allocate ( list . size ( ) * 4 + totalLen ) ; for ( ByteBuffer byteBuffer : list ) { result . putInt ( byteBuffer . remaining ( ) ) ; result . put ( byteBuffer ) ; } result . flip ( ) ; return result ;


signature:
public class H264Utils { /** * Decodes AVC packet in ISO BMF format into Annex B format .
 * Replaces NAL unit size integers with 00 00 00 01 start codes . If the
 * space allows the transformation is done inplace .
 * @ param result */
public static ByteBuffer decodeMOVPacket ( ByteBuffer result , AvcCBox avcC ) { } }

implementation: if ( avcC . getNalLengthSize ( ) == 4 ) { decodeMOVPacketInplace ( result , avcC ) ; return result ; } return joinNALUnits ( splitMOVPacket ( result , avcC ) ) ;


signature:
public class H264Utils { /** * Decodes AVC packet in ISO BMF format into Annex B format .
 * Inplace replaces NAL unit size integers with 00 00 00 01 start codes .
 * @ param result */
public static void decodeMOVPacketInplace ( ByteBuffer result , AvcCBox avcC ) { } }

implementation: if ( avcC . getNalLengthSize ( ) != 4 ) throw new IllegalArgumentException ( "Can only inplace decode AVC MOV packet with nal_length_size = 4." ) ; ByteBuffer dup = result . duplicate ( ) ; while ( dup . remaining ( ) >= 4 ) { int size = dup . getInt ( ) ; dup . position ( dup . position ( ) - 4 ) ; dup . putInt ( 1 ) ; dup . position ( dup . position ( ) + size ) ; }


signature:
public class H264Utils { /** * Wipes AVC parameter sets ( SPS / PPS ) from the packet
 * @ param in
 * AVC frame encoded in Annex B NAL unit format
 * @ param out
 * Buffer where packet without PS will be put
 * @ param spsList
 * Storage for leading SPS structures ( can be null , then all
 * leading SPSs are discarded ) .
 * @ param ppsList
 * Storage for leading PPS structures ( can be null , then all
 * leading PPSs are discarded ) . */
public static void wipePS ( ByteBuffer _in , ByteBuffer out , List < ByteBuffer > spsList , List < ByteBuffer > ppsList ) { } }

implementation: ByteBuffer dup = _in . duplicate ( ) ; while ( dup . hasRemaining ( ) ) { ByteBuffer buf = H264Utils . nextNALUnit ( dup ) ; if ( buf == null ) break ; NALUnit nu = NALUnit . read ( buf . duplicate ( ) ) ; if ( nu . type == NALUnitType . PPS ) { if ( ppsList != null ) ppsList . add ( NIOUtils . duplicate ( buf ) ) ; } else if ( nu . type == NALUnitType . SPS ) { if ( spsList != null ) spsList . add ( NIOUtils . duplicate ( buf ) ) ; } else if ( out != null ) { out . putInt ( 1 ) ; out . put ( buf ) ; } } if ( out != null ) out . flip ( ) ;


signature:
public class H264Utils { /** * Wipes AVC parameter sets ( SPS / PPS ) from the packet ( inplace operation
 * @ param in
 * AVC frame encoded in Annex B NAL unit format
 * @ param spsList
 * Storage for leading SPS structures ( can be null , then all
 * leading SPSs are discarded ) .
 * @ param ppsList
 * Storage for leading PPS structures ( can be null , then all
 * leading PPSs are discarded ) . */
public static void wipePSinplace ( ByteBuffer _in , Collection < ByteBuffer > spsList , Collection < ByteBuffer > ppsList ) { } }

implementation: ByteBuffer dup = _in . duplicate ( ) ; while ( dup . hasRemaining ( ) ) { ByteBuffer buf = H264Utils . nextNALUnit ( dup ) ; if ( buf == null ) break ; NALUnit nu = NALUnit . read ( buf ) ; if ( nu . type == NALUnitType . PPS ) { if ( ppsList != null ) ppsList . add ( NIOUtils . duplicate ( buf ) ) ; _in . position ( dup . position ( ) ) ; } else if ( nu . type == NALUnitType . SPS ) { if ( spsList != null ) spsList . add ( NIOUtils . duplicate ( buf ) ) ; _in . position ( dup . position ( ) ) ; } else if ( nu . type == NALUnitType . IDR_SLICE || nu . type == NALUnitType . NON_IDR_SLICE ) break ; }


signature:
public class H264Utils { /** * Creates a MP4 sample entry given AVC / H . 264 codec private .
 * @ param codecPrivate
 * Array containing AnnexB delimited ( 00 00 00 01 ) SPS / PPS NAL
 * units .
 * @ return MP4 sample entry */
public static SampleEntry createMOVSampleEntryFromBytes ( ByteBuffer codecPrivate ) { } }

implementation: List < ByteBuffer > rawSPS = getRawSPS ( codecPrivate . duplicate ( ) ) ; List < ByteBuffer > rawPPS = getRawPPS ( codecPrivate . duplicate ( ) ) ; return createMOVSampleEntryFromSpsPpsList ( rawSPS , rawPPS , 4 ) ;


signature:
public class H264Utils { /** * Creates a MP4 sample entry given AVC / H . 264 codec private .
 * @ param codecPrivate
 * Array containing AnnexB delimited ( 00 00 00 01 ) SPS / PPS NAL
 * units .
 * @ return MP4 sample entry */
public static AvcCBox createAvcCFromBytes ( ByteBuffer codecPrivate ) { } }

implementation: List < ByteBuffer > rawSPS = getRawSPS ( codecPrivate . duplicate ( ) ) ; List < ByteBuffer > rawPPS = getRawPPS ( codecPrivate . duplicate ( ) ) ; return createAvcCFromPS ( rawSPS , rawPPS , 4 ) ;


signature:
public class H264Utils { /** * Joins buffers containing individual NAL units into a single AnnexB
 * delimited buffer . Each NAL unit will be separated with 00 00 00 01
 * markers . Allocates a new byte buffer and writes data into it .
 * @ param nalUnits
 * @ param out */
public static ByteBuffer joinNALUnits ( List < ByteBuffer > nalUnits ) { } }

implementation: int size = 0 ; for ( ByteBuffer nal : nalUnits ) { size += 4 + nal . remaining ( ) ; } ByteBuffer allocate = ByteBuffer . allocate ( size ) ; joinNALUnitsToBuffer ( nalUnits , allocate ) ; return allocate ;


signature:
public class H264Utils { /** * Joins buffers containing individual NAL units into a single AnnexB
 * delimited buffer . Each NAL unit will be separated with 00 00 00 01
 * markers .
 * @ param nalUnits
 * @ param out */
public static void joinNALUnitsToBuffer ( List < ByteBuffer > nalUnits , ByteBuffer out ) { } }

implementation: for ( ByteBuffer nal : nalUnits ) { out . putInt ( 1 ) ; out . put ( nal . duplicate ( ) ) ; }


signature:
public class BlockInterpolator { /** * Get block of ( possibly interpolated ) luma pixels */
public void getBlockLuma ( Picture pic , Picture out , int off , int x , int y , int w , int h ) { } }

implementation: int xInd = x & 0x3 ; int yInd = y & 0x3 ; int xFp = x >> 2 ; int yFp = y >> 2 ; if ( xFp < 2 || yFp < 2 || xFp > pic . getWidth ( ) - w - 5 || yFp > pic . getHeight ( ) - h - 5 ) { unsafe [ ( yInd << 2 ) + xInd ] . getLuma ( pic . getData ( ) [ 0 ] , pic . getWidth ( ) , pic . getHeight ( ) , out . getPlaneData ( 0 ) , off , out . getPlaneWidth ( 0 ) , xFp , yFp , w , h ) ; } else { safe [ ( yInd << 2 ) + xInd ] . getLuma ( pic . getData ( ) [ 0 ] , pic . getWidth ( ) , pic . getHeight ( ) , out . getPlaneData ( 0 ) , off , out . getPlaneWidth ( 0 ) , xFp , yFp , w , h ) ; }


signature:
public class BlockInterpolator { /** * Fullpel ( 0 , 0 ) unsafe */
static void getLuma00Unsafe ( byte [ ] pic , int picW , int picH , byte [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: int maxH = picH - 1 ; int maxW = picW - 1 ; for ( int j = 0 ; j < blkH ; j ++ ) { int lineStart = clip ( j + y , 0 , maxH ) * picW ; for ( int i = 0 ; i < blkW ; i ++ ) { blk [ blkOff + i ] = pic [ lineStart + clip ( x + i , 0 , maxW ) ] ; } blkOff += blkStride ; }


signature:
public class BlockInterpolator { /** * Halfpel ( 2,0 ) horizontal , int argument version */
static void getLuma20NoRoundInt ( int [ ] pic , int picW , int [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: int off = y * picW + x ; for ( int j = 0 ; j < blkH ; j ++ ) { int off1 = - 2 ; for ( int i = 0 ; i < blkW ; i ++ ) { int a = pic [ off + off1 ] + pic [ off + off1 + 5 ] ; int b = pic [ off + off1 + 1 ] + pic [ off + off1 + 4 ] ; int c = pic [ off + off1 + 2 ] + pic [ off + off1 + 3 ] ; blk [ blkOff + i ] = a + 5 * ( ( c << 2 ) - b ) ; ++ off1 ; } off += picW ; blkOff += blkStride ; }


signature:
public class BlockInterpolator { /** * Halfpel ( 2 , 0 ) horizontal unsafe */
static void getLuma20UnsafeNoRound ( byte [ ] pic , int picW , int picH , int [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: int maxW = picW - 1 ; int maxH = picH - 1 ; for ( int i = 0 ; i < blkW ; i ++ ) { int ipos_m2 = clip ( x + i - 2 , 0 , maxW ) ; int ipos_m1 = clip ( x + i - 1 , 0 , maxW ) ; int ipos = clip ( x + i , 0 , maxW ) ; int ipos_p1 = clip ( x + i + 1 , 0 , maxW ) ; int ipos_p2 = clip ( x + i + 2 , 0 , maxW ) ; int ipos_p3 = clip ( x + i + 3 , 0 , maxW ) ; int boff = blkOff ; for ( int j = 0 ; j < blkH ; j ++ ) { int lineStart = clip ( j + y , 0 , maxH ) * picW ; int a = pic [ lineStart + ipos_m2 ] + pic [ lineStart + ipos_p3 ] ; int b = pic [ lineStart + ipos_m1 ] + pic [ lineStart + ipos_p2 ] ; int c = pic [ lineStart + ipos ] + pic [ lineStart + ipos_p1 ] ; blk [ boff + i ] = a + 5 * ( ( c << 2 ) - b ) ; boff += blkStride ; } }


signature:
public class BlockInterpolator { /** * Hpel ( 0 , 2 ) vertical unsafe */
static void getLuma02UnsafeNoRound ( byte [ ] pic , int picW , int picH , int [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: int maxH = picH - 1 ; int maxW = picW - 1 ; for ( int j = 0 ; j < blkH ; j ++ ) { int offP0 = clip ( y + j - 2 , 0 , maxH ) * picW ; int offP1 = clip ( y + j - 1 , 0 , maxH ) * picW ; int offP2 = clip ( y + j , 0 , maxH ) * picW ; int offP3 = clip ( y + j + 1 , 0 , maxH ) * picW ; int offP4 = clip ( y + j + 2 , 0 , maxH ) * picW ; int offP5 = clip ( y + j + 3 , 0 , maxH ) * picW ; for ( int i = 0 ; i < blkW ; i ++ ) { int pres_x = clip ( x + i , 0 , maxW ) ; int a = pic [ pres_x + offP0 ] + pic [ pres_x + offP5 ] ; int b = pic [ pres_x + offP1 ] + pic [ pres_x + offP4 ] ; int c = pic [ pres_x + offP2 ] + pic [ pres_x + offP3 ] ; blk [ blkOff + i ] = a + 5 * ( ( c << 2 ) - b ) ; } blkOff += blkStride ; }


signature:
public class BlockInterpolator { /** * Qpel : ( 1,0 ) horizontal */
static void getLuma10 ( byte [ ] pic , int picW , byte [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: getLuma20 ( pic , picW , blk , blkOff , blkStride , x , y , blkW , blkH ) ; int off = y * picW + x ; for ( int j = 0 ; j < blkH ; j ++ ) { for ( int i = 0 ; i < blkW ; i ++ ) { blk [ blkOff + i ] = ( byte ) ( ( blk [ blkOff + i ] + pic [ off + i ] + 1 ) >> 1 ) ; } off += picW ; blkOff += blkStride ; }


signature:
public class BlockInterpolator { /** * Qpel vertical ( 0 , 3) */
static void getLuma03 ( byte [ ] pic , int picW , byte [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: getLuma02 ( pic , picW , blk , blkOff , blkStride , x , y , blkW , blkH ) ; int off = y * picW + x ; for ( int j = 0 ; j < blkH ; j ++ ) { for ( int i = 0 ; i < blkW ; i ++ ) { blk [ blkOff + i ] = ( byte ) ( ( blk [ blkOff + i ] + pic [ off + i + picW ] + 1 ) >> 1 ) ; } off += picW ; blkOff += blkStride ; }


signature:
public class BlockInterpolator { /** * Hpel horizontal , Qpel vertical ( 2 , 1) */
void getLuma21 ( byte [ ] pic , int picW , byte [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: getLuma20NoRound ( pic , picW , tmp1 , 0 , blkW , x , y - 2 , blkW , blkH + 7 ) ; getLuma02NoRoundInt ( tmp1 , blkW , tmp2 , blkOff , blkStride , 0 , 2 , blkW , blkH ) ; int off = blkW << 1 ; for ( int j = 0 ; j < blkH ; j ++ ) { for ( int i = 0 ; i < blkW ; i ++ ) { int rounded = clip ( ( tmp2 [ blkOff + i ] + 512 ) >> 10 , - 128 , 127 ) ; int rounded2 = clip ( ( tmp1 [ off + i ] + 16 ) >> 5 , - 128 , 127 ) ; blk [ blkOff + i ] = ( byte ) ( ( rounded + rounded2 + 1 ) >> 1 ) ; } blkOff += blkStride ; off += blkW ; }


signature:
public class BlockInterpolator { /** * Hpel horizontal , Hpel vertical ( 2 , 2) */
void getLuma22 ( byte [ ] pic , int picW , byte [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: getLuma20NoRound ( pic , picW , tmp1 , 0 , blkW , x , y - 2 , blkW , blkH + 7 ) ; getLuma02NoRoundInt ( tmp1 , blkW , tmp2 , blkOff , blkStride , 0 , 2 , blkW , blkH ) ; for ( int j = 0 ; j < blkH ; j ++ ) { for ( int i = 0 ; i < blkW ; i ++ ) { blk [ blkOff + i ] = ( byte ) ( clip ( ( tmp2 [ blkOff + i ] + 512 ) >> 10 , - 128 , 127 ) ) ; } blkOff += blkStride ; }


signature:
public class BlockInterpolator { /** * Hpel ( 2 , 2 ) unsafe */
void getLuma22Unsafe ( byte [ ] pic , int picW , int imgH , byte [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: getLuma20UnsafeNoRound ( pic , picW , imgH , tmp1 , 0 , blkW , x , y - 2 , blkW , blkH + 7 ) ; getLuma02NoRoundInt ( tmp1 , blkW , tmp2 , blkOff , blkStride , 0 , 2 , blkW , blkH ) ; for ( int j = 0 ; j < blkH ; j ++ ) { for ( int i = 0 ; i < blkW ; i ++ ) { blk [ blkOff + i ] = ( byte ) clip ( ( tmp2 [ blkOff + i ] + 512 ) >> 10 , - 128 , 127 ) ; } blkOff += blkStride ; }


signature:
public class BlockInterpolator { /** * Qpel ( 2 , 3 ) unsafe */
void getLuma23Unsafe ( byte [ ] pic , int picW , int imgH , byte [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: getLuma20UnsafeNoRound ( pic , picW , imgH , tmp1 , 0 , blkW , x , y - 2 , blkW , blkH + 7 ) ; getLuma02NoRoundInt ( tmp1 , blkW , tmp2 , blkOff , blkStride , 0 , 2 , blkW , blkH ) ; int off = blkW << 1 ; for ( int j = 0 ; j < blkH ; j ++ ) { for ( int i = 0 ; i < blkW ; i ++ ) { int rounded = clip ( ( tmp2 [ blkOff + i ] + 512 ) >> 10 , - 128 , 127 ) ; int rounded2 = clip ( ( tmp1 [ off + i + blkW ] + 16 ) >> 5 , - 128 , 127 ) ; blk [ blkOff + i ] = ( byte ) ( ( rounded + rounded2 + 1 ) >> 1 ) ; } blkOff += blkStride ; off += blkW ; }


signature:
public class BlockInterpolator { /** * Qpel horizontal , Hpel vertical ( 1 , 2) */
void getLuma12 ( byte [ ] pic , int picW , byte [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: int tmpW = blkW + 7 ; getLuma02NoRound ( pic , picW , tmp1 , 0 , tmpW , x - 2 , y , tmpW , blkH ) ; getLuma20NoRoundInt ( tmp1 , tmpW , tmp2 , blkOff , blkStride , 2 , 0 , blkW , blkH ) ; int off = 2 ; for ( int j = 0 ; j < blkH ; j ++ ) { for ( int i = 0 ; i < blkW ; i ++ ) { int rounded = clip ( ( tmp2 [ blkOff + i ] + 512 ) >> 10 , - 128 , 127 ) ; int rounded2 = clip ( ( tmp1 [ off + i ] + 16 ) >> 5 , - 128 , 127 ) ; blk [ blkOff + i ] = ( byte ) ( ( rounded + rounded2 + 1 ) >> 1 ) ; } blkOff += blkStride ; off += tmpW ; }


signature:
public class BlockInterpolator { /** * Qpel ( 1 , 2 ) unsafe */
void getLuma12Unsafe ( byte [ ] pic , int picW , int imgH , byte [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: int tmpW = blkW + 7 ; getLuma02UnsafeNoRound ( pic , picW , imgH , tmp1 , 0 , tmpW , x - 2 , y , tmpW , blkH ) ; getLuma20NoRoundInt ( tmp1 , tmpW , tmp2 , blkOff , blkStride , 2 , 0 , blkW , blkH ) ; int off = 2 ; for ( int j = 0 ; j < blkH ; j ++ ) { for ( int i = 0 ; i < blkW ; i ++ ) { int rounded = clip ( ( tmp2 [ blkOff + i ] + 512 ) >> 10 , - 128 , 127 ) ; int rounded2 = clip ( ( tmp1 [ off + i ] + 16 ) >> 5 , - 128 , 127 ) ; blk [ blkOff + i ] = ( byte ) ( ( rounded + rounded2 + 1 ) >> 1 ) ; } blkOff += blkStride ; off += tmpW ; }


signature:
public class BlockInterpolator { /** * Qpel ( 1 , 1 ) unsafe */
void getLuma11Unsafe ( byte [ ] pic , int picW , int imgH , byte [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: getLuma20Unsafe ( pic , picW , imgH , blk , blkOff , blkStride , x , y , blkW , blkH ) ; getLuma02Unsafe ( pic , picW , imgH , tmp3 , 0 , blkW , x , y , blkW , blkH ) ; merge ( blk , tmp3 , blkOff , blkStride , blkW , blkH ) ;


signature:
public class BlockInterpolator { /** * Qpel horizontal , Qpel vertical ( 1 , 3) */
void getLuma13 ( byte [ ] pic , int picW , byte [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: getLuma20 ( pic , picW , blk , blkOff , blkStride , x , y + 1 , blkW , blkH ) ; getLuma02 ( pic , picW , tmp3 , 0 , blkW , x , y , blkW , blkH ) ; merge ( blk , tmp3 , blkOff , blkStride , blkW , blkH ) ;


signature:
public class BlockInterpolator { /** * Qpel horizontal , Qpel vertical ( 3 , 1) */
void getLuma31 ( byte [ ] pels , int picW , byte [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: getLuma20 ( pels , picW , blk , blkOff , blkStride , x , y , blkW , blkH ) ; getLuma02 ( pels , picW , tmp3 , 0 , blkW , x + 1 , y , blkW , blkH ) ; merge ( blk , tmp3 , blkOff , blkStride , blkW , blkH ) ;


signature:
public class BlockInterpolator { /** * Qpel ( 3 , 1 ) unsafe */
void getLuma31Unsafe ( byte [ ] pels , int picW , int imgH , byte [ ] blk , int blkOff , int blkStride , int x , int y , int blkW , int blkH ) { } }

implementation: getLuma20Unsafe ( pels , picW , imgH , blk , blkOff , blkStride , x , y , blkW , blkH ) ; getLuma02Unsafe ( pels , picW , imgH , tmp3 , 0 , blkW , x + 1 , y , blkW , blkH ) ; merge ( blk , tmp3 , blkOff , blkStride , blkW , blkH ) ;