...
 
Commits (3)
......@@ -4,7 +4,7 @@ namespace DotNetTransformer.Extensions {
public delegate bool Order<in T>(T l, T r);
public delegate T Func<T>(T l, T r);
public delegate TOut Func<in TIn, out TOut>(TIn l, TIn r);
public delegate TOut Func<out TOut, in TIn>(TIn l, TIn r);
public delegate TOut Constructor<in TIn0, in TIn1, out TOut>(TIn0 arg0, TIn1 arg1);
public delegate TOut Constructor<out TOut, in TIn0, in TIn1>(TIn0 arg0, TIn1 arg1);
}
......@@ -5,7 +5,7 @@ namespace DotNetTransformer.Math.Set {
public abstract partial class FiniteSet<T>
where T : IEquatable<T>
{
public static readonly FiniteSet<T> Empty = new EmptySet();
public static readonly IFiniteSet<T> Empty = new EmptySet();
private sealed class EmptySet : FiniteSet<T>
{
public EmptySet() { }
......
......@@ -25,7 +25,7 @@ public abstract partial class FiniteSet<T> : IFiniteSet<T>
);
}
public override sealed bool Equals(object obj) {
return Equals(obj as FiniteSet<T>);
return Equals(obj as IFiniteSet<T>);
}
public override int GetHashCode() {
int hash = (int)Count;
......
......@@ -113,7 +113,8 @@ private sealed class InternalGroup : FiniteGroup<T>
public int CycleLength {
get {
return this.GetCycleLength<T, P>();
int c = Permutation.CycleLength;
return GroupExtension.Times<T>(this, c).Equals(None) ? c : (c << 1);
}
}
public T InverseElement {
......
......@@ -136,7 +136,8 @@ private sealed class InternalGroup : FiniteGroup<T>
public int CycleLength {
get {
return this.GetCycleLength<T, P>();
int c = Permutation.CycleLength;
return GroupExtension.Times<T>(this, c).Equals(None) ? c : (c << 1);
}
}
public T InverseElement {
......
......@@ -113,7 +113,8 @@ private sealed class InternalGroup : FiniteGroup<T>
public int CycleLength {
get {
return this.GetCycleLength<T, P>();
int c = Permutation.CycleLength;
return GroupExtension.Times<T>(this, c).Equals(None) ? c : (c << 1);
}
}
public T InverseElement {
......
......@@ -122,7 +122,8 @@ private sealed class InternalGroup : FiniteGroup<T>
public int CycleLength {
get {
return this.GetCycleLength<T, P>();
int c = Permutation.CycleLength;
return GroupExtension.Times<T>(this, c).Equals(None) ? c : (c << 1);
}
}
public T InverseElement {
......
......@@ -8,7 +8,7 @@ namespace DotNetTransformer.Math.Transform {
public static class FlipRotateExtension
{
public static IEnumerable<T> GetValues<T, P>(int dimensions,
Constructor<P, int, T> ctor
Constructor<T, P, int> ctor
)
where T : IFlipRotate<T, P>, new()
where P : IPermutation<P>, new()
......@@ -18,7 +18,7 @@ public static class FlipRotateExtension
);
}
public static IEnumerable<T> GetValues<T, P>(int dimensions,
Constructor<P, int, T> ctor,
Constructor<T, P, int> ctor,
Converter<P, IEnumerable<int>> vertexes
)
where T : IFlipRotate<T, P>, new()
......@@ -29,13 +29,5 @@ public static class FlipRotateExtension
foreach(int v in vertexes(p))
yield return ctor(p, v);
}
internal static int GetCycleLength<T, P>(this T _this)
where T : IFlipRotate<T, P>, new()
where P : IPermutation<P>, new()
{
int c = _this.Permutation.CycleLength;
return GroupExtension.Times<T>(_this, c).Equals(new T()) ? c : (c << 1);
}
}
}