1 /*
2 * FIEBDC 3 parser
3 * Copyright (C) 2014 DiSiD Technologies
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/copyleft/gpl.html>.
17 */
18
19 package com.disid.fiebdc3;
20
21 import java.util.ArrayList;
22 import java.util.List;
23
24 /**
25 * Data of a measurement of a Fiebdc3 database.
26 *
27 * @author DiSiD Team
28 */
29 public class Measurement {
30
31 String parentConcept;
32
33 String concept;
34
35 List<Integer> position = new ArrayList<Integer>();
36
37 Float total;
38
39 List<MeasurementLine> measurements = new ArrayList<MeasurementLine>();
40
41 String label;
42
43 Measurement() {
44 // Nothing to do
45 }
46
47 /**
48 * Spec definition:<br/>
49 * <i>POSICION: Posición del CONCEPTO_HIJO en la descomposición del
50 * CONCEPTO_PADRE, este dato permite identificar la medición cuando la
51 * descomposición del concepto padre incluye varios conceptos hijo con el
52 * mismo CODIGO, la numeración de las posiciones comenzará con el 1.
53 *
54 * El campo POSICION deberá especificarse siempre en intercambio de
55 * presupuestos cuando éste sea completo y estructurado, e indicará el
56 * camino completo de la medición descrita en la estructura del archivo. Por
57 * ejemplo 3 \ 5 \ 2, indicará la medición correspondiente al capítulo 3 del
58 * archivo; subcapítulo 5 del capítulo 3; y partida 2 del subcapítulo 5. En
59 * mediciones no estructuradas este campo es opcional.</i>
60 */
61 public List<Integer> getPosition() {
62 return position;
63 }
64
65 public void addPosition(Integer position) {
66 this.position.add(position);
67 }
68
69 /**
70 * Spec definition:<br/>
71 * <i>MEDICION_TOTAL: Debe coincidir con el rendimiento del registro tipo
72 * '~D' correspondiente. Incorpora el sumatorio del producto de unidades,
73 * longitud, latitud y altura o el resultado de expresiones de cada línea,
74 * al leer este registro se recalculará este valor.</i>
75 */
76 public Float getTotal() {
77 return total;
78 }
79
80 public void setTotal(Float total) {
81 this.total = total;
82 }
83
84 /**
85 * Returns the measurements of the work unit.
86 *
87 * @return the measurements of the work unit
88 */
89 public List<MeasurementLine> getMeasurements() {
90 return measurements;
91 }
92
93 /**
94 * Adds a new measurement.
95 *
96 * @return the new added measurement
97 */
98 public MeasurementLine addMeasurement() {
99 MeasurementLine measurement = new MeasurementLine();
100 this.measurements.add(measurement);
101 return measurement;
102 }
103
104 /**
105 * Spec definition:<br/>
106 * <i>ETIQUETA: Es opcional, surge de la necesidad de transmitir un
107 * identificador de los conceptos (capítulos, subcapítulos o partidas). Este
108 * identificador lo imprimen, diversos programas, en los listados de
109 * mediciones o presupuesto de una Obra (por ejemplo, ‘2.10’, ‘A-27b’,
110 * ‘001001’,…); siendo único para cada concepto (capítulo, subcapítulo o
111 * partida) y, en general, diferente de la codificación de la base de datos
112 * empleada para confeccionar el presupuesto (El ‘CODIGO_HIJO’ muchas veces
113 * no aparece en los listados mencionados). </i>
114 */
115 public String getLabel() {
116 return label;
117 }
118
119 public void setLabel(String label) {
120 this.label = label;
121 }
122
123 public String getParentConcept() {
124 return parentConcept;
125 }
126
127 public void setParentConcept(String parentConcept) {
128 this.parentConcept = parentConcept;
129 }
130
131 public String getConcept() {
132 return concept;
133 }
134
135 public void setConcept(String concept) {
136 this.concept = concept;
137 }
138
139 public MeasurementLine addLine() {
140 MeasurementLine line = new MeasurementLine();
141 measurements.add(line);
142 return line;
143 }
144
145 @Override
146 public String toString() {
147 return "Measurement {" + super.toString() + ", Position: " + position
148 + ", Total: " + total + ", Label: " + label
149 + ", Measurements: " + measurements + "}";
150 }
151 }