Class FragmentingFragmenter

java.lang.Object
whistlesAndMoans.DiscardingFragmenter
whistlesAndMoans.FragmentingFragmenter
All Implemented Interfaces:
RegionFragmenter
Direct Known Subclasses:
RejoiningFragmenter

public class FragmentingFragmenter extends DiscardingFragmenter
  • Field Details Link icon

  • Constructor Details Link icon

    • FragmentingFragmenter Link icon

      public FragmentingFragmenter(WhistleMoanControl whistleMoanControl)
  • Method Details Link icon

    • fragmentRegion Link icon

      public int fragmentRegion(ConnectedRegion connectedRegion)
      Description copied from interface: RegionFragmenter
      Fragment a connected region
      Specified by:
      fragmentRegion in interface RegionFragmenter
      Overrides:
      fragmentRegion in class DiscardingFragmenter
      Parameters:
      connectedRegion - region to fragment
      Returns:
      number of fragments.
    • createFragments Link icon

      public void createFragments()
      Split the mother region up into fragments, breaking at every branch and join
    • closeRegion Link icon

      protected boolean closeRegion(ConnectedRegion region, int nJoinedEnd)
      Finish off a region if no more bits are to be added to it.
      Parameters:
      region - region to close
      nJoinedEnd - number of other bits coming out of this point
      Returns:
      true if the region is big enough to be worth keeping.
    • matchPeak Link icon

      protected boolean matchPeak(int[] peak1, int[] peak2, int connectType)
      Match to peaks - return true if they merge into one another.
      Parameters:
      peak1 - first peak
      peak2 - second peak
      connectType - connect 4 or connect 8
      Returns:
      true if they touch according to 4 / 8 rule
    • cleanFragments Link icon

      protected void cleanFragments()
      Clean up fragments - mostly sorting out links between peaks.
    • getFragment Link icon

      public ConnectedRegion getFragment(int fragment)
      Description copied from interface: RegionFragmenter
      Get a specific fragment
      Specified by:
      getFragment in interface RegionFragmenter
      Overrides:
      getFragment in class DiscardingFragmenter
      Parameters:
      fragment - fragment number (0 to getNumFragments);
      Returns:
      the ith fragment
    • getNumFragments Link icon

      public int getNumFragments()
      Description copied from interface: RegionFragmenter
      Get the number of fragments
      Specified by:
      getNumFragments in interface RegionFragmenter
      Overrides:
      getNumFragments in class DiscardingFragmenter
      Returns:
      the number of fragments
    • isDiscardSmallOnes Link icon

      public boolean isDiscardSmallOnes()
    • setDiscardSmallOnes Link icon

      public void setDiscardSmallOnes(boolean discardSmallOnes)
      Set by teh RejoinFragments superclass so that all fragments are kept
      Parameters:
      discardSmallOnes -
    • sayFragments Link icon

      protected void sayFragments()
      Dump information to screen.
    • sayFragment Link icon

      protected void sayFragment(int iFrag, ConnectedRegion region)
      Dump information on a single fragment ot screen.
      Parameters:
      iFrag -
      region -