Class NormativeOrders

java.lang.Object
com.sk89q.worldguard.protection.util.NormativeOrders

public final class NormativeOrders extends Object
Sorts a list of regions so that higher priority regions always take precedence over lower priority ones, and after sorting by priority, so child regions always take priority over their parent regions.

For example, if the regions are a, aa, aaa, aab, aac, b, ba, bc, where aa implies that the second 'a' is a child of the first 'a', the sorted order must reflect the following properties (where regions on the left of < appear before in the sorted list):

  • [aaa, aab, aac] < aa < a
  • [ba, bc] < b

In the case of "[aaa, aab, aac]," the relative order between these regions is unimportant as they all share the same parent (aaa). The following choices would be valid sorts:

  • aaa, aab, aac, aa, a, ba, bc, b
  • aab, aaa, aac, aa, a, bc, ba, b
  • bc, ba, b, aab, aaa, aac, aa, a
  • aab, aaa, bc, aac, aa, ba, a, b

These sorted lists are required for FlagValueCalculator and some implementations of ApplicableRegionSet.