com.singularsys.jep.walkers

## Class SerializableExpression

- java.lang.Object
- - com.singularsys.jep.walkers.PostfixTreeWalker
  - - com.singularsys.jep.walkers.SerializableExpression

- All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable

      public class SerializableExpression
      extends PostfixTreeWalker
      implements java.io.Externalizable

  A serializable representation of an expression. To serialize an expression use

       ObjectOuputStream oos = ...;
       SerializableExpression se = new SerializableExpression(node);
       oos.writeObject(se);

  To deserialize use

       ObjectInputStream ois = ...;
       SerializableExpression se = (SerializableExpression) ois.readObject();
       Node n = se.toNode(jep);

  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `SerializableExpression.Constant`
    `static interface` | `SerializableExpression.Element` interface used in internal representation of expression
    `static class` | `SerializableExpression.Function`
    `static class` | `SerializableExpression.Operator`
    `static class` | `SerializableExpression.Variable`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SerializableExpression()` Constructor used by the serializable mechanism.
    `SerializableExpression(Node node)` Construct a SerializableExpression from a given node

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Iterator<SerializableExpression.Element>` | `iterator()` Returns an iterator for the reverse polish representation of the expression.
    `void` | `readExternal(java.io.ObjectInput ois)`
    `Node` | `toNode(Jep j)` Convert to a node in a given context.
    `java.lang.String` | `toString()`
    `protected void` | `visit(ASTConstant node, int nchildren, int depth)` Visit a constant node
    `protected void` | `visit(ASTFunNode node, int nchildren, int depth)` Visit a function node
    `protected void` | `visit(ASTOpNode node, int nchildren, int depth)` Visit an operator node
    `protected void` | `visit(ASTVarNode node, int nchildren, int depth)` Visit a variable node
    `void` | `writeExternal(java.io.ObjectOutput out)` Write a serialized version of the node to a stream.

    - ### Methods inherited from class com.singularsys.jep.walkers.PostfixTreeWalker

      `supressExaminingChildren, walk, walkSubEquations`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SerializableExpression

          public SerializableExpression(Node node)
                                 throws JepException

      Construct a SerializableExpression from a given node
      Parameters:
        `node` - root node of the expression to serialize
      Throws:
        `JepException`

    - #### SerializableExpression

          public SerializableExpression()

      Constructor used by the serializable mechanism. Not for normal use.

  - ### Method Detail

    - #### toNode

          public final Node toNode(Jep j)
                            throws JepException

      Convert to a node in a given context. Variable, function and operator nodes will refer to the corresponding object in the jep instance.
      Parameters:
        `j` - Jep instance specifying the context
      Returns:
        root node of the expression
      Throws:
        `JepException`

    - #### writeExternal

          public final void writeExternal(java.io.ObjectOutput out)
                                   throws java.io.IOException

      Write a serialized version of the node to a stream.
      Specified by:
        `writeExternal` in interface `java.io.Externalizable`
      Parameters:
        `out` - the stream to write to.
      Throws:
        `java.io.IOException`

    - #### readExternal

          public final void readExternal(java.io.ObjectInput ois)
                                  throws java.io.IOException,
                                         java.lang.ClassNotFoundException

      Specified by:
        `readExternal` in interface `java.io.Externalizable`
      Throws:
        `java.io.IOException`
        `java.lang.ClassNotFoundException`

    - #### visit

          protected void visit(ASTFunNode node,
                               int nchildren,
                               int depth)
                        throws JepException

      Description copied from class: `PostfixTreeWalker`
      Visit a function node
      Specified by:
        `visit` in class `PostfixTreeWalker`
      Parameters:
        `node` - the current node being visited
        `nchildren` - number of children of the node
        `depth` - depth of tree, root node is depth 1.
      Throws:
        `JepException`

    - #### visit

          protected void visit(ASTOpNode node,
                               int nchildren,
                               int depth)
                        throws JepException

      Description copied from class: `PostfixTreeWalker`
      Visit an operator node
      Specified by:
        `visit` in class `PostfixTreeWalker`
      Parameters:
        `node` - the current node being visited
        `nchildren` - number of children of the node
        `depth` - depth of tree, root node is depth 1.
      Throws:
        `JepException`

    - #### visit

          protected void visit(ASTVarNode node,
                               int nchildren,
                               int depth)
                        throws JepException

      Description copied from class: `PostfixTreeWalker`
      Visit a variable node
      Specified by:
        `visit` in class `PostfixTreeWalker`
      Parameters:
        `node` - the current node being visited
        `nchildren` - number of children of the node
        `depth` - depth of tree, root node is depth 1.
      Throws:
        `JepException`

    - #### visit

          protected void visit(ASTConstant node,
                               int nchildren,
                               int depth)
                        throws JepException

      Description copied from class: `PostfixTreeWalker`
      Visit a constant node
      Specified by:
        `visit` in class `PostfixTreeWalker`
      Parameters:
        `node` - the current node being visited
        `nchildren` - number of children of the node
        `depth` - depth of tree, root node is depth 1.
      Throws:
        `JepException`

    - #### iterator

          public java.util.Iterator<SerializableExpression.Element> iterator()

      Returns an iterator for the reverse polish representation of the expression. This iterator is unmodifiable.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

Copyright © 2018 Singular Systems http://www.singularsys.com/jep