01: /*
02: (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: All rights reserved - see end of file.
04: $Id: RuleSet.java,v 1.5 2008/01/02 12:05:52 andy_seaborne Exp $
05: */
06:
07: package com.hp.hpl.jena.assembler;
08:
09: import java.util.*;
10:
11: import com.hp.hpl.jena.reasoner.rulesys.Rule;
12:
13: /**
14: A RuleSet wraps a list of rules.
15:
16: @author kers
17: */
18: public class RuleSet {
19: public static final RuleSet empty = create(Collections.EMPTY_LIST);
20:
21: public static RuleSet create(List rules) {
22: return new RuleSet(rules);
23: }
24:
25: public static RuleSet create(String ruleString) {
26: return create(Rule.parseRules(ruleString));
27: }
28:
29: private final List rules;
30:
31: protected RuleSet(List rules) {
32: this .rules = new ArrayList(rules);
33: }
34:
35: public List getRules() {
36: return rules;
37: }
38:
39: public boolean equals(Object other) {
40: return other instanceof RuleSet
41: && rules.equals(((RuleSet) other).rules);
42: }
43:
44: }
45:
46: /*
47: * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
48: * All rights reserved.
49: *
50: * Redistribution and use in source and binary forms, with or without
51: * modification, are permitted provided that the following conditions
52: * are met:
53: * 1. Redistributions of source code must retain the above copyright
54: * notice, this list of conditions and the following disclaimer.
55: * 2. Redistributions in binary form must reproduce the above copyright
56: * notice, this list of conditions and the following disclaimer in the
57: * documentation and/or other materials provided with the distribution.
58: * 3. The name of the author may not be used to endorse or promote products
59: * derived from this software without specific prior written permission.
60: *
61: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
62: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
63: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
64: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
65: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
66: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
67: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
68: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
69: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
70: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
71: */
|