Git Product home page Git Product logo

dart_interval's Introduction

Language: English | Chinese

dart_interval

Build Status

This library provides data structure and operations for intervals in Dart.

Installation

Depend on it

Run this command:

With Dart:

dart pub add dart_interval

or add this to your project's pubspec.yml:

dependencies:
  dart_interval: ^0.1.1

Feature

  • Interval - The interval data structure.
  • IntervalSet - The interval merging.
  • Interval & Interval - The interval intersection calculation
  • Interval | Interval - The interval union calculation

Examples

Usage

Create a Interval:

import 'package:dart_interval/dart_interval.dart';

final v1 = Interval.between(1, 3, lowerClosed: false, upperClosed: false);

Merge the intervals:

final v1 = Interval.between(1, 3);
final v2 = Interval.between(2, 5);
final v3 = Interval.between(7, 9);
final set = IntervalSet([v1, v2, v3]);
print(set);
// output: [1, 5],[7, 9]

Interval intersection calculation:

print(v1 & v2);
// output: [2, 3]

Interval union calculation:

print(v1 | v2);
// output: [1, 5]

or

print(IntervalSet([v1, v2]));
// output: [1, 5]

dart_interval's People

Contributors

anatta-feng avatar

Stargazers

 avatar

Watchers

 avatar  avatar

dart_interval's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.