/* * ==================================================================== * * TORPEDO * A Testbed of Object Relational Products for Enterprise Distributed Objects * Copyright (c) 2004 The Middleware Company All Rights Reserved * @author Bruce Martin * @version 8.25.04 * * ==================================================================== */ package com.middleware_company.torpedo.auction.jdo; import com.middleware_company.torpedo.auction.Bid; import com.middleware_company.torpedo.auction.Auction; import com.middleware_company.torpedo.auction.User; import java.util.Collection; public class JDOBid implements Bid { public String id=null; private JDOAuction auction=null; private JDOUser buyer=null; private Float amount=null; private Float maxAmount=null; public JDOBid() { } public JDOBid(String id, Auction auction, User buyer, Float amount, Float maxAmount) { this.id=id; this.auction=(JDOAuction)auction; this.buyer=(JDOUser)buyer; this.amount=amount; this.maxAmount=maxAmount; } public String getId(){ return this.id; } public void setAuction(Auction auction){ this.auction=(JDOAuction)auction; } public Auction getAuction(){ return this.auction; } public void setBuyer(User buyer){ this.buyer=(JDOUser)buyer; } public User getBuyer(){ return this.buyer; } public void setAmount(Float amount){ this.amount=amount; } public Float getAmount(){ return this.amount; } public void setMaxAmount(Float maxAmount){ this.maxAmount=maxAmount; } public Float getMaxAmount(){ return this.maxAmount; } public boolean equals (Object other) { String otherID; if ((!(other instanceof JDOBid)) || (other==null)) otherID="invalid"; else otherID=((JDOBid)other).getId(); System.err.println("JDOBid.equals() "+this.id+" equals "+otherID); if (other == this) return true; if (!(other instanceof JDOBid)) return false; return id == null ? ((JDOBid)other).getId() == null : id.equals (((JDOBid)other).getId()); } public int hashCode () { return id == null ? 0 : id.hashCode (); } }