Package com.isode.dsapi.aci
Class SimpleACIArea.Region
java.lang.Object
com.isode.dsapi.aci.SimpleACIArea.Region
- All Implemented Interfaces:
Comparable<SimpleACIArea.Region>
- Enclosing class:
- SimpleACIArea
Representation of a region of the DIT. This is an immutable
object.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRegion()
Construct a region that covers the whole DIT from root down.Region
(ACISubtreeSpec sts) Construct Region from an ACISubtreeSpecConstruct a simple region covering the given entry and below.Construct a Region from a base and a min/max depth.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.Region
(DN base, SimpleACIArea.ChopList chops) Construct a Region from a base and a list of chop points. -
Method Summary
Modifier and TypeMethodDescriptionint
Comparison, ordered by DN.void
dumpXML
(com.isode.util.XMLOutput out) Dump the region out to the given XMLOutput stream.boolean
Test that two regions are identical.eraseSubtree
(DN erase_dn) Generate a Region which is the same as this Region, but with all knowledge about the given subtree erased.int
hashCode()
Generate hash code.boolean
Test whether two Regions intersect in any way.static SimpleACIArea.Region
loadXML
(com.isode.util.XMLInput in) Try to load up a region from XML.Try to merge two regions to create a new region.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.subtreeIntersection
(DN subtree) Generate the region that represents the intersection between this region and the given subtree, i.e.Convert the region into an ACISubtreeSpec.toString()
Debugging dump.
-
Field Details
-
base
Base of subtree. -
min
public final int minMinimum depth, or 0 for all. -
max
public final int maxMaximum depth, or -1 for infinite. 0 means base entry only. -
chops
Chop point list (immutable, never null).
-
-
Constructor Details
-
Region
public Region()Construct a region that covers the whole DIT from root down. -
Region
Construct a simple region covering the given entry and below.- Parameters:
base
- DN of entry at top of subtree
-
Region
Construct a Region from a base and a min/max depth.- Parameters:
base
- DN of the entry at the top of the region's subtreemin
- Minimum depth, or 0 for all entriesmax
- Maximum depth, or -1 for all entries; 0 means only include the topmost entry.
-
Region
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 subtreechops
-SimpleACIArea.ChopList
containing list of chops to add
-
Region
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 subtreemin
- Minimum depth, or 0 for all entriesmax
- Maximum depth, or -1 for all entries; 0 means only include the topmost entry.chops
-SimpleACIArea.ChopList
containing list of chops to add
-
Region
Construct Region from an ACISubtreeSpec
-
-
Method Details
-
intersects
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
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
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
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 DNtarget
- 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
Convert the region into an ACISubtreeSpec. -
dumpXML
Dump the region out to the given XMLOutput stream.- Throws:
IOException
-
loadXML
Try to load up a region from XML. If not present, null is returned. -
compareTo
Comparison, ordered by DN.- Specified by:
compareTo
in interfaceComparable<SimpleACIArea.Region>
-
hashCode
public int hashCode()Generate hash code. -
equals
Test that two regions are identical. -
toString
Debugging dump.
-