com.atlassian.jira.jql.clause
Class SingleParentVisitor

java.lang.Object
  extended by com.atlassian.jira.jql.clause.SingleParentVisitor
All Implemented Interfaces:
ClauseVisitor<Boolean>

public class SingleParentVisitor
extends Object
implements ClauseVisitor<Boolean>

A visitor which searches the clause tree for the given clause names. If all the found clauses have the same parent, then the parent is returned with getSingleParent(), and the getFoundChildren() will return the found clauses. If the found claues have different parents, then getSingleParent() will return null and the getFoundChildren() will return an empty list. If the clause tree has only one clause as its root, which is being searched for, then getSingleParent() will return null and the getFoundChildren() will return a list with the root.

Since:
v4.0

Constructor Summary
SingleParentVisitor(Set<String> clauseNames)
           
SingleParentVisitor(String... clauseNames)
           
 
Method Summary
 List<TerminalClause> getFoundChildren()
           
 Clause getSingleParent()
           
 Boolean visit(AndClause andClause)
          Visit called when accepting a AndClause.
 Boolean visit(NotClause notClause)
          Visit called when accepting a NotClause.
 Boolean visit(OrClause orClause)
          Visit called when accepting a OrClause.
 Boolean visit(TerminalClause clause)
          Visit called when accepting a TerminalClause.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleParentVisitor

public SingleParentVisitor(String... clauseNames)

SingleParentVisitor

public SingleParentVisitor(Set<String> clauseNames)
Method Detail

getSingleParent

public Clause getSingleParent()

getFoundChildren

public List<TerminalClause> getFoundChildren()

visit

public Boolean visit(AndClause andClause)
Description copied from interface: ClauseVisitor
Visit called when accepting a AndClause.

Specified by:
visit in interface ClauseVisitor<Boolean>
Parameters:
andClause - the node being visited.
Returns:
The return type specified by the visitor.

visit

public Boolean visit(OrClause orClause)
Description copied from interface: ClauseVisitor
Visit called when accepting a OrClause.

Specified by:
visit in interface ClauseVisitor<Boolean>
Parameters:
orClause - the node being visited.
Returns:
The return type specified by the visitor.

visit

public Boolean visit(NotClause notClause)
Description copied from interface: ClauseVisitor
Visit called when accepting a NotClause.

Specified by:
visit in interface ClauseVisitor<Boolean>
Parameters:
notClause - the node being visited.
Returns:
The return type specified by the visitor.

visit

public Boolean visit(TerminalClause clause)
Description copied from interface: ClauseVisitor
Visit called when accepting a TerminalClause.

Specified by:
visit in interface ClauseVisitor<Boolean>
Parameters:
clause - the node being visited.
Returns:
The return type specified by the visitor.


Copyright © 2002-2009 Atlassian. All Rights Reserved.