/** * Creates a new in-memory child builder. * @param parent parent builder * @param name name of this node */ protected MemoryNodeBuilder(MemoryNodeBuilder parent, String name) { this.parent = parent; this.name = name; this.rootBuilder = parent.rootBuilder; this.base = parent.base().getChildNode(name); this.baseRevision = parent.baseRevision; this.rootHead = parent.rootHead; this.head = new UnconnectedHead(this, base); }
/** * Creates a new in-memory child builder. * @param parent parent builder * @param name name of this node */ protected MemoryNodeBuilder(MemoryNodeBuilder parent, String name) { this.parent = parent; this.name = name; this.rootBuilder = parent.rootBuilder; this.base = parent.base().getChildNode(name); this.baseRevision = parent.baseRevision; this.rootHead = parent.rootHead; this.head = new UnconnectedHead(this, base); }
@Override public Head update() { if (revision != builder.rootBuilder.baseRevision) { // the root builder's base state has been reset: transition back // to unconnected and connect again if necessary. // No need to pass base() instead of base as the subsequent // call to update will take care of updating to the latest state. builder.head = new UnconnectedHead(builder, builder.base); return builder.head.update(); } else { return this; } }
@Override public Head update() { if (revision != builder.rootBuilder.baseRevision) { // the root builder's base state has been reset: transition back // to unconnected and connect again if necessary. // No need to pass base() instead of base as the subsequent // call to update will take care of updating to the latest state. builder.head = new UnconnectedHead(builder, builder.base); return builder.head.update(); } else { return this; } }