feat: rename grid sha1 to hash for better generality
This commit is contained in:
20
src/Grid.fs
20
src/Grid.fs
@@ -525,7 +525,7 @@ type ExtendedGrid(grid: IGrid) =
|
||||
let mutable elementTree: IdxTree option = None
|
||||
let mutable neighborIndex: NeighborIndex option = None
|
||||
let mutable centroids: Vertex [] option = None
|
||||
let mutable gridSha1: byte[] = [||]
|
||||
let mutable gridHash: byte[] = [||]
|
||||
|
||||
let getNeighborIdx () =
|
||||
match neighborIndex with
|
||||
@@ -621,12 +621,12 @@ type ExtendedGrid(grid: IGrid) =
|
||||
// this.initNodeTree ()
|
||||
Util.tryFindElement grid elementTree.Value p
|
||||
|
||||
member this.initSha1(hash: byte[]) =
|
||||
if gridSha1.Length = 0 && hash.Length > 0 then
|
||||
gridSha1 <- hash
|
||||
member this.initHash(hash: byte[]) =
|
||||
if gridHash.Length = 0 && hash.Length > 0 then
|
||||
gridHash <- hash
|
||||
|
||||
member this.getSha1() =
|
||||
if gridSha1.Length = 0 then
|
||||
member this.getHash() =
|
||||
if gridHash.Length = 0 then
|
||||
let bg : BinGrid = {
|
||||
hash = [||]
|
||||
vertices = (this :> IGrid).getVertices ()
|
||||
@@ -634,11 +634,11 @@ type ExtendedGrid(grid: IGrid) =
|
||||
}
|
||||
let bytes = MessagePackSerializer.Serialize(bg)
|
||||
let sha1 = System.Security.Cryptography.SHA1.Create()
|
||||
gridSha1 <- sha1.ComputeHash bytes
|
||||
gridSha1
|
||||
gridHash <- sha1.ComputeHash bytes
|
||||
gridHash
|
||||
|
||||
member this.getSha1String() =
|
||||
this.getSha1() |> Convert.ToHexStringLower
|
||||
member this.getHashString() =
|
||||
this.getHash() |> Convert.ToHexStringLower
|
||||
|
||||
member this.getCentroids() =
|
||||
match centroids with
|
||||
|
||||
Reference in New Issue
Block a user