no.sesat.search.query.finder
Class ParentFinder

java.lang.Object
  extended by no.sesat.commons.visitor.AbstractReflectionVisitor
      extended by no.sesat.search.query.finder.ParentFinder
All Implemented Interfaces:
Serializable, no.sesat.commons.visitor.Visitor

public final class ParentFinder
extends no.sesat.commons.visitor.AbstractReflectionVisitor
implements Serializable

Visitor used to find a clause's parents. Clauses' do not keep references to their parents as they are immutable and can thus be reused within different trees.

Version:
$Id: ParentFinder.java 7225 2009-04-09 00:32:20Z ssmiweve $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class no.sesat.commons.visitor.AbstractReflectionVisitor
VISIT_METHOD_IMPL
 
Constructor Summary
ParentFinder()
           
 
Method Summary
 List<UnaryClause> getAncestors(Clause root, Clause clause)
          Returns all parents, grandparents, great-grandparents, etc.
 UnaryClause getParent(Clause root, Clause child)
          Finds the first found direct parent.
 List<UnaryClause> getParents(Clause root, Clause child)
          Returns all direct parents.
static boolean insideOf(List<UnaryClause> parents, TokenPredicate token)
           
protected  void visitImpl(BinaryClause clause)
           
protected  void visitImpl(LeafClause clause)
           
protected  void visitImpl(UnaryClause clause)
           
 
Methods inherited from class no.sesat.commons.visitor.AbstractReflectionVisitor
visit, visitImpl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParentFinder

public ParentFinder()
Method Detail

insideOf

public static boolean insideOf(List<UnaryClause> parents,
                               TokenPredicate token)
Parameters:
parents -
token -
Returns:

getAncestors

public List<UnaryClause> getAncestors(Clause root,
                                      Clause clause)
Returns all parents, grandparents, great-grandparents, etc.

Parameters:
root -
clause -
Returns:

getParents

public List<UnaryClause> getParents(Clause root,
                                    Clause child)
Returns all direct parents.

Parameters:
root -
child -
Returns:

getParent

public UnaryClause getParent(Clause root,
                             Clause child)
Finds the first found direct parent.

Parameters:
root -
child -
Returns:

visitImpl

protected void visitImpl(UnaryClause clause)
Parameters:
clause -

visitImpl

protected void visitImpl(BinaryClause clause)
Parameters:
clause -

visitImpl

protected void visitImpl(LeafClause clause)
Parameters:
clause -


Copyright © 2005-2009 Schibsted ASA. All Rights Reserved.