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 interface IVegrehajthato
{ {
public void Vegrehajtas(); void Vegrehajtas();
} }
public interface IFuggo public interface IFuggo
@@ -35,7 +35,13 @@ namespace OE.ALGA.Paradigmak
public void Felvesz(T t) public void Felvesz(T t)
{ {
if (n <= tarolo.Length) if (tarolo.Length == 0)
{
throw new TaroloMegteltKivetel();
}
else
{
if (n < tarolo.Length)
{ {
tarolo[n] = t; tarolo[n] = t;
n++; n++;
@@ -46,18 +52,30 @@ namespace OE.ALGA.Paradigmak
} }
} }
}
public IEnumerator GetEnumerator() public IEnumerator GetEnumerator()
{ {
throw new NotImplementedException(); foreach (T t in tarolo)
{
if (t != null)
{
yield return t;
}
}
} }
virtual public void MindentVegrehajt() virtual public void MindentVegrehajt()
{ {
foreach (T t in tarolo) foreach (T t in tarolo)
{
if (t != null)
{ {
t.Vegrehajtas(); t.Vegrehajtas();
} }
} }
}
IEnumerator<T> IEnumerable<T>.GetEnumerator() IEnumerator<T> IEnumerable<T>.GetEnumerator()
{ {
@@ -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) public FuggoFeladatTarolo(int l) : base(l)
{ {
@@ -76,12 +94,16 @@ namespace OE.ALGA.Paradigmak
override public void MindentVegrehajt() override public void MindentVegrehajt()
{ {
foreach (T t in tarolo) foreach (T t in tarolo)
{
if (t != null)
{ {
if (t.FuggosegTeljesul) if (t.FuggosegTeljesul)
{ {
t.Vegrehajtas(); t.Vegrehajtas();
} }
} }
}
} }
} }
public class FeladatTaroloBejaro<T> : IEnumerator<T> public class FeladatTaroloBejaro<T> : IEnumerator<T>