⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 item.java

📁 数据结构及算法 对于参加ACM的学生有一定帮助 里面有详细的解答
💻 JAVA
字号:
//
//  Unified Library Application
//  Case study in Unified Modeling Language Toolkit
//
//  Item.java: represents a item, a physical instance
//  of a Title. The library can have several items of one
//  title.
//
//  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 bo;
import util.ObjId;
import db.*;
import java.io.*;
public class Item extends Persistent
{
    private int itemid;
    private ObjId title;
    private ObjId loan = new ObjId();
    public Item()
    {
    }
    public Item(ObjId titleid, int idno)
    {
        title = titleid;
        itemid = idno;
    }
    public int getId() { return itemid; }
    public String getTitleName()
    {
        Title t = (Title) Persistent.getObject(title);
        return t.getTitle();
    }
    public void setLoan(ObjId loanid)
    {
        loan = loanid;
    }
    public Loan getLoan()
    {
        Loan ret = (Loan) Persistent.getObject(loan);
        return ret;
    }
    public boolean isBorrowed()
    {
        if (loan.getName().equals("NotSet"))
            return false;
        else
            return true;
    }
    public void write(RandomAccessFile out)
        throws IOException
    {
        out.writeInt(itemid);
        title.write(out);
        loan.write(out);
    }
    public void read(RandomAccessFile in)
        throws IOException
    {
        itemid = in.readInt();
        title = new ObjId();
        title.read(in);
        loan.read(in);
    }
}

⌨️ 快捷键说明

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