Class Collatz.TreeGraph

  • Enclosing class:
    Collatz

    public static final class Collatz.TreeGraph
    extends Object
    Contains the results of computing the Tree Graph via Collatz.treeGraph(~). Contains the root node of a tree of TreeGraphNode's.
    • Constructor Detail

      • TreeGraph

        public TreeGraph​(BigInteger nodeValue,
                         int maxOrbitDistance,
                         BigInteger p,
                         BigInteger a,
                         BigInteger b)
                  throws Collatz.FailedSaneParameterCheck
        Create a new TreeGraph with the root node defined by the inputs.
        Parameters:
        nodeValue - The value for which to find the tree graph node reversal.
        maxOrbitDistance - The maximum distance/orbit/branch length to travel.
        p - Modulus used to devide n, iff n is equivalent to (0 mod P).
        a - Factor by which to multiply n.
        b - Value to add to the scaled value of n.
        Throws:
        Collatz.FailedSaneParameterCheck - if P or a are 0.
      • TreeGraph

        public TreeGraph​(Collatz.TreeGraphNode root)
        Create a new TreeGraph by directly passing it the root node. Intended to be used in testing by manually creating trees.
        Parameters:
        root - The root node of the tree.
    • Method Detail

      • hashCode

        public int hashCode()
        The hashCode of a TreeGraph is determined by the hash of the root node.
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(Object obj)
        The equality between TreeGraph's is determined by the equality check on subtrees. A subtree check will be done on both TreeGraph's root nodes.
        Overrides:
        equals in class Object