pal.treesearch
Class FreeLeafNode

java.lang.Object
  extended by pal.treesearch.AbstractLeafNode
      extended by pal.treesearch.FreeLeafNode
All Implemented Interfaces:
FreeNode, GeneralTreeComponent

public class FreeLeafNode
extends AbstractLeafNode
implements FreeNode


Constructor Summary
FreeLeafNode(FreeBranch parentBranch, java.lang.String id, GeneralConstructionTool tool)
           
 
Method Summary
 Node buildPALNode(double branchLength, FreeBranch caller)
           
 Node buildPALNodeBase(double branchLength, FreeBranch caller)
           
 Node buildPALNodeES(double branchLength, FreeBranch caller)
           
 FreeBranch extract(FreeBranch caller)
          Instruct the node to extract itself from the two connections that aren't the caller One of the other two connections will become redunant.
 void getAllComponents(java.util.ArrayList store, java.lang.Class componentType)
           
 void getAllComponents(java.util.ArrayList store, java.lang.Class componentType, FreeBranch caller)
          Recurse to all neighbours but caller
 void getAllConnections(java.util.ArrayList store, FreeBranch caller)
           
 ConditionalProbabilityStore getExtendedConditionalProbabilities(double distance, FreeBranch callingBranch, GeneralConstructionTool tool)
           
 ConditionalProbabilityStore getExtendedConditionalProbabilities(double distance, FreeBranch callingBranch, UnconstrainedLikelihoodModel.External external, ConditionalProbabilityStore resultStore, GeneralConstructionTool tool)
           
 ConditionalProbabilityStore getFlatConditionalProbabilities(FreeBranch caller, GeneralConstructionTool tool)
           
 ConditionalProbabilityStore getFlatConditionalProbabilities(FreeBranch callingBranch, UnconstrainedLikelihoodModel.External external, ConditionalProbabilityStore resultStore, GeneralConstructionTool tool)
           
 FreeBranch getLeftBranch(FreeBranch caller)
           
 ConditionalProbabilityStore getLeftExtendedConditionalProbabilities(FreeBranch caller, UnconstrainedLikelihoodModel.External externalCalculator, ConditionalProbabilityStore resultStore)
           
 PatternInfo getLeftPatternInfo(GeneralConstructionTool tool, FreeBranch caller)
           
 PatternInfo getPatternInfo(GeneralConstructionTool tool, FreeBranch caller)
           
 FreeBranch getRightBranch(FreeBranch caller)
           
 ConditionalProbabilityStore getRightExtendedConditionalProbabilities(FreeBranch caller, UnconstrainedLikelihoodModel.External externalCalculator, ConditionalProbabilityStore resultStore)
           
 PatternInfo getRightPatternInfo(GeneralConstructionTool tool, FreeBranch caller)
           
 boolean hasConnection(FreeBranch fb, FreeBranch caller)
           
 boolean hasDirectConnection(FreeBranch fb)
           
 void mark()
           
 void rebuildConnectionPatterns(GeneralConstructionTool tool, FreeBranch caller)
           
 int redirectRebuildPattern(GeneralConstructionTool tool)
          This should only be called by another leaf node on the other end of the connection.
 void setConnectingBranches(FreeBranch[] store, int number)
           
 void swapConnection(FreeBranch original, FreeBranch newConnection)
          Should not do anything but swap branches around
 void swapConnection(FreeBranch original, FreeNode nodeToReplace, FreeBranch newConnection)
          Should preserve tree integrity
 void testLikelihood(FreeBranch caller, GeneralConstructionTool tool)
           
 java.lang.String toString(FreeBranch caller)
           
 void undoToMark()
           
 
Methods inherited from class pal.treesearch.AbstractLeafNode
createNewConstrainedLeafCalculator, createNewFreeLeafCalculator, getLabel, getNumberOfPatterns, getPatternInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FreeLeafNode

public FreeLeafNode(FreeBranch parentBranch,
                    java.lang.String id,
                    GeneralConstructionTool tool)
Method Detail

hasDirectConnection

public boolean hasDirectConnection(FreeBranch fb)
Specified by:
hasDirectConnection in interface FreeNode

mark

public void mark()

undoToMark

public void undoToMark()

hasConnection

public boolean hasConnection(FreeBranch fb,
                             FreeBranch caller)
Specified by:
hasConnection in interface FreeNode

extract

public FreeBranch extract(FreeBranch caller)
Description copied from interface: FreeNode
Instruct the node to extract itself from the two connections that aren't the caller One of the other two connections will become redunant.

Specified by:
extract in interface FreeNode
Returns:
the redundant connection, or null of this node can't extract

getLeftExtendedConditionalProbabilities

public ConditionalProbabilityStore getLeftExtendedConditionalProbabilities(FreeBranch caller,
                                                                           UnconstrainedLikelihoodModel.External externalCalculator,
                                                                           ConditionalProbabilityStore resultStore)

