Re-fabrication
This commit is contained in:
parent
f155a47073
commit
cb6309abdb
499 changed files with 7574 additions and 12530 deletions
39
Yavsc.Server/Models/IT/Modeling/Code.cs
Normal file
39
Yavsc.Server/Models/IT/Modeling/Code.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Yavsc.Models.IT.Modeling
|
||||
{
|
||||
public abstract class Code<TLetter> : ICode<TLetter> where TLetter : ILetter<TLetter>
|
||||
{
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// !a Count^3 task len
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool Validate()
|
||||
{
|
||||
foreach (var letter in this) {
|
||||
var word = this.CreateWord(letter);
|
||||
foreach (var other in this) {
|
||||
IWord<TLetter> first = word.Aggregate(other);
|
||||
foreach (var tierce in this)
|
||||
{
|
||||
var otherword = word.Aggregate(tierce);
|
||||
if (first.Equals(otherword))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract IEnumerator<TLetter> GetEnumerator();
|
||||
|
||||
public abstract IWord<TLetter> CreateWord(TLetter letter);
|
||||
}
|
||||
}
|
||||
14
Yavsc.Server/Models/IT/Modeling/Letter.cs
Normal file
14
Yavsc.Server/Models/IT/Modeling/Letter.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
namespace Yavsc.Models.IT.Modeling
|
||||
{
|
||||
public abstract class Letter<T> : ILetter<T>
|
||||
{
|
||||
public abstract bool Equals(T x, T y);
|
||||
|
||||
public int GetHashCode(T obj)
|
||||
{
|
||||
return obj.GetHashCode();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue