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,
17 string className,
18 MethodModel[] methods,
19 string apiName,
20 bool constructorPrivate,
21 Diagnostic[] diagnostics)
22 {
23 Namespace = ns;
24 ClassName = className;
25 Methods = methods;
26 ApiName = apiName;
27 ConstructorPrivate = constructorPrivate;
28 Diagnostics = diagnostics;
29 }
30
31 public bool Equals(ApiModel other)
32 {
33 return Namespace == other.Namespace &&
34 ClassName == other.ClassName &&
35 ApiName == other.ApiName &&
36 Methods.Equals(other.Methods) &&
37 ConstructorPrivate == other.ConstructorPrivate &&
38 Diagnostics.Equals(other.Diagnostics);
39 }
40
41 public override bool Equals(object? obj)
42 {
43 return obj is ApiModel other && Equals(other);
44 }
45
46 public override int GetHashCode()
47 {
48 unchecked
49 {
50 int hashCode = Namespace.GetHashCode();
51 hashCode = (hashCode * 397) ^ ClassName.GetHashCode();
52 hashCode = (hashCode * 397) ^ ApiName.GetHashCode();
53 hashCode = (hashCode * 397) ^ Methods.GetHashCode();
54 hashCode = (hashCode * 397) ^ ConstructorPrivate.GetHashCode();
55 hashCode = (hashCode * 397) ^ Diagnostics.GetHashCode();
56
57 return hashCode;
58 }
59 }
60
61 public static bool operator ==(ApiModel left, ApiModel right)
62 {
63 return left.Equals(right);
64 }
65
66 public static bool operator !=(ApiModel left, ApiModel right)
67 {
68 return !left.Equals(right);
69 }
70}
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:66
static bool operator==(ApiModel left, ApiModel right)
Definition ApiModel.cs:61
override bool Equals(object? obj)
Definition ApiModel.cs:41