Class NodeUpdate

Direct Known Subclasses:
DeleteNode, InsertAfter, InsertAttribute, InsertBefore, InsertInto, InsertIntoAsFirst, InsertIntoAsLast, RenameNode, ReplaceDoc, ReplaceNode, ReplaceValue

public abstract class NodeUpdate extends DataUpdate
Base class for all update primitives that operate on a specific node.
Author:
BaseX Team 2005-21, BSD License, Lukas Kircher
  • Field Details

    • pre

      public final int pre
      Pre value of target node.
  • Method Details

    • node

      public final DBNode node()
      Creates a DBNode instance from the target node information.
      Returns:
      new node instance
    • prepare

      public abstract void prepare(MemData memData, QueryContext qc) throws QueryException
      Prepares this update primitive before execution. This includes e.g. the preparation of insertion sequences.
      Parameters:
      memData - temporary data instance
      qc - query context
      Throws:
      QueryException - query exception
    • update

      public abstract void update(NamePool pool)
      Updates the name pool, which is used to find duplicate attributes and namespace conflicts.
      Parameters:
      pool - name pool
    • addAtomics

      public abstract void addAtomics(AtomicUpdateCache auc)
      Adds the atomic update operations for this update primitive to the given list.
      Parameters:
      auc - list of atomic updates
    • substitute

      public NodeUpdate[] substitute(MemData tmp)
      Substitutes the update primitive if necessary. For instance a 'Replace Value of' primitive called on a target T with T being an element results in a 'Replace Element Content' primitive with target T. As this is ugly to process it is substituted by delete primitives for every child of T and an 'Insert into' primitive if the length of the (optional!) text node is greater zero. When a primitive is substituted it is still added to the list itself to be able to throw exceptions when necessary. I.e. for multiple replaces on the same target node. These update primitives don't produce atomic updates, hence this won't affect the database.
      Parameters:
      tmp - temporary mem data
      Returns:
      An array that contains the substituting primitives or this update primitive if no substitution is necessary.