1 | package de.uka.ipd.sdq.scheduler.resources; |
2 | |
3 | import de.uka.ipd.sdq.scheduler.SchedulerModel; |
4 | import de.uka.ipd.sdq.scheduler.entities.SchedulerEntity; |
5 | import de.uka.ipd.sdq.scheduler.factory.SchedulingFactory; |
6 | |
7 | |
8 | public abstract class AbstractSimResource extends SchedulerEntity { |
9 | |
10 | protected int capacity; |
11 | private String name = ""; |
12 | private String id = ""; |
13 | protected SchedulingFactory factory; |
14 | |
15 | |
16 | public AbstractSimResource(SchedulerModel model, int capacity, String name, String id) { |
17 | super(model, AbstractSimResource.class.getName()); |
18 | this.capacity = capacity; |
19 | this.name = name; |
20 | this.id = id; |
21 | |
22 | factory = new SchedulingFactory(model); |
23 | } |
24 | |
25 | public int getCapacity() { |
26 | return capacity; |
27 | } |
28 | |
29 | public String getName() { |
30 | return name; |
31 | } |
32 | |
33 | public String getId() { |
34 | return id; |
35 | } |
36 | |
37 | @Override |
38 | public boolean equals(Object obj) { |
39 | if (obj != null && obj instanceof AbstractSimResource) { |
40 | AbstractSimResource res = (AbstractSimResource) obj; |
41 | return this.id.equals(res.getId()); |
42 | } |
43 | return false; |
44 | } |
45 | |
46 | @Override |
47 | public String toString() { |
48 | return name + id; |
49 | } |
50 | |
51 | @Override |
52 | public int hashCode() { |
53 | return id.hashCode(); |
54 | } |
55 | } |