www.pudn.com > Java_UML_library.rar > Reservation.java


// 
//  Unified Library Application 
//  Case study in Unified Modeling Language Toolkit 
// 
//  Reservation.java: a reservation reservs a title for 
//  a specific borrower, meaning the borrower should be 
//  first in line when any item of the title is returned. 
// 
//  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.*; 
import java.util.*; 
public class Reservation extends Persistent 
{ 
    private ObjId title; 
    private ObjId borrower; 
    public Reservation() 
    { 
    } 
    public Reservation(ObjId titleid, ObjId borrowerid) 
    { 
        title = titleid; 
        borrower = borrowerid; 
    } 
    public Title getTitle() 
    { 
        Title t = (Title) Persistent.getObject(title); 
        return t; 
    } 
    public BorrowerInformation getBorrower() 
    { 
        BorrowerInformation b = (BorrowerInformation) Persistent.getObject(borrower); 
        return b; 
    } 
    public void write(RandomAccessFile out) 
        throws IOException 
    { 
        title.write(out); 
        borrower.write(out); 
    } 
    public void read(RandomAccessFile in) 
        throws IOException 
    { 
        title = new ObjId(); 
        title.read(in); 
        borrower = new ObjId(); 
        borrower.read(in); 
    } 
}