Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        public virtual void TestOIdInMap()
		{
			NeoDatis.Odb.OID oid1 = NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID(1);
			NeoDatis.Odb.OID oid2 = NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID(1);
			OdbHashMap<OID,string> map = new NeoDatis.Tool.Wrappers.Map.OdbHashMap<OID,string>();
			map.Add(oid1, "oid1");
			AssertNotNull(map[oid2]);
		}
Esempio n. 3
0
        public virtual void TestOIdInMap()
        {
            NeoDatis.Odb.OID         oid1 = NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID(1);
            NeoDatis.Odb.OID         oid2 = NeoDatis.Odb.Core.Oid.OIDFactory.BuildObjectOID(1);
            OdbHashMap <OID, string> map  = new NeoDatis.Tool.Wrappers.Map.OdbHashMap <OID, string>();

            map.Add(oid1, "oid1");
            AssertNotNull(map[oid2]);
        }
Esempio n. 4
0
		/// <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;
		}