idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
151,200
public Object put ( List < Map . Entry > batch ) throws InterruptedException { if ( initializeClusterSource ( ) ) { return clusterSource . put ( batch ) ; } return null ; }
Writes batch of data to the source
151,201
public < T > T eval ( ELVars vars , String el , Class < T > returnType ) throws ELEvalException { Utils . checkNotNull ( vars , "vars" ) ; Utils . checkNotNull ( el , "expression" ) ; Utils . checkNotNull ( returnType , "returnType" ) ; VARIABLES_IN_SCOPE_TL . set ( vars ) ; try { return evaluate ( vars , el , returnTy...
Evaluates an EL .
151,202
public String getLinkCopyText ( JSONObject jsonObject ) { if ( jsonObject == null ) return "" ; try { JSONObject copyObject = jsonObject . has ( "copyText" ) ? jsonObject . getJSONObject ( "copyText" ) : null ; if ( copyObject != null ) { return copyObject . has ( "text" ) ? copyObject . getString ( "text" ) : "" ; } e...
Returns the text for the JSONObject of Link provided The JSONObject of Link provided should be of the type copy
151,203
public String getLinkUrl ( JSONObject jsonObject ) { if ( jsonObject == null ) return null ; try { JSONObject urlObject = jsonObject . has ( "url" ) ? jsonObject . getJSONObject ( "url" ) : null ; if ( urlObject == null ) return null ; JSONObject androidObject = urlObject . has ( "android" ) ? urlObject . getJSONObject...
Returns the text for the JSONObject of Link provided The JSONObject of Link provided should be of the type url
151,204
public String getLinkColor ( JSONObject jsonObject ) { if ( jsonObject == null ) return null ; try { return jsonObject . has ( "color" ) ? jsonObject . getString ( "color" ) : "" ; } catch ( JSONException e ) { Logger . v ( "Unable to get Link Text Color with JSON - " + e . getLocalizedMessage ( ) ) ; return null ; } }
Returns the text color for the JSONObject of Link provided
151,205
static void onActivityCreated ( Activity activity ) { if ( instances == null ) { CleverTapAPI . createInstanceIfAvailable ( activity , null ) ; } if ( instances == null ) { Logger . v ( "Instances is null in onActivityCreated!" ) ; return ; } boolean alreadyProcessedByCleverTap = false ; Bundle notification = null ; Ur...
static lifecycle callbacks
151,206
static void handleNotificationClicked ( Context context , Bundle notification ) { if ( notification == null ) return ; String _accountId = null ; try { _accountId = notification . getString ( Constants . WZRK_ACCT_ID_KEY ) ; } catch ( Throwable t ) { } if ( instances == null ) { CleverTapAPI instance = createInstanceIf...
other static handlers
151,207
public static CleverTapAPI getInstance ( Context context ) throws CleverTapMetaDataNotFoundException , CleverTapPermissionsNotSatisfied { sdkVersion = BuildConfig . SDK_VERSION_STRING ; return getDefaultInstance ( context ) ; }
Returns an instance of the CleverTap SDK .
151,208
@ SuppressWarnings ( "WeakerAccess" ) public static CleverTapAPI getDefaultInstance ( Context context ) { sdkVersion = BuildConfig . SDK_VERSION_STRING ; if ( defaultConfig == null ) { ManifestInfo manifest = ManifestInfo . getInstance ( context ) ; String accountId = manifest . getAccountId ( ) ; String accountToken =...
Returns the default shared instance of the CleverTap SDK .
151,209
private void destroySession ( ) { currentSessionId = 0 ; setAppLaunchPushed ( false ) ; getConfigLogger ( ) . verbose ( getAccountId ( ) , "Session destroyed; Session ID is now 0" ) ; clearSource ( ) ; clearMedium ( ) ; clearCampaign ( ) ; clearWzrkParams ( ) ; }
Destroys the current session
151,210
private String FCMGetFreshToken ( final String senderID ) { String token = null ; try { if ( senderID != null ) { getConfigLogger ( ) . verbose ( getAccountId ( ) , "FcmManager: Requesting a FCM token with Sender Id - " + senderID ) ; token = FirebaseInstanceId . getInstance ( ) . getToken ( senderID , FirebaseMessagin...
request token from FCM
151,211
private String GCMGetFreshToken ( final String senderID ) { getConfigLogger ( ) . verbose ( getAccountId ( ) , "GcmManager: Requesting a GCM token for Sender ID - " + senderID ) ; String token = null ; try { token = InstanceID . getInstance ( context ) . getToken ( senderID , GoogleCloudMessaging . INSTANCE_ID_SCOPE , ...
request token from GCM
151,212
@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public void setOffline ( boolean value ) { offline = value ; if ( offline ) { getConfigLogger ( ) . debug ( getAccountId ( ) , "CleverTap Instance has been set to offline, won't send events queue" ) ; } else { getConfigLogger ( ) . debug ( getAccountId ( ) , "CleverT...
If you want to stop recorded events from being sent to the server use this method to set the SDK instance to offline . Once offline events will be recorded and queued locally but will not be sent to the server until offline is disabled . Calling this method again with offline set to false will allow events to be sent t...
151,213
@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public void enableDeviceNetworkInfoReporting ( boolean value ) { enableNetworkInfoReporting = value ; StorageHelper . putBoolean ( context , storageKeyWithSuffix ( Constants . NETWORK_INFO ) , enableNetworkInfoReporting ) ; getConfigLogger ( ) . verbose ( getAccountI...
Use this method to enable device network - related information tracking including IP address . This reporting is disabled by default . To re - disable tracking call this method with enabled set to false .
151,214
@ SuppressWarnings ( "unused" ) public String getDevicePushToken ( final PushType type ) { switch ( type ) { case GCM : return getCachedGCMToken ( ) ; case FCM : return getCachedFCMToken ( ) ; default : return null ; } }
Returns the device push token or null
151,215
private void attachMeta ( final JSONObject o , final Context context ) { try { o . put ( "mc" , Utils . getMemoryConsumption ( ) ) ; } catch ( Throwable t ) { } try { o . put ( "nt" , Utils . getCurrentNetworkType ( context ) ) ; } catch ( Throwable t ) { } }
Attaches meta info about the current state of the device to an event . Typically this meta is added only to the ping event .
151,216
@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public void recordScreen ( String screenName ) { if ( screenName == null || ( ! currentScreenName . isEmpty ( ) && currentScreenName . equals ( screenName ) ) ) return ; getConfigLogger ( ) . debug ( getAccountId ( ) , "Screen changed to " + screenName ) ; currentScr...
Record a Screen View event
151,217
private void clearQueues ( final Context context ) { synchronized ( eventLock ) { DBAdapter adapter = loadDBAdapter ( context ) ; DBAdapter . Table tableName = DBAdapter . Table . EVENTS ; adapter . removeEvents ( tableName ) ; tableName = DBAdapter . Table . PROFILE_EVENTS ; adapter . removeEvents ( tableName ) ; clea...
Only call async
151,218
private QueueCursor updateCursorForDBObject ( JSONObject dbObject , QueueCursor cursor ) { if ( dbObject == null ) return cursor ; Iterator < String > keys = dbObject . keys ( ) ; if ( keys . hasNext ( ) ) { String key = keys . next ( ) ; cursor . setLastId ( key ) ; try { cursor . setData ( dbObject . getJSONArray ( k...
helper extracts the cursor data from the db object
151,219
private JSONObject getARP ( final Context context ) { try { final String nameSpaceKey = getNamespaceARPKey ( ) ; if ( nameSpaceKey == null ) return null ; final SharedPreferences prefs = StorageHelper . getPreferences ( context , nameSpaceKey ) ; final Map < String , ? > all = prefs . getAll ( ) ; final Iterator < ? ex...
The ARP is additional request parameters which must be sent once received after any HTTP call . This is sort of a proxy for cookies .
151,220
@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public int getTotalVisits ( ) { EventDetail ed = getLocalDataStore ( ) . getEventDetail ( Constants . APP_LAUNCHED_EVENT ) ; if ( ed != null ) return ed . getCount ( ) ; return 0 ; }
Returns the total number of times the app has been launched
151,221
@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public int getTimeElapsed ( ) { int currentSession = getCurrentSession ( ) ; if ( currentSession == 0 ) return - 1 ; int now = ( int ) ( System . currentTimeMillis ( ) / 1000 ) ; return now - currentSession ; }
Returns the time elapsed by the user on the app
151,222
@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public UTMDetail getUTMDetails ( ) { UTMDetail ud = new UTMDetail ( ) ; ud . setSource ( source ) ; ud . setMedium ( medium ) ; ud . setCampaign ( campaign ) ; return ud ; }
Returns a UTMDetail object which consists of UTM parameters like source medium & campaign
151,223
private void _handleMultiValues ( ArrayList < String > values , String key , String command ) { if ( key == null ) return ; if ( values == null || values . isEmpty ( ) ) { _generateEmptyMultiValueError ( key ) ; return ; } ValidationResult vr ; vr = validator . cleanMultiValuePropertyKey ( key ) ; if ( vr . getErrorCod...
private multi - value handlers and helpers
151,224
@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public void pushEvent ( String eventName ) { if ( eventName == null || eventName . trim ( ) . equals ( "" ) ) return ; pushEvent ( eventName , null ) ; }
Pushes a basic event .
151,225
@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public void pushNotificationViewedEvent ( Bundle extras ) { if ( extras == null || extras . isEmpty ( ) || extras . get ( Constants . NOTIFICATION_TAG ) == null ) { getConfigLogger ( ) . debug ( getAccountId ( ) , "Push notification: " + ( extras == null ? "NULL" : e...
Pushes the Notification Viewed event to CleverTap .
151,226
@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public int getCount ( String event ) { EventDetail eventDetail = getLocalDataStore ( ) . getEventDetail ( event ) ; if ( eventDetail != null ) return eventDetail . getCount ( ) ; return - 1 ; }
Returns the total count of the specified event
151,227
private void pushDeviceToken ( final String token , final boolean register , final PushType type ) { pushDeviceToken ( this . context , token , register , type ) ; }
For internal use don t call the public API internally
151,228
@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public static NotificationInfo getNotificationInfo ( final Bundle extras ) { if ( extras == null ) return new NotificationInfo ( false , false ) ; boolean fromCleverTap = extras . containsKey ( Constants . NOTIFICATION_TAG ) ; boolean shouldRender = fromCleverTap && ...
Checks whether this notification is from CleverTap .
151,229
@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public void pushInstallReferrer ( Intent intent ) { try { final Bundle extras = intent . getExtras ( ) ; if ( extras == null || ! extras . containsKey ( "referrer" ) ) { return ; } final String url ; try { url = URLDecoder . decode ( extras . getString ( "referrer" )...
This method is used to push install referrer via Intent
151,230
@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public synchronized void pushInstallReferrer ( String source , String medium , String campaign ) { if ( source == null && medium == null && campaign == null ) return ; try { int status = StorageHelper . getInt ( context , "app_install_status" , 0 ) ; if ( status != 0...
This method is used to push install referrer via UTM source medium & campaign parameters
151,231
@ SuppressWarnings ( "unused" ) public static void changeCredentials ( String accountID , String token ) { changeCredentials ( accountID , token , null ) ; }
This method is used to change the credentials of CleverTap account Id and token programmatically
151,232
@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public static void changeCredentials ( String accountID , String token , String region ) { if ( defaultConfig != null ) { Logger . i ( "CleverTap SDK already initialized with accountID:" + defaultConfig . getAccountId ( ) + " and token:" + defaultConfig . getAccountT...
This method is used to change the credentials of CleverTap account Id token and region programmatically
151,233
@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public int getInboxMessageCount ( ) { synchronized ( inboxControllerLock ) { if ( this . ctInboxController != null ) { return ctInboxController . count ( ) ; } else { getConfigLogger ( ) . debug ( getAccountId ( ) , "Notification Inbox not initialized" ) ; return - 1...
Returns the count of all inbox messages for the user
151,234
@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public int getInboxMessageUnreadCount ( ) { synchronized ( inboxControllerLock ) { if ( this . ctInboxController != null ) { return ctInboxController . unreadCount ( ) ; } else { getConfigLogger ( ) . debug ( getAccountId ( ) , "Notification Inbox not initialized" ) ...
Returns the count of total number of unread inbox messages for the user
151,235
@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public void markReadInboxMessage ( final CTInboxMessage message ) { postAsyncSafely ( "markReadInboxMessage" , new Runnable ( ) { public void run ( ) { synchronized ( inboxControllerLock ) { if ( ctInboxController != null ) { boolean read = ctInboxController . markRe...
marks the message as read
151,236
boolean advance ( ) { if ( header . frameCount <= 0 ) { return false ; } if ( framePointer == getFrameCount ( ) - 1 ) { loopIndex ++ ; } if ( header . loopCount != LOOP_FOREVER && loopIndex > header . loopCount ) { return false ; } framePointer = ( framePointer + 1 ) % header . frameCount ; return true ; }
Move the animation frame counter forward .
151,237
int getDelay ( int n ) { int delay = - 1 ; if ( ( n >= 0 ) && ( n < header . frameCount ) ) { delay = header . frames . get ( n ) . delay ; } return delay ; }
Gets display duration for specified frame .
151,238
boolean setFrameIndex ( int frame ) { if ( frame < INITIAL_FRAME_POINTER || frame >= getFrameCount ( ) ) { return false ; } framePointer = frame ; return true ; }
Sets the frame pointer to a specific frame
151,239
int read ( InputStream is , int contentLength ) { if ( is != null ) { try { int capacity = ( contentLength > 0 ) ? ( contentLength + 4096 ) : 16384 ; ByteArrayOutputStream buffer = new ByteArrayOutputStream ( capacity ) ; int nRead ; byte [ ] data = new byte [ 16384 ] ; while ( ( nRead = is . read ( data , 0 , data . l...
Reads GIF image from stream .
151,240
synchronized int read ( byte [ ] data ) { this . header = getHeaderParser ( ) . setData ( data ) . parseHeader ( ) ; if ( data != null ) { setData ( header , data ) ; } return status ; }
Reads GIF image from byte array .
151,241
private void readChunkIfNeeded ( ) { if ( workBufferSize > workBufferPosition ) { return ; } if ( workBuffer == null ) { workBuffer = bitmapProvider . obtainByteArray ( WORK_BUFFER_SIZE ) ; } workBufferPosition = 0 ; workBufferSize = Math . min ( rawData . remaining ( ) , WORK_BUFFER_SIZE ) ; rawData . get ( workBuffer...
Reads the next chunk for the intermediate work buffer .
151,242
@ TargetApi ( Build . VERSION_CODES . ICE_CREAM_SANDWICH ) public static synchronized void register ( android . app . Application application ) { if ( application == null ) { Logger . i ( "Application instance is null/system API is too old" ) ; return ; } if ( registered ) { Logger . v ( "Lifecycle callbacks have alrea...
Enables lifecycle callbacks for Android devices
151,243
ValidationResult cleanObjectKey ( String name ) { ValidationResult vr = new ValidationResult ( ) ; name = name . trim ( ) ; for ( String x : objectKeyCharsNotAllowed ) name = name . replace ( x , "" ) ; if ( name . length ( ) > Constants . MAX_KEY_LENGTH ) { name = name . substring ( 0 , Constants . MAX_KEY_LENGTH - 1 ...
Cleans the object key .
151,244
ValidationResult cleanMultiValuePropertyKey ( String name ) { ValidationResult vr = cleanObjectKey ( name ) ; name = ( String ) vr . getObject ( ) ; try { RestrictedMultiValueFields rf = RestrictedMultiValueFields . valueOf ( name ) ; if ( rf != null ) { vr . setErrorDesc ( name + "... is a restricted key for multi-val...
Cleans a multi - value property key .
151,245
ValidationResult isRestrictedEventName ( String name ) { ValidationResult error = new ValidationResult ( ) ; if ( name == null ) { error . setErrorCode ( 510 ) ; error . setErrorDesc ( "Event Name is null" ) ; return error ; } for ( String x : restrictedNames ) if ( name . equalsIgnoreCase ( x ) ) { error . setErrorCod...
Checks whether the specified event name is restricted . If it is then create a pending error and abort .
151,246
private ValidationResult _mergeListInternalForKey ( String key , JSONArray left , JSONArray right , boolean remove , ValidationResult vr ) { if ( left == null ) { vr . setObject ( null ) ; return vr ; } if ( right == null ) { vr . setObject ( left ) ; return vr ; } int maxValNum = Constants . MAX_MULTI_VALUE_ARRAY_LENG...
scans right to left until max to maintain latest max values for the multi - value property specified by key .
151,247
@ SuppressWarnings ( { "WeakerAccess" } ) protected void initDeviceID ( ) { getDeviceCachedInfo ( ) ; generateProvisionalGUID ( ) ; cacheGoogleAdID ( ) ; String deviceID = getDeviceID ( ) ; if ( deviceID == null || deviceID . trim ( ) . length ( ) <= 2 ) { generateDeviceID ( ) ; } }
don t run on main thread
151,248
static void i ( String message ) { if ( getStaticDebugLevel ( ) >= CleverTapAPI . LogLevel . INFO . intValue ( ) ) { Log . i ( Constants . CLEVERTAP_LOG_TAG , message ) ; } }
Logs to Info if the debug level is greater than or equal to 1 .
151,249
String calculateDisplayTimestamp ( long time ) { long now = System . currentTimeMillis ( ) / 1000 ; long diff = now - time ; if ( diff < 60 ) { return "Just Now" ; } else if ( diff > 60 && diff < 59 * 60 ) { return ( diff / ( 60 ) ) + " mins ago" ; } else if ( diff > 59 * 60 && diff < 23 * 59 * 60 ) { return diff / ( 6...
Logic for timestamp
151,250
public void setTabs ( ArrayList < String > tabs ) { if ( tabs == null || tabs . size ( ) <= 0 ) return ; if ( platformSupportsTabs ) { ArrayList < String > toAdd ; if ( tabs . size ( ) > MAX_TABS ) { toAdd = new ArrayList < > ( tabs . subList ( 0 , MAX_TABS ) ) ; } else { toAdd = tabs ; } this . tabs = toAdd . toArray ...
Sets the name of the optional two tabs . The contents of the tabs are filtered based on the name of the tab .
151,251
@ SuppressWarnings ( "deprecation" ) public void push ( String eventName , HashMap < String , Object > chargeDetails , ArrayList < HashMap < String , Object > > items ) throws InvalidEventNameException { if ( ! eventName . equals ( Constants . CHARGED_EVENT ) ) { throw new InvalidEventNameException ( "Not a charged eve...
Push an event which describes a purchase made .
151,252
public ArrayList < String > getCarouselImages ( ) { ArrayList < String > carouselImages = new ArrayList < > ( ) ; for ( CTInboxMessageContent ctInboxMessageContent : getInboxMessageContents ( ) ) { carouselImages . add ( ctInboxMessageContent . getMedia ( ) ) ; } return carouselImages ; }
Returns an ArrayList of String URLs of the Carousel Images
151,253
synchronized int storeObject ( JSONObject obj , Table table ) { if ( ! this . belowMemThreshold ( ) ) { Logger . v ( "There is not enough space left on the device to store data, data discarded" ) ; return DB_OUT_OF_MEMORY_ERROR ; } final String tableName = table . getName ( ) ; Cursor cursor = null ; int count = DB_UPD...
Adds a JSON string to the DB .
151,254
synchronized long storeUserProfile ( String id , JSONObject obj ) { if ( id == null ) return DB_UPDATE_ERROR ; if ( ! this . belowMemThreshold ( ) ) { getConfigLogger ( ) . verbose ( "There is not enough space left on the device to store data, data discarded" ) ; return DB_OUT_OF_MEMORY_ERROR ; } final String tableName...
Adds a JSON string representing to the DB .
151,255
synchronized void removeUserProfile ( String id ) { if ( id == null ) return ; final String tableName = Table . USER_PROFILES . getName ( ) ; try { final SQLiteDatabase db = dbHelper . getWritableDatabase ( ) ; db . delete ( tableName , "_id = ?" , new String [ ] { id } ) ; } catch ( final SQLiteException e ) { getConf...
remove the user profile with id from the db .
151,256
synchronized void removeEvents ( Table table ) { final String tName = table . getName ( ) ; try { final SQLiteDatabase db = dbHelper . getWritableDatabase ( ) ; db . delete ( tName , null , null ) ; } catch ( final SQLiteException e ) { getConfigLogger ( ) . verbose ( "Error removing all events from table " + tName + "...
Removes all events from table
151,257
synchronized JSONObject fetchEvents ( Table table , final int limit ) { final String tName = table . getName ( ) ; Cursor cursor = null ; String lastId = null ; final JSONArray events = new JSONArray ( ) ; try { final SQLiteDatabase db = dbHelper . getReadableDatabase ( ) ; cursor = db . rawQuery ( "SELECT * FROM " + t...
Returns a JSONObject keyed with the lastId retrieved and a value of a JSONArray of the retrieved JSONObject events
151,258
synchronized void storeUninstallTimestamp ( ) { if ( ! this . belowMemThreshold ( ) ) { getConfigLogger ( ) . verbose ( "There is not enough space left on the device to store data, data discarded" ) ; return ; } final String tableName = Table . UNINSTALL_TS . getName ( ) ; try { final SQLiteDatabase db = dbHelper . get...
Adds a String timestamp representing uninstall flag to the DB .
151,259
synchronized boolean deleteMessageForId ( String messageId , String userId ) { if ( messageId == null || userId == null ) return false ; final String tName = Table . INBOX_MESSAGES . getName ( ) ; try { final SQLiteDatabase db = dbHelper . getWritableDatabase ( ) ; db . delete ( tName , _ID + " = ? AND " + USER_ID + " ...
Deletes the inbox message for given messageId
151,260
synchronized boolean markReadMessageForId ( String messageId , String userId ) { if ( messageId == null || userId == null ) return false ; final String tName = Table . INBOX_MESSAGES . getName ( ) ; try { final SQLiteDatabase db = dbHelper . getWritableDatabase ( ) ; ContentValues cv = new ContentValues ( ) ; cv . put ...
Marks inbox message as read for given messageId
151,261
synchronized ArrayList < CTMessageDAO > getMessages ( String userId ) { final String tName = Table . INBOX_MESSAGES . getName ( ) ; Cursor cursor ; ArrayList < CTMessageDAO > messageDAOArrayList = new ArrayList < > ( ) ; try { final SQLiteDatabase db = dbHelper . getWritableDatabase ( ) ; cursor = db . rawQuery ( "SELE...
Retrieves list of inbox messages based on given userId
151,262
private void readContents ( int maxFrames ) { boolean done = false ; while ( ! ( done || err ( ) || header . frameCount > maxFrames ) ) { int code = read ( ) ; switch ( code ) { case 0x2C : if ( header . currentFrame == null ) { header . currentFrame = new GifFrame ( ) ; } readBitmap ( ) ; break ; case 0x21 : code = re...
Main file parser . Reads GIF content blocks . Stops after reading maxFrames
151,263
private void readBitmap ( ) { header . currentFrame . ix = readShort ( ) ; header . currentFrame . iy = readShort ( ) ; header . currentFrame . iw = readShort ( ) ; header . currentFrame . ih = readShort ( ) ; int packed = read ( ) ; boolean lctFlag = ( packed & 0x80 ) != 0 ; int lctSize = ( int ) Math . pow ( 2 , ( pa...
Reads next frame image .
151,264
private void readNetscapeExt ( ) { do { readBlock ( ) ; if ( block [ 0 ] == 1 ) { int b1 = ( ( int ) block [ 1 ] ) & 0xff ; int b2 = ( ( int ) block [ 2 ] ) & 0xff ; header . loopCount = ( b2 << 8 ) | b1 ; if ( header . loopCount == 0 ) { header . loopCount = GifDecoder . LOOP_FOREVER ; } } } while ( ( blockSize > 0 ) ...
Reads Netscape extension to obtain iteration count .
151,265
private void readLSD ( ) { header . width = readShort ( ) ; header . height = readShort ( ) ; int packed = read ( ) ; header . gctFlag = ( packed & 0x80 ) != 0 ; header . gctSize = 2 << ( packed & 7 ) ; header . bgIndex = read ( ) ; header . pixelAspect = read ( ) ; }
Reads Logical Screen Descriptor .
151,266
private int [ ] readColorTable ( int ncolors ) { int nbytes = 3 * ncolors ; int [ ] tab = null ; byte [ ] c = new byte [ nbytes ] ; try { rawData . get ( c ) ; tab = new int [ MAX_BLOCK_SIZE ] ; int i = 0 ; int j = 0 ; while ( i < ncolors ) { int r = ( ( int ) c [ j ++ ] ) & 0xff ; int g = ( ( int ) c [ j ++ ] ) & 0xff...
Reads color table as 256 RGB integer values .
151,267
private void skip ( ) { try { int blockSize ; do { blockSize = read ( ) ; rawData . position ( rawData . position ( ) + blockSize ) ; } while ( blockSize > 0 ) ; } catch ( IllegalArgumentException ex ) { } }
Skips variable length blocks up to and including next zero length block .
151,268
private int read ( ) { int curByte = 0 ; try { curByte = rawData . get ( ) & 0xFF ; } catch ( Exception e ) { header . status = GifDecoder . STATUS_FORMAT_ERROR ; } return curByte ; }
Reads a single byte from the input stream .
151,269
private boolean isToIgnore ( CtElement element ) { if ( element instanceof CtStatementList && ! ( element instanceof CtCase ) ) { if ( element . getRoleInParent ( ) == CtRole . ELSE || element . getRoleInParent ( ) == CtRole . THEN ) { return false ; } return true ; } return element . isImplicit ( ) || element instance...
Ignore some element from the AST
151,270
public JsonObject getJSONwithOperations ( TreeContext context , ITree tree , List < Operation > operations ) { OperationNodePainter opNodePainter = new OperationNodePainter ( operations ) ; Collection < NodePainter > painters = new ArrayList < NodePainter > ( ) ; painters . add ( opNodePainter ) ; return getJSONwithCus...
Decorates a node with the affected operator if any .
151,271
public List < Action > getRootActions ( ) { final List < Action > rootActions = srcUpdTrees . stream ( ) . map ( t -> originalActionsSrc . get ( t ) ) . collect ( Collectors . toList ( ) ) ; rootActions . addAll ( srcDelTrees . stream ( ) . filter ( t -> ! srcDelTrees . contains ( t . getParent ( ) ) && ! srcUpdTrees ....
This method retrieves ONLY the ROOT actions
151,272
public Diff compare ( File f1 , File f2 ) throws Exception { return this . compare ( getCtType ( f1 ) , getCtType ( f2 ) ) ; }
compares two java files
151,273
public Diff compare ( String left , String right ) { return compare ( getCtType ( left ) , getCtType ( right ) ) ; }
compares two snippet
151,274
public Diff compare ( CtElement left , CtElement right ) { final SpoonGumTreeBuilder scanner = new SpoonGumTreeBuilder ( ) ; return new DiffImpl ( scanner . getTreeContext ( ) , scanner . getTree ( left ) , scanner . getTree ( right ) ) ; }
compares two AST nodes
151,275
public void set ( int index , T object ) { synchronized ( mLock ) { if ( mOriginalValues != null ) { mOriginalValues . set ( index , object ) ; } else { mObjects . set ( index , object ) ; } } if ( mNotifyOnChange ) notifyDataSetChanged ( ) ; }
set the specified object at index
151,276
public void addAll ( int index , T ... items ) { List < T > collection = Arrays . asList ( items ) ; synchronized ( mLock ) { if ( mOriginalValues != null ) { mOriginalValues . addAll ( index , collection ) ; } else { mObjects . addAll ( index , collection ) ; } } if ( mNotifyOnChange ) notifyDataSetChanged ( ) ; }
Inserts the specified objects at the specified index in the array .
151,277
public void removeAt ( int index ) { synchronized ( mLock ) { if ( mOriginalValues != null ) { mOriginalValues . remove ( index ) ; } else { mObjects . remove ( index ) ; } } if ( mNotifyOnChange ) notifyDataSetChanged ( ) ; }
Removes the specified object in index from the array .
151,278
public boolean removeAll ( Collection < ? > collection ) { boolean result = false ; synchronized ( mLock ) { Iterator < ? > it ; if ( mOriginalValues != null ) { it = mOriginalValues . iterator ( ) ; } else { it = mObjects . iterator ( ) ; } while ( it . hasNext ( ) ) { if ( collection . contains ( it . next ( ) ) ) { ...
Removes the specified objects .
151,279
public void addAll ( final Collection < T > collection ) { final int length = collection . size ( ) ; if ( length == 0 ) { return ; } synchronized ( mLock ) { final int position = getItemCount ( ) ; mObjects . addAll ( collection ) ; notifyItemRangeInserted ( position , length ) ; } }
Adds the specified list of objects at the end of the array .
151,280
public T getItem ( final int position ) { if ( position < 0 || position >= mObjects . size ( ) ) { return null ; } return mObjects . get ( position ) ; }
Returns the item at the specified position .
151,281
public void replaceItem ( final T oldObject , final T newObject ) { synchronized ( mLock ) { final int position = getPosition ( oldObject ) ; if ( position == - 1 ) { return ; } mObjects . remove ( position ) ; mObjects . add ( position , newObject ) ; if ( isItemTheSame ( oldObject , newObject ) ) { if ( isContentTheS...
replaces the old with the new item . The new item will not be added when the old one is not found .
151,282
@ TargetApi ( VERSION_CODES . KITKAT ) public static void hideSystemUI ( Activity activity ) { View decorView = activity . getWindow ( ) . getDecorView ( ) ; decorView . setSystemUiVisibility ( View . SYSTEM_UI_FLAG_LAYOUT_STABLE | View . SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View . SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |...
This intro hides the system bars .
151,283
@ TargetApi ( VERSION_CODES . KITKAT ) public static void showSystemUI ( Activity activity ) { View decorView = activity . getWindow ( ) . getDecorView ( ) ; decorView . setSystemUiVisibility ( View . SYSTEM_UI_FLAG_LAYOUT_STABLE | View . SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View . SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN )...
except for the ones that make the content appear under the system bars .
151,284
public View getView ( int position , View convertView , ViewGroup parent ) { return ( wrapped . getView ( position , convertView , parent ) ) ; }
Get a View that displays the data at the specified position in the data set .
151,285
public void onDismiss ( DialogInterface dialog ) { if ( mOldDialog != null && mOldDialog == dialog ) { return ; } super . onDismiss ( dialog ) ; }
There is a race condition that is not handled properly by the DialogFragment class . If we don t check that this onDismiss callback isn t for the old progress dialog from before the device orientation change then this will cause the newly created dialog after the orientation change to be dismissed immediately .
151,286
public static boolean isToStringMethod ( Method method ) { return ( method != null && method . getName ( ) . equals ( "readString" ) && method . getParameterTypes ( ) . length == 0 ) ; }
Determine whether the given method is a readString method .
151,287
public static Method [ ] getUniqueDeclaredMethods ( Class < ? > leafClass ) throws IllegalArgumentException { final List < Method > methods = new ArrayList < Method > ( 32 ) ; doWithMethods ( leafClass , new MethodCallback ( ) { public void doWith ( Method method ) { boolean knownSignature = false ; Method methodBeingO...
Get the unique set of declared methods on the leaf class and all superclasses . Leaf class methods are included first and while traversing the superclass hierarchy any methods found with signatures matching a method already included are filtered out .
151,288
public V put ( K key , V value ) { if ( fast ) { synchronized ( this ) { Map < K , V > temp = cloneMap ( map ) ; V result = temp . put ( key , value ) ; map = temp ; return ( result ) ; } } else { synchronized ( map ) { return ( map . put ( key , value ) ) ; } } }
Associate the specified value with the specified key in this map . If the map previously contained a mapping for this key the old value is replaced and returned .
151,289
public void putAll ( Map < ? extends K , ? extends V > in ) { if ( fast ) { synchronized ( this ) { Map < K , V > temp = cloneMap ( map ) ; temp . putAll ( in ) ; map = temp ; } } else { synchronized ( map ) { map . putAll ( in ) ; } } }
Copy all of the mappings from the specified map to this one replacing any mappings with the same keys .
151,290
public V remove ( Object key ) { if ( fast ) { synchronized ( this ) { Map < K , V > temp = cloneMap ( map ) ; V result = temp . remove ( key ) ; map = temp ; return ( result ) ; } } else { synchronized ( map ) { return ( map . remove ( key ) ) ; } } }
Remove any mapping for this key and return any previously mapped value .
151,291
public static boolean isFileExist ( String filePath ) { if ( StringUtils . isEmpty ( filePath ) ) { return false ; } File file = new File ( filePath ) ; return ( file . exists ( ) && file . isFile ( ) ) ; }
Indicates if this file represents a file on the underlying file system .
151,292
public static boolean isFolderExist ( String directoryPath ) { if ( StringUtils . isEmpty ( directoryPath ) ) { return false ; } File dire = new File ( directoryPath ) ; return ( dire . exists ( ) && dire . isDirectory ( ) ) ; }
Indicates if this file represents a directory on the underlying file system .
151,293
public static void addToMediaStore ( Context context , File file ) { String [ ] path = new String [ ] { file . getPath ( ) } ; MediaScannerConnection . scanFile ( context , path , null , null ) ; }
another media scan way
151,294
public synchronized long skip ( final long length ) throws IOException { final long skip = super . skip ( length ) ; this . count += skip ; return skip ; }
Skips the stream over the specified number of bytes adding the skipped amount to the count .
151,295
public final void notifyHeaderItemRangeInserted ( int positionStart , int itemCount ) { int newHeaderItemCount = getHeaderItemCount ( ) ; if ( positionStart < 0 || itemCount < 0 || positionStart + itemCount > newHeaderItemCount ) { throw new IndexOutOfBoundsException ( "The given range [" + positionStart + " - " + ( po...
Notifies that multiple header items are inserted .
151,296
public final void notifyHeaderItemChanged ( int position ) { if ( position < 0 || position >= headerItemCount ) { throw new IndexOutOfBoundsException ( "The given position " + position + " is not within the position bounds for header items [0 - " + ( headerItemCount - 1 ) + "]." ) ; } notifyItemChanged ( position ) ; }
Notifies that a header item is changed .
151,297
public final void notifyHeaderItemRangeChanged ( int positionStart , int itemCount ) { if ( positionStart < 0 || itemCount < 0 || positionStart + itemCount >= headerItemCount ) { throw new IndexOutOfBoundsException ( "The given range [" + positionStart + " - " + ( positionStart + itemCount - 1 ) + "] is not within the ...
Notifies that multiple header items are changed .
151,298
public void notifyHeaderItemMoved ( int fromPosition , int toPosition ) { if ( fromPosition < 0 || toPosition < 0 || fromPosition >= headerItemCount || toPosition >= headerItemCount ) { throw new IndexOutOfBoundsException ( "The given fromPosition " + fromPosition + " or toPosition " + toPosition + " is not within the ...
Notifies that an existing header item is moved to another position .
151,299
public void notifyHeaderItemRangeRemoved ( int positionStart , int itemCount ) { if ( positionStart < 0 || itemCount < 0 || positionStart + itemCount > headerItemCount ) { throw new IndexOutOfBoundsException ( "The given range [" + positionStart + " - " + ( positionStart + itemCount - 1 ) + "] is not within the positio...
Notifies that multiple header items are removed .