CircDLelement<E> implements a circular doubly linked list element in BRIDGES and is inherited from DElement<E>
How does the CircDLelement<E> work?
CircDLelement<E> stands for Circular Doubly Linked Element, and is a container
that has two links, pointing to two other doubly linked elements. So
a CircDLelement<E> “knows” who
it’s pointing at, AND it knows who pointed at it.
In this example, calling getNext() on CircDLelement2 will return CircDLelement3.
Calling getPrev() on CircDLelement2 will return CircDLelement1. CircDLelement3 points to CircDLelement1, and CircDLelement1 points to CircDLelement3.
Notice that, since CircDLelement<E> has a getPrev() method, they can move
forwards AND backwards through the linked elements.
See also
This tutorial gives an introduction to the usage of cicular double linked list. You can find the complete documentation of the features in the Doxygen documentation of the following classes and functions:
- CircDLelement [Java] [C++] [Python]
- Element [Java] [C++] [Python]
- ElementVisualizer [Java] [C++] [Python]
- LinkVisualizer [Java] [C++] [Python]
- Color [Java] [C++] [Python]
CircDLelement - BRIDGES Example
Example Details
- In this example, we will build and visualize a circular doubly linked list with student information data, specified through the StudentInfo class, which will be part of the CircDLelement object through its generic variable (CircDLLelement<StudentInfo>).
- The elements are linked, visual attributes assigned through application data and visualized.
- Care must be taking in linking the doubly linked elements, including linking the last element to the first element of the list. See figure above for the final structure of the list.
Bridges Visualization
- Once all your code is in order, run your file.
- Assuming all your code is correct and it compiles correctly, a link to the Bridges website will be generated on the console.
- Copy/paste this link into your favorite browser to view a visualization of the data structure you just created.
- It should look something like this:
Well done! You’ve just created your doubly linked circular doubly linked list!