< prev index next >

src/java.desktop/share/classes/javax/imageio/spi/DigraphNode.java

Print this page




  26 package javax.imageio.spi;
  27 
  28 import java.io.Serializable;
  29 import java.util.HashSet;
  30 import java.util.Iterator;
  31 import java.util.Set;
  32 
  33 /**
  34  * A node in a directed graph.  In addition to an arbitrary
  35  * {@code Object} containing user data associated with the node,
  36  * each node maintains a {@code Set}s of nodes which are pointed
  37  * to by the current node (available from {@code getOutNodes}).
  38  * The in-degree of the node (that is, number of nodes that point to
  39  * the current node) may be queried.
  40  *
  41  */
  42 class DigraphNode<E> implements Cloneable, Serializable {
  43     private static final long serialVersionUID = 5308261378582246841L;
  44 
  45     /** The data associated with this node. */

  46     protected E data;
  47 
  48     /**
  49      * A {@code Set} of neighboring nodes pointed to by this
  50      * node.
  51      */

  52     protected Set<DigraphNode<E>> outNodes = new HashSet<>();
  53 
  54     /** The in-degree of the node. */
  55     protected int inDegree = 0;
  56 
  57     /**
  58      * A {@code Set} of neighboring nodes that point to this
  59      * node.
  60      */

  61     private Set<DigraphNode<E>> inNodes = new HashSet<>();
  62 
  63     public DigraphNode(E data) {
  64         this.data = data;
  65     }
  66 
  67     /** Returns the {@code Object} referenced by this node. */
  68     public E getData() {
  69         return data;
  70     }
  71 
  72     /**
  73      * Returns an {@code Iterator} containing the nodes pointed
  74      * to by this node.
  75      */
  76     public Iterator<DigraphNode<E>> getOutNodes() {
  77         return outNodes.iterator();
  78     }
  79 
  80     /**




  26 package javax.imageio.spi;
  27 
  28 import java.io.Serializable;
  29 import java.util.HashSet;
  30 import java.util.Iterator;
  31 import java.util.Set;
  32 
  33 /**
  34  * A node in a directed graph.  In addition to an arbitrary
  35  * {@code Object} containing user data associated with the node,
  36  * each node maintains a {@code Set}s of nodes which are pointed
  37  * to by the current node (available from {@code getOutNodes}).
  38  * The in-degree of the node (that is, number of nodes that point to
  39  * the current node) may be queried.
  40  *
  41  */
  42 class DigraphNode<E> implements Cloneable, Serializable {
  43     private static final long serialVersionUID = 5308261378582246841L;
  44 
  45     /** The data associated with this node. */
  46     @SuppressWarnings("serial") // Not statically typed as Serializable
  47     protected E data;
  48 
  49     /**
  50      * A {@code Set} of neighboring nodes pointed to by this
  51      * node.
  52      */
  53     @SuppressWarnings("serial") // Not statically typed as Serializable
  54     protected Set<DigraphNode<E>> outNodes = new HashSet<>();
  55 
  56     /** The in-degree of the node. */
  57     protected int inDegree = 0;
  58 
  59     /**
  60      * A {@code Set} of neighboring nodes that point to this
  61      * node.
  62      */
  63     @SuppressWarnings("serial") // Not statically typed as Serializable
  64     private Set<DigraphNode<E>> inNodes = new HashSet<>();
  65 
  66     public DigraphNode(E data) {
  67         this.data = data;
  68     }
  69 
  70     /** Returns the {@code Object} referenced by this node. */
  71     public E getData() {
  72         return data;
  73     }
  74 
  75     /**
  76      * Returns an {@code Iterator} containing the nodes pointed
  77      * to by this node.
  78      */
  79     public Iterator<DigraphNode<E>> getOutNodes() {
  80         return outNodes.iterator();
  81     }
  82 
  83     /**


< prev index next >