public class RatioNumber extends Object
Proportional number, express the two units of proportionality, and the number of large and small items carried and borrowed ratio. Example A: 2 cans of CO2 make 3 cups of soda * `oneUnit` - stock unit `can` * `useUnit` - usage unit `cup` * `oneRate` - `2` stock equals 3 usage * `useRate` - `3` usage equals 2 stock * `dosage` - 1 `cup` per use Derived examples, looking at the values of `oneUnit`, `useUnit`, `oneRate`, `useRate`, `dosage` respectively (1) 1 `bag` cake 5 `piece`, 1 `piece` per use -> bag, piece, 1, 5, 1 (2) 1 `bag` salt 500 `gram`, 30 `gram` per use -> bag, gram, 1, 500, 30 (3) 2 `can` CO2 make 3 `cup` soda, one `cup` per use -> can, cup, 2, 3, 1 (4) 1 `bag` salt 500 `gram`, 1 `spoon` 5 `gram`, 2 `spoon` per use -> bag, spoon, 1, 100, 2 Note, it can also be expressed as -> bag, gram, 1, 500, 10 but it cannot be expressed as -> bag, gram, 5, 500, 2 because it turns 1 `bag` of 500g, into 5 `bag` of 500g.
| Modifier and Type | Class and Description |
|---|---|
static class |
RatioNumber.Grade
up/down relationship between `one` and `use`
|
static class |
RatioNumber.Ratio
ration of `one` and `use`, How many `one` equals how many `use`
|
| Modifier and Type | Field and Description |
|---|---|
static RatioNumber |
NumberZero |
static RatioNumber.Ratio |
RateOneOne |
| Constructor and Description |
|---|
RatioNumber(int oneKeep,
int useKeep) |
| Modifier and Type | Method and Description |
|---|---|
RatioNumber |
add(int dosage,
RatioNumber.Ratio ovu,
RatioNumber.Grade grd)
dosage add
|
RatioNumber |
add(@NotNull RatioNumber num,
RatioNumber.Ratio ovu,
RatioNumber.Grade grd) |
boolean |
equals(Object o) |
int |
getOneKeep() |
int |
getUseKeep() |
static RatioNumber |
grade(int oneNum,
int useNum,
RatioNumber.Ratio ovu,
RatioNumber.Grade grd)
Organize the digits up or down by Grade.
|
RatioNumber |
grade(RatioNumber.Ratio ovu)
Organize the digits up or down by Grade.Upgraded.
|
RatioNumber |
grade(RatioNumber.Ratio ovu,
RatioNumber.Grade grd)
Organize the digits up or down by Grade.
|
int |
hashCode() |
static RatioNumber |
number(int oneKeep,
int useKeep) |
static RatioNumber.Ratio |
ratio(int oneRate,
int useRate) |
RatioNumber |
sub(int dosage,
RatioNumber.Ratio ovu,
RatioNumber.Grade grd)
dosage sub
|
RatioNumber |
sub(RatioNumber num,
RatioNumber.Ratio ovu,
RatioNumber.Grade grd) |
String |
toString() |
public static final RatioNumber.Ratio RateOneOne
public static final RatioNumber NumberZero
public static RatioNumber.Ratio ratio(int oneRate, int useRate)
public static RatioNumber number(int oneKeep, int useKeep)
public int getOneKeep()
public int getUseKeep()
@Contract(value="_,_,_->new") public RatioNumber add(@NotNull @NotNull RatioNumber num, RatioNumber.Ratio ovu, RatioNumber.Grade grd)
@Contract(value="_,_,_->new") public RatioNumber sub(RatioNumber num, RatioNumber.Ratio ovu, RatioNumber.Grade grd)
@Contract(value="_,_,_->new") public RatioNumber add(int dosage, RatioNumber.Ratio ovu, RatioNumber.Grade grd)
@Contract(value="_,_,_->new") public RatioNumber sub(int dosage, RatioNumber.Ratio ovu, RatioNumber.Grade grd)
@Contract(value="_->new") public RatioNumber grade(RatioNumber.Ratio ovu)
@Contract(value="_,_->new") public RatioNumber grade(RatioNumber.Ratio ovu, RatioNumber.Grade grd)
@Contract(value="_,_,_,_->new") public static RatioNumber grade(int oneNum, int useNum, RatioNumber.Ratio ovu, RatioNumber.Grade grd)
oneNum - one partuseNum - use partovu - ratiogrd - grade typeCopyright © 2023. All rights reserved.