Overview | Package | Class | Tree | Deprecated | Index | Help
| SMC 6_0_1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.smc.model
Class SmcVisitor

    java.lang.Object
      net.sf.smc.model.SmcVisitor

Direct Known Subclasses:
  SmcCodeGenerator, SmcSyntaxChecker

    public abstract class SmcVisitor

extends java.lang.Object

The super class for all FSM model visitors. Within the SMC applications, visitors perform either global syntax checking on the tree or generate code based on the tree. See the Visitor pattern in GoF (p. 331).

If an application needs to traverse a finite state machine model, then it should create a class derived from SmcVisitor, override the appropriate visit methods for those FSM elements it needs to process. Visiting is started by calling `SmcFSM.accept(net.sf.smc.model.SmcVisitor)` and passing in the application's visitor instance. See `SmcCodeGenerator` for an example.

All visit methods are explicity defined and do nothing. The reason why there are not abstract is because not all visistors visit all element types. Therefore, Visitor subclasses need override only those methods visiting the elements they care about.

See Also:
  `SmcElement`

Constructor Summary
`protected` | `SmcVisitor()` Default constructor.

Method Summary
`void` | `visit(SmcAction action)` Visits a state transition action.
`void` | `visit(SmcFSM fsm)` Visits the top-level finite state machine element.
`void` | `visit(SmcGuard guard)` Visits a state tansition guard.
`void` | `visit(SmcMap map)` Visits a finite state machine submap.
`void` | `visit(SmcParameter parameter)` Visits a state transition parameter.
`void` | `visit(SmcState state)` Visits a finite state machine state.
`void` | `visit(SmcTransition transition)` Visits a finite state machine state transition.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SmcVisitor

    protected SmcVisitor()

  Default constructor. Does nothing since this abstract class has no member data to initialize.

Method Detail

### visit

    public void visit(SmcFSM fsm)

  Visits the top-level finite state machine element.

  Parameters:
    `fsm` - The top-level finite state machine element.

### visit

    public void visit(SmcMap map)

  Visits a finite state machine submap.

  Parameters:
    `map` - A finite state machine submap.

### visit

    public void visit(SmcState state)

  Visits a finite state machine state.

  Parameters:
    `state` - A finite state machine state.

### visit

    public void visit(SmcTransition transition)

  Visits a finite state machine state transition.

  Parameters:
    `transition` - A finite state machine state transition.

### visit

    public void visit(SmcGuard guard)

  Visits a state tansition guard.

  Parameters:
    `guard` - A state tansition guard.

### visit

    public void visit(SmcAction action)

  Visits a state transition action.

  Parameters:
    `action` - A state transition action.

### visit

    public void visit(SmcParameter parameter)

  Visits a state transition parameter.

  Parameters:
    `parameter` - A state transition parameter.

Overview | Package | Class | Tree | Deprecated | Index | Help
| SMC 6_0_1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009. Charles W. Rapp. All Rights Reserved. Use is subject to license terms.