Fix name of OnDay class inside ContiguousDaysLine
This commit is contained in:
parent
2e26bc7c30
commit
e8ef76ea59
3 changed files with 19 additions and 19 deletions
|
|
@ -33,7 +33,7 @@ import java.util.TreeMap;
|
|||
import org.apache.commons.lang.Validate;
|
||||
import org.joda.time.Days;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.libreplan.business.planner.chart.ContiguousDaysLine.ONDay;
|
||||
import org.libreplan.business.planner.chart.ContiguousDaysLine.OnDay;
|
||||
import org.libreplan.business.planner.entities.DayAssignment;
|
||||
import org.libreplan.business.workingday.EffortDuration;
|
||||
|
||||
|
|
@ -45,15 +45,15 @@ import org.libreplan.business.workingday.EffortDuration;
|
|||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*
|
||||
*/
|
||||
public class ContiguousDaysLine<T> implements Iterable<ONDay<T>> {
|
||||
public class ContiguousDaysLine<T> implements Iterable<OnDay<T>> {
|
||||
|
||||
public static class ONDay<T> {
|
||||
public static class OnDay<T> {
|
||||
|
||||
private final LocalDate day;
|
||||
|
||||
private final T value;
|
||||
|
||||
private ONDay(LocalDate day, T value) {
|
||||
private OnDay(LocalDate day, T value) {
|
||||
Validate.notNull(day);
|
||||
this.day = day;
|
||||
this.value = value;
|
||||
|
|
@ -175,7 +175,7 @@ public class ContiguousDaysLine<T> implements Iterable<ONDay<T>> {
|
|||
public static SortedMap<LocalDate, EffortDuration> toSortedMap(
|
||||
ContiguousDaysLine<EffortDuration> line) {
|
||||
SortedMap<LocalDate, EffortDuration> result = new TreeMap<LocalDate, EffortDuration>();
|
||||
for (ONDay<EffortDuration> each : line) {
|
||||
for (OnDay<EffortDuration> each : line) {
|
||||
result.put(each.getDay(), each.getValue());
|
||||
}
|
||||
return result;
|
||||
|
|
@ -266,7 +266,7 @@ public class ContiguousDaysLine<T> implements Iterable<ONDay<T>> {
|
|||
min(getEndExclusive(), endExclusive));
|
||||
ContiguousDaysLine<T> result = new ContiguousDaysLine<T>(newStart,
|
||||
days.getDays());
|
||||
for (ONDay<T> each : result) {
|
||||
for (OnDay<T> each : result) {
|
||||
result.set(each.getDay(), this.get(each.getDay()));
|
||||
}
|
||||
return result;
|
||||
|
|
@ -332,7 +332,7 @@ public class ContiguousDaysLine<T> implements Iterable<ONDay<T>> {
|
|||
}
|
||||
ContiguousDaysLine<R> result = ContiguousDaysLine.create(
|
||||
startInclusive, getEndExclusive());
|
||||
for (ONDay<T> onDay : this) {
|
||||
for (OnDay<T> onDay : this) {
|
||||
LocalDate day = onDay.getDay();
|
||||
result.set(day, doubleTransformer.transform(day, onDay.getValue()));
|
||||
}
|
||||
|
|
@ -368,9 +368,9 @@ public class ContiguousDaysLine<T> implements Iterable<ONDay<T>> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Iterator<ONDay<T>> iterator() {
|
||||
public Iterator<OnDay<T>> iterator() {
|
||||
final Iterator<T> iterator = values.iterator();
|
||||
return new Iterator<ONDay<T>>() {
|
||||
return new Iterator<OnDay<T>>() {
|
||||
|
||||
private LocalDate current = startInclusive;
|
||||
|
||||
|
|
@ -380,9 +380,9 @@ public class ContiguousDaysLine<T> implements Iterable<ONDay<T>> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ONDay<T> next() {
|
||||
public OnDay<T> next() {
|
||||
T next = iterator.next();
|
||||
ONDay<T> result = new ONDay<T>(current, next);
|
||||
OnDay<T> result = new OnDay<T>(current, next);
|
||||
current = current.plusDays(1);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import org.joda.time.LocalDate;
|
|||
import org.junit.Test;
|
||||
import org.libreplan.business.planner.chart.ContiguousDaysLine;
|
||||
import org.libreplan.business.planner.chart.ContiguousDaysLine.IValueTransformer;
|
||||
import org.libreplan.business.planner.chart.ContiguousDaysLine.ONDay;
|
||||
import org.libreplan.business.planner.chart.ContiguousDaysLine.OnDay;
|
||||
|
||||
public class ContiguousDaysLineTest {
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ public class ContiguousDaysLineTest {
|
|||
|
||||
@Test
|
||||
public void initiallyTheValuesAreNull() {
|
||||
for (ONDay<String> onDay : ContiguousDaysLine.create(someDate,
|
||||
for (OnDay<String> onDay : ContiguousDaysLine.create(someDate,
|
||||
someDate.plusDays(2), String.class)) {
|
||||
assertThat(onDay.getValue(), nullValue());
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ public class ContiguousDaysLineTest {
|
|||
public boolean matches(Object object) {
|
||||
if (object instanceof ContiguousDaysLine) {
|
||||
ContiguousDaysLine<?> line = (ContiguousDaysLine) object;
|
||||
for (ONDay<?> each : line) {
|
||||
for (OnDay<?> each : line) {
|
||||
if(! ObjectUtils.equals(value, each.getValue())){
|
||||
return false;
|
||||
}
|
||||
|
|
@ -178,7 +178,7 @@ public class ContiguousDaysLineTest {
|
|||
public boolean matches(Object object) {
|
||||
if (object instanceof ContiguousDaysLine) {
|
||||
ContiguousDaysLine<?> another = (ContiguousDaysLine<?>) object;
|
||||
for (ONDay<?> each : line) {
|
||||
for (OnDay<?> each : line) {
|
||||
if (!ObjectUtils.equals(each.getValue(),
|
||||
another.get(each.getDay()))) {
|
||||
return false;
|
||||
|
|
@ -192,7 +192,7 @@ public class ContiguousDaysLineTest {
|
|||
@Override
|
||||
public void describeTo(Description description) {
|
||||
List<Object> values = new ArrayList<Object>();
|
||||
for (ONDay<?> each : line) {
|
||||
for (OnDay<?> each : line) {
|
||||
values.add(each.getValue());
|
||||
}
|
||||
description.appendText("the line has values: " + values);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ import org.libreplan.business.orders.entities.Order;
|
|||
import org.libreplan.business.orders.entities.OrderElement;
|
||||
import org.libreplan.business.orders.entities.OrderStatusEnum;
|
||||
import org.libreplan.business.planner.chart.ContiguousDaysLine;
|
||||
import org.libreplan.business.planner.chart.ContiguousDaysLine.ONDay;
|
||||
import org.libreplan.business.planner.chart.ContiguousDaysLine.OnDay;
|
||||
import org.libreplan.business.planner.chart.ResourceLoadChartData;
|
||||
import org.libreplan.business.planner.entities.DayAssignment;
|
||||
import org.libreplan.business.planner.entities.ICostCalculator;
|
||||
|
|
@ -1205,10 +1205,10 @@ public class OrderPlanningModel implements IOrderPlanningModel {
|
|||
ContiguousDaysLine<List<DayAssignment>> orderAssignments) {
|
||||
List<DayAssignment> filteredAssignments = new ArrayList<DayAssignment>();
|
||||
|
||||
Iterator<ONDay<List<DayAssignment>>> iterator = orderAssignments
|
||||
Iterator<OnDay<List<DayAssignment>>> iterator = orderAssignments
|
||||
.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
ONDay<List<DayAssignment>> onDay = iterator.next();
|
||||
OnDay<List<DayAssignment>> onDay = iterator.next();
|
||||
Set<Resource> resources = getResources(onDay.getValue());
|
||||
filteredAssignments.addAll(filterAssignmentsByResource(
|
||||
allAssignments.get(onDay.getDay()), resources));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue