View Javadoc

1   /*
2    * ModeShape (http://www.modeshape.org)
3    * See the COPYRIGHT.txt file distributed with this work for information
4    * regarding copyright ownership.  Some portions may be licensed
5    * to Red Hat, Inc. under one or more contributor license agreements.
6    * See the AUTHORS.txt file in the distribution for a full listing of 
7    * individual contributors. 
8    *
9    * ModeShape is free software. Unless otherwise indicated, all code in ModeShape
10   * is licensed to you under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation; either version 2.1 of
12   * the License, or (at your option) any later version.
13   *
14   * ModeShape is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17   * Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public
20   * License along with this software; if not, write to the Free
21   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
23   */
24  package org.modeshape.graph;
25  
26  import java.util.List;
27  import net.jcip.annotations.Immutable;
28  import org.modeshape.graph.property.Path;
29  import org.modeshape.graph.request.Request;
30  
31  /**
32   * A set of nodes returned from a {@link Graph graph}, with methods to access the properties and children of the nodes in the
33   * result. The {@link #iterator()} method can be used to iterate all over the nodes in the result.
34   */
35  @Immutable
36  public interface Results extends Graph.BaseResults<Node> {
37  
38      /**
39       * Get the graph containing the node.
40       * 
41       * @return the graph
42       */
43      Graph getGraph();
44  
45      /**
46       * Get the node at the supplied location.
47       * 
48       * @param path the path of the node in these results
49       * @return the node, or null if the node is not {@link #includes(Path) included} in these results
50       */
51      Node getNode( String path );
52  
53      /**
54       * Get the node at the supplied location.
55       * 
56       * @param path the path of the node in these results
57       * @return the node, or null if the node is not {@link #includes(Path) included} in these results
58       */
59      Node getNode( Path path );
60  
61      /**
62       * Get the node at the supplied location.
63       * 
64       * @param location the location of the node
65       * @return the node, or null if the node is not {@link #includes(Path) included} in these results
66       */
67      Node getNode( Location location );
68  
69      /**
70       * Return whether these results include a node at the supplied location.
71       * 
72       * @param path the path of the node in these results
73       * @return true if this subgraph includes the supplied location, or false otherwise
74       */
75      boolean includes( String path );
76  
77      /**
78       * Return whether this subgraph has a node at the supplied location.
79       * 
80       * @param path the path of the node in these results
81       * @return true if these results includes the supplied location, or false otherwise
82       */
83      boolean includes( Path path );
84  
85      /**
86       * Return whether this subgraph has a node at the supplied location.
87       * 
88       * @param location the location of the node in these results
89       * @return true if these results includes the supplied location, or false otherwise
90       */
91      boolean includes( Location location );
92  
93      /**
94       * Get the requests that were executed as part of these results.
95       * 
96       * @return the requests; never null, but possibly empty if there were no results when execute was called
97       */
98      List<Request> getRequests();
99  
100 }