Package inra.ijpb.label.conncomp
Class BoundarySet
java.lang.Object
inra.ijpb.label.conncomp.BoundarySet
public class BoundarySet
extends java.lang.Object
A list of boundaries, indexed by an integer label.
Provides utility method to generate new boundaries when required.
- Author:
- dlegland
-
Constructor Summary
Constructors Constructor Description BoundarySet()
Creates a new (empty) BoundarySet. -
Method Summary
Modifier and Type Method Description Boundary
createBoundary(java.util.Collection<java.lang.Integer> neighborLabels)
Creates a new Boundary from the list of adjacent regions, add it to the set, and returns the new instance of Boundary.Boundary
findBoundary(java.util.Collection<java.lang.Integer> neighborLabels)
Try to find a Boundary that has same adjacent regions as the ones specified in the argument.Boundary
findOrCreateBoundary(java.util.Collection<java.lang.Integer> neighborLabels)
Try to find a Boundary that has same adjacent regions as the ones specified in the argument.Boundary
getBoundary(int label)
Retrieve a Boundary from its label.int
size()
java.lang.String
toString()
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
BoundarySet
public BoundarySet()Creates a new (empty) BoundarySet.
-
-
Method Details
-
size
public int size()- Returns:
- the number of boundaries within the set.
-
getBoundary
Retrieve a Boundary from its label.- Parameters:
label
- the label of the boundary- Returns:
- the boundary instance associated to the specified label
-
findOrCreateBoundary
Try to find a Boundary that has same adjacent regions as the ones specified in the argument. If no such Boundary can be found, creates a new one, adds it to the set, and returns the new Boundary.- Parameters:
neighborLabels
- the (integer) labels of the regions adjacent to the boundary- Returns:
- the (existing or new) Boundary instance with the specified labels as adjacent regions
-
findBoundary
Try to find a Boundary that has same adjacent regions as the ones specified in the argument. If no such Boundary can be found, return null.- Parameters:
neighborLabels
- the (integer) labels of the regions adjacent to the boundary- Returns:
- the existing Boundary instance with the specified labels as adjacent regions, or null if no such boundary exist.
-
createBoundary
Creates a new Boundary from the list of adjacent regions, add it to the set, and returns the new instance of Boundary.- Parameters:
neighborLabels
- the list of labels of the (usually two) regions adjacent to the boundary.- Returns:
- the new boundary.
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-