getRightExtendedConditionalProbabilities

public ConditionalProbabilityStore getRightExtendedConditionalProbabilities(FreeBranch caller,
                                                                            UnconstrainedLikelihoodModel.External externalCalculator,
                                                                            ConditionalProbabilityStore resultStore)

getLeftPatternInfo

public PatternInfo getLeftPatternInfo(GeneralConstructionTool tool,
                                      FreeBranch caller)
Specified by:
getLeftPatternInfo in interface FreeNode
Returns:
Get the pattern info for the relative left (from the caller's perspective), or null if not left pattern info

getRightPatternInfo

public PatternInfo getRightPatternInfo(GeneralConstructionTool tool,
                                       FreeBranch caller)
Specified by:
getRightPatternInfo in interface FreeNode
Returns:
Get the pattern info for the relative right (from the caller's perspective), or null if not right pattern info

setConnectingBranches

public void setConnectingBranches(FreeBranch[] store,
                                  int number)
Specified by:
setConnectingBranches in interface FreeNode

testLikelihood

public void testLikelihood(FreeBranch caller,
                           GeneralConstructionTool tool)
Specified by:
testLikelihood in interface FreeNode

swapConnection

public void swapConnection(FreeBranch original,
                           FreeBranch newConnection)
Description copied from interface: FreeNode
Should not do anything but swap branches around

Specified by:
swapConnection in interface FreeNode

swapConnection

public void swapConnection(FreeBranch original,
                           FreeNode nodeToReplace,
                           FreeBranch newConnection)
Description copied from interface: FreeNode
Should preserve tree integrity

Specified by:
swapConnection in interface FreeNode

getLeftBranch

public FreeBranch getLeftBranch(FreeBranch caller)
Specified by:
getLeftBranch in interface FreeNode
Returns:
null (as not possible)

getRightBranch

public FreeBranch getRightBranch(FreeBranch caller)
Specified by:
getRightBranch in interface FreeNode
Returns:
null (as not possible)

getAllConnections

public void getAllConnections(java.util.ArrayList store,
                              FreeBranch caller)

getPatternInfo

public PatternInfo getPatternInfo(GeneralConstructionTool tool,
                                  FreeBranch caller)
Specified by:
getPatternInfo in interface FreeNode

rebuildConnectionPatterns

public void rebuildConnectionPatterns(GeneralConstructionTool tool,
                                      FreeBranch caller)

redirectRebuildPattern

public int redirectRebuildPattern(GeneralConstructionTool tool)
This should only be called by another leaf node on the other end of the connection. In this case we don't have to do much (tree is two node tree)


getFlatConditionalProbabilities

public final ConditionalProbabilityStore getFlatConditionalProbabilities(FreeBranch callingBranch,
                                                                         UnconstrainedLikelihoodModel.External external,
                                                                         ConditionalProbabilityStore resultStore,
                                                                         GeneralConstructionTool tool)

getFlatConditionalProbabilities

public final ConditionalProbabilityStore getFlatConditionalProbabilities(FreeBranch caller,
                                                                         GeneralConstructionTool tool)
Specified by:
getFlatConditionalProbabilities in interface FreeNode

getExtendedConditionalProbabilities

public ConditionalProbabilityStore getExtendedConditionalProbabilities(double distance,
                                                                       FreeBranch callingBranch,
                                                                       UnconstrainedLikelihoodModel.External external,
                                                                       ConditionalProbabilityStore resultStore,
                                                                       GeneralConstructionTool tool)
Specified by:
getExtendedConditionalProbabilities in interface FreeNode

getExtendedConditionalProbabilities

public ConditionalProbabilityStore getExtendedConditionalProbabilities(double distance,
                                                                       FreeBranch callingBranch,
                                                                       GeneralConstructionTool tool)
Specified by:
getExtendedConditionalProbabilities in interface FreeNode

buildPALNode

public final Node buildPALNode(double branchLength,
                               FreeBranch caller)

buildPALNodeES

public final Node buildPALNodeES(double branchLength,
                                 FreeBranch caller)
Specified by:
buildPALNodeES in interface FreeNode

buildPALNodeBase

public final Node buildPALNodeBase(double branchLength,
                                   FreeBranch caller)
Specified by:
buildPALNodeBase in interface FreeNode

toString

public java.lang.String toString(FreeBranch caller)
Specified by:
toString in interface FreeNode

getAllComponents

public void getAllComponents(java.util.ArrayList store,
                             java.lang.Class componentType,
                             FreeBranch caller)
Description copied from interface: FreeNode
Recurse to all neighbours but caller

Specified by:
getAllComponents in interface FreeNode

getAllComponents

public final void getAllComponents(java.util.ArrayList store,
                                   java.lang.Class componentType)
Specified by:
getAllComponents in interface GeneralTreeComponent