コード例 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(("UserDefinedClass".GetHashCode() * 397) ^ DomPath.GetHashCode());
     }
 }
コード例 #2
0
ファイル: Property.cs プロジェクト: sethkontny/CSharpinator
 public Property(DomPath domPath, bool isNonEmpty, IFactory factory)
 {
     HasHadNonEmptyValue |= isNonEmpty;
     _defaultPropertyDefinitionSet = new Lazy<PropertyDefinitionSet>(CreateDefaultPropertyDefinitionSet);
     _domPath = domPath;
     _factory = factory;
 }
コード例 #3
0
ファイル: Property.cs プロジェクト: sethkontny/CSharpinator
 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
ファイル: Repository.cs プロジェクト: sethkontny/CSharpinator
        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
ファイル: Factory.cs プロジェクト: sethkontny/CSharpinator
        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
ファイル: Factory.cs プロジェクト: sethkontny/CSharpinator
        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
ファイル: Factory.cs プロジェクト: sethkontny/CSharpinator
 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
ファイル: Repository.cs プロジェクト: sethkontny/CSharpinator
 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
ファイル: Factory.cs プロジェクト: sethkontny/CSharpinator
        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
ファイル: Factory.cs プロジェクト: sethkontny/CSharpinator
        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
ファイル: Factory.cs プロジェクト: sethkontny/CSharpinator
 public Property CreateProperty(DomPath domPath, bool isNonEmpty)
 {
     return new Property(domPath, isNonEmpty, this);
 }
コード例 #18
0
ファイル: Repository.cs プロジェクト: sethkontny/CSharpinator
 public UserDefinedClass GetOrAdd(DomPath path)
 {
     return _classes.GetOrAdd(
         path,
         x => new UserDefinedClass(x));
 }
コード例 #19
0
ファイル: Repository.cs プロジェクト: sethkontny/CSharpinator
 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
ファイル: DomPath.cs プロジェクト: sethkontny/CSharpinator
 protected bool Equals(DomPath other)
 {
     return _hashCode == other._hashCode;
 }