Module: Java::OrgTmapiCore::Association

Extends:
Superiseable
Includes:
RTM::Association
Defined in:
rtm-javatmapi/lib/rtm/javatmapi/core/association.rb,
rtm-javatmapi/lib/rtm/javatmapi/aliases.rb

Overview

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

Instance Method Summary

Methods included from Superiseable

method_added, register_java_implementation, superised, superising

Instance Method Details

- (Object) children Also known as: reverse_parent

Returns all roles parented by this association.

:call-seq:

  children -> Set of Roles


26
27
28
# File 'rtm-javatmapi/lib/rtm/javatmapi/core/association.rb', line 26

def children
  getRoles
end

- (Object) create_role(type, player)

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


41
42
43
# File 'rtm-javatmapi/lib/rtm/javatmapi/core/association.rb', line 41

def create_role(type, player)
  createRole(topic_map.get!(type),topic_map.get!(player))
end

- (Object) parent Also known as: topic_map, reverse_children

Returns the topic map this association belongs to.

:call-seq:

  parent -> TopicMap


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

def parent
  getParent
end

- (Object) roles(type = :any) Also known as: r

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


58
59
60
61
62
63
64
65
66
67
# File 'rtm-javatmapi/lib/rtm/javatmapi/core/association.rb', line 58

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