1 23 24 package org.objectweb.medor.eval.lib; 25 26 import org.objectweb.medor.api.MedorException; 27 import org.objectweb.medor.eval.api.NodeEvaluator; 28 import org.objectweb.medor.eval.api.NodeEvaluatorFactory; 29 import org.objectweb.medor.eval.api.EvaluationMetaData; 30 import org.objectweb.medor.query.api.QueryNode; 31 32 38 public class IteratifNodeEvaluatorFactory implements NodeEvaluatorFactory { 39 40 public NodeEvaluator createNodeEvaluator(QueryNode node, 41 NodeEvaluator[] subEvaluators, 42 EvaluationMetaData evalMD) 43 throws MedorException { 44 if ((node.getChildren().length == 1) || (subEvaluators.length == 1)) { 45 return new UnaryIteratifNodeEvaluator(node, 46 subEvaluators[0], 47 evalMD); 48 } else if ((node.getChildren().length == 2) || 49 (subEvaluators.length == 2)) { 50 return new BinaryIteratifNodeEvaluator(node, 51 subEvaluators[0], 52 subEvaluators[1], 53 evalMD); 54 } else 55 throw new MedorException("This QueryNode is not evaluable: too many children (" + node.getChildren().length + ")."); 56 } 57 } 58 | Popular Tags |