mirror of https://github.com/rusefi/RomRaider.git
fix compare
git-svn-id: https://svn2.assembla.com/svn/romraider/trunk@187 38686702-15cf-42e4-a595-3071df8bf5ea
This commit is contained in:
parent
1d2cb05aa4
commit
48498b50df
|
@ -40,6 +40,7 @@ import java.text.DecimalFormat;
|
|||
|
||||
public class DataCell extends JLabel implements MouseListener, Serializable {
|
||||
private static final Logger LOGGER = Logger.getLogger(DataCell.class);
|
||||
private static final DecimalFormat PERCENT_FORMAT = new DecimalFormat("#,##0.0%");
|
||||
private final Border defaultBorder = createLineBorder(BLACK, 1);
|
||||
private final Border modifiedBorder = createLineBorder(RED, 3);
|
||||
private final Font defaultFont = new Font("Arial", Font.BOLD, 12);
|
||||
|
@ -93,10 +94,12 @@ public class DataCell extends JLabel implements MouseListener, Serializable {
|
|||
double thatValue = calcDisplayValue(compareValue, expression);
|
||||
double difference = thisValue - thatValue;
|
||||
if (difference == 0) {
|
||||
displayValue = "0%";
|
||||
displayValue = PERCENT_FORMAT.format(0.0);
|
||||
} else if (thatValue == 0.0) {
|
||||
displayValue = '\u221e' + "%";
|
||||
} else {
|
||||
double denominator = thisValue == 0.0 ? abs(difference) : thisValue;
|
||||
displayValue = (int) (difference / denominator * 100) + "%";
|
||||
double d = difference / abs(thatValue);
|
||||
displayValue = PERCENT_FORMAT.format(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -997,11 +997,9 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
if ("[Table1D]".equalsIgnoreCase(pasteType)) { // copied entire table
|
||||
int i = 0;
|
||||
while (st.hasMoreTokens()) {
|
||||
String currentToken = st.nextToken();
|
||||
try {
|
||||
if (!data[i].getText().equalsIgnoreCase(currentToken)) {
|
||||
data[i].setCompareRealValue(currentToken);
|
||||
}
|
||||
String currentToken = st.nextToken();
|
||||
data[i].setCompareRealValue(currentToken);
|
||||
} catch (ArrayIndexOutOfBoundsException ex) { /* table larger than target, ignore*/ }
|
||||
i++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue