Package org.mozilla.zest.core.v1
Class ZestStructuredExpression
- java.lang.Object
-
- org.mozilla.zest.core.v1.ZestElement
-
- org.mozilla.zest.core.v1.ZestExpression
-
- org.mozilla.zest.core.v1.ZestStructuredExpression
-
- All Implemented Interfaces:
ZestExpressionElement
- Direct Known Subclasses:
ZestExpressionAnd,ZestExpressionOr
public abstract class ZestStructuredExpression extends ZestExpression
The Class ZestStructuredExpression.
-
-
Field Summary
-
Fields inherited from class org.mozilla.zest.core.v1.ZestElement
JSON_ELEMENT_TYPE
-
-
Constructor Summary
Constructors Constructor Description ZestStructuredExpression()Instantiates a new zest structured expression.ZestStructuredExpression(List<ZestExpressionElement> childrenExpression)Instantiates a new zest structured expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChildCondition(ZestExpressionElement child)adds a new Condition to the children (last position).voidaddChildCondition(ZestExpressionElement child, int position)adds a new Condition to the children (give position).voidclearChildren()clears the list of children expression.ZestExpressionElementgetChild(int index)returns the Condition Child in position i.List<ZestExpressionElement>getChildrenCondition()returns the children condition of this Zest Expression.booleanisLeaf()true if it is a Simple Conditional false otherwise.booleanremoveAllChildren(Collection<ZestExpressionElement> childrenToRemove)Removes a collection of Expressions.ZestExpressionElementremoveChildCondition(int index)removes an element from the list of children condition.ZestExpressionElementremoveChildCondition(ZestExpressionElement child)removes a child from the list of children condition.List<ZestExpressionElement>setChildrenCondition(List<ZestExpressionElement> new_list)sets the list of Children and return the previous list.-
Methods inherited from class org.mozilla.zest.core.v1.ZestExpression
deepCopy, evaluate, isInverse, setInverse
-
Methods inherited from class org.mozilla.zest.core.v1.ZestElement
getElementType, isSameSubclass, setElementType
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.mozilla.zest.core.v1.ZestExpressionElement
isTrue
-
-
-
-
Constructor Detail
-
ZestStructuredExpression
public ZestStructuredExpression()
Instantiates a new zest structured expression.
-
ZestStructuredExpression
public ZestStructuredExpression(List<ZestExpressionElement> childrenExpression)
Instantiates a new zest structured expression.- Parameters:
childrenExpression- the children expression
-
-
Method Detail
-
setChildrenCondition
public List<ZestExpressionElement> setChildrenCondition(List<ZestExpressionElement> new_list)
sets the list of Children and return the previous list.- Parameters:
new_list- the new list of Children Condition- Returns:
- the previous list of Children Condition
-
getChildrenCondition
public List<ZestExpressionElement> getChildrenCondition()
returns the children condition of this Zest Expression.- Returns:
- the children condition
-
isLeaf
public boolean isLeaf()
Description copied from interface:ZestExpressionElementtrue if it is a Simple Conditional false otherwise.- Specified by:
isLeafin interfaceZestExpressionElement- Overrides:
isLeafin classZestExpression- Returns:
- true if it is a Simple Conditional false otherwise
-
addChildCondition
public void addChildCondition(ZestExpressionElement child)
adds a new Condition to the children (last position).- Parameters:
child- the child condition to add
-
removeChildCondition
public ZestExpressionElement removeChildCondition(ZestExpressionElement child)
removes a child from the list of children condition.- Parameters:
child- the Expression to remove- Returns:
- the expression removed if any, null otherwise.
-
removeChildCondition
public ZestExpressionElement removeChildCondition(int index)
removes an element from the list of children condition.- Parameters:
index- the index of the element to remove- Returns:
- the element removed if any.
-
removeAllChildren
public boolean removeAllChildren(Collection<ZestExpressionElement> childrenToRemove)
Removes a collection of Expressions.- Parameters:
childrenToRemove- the Expressions, children of this StructuredExpression, which has to be removed- Returns:
- true if list of children condition changed as a result of the call
-
clearChildren
public void clearChildren()
clears the list of children expression.
-
addChildCondition
public void addChildCondition(ZestExpressionElement child, int position)
adds a new Condition to the children (give position).- Parameters:
child- the child condition to addposition- the position where to add the condition
-
getChild
public ZestExpressionElement getChild(int index)
returns the Condition Child in position i.- Parameters:
index- position of the child we're searching for- Returns:
- the child found at the given position
-
-