protected virtual void CloneTree(openehr.openehr.am.archetype.constraint_model.C_COMPLEX_OBJECT adlComplexObject, C_COMPLEX_OBJECT parentComplexObject, int depth) { CloneConstraintVisitor nodeVisitor = NewInstance(); openehr.openehr.am.archetype.constraint_model.C_ATTRIBUTE adlAttribute; parentComplexObject.attributes = new C_ATTRIBUTE[adlComplexObject.attributes().count()]; for (int i = 1; i <= adlComplexObject.attributes().count(); i++) { adlAttribute = adlComplexObject.attributes().i_th(i) as openehr.openehr.am.archetype.constraint_model.C_ATTRIBUTE; C_ATTRIBUTE attributeNode = nodeVisitor.CloneAttribute(adlAttribute); attributeNode.children = new C_OBJECT[adlAttribute.children().count()]; parentComplexObject.attributes[i - 1] = attributeNode; for (int j = 1; j <= adlAttribute.children().count(); j++) { openehr.openehr.am.archetype.constraint_model.C_OBJECT child = adlAttribute.children().i_th(j) as openehr.openehr.am.archetype.constraint_model.C_OBJECT; object childNode = nodeVisitor.Visit(child, depth); attributeNode.children[j - 1] = childNode as C_OBJECT; if (child is openehr.openehr.am.archetype.constraint_model.Impl.C_COMPLEX_OBJECT) CloneTree(child as openehr.openehr.am.archetype.constraint_model.C_COMPLEX_OBJECT, childNode as C_COMPLEX_OBJECT, ++depth); } } }
/// <summary> /// Returns a C_COMPLEX_OBJECT class /// </summary> /// <param name="reference_model_class_name">The name of the reference model class as a string</param> /// <param name="an_occurrence">The number occurrences of this object</param> /// <returns>an AOM C_Complex_object that has these features set</returns> public C_COMPLEX_OBJECT MakeComplexObject(string reference_model_class_name, IntervalOfInteger an_occurrence) { C_COMPLEX_OBJECT result = new C_COMPLEX_OBJECT(); result.rm_type_name = reference_model_class_name; result.node_id = ""; result.occurrences = an_occurrence; return result; }
/// <summary> /// Returns a C_COMPLEX_OBJECT class /// </summary> /// <param name="reference_model_class_name">The name of the reference model class as a string</param> /// <returns>an AOM C_Complex_object that has these features set</returns> public C_COMPLEX_OBJECT MakeComplexObject(string reference_model_class_name) { C_COMPLEX_OBJECT result = new C_COMPLEX_OBJECT(); result.rm_type_name = reference_model_class_name; result.node_id = ""; result.occurrences = default_occurrences(); return result; }
/// <summary> /// Returns a C_COMPLEX_OBJECT class /// </summary> /// <param name="reference_model_class_name">The name of the reference model class as a string</param> /// <param name="node_id">The node id of this class</param> /// <param name="an_occurrences">The occurrences as an object</param> /// <returns>an AOM C_Complex_object that has these features set</returns> //public C_COMPLEX_OBJECT MakeComplexObject(string reference_model_class_name, string node_id, interval_of_integer an_occurrences) public C_COMPLEX_OBJECT MakeComplexObject(string reference_model_class_name, string node_id, IntervalOfInteger an_occurrences)//JAR: 30APR2007, AE-42 Support XML Schema 1.0.1 { C_COMPLEX_OBJECT result = new C_COMPLEX_OBJECT(); result.rm_type_name = reference_model_class_name; result.node_id = node_id; result.occurrences = an_occurrences; return result; }
C_COMPLEX_OBJECT VisitComplexObjectConstraint(C_COMPLEX_OBJECT objectConstraint) { System.Diagnostics.Trace.Assert(objectConstraint != null, "objectConstraint must not be null"); C_COMPLEX_OBJECT result = new C_COMPLEX_OBJECT(); CloneObjectConstraint(objectConstraint, result); result.attributes = VisitAttributes(objectConstraint.attributes); return result; }
private void add_attribute(C_COMPLEX_OBJECT an_object, C_ATTRIBUTE an_attribute) { int i; if (an_object.attributes == null) { an_object.attributes = Array.CreateInstance(typeof(C_ATTRIBUTE), 1) as C_ATTRIBUTE[]; i = 0; } else { C_ATTRIBUTE[] new_attributes = an_object.attributes; i = new_attributes.Length; Array.Resize(ref new_attributes, i + 1); an_object.attributes = new_attributes; } an_object.attributes[i] = an_attribute; }
//public C_MULTIPLE_ATTRIBUTE MakeMultipleAttribute(C_COMPLEX_OBJECT an_object, string name, CARDINALITY a_cardinality)//, int capacity) //JAR: 30APR2007, AE-42 Support XML Schema 1.0.1 public C_MULTIPLE_ATTRIBUTE MakeMultipleAttribute(C_COMPLEX_OBJECT an_object, string name, CARDINALITY a_cardinality, IntervalOfInteger existence)//, int capacity) { C_MULTIPLE_ATTRIBUTE result = new C_MULTIPLE_ATTRIBUTE(); result.rm_attribute_name = name; result.cardinality = a_cardinality; result.existence = existence; //JAR: 30APR2007, AE-42 Support XML Schema 1.0.1 //result.children = Array.CreateInstance(typeof(XMLParser.C_OBJECT), capacity) as C_OBJECT[]; add_attribute(an_object, result); return result; }
//public C_SINGLE_ATTRIBUTE MakeSingleAttribute(C_COMPLEX_OBJECT an_object, string name) //JAR: 30APR2007, AE-42 Support XML Schema 1.0.1 public C_SINGLE_ATTRIBUTE MakeSingleAttribute(C_COMPLEX_OBJECT an_object, string name, IntervalOfInteger existence) { C_SINGLE_ATTRIBUTE result = new C_SINGLE_ATTRIBUTE(); result.rm_attribute_name = name; result.existence = existence; //JAR: 30APR2007, AE-42 Support XML Schema 1.0.1 add_attribute(an_object, result); return result; }
protected virtual object Visit(openehr.openehr.am.archetype.constraint_model.Impl.C_COMPLEX_OBJECT o, int depth) { C_COMPLEX_OBJECT result = new C_COMPLEX_OBJECT(); CloneC_Object(result, o); return result; }
private void get_logical_paths(System.Collections.ArrayList list, C_COMPLEX_OBJECT node, string path, string a_language_code) { if (path != "") { path += "[" + getText(a_language_code, node.node_id) + "]"; list.Add(path); } if (node.attributes != null) { foreach (C_ATTRIBUTE attrib in node.attributes) { if (attrib.children != null) { if (attrib.GetType() == typeof(C_MULTIPLE_ATTRIBUTE)) { foreach (C_OBJECT obj in attrib.children) { C_COMPLEX_OBJECT co = obj as C_COMPLEX_OBJECT; if (co != null && !string.IsNullOrEmpty(co.node_id)) get_logical_paths(list, co, path + "/" + attrib.rm_attribute_name, a_language_code); } } else //single attribute { C_COMPLEX_OBJECT co = attrib.children[0] as C_COMPLEX_OBJECT; if (co != null && !string.IsNullOrEmpty(co.node_id)) get_logical_paths(list, co, path + "/" + attrib.rm_attribute_name, a_language_code); } } } } }