idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
41,600 | @ Override @ SuppressWarnings ( "unchecked" ) public < P > P get ( MetaProperty < P > metaProperty ) { return ( P ) getBuffer ( ) . get ( metaProperty ) ; } | Gets the buffered value associated with the specified property name . | 47 | 13 |
41,601 | private static Class < ? > decodeType0 ( String className , JodaBeanSer settings , String basePackage , Map < String , Class < ? > > knownTypes , Class < ? > defaultType ) throws ClassNotFoundException { // basic type Class < ? > result = BASIC_TYPES_REVERSED . get ( className ) ; if ( result != null ) { return result ... | internal type decode | 519 | 3 |
41,602 | public Map < String , Object > write ( Bean bean ) { JodaBeanUtils . notNull ( bean , "bean" ) ; return writeBean ( bean , bean . getClass ( ) ) ; } | Writes the bean to a string . | 46 | 8 |
41,603 | void writeBoolean ( boolean value ) throws IOException { if ( value ) { output . writeByte ( TRUE ) ; } else { output . writeByte ( FALSE ) ; } } | Writes a MessagePack boolean . | 38 | 7 |
41,604 | void writeInt ( int value ) throws IOException { if ( value < MIN_FIX_INT ) { // large negative if ( value >= Byte . MIN_VALUE ) { output . writeByte ( SINT_8 ) ; output . writeByte ( ( byte ) value ) ; } else if ( value >= Short . MIN_VALUE ) { output . writeByte ( SINT_16 ) ; output . writeShort ( ( short ) value ) ;... | Writes a MessagePack int . | 239 | 7 |
41,605 | void writeLong ( long value ) throws IOException { if ( value < MIN_FIX_INT ) { // large negative if ( value >= Byte . MIN_VALUE ) { output . writeByte ( SINT_8 ) ; output . writeByte ( ( byte ) value ) ; } else if ( value >= Short . MIN_VALUE ) { output . writeByte ( SINT_16 ) ; output . writeShort ( ( short ) value )... | Writes a MessagePack long . | 312 | 7 |
41,606 | void writeBytes ( byte [ ] bytes ) throws IOException { int size = bytes . length ; if ( size < 256 ) { output . writeByte ( BIN_8 ) ; output . writeByte ( size ) ; } else if ( size < 65536 ) { output . writeByte ( BIN_16 ) ; output . writeShort ( size ) ; } else { output . writeByte ( BIN_32 ) ; output . writeInt ( si... | Writes a MessagePack byte block . | 106 | 8 |
41,607 | void writeString ( String value ) throws IOException { byte [ ] bytes = toUTF8 ( value ) ; int size = bytes . length ; if ( size < 32 ) { output . writeByte ( MIN_FIX_STR + size ) ; } else if ( size < 256 ) { output . writeByte ( STR_8 ) ; output . writeByte ( size ) ; } else if ( size < 65536 ) { output . writeByte ( ... | Writes a MessagePack string . | 136 | 7 |
41,608 | void writeArrayHeader ( int size ) throws IOException { if ( size < 16 ) { output . writeByte ( MIN_FIX_ARRAY + size ) ; } else if ( size < 65536 ) { output . writeByte ( ARRAY_16 ) ; output . writeShort ( size ) ; } else { output . writeByte ( ARRAY_32 ) ; output . writeInt ( size ) ; } } | Writes a MessagePack array header . | 87 | 8 |
41,609 | void writeMapHeader ( int size ) throws IOException { if ( size < 16 ) { output . writeByte ( MIN_FIX_MAP + size ) ; } else if ( size < 65536 ) { output . writeByte ( MAP_16 ) ; output . writeShort ( size ) ; } else { output . writeByte ( MAP_32 ) ; output . writeInt ( size ) ; } } | Writes a MessagePack map header . | 84 | 8 |
41,610 | void writeExtensionByte ( int extensionType , int value ) throws IOException { output . write ( FIX_EXT_1 ) ; output . write ( extensionType ) ; output . write ( value ) ; } | Writes an extension string using FIX_EXT_1 . | 44 | 12 |
41,611 | void writeExtensionString ( int extensionType , String str ) throws IOException { byte [ ] bytes = str . getBytes ( UTF_8 ) ; if ( bytes . length > 256 ) { throw new IllegalArgumentException ( "String too long" ) ; } output . write ( EXT_8 ) ; output . write ( bytes . length ) ; output . write ( extensionType ) ; outpu... | Writes an extension string using EXT_8 . | 90 | 10 |
41,612 | void writePositiveExtensionInt ( int extensionType , int reference ) throws IOException { if ( reference < 0 ) { throw new IllegalArgumentException ( "Can only serialize positive references: " + reference ) ; } if ( reference < 0xFF ) { output . write ( FIX_EXT_1 ) ; output . write ( extensionType ) ; output . writeByt... | Writes an extension reference of a positive integer using FIX_EXT data types . | 161 | 16 |
41,613 | private void parseClassDescriptions ( ) throws Exception { int refCount = acceptInteger ( input . readByte ( ) ) ; if ( refCount < 0 ) { throw new IllegalArgumentException ( "Invalid binary data: Expected count of references, but was: " + refCount ) ; } refs = new Object [ refCount ] ; int classMapSize = acceptMap ( in... | parses the references | 176 | 5 |
41,614 | private ClassInfo parseClassInfo ( ) throws Exception { String className = acceptString ( input . readByte ( ) ) ; Class < ? > type = SerTypeMapper . decodeType ( className , settings , overrideBasePackage , null ) ; int propertyCount = acceptArray ( input . readByte ( ) ) ; if ( propertyCount < 0 ) { throw new Illegal... | parses the class information | 312 | 6 |
41,615 | private Object parseBean ( int propertyCount , ClassInfo classInfo ) { String propName = "" ; if ( classInfo . metaProperties . length != propertyCount ) { throw new IllegalArgumentException ( "Invalid binary data: Expected " + classInfo . metaProperties . length + " properties but was: " + propertyCount ) ; } try { Se... | parses the bean using the class information | 332 | 9 |
41,616 | Class < ? > getAndSerializeEffectiveTypeIfRequired ( Object value , Class < ? > declaredType ) throws IOException { Class < ? > realType = value . getClass ( ) ; Class < ? > effectiveType = declaredType ; if ( declaredType == Object . class ) { if ( realType != String . class ) { effectiveType = settings . getConverter... | needs to handle no declared type and subclass instances | 278 | 9 |
41,617 | void writeObjectAsString ( Object value , Class < ? > effectiveType ) throws IOException { String converted = settings . getConverter ( ) . convertToString ( effectiveType , value ) ; if ( converted == null ) { throw new IllegalArgumentException ( "Unable to write because converter returned a null string: " + value ) ;... | called after discerning that the value is not a simple type | 83 | 12 |
41,618 | private static MetaBean metaBeanLookup ( Class < ? > cls ) { // handle dynamic beans if ( cls == FlexiBean . class ) { return new FlexiBean ( ) . metaBean ( ) ; } else if ( cls == MapBean . class ) { return new MapBean ( ) . metaBean ( ) ; } else if ( DynamicBean . class . isAssignableFrom ( cls ) ) { try { return cls ... | lookup the MetaBean outside the fast path aiding hotspot inlining | 365 | 15 |
41,619 | private static List < File > findFiles ( final File parent , boolean recurse ) { final List < File > result = new ArrayList <> ( ) ; if ( parent . isDirectory ( ) ) { File [ ] files = parent . listFiles ( ) ; files = ( files != null ? files : new File [ 0 ] ) ; for ( File child : files ) { if ( child . isFile ( ) && ch... | Finds the set of files to process . | 205 | 9 |
41,620 | private File processFile ( File file ) throws Exception { List < String > original = readFile ( file ) ; List < String > content = new ArrayList <> ( original ) ; BeanGen gen ; try { BeanParser parser = new BeanParser ( file , content , config ) ; gen = parser . parse ( ) ; } catch ( BeanCodeGenException ex ) { throw e... | Processes the bean generating the code . | 469 | 8 |
41,621 | private void writeClassDescriptions ( BeanReferences references ) throws IOException { // write out ref count first, which is the number of instances that are referenced output . writeInt ( references . getReferences ( ) . size ( ) ) ; // write map of class name to a list of metatype names (which is empty if not a bean... | determines what beans occur more than once and setup references | 213 | 12 |
41,622 | public static < R > StandaloneMetaProperty < R > of ( String propertyName , MetaBean metaBean , Class < R > clazz ) { return new StandaloneMetaProperty <> ( propertyName , metaBean , clazz , clazz ) ; } | Creates a non - generified property . | 57 | 9 |
41,623 | public byte [ ] write ( Bean bean , boolean rootType ) { ByteArrayOutputStream baos = new ByteArrayOutputStream ( 1024 ) ; try { write ( bean , rootType , baos ) ; } catch ( IOException ex ) { throw new IllegalStateException ( ex ) ; } return baos . toByteArray ( ) ; } | Writes the bean to an array of bytes . | 72 | 10 |
41,624 | protected void propertySet ( Bean bean , String propertyName , Object value , boolean quiet ) { // used to enable 100% test coverage in beans if ( quiet ) { return ; } throw new NoSuchElementException ( "Unknown property: " + propertyName ) ; } | Sets the value of the property . | 55 | 8 |
41,625 | private void findChildBeans ( Object obj , MetaProperty < ? > mp , Class < ? > beanClass , Deque < Bean > temp ) { if ( obj != null ) { if ( obj instanceof Bean ) { temp . addFirst ( ( Bean ) obj ) ; } else { SerIterator it = SerIteratorFactory . INSTANCE . create ( obj , mp , beanClass ) ; if ( it != null ) { while ( ... | find child beans including those in collections | 170 | 7 |
41,626 | private void findReferences ( ImmutableBean root ) { // handle root bean classes . put ( root . getClass ( ) , classInfoFromMetaBean ( root . metaBean ( ) , root . getClass ( ) ) ) ; classSerializationCount . put ( root . getClass ( ) , 1 ) ; // recursively check object graph Map < Object , Integer > objects = new Link... | finds classes and references within the bean | 468 | 8 |
41,627 | private void findReferencesBean ( Object base , Class < ? > declaredClass , Map < Object , Integer > objects , SerIterator parentIterator ) { if ( base == null ) { return ; } // has this object been seen before, if so no need to check it again int result = objects . compute ( base , BeanReferences :: incrementOrOne ) ;... | recursively find the references | 418 | 6 |
41,628 | private void findReferencesIterable ( SerIterator itemIterator , Map < Object , Integer > objects ) { if ( itemIterator . category ( ) == SerCategory . MAP ) { while ( itemIterator . hasNext ( ) ) { itemIterator . next ( ) ; findReferencesBean ( itemIterator . key ( ) , itemIterator . keyType ( ) , objects , null ) ; f... | recursively find the references in an iterable | 395 | 10 |
41,629 | private void addClassInfoAndIncrementCount ( Class < ? > type , ClassInfo classInfo ) { classes . putIfAbsent ( type , classInfo ) ; classSerializationCount . compute ( type , BeanReferences :: incrementOrOne ) ; } | adds the class incrementing the number of times it is used | 53 | 13 |
41,630 | private ClassInfo classInfoFromMetaBean ( MetaBean metaBean , Class < ? > aClass ) { MetaProperty < ? > [ ] metaProperties = StreamSupport . stream ( metaBean . metaPropertyIterable ( ) . spliterator ( ) , false ) . filter ( metaProp -> settings . isSerialized ( metaProp ) ) . toArray ( MetaProperty < ? > [ ] :: new ) ... | converts a meta - bean to a ClassInfo | 116 | 10 |
41,631 | ClassInfo getClassInfo ( Class < ? > effectiveType ) { ClassInfo classInfo = classes . get ( effectiveType ) ; if ( classInfo == null ) { throw new IllegalStateException ( "Tried to serialise class that wasn't present in bean on first pass: " + effectiveType . getName ( ) ) ; } return classInfo ; } | lookup the class info by type | 75 | 7 |
41,632 | private void writeObject ( Class < ? > declaredType , Object obj , SerIterator parentIterator ) throws IOException { if ( obj == null ) { output . writeNull ( ) ; } else if ( settings . getConverter ( ) . isConvertible ( obj . getClass ( ) ) ) { writeSimple ( declaredType , obj ) ; } else if ( obj instanceof Bean ) { w... | write collection object | 172 | 3 |
41,633 | private < T > T parseVersion ( DataInputStream input , Class < T > declaredType ) throws Exception { // root array int arrayByte = input . readByte ( ) ; int versionByte = input . readByte ( ) ; switch ( versionByte ) { case 1 : if ( arrayByte != MIN_FIX_ARRAY + 2 ) { throw new IllegalArgumentException ( "Invalid binar... | parses the version | 247 | 5 |
41,634 | public static CacheFrame [ ] get ( Throwable throwable ) { if ( throwable == null ) { return null ; } Map < Throwable , CacheFrame [ ] > weakMap = cache . get ( ) ; return weakMap . get ( throwable ) ; } | Get the cached frames associated with the given throwable . | 56 | 11 |
41,635 | public void setPersonData ( final String id , final String username , final String email ) { this . rollbar . configure ( new ConfigProvider ( ) { @ Override public Config provide ( ConfigBuilder builder ) { return builder . person ( new PersonProvider ( id , username , email ) ) . build ( ) ; } } ) ; } | Set the person data to include with future items . | 70 | 10 |
41,636 | public void clearPersonData ( ) { this . rollbar . configure ( new ConfigProvider ( ) { @ Override public Config provide ( ConfigBuilder builder ) { return builder . person ( null ) . build ( ) ; } } ) ; } | Remove any person data that might be set . | 50 | 9 |
41,637 | public void setIncludeLogcat ( final boolean includeLogcat ) { final int versionCode = this . versionCode ; final String versionName = this . versionName ; this . rollbar . configure ( new ConfigProvider ( ) { @ Override public Config provide ( ConfigBuilder builder ) { ClientProvider clientProvider = new ClientProvide... | Toggle whether to include logcat output in items . | 118 | 11 |
41,638 | public void critical ( Throwable error , Map < String , Object > custom ) { critical ( error , custom , null ) ; } | Record a critical error with extra information attached . | 27 | 9 |
41,639 | public void critical ( Throwable error , Map < String , Object > custom , String description ) { log ( error , custom , description , Level . CRITICAL ) ; } | Record a critical error with custom parameters and human readable description . | 36 | 12 |
41,640 | public void warning ( Throwable error , Map < String , Object > custom ) { warning ( error , custom , null ) ; } | Record a warning error with extra information attached . | 27 | 9 |
41,641 | public void warning ( Throwable error , Map < String , Object > custom , String description ) { log ( error , custom , description , Level . WARNING ) ; } | Record a warning error with custom parameters and human readable description . | 34 | 12 |
41,642 | public void info ( Throwable error , Map < String , Object > custom ) { info ( error , custom , null ) ; } | Record an info error with extra information attached . | 27 | 9 |
41,643 | public void info ( Throwable error , Map < String , Object > custom , String description ) { log ( error , custom , description , Level . INFO ) ; } | Record an info error with custom parameters and human readable description . | 34 | 12 |
41,644 | public void debug ( Throwable error , Map < String , Object > custom ) { debug ( error , custom , null ) ; } | Record a debug error with extra information attached . | 27 | 9 |
41,645 | public void debug ( Throwable error , Map < String , Object > custom , String description ) { log ( error , custom , description , Level . DEBUG ) ; } | Record a debug error with custom parameters and human readable description . | 34 | 12 |
41,646 | public void log ( Throwable error , Level level ) { log ( error , null , null , level ) ; } | Log an error at level specified . | 24 | 7 |
41,647 | public void log ( Throwable error , String description , Level level ) { log ( error , null , description , level ) ; } | Record a debug error with human readable description at the specified level . | 27 | 13 |
41,648 | public void log ( String message , Level level ) { log ( null , null , message , level ) ; } | Record a message at the level specified . | 23 | 8 |
41,649 | public void log ( String message , Map < String , Object > custom , Level level ) { log ( null , custom , message , level ) ; } | Record a message with extra information attached at the specified level . | 31 | 12 |
41,650 | @ Deprecated public static void reportException ( final Throwable throwable , final String level ) { reportException ( throwable , level , null , null ) ; } | report an exception to Rollbar specifying the level . | 34 | 10 |
41,651 | @ Deprecated public static void reportException ( final Throwable throwable , final String level , final String description , final Map < String , String > params ) { ensureInit ( new Runnable ( ) { @ Override public void run ( ) { notifier . log ( throwable , params != null ? Collections . < String , Object > unmodifi... | report an exception to Rollbar specifying the level adding a custom description and including extra data . | 98 | 18 |
41,652 | @ Deprecated public static void reportMessage ( final String message , final String level ) { reportMessage ( message , level , null ) ; } | Report a message to Rollbar specifying the level . | 29 | 10 |
41,653 | @ Deprecated public static void reportMessage ( final String message , final String level , final Map < String , String > params ) { ensureInit ( new Runnable ( ) { @ Override public void run ( ) { notifier . log ( message , params != null ? Collections . < String , Object > unmodifiableMap ( params ) : null , Level . ... | Report a message to Rollbar specifying the level and including extra data . | 89 | 14 |
41,654 | public String greeting ( ) { int current = counter . getAndAdd ( 1 ) ; if ( current % 2 != 0 ) { return format ( "Hello Rollbar number %d" , current ) ; } throw new RuntimeException ( "Fatal error at greeting number: " + current ) ; } | Get the greeting message . | 62 | 5 |
41,655 | public static ConfigProvider getConfigProvider ( String configProviderClassName ) { ConfigProvider configProvider = null ; if ( configProviderClassName != null && ! "" . equals ( configProviderClassName ) ) { Class userConfigProviderClass = null ; try { userConfigProviderClass = Class . forName ( configProviderClassNam... | Instantiate a ConfigProvider object based on the class name given as parameter . | 182 | 15 |
41,656 | public void critical ( Throwable error , String description ) { log ( error , null , description , Level . CRITICAL ) ; } | Record a critical error with human readable description . | 28 | 9 |
41,657 | public void error ( Throwable error , String description ) { log ( error , null , description , Level . ERROR ) ; } | Record an error with human readable description . | 26 | 8 |
41,658 | public void warning ( Throwable error , String description ) { log ( error , null , description , Level . WARNING ) ; } | Record a warning with human readable description . | 26 | 8 |
41,659 | public void info ( Throwable error , String description ) { log ( error , null , description , Level . INFO ) ; } | Record an info error with human readable description . | 26 | 9 |
41,660 | public void debug ( Throwable error , String description ) { log ( error , null , description , Level . DEBUG ) ; } | Record a debug error with human readable description . | 26 | 9 |
41,661 | public void log ( Throwable error , Map < String , Object > custom , String description , Level level , boolean isUncaught ) { this . rollbar . log ( error , custom , description , level , isUncaught ) ; } | Record an error or message with extra data at the level specified . At least ene of error or description must be non - null . If error is null description will be sent as a message . If error is non - null description will be sent as the description of the error . Custom data will be attached to message if the error is... | 51 | 69 |
41,662 | @ Deprecated public Body from ( Throwable throwable , String description ) { if ( throwable == null ) { return new Body . Builder ( ) . bodyContent ( message ( description ) ) . build ( ) ; } return from ( new RollbarThrowableWrapper ( throwable ) , description ) ; } | Builds the body for the throwable and description supplied . | 65 | 12 |
41,663 | public static Rollbar init ( Config config ) { if ( notifier == null ) { synchronized ( Rollbar . class ) { if ( notifier == null ) { notifier = new Rollbar ( config ) ; LOGGER . debug ( "Rollbar managed notifier created." ) ; } } } return notifier ; } | Method to initialize the library managed notifier instance . | 67 | 10 |
41,664 | public void configure ( Config config ) { LOGGER . debug ( "Reloading configuration." ) ; this . configWriteLock . lock ( ) ; try { this . config = config ; processAppPackages ( config ) ; } finally { this . configWriteLock . unlock ( ) ; } } | Replace the configuration of this instance directly . | 62 | 9 |
41,665 | public void sendJsonPayload ( String json ) { try { this . configReadLock . lock ( ) ; Config config = this . config ; this . configReadLock . unlock ( ) ; sendPayload ( config , new Payload ( json ) ) ; } catch ( Exception e ) { LOGGER . error ( "Error while sending payload to Rollbar: {}" , e ) ; } } | Send JSON payload . | 84 | 4 |
41,666 | public static < T > T requireNonNull ( T object , String errorMessage ) { if ( object == null ) { throw new NullPointerException ( errorMessage ) ; } else { return object ; } } | Checks that the specified object reference is not null . | 44 | 11 |
41,667 | @ PluginFactory public static RollbarAppender createAppender ( @ PluginAttribute ( "accessToken" ) @ Required final String accessToken , @ PluginAttribute ( "endpoint" ) final String endpoint , @ PluginAttribute ( "environment" ) final String environment , @ PluginAttribute ( "language" ) final String language , @ Plug... | Create appender plugin factory method . | 283 | 7 |
41,668 | public static Intent newEmailIntent ( String address , String subject , String body ) { return newEmailIntent ( address , subject , body , null ) ; } | Create an intent to send an email to a single recipient | 34 | 11 |
41,669 | public static Intent newEmailIntent ( String address , String subject , String body , Uri attachment ) { return newEmailIntent ( address == null ? null : new String [ ] { address } , subject , body , attachment ) ; } | Create an intent to send an email with an attachment to a single recipient | 49 | 14 |
41,670 | public static Intent newEmailIntent ( String [ ] addresses , String subject , String body , Uri attachment ) { Intent intent = new Intent ( Intent . ACTION_SEND ) ; if ( addresses != null ) intent . putExtra ( Intent . EXTRA_EMAIL , addresses ) ; if ( body != null ) intent . putExtra ( Intent . EXTRA_TEXT , body ) ; if... | Create an intent to send an email with an attachment | 143 | 10 |
41,671 | public static Intent newPlayYouTubeVideoIntent ( String videoId ) { try { return new Intent ( Intent . ACTION_VIEW , Uri . parse ( "vnd.youtube:" + videoId ) ) ; } catch ( ActivityNotFoundException ex ) { return new Intent ( Intent . ACTION_VIEW , Uri . parse ( "http://www.youtube.com/watch?v=" + videoId ) ) ; } } | Open a YouTube video . If the app is not installed it opens it in the browser | 88 | 17 |
41,672 | public static Intent newPlayMediaIntent ( Uri uri , String type ) { Intent intent = new Intent ( Intent . ACTION_VIEW ) ; intent . setDataAndType ( uri , type ) ; return intent ; } | Open the media player to play the given media Uri | 47 | 10 |
41,673 | public static Intent newTakePictureIntent ( File tempFile ) { Intent intent = new Intent ( MediaStore . ACTION_IMAGE_CAPTURE ) ; intent . putExtra ( MediaStore . EXTRA_OUTPUT , Uri . fromFile ( tempFile ) ) ; return intent ; } | Creates an intent that will launch the camera to take a picture that s saved to a temporary file so you can use it directly without going through the gallery . | 62 | 32 |
41,674 | public static Intent newSelectPictureIntent ( ) { Intent intent = new Intent ( Intent . ACTION_PICK ) ; intent . setType ( "image/*" ) ; return intent ; } | Creates an intent that will launch the phone s picture gallery to select a picture from it . | 40 | 19 |
41,675 | public static Intent newShareTextIntent ( String subject , String message , String chooserDialogTitle ) { Intent shareIntent = new Intent ( Intent . ACTION_SEND ) ; shareIntent . putExtra ( Intent . EXTRA_TEXT , message ) ; shareIntent . putExtra ( Intent . EXTRA_SUBJECT , subject ) ; shareIntent . setType ( MIME_TYPE_... | Creates a chooser to share some data . | 107 | 10 |
41,676 | public static Intent newSmsIntent ( Context context , String body , String [ ] phoneNumbers ) { Uri smsUri ; if ( phoneNumbers == null || phoneNumbers . length == 0 ) { smsUri = Uri . parse ( "smsto:" ) ; } else { smsUri = Uri . parse ( "smsto:" + Uri . encode ( TextUtils . join ( "," , phoneNumbers ) ) ) ; } Intent in... | Creates an intent that will allow to send an SMS to a phone number | 214 | 15 |
41,677 | public static Intent newMarketForAppIntent ( Context context ) { String packageName = context . getApplicationContext ( ) . getPackageName ( ) ; return newMarketForAppIntent ( context , packageName ) ; } | Intent that should open the app store of the device on the current application page | 47 | 16 |
41,678 | public static Intent newMarketForAppIntent ( Context context , String packageName ) { Intent intent = new Intent ( Intent . ACTION_VIEW , Uri . parse ( "market://details?id=" + packageName ) ) ; if ( ! IntentUtils . isIntentAvailable ( context , intent ) ) { intent = new Intent ( Intent . ACTION_VIEW , Uri . parse ( "a... | Intent that should open the app store of the device on the given application | 174 | 15 |
41,679 | public static Intent newGooglePlayIntent ( Context context , String packageName ) { Intent intent = new Intent ( Intent . ACTION_VIEW , Uri . parse ( "market://details?id=" + packageName ) ) ; if ( ! IntentUtils . isIntentAvailable ( context , intent ) ) { intent = MediaIntents . newOpenWebBrowserIntent ( "https://play... | Intent that should open either the Google Play app or if not available the web browser on the Google Play website | 154 | 22 |
41,680 | private String getSymbolExceptions ( ) { if ( TextUtils . isEmpty ( filteredMask ) ) return "" ; StringBuilder maskSymbolException = new StringBuilder ( ) ; for ( char c : filteredMask . toCharArray ( ) ) { if ( ! Character . isDigit ( c ) && maskSymbolException . indexOf ( String . valueOf ( c ) ) == - 1 ) { maskSymbo... | Generate symbol exception for inputType = number | 122 | 9 |
41,681 | public E remove ( int index ) { E e = data [ index ] ; // make copy of element to remove so it can be returned data [ index ] = data [ -- size ] ; // overwrite item to remove with last element data [ size ] = null ; // null last element, so gc can do its work return e ; } | Removes the element at the specified position in this Bag . Order of elements is not preserved . | 70 | 19 |
41,682 | public E removeLast ( ) { if ( size > 0 ) { E e = data [ -- size ] ; data [ size ] = null ; return e ; } return null ; } | Removes and return the last object in the bag . | 38 | 11 |
41,683 | public boolean remove ( E e ) { for ( int i = 0 ; i < size ; i ++ ) { E e2 = data [ i ] ; if ( e == e2 ) { data [ i ] = data [ -- size ] ; // overwrite item to remove with last element data [ size ] = null ; // null last element, so gc can do its work return true ; } } return false ; } | Removes the first occurrence of the specified element from this Bag if it is present . If the Bag does not contain the element it is unchanged . It does not preserve order of elements . | 87 | 37 |
41,684 | public boolean contains ( E e ) { for ( int i = 0 ; size > i ; i ++ ) { if ( e == data [ i ] ) { return true ; } } return false ; } | Check if bag contains this element . The operator == is used to check for equality . | 42 | 17 |
41,685 | public void add ( E e ) { // is size greater than capacity increase capacity if ( size == data . length ) { grow ( ) ; } data [ size ++ ] = e ; } | Adds the specified element to the end of this bag . if needed also increases the capacity of the bag . | 39 | 21 |
41,686 | public void set ( int index , E e ) { if ( index >= data . length ) { grow ( index * 2 ) ; } size = index + 1 ; data [ index ] = e ; } | Set element at specified index in the bag . | 42 | 9 |
41,687 | public void addEntity ( Entity entity ) { boolean delayed = updating || familyManager . notifying ( ) ; entityManager . addEntity ( entity , delayed ) ; } | Adds an entity to this Engine . This will throw an IllegalArgumentException if the given entity was already registered with an engine . | 34 | 26 |
41,688 | public void removeEntity ( Entity entity ) { boolean delayed = updating || familyManager . notifying ( ) ; entityManager . removeEntity ( entity , delayed ) ; } | Removes an entity from this Engine . | 34 | 8 |
41,689 | public void update ( float deltaTime ) { if ( updating ) { throw new IllegalStateException ( "Cannot call update() on an Engine that is already updating." ) ; } updating = true ; ImmutableArray < EntitySystem > systems = systemManager . getSystems ( ) ; try { for ( int i = 0 ; i < systems . size ( ) ; ++ i ) { EntitySy... | Updates all the systems in this Engine . | 169 | 9 |
41,690 | @ SuppressWarnings ( "unchecked" ) < T extends Component > T getComponent ( ComponentType componentType ) { int componentTypeIndex = componentType . getIndex ( ) ; if ( componentTypeIndex < components . getCapacity ( ) ) { return ( T ) components . get ( componentType . getIndex ( ) ) ; } else { return null ; } } | Internal use . | 80 | 3 |
41,691 | public void dispatch ( T object ) { final Object [ ] items = listeners . begin ( ) ; for ( int i = 0 , n = listeners . size ; i < n ; i ++ ) { Listener < T > listener = ( Listener < T > ) items [ i ] ; listener . receive ( this , object ) ; } listeners . end ( ) ; } | Dispatches an event to all Listeners registered to this Signal | 77 | 13 |
41,692 | private static void warmup ( Argon2 argon2 , char [ ] password ) { for ( int i = 0 ; i < WARMUP_RUNS ; i ++ ) { argon2 . hash ( MIN_ITERATIONS , MIN_MEMORY , MIN_PARALLELISM , password ) ; } } | Calls Argon2 a number of times to warm up the JIT | 70 | 14 |
41,693 | private byte [ ] toByteArray ( char [ ] chars , Charset charset ) { assert chars != null ; CharBuffer charBuffer = CharBuffer . wrap ( chars ) ; ByteBuffer byteBuffer = charset . encode ( charBuffer ) ; byte [ ] bytes = Arrays . copyOfRange ( byteBuffer . array ( ) , byteBuffer . position ( ) , byteBuffer . limit ( ) )... | Converts the given char array to a UTF - 8 encoded byte array . | 112 | 15 |
41,694 | public < T > T makeRequest ( String call , String method , boolean authenticate , ApiRequestWriter writer , ApiResponseReader < T > reader ) { HttpURLConnection connection = null ; try { connection = sendRequest ( call , method , authenticate , writer ) ; handleResponseCode ( connection ) ; if ( reader != null ) return... | Make a request to the Http Osm Api | 169 | 11 |
41,695 | public ChangesetInfo get ( long id ) { SingleElementHandler < ChangesetInfo > handler = new SingleElementHandler <> ( ) ; String query = CHANGESET + "/" + id + "?include_discussion=true" ; try { osm . makeAuthenticatedRequest ( query , null , new ChangesetParser ( handler ) ) ; } catch ( OsmNotFoundException e ) { retu... | Get the changeset information with the given id . Always includes the changeset discussion . | 98 | 17 |
41,696 | public void find ( Handler < ChangesetInfo > handler , QueryChangesetsFilters filters ) { String query = filters != null ? "?" + filters . toParamString ( ) : "" ; try { osm . makeAuthenticatedRequest ( CHANGESET + "s" + query , null , new ChangesetParser ( handler ) ) ; } catch ( OsmNotFoundException e ) { // ok, we a... | Get a number of changesets that match the given filters . | 96 | 12 |
41,697 | public ChangesetInfo comment ( long id , String text ) { if ( text . isEmpty ( ) ) { throw new IllegalArgumentException ( "Text must not be empty" ) ; } SingleElementHandler < ChangesetInfo > handler = new SingleElementHandler <> ( ) ; String apiCall = CHANGESET + "/" + id + "/comment?text=" + urlEncodeText ( text ) ; ... | Add a comment to the given changeset . The changeset must already be closed . Adding a comment to a changeset automatically subscribes the user to it . | 119 | 32 |
41,698 | public ChangesetInfo subscribe ( long id ) { SingleElementHandler < ChangesetInfo > handler = new SingleElementHandler <> ( ) ; ChangesetInfo result ; try { String apiCall = CHANGESET + "/" + id + "/subscribe" ; osm . makeAuthenticatedRequest ( apiCall , "POST" , new ChangesetParser ( handler ) ) ; result = handler . g... | Subscribe the user to a changeset discussion . The changeset must be closed already . | 126 | 17 |
41,699 | public ChangesetInfo unsubscribe ( long id ) { SingleElementHandler < ChangesetInfo > handler = new SingleElementHandler <> ( ) ; ChangesetInfo result ; try { String apiCall = CHANGESET + "/" + id + "/unsubscribe" ; osm . makeAuthenticatedRequest ( apiCall , "POST" , new ChangesetParser ( handler ) ) ; result = handler... | Unsubscribe the user from a changeset discussion . The changeset must be closed already . | 200 | 19 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.