source: proiecte/GAIIA/Task.cpp @ 122

Last change on this file since 122 was 122, checked in by (none), 14 years ago
File size: 1.2 KB
Line 
1#include "Graf.h"
2
3/**
4* the constructor
5*
6* @param i the id
7* @param c the cost
8*/
9Task::Task(int i, double c) : Nod(i, c)
10{
11        niv_topo_min = -1;
12        niv_topo_max = -1;
13        procesor_id = -1;
14
15        start = -1;
16        stop = -1;
17}
18
19/**
20* the default initialization
21*/
22void Task::init(){
23        procesor_id=-1;
24        start = -1;
25        stop = -1;
26}
27
28/**
29* Method that assocites to the current task a processor scheduling it to be executed between "st" and "fin"
30*
31* @param id the id of the associated processor
32* @param st the start moment
33* @param fin the stop moment
34*/
35void Task::setProcesor(int id, int st, int fin)
36{
37        procesor_id = id;
38        start = st;
39        stop = fin;
40}
41
42/*
43bool Task::operator<(const Task & t1, const Task & t2){
44         return t1.niv_topo_min < t2.niv_topo_min;
45}
46*/
47
48/**
49* method printing the task's information
50*/
51void Task::print()
52{
53        printf("[Task id = %i cost = %lf min = %i max = %i (%i, %i) proc = %i pred{ ", id, cost, niv_topo_min, niv_topo_max, start, stop, procesor_id);
54        for(int i = 0 ; i < nr_pred ; i ++)
55                printf("%i(%lf) ", ((Muchie*)predecesori[i])->predecesor->id, ((Muchie*)predecesori[i])->cost);
56        printf("} succ { ");
57        for(int i = 0 ; i < nr_succ ; i ++)
58                printf("%i(%lf) ", ((Muchie*)succesori[i])->succesor->id, ((Muchie*)succesori[i])->cost);
59        printf("}]\n");
60}
61
62
Note: See TracBrowser for help on using the repository browser.