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 interface IVegrehajthato
|
||||||
{
|
{
|
||||||
public void Vegrehajtas();
|
void Vegrehajtas();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IFuggo
|
public interface IFuggo
|
||||||
@@ -35,27 +35,45 @@ namespace OE.ALGA.Paradigmak
|
|||||||
|
|
||||||
public void Felvesz(T t)
|
public void Felvesz(T t)
|
||||||
{
|
{
|
||||||
if (n <= tarolo.Length)
|
if (tarolo.Length == 0)
|
||||||
{
|
|
||||||
tarolo[n] = t;
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
throw new TaroloMegteltKivetel();
|
throw new TaroloMegteltKivetel();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (n < tarolo.Length)
|
||||||
|
{
|
||||||
|
tarolo[n] = t;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new TaroloMegteltKivetel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
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)
|
public FuggoFeladatTarolo(int l) : base(l)
|
||||||
{
|
{
|
||||||
@@ -77,10 +95,14 @@ namespace OE.ALGA.Paradigmak
|
|||||||
{
|
{
|
||||||
foreach (T t in tarolo)
|
foreach (T t in tarolo)
|
||||||
{
|
{
|
||||||
if (t.FuggosegTeljesul)
|
if (t != null)
|
||||||
{
|
{
|
||||||
t.Vegrehajtas();
|
if (t.FuggosegTeljesul)
|
||||||
|
{
|
||||||
|
t.Vegrehajtas();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user