class Bio::NeXML::States
Attributes
id[RW]
A file level unique identifier.
label[RW]
A human readable description of the state.
Public Class Methods
new( id, options = {} )
click to toggle source
# File lib/bio/db/nexml/matrix.rb, line 171 def initialize( id, options = {} ) @id = id properties( options ) unless options.empty? block.arity < 1 ? instance_eval( &block ) : block.call( self ) if block_given? end
Public Instance Methods
add_state( state )
click to toggle source
# File lib/bio/db/nexml/matrix.rb, line 183 def add_state( state ); end
create_state( symbol = nil, options = {} )
click to toggle source
# File lib/bio/db/nexml/matrix.rb, line 177 def create_state( symbol = nil, options = {} ) state = State.new( Bio::NeXML.generate_id( State ), symbol, options ) add_state( state ) state end
delete_state( state )
click to toggle source
# File lib/bio/db/nexml/matrix.rb, line 185 def delete_state( state ); end
each( &block )
click to toggle source
Iterate over each state set in self
passing it to the block given. If no block is provided, it returns an Enumerator.
# File lib/bio/db/nexml/matrix.rb, line 206 def each( &block ) @states.each( &block ) end
each_char( state )
click to toggle source
# File lib/bio/db/nexml/matrix.rb, line 193 def each_char( state ); end
each_state( state )
click to toggle source
# File lib/bio/db/nexml/matrix.rb, line 191 def each_state( state ); end
get_state_by_id( state )
click to toggle source
# File lib/bio/db/nexml/matrix.rb, line 189 def get_state_by_id( state ); end
get_state_by_symbol( symbol )
click to toggle source
# File lib/bio/db/nexml/matrix.rb, line 199 def get_state_by_symbol( symbol ) matches = each_state.select{ |s| s.symbol == symbol } matches.first end
has_state?( state )
click to toggle source
# File lib/bio/db/nexml/matrix.rb, line 187 def has_state?( state ); end
include?( state )
click to toggle source
# File lib/bio/db/nexml/matrix.rb, line 195 def include?( state ) has_state?( state ) end
to_xml()
click to toggle source
# File lib/bio/db/nexml/matrix.rb, line 210 def to_xml node = @@writer.create_node( "states", @@writer.attributes( self, :id, :label ) ) self.each_state do |state| node << state.to_xml end node end