C_OBJECT[] VisitChildren(C_OBJECT[] children) { C_OBJECT[] result = null; if (children != null) { List<C_OBJECT> objectConstraintList = new List<C_OBJECT>(); foreach (C_OBJECT objectConstraint in children) { C_OBJECT newObjectConstraint; C_COMPLEX_OBJECT complexObjectConstraint = objectConstraint as C_COMPLEX_OBJECT; if (complexObjectConstraint != null) newObjectConstraint = VisitComplexObjectConstraint(complexObjectConstraint); else { C_PRIMITIVE_OBJECT primitiveObjectConstraint = objectConstraint as C_PRIMITIVE_OBJECT; if (primitiveObjectConstraint != null) newObjectConstraint = VisitPrimitiveObjectConstraint(primitiveObjectConstraint); else newObjectConstraint = objectConstraint; } System.Diagnostics.Debug.Assert(newObjectConstraint != null, "newObject must not be null"); objectConstraintList.Add(newObjectConstraint); } result = objectConstraintList.ToArray(); } return result; }
public void add_object(C_ATTRIBUTE an_attribute, C_OBJECT an_object) { int i; if (an_attribute.children == null) { an_attribute.children = Array.CreateInstance(typeof(C_OBJECT), 1) as C_OBJECT[]; i = 0; } else { C_OBJECT[] new_objects = an_attribute.children; i = new_objects.Length; Array.Resize(ref new_objects, i + 1); an_attribute.children = new_objects; } an_attribute.children[i] = an_object; }
protected virtual void CloneC_Object(C_OBJECT cloneObject, openehr.openehr.am.archetype.constraint_model.C_OBJECT o) { if (!o.node_id().to_cil().StartsWith("unknown")) //hack for xml conversion cloneObject.node_id = o.node_id().to_cil(); else cloneObject.node_id = ""; cloneObject.rm_type_name = o.rm_type_name().to_cil(); cloneObject.occurrences = CloneIntervalOfInteger(o.occurrences()); }
/// <summary> /// Clone C_OBJECT /// </summary> void CloneObjectConstraint(C_OBJECT objectConstraint, C_OBJECT newObjectConstraint) { newObjectConstraint.node_id = objectConstraint.node_id; newObjectConstraint.occurrences = objectConstraint.occurrences; newObjectConstraint.rm_type_name = objectConstraint.rm_type_name; }
private void AddTerms(ArrayList result, C_OBJECT obj) { if (obj.GetType() == typeof(C_COMPLEX_OBJECT)) { C_COMPLEX_OBJECT co = (C_COMPLEX_OBJECT)obj; //Add the node id if (!string.IsNullOrEmpty(obj.node_id) && !result.Contains(obj.node_id)) result.Add(obj.node_id); if (co.attributes != null) foreach (C_ATTRIBUTE attribute in co.attributes) if (attribute.children != null) foreach (C_OBJECT obj_1 in attribute.children) AddTerms(result, obj_1); } else if (obj.GetType() == typeof(ARCHETYPE_SLOT)) { if (!string.IsNullOrEmpty(obj.node_id) && !result.Contains(obj.node_id)) result.Add(obj.node_id); } //check for internal codes else if(obj.GetType() == typeof(C_CODE_PHRASE)) { C_CODE_PHRASE ct = (C_CODE_PHRASE)obj; //Check reference if (ct.terminology_id != null) { if (ct.terminology_id.value.ToString().ToLowerInvariant() == "local" && ct.code_list != null) { foreach (string code in ct.code_list) { if (!result.Contains(code)) result.Add(code); } } } } //Ordinals use internal codes else if (obj.GetType() == typeof(C_DV_ORDINAL)) { C_DV_ORDINAL co = (C_DV_ORDINAL)obj; if (co.list != null && co.list.Length > 0) { foreach (DV_ORDINAL o in co.list) { if (o.symbol != null && o.symbol.defining_code != null) { if (!result.Contains(o.symbol.defining_code.code_string)) result.Add(o.symbol.defining_code.code_string); } } } } //Constraint references us acXXXX codes else if (obj.GetType() == typeof(CONSTRAINT_REF)) { CONSTRAINT_REF cr = (CONSTRAINT_REF)obj; if (cr.reference != null) { if (!result.Contains(cr.reference)) result.Add(cr.reference); } } }