daily update on 20230525 by nitload youmu, ses00001 not solved
This commit is contained in:
@@ -1,48 +1,74 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public abstract class INode<T> where T : INode<T>
|
||||
{
|
||||
[NotNull]
|
||||
protected ContainerNode<T> _id;
|
||||
|
||||
[AllowNull]
|
||||
internal ContainerNode<T> ID { get; }
|
||||
|
||||
internal void setID(ContainerNode<T> id)
|
||||
internal ContainerNode<T> Previous
|
||||
{
|
||||
if (_id!=null)
|
||||
{
|
||||
throw new ArgumentException("Cannot set ID twice");
|
||||
}
|
||||
else
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
get { return _id._previous; }
|
||||
set { _id._previous = value; }
|
||||
}
|
||||
|
||||
internal ContainerNode<T> Next
|
||||
{
|
||||
get { return _id._next; }
|
||||
set { _id._next = value; }
|
||||
}
|
||||
|
||||
public INode()
|
||||
{
|
||||
_id = new ContainerNode<T>(this as T);
|
||||
}
|
||||
|
||||
internal void SetId(ContainerNode<T> tContainer)
|
||||
{
|
||||
_id = tContainer;
|
||||
}
|
||||
|
||||
internal void SelfDestrcut()
|
||||
{
|
||||
_id._previous._next = _id._next;
|
||||
_id._next._previous = _id._previous;
|
||||
this._id = default;
|
||||
_id._next = null;
|
||||
_id._previous = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class ContainerNode<T> where T : INode<T>
|
||||
public class ContainerNode<T> : INullable where T : INode<T>
|
||||
{
|
||||
internal readonly T _value;
|
||||
|
||||
[AllowNull]
|
||||
internal ContainerNode<T> _previous;
|
||||
[AllowNull]
|
||||
internal ContainerNode<T> _next;
|
||||
internal ContainerNode<T> _side;
|
||||
|
||||
internal ContainerNode()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public ContainerNode(T t)
|
||||
{
|
||||
_value = t;
|
||||
t.setID(this);
|
||||
_previous = new ContainerNode<T>();
|
||||
_next = new ContainerNode<T>();
|
||||
}
|
||||
|
||||
public virtual ContainerNode<T> Previous
|
||||
@@ -57,17 +83,16 @@ namespace StgSharp
|
||||
set { _next = value; }
|
||||
}
|
||||
|
||||
public ContainerNode<T> Side
|
||||
{
|
||||
get { return _side; }
|
||||
set { _side = value; }
|
||||
}
|
||||
|
||||
public T Value
|
||||
{
|
||||
get { return _value; }
|
||||
}
|
||||
|
||||
public bool IsNull
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public void Remove()
|
||||
{
|
||||
_previous.Next = _next;
|
||||
|
||||
Reference in New Issue
Block a user