Bio::EnsEMBL::Utils BitString
SummaryPackage variablesDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::EnsEMBL::Utils::BitString - bitstring object implementation
Package variables
No package variables defined.
Synopsis
No synopsis!
Description
This is an implementation of a bitstring object, taken from Damian
Convey's book "Object Oriented Perl".
Methods
bitcount
No description
Code
complement
No description
Code
get
No description
Code
new
No description
Code
print_me
No description
Code
set
No description
Code
Methods description
None available.
Methods code
bitcountdescriptionprevnextTop
sub bitcount {
  8 * length ${$_[0]};
}
complementdescriptionprevnextTop
sub complement {
  my ($self) = @_;
  my $complement = ~$$self;
  bless\$ complement, ref($self);
}
getdescriptionprevnextTop
sub get {
  my ($self, $bitnum) = @_;
  return vec($$self,$bitnum,1);
}
newdescriptionprevnextTop
sub new {
  my $class = ref($_[0])||$_[0];
  my $initbits = join '', map {$_?1:0} @_[1..$#_];
  my $bs = pack 'b*', $initbits;
  bless\$ bs, $class;
}
print_medescriptionprevnextTop
sub print_me {
  my ($self) = @_;
  for (my $i=0; $i < $self->bitcount(); $i++)
  {
    print $self->get($i);
    print ' ' unless ($i+1)%8;
    print "\n" unless ($i+1)%64;
  }
  print "\n";
}


1;
}
setdescriptionprevnextTop
sub set {
  my ($self, $bitnum, $newval) = @_;
  vec($$self,$bitnum,1) = $newval?1:0;
}
General documentation
LICENSETop
  Copyright (c) 1999-2009 The European Bioinformatics Institute and
Genome Research Limited. All rights reserved.
This software is distributed under a modified Apache license. For license details, please see /info/about/code_licence.html
CONTACTTop
  Please email comments or questions to the public Ensembl
developers list at <ensembl-dev@ebi.ac.uk>.
Questions may also be sent to the Ensembl help desk at <helpdesk@ensembl.org>.