daily update on 20230104 by nitload youmu

This commit is contained in:
Nitload
2023-01-05 01:21:54 +08:00
parent 5fd8462e16
commit e464ac56ba
23 changed files with 128 additions and 36 deletions
+11
View File
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Logic
{
public interface INode
{
}
}
+51 -1
View File
@@ -4,7 +4,57 @@ using System.Text;
namespace StgSharp.Logic
{
public class LinkedList<T> where T:
public class LinkedList<T> where T: INode
{
private LinkedListNode<T> _head;
private LinkedListNode<T> _tail;
private LinkedListNode<T> _cache;
public T Head
{
get { return _head._this; }
set { _head = new LinkedListNode<T>(value); }
}
public T Tail
{
get { return _tail._this; }
set { _tail = new LinkedListNode<T>(value); }
}
public void Add(T t)
{
if (_head != default(LinkedListNode<T>))
{
Head = t;
}
else
{
_cache = new LinkedListNode<T>(t);
_tail._next = _cache;
_cache._previous = _tail;
_tail = _cache;
}
}
public void RemoveTail()
{
if (_tail==default(LinkedListNode<T>))
{
}
else
{
_cache = _tail;
_tail = _cache._previous;
_cache._previous = default(LinkedListNode<T>);
}
}
}
}
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Logic
{
internal class LinkedListNode<T> where T : INode
{
internal readonly T _this;
internal LinkedListNode<T> _previous;
internal LinkedListNode<T> _next;
public virtual LinkedListNode<T> Previous
{
get { return _previous; }
set { _previous = value; }
}
public LinkedListNode<T> Next
{
get { return _next; }
set { _next = value; }
}
public LinkedListNode(T t)
{
_this = t;
}
}
}
@@ -1,26 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Logic
{
public class LinkedObject
{
internal LinkedObject _previous;
internal LinkedObject _next;
public LinkedObject Previous
{
get { return _previous; }
set { _previous = value; }
}
public LinkedObject Next
{
get { return _next; }
set { _next = value; }
}
}
}
+11 -1
View File
@@ -1,4 +1,6 @@
using System;
using StgSharp.Geometries;
using StgSharp.Logic;
using System;
using System.Collections.Generic;
using System.Text;
@@ -6,6 +8,14 @@ namespace StgSharp.Logic
{
public class Pool
{
public LinkedList<Point> pointContainer;
public LinkedList<Geometry> geometryContainer;
public Line leftBoader;
public Line rightBoader;
public Line topBoader;
public Line bottomBoader;
}
}