Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface Edge<
- T,
- EP extends Edge.Endpoint<T>
- > extends Serializable, Cloneable, XmlSerializable<EdgeXml, Object>, ContextReporter
- {
- interface Endpoint<
- T
- >
- {
- Set<Edge.Endpoint<T>> getNeighbors();
- Set<Edge.Endpoint<T>> getTraversableNeighborsTo();
- Set<Edge.Endpoint<T>> getTraversableNeighborsFrom();
- boolean isTraversable();
- boolean isTraversable(final Edge.Endpoint<T> destination);
- boolean isTraversable(final T destination);
- T getTarget();
- };
- Set<EP> getEndPoints();
- Set<EP> getEndPoints(final T node);
- boolean contains(final T node);
- Set<T> getTargets();
- Set<T> getNeighbors(final T source);
- Set<T> getTraversableFrom(final T source);
- Set<T> getTraversableTo(final T destination);
- boolean isTraversable(final T source, final T destination);
- int getDegree();
- }
- =========================================================
- public interface Graph<
- PA,
- N extends PA,
- E extends Edge<N,? extends Edge.Endpoint<N>>,
- NEP extends Graph.NodeEndpoint<N, E>,
- EEP extends Graph.EdgeEndpoint<N, E>
- > extends Edge<PA,Graph.Endpoint<N,E,PA>>, Serializable, Cloneable, ContextReporter
- {
- interface Endpoint<
- ON,
- OE extends Edge<ON,? extends Edge.Endpoint<? extends ON>>,
- T
- > extends Edge.Endpoint<T>
- {
- Set<Graph.Endpoint<ON,OE,T>> getAdjacent();
- Set<Graph.Endpoint<ON,OE,T>> getTraversableAdjacentTo();
- Set<Graph.Endpoint<ON,OE,T>> getTraversableAdjacentFrom();
- Set<Graph.NodeEndpoint<ON, OE>> getAdjacentNodes();
- Set<Graph.NodeEndpoint<ON, OE>> getTraversableAdjacentNodesTo();
- Set<Graph.NodeEndpoint<ON, OE>> getTraversableAdjacentNodesFrom();
- Set<Graph.EdgeEndpoint<ON, OE>> getAdjacentEdges();
- Set<Graph.EdgeEndpoint<ON, OE>> getTraversableAdjacentEdgesTo();
- Set<Graph.EdgeEndpoint<ON, OE>> getTraversableAdjacentEdgesFrom();
- };
- interface NodeEndpoint<
- ON,
- OE extends Edge<ON,? extends Edge.Endpoint<? extends ON>>
- > extends Graph.Endpoint<ON,OE,ON>
- {
- };
- interface EdgeEndpoint<
- ON,
- OE extends Edge<ON,? extends Edge.Endpoint<? extends ON>>
- > extends Graph.Endpoint<ON,OE,OE>
- {
- };
- Set<EEP> getEdgeEndpoints();
- Set<EEP> getEdgeEndpoints(E edge);
- Set<NEP> getNodeEndpoints();
- Set<NEP> getNodeEndpoints(N node);
- /**
- * Get a set of all nodes in the graph.
- *
- * @return An unmodifiable set of all nodes in the graph.
- * @since 2.0
- */
- Set<N> getNodes();
- /**
- * Get a set of all edges in the graph. Two edges in the set, and in the graph,
- * may have the same end points unless equals in the edges used by this graph
- * restrict that possiblity.
- *
- * @return An unmodifiable set of a all edges in the graph.
- * @since 2.0
- */
- Set<E> getEdges();
- /**
- * Get a list of all nodes adjacent to the specified node. All edges connected
- * to this node has its other end points added to the list returned. The
- * specified node itself will appear in the list once for every loop. If there
- * are multiple edges connecting node with a particular end point it will
- * appear multiple times in the list, once for each hop to the end point.
- *
- * @param node The whose neighbors are to be returned.
- * @return A list of all nodes adjacent to the specified node, empty set if the
- * node has no edges.
- * @since 2.0
- */
- Set<N> getAdjacentNodes(N node);
- /**
- * Get a set of all edges which is connected to node (adjacent). You may not be
- * able to traverse from the specified node to all of these edges returned. If
- * you only want edges you can traverse then see getTraversableAdjacentEdges.
- *
- * @param node the end point for all edges to retrieve.
- * @return An unmodifiable set of all edges that has node as an end point.
- * @throws IllegalArgumentException if specified node is not in the graph.
- * @since 2.0
- */
- Set<E> getAdjacentEdges(N node);
- Set<E> getTraversableEdgesFrom(final N source);
- Set<E> getTraversableEdgesFrom(final E source);
- Set<E> getTraversableEdgesTo(final N destination);
- Set<E> getTraversableEdgesTo(final E destination);
- Set<N> getTraversableNodesFrom(final N source);
- Set<N> getTraversableNodesFrom(final E source);
- Set<N> getTraversableNodesTo(final N destination);
- Set<N> getTraversableNodesTo(final E destination);
- Set<E> getTraversableAdjacentEdgesFrom(final N source);
- Set<E> getTraversableAdjacentEdgesFrom(final E source);
- Set<E> getTraversableAdjacentEdgesTo(final N destination);
- Set<E> getTraversableAdjacentEdgesTo(final E destination);
- Set<N> getTraversableAdjacentNodesFrom(final N source);
- Set<N> getTraversableAdjacentNodesFrom(final E source);
- /**
- * Get a list of all reachable nodes adjacent to node. All edges connected to
- * node and is traversable from node will have its destination node(s) added to
- * the returned list. node itself will appear in the list once for every loop.
- * If there are multiple edges connecting node with a particular end point then
- * the end point will appear multiple times in the list, once for each hop to
- * the end point.
- *
- * @param destination The whose traversable neighbors are to be returned.
- * @return A list of all nodes adjacent to the specified node and traversable
- * from the spevified node, empty set if the node has no edges.
- * @since 2.0
- */
- Set<N> getTraversableAdjacentNodesTo(final N destination);
- /**
- * Get a set of all edges which you can traverse from node. Of course node will
- * always be an end point for each edge returned. Throws an
- * IllegalArgumentException if node is not in the graph.
- *
- * @param destination edges returned will be traversable from this node.
- * @return An unmodifiable set of all edges that can be traversed from node.
- * @since 2.0
- */
- Set<N> getTraversableAdjacentNodesTo(final E destination);
- }
Add Comment
Please, Sign In to add comment