001    package market.statistics;
002    
003    import java.io.Serializable;
004    import java.util.Calendar;
005    
006    /**
007     * Used by history lists to contain both a date and a value.
008     * @see CISalesStats#orderHistory orderHistory
009     * @see CISalesStats#priceHistory priceHistory
010     * @see CICustomerStats#history customerHistory
011     */
012    public class HistoryEntry implements Serializable {
013    
014        protected Calendar date;
015        protected int value;
016    
017        /**
018         * @param date the date of the entry.
019         * @param value the value of the entry.
020         */
021        public HistoryEntry(Calendar date, int value) {
022            this.date = (Calendar)date.clone(); //if date is not cloned, HistoryEntry's date will change whenever
023            this.value = value;                 //Shop's date changes!
024        }
025    
026        /**
027         * @return the date of the entry.
028         */
029        public Calendar getDate() {
030            return date;
031        }
032    
033        /**
034         * @return the value of the entry.
035         */
036        public int getValue() {
037            return value;
038        }
039    
040        public String toString() {
041            return "Datum: " + date + "; Wert: " + value + ";";
042        }
043    
044    }