idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
148,400
public ClassNode addInterface ( String name ) { ClassNode intf = infoBase . node ( name ) ; addInterface ( intf ) ; return this ; }
Specify the class represented by this ClassNode implements an interface specified by the given name
148,401
public ClassNode annotatedWith ( String name ) { ClassNode anno = infoBase . node ( name ) ; this . annotations . add ( anno ) ; anno . annotated . add ( this ) ; return this ; }
Specify the class represented by this ClassNode is annotated by an annotation class specified by the name
148,402
public static int timezoneOffset ( H . Session session ) { String s = null != session ? session . get ( SESSION_KEY ) : null ; return S . notBlank ( s ) ? Integer . parseInt ( s ) : serverTimezoneOffset ( ) ; }
Returns timezone offset from a session instance . The offset is in minutes to UTC time
148,403
public void sendJsonToUrl ( Object data , String url ) { sendToUrl ( JSON . toJSONString ( data ) , url ) ; }
Send JSON representation of given data object to all connections connected to given URL
148,404
public void sendToTagged ( String message , String ... labels ) { for ( String label : labels ) { sendToTagged ( message , label ) ; } }
Send message to all connections tagged with all given tags
148,405
public void sendJsonToTagged ( Object data , String label ) { sendToTagged ( JSON . toJSONString ( data ) , label ) ; }
Send JSON representation of given data object to all connections tagged with given label
148,406
public void sendJsonToTagged ( Object data , String ... labels ) { for ( String label : labels ) { sendJsonToTagged ( data , label ) ; } }
Send JSON representation of given data object to all connections tagged with all give tag labels
148,407
public void sendJsonToUser ( Object data , String username ) { sendToUser ( JSON . toJSONString ( data ) , username ) ; }
Send JSON representation of given data object to all connections of a user
148,408
private static boolean isBinary ( InputStream in ) { try { int size = in . available ( ) ; if ( size > 1024 ) size = 1024 ; byte [ ] data = new byte [ size ] ; in . read ( data ) ; in . close ( ) ; int ascii = 0 ; int other = 0 ; for ( int i = 0 ; i < data . length ; i ++ ) { byte b = data [ i ] ; if ( b < 0x09 ) retur...
Guess whether given file is binary . Just checks for anything under 0x09 .
148,409
public String toText ( ) { StringBuilder sb = new StringBuilder ( ) ; if ( ! description . isEmpty ( ) ) { sb . append ( description . toText ( ) ) ; sb . append ( EOL ) ; } if ( ! blockTags . isEmpty ( ) ) { sb . append ( EOL ) ; } for ( JavadocBlockTag tag : blockTags ) { sb . append ( tag . toText ( ) ) . append ( E...
Return the text content of the document . It does not containing trailing spaces and asterisks at the start of the line .
148,410
public JavadocComment toComment ( String indentation ) { for ( char c : indentation . toCharArray ( ) ) { if ( ! Character . isWhitespace ( c ) ) { throw new IllegalArgumentException ( "The indentation string should be composed only by whitespace characters" ) ; } } StringBuilder sb = new StringBuilder ( ) ; sb . appen...
Create a JavadocComment by formatting the text of the Javadoc using the given indentation .
148,411
public static boolean isTemplatePath ( String string ) { int sz = string . length ( ) ; if ( sz == 0 ) { return true ; } for ( int i = 0 ; i < sz ; ++ i ) { char c = string . charAt ( i ) ; switch ( c ) { case ' ' : case '\t' : case '\b' : case '<' : case '>' : case '(' : case ')' : case '[' : case ']' : case '{' : cas...
Check if a given string is a template path or template content
148,412
public static PasswordSpec parse ( String spec ) { char [ ] ca = spec . toCharArray ( ) ; int len = ca . length ; illegalIf ( 0 == len , spec ) ; Builder builder = new Builder ( ) ; StringBuilder minBuf = new StringBuilder ( ) ; StringBuilder maxBuf = new StringBuilder ( ) ; boolean lenSpecStart = false ; boolean minPa...
Parse a string representation of password spec .
148,413
protected final void _onConnect ( WebSocketContext context ) { if ( null != connectionListener ) { connectionListener . onConnect ( context ) ; } connectionListenerManager . notifyFreeListeners ( context , false ) ; Act . eventBus ( ) . emit ( new WebSocketConnectEvent ( context ) ) ; }
Called by implementation class once websocket connection established at networking layer .
148,414
public String genId ( ) { S . Buffer sb = S . newBuffer ( ) ; sb . a ( longEncoder . longToStr ( nodeIdProvider . nodeId ( ) ) ) . a ( longEncoder . longToStr ( startIdProvider . startId ( ) ) ) . a ( longEncoder . longToStr ( sequenceProvider . seqId ( ) ) ) ; return sb . toString ( ) ; }
Generate a unique ID across the cluster
148,415
synchronized void bulkRegisterSingleton ( ) { for ( Map . Entry < Class < ? extends AppService > , AppService > entry : registry . entrySet ( ) ) { if ( isSingletonService ( entry . getKey ( ) ) ) { app . registerSingleton ( entry . getKey ( ) , entry . getValue ( ) ) ; } } }
Called when app s singleton registry has been initialized
148,416
public Set < String > paramKeys ( ) { Set < String > set = new HashSet < String > ( ) ; set . addAll ( C . < String > list ( request . paramNames ( ) ) ) ; set . addAll ( extraParams . keySet ( ) ) ; set . addAll ( bodyParams ( ) . keySet ( ) ) ; set . remove ( "_method" ) ; set . remove ( "_body" ) ; return set ; }
Get all parameter keys .
148,417
public ActionContext applyContentType ( Result result ) { if ( ! result . status ( ) . isError ( ) ) { return applyContentType ( ) ; } return applyContentType ( contentTypeForErrorResult ( req ( ) ) ) ; }
Apply content type to response with result provided .
148,418
public < T > T cached ( String key ) { H . Session sess = session ( ) ; if ( null != sess ) { return sess . cached ( key ) ; } else { return app ( ) . cache ( ) . get ( key ) ; } }
Return cached object by key . The key will be concatenated with current session id when fetching the cached object
148,419
public void cache ( String key , Object obj ) { H . Session sess = session ( ) ; if ( null != sess ) { sess . cache ( key , obj ) ; } else { app ( ) . cache ( ) . put ( key , obj ) ; } }
Add an object into cache by key . The key will be used in conjunction with session id if there is a session instance
148,420
public void cache ( String key , Object obj , int expiration ) { H . Session session = this . session ; if ( null != session ) { session . cache ( key , obj , expiration ) ; } else { app ( ) . cache ( ) . put ( key , obj , expiration ) ; } }
Add an object into cache by key with expiration time specified
148,421
public void evictCache ( String key ) { H . Session sess = session ( ) ; if ( null != sess ) { sess . evict ( key ) ; } else { app ( ) . cache ( ) . evict ( key ) ; } }
Evict cached object
148,422
public void login ( Object userIdentifier ) { session ( ) . put ( config ( ) . sessionKeyUsername ( ) , userIdentifier ) ; app ( ) . eventBus ( ) . trigger ( new LoginEvent ( userIdentifier . toString ( ) ) ) ; }
Update the context session to mark a user logged in
148,423
public void loginAndRedirectBack ( Object userIdentifier , String defaultLandingUrl ) { login ( userIdentifier ) ; RedirectToLoginUrl . redirectToOriginalUrl ( this , defaultLandingUrl ) ; }
Login the user and redirect back to original URL . If no original URL found then redirect to defaultLandingUrl .
148,424
public void logout ( ) { String userIdentifier = session . get ( config ( ) . sessionKeyUsername ( ) ) ; SessionManager sessionManager = app ( ) . sessionManager ( ) ; sessionManager . logout ( session ) ; if ( S . notBlank ( userIdentifier ) ) { app ( ) . eventBus ( ) . trigger ( new LogoutEvent ( userIdentifier ) ) ;...
Logout the current session . After calling this method the session will be cleared
148,425
public static void init ( String jobId ) { JobContext parent = current_ . get ( ) ; JobContext ctx = new JobContext ( parent ) ; current_ . set ( ctx ) ; ctx . jobId = jobId ; if ( null == parent ) { Act . eventBus ( ) . trigger ( new JobContextInitialized ( ctx ) ) ; } }
make it public for CLI interaction to reuse JobContext
148,426
public static void clear ( ) { JobContext ctx = current_ . get ( ) ; if ( null != ctx ) { ctx . bag_ . clear ( ) ; JobContext parent = ctx . parent ; if ( null != parent ) { current_ . set ( parent ) ; ctx . parent = null ; } else { current_ . remove ( ) ; Act . eventBus ( ) . trigger ( new JobContextDestroyed ( ctx ) ...
Clear JobContext of current thread
148,427
public static < T > T get ( String key , Class < T > clz ) { return ( T ) m ( ) . get ( key ) ; }
Generic version of getting value by key from the JobContext of current thread
148,428
static JobContext copy ( ) { JobContext current = current_ . get ( ) ; JobContext ctxt = new JobContext ( null ) ; if ( null != current ) { ctxt . bag_ . putAll ( current . bag_ ) ; } return ctxt ; }
Make a copy of JobContext of current thread
148,429
static void loadFromOrigin ( JobContext origin ) { if ( origin . bag_ . isEmpty ( ) ) { return ; } ActContext < ? > actContext = ActContext . Base . currentContext ( ) ; if ( null != actContext ) { Locale locale = ( Locale ) origin . bag_ . get ( "locale" ) ; if ( null != locale ) { actContext . locale ( locale ) ; } H...
Initialize current thread s JobContext using specified copy
148,430
public String getToken ( ) { String id = null == answer ? text : answer ; return Act . app ( ) . crypto ( ) . generateToken ( id ) ; }
Returns an encrypted token combined with answer .
148,431
public String expand ( String macro ) { if ( ! isMacro ( macro ) ) { return macro ; } String definition = macros . get ( Config . canonical ( macro ) ) ; if ( null == definition ) { warn ( "possible missing definition of macro[%s]" , macro ) ; } return null == definition ? macro : definition ; }
Expand a macro .
148,432
public static boolean isPackageOrClassName ( String s ) { if ( S . blank ( s ) ) { return false ; } S . List parts = S . fastSplit ( s , "." ) ; if ( parts . size ( ) < 2 ) { return false ; } for ( String part : parts ) { if ( ! Character . isJavaIdentifierStart ( part . charAt ( 0 ) ) ) { return false ; } for ( int i ...
Check if a given string is a valid java package or class name .
148,433
public static String packageNameOf ( Class < ? > clazz ) { String name = clazz . getName ( ) ; int pos = name . lastIndexOf ( '.' ) ; E . unexpectedIf ( pos < 0 , "Class does not have package: " + name ) ; return name . substring ( 0 , pos ) ; }
Returns package name of a class
148,434
public static RouteInfo of ( ActionContext context ) { H . Method m = context . req ( ) . method ( ) ; String path = context . req ( ) . url ( ) ; RequestHandler handler = context . handler ( ) ; if ( null == handler ) { handler = UNKNOWN_HANDLER ; } return new RouteInfo ( m , path , handler ) ; }
used by Error template
148,435
public List < WebSocketConnection > get ( String key ) { final List < WebSocketConnection > retList = new ArrayList < > ( ) ; accept ( key , C . F . addTo ( retList ) ) ; return retList ; }
Return a list of websocket connection by key
148,436
public void signIn ( String key , WebSocketConnection connection ) { ConcurrentMap < WebSocketConnection , WebSocketConnection > bag = ensureConnectionList ( key ) ; bag . put ( connection , connection ) ; }
Sign in a connection to the registry by key .
148,437
public void signIn ( String key , Collection < WebSocketConnection > connections ) { if ( connections . isEmpty ( ) ) { return ; } Map < WebSocketConnection , WebSocketConnection > newMap = new HashMap < > ( ) ; for ( WebSocketConnection conn : connections ) { newMap . put ( conn , conn ) ; } ConcurrentMap < WebSocketC...
Sign in a group of connections to the registry by key
148,438
public void signOff ( String key , WebSocketConnection connection ) { ConcurrentMap < WebSocketConnection , WebSocketConnection > connections = registry . get ( key ) ; if ( null == connections ) { return ; } connections . remove ( connection ) ; }
Detach a connection from a key .
148,439
public void signOff ( WebSocketConnection connection ) { for ( ConcurrentMap < WebSocketConnection , WebSocketConnection > connections : registry . values ( ) ) { connections . remove ( connection ) ; } }
Remove a connection from all keys .
148,440
public void signOff ( String key , Collection < WebSocketConnection > connections ) { if ( connections . isEmpty ( ) ) { return ; } ConcurrentMap < WebSocketConnection , WebSocketConnection > bag = ensureConnectionList ( key ) ; bag . keySet ( ) . removeAll ( connections ) ; }
Sign off a group of connections from the registry by key
148,441
public int count ( ) { int n = 0 ; for ( ConcurrentMap < ? , ? > bag : registry . values ( ) ) { n += bag . size ( ) ; } return n ; }
Returns the connection count in this registry .
148,442
public int count ( String key ) { ConcurrentMap < WebSocketConnection , WebSocketConnection > bag = registry . get ( key ) ; return null == bag ? 0 : bag . size ( ) ; }
Returns the connection count by key specified in this registry
148,443
public static Object tryGetSingleton ( Class < ? > invokerClass , App app ) { Object singleton = app . singleton ( invokerClass ) ; if ( null == singleton ) { if ( isGlobalOrStateless ( invokerClass , new HashSet < Class > ( ) ) ) { singleton = app . getInstance ( invokerClass ) ; } } if ( null != singleton ) { app . r...
If the invokerClass specified is singleton or without field or all fields are stateless then return an instance of the invoker class . Otherwise return null
148,444
private static final void writeJson ( Writer os , Object object , SerializeConfig config , SerializeFilter [ ] filters , DateFormat dateFormat , int defaultFeatures , SerializerFeature ... features ) { SerializeWriter writer = new SerializeWriter ( os , defaultFeatures , features ) ; try { JSONSerializer serializer = n...
FastJSON does not provide the API so we have to create our own
148,445
public Set < Class > entityClasses ( ) { EntityMetaInfoRepo repo = app ( ) . entityMetaInfoRepo ( ) . forDb ( id ) ; return null == repo ? C . < Class > set ( ) : repo . entityClasses ( ) ; }
Returns all model classes registered on this datasource
148,446
public WebSocketContext messageReceived ( String receivedMessage ) { this . stringMessage = S . string ( receivedMessage ) . trim ( ) ; isJson = stringMessage . startsWith ( "{" ) || stringMessage . startsWith ( "]" ) ; tryParseQueryParams ( ) ; return this ; }
Called when remote end send a message to this connection
148,447
public WebSocketContext reTag ( String label ) { WebSocketConnectionRegistry registry = manager . tagRegistry ( ) ; registry . signOff ( connection ) ; registry . signIn ( label , connection ) ; return this ; }
Re - Tag the websocket connection hold by this context with label specified . This method will remove all previous tags on the websocket connection and then tag it with the new label .
148,448
public WebSocketContext sendToPeers ( String message , boolean excludeSelf ) { return sendToConnections ( message , url , manager . urlRegistry ( ) , excludeSelf ) ; }
Send message to all connections connected to the same URL of this context
148,449
public WebSocketContext sendToTagged ( String message , String tag ) { return sendToTagged ( message , tag , false ) ; }
Send message to all connections labeled with tag specified with self connection excluded
148,450
public WebSocketContext sendToTagged ( String message , String tag , boolean excludeSelf ) { return sendToConnections ( message , tag , manager . tagRegistry ( ) , excludeSelf ) ; }
Send message to all connections labeled with tag specified .
148,451
public WebSocketContext sendToUser ( String message , String username ) { return sendToConnections ( message , username , manager . usernameRegistry ( ) , true ) ; }
Send message to all connections of a certain user
148,452
public WebSocketContext sendJsonToUser ( Object data , String username ) { return sendToTagged ( JSON . toJSONString ( data ) , username ) ; }
Send JSON representation of a data object to all connections of a certain user
148,453
public void bindMappers ( ) { JacksonXmlModule xmlModule = new JacksonXmlModule ( ) ; xmlModule . setDefaultUseWrapper ( false ) ; XmlMapper xmlMapper = new XmlMapper ( xmlModule ) ; xmlMapper . enable ( ToXmlGenerator . Feature . WRITE_XML_DECLARATION ) ; this . bind ( XmlMapper . class ) . toInstance ( xmlMapper ) ; ...
Override for customizing XmlMapper and ObjectMapper
148,454
public Swagger read ( Set < Class < ? > > classes ) { Set < Class < ? > > sortedClasses = new TreeSet < > ( ( class1 , class2 ) -> { if ( class1 . equals ( class2 ) ) { return 0 ; } else if ( class1 . isAssignableFrom ( class2 ) ) { return - 1 ; } else if ( class2 . isAssignableFrom ( class1 ) ) { return 1 ; } return c...
Scans a set of classes for both ReaderListeners and Swagger annotations . All found listeners will be instantiated before any of the classes are scanned for Swagger annotations - so they can be invoked accordingly .
148,455
public Swagger read ( Class < ? > cls ) { SwaggerDefinition swaggerDefinition = cls . getAnnotation ( SwaggerDefinition . class ) ; if ( swaggerDefinition != null ) { readSwaggerConfig ( cls , swaggerDefinition ) ; } return read ( cls , "" , null , false , new String [ 0 ] , new String [ 0 ] , new LinkedHashMap < > ( )...
Scans a single class for Swagger annotations - does not invoke ReaderListeners
148,456
protected void generateRoutes ( ) { try { TypeSpec . Builder typeBuilder = TypeSpec . classBuilder ( className ) . addModifiers ( Modifier . PUBLIC ) . addSuperinterface ( ParameterizedTypeName . get ( Supplier . class , RoutingHandler . class ) ) ; ClassName extractorClass = ClassName . get ( "io.sinistral.proteus.ser...
Generates the routing Java source code
148,457
public ProteusApplication addDefaultRoutes ( RoutingHandler router ) { if ( config . hasPath ( "health.statusPath" ) ) { try { final String statusPath = config . getString ( "health.statusPath" ) ; router . add ( Methods . GET , statusPath , ( final HttpServerExchange exchange ) -> { exchange . getResponseHeaders ( ) ....
Add utility routes the router
148,458
public ProteusApplication setServerConfigurationFunction ( Function < Undertow . Builder , Undertow . Builder > serverConfigurationFunction ) { this . serverConfigurationFunction = serverConfigurationFunction ; return this ; }
Allows direct access to the Undertow . Builder for custom configuration
148,459
static DisplayMetrics getDisplayMetrics ( final Context context ) { final WindowManager windowManager = ( WindowManager ) context . getSystemService ( Context . WINDOW_SERVICE ) ; final DisplayMetrics metrics = new DisplayMetrics ( ) ; windowManager . getDefaultDisplay ( ) . getMetrics ( metrics ) ; return metrics ; }
Returns a valid DisplayMetrics object
148,460
private static Bitmap crop ( Bitmap srcBmp , View canvasView , int downsampling ) { float scale = 1f / downsampling ; return Bitmap . createBitmap ( srcBmp , ( int ) Math . floor ( ( ViewCompat . getX ( canvasView ) ) * scale ) , ( int ) Math . floor ( ( ViewCompat . getY ( canvasView ) ) * scale ) , ( int ) Math . flo...
crops the srcBmp with the canvasView bounds and returns the cropped bitmap
148,461
public void startTask ( int id , String taskName ) { if ( isActivated ) { durations . add ( new Duration ( id , taskName , BenchmarkUtil . elapsedRealTimeNanos ( ) ) ) ; } }
Start a task . The id is needed to end the task
148,462
public double getDurationMs ( ) { double durationMs = 0 ; for ( Duration duration : durations ) { if ( duration . taskFinished ( ) ) { durationMs += duration . getDurationMS ( ) ; } } return durationMs ; }
Returns the duration of the measured tasks in ms
148,463
public static void setViewBackground ( View v , Drawable d ) { if ( Build . VERSION . SDK_INT >= 16 ) { v . setBackground ( d ) ; } else { v . setBackgroundDrawable ( d ) ; } }
legacy helper for setting background
148,464
public static int byteSizeOf ( Bitmap bitmap ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . KITKAT ) { return bitmap . getAllocationByteCount ( ) ; } else if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . HONEYCOMB_MR1 ) { return bitmap . getByteCount ( ) ; } else { return bitmap . getRowBytes ( ...
returns the bytesize of the give bitmap
148,465
public static String getCacheDir ( Context ctx ) { return Environment . MEDIA_MOUNTED . equals ( Environment . getExternalStorageState ( ) ) || ( ! Environment . isExternalStorageRemovable ( ) && ctx . getExternalCacheDir ( ) != null ) ? ctx . getExternalCacheDir ( ) . getPath ( ) : ctx . getCacheDir ( ) . getPath ( ) ...
Gets the appropriate cache dir
148,466
public Point measureImage ( Resources resources ) { BitmapFactory . Options justBoundsOptions = new BitmapFactory . Options ( ) ; justBoundsOptions . inJustDecodeBounds = true ; if ( bitmap != null ) { return new Point ( bitmap . getWidth ( ) , bitmap . getHeight ( ) ) ; } else if ( resId != null ) { BitmapFactory . de...
If the not a bitmap itself this will read the file s meta data .
148,467
public synchronized int cancelByTag ( String tagToCancel ) { int i = 0 ; if ( taskList . containsKey ( tagToCancel ) ) { removeDoneTasks ( ) ; for ( Future < BlurWorker . Result > future : taskList . get ( tagToCancel ) ) { BuilderUtil . logVerbose ( Dali . getConfig ( ) . logTag , "Canceling task with tag " + tagToCan...
Cancel all task with this tag and returns the canceled task count
148,468
public static Bitmap flip ( Bitmap src ) { Matrix m = new Matrix ( ) ; m . preScale ( - 1 , 1 ) ; return Bitmap . createBitmap ( src , 0 , 0 , src . getWidth ( ) , src . getHeight ( ) , m , false ) ; }
Mirrors the given bitmap
148,469
public void purge ( String cacheKey ) { try { if ( useMemoryCache ) { if ( memoryCache != null ) { memoryCache . remove ( cacheKey ) ; } } if ( useDiskCache ) { if ( diskLruCache != null ) { diskLruCache . remove ( cacheKey ) ; } } } catch ( Exception e ) { Log . w ( TAG , "Could not remove entry in cache purge" , e ) ...
Removes the value connected to the given key from all levels of the cache . Will not throw an exception on fail .
148,470
public RenderScript getRenderScript ( ) { if ( renderScript == null ) { renderScript = RenderScript . create ( context , renderScriptContextType ) ; } return renderScript ; }
Syncronously creates a Renderscript context if none exists . Creating a Renderscript context takes about 20 ms in Nexus 5
148,471
private void renderBlurLayer ( float slideOffset ) { if ( enableBlur ) { if ( slideOffset == 0 || forceRedraw ) { clearBlurView ( ) ; } if ( slideOffset > 0f && blurView == null ) { if ( drawerLayout . getChildCount ( ) == 2 ) { blurView = new ImageView ( drawerLayout . getContext ( ) ) ; blurView . setLayoutParams ( n...
This will blur the view behind it and set it in a imageview over the content with a alpha value that corresponds to slideOffset .
148,472
public void onDrawerOpened ( View drawerView ) { super . onDrawerOpened ( drawerView ) ; if ( listener != null ) listener . onDrawerClosed ( drawerView ) ; }
Called when a drawer has settled in a completely open state .
148,473
public static IBlur getIBlurAlgorithm ( EBlurAlgorithm algorithm , ContextWrapper contextWrapper ) { RenderScript rs = contextWrapper . getRenderScript ( ) ; Context ctx = contextWrapper . getContext ( ) ; switch ( algorithm ) { case RS_GAUSS_FAST : return new RenderScriptGaussianBlur ( rs ) ; case RS_BOX_5x5 : return ...
Creates an IBlur instance for the given algorithm enum
148,474
public BlurBuilder downScale ( int scaleInSample ) { data . options . inSampleSize = Math . min ( Math . max ( 1 , scaleInSample ) , 16384 ) ; return this ; }
Will scale the image down before processing for performance enhancement and less memory usage sacrificing image quality .
148,475
public BlurBuilder brightness ( float brightness ) { data . preProcessors . add ( new RenderscriptBrightnessProcessor ( data . contextWrapper . getRenderScript ( ) , brightness , data . contextWrapper . getResources ( ) ) ) ; return this ; }
Set brightness to eg . darken the resulting image for use as background
148,476
public BlurBuilder contrast ( float contrast ) { data . preProcessors . add ( new ContrastProcessor ( data . contextWrapper . getRenderScript ( ) , Math . max ( Math . min ( 1500.f , contrast ) , - 1500.f ) ) ) ; return this ; }
Change contrast of the image
148,477
public static synchronized void resetAndSetNewConfig ( Context ctx , Config config ) { GLOBAL_CONFIG = config ; if ( DISK_CACHE_MANAGER != null ) { DISK_CACHE_MANAGER . clear ( ) ; DISK_CACHE_MANAGER = null ; createCache ( ctx ) ; } if ( EXECUTOR_MANAGER != null ) { EXECUTOR_MANAGER . shutDown ( ) ; EXECUTOR_MANAGER = ...
Sets a new config and clears the previous cache
148,478
public static int getIbanLength ( final CountryCode countryCode ) { final BbanStructure structure = getBbanStructure ( countryCode ) ; return COUNTRY_CODE_LENGTH + CHECK_DIGIT_LENGTH + structure . getBbanLength ( ) ; }
Returns iban length for the specified country .
148,479
public static String getCountryCodeAndCheckDigit ( final String iban ) { return iban . substring ( COUNTRY_CODE_INDEX , COUNTRY_CODE_INDEX + COUNTRY_CODE_LENGTH + CHECK_DIGIT_LENGTH ) ; }
Returns iban s country code and check digit .
148,480
static String replaceCheckDigit ( final String iban , final String checkDigit ) { return getCountryCode ( iban ) + checkDigit + getBban ( iban ) ; }
Returns an iban with replaced check digit .
148,481
static String toFormattedString ( final String iban ) { final StringBuilder ibanBuffer = new StringBuilder ( iban ) ; final int length = ibanBuffer . length ( ) ; for ( int i = 0 ; i < length / 4 ; i ++ ) { ibanBuffer . insert ( ( i + 1 ) * 4 + i , ' ' ) ; } return ibanBuffer . toString ( ) . trim ( ) ; }
Returns formatted version of Iban .
148,482
public static Bic valueOf ( final String bic ) throws BicFormatException , UnsupportedCountryException { BicUtil . validate ( bic ) ; return new Bic ( bic ) ; }
Returns a Bic object holding the value of the specified String .
148,483
public static void validate ( final String bic ) throws BicFormatException , UnsupportedCountryException { try { validateEmpty ( bic ) ; validateLength ( bic ) ; validateCase ( bic ) ; validateBankCode ( bic ) ; validateCountryCode ( bic ) ; validateLocationCode ( bic ) ; if ( hasBranchCode ( bic ) ) { validateBranchCo...
Validates bic .
148,484
public < X > X getScreenshotAs ( OutputType < X > target ) { String base64 = ( String ) execute ( DriverCommand . SCREENSHOT ) . getValue ( ) ; return target . convertFromBase64Png ( base64 ) ; }
Take screenshot of the current window .
148,485
public PayloadBuilder sound ( final String sound ) { if ( sound != null ) { aps . put ( "sound" , sound ) ; } else { aps . remove ( "sound" ) ; } return this ; }
Sets the alert sound to be played .
148,486
public PayloadBuilder category ( final String category ) { if ( category != null ) { aps . put ( "category" , category ) ; } else { aps . remove ( "category" ) ; } return this ; }
Sets the category of the notification for iOS8 notification actions . See 13 minutes into What s new in iOS Notifications
148,487
public PayloadBuilder customField ( final String key , final Object value ) { root . put ( key , value ) ; return this ; }
Sets any application - specific custom fields . The values are presented to the application and the iPhone doesn t display them automatically .
148,488
public PayloadBuilder resizeAlertBody ( final int payloadLength , final String postfix ) { int currLength = length ( ) ; if ( currLength <= payloadLength ) { return this ; } String body = ( String ) customAlert . get ( "body" ) ; final int acceptableSize = Utilities . toUTF8Bytes ( body ) . length - ( currLength - payl...
Shrinks the alert message body so that the resulting payload message fits within the passed expected payload length .
148,489
public String build ( ) { if ( ! root . containsKey ( "mdm" ) ) { insertCustomAlert ( ) ; root . put ( "aps" , aps ) ; } try { return mapper . writeValueAsString ( root ) ; } catch ( final Exception e ) { throw new RuntimeException ( e ) ; } }
Returns the JSON String representation of the payload according to Apple APNS specification
148,490
public ApnsServiceBuilder withSocksProxy ( String host , int port ) { Proxy proxy = new Proxy ( Proxy . Type . SOCKS , new InetSocketAddress ( host , port ) ) ; return withProxy ( proxy ) ; }
Specify the address of the SOCKS proxy the connection should use .
148,491
public ApnsServiceBuilder withAuthProxy ( Proxy proxy , String proxyUsername , String proxyPassword ) { this . proxy = proxy ; this . proxyUsername = proxyUsername ; this . proxyPassword = proxyPassword ; return this ; }
Specify the proxy and the authentication parameters to be used to establish the connections to Apple Servers .
148,492
public ApnsServiceBuilder withProxySocket ( Socket proxySocket ) { return this . withProxy ( new Proxy ( Proxy . Type . SOCKS , proxySocket . getRemoteSocketAddress ( ) ) ) ; }
Specify the socket to be used as underlying socket to connect to the APN service .
148,493
public ApnsServiceBuilder withDelegate ( ApnsDelegate delegate ) { this . delegate = delegate == null ? ApnsDelegate . EMPTY : delegate ; return this ; }
Sets the delegate of the service that gets notified of the status of message delivery .
148,494
public int length ( ) { int length = 1 + 2 + deviceToken . length + 2 + payload . length ; final int marshalledLength = marshall ( ) . length ; assert marshalledLength == length ; return length ; }
Returns the length of the message in bytes as it is encoded on the wire .
148,495
public void setPadding ( float padding , Layout . Axis axis ) { OrientedLayout layout = null ; switch ( axis ) { case X : layout = mShiftLayout ; break ; case Y : layout = mShiftLayout ; break ; case Z : layout = mStackLayout ; break ; } if ( layout != null ) { if ( ! equal ( layout . getDividerPadding ( axis ) , paddi...
Sets padding between the pages
148,496
public void setShiftOrientation ( OrientedLayout . Orientation orientation ) { if ( mShiftLayout . getOrientation ( ) != orientation && orientation != OrientedLayout . Orientation . STACK ) { mShiftLayout . setOrientation ( orientation ) ; requestLayout ( ) ; } }
Sets page shift orientation . The pages might be shifted horizontally or vertically relative to each other to make the content of each page on the screen at least partially visible
148,497
public boolean removeHandlerFor ( final GVRSceneObject sceneObject ) { sceneObject . detachComponent ( GVRCollider . getComponentType ( ) ) ; return null != touchHandlers . remove ( sceneObject ) ; }
Makes the object unpickable and removes the touch handler for it
148,498
public void makePickable ( GVRSceneObject sceneObject ) { try { GVRMeshCollider collider = new GVRMeshCollider ( sceneObject . getGVRContext ( ) , false ) ; sceneObject . attachComponent ( collider ) ; } catch ( Exception e ) { Log . e ( Log . SUBSYSTEM . INPUT , TAG , "makePickable(): possible that some objects (X3D p...
Makes the scene object pickable by eyes . However the object has to be touchable to process the touch events .
148,499
static boolean isInCircle ( float x , float y , float centerX , float centerY , float radius ) { return Math . abs ( x - centerX ) < radius && Math . abs ( y - centerY ) < radius ; }
Check if a position is within a circle