Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Searching records on the basis of creteria defined.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everybody,
I am stuck in between and appreciate your help.
actually my assignment is UrlyBird. I thinking logic for searching records on the basis of creteris been submitted to the public int[] find(String[]) of Db interface.

below written are my thoughts about this, pls help me in improvising it.
  • I have stored all the records in a Arraylist in a form of a class called DBData(which contains the record value and its mark for deletion.)
  • I Iterate all my Arraylist and take out a record , to which I get in form of an String[].
  • Then I start a loop like this
  • Now at this point in time I was thinking of putting the matched record in a seperate String [] and then calling this method again for further filtering of records matched the creteria. But was getting a feeling that there must be a better approach.

    Pls Help...

    Thanx
    Rohit.

    (There is Nothing called BEST in this World, You may have better then best.)

    [Andrew: Put code between UBB [code] and [/code] tags, and numbered list between UBB [list=1] and [/list] tags.]
    [ July 05, 2005: Message edited by: Andrew Monkhouse ]
     
    Ranch Hand
    Posts: 357
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Rohit,

    Does this do what you need ?


    By the way, you will probably need to change the equalsIgnoreCase into startsWith to conform to the specification of your interface definition.

    Frans.

    P.S. if you put code snippets in your forum posts in a CODE-block, they are much more readable.
     
    Rohit Anand
    Greenhorn
    Posts: 2
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    well yeah.... but I was wondering if there is nay better way of doing it, then pls share it.
     
    Frans Janssen
    Ranch Hand
    Posts: 357
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Sorry, I understood your post as if your were going to apply your search method recursively on the results.

    Then I don't know of any better way. You will need to iterate through all records, unless you implement some indexing mechanism, but I would not recommend that, because you would go way beyond the assignment's scope.

    Frans.
     
    Can you hear that? That's my theme music. I don't know where it comes from. Check under this tiny ad:
    Thread Boost feature
    https://coderanch.com/t/674455/Thread-Boost-feature
      Bookmark Topic Watch Topic
    • New Topic