(indent string)
| 309 | } |
| 310 | |
| 311 | func (bA *BitArray) stringIndented(indent string) string { |
| 312 | lines := []string{} |
| 313 | bits := "" |
| 314 | for i := 0; i < bA.Bits; i++ { |
| 315 | if bA.getIndex(i) { |
| 316 | bits += "x" |
| 317 | } else { |
| 318 | bits += "_" |
| 319 | } |
| 320 | if i%100 == 99 { |
| 321 | lines = append(lines, bits) |
| 322 | bits = "" |
| 323 | } |
| 324 | if i%10 == 9 { |
| 325 | bits += indent |
| 326 | } |
| 327 | if i%50 == 49 { |
| 328 | bits += indent |
| 329 | } |
| 330 | } |
| 331 | if len(bits) > 0 { |
| 332 | lines = append(lines, bits) |
| 333 | } |
| 334 | return fmt.Sprintf("BA{%v:%v}", bA.Bits, strings.Join(lines, indent)) |
| 335 | } |
| 336 | |
| 337 | // Bytes returns the byte representation of the bits within the bitarray. |
| 338 | func (bA *BitArray) Bytes() []byte { |
no test coverage detected