001 /* 002 * JBoss, Home of Professional Open Source. 003 * Copyright 2008, Red Hat Middleware LLC, and individual contributors 004 * as indicated by the @author tags. See the copyright.txt file in the 005 * distribution for a full listing of individual contributors. 006 * 007 * This is free software; you can redistribute it and/or modify it 008 * under the terms of the GNU Lesser General Public License as 009 * published by the Free Software Foundation; either version 2.1 of 010 * the License, or (at your option) any later version. 011 * 012 * This software is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * You should have received a copy of the GNU Lesser General Public 018 * License along with this software; if not, write to the Free 019 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 020 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 021 */ 022 package org.jboss.dna.graph; 023 024 import net.jcip.annotations.Immutable; 025 import org.jboss.dna.graph.properties.Path; 026 027 /** 028 * A set of nodes returned from a {@link Graph graph}, with methods to access the properties and children of the nodes in the 029 * result. The {@link #iterator()} method can be used to iterate all over the nodes in the result. 030 * 031 * @author Randall Hauch 032 */ 033 @Immutable 034 public interface Results extends Iterable<Node> { 035 036 /** 037 * Get the graph containing the node. 038 * 039 * @return the graph 040 */ 041 Graph getGraph(); 042 043 /** 044 * Get the node at the supplied location. 045 * 046 * @param path the path of the node in these results 047 * @return the node, or null if the node is not {@link #includes(Path) included} in these results 048 */ 049 Node getNode( String path ); 050 051 /** 052 * Get the node at the supplied location. 053 * 054 * @param path the path of the node in these results 055 * @return the node, or null if the node is not {@link #includes(Path) included} in these results 056 */ 057 Node getNode( Path path ); 058 059 /** 060 * Get the node at the supplied location. 061 * 062 * @param location the location of the node 063 * @return the node, or null if the node is not {@link #includes(Path) included} in these results 064 */ 065 Node getNode( Location location ); 066 067 /** 068 * Return whether these results include a node at the supplied location. 069 * 070 * @param path the path of the node in these results 071 * @return true if this subgraph includes the supplied location, or false otherwise 072 */ 073 boolean includes( String path ); 074 075 /** 076 * Return whether this subgraph has a node at the supplied location. 077 * 078 * @param path the path of the node in these results 079 * @return true if these results includes the supplied location, or false otherwise 080 */ 081 boolean includes( Path path ); 082 083 /** 084 * Return whether this subgraph has a node at the supplied location. 085 * 086 * @param location the location of the node in these results 087 * @return true if these results includes the supplied location, or false otherwise 088 */ 089 boolean includes( Location location ); 090 091 }