ItEr29S14ProcuraOrganizacionsTraballo: Rename Predicate.complays to accepts; add copyright headers
This commit is contained in:
parent
551fc6dbc0
commit
8d1999513c
3 changed files with 46 additions and 3 deletions
|
|
@ -1,13 +1,35 @@
|
|||
/*
|
||||
* This file is part of ###PROJECT_NAME###
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.navalplanner.web.orders;
|
||||
|
||||
/**
|
||||
* Classes implementing this interface check if object matches a given
|
||||
* condition, usually comparing to some attributes in concrete class
|
||||
*
|
||||
* @author Diego Pino Garcia <dpino@igalia.com>
|
||||
*
|
||||
*/
|
||||
public interface IPredicate {
|
||||
|
||||
boolean complays(Object object);
|
||||
boolean accepts(Object object);
|
||||
|
||||
boolean isEmpty();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,30 @@
|
|||
/*
|
||||
* This file is part of ###PROJECT_NAME###
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.navalplanner.web.orders;
|
||||
|
||||
import org.navalplanner.business.labels.entities.Label;
|
||||
import org.navalplanner.business.orders.entities.OrderElement;
|
||||
|
||||
/**
|
||||
* Checks if {@link Label} from {@link OrderElement} matches attribute label
|
||||
*
|
||||
* @author Diego Pino Garcia <dpino@igalia.com>
|
||||
*
|
||||
|
|
@ -17,7 +38,7 @@ public class LabelOrderElementPredicate implements IPredicate {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean complays(Object object) {
|
||||
public boolean accepts(Object object) {
|
||||
final OrderElement orderElement = (OrderElement) object;
|
||||
for (Label label : orderElement.getLabels()) {
|
||||
if (this.label != null && equalsLabel(label)) {
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ public class OrderModel implements IOrderModel {
|
|||
reattachOrderElement(orderElement);
|
||||
reattachLabels();
|
||||
initializeLabels(orderElement.getLabels());
|
||||
if (!predicate.complays(orderElement)) {
|
||||
if (!predicate.accepts(orderElement)) {
|
||||
order.remove(orderElement);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue