Tabnine Logo
PlanNode.removeFromParent
Code IndexAdd Tabnine to your IDE (free)

How to use
removeFromParent
method
in
org.modeshape.jcr.query.plan.PlanNode

Best Java code snippets using org.modeshape.jcr.query.plan.PlanNode.removeFromParent (Showing top 20 results out of 315)

origin: org.fcrepo/modeshape-jcr

/**
 * Add the supplied node to the end of the list of children.
 *
 * @param child the node that should be added as the last child; may not be null
 */
public void addLastChild( PlanNode child ) {
  assert child != null;
  this.children.addLast(child);
  child.removeFromParent();
  child.parent = this;
}
origin: org.fcrepo/modeshape-jcr

/**
 * Add the supplied node to the front of the list of children.
 *
 * @param child the node that should be added as the first child; may not be null
 */
public void addFirstChild( PlanNode child ) {
  assert child != null;
  this.children.addFirst(child);
  child.removeFromParent();
  child.parent = this;
}
origin: ModeShape/modeshape

/**
 * Add the supplied node to the end of the list of children.
 *
 * @param child the node that should be added as the last child; may not be null
 */
public void addLastChild( PlanNode child ) {
  assert child != null;
  this.children.addLast(child);
  child.removeFromParent();
  child.parent = this;
}
origin: ModeShape/modeshape

/**
 * Add the supplied node to the front of the list of children.
 *
 * @param child the node that should be added as the first child; may not be null
 */
public void addFirstChild( PlanNode child ) {
  assert child != null;
  this.children.addFirst(child);
  child.removeFromParent();
  child.parent = this;
}
origin: org.fcrepo/modeshape-jcr

/**
 * Set the parent for this node. If this node already has a parent, this method will remove this node from the current parent.
 * If the supplied parent is not null, then this node will be added to the supplied parent's children.
 *
 * @param parent the new parent, or null if this node is to have no parent
 */
public void setParent( PlanNode parent ) {
  removeFromParent();
  if (parent != null) {
    this.parent = parent;
    this.parent.children.add(this);
  }
}
origin: ModeShape/modeshape

/**
 * Set the parent for this node. If this node already has a parent, this method will remove this node from the current parent.
 * If the supplied parent is not null, then this node will be added to the supplied parent's children.
 *
 * @param parent the new parent, or null if this node is to have no parent
 */
public void setParent( PlanNode parent ) {
  removeFromParent();
  if (parent != null) {
    this.parent = parent;
    this.parent.children.add(this);
  }
}
origin: org.fcrepo/modeshape-jcr

/**
 * Replace the supplied child with another node. If the replacement is already a child of this node, this method effectively
 * swaps the position of the child and replacement nodes.
 *
 * @param child the node that is already a child and that is to be replaced; may not be null and must be a child
 * @param replacement the node that is to replace the 'child' node; may not be null
 * @return true if the child was successfully replaced
 */
public boolean replaceChild( PlanNode child,
               PlanNode replacement ) {
  assert child != null;
  assert replacement != null;
  if (child.parent == this) {
    int i = this.children.indexOf(child);
    if (replacement.parent == this) {
      // Swapping the positions ...
      int j = this.children.indexOf(replacement);
      this.children.set(i, replacement);
      this.children.set(j, child);
      return true;
    }
    // The replacement is not yet a child ...
    this.children.set(i, replacement);
    replacement.removeFromParent();
    replacement.parent = this;
    child.parent = null;
    return true;
  }
  return false;
}
origin: ModeShape/modeshape

/**
 * Replace the supplied child with another node. If the replacement is already a child of this node, this method effectively
 * swaps the position of the child and replacement nodes.
 *
 * @param child the node that is already a child and that is to be replaced; may not be null and must be a child
 * @param replacement the node that is to replace the 'child' node; may not be null
 * @return true if the child was successfully replaced
 */
public boolean replaceChild( PlanNode child,
               PlanNode replacement ) {
  assert child != null;
  assert replacement != null;
  if (child.parent == this) {
    int i = this.children.indexOf(child);
    if (replacement.parent == this) {
      // Swapping the positions ...
      int j = this.children.indexOf(replacement);
      this.children.set(i, replacement);
      this.children.set(j, child);
      return true;
    }
    // The replacement is not yet a child ...
    this.children.set(i, replacement);
    replacement.removeFromParent();
    replacement.parent = this;
    child.parent = null;
    return true;
  }
  return false;
}
origin: ModeShape/modeshape

newParent.removeFromParent();
if (this.parent != null) {
  this.parent.replaceChild(this, newParent);
origin: org.fcrepo/modeshape-jcr

newParent.removeFromParent();
if (this.parent != null) {
  this.parent.replaceChild(this, newParent);
origin: org.fcrepo/modeshape-jcr

@Override
public PlanNode execute( QueryContext context,
             PlanNode plan,
             LinkedList<OptimizerRule> ruleStack ) {
  // For each of the JOIN nodes ...
  for (PlanNode joinNode : plan.findAllAtOrBelow(Type.JOIN)) {
    if (JoinType.RIGHT_OUTER == joinNode.getProperty(Property.JOIN_TYPE, JoinType.class)) {
      // Swap the information ...
      PlanNode left = joinNode.getFirstChild();
      left.removeFromParent(); // right is now the first child ...
      left.setParent(joinNode);
      joinNode.setProperty(Property.JOIN_TYPE, JoinType.LEFT_OUTER);
      // None of the Constraints or JoinCondition need to be changed (they refer to named selectors) ...
    }
  }
  return plan;
}
origin: ModeShape/modeshape

@Override
public PlanNode execute( QueryContext context,
             PlanNode plan,
             LinkedList<OptimizerRule> ruleStack ) {
  // For each of the JOIN nodes ...
  for (PlanNode joinNode : plan.findAllAtOrBelow(Type.JOIN)) {
    if (JoinType.RIGHT_OUTER == joinNode.getProperty(Property.JOIN_TYPE, JoinType.class)) {
      // Swap the information ...
      PlanNode left = joinNode.getFirstChild();
      left.removeFromParent(); // right is now the first child ...
      left.setParent(joinNode);
      joinNode.setProperty(Property.JOIN_TYPE, JoinType.LEFT_OUTER);
      // None of the Constraints or JoinCondition need to be changed (they refer to named selectors) ...
    }
  }
  return plan;
}
origin: ModeShape/modeshape

@Test
public void shouldRemoveFromParentWhenThereIsNoParent() {
  node = new PlanNode(Type.JOIN);
  PlanNode child1 = new PlanNode(Type.ACCESS, node);
  assertThat(node.getFirstChild(), is(sameInstance(child1)));
  assertThat(node.getChildCount(), is(1));
  // Perform the removeFromParent ...
  assertThat(node.removeFromParent(), is(nullValue()));
  assertThat(node.getFirstChild(), is(sameInstance(child1)));
  assertThat(node.getChildCount(), is(1));
}
origin: ModeShape/modeshape

if (swapChildren) {
  PlanNode first = join.getFirstChild();
  first.removeFromParent();
  join.addLastChild(first);
  if (joinType == JoinType.LEFT_OUTER){
origin: org.fcrepo/modeshape-jcr

if (swapChildren) {
  PlanNode first = join.getFirstChild();
  first.removeFromParent();
  join.addLastChild(first);
  if (joinType == JoinType.LEFT_OUTER){
origin: ModeShape/modeshape

@Test
public void shouldRemoveFromParentWhenThereIsAParent() {
  parent = new PlanNode(Type.JOIN);
  PlanNode child1 = new PlanNode(Type.ACCESS, parent);
  PlanNode child2 = new PlanNode(Type.DUP_REMOVE, parent);
  PlanNode child3 = new PlanNode(Type.GROUP, parent);
  PlanNode grandChild21 = new PlanNode(Type.LIMIT, child2);
  assertThat(parent.getFirstChild(), is(sameInstance(child1)));
  assertThat(parent.getChild(1), is(sameInstance(child2)));
  assertThat(parent.getLastChild(), is(sameInstance(child3)));
  assertThat(parent.getChildCount(), is(3));
  assertThat(child2.getFirstChild(), is(sameInstance(grandChild21)));
  // Perform the removeFromParent ...
  assertThat(child2.removeFromParent(), is(sameInstance(parent)));
  assertThat(parent.getFirstChild(), is(sameInstance(child1)));
  assertThat(parent.getLastChild(), is(sameInstance(child3)));
  assertThat(parent.getChildCount(), is(2));
  // There should still be the child in the removed node ...
  assertThat(child2.getFirstChild(), is(sameInstance(grandChild21)));
}
origin: org.fcrepo/modeshape-jcr

assert sort.getParent() == distinct;
sort.removeFromParent();
assert sort.getParent() == null;
origin: ModeShape/modeshape

assert sort.getParent() == distinct;
sort.removeFromParent();
assert sort.getParent() == null;
origin: ModeShape/modeshape

  access.removeFromParent();
} else {
  project.extractFromParent();
origin: org.fcrepo/modeshape-jcr

  access.removeFromParent();
} else {
  project.extractFromParent();
org.modeshape.jcr.query.planPlanNoderemoveFromParent

Javadoc

Remove this node from its parent, and return the node that used to be the parent of this node. Note that this method removes the entire subgraph under this node.

Popular methods of PlanNode

  • <init>
    Create a new plan node with the supplied initial type ad that is a child of the supplied parent.
  • addChildren
    Add the supplied nodes at the end of the list of children.
  • addSelector
    Add the selectors to this plan node. This method does nothing for any supplied selector that is null
  • addSelectors
    Add the selectors to this plan node. This method does nothing for any supplied selector that is null
  • extractChild
    Remove the child node from this node, and replace that child with its first child (if there is one).
  • findAllAtOrBelow
    Find all of the nodes with one of the specified types that are at or below this node.
  • getChildCount
    Get the number of child nodes.
  • getChildren
    Get the unmodifiable list of child nodes. This list will immediately reflect any changes made to the
  • getFirstChild
    Get the first child.
  • getLastChild
    Get the last child.
  • getParent
    Get the parent of this node.
  • getPathTo
    Get the path from this node (inclusive) to the supplied descendant node (inclusive)
  • getParent,
  • getPathTo,
  • getProperty,
  • getPropertyAsList,
  • getSelectors,
  • getString,
  • getType,
  • hasAncestorOfType,
  • hasProperty,
  • insertAsParent

Popular in Java

  • Updating database using SQL prepared statement
  • getApplicationContext (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • findViewById (Activity)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • JOptionPane (javax.swing)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now