Physikal is a Kotlin units of measurement, physical computing, and dimension analysis library.

Overview

Physikal  License Matrix

Physikal is a Kotlin units of measurement, physical computing, and dimension analysis library. Currently just extensions for Java units of measurement but we are planning for a Kotlin multiplatform rewrite.

Artifacts

Core SI Units Complete Units
JVM Maven Central Maven Central 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 allocation and GC. Hopefully we can resolve this issue when / if Kotlin inline classes are expanded to support multiple properties.

Special thanks

You might also like...
Android Multi Theme Switch Library ,use  kotlin language ,coroutine ,and so on ...
Android Multi Theme Switch Library ,use kotlin language ,coroutine ,and so on ...

Magic Mistletoe Android多主题(换肤)切换框架 背景 时隔四年,在网易换肤之前的思路下,做了几点改进,现在完全通过反射创建View,并且在SkinLoadManager中提供一个configCustomAttrs以支持自定义View的属性插队替换 摈弃了之前的AsyncTask

API for a library using Kotlin, Spring-boot and covered by test

Library API This API is to create Books and be able to borrow from them I'm using: Spring Boot version 2.5.6 Kotlin 1.5.31 Java 11 I'm implementing us

Kotlin Symbol Processor library to create Mutable and Immutable variants of objects.

implier Kotlin Symbol Processor plugin to create Mutable and Immutable variants of objects. Examples @ImmutableImpl @MutableImpl public interface Samp

Native-Blur: a C++/Kotlin library for blur bitmaps and activity, mobile-ready, android compatible
Native-Blur: a C++/Kotlin library for blur bitmaps and activity, mobile-ready, android compatible

Native-Blur The Native-Blur is a C++/Kotlin libraray for blur bitmaps and activity, mobile-ready, android compatible, powered by Java Native Interface

Bukkit library written in Kotlin to make with compatibility and ease non-playable-character (NPC)

