FollowRelation subclass: #FollowRelationAndSum
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'PSiGene-Patterns-JP'!



!FollowRelationAndSum methodsFor: 'smalltalk code templates'!

doLoopST
	"This method returns a Smalltalk-Template for a Pattern."

	^MacroText fromString: '"1:n relation."
	self {relation} connections do:
		[	:anObject|
			sum := sum + (anObject {remoteOperation}{optionalParameter})
		].'!

dontLoopST
	"This method returns a Smalltalk-Template for a Pattern."

	^MacroText fromString: '"1:1 relation."
	self {relation} instance notNil ifTrue:
	[ sum := sum + (self {relation} instance {remoteOperation}{optionalParameter}) ].'!

operationST
	"This method returns a Smalltalk-Template for a Pattern."
	"The template contains a method to get the value overall relations."

	^MacroText fromString: '{operation}{optionalParameter}
	"Computes over all relations."
	|sum|
	"init calculation"
	sum := 0.
	{loop}
	^sum'! !

To increase readability of this file, some HTML tags have been included

(click here for the original file)