ilog.rules.util

Class IlrVisitor

  • java.lang.Object
    • ilog.rules.util.IlrVisitor
  • Direct Known Subclasses:
    IlrTranslationWriter


    public class IlrVisitor
    extends java.lang.Object
    Reflective visitor.

    To use this visitor, implement a inspect(<the class to visit>) method for each class to be visited. This visitor implementation is generic, and thus you can write the visit method only for the classes you're interested in. Also, it supports inheritance by applying the most specific visit method that is provided.

    If there is no implementation of the visit method for the current object's class, the inspect method will be called. By default it does nothing.

    The visited class may implement the IlrVisitable interface. In this case, the visit follows the path defined by the implementation of the IlrVisitable.accept method in the visited class. This permits definition of the visit path in the visited classes. Note that you can easily redefine this behavior by implementing your own callAccept method.

    • Constructor Summary

      Constructors 
      Constructor and Description
      IlrVisitor() 
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      protected void callAccept(IlrVisitable visitable)
      This method calls the accept method on a visited object, which usually means following a visit path defined by the visited objects.
      void inspect(java.lang.Object o)
      The default inspect method is called if a more precise method is not available.
      void iterateVisit(java.util.Collection collection)
      Method to call to visit each element of a collection.
      void iterateVisit(java.util.Iterator i)
      Method to call to visit each element returned by an iterator.
      void visit(java.lang.Object o)
      Visit an object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IlrVisitor

        public IlrVisitor()
    • Method Detail

      • iterateVisit

        public void iterateVisit(java.util.Collection collection)
        Method to call to visit each element of a collection.
        Parameters:
        collection - A collection. It can be null. In this case, the method does nothing.
      • iterateVisit

        public void iterateVisit(java.util.Iterator i)
        Method to call to visit each element returned by an iterator.
        Parameters:
        i - An iterator. It can be null. In this case, the method does nothing.
      • visit

        public void visit(java.lang.Object o)
        Visit an object. The best inspect method is called based on the class of the parameter.
        Parameters:
        o - The object to visit. If it is null, this method does nothing.
      • callAccept

        protected void callAccept(IlrVisitable visitable)
        This method calls the accept method on a visited object, which usually means following a visit path defined by the visited objects. It can be redefined to avoid the path by setting it to do nothing.
        Parameters:
        visitable -
      • inspect

        public void inspect(java.lang.Object o)
        The default inspect method is called if a more precise method is not available. It does nothing, but can be redefined.
        Parameters:
        o -

© Copyright IBM Corp. 1987, 2017