From c5f5f84e578d6b3d5e2493750ec432a963ed5f51 Mon Sep 17 00:00:00 2001 From: Plague Fox Date: Sat, 11 Jan 2025 06:27:56 +0400 Subject: [PATCH] Rename nodesCount to nodes --- example/lib/src/feature/quadtree/quadtree_screen.dart | 2 +- lib/src/collisions/quadtree.dart | 8 ++++---- test/unit/quadtree_test.dart | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/example/lib/src/feature/quadtree/quadtree_screen.dart b/example/lib/src/feature/quadtree/quadtree_screen.dart index 0517163..634c9bb 100644 --- a/example/lib/src/feature/quadtree/quadtree_screen.dart +++ b/example/lib/src/feature/quadtree/quadtree_screen.dart @@ -323,7 +323,7 @@ class QuadTreePainter extends RePainterBase { ..write(' | ') ..write('Nodes:') ..write(nbsp) - ..write(_quadTree.nodesCount); + ..write(_quadTree.nodes); _textPainter ..text = TextSpan( text: status.toString(), diff --git a/lib/src/collisions/quadtree.dart b/lib/src/collisions/quadtree.dart index 55a4e61..6c6dd7d 100644 --- a/lib/src/collisions/quadtree.dart +++ b/lib/src/collisions/quadtree.dart @@ -223,7 +223,7 @@ final class QuadTree { Uint32List _recycledNodes; /// Number of active objects in the QuadTree. - int get nodesCount => _nodesCount - _recycledNodesCount; + int get nodes => _nodesCount - _recycledNodesCount; /// List of nodes in the QuadTree. /// Each index in the list is the identifier of the node. @@ -969,8 +969,8 @@ final class QuadTree { }); // Check if all nodes are visited - if (nodesCount != nodeIds.length) - errors.add('Invalid nodes count: $nodesCount != ${nodeIds.length}.'); + if (nodes != nodeIds.length) + errors.add('Invalid nodes count: $nodes != ${nodeIds.length}.'); return errors; } @@ -981,7 +981,7 @@ final class QuadTree { @override String toString() => 'QuadTree{' - 'nodes: $nodesCount, ' + 'nodes: $nodes, ' 'objects: $length' '}'; } diff --git a/test/unit/quadtree_test.dart b/test/unit/quadtree_test.dart index 814f813..a700f45 100644 --- a/test/unit/quadtree_test.dart +++ b/test/unit/quadtree_test.dart @@ -168,7 +168,7 @@ void main() => group('Quadtree', () { capacity: 6, ); expect(qt.length, equals(0)); - expect(qt.nodesCount, equals(0)); + expect(qt.nodes, equals(0)); for (var i = 0; i < 10; i++) { expect( () => qt.insert(ui.Rect.fromLTWH(i * 10.0, i * 10.0, 10, 10)), @@ -176,7 +176,7 @@ void main() => group('Quadtree', () { ); } expect(qt.length, equals(10)); - expect(qt.nodesCount, greaterThan(0)); + expect(qt.nodes, greaterThan(0)); expect(() => qt.get(10), returnsNormally); expect( qt.get(10),