I have a task in which user can: 1. Form any number of points any coordinates; 2. Delete points according to a criterion.
I realized: 1. The case of a simple criterion (>, <, =, >= etc.). 2. The case of a composite criterion, which consists of two criteria with OR between them (x>5 OR y<3 , x<=2 OR y=0). I just add what is selected by one query to what was selected by the other. Then I remove duplicates. This is incorrect of course as the program should select only what is necessary at once. Well, but this is more or less satisfactory to me.
I program in C, so there is no possibility to use self modifying code, as far as I know and to the best of my ability.
I decided that I will limit myself to two criteria with OR or AND between them. I can see: >, <, >=, <=, =, !=. That is 6 cases. Then x and y, point ID, distance from origin. 4 cases. Then if I use combinations, that will be already too much cases for me to implement.
But I can't imagine anything but simple providing a special condition for each unique case. Of course, I could select everything according each query. Then use intersection for AND or addition for OR like we do it in discrete mathematics. But I'd like to do it the fastes way: the computer should select only what is necessary.
So for each case I provide if (x > value & y < value) if (x < value & y = value) if (x = value & y =< value)
Etc.
But this seems to be absolutely crazy. Could you recommend anything to me?