CB100

Notas, resueltos y tps de la materia Algoritmos y Estructuras de Datos
Index Commits Files Refs README
commit c707981a32ca5a125e333c8a92580d494c9e14b1
parent d358e715fd4f5a6868ae95cf73006b932336ecf1
Author: Martin J. Klöckner <mjkloeckner@gmail.com>
Date:   Sun, 16 Jun 2024 23:13:24 -0300

Merge pull request #3 from IgnacioCettour/main

TDA Barrio, Parada y Linea
Diffstat:
ABarrio.cpp | 39+++++++++++++++++++++++++++++++++++++++
ABarrio.h | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
ALinea.cpp | 27+++++++++++++++++++++++++++
ALinea.h | 45+++++++++++++++++++++++++++++++++++++++++++++
AParada.cpp | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AParada.h | 72++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 293 insertions(+), 0 deletions(-)
diff --git a/Barrio.cpp b/Barrio.cpp
@@ -0,0 +1,39 @@
+/*
+ * Barrio.cpp
+ *
+ *  Created on: 16/06/2024
+ *      Author: algo2
+ */
+
+#include "Barrio.h"
+
+Barrio::Barrio(string nombre, int comuna){
+
+    this->nombre = nombre;
+    this->comuna = comuna;
+    this-> paradas = new list<parada*>(); // crea la lista para las paradas
+
+}
+
+int Barrio::getComuna(){
+    return this->comuna;
+}
+
+string Barrio::getNombre(){
+    return this->nombre;
+}
+
+list<Parada*>* Barrio::obtenerParadas(){
+    return this->paradas;
+}
+
+void Barrio::appendParada(string calle, int alturaPlano, string direccion, unsigned int coord_x, unsigned int coord_y){
+
+    this->paradas->insent(new Parada(calle,alturaPlano,direccion,coord_x,coord_y)) //crea una para y la agrega a la lista de paradas
+}
+
+Barrio::~Barrio() {
+
+    delete paradas;
+}
+
diff --git a/Barrio.h b/Barrio.h
@@ -0,0 +1,54 @@
+/*
+ * Barrio.h
+
+ *
+ *  Created on: 16/06/2024
+ *      Author: algo2
+ */
+
+#include <string>
+#include <list.h>
+#include <Parada.h>
+#ifndef BARRIO_H_
+#define BARRIO_H_
+
+
+class Barrio {
+private:
+
+    string nombre;
+    int comuna;
+    list<Parada*>* paradas;
+
+public:
+    /*
+     *post: Deja creado la clase con los parametros dados
+     */
+    Barrio(string nombre, int comuna);
+
+    /*
+     * post: Vacia y elimina el Barrio
+     */
+    virtual ~Barrio();
+    /*
+     * post: Devuelve el numero de comuna del Barrio
+     */
+    int getComuna();
+
+    /*
+     * post: Devuelve el nombre del Barrio
+     */
+    string getNombre();
+
+    /*
+     * post: Devuelve una lista con todos las paradas de ese Barrio
+     */
+    list<Parada*>* obtenerParadas();
+
+    /*
+     * post: Agrega una para nueva
+     */
+    void appendParada(string calle, int alturaPlano, string direccion, unsigned int coord_x, unsigned int coord_y);
+};
+
+#endif /* BARRIO_H_ */
diff --git a/Linea.cpp b/Linea.cpp
@@ -0,0 +1,27 @@
+/*
+ * Linea.cpp
+ *
+ *  Created on: 16/06/2024
+ *      Author: algo2
+ */
+
+#include "Linea.h"
+
+Linea::Linea(int numero, bool sentido) {
+
+    this->numero = numero;
+    this->sentido = sentido;
+
+}
+
+int Linea::getNumero(){
+    return this->numero;
+}
+
+bool Linea::getSentido(){
+    return this->sentido;
+}
+
+Linea::~Linea() {
+}
+
diff --git a/Linea.h b/Linea.h
@@ -0,0 +1,45 @@
+/*
+ * Linea.h
+ *
+ *  Created on: 16/06/2024
+ *      Author: algo2
+ */
+
+#include <string>
+#ifndef LINEA_H_
+#define LINEA_H_
+
+};
+
+class Linea {
+private:
+
+    int numero;
+    bool sentido; // aca puede ser tambien un enum ?????? un bool con true y false porque en realidad es I o V
+
+public:
+
+    /*
+     * pre: Recibe como parametro el numero y el sentido de la linea
+     * post: crea la clase Linea con su numero y sentido
+     */
+    Linea(int numero, bool sentido);
+
+    /*
+     * post: Devuelve el numero de la linea
+     */
+    int getNumero();
+
+    /*
+     * post: Devuelve el sentido de la linea
+     */
+     bool getSentido();
+
+
+    /*
+     *  post: Elimina la linea
+     */
+    virtual ~Linea();
+};
+
+#endif /* LINEA_H_ */
diff --git a/Parada.cpp b/Parada.cpp
@@ -0,0 +1,56 @@
+/*
+ * Parada.cpp
+ *
+ *  Created on: 16/06/2024
+ *      Author: algo2
+ */
+
+#include "Parada.h"
+
+Parada::Parada(string calle, int alturaPlano, string direccion, unsigned int coord_x, unsigned int coord_y) {
+
+    this->alturaPlano = alturaPlano;
+    this->calle = calle;
+    this->coord_x = coord_x;
+    this->coord_y = coord_y;
+    this->direccion = direccion;
+    this->lineas = new list<Linea*>(); // crea la lista para las lineas
+
+}
+
+string Parada::getCalle(){
+    return this->calle;
+}
+
+int Parada::getAlturaPlano(){
+    return this->alturaPlano;
+}
+
+string Parada::getDireccion(){
+    return this->direccion;
+}
+
+unsigned int Parada::getCoord_X(){
+    return this->coord_x;
+}
+
+unsigned int Parada::getCoord_y(){
+    return this->coord_y;
+}
+
+list<Linea*>* Parada::getLineas(){
+    return this->lineas;
+}
+
+void Parada::appendLineas(int numero, bool sentido){
+
+    this->lineas->insert(new Linea(numero,sentido))
+
+}
+
+Parada::~Parada() {
+
+    delete lineas;
+
+}
+
diff --git a/Parada.h b/Parada.h
@@ -0,0 +1,72 @@
+/*
+ * Parada.h
+ *
+ *  Created on: 16/06/2024
+ *      Author: algo2
+ */
+
+#include <string>
+#include <list.h>
+#ifndef PARADA_H_
+#define PARADA_H_
+
+class Parada {
+
+private:
+
+    string calle;
+    int alturaPlano;
+    string direccion;
+    unsigned int coord_x;
+    unsigned int coord_y;
+    list<Linea*>* lineas;    //porque por cada parada hay tambien distintas lineas que tienen sentido y numero
+
+public:
+
+    /*
+     * post: Deja creado la parada con sus parametros
+     */
+    Parada(string calle, int alturaPlano, string direccion, unsigned int coord_x, unsigned int coord_y);
+
+    /*
+     * post: Devuelve el numero de la calle
+     */
+    string getCalle();
+
+    /*
+     * post: Devuelve la altura del plano
+     */
+    int getAlturaPlano();
+
+    /*
+     * post: Devuelve la dirrecion
+     */
+    string getDireccion();
+
+    /*
+     * post: Devuelve la coordenada en X de la parada
+     */
+    unsigned int getCoord_X();
+
+    /*
+     * post: Devuelve la coordenada en Y de la parada
+     */
+    unsigned int getCoord_y();
+
+    /*
+     * post: Devuelve una lista con las lineas de esa parada
+     */
+    list<Linea*>* getLineas();
+
+    /*
+     * post: Setea las lineas de esa parada
+     */
+    void appendLineas(int numero, bool sentido);
+
+    /*
+     * post: Elimina y vacia la parada y sus lineas
+     */
+    virtual ~Parada(); //agregar las lineas
+};
+
+#endif /* PARADA_H_ */