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.
Files changed (76) hide show
  1. data/Rakefile +1 -0
  2. data/VERSION.yml +2 -2
  3. data/examples/random-people-shared-addresses/Makefile +2 -2
  4. data/examples/random-people-shared-addresses/batch-load-users.rb +2 -5
  5. data/examples/random-people-shared-addresses/find-mentions.rb +1 -4
  6. data/examples/random-people-shared-addresses/find-people-by-address.rb +1 -4
  7. data/examples/random-people-shared-addresses/optimise.rb +1 -4
  8. data/examples/random-people-shared-addresses/people.rb +0 -15
  9. data/examples/random-people-shared-addresses/query.rb +1 -4
  10. data/examples/random-people-shared-addresses/query2.rb +1 -4
  11. data/examples/random-people-shared-addresses/results.write.BASELINE +298 -0
  12. data/examples/random-people-shared-addresses/results.write.NEW_ATTR_ENCODING +294 -0
  13. data/examples/random-people-shared-addresses/settings.rb +3 -0
  14. data/examples/random-people/batch-load-users.rb +1 -4
  15. data/examples/random-people/optimise.rb +1 -4
  16. data/examples/random-people/people.rb +0 -3
  17. data/examples/random-people/query.rb +1 -5
  18. data/examples/random-people/query2.rb +1 -4
  19. data/examples/random-people/settings.rb +3 -0
  20. data/examples/random-people/what-to-query-on.rb +1 -3
  21. data/examples/read-testing/Makefile +10 -0
  22. data/examples/read-testing/load.rb +65 -0
  23. data/examples/read-testing/read.rb +51 -0
  24. data/examples/read-testing/results.read.BASELINE +6 -0
  25. data/examples/read-testing/results.read.FAST +5 -0
  26. data/examples/read-testing/rrr.rb +87 -0
  27. data/examples/read-testing/settings.rb +2 -0
  28. data/examples/read-testing/xampl-gen.rb +36 -0
  29. data/examples/read-testing/xml/text.xml +8 -0
  30. data/lib/xamplr.rb +10 -1
  31. data/lib/xamplr/exceptions.rb +97 -0
  32. data/lib/xamplr/from-xml-orig.rb +350 -0
  33. data/lib/xamplr/from-xml.rb +272 -183
  34. data/lib/xamplr/handwritten/example.rb +0 -58
  35. data/lib/xamplr/handwritten/hand-example.rb +0 -27
  36. data/lib/xamplr/handwritten/test-handwritten.rb +0 -37
  37. data/lib/xamplr/mixins.rb +10 -48
  38. data/lib/xamplr/persist-to-xml.rb +249 -0
  39. data/lib/xamplr/persistence.rb +44 -412
  40. data/lib/xamplr/persistence.rb.more_thread_safe +0 -13
  41. data/lib/xamplr/persistence.rb.partially_thread_safe +0 -13
  42. data/lib/xamplr/persister.rb +298 -0
  43. data/lib/xamplr/{persister → persisters}/caches.rb +0 -0
  44. data/lib/xamplr/{persister → persisters}/caching.rb +1 -1
  45. data/lib/xamplr/{persister → persisters}/filesystem.rb +4 -5
  46. data/lib/xamplr/{persister → persisters}/in-memory.rb +1 -1
  47. data/lib/xamplr/{persister → persisters}/simple.rb +0 -0
  48. data/lib/xamplr/{persister → persisters}/tokyo-cabinet.rb +53 -15
  49. data/lib/xamplr/simpleTemplate/{input-c.r4 → obsolete/input-c.r4} +0 -0
  50. data/lib/xamplr/simpleTemplate/{play.r6.txt → obsolete/play.r6.txt} +0 -0
  51. data/lib/xamplr/simpleTemplate/{play_more.r6.txt → obsolete/play_more.r6.txt} +0 -0
  52. data/lib/xamplr/simpleTemplate/{test001.r5 → obsolete/test001.r5} +0 -0
  53. data/lib/xamplr/simpleTemplate/{test002.r5 → obsolete/test002.r5} +0 -0
  54. data/lib/xamplr/simpleTemplate/{test003.r5 → obsolete/test003.r5} +0 -0
  55. data/lib/xamplr/templates/child_indexed.template +1 -1
  56. data/lib/xamplr/templates/element_classes.template +1 -1
  57. data/lib/xamplr/templates/element_data.template +0 -39
  58. data/lib/xamplr/templates/element_empty.template +0 -40
  59. data/lib/xamplr/templates/element_mixed.template +0 -41
  60. data/lib/xamplr/templates/element_simple.template +0 -40
  61. data/lib/xamplr/test-support/bench.rb +6 -26
  62. data/lib/xamplr/test-support/test.rb +1 -89
  63. data/lib/xamplr/visitor.rb +0 -778
  64. data/lib/xamplr/visitors.rb +573 -0
  65. data/lib/xamplr/xampl-generator.rb +1 -1
  66. data/lib/xamplr/xampl-hand-generated.rb +0 -85
  67. data/lib/xamplr/xampl-module.rb +36 -0
  68. data/lib/xamplr/xampl-object-internals.rb +6 -0
  69. data/lib/xamplr/xampl-object.rb +10 -341
  70. data/lib/xamplr/xampl-persisted-object.rb +122 -0
  71. data/lib/xamplr/xml-text.rb +117 -0
  72. metadata +53 -18
  73. data/lib/xamplr/persister/subversion.rb +0 -61
  74. data/lib/xamplr/rac.sh +0 -6
  75. data/lib/xamplr/rac_gen.sh +0 -1
  76. data/lib/xamplr/templates/child_indexed.template.000 +0 -87
@@ -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
@@ -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