#include #include "resourcematrix.h" ResourceMatrix::ResourceMatrix() { srand(1); m_plannedTimeSlicesCount = 100; m_resourceCount = 30; m_tickResolution = 3; for (int i = 0; i < m_resourceCount; i++) { m_resources.append(QVector (m_plannedTimeSlicesCount, 0)); } randomize(); } ResourceMatrix::~ResourceMatrix() { } void ResourceMatrix::randomize() { QMutableVectorIterator< QVector > i(m_resources); QVector timeline; int randomNumber; while (i.hasNext()) { timeline = i.next(); for (int j = 0; j < timeline.size(); j++) { randomNumber = rand(); if (randomNumber % 2) { timeline[j] = 1; } } } } int ResourceMatrix::resourceCount() { return m_resourceCount; } int ResourceMatrix::plannedTimeSclices() { return m_plannedTimeSlicesCount; } int ResourceMatrix::tickResolution() { return m_tickResolution; } QVector< QVector > ResourceMatrix::getReservations() { return m_resources; }