pione 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +12 -1
- data/example/AbstractRule/AbstractRule.pione +40 -0
- data/example/Fib/Fib.pione +12 -5
- data/example/LucasNumber/LucasNumber.pione +1 -1
- data/example/MakePair/MakePair.pione +21 -6
- data/example/OddSelector/OddSelector.pione +17 -0
- data/example/OddSelector/data/1.i +0 -0
- data/example/OddSelector/data/10.i +0 -0
- data/example/OddSelector/data/2.i +0 -0
- data/example/OddSelector/data/3.i +0 -0
- data/example/OddSelector/data/4.i +0 -0
- data/example/OddSelector/data/5.i +0 -0
- data/example/OddSelector/data/6.i +0 -0
- data/example/OddSelector/data/7.i +0 -0
- data/example/OddSelector/data/8.i +0 -0
- data/example/OddSelector/data/9.i +0 -0
- data/example/SequentialParameter/SequentialParameter.pione +4 -0
- data/example/SieveOfEratosthenes/SieveOfEratosthenes.pione +31 -43
- data/example/SingleParticlesWithRef/SingleParticlesWithRef.pione +1 -1
- data/example/Touch/Touch.pione +3 -0
- data/lib/pione/command/pione-syntax-checker.rb +4 -4
- data/lib/pione/model/assignment.rb +6 -1
- data/lib/pione/model/basic-model.rb +92 -278
- data/lib/pione/model/binary-operator.rb +5 -1
- data/lib/pione/model/block.rb +17 -0
- data/lib/pione/model/boolean.rb +54 -22
- data/lib/pione/model/constraints.rb +34 -0
- data/lib/pione/model/data-expr.rb +184 -297
- data/lib/pione/model/feature-expr.rb +13 -4
- data/lib/pione/model/float.rb +24 -41
- data/lib/pione/model/integer.rb +75 -41
- data/lib/pione/model/keyed-sequence.rb +143 -0
- data/lib/pione/model/list.rb +12 -8
- data/lib/pione/model/message.rb +8 -4
- data/lib/pione/model/ordinal-sequence.rb +75 -0
- data/lib/pione/model/package.rb +6 -2
- data/lib/pione/model/parameters.rb +61 -9
- data/lib/pione/model/pione-method.rb +146 -0
- data/lib/pione/model/rule-expr.rb +44 -38
- data/lib/pione/model/rule-io.rb +11 -3
- data/lib/pione/model/rule.rb +105 -155
- data/lib/pione/model/sequence.rb +273 -0
- data/lib/pione/model/string.rb +75 -29
- data/lib/pione/model/ticket-expr.rb +17 -29
- data/lib/pione/model/type.rb +242 -0
- data/lib/pione/model/variable-table.rb +52 -53
- data/lib/pione/model/variable.rb +8 -4
- data/lib/pione/model.rb +34 -0
- data/lib/pione/parser/block-parser.rb +44 -20
- data/lib/pione/parser/common-parser.rb +2 -1
- data/lib/pione/parser/document-parser.rb +6 -1
- data/lib/pione/parser/expr-parser.rb +57 -11
- data/lib/pione/parser/flow-element-parser.rb +2 -2
- data/lib/pione/parser/rule-definition-parser.rb +23 -1
- data/lib/pione/patch/rinda-patch.rb +1 -5
- data/lib/pione/rule-handler/action-handler.rb +5 -5
- data/lib/pione/rule-handler/basic-handler.rb +30 -7
- data/lib/pione/rule-handler/empty-handler.rb +14 -0
- data/lib/pione/rule-handler/flow-handler.rb +132 -115
- data/lib/pione/rule-handler/root-handler.rb +6 -2
- data/lib/pione/rule-handler/update-criteria.rb +152 -0
- data/lib/pione/rule-handler.rb +14 -0
- data/lib/pione/system/identifier.rb +9 -9
- data/lib/pione/transformer/block-transformer.rb +4 -0
- data/lib/pione/transformer/expr-transformer.rb +1 -1
- data/lib/pione/transformer/flow-element-transformer.rb +4 -2
- data/lib/pione/transformer/literal-transformer.rb +14 -3
- data/lib/pione/transformer/rule-definition-transformer.rb +17 -5
- data/lib/pione/tuple-space/data-finder.rb +15 -52
- data/lib/pione/version.rb +1 -1
- data/lib/pione.rb +12 -38
- data/test/agent/spec_task-worker.rb +13 -12
- data/test/model/spec_assignment.rb +2 -2
- data/test/model/spec_binary-operator.rb +10 -10
- data/test/model/spec_block.rb +8 -8
- data/test/model/spec_boolean.rb +1 -72
- data/test/model/spec_boolean.yml +134 -0
- data/test/model/spec_data-expr.rb +50 -237
- data/test/model/spec_data-expr.yml +16 -45
- data/test/model/spec_data-expr_match.yml +45 -0
- data/test/model/spec_feature-expr.rb +2 -43
- data/test/model/spec_feature-expr.yml +0 -28
- data/test/model/spec_feature-expr_decide.yml +28 -0
- data/test/model/spec_float.rb +1 -119
- data/test/model/spec_float.yml +17 -0
- data/test/model/spec_integer.rb +1 -119
- data/test/model/spec_integer.yml +57 -0
- data/test/model/spec_keyed-sequence.rb +5 -0
- data/test/model/spec_keyed-sequence.yml +22 -0
- data/test/model/spec_message.rb +7 -7
- data/test/model/spec_parameters.rb +50 -63
- data/test/model/spec_pione-method.rb +56 -0
- data/test/model/spec_rule-expr.rb +18 -8
- data/test/model/spec_rule.rb +12 -12
- data/test/model/spec_sequence.rb +5 -0
- data/test/model/spec_sequence.yml +60 -0
- data/test/model/spec_string.rb +3 -70
- data/test/model/spec_string.yml +83 -0
- data/test/model/spec_ticket-expr.rb +4 -54
- data/test/model/spec_ticket-expr.yml +11 -0
- data/test/model/spec_variable-table.rb +41 -42
- data/test/model/spec_variable.rb +20 -22
- data/test/parser/spec_block-parser.yml +9 -0
- data/test/parser/spec_expr-parser.yml +0 -17
- data/test/parser/spec_flow-element-parser.yml +1 -1
- data/test/parser/spec_rule-definition-parser.yml +0 -4
- data/test/rule-handler/spec_update-criteria.pione +39 -0
- data/test/rule-handler/spec_update-criteria.rb +53 -0
- data/test/rule-handler/spec_update-criteria.yml +158 -0
- data/test/test-util.rb +25 -0
- data/test/transformer/spec_block-transformer.rb +7 -0
- data/test/transformer/spec_expr-transformer.rb +64 -19
- data/test/transformer/spec_flow-element-transformer.rb +11 -11
- data/test/transformer/spec_literal-transformer.rb +29 -29
- data/test/transformer/spec_rule-definition-transformer.rb +39 -21
- metadata +57 -11
- data/lib/pione/model/undefined-value.rb +0 -24
- data/lib/pione/tuple-space/update-criteria.rb +0 -97
- data/test/model/spec_list.rb +0 -26
- data/test/model/spec_rule-io.rb +0 -32
- data/test/spec_update-criteria.rb +0 -83
@@ -3,22 +3,31 @@ require_relative '../test-util'
|
|
3
3
|
describe 'Pione::Transformer::RuleDefinitionTransformer' do
|
4
4
|
transformer_spec("input_line", :input_line) do
|
5
5
|
tc("input '*.txt'") do
|
6
|
-
Naming.InputLine(DataExpr.new("*.txt"))
|
6
|
+
Naming.InputLine(DataExpr.new("*.txt").to_seq)
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
10
|
transformer_spec("output_line", :output_line) do
|
11
11
|
tc("output '*.txt'") do
|
12
|
-
Naming.OutputLine(DataExpr.new("*.txt"))
|
12
|
+
Naming.OutputLine(DataExpr.new("*.txt").to_seq)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
transformer_spec("param_line", :param_line) do
|
17
17
|
tc("param {var: 1}") do
|
18
|
-
Naming.ParamLine(
|
18
|
+
Naming.ParamLine(
|
19
|
+
Parameters.new(
|
20
|
+
{Variable.new("var") => IntegerSequence.new([PioneInteger.new(1)])}
|
21
|
+
)
|
22
|
+
)
|
19
23
|
end
|
20
24
|
tc("param {var1: 1, var2: 2}") do
|
21
|
-
Naming.ParamLine(
|
25
|
+
Naming.ParamLine(
|
26
|
+
Parameters.new(
|
27
|
+
{ Variable.new("var1") => IntegerSequence.new([PioneInteger.new(1)]),
|
28
|
+
Variable.new("var2") => IntegerSequence.new([PioneInteger.new(2)]) }
|
29
|
+
)
|
30
|
+
)
|
22
31
|
end
|
23
32
|
end
|
24
33
|
|
@@ -40,10 +49,8 @@ describe 'Pione::Transformer::RuleDefinitionTransformer' do
|
|
40
49
|
ActionRule.new(
|
41
50
|
RuleExpr.new(Package.new("main"), "Test"),
|
42
51
|
RuleCondition.new(
|
43
|
-
[ DataExpr.new('*.a') ],
|
44
|
-
[ DataExpr.new('{$INPUT[1].MATCH[1]}.b') ]
|
45
|
-
Parameters.empty,
|
46
|
-
Feature.empty
|
52
|
+
[ DataExpr.new('*.a').to_seq ],
|
53
|
+
[ DataExpr.new('{$INPUT[1].MATCH[1]}.b').to_seq ]
|
47
54
|
),
|
48
55
|
ActionBlock.new(" echo \"test\" > {$OUTPUT[1].NAME}\n")
|
49
56
|
)
|
@@ -62,9 +69,7 @@ describe 'Pione::Transformer::RuleDefinitionTransformer' do
|
|
62
69
|
RuleExpr.new(Package.new("main"), "Test"),
|
63
70
|
RuleCondition.new(
|
64
71
|
[ DataExpr.new('*.a') ],
|
65
|
-
[ DataExpr.new('{$INPUT[1].MATCH[1]}.b') ]
|
66
|
-
Parameters.empty,
|
67
|
-
Feature.empty
|
72
|
+
[ DataExpr.new('{$INPUT[1].MATCH[1]}.b') ]
|
68
73
|
),
|
69
74
|
FlowBlock.new(
|
70
75
|
CallRule.new(RuleExpr.new(Package.new("main"), "TestA")),
|
@@ -94,17 +99,20 @@ describe 'Pione::Transformer::RuleDefinitionTransformer' do
|
|
94
99
|
DataExpr.new("*.txt"),
|
95
100
|
DataExpr.new("summary.txt"))],
|
96
101
|
[DataExpr.new("summary.txt")],
|
97
|
-
Parameters.new(
|
98
|
-
|
102
|
+
params: Parameters.new(
|
103
|
+
Variable.new("ConvertCharSet") =>
|
104
|
+
BooleanSequence.new([PioneBoolean.true])
|
105
|
+
)
|
99
106
|
),
|
100
107
|
FlowBlock.new(
|
101
108
|
ConditionalBlock.new(
|
102
109
|
Variable.new("ConvertCharset"),
|
103
|
-
{ PioneBoolean.true =>
|
110
|
+
{ BooleanSequence.new([PioneBoolean.true]) =>
|
111
|
+
FlowBlock.new(
|
104
112
|
CallRule.new(Message.new(
|
105
113
|
"params",
|
106
114
|
RuleExpr.new(Package.new("main"), "NKF"),
|
107
|
-
PioneString.new("-w")
|
115
|
+
StringSequence.new([PioneString.new("-w")])
|
108
116
|
))
|
109
117
|
)}
|
110
118
|
),
|
@@ -117,6 +125,20 @@ describe 'Pione::Transformer::RuleDefinitionTransformer' do
|
|
117
125
|
)
|
118
126
|
)
|
119
127
|
end
|
128
|
+
|
129
|
+
tc(<<-STRING) do
|
130
|
+
Rule EmptyRule
|
131
|
+
input '*.a'
|
132
|
+
output '*.a'.touch
|
133
|
+
End
|
134
|
+
STRING
|
135
|
+
rule_expr = RuleExpr.new(Package.new("main"), "EmptyRule")
|
136
|
+
condition = RuleCondition.new(
|
137
|
+
[DataExpr.new("*.a")], [Message.new("touch", DataExpr.new("*.a"))]
|
138
|
+
)
|
139
|
+
EmptyRule.new(rule_expr, condition, EmptyBlock.instance)
|
140
|
+
end
|
141
|
+
|
120
142
|
end
|
121
143
|
|
122
144
|
transformer_spec("rule_definitions", :toplevel_elements) do
|
@@ -140,9 +162,7 @@ describe 'Pione::Transformer::RuleDefinitionTransformer' do
|
|
140
162
|
RuleExpr.new(Package.new("main"), "TestA"),
|
141
163
|
RuleCondition.new(
|
142
164
|
[ DataExpr.new("*.a") ],
|
143
|
-
[ DataExpr.new('{$INPUT[1].MATCH[1]}.b') ]
|
144
|
-
Parameters.empty,
|
145
|
-
Feature.empty
|
165
|
+
[ DataExpr.new('{$INPUT[1].MATCH[1]}.b') ]
|
146
166
|
),
|
147
167
|
ActionBlock.new(" cat {$INPUT[1].NAME} > {$OUTPUT[1].NAME}\n")
|
148
168
|
),
|
@@ -150,9 +170,7 @@ describe 'Pione::Transformer::RuleDefinitionTransformer' do
|
|
150
170
|
RuleExpr.new(Package.new("main"), "TestB"),
|
151
171
|
RuleCondition.new(
|
152
172
|
[ DataExpr.new("*.b") ],
|
153
|
-
[ DataExpr.new('{$INPUT[1].MATCH[1]}.c') ]
|
154
|
-
Parameters.empty,
|
155
|
-
Feature.empty
|
173
|
+
[ DataExpr.new('{$INPUT[1].MATCH[1]}.c') ]
|
156
174
|
),
|
157
175
|
ActionBlock.new(" cat {$INPUT[1].NAME} > {$OUTPUT[1].NAME}\n")
|
158
176
|
)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pione
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: parslet
|
@@ -328,6 +328,7 @@ files:
|
|
328
328
|
- demo/public/demo.js
|
329
329
|
- demo/public/index.html
|
330
330
|
- demo/public/jquery-1.8.3.min.js
|
331
|
+
- example/AbstractRule/AbstractRule.pione
|
331
332
|
- example/CountChar/CountChar.pione
|
332
333
|
- example/CountChar/misc/CountChar.rb
|
333
334
|
- example/CountChar/text/aidokushono_insho.txt
|
@@ -351,6 +352,18 @@ files:
|
|
351
352
|
- example/MakePair/data/3.i
|
352
353
|
- example/MakePair/data/4.i
|
353
354
|
- example/MakePair/data/5.i
|
355
|
+
- example/OddSelector/OddSelector.pione
|
356
|
+
- example/OddSelector/data/1.i
|
357
|
+
- example/OddSelector/data/10.i
|
358
|
+
- example/OddSelector/data/2.i
|
359
|
+
- example/OddSelector/data/3.i
|
360
|
+
- example/OddSelector/data/4.i
|
361
|
+
- example/OddSelector/data/5.i
|
362
|
+
- example/OddSelector/data/6.i
|
363
|
+
- example/OddSelector/data/7.i
|
364
|
+
- example/OddSelector/data/8.i
|
365
|
+
- example/OddSelector/data/9.i
|
366
|
+
- example/SequentialParameter/SequentialParameter.pione
|
354
367
|
- example/SequentialProcess/SequentialProcess.pione
|
355
368
|
- example/SieveOfEratosthenes/SieveOfEratosthenes.pione
|
356
369
|
- example/SingleParticlesWithRef/Makefile
|
@@ -443,6 +456,7 @@ files:
|
|
443
456
|
- example/SyntaxError/output_line_error.pione
|
444
457
|
- example/SyntaxError/param_line_error.pione
|
445
458
|
- example/SyntaxError/variable-binding-error.pione
|
459
|
+
- example/Touch/Touch.pione
|
446
460
|
- lib/pione.rb
|
447
461
|
- lib/pione/agent/basic-agent.rb
|
448
462
|
- lib/pione/agent/broker.rb
|
@@ -491,26 +505,32 @@ files:
|
|
491
505
|
- lib/pione/log/process-log.rb
|
492
506
|
- lib/pione/log/process-record.rb
|
493
507
|
- lib/pione/log/xes-log.rb
|
508
|
+
- lib/pione/model.rb
|
494
509
|
- lib/pione/model/assignment.rb
|
495
510
|
- lib/pione/model/basic-model.rb
|
496
511
|
- lib/pione/model/binary-operator.rb
|
497
512
|
- lib/pione/model/block.rb
|
498
513
|
- lib/pione/model/boolean.rb
|
499
514
|
- lib/pione/model/call-rule.rb
|
515
|
+
- lib/pione/model/constraints.rb
|
500
516
|
- lib/pione/model/data-expr.rb
|
501
517
|
- lib/pione/model/feature-expr.rb
|
502
518
|
- lib/pione/model/float.rb
|
503
519
|
- lib/pione/model/integer.rb
|
520
|
+
- lib/pione/model/keyed-sequence.rb
|
504
521
|
- lib/pione/model/list.rb
|
505
522
|
- lib/pione/model/message.rb
|
523
|
+
- lib/pione/model/ordinal-sequence.rb
|
506
524
|
- lib/pione/model/package.rb
|
507
525
|
- lib/pione/model/parameters.rb
|
526
|
+
- lib/pione/model/pione-method.rb
|
508
527
|
- lib/pione/model/rule-expr.rb
|
509
528
|
- lib/pione/model/rule-io.rb
|
510
529
|
- lib/pione/model/rule.rb
|
530
|
+
- lib/pione/model/sequence.rb
|
511
531
|
- lib/pione/model/string.rb
|
512
532
|
- lib/pione/model/ticket-expr.rb
|
513
|
-
- lib/pione/model/
|
533
|
+
- lib/pione/model/type.rb
|
514
534
|
- lib/pione/model/variable-table.rb
|
515
535
|
- lib/pione/model/variable.rb
|
516
536
|
- lib/pione/option.rb
|
@@ -544,11 +564,14 @@ files:
|
|
544
564
|
- lib/pione/relay/relay-socket.rb
|
545
565
|
- lib/pione/relay/trampoline.rb
|
546
566
|
- lib/pione/relay/transmitter-socket.rb
|
567
|
+
- lib/pione/rule-handler.rb
|
547
568
|
- lib/pione/rule-handler/action-handler.rb
|
548
569
|
- lib/pione/rule-handler/basic-handler.rb
|
570
|
+
- lib/pione/rule-handler/empty-handler.rb
|
549
571
|
- lib/pione/rule-handler/flow-handler.rb
|
550
572
|
- lib/pione/rule-handler/root-handler.rb
|
551
573
|
- lib/pione/rule-handler/system-handler.rb
|
574
|
+
- lib/pione/rule-handler/update-criteria.rb
|
552
575
|
- lib/pione/system/common.rb
|
553
576
|
- lib/pione/system/config.rb
|
554
577
|
- lib/pione/system/document.rb
|
@@ -573,7 +596,6 @@ files:
|
|
573
596
|
- lib/pione/tuple-space/tuple-space-receiver.rb
|
574
597
|
- lib/pione/tuple-space/tuple-space-server-interface.rb
|
575
598
|
- lib/pione/tuple-space/tuple-space-server.rb
|
576
|
-
- lib/pione/tuple-space/update-criteria.rb
|
577
599
|
- lib/pione/tuple/agent-tuple.rb
|
578
600
|
- lib/pione/tuple/attribute-tuple.rb
|
579
601
|
- lib/pione/tuple/base-location-tuple.rb
|
@@ -629,22 +651,32 @@ files:
|
|
629
651
|
- test/model/spec_binary-operator.rb
|
630
652
|
- test/model/spec_block.rb
|
631
653
|
- test/model/spec_boolean.rb
|
654
|
+
- test/model/spec_boolean.yml
|
632
655
|
- test/model/spec_call-rule.rb
|
633
656
|
- test/model/spec_data-expr.rb
|
634
657
|
- test/model/spec_data-expr.yml
|
658
|
+
- test/model/spec_data-expr_match.yml
|
635
659
|
- test/model/spec_feature-expr.rb
|
636
660
|
- test/model/spec_feature-expr.yml
|
661
|
+
- test/model/spec_feature-expr_decide.yml
|
637
662
|
- test/model/spec_float.rb
|
663
|
+
- test/model/spec_float.yml
|
638
664
|
- test/model/spec_integer.rb
|
639
|
-
- test/model/
|
665
|
+
- test/model/spec_integer.yml
|
666
|
+
- test/model/spec_keyed-sequence.rb
|
667
|
+
- test/model/spec_keyed-sequence.yml
|
640
668
|
- test/model/spec_message.rb
|
641
669
|
- test/model/spec_package.rb
|
642
670
|
- test/model/spec_parameters.rb
|
671
|
+
- test/model/spec_pione-method.rb
|
643
672
|
- test/model/spec_rule-expr.rb
|
644
|
-
- test/model/spec_rule-io.rb
|
645
673
|
- test/model/spec_rule.rb
|
674
|
+
- test/model/spec_sequence.rb
|
675
|
+
- test/model/spec_sequence.yml
|
646
676
|
- test/model/spec_string.rb
|
677
|
+
- test/model/spec_string.yml
|
647
678
|
- test/model/spec_ticket-expr.rb
|
679
|
+
- test/model/spec_ticket-expr.yml
|
648
680
|
- test/model/spec_variable-table.rb
|
649
681
|
- test/model/spec_variable.rb
|
650
682
|
- test/parser/spec_block-parser.rb
|
@@ -666,13 +698,15 @@ files:
|
|
666
698
|
- test/patch/spec_uri-patch.rb
|
667
699
|
- test/rule-handler/spec_action-handler.rb
|
668
700
|
- test/rule-handler/spec_flow-handler.rb
|
701
|
+
- test/rule-handler/spec_update-criteria.pione
|
702
|
+
- test/rule-handler/spec_update-criteria.rb
|
703
|
+
- test/rule-handler/spec_update-criteria.yml
|
669
704
|
- test/spec_common.rb
|
670
705
|
- test/spec_data-finder.rb
|
671
706
|
- test/spec_data-finder.yml
|
672
707
|
- test/spec_identifier.rb
|
673
708
|
- test/spec_log.rb
|
674
709
|
- test/spec_object.rb
|
675
|
-
- test/spec_update-criteria.rb
|
676
710
|
- test/system/spec_document.rb
|
677
711
|
- test/system/spec_file-cache.rb
|
678
712
|
- test/test-util.rb
|
@@ -714,7 +748,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
714
748
|
version: '0'
|
715
749
|
segments:
|
716
750
|
- 0
|
717
|
-
hash: -
|
751
|
+
hash: -3244176729533041699
|
718
752
|
requirements: []
|
719
753
|
rubyforge_project:
|
720
754
|
rubygems_version: 1.8.24
|
@@ -739,22 +773,32 @@ test_files:
|
|
739
773
|
- test/model/spec_binary-operator.rb
|
740
774
|
- test/model/spec_block.rb
|
741
775
|
- test/model/spec_boolean.rb
|
776
|
+
- test/model/spec_boolean.yml
|
742
777
|
- test/model/spec_call-rule.rb
|
743
778
|
- test/model/spec_data-expr.rb
|
744
779
|
- test/model/spec_data-expr.yml
|
780
|
+
- test/model/spec_data-expr_match.yml
|
745
781
|
- test/model/spec_feature-expr.rb
|
746
782
|
- test/model/spec_feature-expr.yml
|
783
|
+
- test/model/spec_feature-expr_decide.yml
|
747
784
|
- test/model/spec_float.rb
|
785
|
+
- test/model/spec_float.yml
|
748
786
|
- test/model/spec_integer.rb
|
749
|
-
- test/model/
|
787
|
+
- test/model/spec_integer.yml
|
788
|
+
- test/model/spec_keyed-sequence.rb
|
789
|
+
- test/model/spec_keyed-sequence.yml
|
750
790
|
- test/model/spec_message.rb
|
751
791
|
- test/model/spec_package.rb
|
752
792
|
- test/model/spec_parameters.rb
|
793
|
+
- test/model/spec_pione-method.rb
|
753
794
|
- test/model/spec_rule-expr.rb
|
754
|
-
- test/model/spec_rule-io.rb
|
755
795
|
- test/model/spec_rule.rb
|
796
|
+
- test/model/spec_sequence.rb
|
797
|
+
- test/model/spec_sequence.yml
|
756
798
|
- test/model/spec_string.rb
|
799
|
+
- test/model/spec_string.yml
|
757
800
|
- test/model/spec_ticket-expr.rb
|
801
|
+
- test/model/spec_ticket-expr.yml
|
758
802
|
- test/model/spec_variable-table.rb
|
759
803
|
- test/model/spec_variable.rb
|
760
804
|
- test/parser/spec_block-parser.rb
|
@@ -776,13 +820,15 @@ test_files:
|
|
776
820
|
- test/patch/spec_uri-patch.rb
|
777
821
|
- test/rule-handler/spec_action-handler.rb
|
778
822
|
- test/rule-handler/spec_flow-handler.rb
|
823
|
+
- test/rule-handler/spec_update-criteria.pione
|
824
|
+
- test/rule-handler/spec_update-criteria.rb
|
825
|
+
- test/rule-handler/spec_update-criteria.yml
|
779
826
|
- test/spec_common.rb
|
780
827
|
- test/spec_data-finder.rb
|
781
828
|
- test/spec_data-finder.yml
|
782
829
|
- test/spec_identifier.rb
|
783
830
|
- test/spec_log.rb
|
784
831
|
- test/spec_object.rb
|
785
|
-
- test/spec_update-criteria.rb
|
786
832
|
- test/system/spec_document.rb
|
787
833
|
- test/system/spec_file-cache.rb
|
788
834
|
- test/test-util.rb
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module Pione
|
2
|
-
module Model
|
3
|
-
class UndefinedValue < BasicModel
|
4
|
-
set_pione_model_type TypeUndefinedValue
|
5
|
-
|
6
|
-
def ==(other)
|
7
|
-
return other.kind_of?(UndefinedValue)
|
8
|
-
end
|
9
|
-
|
10
|
-
alias :eql? :"=="
|
11
|
-
|
12
|
-
def hash
|
13
|
-
0
|
14
|
-
end
|
15
|
-
|
16
|
-
#
|
17
|
-
# pione model method
|
18
|
-
#
|
19
|
-
define_pione_method("as_string", [], TypeString) do |rec|
|
20
|
-
PioneString.new("undefined")
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,97 +0,0 @@
|
|
1
|
-
# UpdateCriteria repesents rule application criteria.
|
2
|
-
module Pione::UpdateCriteria
|
3
|
-
class << self
|
4
|
-
# Return true if we need to update because of no output rule.
|
5
|
-
# @param [Rule] rule
|
6
|
-
# rule
|
7
|
-
# @param [Tuple::Data] inputs
|
8
|
-
# input tuples
|
9
|
-
# @param [Tuple::Data] outputs
|
10
|
-
# output tuples
|
11
|
-
# @param [VariableTable] vtable
|
12
|
-
# variable table
|
13
|
-
# @return [Boolean]
|
14
|
-
# true if outputs are empty
|
15
|
-
def no_output_rules?(rule, inputs, outputs, vtable)
|
16
|
-
rule.outputs.empty?
|
17
|
-
end
|
18
|
-
|
19
|
-
# Return true if we need to update because of lacking some ouputs.
|
20
|
-
# @param [Rule] rule
|
21
|
-
# rule
|
22
|
-
# @param [Tuple::Data] inputs
|
23
|
-
# input tuples
|
24
|
-
# @param [Tuple::Data] outputs
|
25
|
-
# output tuples
|
26
|
-
# @param [VariableTable] vtable
|
27
|
-
# variable table
|
28
|
-
# @return [Boolean]
|
29
|
-
# true if some outputs lack
|
30
|
-
def not_exist_output?(rule, inputs, outputs, vtable)
|
31
|
-
return true if outputs.empty?
|
32
|
-
result = false
|
33
|
-
rule.outputs.each_with_index do |data_expr, i|
|
34
|
-
data_expr = data_expr.eval(vtable)
|
35
|
-
case data_expr.modifier
|
36
|
-
when :all
|
37
|
-
if outputs[i].select{|data| data_expr.match(data.name)}.empty?
|
38
|
-
result = true
|
39
|
-
end
|
40
|
-
when :each
|
41
|
-
unless data_expr.match(outputs[i].name)
|
42
|
-
result = true
|
43
|
-
end
|
44
|
-
end
|
45
|
-
break if result
|
46
|
-
end
|
47
|
-
return result
|
48
|
-
end
|
49
|
-
|
50
|
-
# Return true if we need to update because of newer inputs.
|
51
|
-
# @param [Rule] rule
|
52
|
-
# rule
|
53
|
-
# @param [Tuple::Data] inputs
|
54
|
-
# input tuples
|
55
|
-
# @param [Tuple::Data] outputs
|
56
|
-
# output tuples
|
57
|
-
# @param [VariableTable] vtable
|
58
|
-
# variable table
|
59
|
-
# @return [Boolean]
|
60
|
-
# true if inputs are newer than outputs
|
61
|
-
def exist_newer_input?(rule, inputs, outputs, vtable)
|
62
|
-
# get output oldest time
|
63
|
-
output_oldest_time = outputs.flatten.select{|output| output.update_criteria == :care}.map{|output| output.time}.sort.last
|
64
|
-
|
65
|
-
# get input last time
|
66
|
-
input_last_time = inputs.flatten.map{|input| input.time}.sort.last
|
67
|
-
|
68
|
-
# criteria
|
69
|
-
return false unless output_oldest_time
|
70
|
-
return false unless input_last_time
|
71
|
-
return output_oldest_time < input_last_time
|
72
|
-
end
|
73
|
-
|
74
|
-
# Return true if we need to update.
|
75
|
-
#
|
76
|
-
# @param [Rule] rule
|
77
|
-
# rule
|
78
|
-
# @param [Tuple::DataTuple] inputs
|
79
|
-
# input tuples
|
80
|
-
# @param [Tuple::DataTuple] outputs
|
81
|
-
# output tuples
|
82
|
-
# @param [VariableTable] vtable
|
83
|
-
# variable table
|
84
|
-
# @return [Boolean]
|
85
|
-
# true if inputs are newer than outputs
|
86
|
-
def satisfy?(rule, inputs, outputs, vtable)
|
87
|
-
CRITERIA.any?{|name| self.send(name, rule, inputs, outputs, vtable)}
|
88
|
-
end
|
89
|
-
|
90
|
-
# PIONE data update criteria
|
91
|
-
CRITERIA = [
|
92
|
-
:no_output_rules?,
|
93
|
-
:not_exist_output?,
|
94
|
-
:exist_newer_input?
|
95
|
-
]
|
96
|
-
end
|
97
|
-
end
|
data/test/model/spec_list.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require_relative '../test-util'
|
2
|
-
|
3
|
-
describe 'Model::List' do
|
4
|
-
it 'should be equal' do
|
5
|
-
x1 = PioneList.new
|
6
|
-
x2 = PioneList.new
|
7
|
-
x1.should.be.equal x2
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'should be equal with elements' do
|
11
|
-
x1 = PioneList.new(PioneString.new("abc"), PioneString.new("def"))
|
12
|
-
x2 = PioneList.new(PioneString.new("abc"), PioneString.new("def"))
|
13
|
-
x1.should.be.equal x2
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'should not be equal' do
|
17
|
-
x1 = PioneList.new(PioneString.new("abc"))
|
18
|
-
x2 = PioneList.new(PioneString.new("abc"), PioneString.new("def"))
|
19
|
-
x1.should.not.be.equal x2
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'should have type [string]' do
|
23
|
-
list = PioneList.new(PioneString.new("abc"))
|
24
|
-
list.pione_model_type.should == TypeList.new(TypeString)
|
25
|
-
end
|
26
|
-
end
|
data/test/model/spec_rule-io.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require_relative '../test-util'
|
2
|
-
|
3
|
-
describe 'Model::RuleIOElement' do
|
4
|
-
it 'should have name as a pione string' do
|
5
|
-
RuleIOElement.new("a.txt").name.should.kind_of?(PioneString)
|
6
|
-
end
|
7
|
-
|
8
|
-
it 'should have uri as a pione string' do
|
9
|
-
elt = RuleIOElement.new("a.txt")
|
10
|
-
elt.uri = "local:./test/a.txt"
|
11
|
-
elt.uri.should.kind_of?(PioneString)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe 'Model::RuleIOList' do
|
16
|
-
it 'should add elements' do
|
17
|
-
list = RuleIOList.new
|
18
|
-
list.add(RuleIOElement.new("a.txt"))
|
19
|
-
.add(RuleIOElement.new("b.txt"))
|
20
|
-
.add(RuleIOElement.new("c.txt"))
|
21
|
-
.elements.size.should == 3
|
22
|
-
list.elements.size.should == 0
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should add elements destructively' do
|
26
|
-
list = RuleIOList.new
|
27
|
-
list.add! RuleIOElement.new("a.txt")
|
28
|
-
list.add! RuleIOElement.new("b.txt")
|
29
|
-
list.add! RuleIOElement.new("c.txt")
|
30
|
-
list.elements.size.should == 3
|
31
|
-
end
|
32
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
require_relative 'test-util'
|
2
|
-
|
3
|
-
data = DataExpr.new('*')
|
4
|
-
|
5
|
-
document = Document.parse(<<DOCUMENT)
|
6
|
-
Rule NoOutputsRule
|
7
|
-
input '*'
|
8
|
-
Action---
|
9
|
-
|
10
|
-
--End
|
11
|
-
|
12
|
-
Rule OutputsRule
|
13
|
-
input '*.a'
|
14
|
-
output '*.b'
|
15
|
-
Action
|
16
|
-
cat {$INPUT[1]} > {$OUTPUT[1]}
|
17
|
-
End
|
18
|
-
DOCUMENT
|
19
|
-
$no_outputs_rule = document["&main:NoOutputsRule"]
|
20
|
-
$outputs_rule = document["&main:OutputsRule"]
|
21
|
-
|
22
|
-
|
23
|
-
time1 = Time.now
|
24
|
-
time2 = Time.now
|
25
|
-
time3 = Time.now
|
26
|
-
tuple1 = Tuple[:data].new('test', '1.a', nil, time1)
|
27
|
-
tuple2 = Tuple[:data].new('test', '2.a', nil, time2)
|
28
|
-
tuple3 = Tuple[:data].new('test', '3.b', nil, time2)
|
29
|
-
|
30
|
-
UC = UpdateCriteria
|
31
|
-
|
32
|
-
describe 'UpdateCriteria' do
|
33
|
-
|
34
|
-
# no output rules
|
35
|
-
describe 'criteria: no output rules' do
|
36
|
-
it 'should be updatable' do
|
37
|
-
inputs = [tuple1, tuple2]
|
38
|
-
outputs = [tuple3]
|
39
|
-
|
40
|
-
UC.no_output_rules?(
|
41
|
-
$no_outputs_rule,
|
42
|
-
inputs,
|
43
|
-
outputs,
|
44
|
-
VariableTable.new
|
45
|
-
).should.true
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'should not be updatable' do
|
49
|
-
inputs = [tuple1, tuple2]
|
50
|
-
outputs = [tuple3]
|
51
|
-
UC.no_output_rules?(
|
52
|
-
$outputs_rule,
|
53
|
-
inputs,
|
54
|
-
outputs,
|
55
|
-
VariableTable.new
|
56
|
-
).should.false
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe 'criteria: not_exist_output' do
|
61
|
-
it 'should be updatable' do
|
62
|
-
inputs = [tuple1, tuple2]
|
63
|
-
outputs = []
|
64
|
-
UC.not_exist_output?(
|
65
|
-
$outputs_rule,
|
66
|
-
inputs,
|
67
|
-
outputs,
|
68
|
-
VariableTable.new
|
69
|
-
).should.true
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'should be not updatable' do
|
73
|
-
inputs = [tuple1]
|
74
|
-
outputs = [tuple3]
|
75
|
-
UC.not_exist_output?(
|
76
|
-
$outputs_rule,
|
77
|
-
inputs,
|
78
|
-
outputs,
|
79
|
-
VariableTable.new
|
80
|
-
).should.false
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|