daily update on 20230301 by nitload youmu, file struct cahnged and more vec func added
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
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;
|
||||
t.setID<T>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
using Microsoft.CSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Counter<T>where T:struct, IConvertible, IFormattable, IComparable
|
||||
{
|
||||
internal readonly dynamic _defualtValue;
|
||||
internal readonly dynamic _defualtAddValue;
|
||||
internal readonly dynamic _defualtSubValue;
|
||||
|
||||
internal dynamic _value;
|
||||
|
||||
public dynamic Value
|
||||
{
|
||||
get { return _value; }
|
||||
set { _value = value; }
|
||||
}
|
||||
|
||||
public Counter(T defualtValue,T defualtAddValue,T defualtSubValue)
|
||||
{
|
||||
var type = Type.GetTypeCode(defualtValue.GetType());
|
||||
switch (type)
|
||||
{
|
||||
case TypeCode.Byte:
|
||||
break;
|
||||
case TypeCode.Int16:
|
||||
break;
|
||||
case TypeCode.Int32:
|
||||
break;
|
||||
case TypeCode.Int64:
|
||||
break;
|
||||
case TypeCode.Double:
|
||||
break;
|
||||
case TypeCode.Single:
|
||||
break;
|
||||
case TypeCode.SByte:
|
||||
break;
|
||||
case TypeCode.UInt16:
|
||||
break;
|
||||
case TypeCode.UInt32:
|
||||
break;
|
||||
case TypeCode.UInt64:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Input is not number value type");
|
||||
break;
|
||||
}
|
||||
_defualtValue = defualtValue;
|
||||
_defualtAddValue = defualtAddValue;
|
||||
_defualtSubValue = defualtSubValue;
|
||||
}
|
||||
|
||||
|
||||
public void Add(T value)
|
||||
{
|
||||
_value += value;
|
||||
}
|
||||
|
||||
public void QuickAdd()
|
||||
{
|
||||
_value += _defualtAddValue;
|
||||
}
|
||||
|
||||
public void Sub(T value)
|
||||
{
|
||||
_value -= value;
|
||||
}
|
||||
|
||||
public void QuickSub()
|
||||
{
|
||||
_value -= _defualtSubValue;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_value = _defualtValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Dictionary<T> where T : Enum ,INode
|
||||
{
|
||||
internal ContainerNode<T> _indexHead;
|
||||
internal ContainerNode<T> _indexTail;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public interface INode
|
||||
{
|
||||
internal ContainerNode<INode> ID { get; }
|
||||
|
||||
internal void setID<T>(ContainerNode<T> id) where T:INode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class LinkedList<T> where T: INode
|
||||
{
|
||||
internal ContainerNode<T> _first;
|
||||
internal ContainerNode<T> _tail;
|
||||
|
||||
private ContainerNode<T> _cache;
|
||||
|
||||
public T First
|
||||
{
|
||||
get { return _first._this; }
|
||||
set { _first = new ContainerNode<T>(value); }
|
||||
}
|
||||
|
||||
public T Tail
|
||||
{
|
||||
get { return _tail._this; }
|
||||
set { _tail = new ContainerNode<T>(value); }
|
||||
}
|
||||
|
||||
|
||||
public void Add(T t)
|
||||
{
|
||||
if (_first != default(ContainerNode<T>))
|
||||
{
|
||||
First = t;
|
||||
}
|
||||
else
|
||||
{
|
||||
_cache = new ContainerNode<T>(t);
|
||||
_tail._next = _cache;
|
||||
_cache._previous = _tail;
|
||||
_tail = _cache;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveTail()
|
||||
{
|
||||
if (_tail==default(ContainerNode<T>))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_cache = _tail;
|
||||
_tail = _cache._previous;
|
||||
_cache._previous = default(ContainerNode<T>);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using StgSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Pool
|
||||
{
|
||||
public LinkedList<Point> pointContainer;
|
||||
public LinkedList<IGeometry> geometryContainer;
|
||||
public LinkedList<Sensor> sensorContainer;
|
||||
|
||||
public Line leftBoader;
|
||||
public Line rightBoader;
|
||||
public Line topBoader;
|
||||
public Line bottomBoader;
|
||||
|
||||
|
||||
public void OnRender()
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Sensor : INode
|
||||
{
|
||||
private ContainerNode<INode> _id;
|
||||
|
||||
ContainerNode<INode> INode.ID
|
||||
{
|
||||
get { return _id; }
|
||||
}
|
||||
|
||||
void INode.setID<T>(ContainerNode<T> id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
_id = id as ContainerNode<INode>;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentNullException("Cannot set id teice!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user