source: observatorio/simulacion/ModuloDinamico/input.C @ a3eef50

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

Simulador al 90%

  • Property mode set to 100644
File size: 3.7 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 Input.
25*/
26
27# include <input.H>
28
29Input::Input()
30  : Good(), internal_sales(0), external_sales(0), price(0),
31    INIT_SIMULATION_ATTRIBUTES
32{
33  // Empty
34}
35
36Input::Input(const Input & input)
37  : Good(input), internal_sales(input.internal_sales),
38    external_sales(input.external_sales), price(input.price),
39    INIT_COPY_SIMULATION_ATTRIBUTES(input)
40{
41  // Empty
42}
43
44Input::Input(Input && input)
45  : Good(std::move(input)), internal_sales(0), external_sales(0), price(0),
46    INIT_SIMULATION_ATTRIBUTES
47{
48  std::swap(internal_sales, input.internal_sales);
49  std::swap(external_sales, input.external_sales);
50  std::swap(price, input.price);
51  SWAP_SIMULATION_ATTRIBUTES(input)
52}
53
54const real & Input::get_internal_sales() const
55{
56  return internal_sales;
57}
58
59void Input::set_internal_sales(const real & _internal_sales)
60{
61  internal_sales = _internal_sales;
62}
63
64const real & Input::get_external_sales() const
65{
66  return external_sales;
67}
68
69void Input::set_external_sales(const real & _external_sales)
70{
71  external_sales = _external_sales;
72}
73
74const real & Input::get_price() const
75{
76  return price;
77}
78
79void Input::set_price(const real & _price)
80{
81  price = _price;
82}
83
84Input & Input::operator = (const Input & input)
85{
86  if (&input == this)
87    return *this;
88
89  (Good &) *this = input;
90
91  internal_sales = input.internal_sales;
92  external_sales = input.external_sales;
93  price = input.price;
94  COPY_SIMULATION_ATTRIBUTES(input)
95
96  return *this;
97}
98
99Input & Input::operator = (Input && input)
100{
101  (Good &) *this = std::move(input);
102
103  std::swap(internal_sales, input.internal_sales);
104  std::swap(external_sales, input.external_sales);
105  std::swap(price, input.price);
106  SWAP_SIMULATION_ATTRIBUTES(input)
107
108  return *this;
109}
110
111std::string Input::to_dot() const
112{
113  std::stringstream sstr;
114
115  sstr << Good::to_dot() << "\\n"
116       << "Ventas Internas: " << internal_sales << "\\n"
117       << "Ventas Externas: " << external_sales << "\\n"
118       << "Precio: " << price;
119
120  return sstr.str();
121}
122
123Good_Type Input::get_type() const
124{
125  return INPUT;
126}
127
128real & Input::production_at(const size_t & t)
129{
130  return get_simulation_attributes_at(t).production;
131}
132
133real & Input::stock_at(const size_t & t)
134{
135  return get_simulation_attributes_at(t).stock;
136}
137
138real & Input::internal_requested_quantity_at(const size_t & t)
139{
140  return get_simulation_attributes_at(t).internal_requested_quantity;
141}
142
143real Input::requested_quantity_at(const size_t & t)
144{
145  Input_Simulation_Attributes & sim_attr = get_simulation_attributes_at(t);
146
147  return sim_attr.internal_requested_quantity +
148         sim_attr.external_requested_quantity;
149}
150
151real & Input::internal_sales_at(const size_t & t)
152{
153  return get_simulation_attributes_at(t).internal_sales;
154}
155
156real & Input::price_at(const size_t & t)
157{
158  return get_simulation_attributes_at(t).price;
159}
160
Note: See TracBrowser for help on using the repository browser.