Use an iteration variable in walker

This commit is contained in:
Dan Hawkins 2021-12-21 17:26:36 +00:00
commit 0122ee498c

View file

@ -927,6 +927,7 @@ class MetaInfo extends GISJsonSerialised {
class IterationInfo {
private ArrayList<CollectedMeta> metacollection
private Map<String, CollectedMeta>() metamap
private String comment
private int level
private String gatheredpath
@ -935,6 +936,7 @@ class MetaInfo extends GISJsonSerialised {
private int maxdepth
IterationInfo(ArrayList<CollectedMeta> metacollection = new ArrayList<CollectedMeta>(),
Map<String, CollectedMeta> metamap = new Map<String, CollectedMeta>(),
String comment = '',
int level = 0,
String gatheredpath = '',
@ -942,6 +944,7 @@ class MetaInfo extends GISJsonSerialised {
boolean limiteddepth = false,
int maxdepth = 0) {
this.metacollection = metacollection
this.metamap = metamap
this.comment = comment
this.level = level
this.gatheredpath = gatheredpath
@ -990,6 +993,7 @@ class MetaInfo extends GISJsonSerialised {
def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}")
def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}")
def nextii = new IterationInfo(ii.metacollection,
ii.metamap,
ii.comment,
ii.level + 1,
nextgatheredpath,
@ -1018,6 +1022,7 @@ class MetaInfo extends GISJsonSerialised {
def childmetainfo = openchildmeta(ii, relatedmetainfo)
if (childmetainfo.imported) {
def nextii = new IterationInfo(ii.metacollection,
ii.metamap,
ii.comment,
ii.level + 1,
childmetainfo.nextgatheredpath,
@ -1031,6 +1036,7 @@ class MetaInfo extends GISJsonSerialised {
} else if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') {
def MetaInfo othermeta = relatedmetainfo.meta
def nextii = new IterationInfo(ii.metacollection,
ii.metamap,
ii.comment,
ii.level + 1,
ii.gatheredpath,
@ -1046,12 +1052,13 @@ class MetaInfo extends GISJsonSerialised {
return [ 'metacollection' : ii.metacollection, 'comment': ii.comment ]
}
def allrelatedmeta(String metapath = '') {
return walkrelated(new IterationInfo(metacollection, '', 0, '', metapath))
def allrelatedmeta(String metapath = '') {,
Map<String, CollectedMeta> metamap =
return walkrelated(new IterationInfo(new ArrayList<CollectedMeta>(), new Map<String, CollectedMeta>(), '', 0, '', metapath))
}
ArrayList<CollectedMeta> releasewalker(int maxdepth, String startpath = '', String startmetapath = '') {
def results = walkrelated(new IterationInfo(metacollection, 'meta', 0, startpath, startmetapath, true, maxdepth))
def results = walkrelated(new IterationInfo(new ArrayList<CollectedMeta>(), new Map<String, CollectedMeta>(), 'meta', 0, startpath, startmetapath, true, maxdepth))
return results.metacollection
}