private BindingSetAssignment crossJoin(BindingSetAssignment left,BindingSetAssignment right){
  Iterable<BindingSet> leftIter=left.getBindingSets();
  Iterable<BindingSet> rightIter=right.getBindingSets();
  int leftSize=size(leftIter,16);
  int rightSize=size(rightIter,16);
  List<BindingSet> output=new ArrayList<BindingSet>(leftSize * rightSize);
  for (  BindingSet l : leftIter) {
    for (    BindingSet r : rightIter) {
      QueryBindingSet bs=new QueryBindingSet();
      bs.addAll(l);
      bs.addAll(r);
      output.add(bs);
    }
  }
  Set<String> bindingNames=new HashSet<String>(left.getBindingNames());
  bindingNames.addAll(right.getBindingNames());
  BindingSetAssignment bindings=new BindingSetAssignment();
  bindings.setBindingSets(output);
  bindings.setBindingNames(bindingNames);
  return bindings;
}

private BindingSetAssignment crossJoin ( BindingSetAssignment left , BindingSetAssignment right ) { Iterable < BindingSet > leftIter = left . getBindingSets ( ) ; Iterable < BindingSet > rightIter = right . getBindingSets ( ) ; int leftSize = size ( leftIter , 16 ) ; int rightSize = size ( rightIter , 16 ) ; List < BindingSet > output = new ArrayList < BindingSet > ( leftSize * rightSize ) ; for ( BindingSet l : leftIter ) { for ( BindingSet r : rightIter ) { QueryBindingSet bs = new QueryBindingSet ( ) ; bs . addAll ( l ) ; bs . addAll ( r ) ; output . add ( bs ) ; } } Set < String > bindingNames = new HashSet < String > ( left . getBindingNames ( ) ) ; bindingNames . addAll ( right . getBindingNames ( ) ) ; BindingSetAssignment bindings = new BindingSetAssignment ( ) ; bindings . setBindingSets ( output ) ; bindings . setBindingNames ( bindingNames ) ; return bindings ; }
computes the cartesian product of the given binding sets .
