• R/O
  • HTTP
  • SSH
  • HTTPS

tutorial: Commit

This repository is for tutorials of Eos.


Commit MetaInfo

Revisiona0ad6c5672d91f969dde6984ffb4449ea2f38cdf (tree)
Time2014-11-05 17:30:27
Authorkinoshita-eos <kinoshita@yasu...>
Commiterkinoshita-eos

Log Message

Add: tutorial PIONE-PNML for multiple input and output
new file: SampleCode/PIONE-PNML/Basic3/TextSwapSed.md
new file: SampleCode/PIONE-PNML/Basic3/TextSwapSed.pnml
new file: SampleCode/PIONE-PNML/Basic3/TextSwapSedInput/Input1.txt
new file: SampleCode/PIONE-PNML/Basic3/TextSwapSedInput/Input2.txt
new file: SampleCode/PIONE-PNML/Basic3/TextSwapSedInput/line1.swap
new file: SampleCode/PIONE-PNML/Basic3/TextSwapSedInput/line2.swap
new file: SampleCode/PIONE-PNML/Basic3/TextSwapSedInput/ref1.sed
new file: SampleCode/PIONE-PNML/Basic3/TextSwapSedInput/ref2.sed

Change Summary

Incremental Difference

--- /dev/null
+++ b/SampleCode/PIONE-PNML/Basic3/TextSwapSed.md
@@ -0,0 +1,45 @@
1+# TextSwapSed.pione
2+
3+## TextSwap
4+
5+```
6+cp {$I[1]} intmp;
7+while read line ; \
8+do \
9+ i1=$(echo $line | awk '{printf("%d", $1)}'); \
10+ i2=$(echo $line | awk '{printf("%d", $2)}'); \
11+ lnum=$(wc -l intmp | awk '{printf("%d", $1)}'); \
12+ c1=$(expr $lnum - $i2); \
13+ c2=$(expr $i2 - $i1); \
14+ top=$( head -$i1 intmp ); \
15+ middle=$( head -$i2 intmp | tail -$c2 ); \
16+ bottom=$( tail -$c1 intmp ); \
17+ t1=$(expr $i1 - 1); \
18+ m1=$(expr $c2 - 1); \
19+ top1=$( echo "$top" | head -$t1 ); \
20+ str1=$( echo "$top" | tail -1 ); \
21+ middle1=$( echo "$middle" | head -$m1 ); \
22+ str2=$( echo "$middle" | tail -1 ); \
23+ echo "$top1" > outtmp; \
24+ echo "$str2" >> outtmp; \
25+ echo "$middle1" >> outtmp; \
26+ echo "$str1" >> outtmp; \
27+ echo "$bottom" >> outtmp; \
28+ cat outtmp | sed '/^$/d' > intmp; \
29+done < {$I[2]};
30+mv intmp {$O[1]};
31+```
32+
33+## TextSed
34+
35+```
36+cp {$I[1]} intmp;
37+while read line ; \
38+do \
39+ str1=$(echo $line | awk '{printf("%s", $1)}'); \
40+ str2=$(echo $line | awk '{printf("%s", $2)}'); \
41+ sed -e "s/$str1/$str2/g" intmp > outtmp; \
42+ cat outtmp | sed '/^$/d' > intmp; \
43+done < {$I[2]};
44+mv intmp {$O[1]};
45+```
--- /dev/null
+++ b/SampleCode/PIONE-PNML/Basic3/TextSwapSed.pnml
@@ -0,0 +1,440 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<!--PLEASE DO NOT EDIT THIS FILE
3+Created with Workflow PetriNet Designer Version 3.2.0 (woped.org)-->
4+<pnml>
5+ <net type="http://www.informatik.hu-berlin.de/top/pntd/ptNetb" id="noID">
6+ <place id="p1">
7+ <name>
8+ <text>>'*.sdtxt'</text>
9+ <graphics>
10+ <offset x="470" y="190"/>
11+ </graphics>
12+ </name>
13+ <graphics>
14+ <position x="470" y="150"/>
15+ <dimension x="40" y="40"/>
16+ </graphics>
17+ </place>
18+ <place id="p2">
19+ <name>
20+ <text>&lt;'*.txt'.all</text>
21+ <graphics>
22+ <offset x="10" y="90"/>
23+ </graphics>
24+ </name>
25+ <graphics>
26+ <position x="20" y="110"/>
27+ <dimension x="40" y="40"/>
28+ </graphics>
29+ </place>
30+ <place id="p3">
31+ <name>
32+ <text>&lt;'*.swap'.all</text>
33+ <graphics>
34+ <offset x="10" y="10"/>
35+ </graphics>
36+ </name>
37+ <graphics>
38+ <position x="20" y="30"/>
39+ <dimension x="40" y="40"/>
40+ </graphics>
41+ </place>
42+ <place id="p4">
43+ <name>
44+ <text>&lt;'*.sed'.all</text>
45+ <graphics>
46+ <offset x="10" y="160"/>
47+ </graphics>
48+ </name>
49+ <graphics>
50+ <position x="20" y="180"/>
51+ <dimension x="40" y="40"/>
52+ </graphics>
53+ </place>
54+ <place id="p5">
55+ <name>
56+ <text>'*.swap'</text>
57+ <graphics>
58+ <offset x="130" y="70"/>
59+ </graphics>
60+ </name>
61+ <graphics>
62+ <position x="130" y="30"/>
63+ <dimension x="40" y="40"/>
64+ </graphics>
65+ </place>
66+ <place id="p6">
67+ <name>
68+ <text>'*.sed'</text>
69+ <graphics>
70+ <offset x="130" y="220"/>
71+ </graphics>
72+ </name>
73+ <graphics>
74+ <position x="130" y="180"/>
75+ <dimension x="40" y="40"/>
76+ </graphics>
77+ </place>
78+ <place id="p7">
79+ <name>
80+ <text>>'*.swtxt'</text>
81+ <graphics>
82+ <offset x="470" y="100"/>
83+ </graphics>
84+ </name>
85+ <graphics>
86+ <position x="470" y="60"/>
87+ <dimension x="40" y="40"/>
88+ </graphics>
89+ </place>
90+ <place id="p8">
91+ <name>
92+ <text>'*.txt'</text>
93+ <graphics>
94+ <offset x="130" y="150"/>
95+ </graphics>
96+ </name>
97+ <graphics>
98+ <position x="130" y="110"/>
99+ <dimension x="40" y="40"/>
100+ </graphics>
101+ </place>
102+ <place id="p9">
103+ <name>
104+ <text>'{$I[1][1]}-{$I[2][1]}.swtxt'</text>
105+ <graphics>
106+ <offset x="270" y="100"/>
107+ </graphics>
108+ </name>
109+ <graphics>
110+ <position x="320" y="60"/>
111+ <dimension x="40" y="40"/>
112+ </graphics>
113+ </place>
114+ <place id="p10">
115+ <name>
116+ <text>'{$I[1][1]}-{$I[2][1]}.sdtxt'</text>
117+ <graphics>
118+ <offset x="270" y="190"/>
119+ </graphics>
120+ </name>
121+ <graphics>
122+ <position x="330" y="150"/>
123+ <dimension x="40" y="40"/>
124+ </graphics>
125+ </place>
126+ <transition id="t4">
127+ <name>
128+ <text>TextSwap</text>
129+ <graphics>
130+ <offset x="210" y="100"/>
131+ </graphics>
132+ </name>
133+ <graphics>
134+ <position x="210" y="60"/>
135+ <dimension x="40" y="40"/>
136+ </graphics>
137+ <toolspecific tool="WoPeD" version="1.0">
138+ <time>0</time>
139+ <timeUnit>1</timeUnit>
140+ <orientation>1</orientation>
141+ </toolspecific>
142+ </transition>
143+ <transition id="t5">
144+ <name>
145+ <text/>
146+ <graphics>
147+ <offset x="410" y="100"/>
148+ </graphics>
149+ </name>
150+ <graphics>
151+ <position x="410" y="60"/>
152+ <dimension x="40" y="40"/>
153+ </graphics>
154+ <toolspecific tool="WoPeD" version="1.0">
155+ <time>0</time>
156+ <timeUnit>1</timeUnit>
157+ <orientation>1</orientation>
158+ </toolspecific>
159+ </transition>
160+ <transition id="t6">
161+ <name>
162+ <text>TextSed</text>
163+ <graphics>
164+ <offset x="210" y="190"/>
165+ </graphics>
166+ </name>
167+ <graphics>
168+ <position x="210" y="150"/>
169+ <dimension x="40" y="40"/>
170+ </graphics>
171+ <toolspecific tool="WoPeD" version="1.0">
172+ <time>0</time>
173+ <timeUnit>1</timeUnit>
174+ <orientation>1</orientation>
175+ </toolspecific>
176+ </transition>
177+ <transition id="t7">
178+ <name>
179+ <text/>
180+ <graphics>
181+ <offset x="410" y="190"/>
182+ </graphics>
183+ </name>
184+ <graphics>
185+ <position x="410" y="150"/>
186+ <dimension x="40" y="40"/>
187+ </graphics>
188+ <toolspecific tool="WoPeD" version="1.0">
189+ <time>0</time>
190+ <timeUnit>1</timeUnit>
191+ <orientation>1</orientation>
192+ </toolspecific>
193+ </transition>
194+ <transition id="t1">
195+ <name>
196+ <text/>
197+ <graphics>
198+ <offset x="70" y="70"/>
199+ </graphics>
200+ </name>
201+ <graphics>
202+ <position x="70" y="30"/>
203+ <dimension x="40" y="40"/>
204+ </graphics>
205+ <toolspecific tool="WoPeD" version="1.0">
206+ <time>0</time>
207+ <timeUnit>1</timeUnit>
208+ <orientation>1</orientation>
209+ </toolspecific>
210+ </transition>
211+ <transition id="t2">
212+ <name>
213+ <text/>
214+ <graphics>
215+ <offset x="70" y="150"/>
216+ </graphics>
217+ </name>
218+ <graphics>
219+ <position x="70" y="110"/>
220+ <dimension x="40" y="40"/>
221+ </graphics>
222+ <toolspecific tool="WoPeD" version="1.0">
223+ <time>0</time>
224+ <timeUnit>1</timeUnit>
225+ <orientation>1</orientation>
226+ </toolspecific>
227+ </transition>
228+ <transition id="t3">
229+ <name>
230+ <text/>
231+ <graphics>
232+ <offset x="70" y="220"/>
233+ </graphics>
234+ </name>
235+ <graphics>
236+ <position x="70" y="180"/>
237+ <dimension x="40" y="40"/>
238+ </graphics>
239+ <toolspecific tool="WoPeD" version="1.0">
240+ <time>0</time>
241+ <timeUnit>1</timeUnit>
242+ <orientation>1</orientation>
243+ </toolspecific>
244+ </transition>
245+ <arc id="a11" source="t5" target="p7">
246+ <inscription>
247+ <text>1</text>
248+ </inscription>
249+ <graphics/>
250+ <toolspecific tool="WoPeD" version="1.0">
251+ <probability>1.0</probability>
252+ <displayProbabilityOn>false</displayProbabilityOn>
253+ <displayProbabilityPosition x="500.0" y="0.0"/>
254+ </toolspecific>
255+ </arc>
256+ <arc id="a10" source="p9" target="t5">
257+ <inscription>
258+ <text>1</text>
259+ </inscription>
260+ <graphics/>
261+ <toolspecific tool="WoPeD" version="1.0">
262+ <probability>1.0</probability>
263+ <displayProbabilityOn>false</displayProbabilityOn>
264+ <displayProbabilityPosition x="500.0" y="0.0"/>
265+ </toolspecific>
266+ </arc>
267+ <arc id="a13" source="p8" target="t6">
268+ <inscription>
269+ <text>1</text>
270+ </inscription>
271+ <graphics/>
272+ <toolspecific tool="WoPeD" version="1.0">
273+ <probability>1.0</probability>
274+ <displayProbabilityOn>false</displayProbabilityOn>
275+ <displayProbabilityPosition x="500.0" y="0.0"/>
276+ </toolspecific>
277+ </arc>
278+ <arc id="a12" source="p6" target="t6">
279+ <inscription>
280+ <text>1</text>
281+ </inscription>
282+ <graphics/>
283+ <toolspecific tool="WoPeD" version="1.0">
284+ <probability>1.0</probability>
285+ <displayProbabilityOn>false</displayProbabilityOn>
286+ <displayProbabilityPosition x="500.0" y="0.0"/>
287+ </toolspecific>
288+ </arc>
289+ <arc id="a15" source="p10" target="t7">
290+ <inscription>
291+ <text>1</text>
292+ </inscription>
293+ <graphics/>
294+ <toolspecific tool="WoPeD" version="1.0">
295+ <probability>1.0</probability>
296+ <displayProbabilityOn>false</displayProbabilityOn>
297+ <displayProbabilityPosition x="500.0" y="0.0"/>
298+ </toolspecific>
299+ </arc>
300+ <arc id="a14" source="t6" target="p10">
301+ <inscription>
302+ <text>1</text>
303+ </inscription>
304+ <graphics/>
305+ <toolspecific tool="WoPeD" version="1.0">
306+ <probability>1.0</probability>
307+ <displayProbabilityOn>false</displayProbabilityOn>
308+ <displayProbabilityPosition x="500.0" y="0.0"/>
309+ </toolspecific>
310+ </arc>
311+ <arc id="a17" source="t2" target="p8">
312+ <inscription>
313+ <text>1</text>
314+ </inscription>
315+ <graphics/>
316+ <toolspecific tool="WoPeD" version="1.0">
317+ <probability>1.0</probability>
318+ <displayProbabilityOn>false</displayProbabilityOn>
319+ <displayProbabilityPosition x="500.0" y="0.0"/>
320+ </toolspecific>
321+ </arc>
322+ <arc id="a16" source="t7" target="p1">
323+ <inscription>
324+ <text>1</text>
325+ </inscription>
326+ <graphics>
327+ <position x="468" y="171"/>
328+ </graphics>
329+ <toolspecific tool="WoPeD" version="1.0">
330+ <probability>1.0</probability>
331+ <displayProbabilityOn>false</displayProbabilityOn>
332+ <displayProbabilityPosition x="500.0" y="0.0"/>
333+ </toolspecific>
334+ </arc>
335+ <arc id="a19" source="t3" target="p6">
336+ <inscription>
337+ <text>1</text>
338+ </inscription>
339+ <graphics/>
340+ <toolspecific tool="WoPeD" version="1.0">
341+ <probability>1.0</probability>
342+ <displayProbabilityOn>false</displayProbabilityOn>
343+ <displayProbabilityPosition x="500.0" y="0.0"/>
344+ </toolspecific>
345+ </arc>
346+ <arc id="a1" source="p3" target="t1">
347+ <inscription>
348+ <text>1</text>
349+ </inscription>
350+ <graphics/>
351+ <toolspecific tool="WoPeD" version="1.0">
352+ <probability>1.0</probability>
353+ <displayProbabilityOn>false</displayProbabilityOn>
354+ <displayProbabilityPosition x="500.0" y="0.0"/>
355+ </toolspecific>
356+ </arc>
357+ <arc id="a2" source="t1" target="p5">
358+ <inscription>
359+ <text>1</text>
360+ </inscription>
361+ <graphics/>
362+ <toolspecific tool="WoPeD" version="1.0">
363+ <probability>1.0</probability>
364+ <displayProbabilityOn>false</displayProbabilityOn>
365+ <displayProbabilityPosition x="500.0" y="0.0"/>
366+ </toolspecific>
367+ </arc>
368+ <arc id="a3" source="p2" target="t2">
369+ <inscription>
370+ <text>1</text>
371+ </inscription>
372+ <graphics/>
373+ <toolspecific tool="WoPeD" version="1.0">
374+ <probability>1.0</probability>
375+ <displayProbabilityOn>false</displayProbabilityOn>
376+ <displayProbabilityPosition x="500.0" y="0.0"/>
377+ </toolspecific>
378+ </arc>
379+ <arc id="a5" source="p4" target="t3">
380+ <inscription>
381+ <text>1</text>
382+ </inscription>
383+ <graphics/>
384+ <toolspecific tool="WoPeD" version="1.0">
385+ <probability>1.0</probability>
386+ <displayProbabilityOn>false</displayProbabilityOn>
387+ <displayProbabilityPosition x="500.0" y="0.0"/>
388+ </toolspecific>
389+ </arc>
390+ <arc id="a7" source="p8" target="t4">
391+ <inscription>
392+ <text>1</text>
393+ </inscription>
394+ <graphics/>
395+ <toolspecific tool="WoPeD" version="1.0">
396+ <probability>1.0</probability>
397+ <displayProbabilityOn>false</displayProbabilityOn>
398+ <displayProbabilityPosition x="500.0" y="0.0"/>
399+ </toolspecific>
400+ </arc>
401+ <arc id="a8" source="p5" target="t4">
402+ <inscription>
403+ <text>1</text>
404+ </inscription>
405+ <graphics/>
406+ <toolspecific tool="WoPeD" version="1.0">
407+ <probability>1.0</probability>
408+ <displayProbabilityOn>false</displayProbabilityOn>
409+ <displayProbabilityPosition x="500.0" y="0.0"/>
410+ </toolspecific>
411+ </arc>
412+ <arc id="a9" source="t4" target="p9">
413+ <inscription>
414+ <text>1</text>
415+ </inscription>
416+ <graphics/>
417+ <toolspecific tool="WoPeD" version="1.0">
418+ <probability>1.0</probability>
419+ <displayProbabilityOn>false</displayProbabilityOn>
420+ <displayProbabilityPosition x="500.0" y="0.0"/>
421+ </toolspecific>
422+ </arc>
423+ <toolspecific tool="WoPeD" version="1.0">
424+ <bounds>
425+ <position x="11" y="33"/>
426+ <dimension x="755" y="474"/>
427+ </bounds>
428+ <scale>100</scale>
429+ <treeWidthRight>570</treeWidthRight>
430+ <overviewPanelVisible>true</overviewPanelVisible>
431+ <treeHeightOverview>100</treeHeightOverview>
432+ <treePanelVisible>true</treePanelVisible>
433+ <verticalLayout>false</verticalLayout>
434+ <resources/>
435+ <simulations/>
436+ <partnerLinks/>
437+ <variables/>
438+ </toolspecific>
439+ </net>
440+</pnml>
\ No newline at end of file
--- /dev/null
+++ b/SampleCode/PIONE-PNML/Basic3/TextSwapSedInput/Input1.txt
@@ -0,0 +1,8 @@
1+aaa
2+aab
3+aba
4+abb
5+baa
6+bab
7+bba
8+bbb
--- /dev/null
+++ b/SampleCode/PIONE-PNML/Basic3/TextSwapSedInput/Input2.txt
@@ -0,0 +1,6 @@
1+abc
2+acb
3+bac
4+bca
5+cab
6+cba
--- /dev/null
+++ b/SampleCode/PIONE-PNML/Basic3/TextSwapSedInput/line1.swap
@@ -0,0 +1,3 @@
1+1 3
2+4 5
3+1 6
--- /dev/null
+++ b/SampleCode/PIONE-PNML/Basic3/TextSwapSedInput/line2.swap
@@ -0,0 +1,5 @@
1+1 2
2+1 3
3+1 4
4+1 5
5+1 6
--- /dev/null
+++ b/SampleCode/PIONE-PNML/Basic3/TextSwapSedInput/ref1.sed
@@ -0,0 +1,3 @@
1+a c
2+bc bd
3+dc DC
--- /dev/null
+++ b/SampleCode/PIONE-PNML/Basic3/TextSwapSedInput/ref2.sed
@@ -0,0 +1,3 @@
1+abc ddd
2+aaa eee
3+bc XX
Show on old repository browser