Sha256: 3c2a557214c10e46c0756b810f69c3e0cd376ade11a9d53adb22fc36527517b8

Contents?: true

Size: 1.52 KB

Versions: 3

Compression:

Stored size: 1.52 KB

Contents

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

module Java::OrgTmapiCore::Association
  
  include RTM::Association
  extend Superiseable
  
  superised
  # Returns the topic map this association belongs to.
  #
  # :call-seq:
  #   parent -> TopicMap
  #
  def parent
  	getParent
  end
  alias :topic_map :parent
  alias :reverse_children :parent

  # Returns all roles parented by this association.
  #
  # :call-seq:
  #   children -> Set of Roles
  #
  def children
   	getRoles
  end
  alias :reverse_parent :children
  
  superised
  # Creates a new role in this association. The optional argument 'type'
  # specifies the role type and
  # 'player' specifies the role player.
  #
  # Type and player may each be topic references.
  #
  # :call-seq:
  #   create_role(type, player) -> Role
  #
  def create_role(type, player)
    createRole(topic_map.get!(type),topic_map.get!(player))
  end

  superised
  # Returns the Roles participating in this Association.
  # The optional identifier specifies the type of
  # the returned Roles.
  #
  # Identifier may be a topic reference.
  #
  # The result may be empty.
  #
  # :call-seq:
  #   roles -> Set of Roles
  #   roles(identifier) -> Set of Roles
  #
  def roles(type = :any)
    return getRoles if type == :any
    return java.util.HashSet.new if type == nil
    _topic = topic_map.get(type)
    if _topic.is_a?(Java::OrgTmapiCore::Topic)
      return getRoles(_topic)
    else
      return java.util.HashSet.new
    end
  end


end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rtm-javatmapi-0.3.1-java lib/rtm/javatmapi/core/association.rb
rtm-javatmapi-0.3.0 lib/rtm/javatmapi/core/association.rb
rtm-javatmapi-0.2.1 lib/rtm/javatmapi/core/association.rb