Skip to content

Package: ConditionServiceManager

ConditionServiceManager

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2016 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Eugen Neufeld - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.internal.rule;
15:
16: import java.util.Map;
17: import java.util.Set;
18:
19: import org.eclipse.emf.ecore.EObject;
20: import org.eclipse.emf.ecore.EStructuralFeature.Setting;
21: import org.eclipse.emf.ecp.common.spi.UniqueSetting;
22: import org.eclipse.emf.ecp.view.spi.model.VDomainModelReference;
23: import org.eclipse.emf.ecp.view.spi.rule.model.Condition;
24:
25: /**
26: * The ConditionServiceManager is responsible to delegate evaluation calls about conditions to the corresponding
27: * ConditionServices.
28: *
29: * @author Eugen Neufeld
30: *
31: */
32: public interface ConditionServiceManager {
33:
34:         /**
35:          * Returns the conditionSetting for a condition and the corresponding domain model.
36:          *
37:          * @param condition The condition to get the settings for
38:          * @param domainModel The domain model this condition applies to
39:          * @return The Set of Settings. This set cannot be null.
40:          */
41:         Set<UniqueSetting> getConditionSettings(Condition condition, EObject domainModel);
42:
43:         /**
44:          * Evaluates the given condition using the provided domain model.
45:          *
46:          * @param condition The condition to evaluate.
47:          * @param domainModel The root domain object of this condition.
48:          * @return {@code true}, if the condition matches, {@code false} otherwise
49:          */
50:         boolean evaluate(Condition condition, EObject domainModel);
51:
52:         /**
53:          * Evaluates whether the given condition using the provided domain model will change if a specific setting will be
54:          * set to a specific value.
55:          *
56:          * @param condition The condition to evaluate.
57:          * @param domainModel The root domain object of this condition.
58:          * @param possibleNewValues
59:          * the new value that should be compared against the expected value of the condition
60:          * @return {@code true}, if the condition matches, {@code false} otherwise
61:          */
62:         boolean evaluateChangedValues(Condition condition, EObject domainModel, Map<Setting, Object> possibleNewValues);
63:
64:         /**
65:          * The Set of DomainModelReferences this condition needs to evaluate.
66:          *
67:          * @param condition The condition to retrieve the VDomainModelReferences for
68:          * @return The Set of DomainModelReferences. The set cannot be null.
69:          */
70:         Set<VDomainModelReference> getDomainModelReferences(Condition condition);
71: }