daily update on 20230329 by nitload youmu
This commit is contained in:
@@ -6,12 +6,12 @@ using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class LinkedList<T>:IEnumerable where T: INode<T>
|
||||
public class LinkedList<T>:IEnumerable,INode<LinkedList<T>> where T: INode<T>
|
||||
{
|
||||
internal readonly ContainerNode<T> _heading;
|
||||
internal ContainerNode<T> _first;
|
||||
internal ContainerNode<T> _tail;
|
||||
|
||||
private ContainerNode<LinkedList<T>> _id;
|
||||
private ContainerNode<T> _cache;
|
||||
|
||||
public LinkedList()
|
||||
@@ -35,6 +35,7 @@ namespace StgSharp
|
||||
set { _tail = new ContainerNode<T>(value); }
|
||||
}
|
||||
|
||||
ContainerNode<LinkedList<T>> INode<LinkedList<T>>.ID => _id;
|
||||
|
||||
public void Add(T t)
|
||||
{
|
||||
@@ -69,5 +70,17 @@ namespace StgSharp
|
||||
{
|
||||
return new LinkedListEnumrator<T>(this);
|
||||
}
|
||||
|
||||
void INode<LinkedList<T>>.setID(ContainerNode<LinkedList<T>> id)
|
||||
{
|
||||
if (_id == null)
|
||||
{
|
||||
throw new ArgumentException("Cannot set ID twice");
|
||||
}
|
||||
else
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user