public void Setup()
        {
            store = new TypeStore();
            factory = new TypeFactory();
            nct = new NestedComplexTypeExtractor(factory, store);

        }
 public override DataType VisitArray(ArrayType at)
 {
     if (insideComplexType)
     {
         var nctr = new NestedComplexTypeExtractor(factory, store);
         at.Accept(nctr);
         return at;
     }
     else
     {
         insideComplexType = true;
         return base.VisitArray(at);
     }
 }
		public static bool ReplaceAll(TypeFactory factory, TypeStore store)
		{
			EquivalenceClass [] eqs = new EquivalenceClass[store.UsedEquivalenceClasses.Count];
			store.UsedEquivalenceClasses.CopyTo(eqs, 0);
			bool changed = false;
			for (int i = 0; i < eqs.Length; ++i)
			{
				if (eqs[i].DataType != null)
				{
					NestedComplexTypeExtractor nctr = new NestedComplexTypeExtractor(factory, store);
					eqs[i].DataType = eqs[i].DataType.Accept(nctr);
					changed |= nctr.Changed;
				}
			}
			return changed;
		}
		public override DataType VisitStructure(StructureType str)
		{
            if (visitedTypes.Contains(str))
                return str;
            visitedTypes.Add(str);
			if (insideComplexType)
			{
				changed = true;
				NestedComplexTypeExtractor nctr = new NestedComplexTypeExtractor(factory, store);
				str.Accept(nctr);
				return CreateEquivalenceClass(str);
			}
			else
			{
				insideComplexType = true;
				return base.VisitStructure(str);
			}
		}
		public override DataType VisitUnion(UnionType ut)
		{
			if (insideComplexType)
			{
				changed = true;
				NestedComplexTypeExtractor nctr = new NestedComplexTypeExtractor(factory, store);
				ut.Accept(nctr);
				return CreateEquivalenceClass(ut);
			}
			else
			{
				insideComplexType = true;
				return base.VisitUnion(ut);
			}
		}