| java.lang.Object java.util.Observable jimm.datavision.Expression
All known Subclasses: jimm.datavision.UserColumn, jimm.datavision.Formula,
Expression | abstract public class Expression extends Observable implements Identity,Nameable,Writeable,Draggable,Observer(Code) | | The abstract superclass of objects that are evaluated, such as formulas
and user columns. An expression contains text that is evaluated. The
text may contain database column values, formulas, special values,
or other types of objects.
Before being evaluated, the following substitutions are made withing
the evaluation string:
- {table_name.column_name} is replaced by the current value
of the column table_name.column_name.
- {@id_number} is replaced by the results of evaluating the
formula whose id is id_number.
- {%special_value_name} is replaced by a special value
(report title, report run date, page number, or record number).
- {?id_number} is replaced by a parameter value (string,
number, or date).
- {!id_number} is replaced by a user column's value (string,
number, or date).
|
Method Summary | |
public Collection | columnsUsed() Returns a collection of the columns used in the expression. | abstract public String | designLabel() | public static String | displayToExpression(Report report, String str) Given a string, returns a string with all instances of formula,
parameter, and user column "display names" replaced by "formula
strings". | abstract public String | dragString() | public static String | expressionToDisplay(Report report, String str) Given a string, returns a string with all instances of formula,
parameter, and user column "formula strings" replaced by "display name"
strings. | protected void | finalize() | abstract public String | formulaString() | public String | getEditableExpression() Returns the expression string fit for human consumption. | public String | getExpression() Returns the expression string. | public Object | getId() | public String | getName() Returns the name for this expression. | public boolean | refersTo(Field f) Returns true if this expression contains a reference to the
specified field. | public boolean | refersTo(Expression expression) Returns true if this expression contains a reference to the
specified expression (formula or user column). | public boolean | refersTo(Parameter p) Returns true if this expression contains a reference to the
specified parameter. | public void | setEditableExpression(String newExpression) Sets the eval string after replacing formula, parameter, and user column
names with their id numbers. | public void | setExpression(String newExpression) Sets the eval string. | public void | setName(String newName) Sets the name. | protected void | startObservingContents() Starts observing all observables referenced by this expression: formulas,
parameters, and user columns. | protected void | stopObservingContents() Stops observing that which we were observing. | public void | update(Observable o, Object arg) | public Collection | userColumnsUsed() Returns a collection of the user columns used in the expression. | protected void | writeAdditionalAttributes(XMLWriter out) Writes additional attributes. | abstract public void | writeXML(XMLWriter out) Writes this expression as an XML tag. | protected void | writeXML(XMLWriter out, String elementName) |
Expression | protected Expression(Long id, Report report, String name, String expression, String exceptAfter)(Code) | | Constructor. If id is null , throws an
IllegalArgumentException . This is because subclasses are
responsible for generating their id number. For example, formulas call
Report.generateNewFormulaId .
Parameters: id - the unique identifier for the new expression; may not benull Parameters: report - the report containing this expression Parameters: name - the expression name Parameters: expression - the string to evaulate at runtime; may benull Parameters: exceptAfter - when looking for things inside "{}" braces, ignorebraces immediately after this string |
columnsUsed | public Collection columnsUsed()(Code) | | Returns a collection of the columns used in the expression. This is used
by the report's query when it is figuring out what columns and tables
are used by the report.
a possibly empty collection of database columns See Also: jimm.datavision.source.Query.findSelectablesUsed |
displayToExpression | public static String displayToExpression(Report report, String str)(Code) | | Given a string, returns a string with all instances of formula,
parameter, and user column "display names" replaced by "formula
strings". If there are no such strings, the original string is returned.
Parameters: report - a report Parameters: str - a string with display names a string with all display names replaced by formula strings |
expressionToDisplay | public static String expressionToDisplay(Report report, String str)(Code) | | Given a string, returns a string with all instances of formula,
parameter, and user column "formula strings" replaced by "display name"
strings. If there are no such strings, the original string is returned.
a string with all formula strings replaced by display namestrings |
getEditableExpression | public String getEditableExpression()(Code) | | Returns the expression string fit for human consumption. This mainly means
that we substitute formula, parameter, and user column numbers with names.
Called from any expression editor. This code assumes that curly braces are
never nested.
the eval string with formula, parameter, and user column id numbersreplaced with names |
getExpression | public String getExpression()(Code) | | Returns the expression string.
the eval string |
getName | public String getName()(Code) | | Returns the name for this expression.
the name |
refersTo | public boolean refersTo(Field f)(Code) | | Returns true if this expression contains a reference to the
specified field.
Parameters: f - a field true if this field contains a reference to thespecified field |
refersTo | public boolean refersTo(Expression expression)(Code) | | Returns true if this expression contains a reference to the
specified expression (formula or user column).
Parameters: expression - an expression true if this field is the same as or contains areference to the specified expression |
refersTo | public boolean refersTo(Parameter p)(Code) | | Returns true if this expression contains a reference to the
specified parameter.
Parameters: p - a parameter true if this field contains a reference to thespecified parameter |
setEditableExpression | public void setEditableExpression(String newExpression)(Code) | | Sets the eval string after replacing formula, parameter, and user column
names with their id numbers. Called from a editor.
This method will throw an IllegalArgumentException if any
formula, parameter, or user column name is not the name of some existing
object.
Parameters: newExpression - the new eval string throws: IllegalArgumentException - |
setExpression | public void setExpression(String newExpression)(Code) | | Sets the eval string.
Parameters: newExpression - the new eval string |
setName | public void setName(String newName)(Code) | | Sets the name.
Parameters: newName - the new name |
startObservingContents | protected void startObservingContents()(Code) | | Starts observing all observables referenced by this expression: formulas,
parameters, and user columns.
|
stopObservingContents | protected void stopObservingContents()(Code) | | Stops observing that which we were observing.
|
userColumnsUsed | public Collection userColumnsUsed()(Code) | | Returns a collection of the user columns used in the expression. This
is used by the report's query when it is figuring out what columns,
tables, and user columns are used by the report.
a possibly empty collection of user columns See Also: jimm.datavision.source.Query.findSelectablesUsed |
writeAdditionalAttributes | protected void writeAdditionalAttributes(XMLWriter out)(Code) | | Writes additional attributes. Default behavior is to do nothing.
Parameters: out - a writer that knows how to write XML |
writeXML | abstract public void writeXML(XMLWriter out)(Code) | | Writes this expression as an XML tag.
Parameters: out - a writer that knows how to write XML |
|
|