scphEditor
Class OperandViewFactory

java.lang.Object
  extended by scphEditor.OperandViewFactory
All Implemented Interfaces:
OperandVisitor

public class OperandViewFactory
extends java.lang.Object
implements OperandVisitor

This class is a factory of view objects for Operand objects. It is mainly a helper of the ExpressionView and ExpressionNaryView classes, when they recursively create views for children. Just call make() with the operand and you are done.

It does its job by being a visitor of concrete Operand objects. Each visit method creates an appropriate view object. In case the given Operand object is null, an appropriate view object is created without visiting.

See Also:
make(scphEditor.Operand)

Constructor Summary
OperandViewFactory(OperandControl c)
          Constructor.
 
Method Summary
 java.awt.Component make(Operand p)
          Creates and returns a view object for the given Operand object.
 void visitExpression(Expression e)
          Visits an Expression object and creates an ExpressionView object.
 void visitExpressionNary(ExpressionNary e)
          Visits an ExpressionNary object and creates an ExpressionViewNary object.
 void visitIdentifier(Identifier id)
          Visits an identifier and creates an IdentifierView object.
 void visitVariable(Variable v)
          Called by Variable.acceptVisitor().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperandViewFactory

public OperandViewFactory(OperandControl c)
Constructor.

Method Detail

make

public java.awt.Component make(Operand p)
Creates and returns a view object for the given Operand object. It works for null too.

Parameters:
p - the operand.
Returns:
the view object.

visitVariable

public void visitVariable(Variable v)
Description copied from interface: OperandVisitor
Called by Variable.acceptVisitor().

Specified by:
visitVariable in interface OperandVisitor
Parameters:
v - the Variable object that calls me.
See Also:
Variable.acceptVisitor(scphEditor.OperandVisitor)

visitIdentifier

public void visitIdentifier(Identifier id)
Visits an identifier and creates an IdentifierView object.

Specified by:
visitIdentifier in interface OperandVisitor
Parameters:
id - the visited identifier.
See Also:
Identifier.acceptVisitor(scphEditor.OperandVisitor)

visitExpression

public void visitExpression(Expression e)
Visits an Expression object and creates an ExpressionView object. The code of this method does not explicitly recurse into the children of the expression, but since the constructor of ExpressionView (which does) is called, that recursion is implicit.

Specified by:
visitExpression in interface OperandVisitor
Parameters:
e - the visited expression.
See Also:
Expression.acceptVisitor(scphEditor.OperandVisitor)

visitExpressionNary

public void visitExpressionNary(ExpressionNary e)
Visits an ExpressionNary object and creates an ExpressionViewNary object. The code of this method does not explicitly recurse into the children of the expression, but since the constructor of ExpressionNaryView (which does) is called, that recursion is implicit.

Specified by:
visitExpressionNary in interface OperandVisitor
Parameters:
e - the visited n-ary expression.
See Also:
ExpressionNary.acceptVisitor(scphEditor.OperandVisitor)