1dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond/*
2dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * Licensed to the Apache Software Foundation (ASF) under one or more
3dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * contributor license agreements.  See the NOTICE file distributed with
4dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * this work for additional information regarding copyright ownership.
5dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * The ASF licenses this file to You under the Apache License, Version 2.0
6dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * (the "License"); you may not use this file except in compliance with
7dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * the License.  You may obtain a copy of the License at
8dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond *
9dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond *      http://www.apache.org/licenses/LICENSE-2.0
10dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond *
11dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * Unless required by applicable law or agreed to in writing, software
12dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * distributed under the License is distributed on an "AS IS" BASIS,
13dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * See the License for the specific language governing permissions and
15dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * limitations under the License.
16dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond */
17dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond
18dee0849a9704d532af0b550146cbafbaa6ee1d19Raymondpackage org.apache.commons.math.linear;
19dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond
20dee0849a9704d532af0b550146cbafbaa6ee1d19Raymondimport org.apache.commons.math.FieldElement;
21dee0849a9704d532af0b550146cbafbaa6ee1d19Raymondimport org.apache.commons.math.linear.MatrixVisitorException;
22dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond
23dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond/**
24dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * Interface defining a visitor for matrix entries.
25dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond *
26dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * @param <T> the type of the field elements
27dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * @version $Revision: 1073158 $ $Date: 2011-02-21 22:46:52 +0100 (lun. 21 févr. 2011) $
28dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * @since 2.0
29dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond */
30dee0849a9704d532af0b550146cbafbaa6ee1d19Raymondpublic interface FieldMatrixChangingVisitor<T extends FieldElement<?>> {
31dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond
32dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    /**
33dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * Start visiting a matrix.
34dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <p>This method is called once before any entry of the matrix is visited.</p>
35dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param rows number of rows of the matrix
36dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param columns number of columns of the matrix
37dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param startRow Initial row index
38dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param endRow Final row index (inclusive)
39dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param startColumn Initial column index
40dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param endColumn Final column index (inclusive)
41dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     */
42dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    void start(int rows, int columns,
43dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond               int startRow, int endRow, int startColumn, int endColumn);
44dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond
45dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    /**
46dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * Visit one matrix entry.
47dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param row row index of the entry
48dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param column column index of the entry
49dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param value current value of the entry
50dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @return the new value to be set for the entry
51dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @throws MatrixVisitorException if something wrong occurs
52dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     */
53dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    T visit(int row, int column, T value)
54dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond        throws MatrixVisitorException;
55dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond
56dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    /**
57dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * End visiting a matrix.
58dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <p>This method is called once after all entries of the matrix have been visited.</p>
59dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @return the value that the <code>walkInXxxOrder</code> must return
60dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     */
61dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    T end();
62dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond
63dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond}
64