Friday 5 July 2013

Week 5 - ZAProxy & Zest Complex Conditional

During 5th week I found a bug I what I developed last week. I started trying to solve the issue, but after some time spent on that problem, the mentor and I decided to start developing on Zest side: Complex Conditional.

Ref: https://docs.google.com/document/d/1oAx26AU5gs4WKVXeI1pQF-sC-B9CiVXd7R3PDz7Sikw/edit#heading=h.xgiwfxe7dwpf

The structure I came up now is this:


  • ZestConditional
  • ZestBooleanAnd
    • ZestBooleanOr
      • ZestExpressionRegex (regex exp1)
      • ZestExpressionRegex (regex exp2)
    • ZestBooleanStatusCode (200)
  • List <ZestStatement> ifStatements etc...
    Going more inside, I designed the following internal structure for each class/interface:
  • abstract class ZestExpression extends ZestElement implements ZestConditionalElement:
    • List<ZestConditionalElement> children;
    • boolean not;
    • ZestConditionalElement parent;
    • String name;
    • static int counter; // for the default name
    • abstract boolean evaluate;
  • class ZestConditional extends ZestStatement implements ZestContainer, ZestConditionalElement:
    • List<ZestConditionalElement> children;
    • List<ZestStatement> ifStatement;
    • List<ZestStatement> elseStatement;
  • class ZestBoolean[And,Or] extends ZestExpression implements ZestConditionalElement:
    • ZestConditionalElement parent;
    • List<ZestConditionalElement> children;
    • boolean evaluate();
  • interface ZestConditionalElement extends ZestContainer
    • getIndex(); //return the index of the statement;
    • getChildren();// returns the children;
    • isLeaf();//true if it has no children;
    • isRoot();// if it is the root of the Conditional Tree
    • evaluate();// evaluate the whole condition.


The structure above had been implemented and the javadoc is done, and this a basic UML:




And here you can find my fork of the Zest repo (with the structure developed): https://github.com/Vankar/zest


Some tests has started (very basic and not checked in).

Note the assumption: 
2 Expression of the same class can have the same name!

Any comment, tip or advice on the Structure of the Complex Conditional is greatfully welcome :)

No comments:

Post a Comment