Skip to content

Commit

Permalink
Prefix local calls with this
Browse files Browse the repository at this point in the history
Code should not contain multiple blank lines in a row
  • Loading branch information
emmanuelmathot committed Feb 7, 2023
1 parent f7a3898 commit ac186ea
Show file tree
Hide file tree
Showing 49 changed files with 446 additions and 468 deletions.
4 changes: 2 additions & 2 deletions src/DotNetStac/Collection/StacExtent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public object Clone()

internal void Update(ICollection<StacItem> items)
{
Spatial = new StacSpatialExtent(items.Select(i => i.GetBoundingBoxFromGeometryExtent()[0])
this.Spatial = new StacSpatialExtent(items.Select(i => i.GetBoundingBoxFromGeometryExtent()[0])
.Concat(new double[] { this.Spatial.BoundingBoxes[0][0] })
.Min(),
items.Select(i => i.GetBoundingBoxFromGeometryExtent()[1])
Expand All @@ -93,7 +93,7 @@ internal void Update(ICollection<StacItem> items)
items.Select(i => i.GetBoundingBoxFromGeometryExtent()[3])
.Concat(new double[] { this.Spatial.BoundingBoxes[0][3] })
.Max());
Temporal = new StacTemporalExtent(items.Select(i => i.DateTime.Start)
this.Temporal = new StacTemporalExtent(items.Select(i => i.DateTime.Start)
.Concat(new DateTime[] { this.Temporal.Interval[0][0].GetValueOrDefault() })
.Min(),
items.Select(i => i.DateTime.End)
Expand Down
2 changes: 1 addition & 1 deletion src/DotNetStac/Collection/StacSpatialExtent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class StacSpatialExtent : ICloneable
[JsonConstructor]
public StacSpatialExtent(double minX, double minY, double maxX, double maxY)
{
BoundingBoxes = new double[1][] { new double[4] { minX, minY, maxX, maxY } };
this.BoundingBoxes = new double[1][] { new double[4] { minX, minY, maxX, maxY } };
}

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions src/DotNetStac/Collection/StacSummaryItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public JToken this[object key]
{
get
{
return summary[key];
return this.summary[key];
}
}

Expand All @@ -45,7 +45,7 @@ public JToken this[object key]
/// <value>
/// <placeholder>JToken transformer</placeholder>
/// </value>
public JToken AsJToken => summary;
public JToken AsJToken => this.summary;

/// <inheritdoc/>
public abstract IEnumerable<object> Enumerate();
Expand All @@ -56,12 +56,12 @@ public JToken this[object key]
/// <returns></returns>
public IEnumerator GetEnumerator()
{
return summary.Children().GetEnumerator();
return this.summary.Children().GetEnumerator();
}

IEnumerator<JToken> IEnumerable<JToken>.GetEnumerator()
{
return summary.Children().GetEnumerator();
return this.summary.Children().GetEnumerator();
}

}
Expand Down
10 changes: 5 additions & 5 deletions src/DotNetStac/Collection/StacSummaryRangeObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public StacSummaryRangeObject(JObject summary) : base(summary)
/// <returns></returns>
public StacSummaryRangeObject(T min, T max) : base(new JObject())
{
Min = min;
Max = max;
this.Min = min;
this.Max = max;
}

/// <summary>
Expand All @@ -45,7 +45,7 @@ public StacSummaryRangeObject(T min, T max) : base(new JObject())
/// <value>
/// <placeholder>Minimum of the range</placeholder>
/// </value>
public T Min { get => summary["minimum"].Value<T>(); set => summary["minimum"] = new JValue(value); }
public T Min { get => this.summary["minimum"].Value<T>(); set => this.summary["minimum"] = new JValue(value); }

/// <summary>
/// Maximum of the range
Expand All @@ -54,12 +54,12 @@ public StacSummaryRangeObject(T min, T max) : base(new JObject())
/// <value>
/// <placeholder>Maximum of the range</placeholder>
/// </value>
public T Max { get => summary["maximum"].Value<T>(); set => summary["maximum"] = new JValue(value); }
public T Max { get => this.summary["maximum"].Value<T>(); set => this.summary["maximum"] = new JValue(value); }

/// <inheritdoc/>
public override IEnumerable<object> Enumerate()
{
return new object[2] { Min, Max };
return new object[2] { this.Min, this.Max };
}
}
}
8 changes: 4 additions & 4 deletions src/DotNetStac/Collection/StacSummaryValueSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public StacSummaryValueSet(IEnumerable<T> summarySet) : base(new JArray(summaryS
/// <param name="item">value item</param>
public void Add(T item)
{
((JArray)summary).Add(item);
((JArray)this.summary).Add(item);
}

/// <summary>
Expand All @@ -53,19 +53,19 @@ public void Add(T item)
/// <value>
/// <placeholder>Summary Value Set total of items</placeholder>
/// </value>
public int Count => summary.Count();
public int Count => this.summary.Count();

/// <summary>
/// Get the Summary Value Set as an enumerable
/// </summary>
/// <value>
/// <placeholder>Get the Summary Value Set as an enumerable</placeholder>
/// </value>
public IEnumerable<T> SummarySet { get => summary.ToObject<List<T>>(); }
public IEnumerable<T> SummarySet { get => this.summary.ToObject<List<T>>(); }

IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return SummarySet.GetEnumerator();
return this.SummarySet.GetEnumerator();
}

/// <inheritdoc/>
Expand Down
3 changes: 1 addition & 2 deletions src/DotNetStac/Collection/StacTemporalExtent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace Stac.Collection
public class StacTemporalExtent
{


/// <summary>
/// Initialize a new instance of the <see cref="StacTemporalExtent" /> class with a single extent.
/// </summary>
Expand All @@ -24,7 +23,7 @@ public class StacTemporalExtent
[JsonConstructor]
public StacTemporalExtent(DateTime? start, DateTime? end)
{
Interval = new DateTime?[1][] { new DateTime?[2] { start, end } };
this.Interval = new DateTime?[1][] { new DateTime?[2] { start, end } };
}

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion src/DotNetStac/Common/JsonMergeUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public static string Merge(string original, string patch, JsonWriterOptions? wri
MergeObjects(jsonWriter, originalDoc.RootElement, patchDoc.RootElement);
}


return Encoding.UTF8.GetString(memStream.ToArray());
}

Expand Down
10 changes: 5 additions & 5 deletions src/DotNetStac/Common/PropertyObservableCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ public class PropertyObservableCollection<T> : ObservableCollection<T>
{
public PropertyObservableCollection(IStacPropertiesContainer propertiesContainer, string key) : base()
{
PropertiesContainer = propertiesContainer;
Key = key;
this.CollectionChanged += ObservableCollectionInPropertiesChanged;
this.PropertiesContainer = propertiesContainer;
this.Key = key;
this.CollectionChanged += this.ObservableCollectionInPropertiesChanged;
}

public IStacPropertiesContainer PropertiesContainer { get; }
public string Key { get; }

private void ObservableCollectionInPropertiesChanged(object sender, NotifyCollectionChangedEventArgs e)
{
PropertiesContainer.RemoveProperty(Key);
this.PropertiesContainer.RemoveProperty(this.Key);
if (this.Count == 0) return;
PropertiesContainer.SetProperty(Key, this.ToList());
this.PropertiesContainer.SetProperty(this.Key, this.ToList());
}
}
}
14 changes: 7 additions & 7 deletions src/DotNetStac/Common/Statistics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public class Statistics
[JsonConstructor]
public Statistics(double? minimum, double? maximum, double? mean, double? stdev, double? validPercent)
{
Mean = mean;
Minimum = minimum;
Maximum = maximum;
Stdev = stdev;
ValidPercent = validPercent;
properties = new Dictionary<string, object>();
this.Mean = mean;
this.Minimum = minimum;
this.Maximum = maximum;
this.Stdev = stdev;
this.ValidPercent = validPercent;
this.properties = new Dictionary<string, object>();
}

/// <summary>
Expand Down Expand Up @@ -69,7 +69,7 @@ public Statistics(double? minimum, double? maximum, double? mean, double? stdev,
/// </summary>
/// <value></value>
[JsonExtensionData]
public IDictionary<string, object> Properties { get => properties; set => properties = value; }
public IDictionary<string, object> Properties { get => this.properties; set => this.properties = value; }

}
}
4 changes: 2 additions & 2 deletions src/DotNetStac/Common/TolerantEnumConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ internal class TolerantEnumConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
Type type = IsNullableType(objectType) ? Nullable.GetUnderlyingType(objectType) : objectType;
Type type = this.IsNullableType(objectType) ? Nullable.GetUnderlyingType(objectType) : objectType;
return type.IsEnum;
}

