📄 objid.java
字号:
//
// Unified Library Application
// Case study in Unified Modeling Language Toolkit
//
// ObjId.java: represents a object id, a class that works as
// "pointer" to any persistent object in the system.
//
// Copyright (c) 1998 John Wiley & Sons, Inc. All rights reserved.
// Reproduction or translations of this work beyond that permitted
// in Section 117 of the 1976 United States Copyright Act without
// the express written permission of the copyright owner is unlawful.
// Requests for further information should be addressed to Permissions
// Department, John Wiley & Sons, Inc. The purchaser may make back-up
// copies for his/her own use only and not for distribution or resale.
// The Publisher assumes no responsibility for errors, omissions, or
// damages, caused by the use of these programs of from the use of the
// information contained herein.
package util;
import java.io.*;
public class ObjId
{
private String classname;
private int number;
public ObjId()
{
classname = "NotSet";
number = 0;
}
public ObjId(String name, int num)
{
classname = name;
number = num;
}
public String getName()
{
return classname;
}
public int getId()
{
return number;
}
public boolean equals(Object obj)
{
if (!obj.getClass().getName().equals("util.ObjId"))
return false;
ObjId comp = (ObjId) obj;
if (classname.equals(comp.classname) &&
number == comp.number)
return true;
else
return false;
}
public void write(RandomAccessFile out)
throws IOException
{
out.writeUTF(classname);
out.writeInt(number);
}
public void read(RandomAccessFile in)
throws IOException
{
classname = in.readUTF();
number = in.readInt();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -