Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
0c87e944
Commit
0c87e944
authored
Mar 11, 2018
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: Geo
parent
d8b3a589
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
53 deletions
+45
-53
GeoEntry.cs
StackExchange.Redis/StackExchange/Redis/GeoEntry.cs
+45
-53
No files found.
StackExchange.Redis/StackExchange/Redis/GeoEntry.cs
View file @
0c87e944
using
System
;
using
System
;
namespace
StackExchange.Redis
namespace
StackExchange.Redis
...
@@ -40,12 +39,12 @@ public struct GeoRadiusResult
...
@@ -40,12 +39,12 @@ public struct GeoRadiusResult
/// Indicate the member being represented
/// Indicate the member being represented
/// </summary>
/// </summary>
public
override
string
ToString
()
=>
Member
.
ToString
();
public
override
string
ToString
()
=>
Member
.
ToString
();
/// <summary>
/// <summary>
/// The matched member.
/// The matched member.
/// </summary>
/// </summary>
public
RedisValue
Member
{
get
;
}
public
RedisValue
Member
{
get
;
}
/// <summary>
/// <summary>
/// The distance of the matched member from the center of the geo radius command.
/// The distance of the matched member from the center of the geo radius command.
/// </summary>
/// </summary>
...
@@ -65,6 +64,10 @@ public struct GeoRadiusResult
...
@@ -65,6 +64,10 @@ public struct GeoRadiusResult
/// <summary>
/// <summary>
/// Returns a new GeoRadiusResult
/// Returns a new GeoRadiusResult
/// </summary>
/// </summary>
/// <param name="member">The value from the result.</param>
/// <param name="distance">Tthe distance from the result.</param>
/// <param name="hash">The hash of the result.</param>
/// <param name="position">The geo position of the result.</param>
internal
GeoRadiusResult
(
RedisValue
member
,
double
?
distance
,
long
?
hash
,
GeoPosition
?
position
)
internal
GeoRadiusResult
(
RedisValue
member
,
double
?
distance
,
long
?
hash
,
GeoPosition
?
position
)
{
{
Member
=
member
;
Member
=
member
;
...
@@ -116,47 +119,42 @@ public GeoPosition(double longitude, double latitude)
...
@@ -116,47 +119,42 @@ public GeoPosition(double longitude, double latitude)
/// <summary>
/// <summary>
/// See Object.ToString()
/// See Object.ToString()
/// </summary>
/// </summary>
public
override
string
ToString
()
public
override
string
ToString
()
=>
string
.
Format
(
"{0} {1}"
,
Longitude
,
Latitude
);
{
return
string
.
Format
(
"{0} {1}"
,
Longitude
,
Latitude
);
}
/// <summary>
/// <summary>
/// See Object.GetHashCode()
/// See Object.GetHashCode()
/// Diagonals not an issue in the case of lat/long
/// Diagonals not an issue in the case of lat/long
/// </summary>
/// </summary>
public
override
int
GetHashCode
()
/// <remarks>
{
/// Diagonals are not an issue in the case of lat/long.
// diagonals not an issue in the case of lat/long
/// </remarks>
return
Longitude
.
GetHashCode
()
^
Latitude
.
GetHashCode
();
public
override
int
GetHashCode
()
=>
Longitude
.
GetHashCode
()
^
Latitude
.
GetHashCode
();
}
/// <summary>
/// <summary>
/// Compares two values for equality
/// Compares two values for equality
/// </summary>
/// </summary>
public
override
bool
Equals
(
object
obj
)
/// <param name="obj">The <see cref="GeoPosition"/> to compare to.</param>
{
public
override
bool
Equals
(
object
obj
)
=>
obj
is
GeoPosition
gpObj
&&
Equals
(
gpObj
);
return
obj
is
GeoPosition
&&
Equals
((
GeoPosition
)
obj
);
}
/// <summary>
/// <summary>
/// Compares two values for equality
/// Compares two values for equality
/// </summary>
/// </summary>
public
bool
Equals
(
GeoPosition
other
)
/// <param name="other">The <see cref="GeoPosition"/> to compare to.</param>
{
public
bool
Equals
(
GeoPosition
other
)
=>
this
==
other
;
return
this
==
other
;
}
/// <summary>
/// <summary>
/// Compares two values for equality
/// Compares two values for equality
/// </summary>
/// </summary>
public
static
bool
operator
==(
GeoPosition
x
,
GeoPosition
y
)
/// <param name="x">The first position to compare.</param>
{
/// <param name="y">The second position to compare.</param>
return
x
.
Longitude
==
y
.
Longitude
&&
x
.
Latitude
==
y
.
Latitude
;
public
static
bool
operator
==(
GeoPosition
x
,
GeoPosition
y
)
=>
x
.
Longitude
==
y
.
Longitude
&&
x
.
Latitude
==
y
.
Latitude
;
}
/// <summary>
/// <summary>
/// Compares two values for non-equality
/// Compares two values for non-equality
/// </summary>
/// </summary>
public
static
bool
operator
!=(
GeoPosition
x
,
GeoPosition
y
)
/// <param name="x">The first position to compare.</param>
{
/// <param name="y">The second position to compare.</param>
return
x
.
Longitude
!=
y
.
Longitude
||
x
.
Latitude
!=
y
.
Latitude
;
public
static
bool
operator
!=(
GeoPosition
x
,
GeoPosition
y
)
=>
x
.
Longitude
!=
y
.
Longitude
||
x
.
Latitude
!=
y
.
Latitude
;
}
}
}
/// <summary>
/// <summary>
...
@@ -178,14 +176,15 @@ public struct GeoEntry : IEquatable<GeoEntry>
...
@@ -178,14 +176,15 @@ public struct GeoEntry : IEquatable<GeoEntry>
/// <summary>
/// <summary>
/// Initializes a GeoEntry value
/// Initializes a GeoEntry value
/// </summary>
/// </summary>
/// <param name="longitude">The longitude position to use.</param>
/// <param name="latitude">The latitude position to use.</param>
/// <param name="member">The value to store for this position.</param>
public
GeoEntry
(
double
longitude
,
double
latitude
,
RedisValue
member
)
public
GeoEntry
(
double
longitude
,
double
latitude
,
RedisValue
member
)
{
{
Member
=
member
;
Member
=
member
;
Position
=
new
GeoPosition
(
longitude
,
latitude
);
Position
=
new
GeoPosition
(
longitude
,
latitude
);
}
}
/// <summary>
/// <summary>
/// The longitude of the geo entry
/// The longitude of the geo entry
/// </summary>
/// </summary>
...
@@ -199,44 +198,37 @@ public GeoEntry(double longitude, double latitude, RedisValue member)
...
@@ -199,44 +198,37 @@ public GeoEntry(double longitude, double latitude, RedisValue member)
/// <summary>
/// <summary>
/// See Object.ToString()
/// See Object.ToString()
/// </summary>
/// </summary>
public
override
string
ToString
()
public
override
string
ToString
()
=>
$"(
{
Longitude
}
,
{
Latitude
}
)=
{
Member
}
"
;
{
return
$"(
{
Longitude
}
,
{
Latitude
}
)=
{
Member
}
"
;
}
/// <summary>
/// <summary>
/// See Object.GetHashCode()
/// See Object.GetHashCode()
/// </summary>
/// </summary>
public
override
int
GetHashCode
()
public
override
int
GetHashCode
()
=>
Position
.
GetHashCode
()
^
Member
.
GetHashCode
();
{
return
Position
.
GetHashCode
()
^
Member
.
GetHashCode
();
}
/// <summary>
/// <summary>
/// Compares two values for equality
/// Compares two values for equality
/// </summary>
/// </summary>
public
override
bool
Equals
(
object
obj
)
/// <param name="obj">The <see cref="GeoEntry"/> to compare to.</param>
{
public
override
bool
Equals
(
object
obj
)
=>
obj
is
GeoEntry
geObj
&&
Equals
(
geObj
);
return
obj
is
GeoEntry
&&
Equals
((
GeoEntry
)
obj
);
}
/// <summary>
/// <summary>
/// Compares two values for equality
/// Compares two values for equality
/// </summary>
/// </summary>
public
bool
Equals
(
GeoEntry
other
)
/// <param name="other">The <see cref="GeoEntry"/> to compare to.</param>
{
public
bool
Equals
(
GeoEntry
other
)
=>
this
==
other
;
return
this
==
other
;
}
/// <summary>
/// <summary>
/// Compares two values for equality
/// Compares two values for equality
/// </summary>
/// </summary>
public
static
bool
operator
==(
GeoEntry
x
,
GeoEntry
y
)
/// <param name="x">The first entry to compare.</param>
{
/// <param name="y">The second entry to compare.</param>
return
x
.
Position
==
y
.
Position
&&
x
.
Member
==
y
.
Member
;
public
static
bool
operator
==(
GeoEntry
x
,
GeoEntry
y
)
=>
x
.
Position
==
y
.
Position
&&
x
.
Member
==
y
.
Member
;
}
/// <summary>
/// <summary>
/// Compares two values for non-equality
/// Compares two values for non-equality
/// </summary>
/// </summary>
public
static
bool
operator
!=(
GeoEntry
x
,
GeoEntry
y
)
/// <param name="x">The first entry to compare.</param>
{
/// <param name="y">The second entry to compare.</param>
return
x
.
Position
!=
y
.
Position
||
x
.
Member
!=
y
.
Member
;
public
static
bool
operator
!=(
GeoEntry
x
,
GeoEntry
y
)
=>
x
.
Position
!=
y
.
Position
||
x
.
Member
!=
y
.
Member
;
}
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment