Package net.ontopia.topicmaps.utils
Class ScopeUtils
- java.lang.Object
-
- net.ontopia.topicmaps.utils.ScopeUtils
-
public class ScopeUtils extends Object
INTERNAL: Scope processing utilities.
-
-
Constructor Summary
Constructors Constructor Description ScopeUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isApplicableInContext(ScopedIF obj, Collection<TopicIF> context)
Checks to see if the ScopedIF's scope is applicable in the user context.static boolean
isIntersectionOfContext(ScopedIF obj, Collection<TopicIF> context)
Checks to see if the ScopedIF's scope intersects with the user context.static boolean
isIntersectionOfContext(ScopedIF obj, TopicIF[] context)
EXPERIMENTAL:static boolean
isSubsetOfContext(ScopedIF obj, Collection<TopicIF> context)
Checks to see if the ScopedIF's scope is a subset of the user context.static boolean
isSupersetOfContext(ScopedIF obj, Collection<TopicIF> context)
Checks to see if the ScopedIF's scope is a superset of the user context.static boolean
isSupersetOfContext(ScopedIF obj, TopicIF[] context)
EXPERIMENTAL:static <S extends ScopedIF>
List<S>rankByScope(Collection<S> scoped, Collection<TopicIF> scope)
Ranks the ScopedIFs by the applicability to the specified scope.static <S extends ScopedIF>
List<S>rankByScope(Collection<S> scoped, TopicIF theme)
Ranks the ScopedIFs by the applicability to the specified scope.
-
-
-
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 ScopedIF> List<S> rankByScope(Collection<S> scoped, TopicIF theme)
Ranks the ScopedIFs by the applicability to the specified scope.
-
rankByScope
public static <S extends ScopedIF> List<S> rankByScope(Collection<S> scoped, Collection<TopicIF> scope)
Ranks the ScopedIFs by the applicability to the specified scope.
-
-