01: package org.andromda.andromdapp;
02:
03: import java.util.ArrayList;
04: import java.util.LinkedHashMap;
05: import java.util.List;
06: import java.util.Map;
07:
08: /**
09: * Represents a <conditions/> element, which groups more than
10: * one condition together.
11: *
12: * @author Chad Brandon
13: */
14: public class Conditions {
15: /**
16: * The "and" type.
17: */
18: static final String TYPE_AND = "and";
19:
20: /**
21: * The "or" type.
22: */
23: static final String TYPE_OR = "or";
24:
25: /**
26: * The type of this conditions instance.
27: */
28: private String type;
29:
30: /**
31: * Gets the type of this conditions instance.
32: *
33: * @return Returns the type.
34: */
35: public String getType() {
36: return this .type;
37: }
38:
39: /**
40: * Sets the type of this conditions instance.
41: *
42: * @param type The type to set.
43: */
44: public void setType(String type) {
45: this .type = type;
46: }
47:
48: /**
49: * Stores the conditions.
50: */
51: private List conditions = new ArrayList();
52:
53: /**
54: * Adds a condition instance to this conditions.
55: *
56: * @param condition the condition which must apply to this conditions instance.
57: */
58: public void addCondition(final Condition condition) {
59: this .conditions.add(condition);
60: }
61:
62: /**
63: * Gets the condition instances defined in this conditions instance.
64: *
65: * @return the conditions that are defined within this prompt.
66: */
67: public List getConditions() {
68: return this .conditions;
69: }
70:
71: /**
72: * Stores the output paths.
73: */
74: private Map outputPaths = new LinkedHashMap();
75:
76: /**
77: * Adds a path to the output paths.
78: *
79: * @param path the path to the resulting output
80: * @param patterns any patterns to which the conditions should apply
81: */
82: public void addOutputPath(final String path, final String patterns) {
83: this .outputPaths.put(path, AndroMDAppUtils
84: .stringToArray(patterns));
85: }
86:
87: /**
88: * Gets the current output paths for this condition.
89: *
90: * @return the map of output paths and its patterns (if it has any defined).
91: */
92: final Map getOutputPaths() {
93: return this.outputPaths;
94: }
95: }
|