if (target == null) {
return false;
}
String[] list = constraint.getExplicitListValues();
if (list != null) {
CellValue candidate = null;
for(int j = 0; j < list.length; ++j) {
String txt = list[j];
if (txt == null) {
continue; //skip
} else if (txt.startsWith("=")) { //must be string
candidate = new CellValue(txt);
} else {
candidate = getEvalValue(sheet, txt);
}
if (candidate != null && equalCellValue(target, candidate)) {
return true;
}
}
return false;
} else {
String txt = constraint.getFormula1();
Book book = sheet.getBook();
final ValueEval ve = BookHelper.evaluateFormulaValueEval(book, book.getSheetIndex(sheet), txt, false);
if (ve instanceof ArrayEval) {
final ArrayEval ae = (ArrayEval) ve;
if (ae.isColumn() || ae.isRow()) {
final int rows = ae.getHeight();
final int cols = ae.getWidth();
for (int r = 0; r < rows; ++r) {
for (int c = 0; c < cols; ++c) {
ValueEval xve = ae.getValue(r, c);
final CellValue candidate = book.getFormulaEvaluator().getCellValueByValueEval(xve);
if (equalCellValue(target, candidate)) {
return true;
}
}
}
}
} else {
final CellValue candidate = book.getFormulaEvaluator().getCellValueByValueEval(ve);
if (equalCellValue(target, candidate)) {
return true;
}
}
return false;