com.togethersoft.openapi.sci.visitor
Class SciVisitorUtil


public class SciVisitorUtil

This class contains a set of useful static methods for accepting a visitor by an enumeration of elements, expressions, statements or references.

Methods acceptToAll just accept visitor by a specified enumeration of elements, expressions, statements or references.

Methods acceptUntilStop behave more delicately, allowing to stop the process of accepting when the result of acception the visitor by an element of enumeration equals to the static variable STOP.

Author:
TogetherSoft

Field Summary
 final static ObjectSTOP
           This static variable is used to keep the "stop-sign" object.

Method Summary
 static voidacceptToAll(SciElementEnumeration enum, SciElementVisitor visitor)
           Makes each SciElement from the specified enumeration accept the specified visitor.
 static voidacceptToAll(SciReferenceEnumeration enum, SciReferenceVisitor visitor)
           Makes each SciReference from the specified enumeration accept the specified visitor.
 static voidacceptToAll(SciStatementEnumeration enum, SciStatementVisitor visitor)
           Makes each SciStatement from the specified enumeration accept the specified visitor.
 static voidacceptToAll(SciExpressionEnumeration enum, SciExpressionVisitor visitor)
           Makes each SciExpression from the specified enumeration accept the specified visitor.
 static ObjectacceptUntilStop(SciElementEnumeration enum, SciElementVisitor visitor)
           Makes each SciElement from the specified enumeration accept the specified visitor until the result of accepting is equal to the static variable STOP.
 static ObjectacceptUntilStop(SciReferenceEnumeration enum, SciReferenceVisitor visitor)
           Makes each SciReference from the specified enumeration accept the specified visitor until the result of accepting is equal to the static variable STOP.
 static ObjectacceptUntilStop(SciStatementEnumeration enum, SciStatementVisitor visitor)
           Makes each SciStatement from the specified enumeration accept the specified visitor until the result of accepting is equal to the static variable STOP.
 static ObjectacceptUntilStop(SciExpressionEnumeration enum, SciExpressionVisitor visitor)
           Makes each SciExpression from the specified enumeration accept the specified visitor until the result of accepting is equal to the static variable STOP.

Field Detail

STOP

public final static Object STOP
This static variable is used to keep the "stop-sign" object.
Method Detail

acceptToAll

public static void acceptToAll(SciElementEnumeration enum, SciElementVisitor visitor)
Makes each SciElement from the specified enumeration accept the specified visitor.
Parameters:
enum - SciElementEnumeration of SciElements
visitor - the SciElementVisitor to perform desired actions

acceptToAll

public static void acceptToAll(SciReferenceEnumeration enum, SciReferenceVisitor visitor)
Makes each SciReference from the specified enumeration accept the specified visitor.
Parameters:
enum - SciReferenceEnumeration of SciReferences
visitor - the SciReferenceVisitor to perform desired actions

acceptToAll

public static void acceptToAll(SciStatementEnumeration enum, SciStatementVisitor visitor)
Makes each SciStatement from the specified enumeration accept the specified visitor.
Parameters:
enum - SciStatementEnumeration of SciStatements
visitor - the SciStatementVisitor to perform desired actions

acceptToAll

public static void acceptToAll(SciExpressionEnumeration enum, SciExpressionVisitor visitor)
Makes each SciExpression from the specified enumeration accept the specified visitor.
Parameters:
enum - SciExpressionEnumeration of SciExpressions
visitor - the SciExpressionVisitor to perform desired actions

acceptUntilStop

public static Object acceptUntilStop(SciElementEnumeration enum, SciElementVisitor visitor)
Makes each SciElement from the specified enumeration accept the specified visitor until the result of accepting is equal to the static variable STOP.
Parameters:
enum - SciElementEnumeration of SciElements
visitor - the SciElementVisitor to perform desired actions
Returns: STOP variable if visitor's returned result is equal to the static variable STOP, null otherwise
See Also:
STOP

acceptUntilStop

public static Object acceptUntilStop(SciReferenceEnumeration enum, SciReferenceVisitor visitor)
Makes each SciReference from the specified enumeration accept the specified visitor until the result of accepting is equal to the static variable STOP.
Parameters:
enum - SciReferenceEnumeration of SciReferences
visitor - the SciReferenceVisitor to perform desired actions
Returns: STOP variable if visitor's returned result is equal to the static variable STOP, null otherwise
See Also:
STOP

acceptUntilStop

public static Object acceptUntilStop(SciStatementEnumeration enum, SciStatementVisitor visitor)
Makes each SciStatement from the specified enumeration accept the specified visitor until the result of accepting is equal to the static variable STOP.
Parameters:
enum - SciStatementEnumeration of SciStatements
visitor - the SciStatementVisitor to perform desired actions
Returns: STOP variable if visitor's returned result is equal to the static variable STOP, null otherwise
See Also:
STOP

acceptUntilStop

public static Object acceptUntilStop(SciExpressionEnumeration enum, SciExpressionVisitor visitor)
Makes each SciExpression from the specified enumeration accept the specified visitor until the result of accepting is equal to the static variable STOP.
Parameters:
enum - SciExpressionEnumeration of SciExpressions
visitor - the SciExpressionVisitor to perform desired actions
Returns: STOP variable if visitor's returned result is equal to the static variable STOP, null otherwise
See Also:
STOP