pione 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/History.txt +11 -0
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/bin/pione-log +5 -0
- data/example/CountChar/CountChar.pione +1 -1
- data/example/SieveOfEratosthenes/SieveOfEratosthenes.pione +39 -38
- data/lib/pione.rb +14 -35
- data/lib/pione/agent/input-generator.rb +38 -40
- data/lib/pione/agent/logger.rb +52 -19
- data/lib/pione/agent/rule-provider.rb +5 -8
- data/lib/pione/agent/task-worker.rb +25 -32
- data/lib/pione/agent/tuple-space-client.rb +22 -14
- data/lib/pione/command.rb +21 -0
- data/lib/pione/command/basic-command.rb +267 -84
- data/lib/pione/command/child-process.rb +21 -18
- data/lib/pione/command/daemon-process.rb +9 -8
- data/lib/pione/command/front-owner-command.rb +8 -25
- data/lib/pione/command/pione-broker.rb +27 -24
- data/lib/pione/command/pione-clean.rb +6 -6
- data/lib/pione/command/pione-client.rb +143 -128
- data/lib/pione/command/pione-log.rb +61 -0
- data/lib/pione/command/pione-relay-account-db.rb +40 -38
- data/lib/pione/command/pione-relay-client-db.rb +38 -42
- data/lib/pione/command/pione-relay.rb +19 -20
- data/lib/pione/command/pione-syntax-checker.rb +70 -45
- data/lib/pione/command/pione-task-worker.rb +56 -66
- data/lib/pione/command/pione-tuple-space-provider.rb +36 -45
- data/lib/pione/command/pione-tuple-space-receiver.rb +34 -32
- data/lib/pione/command/pione-tuple-space-viewer.rb +63 -47
- data/lib/pione/location.rb +10 -0
- data/lib/pione/location/basic-location.rb +272 -0
- data/lib/pione/location/dropbox-location.rb +139 -0
- data/lib/pione/location/ftp-location.rb +156 -0
- data/lib/pione/location/local-location.rb +116 -0
- data/lib/pione/log.rb +10 -0
- data/lib/pione/log/domain-info.rb +72 -0
- data/lib/pione/log/process-log.rb +176 -0
- data/lib/pione/log/process-record.rb +189 -0
- data/lib/pione/log/xes-log.rb +105 -0
- data/lib/pione/model/assignment.rb +88 -80
- data/lib/pione/model/binary-operator.rb +74 -68
- data/lib/pione/model/block.rb +218 -207
- data/lib/pione/model/boolean.rb +123 -112
- data/lib/pione/model/call-rule.rb +72 -65
- data/lib/pione/model/data-expr.rb +596 -290
- data/lib/pione/model/float.rb +108 -103
- data/lib/pione/model/integer.rb +133 -129
- data/lib/pione/model/message.rb +79 -72
- data/lib/pione/model/package.rb +42 -38
- data/lib/pione/model/parameters.rb +265 -236
- data/lib/pione/model/rule-expr.rb +247 -242
- data/lib/pione/model/rule-io.rb +137 -133
- data/lib/pione/model/rule.rb +307 -292
- data/lib/pione/model/string.rb +110 -99
- data/lib/pione/model/variable-table.rb +300 -271
- data/lib/pione/model/variable.rb +88 -83
- data/lib/pione/option.rb +13 -0
- data/lib/pione/option/child-process-option.rb +19 -0
- data/lib/pione/{command-option → option}/common-option.rb +6 -5
- data/lib/pione/option/option-interface.rb +73 -0
- data/lib/pione/{command-option → option}/presence-notifier-option.rb +4 -3
- data/lib/pione/option/task-worker-owner-option.rb +24 -0
- data/lib/pione/{command-option → option}/tuple-space-provider-option.rb +6 -4
- data/lib/pione/option/tuple-space-provider-owner-option.rb +18 -0
- data/lib/pione/option/tuple-space-receiver-option.rb +8 -0
- data/lib/pione/parser/common-parser.rb +3 -2
- data/lib/pione/parser/expr-parser.rb +6 -1
- data/lib/pione/patch/em-ftpd-patch.rb +21 -0
- data/lib/pione/patch/rinda-patch.rb +31 -23
- data/lib/pione/rule-handler/action-handler.rb +35 -25
- data/lib/pione/rule-handler/basic-handler.rb +92 -18
- data/lib/pione/rule-handler/flow-handler.rb +104 -98
- data/lib/pione/rule-handler/root-handler.rb +11 -0
- data/lib/pione/system/common.rb +10 -0
- data/lib/pione/system/file-cache.rb +103 -84
- data/lib/pione/system/global.rb +67 -12
- data/lib/pione/system/init.rb +20 -0
- data/lib/pione/transformer/expr-transformer.rb +6 -1
- data/lib/pione/tuple-space/data-finder.rb +33 -6
- data/lib/pione/tuple-space/tuple-space-receiver.rb +4 -3
- data/lib/pione/tuple-space/tuple-space-server-interface.rb +58 -13
- data/lib/pione/tuple-space/tuple-space-server.rb +13 -11
- data/lib/pione/tuple-space/update-criteria.rb +8 -7
- data/lib/pione/tuple/base-location-tuple.rb +9 -0
- data/lib/pione/tuple/basic-tuple.rb +7 -7
- data/lib/pione/tuple/data-tuple.rb +5 -2
- data/lib/pione/tuple/lift-tuple.rb +14 -0
- data/lib/pione/tuple/rule-tuple.rb +1 -1
- data/lib/pione/tuple/task-tuple.rb +5 -1
- data/lib/pione/version.rb +1 -1
- data/pione.gemspec +5 -1
- data/test/location/spec_basic-location.rb +35 -0
- data/test/location/spec_ftp-location.rb +100 -0
- data/test/location/spec_local-location.rb +99 -0
- data/test/log/data/sample.log +1003 -0
- data/test/log/spec_xes-log.rb +11 -0
- data/test/model/spec_data-expr.rb +249 -6
- data/test/model/spec_data-expr.yml +45 -0
- data/test/parser/spec_expr-parser.yml +4 -0
- data/test/spec_data-finder.rb +13 -7
- data/test/spec_data-finder.yml +42 -13
- data/test/system/spec_file-cache.rb +39 -0
- data/test/test-util.rb +226 -1
- data/test/transformer/spec_expr-transformer.rb +12 -1
- metadata +107 -24
- data/bin/pione-search-log +0 -30
- data/lib/pione/command-option/basic-option.rb +0 -42
- data/lib/pione/command-option/child-process-option.rb +0 -17
- data/lib/pione/command-option/daemon-option.rb +0 -12
- data/lib/pione/command-option/task-worker-owner-option.rb +0 -17
- data/lib/pione/command-option/tuple-space-provider-owner-option.rb +0 -16
- data/lib/pione/command-option/tuple-space-receiver-option.rb +0 -12
- data/lib/pione/command/tuple-space-provider-owner.rb +0 -6
- data/lib/pione/resource/basic-resource.rb +0 -92
- data/lib/pione/resource/dropbox-resource.rb +0 -106
- data/lib/pione/resource/ftp.rb +0 -84
- data/lib/pione/resource/local.rb +0 -113
- data/lib/pione/tuple/base-uri-tuple.rb +0 -9
- data/lib/pione/tuple/shift-tuple.rb +0 -13
- data/lib/pione/util/log.rb +0 -79
- data/test/spec_resource.rb +0 -73
data/lib/pione/model/float.rb
CHANGED
@@ -1,106 +1,111 @@
|
|
1
|
-
module Pione
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
return
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
@
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
1
|
+
module Pione
|
2
|
+
module Model
|
3
|
+
# PioneFloat represents float values in PIONE system.
|
4
|
+
class PioneFloat < BasicModel
|
5
|
+
set_pione_model_type TypeFloat
|
6
|
+
|
7
|
+
attr_reader :value
|
8
|
+
|
9
|
+
# Create a float value in PIONE system.
|
10
|
+
#
|
11
|
+
# @param value [Float]
|
12
|
+
# value in ruby
|
13
|
+
def initialize(value)
|
14
|
+
@value = value
|
15
|
+
super()
|
16
|
+
end
|
17
|
+
|
18
|
+
# @api private
|
19
|
+
def textize
|
20
|
+
"#PioneFloat{%s}" % @value
|
21
|
+
end
|
22
|
+
|
23
|
+
# Return ruby's value.
|
24
|
+
#
|
25
|
+
# @return [Float]
|
26
|
+
# ruby's value
|
27
|
+
def to_ruby
|
28
|
+
return @value
|
29
|
+
end
|
30
|
+
|
31
|
+
# @api private
|
32
|
+
def ==(other)
|
33
|
+
return false unless other.kind_of?(self.class)
|
34
|
+
@value == other.value
|
35
|
+
end
|
36
|
+
|
37
|
+
alias :eql? :"=="
|
38
|
+
|
39
|
+
# @api private
|
40
|
+
def hash
|
41
|
+
@value.hash
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
TypeFloat.instance_eval do
|
46
|
+
# Return true if the other equals self.
|
47
|
+
#
|
48
|
+
# @return [PioneBoolean]
|
49
|
+
# true if the other equals self
|
50
|
+
define_pione_method("==", [TypeFloat], TypeBoolean) do |rec, other|
|
51
|
+
PioneBoolean.new(rec.value == other.value)
|
52
|
+
end
|
53
|
+
|
54
|
+
define_pione_method("!=", [TypeFloat], TypeBoolean) do |rec, other|
|
55
|
+
PioneBoolean.not(rec.call_pione_method("==", other))
|
56
|
+
end
|
57
|
+
|
58
|
+
define_pione_method(">", [TypeFloat], TypeBoolean) do |rec, other|
|
59
|
+
PioneBoolean.new(rec.value > other.value)
|
60
|
+
end
|
61
|
+
|
62
|
+
define_pione_method(">=", [TypeFloat], TypeBoolean) do |rec, other|
|
63
|
+
PioneBoolean.or(rec.call_pione_method(">", other),
|
64
|
+
rec.call_pione_method("==", other))
|
65
|
+
end
|
66
|
+
|
67
|
+
define_pione_method("<", [TypeFloat], TypeBoolean) do |rec, other|
|
68
|
+
PioneBoolean.new(rec.value < other.value)
|
69
|
+
end
|
70
|
+
|
71
|
+
define_pione_method("<=", [TypeFloat], TypeBoolean) do |rec, other|
|
72
|
+
PioneBoolean.or(rec.call_pione_method("<", other),
|
73
|
+
rec.call_pione_method("==", other))
|
74
|
+
end
|
75
|
+
|
76
|
+
define_pione_method("+", [TypeFloat], TypeFloat) do |rec, other|
|
77
|
+
PioneFloat.new(rec.value + other.value)
|
78
|
+
end
|
79
|
+
|
80
|
+
define_pione_method("-", [TypeFloat], TypeFloat) do |rec, other|
|
81
|
+
PioneFloat.new(rec.value - other.value)
|
82
|
+
end
|
83
|
+
|
84
|
+
define_pione_method("*", [TypeFloat], TypeFloat) do |rec, other|
|
85
|
+
PioneFloat.new(rec.value * other.value)
|
86
|
+
end
|
87
|
+
|
88
|
+
define_pione_method("%", [TypeFloat], TypeFloat) do |rec, other|
|
89
|
+
# TODO: zero division error
|
90
|
+
PioneFloat.new(rec.value % other.value)
|
91
|
+
end
|
92
|
+
|
93
|
+
define_pione_method("/", [TypeFloat], TypeFloat) do |rec, other|
|
94
|
+
# TODO: zero division error
|
95
|
+
PioneFloat.new(rec.value / other.value)
|
96
|
+
end
|
97
|
+
|
98
|
+
define_pione_method("as_string", [], TypeString) do |rec|
|
99
|
+
PioneString.new(rec.value.to_s)
|
100
|
+
end
|
101
|
+
|
102
|
+
define_pione_method("as_int", [], TypeInteger) do |rec|
|
103
|
+
PioneInteger.new(rec.value.to_i)
|
104
|
+
end
|
105
|
+
|
106
|
+
define_pione_method("as_float", [], TypeFloat) do |rec|
|
107
|
+
rec
|
108
|
+
end
|
104
109
|
end
|
105
110
|
end
|
106
111
|
end
|
data/lib/pione/model/integer.rb
CHANGED
@@ -1,132 +1,136 @@
|
|
1
|
-
module Pione
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
@
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
return
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
@
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
1
|
+
module Pione
|
2
|
+
module Model
|
3
|
+
# PioneInteger represents integer value in PIONE system.
|
4
|
+
class PioneInteger < BasicModel
|
5
|
+
set_pione_model_type TypeInteger
|
6
|
+
|
7
|
+
attr_reader :value
|
8
|
+
|
9
|
+
# Create a integer value in PIONE system.
|
10
|
+
#
|
11
|
+
# @param value [Integer]
|
12
|
+
# value in ruby
|
13
|
+
def initialize(value)
|
14
|
+
@value = value
|
15
|
+
super()
|
16
|
+
end
|
17
|
+
|
18
|
+
# @api private
|
19
|
+
def task_id_string
|
20
|
+
"Integer<#{@value}>"
|
21
|
+
end
|
22
|
+
|
23
|
+
# @api private
|
24
|
+
def textize
|
25
|
+
@value.to_s
|
26
|
+
end
|
27
|
+
|
28
|
+
# Return the ruby's value.
|
29
|
+
#
|
30
|
+
# @return [Integer]
|
31
|
+
# ruby's value
|
32
|
+
def to_ruby
|
33
|
+
return @value
|
34
|
+
end
|
35
|
+
|
36
|
+
# @api private
|
37
|
+
def ==(other)
|
38
|
+
return false unless other.kind_of?(self.class)
|
39
|
+
@value == other.value
|
40
|
+
end
|
41
|
+
|
42
|
+
alias :eql? :"=="
|
43
|
+
|
44
|
+
# @api private
|
45
|
+
def hash
|
46
|
+
@value.hash
|
47
|
+
end
|
48
|
+
|
49
|
+
# @api private
|
50
|
+
def inspect
|
51
|
+
"#<Pione::Model::PioneInteger @value=%s>" % @value.inspect
|
52
|
+
end
|
53
|
+
|
54
|
+
# @api private
|
55
|
+
alias :to_s :inspect
|
56
|
+
end
|
57
|
+
|
58
|
+
TypeInteger.instance_eval do
|
59
|
+
define_pione_method("==", [TypeInteger], TypeBoolean) do |rec, other|
|
60
|
+
PioneBoolean.new(rec.value == other.value)
|
61
|
+
end
|
62
|
+
|
63
|
+
define_pione_method("!=", [TypeInteger], TypeBoolean) do |rec, other|
|
64
|
+
PioneBoolean.not(rec.call_pione_method("==", other))
|
65
|
+
end
|
66
|
+
|
67
|
+
define_pione_method(">", [TypeInteger], TypeBoolean) do |rec, other|
|
68
|
+
PioneBoolean.new(rec.value > other.value)
|
69
|
+
end
|
70
|
+
|
71
|
+
define_pione_method(">=", [TypeInteger], TypeBoolean) do |rec, other|
|
72
|
+
PioneBoolean.or(rec.call_pione_method(">", other),
|
73
|
+
rec.call_pione_method("==", other))
|
74
|
+
end
|
75
|
+
|
76
|
+
define_pione_method("<", [TypeInteger], TypeBoolean) do |rec, other|
|
77
|
+
PioneBoolean.new(rec.value < other.value)
|
78
|
+
end
|
79
|
+
|
80
|
+
define_pione_method("<=", [TypeInteger], TypeBoolean) do |rec, other|
|
81
|
+
PioneBoolean.or(rec.call_pione_method("<", other),
|
82
|
+
rec.call_pione_method("==", other))
|
83
|
+
end
|
84
|
+
|
85
|
+
define_pione_method("+", [TypeInteger], TypeInteger) do |rec, other|
|
86
|
+
PioneInteger.new(rec.value + other.value)
|
87
|
+
end
|
88
|
+
|
89
|
+
define_pione_method("-", [TypeInteger], TypeInteger) do |rec, other|
|
90
|
+
PioneInteger.new(rec.value - other.value)
|
91
|
+
end
|
92
|
+
|
93
|
+
define_pione_method("*", [TypeInteger], TypeInteger) do |rec, other|
|
94
|
+
PioneInteger.new(rec.value * other.value)
|
95
|
+
end
|
96
|
+
|
97
|
+
define_pione_method("%", [TypeInteger], TypeInteger) do |rec, other|
|
98
|
+
# TODO: zero division error
|
99
|
+
PioneInteger.new(rec.value % other.value)
|
100
|
+
end
|
101
|
+
|
102
|
+
define_pione_method("/", [TypeInteger], TypeInteger) do |rec, other|
|
103
|
+
# TODO: zero division error
|
104
|
+
PioneInteger.new(rec.value / other.value)
|
105
|
+
end
|
106
|
+
|
107
|
+
define_pione_method("as_string", [], TypeString) do |rec|
|
108
|
+
PioneString.new(rec.value.to_s)
|
109
|
+
end
|
110
|
+
|
111
|
+
define_pione_method("as_int", [], TypeInteger) do |rec|
|
112
|
+
rec
|
113
|
+
end
|
114
|
+
|
115
|
+
define_pione_method("as_float", [], TypeFloat) do |rec|
|
116
|
+
PioneFloat.new(rec.value.to_f)
|
117
|
+
end
|
118
|
+
|
119
|
+
define_pione_method("next", [], TypeInteger) do |rec|
|
120
|
+
PioneInteger.new(rec.value.next)
|
121
|
+
end
|
122
|
+
|
123
|
+
define_pione_method("prev", [], TypeInteger) do |rec|
|
124
|
+
PioneInteger.new(rec.value.pred)
|
125
|
+
end
|
126
|
+
|
127
|
+
define_pione_method("even?", [], TypeBoolean) do |rec|
|
128
|
+
PioneBoolean.new(rec.value.even?)
|
129
|
+
end
|
130
|
+
|
131
|
+
define_pione_method("odd?", [], TypeBoolean) do |rec|
|
132
|
+
PioneBoolean.new(rec.value.odd?)
|
133
|
+
end
|
130
134
|
end
|
131
135
|
end
|
132
136
|
end
|