def getFinalAddons(self):
        """The final addons of a profile are the ones that will be
        used when a game is launched.  The returned list is sorted
        based on the load order that applies to the profile.

        For the Defaults profile, the final addons include ALL the
        existing addons.

        @return A list of addon identifiers, in the actual load order.
        """
        if self is profdb.defaults:
            # Return all existing addons.
            finalAddons = map(lambda a: a.getId(), aodb.getAddons())

        else:
            usedAddons = self.getUsedAddons()

            finalAddons = []

            # Any boxes?
            for ident in usedAddons:
                addon = aodb.get(ident)

                if addon.getBox():
                    # If the box hasn't been selected by the user, forget it.
                    if addon.getBox().getId() not in usedAddons:
                        continue
                
                if addon.isBox():
                    # Also include the required parts of the addons.
                    finalAddons += addon.getRequiredParts()

                finalAddons.append(ident)

        # Apply load order.
        self.sortByLoadOrder(finalAddons)

        return finalAddons                
    def getUsedAddons(self):
        """Returns the list of all addons that will be used with the
        profile.  This includes the addons that have been attached to
        the Defaults profile.  If a addon is attached to both Defaults
        and this profile, it won't be used (exclusion).

        @return An array of addon identifiers.
        """
        if self is profdb.getDefaults():
            usedAddons = self.getAddons()
        else:
            usedAddons = []

            # Decide which addons are actually used.  The ones that are
            # both in defaultAddons and profileAddons are NOT used.
            # ((P union D) - (P intersection D))
            for a in self.getAddons():
                usedAddons.append(a)

            for d in profdb.getDefaults().getAddons():
                if d in self.getAddons():
                    # This addon is in both the Defaults and this profile,
                    # don't use it.
                    usedAddons.remove(d)
                else:
                    usedAddons.append(d)

        # Any inversed addons that should be used?
        for addon in aodb.getAddons():
            if addon.isInversed():
                if addon.getId() not in usedAddons:
                    usedAddons.append(addon.getId())
                else:
                    usedAddons.remove(addon.getId())
            
        # Filter out the incompatible ones.
        return [a for a in usedAddons if aodb.get(a).isCompatibleWith(self)]