ItEr29S06CUAsignacionGrupoRecursosAPlanificacionItEr28S06: Exposing getName function

This commit is contained in:
Óscar González Fernández 2009-10-07 12:09:35 +02:00
parent 7f1bba826c
commit edb9d0c3d3

View file

@ -231,9 +231,8 @@ public class ResourceLoadModel implements IResourceLoadModel {
List<LoadTimeLine> result = new ArrayList<LoadTimeLine>();
for (Entry<Set<Criterion>, List<GenericResourceAllocation>> entry : byCriterions
.entrySet()) {
LoadTimeLine timeLine = buildTimeLine(new ArrayList<Criterion>(
entry.getKey()),
resource, entry.getValue());
LoadTimeLine timeLine = buildTimeLine(entry.getKey(), resource,
entry.getValue());
if (!timeLine.isEmpty()) {
result.add(timeLine);
}
@ -257,7 +256,7 @@ public class ResourceLoadModel implements IResourceLoadModel {
return secondLevel;
}
private LoadTimeLine buildTimeLine(List<Criterion> criterions,
private LoadTimeLine buildTimeLine(Collection<Criterion> criterions,
Resource resource,
List<GenericResourceAllocation> allocationsSortedByStartDate) {
return new LoadTimeLine(getName(criterions), PeriodsBuilder.build(
@ -265,13 +264,14 @@ public class ResourceLoadModel implements IResourceLoadModel {
allocationsSortedByStartDate));
}
private String getName(List<Criterion> criterions) {
public static String getName(Collection<? extends Criterion> criterions) {
if (criterions.isEmpty()) {
return _("generic all workers");
return _("[generic all workers]");
}
String[] names = new String[criterions.size()];
for (int i = 0; i < names.length; i++) {
names[i] = criterions.get(i).getName();
int i = 0;
for (Criterion criterion : criterions) {
names[i++] = criterion.getName();
}
return Arrays.toString(names);
}