Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. namespace com.ibm.daell ;
  2.  
  3. composite LineCount
  4. {
  5. type
  6. LineCount_t = rstring fileName, int32 lineCntl ;
  7. graph
  8. (stream<rstring fileName> FileFoundInDir) = DirectoryScan()
  9. {
  10. param
  11. directory : getSubmissionTimeValue("DirName") ;
  12. ignoreDotFiles : true ;
  13. sleepTime : 10.0 ;
  14. pattern : ".*\\..*" ; //This should be in regex format
  15.  
  16. }
  17.  
  18. (stream<rstring fileName> FileFoundInDir2) =DirectoryScan()
  19. {
  20. param
  21. directory : getSubmissionTimeValue("DirName2");
  22. ignoreDotFiles : true ;
  23. sleepTime : 10.0 ;
  24. pattern : ".*\\..*" ; //This should be in regex format
  25. }
  26.  
  27. (stream<rstring line, rstring fileName> Line) = FileSource(FileFoundInDir)
  28. {
  29. param
  30. format : line ;
  31. output
  32. Line : fileName = FileName() ;
  33. }
  34.  
  35.  
  36. (stream<rstring line, rstring fileName> Line2) = FileSource(FileFoundInDir2)
  37. {
  38. param
  39. format : line ;
  40. output
  41. Line2 : fileName = FileName() ;
  42. }
  43.  
  44. stream<LineCount_t> LineCount as LC = Custom(Line ;Line2)
  45. {
  46. logic
  47. state :
  48. {
  49. mutable int32 _cnt = 0 ;
  50. mutable rstring _fileName = "" ;
  51. mutable int32 _cnt2 = 0 ;
  52. mutable rstring _fileName2 = "" ;
  53. }
  54.  
  55. onTuple Line :
  56. {
  57. _cnt ++ ;
  58. _fileName = Line.fileName ;
  59. }
  60.  
  61. onPunct Line :
  62. {
  63. if(currentPunct() == Sys.WindowMarker)
  64. {
  65. mutable LineCount_t oTuple = { } ;
  66. oTuple.fileName = _fileName ;
  67. oTuple.lineCntl = _cnt ;
  68. submit(oTuple, LC) ;
  69. _cnt = 0 ;
  70. _fileName = "" ;
  71. }
  72.  
  73. }
  74. onTuple Line2 :
  75. {
  76. _cnt2 ++ ;
  77. _fileName2 = Line2.fileName ;
  78. }
  79.  
  80. onPunct Line2 :
  81. {
  82. if(currentPunct() == Sys.WindowMarker)
  83. {
  84. mutable LineCount_t oTuple = { } ;
  85. oTuple.fileName = _fileName2 ;
  86. oTuple.lineCntl = _cnt2 ;
  87. submit(oTuple, LC) ;
  88. _cnt2 = 0 ;
  89. _fileName2 = "" ;
  90. }
  91.  
  92. }
  93.  
  94. }
  95.  
  96. () as MySink1 = FileSink(LineCount)
  97. {
  98. param
  99. file : "/dev/stdout" ;
  100. flush : 1u ;
  101. }
  102.  
  103.  
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement