[BioRuby-cvs] bioruby/lib/bio location.rb,0.24,0.25

Jan Aerts aerts at dev.open-bio.org
Thu May 4 18:40:28 UTC 2006


Update of /home/repository/bioruby/bioruby/lib/bio
In directory dev.open-bio.org:/tmp/cvs-serv21224

Modified Files:
	location.rb 
Log Message:
Line formatting


Index: location.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/location.rb,v
retrieving revision 0.24
retrieving revision 0.25
diff -C2 -d -r0.24 -r0.25
*** location.rb	4 May 2006 13:13:57 -0000	0.24
--- location.rb	4 May 2006 18:40:26 -0000	0.25
***************
*** 131,165 ****
    end
  
! 	# Check where a Bio::Location object is located compared to another
! 	# Bio::Location object (mainly to facilitate the use of Comparable).
! 	# A location A is upstream of location B if the start position of location A
! 	# is smaller than the start position of location B. If they're the same, the
! 	# end positions are checked.
! 	# ---
! 	# *Arguments*:
! 	# * (required) _other location_: a Bio::Location object
! 	# *Returns*::
! 	# * 1 if self < other location
! 	# * -1 if self > other location
! 	# * 0 if both location are the same
! 	# * nil if the argument is not a Bio::Location object
! 	def <=>(other)
! 		if ! other.kind_of?(Bio::Location)
! 			return nil
! 		end
!     
! 		if @from.to_f < other.from.to_f
        return -1
! 		elsif @from.to_f > other.from.to_f
! 			return 1
! 		end
! 		
! 		if @to.to_f < other.to.to_f
        return -1
! 		elsif @to.to_f > other.to.to_f
! 			return 1
! 		end
      return 0
! 	end
  
  end # class location
--- 131,165 ----
    end
  
!   # Check where a Bio::Location object is located compared to another
!   # Bio::Location object (mainly to facilitate the use of Comparable).
!   # A location A is upstream of location B if the start position of location A
!   # is smaller than the start position of location B. If they're the same, the
!   # end positions are checked.
!   # ---
!   # *Arguments*:
!   # * (required) _other location_: a Bio::Location object
!   # *Returns*::
!   # * 1 if self < other location
!   # * -1 if self > other location
!   # * 0 if both location are the same
!   # * nil if the argument is not a Bio::Location object
!   def <=>(other)
!     if ! other.kind_of?(Bio::Location)
!       return nil
!     end
! 
!     if @from.to_f < other.from.to_f
        return -1
!     elsif @from.to_f > other.from.to_f
!       return 1
!     end
! 
!     if @to.to_f < other.to.to_f
        return -1
!     elsif @to.to_f > other.to.to_f
!       return 1
!     end
      return 0
!   end
  
  end # class location
***************
*** 755,758 ****
--- 755,760 ----
    print "`- loc[1]   : "; p loc[1]
    print "   `- range : "; p loc[1].range
+ 
+   puts Bio::Location.new('5').<=>(Bio::Location.new('3'))
  end
  




More information about the bioruby-cvs mailing list