github-68: add @Override to o.a.p.ss.usermodel.charts.DataSources. Thanks to Alain-Bearez.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1813868 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2017-10-31 10:17:38 +00:00
parent 06ea018e03
commit cb28546f50
1 changed files with 12 additions and 0 deletions

View File

@ -40,6 +40,7 @@ public class DataSources {
public static ChartDataSource<Number> fromNumericCellRange(Sheet sheet, CellRangeAddress cellRangeAddress) { public static ChartDataSource<Number> fromNumericCellRange(Sheet sheet, CellRangeAddress cellRangeAddress) {
return new AbstractCellRangeDataSource<Number>(sheet, cellRangeAddress) { return new AbstractCellRangeDataSource<Number>(sheet, cellRangeAddress) {
@Override
public Number getPointAt(int index) { public Number getPointAt(int index) {
CellValue cellValue = getCellValueAt(index); CellValue cellValue = getCellValueAt(index);
if (cellValue != null && cellValue.getCellType() == CellType.NUMERIC) { if (cellValue != null && cellValue.getCellType() == CellType.NUMERIC) {
@ -49,6 +50,7 @@ public class DataSources {
} }
} }
@Override
public boolean isNumeric() { public boolean isNumeric() {
return true; return true;
} }
@ -57,6 +59,7 @@ public class DataSources {
public static ChartDataSource<String> fromStringCellRange(Sheet sheet, CellRangeAddress cellRangeAddress) { public static ChartDataSource<String> fromStringCellRange(Sheet sheet, CellRangeAddress cellRangeAddress) {
return new AbstractCellRangeDataSource<String>(sheet, cellRangeAddress) { return new AbstractCellRangeDataSource<String>(sheet, cellRangeAddress) {
@Override
public String getPointAt(int index) { public String getPointAt(int index) {
CellValue cellValue = getCellValueAt(index); CellValue cellValue = getCellValueAt(index);
if (cellValue != null && cellValue.getCellType() == CellType.STRING) { if (cellValue != null && cellValue.getCellType() == CellType.STRING) {
@ -66,6 +69,7 @@ public class DataSources {
} }
} }
@Override
public boolean isNumeric() { public boolean isNumeric() {
return false; return false;
} }
@ -80,23 +84,28 @@ public class DataSources {
this.elements = elements.clone(); this.elements = elements.clone();
} }
@Override
public int getPointCount() { public int getPointCount() {
return elements.length; return elements.length;
} }
@Override
public T getPointAt(int index) { public T getPointAt(int index) {
return elements[index]; return elements[index];
} }
@Override
public boolean isReference() { public boolean isReference() {
return false; return false;
} }
@Override
public boolean isNumeric() { public boolean isNumeric() {
Class<?> arrayComponentType = elements.getClass().getComponentType(); Class<?> arrayComponentType = elements.getClass().getComponentType();
return (Number.class.isAssignableFrom(arrayComponentType)); return (Number.class.isAssignableFrom(arrayComponentType));
} }
@Override
public String getFormulaString() { public String getFormulaString() {
throw new UnsupportedOperationException("Literal data source can not be expressed by reference."); throw new UnsupportedOperationException("Literal data source can not be expressed by reference.");
} }
@ -116,14 +125,17 @@ public class DataSources {
this.evaluator = sheet.getWorkbook().getCreationHelper().createFormulaEvaluator(); this.evaluator = sheet.getWorkbook().getCreationHelper().createFormulaEvaluator();
} }
@Override
public int getPointCount() { public int getPointCount() {
return numOfCells; return numOfCells;
} }
@Override
public boolean isReference() { public boolean isReference() {
return true; return true;
} }
@Override
public String getFormulaString() { public String getFormulaString() {
return cellRangeAddress.formatAsString(sheet.getSheetName(), true); return cellRangeAddress.formatAsString(sheet.getSheetName(), true);
} }