Git Product home page Git Product logo

physikal's Introduction

Physikal

License Build Status Codacy Badge

Library providing Kotlin extensions and ease of use functions for Java Units of Measurement libraries.

Contains

Maven Central Artifacts

  • Core Maven Central

  • SI Units Maven Central

  • Complete Units Maven Central

Usage

Create units

    val small = 10.metre
    
    val large = 10.kilo.metre

Includes all operators

    val added = 10.metre + 1.kilo.metre
    >> 1010.0 m
    
    val speed = added/10.minute 
    >> 101 m/min
    
    var aFewSeconds = 5.second
    aFewSeconds++
    >> 6.0 s
    
    10.peta.watt > 2.watt
    >> true
    
    5.gram <= 20.kilo.gram
    >> true
    
    (-10.nano.metre).abs()
    >> 10.0 nm
    
    ## The operator '==' does not always work reliably for quantities;
    ## the function qeq() should be used instead.
    1.kilo.gram == 1000.gram
    >> false
    
    1.kilo.gram qeq 1000.gram
    >> true

Using different units (SI units & other units)

    5.gram + 2.pound
    >> 912.18474 g
    
    (13.kilo.gram + 20.pound) convertTo STONE
    >> 3.47572100600243466674378 st

Future updates

Currently all quantities are reference types, so heavy usage of this library will involve some level of extraneous object creation. Hopefully we can resolve this issue with project valhalla or another attempt to get value types in the JVM.

Special thanks

physikal's People

Contributors

ejberry avatar johannesrudolph avatar

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.