source: ruby/trunk/models/rm/common/archetyped.rb@ 8

Last change on this file since 8 was 8, checked in by KOBAYASHI, Shinji, 16 years ago

correct some typo

File size: 2.6 KB
Line 
1module OpenEHR
2 module RM
3 module Common
4 module Archetyped
5 module Locater_Constants
6 CURRENT_TRANSACTION_ID = "current"
7 FRAGMENT_SEPARATOR = "#"
8 CONTENT_PATH_SEPARATOR = "|"
9 ORGANIZER_PATH_SEPARATOR = "/"
10 MULTIPART_ID_DELIMITER = "::"
11 end
12 class Pathable
13 attr_reader :parent
14 def initialize(parent)
15 @parent = parent
16 end
17 def item_at_path(path)
18 raise NotImplementError, "item_at_path must be implemented"
19 end
20 def items_at_path(path)
21 raise NotImplementError, "items_at_path must be implemented"
22 end
23 def path_exists?(path)
24 raise NotImplementError, "path_exists? must be implemented"
25 end
26 def path_of_item(item)
27 raise NotImplementError, "path_of_item must be implemented"
28 end
29 def path_unique(path)
30 raise NotImplementError, "path_unique must be implemented"
31 end
32 end
33 class Locatable < Pathable
34 include Locater_Constants
35 attr_accessor :uid, :archetype_node_id, :archetype_details
36 attr_accessor :feeder_audit, :links, :parent
37 def initialize(uid, archetype_node_id, name, archetype_details,
38 feeder_audit, links, parent)
39 super(parent)
40 if archetype_node_id.nil?
41 raise ArgumentError, "null archetype_node_id"
42 end
43 if name.nil?
44 raise ArgumentError, "name is empty"
45 end
46 if links.nil?
47 raise ArgumentError, "links is empty"
48 end
49 @uid = uid
50 @archetype_node_id = archetype_node_id
51 @archetype_details = archetype_details
52 @feeder_audit = feeder_audit
53 @links = links
54 @parent = parent
55 end
56 def item_at_path(path)
57 if !@path.nil?
58 if @path == ""
59 raise ArgumentError, "path is not valid"
60 end
61 end
62 end
63 def items_at_path(path)
64 raise NotImplementError, "items_at_path must be implemented"
65 end
66 def path_exists?
67 raise NotImplementError, "path_exists? must be implemented"
68 end
69 def path_unique
70 raise NotImplementError, "path_unique must be implemented"
71 end
72 def concept
73 end
74 def is_archetype_root?
75 !archetype_details.nil?
76 end
77 end
78 end # end of Archetyped
79 end # end of Common
80 end # end of RM
81end # end of OpenEHR
Note: See TracBrowser for help on using the repository browser.