Skip to content

Commit 7d00aa7

Browse files
committed
mark in comment the Equals, ToString and GetHashCode of more methods of graph
1 parent fadef82 commit 7d00aa7

File tree

3 files changed

+85
-82
lines changed

3 files changed

+85
-82
lines changed

src/NRedisStack/Graph/Header.cs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,31 @@ internal Header(RedisResult result)
4141
}
4242
}
4343

44-
public override bool Equals(object? obj)
45-
{
46-
if (obj == null) return this == null;
44+
// TODO: check if this is needed:
45+
// public override bool Equals(object? obj)
46+
// {
47+
// if (obj == null) return this == null;
4748

48-
if (this == obj)
49-
{
50-
return true;
51-
}
49+
// if (this == obj)
50+
// {
51+
// return true;
52+
// }
5253

53-
var header = obj as Header;
54+
// var header = obj as Header;
5455

55-
if (header is null)
56-
{
57-
return false;
58-
}
56+
// if (header is null)
57+
// {
58+
// return false;
59+
// }
5960

60-
return Object.Equals(SchemaTypes, header.SchemaTypes)
61-
&& Object.Equals(SchemaNames, header.SchemaNames);
62-
}
61+
// return Object.Equals(SchemaTypes, header.SchemaTypes)
62+
// && Object.Equals(SchemaNames, header.SchemaNames);
63+
// }
6364

64-
public override int GetHashCode()
65-
{
66-
return HashCode.Combine(SchemaTypes, SchemaNames);
67-
}
65+
// public override int GetHashCode()
66+
// {
67+
// return HashCode.Combine(SchemaTypes, SchemaNames);
68+
// }
6869

6970
public override string ToString() =>
7071
$"Header{{schemaTypes=[{string.Join(", ", SchemaTypes)}], schemaNames=[{string.Join(", ", SchemaNames)}]}}";

src/NRedisStack/Graph/Point.cs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,22 @@ public Point(List<double> values)
2323
this.longitude = values[1];
2424
}
2525

26-
public override bool Equals(object? obj)
27-
{
28-
if (obj == null) return this == null;
29-
30-
if (this == obj) return true;
31-
if (!(obj.GetType() == typeof(Point))) return false;
32-
Point o = (Point)obj;
33-
return Math.Abs(latitude - o.latitude) < EPSILON &&
34-
Math.Abs(longitude - o.longitude) < EPSILON;
35-
}
36-
37-
public override int GetHashCode()
38-
{
39-
return latitude.GetHashCode() ^ longitude.GetHashCode();
40-
}
26+
// TODO: check if this is needed:
27+
// public override bool Equals(object? obj)
28+
// {
29+
// if (obj == null) return this == null;
30+
31+
// if (this == obj) return true;
32+
// if (!(obj.GetType() == typeof(Point))) return false;
33+
// Point o = (Point)obj;
34+
// return Math.Abs(latitude - o.latitude) < EPSILON &&
35+
// Math.Abs(longitude - o.longitude) < EPSILON;
36+
// }
37+
38+
// public override int GetHashCode()
39+
// {
40+
// return latitude.GetHashCode() ^ longitude.GetHashCode();
41+
// }
4142

4243

4344
public override string ToString()

src/NRedisStack/Graph/Record.cs

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -58,53 +58,54 @@ internal Record(List<string> header, List<object> values)
5858
/// </summary>
5959
public int Size => Header.Count;
6060

61-
public override bool Equals(object? obj)
62-
{
63-
if (obj == null) return this == null;
64-
65-
if (this == obj)
66-
{
67-
return true;
68-
}
69-
70-
if (!(obj is Record that))
71-
{
72-
return false;
73-
}
74-
75-
return Enumerable.SequenceEqual(Header, that.Header) && Enumerable.SequenceEqual(Values, that.Values);
76-
}
77-
78-
/// <summary>
79-
/// Overridden method that generates a hash code based on the hash codes of the keys and values.
80-
/// </summary>
81-
/// <returns></returns>
82-
public override int GetHashCode()
83-
{
84-
unchecked
85-
{
86-
int hash = 17;
87-
88-
hash = hash * 31 + Header.GetHashCode();
89-
hash = hash * 31 + Values.GetHashCode();
90-
91-
return hash;
92-
}
93-
}
94-
95-
/// <summary>
96-
/// Overridden method that emits a string of representing all of the values in a record.
97-
/// </summary>
98-
/// <returns></returns>
99-
public override string ToString()
100-
{
101-
var sb = new StringBuilder();
102-
103-
sb.Append("Record{values=");
104-
sb.Append(string.Join(",", Values));
105-
sb.Append('}');
106-
107-
return sb.ToString();
108-
}
61+
// TODO: check if this is needed:
62+
// public override bool Equals(object? obj)
63+
// {
64+
// if (obj == null) return this == null;
65+
66+
// if (this == obj)
67+
// {
68+
// return true;
69+
// }
70+
71+
// if (!(obj is Record that))
72+
// {
73+
// return false;
74+
// }
75+
76+
// return Enumerable.SequenceEqual(Header, that.Header) && Enumerable.SequenceEqual(Values, that.Values);
77+
// }
78+
79+
// /// <summary>
80+
// /// Overridden method that generates a hash code based on the hash codes of the keys and values.
81+
// /// </summary>
82+
// /// <returns></returns>
83+
// public override int GetHashCode()
84+
// {
85+
// unchecked
86+
// {
87+
// int hash = 17;
88+
89+
// hash = hash * 31 + Header.GetHashCode();
90+
// hash = hash * 31 + Values.GetHashCode();
91+
92+
// return hash;
93+
// }
94+
// }
95+
96+
// /// <summary>
97+
// /// Overridden method that emits a string of representing all of the values in a record.
98+
// /// </summary>
99+
// /// <returns></returns>
100+
// public override string ToString()
101+
// {
102+
// var sb = new StringBuilder();
103+
104+
// sb.Append("Record{values=");
105+
// sb.Append(string.Join(",", Values));
106+
// sb.Append('}');
107+
108+
// return sb.ToString();
109+
// }
109110
}
110111
}

0 commit comments

Comments
 (0)