@@ -0,0 +1,1890 @@
+/*%0A *  Copyright (C) 2011-2012 The Animo Project%0A *  http://animotron.org%0A *  %09%0A *  This file is part of Animotron.%0A *  %0A *  Animotron is free software: you can redistribute it and/or modify%0A *  it under the terms of the GNU Affero General Public License as %0A *  published by the Free Software Foundation, either version 3 of %0A *  the License, or (at your option) any later version.%0A *  %0A *  Animotron is distributed in the hope that it will be useful,%0A *  but WITHOUT ANY WARRANTY; without even the implied warranty of%0A *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A *  GNU Affero General Public License for more details.%0A *  %0A *  You should have received a copy of %0A *  the GNU Affero General Public License along with Animotron.  %0A *  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A */%0Apackage org.animotron.statement.animo;%0A%0Aimport org.animotron.graph.index.Order;%0Aimport org.animotron.manipulator.OnQuestion;%0Aimport org.animotron.manipulator.PFlow;%0Aimport org.animotron.statement.instruction.Instruction;%0Aimport org.animotron.statement.operator.Evaluable;%0Aimport org.neo4j.graphdb.Relationship;%0Aimport org.neo4j.graphdb.index.IndexHits;%0A%0A/**%0A * Operation 'ORDERED'.%0A * %0A * @author %3Ca href=%22mailto:shabanovd@gmail.com%22%3EDmitriy Shabanov%3C/a%3E%0A * @author %3Ca href=%22mailto:gazdovsky@gmail.com%22%3EEvgeny Gazdovsky%3C/a%3E%0A */%0Apublic class ORDERED extends Instruction implements Evaluable %7B%0A%09%0A%09public static final ORDERED _ = new ORDERED();%0A%09%0A%09private static boolean debug = false;%0A%09%0A%09private ORDERED() %7B super(%22ordered%22); %7D%0A%09%0A    @Override%0A%09public OnQuestion onCalcQuestion() %7B%0A%09%09return new Calc();%0A    %7D%0A    %0A    class Calc extends OnQuestion %7B%0A%09%09@Override%0A%09%09public void act(final PFlow pf) %7B%0A%09%09%09IndexHits%3CRelationship%3E hits = Order.queryDown(pf.getOPNode());%0A%09%09%09try %7B%0A%09%09%09%09for (Relationship r : hits) %7B%0A%09%09%09%09%09pf.sendAnswer(r);%0A%09%09%09%09%7D%0A%09%09%09%7D finally %7B%0A%09%09%09%09hits.close();%0A%09%09%09%7D%0A%09%09%7D%0A    %7D%0A%7D%0A

add ORDERED instruction