in progress
[jalview.git] / forester / ruby / evoruby / lib / evo / taxonomy / taxonomy.rb
1 #
2 # = lib/evo/taxonomy/taxonomy.rb - Taxonomy class
3 #
4 # Copyright::  Copyright (C) 2006-2007 Christian M. Zmasek
5 # License::    GNU Lesser General Public License (LGPL)
6 #
7 # $Id: taxonomy.rb,v 1.2 2009/01/03 00:19:08 cmzmasek Exp $
8
9
10
11 module Evoruby
12
13     class Taxonomy
14
15         def initialize( name, id = nil, id_source = nil )
16             @name = String.new( name.strip() )
17             if ( id == nil )
18                 @id = String.new()
19             else
20                 @id = String.new( id.strip() )
21             end
22             if ( id_source == nil )
23                 @id_source = String.new()
24             else
25                 @id_source = String.new( id_source.strip() )
26             end
27         end
28
29         def == ( taxonomy )
30             if taxonomy == nil
31                 return false
32             else
33                 return ( ( get_name == taxonomy.get_name ) &&
34                      ( get_id == taxonomy.get_id ) &&
35                      ( get_id_source == taxonomy.get_id_source ) )
36             end
37         end
38
39         def copy
40             return Taxonomy.new( get_name, get_id, get_id_source )
41         end
42
43         def get_name()
44             @name
45         end
46
47         def get_id()
48             @id
49         end
50
51         def get_id_source()
52             @id_source
53         end
54
55         def to_str()
56             if Util.is_string_empty?( get_id )
57                 @name
58             else
59                 "[" + get_id + "] " + @name
60             end
61         end
62
63     end # class Taxonomy
64
65 end # module Evoruby