01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2007.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.http.protocol.transaction.operations;
07:
08: import java.util.Arrays;
09:
10: import org.openrdf.OpenRDFUtil;
11: import org.openrdf.model.Resource;
12:
13: /**
14: * A TransactionOperation that operates on a specific (set of) contexts.
15: *
16: * @author Arjohn Kampman
17: */
18: public abstract class ContextOperation implements TransactionOperation {
19:
20: protected Resource[] contexts;
21:
22: protected ContextOperation(Resource... contexts) {
23: setContexts(contexts);
24: }
25:
26: public Resource[] getContexts() {
27: return contexts;
28: }
29:
30: public void setContexts(Resource... contexts) {
31: OpenRDFUtil.verifyContextNotNull(contexts);
32:
33: this .contexts = contexts;
34: }
35:
36: @Override
37: public boolean equals(Object other) {
38: if (other instanceof ContextOperation) {
39: ContextOperation o = (ContextOperation) other;
40: return Arrays.deepEquals(getContexts(), o.getContexts());
41: }
42:
43: return false;
44: }
45:
46: @Override
47: public int hashCode() {
48: return Arrays.deepHashCode(getContexts());
49: }
50: }
|