Class ScopeUtils


  • public class ScopeUtils
    extends Object
    INTERNAL: Scope processing utilities.
    • Constructor Detail

      • ScopeUtils

        public ScopeUtils()
    • Method Detail

      • isApplicableInContext

        public static boolean isApplicableInContext​(ScopedIF obj,
                                                    Collection<TopicIF> context)
        Checks to see if the ScopedIF's scope is applicable in the user context. This is implies that the ScopedIF's scope must be either the unconstrained scope (empty) or a superset of the user context.

        Parameters:
        obj - The ScopedIF object to compare with.
        context - The user context; a collection of TopicIFs.
        Returns:
        boolean; true if the scoped object's scope is applicable in the user context.
      • isSupersetOfContext

        public static boolean isSupersetOfContext​(ScopedIF obj,
                                                  Collection<TopicIF> context)
        Checks to see if the ScopedIF's scope is a superset of the user context. The scope is a superset if it contains all the context themes.

        Note that the unconstrained scope is in this case considered an empty set.

        Parameters:
        obj - The ScopedIF object to compare with.
        context - The user context; a collection of TopicIFs.
        Returns:
        boolean; true if the scoped object's scope is a superset of the context.
      • isSupersetOfContext

        public static boolean isSupersetOfContext​(ScopedIF obj,
                                                  TopicIF[] context)
        EXPERIMENTAL:
      • isSubsetOfContext

        public static boolean isSubsetOfContext​(ScopedIF obj,
                                                Collection<TopicIF> context)
        Checks to see if the ScopedIF's scope is a subset of the user context. The scope is a subset if the context contains all the scope themes.

        Note that the unconstrained scope is in this case considered an empty set.

        Parameters:
        obj - The ScopedIF object to compare with.
        context - The user context; a collection of TopicIFs.
        Returns:
        boolean; true if the scoped object's scope is a subset of the context.
      • isIntersectionOfContext

        public static boolean isIntersectionOfContext​(ScopedIF obj,
                                                      Collection<TopicIF> context)
        Checks to see if the ScopedIF's scope intersects with the user context. Note that there is no intersection when either collection is empty.

        Note that the unconstrained scope is in this case considered an empty set.

        Parameters:
        obj - The ScopedIF object to compare with.
        context - The user context; a collection of TopicIFs.
        Returns:
        boolean; true if the scoped object's scope intersects with the user context.
      • isIntersectionOfContext

        public static boolean isIntersectionOfContext​(ScopedIF obj,
                                                      TopicIF[] context)
        EXPERIMENTAL:
      • rankByScope

        public static <S extends ScopedIFList<S> rankByScope​(Collection<S> scoped,
                                                               TopicIF theme)
        Ranks the ScopedIFs by the applicability to the specified scope.