prefuse.data.expression
Class BinaryExpression

java.lang.Object
  extended by prefuse.data.expression.AbstractExpression
      extended by prefuse.data.expression.BinaryExpression
All Implemented Interfaces:
java.util.EventListener, ExpressionListener, Expression
Direct Known Subclasses:
ArithmeticExpression, ComparisonPredicate, RangePredicate

public abstract class BinaryExpression
extends AbstractExpression

Abstract base class for Expression implementations that maintain two sub-expressions. These are referred to as the left expression (the first one) and the right expression (the second one).

Author:
jeffrey heer

Field Summary
protected  Expression m_left
           
protected  int m_op
           
protected  Expression m_right
           
 
Constructor Summary
protected BinaryExpression(int operation, int minOp, int maxOp, Expression left, Expression right)
          Create a new BinaryExpression.
 
Method Summary
protected  void addChildListeners()
          Add child listeners to catch and propagate sub-expression updates.
 Expression getLeftExpression()
          Get the left sub-expression.
 int getOperation()
          Get the operation code for this expression.
 Expression getRightExpression()
          Get the right sub-expression.
protected  void removeChildListeners()
          Remove child listeners for sub-expression updates.
 void setLeftExpression(Expression e)
          Set the left sub-expression.
 void setRightExpression(Expression e)
          Set the right sub-expression.
 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, toString, wait, wait, wait
 
Methods inherited from interface prefuse.data.expression.Expression
getType
 

Field Detail

m_op

protected int m_op

m_left

protected Expression m_left

m_right

protected Expression m_right
Constructor Detail

BinaryExpression

protected BinaryExpression(int operation,
                           int minOp,
                           int maxOp,
                           Expression left,
                           Expression right)
Create a new BinaryExpression.

Parameters:
operation - int value indicating the operation to be performed on the subtrees. The actual range of acceptable values are determined by subclasses.
minOp - the minimum legal operation code value
maxOp - the maximum legal operation code value
left - the left sub-expression
right - the right sub-expression
Method Detail

getLeftExpression

public Expression getLeftExpression()
Get the left sub-expression.

Returns:
the left sub-expression

getRightExpression

public Expression getRightExpression()
Get the right sub-expression.

Returns:
the right sub-expression

setLeftExpression

public void setLeftExpression(Expression e)
Set the left sub-expression. Any listeners will be notified.

Parameters:
e - the left sub-expression to use

setRightExpression

public void setRightExpression(Expression e)
Set the right sub-expression. Any listeners will be notified.

Parameters:
e - the right sub-expression to use

getOperation

public int getOperation()
Get the operation code for this expression. The meaning of this code is left for subclasses to determine.

Returns:
the operation code

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()


Copyright 2007 Regents of the University of California