001: /**
002: * Speedo: an implementation of JDO compliant personality on top of JORM generic
003: * I/O sub-system.
004: * Copyright (C) 2001-2004 France Telecom R&D
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2 of the License, or (at your option) any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: *
021: *
022: * Contact: speedo@objectweb.org
023: *
024: */package org.objectweb.speedo.pobjects.detach;
025:
026: import java.io.Serializable;
027: import java.math.BigDecimal;
028:
029: /**
030: * @author Y.Bersihand
031: */
032: public class SharePrice implements Serializable {
033:
034: private long id; // price object identification
035: private int type; // the type of the price
036: private int year; // the year when this price is valid for
037: private int month; // the month when this price is valid for
038: private BigDecimal price; // The price valid for this type, year and month
039:
040: private Share share;
041:
042: public SharePrice() {
043: }
044:
045: public SharePrice(int aType, int aYear, int aMonth,
046: BigDecimal aPrice) {
047: type = aType;
048: year = aYear;
049: month = aMonth;
050: price = aPrice;
051: }
052:
053: public long getId() {
054: return id;
055: }
056:
057: public void setId(long aId) {
058: id = aId;
059: }
060:
061: public Share getShare() {
062: return share;
063: }
064:
065: public void setShare(Share aShare) {
066: share = aShare;
067: }
068:
069: public int getType() {
070: return type;
071: }
072:
073: public void setType(int type) {
074: this .type = type;
075: }
076:
077: public int getYear() {
078: return year;
079: }
080:
081: public void setYear(int year) {
082: this .year = year;
083: }
084:
085: public int getMonth() {
086: return month;
087: }
088:
089: public void setMonth(int month) {
090: this .month = month;
091: }
092:
093: public BigDecimal getPrice() {
094: return price;
095: }
096:
097: public String getFormattedPrice() {
098: return price.toString();
099: }
100:
101: public void setPrice(BigDecimal aPrice) {
102: price = aPrice;
103: }
104:
105: public boolean equals(Object aObject) {
106: return aObject instanceof SharePrice
107: && ((SharePrice) aObject).getId() == this .getId();
108: }
109:
110: public int hashCode() {
111: return new Long(id).hashCode();
112: }
113:
114: }
|