• Post Reply Bookmark Topic Watch Topic
  • New Topic

recNo in data.java  RSS feed

 
Andy Zhu
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the instruction, I need to recycle the spaces for deleted records. But what will happen to recNo? I assume that recNo starts with 1. Say, initially, there are 10 recs; and then recNo 5 is deleted, will a readRecord(5) throw a RNF exception or return the initial recNo 6 (the next valid record?

Furthermore, will recNo starts with 1 or 0, or simply irrelevant?

Thanks
 
Anton Golovin
Ranch Hand
Posts: 531
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Andy Zhu:
From the instruction, I need to recycle the spaces for deleted records. But what will happen to recNo? I assume that recNo starts with 1. Say, initially, there are 10 recs; and then recNo 5 is deleted, will a readRecord(5) throw a RNF exception or return the initial recNo 6 (the next valid record?

Furthermore, will recNo starts with 1 or 0, or simply irrelevant?

Thanks


In my project, it starts with 0 just because storage structures start with 0. I think that the way you describe it, reading a deleted record should throw an RNF exception.
 
Robert Chisholm
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read my sig for the version I'm working on.

I have an unsigned status byte before each record. IMO, deleting a record doesn't mean removing it physically (where all records shift down the stack)... it is simply flagged for deletion.
 
Andy Zhu
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!