@@ -12,10 +12,6 @@ import com.regnosys.rosetta.rosetta.simple.Data
1212import com.regnosys.rosetta.rosetta.simple.Function
1313import com.regnosys.rosetta.rosetta.simple.Operation
1414import com.regnosys.rosetta.rosetta.simple.Segment
15- import com.regnosys.rosetta.rosetta.simple.ShortcutDeclaration
16- import com.regnosys.rosetta.rosetta.simple.Condition
17- import com.regnosys.rosetta.rosetta.RosettaFeature
18- import com.regnosys.rosetta.rosetta.RosettaTyped
1915import java.util.ArrayList
2016import java.util.Collections
2117import java.util.HashMap
@@ -287,7 +283,7 @@ class PythonFunctionGenerator {
287283 private def generateAddOperation (AssignPathRoot root , Operation operation , Function function , String expression ) {
288284 val lineSeparator = System . getProperty(" line.separator" )
289285 val attribute = root as Attribute
290- val fullPath = generateFullPath(operation. getPath(). getReversedFeatures() , root. name)
286+ val fullPath = generateFullPath(operation. getPath(). getReversedAttributes , root. name)
291287
292288 var result = " "
293289 if (attribute. typeCall. type instanceof RosettaEnumeration ) {
@@ -328,7 +324,7 @@ class PythonFunctionGenerator {
328324 var result = new StringBuilder ()
329325 result. append(" '" )
330326 while (currentPath !== null ) {
331- result. append(currentPath. getFeature (). name)
327+ result. append(currentPath. getAttribute (). name)
332328 if (currentPath. next !== null ) {
333329 result. append(" ->" )
334330 }
@@ -340,8 +336,8 @@ class PythonFunctionGenerator {
340336
341337 private def getNextPathElementName (Segment path ) {
342338 if (path !== null ) {
343- val feature = path. getFeature ()
344- return " '" + feature . name + " '"
339+ val attribute = path. getAttribute ()
340+ return " '" + attribute . name + " '"
345341 }
346342 return null
347343 }
@@ -356,34 +352,35 @@ class PythonFunctionGenerator {
356352 return ' ' ' _get_rune_object(' «feature. typeCall. type. name»' , «getNextPathElementName(path.next)», «buildObject(expression, path.next)»)' ' '
357353 }
358354 throw new IllegalArgumentException (" Cannot build object for feature " + feature. getName() + " of type " + feature. class. simpleName)
355+
359356 }
360357
361- private def String generateFullPath (Iterable<RosettaFeature > features , String root ) {
362- if (features . isEmpty) {
358+ private def String generateFullPath (Iterable<Attribute > attrs , String root ) {
359+ if (attrs . isEmpty) {
363360 return " self"
364361 }
365362
366- val attr = features . head
367- val remainingAttrs = features . tail. toList
363+ val attr = attrs . head
364+ val remainingAttrs = attrs . tail. toList
368365
369366 val nextPath = if (remainingAttrs. isEmpty) ' ' ' rune_resolve_attr(self, «root»)' ' ' else generateFullPath(
370367 remainingAttrs, root)
371368
372369 return ' ' ' rune_resolve_attr(«nextPath», ' «attr. name»' )' ' '
373370 }
374371
375- private def getReversedFeatures (Segment segment ) {
376- val features = new ArrayList<RosettaFeature > ();
372+ private def getReversedAttributes (Segment segment ) {
373+ val attributes = new ArrayList<Attribute > ();
377374 var current = segment;
378375
379376 while (current !== null ) {
380- features . add(current. getFeature ());
377+ attributes . add(current. getAttribute ());
381378 current = current. getNext();
382379 }
383380
384- Collections . reverse(features );
381+ Collections . reverse(attributes );
385382
386- return features ;
383+ return attributes ;
387384 }
388385
389386 def addImportsFromConditions (String var iable , String namespace ) {
0 commit comments