/*
 *  Copyright (C) 2011 The Animo Project
 *  http://animotron.org
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public License
 *  as published by the Free Software Foundation; either version 3
 *  of the License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
package org.animotron.operator.query;

import org.animotron.operator.AbstractOperator;
import org.animotron.operator.Cachable;

/**
 * Query operator 'ALL'.
 * 
 * Return nothing (if no USE) or 'all' USE. 
 * 
 * @author <a href="mailto:shabanovd@gmail.com">Dmitriy Shabanov</a>
 * @author <a href="mailto:gazdovsky@gmail.com">Evgeny Gazdovsky</a>
 */
public class ALL extends AbstractOperator implements Cachable {
	
	public static final ALL _ = new ALL();
	
	private ALL() { super("all", "animo/query/all"); }
	
}

@@ -862,42 +862,150 @@
 ron.
-operator.AbstractOperator;
+manipulator.OnQuestion;%0Aimport org.animotron.manipulator.PFlow;%0Aimport org.neo4j.graphdb.Node;%0Aimport org.neo4j.graphdb.Relationship;%0A
 %0Aimport 
 org.
@@ -992,32 +992,39 @@
 onship;%0A%0Aimport 
+static 
 org.animotron.op
@@ -1025,25 +1025,87 @@
 ron.
-operator.Cachable
+graph.RelationshipTypes.REF;%0Aimport static org.neo4j.graphdb.Direction.OUTGOING
 ;%0A%0A/
@@ -1364,36 +1364,13 @@
 ract
-Operator implements Cachable
+Query
  %7B%0A%09
@@ -1464,12 +1464,776 @@
 ll%22); %7D%0A
-%09
+%0A    public OnQuestion onCalcQuestion() %7B%0A        return question;%0A    %7D%0A%0A    private OnQuestion question = new OnQuestion() %7B%0A        @Override%0A        public void onMessage(final PFlow pf) %7B%0A            final Node n = pf.getOP().getEndNode();%0A            Relationship ref = n.getSingleRelationship( REF, OUTGOING );%0A%0A            Node node = ref.getEndNode();%0A%0A            for (Relationship tdR : td_eval.traverse(node).relationships()) %7B%0A                System.out.println(%22ALL get next %22+tdR+%22 %5B%22+tdR.getStartNode()+%22%5D%22);%0A                Node res = tdR.getStartNode();%0A                if (filtering(pf, res)) %7B%0A                    pf.sendAnswer( createResultInMemory( n, getThe(res) ) );%0A                %7D%0A            %7D%0A%0A            pf.done();%0A        %7D%0A%0A    %7D;%0A
 %0A%7D%0A

implement ALL