1 /* 2 Copyright (C) 2004 Grid Systems, S.A. 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License, version 2, as 6 published by the Free Software Foundation. 7 8 This program is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License 14 along with this program; if not, write to the Free Software 15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 */ 17 package com.gridsystems.beanfilter; 18 19 /** 20 * Evaluation tree node. 21 * 22 * @author Rodrigo Ruiz 23 * @author Xmas 24 * @version 1.0 25 */ 26 public abstract class EvalNode extends EvalValue { 27 28 /** 29 * Creates a new instance. 30 * 31 * @param linePos The line token position 32 * @param charPos The char token position 33 */ 34 public EvalNode(int linePos, int charPos) { 35 super(linePos, charPos); 36 } 37 38 39 /** 40 * {@inheritDoc} 41 */ 42 @Override 43 public final Object getValue(Object src) throws EvalException { 44 return eval(src); 45 } 46 47 48 /** 49 * {@inheritDoc} 50 */ 51 @Override 52 public final Class<?> getClassValue(Class<?> parentClass) throws EvalException { 53 return Boolean.class; 54 } 55 56 /** 57 * Evaluates the node. 58 * 59 * @param src Data source, for dynamic nodes 60 * @return <code>true</code> if src makes true the node 61 * @throws EvalException If an error occurs 62 */ 63 public abstract boolean eval(Object src) throws EvalException; 64 }