public static void main(String[] args) { InputStream in = System.in ; OutputStream out = System.out ; BindingInputStream input = new BindingInputStream(in) ; BindingOutputStream output = new BindingOutputStream(out) ; for ( ; input.hasNext() ; ) output.send(input.next()) ; output.flush() ; } }
/** Convert a query solution to a binding */ public static Binding asBinding(QuerySolution qSolution) { if ( qSolution == null ) return null ; if ( qSolution instanceof ResultBinding ) // Only named variables. return new BindingProjectNamed(((ResultBinding)qSolution).getBinding()) ; BindingMap binding = BindingFactory.create() ; addToBinding(binding, qSolution) ; return binding ; }
public static Binding asBinding(QuerySolution qSolution) { if ( qSolution == null ) return null ; Binding binding = new BindingMap(null) ; addToBinding(binding, qSolution) ; return binding ; }
@Override public boolean equals(Object obj) { if ( this == obj ) return true ; if ( ! ( obj instanceof BindingFixed) ) return false ; BindingFixed b = (BindingFixed)obj ; return BindingBase.equals(this, b) ; }
@Override public int hashCode() { if ( ! haveDoneHashCode ) { calcHashCode = calcHashCode() ; haveDoneHashCode = true ; } return calcHashCode ; }
private static int compareNodes(NodeValue nv1, NodeValue nv2, int direction) { int x = compareNodesRaw(nv1, nv2) ; if ( direction == Query.ORDER_DESCENDING ) x = -x ; return x ; }
private static void bind(Binding b, Var var, Node node) { if ( node == null || node == Node.ANY ) return ; b.add(var, node) ; }