本文整理汇总了Java中com.rapidminer.operator.nio.model.ParsingError类的典型用法代码示例。如果您正苦于以下问题:Java ParsingError类的具体用法?Java ParsingError怎么用?Java ParsingError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParsingError类属于com.rapidminer.operator.nio.model包,在下文中一共展示了ParsingError类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValueAt
import com.rapidminer.operator.nio.model.ParsingError; //导入依赖的package包/类
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
ParsingError error = errors.get(rowIndex);
switch (columnIndex) {
case 0:
if (error.getRow() < 0 && error.getColumn() < 0) {
if (error.getColumns() == null) {
return "";
} else {
return "columns " + listToString(error.getColumns());
}
} else {
return error.getRow() + 1 + ", " + (error.getColumn() + 1);
}
case 1:
return error.getErrorCode().getMessage();
case 2:
return error.getOriginalValue();
case 3:
return error.getCause() != null ? error.getCause().getMessage() : null;
default:
return null;
}
}
示例2: setErrors
import com.rapidminer.operator.nio.model.ParsingError; //导入依赖的package包/类
public void setErrors(Collection<ParsingError> errors) {
if (!this.errors.equals(errors)) {
this.errors.clear();
this.errors.addAll(errors);
Collections.sort(this.errors, new Comparator<ParsingError>() {
@Override
public int compare(ParsingError o1, ParsingError o2) {
int rowDiff = o1.getRow() - o2.getRow();
if (rowDiff != 0) {
return rowDiff;
} else {
return o1.getColumn() - o2.getColumn();
}
}
});
fireTableStructureChanged();
}
}
示例3: checkForDuplicates
import com.rapidminer.operator.nio.model.ParsingError; //导入依赖的package包/类
public void checkForDuplicates() {
oldDuplicateNameColumn.clear();
oldDuplicateNameColumn.addAll(duplicateNameColumn);
duplicateNameColumn.clear();
oldDuplicateRoleColumn.clear();
oldDuplicateRoleColumn.addAll(duplicateRoleColumn);
duplicateRoleColumn.clear();
errorList = new ArrayList<ParsingError>();
for (Entry<String, List<Integer>> roleEntry : columnRoles.entrySet()) {
if (roleEntry.getValue().size() > 1 && !roleEntry.getKey().equals("attribute")) {
errorList.add(new ParsingError(roleEntry.getValue(), ParsingError.ErrorCode.SAME_ROLE_FOR_MULTIPLE_COLUMNS, roleEntry.getKey()));
duplicateRoleColumn.addAll(roleEntry.getValue());
}
}
for (Entry<String, List<Integer>> nameEntry : columnNames.entrySet()) {
if (nameEntry.getValue().size() > 1) {
errorList.add(new ParsingError(nameEntry.getValue(), ParsingError.ErrorCode.SAME_NAME_FOR_MULTIPLE_COLUMNS, nameEntry.getKey()));
duplicateNameColumn.addAll(nameEntry.getValue());
}
}
checkIfUpdate();
}
示例4: getValueAt
import com.rapidminer.operator.nio.model.ParsingError; //导入依赖的package包/类
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
ParsingError error = errors.get(rowIndex);
switch (columnIndex) {
case 0:
if(error.getRow() < 0 && error.getColumn() < 0) {
return "columns " + listToString(error.getColumns());
} else {
return (error.getRow()+1) + ", " + (error.getColumn()+1);
}
case 1:
return error.getErrorCode().getMessage();
case 2:
return error.getOriginalValue();
case 3:
return error.getCause() != null ? error.getCause().getMessage() : null;
default:
return null;
}
}
示例5: setErrors
import com.rapidminer.operator.nio.model.ParsingError; //导入依赖的package包/类
public void setErrors(Collection<ParsingError> errors) {
if (!this.errors.equals(errors)) {
this.errors.clear();
this.errors.addAll(errors);
Collections.sort(this.errors, new Comparator<ParsingError>() {
@Override
public int compare(ParsingError o1, ParsingError o2) {
int rowDiff = o1.getRow() - o2.getRow();
if (rowDiff != 0) {
return rowDiff;
} else {
return o1.getColumn() - o2.getColumn();
}
}
});
fireTableStructureChanged();
}
}
示例6: getDate
import com.rapidminer.operator.nio.model.ParsingError; //导入依赖的package包/类
@Override
public Date getDate(int columnIndex) throws ParseException {
String dateValue = getValue(columnIndex);
if (dateValue == null) {
return null;
}
switch (getCellType(columnIndex)) {
case NUMBER:
case DATE:
// XLSX stores dates as double values
double dateAsDouble = Double.parseDouble(dateValue);
// Use POI methods to convert value to Date java object
if (DateUtil.isValidExcelDate(dateAsDouble)) {
return DateUtil.getJavaDate(dateAsDouble, xlsxWorkbook.isDate1904);
} else {
throw new ParseException(new ParsingError(getCurrentRow() + 1, columnIndex,
ParsingError.ErrorCode.UNPARSEABLE_DATE, dateValue));
}
case INLINE_STRING:
case SHARED_STRING:
case STRING:
// In case a date is stored as String, we try to parse it here
String dateString = dateValue;
try {
return dateFormatProvider.geDateFormat().parse(dateString);
} catch (java.text.ParseException e) {
throw new ParseException(new ParsingError(getCurrentRow() + 1, columnIndex,
ParsingError.ErrorCode.UNPARSEABLE_DATE, dateString));
}
default:
throw new ParseException(new ParsingError(getCurrentRow() + 1, columnIndex,
ParsingError.ErrorCode.UNPARSEABLE_DATE, dateValue));
}
}
示例7: getNumber
import com.rapidminer.operator.nio.model.ParsingError; //导入依赖的package包/类
@Override
public Number getNumber(int columnIndex) throws ParseException {
String numberValue = getValue(columnIndex);
if (numberValue == null) {
return null;
}
try {
return Double.valueOf(numberValue);
} catch (NumberFormatException e) {
throw new ParseException(new ParsingError(getCurrentRow() + 1, columnIndex,
ParsingError.ErrorCode.UNPARSEABLE_REAL, numberValue));
}
}
示例8: checkForDuplicates
import com.rapidminer.operator.nio.model.ParsingError; //导入依赖的package包/类
public void checkForDuplicates() {
oldDuplicateNameColumn.clear();
oldDuplicateNameColumn.addAll(duplicateNameColumn);
duplicateNameColumn.clear();
oldDuplicateRoleColumn.clear();
oldDuplicateRoleColumn.addAll(duplicateRoleColumn);
duplicateRoleColumn.clear();
errorList = new ArrayList<ParsingError>();
for (Entry<String, List<Integer>> roleEntry : columnRoles.entrySet()) {
if (roleEntry.getValue().size() > 1 && !roleEntry.getKey().equals("attribute")) {
errorList.add(new ParsingError(roleEntry.getValue(), ParsingError.ErrorCode.SAME_ROLE_FOR_MULTIPLE_COLUMNS,
roleEntry.getKey()));
duplicateRoleColumn.addAll(roleEntry.getValue());
}
}
for (Entry<String, List<Integer>> nameEntry : columnNames.entrySet()) {
if (nameEntry.getValue().size() > 1) {
errorList.add(new ParsingError(nameEntry.getValue(), ParsingError.ErrorCode.SAME_NAME_FOR_MULTIPLE_COLUMNS,
nameEntry.getKey()));
duplicateNameColumn.addAll(nameEntry.getValue());
}
}
checkIfUpdate();
}
示例9: getErrorInRow
import com.rapidminer.operator.nio.model.ParsingError; //导入依赖的package包/类
public ParsingError getErrorInRow(int index) {
if (index < errors.size()) {
return errors.get(index);
} else {
return null;
}
}
示例10: getNumber
import com.rapidminer.operator.nio.model.ParsingError; //导入依赖的package包/类
@Override
/**
* This method is not supported by the XML result set. Anytime it is called a ParseException will be thrown.
*/
public Number getNumber(int columnIndex) throws ParseException {
throw new ParseException(new ParsingError(currentExampleIndex, columnIndex, ParsingError.ErrorCode.UNPARSEABLE_REAL, ""));
}
示例11: getDate
import com.rapidminer.operator.nio.model.ParsingError; //导入依赖的package包/类
@Override
/**
* This method is not supported by the XML result set. Anytime it is called a ParseException will be thrown.
*/
public Date getDate(int columnIndex) throws ParseException {
throw new ParseException(new ParsingError(currentExampleIndex, columnIndex, ParsingError.ErrorCode.UNPARSEABLE_DATE, ""));
}
示例12: getErrors
import com.rapidminer.operator.nio.model.ParsingError; //导入依赖的package包/类
public List<ParsingError> getErrors() {
return errorList;
}