daily update on 20230111 by nitload youmu

This commit is contained in:
Nitload
2023-01-12 00:33:20 +08:00
parent 6dfc2f8d70
commit e9116ca11b
47 changed files with 190 additions and 98 deletions
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Logic
{
public class ContainerNode<T> where T : INode
{
internal readonly T _this;
internal ContainerNode<T> _previous;
internal ContainerNode<T> _next;
internal ContainerNode<T> _side;
public virtual ContainerNode<T> Previous
{
get { return _previous; }
set { _previous = value; }
}
public ContainerNode<T> Next
{
get { return _next; }
set { _next = value; }
}
public ContainerNode<T> Side
{
get { return _side; }
set { _side = value; }
}
public T Value
{
get { return _this; }
}
public ContainerNode(T t)
{
_this = t;
}
}
}
+1
View File
@@ -45,6 +45,7 @@ namespace StgSharp.Logic
case TypeCode.UInt64:
break;
default:
throw new ArgumentException("Input is not number value type");
break;
}
_defualtValue = defualtValue;
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Logic
{
public class Dictionary<T> where T : Enum ,INode
{
internal ContainerNode<T> _indexHead;
internal ContainerNode<T> _indexTail;
}
}
+3 -5
View File
@@ -4,11 +4,9 @@ using System.Text;
namespace StgSharp.Logic
{
public interface INode
public interface INode
{
public LinkedListNode<INode> ID
{
get ;
}
}
}
+9 -9
View File
@@ -6,33 +6,33 @@ namespace StgSharp.Logic
{
public class LinkedList<T> where T: INode
{
private LinkedListNode<T> _head;
private LinkedListNode<T> _tail;
internal ContainerNode<T> _head;
internal ContainerNode<T> _tail;
private LinkedListNode<T> _cache;
private ContainerNode<T> _cache;
public T Head
{
get { return _head._this; }
set { _head = new LinkedListNode<T>(value); }
set { _head = new ContainerNode<T>(value); }
}
public T Tail
{
get { return _tail._this; }
set { _tail = new LinkedListNode<T>(value); }
set { _tail = new ContainerNode<T>(value); }
}
public void Add(T t)
{
if (_head != default(LinkedListNode<T>))
if (_head != default(ContainerNode<T>))
{
Head = t;
}
else
{
_cache = new LinkedListNode<T>(t);
_cache = new ContainerNode<T>(t);
_tail._next = _cache;
_cache._previous = _tail;
_tail = _cache;
@@ -41,7 +41,7 @@ namespace StgSharp.Logic
public void RemoveTail()
{
if (_tail==default(LinkedListNode<T>))
if (_tail==default(ContainerNode<T>))
{
}
@@ -49,7 +49,7 @@ namespace StgSharp.Logic
{
_cache = _tail;
_tail = _cache._previous;
_cache._previous = default(LinkedListNode<T>);
_cache._previous = default(ContainerNode<T>);
}
}
@@ -1,30 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Logic
{
public 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;
}
}
}
+21 -5
View File
@@ -1,7 +1,9 @@
using StgSharp.Geometries;
using StgSharp.Control;
using StgSharp.Geometries;
using StgSharp.Logic;
using System;
using System.Collections.Generic;
using System.Net.Http.Headers;
using System.Text;
namespace StgSharp.Logic
@@ -9,11 +11,8 @@ namespace StgSharp.Logic
public class Pool
{
public LinkedList<Point> pointContainer;
public LinkedList<IGeometry> geometryContainer;
public LinkedList<IGeometrySimple> geometryContainer;
public LinkedList<Sensor> sensorContainer;
public Line leftBoader;
public Line rightBoader;
@@ -21,5 +20,22 @@ namespace StgSharp.Logic
public Line bottomBoader;
public void OnRender()
{
ContainerNode<Point> idCache = pointContainer._head;
Point p;
do
{
p = idCache._this;
p._x = p.getXHandler.Invoke(TimeLine.tickCounter);
p._y = p.getYHandler.Invoke(TimeLine.tickCounter);
idCache = idCache._next;
} while (idCache != default(ContainerNode<Point>));
}
}
}
+3 -5
View File
@@ -6,11 +6,9 @@ namespace StgSharp.Logic
{
public class Sensor : INode
{
private LinkedListNode<INode> _id;
private ContainerNode<Sensor> _id;
LinkedListNode<INode> INode.ID
{
get { return _id; }
}
}
}