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

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

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

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

/**
 * method returns the intersection size of two leaf sets
 *
 * @param leavesSubTree
 * @param leavesSubCompareTree
 * @return intersectionSize
 */
public static int countCommonLeaves(TreeNode[] leavesSubTree, TreeNode[] leavesSubCompareTree) {
  int intersectionSize = 0;
  for (int i = 0; i < leavesSubTree.length; i++) {
    for (int j = 0; j < leavesSubCompareTree.length; j++) {
      if (leavesSubTree[i].equalsNode(leavesSubCompareTree[j])) {
        intersectionSize++;
        break;
      }
    }
  }
  return intersectionSize;
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

  private boolean findLeaf(TreeNode node, int index) {
//      boolean isIn = false;

//        if(leaves.contains(node)) return true;
//        else return false;

    for (TreeNode leave : leaves) {
      if (leave.equalsNode(node)) return true;
    }
    return false;


//      try{
//          TreeNode l = (TreeNode)leaves.get(index); //   elementAt(index);
//                                          
//          if(l.equals(node)){
//             isIn = true;
//             return isIn;
//          }               
//      }catch (ClassCastException e){
//          isIn = false;
//          index+=1;          
//          if(index<leaves.size()){
//              if(findLeaf(node,index))
//              return true;
//          }           
//      }
//      return isIn;            
  }

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

/**
 * Indicates, if this node is a child of the given node.
 *
 * @param node: the node, that may be parent of this node
 * @return true, if this node is a child of the given node, false otherwise
 */
public boolean isChildOf(TreeNode node) {
  if (this.getParent().equalsNode(node)) {
    return true;
  } else {
    return false;
  }
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

/**
 * Computes the number of the given child for this node.
 * This number is 0 {@literal <=} childNum {@literal <} 'number of children', if the child is a real child of this node.
 * It is childNum = 'number of children', if the given child is parent of this node.
 *
 * @param child: the child, for that its number has to be computed
 * @return the child number for the  given node
 */
public int getChildNumber(TreeNode child) {
  if (this.getParent().equalsNode(child)) {
    return childCount();
  } else if (child.isChildOf(this)) {
    int num = 0;
    for (TreeNode nodesChild : this.children()) {
      if (!nodesChild.equalsNode(child)) {
        num++;
      } else {
        break;
      }
    }
    return num;
  } else {
    throw new RuntimeException("Given child is no child of this node!");
  }
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

  if (leaf.equalsNode(a)) posA = x;
  if (leaf.equalsNode(b)) posB = x;
if (node.equalsNode(a)) posA = x;
if (node.equalsNode(b)) posB = x;
phylo.tree.modelTreeNodeequalsNode

Javadoc

Compares this TreeNode with a given object. If the nodes are in the same Tree, then their indes is compared If they are in different trees, the labels are compared.

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,
  • getChildAt,
  • getGraph,
  • getIndex,
  • getPartition

Popular in Java

  • Start an intent from android
  • onCreateOptionsMenu (Activity)
  • compareTo (BigDecimal)
  • onRequestPermissionsResult (Fragment)
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • 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