Friday, 15 August 2014

user interface - Need guidance towards evaluative boolean logic tree -


I can not find an indicator in the right direction, I'm also not sure what I should do. But countless hours of googling sparkles in circles, so it is expected that the collective hive of stack overflow intelligence can help.

The problem is, I want a method of filtering data, only one mixed logic can call the tree. Currently, this system implements a simple and filtering system. For example, suppose we have Dataset of people is you add a bunch of filters that show to all people (gender = female) and (age> 23) and (age <30) and (position = single). Enough easy, through each item again, add a valid item to the collection, if every condition is correct

The problem I am experiencing is that I am able to insert the user with complex questions How can I do it and what is it? I am thinking like a tree where every node represents and the expression that treats her children as right or wrong will be a simple example - ((sex == male and age == 25) or (sex == female and Position == single)) and IQ> 120. Sorry I can not think of a better example at the moment. But how can you go about representing this type of expression tree, and evaluate the objects in the collection of these filters. What are some references that will help? Hell, what are Google looking for something that can move in a positive direction ?!

Anyone can help with any help.

Here is an example of a compound query in the tree

  • Question - Show me all the people where sex is male and the eyes are green or the gender is female, the eyes are blue Are or single status. As a parent (gender == men & eyes == green) || (Sex == woman & amp; (eyes == blue || condition == single))

Then think of tree as a

  o - Root node - and - sex = male - and - eyes = blue - or - gender = female - and eyes = blue - or position = single  

I believe the solution is to each Representing is a data structure such as node

  node {OpType - AND or OR ExpressionField - ExpressionOp - = ,! =, & Gt;, & gt; =, & Lt;, & lt; = Field expression value to evaluate - value to compare value of field against function evaluation () - Returns a boole  

Therefore for a given node, chilren's Assess, if you are a node, then return true if the results of your expression are true and you and the children are correct or evaluated for any or the child's evaluation and then recurse up again.

It seems to satisfy every ideological situation I can throw it, but once we implement it, I'll post the actual code later when its work and photos are better describing this problem for others.

Your parsing expression ((sex == male and female == 25) or (sex == Woman and status == single)) and IQ> 120 looks odd I will parse it as:

  * and * or * and * == * gender * male * = * eyes * blue * and * == * gender * woman * == * Status * Single * & gt; The type of tree will be:  
  node {ball evaluation ()} and node: node {Evaluate the right hair of the node node () {return left.evaluate () & amp; Amp; Right.evaluate ()}} // OrNode is equal to: node {field field value values ​​BULL evaluation () {return field.value () == value}} // Similar <, & gt;, etc < / Code>> 

No comments:

Post a Comment