/*! ****************************************************************************** * * Pentaho Data Integration * * Copyright (C) 2002-2013 by Pentaho : http://www.pentaho.com * ******************************************************************************* * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************************/ package org.pentaho.di.trans.steps.formula; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.trans.step.BaseStepData; import org.pentaho.di.trans.step.StepDataInterface; import org.pentaho.reporting.libraries.formula.EvaluationException; import org.pentaho.reporting.libraries.formula.Formula; import org.pentaho.reporting.libraries.formula.parser.FormulaParser; import org.pentaho.reporting.libraries.formula.parser.ParseException; /** * @author Matt * @since 8-sep-2005 * */ public class FormulaData extends BaseStepData implements StepDataInterface { public static final int RETURN_TYPE_STRING = 0; public static final int RETURN_TYPE_NUMBER = 1; public static final int RETURN_TYPE_INTEGER = 2; public static final int RETURN_TYPE_LONG = 3; public static final int RETURN_TYPE_DATE = 4; public static final int RETURN_TYPE_BIGDECIMAL = 5; public static final int RETURN_TYPE_BYTE_ARRAY = 6; public static final int RETURN_TYPE_BOOLEAN = 7; public RowForumulaContext context; public Formula[] formulas; public FormulaParser parser; public RowMetaInterface outputRowMeta; public int[] returnType; public int[] replaceIndex; public FormulaData() { super(); } public Formula createFormula( String formulaText ) throws EvaluationException, ParseException { Formula result = new Formula( formulaText ); result.initialize( context ); return result; } }