Module: Java::OrgTmapiCore::Scoped

Extended by:
Superiseable
Includes:
RTM::Scoped
Defined in:
lib/rtm/javatmapi/core/scoped.rb

Overview

Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. License: Apache License, Version 2.0

Instance Method Summary collapse

Methods included from Superiseable

method_added, register_java_implementation, superised, superising

Instance Method Details

#add_theme(identifier) ⇒ Object

Adds a topic given by the identifier to the scope.

Identifier may be a topic reference.

:call-seq:

add_theme(identifier)


28
29
30
31
32
33
34
35
36
# File 'lib/rtm/javatmapi/core/scoped.rb', line 28

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

#add_themes(*args) ⇒ Object Also known as: add_scope

Adds one or several topics to the scope.

An identifier may be a topic reference.

:call-seq:

add_themes(identifier)
add_themes(identifier1, identifier2, ...)


46
47
48
49
50
51
# File 'lib/rtm/javatmapi/core/scoped.rb', line 46

def add_themes(*args)
   args.flatten!
   args.each do |identifier|
     add_theme(identifier)
   end
end

#remove_theme(identifier) ⇒ Object

Removes a topic given by the identifier from the current scope.

Identifier may be a topic reference.

:call-seq:

remove_theme(identifier)


68
69
70
71
# File 'lib/rtm/javatmapi/core/scoped.rb', line 68

def remove_theme(identifier)
   identifier = topic_map.get(identifier)
   removeTheme(identifier) if identifier.is_a?(Java::OrgTmapiCore::Topic)
end

#remove_themes(*args) ⇒ Object Also known as: remove_scope

Removes one or several topics from the scope.

An identifier may be a topic reference.

:call-seq:

remove_themes(identifier)
remove_themes(identifier1, identifier2, ...)


81
82
83
84
85
# File 'lib/rtm/javatmapi/core/scoped.rb', line 81

def remove_themes(*args)
   args.flatten.each do |identifier|
     remove_theme(identifier)
   end
end

#scopeObject Also known as: themes

Returns the Topics which define the scope of this scoped Construct. An empty Set represents the unconstrained scope.

:call-seq:

scope -> Set of Topics


15
16
17
# File 'lib/rtm/javatmapi/core/scoped.rb', line 15

def scope
  getScope
end