|
|
@ -1,7 +1,10 @@ |
|
|
|
package mightypork.utils.math.num; |
|
|
|
package mightypork.utils.math.num; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
import mightypork.utils.math.rect.RectView; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract class NumMathDynamic extends NumMathBase<NumView> { |
|
|
|
|
|
|
|
|
|
|
|
private NumView ceil; |
|
|
|
private NumView ceil; |
|
|
|
private NumView floor; |
|
|
|
private NumView floor; |
|
|
@ -20,12 +23,14 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
private NumView neg; |
|
|
|
private NumView neg; |
|
|
|
private NumView abs; |
|
|
|
private NumView abs; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView add(final double addend) |
|
|
|
public NumView add(final double addend) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return new NumView() { |
|
|
|
return new NumView() { |
|
|
|
|
|
|
|
|
|
|
|
private Num t = NumMathDynamic.this; |
|
|
|
private final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
@ -35,18 +40,21 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView sub(final double subtrahend) |
|
|
|
public NumView sub(final double subtrahend) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return add(-subtrahend); |
|
|
|
return add(-subtrahend); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView mul(final double factor) |
|
|
|
public NumView mul(final double factor) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return new NumView() { |
|
|
|
return new NumView() { |
|
|
|
|
|
|
|
|
|
|
|
private Num t = NumMathDynamic.this; |
|
|
|
private final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
@ -56,18 +64,21 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView div(final double factor) |
|
|
|
public NumView div(final double factor) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return mul(1 / factor); |
|
|
|
return mul(1 / factor); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView perc(final double percent) |
|
|
|
public NumView perc(final double percent) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return mul(percent / 100); |
|
|
|
return mul(percent / 100); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView neg() |
|
|
|
public NumView neg() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -75,6 +86,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -85,6 +97,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
return neg; |
|
|
|
return neg; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView abs() |
|
|
|
public NumView abs() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -92,6 +105,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -102,6 +116,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
return abs; |
|
|
|
return abs; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView max(final double other) |
|
|
|
public NumView max(final double other) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -109,6 +124,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -117,6 +133,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView min(final double other) |
|
|
|
public NumView min(final double other) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -124,6 +141,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -132,6 +150,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView pow(final double other) |
|
|
|
public NumView pow(final double other) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -139,6 +158,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -147,6 +167,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView square() |
|
|
|
public NumView square() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -154,6 +175,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -165,6 +187,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
return square; |
|
|
|
return square; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView cube() |
|
|
|
public NumView cube() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -172,6 +195,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -183,6 +207,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
return cube; |
|
|
|
return cube; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView sqrt() |
|
|
|
public NumView sqrt() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -190,6 +215,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -200,6 +226,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
return sqrt; |
|
|
|
return sqrt; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView cbrt() |
|
|
|
public NumView cbrt() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -207,6 +234,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -217,6 +245,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
return cbrt; |
|
|
|
return cbrt; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView sin() |
|
|
|
public NumView sin() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -224,6 +253,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -234,6 +264,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
return sin; |
|
|
|
return sin; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView cos() |
|
|
|
public NumView cos() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -241,6 +272,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -251,6 +283,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
return cos; |
|
|
|
return cos; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView tan() |
|
|
|
public NumView tan() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -258,6 +291,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -268,6 +302,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
return tan; |
|
|
|
return tan; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView asin() |
|
|
|
public NumView asin() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -275,6 +310,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -285,6 +321,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
return asin; |
|
|
|
return asin; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView acos() |
|
|
|
public NumView acos() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -292,6 +329,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -302,6 +340,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
return acos; |
|
|
|
return acos; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView atan() |
|
|
|
public NumView atan() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -309,6 +348,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -319,6 +359,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
return atan; |
|
|
|
return atan; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView round() |
|
|
|
public NumView round() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -326,6 +367,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -336,6 +378,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
return round; |
|
|
|
return round; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView floor() |
|
|
|
public NumView floor() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -343,6 +386,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -353,6 +397,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
return floor; |
|
|
|
return floor; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView ceil() |
|
|
|
public NumView ceil() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -360,6 +405,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -370,6 +416,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
return ceil; |
|
|
|
return ceil; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView signum() |
|
|
|
public NumView signum() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -377,6 +424,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
|
|
|
|
|
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
final Num t = NumMathDynamic.this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public double value() |
|
|
|
public double value() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -387,6 +435,7 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
return sgn; |
|
|
|
return sgn; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView average(final double other) |
|
|
|
public NumView average(final double other) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -401,7 +450,6 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public NumView add(final Num addend) |
|
|
|
public NumView add(final Num addend) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -555,4 +603,11 @@ public abstract class NumMathDynamic extends NumMathBase<NumView>{ |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public RectView box() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return RectView.make(this, this); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|