Updated DoublyLinkedListNode to use new Node Type

This commit is contained in:
Luke Else 2022-03-31 21:27:31 +01:00
parent 3d5f1cfbc1
commit c69c6ee0d3
3 changed files with 4 additions and 6 deletions

View File

@ -6,10 +6,8 @@ using System.Threading.Tasks;
namespace C_.Datastructures.Nodes
{
internal class DoublyLinkedListNode<T>
{
public T? Value { get; set; } = default;
public DoublyLinkedListNode<T>? Next { get; set; } = default;
internal class DoublyLinkedListNode<T> : Node<T, DoublyLinkedListNode<T>>
{//Inherits from Node
public DoublyLinkedListNode<T>? Prev { get; set; } = default;
public static DoublyLinkedListNode<T> Create(T? value, DoublyLinkedListNode<T>? next, DoublyLinkedListNode<T>? prev)

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace C_.Datastructures.Nodes
{
internal class LinkedListNode<T> : Node<T, LinkedListNode<T>>
{
{//Inherits from Node
public static LinkedListNode<T> Create(T? value, LinkedListNode<T>? next)
{
return new LinkedListNode<T>

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace C_.Datastructures.Nodes
{
internal class Node<T, NodeType>
{
{//Generic Node type that every other type inherits from
public T? Value { get; set; } = default;
public NodeType? Next { get; set; } = default;
}