public JSONObject toDebugJSON() { JSONObject o = toJSON(); try { o.put("start", mStart); o.put("stop", mStop); o.put("clock", mClock.getClass().getSimpleName()); o.put("sub-event-count", mSubEvents.size()); o.put("durationAbs", getDurationAbsolute()); } catch (JSONException e) { SgnLog.d(TAG, e.getMessage(), e); } return o; }
public JSONObject toJSON() { try { JSONObject o = new JSONObject(); o.put("type", mEventType.toString()); o.put("ms", getDuration()); o.put("orientation", mOrientation.toString()); o.put("pages", PageflipUtils.join(",", mPages)); o.put("view_session", mViewSession); return o; } catch (JSONException e) { SgnLog.d(TAG, e.getMessage(), e); } return new JSONObject(); }
private void checkSize() { int size = mCache.size(); if (size > mMaxItems) { float percentToRemove = (float) mPercentToClean / (float) 100; int itemsToRemove = (int) (size * percentToRemove); // least recently accessed item will be the first one iterated Iterator<Entry<String, Cache.Item>> it = mCache.entrySet().iterator(); while (it.hasNext()) { it.next(); it.remove(); if (itemsToRemove-- == 0) { break; } } SgnLog.d(TAG, "Cleaned " + TAG + " new size: " + mCache.size()); } }