List of usage examples for java.lang System identityHashCode
@HotSpotIntrinsicCandidate public static native int identityHashCode(Object x);
From source file:com.ayuget.redface.ui.fragment.PostsFragment.java
private void showLoadingIndicator() { Log.d(LOG_TAG, String.format("@%d -> Showing loading layout", System.identityHashCode(this))); if (errorView != null) { errorView.setVisibility(View.GONE); }/*from w ww .ja va2s.c o m*/ if (loadingIndicator != null) { loadingIndicator.setVisibility(View.VISIBLE); } if (swipeRefreshLayout != null) { swipeRefreshLayout.setVisibility(View.GONE); } }
From source file:IdentityMap.java
/** * {@inheritDoc}/* w w w . j ava 2 s . c o m*/ * @see java.util.Collection#add(java.lang.Object) */ public boolean add(final Object key) { int hash = System.identityHashCode(key); int index = hash % _capacity; if (index < 0) { index = -index; } Entry entry = _buckets[index]; Entry prev = null; while (entry != null) { if (entry.getKey() == key) { // There is already a mapping for this key. return false; } prev = entry; entry = entry.getNext(); } if (prev == null) { // There is no previous entry in this bucket. _buckets[index] = new Entry(key, hash); } else { // Next entry is empty so we have no mapping for this key. prev.setNext(new Entry(key, hash)); } _entries++; if (_entries > _maximum) { rehash(); } return true; }
From source file:android.support.car.app.CarFragmentActivity.java
private static String viewToString(View view) { StringBuilder out = new StringBuilder(128); out.append(view.getClass().getName()); out.append('{'); out.append(Integer.toHexString(System.identityHashCode(view))); out.append(' '); switch (view.getVisibility()) { case View.VISIBLE: out.append('V'); break;//from w ww.j a v a2 s . co m case View.INVISIBLE: out.append('I'); break; case View.GONE: out.append('G'); break; default: out.append('.'); break; } out.append(view.isFocusable() ? 'F' : '.'); out.append(view.isEnabled() ? 'E' : '.'); out.append(view.willNotDraw() ? '.' : 'D'); out.append(view.isHorizontalScrollBarEnabled() ? 'H' : '.'); out.append(view.isVerticalScrollBarEnabled() ? 'V' : '.'); out.append(view.isClickable() ? 'C' : '.'); out.append(view.isLongClickable() ? 'L' : '.'); out.append(' '); out.append(view.isFocused() ? 'F' : '.'); out.append(view.isSelected() ? 'S' : '.'); out.append(view.isPressed() ? 'P' : '.'); out.append(' '); out.append(view.getLeft()); out.append(','); out.append(view.getTop()); out.append('-'); out.append(view.getRight()); out.append(','); out.append(view.getBottom()); final int id = view.getId(); if (id != View.NO_ID) { out.append(" #"); out.append(Integer.toHexString(id)); final Resources r = view.getResources(); if (id != 0 && r != null) { try { String pkgname; switch (id & 0xff000000) { case 0x7f000000: pkgname = "app"; break; case 0x01000000: pkgname = "android"; break; default: pkgname = r.getResourcePackageName(id); break; } String typename = r.getResourceTypeName(id); String entryname = r.getResourceEntryName(id); out.append(" "); out.append(pkgname); out.append(":"); out.append(typename); out.append("/"); out.append(entryname); } catch (Resources.NotFoundException e) { } } } out.append("}"); return out.toString(); }
From source file:android.support.car.app.CarFragmentActivity.java
/** * Print the Activity's state into the given stream. This gets invoked if * you run "adb shell dumpsys activity <activity_component_name>". * * @param prefix Desired prefix to prepend at each line of output. * @param fd The raw file descriptor that the dump is being sent to. * @param writer The PrintWriter to which you should dump your state. This will be * closed for you after you return./*ww w . j a v a2s .c o m*/ * @param args additional arguments to the dump request. */ public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { if (android.os.Build.VERSION.SDK_INT >= HONEYCOMB) { // XXX This can only work if we can call the super-class impl. :/ //ActivityCompatHoneycomb.dump(this, prefix, fd, writer, args); } writer.print(prefix); writer.print("Local FragmentActivity "); writer.print(Integer.toHexString(System.identityHashCode(this))); writer.println(" State:"); String innerPrefix = prefix + " "; writer.print(innerPrefix); writer.print("mCreated="); writer.print(mCreated); writer.print("mResumed="); writer.print(mResumed); writer.print(" mStopped="); writer.print(mStopped); writer.print(" mReallyStopped="); writer.println(mReallyStopped); mFragments.dumpLoaders(innerPrefix, fd, writer, args); mFragments.getSupportFragmentManager().dump(prefix, fd, writer, args); writer.print(prefix); writer.println("View Hierarchy:"); dumpViewHierarchy(prefix + " ", writer, getWindow().getDecorView()); }
From source file:com.ayuget.redface.ui.fragment.PostsFragment.java
private void showErrorView() { Log.d(LOG_TAG, String.format("@%d -> Showing error layout", System.identityHashCode(this))); if (errorView != null) { errorView.setVisibility(View.VISIBLE); }/* w w w.java2s. c om*/ if (loadingIndicator != null) { loadingIndicator.setVisibility(View.GONE); } if (swipeRefreshLayout != null) { swipeRefreshLayout.setVisibility(View.GONE); } }
From source file:org.jbpm.graph.def.GraphElement.java
public String toString() { String className = getClass().getName(); className = className.substring(className.lastIndexOf('.') + 1); if (name != null) { className = className + "(" + name + ")"; } else {/*from w w w . j av a 2s.c o m*/ className = className + "(" + Integer.toHexString(System.identityHashCode(this)) + ")"; } return className; }
From source file:com.ayuget.redface.ui.fragment.PostsFragment.java
private void showPosts() { Log.d(LOG_TAG, String.format("@%d -> Showing posts layout", System.identityHashCode(this))); if (errorView != null) { errorView.setVisibility(View.GONE); }/* w w w. ja v a2 s . c o m*/ if (loadingIndicator != null) { loadingIndicator.setVisibility(View.GONE); } if (swipeRefreshLayout != null) { swipeRefreshLayout.setVisibility(View.VISIBLE); } }
From source file:HashCodeAssist.java
/** * Returns an Integer for the given object's default hash code. * //from w w w. ja v a 2 s . com * @see System#identityHashCode(Object) * @param value * object for which the hashCode is to be calculated * @return Default int hash code */ private static Integer toIdentityHashCodeInteger(Object value) { return new Integer(System.identityHashCode(value)); }
From source file:org.apache.hadoop.hbase.ipc.AsyncRpcClient.java
/** * Remove connection from pool//w w w . j a va 2s . c o m */ public void removeConnection(AsyncRpcChannel connection) { int connectionHashCode = connection.hashCode(); synchronized (connections) { // we use address as cache key, so we should check here to prevent removing the // wrong connection AsyncRpcChannel connectionInPool = this.connections.get(connectionHashCode); if (connectionInPool != null && connectionInPool.equals(connection)) { this.connections.remove(connectionHashCode); } else if (LOG.isDebugEnabled()) { LOG.debug(String.format("%s already removed, expected instance %08x, actual %08x", connection.toString(), System.identityHashCode(connection), System.identityHashCode(connectionInPool))); } } }
From source file:de.innovationgate.wgpublisher.webtml.utils.TMLContext.java
public void makeThreadMainContext() { LinkedList<TMLContext> contexts = _threadMainContexts.get(); if (contexts == null) { contexts = new LinkedList<TMLContext>(); _threadMainContexts.set(contexts); }// w w w. j av a 2s .c om if ("true".equals(System.getProperty("de.innovationgate.wga.threadmaincontexts.verbose"))) { try { StackTraceElement[] elements = Thread.currentThread().getStackTrace(); getlog().info("Thread " + Thread.currentThread().hashCode() + " - Registering main context '" + getpath() + "' (" + System.identityHashCode(this) + ") at position " + contexts.size() + ", Stacktrace " + elements[2]); } catch (WGAPIException e) { // TODO Auto-generated catch block e.printStackTrace(); } } contexts.add(this); if (contexts.size() == 100) { getlog().warn("Size of main contexts list on thread '" + Thread.currentThread().getName() + "' exceeds 100 entries. The main contexts management is most likely leaking!"); } }