v2019.1.21
rsmckinney
released this
14 Oct 04:24
·
1111 commits
to master
since this release
New Features (v2019.1.21)
Operator Overloading
Implement operator methods on any type to directly support arithmetic, relational, and unit operators.
// BigDecimal expressions
if (bigDec1 > bigDec2) {
BigDecimal result = bigDec1 + bigDec2;
...
}
// Implemnet operators for any type
MyType value = myType1 + myType2;
Unit Expressions
Unit or binding operations are unique to the Manifold framework. They provide a powerfully concise syntax and can be applied to a wide range of applications.
import static manifold.science.util.UnitConstants.*; // kg, m, s, ft, etc
...
Length distance = 100 mph * 3 hr;
Force f = 5.2 kg m/s/s; // same as 5.2 N
Mass infant = 9 lb + 8.71 oz;
Ranges
Easily work with the Range
API using unit expressions. Simply import the RangeFun
constants to create ranges.
// imports the `to`, `step`, and other "binding" constants
import static manifold.collections.api.range.RangeFun.*;
...
for (int i: 1 to 5) {
out.println(i);
}
for (Mass m: 0kg to 10kg step 22r unit g) {
out.println(m);
}
Science
Use the manifold-science framework to type-safely incorporate units and precise measurements into your applications.
import static manifold.science.util.UnitConstants.*; // kg, m, s, ft, etc.
...
Velocity rate = 65mph;
Time time = 1min + 3.7sec;
Length distance = rate * time;