Class SimpleACIArea.Region

java.lang.Object
com.isode.dsapi.aci.SimpleACIArea.Region
All Implemented Interfaces:
Comparable<SimpleACIArea.Region>
Enclosing class:
SimpleACIArea

public static class SimpleACIArea.Region extends Object implements Comparable<SimpleACIArea.Region>
Representation of a region of the DIT. This is an immutable object.
  • Field Details

    • base

      public final DN base
      Base of subtree.
    • min

      public final int min
      Minimum depth, or 0 for all.
    • max

      public final int max
      Maximum depth, or -1 for infinite. 0 means base entry only.
    • chops

      public final List<SimpleACIArea.Chop> chops
      Chop point list (immutable, never null).
  • Constructor Details

    • Region

      public Region()
      Construct a region that covers the whole DIT from root down.
    • Region

      public Region(DN base)
      Construct a simple region covering the given entry and below.
      Parameters:
      base - DN of entry at top of subtree
    • Region

      public Region(DN base, int min, int max)
      Construct a Region from a base and a min/max depth.
      Parameters:
      base - DN of the entry at the top of the region's subtree
      min - Minimum depth, or 0 for all entries
      max - Maximum depth, or -1 for all entries; 0 means only include the topmost entry.
    • Region

      public Region(DN base, SimpleACIArea.ChopList chops)
      Construct a Region from a base and a list of chop points. Any chop-points that aren't descendants of the base will be discarded.
      Parameters:
      base - DN of the entry at the top of the region's subtree
      chops - SimpleACIArea.ChopList containing list of chops to add
    • Region

      public Region(DN base, int min, int max, SimpleACIArea.ChopList chops)
      Construct a Region from a base, a min/max depth and a list of chop points. Any chop-points that aren't descendants of the base will be discarded.
      Parameters:
      base - DN of the entry at the top of the region's subtree
      min - Minimum depth, or 0 for all entries
      max - Maximum depth, or -1 for all entries; 0 means only include the topmost entry.
      chops - SimpleACIArea.ChopList containing list of chops to add
    • Region

      public Region(ACISubtreeSpec sts)
      Construct Region from an ACISubtreeSpec
  • Method Details

    • intersects

      public boolean intersects(SimpleACIArea.Region reg)
      Test whether two Regions intersect in any way.
      Parameters:
      reg - Region to test against this one
      Returns:
      true: there is some intersection, false: no intersection
    • subtreeIntersection

      public SimpleACIArea.Region subtreeIntersection(DN subtree)
      Generate the region that represents the intersection between this region and the given subtree, i.e. the part of this region that applies within that subtree. May return the same region, a new region, or null if there is no intersection.
      Parameters:
      subtree - DN of head of subtree
      Returns:
      Region, or null
    • eraseSubtree

      public SimpleACIArea.Region eraseSubtree(DN erase_dn)
      Generate a Region which is the same as this Region, but with all knowledge about the given subtree erased. The subtree takes on the same selection status that a miscellaneous subtree at that same level would have (i.e. some subtree with a random name that is not significant to the existing spec in any way). This means that its status will be affected by whether the nearest significant parent is a chop or a selection, and any depth specifications in force.
      Parameters:
      erase_dn - DN of subtree to erase
      Returns:
      Region, or null
    • relocate

      public SimpleACIArea.Region[] relocate(DN source, DN target)
      Take the current region, chop out a subtree and relocate it, and return the result as two regions: the base region with the subtree chopped out of it, and the chopped region after relocation. These regions may overlap, but still for simplicity they are returned separately. Depending on where the relocation subtree is located in relation to the region, one or other of these regions may be empty in which case it is omitted from the returned array.
      Parameters:
      source - Source DN
      target - Target DN
      Returns:
      Region[] One or two resultant regions
    • merge

      Try to merge two regions to create a new region. Returns null if it was not possible to merge them. This is a 'union' operation.
      Returns:
      New Region, or null
    • toACISubtreeSpec

      public ACISubtreeSpec toACISubtreeSpec()
      Convert the region into an ACISubtreeSpec.
    • dumpXML

      public void dumpXML(com.isode.util.XMLOutput out) throws IOException
      Dump the region out to the given XMLOutput stream.
      Throws:
      IOException
    • loadXML

      public static SimpleACIArea.Region loadXML(com.isode.util.XMLInput in)
      Try to load up a region from XML. If not present, null is returned.
    • compareTo

      public int compareTo(SimpleACIArea.Region bb)
      Comparison, ordered by DN.
      Specified by:
      compareTo in interface Comparable<SimpleACIArea.Region>
    • hashCode

      public int hashCode()
      Generate hash code.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Test that two regions are identical.
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Debugging dump.
      Overrides:
      toString in class Object