.


:




:

































 

 

 

 


q-.




1

Q-. ΔT

: () ΔT, .

: , MS Windows XP/7, (C++, #) MS Visual Studio.

1. , һ, .

2. һ. .

3. .

.

, . , , . . . , , . .

. , , , , .

Δ t. , Δ t, , , .

. , , .

:

Q-

 

 

 

:


 

 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Drawing;

using System.Threading;

 

namespace 1_V2._0

{

public class Qsystem

{

public ListIOnTickable ObjsTick { get; private set; }

public ListEndNode ObjsEnd { get; private set; }

public int ClientsCount { get; set; }

public float dt { get; set; }

public float T { get; set; }

public bool IsEnd

{

get

{

int sum = 0;

foreach (var item in ObjsEnd)

{

sum += item.Count;

}

return sum == ClientsCount;

}

}

public Font font = new Font(FontFamily.GenericSansSerif,6,FontStyle.Regular);

 

public Qsystem()

{

this.ObjsTick = new ListIOnTickable();

this.ObjsEnd = new ListEndNode();

}

public void Add(IOnTickable o)

{

((DrawingObj)o).Owner = this;

this.ObjsTick.Add(o);

}

public void Add(EndNode o)

{

((DrawingObj)o).Owner = this;

this.ObjsEnd.Add(o);

}

public void StartTick()

{

CalculateClientCount();

while (!IsEnd)

{

StepTick();

}

}

 

public void CalculateClientCount()

{

foreach (var item in this.ObjsTick)

{

Source s = item as Source;

if (s!= null)

{

this.ClientsCount += s.Count;

}

}

}

public void StepTick()

{

foreach (var item in this.ObjsTick)

{

item.OnTick(dt);

}

T += dt;

}

 

public IEnumerableobject GetEnumerator()

{

foreach (var item in this.ObjsTick)

{

yield return item;

}

foreach (var item in this.ObjsEnd)

{

yield return item;

}

}

 

public void Draw(Graphics g)

{

foreach (DrawingObj item in this.GetEnumerator())

{

item.Draw(g);

}

}

 

}

 

2

q-.

: () , .

: , MS Windows XP/7/8, (C++, #) MS Visual Studio.

- 4 .

 





:


: 2017-02-25; !; : 481 |


:

:

,
==> ...

1753 - | 1627 -


© 2015-2024 lektsii.org - -

: 0.01 .