public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
bool isNullable = IsNullableType(objectType);
bool isNullable = this.IsNullableType(objectType);
Type enumType = isNullable ? Nullable.GetUnderlyingType(objectType) : objectType;

string[] names = Enum.GetNames(enumType);
Expand Down
16 changes: 8 additions & 8 deletions src/DotNetStac/Extensions/Alternate/AlternateAssetObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public class AlternateAssetObject : IStacPropertiesContainer
public AlternateAssetObject(string href, IStacObject parent = null, string title = null, string description = null)
{
this.href = href;
_parent = parent;
this._parent = parent;
this.title = title;
this.description = description;
properties = new Dictionary<string, object>();
this.properties = new Dictionary<string, object>();
}

/// <summary>
Expand All @@ -46,7 +46,7 @@ public AlternateAssetObject(string href, IStacObject parent = null, string title
/// </value>
[JsonProperty("href")]
[JsonRequired]
public string Href { get => href; set => href = value; }
public string Href { get => this.href; set => this.href = value; }

/// <summary>
/// The displayed title for clients and users.
Expand All @@ -55,7 +55,7 @@ public AlternateAssetObject(string href, IStacObject parent = null, string title
/// <placeholder>The displayed title for clients and users.</placeholder>
/// </value>
[JsonProperty("title")]
public string Title { get => title; set => title = value; }
public string Title { get => this.title; set => this.title = value; }

/// <summary>
/// A description of the Asset providing additional details, such as how it was processed or created. CommonMark 0.29 syntax MAY be used for rich text representation.
Expand All @@ -64,14 +64,14 @@ public AlternateAssetObject(string href, IStacObject parent = null, string title
/// <placeholder>A description of the Asset providing additional details, such as how it was processed or created. CommonMark 0.29 syntax MAY be used for rich text representation.</placeholder>
/// </value>
[JsonProperty("description")]
public string Description { get => description; set => description = value; }
public string Description { get => this.description; set => this.description = value; }

/// <summary>
/// Additional fields
/// </summary>
/// <value></value>
[JsonExtensionData]
public IDictionary<string, object> Properties { get => properties; set => properties = value; }
public IDictionary<string, object> Properties { get => this.properties; set => this.properties = value; }

/// <summary>
/// Parent Stac Object
Expand All @@ -81,7 +81,7 @@ public AlternateAssetObject(string href, IStacObject parent = null, string title
/// <placeholder>Parent Stac Object</placeholder>
/// </value>
[JsonIgnore]
public IStacObject StacObjectContainer => _parent;
public IStacObject StacObjectContainer => this._parent;

/// <summary>
/// Uri
Expand All @@ -91,6 +91,6 @@ public AlternateAssetObject(string href, IStacObject parent = null, string title
/// <placeholder>Uri</placeholder>
/// </value>
[JsonIgnore]
public Uri Uri => new Uri(href);
public Uri Uri => new Uri(this.href);
}
}
18 changes: 8 additions & 10 deletions src/DotNetStac/Extensions/Alternate/AlternateStacExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ internal AlternateStacExtension(StacAsset stacAsset) : base(JsonSchemaUrl, stacA
/// </value>
public IDictionary<string, AlternateAssetObject> AlternateAssets
{
get { return StacPropertiesContainer.GetProperty<Dictionary<string, AlternateAssetObject>>(AlternateField); }
get { return this.StacPropertiesContainer.GetProperty<Dictionary<string, AlternateAssetObject>>(AlternateField); }
set
{
if (value == null || value.Count() == 0)
StacPropertiesContainer.RemoveProperty(AlternateField);
this.StacPropertiesContainer.RemoveProperty(AlternateField);
else
{
StacPropertiesContainer.SetProperty(AlternateField, value);
DeclareStacExtension();
this.StacPropertiesContainer.SetProperty(AlternateField, value);
this.DeclareStacExtension();
}
}
}
Expand All @@ -57,7 +57,7 @@ public IDictionary<string, AlternateAssetObject> AlternateAssets
public override IDictionary<string, Type> ItemFields => assetFields;

/// <inheritdoc/>
public StacAsset StacAsset => StacPropertiesContainer as StacAsset;
public StacAsset StacAsset => this.StacPropertiesContainer as StacAsset;

/// <inheritdoc/>
public override IDictionary<string, ISummaryFunction> GetSummaryFunctions()
Expand All @@ -68,15 +68,13 @@ public override IDictionary<string, ISummaryFunction> GetSummaryFunctions()

public AlternateAssetObject AddAlternate(string key, Uri uri, string title = null, string description = null)
{
AlternateAssetObject alternateAssetObject = new AlternateAssetObject(uri.ToString(), StacAsset.ParentStacObject, title, description);
var alternateAssets = AlternateAssets ?? new Dictionary<string, AlternateAssetObject>();
AlternateAssetObject alternateAssetObject = new AlternateAssetObject(uri.ToString(), this.StacAsset.ParentStacObject, title, description);
var alternateAssets = this.AlternateAssets ?? new Dictionary<string, AlternateAssetObject>();
alternateAssets.Add(key, alternateAssetObject);
AlternateAssets = alternateAssets;
this.AlternateAssets = alternateAssets;
return alternateAssetObject;
}



}

/// <summary>
Expand Down
Loading

0 comments on commit ac186ea

Please sign in to comment.