MOCKSTACKS
EN
Questions And Answers

More Tutorials









Swift Concurrent Mapper


The concurrent_mapper is almost the same as the simple mapper, except that it is used to map an output file, and the filename generated will contain an extract sequence that is unique. This mapper is the default mapper for variables when no mapper is specified

Parameter Meaning
location A directory that the files are located.
prefix The prefix of the files
suffix The suffix of the files, for instance: ".txt" pattern A UNIX glob style pattern, for instance: "*foo*" would match all file names that contain foo. When this mapper is used to specify output filenames, pattern is ignored.

Example:


file f1;
file f2 <concurrent_mapper;prefix="foo", suffix=".txt">;

The above example would use concurrent mapper for f1 and f2, and generate f2 filename with prefix "foo" and extension ".txt"

Filesystem Mapper


The filesys_mapper is similar to the simple mapper, but maps a file or a list of files to an array. Each of the filename is mapped as an element in the array. The order of files in the resulting array is not defined.

TODO: note on difference between location as a relative vs absolute path w.r.t. staging to remote location - as mihael said: It’s because you specify that location in the mapper. Try location="." instead of location="/sandbox/. . . "

parameter meaning
location The directory where the files are located.
prefix The prefix of the files
suffix The suffix of the files, for instance: ".txt" pattern A UNIX glob style pattern, for instance: "*foo*" would match all file names that contain foo

Example:


file texts[] <filesys_mapper;prefix="foo", suffix=".txt">;

The above example would map all filenames that start with "foo" and have an extension ".txt" into the array texts. For example, if the specified directory contains files: foo1.txt, footest.txt, foo__1.txt, then the mapping might be:


Swift variable filename
texts[0] footest.txt
texts[1] foo1.txt
texts[2] foo__1.txt

Conclusion

In this page (written and validated by ) you learned about Swift Concurrent Mapper . What's Next? If you are interested in completing Swift tutorial, your next topic will be learning about: Swift Fixed Array Mapper.



Incorrect info or code snippet? We take very seriously the accuracy of the information provided on our website. We also make sure to test all snippets and examples provided for each section. If you find any incorrect information, please send us an email about the issue: mockstacks@gmail.com.


Share On:


Mockstacks was launched to help beginners learn programming languages; the site is optimized with no Ads as, Ads might slow down the performance. We also don't track any personal information; we also don't collect any kind of data unless the user provided us a corrected information. Almost all examples have been tested. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. By using Mockstacks.com, you agree to have read and accepted our terms of use, cookies and privacy policy.