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 /** 015 * ID for serialization. 016 */ 017 private static final long serialVersionUID = 5937515546052805848L; 018 019 protected Calendar date; 020 protected int value; 021 022 /** 023 * @param date the date of the entry. 024 * @param value the value of the entry. 025 */ 026 public HistoryEntry(Calendar date, int value) { 027 this.date = (Calendar)date.clone(); //if date is not cloned, HistoryEntry's date will change whenever 028 this.value = value; //Shop's date changes! 029 } 030 031 /** 032 * @return the date of the entry. 033 */ 034 public Calendar getDate() { 035 return date; 036 } 037 038 /** 039 * @return the value of the entry. 040 */ 041 public int getValue() { 042 return value; 043 } 044 045 public String toString() { 046 return "Datum: " + date + "; Wert: " + value + ";"; 047 } 048 049 }