mirror of
https://github.com/DanilaFe/abacus
synced 2026-01-15 19:35:20 +00:00
Format code.
This commit is contained in:
@@ -26,6 +26,7 @@ public class NaiveNumber implements NumberInterface {
|
||||
public NaiveNumber(String value) {
|
||||
this(Double.parseDouble(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new NaiveNumber with the given value.
|
||||
*
|
||||
@@ -110,7 +111,7 @@ public class NaiveNumber implements NumberInterface {
|
||||
|
||||
@Override
|
||||
public int intValue() {
|
||||
return (int)value;
|
||||
return (int) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -81,18 +81,21 @@ public interface NumberInterface {
|
||||
|
||||
/**
|
||||
* Returns the least integer greater than or equal to the number.
|
||||
*
|
||||
* @return the least integer >= the number, if int can hold the value.
|
||||
*/
|
||||
NumberInterface ceiling();
|
||||
|
||||
/**
|
||||
* Return the greatest integer less than or equal to the number.
|
||||
*
|
||||
* @return the greatest int >= the number, if int can hold the value.
|
||||
*/
|
||||
NumberInterface floor();
|
||||
|
||||
/**
|
||||
* Returns the fractional part of the number.
|
||||
*
|
||||
* @return the fractional part of the number.
|
||||
*/
|
||||
NumberInterface fractionalPart();
|
||||
@@ -100,6 +103,7 @@ public interface NumberInterface {
|
||||
/**
|
||||
* Returns the integer representation of this number, discarding any fractional part,
|
||||
* if int can hold the value.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int intValue();
|
||||
|
||||
@@ -102,7 +102,7 @@ public class PreciseNumber implements NumberInterface {
|
||||
public NumberInterface ceiling() {
|
||||
String str = value.toPlainString();
|
||||
int decimalIndex = str.indexOf('.');
|
||||
if(decimalIndex != -1){
|
||||
if (decimalIndex != -1) {
|
||||
return this.floor().add(ONE);
|
||||
}
|
||||
return this;
|
||||
@@ -112,7 +112,7 @@ public class PreciseNumber implements NumberInterface {
|
||||
public NumberInterface floor() {
|
||||
String str = value.toPlainString();
|
||||
int decimalIndex = str.indexOf('.');
|
||||
if(decimalIndex != -1){
|
||||
if (decimalIndex != -1) {
|
||||
return new PreciseNumber(str.substring(0, decimalIndex));
|
||||
}
|
||||
return this;
|
||||
@@ -122,7 +122,7 @@ public class PreciseNumber implements NumberInterface {
|
||||
public NumberInterface fractionalPart() {
|
||||
String str = value.toPlainString();
|
||||
int decimalIndex = str.indexOf('.');
|
||||
if(decimalIndex != -1){
|
||||
if (decimalIndex != -1) {
|
||||
return new PreciseNumber(str.substring(decimalIndex + 1));
|
||||
}
|
||||
return ZERO;
|
||||
|
||||
Reference in New Issue
Block a user