Skip to content

Commit 3dae38a

Browse files
committed
Removed extra usings and file scoped namespaces
1 parent 9901603 commit 3dae38a

75 files changed

Lines changed: 6373 additions & 6561 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Geocoding.Core/Address.cs

Lines changed: 78 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,100 @@
1-
using System;
1+
namespace Geocoding;
22

3-
namespace Geocoding
3+
/// <summary>
4+
/// Most basic and generic form of address.
5+
/// Just the full address string and a lat/long
6+
/// </summary>
7+
public abstract class Address
48
{
9+
string formattedAddress = string.Empty;
10+
Location coordinates;
11+
string provider = string.Empty;
12+
513
/// <summary>
6-
/// Most basic and generic form of address.
7-
/// Just the full address string and a lat/long
14+
/// Initializes a new address instance.
815
/// </summary>
9-
public abstract class Address
16+
/// <param name="formattedAddress">The provider formatted address string.</param>
17+
/// <param name="coordinates">The geocoded coordinates.</param>
18+
/// <param name="provider">The provider name that produced this address.</param>
19+
public Address(string formattedAddress, Location coordinates, string provider)
1020
{
11-
string formattedAddress = string.Empty;
12-
Location coordinates;
13-
string provider = string.Empty;
14-
15-
/// <summary>
16-
/// Initializes a new address instance.
17-
/// </summary>
18-
/// <param name="formattedAddress">The provider formatted address string.</param>
19-
/// <param name="coordinates">The geocoded coordinates.</param>
20-
/// <param name="provider">The provider name that produced this address.</param>
21-
public Address(string formattedAddress, Location coordinates, string provider)
22-
{
23-
FormattedAddress = formattedAddress;
24-
Coordinates = coordinates;
25-
Provider = provider;
26-
}
21+
FormattedAddress = formattedAddress;
22+
Coordinates = coordinates;
23+
Provider = provider;
24+
}
2725

28-
/// <summary>
29-
/// Gets or sets the full formatted address.
30-
/// </summary>
31-
public virtual string FormattedAddress
26+
/// <summary>
27+
/// Gets or sets the full formatted address.
28+
/// </summary>
29+
public virtual string FormattedAddress
30+
{
31+
get { return formattedAddress; }
32+
set
3233
{
33-
get { return formattedAddress; }
34-
set
35-
{
36-
if (string.IsNullOrWhiteSpace(value))
37-
throw new ArgumentException("FormattedAddress is null or blank");
34+
if (string.IsNullOrWhiteSpace(value))
35+
throw new ArgumentException("FormattedAddress is null or blank");
3836

39-
formattedAddress = value.Trim();
40-
}
37+
formattedAddress = value.Trim();
4138
}
39+
}
4240

43-
/// <summary>
44-
/// Gets or sets the latitude and longitude for this address.
45-
/// </summary>
46-
public virtual Location Coordinates
41+
/// <summary>
42+
/// Gets or sets the latitude and longitude for this address.
43+
/// </summary>
44+
public virtual Location Coordinates
45+
{
46+
get { return coordinates; }
47+
set
4748
{
48-
get { return coordinates; }
49-
set
50-
{
51-
if (value == null)
52-
throw new ArgumentNullException("Coordinates");
49+
if (value == null)
50+
throw new ArgumentNullException("Coordinates");
5351

54-
coordinates = value;
55-
}
52+
coordinates = value;
5653
}
54+
}
5755

58-
/// <summary>
59-
/// Gets the provider name for this address.
60-
/// </summary>
61-
public virtual string Provider
56+
/// <summary>
57+
/// Gets the provider name for this address.
58+
/// </summary>
59+
public virtual string Provider
60+
{
61+
get { return provider; }
62+
protected set
6263
{
63-
get { return provider; }
64-
protected set
65-
{
66-
if (string.IsNullOrWhiteSpace(value))
67-
throw new ArgumentException("Provider can not be null or blank");
64+
if (string.IsNullOrWhiteSpace(value))
65+
throw new ArgumentException("Provider can not be null or blank");
6866

69-
provider = value;
70-
}
67+
provider = value;
7168
}
69+
}
7270

73-
/// <summary>
74-
/// Calculates the distance from this address to another address in miles.
75-
/// </summary>
76-
/// <param name="address">The destination address.</param>
77-
/// <returns>The distance between the two addresses.</returns>
78-
public virtual Distance DistanceBetween(Address address)
79-
{
80-
return this.Coordinates.DistanceBetween(address.Coordinates);
81-
}
71+
/// <summary>
72+
/// Calculates the distance from this address to another address in miles.
73+
/// </summary>
74+
/// <param name="address">The destination address.</param>
75+
/// <returns>The distance between the two addresses.</returns>
76+
public virtual Distance DistanceBetween(Address address)
77+
{
78+
return this.Coordinates.DistanceBetween(address.Coordinates);
79+
}
8280

83-
/// <summary>
84-
/// Calculates the distance from this address to another address.
85-
/// </summary>
86-
/// <param name="address">The destination address.</param>
87-
/// <param name="units">The unit to return the distance in.</param>
88-
/// <returns>The distance between the two addresses.</returns>
89-
public virtual Distance DistanceBetween(Address address, DistanceUnits units)
90-
{
91-
return this.Coordinates.DistanceBetween(address.Coordinates, units);
92-
}
81+
/// <summary>
82+
/// Calculates the distance from this address to another address.
83+
/// </summary>
84+
/// <param name="address">The destination address.</param>
85+
/// <param name="units">The unit to return the distance in.</param>
86+
/// <returns>The distance between the two addresses.</returns>
87+
public virtual Distance DistanceBetween(Address address, DistanceUnits units)
88+
{
89+
return this.Coordinates.DistanceBetween(address.Coordinates, units);
90+
}
9391

94-
/// <summary>
95-
/// Returns the formatted address.
96-
/// </summary>
97-
/// <returns>The formatted address.</returns>
98-
public override string ToString()
99-
{
100-
return FormattedAddress;
101-
}
92+
/// <summary>
93+
/// Returns the formatted address.
94+
/// </summary>
95+
/// <returns>The formatted address.</returns>
96+
public override string ToString()
97+
{
98+
return FormattedAddress;
10299
}
103100
}

