use of com.simiacryptus.mindseye.layers.java.WrapperLayer in project MindsEye by SimiaCryptus.
the class DAGNetwork method visitLayers.
/**
* Visit layers.
*
* @param visitor the visitor
*/
public void visitLayers(@Nonnull final Consumer<Layer> visitor) {
layersById.values().forEach(layer -> {
Layer unwrapped = layer;
while (unwrapped instanceof WrapperLayer) {
unwrapped = ((WrapperLayer) unwrapped).getInner();
}
if (unwrapped instanceof DAGNetwork) {
((DAGNetwork) unwrapped).visitLayers(visitor);
}
visitor.accept(layer);
while (layer instanceof WrapperLayer) {
Layer inner = ((WrapperLayer) layer).getInner();
visitor.accept(inner);
layer = inner;
}
});
}
use of com.simiacryptus.mindseye.layers.java.WrapperLayer in project MindsEye by SimiaCryptus.
the class DAGNetwork method visitNodes.
/**
* Visit nodes.
*
* @param visitor the visitor
*/
public void visitNodes(@Nonnull final Consumer<DAGNode> visitor) {
nodesById.values().forEach(node -> {
Layer layer = node.getLayer();
while (layer instanceof WrapperLayer) {
layer = ((WrapperLayer) layer).getInner();
}
if (layer instanceof DAGNetwork) {
((DAGNetwork) layer).visitNodes(visitor);
}
visitor.accept(node);
});
}
Aggregations