/
association_AddUnidirectionalMN_relatedSpecialization.ump
51 lines (48 loc) · 3.56 KB
/
association_AddUnidirectionalMN_relatedSpecialization.ump
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
class UmpleToJava {
association_AddUnidirectionalMN_relatedSpecialization <<! /* Code from template association_AddUnidirectionalMN_relatedSpecialization */
<</*association_AddUnidirectionalMN_relatedSpecialization*/>> public boolean <<=gen.translate("addMethod",av)>>(<<=gen.translate("type",av)>> <<=gen.translate("parameterOne",av)>>)
{
boolean wasAdded = false;
<<# if (customAddPrefixCode != null) { append(realSb, "\n{0}",GeneratorHelper.doIndent(customAddPrefixCode, " ")); } #>>
if (<<=gen.translate("numberOfMethod",av)>>() < <<=gen.translate("maximumNumberOfMethod",av)>>_<<=gen.translate("type",av)>>())
{<<#for( TraceItem traceItemAssocAdd : traceItemAssocAdds )#>><<=
(traceItemAssocAdd!=null&&traceItemAssocAdd.getIsPre()?"\n"+traceItemAssocAdd.trace(gen, av,"as_a", uClass,gen.translate("numberOfMethod",av)+"()"):"")
>>
<<=gen.translate("associationMany",av)>>.add(<<=gen.translate("parameterOne",av)>>);<<#for( TraceItem traceItemAssocAdd : traceItemAssocAdds )#>><<=
(traceItemAssocAdd!=null&&traceItemAssocAdd.getIsPost()?"\n"+traceItemAssocAdd.trace(gen, av,"as_a", uClass,gen.translate("numberOfMethod",av)+"()"):"")
>>
wasAdded = true;
}
<<# if (customAddPostfixCode != null) { addUncaughtExceptionVariables(realSb.toString().split("\\n").length,customAddPostfixCode,gen.translate("addMethod",av));
append(realSb, "\n{0}",GeneratorHelper.doIndent(customAddPostfixCode, " ")); } #>>
return wasAdded;
}
public boolean <<=gen.translate("removeMethod",av)>>(<<=gen.translate("type",av)>> <<=gen.translate("parameterOne",av)>>)
{
boolean wasRemoved = false;
<<# if (customRemovePrefixCode != null) { addUncaughtExceptionVariables(realSb.toString().split("\\n").length,customRemovePrefixCode,gen.translate("removeMethod",av));
append(realSb, "\n{0}",GeneratorHelper.doIndent(customRemovePrefixCode, " ")); } #>>
if (!<<=gen.translate("associationMany",av)>>.contains(<<=gen.translate("parameterOne",av)>>))
{
<<# if (customRemovePostfixCode != null) { addUncaughtExceptionVariables(realSb.toString().split("\\n").length,customRemovePostfixCode,gen.translate("removeMethod",av));
append(realSb, "\n{0}",GeneratorHelper.doIndent(customRemovePostfixCode, " ")); } #>>
return wasRemoved;
}
if (<<=gen.translate("numberOfMethod",av)>>() <= <<=gen.translate("minimumNumberOfMethod",av)>>_<<=gen.translate("type",av)>>())
{
<<# if (customRemovePostfixCode != null) { addUncaughtExceptionVariables(realSb.toString().split("\\n").length,customRemovePostfixCode,gen.translate("removeMethod",av));
append(realSb, "\n{0}",GeneratorHelper.doIndent(customRemovePostfixCode, " ")); } #>>
return wasRemoved;
}<<#for( TraceItem traceItemAssocRemove : traceItemAssocRemoves )#>><<=
(traceItemAssocRemove!=null&&traceItemAssocRemove.getIsPre()?"\n"+traceItemAssocRemove.trace(gen, av,"as_r", uClass,gen.translate("numberOfMethod",av)+"()"):"")
>>
<<=gen.translate("associationMany",av)>>.remove(<<=gen.translate("parameterOne",av)>>);<<#for( TraceItem traceItemAssocRemove : traceItemAssocRemoves )#>><<=
(traceItemAssocRemove!=null&&traceItemAssocRemove.getIsPost()?"\n"+traceItemAssocRemove.trace(gen, av,"as_r", uClass,gen.translate("numberOfMethod",av)+"()"):"")
>>
wasRemoved = true;
<<# if (customRemovePostfixCode != null) { addUncaughtExceptionVariables(realSb.toString().split("\\n").length,customRemovePostfixCode,gen.translate("removeMethod",av));
append(realSb, "\n{0}",GeneratorHelper.doIndent(customRemovePostfixCode, " ")); } #>>
return wasRemoved;
}
!>>
}