-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathArchComponent.java
132 lines (103 loc) · 3.37 KB
/
ArchComponent.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import java.io.*;
import java.util.Vector;
/* Package: Architecture */
/******************************
* Copyright (c) 2003--2022 Kevin Lano
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
* *****************************/
public class ArchComponent extends ModelElement
{ public String id = "F1";
public String text = "";
public String requirementKind = "functional";
private boolean product = true;
private boolean local = false;
private Vector providedInterfaces = new Vector(); // of Entity
private Vector requiredInterfaces = new Vector(); // of Entity
private Vector scenarios = new Vector();
private Type type = null;
public ArchComponent(String nme, String i, String txt, String knd)
{ super(nme);
id = i ;
text = txt;
requirementKind = knd;
}
public ArchComponent(String nme)
{ super(nme); }
public String getText()
{ return text; }
public String getKind()
{ return requirementKind; }
public String getScope()
{ if (local)
{ return "local"; }
return "global";
}
public boolean isGlobal()
{ if (local)
{ return false; }
return true;
}
public void setText(String txt)
{ text = txt; }
public void setKind(String k)
{ requirementKind = k; }
public void setScope(String k)
{ if ("local".equals(k))
{ local = true; }
else
{ local = false; }
}
public void clearInterfaces()
{ providedInterfaces = new Vector();
requiredInterfaces = new Vector();
}
public void addProvidedInterface(Entity pintf)
{ if (providedInterfaces.contains(pintf)) { }
else
{ providedInterfaces.add(pintf); }
}
public void addRequiredInterface(Entity pintf)
{ if (requiredInterfaces.contains(pintf)) { }
else
{ requiredInterfaces.add(pintf); }
}
public Vector getProvidedInterfaces()
{ return providedInterfaces; }
public Vector getRequiredInterfaces()
{ return requiredInterfaces; }
public String toString()
{ return "Component: " + name + "\n" +
"Provided interfaces: " + providedInterfaces + "\n" +
"Required interfaces: " + requiredInterfaces + "\n";
}
public Vector getParameters()
{ return new Vector(); }
public void addParameter(Attribute att)
{ }
public Type getType() { return type; }
public void setType(Type t) { type = t; }
public void generateJava(PrintWriter out) { }
public String saveData()
{ String res = name + "\n\n\n";
// for (int i = 0; i < scenarios.size(); i++)
// { Scenario sc = (Scenario) scenarios.get(i);
// res = res + sc.saveData(name) + "\n";
// }
return res;
}
public void saveModelData(PrintWriter out)
{ out.println(name + " : ArchComponent");
// out.println(name + ".id = \"" + id + "\"");
// out.println(name + ".text = \"" + text + "\"");
// out.println(name + ".requirementKind = \"" + requirementKind + "\"");
// out.println(name + ".localScope = " + local);
/* for (int i = 0; i < scenarios.size(); i++)
{ Scenario sc = (Scenario) scenarios.get(i);
sc.saveModelData(out,name);
} */
}
}