This commit is contained in:
Lendaia Mirai
2025-09-24 23:55:52 +02:00
parent 1d80c9e3fb
commit b74f843f5d

View File

@@ -6,7 +6,7 @@ namespace OE.ALGA.Paradigmak
{
public interface IVegrehajthato
{
public void Vegrehajtas();
void Vegrehajtas();
}
public interface IFuggo
@@ -35,27 +35,45 @@ namespace OE.ALGA.Paradigmak
public void Felvesz(T t)
{
if (n <= tarolo.Length)
{
tarolo[n] = t;
n++;
}
else
if (tarolo.Length == 0)
{
throw new TaroloMegteltKivetel();
}
else
{
if (n < tarolo.Length)
{
tarolo[n] = t;
n++;
}
else
{
throw new TaroloMegteltKivetel();
}
}
}
public IEnumerator GetEnumerator()
{
throw new NotImplementedException();
foreach (T t in tarolo)
{
if (t != null)
{
yield return t;
}
}
}
virtual public void MindentVegrehajt()
{
foreach (T t in tarolo)
{
t.Vegrehajtas();
if (t != null)
{
t.Vegrehajtas();
}
}
}
@@ -67,7 +85,7 @@ namespace OE.ALGA.Paradigmak
}
public class FuggoFeladatTarolo<T> : FeladatTarolo<T> where T : IVegrehajthato, IFuggo
public class FuggoFeladatTarolo<T> : FeladatTarolo<T>, IEnumerable<T> where T : IVegrehajthato, IFuggo
{
public FuggoFeladatTarolo(int l) : base(l)
{
@@ -77,10 +95,14 @@ namespace OE.ALGA.Paradigmak
{
foreach (T t in tarolo)
{
if (t.FuggosegTeljesul)
if (t != null)
{
t.Vegrehajtas();
if (t.FuggosegTeljesul)
{
t.Vegrehajtas();
}
}
}
}
}