예제 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(("UserDefinedClass".GetHashCode() * 397) ^ DomPath.GetHashCode());
     }
 }
예제 #2
0
 public Property(DomPath domPath, bool isNonEmpty, IFactory factory)
 {
     HasHadNonEmptyValue |= isNonEmpty;
     _defaultPropertyDefinitionSet = new Lazy<PropertyDefinitionSet>(CreateDefaultPropertyDefinitionSet);
     _domPath = domPath;
     _factory = factory;
 }
예제 #3
0
 public Property(DomPath domPath, bool isNonEmpty, IFactory factory)
 {
     HasHadNonEmptyValue          |= isNonEmpty;
     _defaultPropertyDefinitionSet = new Lazy <PropertyDefinitionSet>(CreateDefaultPropertyDefinitionSet);
     _domPath = domPath;
     _factory = factory;
 }
예제 #4
0
        public override bool Equals(object other)
        {
            var otherUserDefinedClass = other as UserDefinedClass;

            if (otherUserDefinedClass == null)
            {
                return(false);
            }

            return(DomPath.Equals(otherUserDefinedClass.DomPath));
        }
예제 #5
0
        public DomPath GetDomPath(IFactory factory)
        {
            var split = DomPath.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);

            var fullPath      = split[0];
            var typeNameDepth = int.Parse(split[1]);

            var domPath = factory.GetOrCreateDomPath(fullPath, typeNameDepth);

            return(domPath);
        }
예제 #6
0
        public UserDefinedClass GetOrAdd(DomPath path, out bool isNew)
        {
            var isNewClass = false;
            var @class     = _classes.GetOrAdd(
                path,
                x =>
            {
                isNewClass = true;
                return(new UserDefinedClass(x));
            });

            isNew = isNewClass;
            return(@class);
        }
예제 #7
0
        public DomPath GetOrCreateDomPath(string fullPath, int typeNameDepth)
        {
            if (domPaths.ContainsKey(fullPath))
            {
                return(domPaths[fullPath]);
            }

            var domPath = new DomPath(fullPath, typeNameDepth);

            if (stuff.Contains(domPath.TypeName.Raw))
            {
                throw new InvalidOperationException("Invalid metadata: more than one user defined class with identical type names.");
            }

            stuff.Add(domPath.TypeName.Raw);
            domPaths.Add(fullPath, domPath);
            return(domPath);
        }
예제 #8
0
        public Property ToProperty(IRepository repository, IFactory factory)
        {
            var split    = DomPath.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
            var domPath  = factory.GetOrCreateDomPath(split[0], int.Parse(split[1]));
            var property = factory.CreateProperty(domPath, HasHadNonEmptyValue);

            property.CustomName = CustomName;

            property.InitializeDefaultPropertyDefinitionSet(
                propertyDefinitions =>
                propertyDefinitions.Append(DefaultPropertyDefinitionSet.PropertyDefinitions.Select(x => x.ToPropertyDefinition(repository, factory))));

            foreach (var proxySet in ExtraPropertyDefinitionSets)
            {
                var set = proxySet.ToPropertyDefinitionSet(repository, factory);
                property.AddOrUpdateExtraPropertyDefinitionSet(set);
            }

            return(property);
        }
예제 #9
0
        public DomPath GetOrCreateDomPath(string fullPath)
        {
            if (domPaths.ContainsKey(fullPath))
            {
                return(domPaths[fullPath]);
            }

            for (int i = 0;; i++)
            {
                var domPath = new DomPath(fullPath, i);
                if (!stuff.Contains(domPath.TypeName.Raw))
                {
                    stuff.Add(domPath.TypeName.Raw);
                    domPaths.Add(fullPath, domPath);
                    return(domPath);
                }
            }

            // If there is one that exists with the given fullPath, return it.
            // Start with a depth of zero.
            //     If there is not one that exists at the current depth, create and return one at that depth
            //     Increment depth
        }
예제 #10
0
 public Property CreateProperty(DomPath domPath, bool isNonEmpty)
 {
     return(new Property(domPath, isNonEmpty, this));
 }
예제 #11
0
 protected bool Equals(DomPath other)
 {
     return(_hashCode == other._hashCode);
 }
예제 #12
0
 public UserDefinedClass GetOrAdd(DomPath path)
 {
     return(_classes.GetOrAdd(
                path,
                x => new UserDefinedClass(x)));
 }
예제 #13
0
 public UserDefinedClass(DomPath domPath)
 {
     _domPath = domPath;
     _order = _orderSeed++;
 }
예제 #14
0
 public UserDefinedClass(DomPath domPath)
 {
     _domPath = domPath;
     _order   = _orderSeed++;
 }
예제 #15
0
        public DomPath GetOrCreateDomPath(string fullPath)
        {
            if (domPaths.ContainsKey(fullPath))
            {
                return domPaths[fullPath];
            }

            for (int i = 0;; i++)
            {
                var domPath = new DomPath(fullPath, i);
                if (!stuff.Contains(domPath.TypeName.Raw))
                {
                    stuff.Add(domPath.TypeName.Raw);
                    domPaths.Add(fullPath, domPath);
                    return domPath;
                }
            }

            // If there is one that exists with the given fullPath, return it.
            // Start with a depth of zero.
            //     If there is not one that exists at the current depth, create and return one at that depth
            //     Increment depth
        }
예제 #16
0
        public DomPath GetOrCreateDomPath(string fullPath, int typeNameDepth)
        {
            if (domPaths.ContainsKey(fullPath))
            {
                return domPaths[fullPath];
            }

            var domPath = new DomPath(fullPath, typeNameDepth);
            if (stuff.Contains(domPath.TypeName.Raw))
            {
                throw new InvalidOperationException("Invalid metadata: more than one user defined class with identical type names.");
            }

            stuff.Add(domPath.TypeName.Raw);
            domPaths.Add(fullPath, domPath);
            return domPath;
        }
예제 #17
0
 public Property CreateProperty(DomPath domPath, bool isNonEmpty)
 {
     return new Property(domPath, isNonEmpty, this);
 }
예제 #18
0
 public UserDefinedClass GetOrAdd(DomPath path)
 {
     return _classes.GetOrAdd(
         path,
         x => new UserDefinedClass(x));
 }
예제 #19
0
 public UserDefinedClass GetOrAdd(DomPath path, out bool isNew)
 {
     var isNewClass = false;
     var @class = _classes.GetOrAdd(
         path,
         x =>
         {
             isNewClass = true;
             return new UserDefinedClass(x);
         });
     isNew = isNewClass;
     return @class;
 }
예제 #20
0
 protected bool Equals(DomPath other)
 {
     return _hashCode == other._hashCode;
 }