-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathStruct.cs
More file actions
81 lines (66 loc) · 2.51 KB
/
Struct.cs
File metadata and controls
81 lines (66 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using System.Collections.Generic;
using System.Linq;
using ArchUnitNET.Domain.Dependencies;
using ArchUnitNET.Domain.Extensions;
using JetBrains.Annotations;
namespace ArchUnitNET.Domain
{
public class Struct : IType
{
public Struct(IType type)
{
Type = type;
}
public IType Type { get; }
public string Name => Type.Name;
public string FullName => Type.FullName;
public string AssemblyQualifiedName => Type.AssemblyQualifiedName;
[CanBeNull]
public Class BaseClass =>
(Class)Dependencies.OfType<InheritsBaseClassDependency>().FirstOrDefault()?.Target;
public IEnumerable<Class> InheritedClasses =>
BaseClass == null
? Enumerable.Empty<Class>()
: BaseClass.InheritedClasses.Concat(new[] { BaseClass });
public Visibility Visibility => Type.Visibility;
public bool IsNested => Type.IsNested;
public bool IsGeneric => Type.IsGeneric;
public bool IsGenericParameter => Type.IsGenericParameter;
public bool IsStub => Type.IsStub;
public bool IsCompilerGenerated => Type.IsCompilerGenerated;
public Namespace Namespace => Type.Namespace;
public Assembly Assembly => Type.Assembly;
public IEnumerable<Attribute> Attributes =>
AttributeInstances.Select(instance => instance.Type);
public List<AttributeInstance> AttributeInstances => Type.AttributeInstances;
public List<ITypeDependency> Dependencies => Type.Dependencies;
public List<ITypeDependency> BackwardsDependencies => Type.BackwardsDependencies;
public IEnumerable<IType> ImplementedInterfaces => Type.ImplementedInterfaces;
public MemberList Members => Type.Members;
public List<GenericParameter> GenericParameters => Type.GenericParameters;
public override string ToString()
{
return FullName;
}
private bool Equals(Struct other)
{
return Equals(Type, other.Type);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
if (ReferenceEquals(this, obj))
{
return true;
}
return obj.GetType() == GetType() && Equals((Struct)obj);
}
public override int GetHashCode()
{
return Type != null ? Type.GetHashCode() : 0;
}
}
}