<commit_before>package me.drton.jmavsim.vehicle;

import me.drton.jmavsim.ReportUtil;
import me.drton.jmavsim.ReportingObject;
import me.drton.jmavsim.Rotor;
import me.drton.jmavsim.World;

import javax.vecmath.Vector3d;
import java.io.FileNotFoundException;

/**
 * Abstract multicopter class. Does all necessary calculations for multirotor with any placement of rotors.
 * Only rotors on one plane supported now.
 */
public abstract class AbstractMulticopter extends AbstractVehicle implements ReportingObject {
    private double dragMove = 0.0;
    private double dragRotate = 0.0;
    protected Rotor[] rotors;

    public AbstractMulticopter(World world, String modelName) throws FileNotFoundException {
        super(world, modelName);
        rotors = new Rotor[getRotorsNum()];
        for (int i = 0; i < getRotorsNum(); i++) {
            rotors[i] = new Rotor();
        }
    }

    public void report(StringBuilder builder) {
        builder.append("MULTICOPTER");
        builder.append(newLine);
        builder.append("===========");
        builder.append(newLine);
        builder.append(newLine);

        for (int i = 0; i < getRotorsNum(); i++) {
            builder.append("ROTOR #");
            builder.append(i);
            builder.append(newLine);
            builder.append("--------");
            builder.append(newLine);

            builder.append("Control: ");
            builder.append(rotors[i].getControl());
            builder.append(newLine);

            builder.append("Thrust: ");
            builder.append(rotors[i].getThrust());
            builder.append(" / ");
            builder.append(rotors[i].getFullThrust());
            builder.append(" [N]");
            builder.append(newLine);

            builder.append("Torque: ");
            builder.append(rotors[i].getThrust());
            builder.append(" / ");
            builder.append(rotors[i].getFullTorque());
            builder.append(" [N * m]");
            builder.append(newLine);

            builder.append("Spin up: ");
            builder.append(rotors[i].getTimeConstant());
            builder.append(" [s]");
            builder.append(newLine);

            builder.append("Position: ");
            builder.append(ReportUtil.toShortString(getRotorPosition(i)));
            builder.append(newLine);

            builder.append(newLine);
        }

        builder.append(ReportingObject.newLine);
        builder.append(ReportingObject.newLine);
    }


    /**
     * Get number of rotors.
     *
     * @return number of rotors
     */
    protected abstract int getRotorsNum();

    /**
     * Get rotor position relative to gravity center of vehicle.
     *
     * @param i rotor number
     * @return rotor radius-vector from GC
     */
    protected abstract Vector3d getRotorPosition(int i);

    public void setDragMove(double dragMove) {
        this.dragMove = dragMove;
    }

    public void setDragRotate(double dragRotate) {
        this.dragRotate = dragRotate;
    }

    @Override
    public void update(long t) {
        for (Rotor rotor : rotors) {<commit_msg>Display vehicle control list<commit_after>package me.drton.jmavsim.vehicle;

import me.drton.jmavsim.ReportUtil;
import me.drton.jmavsim.ReportingObject;
import me.drton.jmavsim.Rotor;
import me.drton.jmavsim.World;

import javax.vecmath.Vector3d;
import java.io.FileNotFoundException;

/**
 * Abstract multicopter class. Does all necessary calculations for multirotor with any placement of rotors.
 * Only rotors on one plane supported now.
 */
public abstract class AbstractMulticopter extends AbstractVehicle implements ReportingObject {
    private double dragMove = 0.0;
    private double dragRotate = 0.0;
    protected Rotor[] rotors;

    public AbstractMulticopter(World world, String modelName) throws FileNotFoundException {
        super(world, modelName);
        rotors = new Rotor[getRotorsNum()];
        for (int i = 0; i < getRotorsNum(); i++) {
            rotors[i] = new Rotor();
        }
    }

    public void report(StringBuilder builder) {
        builder.append("MULTICOPTER");
        builder.append(newLine);
        builder.append("===========");
        builder.append(newLine);
        builder.append(newLine);

        builder.append("CONTROLS");
        builder.append(newLine);
        builder.append("--------");
        builder.append(newLine);

        if (getControl().size() > 0) {
            for (int i = 0; i < getControl().size(); i++) {
                builder.append(Double.toString(getControl().get(i)));
                builder.append(newLine);
            }
        } else {
            builder.append("n/a");
            builder.append(newLine);
        }

        builder.append(newLine);

        for (int i = 0; i < getRotorsNum(); i++) {
            reportRotor(builder, i);
        }

        builder.append(ReportingObject.newLine);
        builder.append(ReportingObject.newLine);
    }

    private void reportRotor(StringBuilder builder, int rotorIndex) {
        Rotor rotor = rotors[rotorIndex];

        builder.append("ROTOR #");
        builder.append(rotorIndex);
        builder.append(newLine);
        builder.append("--------");
        builder.append(newLine);

        builder.append("Control: ");
        builder.append(rotor.getControl());
        builder.append(newLine);

        builder.append("Thrust: ");
        builder.append(rotor.getThrust());
        builder.append(" / ");
        builder.append(rotor.getFullThrust());
        builder.append(" [N]");
        builder.append(newLine);

        builder.append("Torque: ");
        builder.append(rotor.getThrust());
        builder.append(" / ");
        builder.append(rotor.getFullTorque());
        builder.append(" [N * m]");
        builder.append(newLine);

        builder.append("Spin up: ");
        builder.append(rotor.getTimeConstant());
        builder.append(" [s]");
        builder.append(newLine);

        builder.append("Position: ");
        builder.append(ReportUtil.toShortString(getRotorPosition(rotorIndex)));
        builder.append(newLine);

        builder.append(newLine);
    }

    /**
     * Get number of rotors.
     *
     * @return number of rotors
     */
    protected abstract int getRotorsNum();

    /**
     * Get rotor position relative to gravity center of vehicle.
     *
     * @param i rotor number
     * @return rotor radius-vector from GC
     */
    protected abstract Vector3d getRotorPosition(int i);

    public void setDragMove(double dragMove) {
        this.dragMove = dragMove;
    }

    public void setDragRotate(double dragRotate) {
        this.dragRotate = dragRotate;
    }

    @Override
    public void update(long t) {
        for (Rotor rotor : rotors) {
{'fraction_non_alphanumeric': 0.12766272189349112, 'fraction_numerical': 0.0026627218934911242, 'mean_word_length': 2.3788105947026486, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 4, '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': '7387215', 'n_tokens_mistral': 1964, 'n_tokens_neox': 1884, 'n_words': 400}