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.
PilaAcciones_U3 in estructuras.PilaAcciones_U3 implements a LIFO stack using a singly-linked list of internal nodes. Every enrollment operation — both registration and cancellation — pushes an AccionMatricula record onto the top. The most recently performed action is always the first one visible in the history panel. The name suffix _U3 reflects the class’s origin in Unit 3 of the AED course, where stacks are introduced as the canonical LIFO structure.
The AccionMatricula Record
AccionMatricula in estructuras.AccionMatricula is a plain data record. It captures the action type and a snapshot of the Matricula that was affected. The tipo field uses the string literals "REGISTRO" and "ELIMINACIÓN" — a third value "ACTUALIZACIÓN" is defined in the source comment but not currently emitted by the system.
Public API
apilar(AccionMatricula accion)
Pushes a new node onto the top of the stack in O(1). The new node’s
siguiente pointer is set to the current tope, then tope is updated to point to the new node.desapilar()
Pops the top element and returns its
AccionMatricula. Returns null if the stack is empty — callers must null-check. Complexity O(1).recorrer(Consumer<AccionMatricula> callback)
Iterates the stack from top to bottom without destructively popping any element. The caller supplies a
Consumer<AccionMatricula> lambda — typically a table-row appender for the history panel. Complexity O(n).Copy Algorithm Explanation
Thecopiar() method must produce a stack with the same top-to-bottom order as the original, but a naive single-pass push into a new stack would reverse the order because each push becomes the new top. The two-pass strategy solves this:
- Pass 1 — reverse into auxiliary: Traverse
tope → bottompushing each element intoauxiliar. The bottom element is nowauxiliar’s top. - Pass 2 — reverse back into copy: Traverse
auxiliar.tope → bottompushing each element intocopia. The bottom element becomescopia’s bottom again, restoring the original order.
Session Scope
The stack instance lives insideMenuPrincipal and is passed by reference to the enrollment and cancellation panels. It is not persisted — closing the application clears the audit trail. On next launch the history panel starts empty.