• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Modifying Find

 
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are we allowed to modify the find method in the Data class for FBN assignment? I think older FBN assignments don't have a find method, but mine does. It seems TOTALLY useless. Maybe overloading it would be better? Any comments?
Matt DeLacey
 
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do you need to modify it in the first place? My assignment says nothing about the modification of any methods exception deprecations, lock and unlocking, and add criteriaFind. I don't see why you need to change it at all.
 
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Matt,
find() was really useful in my unit tests.
Jerry
 
Matt DeLacey
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jerry. Adrian--> The reason I wanted to modify it, was because it is useless to me now, but if I made some minor modifications it could do a lot of the work of my criteriaFind method. Anyway, the directions don't say anything about modifying find, but they don't say anything about NOT modifying it...?

With Respect,
Matt
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not think you should use Data.find() to implement your criteriaFind() method.
From what I understood, find() looks for the first instance of the search criteria and returns the record. I think this will work fine if each record has a unique field like Flight number.
This method will not work if the data structure is:
Flight Origin Destination
1 LAX SFO
2 SFT LAX
We will not be able to find flights arriving in LAX. Using this method, we will always hit record one and never be able to reach record 2.
I am waiting for your comments.
Mohnish
------------------
 
Matt DeLacey
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree 100%. That is why I wanted to modify it. But I guess I have decided to let it be and overload it instead.
With Respect,
Matt
 
Whatever. Here's a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic