source: observatorio/simulacion/ModuloDinamico/imported_product.C

simulacion
Last change on this file was 71c519d, checked in by Alejandro <amujica@…>, 10 years ago

Simulador al 90%

  • Property mode set to 100644
File size: 4.4 KB
Line 
1/*
2  Copyright (C) 2014
3  Alejandro Mujica (amujica@cenditel.gob.ve)
4  José Ruiz (jruiz@cenditel.gob.ve)
5  Julie Vera (jvera@cenditel.gob.ve)
6 
7  CENDITEL Fundación Centro Nacional de Desarrollo e Investigación en
8  Tecnologías Libres
9 
10  Este programa es software libre; Usted puede usarlo bajo los términos de la
11  licencia de software GPL versión 2.0 de la Free Software Foundation.
12 
13  Este programa se distribuye con la esperanza de que sea útil, pero SIN
14  NINGUNA GARANTÍA; tampoco las implícitas garantías de MERCANTILIDAD o
15  ADECUACIÓN A UN PROPÓSITO PARTICULAR.
16  Consulte la licencia GPL para más detalles. Usted debe recibir una copia
17  de la GPL junto con este programa; si no, escriba a la Free Software
18  Foundation Inc. 51 Franklin Street,5 Piso, Boston, MA 02110-1301, USA.
19*/
20
21/*
22  Autor:             Alejandro J. Mujica
23  Fecha de creación: 05/06/2014
24  Este archivo contiene la implementación de la clase Imported_Product.
25*/
26
27# include <imported_product.H>
28
29Imported_Product::Imported_Product()
30  : Good(), imports(0.0), sale(0.0), requested_quantity(0.0), price(0.0),
31    INIT_SIMULATION_ATTRIBUTES
32{
33  // Empty
34}
35
36Imported_Product::Imported_Product(const Imported_Product & imported_product)
37  : Good(imported_product), imports(imported_product.imports),
38    sale(imported_product.sale),
39    requested_quantity(imported_product.requested_quantity),
40    price(imported_product.price),
41    INIT_COPY_SIMULATION_ATTRIBUTES(imported_product)
42{
43  // Empty
44}
45
46Imported_Product::Imported_Product(Imported_Product && imported_product)
47  : imports(0.0), sale(0.0), requested_quantity(0.0), price(0.0),
48    INIT_SIMULATION_ATTRIBUTES
49{
50  std::swap(imports, imported_product.imports);
51  std::swap(sale, imported_product.sale);
52  std::swap(requested_quantity, imported_product.requested_quantity);
53  std::swap(price, imported_product.price);
54  SWAP_SIMULATION_ATTRIBUTES(imported_product)
55}
56
57const real & Imported_Product::get_imports() const
58{
59  return imports;
60}
61
62void Imported_Product::set_imports(const real & _imports)
63{
64  imports = _imports;
65}
66
67const real & Imported_Product::get_sale() const
68{
69  return sale;
70}
71
72void Imported_Product::set_sale(const real & _sale)
73{
74  sale = _sale;
75}
76
77const real & Imported_Product::get_requested_quantity() const
78{
79  return requested_quantity;
80}
81
82void Imported_Product::set_requested_quantity(const real & _requested_quantity)
83{
84  requested_quantity = _requested_quantity;
85}
86
87const real & Imported_Product::get_price() const
88{
89  return price;
90}
91
92void Imported_Product::set_price(const real & _price)
93{
94  price = _price;
95}
96
97Imported_Product &
98Imported_Product::operator = (const Imported_Product & imported_product)
99{
100  if (&imported_product == this)
101    return *this;
102
103  (Good &) (*this) = imported_product;
104
105  imports = imported_product.imports;
106  sale = imported_product.sale;
107  requested_quantity = imported_product.requested_quantity;
108  price = imported_product.price;
109  COPY_SIMULATION_ATTRIBUTES(imported_product)
110
111  return *this;
112}
113
114Imported_Product &
115Imported_Product::operator = (Imported_Product && imported_product)
116{
117  (Good &) (*this) = std::move(imported_product);
118
119  std::swap(imports, imported_product.imports);
120  std::swap(sale, imported_product.sale);
121  std::swap(requested_quantity, imported_product.requested_quantity);
122  std::swap(price, imported_product.price);
123  SWAP_SIMULATION_ATTRIBUTES(imported_product)
124
125  return *this;
126}
127
128std::string Imported_Product::to_dot() const
129{
130  std::stringstream sstr;
131
132  sstr << Good::to_dot() << "\\n"
133       << "Importaciones: " << imports << "\\n"
134       << "Venta: " << sale << "\\n"
135       << "Cantidad requerida: " << requested_quantity << "\\n"
136       << "Precio: " << price;
137
138  return sstr.str();
139}
140
141Good_Type Imported_Product::get_type() const
142{
143  return IMPORTED_PRODUCT;
144}
145
146real & Imported_Product::production_at(const size_t & t)
147{
148  return get_simulation_attributes_at(t).imports;
149}
150
151real & Imported_Product::stock_at(const size_t & t)
152{
153  return get_simulation_attributes_at(t).stock;
154}
155
156real & Imported_Product::internal_requested_quantity_at(const size_t & t)
157{
158  return get_simulation_attributes_at(t).requested_quantity;
159}
160
161real Imported_Product::requested_quantity_at(const size_t & t)
162{
163  return get_simulation_attributes_at(t).requested_quantity;
164}
165
166real & Imported_Product::internal_sales_at(const size_t & t)
167{
168  return get_simulation_attributes_at(t).sales;
169}
170
171real & Imported_Product::price_at(const size_t & t)
172{
173  return get_simulation_attributes_at(t).price;
174}
175
Note: See TracBrowser for help on using the repository browser.