Tabnine Logo
TreeNode.getIndex
Code IndexAdd Tabnine to your IDE (free)

How to use
getIndex
method
in
phylo.tree.model.TreeNode

Best Java code snippets using phylo.tree.model.TreeNode.getIndex (Showing top 9 results out of 315)

origin: de.unijena.bioinf.phylo/phyloTree-lib.model

/**
 * Returns true if this tree contains the given node
 *
 * @param node the node
 * @return true if tree contains node
 */
public boolean containsVertex(TreeNode node) {
  if (node == null) return false;
  return nodes.get(node.getIndex()) != null && nodes.get(node.getIndex()) == node;
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

public Map<Integer, BCNNode> getResult() {
  //compare(compareTree);
  HashMap<Integer, BCNNode> sscores = new HashMap<Integer, BCNNode>();
  for (TreeNode n : sourceScrores.keySet()) {
    BCNScore score = sourceScrores.get(n);
    sscores.put(n.getIndex(), new BCNNode(score.getScore(), score.getTargetIndex()));
  }
  return sscores;
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

/**
 * Adds a node to the tree.
 */
public int addVertex(TreeNode n) {
  n.setGraph(this);
  nodes.put(n);
  return n.getIndex();
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

/**
 * Create a new {@link Tree} that represents the subtree of this tree rooted at the given
 * node and removes this subtree from this tree. The returned tree is a new tree that contains the original {@link TreeNode}s of this tree.
 * <p>
 * If this tree does not contain the given node, null is returned.
 *
 * @param n the root node of the subtree
 * @return subtree rooted at the given node or null
 */
public List<TreeNode> removeSubtree(TreeNode n) {
  if (n == null) throw new NullPointerException();
  if (nodes.get(n.getIndex()) != n) {
    return null;
  }
  LinkedList<TreeNode> nodes = new LinkedList<>();
  for (TreeNode node : n.depthFirstIterator()) {
    nodes.push(node);
    this.nodes.remove(node.getIndex());
  }
  if (n.incompingEdge != null) {
    n.incompingEdge.getSource().removeEdge(n.incompingEdge);
    n.incompingEdge = null;
  }
  nodes.push(n);
  this.nodes.remove(n.getIndex());
  return nodes;
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

/**
 * Clones this node.
 *
 * @return node the new node
 */
public TreeNode cloneNode() {
  TreeNode n = new TreeNode();
  n.setLabel(getLabel());
  n.setIndex(getIndex());
  return n;
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

if (this.getIndex() == object.getIndex()) {
  return true;
} else {
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

s.setTargetIndex(bcnNode.getIndex());
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

/**
 * Create a new {@link Tree} that represents the subtree of this tree rooted at the given
 * node. The returned tree is a new tree that contains clones of the {@link TreeNode}s of this tree.
 * The node copies are created using {@link TreeNode#cloneNode()} and are
 * new instances, so you will not have object equality ( n != n.cloneNode() ). Node equality using
 * {@link TreeNode#equals(Object)} will work at least for labeled nodes (because the labels are compared), but
 * for performance reasons we do not do deep checks.
 * <p>
 * If this tree does not contain the given node, null is returned.
 *
 * @param n the root node of the subtree
 * @return subtree rooted at the given node or null
 */
public Tree getSubtree(TreeNode n) {
  if (n == null) throw new NullPointerException();
  if (nodes.get(n.getIndex()) != n) {
    return null;
  }
  Tree r = new Tree();
  r.setName(getName());
  TreeNode root = n.cloneNode();
  root.setIndex(-1); // reset index
  r.addVertex(root);
  r.setRoot(root);
  hangIn(root, n, r);
  return r;
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

score.setScore(r.getIndex());
phylo.tree.modelTreeNodegetIndex

Popular methods of TreeNode

  • <init>
    Create a new node with given label
  • childCount
    Returns the number of children of this node.
  • depthFirstIterator
    Returns a depth first Iterable. This enables iterating the subtree rooted at this node in post order
  • getLabel
    The label of this node. If the label is not set, this looks for a label property TreeNodeProperties#
  • getParent
    Return the parent of this node.
  • isInnerNode
    Returns true if this is not a leaf.
  • isLeaf
    Returns true if this node is a leaf.
  • children
    Returns an Iterable over all children of this node. This allow using nodes in foreach loop: for(Tre
  • getChildren
    Get a list of all children of this node. It is helpful if one wants to iterate over all children and
  • getEdgeToParent
    Return the edge to the parent node or null.
  • getLevel
    Lazy and one time computation of the level of this node.
  • getDistanceToParent
    Returns the distance to the parent node. If the node has no parent (root node ) -1 is returned.
  • getLevel,
  • getDistanceToParent,
  • getLeaves,
  • setLabel,
  • cloneNode,
  • equalsNode,
  • getChildAt,
  • getGraph,
  • getPartition

Popular in Java

  • Reactive rest calls using spring rest template
  • setContentView (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setRequestProperty (URLConnection)
  • Menu (java.awt)
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • JTable (javax.swing)
  • Join (org.hibernate.mapping)
  • 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