@Override
		public int compare(Group g1, Group g2) {
			if (sortType == SORT_BY_ADDRESS) {
				Address addr1 = null;
				Address addr2 = null;
				if (g1 instanceof ProgramFragment) {
					addr1 = ((ProgramFragment) g1).getMinAddress();
				}
				else {
					ProgramModule m = (ProgramModule) g1;
					addr1 = m.getAddressSet().getMinAddress();
				}
				if (g2 instanceof ProgramFragment) {
					addr2 = ((ProgramFragment) g2).getMinAddress();
				}
				else {
					ProgramModule m = (ProgramModule) g2;
					addr2 = m.getAddressSet().getMinAddress();
				}
				if (addr1 == null && addr2 == null) {
					return 0;
				}
				if (addr1 != null && addr2 == null) {
					return -1;
				}
				if (addr1 == null) {
					return 1;
				}
				return addr1.compareTo(addr2);
			}
			return g1.getName().compareTo(g2.getName());
		}
Plugin to sort Modules and Fragments within a selected Module.
Child Module folders are always name-sorted and placed
above child Fragments.  When sorting on address, the minimum
address for each fragment is used, while empty fragments are name-sorted
and placed at the bottom.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/module/ModuleSortPlugin.java