net.sf.okapi.lib.xliff2.walker

## Class XliffWalker

- java.lang.Object
- - net.sf.okapi.lib.xliff2.walker.XliffWalker

-     public class XliffWalker
      extends java.lang.Object

  Allows for traversal of the tree structure of an XLIFF document, in a fashion similar to visitor pattern. Three types of visitor can be added to the XliffWalker: File visitors, Unit visitors, and Segment visitors. The exact order in which the visit() method of these is called is determined by the XliffWalkerStrategy, for which a default implementation is provided. All visitors stored in the walked are stored in insertion order. This order is maintained during traversal using the default strategy.
  Author:
    Martin Wunderlich

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XliffWalker(XLIFFDocument doc)`
    `XliffWalker(XLIFFDocument doc, AbstractXliffWalkerStrategy strategy)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Integer` | `addFileVisitor(IXliffVisitor<FileNode> fileVisitor)`
    `java.lang.Integer` | `addSegmentVisitor(IXliffVisitor<Segment> segmentVisitor)`
    `java.lang.Integer` | `addUnitVisitor(IXliffVisitor<UnitNode> unitVisitor)`
    `void` | `doWalk()` Main method for running the traversal.
    `FileNode` | `getFileNode(java.lang.String fileNodeID)`
    `java.util.List<java.lang.String>` | `getFileNodeIds()`
    `java.util.List<IXliffVisitor<FileNode>>` | `getFileNodeVisitors()`
    `java.util.List<IXliffVisitor<Segment>>` | `getSegmentVisitors()`
    `java.util.List<IXliffVisitor<UnitNode>>` | `getUnitNodeVisitors()`
    `XLIFFDocument` | `getXlfDoc()`
    `void` | `removeAllVisitors()`
    `void` | `removeFileVisitor(java.lang.Integer ID)`
    `void` | `removeSegmentVisitor(java.lang.Integer ID)`
    `void` | `removeUnitVisitor(java.lang.Integer ID)`
    `void` | `setVisitors(java.util.List<IXliffVisitor<FileNode>> fileVisitors, java.util.List<IXliffVisitor<UnitNode>> unitVisitors, java.util.List<IXliffVisitor<Segment>> segmentVisitors)`

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

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

- - ### Constructor Detail

    - #### XliffWalker

          public XliffWalker(XLIFFDocument doc)

    - #### XliffWalker

          public XliffWalker(XLIFFDocument doc,
                     AbstractXliffWalkerStrategy strategy)

  - ### Method Detail

    - #### doWalk

          public void doWalk()

      Main method for running the traversal. Should only be called after some visitors have been added to the Walker. Otherwise, an exception will be thrown.

    - #### setVisitors

          public void setVisitors(java.util.List<IXliffVisitor<FileNode>> fileVisitors,
                         java.util.List<IXliffVisitor<UnitNode>> unitVisitors,
                         java.util.List<IXliffVisitor<Segment>> segmentVisitors)

    - #### addFileVisitor

          public java.lang.Integer addFileVisitor(IXliffVisitor<FileNode> fileVisitor)

    - #### addUnitVisitor

          public java.lang.Integer addUnitVisitor(IXliffVisitor<UnitNode> unitVisitor)

    - #### addSegmentVisitor

          public java.lang.Integer addSegmentVisitor(IXliffVisitor<Segment> segmentVisitor)

    - #### getFileNodeVisitors

          public java.util.List<IXliffVisitor<FileNode>> getFileNodeVisitors()

    - #### getUnitNodeVisitors

          public java.util.List<IXliffVisitor<UnitNode>> getUnitNodeVisitors()

    - #### getSegmentVisitors

          public java.util.List<IXliffVisitor<Segment>> getSegmentVisitors()

    - #### removeFileVisitor

          public void removeFileVisitor(java.lang.Integer ID)

    - #### removeUnitVisitor

          public void removeUnitVisitor(java.lang.Integer ID)

    - #### removeSegmentVisitor

          public void removeSegmentVisitor(java.lang.Integer ID)

    - #### removeAllVisitors

          public void removeAllVisitors()

    - #### getXlfDoc

          public XLIFFDocument getXlfDoc()

    - #### getFileNodeIds

          public java.util.List<java.lang.String> getFileNodeIds()

    - #### getFileNode

          public FileNode getFileNode(java.lang.String fileNodeID)