identity.java

来自「java 调用windows的api」· Java 代码 · 共 46 行

JAVA
46
字号
/*
 * Identity.java -
 *
 * This file is part of the Jawin Project: http://jawinproject.sourceforge.net/
 * 
 * Please consult the LICENSE file in the project root directory,
 * or at the project site before using this software.
 */

/* $Id: Identity.java,v 1.3 2004/06/14 20:02:22 arosii_moa Exp $ */

package org.jawin;

/**
 * Object containing a GIT cookie (peer) and a reference count for it.
 *
 * @version     $Revision: 1.3 $
 * @author      Stuart Halloway, http://www.relevancellc.com/halloway/weblog/
 */
class Identity {
	private int count;
	private final int peer;
	
	Identity(int peer) {
		count = 1;
		this.peer = peer;
		if (IdentityManager.TRACE_REFS) {
			System.out.println("GIT ref [" + Integer.toHexString(peer) + "] = 1");
		}
	}
	
	synchronized int incRef() {
		if (IdentityManager.TRACE_REFS) {
			System.out.println("GIT ref [" + Integer.toHexString(peer) + "] = " + (count + 1));
		}
		return ++count;
	}
	
	synchronized int decRef() {
		if (IdentityManager.TRACE_REFS) {
			System.out.println("GIT ref [" + Integer.toHexString(peer) + "] = " + (count - 1));
		}
		return --count;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?