|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Observable
jimm.datavision.Expression
public abstract class Expression
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:
| Field Summary | |
|---|---|
protected java.lang.String |
exceptAfter
|
protected java.lang.String |
expr
|
protected java.lang.Long |
id
|
protected java.lang.String |
name
|
protected java.util.ArrayList |
observedContents
|
protected Report |
report
|
| Constructor Summary | |
|---|---|
protected |
Expression(java.lang.Long id,
Report report,
java.lang.String name,
java.lang.String expression,
java.lang.String exceptAfter)
Constructor. |
| Method Summary | |
|---|---|
java.util.Collection |
columnsUsed()
Returns a collection of the columns used in the expression. |
abstract java.lang.String |
designLabel()
|
static java.lang.String |
displayToExpression(Report report,
java.lang.String str)
Given a string, returns a string with all instances of formula, parameter, and user column "display names" replaced by "formula strings". |
abstract java.lang.String |
dragString()
Returns the string used to identify the object when dragging it. |
static java.lang.String |
expressionToDisplay(Report report,
java.lang.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 java.lang.String |
formulaString()
|
java.lang.String |
getEditableExpression()
Returns the expression string fit for human consumption. |
java.lang.String |
getExpression()
Returns the expression string. |
java.lang.Object |
getId()
Returns the identity. |
java.lang.String |
getName()
Returns the name for this expression. |
boolean |
refersTo(Expression expression)
Returns true if this expression contains a reference to the
specified expression (formula or user column). |
boolean |
refersTo(Field f)
Returns true if this expression contains a reference to the
specified field. |
boolean |
refersTo(Parameter p)
Returns true if this expression contains a reference to the
specified parameter. |
void |
setEditableExpression(java.lang.String newExpression)
Sets the eval string after replacing formula, parameter, and user column names with their id numbers. |
void |
setExpression(java.lang.String newExpression)
Sets the eval string. |
void |
setName(java.lang.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. |
void |
update(java.util.Observable o,
java.lang.Object arg)
|
java.util.Collection |
userColumnsUsed()
Returns a collection of the user columns used in the expression. |
protected void |
writeAdditionalAttributes(XMLWriter out)
Writes additional attributes. |
abstract void |
writeXML(XMLWriter out)
Writes this expression as an XML tag. |
protected void |
writeXML(XMLWriter out,
java.lang.String elementName)
|
| Methods inherited from class java.util.Observable |
|---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.Long id
protected Report report
protected java.lang.String name
protected java.lang.String expr
protected java.lang.String exceptAfter
protected java.util.ArrayList observedContents
| Constructor Detail |
|---|
protected Expression(java.lang.Long id,
Report report,
java.lang.String name,
java.lang.String expression,
java.lang.String exceptAfter)
null, throws an
IllegalArgumentException. This is because subclasses are
responsible for generating their id number. For example, formulas call
Report.generateNewFormulaId.
id - the unique identifier for the new expression; may not be
nullreport - the report containing this expressionname - the expression nameexpression - the string to evaulate at runtime; may be
nullexceptAfter - when looking for things inside "{}" braces, ignore
braces immediately after this string| Method Detail |
|---|
public static java.lang.String expressionToDisplay(Report report,
java.lang.String str)
public static java.lang.String displayToExpression(Report report,
java.lang.String str)
report - a reportstr - a string with display names
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable
public void update(java.util.Observable o,
java.lang.Object arg)
update in interface java.util.Observerpublic java.lang.Object getId()
Identity
getId in interface Identitypublic java.lang.String getName()
getName in interface Nameablepublic void setName(java.lang.String newName)
setName in interface NameablenewName - the new namepublic java.lang.String getExpression()
public void setExpression(java.lang.String newExpression)
newExpression - the new eval stringprotected void startObservingContents()
protected void stopObservingContents()
public java.lang.String getEditableExpression()
public void setEditableExpression(java.lang.String newExpression)
This method will throw an IllegalArgumentException if any
formula, parameter, or user column name is not the name of some existing
object.
newExpression - the new eval string
java.lang.IllegalArgumentExceptionpublic abstract java.lang.String dragString()
Draggable
dragString in interface Draggablepublic abstract java.lang.String designLabel()
public abstract java.lang.String formulaString()
public boolean refersTo(Field f)
true if this expression contains a reference to the
specified field.
f - a field
true if this field contains a reference to the
specified fieldpublic boolean refersTo(Expression expression)
true if this expression contains a reference to the
specified expression (formula or user column).
expression - an expression
true if this field is the same as or contains a
reference to the specified expressionpublic boolean refersTo(Parameter p)
true if this expression contains a reference to the
specified parameter.
p - a parameter
true if this field contains a reference to the
specified parameterpublic java.util.Collection columnsUsed()
Query.findSelectablesUsed()public java.util.Collection userColumnsUsed()
Query.findSelectablesUsed()public abstract void writeXML(XMLWriter out)
writeXML in interface Writeableout - a writer that knows how to write XML
protected void writeXML(XMLWriter out,
java.lang.String elementName)
protected void writeAdditionalAttributes(XMLWriter out)
out - a writer that knows how to write XML
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||