public boolean evaluate(FeatureClassInfo fci, int row, StringBuffer reasoning) { // Pre-cache column index so we don't have to do lookup for each entry. if (colIndex == -1 || otherColIndex == -1 || this.fci != fci) { setIndexes(fci); } // The columns aren't found if (colIndex == -1 || otherColIndex == -1) { logger.finer( "col " + colName + " or " + otherColName + " not found in FCI[" + fci.columnNameString() + "]"); return false; } List<Object> fcirow = new ArrayList<Object>(); try { if (fci.getRow(fcirow, row)) { Double realVal1 = Double.parseDouble(fcirow.get(colIndex).toString()); Double realVal2 = Double.parseDouble(fcirow.get(otherColIndex).toString()); return test(realVal1, realVal2, reasoning); } } catch (FormatException fe) { } catch (NumberFormatException nfe) { } return false; }
protected void setIndexes(FeatureClassInfo fci) { this.fci = fci; colIndex = -1; int columnCount = fci.getColumnCount(); for (int column = 0; column < columnCount; column++) { if (fci.getColumnName(column).equalsIgnoreCase(colName)) { colIndex = column; break; } } }
public boolean evaluate(FeatureClassInfo fci, List<Object> row, StringBuffer reasoning) { // Pre-cache column index so we don't have to do lookup for each entry. if (colIndex == -1 || this.fci != fci) { setIndexes(fci); } try { if (colIndex < 0) { if (reasoning != null) { reasoning .append("\n col ") .append(colName) .append(" not found in FCI[") .append(fci.columnNameString()) .append("]"); } return false; } Double realVal = Double.parseDouble(row.get(colIndex).toString()); return test(realVal, val, reasoning); } catch (NumberFormatException nfe) { if (reasoning != null) { reasoning.append("\n NumberFormatException reading ").append(row.get(colIndex)); } } return false; }
public boolean evaluate(FeatureClassInfo fci, int row, StringBuffer reasoning) { // Pre-cache column index so we don't have to do lookup for each entry. if (colIndex == -1 || this.fci != fci) { setIndexes(fci); } List<Object> fcirow = new ArrayList<Object>(); try { if (fci.getRow(fcirow, row)) { if (colIndex < 0) { if (reasoning != null) { reasoning .append("\n col ") .append(colName) .append(" not found in FCI[") .append(fci.columnNameString()) .append("]"); } logger.info("col " + colName + " not found in FCI[" + fci.columnNameString() + "]"); return false; } String realVal = fcirow.get(colIndex).toString().trim(); return test(realVal, val, reasoning); } else { if (reasoning != null) { reasoning.append("\n Can't read row ").append(row); } } } catch (FormatException fe) { if (reasoning != null) { reasoning.append("\n FormatException reading row ").append(row); } } return false; }
/** For ECDISExpressions, none of the arguments matter. */ public boolean evaluate(FeatureClassInfo fci, List<Object> row, StringBuffer reasoning) { // Pre-cache column index so we don't have to do lookup for each entry. if (colIndex == -1 || this.fci != fci) { setIndexes(fci); } // The columns aren't found if (colIndex == -1) { logger.finer("col " + colName + " not found in FCI[" + fci.columnNameString() + "]"); return false; } Object realVal = row.get(colIndex); if (realVal == null) { realVal = ""; } return test(realVal.toString().trim(), val, reasoning); }