01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2006.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.query;
07:
08: import org.openrdf.model.Value;
09:
10: /**
11: * A named value binding.
12: */
13: public interface Binding {
14:
15: /**
16: * Gets the name of the binding (e.g. the variable name).
17: *
18: * @return The name of the binding.
19: */
20: public String getName();
21:
22: /**
23: * Gets the value of the binding. The returned value is never equal to
24: * <tt>null</tt>, such a "binding" is considered to be unbound.
25: *
26: * @return The value of the binding, never <tt>null</tt>.
27: */
28: public Value getValue();
29:
30: /**
31: * Compares a binding object to another object.
32: *
33: * @param o
34: * The object to compare this binding to.
35: * @return <tt>true</tt> if the other object is an instance of
36: * {@link Binding} and both their names and values are equal,
37: * <tt>false</tt> otherwise.
38: */
39: public boolean equals(Object o);
40:
41: /**
42: * The hash code of a binding is defined as the bit-wise XOR of the hash
43: * codes of its name and value:
44: *
45: * <pre>
46: * name.hashCode() ˆ value.hashCode()
47: * </pre>.
48: *
49: * @return A hash code for the binding.
50: */
51: public int hashCode();
52: }
|