mc-npk Easy to use, fast and efficient library to make non-playable-characters (

🧶 Library to handling files for persistent storage with Google Cloud Storage and Amazon S3-compatible server, made in Kotlin

🧶 Remi Library to handling files for persistent storage with Google Cloud Storage and Amazon S3-compatible server, made in Kotlin! Why is this built?

BindsAdapter is an Android library to help you create and maintain Adapter class easier via ksp( Kotlin Symbol Processing).

BindsAdapter BindsAdapter is an Android library to help you create and maintain Adapter class easier via ksp( Kotlin Symbol Processing). Installation

Affogato is a multipurpose library for Android, Jetpack Compose and Kotlin.
Affogato is a multipurpose library for Android, Jetpack Compose and Kotlin.

Affogato Affogato is a multipurpose library for Jetpack Compose, Android and Kotlin. Core-ktx Core-ktx is a Kotlin library that provides a set of Kotl

Integration-test library for Kotlin and Java

Maya Maya (/ˈmɑːjə/, माया), literally "illusion" or "magic". In Vedic texts it connotes a "magic show, an illusion where things appear to be present,

Comments
  • Upgraded to Indriya 1.0

    Upgraded to Indriya 1.0

    When I prepared my KUG talk and ran Scratch files for each of the README examples, I stumbled across problems with uom-systems dependencies and underlying calls. Not sure, why it did not show in the build, but some of them only seem to occur at runtime. As 0.9 of both si-units and all uom-systems was released on top of Indriya 1.0 I migrated everything to the Indriya version (still JSR 363)

    I proposed a new version 1.1.4.0.

    opened by keilw 6
  • chore: remove parent pom depdendencies, which break maven consumers

    chore: remove parent pom depdendencies, which break maven consumers

    The way Physikal is currently packaged on maven central, the pom e.g. of si-units-1.1.1.0 currently includes:

        <dependency>
          <groupId>si.uom</groupId>
          <artifactId>si-parent</artifactId>
          <version>0.7.1</version>
          <scope>compile</scope>
        </dependency>
    

    This breaks consumers of Physikal using maven to build:

    [ERROR] Failed to execute goal on project model-nosql: Could not resolve dependencies for project de.xxx.core:model-nosql:jar:0.9: The following artifacts could not be resolved: systems.uom:systems-parent:jar:0.7.2, si.uom:si-parent:jar:0.7.1: Failure to find systems.uom:systems-parent:jar:0.7.2 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
    

    I think the situation si somewhat similar to https://stackoverflow.com/questions/27110014/could-not-find-artifact-in-maven-central-repo-when-search-returns-a-match

    In any case, I believe the parent pom is not necessary as a direct dependency. I confirm I can build and consume phyiskal to my local repo just fine using the change in this PR.

    opened by JohannesRudolph 1
  • Add a Gitter chat badge to README.md

    Add a Gitter chat badge to README.md

    Tenkiv/Physikal now has a Chat Room on Gitter

    @ejberry has just created a chat room. You can visit it here: https://gitter.im/Tenkiv/Physikal.

    This pull-request adds this badge to your README.md:

    Gitter

    If my aim is a little off, please let me know.

    Happy chatting.

    PS: Click here if you would prefer not to receive automatic pull-requests from Gitter in future.

    opened by gitter-badger 0
Static code analysis plugin for Android project. (Checkstyle, PMD)

Android Check Static code analysis plugin for Android project. Usage Modifications in <project_dir>/build.gradle: buildscript { repositories { jce

Noveo Group 270 Dec 19, 2022
🔥The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.

??The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.

Rouse 1.3k Dec 30, 2022
FlowExt is a Kotlin Multiplatform library, that provides many operators and extensions to Kotlin Coroutines Flow

FlowExt | Kotlinx Coroutines Flow Extensions | Kotlinx Coroutines Flow Extensions. Extensions to the Kotlin Flow library | kotlin-flow-extensions | Coroutines Flow Extensions | Kotlin Flow extensions | kotlin flow extensions | Flow extensions

Petrus Nguyễn Thái Học 151 Jan 1, 2023
This Kotlin Multiplatform library is for accessing the TMDB API to get movie and TV show content. Using for Android, iOS, and JS projects.

Website | Forum | Documentation | TMDb 3 API Get movie and TV show content from TMDb in a fast and simple way. TMDb API This library gives access to T

Moviebase 37 Dec 29, 2022
Mocking for Kotlin/Native and Kotlin Multiplatform using the Kotlin Symbol Processing API (KSP)

Mockative Mocking for Kotlin/Native and Kotlin Multiplatform using the Kotlin Symbol Processing API (KSP). Installation Mockative uses KSP to generate

Mockative 121 Dec 26, 2022
Small kotlin library for persisting _single instances_ of kotlin data classes

PerSista Small library for persisting single instances of kotlin data classes. NB: PerSista uses typeOf() internally which is marked as @ExperimentalS

Eric Donovan 5 Nov 13, 2022
Kotlin microservices with REST, and gRPC using BFF pattern. This repository contains backend services. Everything is dockerized and ready to "Go" actually "Kotlin" :-)

Microservices Kotlin gRPC Deployed in EC2, Check it out! This repo contains microservices written in Kotlin with BFF pattern for performing CRUD opera

Oguzhan 18 Apr 21, 2022
🎲 Kotlin Symbol Processor to auto-generate extensive sealed classes and interfaces for Android and Kotlin.

SealedX ?? Kotlin Symbol Processor to auto-generate extensive sealed classes and interfaces for Android and Kotlin. Why SealedX? SealedX generates ext

Jaewoong Eum 236 Nov 30, 2022
An library to help android developers working easly with activities and fragments (Kotlin version)

AFM An library to help android developer working easly with activities and fragments (Kotlin) Motivation Accelerate the process and abstract the logic

Massive Disaster 12 Oct 3, 2022
Amazing and easy to use Accordion Library for Android built with kotlin

AccoLib An easy-to-use, amazing Accordion Library for Android built with kotlin. It reduces the amount of code needed to make Accordions in android, w

Gourav Khunger 6 Jul 4, 2022