11package org.operatorfoundation.codex
22
3- import org.operatorfoundation.codex.symbols.Power
4- import org.operatorfoundation.codex.symbols.Binary
53import org.operatorfoundation.codex.symbols.Symbol
64
75/* *
@@ -15,7 +13,6 @@ import org.operatorfoundation.codex.symbols.Symbol
1513 */
1614class Decoder (private val symbols : List <Symbol >)
1715{
18-
1916 /* *
2017 * Creates an Encoder instance with the same symbol list.
2118 */
@@ -53,10 +50,11 @@ class Decoder(private val symbols: List<Symbol>)
5350 */
5451 private fun decodeStep (encodedValue : ByteArray , symbol : Symbol , index : Int ): Int
5552 {
56- return if (symbol.size() == 1 ) {
53+ if (symbol.size() == 1 ) {
5754 // Symbols with size 1 don't contribute to the numeric value
5855 println (" decode_step(${encodedValue.decodeToString()} , $symbol , $index )" )
59- 0
56+
57+ return 0
6058 }
6159 else
6260 {
@@ -65,7 +63,7 @@ class Decoder(private val symbols: List<Symbol>)
6563 if (index == symbols.size - 1 )
6664 {
6765 // Last symbol: just return its decoded value
68- symbol.decode(encodedValue)
66+ return symbol.decode(encodedValue)
6967 }
7068 else
7169 {
@@ -80,7 +78,7 @@ class Decoder(private val symbols: List<Symbol>)
8078 val result = symbol.decode(encodedValue) * p
8179 println (" result: $result " )
8280
83- result
81+ return result
8482 }
8583 }
8684 }
0 commit comments