Describe prints a description of the bitmap's containers to stdout
()
| 2441 | |
| 2442 | // Describe prints a description of the bitmap's containers to stdout |
| 2443 | func (rb *Bitmap) Describe() { |
| 2444 | fmt.Printf("Bitmap with %d containers:\n", len(rb.highlowcontainer.containers)) |
| 2445 | for i, c := range rb.highlowcontainer.containers { |
| 2446 | key := rb.highlowcontainer.keys[i] |
| 2447 | shared := "" |
| 2448 | if rb.highlowcontainer.needCopyOnWrite[i] { |
| 2449 | shared = " (shared)" |
| 2450 | } |
| 2451 | switch c.(type) { |
| 2452 | case *arrayContainer: |
| 2453 | fmt.Printf(" Container %d (key %d): array, cardinality %d%s\n", i, key, c.getCardinality(), shared) |
| 2454 | case *bitmapContainer: |
| 2455 | fmt.Printf(" Container %d (key %d): bitmap, cardinality %d%s\n", i, key, c.getCardinality(), shared) |
| 2456 | case *runContainer16: |
| 2457 | fmt.Printf(" Container %d (key %d): run, cardinality %d%s\n", i, key, c.getCardinality(), shared) |
| 2458 | default: |
| 2459 | fmt.Printf(" Container %d (key %d): unknown type, cardinality %d%s\n", i, key, c.getCardinality(), shared) |
| 2460 | } |
| 2461 | } |
| 2462 | valid := rb.Validate() |
| 2463 | if valid != nil { |
| 2464 | fmt.Printf(" Bitmap is INVALID: %v\n", valid) |
| 2465 | } else { |
| 2466 | fmt.Printf(" Bitmap is valid\n") |
| 2467 | } |
| 2468 | } |
| 2469 | |
| 2470 | // Validate checks if the bitmap is internally consistent. |
| 2471 | // You may call it after deserialization to check that the bitmap is valid. |