public ExtendedIterator<Domain> executeBindings(
     List<Stage> outStages, NamedGraphMap args, Node[] nodes) {
   Mapping map = new Mapping(nodes);
   ArrayList<Stage> stages = new ArrayList<Stage>();
   addStages(stages, args, map);
   if (constraint.isComplex()) stages.add(new ConstraintStage(map, constraint));
   outStages.addAll(stages);
   variableCount = map.size();
   return filter(connectStages(stages, variableCount));
 }
 /** Preserve the state of an interpreter into this frame. */
 public void preserveState(List<Node> trail) {
   // Save the trail state
   int trailLen = trail.size();
   if (trailLen > trailLength) {
     trailValues = new Node[trailLen];
     trailVars = new Node_RuleVariable[trailLen];
   }
   trailLength = trailLen;
   for (int i = 0; i < trailLen; i++) {
     Node_RuleVariable var = (Node_RuleVariable) trail.get(i);
     trailVars[i] = var;
     trailValues[i] = var.getRawBoundValue();
   }
   // Save the permanent variables
   Node[] currentPVars = envFrame.pVars;
   if (currentPVars != null) {
     if (pVars == null || pVars.length < currentPVars.length) {
       pVars = new Node[currentPVars.length];
     }
     System.arraycopy(currentPVars, 0, pVars, 0, currentPVars.length);
   }
 }
 private static NamedTripleBunches asNamedTripleBunches(List<Triple> pattern) {
   NamedTripleBunches result = new NamedTripleBunches();
   for (Iterator<Triple> elements = pattern.iterator(); elements.hasNext(); )
     result.add(NamedTripleBunches.anon, elements.next());
   return result;
 }