jaitools.jiffle.runtime.AbstractJiffleRuntime Maven / Gradle / Ivy
/*
* Copyright 2011 Michael Bedward
*
* This file is part of jai-tools.
*
* jai-tools 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 3 of the
* License, or (at your option) any later version.
*
* jai-tools 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 jai-tools. If not, see .
*
*/
package jaitools.jiffle.runtime;
/**
* Provides default implementations of {@link JiffleRuntime} methods plus
* some common fields.
*
* @author Michael Bedward
* @since 1.1
* @version $Id: AbstractJiffleRuntime.java 1505 2011-03-05 11:37:43Z michael.bedward $
*/
public abstract class AbstractJiffleRuntime implements JiffleRuntime {
/** Whether the outside option is set. */
protected boolean _outsideValueSet = false;
/**
* The value to return for out-of-bounds image data requests if the
* outside option is set.
*/
protected double _outsideValue;
/**
* A stack of integer values used in the evaluation of if statements.
*/
protected IntegerStack _stk;
/**
* Provides runtime function support.
*/
protected final JiffleFunctions _FN;
/**
* Creates a new instance of this class and initializes its
* {@link JiffleFunctions} and {@link IntegerStack} objects.
*/
public AbstractJiffleRuntime() {
_FN = new JiffleFunctions();
_stk = new IntegerStack();
}
/**
* {@inheritDoc}
*/
public Double getVar(String varName) {
return null;
}
/**
* Initializes image-scope variables. These are fields in the runtime class.
* They are initialized in a separate method rather than the constructor
* because they may depend on expressions involving values that are not
* known until the processing area is set (e.g. Jiffle's width() function).
*/
protected abstract void initImageScopeVars();
/**
* Initializes runtime class fields related to Jiffle script options.
*/
protected abstract void initOptionVars();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy