Java 类org.neo4j.graphdb.traversal.Evaluator 实例源码

项目:WhiteLab2.0-Neo4J-Plugin    文件:QueryBenchmark.java   
private Traverser getPatternMatch(Node startNode, final List<String> patterns, final List<NodeLabel> nodeLabels, final List<LinkLabel> linkLabels) {
    TraversalDescription td = database.traversalDescription()
        .depthFirst()
        .evaluator( new Evaluator() {
            public Evaluation evaluate( final org.neo4j.graphdb.Path path ) {
                if ( path.length() == 0 ) {
                    return Evaluation.EXCLUDE_AND_CONTINUE;
                }
                boolean isToken = path.endNode().hasLabel(NodeLabel.WordToken);
                boolean included = isToken && (path.length() == 1 || nodeHasAnnotation(path.endNode(), linkLabels.get(path.length() - 1), patterns.get(path.length() - 1)));
                boolean continued = path.length() < patterns.size();
                return Evaluation.of( included, continued );
            }
        } )
        .relationships(LinkLabel.NEXT, Direction.OUTGOING)
        .relationships(LinkLabel.HAS_TYPE, Direction.INCOMING)
        .relationships(LinkLabel.HAS_LEMMA, Direction.INCOMING)
        .relationships(LinkLabel.HAS_POS_TAG, Direction.INCOMING)
        .relationships(LinkLabel.HAS_HEAD, Direction.INCOMING);
    return td.traverse(startNode);
}
项目:neo4j-mobile-android    文件:MultiEvaluator.java   
public Evaluation evaluate( Path position )
{
    boolean includes = true;
    boolean continues = true;
    for ( Evaluator evaluator : this.evaluators )
    {
        Evaluation bla = evaluator.evaluate( position );
        if ( !bla.includes() )
        {
            includes = false;
        }
        if ( !bla.continues() )
        {
            continues = false;
        }
        if ( !continues && !includes )
        {
            return Evaluation.EXCLUDE_AND_PRUNE;
        }
    }
    return Evaluation.of( includes, continues );
}
项目:neo4j-mobile-android    文件:TraversalDescriptionImpl.java   
private Evaluator addBlaEvaluator( Evaluator evaluator )
{
    if ( this.evaluator instanceof MultiEvaluator )
    {
        return ((MultiEvaluator) this.evaluator).add( evaluator );
    }
    else
    {
        if ( this.evaluator == Evaluators.all() )
        {
            return evaluator;
        }
        else
        {
            return new MultiEvaluator( new Evaluator[] { this.evaluator, evaluator } );
        }
    }
}
项目:neo4j-mobile-android    文件:MultiEvaluator.java   
public MultiEvaluator add( Evaluator evaluator )
{
    Evaluator[] newArray = new Evaluator[this.evaluators.length+1];
    System.arraycopy( this.evaluators, 0, newArray, 0, this.evaluators.length );
    newArray[newArray.length-1] = evaluator;
    return new MultiEvaluator( newArray );
}
项目:neo4j-mobile-android    文件:TraversalDescriptionImpl.java   
private TraversalDescriptionImpl( Expander expander,
        UniquenessFactory uniqueness, Object uniquenessParameter,
        Evaluator evaluator, BranchOrderingPolicy branchSelector )
{
    this.expander = expander;
    this.uniqueness = uniqueness;
    this.uniquenessParameter = uniquenessParameter;
    this.evaluator = evaluator;
    this.branchSelector = branchSelector;
}
项目:unmanaged-extension    文件:TraversalPrinter.java   
public TraversalPrinter( Evaluator innerEvaluator, String... propertyNames )
{
    this.innerEvaluator = innerEvaluator;
    this.propertyNames = asList( propertyNames );
}
项目:neo4j-mobile-android    文件:MultiEvaluator.java   
MultiEvaluator( Evaluator... prunings )
{
    this.evaluators = prunings;
}