01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.php
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package edu.iu.uis.eden.engine.node;
18:
19: import java.util.Collection;
20:
21: /**
22: * The criteria defining parameters to a search through a document's node graph.
23: *
24: * @author ewestfal
25: */
26: public class NodeGraphSearchCriteria {
27:
28: // search directions
29: public static final int SEARCH_DIRECTION_FORWARD = 1;
30: public static final int SEARCH_DIRECTION_BACKWARD = 2;
31: public static final int SEARCH_DIRECTION_BOTH = 3;
32:
33: private int searchDirection = SEARCH_DIRECTION_FORWARD;
34: private Collection startingNodeInstances;
35: private NodeMatcher matcher;
36:
37: public NodeGraphSearchCriteria(int searchDirection,
38: Collection startingNodeInstances, NodeMatcher matcher) {
39: if (startingNodeInstances == null
40: || startingNodeInstances.isEmpty()) {
41: throw new IllegalArgumentException(
42: "Starting node instances were empty. At least one starting node instance must be specified in order to perform a search.");
43: }
44: this .searchDirection = searchDirection;
45: this .startingNodeInstances = startingNodeInstances;
46: this .matcher = matcher;
47: }
48:
49: public NodeGraphSearchCriteria(int searchDirection,
50: Collection startingNodeInstances, String nodeName) {
51: this (searchDirection, startingNodeInstances,
52: new NodeNameMatcher(nodeName));
53: }
54:
55: public NodeMatcher getMatcher() {
56: return matcher;
57: }
58:
59: public Collection getStartingNodeInstances() {
60: return startingNodeInstances;
61: }
62:
63: public int getSearchDirection() {
64: return searchDirection;
65: }
66:
67: }
|