private ModelTime Min(ModelTime mt1, ModelTime mt2, ModelTime mt3) { return(new ModelTime() { Time = Math.Min(Math.Min(mt1.Time, mt2.Time), mt3.Time) }); }
public Server(ref ModelTime time, AbstractGenerator aTypeGenerator, AbstractGenerator bTypeGenerator) { _time = time; _aTypeGenerator = aTypeGenerator; _bTypeGenerator = bTypeGenerator; IsFree = true; }
public void Enter(Transact transact) { transact.AddLog(new TransactLog(_time, EventTypeEnum.EnterServer)); IsFree = false; _currentTransact = transact; NextReleaseTime = new ModelTime() { Time = _time.Time + (_currentTransact.Type == TransactTypeEnum.Atype ? _aTypeGenerator.Next() : _bTypeGenerator.Next()) }; }
public Model( AbstractGenerator sourceAGenerator, AbstractGenerator sourceBGenerator, AbstractGenerator serverAGenerator, AbstractGenerator serverBGenerator, ModelTime maxTime) { _time = new ModelTime(); MaxTime = maxTime; Source = new Source(ref _time, sourceAGenerator, sourceBGenerator); Drain = new Drain(ref _time); Queue = new Queue(ref _time); Server = new Server(ref _time, serverAGenerator, serverBGenerator); }
public Source(ref ModelTime time, AbstractGenerator aTypeGenerator, AbstractGenerator bTypeGenerator) { _time = time; _aTypeGenerator = aTypeGenerator; _bTypeGenerator = bTypeGenerator; NextAGenerationTime = new ModelTime() { Time = _time.Time + _aTypeGenerator.Next() }; NextBGenerationTime = new ModelTime() { Time = _time.Time + _bTypeGenerator.Next() }; }
public Transact Get() { Transact transact = null; if (NextAGenerationTime == _time) { NextAGenerationTime = new ModelTime() { Time = _time.Time + _aTypeGenerator.Next() }; transact = new Transact(++idCounter, TransactTypeEnum.Atype); } if (NextBGenerationTime == _time) { NextBGenerationTime = new ModelTime() { Time = _time.Time + _bTypeGenerator.Next() }; transact = new Transact(++idCounter, TransactTypeEnum.Btype); } transact?.AddLog(new TransactLog(_time, EventTypeEnum.Born)); return(transact); }
public Queue(ref ModelTime time) { _time = time; }
public Drain(ref ModelTime time) { _time = time; DrainedTransacts = new List <Transact>(); }