/* * JMEP - Java Mathematical Expression Parser. * Copyright (C) 1999 Jo Desmet * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * You can contact the Original submitter of this library by * email at: Jo_Desmet@yahoo.com. * */ package com.iabcinc.jmep.hooks; /** * Interface that defines a skeleton for a Variable call-back adaptor. * It should be implemented in order to use it with the addVariable method of * Environment. A way to accomplish this is by using in-line adaptor classes:<P> *<ul><pre><code>oEnv.addVariable("time", * new Variable() { * public Object getValue() { * // Call a method from containing class: * return new Double(System.currentTimeMillis()/1000.0); * } * } *);</code></pre></ul> * * @see com.iabcinc.jmep.Environment */ public interface Variable { /** * Defines the variable's behaviour. As no problems could be expected from * getting a known variable it can be expected to always return a legal * value, hence the return value should be never <code>null</code>. * @param contextID * @return the variable contents. Supported return types are <code>String</code>, * <code>Integer</code> and <code>Double</code>. */ public int getValue (int[] ifInt, float[] ifFloat, Object[] ifObject, int contextID); }