• Post Reply Bookmark Topic Watch Topic
  • New Topic

modify method in Data class

 
Rasika Chitnis
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am wondering why in modify method of Data class, first find method is invoked with flight number as the parameter. I am referring to following line in the code.
DataInfo test = find((newData.getValues())[0]);
after find method returns a DataInfo, a test is made to match the record number of 'test' and record number of the newData. Why don't they just try to read a record for newData's record number and if it not found, throw a DataBaseException ???
 
Sajid Raza
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe the call to 'find' is to guard against invalid record numbers.
 
Rasika Chitnis
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But same thing can be achieved by doing what I said in my original message i.e. by directly doing a readRecord for supplied record number. If not found, means the supplied parameter was invalid.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!