Class NeighborhoodCondition

Object
NeighborhoodCondition
All Implemented Interfaces:
UpdatableBeforeCondition

public class NeighborhoodCondition extends Object implements UpdatableBeforeCondition
A condition to determine if two objects are potential neighbors and candidates for merging.

This condition implements UpdatableBeforeCondition to allow efficient updates when the source object changes.

  • Constructor Details

    • NeighborhoodCondition

      public NeighborhoodCondition(boolean requireBBoxNeighbors, boolean requireTouching)
      Creates a new NeighborhoodCondition.
      Parameters:
      requireBBoxNeighbors - whether to require bounding boxes to be neighbors
      requireTouching - whether to require objects to be touching
  • Method Details

    • updateSourceObject

      public void updateSourceObject(ObjectMask source, Optional<UnitConverter> unitConverter) throws OperationFailedException
      Description copied from interface: UpdatableBeforeCondition
      Updates the source object and performs any necessary pre-computations.
      Specified by:
      updateSourceObject in interface UpdatableBeforeCondition
      Parameters:
      source - the source ObjectMask
      unitConverter - an optional UnitConverter for unit conversions
      Throws:
      OperationFailedException - if the update operation fails
    • accept

      public boolean accept(ObjectMask destination)
      Description copied from interface: UpdatableBeforeCondition
      Checks if the destination object should be merged with the previously set source object.
      Specified by:
      accept in interface UpdatableBeforeCondition
      Parameters:
      destination - the destination ObjectMask to check against the source
      Returns:
      true if the objects should be merged, false otherwise