BadScript 2
Loading...
Searching...
No Matches
ApiModel.cs
Go to the documentation of this file.
1using System;
2
3using Microsoft.CodeAnalysis;
4
6
7public readonly struct ApiModel : IEquatable<ApiModel>
8{
9 public readonly string Namespace;
10 public readonly string ClassName;
11 public readonly string ApiName;
12 public readonly MethodModel[] Methods;
13 public readonly bool ConstructorPrivate;
14 public readonly Diagnostic[] Diagnostics;
15
16 public ApiModel(string ns, string className, MethodModel[] methods, string apiName, bool constructorPrivate, Diagnostic[] diagnostics)
17 {
18 Namespace = ns;
19 ClassName = className;
20 Methods = methods;
21 ApiName = apiName;
22 ConstructorPrivate = constructorPrivate;
23 Diagnostics = diagnostics;
24 }
25
26 public bool Equals(ApiModel other)
27 {
28 return Namespace == other.Namespace &&
29 ClassName == other.ClassName &&
30 ApiName == other.ApiName &&
31 Methods.Equals(other.Methods) &&
32 ConstructorPrivate == other.ConstructorPrivate &&
33 Diagnostics.Equals(other.Diagnostics);
34 }
35
36 public override bool Equals(object? obj)
37 {
38 return obj is ApiModel other && Equals(other);
39 }
40
41 public override int GetHashCode()
42 {
43 unchecked
44 {
45 int hashCode = Namespace.GetHashCode();
46 hashCode = hashCode * 397 ^ ClassName.GetHashCode();
47 hashCode = hashCode * 397 ^ ApiName.GetHashCode();
48 hashCode = hashCode * 397 ^ Methods.GetHashCode();
49 hashCode = hashCode * 397 ^ ConstructorPrivate.GetHashCode();
50 hashCode = hashCode * 397 ^ Diagnostics.GetHashCode();
51
52 return hashCode;
53 }
54 }
55
56 public static bool operator ==(ApiModel left, ApiModel right)
57 {
58 return left.Equals(right);
59 }
60
61 public static bool operator !=(ApiModel left, ApiModel right)
62 {
63 return !left.Equals(right);
64 }
65}
ApiModel(string ns, string className, MethodModel[] methods, string apiName, bool constructorPrivate, Diagnostic[] diagnostics)
Definition ApiModel.cs:16
static bool operator!=(ApiModel left, ApiModel right)
Definition ApiModel.cs:61
static bool operator==(ApiModel left, ApiModel right)
Definition ApiModel.cs:56
override bool Equals(object? obj)
Definition ApiModel.cs:36