org.apache.commons.math3.linear

## Class DefaultFieldMatrixPreservingVisitor<T extends FieldElement<T>>

- java.lang.Object
- - org.apache.commons.math3.linear.DefaultFieldMatrixPreservingVisitor<T>

- Type Parameters:
    `T` - the type of the field elements
  All Implemented Interfaces:
    FieldMatrixPreservingVisitor<T>
  Direct Known Subclasses:
    MatrixUtils.BigFractionMatrixConverter, MatrixUtils.FractionMatrixConverter

      public class DefaultFieldMatrixPreservingVisitor<T extends FieldElement<T>>
      extends java.lang.Object
      implements FieldMatrixPreservingVisitor<T>

  Default implementation of the `FieldMatrixPreservingVisitor` interface.

  This class is a convenience to create custom visitors without defining all methods. This class provides default implementations that do nothing.

  Since:
    2.0
  Version:
    $Id: DefaultFieldMatrixPreservingVisitor.java 1416643 2012-12-03 19:37:14Z tn $

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private T` | `zero` Zero element of the field.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultFieldMatrixPreservingVisitor(T zero)` Build a new instance.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `T` | `end()` End visiting a matrix.
    `void` | `start(int rows, int columns, int startRow, int endRow, int startColumn, int endColumn)` Start visiting a matrix.
    `void` | `visit(int row, int column, T value)` Visit one matrix entry.

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

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

- - ### Field Detail

    - #### zero

          private final T extends FieldElement<T> zero

      Zero element of the field.

  - ### Constructor Detail

    - #### DefaultFieldMatrixPreservingVisitor

          public DefaultFieldMatrixPreservingVisitor(T zero)

      Build a new instance.
      Parameters:
        `zero` - additive identity of the field

  - ### Method Detail

    - #### start

          public void start(int rows,
                   int columns,
                   int startRow,
                   int endRow,
                   int startColumn,
                   int endColumn)

      Start visiting a matrix.

      This method is called once before any entry of the matrix is visited.

      Specified by:
        `start` in interface `FieldMatrixPreservingVisitor<T extends FieldElement<T>>`
      Parameters:
        `rows` - number of rows of the matrix
        `columns` - number of columns of the matrix
        `startRow` - Initial row index
        `endRow` - Final row index (inclusive)
        `startColumn` - Initial column index
        `endColumn` - Final column index (inclusive)

    - #### visit

          public void visit(int row,
                   int column,
                   T value)

      Visit one matrix entry.
      Specified by:
        `visit` in interface `FieldMatrixPreservingVisitor<T extends FieldElement<T>>`
      Parameters:
        `row` - row index of the entry
        `column` - column index of the entry
        `value` - current value of the entry

    - #### end

          public T end()

      End visiting a matrix.

      This method is called once after all entries of the matrix have been visited.

      Specified by:
        `end` in interface `FieldMatrixPreservingVisitor<T extends FieldElement<T>>`
      Returns:
        the value that the `walkInXxxOrder` must return

Copyright (c) 2003-2013 Apache Software Foundation