.if (%implInterface%)
.// Get collection
.set_value(_operationName, get%.FU:roleName%, new)
.set_value(_operationSignature, get%.FU:roleName%, new)
.set_value(_memberName, %roleName%, new)
.if (%endClassHasOperation% == false)
public %implInterface% %_operationName%() \
{
if (%_memberName% == null)
%_memberName% = new %implClass%();
return %_memberName%;
}
.endif(\n\n)
.// Get iterator
.set_value(_operationName, getIterator%.FU:roleName%, new)
.set_value(_operationSignature, getIterator%.FU:roleName%, new)
.set_value(_memberName, %roleName%, new)
.if (%endClassHasOperation% == false)
public java.util.Iterator %_operationName%() \
{
if (%_memberName% == null)
%_memberName% = new %implClass%();
return %_memberName%.iterator();
}
.endif(\n\n)
.// Set collection
.set_value(_operationName, set%.FU:roleName%, new)
.set_value(_operationSignature, set%.FU:roleName%@%implInterface%, new)
.set_value(_paramName, new%.FU:roleName%, new)
.set_value(_memberName, %roleName%, new)
.if (%endClassHasOperation% == false)
public void %_operationName%(%implInterface% %_paramName%) \
{
removeAll%.FU:roleName%();
for (java.util.Iterator iter = %_paramName%.iterator(); iter.hasNext();)
add%.FU:roleName%((%Classifier.qualifiedCode%)iter.next());
}
.endif(\n\n)
.// Add object
.set_value(_operationName, add%.FU:roleName%, new)
.set_value(_operationSignature, add%.FU:roleName%@%Classifier.qualifiedCode%, new)
.set_value(_paramName, new%.FU:Classifier.Code%, new)
.set_value(_memberName, %roleName%, new)
.if (%endClassHasOperation% == false)
public void %_operationName%(%Classifier.qualifiedCode% %_paramName%) \
{
if (%_paramName% == null)
return;
if (this.%_memberName% == null)
this.%_memberName% = new %implClass%();
if (!this.%_memberName%.contains(%_paramName%))\n
.if (%endNavigability%) and (%endMultiple% == false)
{
this.%_memberName%.add(%_paramName%);
%_paramName%.set%.FU:endRoleName%(this);
}
.elsif (%endNavigability%) and (%endMultiple%) and (%endClassHasImplementation%)
{
this.%_memberName%.add(%_paramName%);
%_paramName%.add%.FU:endRoleName%(this);
}
.else
this.%_memberName%.add(%_paramName%);
.endif(\n)
}
.endif(\n\n)
.// Remove object
.set_value(_operationName, remove%.FU:roleName%, new)
.set_value(_operationSignature, remove%.FU:roleName%@%Classifier.qualifiedCode%, new)
.set_value(_paramName, old%.FU:Classifier.Code%, new)
.set_value(_memberName, %roleName%, new)
.if (%endClassHasOperation% == false)
public void %_operationName%(%Classifier.qualifiedCode% %_paramName%) \
{
if (%_paramName% == null)
return;
if (this.%_memberName% != null)
if (this.%_memberName%.contains(%_paramName%))\n
.if (%endNavigability%) and (%endMultiple% == false)
{
this.%_memberName%.remove(%_paramName%);
%_paramName%.set%.FU:endRoleName%((%EndClassifier.qualifiedCode%)null);
}
.elsif (%endNavigability%) and (%endMultiple%) and (%endClassHasImplementation%)
{
this.%_memberName%.remove(%_paramName%);
%_paramName%.remove%.FU:endRoleName%(this);
}
.else
this.%_memberName%.remove(%_paramName%);
.endif(\n)
}
.endif(\n\n)
.// Remove all objects
.set_value(_operationName, removeAll%.FU:roleName%, new)
.set_value(_operationSignature, removeAll%.FU:roleName%, new)
.set_value(_memberName, %roleName%, new)
.set_value(_tempObjName, old%.FU:Classifier.Code%, new)
.if (%endClassHasOperation% == false)
public void %_operationName%() \
{
if (%_memberName% != null)\n
.if (%endNavigability%) and (%endMultiple% == false)
{
%Classifier.qualifiedCode% %_tempObjName%;
for (java.util.Iterator iter = getIterator%.FU:roleName%(); iter.hasNext();)
{
%_tempObjName% = (%Classifier.qualifiedCode%)iter.next();
iter.remove();
%_tempObjName%.set%.FU:endRoleName%((%EndClassifier.qualifiedCode%)null);
}
}
.elsif (%endNavigability%) and (%endMultiple%) and (%endClassHasImplementation%)
{
%Classifier.qualifiedCode% %_tempObjName%;
for (java.util.Iterator iter = getIterator%.FU:roleName%(); iter.hasNext();)
{
%_tempObjName% = (%Classifier.qualifiedCode%)iter.next();
iter.remove();
%_tempObjName%.remove%.FU:endRoleName%(this);
}
}
.else
%_memberName%.clear();
.endif(\n)
}
.endif(\n)
.else
.if (%isGenAssocDefaultAccessors%)
.// Default accessors
.// Get array
.set_value(_operationName, get%.FU:roleName%, new)
.set_value(_operationSignature, get%.FU:roleName%, new)
.set_value(_memberName, %roleName%, new)
.if (%endClassHasOperation% == false)
public %Classifier.qualifiedCode%\[\] %_operationName%() \
{
return %_memberName%;
}
.endif(\n\n)
.// Set array
.set_value(_operationName, set%.FU:roleName%, new)
.set_value(_operationSignature, set%.FU:roleName%@%Classifier.qualifiedCode%#, new)
.set_value(_paramName, new%.FU:roleName%, new)
.set_value(_memberName, %roleName%, new)
.if (%endClassHasOperation% == false)
public void %_operationName%(%Classifier.qualifiedCode%\[\] %_paramName%) \
{
this.%_memberName% = %_paramName%;
}
.endif(\n\n)
.endif
.endif
.if ((%endNavigability%) and(%endContainerType%) and (%endMultiple%)) or (%isGenAssocDefaultAccessors%)
.// Parent getter
.set_value(_operationName, get%.FU:roleName%, new)
.set_value(_operationSignature, get%.FU:roleName%, new)
.if (%endClassHasOperation% == false)
public %Classifier.qualifiedCode% get%.FU:roleName%() \
{
return %roleName%;
}
.endif(\n\n)
.// Parent setter
.set_value(_operationName, set%.FU:roleName%)
.set_value(_operationSignature, set%.FU:roleName%@%Classifier.qualifiedCode%)
.if (%endClassHasOperation% == false)
public void set%.FU:roleName%(%Classifier.qualifiedCode% new%.FU:Classifier.Code%) \
{\n
.if (%endNavigability%)
.if (%endContainerType%) and (%endMultiple%)
if (this.%roleName% == null || !this.%roleName%.equals(new%.FU:Classifier.Code%))
{
if (this.%roleName% != null)
{
%Classifier.qualifiedCode% old%.FU:Classifier.Code% = this.%roleName%;
this.%roleName% = null;
old%.FU:Classifier.Code%.remove%.FU:endRoleName%(this);
}
if (new%.FU:Classifier.Code% != null)
{
this.%roleName% = new%.FU:Classifier.Code%;
this.%roleName%.add%.FU:endRoleName%(this);
}
}
.elsif (%endMultiple% == false)
if (this.%roleName% == null || !this.%roleName%.equals(new%.FU:Classifier.Code%))
{
if (this.%roleName% != null)
this.%roleName%.set%.FU:endRoleName%(null);
this.%roleName% = new%.FU:Classifier.Code%;
if (this.%roleName% != null)
this.%roleName%.set%.FU:endRoleName%(this);
}
.else
this.%roleName% = new%.FU:Classifier.Code%;
.endif(\n)
.else
this.%roleName% = new%.FU:Classifier.Code%;
.endif(\n)
}
.endif(\n\n)
.endif