CPD Results
The following document contains the results of PMD's CPD 7.12.0.
Duplications
File |
Line |
net\sourceforge\joceanus\oceanus\decimal\OceanusDecimal.java |
324 |
net\sourceforge\joceanus\oceanus\decimal\OceanusNewDecimal.java |
448 |
protected static long adjustDecimals(final long pValue,
final int iAdjust) {
/* Take a copy of the value */
long myValue = pValue;
/* If we need to reduce decimals */
if (iAdjust < 0) {
/* If we have more than one decimal to remove */
if (iAdjust + 1 < 0) {
/* Calculate division factor (minus one) */
final long myFactor = getFactor(-(iAdjust + 1));
/* Reduce to 10 times required value */
myValue /= myFactor;
}
/* Access last digit */
long myDigit = myValue
% RADIX_TEN;
/* Handle negatiove values */
int myAdjust = 1;
if (myDigit < 0) {
myAdjust = -1;
myDigit = -myDigit;
}
/* Reduce final decimal and round up if required */
myValue /= RADIX_TEN;
if (myDigit >= (RADIX_TEN >> 1)) {
myValue += myAdjust;
}
/* else if we need to expand fractional product */
} else if (iAdjust > 0) {
myValue *= getFactor(iAdjust);
}
/* Return the adjusted value */
return myValue;
} |
File |
Line |
net\sourceforge\joceanus\oceanus\decimal\OceanusDecimalParser.java |
122 |
net\sourceforge\joceanus\oceanus\decimal\OceanusDecimalParser.java |
404 |
final OceanusDecimal pResult) {
/* Handle null value */
if (pValue == null) {
throw new IllegalArgumentException();
}
/* Create a working copy */
final StringBuilder myWork = new StringBuilder(pValue.trim());
/* If the value is negative, strip the leading minus sign */
final boolean isNegative = (myWork.length() > 0)
&& (myWork.charAt(0) == pLocale.getMinusSign());
if (isNegative) {
myWork.deleteCharAt(0);
}
/* Remove any grouping characters from the value */
final String myGrouping = pLocale.getGrouping();
int myPos;
for (;;) {
myPos = myWork.indexOf(myGrouping);
if (myPos == -1) {
break;
}
myWork.deleteCharAt(myPos);
}
/* Trim leading and trailing blanks again */
trimBuffer(myWork); |