-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClassifications.java
154 lines (138 loc) · 3.79 KB
/
Classifications.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE 1.29.1.4295.41a59b8ce modeling language!*/
import java.util.*;
// line 51 "model.ump"
// line 152 "model.ump"
public class Classifications
{
//------------------------
// MEMBER VARIABLES
//------------------------
//Classifications Associations
private List<Clusterizing> clusterizings;
//------------------------
// CONSTRUCTOR
//------------------------
public Classifications()
{
clusterizings = new ArrayList<Clusterizing>();
}
//------------------------
// INTERFACE
//------------------------
/* Code from template association_GetMany */
public Clusterizing getClusterizing(int index)
{
Clusterizing aClusterizing = clusterizings.get(index);
return aClusterizing;
}
public List<Clusterizing> getClusterizings()
{
List<Clusterizing> newClusterizings = Collections.unmodifiableList(clusterizings);
return newClusterizings;
}
public int numberOfClusterizings()
{
int number = clusterizings.size();
return number;
}
public boolean hasClusterizings()
{
boolean has = clusterizings.size() > 0;
return has;
}
public int indexOfClusterizing(Clusterizing aClusterizing)
{
int index = clusterizings.indexOf(aClusterizing);
return index;
}
/* Code from template association_MinimumNumberOfMethod */
public static int minimumNumberOfClusterizings()
{
return 0;
}
/* Code from template association_AddManyToManyMethod */
public boolean addClusterizing(Clusterizing aClusterizing)
{
boolean wasAdded = false;
if (clusterizings.contains(aClusterizing)) { return false; }
clusterizings.add(aClusterizing);
if (aClusterizing.indexOfClassification(this) != -1)
{
wasAdded = true;
}
else
{
wasAdded = aClusterizing.addClassification(this);
if (!wasAdded)
{
clusterizings.remove(aClusterizing);
}
}
return wasAdded;
}
/* Code from template association_RemoveMany */
public boolean removeClusterizing(Clusterizing aClusterizing)
{
boolean wasRemoved = false;
if (!clusterizings.contains(aClusterizing))
{
return wasRemoved;
}
int oldIndex = clusterizings.indexOf(aClusterizing);
clusterizings.remove(oldIndex);
if (aClusterizing.indexOfClassification(this) == -1)
{
wasRemoved = true;
}
else
{
wasRemoved = aClusterizing.removeClassification(this);
if (!wasRemoved)
{
clusterizings.add(oldIndex,aClusterizing);
}
}
return wasRemoved;
}
/* Code from template association_AddIndexControlFunctions */
public boolean addClusterizingAt(Clusterizing aClusterizing, int index)
{
boolean wasAdded = false;
if(addClusterizing(aClusterizing))
{
if(index < 0 ) { index = 0; }
if(index > numberOfClusterizings()) { index = numberOfClusterizings() - 1; }
clusterizings.remove(aClusterizing);
clusterizings.add(index, aClusterizing);
wasAdded = true;
}
return wasAdded;
}
public boolean addOrMoveClusterizingAt(Clusterizing aClusterizing, int index)
{
boolean wasAdded = false;
if(clusterizings.contains(aClusterizing))
{
if(index < 0 ) { index = 0; }
if(index > numberOfClusterizings()) { index = numberOfClusterizings() - 1; }
clusterizings.remove(aClusterizing);
clusterizings.add(index, aClusterizing);
wasAdded = true;
}
else
{
wasAdded = addClusterizingAt(aClusterizing, index);
}
return wasAdded;
}
public void delete()
{
ArrayList<Clusterizing> copyOfClusterizings = new ArrayList<Clusterizing>(clusterizings);
clusterizings.clear();
for(Clusterizing aClusterizing : copyOfClusterizings)
{
aClusterizing.removeClassification(this);
}
}
}