1 /******************************************************************************* 2 * Copyright (c) 2007, 2012 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.swt.internal.cocoa; 15 16 /** 17 * @jniclass flags=no_gen 18 */ 19 public class id { 20 21 public long id; 22 id()23public id() { 24 } 25 id(long id)26public id(long id) { 27 this.id = id; 28 } 29 id(id id)30public id(id id) { 31 this.id = id != null ? id.id : 0; 32 } 33 34 @Override hashCode()35public int hashCode() { 36 return (int) this.id; 37 } 38 39 @Override equals(Object other)40public boolean equals(Object other) { 41 return (this.id == ((id)other).id); 42 } 43 objc_getClass()44public long objc_getClass() { 45 String name = getClass().getName(); 46 int index = name.lastIndexOf('.'); 47 if (index != -1) name = name.substring(index + 1); 48 return OS.objc_getClass(name); 49 } 50 51 @Override toString()52public String toString() { 53 return getClass().getName() + "{" + id + "}"; 54 } 55 } 56