/// <summary>To detect if a class has cyclic reference</summary> /// <param name="alreadyVisitedClasses">A hashmap containg all the already visited classes /// </param> /// <returns>true if this class info has cyclic references</returns> private bool HasCyclicReference(System.Collections.Generic.IDictionary <string, ClassInfo > alreadyVisitedClasses) { ClassAttributeInfo cai = null; bool hasCyclicRef = false; if (alreadyVisitedClasses[fullClassName] != null) { return(true); } System.Collections.Generic.IDictionary <string, ClassInfo > localMap = new NeoDatis.Tool.Wrappers.Map.OdbHashMap <string, ClassInfo >(); alreadyVisitedClasses.Add(fullClassName, this); for (int i = 0; i < attributes.Count; i++) { cai = GetAttributeInfo(i); if (!cai.IsNative()) { localMap = new NeoDatis.Tool.Wrappers.Map.OdbHashMap <string, ClassInfo >(alreadyVisitedClasses); hasCyclicRef = cai.GetClassInfo().HasCyclicReference(localMap); if (hasCyclicRef) { return(true); } } } return(false); }
> GetAllNonNativeAttributes() { NeoDatis.Tool.Wrappers.List.IOdbList <ClassAttributeInfo > result = new NeoDatis.Tool.Wrappers.List.OdbArrayList <ClassAttributeInfo >(attributes.Count); ClassAttributeInfo cai = null; for (int i = 0; i < attributes.Count; i++) { cai = attributes[i]; if (!cai.IsNative() || cai.GetAttributeType().IsEnum()) { result.Add(cai); } else { if (cai.GetAttributeType().IsArray() && !cai.GetAttributeType().GetSubType().IsNative ()) { result.Add(new ClassAttributeInfo(-1, "subtype" , cai.GetAttributeType().GetSubType().GetName(), null)); } } } return(result); }