1 package org.thegalactic.dgraph; 2 3 /* 4 * DGraph.java 5 * 6 * Copyright: 2016 The Galactic Organization, France 7 * 8 * License: http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html CeCILL-B license 9 * 10 * This file is part of java-lattices. 11 * You can redistribute it and/or modify it under the terms of the CeCILL-B license. 12 */ 13 import java.io.IOException; 14 import java.util.SortedSet; 15 16 /** 17 * DGraph. 18 * 19 * @param <N> Node content type 20 * @param <E> Edge content type 21 * 22 * @todo Do use N insteand of Node and E instead of Edge by defining DGraph<N extends Comparable<N>, E> 23 */ 24 public interface DGraph<N, E> { 25 26 /** 27 * Returns the set of nodes of this component. 28 * 29 * @return the set of nodes 30 */ 31 SortedSet<Node<N>> getNodes(); 32 33 /** 34 * Returns the set of edges of this component. 35 * 36 * @return the set of edges 37 */ 38 SortedSet<Edge<N, E>> getEdges(); 39 40 /** 41 * Returns the set of edges predecessors of the specified node. 42 * 43 * @param node the node to search for 44 * 45 * @return the set of edges 46 */ 47 SortedSet<Edge<N, E>> getPredecessorEdges(final Node<N> node); 48 49 /** 50 * Returns the set of edges successors of the specified node. 51 * 52 * @param node the node to search for 53 * 54 * @return the set of edges 55 */ 56 SortedSet<Edge<N, E>> getSuccessorEdges(final Node<N> node); 57 58 /** 59 * Returns the set of nodes predecessors of the specified node. 60 * 61 * @param node the node to search for 62 * 63 * @return the set of nodes 64 */ 65 SortedSet<Node<N>> getPredecessorNodes(final Node<N> node); 66 67 /** 68 * Returns the set of nodes successors of the specified node. 69 * 70 * @param node the node to search for 71 * 72 * @return the set of nodes 73 */ 74 SortedSet<Node<N>> getSuccessorNodes(final Node<N> node); 75 76 /** 77 * Returns the sinks of this component. 78 * 79 * @return the sinks 80 */ 81 SortedSet<Node<N>> getSinks(); 82 83 /** 84 * Returns the wells of this component. 85 * 86 * @return the wells 87 */ 88 SortedSet<Node<N>> getWells(); 89 90 /** 91 * Returns the number of edges of this component. 92 * 93 * @return the number of edges 94 */ 95 int sizeEdges(); 96 97 /** 98 * Returns the number of nodes of this component. 99 * 100 * @return the number of nodes 101 */ 102 int sizeNodes(); 103 104 /** 105 * Save the description of this component in a file whose name is specified. 106 * 107 * @param filename the name of the file 108 * 109 * @throws IOException When an IOException occurs 110 */ 111 void save(final String filename) throws IOException; 112 113 /** 114 * Returns a String representation of this component. 115 * 116 * @return the string representation 117 */ 118 @Override 119 String toString(); 120 }