Sha256: 4b8b360f7b71df947f4890391e3e8480488e2c286a5b6cad6aa0b13f6ba1b058
Contents?: true
Size: 1.53 KB
Versions: 1
Compression:
Stored size: 1.53 KB
Contents
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 module RTM module Navigation module Topic # First computes all Associations where this Topic playes a Role. # There, the optional identifier filters the Associations for their type. # # Returns all Players of all Roles in these Associations. # The current Topic is not included in the result. # The result may be empty. # # The identifier may be a Topic or Topic-Reference. # # :call-seq: # traverse(identifier) -> Array of Topics # def traverse(type = :any) unless type == :any _topic = topic_map.get(type) return [] unless _topic end _res = roles_played.map{|r| r.parent} #associations _res = _res.select{|a| a.type == _topic} unless type == :any _res = _res.map{|a| a.roles.map{ |r| r.player}}.flatten #players of all roles in these associations # unless _res.empty? # _res.each_with_index do |x,i| # if x == self # _res.delete_at(i) # break # end # end # end _res =_res.reject{|p| p == self} return _res end # Always returns an empty Array # # :call-seq: # reverse_traverse -> Array # def reverse_traverse Array.new end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rtm-0.2.0 | lib/rtm/navigation/topic/traverse.rb |