int size = mTextCachedSizes.get(key); if (size != 0) { return size;
int size = mTextCachedSizes.get(key); if (size != 0) { return size;
@Override public int computeHashCode(SparseIntArray array) { return (array.get(dimension) - shift) >= 0 ? 1 : 0; } }
@Override public int computeHashCode(SparseIntArray array) { return (array.get(dimension) - shift) >= 0 ? 1 : 0; } }
@Override public double getAsDouble(int i) { return values.get(i); }
@Override public double getAsDouble(int i) { return values.get(i); }
@Override public int computeHashCode(SparseIntArray array) { // which hash function if (bitsPerDim == 0) { return array.get(ham) == 0 ? 0 : 1; } else { // compact binary data final int m = ham % bitsPerDim; final int d = ham / bitsPerDim; return (int) (HammingHelper.convert(array.get(d)) >>> m & 1L); } } }
@Override public int computeHashCode(SparseIntArray array) { // which hash function if (bitsPerDim == 0) { return array.get(ham) == 0 ? 0 : 1; } else { // compact binary data final int m = ham % bitsPerDim; final int d = ham / bitsPerDim; return (int) (HammingHelper.convert(array.get(d)) >>> m & 1L); } } }
return positionMap.get(position);
/** * Compute the dot product with another vector * @param vector the other vector * @return the dot product */ public double dotProduct(SparseIntArray vector) { double sum = 0; int tused = this.used(); int vused = vector.used(); SparseIntArray smaller = (tused < vused ? this : vector); SparseIntArray larger = (tused < vused ? vector : this); for (Entry e : smaller.entries()) { sum += e.value * larger.get(e.index); } return sum; }
private void shaveOffCorners(final ViewGroup view) { view.post(new Runnable() { @Override public void run() { // make all child views invisible before scraping the drawing cache SparseIntArray viewStates = new SparseIntArray(); for(int index = 0; index < view.getChildCount(); ++index) { View child = view.getChildAt(index); viewStates.put(index, child.getVisibility()); child.setVisibility(View.INVISIBLE); } view.buildDrawingCache(); // this is the exact bitmap that is currently rendered to screen. hence, we wanted to // hide all the children so that they don't permanently become part of the background final Bitmap rounded = view.getDrawingCache(); // restore actual visibility states after getting the drawing cache for(int index = 0; index < view.getChildCount(); ++index) { View child = view.getChildAt(index); child.setVisibility(viewStates.get(index)); } view.setBackgroundDrawable(new BitmapDrawable( getResources(), MyImageUtil.createRoundedCornerBitmap( view.getContext(), rounded, getResources().getDimensionPixelSize(R.dimen.radius_corner_default), false, true, true, false))); } }); }
private static final SparseIntArray tagMatcher2 = new SparseIntArray(); private static void put(String key, int value) { tagMatcher2.put(key.hashCode(), value); } private static int get(String key) { return tagMatcher2.get(key.hashCode()); } static { put("tag1", 1); put("tag2", 2); put("tag23", 23); } private void parse2 (String node) { switch (get(node)) { case 1: // etc break; case 0: // no match break; } }
/** * sets a word in the document's count. * @param word * @param count */ public void setWordCount(int word, int count){ if(this.getVector().isUsed(word)){ this.length -= this.getVector().get(word); } this.length += this.getVector().set(word, count); }
private static SparseIntArray ORIENTATIONS = new SparseIntArray(); static{ ORIENTATIONS.append(Surface.ROTATION_0, 0); ORIENTATIONS.append(Surface.ROTATION_90, 90); ORIENTATIONS.append(Surface.ROTATION_180, 180); ORIENTATIONS.append(Surface.ROTATION_270, 270); } private int sensorToDeviceRotation(CameraCharacteristics cameraCharacteristics, int deviceOrientation){ int sensorOrientation = cameraCharacteristics.get(CameraCharacteristics.SENSOR_ORIENTATION); deviceOrientation = ORIENTATIONS.get(deviceOrientation); return (sensorOrientation + deviceOrientation + 360) % 360; }
cursorPositions = new SparseIntArray(); for (int i=0; i<cursor.getCount() + sections.size(); i++){ if (sections.get(i, -1) != -1){ temp ++; cursorPositions.put(i, -1); getCursor().moveToPosition(cursorPositions.get(position)); bindView(view, mContext, getCursor(), position); } else if (getItemViewType(position) == SECTION_LIST_VIEW) { bindSectionView(view, mContext, (char)sections.get(position)); } else { if (view == null){ return cursorPositions.get(position) >= 0; if (cursorPositions.get(position) >= 0){ return NORMAL_LIST_VIEW; }else if (cursorPositions.get(position) == -1){ return SECTION_LIST_VIEW; } else { cursorPositions.put(position, -cursorPositions.get(position)); } else { int actualPosition = cursorPositions.keyAt(cursorPositions.indexOfValue(position)); cursorPositions.put(position, -cursorPositions.get(position)); } else { int actualPosition = cursorPositions.keyAt(cursorPositions.indexOfValue(-position));
int g = (int)centers.get(label, 1)[0]; int b = (int)centers.get(label, 0)[0]; counts.put(label, counts.get(label) + 1); clusters.get(label).put(y, x, b, g, r); rows++;
int size = mTextCachedSizes.get(key); if (size != 0) { return size;
int numberToClear = mapOfFilledTextViews.get(indexToClear); clearButton(numberToClear); clearTextView(indexToClear); b.setEnabled(false); int number = mapOfButtons.get(id); setText(number); for (int i = 0; i < len; i++) value = mapOfFilledTextViews.get(i, -1); textView[i].setText(value >= 0 ? String.valueOf(value) : EMPTY);
int size = mTextCachedSizes.get(key); if (size != 0) { return size;