Class: DSKTrackSector

Inherits:
Object
  • Object
show all
Defined in:
lib/DSK.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(track_no, sector_no, offset = 0x00) ⇒ DSKTrackSector

Returns a new instance of DSKTrackSector.



318
319
320
321
322
# File 'lib/DSK.rb', line 318

def initialize(track_no,sector_no,offset=0x00)
  @track_no=track_no
  @sector_no=sector_no
  @offset=offset
end

Instance Attribute Details

#offsetObject

Returns the value of attribute offset.



317
318
319
# File 'lib/DSK.rb', line 317

def offset
  @offset
end

#sector_noObject

Returns the value of attribute sector_no.



317
318
319
# File 'lib/DSK.rb', line 317

def sector_no
  @sector_no
end

#track_noObject

Returns the value of attribute track_no.



317
318
319
# File 'lib/DSK.rb', line 317

def track_no
  @track_no
end

Instance Method Details

#<=>(other) ⇒ Object



327
328
329
330
331
332
# File 'lib/DSK.rb', line 327

def <=>(other)
  return -1 unless other.kind_of?DSKTrackSector
  return track_no<=>other.track_no unless track_no==other.track_no
  return sector_no<=>other.sector_no unless sector_no==other.sector_no
  return offset<=>other.offset
end

#to_sObject



323
324
325
# File 'lib/DSK.rb', line 323

def to_s 
  sprintf "TRACK $%02X SECTOR $%02X OFFSET $02X",track_no,sector_no,offset
end