prefuse.data.expression
Class FunctionExpression

java.lang.Object
  extended by prefuse.data.expression.AbstractExpression
      extended by prefuse.data.expression.FunctionExpression
All Implemented Interfaces:
java.util.EventListener, ExpressionListener, Expression, Function

public abstract class FunctionExpression
extends AbstractExpression
implements Function

Abstract base class for FunctionExpression implementations. Provides parameter handling support.

Author:
jeffrey heer

Field Summary
protected  CopyOnWriteArrayList m_params
           
protected  int m_pcount
           
 
Fields inherited from interface prefuse.data.expression.Function
VARARGS
 
Constructor Summary
protected FunctionExpression(int parameterCount)
          Protected constructor.
 
Method Summary
protected  void addChildListeners()
          Add child listeners to catch and propagate sub-expression updates.
 void addParameter(Expression e)
          Add a parameter value sub-expression to this function.
abstract  java.lang.String getName()
          Get the name of this function.
 int getParameterCount()
          Get the maximum number of parameters accepted by this Function.
protected  void missingParams()
          Throw an exception when needed parameters are missing.
protected  Expression param(int idx)
          Return the parameter expression at the given index.
protected  int paramCount()
          An internal-only method that returns the current number of parameters collected.
protected  void removeChildListeners()
          Remove child listeners for sub-expression updates.
 java.lang.String toString()
           
 void visit(ExpressionVisitor v)
          Passes the visitor through this expression and any sub expressions
 
Methods inherited from class prefuse.data.expression.AbstractExpression
addExpressionListener, expressionChanged, fireExpressionChange, get, getBoolean, getDouble, getFloat, getInt, getLong, hasListeners, removeExpressionListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface prefuse.data.expression.Expression
addExpressionListener, get, getBoolean, getDouble, getFloat, getInt, getLong, getType, removeExpressionListener
 

Field Detail

m_params

protected CopyOnWriteArrayList m_params

m_pcount

protected final int m_pcount
Constructor Detail

FunctionExpression

protected FunctionExpression(int parameterCount)
Protected constructor.

Parameters:
parameterCount - the max parameter count
Method Detail

getName

public abstract java.lang.String getName()
Description copied from interface: Function
Get the name of this function.

Specified by:
getName in interface Function
Returns:
the function name
See Also:
Function.getName()

addParameter

public void addParameter(Expression e)
Description copied from interface: Function
Add a parameter value sub-expression to this function.

Specified by:
addParameter in interface Function
Parameters:
e - the parameter sub-expression
See Also:
Function.addParameter(prefuse.data.expression.Expression)

paramCount

protected int paramCount()
An internal-only method that returns the current number of parameters collected.


param

protected final Expression param(int idx)
Return the parameter expression at the given index.

Parameters:
idx - the parameter index
Returns:
the parameter value Expression at the given index

getParameterCount

public int getParameterCount()
Description copied from interface: Function
Get the maximum number of parameters accepted by this Function.

Specified by:
getParameterCount in interface Function
Returns:
the maximum number of parametes accepted, or Function.VARARGS is the number is variable.
See Also:
Function.getParameterCount()

missingParams

protected void missingParams()
Throw an exception when needed parameters are missing.


visit

public void visit(ExpressionVisitor v)
Description copied from interface: Expression
Passes the visitor through this expression and any sub expressions

Specified by:
visit in interface Expression
Overrides:
visit in class AbstractExpression
Parameters:
v - the ExpressionVisitor
See Also:
Expression.visit(prefuse.data.expression.ExpressionVisitor)

addChildListeners

protected void addChildListeners()
Description copied from class: AbstractExpression
Add child listeners to catch and propagate sub-expression updates.

Overrides:
addChildListeners in class AbstractExpression
See Also:
AbstractExpression.addChildListeners()

removeChildListeners

protected void removeChildListeners()
Description copied from class: AbstractExpression
Remove child listeners for sub-expression updates.

Overrides:
removeChildListeners in class AbstractExpression
See Also:
AbstractExpression.removeChildListeners()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2007 Regents of the University of California