annotate artifact-database/src/main/java/de/intevation/artifactdatabase/state/StateEngine.java @ 347:16ab243507e0

Let StateEngine compute compatibility matrix based on a list of states. artifacts/trunk@3108 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 28 Oct 2011 10:08:35 +0000
parents 2ce31a9414ff
children 5420b96dd0b3
rev   line source
104
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.artifactdatabase.state;
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
347
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
3 import java.util.ArrayList;
104
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import java.util.HashMap;
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import java.util.List;
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import java.util.Map;
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import org.apache.log4j.Logger;
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 /**
347
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
11 * The StateEngine stores all states and associated information about
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
12 * outputs and facets for each Artifact.
104
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 *
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 */
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 public class StateEngine {
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 /** The logger used in this class. */
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 private static Logger logger = Logger.getLogger(StateEngine.class);
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 /**
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 * A map that contains the states of the artifacts. The key of this map is
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 * the name of an artifact, its value is a list of all states the artifact
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 * can reach.
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 */
272
2ce31a9414ff Use generics more precisely
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 108
diff changeset
26 protected Map<String, List<State>> states;
104
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 /**
108
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
30 * A map that contains all existing states. The key of this map is the ID of
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
31 * the state, its value is the state itself.
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
32 */
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
33 protected Map<String, State> allStates;
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
34
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
35
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
36 /**
104
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 * The default constructor.
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 */
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 public StateEngine() {
272
2ce31a9414ff Use generics more precisely
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 108
diff changeset
40 states = new HashMap<String, List<State>>();
108
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
41 allStates = new HashMap<String, State>();
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
42 }
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
43
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
44
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
45 /**
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
46 * This method adds a state into the map <i>allStates</i>.
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
47 *
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
48 * @param state The state to add.
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
49 */
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
50 protected void addState(State state) {
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
51 allStates.put(state.getID(), state);
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
52 }
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
53
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
54
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
55 /**
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
56 * Returns the state based on its ID.
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
57 *
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
58 * @param stateId The ID of the desired state.
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
59 *
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
60 * @return the state.
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
61 */
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
62 public State getState(String stateId) {
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
63 return allStates.get(stateId);
104
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 }
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 /**
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 * Add new states for a specific artifact.
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 *
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 * @param artifact The name of the artifact.
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 * @param states A list of states that the artifact can reach.
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 *
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 * @return true, if the states were added, otherwise false.
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 */
108
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
75 public boolean addStates(String artifact, List<State> states) {
104
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 List tmp = this.states.get(artifact);
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 if (tmp != null) {
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 logger.info(
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 "States for the artifact '" + artifact + "' already stored.");
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 return false;
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 }
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84
108
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
85 // add the state to the map with all existing states
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
86 for (State s: states) {
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
87 addState(s);
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
88 }
9ece61d918b1 Improved the StateEngine and the TransitionEngine to retrieve the reachable states of a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 106
diff changeset
89
104
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 logger.debug("Add new states for the artifact '" + artifact + "'");
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 return this.states.put(artifact, states) != null;
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 }
106
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 104
diff changeset
93
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 104
diff changeset
94
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 104
diff changeset
95 /**
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 104
diff changeset
96 * Returns the state list of an artifact specified by its name.
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 104
diff changeset
97 *
347
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
98 * @param artifact The name of the artifact (e.g. "winfo").
106
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 104
diff changeset
99 *
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 104
diff changeset
100 * @return the list of states of this artifact or <i>null</i> if no states
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 104
diff changeset
101 * are existing for this <i>artifact</i>.
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 104
diff changeset
102 */
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 104
diff changeset
103 public List<State> getStates(String artifact) {
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 104
diff changeset
104 return states.get(artifact);
ece0fdb07975 Implementations to initialize and retrieve states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 104
diff changeset
105 }
347
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
106
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
107
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
108 /**
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
109 * Return mapping of output to facets for an artifact in its states.
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
110 */
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
111 public Map<String, List<String>> getCompatibleFacets(List<String> aStates) {
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
112 Map<String, List<String>> compatibilityMatrix =
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
113 new HashMap<String, List<String>>();
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
114
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
115 // For all states that the artifact had seen, add outputs facets.
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
116 for (String stateId: aStates) {
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
117
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
118 State state = allStates.get(stateId);
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
119 if (state == null) {
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
120 continue;
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
121 }
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
122
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
123 for (Output output: state.getOutputs()) {
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
124 List<Facet> outFacets = output.getFacets();
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
125
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
126 List<String> oldFacets = compatibilityMatrix.get(output.getName());
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
127
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
128 if (oldFacets == null) {
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
129 oldFacets = new ArrayList<String>();
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
130 }
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
131
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
132 for (Facet facet: outFacets) {
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
133 oldFacets.add(facet.getName());
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
134 }
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
135
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
136 compatibilityMatrix.put(output.getName(), oldFacets);
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
137 }
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
138 }
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
139 return compatibilityMatrix;
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
140 }
104
26bfff409dd3 Added interfaces and engines used in concrete artifact packages.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 }
347
16ab243507e0 Let StateEngine compute compatibility matrix based on a list of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 272
diff changeset
142 // vim:set ts=4 sw=4 et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org