I am wondering what GoF pattern to look into in case of implementing a search function in my simple Java console program.
It is basically just a registry class that has the information of all the other model classes that have been registered. I would then like to implement a search that returns members, registered, based on the search keywords used i.e. keywords: Enter name, phone number, car type, age.
I had imagined it to be like you enter the keywords you would like to search by and they would be searched as AND linking them together. Then you could get a new line to enter the keywords you would like and then those would be internally AND but linked to the former with OR.
Example(just x if you do not use keyword):
Name: John Phone-Number:x Car-Type: Wagon Age: >55
Would return a all Johns fullfilling the other keywords but:
Name: John Phone-Number:x Car-Type: x Age:x
Name: x Phone-Number:x Car-Type: Wagon Age: x
Name: x Phone-Number:x Car-Type: x Age: >55
Would return all Johns all owners of Wagons and all over 55
The UI is not the question/problem its just for explantation - the question is what GoF pattern should I look into for this implementation, I have been reading on them and I am not quite sure. Iterator patter maybe?
Aucun commentaire:
Enregistrer un commentaire