1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.gscg.singleuser.interactionlayer.dataobjects.content;
15
16 import java.io.Serializable;
17
18 import nl.tudelft.simulation.dsol.simulators.SimulatorInterface;
19 import nl.tudelft.simulation.logger.Logger;
20 import nl.tudelft.simulation.supplychain.content.Bill;
21 import nl.tudelft.simulation.supplychain.content.OrderBasedOnQuote;
22 import nl.tudelft.simulation.supplychain.content.OrderStandAlone;
23
24 import org.gscg.singleuser.interactionlayer.dataobjects.DateIntData;
25
26 /***
27 * Contains data for a bill. This object is send to a client-side graphical user
28 * interface and is used to update information related to a bill. <br>
29 * <br>
30 * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
31 * Delft, the Netherlands. All rights reserved.
32 *
33 * See for project information <a href="http://www.simulation.tudelft.nl/">
34 * www.simulation.tudelft.nl </a>.
35 *
36 * The source code and binary code of this software is proprietary information
37 * of Delft University of Technology.
38 *
39 * @author <a
40 * href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
41 * Verbraeck </a>
42 * @version $Revision: 1.1 $ $Date: 2005/06/16 12:33:56 $
43 * @since 1.0.0
44 */
45 public class BillData extends ContentData
46 {
47 /*** the serial version uid */
48 private static final long serialVersionUID = 11L;
49
50 /*** the simulation time for final payment */
51 private DateIntData finalPaymentDate;
52
53 /*** the price that has to be paid */
54 private double price;
55
56 /*** the order to which this bill belongs */
57 private OrderData orderData;
58
59 /*** the internal demand id this bill belongs to */
60 private Serializable internalDemandID = null;
61
62 /***
63 * @param bill the bill to extract data from
64 * @param simulator the simulator
65 */
66 public BillData(final Bill bill, final SimulatorInterface simulator)
67 {
68 super(bill.getSender().getName(), bill.getSender()
69 .getLocationDescription(), bill.getReceiver().getName(), bill
70 .getReceiver().getLocationDescription());
71
72 this.finalPaymentDate = DateIntData.makeDateIntData(bill
73 .getFinalPaymentDate(), simulator);
74 this.internalDemandID = bill.getOrder().getInternalDemandID();
75 this.price = bill.getPrice();
76 if (bill.getOrder() instanceof OrderBasedOnQuote)
77 {
78 this.orderData = new OrderBasedOnQuoteData((OrderBasedOnQuote) bill
79 .getOrder(), simulator);
80 } else if (bill.getOrder() instanceof OrderStandAlone)
81 {
82 this.orderData = new OrderStandAloneData((OrderStandAlone) bill
83 .getOrder(), simulator);
84 } else
85 {
86 Logger.warning("BillData", "<init>",
87 "Order not OrderBasedOnQuote or OrderStandAloneData but: "
88 + bill.getOrder().getClass());
89 }
90 }
91
92 /***
93 * @return Returns the internal demand id
94 */
95 public Serializable getInternalDemandID()
96 {
97 return this.internalDemandID;
98 }
99
100 /***
101 * @return Returns the finalPaymentDate.
102 */
103 public DateIntData getFinalPaymentDate()
104 {
105 return this.finalPaymentDate;
106 }
107
108 /***
109 * @return Returns the orderData.
110 */
111 public OrderData getOrderData()
112 {
113 return this.orderData;
114 }
115
116 /***
117 * @return Returns the price.
118 */
119 public double getPrice()
120 {
121 return Math.round(this.price);
122 }
123 }