mirror of
https://github.com/Lendaia/oe-alga-feladatok.git
synced 2026-04-23 04:16:32 +01:00
commit
This commit is contained in:
@@ -6,7 +6,7 @@ namespace OE.ALGA.Paradigmak
|
||||
{
|
||||
public interface IVegrehajthato
|
||||
{
|
||||
public void Vegrehajtas();
|
||||
void Vegrehajtas();
|
||||
}
|
||||
|
||||
public interface IFuggo
|
||||
@@ -35,7 +35,13 @@ namespace OE.ALGA.Paradigmak
|
||||
|
||||
public void Felvesz(T t)
|
||||
{
|
||||
if (n <= tarolo.Length)
|
||||
if (tarolo.Length == 0)
|
||||
{
|
||||
throw new TaroloMegteltKivetel();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (n < tarolo.Length)
|
||||
{
|
||||
tarolo[n] = t;
|
||||
n++;
|
||||
@@ -46,18 +52,30 @@ namespace OE.ALGA.Paradigmak
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (t != null)
|
||||
{
|
||||
t.Vegrehajtas();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -76,12 +94,16 @@ namespace OE.ALGA.Paradigmak
|
||||
override public void MindentVegrehajt()
|
||||
{
|
||||
foreach (T t in tarolo)
|
||||
{
|
||||
if (t != null)
|
||||
{
|
||||
if (t.FuggosegTeljesul)
|
||||
{
|
||||
t.Vegrehajtas();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
public class FeladatTaroloBejaro<T> : IEnumerator<T>
|
||||
|
||||
Reference in New Issue
Block a user