View Javadoc

1   /*
2    * Copyright James Leigh (c) 2006 2007.
3    *
4    * Licensed under the Aduna BSD-style license.
5    */
6   package org.openrdf.repository.augur.model;
7   
8   import org.openrdf.model.Resource;
9   
10  /**
11   * Base class for ABNode and AURI. Includes the AugurNode, binding name, and
12   * Resource value.
13   * 
14   * @author James Leigh
15   */
16  public abstract class AResource implements Resource {
17  
18  	public AResource(String name, Resource value, AugurNode node) {
19  		assert name != null;
20  		assert value != null;
21  		assert node != null;
22  		this._name = name;
23  		this._value = value;
24  		this.node = node;
25  	}
26  
27  	private transient String _name;
28  
29  	private Resource _value;
30  
31  	private transient AugurNode node;
32  
33  	public String getName() {
34  		return _name;
35  	}
36  
37  	public Resource getValue() {
38  		return _value;
39  	}
40  
41  	public AugurNode getAugurNode() {
42  		return node;
43  	}
44  
45  	public String stringValue() {
46  		return getValue().stringValue();
47  	}
48  
49  	@Override
50  	public boolean equals(Object o) {
51  		return getValue().equals(o);
52  	}
53  
54  	@Override
55  	public int hashCode() {
56  		return getValue().hashCode();
57  	}
58  
59  	@Override
60  	public String toString() {
61  		return getValue().toString();
62  	}
63  }