-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcessClass.cs
More file actions
56 lines (47 loc) · 1.79 KB
/
ProcessClass.cs
File metadata and controls
56 lines (47 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProcessSchedulerProyect
{
class ProcessClass
{
// These are the parameters for the process.
public string Name, State, Priority;
public Date DateOfCreation;
public int id;
//These is the option NeedResourcess so, when a process goes to the running queue if it need to share resourcess
// it is going to be moved to the waiting state. And when a process is completed the process is going ot be terminated.
public bool NeedResourcess, Completed;
public ProcessClass(int id_,string Name_, Date DateOfCreation_, string State_, string Priority_, bool NeedResourcess_, bool Completed_)
{
int id = id_;
Name = Name_;
DateOfCreation = DateOfCreation_;
State = State_;
Priority = Priority_;
NeedResourcess = NeedResourcess_;
Completed = Completed_;
}
public ProcessClass(string line)
{
string[] parts = line.Split(',');
id = int.Parse(parts[0]);
Name = parts[1];
DateOfCreation = new Date(parts[2]);
State = parts[3];
Priority = parts[4];
NeedResourcess = bool.Parse(parts[5]);
Completed = bool.Parse(parts[6]);
}
public string serialize()
{
return id.ToString() + ","+ Name + "," + DateOfCreation.serlialize() + "," + State + "," + Priority + "," + NeedResourcess + "," + Completed;
}
public override string ToString()
{
return this.serialize();
}
}
}