Skip to content

Commit

Permalink
Internalize the Components struct's properties and create a Create() …
Browse files Browse the repository at this point in the history
…method.
  • Loading branch information
mattlorimor committed Dec 14, 2015
1 parent e024af5 commit 3c6c74b
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions ProbabilisticDataStructures/CuckooBloomFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,7 @@ private Components GetComponents(byte[] data)
var i1 = ProbabilisticDataStructures.ToBigEndianUInt32(hash);
var i2 = ProbabilisticDataStructures.ToBigEndianUInt32(this.ComputeHash(f));

return new Components
{
Fingerprint = f,
Hash1 = i1,
Hash2 = i2
};
return Components.Create(f, i1, i2);
}

/// <summary>
Expand Down Expand Up @@ -451,9 +446,19 @@ private static uint Power2(uint x)

private struct Components
{
public byte[] Fingerprint;
public uint Hash1;
public uint Hash2;
internal byte[] Fingerprint;
internal uint Hash1;
internal uint Hash2;

internal static Components Create(byte[] fingerprint, uint hash1, uint hash2)
{
return new Components
{
Fingerprint = fingerprint,
Hash1 = hash1,
Hash2 = hash2
};
}
}

public class TestAndAddResult
Expand Down

0 comments on commit 3c6c74b

Please sign in to comment.