src/Geocoding.Core/Bounds.cs

Lines changed: 82 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,100 @@
11
using Newtonsoft.Json;
2-
using System;
32

4-
namespace Geocoding
3+
namespace Geocoding;
4+
5+
/// <summary>
6+
/// Represents a rectangular viewport defined by southwest and northeast coordinates.
7+
/// </summary>
8+
public class Bounds
59
{
10+
readonly Location southWest;
11+
readonly Location northEast;
12+
613
/// <summary>
7-
/// Represents a rectangular viewport defined by southwest and northeast coordinates.
14+
/// Gets the southwest corner.
815
/// </summary>
9-
public class Bounds
16+
public Location SouthWest
1017
{
11-
readonly Location southWest;
12-
readonly Location northEast;
13-
14-
/// <summary>
15-
/// Gets the southwest corner.
16-
/// </summary>
17-
public Location SouthWest
18-
{
19-
get { return southWest; }
20-
}
18+
get { return southWest; }
19+
}
2120

22-
/// <summary>
23-
/// Gets the northeast corner.
24-
/// </summary>
25-
public Location NorthEast
26-
{
27-
get { return northEast; }
28-
}
21+
/// <summary>
22+
/// Gets the northeast corner.
23+
/// </summary>
24+
public Location NorthEast
25+
{
26+
get { return northEast; }
27+
}
2928

30-
/// <summary>
31-
/// Initializes bounds from raw latitude and longitude values.
32-
/// </summary>
33-
/// <param name="southWestLatitude">The southwest latitude.</param>
34-
/// <param name="southWestLongitude">The southwest longitude.</param>
35-
/// <param name="northEastLatitude">The northeast latitude.</param>
36-
/// <param name="northEastLongitude">The northeast longitude.</param>
37-
public Bounds(double southWestLatitude, double southWestLongitude, double northEastLatitude, double northEastLongitude)
38-
: this(new Location(southWestLatitude, southWestLongitude), new Location(northEastLatitude, northEastLongitude)) { }
29+
/// <summary>
30+
/// Initializes bounds from raw latitude and longitude values.
31+
/// </summary>
32+
/// <param name="southWestLatitude">The southwest latitude.</param>
33+
/// <param name="southWestLongitude">The southwest longitude.</param>
34+
/// <param name="northEastLatitude">The northeast latitude.</param>
35+
/// <param name="northEastLongitude">The northeast longitude.</param>
36+
public Bounds(double southWestLatitude, double southWestLongitude, double northEastLatitude, double northEastLongitude)
37+
: this(new Location(southWestLatitude, southWestLongitude), new Location(northEastLatitude, northEastLongitude)) { }
3938

40-
/// <summary>
41-
/// Initializes bounds from two corner locations.
42-
/// </summary>
43-
/// <param name="southWest">The southwest corner.</param>
44-
/// <param name="northEast">The northeast corner.</param>
45-
[JsonConstructor]
46-
public Bounds(Location southWest, Location northEast)
47-
{
48-
if (southWest == null)
49-
throw new ArgumentNullException("southWest");
39+
/// <summary>
40+
/// Initializes bounds from two corner locations.
41+
/// </summary>
42+
/// <param name="southWest">The southwest corner.</param>
43+
/// <param name="northEast">The northeast corner.</param>
44+
[JsonConstructor]
45+
public Bounds(Location southWest, Location northEast)
46+
{
47+
if (southWest == null)
48+
throw new ArgumentNullException("southWest");
5049

51-
if (northEast == null)
52-
throw new ArgumentNullException("northEast");
50+
if (northEast == null)
51+
throw new ArgumentNullException("northEast");
5352

54-
if (southWest.Latitude > northEast.Latitude)
55-
throw new ArgumentException("southWest latitude cannot be greater than northEast latitude");
53+
if (southWest.Latitude > northEast.Latitude)
54+
throw new ArgumentException("southWest latitude cannot be greater than northEast latitude");
5655

57-
this.southWest = southWest;
58-
this.northEast = northEast;
59-
}
56+
this.southWest = southWest;
57+
this.northEast = northEast;
58+
}
6059

61-
/// <summary>
62-
/// Determines whether the specified object is equal to the current bounds.
63-
/// </summary>
64-
/// <param name="obj">The object to compare.</param>
65-
/// <returns><c>true</c> when equal; otherwise <c>false</c>.</returns>
66-
public override bool Equals(object obj)
67-
{
68-
return Equals(obj as Bounds);
69-
}
60+
/// <summary>
61+
/// Determines whether the specified object is equal to the current bounds.
62+
/// </summary>
63+
/// <param name="obj">The object to compare.</param>
64+
/// <returns><c>true</c> when equal; otherwise <c>false</c>.</returns>
65+
public override bool Equals(object obj)
66+
{
67+
return Equals(obj as Bounds);
68+
}
7069

71-
/// <summary>
72-
/// Determines whether another bounds instance is equal to the current one.
73-
/// </summary>
74-
/// <param name="bounds">The other bounds instance.</param>
75-
/// <returns><c>true</c> when equal; otherwise <c>false</c>.</returns>
76-
public bool Equals(Bounds bounds)
77-
{
78-
if (bounds == null)
79-
return false;
70+
/// <summary>
71+
/// Determines whether another bounds instance is equal to the current one.
72+
/// </summary>
73+
/// <param name="bounds">The other bounds instance.</param>
74+
/// <returns><c>true</c> when equal; otherwise <c>false</c>.</returns>
75+
public bool Equals(Bounds bounds)
76+
{
77+
if (bounds == null)
78+
return false;
8079

81-
return (this.SouthWest.Equals(bounds.SouthWest) && this.NorthEast.Equals(bounds.NorthEast));
82-
}
80+
return (this.SouthWest.Equals(bounds.SouthWest) && this.NorthEast.Equals(bounds.NorthEast));
81+
}
8382

84-
/// <summary>
85-
/// Returns a hash code for the current bounds.
86-
/// </summary>
87-
/// <returns>A hash code for the current bounds.</returns>
88-
public override int GetHashCode()
89-
{
90-
return SouthWest.GetHashCode() ^ NorthEast.GetHashCode();
91-
}
83+
/// <summary>
84+
/// Returns a hash code for the current bounds.
85+
/// </summary>
86+
/// <returns>A hash code for the current bounds.</returns>
87+
public override int GetHashCode()
88+
{
89+
return SouthWest.GetHashCode() ^ NorthEast.GetHashCode();
90+
}
9291

93-
/// <summary>
94-
/// Returns a string representation of the bounds.
95-
/// </summary>
96-
/// <returns>A string representation of the bounds.</returns>
97-
public override string ToString()
98-
{
99-
return string.Format("{0} | {1}", southWest, northEast);
100-
}
92+
/// <summary>
93+
/// Returns a string representation of the bounds.
94+
/// </summary>
95+
/// <returns>A string representation of the bounds.</returns>
96+
public override string ToString()
97+
{
98+
return string.Format("{0} | {1}", southWest, northEast);
10199
}
102-
}
100+
}

0 commit comments

Comments
 (0)