br.usp.ime.klava.segmentit.util
Enum Connectivity

java.lang.Object
  extended by java.lang.Enum<Connectivity>
      extended by br.usp.ime.klava.segmentit.util.Connectivity
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Connectivity>

public enum Connectivity
extends java.lang.Enum<Connectivity>

Represents adjacency relations.

Author:
Bruno Klava

Enum Constant Summary
CONNECTIVITY_4
          Specifies that the neighbors of a given element are the elements localized around it, in the vertical (2) and horizontal (2) directions.
CONNECTIVITY_8
          Specifies that the neighbors of a given element are the elements localized around it, in the vertical (2), horizontal (2) and diagonal (4) directions.
 
Method Summary
 java.util.List<Pixel> getNeighbors(Pixel[][] matrix, Pixel pixel)
          Returns a list with the neighbors of the pixel in the given matrix.
<T> java.util.List<T>
getNeighbors(T[][] matrix, int x, int y)
          Returns a list with the neighbors of the element localized at (x,y) in the given matrix.
static Connectivity valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Connectivity[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

CONNECTIVITY_4

public static final Connectivity CONNECTIVITY_4
Specifies that the neighbors of a given element are the elements localized around it, in the vertical (2) and horizontal (2) directions.


CONNECTIVITY_8

public static final Connectivity CONNECTIVITY_8
Specifies that the neighbors of a given element are the elements localized around it, in the vertical (2), horizontal (2) and diagonal (4) directions.

Method Detail

values

public static Connectivity[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Connectivity c : Connectivity.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Connectivity valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getNeighbors

public java.util.List<Pixel> getNeighbors(Pixel[][] matrix,
                                          Pixel pixel)
Returns a list with the neighbors of the pixel in the given matrix.

Parameters:
matrix - the matrix of pixels
pixel - the pixel whose neighbors will be returned
Returns:
a list with the neighbors of the pixel in the given matrix

getNeighbors

public <T> java.util.List<T> getNeighbors(T[][] matrix,
                                          int x,
                                          int y)
Returns a list with the neighbors of the element localized at (x,y) in the given matrix.

Type Parameters:
T - the type of elements of matrix
Parameters:
matrix - the matrix of T elements
x - the x-coordinate of the element whose neighbors will be returned
y - the y-coordinate of the element whose neighbors will be returned
Returns:
a list with the neighbors of the element localized at (x,y) in the given matrix