package simDataContainers;

import general.LoObject;
import general.Vector;
import nav.FlightEntry;

/**
 * This class is always thread safe
 *
 * @author Johan
 */
public class SelfData implements general.Parsing {

    private static final String parseKey = "Me_data";
    private boolean isF15 = false, isA10 = false, isUS = false;

    @Override
    public String getParseKey() {
        return parseKey;
    }
    public nav.FlightEntry myPos = FlightEntry.defaultEntry;
    public double pitch = 0.5,
            bank = 0.5,
            yaw = 0,
            TAS = 0,
            GSP = 0,
            CAS = 0;
    private String acName = "unknown";

    @Override
    public final int parse(Vector<String> lines, int lineIndex) {
        myPos = new FlightEntry(lines, lineIndex);
        pitch = Double.valueOf(lines.get((lineIndex += 7)));
        bank = Double.valueOf(lines.get(++lineIndex));
        yaw = Double.valueOf(lines.get(++lineIndex));
        TAS = Double.valueOf(lines.get(++lineIndex));
        GSP = Double.valueOf(lines.get(++lineIndex));
        CAS = Double.valueOf(lines.get(++lineIndex));
        acName = LoObject.lookUp(lines.get(++lineIndex)).NCTRname;
        isF15 = acName.equals("F-15");
        isA10 = acName.equals("A-10");
        isUS = isF15 || isA10;
        return ++lineIndex;
    }

    public boolean isF15() {
        return isF15;
    }

    public boolean isA10() {
        return isA10;
    }

    public boolean isUS() {
        return isUS;
    }
}
