# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 module Java::OrgTmapiCore::Scoped include RTM::Scoped extend Superiseable # Returns the Topics which define the scope of this scoped Construct. # An empty Set represents the unconstrained scope. # # :call-seq: # scope -> Set of Topics # def scope getScope end alias :themes :scope superised # Adds a topic given by the identifier to the scope. # # Identifier may be a topic reference. # # :call-seq: # add_theme(identifier) # def add_theme(identifier) if identifier.is_a?(Java::OrgTmapiCore::Topic) addTheme(identifier) elsif identifier.is_a?(Java::OrgTmapiCore::Locator) || identifier.is_a?(String) addTheme(topic_map.get!(identifier)) else raise("Identifier must be a Topic, String or Locator") end end # Adds one or several topics to the scope. # # An identifier may be a topic reference. # # :call-seq: # add_themes(identifier) # add_themes(identifier1, identifier2, ...) # def add_themes(*args) args.flatten! args.each do |identifier| add_theme(identifier) end end alias :add_scope :add_themes # Future version, TODO # def set_scope(*args) # # end # alias :scope= :set_scope superised # Removes a topic given by the identifier from the current scope. # # Identifier may be a topic reference. # # :call-seq: # remove_theme(identifier) # def remove_theme(identifier) identifier = topic_map.get(identifier) removeTheme(identifier) if identifier.is_a?(Java::OrgTmapiCore::Topic) end # Removes one or several topics from the scope. # # An identifier may be a topic reference. # # :call-seq: # remove_themes(identifier) # remove_themes(identifier1, identifier2, ...) # def remove_themes(*args) args.flatten! args.each do |identifier| remove_theme(identifier) end end alias :remove_scope :remove_themes # Future version, TODO # def delete_scope(*args) # # end end