AFC - Abacus Formula Compiler for Java

Decompiled Code For HLOOKUP( C108, D$105:G$107, D108 )

The expression

=HLOOKUP( C108, D$105:G$107, D108 )

is compiled to the following class(es):

package org.formulacompiler.gen;
import org.formulacompiler.runtime.Computation;
import org.formulacompiler.runtime.FormulaException;
import org.formulacompiler.runtime.internal.Environment;
import org.formulacompiler.runtime.internal.RuntimeDouble_v2;
import org.formulacompiler.runtime.internal.Runtime_v2;
import org.formulacompiler.tests.reference.base.Inputs;
import org.formulacompiler.tests.reference.base.Outputs;

final class $Root extends Outputs implements Computation
{
    private final Inputs $inputs;
    final Environment $environment;
    private double[] $constarr$0;

    $Root(Inputs inputs, Environment environment) {
        $environment = environment;
        $inputs = inputs;
    }

    final double get$0() {
        return get$3((double) RuntimeDouble_v2.fun_MATCH_Ascending
                              (get$1(), $constarr$0()));
    }

    public final double dbl() {
        return get$0();
    }

    final double get$3(double d) {
        switch ((int) Runtime_v2.checkDouble(get$2())) {
        case 1:
            return $idx$0((int) Runtime_v2.checkDouble(d) - 1);
        case 2:
            return $idx$1((int) Runtime_v2.checkDouble(d) - 1);
        case 3:
            return $idx$2((int) Runtime_v2.checkDouble(d) - 1);
        default:
            Runtime_v2.fun_ERROR
                ("#VALUE/REF! because index is out of range in H/VLOOKUP");
            return (double) -1;
        }
    }

    final double $idx$0(int i) {
        switch (i) {
        case 0:
            return 10.0;
        case 1:
            return 20.0;
        case 2:
            return 30.0;
        case 3:
            return 40.0;
        default:
            throw new FormulaException
                      ("#VALUE/REF! because index is out of range in INDEX");
        }
    }

    final double $idx$1(int i) {
        switch (i) {
        case 0:
            return 11.0;
        case 1:
            return 12.0;
        case 2:
            return 13.0;
        case 3:
            return 14.0;
        default:
            throw new FormulaException
                      ("#VALUE/REF! because index is out of range in INDEX");
        }
    }

    final double $idx$2(int i) {
        switch (i) {
        case 0:
            return 21.0;
        case 1:
            return 22.0;
        case 2:
            return 23.0;
        case 3:
            return 24.0;
        default:
            throw new FormulaException
                      ("#VALUE/REF! because index is out of range in INDEX");
        }
    }

    final double[] $constarr$0() {
        if ($constarr$0 == null)
            $constarr$0 = new double[] { 10.0, 20.0, 30.0, 40.0 };
        return $constarr$0;
    }

    final double get$1() {
        return $inputs.dbl(0);
    }

    final double get$2() {
        return $inputs.dbl(1);
    }
}