<commit_before>package robot.function;

// Libraries
import stackable.*;
import exception.*;

/**
 * Assembly functions - class Arit.
 * Provides the funcions for arithmetic
 * operations (sum, subtractio, multiplication,
 * division and modulus) in the data inside the 
 * stack of the virtual machine.
 * 
 * @author <NAME>
 * @see Function
 * @see RMV
 */
public class Arit
{
    final private Stack DATA;
    
    /**
     * Class constructor. 
     * Receives a handle to the main stack.
     * 
     * @param Stack Data
     */
    Arit(Stack DATA)
    {
        this.DATA = DATA;
    }
    
    /** 
     * Interface for arithmetic operations,
     * Dummy interface with the aim of being a 
     * model for all the arithmetic operations.
     */
    private interface Operation 
    {
        double op(double a, double b);
    }
    
    /**
     * General-model funcion calculate.
     * Takes out the two arguments in the top 
     * of the main stack and pushes the answer
     * of the operation made over them.
     * @param Anonymous inner class of type operation
     */
    final private void calculate(Operation op) 
        throws WrongTypeException,
               StackUnderflowException
    {
        
        Stackable arg1 = DATA.pop();
        Stackable arg2 = DATA.pop();
        
        if(arg1.looksLikeNumber() && arg2.looksLikeNumber())
        {
            Num a = (Num) arg1, b = (Num) arg2;
            double ans = op.op(b.getNumber(), a.getNumber());
            DATA.push(new Num(ans));
        }
        else { throw new WrongTypeException("Num"); }
    }

    void ADD() throws WrongTypeException,
                      StackUnderflowException
    {
        calculate(new Operation() { 
            public double op(double a, double b) { return a+b; } }
        );
    }
    
    void SUB() throws WrongTypeException,
                      StackUnderflowException
    {
        calculate(new Operation() { 
            public double op(double a, double b) { return a-b; } }
        );
    }
    
    void MUL() throws WrongTypeException,
                      StackUnderflowException
    {
        calculate(new Operation() { 
            public double op(double a, double b) { return a*b; } }
        );
    }
    
    void DIV() throws WrongTypeException,
                      StackUnderflowException
    {
        calculate(new Operation() { 
            public double op(double a, double b) { return a/b; } }
        );
    }
    
    void MOD() throws WrongTypeException,
                      StackUnderflowException
    {
        calculate(new Operation() { 
            public double op(double a, double b) { return a/b; } }
        );
    }
}
<commit_msg>Stuff working (finally)<commit_after>package robot.function;

// Libraries
import stackable.*;
import exception.*;

/**
 * Assembly functions - class Arit.
 * Provides the funcions for arithmetic
 * operations (sum, subtractio, multiplication,
 * division and modulus) in the data inside the 
 * stack of the virtual machine.
 * 
 * @author <NAME>
 * @see Function
 * @see RMV
 */
public class Arit
{
    final private Stack DATA;
    
    /**
     * Class constructor. 
     * Receives a handle to the main stack.
     * 
     * @param Stack Data
     */
    Arit(Stack DATA)
    {
        this.DATA = DATA;
    }
    
    /** 
     * Interface for arithmetic operations,
     * Dummy interface with the aim of being a 
     * model for all the arithmetic operations.
     */
    private interface Operation 
    {
        double op(double a, double b);
    }
    
    /**
     * General-model funcion calculate.
     * Takes out the two arguments in the top 
     * of the main stack and pushes the answer
     * of the operation made over them.
     * @param Anonymous inner class of type operation
     */
    final private void calculate(Operation op) 
        throws WrongTypeException,
               StackUnderflowException
    {
        
        Stackable arg1 = DATA.pop();
        Stackable arg2 = DATA.pop();
        
        if(arg1.looksLikeNumber() && arg2.looksLikeNumber())
        {
            Num a = (Num) arg1, b = (Num) arg2;
            double ans = op.op(b.getNumber(), a.getNumber());
            DATA.push(new Num(ans));
        }
        else { throw new WrongTypeException("Num"); }
    }

    void ADD() throws WrongTypeException,
                      StackUnderflowException
    {
        calculate(new Operation() { 
            public double op(double a, double b) { return a+b; } }
        );
    }
    
    void SUB() throws WrongTypeException,
                      StackUnderflowException
    {
        calculate(new Operation() { 
            public double op(double a, double b) { return a-b; } }
        );
    }
    
    void MUL() throws WrongTypeException,
                      StackUnderflowException
    {
        calculate(new Operation() { 
            public double op(double a, double b) { return a*b; } }
        );
    }
    
    void DIV() throws WrongTypeException,
                      StackUnderflowException
    {
        calculate(new Operation() { 
            public double op(double a, double b) { return a/b; } }
        );
    }
    
    void MOD() throws WrongTypeException,
                      StackUnderflowException
    {
        calculate(new Operation() { 
            public double op(double a, double b) { return a%b; } }
        );
    }
}

{'fraction_non_alphanumeric': 0.09147915898192549, 'fraction_numerical': 0.0022132054592401327, 'mean_word_length': 1.7444331983805668, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '789543', 'n_tokens_mistral': 1521, 'n_tokens_neox': 1445, 'n_words': 458}