/** * Override the object reading protocol to make sure caches are instantiated. This just calls * {@link #initializeCaches()} after doing the default object-reading. * * @param stream The stream to read from. * @throws IOException If an I/O exception occurs deserializing the object. * @throws ClassNotFoundException If there is a missing class deserializing the object. */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); initializeCaches(); }
/** * Construct a new DAG node. * @param lbl The label. * @param edges The edges. This takes pairs, not actual edge objects, because the edge objects * need to be constructed within the constructor in order to create the circular * references back to the head nodes properly. */ DAGNode(@Nonnull V lbl, Iterable<Pair<DAGNode<V,E>,E>> edges) { label = lbl; ImmutableSet.Builder<DAGEdge<V,E>> bld = ImmutableSet.builder(); for (Pair<DAGNode<V,E>,E> pair: edges) { DAGEdge<V,E> edge = new DAGEdge<V, E>(this, pair.getLeft(), pair.getRight()); bld.add(edge); } outgoingEdges = bld.build(); initializeCaches(); }