/libformula-1.1.3/source/org/pentaho/reporting/libraries/formula/FormulaContext.java
Java | 99 lines | 17 code | 10 blank | 72 comment | 0 complexity | db0d0e933e3fee956a972234e5a9a1f7 MD5 | raw file
Possible License(s): LGPL-2.1
1/*
2 * This program is free software; you can redistribute it and/or modify it under the
3 * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software
4 * Foundation.
5 *
6 * You should have received a copy of the GNU Lesser General Public License along with this
7 * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
8 * or from the Free Software Foundation, Inc.,
9 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU Lesser General Public License for more details.
14 *
15 * Copyright (c) 2006 - 2009 Pentaho Corporation and Contributors. All rights reserved.
16 */
17
18package org.pentaho.reporting.libraries.formula;
19
20import org.pentaho.reporting.libraries.formula.function.FunctionRegistry;
21import org.pentaho.reporting.libraries.formula.operators.OperatorFactory;
22import org.pentaho.reporting.libraries.formula.typing.Type;
23import org.pentaho.reporting.libraries.formula.typing.TypeRegistry;
24import org.pentaho.reporting.libraries.base.config.Configuration;
25
26/**
27 * The formula-context connects the formula functions with the outside world. The context can be used to resolve
28 * external references, to query the configuration or to retrieve information about the formula-evaluation system.
29 *
30 * @author Thomas Morgner
31 */
32public interface FormulaContext
33{
34 /**
35 * Checks whether the external object referenced by <code>name</code> has changed.
36 *
37 * @param name the name that identifies the reference.
38 * @return true, if the reference has changed, false otherwise.
39 * @throws ContextEvaluationException if an error occurs.
40 */
41 public boolean isReferenceDirty(Object name) throws ContextEvaluationException;
42
43 /**
44 * Resolves the given reference. How the name is interpreted by the outside system is an implementation detail.
45 *
46 * @param name the name that identifies the reference.
47 * @return the resolved object.
48 * @throws ContextEvaluationException if an error occurs.
49 */
50 public Object resolveReference(Object name) throws ContextEvaluationException;
51
52 /**
53 * Queries the type of the given reference. How the name is interpreted by the outside system is an implementation
54 * detail. This return a LibFormula type object matching the type of the object that would be returned by
55 * resolveReference.
56 *
57 * @param name the name that identifies the reference.
58 * @return the type of the resolved object.
59 * @throws ContextEvaluationException if an error occurs.
60 */
61 public Type resolveReferenceType(Object name) throws ContextEvaluationException;
62
63 /**
64 * Returns the localization context of this formula. The localization context can be used to query locale specific
65 * configuration settings.
66 *
67 * @return the localization context.
68 */
69 public LocalizationContext getLocalizationContext();
70
71 /**
72 * Returns the local configuration of the formula.
73 *
74 * @return the local configuration.
75 */
76 public Configuration getConfiguration();
77
78 /**
79 * Returns the function registry. The function registry grants access to all formula-function implementations.
80 *
81 * @return the function registry.
82 */
83 public FunctionRegistry getFunctionRegistry();
84
85 /**
86 * Returns the type registry. The type registry contains all type information and allows to convert values between
87 * different types.
88 *
89 * @return the function registry.
90 */
91 public TypeRegistry getTypeRegistry();
92
93 /**
94 * Returns the operator registry. The Operator-registry contains all operator-implementations.
95 *
96 * @return the operator registry.
97 */
98 public OperatorFactory getOperatorFactory();
99}