Re: Merging beans for composite search
- From: "H. S. Lahman" <h.lahman@xxxxxxxxxxx>
- Date: Thu, 21 Jul 2005 16:24:56 GMT
Responding to Vivoli...
I am pretty stuck with a composite search problem, which among the others has the need of the following operation:
I have a bean representing the search criteria ( the search domain is People objects, and I'm searching-by-example ), call them PeopleSearchCriteria that can be filled in with details of a person I am searching ( through setName() and the like )
Now I have two of these criteria, name them C1 and C2 ( spawning disjoint sets S1 and S2 ) and I have to create a third one (C3) by merging the information contained in each of them ( thus with a search set equal the union of the two S3 = {S1 U S2} )
This sounds like you need to organize your compound criteria into a data structure where you can easily access (iterate over) the minimum sum of products. For example, a tree with the ORs all at the root:
[OR]
|
+-----------+------------+
| |
[OR] [AND]
| |
+--------+--------+ +------+----------+
| | | |
[Age > 22] [Name = XYZ] [YOB > 1938] [City = London]P1 P1 ----------- P3 --------------
The minimum sum of products is {P1, P2, P3} and the compound criteria is satisfied if any one of the products evaluates to TRUE. So your bean "walks" the leaves of the criteria tree in order of boolean products and evaluates each product's criterion against the People in hand.
The simple solution would be to go through every getter of S1 and S2 and set the respective setter of S3 when they return a value ( not null ), but the point is that I have like 70 properties to check and I don't really like doing it...
Another possibility would be inserting a proxy recording the setters that are called to fill the two criteria, but it happens that the class structure is
People ^ | PeopleSearchCriteria
Is this a subclassing relation? If so I don't understand how PeopleSearchCriteria IS-A People. They seem like two entirely different things.
************* There is nothing wrong with me that could not be cured by a capful of Drano.
H. S. Lahman hsl@xxxxxxxxxxxxxxxxx Pathfinder Solutions -- Put MDA to Work http://www.pathfindermda.com blog: http://pathfinderpeople.blogs.com/hslahman (888)OOA-PATH
.
- Follow-Ups:
- Re: Merging beans for composite search
- From: Francesco Vivoli
- Re: Merging beans for composite search
- References:
- Merging beans for composite search
- From: Francesco Vivoli
- Merging beans for composite search
- Prev by Date: Re: Use Case Level of Detail
- Next by Date: Re: Use Case Level of Detail
- Previous by thread: Merging beans for composite search
- Next by thread: Re: Merging beans for composite search
- Index(es):
Relevant Pages
|