+ Start a Discussion
Jacob W LandisJacob W Landis 

How to valid a logic string


We want to display a list of string ( from a object) to let user pick, after they pick some values, for example A, B , C and D, and then user can put some logic for the selection, like (A and B) OR (C and D). My questions are
1. how to valid this logic string?
2. We are going to have a conjunction object to hold the relationship between selectd item with parent, how can we store this logic information?


Sumit Kumar Singh 9Sumit Kumar Singh 9
Hello Jingi, 

Please, have a look at "Composite" design pattern. THis is design patterns has been designed for this purpose -

Here is the link -


Sumit Kumar Singh
Jacob W LandisJacob W Landis
Thanks for the response. My question is how to valid a text which has and/ or logic between selected items. for example (1 or 2) and (3 or 4)
Jacob W LandisJacob W Landis
actually the pattern could be like ((A=1) And B ) OR (c=2)