hutch-xamplr 1.0.5 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/VERSION.yml +2 -2
- data/examples/random-people-shared-addresses/Makefile +2 -2
- data/examples/random-people-shared-addresses/batch-load-users.rb +2 -5
- data/examples/random-people-shared-addresses/find-mentions.rb +1 -4
- data/examples/random-people-shared-addresses/find-people-by-address.rb +1 -4
- data/examples/random-people-shared-addresses/optimise.rb +1 -4
- data/examples/random-people-shared-addresses/people.rb +0 -15
- data/examples/random-people-shared-addresses/query.rb +1 -4
- data/examples/random-people-shared-addresses/query2.rb +1 -4
- data/examples/random-people-shared-addresses/results.write.BASELINE +298 -0
- data/examples/random-people-shared-addresses/results.write.NEW_ATTR_ENCODING +294 -0
- data/examples/random-people-shared-addresses/settings.rb +3 -0
- data/examples/random-people/batch-load-users.rb +1 -4
- data/examples/random-people/optimise.rb +1 -4
- data/examples/random-people/people.rb +0 -3
- data/examples/random-people/query.rb +1 -5
- data/examples/random-people/query2.rb +1 -4
- data/examples/random-people/settings.rb +3 -0
- data/examples/random-people/what-to-query-on.rb +1 -3
- data/examples/read-testing/Makefile +10 -0
- data/examples/read-testing/load.rb +65 -0
- data/examples/read-testing/read.rb +51 -0
- data/examples/read-testing/results.read.BASELINE +6 -0
- data/examples/read-testing/results.read.FAST +5 -0
- data/examples/read-testing/rrr.rb +87 -0
- data/examples/read-testing/settings.rb +2 -0
- data/examples/read-testing/xampl-gen.rb +36 -0
- data/examples/read-testing/xml/text.xml +8 -0
- data/lib/xamplr.rb +10 -1
- data/lib/xamplr/exceptions.rb +97 -0
- data/lib/xamplr/from-xml-orig.rb +350 -0
- data/lib/xamplr/from-xml.rb +272 -183
- data/lib/xamplr/handwritten/example.rb +0 -58
- data/lib/xamplr/handwritten/hand-example.rb +0 -27
- data/lib/xamplr/handwritten/test-handwritten.rb +0 -37
- data/lib/xamplr/mixins.rb +10 -48
- data/lib/xamplr/persist-to-xml.rb +249 -0
- data/lib/xamplr/persistence.rb +44 -412
- data/lib/xamplr/persistence.rb.more_thread_safe +0 -13
- data/lib/xamplr/persistence.rb.partially_thread_safe +0 -13
- data/lib/xamplr/persister.rb +298 -0
- data/lib/xamplr/{persister → persisters}/caches.rb +0 -0
- data/lib/xamplr/{persister → persisters}/caching.rb +1 -1
- data/lib/xamplr/{persister → persisters}/filesystem.rb +4 -5
- data/lib/xamplr/{persister → persisters}/in-memory.rb +1 -1
- data/lib/xamplr/{persister → persisters}/simple.rb +0 -0
- data/lib/xamplr/{persister → persisters}/tokyo-cabinet.rb +53 -15
- data/lib/xamplr/simpleTemplate/{input-c.r4 → obsolete/input-c.r4} +0 -0
- data/lib/xamplr/simpleTemplate/{play.r6.txt → obsolete/play.r6.txt} +0 -0
- data/lib/xamplr/simpleTemplate/{play_more.r6.txt → obsolete/play_more.r6.txt} +0 -0
- data/lib/xamplr/simpleTemplate/{test001.r5 → obsolete/test001.r5} +0 -0
- data/lib/xamplr/simpleTemplate/{test002.r5 → obsolete/test002.r5} +0 -0
- data/lib/xamplr/simpleTemplate/{test003.r5 → obsolete/test003.r5} +0 -0
- data/lib/xamplr/templates/child_indexed.template +1 -1
- data/lib/xamplr/templates/element_classes.template +1 -1
- data/lib/xamplr/templates/element_data.template +0 -39
- data/lib/xamplr/templates/element_empty.template +0 -40
- data/lib/xamplr/templates/element_mixed.template +0 -41
- data/lib/xamplr/templates/element_simple.template +0 -40
- data/lib/xamplr/test-support/bench.rb +6 -26
- data/lib/xamplr/test-support/test.rb +1 -89
- data/lib/xamplr/visitor.rb +0 -778
- data/lib/xamplr/visitors.rb +573 -0
- data/lib/xamplr/xampl-generator.rb +1 -1
- data/lib/xamplr/xampl-hand-generated.rb +0 -85
- data/lib/xamplr/xampl-module.rb +36 -0
- data/lib/xamplr/xampl-object-internals.rb +6 -0
- data/lib/xamplr/xampl-object.rb +10 -341
- data/lib/xamplr/xampl-persisted-object.rb +122 -0
- data/lib/xamplr/xml-text.rb +117 -0
- metadata +53 -18
- data/lib/xamplr/persister/subversion.rb +0 -61
- data/lib/xamplr/rac.sh +0 -6
- data/lib/xamplr/rac_gen.sh +0 -1
- data/lib/xamplr/templates/child_indexed.template.000 +0 -87
data/lib/xamplr/rac.sh
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
./generator.rb ~/Projects/agri/raconteur/xox/*.xml ~/Projects/agri/common/xml/*.xml ~/Projects/agri/frameworks/xml/*.xml
|
2
|
-
|
3
|
-
#ruby... 80985 loc, 24477 loc in modules which is *not* available in java
|
4
|
-
#java... 554619 loc
|
5
|
-
|
6
|
-
# 6.8 times bigger in java, 9.8 times bigger if don't count child modules
|
data/lib/xamplr/rac_gen.sh
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby -w generator.rb -E -d "./tmp" /Users/hutch/Projects/agri/raconteur/xox/*.xml /Users/hutch/Projects/agri/common/xml/*.xml /Users/hutch/Projects/agri/frameworks/xml/*.xml
|
@@ -1,87 +0,0 @@
|
|
1
|
-
|
2
|
-
module #{element.class_name}AsChild
|
3
|
-
require "indexed-array"
|
4
|
-
|
5
|
-
def #{element.attribute_name}_child
|
6
|
-
accessed
|
7
|
-
@#{element.attribute_name}_child
|
8
|
-
end
|
9
|
-
|
10
|
-
def #{element.attribute_name}_child=(v)
|
11
|
-
accessed
|
12
|
-
@#{element.attribute_name}_child = v
|
13
|
-
end
|
14
|
-
|
15
|
-
alias #{element.attribute_name} #{element.attribute_name}_child
|
16
|
-
alias #{element.attribute_name}= #{element.attribute_name}_child=
|
17
|
-
|
18
|
-
def init_#{element.attribute_name}_as_child
|
19
|
-
@#{element.attribute_name}_child = IndexedArray.new
|
20
|
-
end
|
21
|
-
|
22
|
-
def add_#{element.attribute_name}(#{element.attribute_name})
|
23
|
-
accessed
|
24
|
-
index = #{element.attribute_name}.get_the_index
|
25
|
-
if(nil == index) then
|
26
|
-
raise XamplException.new("no value for the index '#{element.indexed_by_attr}' of #{element.attribute_name} defined in : " << #{element.attribute_name}.pp_xml)
|
27
|
-
end
|
28
|
-
|
29
|
-
existing = @#{element.attribute_name}_child[index]
|
30
|
-
|
31
|
-
self.remove_#{element.attribute_name}(index) if existing and (existing != #{element.attribute_name})
|
32
|
-
|
33
|
-
@children << #{element.attribute_name}
|
34
|
-
@#{element.attribute_name}_child[index] = #{element.attribute_name}
|
35
|
-
|
36
|
-
#{element.attribute_name}.add_parent(self)
|
37
|
-
|
38
|
-
changed
|
39
|
-
return #{element.attribute_name}
|
40
|
-
end
|
41
|
-
|
42
|
-
def new_#{element.attribute_name}(index)
|
43
|
-
accessed
|
44
|
-
|
45
|
-
#{element.attribute_name} = nil
|
46
|
-
|
|
47
|
-
|if @element.persisted then
|
48
|
-
|
|
49
|
-
#{element.attribute_name} = #{element.class_name}.lookup(index) if Xampl.persister and Xampl.persister.automatic
|
50
|
-
|
|
51
|
-
|end
|
52
|
-
|
|
53
|
-
#{element.attribute_name} = #{element.class_name}.new(index) unless #{element.attribute_name}
|
54
|
-
|
55
|
-
yield(#{element.attribute_name}) if block_given?
|
56
|
-
return add_#{element.attribute_name}(#{element.attribute_name})
|
57
|
-
end
|
58
|
-
|
59
|
-
def ensure_#{element.attribute_name}(index)
|
60
|
-
accessed
|
61
|
-
|
62
|
-
#{element.attribute_name} = @#{element.attribute_name}_child[index]
|
63
|
-
return #{element.attribute_name} if #{element.attribute_name}
|
64
|
-
|
65
|
-
|
|
66
|
-
|if @element.persisted then
|
67
|
-
|
|
68
|
-
#{element.attribute_name} = #{element.class_name}.lookup(index) if Xampl.persister and Xampl.persister.automatic
|
69
|
-
|
|
70
|
-
|end
|
71
|
-
|
|
72
|
-
#{element.attribute_name} = #{element.class_name}.new(index) unless #{element.attribute_name}
|
73
|
-
|
74
|
-
yield(#{element.attribute_name}) if block_given?
|
75
|
-
return add_#{element.attribute_name}(#{element.attribute_name})
|
76
|
-
end
|
77
|
-
|
78
|
-
def remove_#{element.attribute_name}(index)
|
79
|
-
accessed
|
80
|
-
changed
|
81
|
-
unless String === index or Symbol === index then
|
82
|
-
index = index.get_the_index
|
83
|
-
end
|
84
|
-
#{element.attribute_name} = @#{element.attribute_name}_child.delete(index) if index
|
85
|
-
@children.delete(#{element.attribute_name})
|
86
|
-
end
|
87
|
-
end
|