WIP
parent
52f5a653f0
commit
b9220dc3a3
@ -0,0 +1,40 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using YavscLib;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
using YavscLib;
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,42 +0,0 @@
|
|||||||
@model PerformerProfile
|
|
||||||
|
|
||||||
<div class="performer @(Model.Active?"active":"inactive")">
|
|
||||||
@if (Model.Performer != null) {
|
|
||||||
@if (Model.Performer.Avatar != null) {
|
|
||||||
<img src="~/Avatars/@Model.Performer.Avatar" alt="avatar">
|
|
||||||
}
|
|
||||||
@Model.Performer.UserName
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
|
|
||||||
<li> @SR["Rating"]: @Model.Rate % </li>
|
|
||||||
@if (Model.MinDailyCost != null) {
|
|
||||||
<li>@SR["MinDailyCost"]: @Model.MinDailyCost€</li>
|
|
||||||
}
|
|
||||||
@if (Model.MinDailyCost != null) {
|
|
||||||
<li>@SR["MaxDailyCost"]: @Model.MaxDailyCost€</li>
|
|
||||||
}
|
|
||||||
@if (Model.WebSite!=null) {
|
|
||||||
<li>@SR["WebSite"]: @Model.WebSite</li>
|
|
||||||
}
|
|
||||||
@if (Model.DoesBlog) {
|
|
||||||
<li> <a asp-controller="Blogspot" asp-action="UserPosts"
|
|
||||||
asp-route-id="@Model.Performer.UserName">@SR["His blog"]</a>
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
@if (!string.IsNullOrEmpty(
|
|
||||||
Model.Performer.DedicatedGoogleCalendar))
|
|
||||||
{
|
|
||||||
<li> @SR["Exposes his Google calendar!"]
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
@if (Model.Performer.Devices?.Count>0)
|
|
||||||
{
|
|
||||||
<li> @SR["Uses the mobile application, and receives push notifications"]
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace YavscLib
|
||||||
|
{
|
||||||
|
public interface ILetter<T> : IEqualityComparer<T> {
|
||||||
|
}
|
||||||
|
public interface IWord<TLetter> where TLetter : ILetter<TLetter>
|
||||||
|
{
|
||||||
|
IWord<TLetter> Aggregate(TLetter other);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ICode<TLetter> : IEnumerable<TLetter> where TLetter : ILetter<TLetter>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Checks that (b!=c) => a.b != a.c
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool Validate();
|
||||||
|
|
||||||
|
IWord<TLetter> CreateWord(TLetter letter);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue