mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-04-04 04:18:22 +00:00
Huffman base2/3
This commit is contained in:
53
Esiur.Analysis/Coding/CodeSet.cs
Normal file
53
Esiur.Analysis/Coding/CodeSet.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Esiur.Analysis.Coding
|
||||
{
|
||||
|
||||
public class CodeSet<T> where T : System.Enum
|
||||
{
|
||||
|
||||
public T[] Elements { get; private set; }
|
||||
|
||||
public int ElementsCount { get; private set; }
|
||||
|
||||
public CodeSet()
|
||||
{
|
||||
var values = System.Enum.GetValues(typeof(T));
|
||||
Elements = new T[values.Length];
|
||||
ElementsCount = values.Length;
|
||||
values.CopyTo(Elements, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//public interface IBaseValue<T>
|
||||
//{
|
||||
// public T Value { get; set; }
|
||||
// public T[] Allowed { get; set; }
|
||||
//}
|
||||
|
||||
|
||||
public enum Base2: byte
|
||||
{
|
||||
Zero,
|
||||
One
|
||||
}
|
||||
|
||||
public enum Base3 : byte
|
||||
{
|
||||
Zero,
|
||||
One,
|
||||
Two
|
||||
}
|
||||
|
||||
//public struct BinaryValue : IBaseValue<Base2>
|
||||
//{
|
||||
// public Base2 Value { get; set; }
|
||||
//}
|
||||
|
||||
//public struct TernaryValue : IBaseValue<Base3>
|
||||
//{
|
||||
// public Base3 Value { get; set; }
|
||||
//}
|
||||
}
|
||||
Reference in New Issue
Block a user