Skip to content

Commit 376036f

Browse files
committed
CVParamType comparer
1 parent c5cfc87 commit 376036f

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

Util/CVHelpers.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using ThermoRawFileParser.Writer.MzML;
1+
using System.Collections.Generic;
2+
using ThermoRawFileParser.Writer.MzML;
23

34
namespace ThermoRawFileParser.Util
45
{
@@ -18,4 +19,17 @@ public static CVParamType Copy (this CVParamType old)
1819
};
1920
}
2021
}
22+
23+
public class CVComparer : IEqualityComparer<CVParamType>
24+
{
25+
public bool Equals(CVParamType cv1, CVParamType cv2)
26+
{
27+
return cv1.accession == cv2.accession;
28+
}
29+
30+
public int GetHashCode(CVParamType cv)
31+
{
32+
return cv.accession.GetHashCode();
33+
}
34+
}
2135
}

Writer/MzMlSpectrumWriter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using ThermoFisher.CommonCore.Data.Business;
1717
using ThermoFisher.CommonCore.Data.FilterEnums;
1818
using ThermoFisher.CommonCore.Data.Interfaces;
19+
using ThermoRawFileParser.Util;
1920
using ThermoRawFileParser.Writer.MzML;
2021
using zlib;
2122

@@ -143,7 +144,7 @@ public override void Write(IRawDataPlus rawFile, int firstScanNumber, int lastSc
143144
_writer.WriteStartElement("fileContent");
144145

145146
//accumulating different types of file content
146-
HashSet<CVParamType> content = new HashSet<CVParamType>();
147+
HashSet<CVParamType> content = new HashSet<CVParamType>(new CVComparer());
147148

148149
if (_rawFile.HasMsData)
149150
{

0 commit comments

Comments
 (0)