Documentation Index
Fetch the complete documentation index at: https://mintlify.com/kenri89/PROYECTO_UTP_AED_1_1/llms.txt
Use this file to discover all available pages before exploring further.
MatrizSemestres in estructuras.MatrizSemestres is a two-dimensional array Curso[filas][columnas] with a default size of 10×10. The first dimension (rows) represents academic semesters 1 through 10 using a zero-based index — semester n maps to row n − 1. The second dimension (columns) provides up to 10 open slots per semester, filled left-to-right; a null cell is an empty slot. This layout directly mirrors the grid panel in the UI, where each row of the visual table corresponds to one semester row in the matrix.
Matrix Layout
The table below shows how semesters and array indices relate. Each cell at[row][col] holds a Curso reference or null.
| Row index | Semester | Max courses per row |
|---|---|---|
| 0 | Semester 1 | 10 |
| 1 | Semester 2 | 10 |
| … | … | … |
| 8 | Semester 9 | 10 |
| 9 | Semester 10 | 10 |
null column of the target row. Once all 10 columns of a row are occupied, insertarPorSemestre returns false and the caller must handle the overflow case.
Public API
MatrizSemestres() / MatrizSemestres(int filas, int columnas)
The no-argument constructor initialises a
Curso[10][10] array — the standard configuration for a 10-semester programme. The parameterised constructor allows alternative dimensions for custom use cases.insertarPorSemestre(Curso curso)
Reads
curso.getSemestre(), subtracts 1 to obtain the zero-based row index, then scans columns left-to-right for the first null cell. Inserts there and returns true. Returns false if the semester index is out of bounds or the row is full.eliminarPorCodigo(String codigo, int semestre)
Converts
semestre to a row index, then scans that row for a cell whose getCodigo() matches codigo (case-insensitive). Nulls the cell and returns true. Returns false if the row is out of range or the code is not found in that row. Complexity O(columnas).actualizarCurso(String codigo, Curso actualizado)
Performs a full matrix scan to find the cell containing the course with the given code. If the new
Curso has a different semestre value, the old cell is set to null and insertarPorSemestre(actualizado) places it in the correct new row. If the semester is unchanged, the cell is replaced in-place. Returns true if the code was found. Complexity O(filas × columnas) worst case.Semester Change Handling
WhenactualizarCurso detects that cursoActual.getSemestre() != actualizado.getSemestre(), it executes a two-step relocation:
- Remove from old row — sets
matriz[fila][col] = null, freeing the slot in the original semester row. - Insert into new row — calls
insertarPorSemestre(actualizado), which places the updated course in the first free slot of the new semester row.
Usage Example
All three course structures —
ArregloCursos, ListaCursos, and MatrizSemestres — must be kept synchronised at all times. Inserting, updating, or deleting a course must be applied to all three in a single coordinated operation; failing to do so will cause the semester grid panel, the combo-boxes, and the Excel export to show inconsistent data.