import org.acplt.oncrpc.*;
import java.io.IOException;

public class CalculServerMain extends CalculServerStub {
    public CalculServerMain() throws OncRpcException, IOException {
        super();
    }

    // Version INT
    @Override
    public int add_1(int a, int b) { return a + b; }
    @Override
    public int sub_1(int a, int b) { return a - b; }
    @Override
    public int mul_1(int a, int b) { return a * b; }
    @Override
    public int div_1(int a, int b) { return b == 0 ? 0 : a / b; }
    @Override
    public int mod_1(int a, int b) { return b == 0 ? 0 : a % b; }
    @Override
    public void calcul_null_1() {}

    // Version FLOAT
    @Override
    public float add_2(float a, float b) { return a + b; }
    @Override
    public float sub_2(float a, float b) { return a - b; }
    @Override
    public float mul_2(float a, float b) { return a * b; }
    @Override
    public float div_2(float a, float b) { return b == 0.0f ? 0.0f : a / b; }
    @Override
    public void calcul_null_2() {}

    public static void main(String[] args) throws Exception {
        System.out.println("Serveur de calcul lancé.");
        CalculServerMain server = new CalculServerMain();
        server.run();
    }
}
