btree 0.1.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 18

btree

This package provides an in-memory B-Tree implementation, useful as a an ordered, mutable data structure.

It has a flatter structure than an equivalent red-black or other binary tree, which in some cases yields better memory usage and/or performance.

The API is based on BTree implementation for Go

Build Status Coverage Status

Usage

A simple usage example:

library btree.example;

import 'package:btree/btree.dart';

main() {
  final btree = new BTree<int>(3);
  for (var i = 0; i < 10; i++) {
    btree.replaceOrInsert(i);
  }
  print('len:       ${btree.length}');
  // len:       10
  print('get3:      ${btree[3]}');
  // get3:      3
  print('get100:    ${btree[100]}');
  // get100:    null
  print('del4:      ${btree.remove(4)}');
  // del4:      4
  print('del100:    ${btree.remove(100)}');
  // del100:    null
  print('replace5:  ${btree.replaceOrInsert(5)}');
  // replace5:  5
  print('replace100:${btree.replaceOrInsert(100)}');
  // replace100:null
  print('delmin:    ${btree.removeMin()}');
  // delmin:    0
  print('delmax:    ${btree.removeMax()}');
  // delmax:    100
  print('len:       ${btree.length}');
  // len:       8
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

Changelog

0.1.1

  • Turn on strong mode and fix warnings and errors

0.1.0

  • Initial version

example/btree.dart

// Copyright (c) 2015, Kwang Yul Seo. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

library btree.example;

import 'package:btree/btree.dart';

main() {
  final btree = new BTree<int>(3);
  for (var i = 0; i < 10; i++) {
    btree.replaceOrInsert(i);
  }
  print('len:       ${btree.length}');
  // len:       10
  print('get3:      ${btree[3]}');
  // get3:      3
  print('get100:    ${btree[100]}');
  // get100:    null
  print('del4:      ${btree.remove(4)}');
  // del4:      4
  print('del100:    ${btree.remove(100)}');
  // del100:    null
  print('replace5:  ${btree.replaceOrInsert(5)}');
  // replace5:  5
  print('replace100:${btree.replaceOrInsert(100)}');
  // replace100:null
  print('delmin:    ${btree.removeMin()}');
  // delmin:    0
  print('delmax:    ${btree.removeMax()}');
  // delmax:    100
  print('len:       ${btree.length}');
  // len:       8
}

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  btree: "^0.1.1"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:btree/btree.dart';
        
Version Uploaded Documentation Archive
0.1.1 Nov 3, 2016 Go to the documentation of btree 0.1.1 Download btree 0.1.1 archive
0.1.0 Nov 22, 2015 Go to the documentation of btree 0.1.0 Download btree 0.1.0 archive

Analysis

We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
18 / 100
Health:
Code health derived from static analysis. [more]
2 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
44 / 100
Overall score:
Weighted score of the above. [more]
18
Learn more about scoring.

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:btree/btree.dart.

Suggestions

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 18 errors.

    Strong-mode analysis of lib/src/btree_base.dart failed with the following error:

    line: 115 col: 19
    The function expression type '(T) → bool' isn't of type '(dynamic) → bool'. This means its parameter or return type does not match what is expected. Consider changing parameter type(s) or the returned type(s).

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0
quiver_check >=1.0.0 <1.1.0 1.0.0
quiver_collection >=1.0.0 <1.1.0 1.0.0
tuple >=0.4.0 <0.5.0 0.4.0 1.0.1
Transitive dependencies
meta 1.1.2
quiver_iterables 1.0.1
Dev dependencies
test >=0.12.0 <0.13.0