21
21
import com .fasterxml .jackson .annotation .JsonProperty ;
22
22
23
23
import java .util .ArrayList ;
24
+ import java .util .Collections ;
24
25
import java .util .HashMap ;
25
26
import java .util .List ;
26
27
import java .util .Map ;
@@ -89,7 +90,6 @@ public double getFitness() {
89
90
}
90
91
91
92
public static class PreferentialNamedConsumableResource {
92
- private final double maxFitness ;
93
93
private final String hostname ;
94
94
private final int index ;
95
95
private final String attrName ;
@@ -104,9 +104,6 @@ public static class PreferentialNamedConsumableResource {
104
104
this .attrName = attrName ;
105
105
this .limit = limit ;
106
106
usageBy = new HashMap <>();
107
- // we add 1.0 to max fitness possible since we add 1.0 for the situation when there is already a task
108
- // assigned with the same resValue even though it uses 0.0 subResources, versus, there are no assignments yet.
109
- maxFitness = limit + 1.0 ;
110
107
}
111
108
112
109
public int getIndex () {
@@ -125,9 +122,10 @@ public Map<String, TaskRequest.NamedResourceSetRequest> getUsageBy() {
125
122
return usageBy ;
126
123
}
127
124
128
- double getUsedCount () {
129
- if (resName == null )
125
+ public int getUsedCount () {
126
+ if (resName == null ) {
130
127
return -1 ;
128
+ }
131
129
return usedSubResources ;
132
130
}
133
131
@@ -223,6 +221,10 @@ public String getName() {
223
221
return name ;
224
222
}
225
223
224
+ public List <PreferentialNamedConsumableResource > getUsageBy () {
225
+ return Collections .unmodifiableList (usageBy );
226
+ }
227
+
226
228
// boolean hasAvailability(TaskRequest request) {
227
229
// for(PreferentialNamedConsumableResource r: usageBy) {
228
230
// if(r.hasAvailability(request))
@@ -298,7 +300,7 @@ int getNumSubResources() {
298
300
List <Double > getUsedCounts () {
299
301
List <Double > counts = new ArrayList <>(usageBy .size ());
300
302
for (PreferentialNamedConsumableResource r : usageBy )
301
- counts .add (r .getUsedCount ());
303
+ counts .add (( double ) r .getUsedCount ());
302
304
return counts ;
303
305
}
304
306
}
0 commit comments