Skip to content

Commit

Permalink
Update extension methods names
Browse files Browse the repository at this point in the history
  • Loading branch information
yongyan-gh committed Feb 19, 2022
1 parent 7c77019 commit 966b7f8
Show file tree
Hide file tree
Showing 19 changed files with 207 additions and 207 deletions.
4 changes: 2 additions & 2 deletions src/Sarif/Comparers/ArtifactComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public int Compare(Artifact left, Artifact right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand Down Expand Up @@ -93,7 +93,7 @@ public int Compare(Artifact left, Artifact right)
return compareResult;
}

compareResult = left.Hashes.DictionaryCompare(right.Hashes);
compareResult = left.Hashes.DictionaryCompares(right.Hashes);

if (compareResult != 0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Sarif/Comparers/ArtifactContentComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public int Compare(ArtifactContent left, ArtifactContent right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sarif/Comparers/ArtifactLocationComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public int Compare(ArtifactLocation left, ArtifactLocation right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}

compareResult = left.Uri.UriCompare(right.Uri);
compareResult = left.Uri.UriCompares(right.Uri);

if (compareResult != 0)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Sarif/Comparers/CodeFlowComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public int Compare(CodeFlow left, CodeFlow right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand All @@ -30,7 +30,7 @@ public int Compare(CodeFlow left, CodeFlow right)
return compareResult;
}

compareResult = left.ThreadFlows.ListCompare(right.ThreadFlows, ThreadFlowComparer.Instance);
compareResult = left.ThreadFlows.ListCompares(right.ThreadFlows, ThreadFlowComparer.Instance);

if (compareResult != 0)
{
Expand Down
20 changes: 10 additions & 10 deletions src/Sarif/Comparers/ComparerHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal static class ComparerExtensions
/// 1 if the first object is not null and the second object is null.
/// </param>
/// <returns>Return true if you can get a definite compare result, otherwise return false.</returns>
public static bool TryReferenceCompare(this object left, object right, out int result)
public static bool TryReferenceCompares(this object left, object right, out int result)
{
result = 0;

Expand All @@ -45,12 +45,12 @@ public static bool TryReferenceCompare(this object left, object right, out int r
return false;
}

public static int ListCompare<T>(this IList<T> left, IList<T> right) where T : IComparable
public static int ListCompares<T>(this IList<T> left, IList<T> right) where T : IComparable
{
return CompareListHelper(left, right, (a, b) => a.CompareTo(b));
}

public static int ListCompare<T>(this IList<T> left, IList<T> right, IComparer<T> comparer)
public static int ListCompares<T>(this IList<T> left, IList<T> right, IComparer<T> comparer)
{
if (comparer == null)
{
Expand All @@ -69,7 +69,7 @@ private static int CompareListHelper<T>(IList<T> left, IList<T> right, Func<T, T

int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand All @@ -83,7 +83,7 @@ private static int CompareListHelper<T>(IList<T> left, IList<T> right, Func<T, T

for (int i = 0; i < left.Count; ++i)
{
if (left[i].TryReferenceCompare(right[i], out compareResult) && compareResult != 0)
if (left[i].TryReferenceCompares(right[i], out compareResult) && compareResult != 0)
{
return compareResult;
}
Expand All @@ -99,12 +99,12 @@ private static int CompareListHelper<T>(IList<T> left, IList<T> right, Func<T, T
return compareResult;
}

public static int DictionaryCompare<T>(this IDictionary<string, T> left, IDictionary<string, T> right) where T : IComparable
public static int DictionaryCompares<T>(this IDictionary<string, T> left, IDictionary<string, T> right) where T : IComparable
{
return DictionaryCompareHelper(left, right, (a, b) => a.CompareTo(b));
}

public static int DictionaryCompare<T>(this IDictionary<string, T> left, IDictionary<string, T> right, IComparer<T> comparer)
public static int DictionaryCompares<T>(this IDictionary<string, T> left, IDictionary<string, T> right, IComparer<T> comparer)
{
if (comparer == null)
{
Expand All @@ -123,7 +123,7 @@ private static int DictionaryCompareHelper<T>(IDictionary<string, T> left, IDict

int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand Down Expand Up @@ -158,11 +158,11 @@ private static int DictionaryCompareHelper<T>(IDictionary<string, T> left, IDict
return compareResult;
}

public static int UriCompare(this Uri left, Uri right)
public static int UriCompares(this Uri left, Uri right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sarif/Comparers/LocationComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public int Compare(Location left, Location right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand All @@ -37,7 +37,7 @@ public int Compare(Location left, Location right)
return compareResult;
}

compareResult = left.LogicalLocations.ListCompare<LogicalLocation>(right.LogicalLocations, LogicalLocationComparer.Instance);
compareResult = left.LogicalLocations.ListCompares<LogicalLocation>(right.LogicalLocations, LogicalLocationComparer.Instance);

if (compareResult != 0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Sarif/Comparers/LogicalLocationComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public int Compare(LogicalLocation left, LogicalLocation right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sarif/Comparers/MessageComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public int Compare(Message left, Message right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand All @@ -44,7 +44,7 @@ public int Compare(Message left, Message right)
return compareResult;
}

compareResult = left.Arguments.ListCompare<string>(right.Arguments);
compareResult = left.Arguments.ListCompares<string>(right.Arguments);

if (compareResult != 0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Sarif/Comparers/MultiformatMessageStringComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public int Compare(MultiformatMessageString left, MultiformatMessageString right
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Sarif/Comparers/PhysicalLocationComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public int Compare(PhysicalLocation left, PhysicalLocation right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Sarif/Comparers/RegionComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public int Compare(Region left, Region right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Sarif/Comparers/ReportingConfigurationComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public int Compare(ReportingConfiguration left, ReportingConfiguration right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Sarif/Comparers/ReportingDescriptorComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public int Compare(ReportingDescriptor left, ReportingDescriptor right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand All @@ -30,7 +30,7 @@ public int Compare(ReportingDescriptor left, ReportingDescriptor right)
return compareResult;
}

compareResult = left.DeprecatedIds.ListCompare(right.DeprecatedIds);
compareResult = left.DeprecatedIds.ListCompares(right.DeprecatedIds);

if (compareResult != 0)
{
Expand All @@ -44,7 +44,7 @@ public int Compare(ReportingDescriptor left, ReportingDescriptor right)
return compareResult;
}

compareResult = left.DeprecatedGuids.ListCompare(right.DeprecatedGuids);
compareResult = left.DeprecatedGuids.ListCompares(right.DeprecatedGuids);

if (compareResult != 0)
{
Expand All @@ -58,7 +58,7 @@ public int Compare(ReportingDescriptor left, ReportingDescriptor right)
return compareResult;
}

compareResult = left.DeprecatedNames.ListCompare(right.DeprecatedNames);
compareResult = left.DeprecatedNames.ListCompares(right.DeprecatedNames);

if (compareResult != 0)
{
Expand Down Expand Up @@ -86,7 +86,7 @@ public int Compare(ReportingDescriptor left, ReportingDescriptor right)
return compareResult;
}

compareResult = left.HelpUri.UriCompare(right.HelpUri);
compareResult = left.HelpUri.UriCompares(right.HelpUri);

if (compareResult != 0)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Sarif/Comparers/ResultComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public int Compare(Result left, Result right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand Down Expand Up @@ -65,7 +65,7 @@ public int Compare(Result left, Result right)
return compareResult;
}

compareResult = left.Locations.ListCompare(right.Locations, LocationComparer.Instance);
compareResult = left.Locations.ListCompares(right.Locations, LocationComparer.Instance);

if (compareResult != 0)
{
Expand Down Expand Up @@ -93,7 +93,7 @@ public int Compare(Result left, Result right)
return compareResult;
}

compareResult = left.CodeFlows.ListCompare(right.CodeFlows, CodeFlowComparer.Instance);
compareResult = left.CodeFlows.ListCompares(right.CodeFlows, CodeFlowComparer.Instance);

if (compareResult != 0)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Sarif/Comparers/RunComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public int Compare(Run left, Run right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}

compareResult = left.Artifacts.ListCompare(right.Artifacts, ArtifactComparer.Instance);
compareResult = left.Artifacts.ListCompares(right.Artifacts, ArtifactComparer.Instance);

if (compareResult != 0)
{
Expand All @@ -37,7 +37,7 @@ public int Compare(Run left, Run right)
return compareResult;
}

compareResult = left.Results.ListCompare(right.Results, ResultComparer.Instance);
compareResult = left.Results.ListCompares(right.Results, ResultComparer.Instance);

if (compareResult != 0)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Sarif/Comparers/ThreadFlowComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public int Compare(ThreadFlow left, ThreadFlow right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand All @@ -37,7 +37,7 @@ public int Compare(ThreadFlow left, ThreadFlow right)
return compareResult;
}

compareResult = left.Locations.ListCompare(right.Locations, ThreadFlowLocationComparer.Instance);
compareResult = left.Locations.ListCompares(right.Locations, ThreadFlowLocationComparer.Instance);

if (compareResult != 0)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Sarif/Comparers/ThreadFlowLocationComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public int Compare(ThreadFlowLocation left, ThreadFlowLocation right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand All @@ -37,7 +37,7 @@ public int Compare(ThreadFlowLocation left, ThreadFlowLocation right)
return compareResult;
}

compareResult = left.Kinds.ListCompare(right.Kinds);
compareResult = left.Kinds.ListCompares(right.Kinds);

if (compareResult != 0)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Sarif/Comparers/ToolComponentComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public int Compare(ToolComponent left, ToolComponent right)
{
int compareResult = 0;

if (left.TryReferenceCompare(right, out compareResult))
if (left.TryReferenceCompares(right, out compareResult))
{
return compareResult;
}
Expand Down Expand Up @@ -80,21 +80,21 @@ public int Compare(ToolComponent left, ToolComponent right)
return compareResult;
}

compareResult = left.DownloadUri.UriCompare(right.DownloadUri);
compareResult = left.DownloadUri.UriCompares(right.DownloadUri);

if (compareResult != 0)
{
return compareResult;
}

compareResult = left.InformationUri.UriCompare(right.InformationUri);
compareResult = left.InformationUri.UriCompares(right.InformationUri);

if (compareResult != 0)
{
return compareResult;
}

compareResult = left.Rules.ListCompare(right.Rules, ReportingDescriptorComparer.Instance);
compareResult = left.Rules.ListCompares(right.Rules, ReportingDescriptorComparer.Instance);

if (compareResult != 0)
{
Expand Down
Loading

0 comments on commit 966b7f8

Please sign in to comment.