001    /*
002     * CoOccurrenceMatrix
003     * 
004     * Copyright (c) 2001, 2002, 2003 Marco Schmidt.
005     * All rights reserved.
006     */
007    
008    package net.sourceforge.jiu.color.data;
009    
010    /**
011     * An interface for co-occurrence matrices.
012     * An implementing class stores <code>int</code> counter values for pairs of pixels.
013     * These counters represent the number of times two pixels are direct
014     * neighbors in an image.
015     * @author Marco Schmidt
016     */
017    public interface CoOccurrenceMatrix
018    {
019            /**
020             * Sets all counters to zero.
021             */
022            void clear();
023    
024            /**
025             * Returns the dimension of this matrix.
026             * This is the number of rows and columns.
027             * @return matrix dimension (larger than zero)
028             */
029            int getDimension();
030    
031            /**
032             * Returns the matrix value at a given position.
033             * @param i column index, from 0 to {@link #getDimension} - 1
034             * @param j row index, from 0 to {@link #getDimension} - 1
035             * @throws IllegalArgumentException for invalid index pairs (i, j)
036             */
037            int getValue(int i, int j);
038    
039            /**
040             * Increases the counter for pair (i, j) by one.
041             * This method can be implemented by the call 
042             * <code>setValue(i, j, getValue(i, j) + 1);</code>.
043             * @param i column index, from 0 to {@link #getDimension} - 1
044             * @param j row index, from 0 to {@link #getDimension} - 1
045             * @throws IllegalArgumentException for invalid index pairs (i, j)
046             */
047            void incValue(int i, int j);
048    
049            /**
050             * Sets the counter for pair (i, j) to a new value.
051             * @param i column index, from 0 to {@link #getDimension} - 1
052             * @param j row index, from 0 to {@link #getDimension} - 1
053             * @throws IllegalArgumentException for invalid index pairs (i, j)
054             */      
055            void setValue(int i, int j, int newValue);
056    }