Package 

Class treeKt

    • Method Summary

      Modifier and Type Method Description
      final <ERROR CLASS> spanningTree(Number potential) Build a spanning tree.
      final <T extends Any, U extends Any> <ERROR CLASS> spanningTreeExtended(Number potential, Function1<T, U> function, U init) Build a spanning tree.
      final <T extends Any, U extends Any> U applyOnTree(Function1<Unit, T> tree, Boolean condition, Function1<T, U> f, Function1<T, U> g) Assuming to have a spanning tree, apply f where condition holds, g otherwise.
      final <E extends Any, C extends Any, U extends Any> U descendBranch(Number potential, Function1<Boolean, Boolean> filter, Function2<Any, Any, U> f, Function2<Any, Any, U> g) Assuming to have a spanning tree, apply f to the children of the first device where condition holds, g otherwise.
      final <E extends Any, C extends Any, U extends Any> U descendBranchWithNull(Number potential, Number null, Function1<Boolean, Boolean> filter, Function2<Any, Any, U> f, Function2<Any, Any, U> g) Assuming to have a spanning tree, apply f to the children of the first device where condition holds, g otherwise.
      final <E extends Any, C extends Any, U extends Any> U ascendBranch(Number potential, Function1<Boolean, Boolean> filter, Function2<Any, Any, U> f, Function2<Any, Any, U> g) Assuming to have a spanning tree, apply f to the father of any of the devices where condition holds, g otherwise.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • spanningTree

         final <ERROR CLASS> spanningTree(Number potential)

        Build a spanning tree.

        Parameters:
        potential - potential to be followed
      • spanningTreeExtended

         final <T extends Any, U extends Any> <ERROR CLASS> spanningTreeExtended(Number potential, Function1<T, U> function, U init)

        Build a spanning tree.

        Parameters:
        potential - potential to be followed
        function - function to be applied to the parent value
        init - initial value of the device
      • applyOnTree

         final <T extends Any, U extends Any> U applyOnTree(Function1<Unit, T> tree, Boolean condition, Function1<T, U> f, Function1<T, U> g)

        Assuming to have a spanning tree, apply f where condition holds, g otherwise.

        Parameters:
        tree - tree
        condition - condition
        f - what to do if condition is true
        g - what to do if condition is false
      • descendBranch

         final <E extends Any, C extends Any, U extends Any> U descendBranch(Number potential, Function1<Boolean, Boolean> filter, Function2<Any, Any, U> f, Function2<Any, Any, U> g)

        Assuming to have a spanning tree, apply f to the children of the first device where condition holds, g otherwise.

        Parameters:
        potential - potential
        filter - whether to execute f or g according to the parent condition
        f - what to do if condition is true
        g - what to do if condition is false
      • descendBranchWithNull

         final <E extends Any, C extends Any, U extends Any> U descendBranchWithNull(Number potential, Number null, Function1<Boolean, Boolean> filter, Function2<Any, Any, U> f, Function2<Any, Any, U> g)

        Assuming to have a spanning tree, apply f to the children of the first device where condition holds, g otherwise.

        Parameters:
        potential - potential
        null - null potential value
        filter - whether to execute f or g according to the parent condition
        f - what to do if condition is true
        g - what to do if condition is false
      • ascendBranch

         final <E extends Any, C extends Any, U extends Any> U ascendBranch(Number potential, Function1<Boolean, Boolean> filter, Function2<Any, Any, U> f, Function2<Any, Any, U> g)

        Assuming to have a spanning tree, apply f to the father of any of the devices where condition holds, g otherwise.

        Parameters:
        potential - potential
        filter - whether to execute f or g according to the parent condition
        f - what to do if condition is true
        g - what to do if condition is false