4 * represents a set in the model space
10 public class SetDescriptor extends Descriptor {
15 public static String prefix="";
17 public SetDescriptor(String name) {
19 subsets = new Vector();
23 public static Set expand(Set descriptors) {
24 HashSet expanded = new HashSet();
25 Iterator d = descriptors.iterator();
28 Descriptor descriptor = (Descriptor) d.next();
30 if (descriptor instanceof SetDescriptor) {
31 expanded.addAll(((SetDescriptor) descriptor).allSubsets());
33 expanded.add(descriptor); /* Still need the descriptor */
36 expanded.addAll(descriptors);
40 public boolean isPartition() {
44 public void isPartition(boolean newvalue) {
48 public void setType(TypeDescriptor td) {
52 public TypeDescriptor getType() {
56 public void addSubset(SetDescriptor sd) {
57 subsets.addElement(sd);
60 public Vector getSubsets() {
64 public Iterator subsets() {
65 return subsets.iterator();
68 public boolean isSubset(SetDescriptor sd) {
73 for (int i = 0; i < subsets.size(); i++) {
74 SetDescriptor subset = (SetDescriptor) subsets.elementAt(i);
75 if (subset.isSubset(sd)) {
83 public Set allSubsets() {
84 Set v = new HashSet();
87 for (int i = 0; i < subsets.size(); i++) {
88 SetDescriptor subset = (SetDescriptor) subsets.elementAt(i);
89 v.addAll(subset.allSubsets());
95 public String getSafeSymbol() {
96 return prefix+safename;
98 public String getJustSafeSymbol() {